From 5adc20ca0623f7d5341cbfadc2f785b4fa6f3012 Mon Sep 17 00:00:00 2001 From: Xiwen JIANG Date: Tue, 18 Aug 2015 17:17:46 +0200 Subject: [PATCH 001/349] patch difference of TM7 dev with svn r7530 to git branch --- cmake_targets/CMakeLists.txt | 1 + common/utils/Makefile.inc | 2 +- openair1/PHY/INIT/lte_init.c | 42 +- .../LTE_ESTIMATION/bf_freq_domain_filters.m | 59 + openair1/PHY/LTE_ESTIMATION/defs.h | 7 + openair1/PHY/LTE_ESTIMATION/filt12_32.h | 72 + .../lte_dl_bf_channel_estimation.c | 96 ++ openair1/PHY/LTE_REFSIG/defs.h | 11 +- openair1/PHY/LTE_REFSIG/lte_dl_ue_spec.c | 393 +++++ openair1/PHY/LTE_REFSIG/lte_dl_uespec.c | 362 ----- openair1/PHY/LTE_REFSIG/lte_gold.c | 42 + openair1/PHY/LTE_TRANSPORT/dlsch_coding.c | 9 +- .../PHY/LTE_TRANSPORT/dlsch_demodulation.c | 795 +++++++++- .../PHY/LTE_TRANSPORT/dlsch_llr_computation.c | 12 +- openair1/PHY/LTE_TRANSPORT/dlsch_modulation.c | 1370 +++++++++-------- openair1/PHY/LTE_TRANSPORT/lte_mcs.c | 15 +- openair1/PHY/LTE_TRANSPORT/pilots_ue_spec.c | 217 +++ openair1/PHY/LTE_TRANSPORT/pmch.c | 5 +- openair1/PHY/LTE_TRANSPORT/proto.h | 49 +- openair1/PHY/MODULATION/slot_fep.c | 9 + openair1/PHY/Makefile.inc | 6 +- openair1/PHY/defs.h | 9 +- openair1/PHY/impl_defs_lte.h | 17 +- openair1/SCHED/phy_procedures_lte_eNb.c | 46 +- openair1/SCHED/phy_procedures_lte_ue.c | 27 +- openair1/SIMULATION/LTE_PHY/dlsim.c | 321 +++- openair1/SIMULATION/LTE_PHY/mbmssim.c | 2 +- targets/ARCH/EXMIMO/USERSPACE/OCTAVE/txsig.m | 18 +- 28 files changed, 2884 insertions(+), 1130 deletions(-) create mode 100644 openair1/PHY/LTE_ESTIMATION/bf_freq_domain_filters.m create mode 100644 openair1/PHY/LTE_ESTIMATION/filt12_32.h create mode 100644 openair1/PHY/LTE_ESTIMATION/lte_dl_bf_channel_estimation.c create mode 100644 openair1/PHY/LTE_REFSIG/lte_dl_ue_spec.c create mode 100644 openair1/PHY/LTE_TRANSPORT/pilots_ue_spec.c diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index 9bb062ba20..e3d2bed6f4 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -754,6 +754,7 @@ set(PHY_SRC ${OPENAIR1_DIR}/PHY/LTE_ESTIMATION/lte_sync_timefreq.c ${OPENAIR1_DIR}/PHY/LTE_ESTIMATION/lte_adjust_sync.c ${OPENAIR1_DIR}/PHY/LTE_ESTIMATION/lte_dl_channel_estimation.c + ${OPENAIR1_DIR}/PHY/LTE_ESTIMATION/lte_dl_bf_channel_estimation.c ${OPENAIR1_DIR}/PHY/LTE_ESTIMATION/lte_dl_mbsfn_channel_estimation.c ${OPENAIR1_DIR}/PHY/LTE_ESTIMATION/lte_ul_channel_estimation.c ${OPENAIR1_DIR}/PHY/LTE_ESTIMATION/lte_est_freq_offset.c diff --git a/common/utils/Makefile.inc b/common/utils/Makefile.inc index b7a1c82379..8c4ebbe31e 100644 --- a/common/utils/Makefile.inc +++ b/common/utils/Makefile.inc @@ -5,7 +5,7 @@ linux := $(shell if [ `uname` = "Linux" ] ; then echo "1" ; else echo "0" ; fi) CFLAGS += -std=gnu99 -#CFLAGS += -Wall -g -ggdb -Wstrict-prototypes -fno-strict-aliasing +CFLAGS += -Wall -g -ggdb -Wstrict-prototypes -fno-strict-aliasing # Need to force this option because default kernel module builder is wrong CFLAGS += $(call cc-option,-mpreferred-stack-boundary=4) diff --git a/openair1/PHY/INIT/lte_init.c b/openair1/PHY/INIT/lte_init.c index 9adbe31916..51c4939c56 100644 --- a/openair1/PHY/INIT/lte_init.c +++ b/openair1/PHY/INIT/lte_init.c @@ -923,14 +923,17 @@ void phy_init_lte_ue__PDSCH( LTE_UE_PDSCH* const pdsch, const LTE_DL_FRAME_PARMS pdsch->llr128_2ndstream = (int16_t**)malloc16_clear( sizeof(int16_t*) ); // FIXME! no further allocation for (int16_t*)pdsch->llr128 !!! expect SIGSEGV - pdsch->rxdataF_ext = (int32_t**)malloc16_clear( 8*sizeof(int32_t*) ); - pdsch->rxdataF_comp0 = (int32_t**)malloc16_clear( 8*sizeof(int32_t*) ); - pdsch->rho = (int32_t**)malloc16_clear( frame_parms->nb_antennas_rx*sizeof(int32_t*) ); - pdsch->dl_ch_estimates_ext = (int32_t**)malloc16_clear( 8*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( 8*sizeof(int32_t*) ); - pdsch->dl_ch_magb0 = (int32_t**)malloc16_clear( 8*sizeof(int32_t*) ); + pdsch->rxdataF_ext = (int32_t**)malloc16_clear( 8*sizeof(int32_t*) ); + pdsch->rxdataF_uespec_pilots = (int32_t**)malloc16_clear( 8*sizeof(int32_t*) ); + pdsch->rxdataF_comp0 = (int32_t**)malloc16_clear( 8*sizeof(int32_t*) ); + pdsch->rho = (int32_t**)malloc16_clear( frame_parms->nb_antennas_rx*sizeof(int32_t*) ); + pdsch->dl_ch_estimates_ext = (int32_t**)malloc16_clear( 8*sizeof(int32_t*) ); + pdsch->dl_bf_ch_estimates = (int32_t**)malloc16_clear( 8*sizeof(int32_t*) ); + pdsch->dl_bf_ch_estimates_ext = (int32_t**)malloc16_clear( 8*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( 8*sizeof(int32_t*) ); + pdsch->dl_ch_magb0 = (int32_t**)malloc16_clear( 8*sizeof(int32_t*) ); // the allocated memory size is fixed: AssertFatal( frame_parms->nb_antennas_rx <= 2, "nb_antennas_rx > 2" ); @@ -941,13 +944,16 @@ void phy_init_lte_ue__PDSCH( LTE_UE_PDSCH* const pdsch, const LTE_DL_FRAME_PARMS for (int j=0; j<4; j++) { //frame_parms->nb_antennas_tx; j++) const int idx = (j<<1)+i; const size_t num = 7*2*frame_parms->N_RB_DL*12; - pdsch->rxdataF_ext[idx] = (int32_t*)malloc16_clear( sizeof(int32_t) * num ); - pdsch->rxdataF_comp0[idx] = (int32_t*)malloc16_clear( sizeof(int32_t) * num ); - pdsch->dl_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->rxdataF_ext[idx] = (int32_t*)malloc16_clear( sizeof(int32_t) * num ); + pdsch->rxdataF_uespec_pilots[idx] = (int32_t*)malloc16_clear( sizeof(int32_t) * frame_parms->N_RB_DL*12); + pdsch->rxdataF_comp0[idx] = (int32_t*)malloc16_clear( sizeof(int32_t) * num ); + 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) * num ); + pdsch->dl_bf_ch_estimates_ext[idx] = (int32_t*)malloc16_clear( sizeof(int32_t)*frame_parms->symbols_per_tti*(frame_parms->ofdm_symbol_size+LTE_CE_FILTER_LENGTH) ); + 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 ); } } } @@ -1268,10 +1274,10 @@ int phy_init_lte_eNB(PHY_VARS_eNB *phy_vars_eNB, if (abstraction_flag==0) { // TX vars - eNB_common_vars->txdata[eNB_id] = (int32_t**)malloc16( frame_parms->nb_antennas_tx*sizeof(int32_t*) ); - eNB_common_vars->txdataF[eNB_id] = (mod_sym_t **)malloc16( frame_parms->nb_antennas_tx*sizeof(mod_sym_t*) ); + eNB_common_vars->txdata[eNB_id] = (int32_t**)malloc16(phy_vars_eNB->nb_antennas_tx_phy*sizeof(int32_t*) ); + eNB_common_vars->txdataF[eNB_id] = (mod_sym_t **)malloc16(phy_vars_eNB->nb_antennas_tx_phy*sizeof(mod_sym_t*) ); - for (i=0; inb_antennas_tx; i++) { + for (i=0; inb_antennas_tx_phy; i++) { #ifdef USER_MODE eNB_common_vars->txdata[eNB_id][i] = (int32_t*)malloc16_clear( FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(int32_t) ); eNB_common_vars->txdataF[eNB_id][i] = (mod_sym_t*)malloc16_clear( FRAME_LENGTH_COMPLEX_SAMPLES_NO_PREFIX*sizeof(mod_sym_t) ); diff --git a/openair1/PHY/LTE_ESTIMATION/bf_freq_domain_filters.m b/openair1/PHY/LTE_ESTIMATION/bf_freq_domain_filters.m new file mode 100644 index 0000000000..557c54dddd --- /dev/null +++ b/openair1/PHY/LTE_ESTIMATION/bf_freq_domain_filters.m @@ -0,0 +1,59 @@ +filter_length = 12; + +F = -3/4:1/4:7/4; +F_l = zeros(8,12); +F_r = zeros(8,12); +F_m = zeros(8,12); + +F2 =-3/5:1/5:8/5; + +for i=0:3 + F_l(i+1,:) = floor(16384*[F(8+i:-1:4) zeros(1,7-i)]); + F_r(i+1,:) = floor(16384*[zeros(1,4+i) F(4:end-i)]); + F_m(i+1,:) = floor(16384*[F(4-i:8) F(7:-1:1+i)]); +end + +for i=0:1 + F_l(i+5,:) = floor(16384*[F(8:-1:4-i) zeros(1,7-i)]); + F_r(i+5,:) = floor(16384*[zeros(1,5+i) F2(5+i) F2(7:end-i)]); + F_m(i+5,:) = floor(16384*[F(4-i:8) F2(8-i) F2(6:-1:1+i)]); +end + +for i=2:3 + F_l(i+5,:) = floor(16384*[F2(end:-1:7) F2(8-i) zeros(1,5)]); + F_r(i+5,:) = floor(16384*[zeros(1,4+i) F(4:end-i)]); + F_m(i+5,:) = floor(16384*[F2(4-i:6) F2(4+i) F(8:-1:1+i)]); +end + + +fd = fopen("filt12_32.h","w"); + +for i=0:3 + fprintf(fd,"short filt12_l%d[12] = {\n",i); + fprintf(fd,"%d,",F_l(i+1,1:end-1)); + fprintf(fd,"%d};\n\n",F_l(i+1,end)); + + fprintf(fd,"short filt12_r%d[12] = {\n",i); + fprintf(fd,"%d,",F_r(i+1,1:end-1)); + fprintf(fd,"%d};\n\n",F_r(i+1,end)); + + fprintf(fd,"short filt12_m%d[12] = {\n",i); + fprintf(fd,"%d,",F_m(i+1,1:end-1)); + fprintf(fd,"%d};\n\n",F_m(i+1,end)); +end + +for i=0:3 + fprintf(fd,"short filt12_l%d_dc[12] = {\n",i); + fprintf(fd,"%d,",F_l(i+5,1:end-1)); + fprintf(fd,"%d};\n\n",F_l(i+5,end)); + + fprintf(fd,"short filt12_r%d_dc[12] = {\n",i); + fprintf(fd,"%d,",F_r(i+5,1:end-1)); + fprintf(fd,"%d};\n\n",F_r(i+5,end)); + + fprintf(fd,"short filt12_m%d_dc[12] = {\n",i); + fprintf(fd,"%d,",F_m(i+5,1:end-1)); + fprintf(fd,"%d};\n\n",F_m(i+5,end)); +end + +fclose(fd); diff --git a/openair1/PHY/LTE_ESTIMATION/defs.h b/openair1/PHY/LTE_ESTIMATION/defs.h index ee8d9d8c6f..4763602525 100644 --- a/openair1/PHY/LTE_ESTIMATION/defs.h +++ b/openair1/PHY/LTE_ESTIMATION/defs.h @@ -124,6 +124,13 @@ int lte_dl_channel_estimation(PHY_VARS_UE *phy_vars_ue, uint8_t symbol); +int lte_dl_bf_channel_estimation(PHY_VARS_UE *phy_vars_ue, + module_id_t eNB_id, + uint8_t eNB_offset, + uint8_t Ns, + uint8_t p, + uint8_t symbol); + int lte_dl_msbfn_channel_estimation(PHY_VARS_UE *phy_vars_ue, module_id_t eNB_id, uint8_t eNB_offset, diff --git a/openair1/PHY/LTE_ESTIMATION/filt12_32.h b/openair1/PHY/LTE_ESTIMATION/filt12_32.h new file mode 100644 index 0000000000..602f7c2c3f --- /dev/null +++ b/openair1/PHY/LTE_ESTIMATION/filt12_32.h @@ -0,0 +1,72 @@ +short filt12_l0[12] = { +16384,12288,8192,4096,0,0,0,0,0,0,0,0}; + +short filt12_r0[12] = { +0,0,0,0,0,4096,8192,12288,16384,20480,24576,28672}; + +short filt12_m0[12] = { +0,4096,8192,12288,16384,12288,8192,4096,0,-4096,-8192,-12288}; + +short filt12_l1[12] = { +20480,16384,12288,8192,4096,0,0,0,0,0,0,0}; + +short filt12_r1[12] = { +0,0,0,0,0,0,4096,8192,12288,16384,20480,24576}; + +short filt12_m1[12] = { +-4096,0,4096,8192,12288,16384,12288,8192,4096,0,-4096,-8192}; + +short filt12_l2[12] = { +24576,20480,16384,12288,8192,4096,0,0,0,0,0,0}; + +short filt12_r2[12] = { +0,0,0,0,0,0,0,4096,8192,12288,16384,20480}; + +short filt12_m2[12] = { +-8192,-4096,0,4096,8192,12288,16384,12288,8192,4096,0,-4096}; + +short filt12_l3[12] = { +28672,24576,20480,16384,12288,8192,4096,0,0,0,0,0}; + +short filt12_r3[12] = { +0,0,0,0,0,0,0,0,4096,8192,12288,16384}; + +short filt12_m3[12] = { +-12288,-8192,-4096,0,4096,8192,12288,16384,12288,8192,4096,0}; + +short filt12_l0_dc[12] = { +16384,12288,8192,4096,0,0,0,0,0,0,0,0}; + +short filt12_r0_dc[12] = { +0,0,0,0,0,3276,9830,13107,16384,19660,22937,26214}; + +short filt12_m0_dc[12] = { +0,4096,8192,12288,16384,13107,6553,3276,0,-3277,-6554,-9831}; + +short filt12_l1_dc[12] = { +16384,12288,8192,4096,0,-4096,0,0,0,0,0,0}; + +short filt12_r1_dc[12] = { +0,0,0,0,0,0,6553,9830,13107,16384,19660,22937}; + +short filt12_m1_dc[12] = { +-4096,0,4096,8192,12288,16384,9830,6553,3276,0,-3277,-6554}; + +short filt12_l2_dc[12] = { +26214,22937,19660,16384,13107,9830,6553,0,0,0,0,0}; + +short filt12_r2_dc[12] = { +0,0,0,0,0,0,0,4096,8192,12288,16384,20480}; + +short filt12_m2_dc[12] = { +-6554,-3277,0,3276,6553,6553,16384,12288,8192,4096,0,-4096}; + +short filt12_l3_dc[12] = { +26214,22937,19660,16384,13107,9830,3276,0,0,0,0,0}; + +short filt12_r3_dc[12] = { +0,0,0,0,0,0,0,0,4096,8192,12288,16384}; + +short filt12_m3_dc[12] = { +-9831,-6554,-3277,0,3276,6553,9830,16384,12288,8192,4096,0}; + diff --git a/openair1/PHY/LTE_ESTIMATION/lte_dl_bf_channel_estimation.c b/openair1/PHY/LTE_ESTIMATION/lte_dl_bf_channel_estimation.c new file mode 100644 index 0000000000..9707b15b35 --- /dev/null +++ b/openair1/PHY/LTE_ESTIMATION/lte_dl_bf_channel_estimation.c @@ -0,0 +1,96 @@ +/******************************************************************************* + OpenAirInterface + Copyright(c) 1999 - 2014 Eurecom + + OpenAirInterface is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + + OpenAirInterface is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with OpenAirInterface.The full GNU General Public License is + included in this distribution in the file called "COPYING". If not, + see . + + Contact Information + OpenAirInterface Admin: openair_admin@eurecom.fr + OpenAirInterface Tech : openair_tech@eurecom.fr + OpenAirInterface Dev : openair4g-devel@eurecom.fr + + Address : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE + + *******************************************************************************/ +#ifdef USER_MODE +#include +#endif +#include "defs.h" +#include "PHY/defs.h" +#include "filt12_32.h" +//#define DEBUG_CH + +/*To be accomplished*/ +int lte_dl_bf_channel_estimation(PHY_VARS_UE *phy_vars_ue, + uint8_t eNB_id, + uint8_t eNB_offset, + unsigned char Ns, + unsigned char p, + unsigned char symbol) +{ + + unsigned char aarx; + int uespec_pilot[9][200]; + short *pil, *rxF; + + //LTE_UE_PDSCH *lte_ue_pdsch_vars = phy_vars_ue->lte_ue_pdsch_vars[eNB_id]; + int **rxdataF = phy_vars_ue->lte_ue_common_vars.rxdataF; + int32_t **dl_bf_ch_estimates = phy_vars_ue->lte_ue_pdsch_vars[eNB_id]->dl_bf_ch_estimates; + + int beamforming_mode = phy_vars_ue->transmission_mode>7?phy_vars_ue->transmission_mode : 0; + + // define interpolation filters + //.... + + //ch_offset = phy_vars_ue->lte_frame_parms.ofdm_symbol_size*symbol; + + //generate ue specific pilots + if(beamforming_mode==7) + lte_dl_ue_spec_rx(phy_vars_ue,&uespec_pilot[p-5][0],Ns,p,0); + else if (beamforming_mode>7) + lte_dl_ue_spec_rx(phy_vars_ue,&uespec_pilot[p-6][0],Ns,p,0); + else if (beamforming_mode==0) + msg("No beamforming is performed.\n"); + else + msg("Beamforming mode not supported yet.\n"); + + + if(beamforming_mode==7) { + + for (aarx=0; aarxlte_frame_parms.nb_antennas_rx;aarx++) { + + /* pil = (short *)&uespec_pilot[0][0]; + rxF = (short *)&rxdataF_uespec[aarx][(symbol-1)/3*frame_parms->N_RB_DL*(3+frame_parms->Ncp)]; + dl_ch = (short *)&dl_bf_ch_estimates[aarx][ch_offset]; + + memset(dl_ch,0,4*(phy_vars_ue->lte_frame_parms.ofdm_symbol_size)); + //estimation and interpolation */ + } + + } else if (beamforming_mode==0){ + msg("No beamforming is performed.\n"); + return(-1); + } else { + msg("Beamforming mode is not supported yet.\n"); + return(-1); + } + + //temporal interpolation + + return(0); + +} diff --git a/openair1/PHY/LTE_REFSIG/defs.h b/openair1/PHY/LTE_REFSIG/defs.h index 2127380565..e9482060a7 100644 --- a/openair1/PHY/LTE_REFSIG/defs.h +++ b/openair1/PHY/LTE_REFSIG/defs.h @@ -52,12 +52,13 @@ unsigned int lte_gold_generic(unsigned int *x1, unsigned int *x2, unsigned char void lte_gold(LTE_DL_FRAME_PARMS *frame_parms,uint32_t lte_gold_table[20][2][14],uint16_t Nid_cell); +void lte_gold_ue_spec(LTE_DL_FRAME_PARMS *frame_parms,uint32_t lte_gold_uespec_table[2][20][2][21],uint16_t Nid_cell, uint16_t *n_idDMRS); + /*!\brief This function generates the LTE Gold sequence (36-211, Sec 7.2), specifically for DL UE-specific reference signals for antenna ports 7..14. @param frame_parms LTE DL Frame parameters @param lte_gold_uespec_table pointer to table where sequences are stored @param Nid_cell Cell Id (to compute sequences for local and adjacent cells) @param n_idDMRS Scrambling identity for TM10*/ -void lte_gold_ue_spec(LTE_DL_FRAME_PARMS *frame_parms,uint32_t lte_gold_uespec_table[2][20][2][21],uint16_t Nid_cell, uint16_t *n_idDMRS); void lte_gold_mbsfn(LTE_DL_FRAME_PARMS *frame_parms,uint32_t lte_gold_mbsfn_table[10][3][42],uint16_t Nid_MBSFN); @@ -84,6 +85,7 @@ int lte_dl_cell_spec(PHY_VARS_eNB *phy_vars_eNB, @param output Output vector for OFDM symbol (Frequency Domain) @param amp Q15 amplitude @param Ns Slot number (0..19) +@param lprime symbol (0,1) @param p antenna index @param SS_flag Flag to indicate special subframe */ @@ -92,6 +94,7 @@ int lte_dl_ue_spec(PHY_VARS_eNB *phy_vars_eNB, mod_sym_t *output, short amp, uint8_t Ns, + uint8_t lprime, uint8_t p, int SS_flag ); @@ -123,6 +126,12 @@ int lte_dl_cell_spec_rx(PHY_VARS_UE *phy_vars_ue, unsigned char l, unsigned char p); +int lte_dl_ue_spec_rx(PHY_VARS_UE *phy_vars_ue, + mod_sym_t *output, + unsigned char Ns, + unsigned char p, + int SS_flag); + int lte_dl_mbsfn_rx(PHY_VARS_UE *phy_vars_ue, int *output, int subframe, diff --git a/openair1/PHY/LTE_REFSIG/lte_dl_ue_spec.c b/openair1/PHY/LTE_REFSIG/lte_dl_ue_spec.c new file mode 100644 index 0000000000..64c4e8782e --- /dev/null +++ b/openair1/PHY/LTE_REFSIG/lte_dl_ue_spec.c @@ -0,0 +1,393 @@ +/******************************************************************************* + OpenAirInterface + Copyright(c) 1999 - 2014 Eurecom + + OpenAirInterface is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + + OpenAirInterface is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with OpenAirInterface.The full GNU General Public License is + included in this distribution in the file called "COPYING". If not, + see . + + Contact Information + OpenAirInterface Admin: openair_admin@eurecom.fr + OpenAirInterface Tech : openair_tech@eurecom.fr + OpenAirInterface Dev : openair4g-devel@eurecom.fr + + Address : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE + + *******************************************************************************/ + +/*! \file PHY/LTE_REFSIG/lte_dl_ue_spec.c +* \brief Top-level routines for generating UE-specific Reference signals from 36-211, V11.3.0 2013-06 +* \author R. Knopp X. Jiang +* \date 2015 +* \version 0.1 +* \company Eurecom +* \email: knopp@eurecom.fr xiwen.jiang@eurecom.fr +* \note +* \warning +*/ + +#ifdef USER_MODE +#include +#include +#endif + +#include "defs.h" +#include "PHY/defs.h" +#include "log.h" + +//extern unsigned int lte_gold_table[3][20][2][14]; +//#define DEBUG_DL_CELL_SPEC + +int Wbar_NCP[8][4] = {{1,1,1,1},{1,-1,1,-1},{1,1,1,1},{1,-1,1,-1},{1,1,-1,-1},{-1,-1,1,1},{1,-1,-1,1},{-1,1,1,-1}}; + +int lte_dl_ue_spec(PHY_VARS_eNB *phy_vars_eNB, + uint8_t UE_id, + mod_sym_t *output, + short amp, + uint8_t Ns, + uint8_t lprime, + uint8_t p, + int SS_flag ) +{ + + mod_sym_t qpsk[4],nqpsk[4]; + int16_t k=0,a; + int mprime,mprime_dword,mprime_qpsk_symb; + unsigned nushift,kprime; + // LTE_eNB_DLSCH_t *dlsch = phy_vars_eNB->dlsch_eNB[UE_id][0]; + + a = (amp*ONE_OVER_SQRT2_Q15)>>15; + ((short *)&qpsk[0])[0] = a; + ((short *)&qpsk[0])[1] = a; + ((short *)&qpsk[1])[0] = -a; + ((short *)&qpsk[1])[1] = a; + ((short *)&qpsk[2])[0] = a; + ((short *)&qpsk[2])[1] = -a; + ((short *)&qpsk[3])[0] = -a; + ((short *)&qpsk[3])[1] = -a; + + ((short *)&nqpsk[0])[0] = -a; + ((short *)&nqpsk[0])[1] = -a; + ((short *)&nqpsk[1])[0] = a; + ((short *)&nqpsk[1])[1] = -a; + ((short *)&nqpsk[2])[0] = -a; + ((short *)&nqpsk[2])[1] = a; + ((short *)&nqpsk[3])[0] = a; + ((short *)&nqpsk[3])[1] = a; + + if (p==5) { + if (SS_flag==0) { + if (phy_vars_eNB->lte_frame_parms.Ncp == NORMAL) { + // this is 3GPP 36-211 6.10.3.2, NORMAL CP, p=5 + + nushift = phy_vars_eNB->lte_frame_parms.Nid_cell%3; + + if(lprime==0){ + kprime=nushift; + }else{ + kprime=(nushift+2*lprime)%4; + } + + k = kprime+phy_vars_eNB->lte_frame_parms.first_carrier_offset; + printf("lte_dl_ue_spec:k=%d\n",k); + + for (mprime=0;mprime<3*phy_vars_eNB->lte_frame_parms.N_RB_DL-1;mprime++) { + mprime_dword = mprime>>4; + mprime_qpsk_symb = mprime&0xf; + + //output[k] = qpsk[(phy_vars_eNB->lte_gold_uespec_port5_table[0][Ns][lprime][ind_dword]>>(2*ind_qpsk_symb))&3]; + output[k] = 0xffffffff; + + k += 4; + if (k >= phy_vars_eNB->lte_frame_parms.ofdm_symbol_size) { + k++; // skip DC carrier + k-=phy_vars_eNB->lte_frame_parms.ofdm_symbol_size; + } + + } + } + } + } else if (p>=7) { + printf("lte_dl_ue_spec:antenna ports >=7 not supported yet!\n"); + } else { + LOG_E(PHY,"Illegal p %d UE specific pilots\n",p); + } + + return(0); +} + + +int lte_dl_ue_spec_rx(PHY_VARS_UE *phy_vars_ue, + mod_sym_t *output, + unsigned char Ns, + unsigned char p, + int SS_flag) +{ + mod_sym_t qpsk[4],nqpsk[4],*qpsk_p,*output_p; + int16_t a; + int w,lprime,mprime,ind,l,ind_dword,ind_qpsk_symb,nPRB; + short pamp; + + // Compute the correct pilot amplitude, sqrt_rho_b = Q3.13 + pamp = ONE_OVER_SQRT2_Q15; + + // This includes complex conjugate for channel estimation + ((short *)&qpsk[0])[0] = pamp; + ((short *)&qpsk[0])[1] = -pamp; + ((short *)&qpsk[1])[0] = -pamp; + ((short *)&qpsk[1])[1] = -pamp; + ((short *)&qpsk[2])[0] = pamp; + ((short *)&qpsk[2])[1] = pamp; + ((short *)&qpsk[3])[0] = -pamp; + ((short *)&qpsk[3])[1] = pamp; + + ((short *)&nqpsk[0])[0] = -pamp; + ((short *)&nqpsk[0])[1] = pamp; + ((short *)&nqpsk[1])[0] = pamp; + ((short *)&nqpsk[1])[1] = pamp; + ((short *)&nqpsk[2])[0] = -pamp; + ((short *)&nqpsk[2])[1] = -pamp; + ((short *)&nqpsk[3])[0] = pamp; + ((short *)&nqpsk[3])[1] = -pamp; + + if (p>=7) { + if (SS_flag==0) { + if (phy_vars_ue->lte_frame_parms.Ncp == NORMAL) { + // this is 3GPP 36-211 6.10.3.2, NORMAL CP, p>=7 + + output_p = output; + + for (lprime=0; lprime<2; lprime++) { + + ind = 3*lprime*phy_vars_ue->lte_frame_parms.N_RB_DL; + l = lprime + ((Ns&1)<<1); + + // loop over pairs of PRBs, this is the periodicity of the W_bar_NCP sequence + // unroll the computations for the 6 pilots, select qpsk or nqpsk as function of W_bar_NCP + for (nPRB=0; nPRBlte_frame_parms.N_RB_DL; nPRB+=2) { + + // First pilot + w = Wbar_NCP[p-7][l]; + qpsk_p = (w==1) ? qpsk : nqpsk; + + + ind_dword = ind>>4; + ind_qpsk_symb = ind&0xf; + + *output_p = qpsk_p[(phy_vars_ue->lte_gold_uespec_table[0][Ns][lprime][ind_dword]>>(2*ind_qpsk_symb))&3]; + + +#ifdef DEBUG_DL_UESPEC + LOG_D(PHY,"Ns %d, l %d, m %d,ind_dword %d, ind_qpsk_symbol %d\n", + Ns,l,m,ind_dword,ind_qpsk_symb); + LOG_D(PHY,"index = %d\n",(phy_vars_eNB->lte_gold_uespec_table[0][Ns][lprime][ind_dword]>>(2*ind_qpsk_symb))&3); +#endif + + output_p++; + ind++; + + w = Wbar_NCP[p-7][3-l]; + qpsk_p = (w==1) ? qpsk : nqpsk; + + // Second pilot + ind_dword = ind>>4; + ind_qpsk_symb = ind&0xf; + + *output_p = qpsk_p[(phy_vars_ue->lte_gold_uespec_table[0][Ns][lprime][ind_dword]>>(2*ind_qpsk_symb))&3]; + +#ifdef DEBUG_DL_UESPEC + LOG_D(PHY,"Ns %d, l %d, m %d,ind_dword %d, ind_qpsk_symbol %d\n", + Ns,l,m,ind_dword,ind_qpsk_symb); + LOG_D(PHY,"index = %d\n",(phy_vars_ue->lte_gold_uespec_table[0][Ns][lprime][ind_dword]>>(2*ind_qpsk_symb))&3); +#endif + + output_p++; + ind++; + + w = Wbar_NCP[p-7][l]; + qpsk_p = (w==1) ? qpsk : nqpsk; + // Third pilot + ind_dword = ind>>4; + ind_qpsk_symb = ind&0xf; + + *output_p = qpsk_p[(phy_vars_ue->lte_gold_uespec_table[0][Ns][lprime][ind_dword]>>(2*ind_qpsk_symb))&3]; + +#ifdef DEBUG_DL_UESPEC + LOG_D(PHY,"Ns %d, l %d, m %d,ind_dword %d, ind_qpsk_symbol %d\n", + Ns,l,m,ind_dword,ind_qpsk_symb); + LOG_D(PHY,"index = %d\n",(phy_vars_eNB->lte_gold_uespec_table[0][Ns][lprime][ind_dword]>>(2*ind_qpsk_symb))&3); +#endif + + output_p++; + ind++; + + // Fourth pilot + w = Wbar_NCP[p-7][3-l]; + qpsk_p = (w==1) ? qpsk : nqpsk; + + + ind_dword = ind>>4; + ind_qpsk_symb = ind&0xf; + + *output_p = qpsk_p[(phy_vars_ue->lte_gold_uespec_table[0][Ns][lprime][ind_dword]>>(2*ind_qpsk_symb))&3]; + + +#ifdef DEBUG_DL_UESPEC + LOG_D(PHY,"Ns %d, l %d, m %d,ind_dword %d, ind_qpsk_symbol %d\n", + Ns,l,m,ind_dword,ind_qpsk_symb); + LOG_D(PHY,"index = %d\n",(phy_vars_ue->lte_gold_uespec_table[0][Ns][lprime][ind_dword]>>(2*ind_qpsk_symb))&3); +#endif + + output_p++; + ind++; + + w = Wbar_NCP[p-7][l]; + qpsk_p = (w==1) ? qpsk : nqpsk; + + // Fifth pilot + ind_dword = ind>>4; + ind_qpsk_symb = ind&0xf; + + *output_p = qpsk_p[(phy_vars_ue->lte_gold_uespec_table[0][Ns][lprime][ind_dword]>>(2*ind_qpsk_symb))&3]; + +#ifdef DEBUG_DL_UESPEC + LOG_D(PHY,"Ns %d, l %d, m %d,ind_dword %d, ind_qpsk_symbol %d\n", + Ns,l,m,ind_dword,ind_qpsk_symb); + LOG_D(PHY,"index = %d\n",(phy_vars_ue->lte_gold_uespec_table[0][Ns][lprime][ind_dword]>>(2*ind_qpsk_symb))&3); +#endif + + output_p++; + ind++; + + w = Wbar_NCP[p-7][3-l]; + qpsk_p = (w==1) ? qpsk : nqpsk; + // Sixth pilot + ind_dword = ind>>4; + ind_qpsk_symb = ind&0xf; + + *output_p = qpsk_p[(phy_vars_ue->lte_gold_uespec_table[0][Ns][lprime][ind_dword]>>(2*ind_qpsk_symb))&3]; + +#ifdef DEBUG_DL_UESPEC + LOG_D(PHY,"Ns %d, l %d, m %d,ind_dword %d, ind_qpsk_symbol %d\n", + Ns,l,m,ind_dword,ind_qpsk_symb); + LOG_D(PHY,"index = %d\n",(phy_vars_ue->lte_gold_uespec_table[0][Ns][lprime][ind_dword]>>(2*ind_qpsk_symb))&3); +#endif + + output_p++; + ind++; + } + } + } else { + LOG_E(PHY,"Special subframe not supported for UE specific pilots yet\n"); + } + } + } else if (p==5) { + if (SS_flag==0) { + if (phy_vars_ue->lte_frame_parms.Ncp == NORMAL) { + + for (lprime=0;lprime<2;lprime++) { + ind = 3*lprime*phy_vars_ue->lte_frame_parms.N_RB_DL; + + for (mprime=0;mprime<3*phy_vars_ue->lte_frame_parms.N_RB_DL-1;mprime++) { + ind_dword = ind>>4; + ind_qpsk_symb = ind&0xf; + *output_p = qpsk_p[(phy_vars_ue->lte_gold_uespec_port5_table[Ns][lprime][ind_dword]>>(2*ind_qpsk_symb))&3]; + *output_p++; + } + } + } + } + } else { + LOG_E(PHY,"Illegal p %d UE specific pilots\n",p); + } + + return(0); +} + + + +#ifdef LTE_DL_CELL_SPEC_MAIN + + + +//extern int write_output(const char *,const char *,void *,int,int,char); +// flag change eren +extern int write_output(const char *,const char *,void *,int,int,char); +main() +{ + + unsigned short Nid_cell=0; + unsigned int Ncp = 0; + int output00[1024]; + int output01[1024]; + int output10[1024]; + int output11[1024]; + + memset(output00,0,1024*sizeof(int)); + memset(output01,0,1024*sizeof(int)); + memset(output10,0,1024*sizeof(int)); + memset(output11,0,1024*sizeof(int)); + + lte_gold(Nid_cell,Ncp); + + lte_dl_ue_spec(output00, + ONE_OVER_SQRT2_Q15, + 50, + Nid_cell, + Ncp, + 0, + 0, + 0, + 0); + + lte_dl_ue_spec(output10, + ONE_OVER_SQRT2_Q15, + 50, + Nid_cell, + Ncp, + 0, + 1, + 0, + 0); + + lte_dl_ue_spec(output01, + ONE_OVER_SQRT2_Q15, + 50, + Nid_cell, + Ncp, + 0, + 0, + 1, + 0); + + lte_dl_ue_spec(output11, + ONE_OVER_SQRT2_Q15, + 50, + Nid_cell, + Ncp, + 0, + 1, + 1, + 0); + + + write_output("dl_ue_spec00.m","dl_cs00",output00,1024,1,1); + write_output("dl_ue_spec01.m","dl_cs01",output01,1024,1,1); + write_output("dl_ue_spec10.m","dl_cs10",output10,1024,1,1); + write_output("dl_ue_spec11.m","dl_cs11",output11,1024,1,1); +} + + +#endif diff --git a/openair1/PHY/LTE_REFSIG/lte_dl_uespec.c b/openair1/PHY/LTE_REFSIG/lte_dl_uespec.c index b40f6ddfda..e69de29bb2 100644 --- a/openair1/PHY/LTE_REFSIG/lte_dl_uespec.c +++ b/openair1/PHY/LTE_REFSIG/lte_dl_uespec.c @@ -1,362 +0,0 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see . - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE - - *******************************************************************************/ - -/*! \file PHY/LTE_REFSIG/lte_dl_uespec.c -* \brief Top-level routines for generating UE-specific Reference signals from 36-211, V11.3.0 2013-06 -* \author R. Knopp -* \date 2014 -* \version 0.1 -* \company Eurecom -* \email: knopp@eurecom.fr -* \note -* \warning -*/ - -#ifdef USER_MODE -#include -#include -#endif - -#include "defs.h" -#include "PHY/defs.h" -#include "log.h" - -//extern unsigned int lte_gold_table[3][20][2][14]; -//#define DEBUG_DL_CELL_SPEC - -int Wbar_NCP[8][4] = {{1,1,1,1},{1,-1,1,-1},{1,1,1,1},{1,-1,1,-1},{1,1,-1,-1},{-1,-1,1,1},{1,-1,-1,1},{-1,1,1,-1}}; - -int lte_dl_ue_spec(PHY_VARS_eNB *phy_vars_eNB, - uint8_t UE_id, - mod_sym_t *output, - short amp, - uint8_t Ns, - uint8_t p, - int SS_flag ) -{ - - mod_sym_t qpsk[4],nqpsk[4],*qpsk_p,*output_p; - int16_t a; - int w,lprime,ind,l,ind_dword,ind_qpsk_symb,nPRB; - // LTE_eNB_DLSCH_t *dlsch = phy_vars_eNB->dlsch_eNB[UE_id][0]; - - a = (amp*ONE_OVER_SQRT2_Q15)>>15; - ((short *)&qpsk[0])[0] = a; - ((short *)&qpsk[0])[1] = a; - ((short *)&qpsk[1])[0] = -a; - ((short *)&qpsk[1])[1] = a; - ((short *)&qpsk[2])[0] = a; - ((short *)&qpsk[2])[1] = -a; - ((short *)&qpsk[3])[0] = -a; - ((short *)&qpsk[3])[1] = -a; - - ((short *)&nqpsk[0])[0] = -a; - ((short *)&nqpsk[0])[1] = -a; - ((short *)&nqpsk[1])[0] = a; - ((short *)&nqpsk[1])[1] = -a; - ((short *)&nqpsk[2])[0] = -a; - ((short *)&nqpsk[2])[1] = a; - ((short *)&nqpsk[3])[0] = a; - ((short *)&nqpsk[3])[1] = a; - - if (p>=7) { - if (SS_flag==0) { - if (phy_vars_eNB->lte_frame_parms.Ncp == NORMAL) { - // this is 3GPP 36-211 6.10.3.2, NORMAL CP, p>=7 - - - - // position output pointer to 5th symbol in slot - output_p = output+(60*phy_vars_eNB->lte_frame_parms.N_RB_DL); - - // shift to 2nd RE in PRB for p=7,8,11,13 - if ((p==7) || (p==8) || (p==11) || (p==13)) output_p++; - - - for (lprime=0; lprime<2; lprime++) { - - ind = 3*lprime*phy_vars_eNB->lte_frame_parms.N_RB_DL; - l = lprime + ((Ns&1)<<1); - - // loop over pairs of PRBs, this is the periodicity of the W_bar_NCP sequence - // unroll the computations for the 6 pilots, select qpsk or nqpsk as function of W_bar_NCP - for (nPRB=0; nPRBlte_frame_parms.N_RB_DL; nPRB+=2) { - - // First pilot - w = Wbar_NCP[p-7][l]; - qpsk_p = (w==1) ? qpsk : nqpsk; - - - ind_dword = ind>>4; - ind_qpsk_symb = ind&0xf; - - *output_p = qpsk_p[(phy_vars_eNB->lte_gold_uespec_table[0][Ns][lprime][ind_dword]>>(2*ind_qpsk_symb))&3]; - - -#ifdef DEBUG_DL_UESPEC - LOG_D(PHY,"Ns %d, l %d, m %d,ind_dword %d, ind_qpsk_symbol %d\n", - Ns,l,m,mprime_dword,mprime_qpsk_symb); - LOG_D(PHY,"index = %d\n",(phy_vars_eNB->lte_gold_uespec_table[0][Ns][lprime][ind_dword]>>(2*ind_qpsk_symb))&3); -#endif - - output_p+=5; - ind++; - - w = Wbar_NCP[p-7][3-l]; - qpsk_p = (w==1) ? qpsk : nqpsk; - - // Second pilot - ind_dword = ind>>4; - ind_qpsk_symb = ind&0xf; - - *output_p = qpsk_p[(phy_vars_eNB->lte_gold_uespec_table[0][Ns][lprime][ind_dword]>>(2*ind_qpsk_symb))&3]; - -#ifdef DEBUG_DL_UESPEC - LOG_D(PHY,"Ns %d, l %d, m %d,ind_dword %d, ind_qpsk_symbol %d\n", - Ns,l,m,mprime_dword,mprime_qpsk_symb); - LOG_D(PHY,"index = %d\n",(phy_vars_eNB->lte_gold_uespec_table[0][Ns][lprime][ind_dword]>>(2*ind_qpsk_symb))&3); -#endif - - output_p+=5; - ind++; - - w = Wbar_NCP[p-7][l]; - qpsk_p = (w==1) ? qpsk : nqpsk; - // Third pilot - ind_dword = ind>>4; - ind_qpsk_symb = ind&0xf; - - *output_p = qpsk_p[(phy_vars_eNB->lte_gold_uespec_table[0][Ns][lprime][ind_dword]>>(2*ind_qpsk_symb))&3]; - -#ifdef DEBUG_DL_UESPEC - LOG_D(PHY,"Ns %d, l %d, m %d,ind_dword %d, ind_qpsk_symbol %d\n", - Ns,l,m,mprime_dword,mprime_qpsk_symb); - LOG_D(PHY,"index = %d\n",(phy_vars_eNB->lte_gold_uespec_table[0][Ns][lprime][ind_dword]>>(2*ind_qpsk_symb))&3); -#endif - - output_p+=2; - ind++; - - // Fourth pilot - w = Wbar_NCP[p-7][3-l]; - qpsk_p = (w==1) ? qpsk : nqpsk; - - - ind_dword = ind>>4; - ind_qpsk_symb = ind&0xf; - - *output_p = qpsk_p[(phy_vars_eNB->lte_gold_uespec_table[0][Ns][lprime][ind_dword]>>(2*ind_qpsk_symb))&3]; - - -#ifdef DEBUG_DL_UESPEC - LOG_D(PHY,"Ns %d, l %d, m %d,ind_dword %d, ind_qpsk_symbol %d\n", - Ns,l,m,mprime_dword,mprime_qpsk_symb); - LOG_D(PHY,"index = %d\n",(phy_vars_eNB->lte_gold_uespec_table[0][Ns][lprime][ind_dword]>>(2*ind_qpsk_symb))&3); -#endif - - output_p+=5; - ind++; - - w = Wbar_NCP[p-7][l]; - qpsk_p = (w==1) ? qpsk : nqpsk; - - // Fifth pilot - ind_dword = ind>>4; - ind_qpsk_symb = ind&0xf; - - *output_p = qpsk_p[(phy_vars_eNB->lte_gold_uespec_table[0][Ns][lprime][ind_dword]>>(2*ind_qpsk_symb))&3]; - -#ifdef DEBUG_DL_UESPEC - LOG_D(PHY,"Ns %d, l %d, m %d,ind_dword %d, ind_qpsk_symbol %d\n", - Ns,l,m,mprime_dword,mprime_qpsk_symb); - LOG_D(PHY,"index = %d\n",(phy_vars_eNB->lte_gold_uespec_table[0][Ns][lprime][ind_dword]>>(2*ind_qpsk_symb))&3); -#endif - - output_p+=5; - ind++; - - w = Wbar_NCP[p-7][3-l]; - qpsk_p = (w==1) ? qpsk : nqpsk; - // Sixth pilot - ind_dword = ind>>4; - ind_qpsk_symb = ind&0xf; - - *output_p = qpsk_p[(phy_vars_eNB->lte_gold_uespec_table[0][Ns][lprime][ind_dword]>>(2*ind_qpsk_symb))&3]; - -#ifdef DEBUG_DL_UESPEC - LOG_D(PHY,"Ns %d, l %d, m %d,ind_dword %d, ind_qpsk_symbol %d\n", - Ns,l,m,mprime_dword,mprime_qpsk_symb); - LOG_D(PHY,"index = %d\n",(phy_vars_eNB->lte_gold_uespec_table[0][Ns][lprime][ind_dword]>>(2*ind_qpsk_symb))&3); -#endif - - output_p+=2; - ind++; - } - } - } else { - LOG_E(PHY,"Special subframe not supported for UE specific pilots yet\n"); - } - } - } else if (p==5) { - LOG_E(PHY,"p=5 not supported for UE specific pilots yet\n"); - } else { - LOG_E(PHY,"Illegal p %d UE specific pilots\n",p); - } - - return(0); -} - -/* -int lte_dl_cell_spec_rx(PHY_VARS_UE *phy_vars_ue, - uint8_t eNB_offset, - int *output, - unsigned char Ns, - unsigned char l, - unsigned char p) { - - - unsigned char mprime,mprime_dword,mprime_qpsk_symb,m; - unsigned short k=0; - unsigned int qpsk[4]; - short pamp; - - // Compute the correct pilot amplitude, sqrt_rho_b = Q3.13 - pamp = ONE_OVER_SQRT2_Q15; - - // This includes complex conjugate for channel estimation - - ((short *)&qpsk[0])[0] = pamp; - ((short *)&qpsk[0])[1] = -pamp; - ((short *)&qpsk[1])[0] = -pamp; - ((short *)&qpsk[1])[1] = -pamp; - ((short *)&qpsk[2])[0] = pamp; - ((short *)&qpsk[2])[1] = pamp; - ((short *)&qpsk[3])[0] = -pamp; - ((short *)&qpsk[3])[1] = pamp; - - mprime = 110 - phy_vars_ue->lte_frame_parms.N_RB_DL; - - for (m=0;mlte_frame_parms.N_RB_DL<<1;m++) { - - mprime_dword = mprime>>4; - mprime_qpsk_symb = mprime&0xf; - - // this is r_mprime from 3GPP 36-211 6.10.1.2 - output[k] = qpsk[(phy_vars_ue->lte_gold_table[eNB_offset][Ns][l][mprime_dword]>>(2*mprime_qpsk_symb))&3]; -#ifdef DEBUG_DL_CELL_SPEC - printf("Ns %d, l %d, m %d,mprime_dword %d, mprime_qpsk_symbol %d\n", - Ns,l,m,mprime_dword,mprime_qpsk_symb); - printf("index = %d (k %d)\n",(phy_vars_ue->lte_gold_table[eNB_offset][Ns][l][mprime_dword]>>(2*mprime_qpsk_symb))&3,k); -#endif - - mprime++; -#ifdef DEBUG_DL_CELL_SPEC - if (m<4) - printf("Ns %d l %d output[%d] = (%d,%d)\n",Ns,l,k,((short *)&output[k])[0],((short *)&output[k])[1]); -#endif - k++; - } - return(0); -} - -*/ - -#ifdef LTE_DL_CELL_SPEC_MAIN - - - -//extern int write_output(const char *,const char *,void *,int,int,char); -// flag change eren -extern int write_output(const char *,const char *,void *,int,int,char); -main() -{ - - unsigned short Nid_cell=0; - unsigned int Ncp = 0; - int output00[1024]; - int output01[1024]; - int output10[1024]; - int output11[1024]; - - memset(output00,0,1024*sizeof(int)); - memset(output01,0,1024*sizeof(int)); - memset(output10,0,1024*sizeof(int)); - memset(output11,0,1024*sizeof(int)); - - lte_gold(Nid_cell,Ncp); - - lte_dl_cell_spec(output00, - ONE_OVER_SQRT2_Q15, - 50, - Nid_cell, - Ncp, - 0, - 0, - 0, - 0); - - lte_dl_cell_spec(output10, - ONE_OVER_SQRT2_Q15, - 50, - Nid_cell, - Ncp, - 0, - 1, - 0, - 0); - - lte_dl_cell_spec(output01, - ONE_OVER_SQRT2_Q15, - 50, - Nid_cell, - Ncp, - 0, - 0, - 1, - 0); - - lte_dl_cell_spec(output11, - ONE_OVER_SQRT2_Q15, - 50, - Nid_cell, - Ncp, - 0, - 1, - 1, - 0); - - - write_output("dl_cell_spec00.m","dl_cs00",output00,1024,1,1); - write_output("dl_cell_spec01.m","dl_cs01",output01,1024,1,1); - write_output("dl_cell_spec10.m","dl_cs10",output10,1024,1,1); - write_output("dl_cell_spec11.m","dl_cs11",output11,1024,1,1); -} - - -#endif diff --git a/openair1/PHY/LTE_REFSIG/lte_gold.c b/openair1/PHY/LTE_REFSIG/lte_gold.c index 2463d73b79..456a2b17d1 100644 --- a/openair1/PHY/LTE_REFSIG/lte_gold.c +++ b/openair1/PHY/LTE_REFSIG/lte_gold.c @@ -142,6 +142,48 @@ void lte_gold_ue_spec(LTE_DL_FRAME_PARMS *frame_parms,uint32_t lte_gold_uespec_t } } +void lte_gold_ue_spec_port5(uint32_t lte_gold_uespec_port5_table[20][2][21],uint16_t Nid_cell, uint16_t n_rnti) +{ + + unsigned char ns,l; + unsigned int n,x1,x2; + + + for (ns=0; ns<20; ns++) { + + for (l=0; l<2; l++) { + + + x2 = ((((ns>>1)+1)*((Nid_cell<<1)+1))<<16) + n_rnti; + //x2 = frame_parms->Ncp + (Nid_cell<<1) + (1+(Nid_cell<<1))*(1 + (3*l) + (7*(1+ns))); //cinit + //n = 0 + // printf("cinit (ns %d, l %d) => %d\n",ns,l,x2); + x1 = 1+ (1<<31); + x2=x2 ^ ((x2 ^ (x2>>1) ^ (x2>>2) ^ (x2>>3))<<31); + + // skip first 50 double words (1600 bits) + //printf("n=0 : x1 %x, x2 %x\n",x1,x2); + for (n=1; n<50; n++) { + x1 = (x1>>1) ^ (x1>>4); + x1 = x1 ^ (x1<<31) ^ (x1<<28); + x2 = (x2>>1) ^ (x2>>2) ^ (x2>>3) ^ (x2>>4); + x2 = x2 ^ (x2<<31) ^ (x2<<30) ^ (x2<<29) ^ (x2<<28); + // printf("x1 : %x, x2 : %x\n",x1,x2); + } + + for (n=0; n<14; n++) { + x1 = (x1>>1) ^ (x1>>4); + x1 = x1 ^ (x1<<31) ^ (x1<<28); + x2 = (x2>>1) ^ (x2>>2) ^ (x2>>3) ^ (x2>>4); + x2 = x2 ^ (x2<<31) ^ (x2<<30) ^ (x2<<29) ^ (x2<<28); + lte_gold_uespec_port5_table[ns][l][n] = x1^x2; + // printf("n=%d : c %x\n",n,x1^x2); + } + + } + } +} + /*! \brief gold sequenquence generator \param x1 \param x2 this should be set to c_init if reset=1 diff --git a/openair1/PHY/LTE_TRANSPORT/dlsch_coding.c b/openair1/PHY/LTE_TRANSPORT/dlsch_coding.c index 5dd2f9b5f9..db95c2362c 100644 --- a/openair1/PHY/LTE_TRANSPORT/dlsch_coding.c +++ b/openair1/PHY/LTE_TRANSPORT/dlsch_coding.c @@ -259,6 +259,7 @@ int dlsch_encoding(unsigned char *a, unsigned char mod_order; unsigned int Kr=0,Kr_bytes,r,r_offset=0; unsigned short m=dlsch->harq_processes[harq_pid]->mcs; + uint8_t transmission_mode_7to9=0; VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_ENCODING, VCD_FUNCTION_IN); @@ -266,7 +267,13 @@ int dlsch_encoding(unsigned char *a, // printf("Encoder: A: %d\n",A); mod_order = get_Qm(dlsch->harq_processes[harq_pid]->mcs); - G = get_G(frame_parms,nb_rb,dlsch->harq_processes[harq_pid]->rb_alloc,mod_order,dlsch->harq_processes[harq_pid]->Nl,num_pdcch_symbols,frame,subframe); + if(dlsch->harq_processes[harq_pid]->mimo_mode == TM7) + transmission_mode_7to9 = 7; + else if(dlsch->harq_processes[harq_pid]->mimo_mode == TM8) + transmission_mode_7to9 = 8; + else if(dlsch->harq_processes[harq_pid]->mimo_mode == TM9_10) + transmission_mode_7to9 = 9; + G = get_G(frame_parms,nb_rb,dlsch->harq_processes[harq_pid]->rb_alloc,mod_order,dlsch->harq_processes[harq_pid]->Nl,num_pdcch_symbols,frame,subframe,transmission_mode_7to9); // if (dlsch->harq_processes[harq_pid]->Ndi == 1) { // this is a new packet diff --git a/openair1/PHY/LTE_TRANSPORT/dlsch_demodulation.c b/openair1/PHY/LTE_TRANSPORT/dlsch_demodulation.c index a1f1173ede..3aa3f72312 100644 --- a/openair1/PHY/LTE_TRANSPORT/dlsch_demodulation.c +++ b/openair1/PHY/LTE_TRANSPORT/dlsch_demodulation.c @@ -1,4 +1,4 @@ -/******************************************************************************* +/****************************************************************************** OpenAirInterface Copyright(c) 1999 - 2014 Eurecom @@ -74,7 +74,6 @@ unsigned char offset_mumimo_llr_drange[29][3]={{7, 8, 7},{6, 6, 7},{6, 6, 7},{6, */ unsigned char offset_mumimo_llr_drange[29][3]= {{0, 6, 5},{0, 4, 5},{0, 4, 5},{0, 5, 4},{0, 5, 6},{0, 5, 3},{0, 4, 4},{0, 4, 4},{0, 3, 3},{0, 1, 2},{1, 1, 0},{1, 3, 2},{3, 4, 1},{2, 0, 0},{2, 2, 2},{1, 1, 1},{2, 1, 0},{2, 1, 1},{1, 0, 1},{1, 0, 1},{0, 0, 0},{1, 0, 0},{0, 0, 0},{0, 1, 0},{1, 0, 0},{0, 0, 0},{0, 0, 0},{0, 0, 0},{0, 0, 0}}; - extern void print_shorts(char *s,__m128i *x); int rx_pdsch(PHY_VARS_UE *phy_vars_ue, @@ -99,6 +98,8 @@ int rx_pdsch(PHY_VARS_UE *phy_vars_ue, unsigned short nb_rb; int avgs, rb; LTE_DL_UE_HARQ_t *dlsch0_harq,*dlsch1_harq = 0; + + uint8_t beamforming_mode = phy_vars_ue->transmission_mode[eNB_id]<7?0:phy_vars_ue->transmission_mode[eNB_id]; switch (type) { case SI_PDSCH: @@ -162,7 +163,7 @@ int rx_pdsch(PHY_VARS_UE *phy_vars_ue, pilots=0; */ - if (frame_parms->nb_antennas_tx_eNB>1) { + if (frame_parms->nb_antennas_tx_eNB>1 && beamforming_mode==0) { #ifdef DEBUG_DLSCH_MOD LOG_I(PHY,"dlsch: using pmi %x (%p), rb_alloc %x\n",pmi2hex_2Ar1(dlsch0_harq->pmi_alloc),dlsch_ue[0],dlsch0_harq->rb_alloc[0]); #endif @@ -204,8 +205,7 @@ int rx_pdsch(PHY_VARS_UE *phy_vars_ue, phy_vars_ue->high_speed_flag, frame_parms); } - } // if n_tx>1 - else { + } else if (beamforming_mode==0) {// if n_tx>1 nb_rb = dlsch_extract_rbs_single(lte_ue_common_vars->rxdataF, lte_ue_common_vars->dl_ch_estimates[eNB_id], lte_ue_pdsch_vars[eNB_id]->rxdataF_ext, @@ -244,7 +244,21 @@ int rx_pdsch(PHY_VARS_UE *phy_vars_ue, phy_vars_ue->high_speed_flag, frame_parms); } - } //else n_tx>1 + } else if (beamforming_mode==7) { //else n_tx>1 + nb_rb = dlsch_extract_rbs_TM7(lte_ue_common_vars->rxdataF, + lte_ue_common_vars->dl_ch_estimates[eNB_id], + lte_ue_pdsch_vars[eNB_id]->rxdataF_ext, + lte_ue_pdsch_vars[eNB_id]->dl_ch_estimates_ext, + dlsch0_harq->rb_alloc, + symbol, + subframe, + phy_vars_ue->high_speed_flag, + frame_parms); + + + } else if(beamforming_mode>7) { + LOG_W(PHY,"dlsch_demodulation:beamforming mode not supported yet.\n"); + } // printf("nb_rb = %d, eNB_id %d\n",nb_rb,eNB_id); if (nb_rb==0) { @@ -418,7 +432,7 @@ int rx_pdsch(PHY_VARS_UE *phy_vars_ue, } } else if (dlsch0_harq->mimo_moden_connected_eNB)) { // TM5 two-user // Scale the channel estimates for interfering stream @@ -531,6 +545,21 @@ int rx_pdsch(PHY_VARS_UE *phy_vars_ue, lte_ue_pdsch_vars[eNB_id]->log2_maxh, 1); } + } else if (dlsch0_harq->mimo_mode==TM7) { //TM7 + + dlsch_channel_compensation(lte_ue_pdsch_vars[eNB_id]->rxdataF_ext, + lte_ue_pdsch_vars[eNB_id]->dl_ch_estimates_ext, + lte_ue_pdsch_vars[eNB_id]->dl_ch_mag0, + lte_ue_pdsch_vars[eNB_id]->dl_ch_magb0, + lte_ue_pdsch_vars[eNB_id]->rxdataF_comp0, + (aatx>1) ? lte_ue_pdsch_vars[eNB_id]->rho : NULL, + frame_parms, + symbol, + first_symbol_flag, + get_Qm(dlsch0_harq->mcs), + nb_rb, + lte_ue_pdsch_vars[eNB_id]->log2_maxh, + phy_measurements); // log2_maxh+I0_shift } // printf("MRC\n"); @@ -570,8 +599,8 @@ int rx_pdsch(PHY_VARS_UE *phy_vars_ue, // printf("Combining"); if ((dlsch0_harq->mimo_mode == SISO) || ((dlsch0_harq->mimo_mode >= UNIFORM_PRECODING11) && - (dlsch0_harq->mimo_mode <= PUSCH_PRECODING0))) { - + (dlsch0_harq->mimo_mode <= PUSCH_PRECODING0)) || + (dlsch0_harq->mimo_mode == TM7)) { /* dlsch_siso(frame_parms, lte_ue_pdsch_vars[eNB_id]->rxdataF_comp, @@ -608,7 +637,8 @@ int rx_pdsch(PHY_VARS_UE *phy_vars_ue, lte_ue_pdsch_vars[eNB_id]->llr[0], symbol,first_symbol_flag,nb_rb, adjust_G2(frame_parms,dlsch0_harq->rb_alloc,2,subframe,symbol), - lte_ue_pdsch_vars[eNB_id]->llr128); + lte_ue_pdsch_vars[eNB_id]->llr128, + beamforming_mode); else if (i_mod == 2) { dlsch_qpsk_qpsk_llr(frame_parms, lte_ue_pdsch_vars[eNB_id]->rxdataF_comp0, @@ -4178,8 +4208,745 @@ unsigned short dlsch_extract_rbs_dual(int **rxdataF, return(nb_rb/frame_parms->nb_antennas_rx); } -//============================================================================================== -// Auxiliary functions +unsigned short dlsch_extract_rbs_TM7(int **rxdataF, + int **dl_ch_estimates, + int **rxdataF_ext, + int **dl_ch_estimates_ext, + unsigned int *rb_alloc, + unsigned char symbol, + unsigned char subframe, + uint32_t high_speed_flag, + LTE_DL_FRAME_PARMS *frame_parms) +{ + + unsigned short rb,nb_rb=0; + unsigned char rb_alloc_ind; + unsigned char i,aarx,l,nsymb,skip_half=0,sss_symb,pss_symb=0; + int *dl_ch0,*dl_ch0_ext,*rxF,*rxF_ext,*rxF_uespec; + + unsigned char symbol_mod,pilots=0,uespec_pilots=0,j=0,k=0,poffset=0,uespec_poffset=0; + int8_t uespec_nushift = frame_parms->Nid_cell%3; + + symbol_mod = (symbol>=(7-frame_parms->Ncp)) ? symbol-(7-frame_parms->Ncp) : symbol; + pilots = ((symbol_mod==0)||(symbol_mod==(4-frame_parms->Ncp))) ? 1 : 0; + l=symbol; + nsymb = (frame_parms->Ncp==NORMAL) ? 14:12; + + if (frame_parms->Ncp==0){ + if (symbol==3 || symbol==6 || symbol==9 || symbol==12) + uespec_pilots = 1; + } else{ + if (symbol==4 || symbol==7 || symbol==10) + uespec_pilots = 1; + } + + if (frame_parms->frame_type == TDD) { // TDD + sss_symb = nsymb-1; + pss_symb = 2; + } else { + sss_symb = (nsymb>>1)-2; + pss_symb = (nsymb>>1)-1; + } + + if (symbol_mod==(4-frame_parms->Ncp)) + poffset=3; + + if ((frame_parms->Ncp==0 && (symbol==6 ||symbol ==12)) || (frame_parms->Ncp==1 && symbol==7)) + uespec_poffset=2; + + for (aarx=0; aarxnb_antennas_rx; aarx++) { + + if (high_speed_flag == 1) + dl_ch0 = &dl_ch_estimates[aarx][5+(symbol*(frame_parms->ofdm_symbol_size))]; + else + dl_ch0 = &dl_ch_estimates[aarx][5]; + + dl_ch0_ext = &dl_ch_estimates_ext[aarx][symbol*(frame_parms->N_RB_DL*12)]; + + rxF_ext = &rxdataF_ext[aarx][symbol*(frame_parms->N_RB_DL*12)]; + rxF = &rxdataF[aarx][(frame_parms->first_carrier_offset + (symbol*(frame_parms->ofdm_symbol_size)))]; + printf("symbol:%d, (symbol-1)/3:%d\n",symbol,(symbol-1)/3); + //rxF_uespec = &rxdataF_uespec_pilots[aarx][(symbol-1)/3*frame_parms->N_RB_DL*(3+frame_parms->Ncp)]; + //printf("symbol, rxF_uespec offset:%d\n",symbol,(symbol-1)/3*frame_parms->N_RB_DL*(3+frame_parms->Ncp)); + + if ((frame_parms->N_RB_DL&1) == 0) // even number of RBs + for (rb=0; rbN_RB_DL; rb++) { + + if (rb < 32) + rb_alloc_ind = (rb_alloc[0]>>rb) & 1; + else if (rb < 64) + rb_alloc_ind = (rb_alloc[1]>>(rb-32)) & 1; + else if (rb < 96) + rb_alloc_ind = (rb_alloc[2]>>(rb-64)) & 1; + else if (rb < 100) + rb_alloc_ind = (rb_alloc[3]>>(rb-96)) & 1; + else + rb_alloc_ind = 0; + + // For second half of RBs skip DC carrier + if (rb==(frame_parms->N_RB_DL>>1)) { + rxF = &rxdataF[aarx][(1 + (symbol*(frame_parms->ofdm_symbol_size)))]; + //dl_ch0++; + } + + if (rb_alloc_ind==1) { + //*pmi_ext = (pmi>>((rb>>2)<<1))&3; + memcpy(dl_ch0_ext,dl_ch0,12*sizeof(int)); + + /* + printf("rb %d\n",rb); + for (i=0;i<12;i++) + printf("(%d %d)",((short *)dl_ch0)[i<<1],((short*)dl_ch0)[1+(i<<1)]); + printf("\n"); + */ + if (pilots==0 && uespec_pilots==0) { + for (i=0; i<12; i++) { + rxF_ext[i]=rxF[i]; + /* + printf("%d : (%d,%d)\n",(rxF+i-&rxdataF[aarx][( (symbol*(frame_parms->ofdm_symbol_size)))]), + ((short*)&rxF[i])[0],((short*)&rxF[i])[1]);*/ + } + + dl_ch0_ext+=12; + rxF_ext+=12; + } else if(pilots==1 && uespec_pilots==0) { + j=0; + + for (i=0; i<12; i++) { + if ((i!=(frame_parms->nushift+poffset)) && + (i!=((frame_parms->nushift+poffset+6)%12))) { + rxF_ext[j]=rxF[i]; + // printf("extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[j],*(1+(short*)&rxF_ext[j])); + dl_ch0_ext[j++]=dl_ch0[i]; + + } + } + + dl_ch0_ext+=10; + rxF_ext+=10; + + } else if (pilots==0 && uespec_pilots==1) { + j=0; + k=0; + + for (i=0; i<12; i++){ + if (frame_parms->Ncp==0){ + if (i!=uespec_nushift+uespec_poffset && i!=uespec_nushift+uespec_poffset+4 && i!=(uespec_nushift+uespec_poffset+8)%12){ + rxF_ext[j] = rxF[i]; + dl_ch0_ext[j++]=dl_ch0[i]; + } + } else{ + if (i!=uespec_nushift+uespec_poffset && i!=uespec_nushift+uespec_poffset+3 && i!=uespec_nushift+uespec_poffset+6 && i!=(uespec_nushift+uespec_poffset+9)%12){ + rxF_ext[j] = rxF[i]; + dl_ch0_ext[j++]=dl_ch0[i]; + } + } + + } + + dl_ch0_ext+=9-frame_parms->Ncp; + rxF_ext+=9-frame_parms->Ncp; + + } else { + msg("dlsch_extract_rbs_TM7(dl_demodulation.c):pilot or ue spec pilot detection error\n"); + exit(-1); + } + + nb_rb++; + } + + dl_ch0+=12; + rxF+=12; + + } + else { // Odd number of RBs + for (rb=0; rbN_RB_DL>>1; rb++) { + // printf("dlch_ext %d\n",dl_ch0_ext-&dl_ch_estimates_ext[aarx][0]); + skip_half=0; + + if (rb < 32) + rb_alloc_ind = (rb_alloc[0]>>rb) & 1; + else if (rb < 64) + rb_alloc_ind = (rb_alloc[1]>>(rb-32)) & 1; + else if (rb < 96) + rb_alloc_ind = (rb_alloc[2]>>(rb-64)) & 1; + else if (rb < 100) + rb_alloc_ind = (rb_alloc[3]>>(rb-96)) & 1; + else + rb_alloc_ind = 0; + + + // PBCH + if ((subframe==0) && (rb>((frame_parms->N_RB_DL>>1)-3)) && (rb<((frame_parms->N_RB_DL>>1)+3)) && (l>=(nsymb>>1)) && (l<((nsymb>>1) + 4))) { + rb_alloc_ind = 0; + } + + //PBCH subframe 0, symbols nsymb>>1 ... nsymb>>1 + 3 + if ((subframe==0) && (rb==((frame_parms->N_RB_DL>>1)-3)) && (l>=(nsymb>>1)) && (l<((nsymb>>1) + 4))) + skip_half=1; + else if ((subframe==0) && (rb==((frame_parms->N_RB_DL>>1)+3)) && (l>=(nsymb>>1)) && (l<((nsymb>>1) + 4))) + skip_half=2; + + //SSS + + if (((subframe==0)||(subframe==5)) && + (rb>((frame_parms->N_RB_DL>>1)-3)) && + (rb<((frame_parms->N_RB_DL>>1)+3)) && + (l==sss_symb) ) { + rb_alloc_ind = 0; + } + + //SSS + if (((subframe==0)||(subframe==5)) && + (rb==((frame_parms->N_RB_DL>>1)-3)) && + (l==sss_symb)) + skip_half=1; + else if (((subframe==0)||(subframe==5)) && + (rb==((frame_parms->N_RB_DL>>1)+3)) && + (l==sss_symb)) + skip_half=2; + + //PSS in subframe 0/5 if FDD + if (frame_parms->frame_type == FDD) { //FDD + if (((subframe==0)||(subframe==5)) && (rb>((frame_parms->N_RB_DL>>1)-3)) && (rb<((frame_parms->N_RB_DL>>1)+3)) && (l==pss_symb) ) { + rb_alloc_ind = 0; + } + + if (((subframe==0)||(subframe==5)) && (rb==((frame_parms->N_RB_DL>>1)-3)) && (l==pss_symb)) + skip_half=1; + else if (((subframe==0)||(subframe==5)) && (rb==((frame_parms->N_RB_DL>>1)+3)) && (l==pss_symb)) + skip_half=2; + } + + if ((frame_parms->frame_type == TDD) && + (subframe==6)) { //TDD Subframe 6 + if ((rb>((frame_parms->N_RB_DL>>1)-3)) && (rb<((frame_parms->N_RB_DL>>1)+3)) && (l==pss_symb) ) { + rb_alloc_ind = 0; + } + + if ((rb==((frame_parms->N_RB_DL>>1)-3)) && (l==pss_symb)) + skip_half=1; + else if ((rb==((frame_parms->N_RB_DL>>1)+3)) && (l==pss_symb)) + skip_half=2; + } + + + if (rb_alloc_ind==1) { + // printf("rb %d/symbol %d (skip_half %d)\n",rb,l,skip_half); + + if (pilots==0 && uespec_pilots==0) { + // printf("Extracting w/o pilots (symbol %d, rb %d, skip_half %d)\n",l,rb,skip_half); + + if (skip_half==1) { + memcpy(dl_ch0_ext,dl_ch0,6*sizeof(int)); + + for (i=0; i<6; i++) + rxF_ext[i]=rxF[i]; + + dl_ch0_ext+=6; + rxF_ext+=6; + } else if (skip_half==2) { + memcpy(dl_ch0_ext,dl_ch0+6,6*sizeof(int)); + + for (i=0; i<6; i++) + rxF_ext[i]=rxF[(i+6)]; + + dl_ch0_ext+=6; + rxF_ext+=6; + } else { + memcpy(dl_ch0_ext,dl_ch0,12*sizeof(int)); + + for (i=0; i<12; i++) + rxF_ext[i]=rxF[i]; + + dl_ch0_ext+=12; + rxF_ext+=12; + } + } else if (pilots==1 && uespec_pilots==0){ + // printf("Extracting with pilots (symbol %d, rb %d, skip_half %d)\n",l,rb,skip_half); + j=0; + + if (skip_half==1) { + for (i=0; i<6; i++) { + if (i!=((frame_parms->nushift+poffset)%6)) { + rxF_ext[j]=rxF[i]; + // printf("extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[j],*(1+(short*)&rxF_ext[j])); + dl_ch0_ext[j++]=dl_ch0[i]; + } + } + + dl_ch0_ext+=5; + rxF_ext+=5; + } else if (skip_half==2) { + for (i=0; i<6; i++) { + if (i!=((frame_parms->nushift+poffset)%6)) { + rxF_ext[j]=rxF[(i+6)]; + // printf("extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[j],*(1+(short*)&rxF_ext[j])); + dl_ch0_ext[j++]=dl_ch0[i+6]; + } + } + + dl_ch0_ext+=5; + rxF_ext+=5; + } else { + for (i=0; i<12; i++) { + if ((i!=(frame_parms->nushift+poffset)) && + (i!=((frame_parms->nushift+poffset+6)%12))) { + rxF_ext[j]=rxF[i]; + // printf("extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[j],*(1+(short*)&rxF_ext[j])); + dl_ch0_ext[j++]=dl_ch0[i]; + + } + } + + dl_ch0_ext+=10; + rxF_ext+=10; + } + } else if(pilots==0 && uespec_pilots==1){ + //printf("Extracting with uespec pilots (symbol %d, rb %d, skip_half %d)\n",l,rb,skip_half); + j=0; + k=0; + + if (skip_half==1) { + if (frame_parms->Ncp==0){ + for (i=0; i<6; i++) { + if (i!=uespec_nushift+uespec_poffset && i!=uespec_nushift+uespec_poffset+4 && i!=(uespec_nushift+uespec_poffset+8)%12){ + rxF_ext[j]=rxF[i]; + dl_ch0_ext[j++]=dl_ch0[i]; + } + } + dl_ch0_ext+=6-(uespec_nushift+uespec_poffset<6)-(uespec_nushift+uespec_poffset+4<6)-((uespec_nushift+uespec_poffset+8)%12<6); + rxF_ext+=6-(uespec_nushift+uespec_poffset<6)-(uespec_nushift+uespec_poffset+4<6)-((uespec_nushift+uespec_poffset+8)%12<6); + + } else{ + for (i=0; i<6; i++) { + if (i!=uespec_nushift+uespec_poffset && i!=uespec_nushift+uespec_poffset+3 && i!=uespec_nushift+uespec_poffset+6 && i!=(uespec_nushift+uespec_poffset+9)%12){ + rxF_ext[j]=rxF[i]; + dl_ch0_ext[j++]=dl_ch0[i]; + } + } + dl_ch0_ext+=4; + rxF_ext+=4; + } + + } else if (skip_half==2) { + if(frame_parms->Ncp==0){ + for (i=0; i<6; i++) { + if (i!=uespec_nushift+uespec_poffset && i!=uespec_nushift+uespec_poffset+4 && i!=(uespec_nushift+uespec_poffset+8)%12){ + rxF_ext[j]=rxF[(i+6)]; + dl_ch0_ext[j++]=dl_ch0[i+6]; + } + } + dl_ch0_ext+=6-(uespec_nushift+uespec_poffset>6)-(uespec_nushift+uespec_poffset+4>6)-((uespec_nushift+uespec_poffset+8)%12>6); + rxF_ext+=6-(uespec_nushift+uespec_poffset>6)-(uespec_nushift+uespec_poffset+4>6)-((uespec_nushift+uespec_poffset+8)%12>6); + + } else { + for (i=0; i<6; i++) { + if (i!=uespec_nushift+uespec_poffset && i!=uespec_nushift+uespec_poffset+3 && i!=uespec_nushift+uespec_poffset+6 && i!=(uespec_nushift+uespec_poffset+9)%12){ + rxF_ext[j]=rxF[(i+6)]; + dl_ch0_ext[j++]=dl_ch0[i+6]; + } + } + dl_ch0_ext+=4; + rxF_ext+=4; + } + + } else { + + for (i=0; i<12; i++){ + if (frame_parms->Ncp==0){ + if (i!=uespec_nushift+uespec_poffset && i!=uespec_nushift+uespec_poffset+4 && i!=(uespec_nushift+uespec_poffset+8)%12){ + rxF_ext[j] = rxF[i]; + dl_ch0_ext[j++] = dl_ch0[i]; + } + } else{ + if (i!=uespec_nushift+uespec_poffset && i!=uespec_nushift+uespec_poffset+3 && i!=uespec_nushift+uespec_poffset+6 && i!=(uespec_nushift+uespec_poffset+9)%12){ + rxF_ext[j] = rxF[i]; + dl_ch0_ext[j++]=dl_ch0[i]; + } + } + + } + + dl_ch0_ext+=9-frame_parms->Ncp; + rxF_ext+=9-frame_parms->Ncp; + } + + } else { + msg("dlsch_extract_rbs_TM7(dl_demodulation.c):pilot or ue spec pilot detection error\n"); + exit(-1); + + } + + nb_rb++; + } + + dl_ch0+=12; + rxF+=12; + } // first half loop + + + // Do middle RB (around DC) + if (rb < 32) + rb_alloc_ind = (rb_alloc[0]>>rb) & 1; + else if (rb < 64) + rb_alloc_ind = (rb_alloc[1]>>(rb-32)) & 1; + else if (rb < 96) + rb_alloc_ind = (rb_alloc[2]>>(rb-64)) & 1; + else if (rb < 100) + rb_alloc_ind = (rb_alloc[3]>>(rb-96)) & 1; + else + rb_alloc_ind = 0; + + + + // PBCH + if ((subframe==0) && (rb>=((frame_parms->N_RB_DL>>1)-3)) && (rb<((frame_parms->N_RB_DL>>1)+3)) && (l>=(nsymb>>1)) && (l<((nsymb>>1) + 4))) { + rb_alloc_ind = 0; + } + + //SSS + if (((subframe==0)||(subframe==5)) && (rb>=((frame_parms->N_RB_DL>>1)-3)) && (rb<((frame_parms->N_RB_DL>>1)+3)) && (l==sss_symb) ) { + rb_alloc_ind = 0; + } + + if (frame_parms->frame_type == FDD) { + //PSS + if (((subframe==0)||(subframe==5)) && (rb>=((frame_parms->N_RB_DL>>1)-3)) && (rb<((frame_parms->N_RB_DL>>1)+3)) && (l==pss_symb) ) { + rb_alloc_ind = 0; + } + } + + if ((frame_parms->frame_type == TDD) && + (subframe==6)) { + //PSS + if ((rb>((frame_parms->N_RB_DL>>1)-3)) && (rb<((frame_parms->N_RB_DL>>1)+3)) && (l==pss_symb) ) { + rb_alloc_ind = 0; + } + } + + //printf("dlch_ext %d\n",dl_ch0_ext-&dl_ch_estimates_ext[aarx][0]); + //printf("DC rb %d (%p)\n",rb,rxF); + if (rb_alloc_ind==1) { + //printf("rb %d/symbol %d (skip_half %d)\n",rb,l,skip_half); + if (pilots==0 && uespec_pilots==0) { + for (i=0; i<6; i++) { + dl_ch0_ext[i]=dl_ch0[i]; + rxF_ext[i]=rxF[i]; + } + + rxF = &rxdataF[aarx][((symbol*(frame_parms->ofdm_symbol_size)))]; + + for (; i<12; i++) { + dl_ch0_ext[i]=dl_ch0[i]; + rxF_ext[i]=rxF[(1+i-6)]; + } + + dl_ch0_ext+=12; + rxF_ext+=12; + } else if(pilots==1 && uespec_pilots==0){ // pilots==1 + j=0; + + for (i=0; i<6; i++) { + if (i!=((frame_parms->nushift+poffset)%6)) { + 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 = &rxdataF[aarx][((symbol*(frame_parms->ofdm_symbol_size)))]; + + for (; i<12; i++) { + if (i!=((frame_parms->nushift+6+poffset)%12)) { + 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])); + } + } + + dl_ch0_ext+=10; + rxF_ext+=10; + } else if(pilots==0 && uespec_pilots==1) { + j=0; + k=0; + + for (i=0; i<6; i++) { + if (frame_parms->Ncp==0){ + if (i!=uespec_nushift+uespec_poffset && i!=uespec_nushift+uespec_poffset+4 && i!=(uespec_nushift+uespec_poffset+8)%12){ + 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])); + } + } else { + if (i!=uespec_nushift+uespec_poffset && i!=uespec_nushift+uespec_poffset+3 && i!=uespec_nushift+uespec_poffset+6 && i!=(uespec_nushift+uespec_poffset+9)%12){ + 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 = &rxdataF[aarx][((symbol*(frame_parms->ofdm_symbol_size)))]; + + for (; i<12; i++) { + if (frame_parms->Ncp==0){ + if (i!=uespec_nushift+uespec_poffset && i!=uespec_nushift+uespec_poffset+4 && i!=(uespec_nushift+uespec_poffset+8)%12){ + 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])); + } + } else { + if (i!=uespec_nushift+uespec_poffset && i!=uespec_nushift+uespec_poffset+3 && i!=uespec_nushift+uespec_poffset+6 && i!=(uespec_nushift+uespec_poffset+9)%12){ + dl_ch0_ext[j]=dl_ch0[i]; + rxF_ext[j++] = rxF[(1+i-6)]; + } + } + } + + dl_ch0_ext+=9-frame_parms->Ncp; + rxF_ext+=9-frame_parms->Ncp; + + }// symbol_mod==0 + + nb_rb++; + } // rballoc==1 + else { + rxF = &rxdataF[aarx][((symbol*(frame_parms->ofdm_symbol_size)))]; + } + + dl_ch0+=12; + rxF+=7; + rb++; + + for (; rbN_RB_DL; rb++) { + // printf("dlch_ext %d\n",dl_ch0_ext-&dl_ch_estimates_ext[aarx][0]); + // printf("rb %d (%p)\n",rb,rxF); + skip_half=0; + + if (rb < 32) + rb_alloc_ind = (rb_alloc[0]>>rb) & 1; + else if (rb < 64) + rb_alloc_ind = (rb_alloc[1]>>(rb-32)) & 1; + else if (rb < 96) + rb_alloc_ind = (rb_alloc[2]>>(rb-64)) & 1; + else if (rb < 100) + rb_alloc_ind = (rb_alloc[3]>>(rb-96)) & 1; + else + rb_alloc_ind = 0; + + + + // PBCH + if ((subframe==0) && (rb>((frame_parms->N_RB_DL>>1)-3)) && (rb<((frame_parms->N_RB_DL>>1)+3)) && (l>=nsymb>>1) && (l<((nsymb>>1) + 4))) { + rb_alloc_ind = 0; + } + + //PBCH subframe 0, symbols nsymb>>1 ... nsymb>>1 + 3 + if ((subframe==0) && (rb==((frame_parms->N_RB_DL>>1)-3)) && (l>=(nsymb>>1)) && (l<((nsymb>>1) + 4))) + skip_half=1; + else if ((subframe==0) && (rb==((frame_parms->N_RB_DL>>1)+3)) && (l>=(nsymb>>1)) && (l<((nsymb>>1) + 4))) + skip_half=2; + + //SSS + if (((subframe==0)||(subframe==5)) && (rb>((frame_parms->N_RB_DL>>1)-3)) && (rb<((frame_parms->N_RB_DL>>1)+3)) && (l==sss_symb) ) { + rb_alloc_ind = 0; + } + + //SSS + if (((subframe==0)||(subframe==5)) && (rb==((frame_parms->N_RB_DL>>1)-3)) && (l==sss_symb)) + skip_half=1; + else if (((subframe==0)||(subframe==5)) && (rb==((frame_parms->N_RB_DL>>1)+3)) && (l==sss_symb)) + skip_half=2; + + if (frame_parms->frame_type == FDD) { + //PSS + if (((subframe==0)||(subframe==5)) && (rb>((frame_parms->N_RB_DL>>1)-3)) && (rb<((frame_parms->N_RB_DL>>1)+3)) && (l==pss_symb) ) { + rb_alloc_ind = 0; + } + + //PSS + if (((subframe==0)||(subframe==5)) && (rb==((frame_parms->N_RB_DL>>1)-3)) && (l==pss_symb)) + skip_half=1; + else if (((subframe==0)||(subframe==5)) && (rb==((frame_parms->N_RB_DL>>1)+3)) && (l==pss_symb)) + skip_half=2; + } + + if ((frame_parms->frame_type == TDD) && + (subframe==6)) { //TDD Subframe 6 + if ((rb>((frame_parms->N_RB_DL>>1)-3)) && (rb<((frame_parms->N_RB_DL>>1)+3)) && (l==pss_symb) ) { + rb_alloc_ind = 0; + } + + if ((rb==((frame_parms->N_RB_DL>>1)-3)) && (l==pss_symb)) + skip_half=1; + else if ((rb==((frame_parms->N_RB_DL>>1)+3)) && (l==pss_symb)) + skip_half=2; + } + + if (rb_alloc_ind==1) { + // printf("rb %d/symbol %d (skip_half %d)\n",rb,l,skip_half); + /* + printf("rb %d\n",rb); + for (i=0;i<12;i++) + printf("(%d %d)",((short *)dl_ch0)[i<<1],((short*)dl_ch0)[1+(i<<1)]); + printf("\n"); + */ + if (pilots==0 && uespec_pilots==0) { + //printf("Extracting w/o pilots (symbol %d, rb %d, skip_half %d)\n",l,rb,skip_half); + if (skip_half==1) { + memcpy(dl_ch0_ext,dl_ch0,6*sizeof(int)); + + for (i=0; i<6; i++) + rxF_ext[i]=rxF[i]; + + dl_ch0_ext+=6; + rxF_ext+=6; + + } else if (skip_half==2) { + memcpy(dl_ch0_ext,dl_ch0+6,6*sizeof(int)); + + for (i=0; i<6; i++) + rxF_ext[i]=rxF[(i+6)]; + + dl_ch0_ext+=6; + rxF_ext+=6; + + } else { + memcpy(dl_ch0_ext,dl_ch0,12*sizeof(int)); + + for (i=0; i<12; i++) + rxF_ext[i]=rxF[i]; + + dl_ch0_ext+=12; + rxF_ext+=12; + } + } else if (pilots==1 && uespec_pilots==0){ + //printf("Extracting with pilots (symbol %d, rb %d, skip_half %d)\n",l,rb,skip_half); + j=0; + + if (skip_half==1) { + for (i=0; i<6; i++) { + if (i!=((frame_parms->nushift+poffset)%6)) { + rxF_ext[j]=rxF[i]; + //printf("extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[j],*(1+(short*)&rxF_ext[j])); + dl_ch0_ext[j++]=dl_ch0[i]; + } + } + + dl_ch0_ext+=5; + rxF_ext+=5; + } else if (skip_half==2) { + for (i=0; i<6; i++) { + if (i!=((frame_parms->nushift+poffset)%6)) { + rxF_ext[j]=rxF[(i+6)]; + //printf("extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[j],*(1+(short*)&rxF_ext[j])); + dl_ch0_ext[j++]=dl_ch0[i+6]; + } + } + + dl_ch0_ext+=5; + rxF_ext+=5; + } else { + for (i=0; i<12; i++) { + if ((i!=(frame_parms->nushift+poffset)) && + (i!=((frame_parms->nushift+poffset+6)%12))) { + rxF_ext[j]=rxF[i]; + //printf("extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[j],*(1+(short*)&rxF_ext[j])); + dl_ch0_ext[j++]=dl_ch0[i]; + } + } + + dl_ch0_ext+=10; + rxF_ext+=10; + } + } else if(pilots==0 && uespec_pilots==1) { + j=0; + k=0; + + if (skip_half==1) { + if (frame_parms->Ncp==0){ + for (i=0; i<6; i++) { + if (i!=uespec_nushift+uespec_poffset && i!=uespec_nushift+uespec_poffset+4 && i!=(uespec_nushift+uespec_poffset+8)%12){ + rxF_ext[j]=rxF[i]; + dl_ch0_ext[j++]=dl_ch0[i]; + } + } + dl_ch0_ext+=6-(uespec_nushift+uespec_poffset<6)-(uespec_nushift+uespec_poffset+4<6)-((uespec_nushift+uespec_poffset+8)%12<6); + rxF_ext+=6-(uespec_nushift+uespec_poffset<6)-(uespec_nushift+uespec_poffset+4<6)-((uespec_nushift+uespec_poffset+8)%12<6); + + } else{ + for (i=0; i<6; i++) { + if (i!=uespec_nushift+uespec_poffset && i!=uespec_nushift+uespec_poffset+3 && i!=uespec_nushift+uespec_poffset+6 && i!=(uespec_nushift+uespec_poffset+9)%12){ + rxF_ext[j]=rxF[i]; + dl_ch0_ext[j++]=dl_ch0[i]; + } + } + dl_ch0_ext+=4; + rxF_ext+=4; + } + + } else if (skip_half==2) { + if(frame_parms->Ncp==0){ + for (i=0; i<6; i++) { + if (i!=uespec_nushift+uespec_poffset && i!=uespec_nushift+uespec_poffset+4 && i!=(uespec_nushift+uespec_poffset+8)%12){ + rxF_ext[j]=rxF[(i+6)]; + dl_ch0_ext[j++]=dl_ch0[i+6]; + } + } + dl_ch0_ext+=6-(uespec_nushift+uespec_poffset>6)-(uespec_nushift+uespec_poffset+4>6)-((uespec_nushift+uespec_poffset+8)%12>6); + rxF_ext+=6-(uespec_nushift+uespec_poffset>6)-(uespec_nushift+uespec_poffset+4>6)-((uespec_nushift+uespec_poffset+8)%12>6); + + } else { + for (i=0; i<6; i++) { + if (i!=uespec_nushift+uespec_poffset && i!=uespec_nushift+uespec_poffset+3 && i!=uespec_nushift+uespec_poffset+6 && i!=(uespec_nushift+uespec_poffset+9)%12){ + rxF_ext[j]=rxF[(i+6)]; + dl_ch0_ext[j++]=dl_ch0[i+6]; + } + } + dl_ch0_ext+=4; + rxF_ext+=4; + } + + } else { + for (i=0; i<12; i++){ + if (frame_parms->Ncp==0){ + if (i!=uespec_nushift+uespec_poffset && i!=uespec_nushift+uespec_poffset+4 && i!=(uespec_nushift+uespec_poffset+8)%12){ + rxF_ext[j] = rxF[i]; + dl_ch0_ext[j++]=dl_ch0[i]; + } + } else{ + if (i!=uespec_nushift+uespec_poffset && i!=uespec_nushift+uespec_poffset+3 && i!=uespec_nushift+uespec_poffset+6 && i!=(uespec_nushift+uespec_poffset+9)%12){ + rxF_ext[j] = rxF[i]; + dl_ch0_ext[j++]=dl_ch0[i]; + } + } + } + + dl_ch0_ext+=9-frame_parms->Ncp; + rxF_ext+=9-frame_parms->Ncp; + + } + + }// pilots=0 + + nb_rb++; + } + + dl_ch0+=12; + rxF+=12; + } + } + } + + _mm_empty(); + _m_empty(); + + return(nb_rb/frame_parms->nb_antennas_rx); +} + + + //============================================================================================== #ifdef USER_MODE @@ -4223,6 +4990,10 @@ void dump_dlsch2(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint16_t coded_bits_per } } + sprintf(fname,"dlsch%d_rxF_r%d_uespec0.m",eNB_id,round); + sprintf(vname,"dl%d_rxF_r%d_uespec0",eNB_id,round); + write_output(fname,vname,phy_vars_ue->lte_ue_pdsch_vars[eNB_id]->rxdataF_uespec_pilots[0],12*N_RB_DL,1,1); + /* write_output("dlsch%d_ch_ext01.m","dl01_ch0_ext",lte_ue_pdsch_vars[eNB_id]->dl_ch_estimates_ext[1],12*N_RB_DL*nsymb,1,1); write_output("dlsch%d_ch_ext10.m","dl10_ch0_ext",lte_ue_pdsch_vars[eNB_id]->dl_ch_estimates_ext[2],12*N_RB_DL*nsymb,1,1); diff --git a/openair1/PHY/LTE_TRANSPORT/dlsch_llr_computation.c b/openair1/PHY/LTE_TRANSPORT/dlsch_llr_computation.c index 4990e94cf5..951e4afcd0 100644 --- a/openair1/PHY/LTE_TRANSPORT/dlsch_llr_computation.c +++ b/openair1/PHY/LTE_TRANSPORT/dlsch_llr_computation.c @@ -640,7 +640,8 @@ int dlsch_qpsk_llr(LTE_DL_FRAME_PARMS *frame_parms, uint8_t first_symbol_flag, uint16_t nb_rb, uint16_t pbch_pss_sss_adjust, - short **llr32p) + short **llr32p, + uint8_t beamforming_mode) { uint32_t *rxF = (uint32_t*)&rxdataF_comp[0][(symbol*frame_parms->N_RB_DL*12)]; @@ -661,11 +662,16 @@ int dlsch_qpsk_llr(LTE_DL_FRAME_PARMS *frame_parms, if ((symbol_mod==0) || (symbol_mod==(4-frame_parms->Ncp))) { - if (frame_parms->mode1_flag==0) + if (frame_parms->mode1_flag==0 && beamforming_mode!=7) len = (nb_rb*8);// - (2*pbch_pss_sss_adjust/3); else len = (nb_rb*10);// - (5*pbch_pss_sss_adjust/6); - } else { + } else if((beamforming_mode==7) && (frame_parms->Ncp==0) && (symbol==3 || symbol==6 || symbol==9 || symbol==12)){ + len = (nb_rb*9); + } else if((beamforming_mode==7) && (frame_parms->Ncp==1) && (symbol==4 || symbol==7 || symbol==10)){ + len = (nb_rb*8); + } + else { len = (nb_rb*12);// - pbch_pss_sss_adjust; } diff --git a/openair1/PHY/LTE_TRANSPORT/dlsch_modulation.c b/openair1/PHY/LTE_TRANSPORT/dlsch_modulation.c index c4b0247d75..d14c26c13d 100644 --- a/openair1/PHY/LTE_TRANSPORT/dlsch_modulation.c +++ b/openair1/PHY/LTE_TRANSPORT/dlsch_modulation.c @@ -1,42 +1,42 @@ /******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom + OpenAirInterface + Copyright(c) 1999 - 2014 Eurecom - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. + OpenAirInterface is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. + OpenAirInterface is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see . + You should have received a copy of the GNU General Public License + along with OpenAirInterface.The full GNU General Public License is + included in this distribution in the file called "COPYING". If not, + see . Contact Information OpenAirInterface Admin: openair_admin@eurecom.fr OpenAirInterface Tech : openair_tech@eurecom.fr OpenAirInterface Dev : openair4g-devel@eurecom.fr - Address : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE +Address : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE *******************************************************************************/ /*! \file PHY/LTE_TRANSPORT/dlsch_modulation.c -* \brief Top-level routines for generating the PDSCH physical channel from 36-211, V8.6 2009-03 -* \author R. Knopp, F. Kaltenberger -* \date 2011 -* \version 0.1 -* \company Eurecom -* \email: knopp@eurecom.fr,florian.kaltenberger@eurecom.fr -* \note -* \warning -*/ + * \brief Top-level routines for generating the PDSCH physical channel from 36-211, V8.6 2009-03 + * \author R. Knopp, F. Kaltenberger + * \date 2011 + * \version 0.1 + * \company Eurecom + * \email: knopp@eurecom.fr,florian.kaltenberger@eurecom.fr + * \note + * \warning + */ #include "PHY/defs.h" #include "PHY/extern.h" #include "PHY/CODING/defs.h" @@ -70,10 +70,33 @@ uint8_t is_not_pilot(uint8_t pilots, uint8_t re, uint8_t nushift, uint8_t use2nd return(0); } -uint8_t is_not_UEspecRS(int first_layer,int re) +//uint8_t is_not_UEspecRS(int first_layer,int re) +uint8_t is_not_UEspecRS(uint8_t lprime, uint8_t re, uint8_t nushift, uint8_t Ncp, uint8_t beamforming_mode) { + uint8_t offset = (lprime==2)?2:0; + if(lprime==0) + return(1); - return(1); + switch(beamforming_mode){ + case 7: + if (Ncp == NORMAL){ + if ((re!=nushift+offset) && (re!=((nushift+4+offset)%12)) && (re!=((nushift+8+offset)%12))) + return(1); + /*else{ + printf("(is_no_UEspec_RS):lprime=%d, re=%d, nushift=%d, offset=%d\n",lprime, re,nushift,offset); + }*/ + } else { + if ((re!=nushift+offset) && (re!=((nushift+3+offset)%12)) && (re!=((nushift+6+offset)%12)) && (re!=((nushift+9+offset)%12))) + return(1); + } + break; + + default: + msg("is_not_UEspecRS() [dlsch_modulation.c] : ERROR, unknown beamforming_mode %d\n",beamforming_mode); + return(-1); + } + + return(0); } void generate_64qam_table(void) @@ -110,33 +133,33 @@ void layer1prec2A(int32_t *antenna0_sample, int32_t *antenna1_sample, uint8_t pr switch (precoding_index) { - case 0: // 1 1 - *antenna1_sample=*antenna0_sample; - break; + case 0: // 1 1 + *antenna1_sample=*antenna0_sample; + break; - case 1: // 1 -1 - ((int16_t *)antenna1_sample)[0] = -((int16_t *)antenna0_sample)[0]; - ((int16_t *)antenna1_sample)[1] = -((int16_t *)antenna0_sample)[1]; - break; + case 1: // 1 -1 + ((int16_t *)antenna1_sample)[0] = -((int16_t *)antenna0_sample)[0]; + ((int16_t *)antenna1_sample)[1] = -((int16_t *)antenna0_sample)[1]; + break; - case 2: // 1 j - ((int16_t *)antenna1_sample)[0] = -((int16_t *)antenna0_sample)[1]; - ((int16_t *)antenna1_sample)[1] = ((int16_t *)antenna0_sample)[0]; - break; + case 2: // 1 j + ((int16_t *)antenna1_sample)[0] = -((int16_t *)antenna0_sample)[1]; + ((int16_t *)antenna1_sample)[1] = ((int16_t *)antenna0_sample)[0]; + break; - case 3: // 1 -j - ((int16_t *)antenna1_sample)[0] = ((int16_t *)antenna0_sample)[1]; - ((int16_t *)antenna1_sample)[1] = -((int16_t *)antenna0_sample)[0]; - break; + case 3: // 1 -j + ((int16_t *)antenna1_sample)[0] = ((int16_t *)antenna0_sample)[1]; + ((int16_t *)antenna1_sample)[1] = -((int16_t *)antenna0_sample)[0]; + break; } // normalize /* ((int16_t *)antenna0_sample)[0] = (int16_t)((((int16_t *)antenna0_sample)[0]*ONE_OVER_SQRT2_Q15)>>15); - ((int16_t *)antenna0_sample)[1] = (int16_t)((((int16_t *)antenna0_sample)[1]*ONE_OVER_SQRT2_Q15)>>15); ((int16_t *)antenna1_sample)[0] = (int16_t)((((int16_t *)antenna1_sample)[0]*ONE_OVER_SQRT2_Q15)>>15); - ((int16_t *)antenna1_sample)[1] = (int16_t)((((int16_t *)antenna1_sample)[1]*ONE_OVER_SQRT2_Q15)>>15); */ + ((int16_t *)antenna0_sample)[1] = (int16_t)((((int16_t *)antenna0_sample)[1]*ONE_OVER_SQRT2_Q15)>>15); ((int16_t *)antenna1_sample)[0] = (int16_t)((((int16_t *)antenna1_sample)[0]*ONE_OVER_SQRT2_Q15)>>15); + ((int16_t *)antenna1_sample)[1] = (int16_t)((((int16_t *)antenna1_sample)[1]*ONE_OVER_SQRT2_Q15)>>15); */ } -int allocate_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms, +int allocate_REs_in_RB(PHY_VARS_eNB *phy_vars_eNB, mod_sym_t **txdataF, uint32_t *jj, uint32_t *jj2, @@ -151,10 +174,14 @@ int allocate_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms, int16_t *qam_table_s1, uint32_t *re_allocated, uint8_t skip_dc, - uint8_t skip_half) + uint8_t skip_half, + uint8_t lprime, + uint8_t mprime, + uint8_t Ns, + int32_t **beamforming_weights) { - + LTE_DL_FRAME_PARMS *frame_parms = &phy_vars_eNB->lte_frame_parms; uint8_t *x0 = dlsch0_harq->e; MIMO_mode_t mimo_mode = dlsch0_harq->mimo_mode; @@ -165,11 +192,11 @@ int allocate_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms, uint8_t *x1=NULL; uint8_t mod_order1=2; + uint8_t nb_antennas_tx_phy = phy_vars_eNB->nb_antennas_tx_phy; + // Fill these in later for TM8-10 // int Nlayers1; // int first_layer1; - - int use2ndpilots = (frame_parms->mode1_flag==1)?1:0; uint32_t tti_offset,aa; @@ -195,10 +222,23 @@ int allocate_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms, uint8_t first_re,last_re; int32_t tmp_sample1,tmp_sample2; int16_t tmp_amp=amp; + uint8_t layer; int s=1; + + uint8_t mprime2 = mprime,mprime_dword,mprime_qpsk_symb; + mod_sym_t qpsk[4]; gain_lin_QPSK = (int16_t)((amp*ONE_OVER_SQRT2_Q15)>>15); // if (mimo_mode == LARGE_CDD) gain_lin_QPSK>>=1; + ((int16_t *)&qpsk[0])[0] = gain_lin_QPSK; + ((int16_t *)&qpsk[0])[1] = gain_lin_QPSK; + ((int16_t *)&qpsk[1])[0] = -gain_lin_QPSK; + ((int16_t *)&qpsk[1])[1] = gain_lin_QPSK;; + ((int16_t *)&qpsk[2])[0] = gain_lin_QPSK;; + ((int16_t *)&qpsk[2])[1] = -gain_lin_QPSK;; + ((int16_t *)&qpsk[3])[0] = -gain_lin_QPSK;; + ((int16_t *)&qpsk[3])[1] = -gain_lin_QPSK; + if (dlsch1_harq) { x1 = dlsch1_harq->e; @@ -210,151 +250,151 @@ int allocate_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms, } /* - switch (mod_order) { - case 2: - // QPSK single stream + switch (mod_order) { + case 2: +// QPSK single stream - break; - case 4: - //16QAM Single stream - gain_lin_16QAM1 = (int16_t)(((int32_t)amp*QAM16_n1)>>15); - gain_lin_16QAM2 = (int16_t)(((int32_t)amp*QAM16_n2)>>15); +break; +case 4: +//16QAM Single stream +gain_lin_16QAM1 = (int16_t)(((int32_t)amp*QAM16_n1)>>15); +gain_lin_16QAM2 = (int16_t)(((int32_t)amp*QAM16_n2)>>15); - break; +break; - case 6: - //64QAM Single stream - break; - default: - break; - } - */ +case 6: +//64QAM Single stream +break; +default: +break; +} + */ -#ifdef DEBUG_DLSCH_MODULATION - printf("allocate_re (mod %d): symbol_offset %d re_offset %d (%d,%d), jj %d -> %d,%d\n",mod_order0,symbol_offset,re_offset,skip_dc,skip_half,*jj, x0[*jj], x0[1+*jj]); -#endif +//#ifdef DEBUG_DLSCH_MODULATION +// printf("allocate_re (mod %d): symbol_offset %d re_offset %d (%d,%d), jj %d -> %d,%d\n",mod_order0,symbol_offset,re_offset,skip_dc,skip_half,*jj, x0[*jj], x0[1+*jj]); +//#endif first_re=0; last_re=12; - + if (skip_half==1) last_re=6; else if (skip_half==2) first_re=6; - - for (re=first_re; reofdm_symbol_size+1; - tti_offset = symbol_offset + re_off + re; + tti_offset = symbol_offset + re_off + re; + // printf("tti_offset = %d\n", tti_offset); // check that RE is not from Cell-specific RS if (is_not_pilot(pilots,re,frame_parms->nushift,use2ndpilots)==1) { - // printf("re %d (jj %d)\n",re,*jj); + // printf("re %d (jj %d)\n",re,*jj); if (mimo_mode == SISO) { //SISO mapping *re_allocated = *re_allocated + 1; switch (mod_order0) { - case 2: //QPSK + case 2: //QPSK - //printf("%d(%d) : %d,%d => ",tti_offset,*jj,((int16_t*)&txdataF[0][tti_offset])[0],((int16_t*)&txdataF[0][tti_offset])[1]); - for (aa=0; aanb_antennas_tx; aa++) { - ((int16_t*)&txdataF[aa][tti_offset])[0] += (x0[*jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK; //I //b_i - } + //printf("%d(%d) : %d,%d => ",tti_offset,*jj,((int16_t*)&txdataF[0][tti_offset])[0],((int16_t*)&txdataF[0][tti_offset])[1]); + for (aa=0; aanb_antennas_tx; aa++) { + ((int16_t*)&txdataF[aa][tti_offset])[0] += (x0[*jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK; //I //b_i + } - *jj = *jj + 1; + *jj = *jj + 1; - for (aa=0; aanb_antennas_tx; aa++) { - ((int16_t*)&txdataF[aa][tti_offset])[1] += (x0[*jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK; //Q //b_{i+1} - } + for (aa=0; aanb_antennas_tx; aa++) { + ((int16_t*)&txdataF[aa][tti_offset])[1] += (x0[*jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK; //Q //b_{i+1} + } - *jj = *jj + 1; + *jj = *jj + 1; - // printf("%d,%d\n",((int16_t*)&txdataF[0][tti_offset])[0],((int16_t*)&txdataF[0][tti_offset])[1]); - break; + //printf("%d,%d\n",((int16_t*)&txdataF[0][tti_offset])[0],((int16_t*)&txdataF[0][tti_offset])[1]); + break; - case 4: //16QAM + case 4: //16QAM - qam16_table_offset_re = 0; - qam16_table_offset_im = 0; + qam16_table_offset_re = 0; + qam16_table_offset_im = 0; - if (x0[*jj] == 1) - qam16_table_offset_re+=2; + if (x0[*jj] == 1) + qam16_table_offset_re+=2; - *jj=*jj+1; + *jj=*jj+1; - if (x0[*jj] == 1) - qam16_table_offset_im+=2; + if (x0[*jj] == 1) + qam16_table_offset_im+=2; - *jj=*jj+1; + *jj=*jj+1; - if (x0[*jj] == 1) - qam16_table_offset_re+=1; + if (x0[*jj] == 1) + qam16_table_offset_re+=1; - *jj=*jj+1; + *jj=*jj+1; - if (x0[*jj] == 1) - qam16_table_offset_im+=1; + if (x0[*jj] == 1) + qam16_table_offset_im+=1; - *jj=*jj+1; + *jj=*jj+1; - for (aa=0; aanb_antennas_tx; aa++) { - ((int16_t *)&txdataF[aa][tti_offset])[0]+=qam_table_s0[qam16_table_offset_re]; - ((int16_t *)&txdataF[aa][tti_offset])[1]+=qam_table_s0[qam16_table_offset_im]; - // ((int16_t *)&txdataF[aa][tti_offset])[0]+=(int16_t)(((int32_t)amp*qam16_table[qam16_table_offset_re])>>15); - // ((int16_t *)&txdataF[aa][tti_offset])[1]+=(int16_t)(((int32_t)amp*qam16_table[qam16_table_offset_im])>>15); - } + for (aa=0; aanb_antennas_tx; aa++) { + ((int16_t *)&txdataF[aa][tti_offset])[0]+=qam_table_s0[qam16_table_offset_re]; + ((int16_t *)&txdataF[aa][tti_offset])[1]+=qam_table_s0[qam16_table_offset_im]; + // ((int16_t *)&txdataF[aa][tti_offset])[0]+=(int16_t)(((int32_t)amp*qam16_table[qam16_table_offset_re])>>15); + // ((int16_t *)&txdataF[aa][tti_offset])[1]+=(int16_t)(((int32_t)amp*qam16_table[qam16_table_offset_im])>>15); + } - break; + break; - case 6: //64QAM + case 6: //64QAM - qam64_table_offset_re = 0; - qam64_table_offset_im = 0; + qam64_table_offset_re = 0; + qam64_table_offset_im = 0; - if (x0[*jj] == 1) - qam64_table_offset_re+=4; + if (x0[*jj] == 1) + qam64_table_offset_re+=4; - *jj=*jj+1; + *jj=*jj+1; - if (x0[*jj] == 1) - qam64_table_offset_im+=4; + if (x0[*jj] == 1) + qam64_table_offset_im+=4; - *jj=*jj+1; + *jj=*jj+1; - if (x0[*jj] == 1) - qam64_table_offset_re+=2; + if (x0[*jj] == 1) + qam64_table_offset_re+=2; - *jj=*jj+1; + *jj=*jj+1; - if (x0[*jj] == 1) - qam64_table_offset_im+=2; + if (x0[*jj] == 1) + qam64_table_offset_im+=2; - *jj=*jj+1; + *jj=*jj+1; - if (x0[*jj] == 1) - qam64_table_offset_re+=1; + if (x0[*jj] == 1) + qam64_table_offset_re+=1; - *jj=*jj+1; + *jj=*jj+1; - if (x0[*jj] == 1) - qam64_table_offset_im+=1; + if (x0[*jj] == 1) + qam64_table_offset_im+=1; - *jj=*jj+1; + *jj=*jj+1; - for (aa=0; aanb_antennas_tx; aa++) { - ((int16_t *)&txdataF[aa][tti_offset])[0]+=qam_table_s0[qam64_table_offset_re];//(int16_t)(((int32_t)amp*qam64_table[qam64_table_offset_re])>>15); - ((int16_t *)&txdataF[aa][tti_offset])[1]+=qam_table_s0[qam64_table_offset_im];//(int16_t)(((int32_t)amp*qam64_table[qam64_table_offset_im])>>15); - } + for (aa=0; aanb_antennas_tx; aa++) { + ((int16_t *)&txdataF[aa][tti_offset])[0]+=qam_table_s0[qam64_table_offset_re];//(int16_t)(((int32_t)amp*qam64_table[qam64_table_offset_re])>>15); + ((int16_t *)&txdataF[aa][tti_offset])[1]+=qam_table_s0[qam64_table_offset_im];//(int16_t)(((int32_t)amp*qam64_table[qam64_table_offset_im])>>15); + } - break; + break; } } @@ -365,171 +405,171 @@ int allocate_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms, amp = (int16_t)(((int32_t)tmp_amp*ONE_OVER_SQRT2_Q15)>>15); switch (mod_order0) { - case 2: //QPSK + case 2: //QPSK - // first antenna position n -> x0 + // first antenna position n -> x0 - ((int16_t*)&tmp_sample1)[0] = (x0[*jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK; - *jj=*jj+1; - ((int16_t*)&tmp_sample1)[1] = (x0[*jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK; - *jj=*jj+1; + ((int16_t*)&tmp_sample1)[0] = (x0[*jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK; + *jj=*jj+1; + ((int16_t*)&tmp_sample1)[1] = (x0[*jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK; + *jj=*jj+1; - // second antenna position n -> -x1* + // second antenna position n -> -x1* - ((int16_t*)&tmp_sample2)[0] = (x0[*jj]==1) ? (gain_lin_QPSK) : -gain_lin_QPSK; - *jj=*jj+1; - ((int16_t*)&tmp_sample2)[1] = (x0[*jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK; - *jj=*jj+1; + ((int16_t*)&tmp_sample2)[0] = (x0[*jj]==1) ? (gain_lin_QPSK) : -gain_lin_QPSK; + *jj=*jj+1; + ((int16_t*)&tmp_sample2)[1] = (x0[*jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK; + *jj=*jj+1; - // normalization for 2 tx antennas - ((int16_t*)&txdataF[0][tti_offset])[0] += (int16_t)((((int16_t*)&tmp_sample1)[0]*ONE_OVER_SQRT2_Q15)>>15); - ((int16_t*)&txdataF[0][tti_offset])[1] += (int16_t)((((int16_t*)&tmp_sample1)[1]*ONE_OVER_SQRT2_Q15)>>15); - ((int16_t*)&txdataF[1][tti_offset])[0] += (int16_t)((((int16_t*)&tmp_sample2)[0]*ONE_OVER_SQRT2_Q15)>>15); - ((int16_t*)&txdataF[1][tti_offset])[1] += (int16_t)((((int16_t*)&tmp_sample2)[1]*ONE_OVER_SQRT2_Q15)>>15); + // normalization for 2 tx antennas + ((int16_t*)&txdataF[0][tti_offset])[0] += (int16_t)((((int16_t*)&tmp_sample1)[0]*ONE_OVER_SQRT2_Q15)>>15); + ((int16_t*)&txdataF[0][tti_offset])[1] += (int16_t)((((int16_t*)&tmp_sample1)[1]*ONE_OVER_SQRT2_Q15)>>15); + ((int16_t*)&txdataF[1][tti_offset])[0] += (int16_t)((((int16_t*)&tmp_sample2)[0]*ONE_OVER_SQRT2_Q15)>>15); + ((int16_t*)&txdataF[1][tti_offset])[1] += (int16_t)((((int16_t*)&tmp_sample2)[1]*ONE_OVER_SQRT2_Q15)>>15); - break; + break; - case 4: //16QAM + case 4: //16QAM - // Antenna 0 position n + // Antenna 0 position n - qam16_table_offset_re = 0; - qam16_table_offset_im = 0; + qam16_table_offset_re = 0; + qam16_table_offset_im = 0; - if (x0[*jj] == 1) - qam16_table_offset_re+=2; + if (x0[*jj] == 1) + qam16_table_offset_re+=2; - *jj=*jj+1; + *jj=*jj+1; - if (x0[*jj] == 1) - qam16_table_offset_im+=2; + if (x0[*jj] == 1) + qam16_table_offset_im+=2; - *jj=*jj+1; + *jj=*jj+1; - if (x0[*jj] == 1) - qam16_table_offset_re+=1; + if (x0[*jj] == 1) + qam16_table_offset_re+=1; - *jj=*jj+1; + *jj=*jj+1; - if (x0[*jj] == 1) - qam16_table_offset_im+=1; + if (x0[*jj] == 1) + qam16_table_offset_im+=1; - *jj=*jj+1; + *jj=*jj+1; - ((int16_t *)&txdataF[0][tti_offset])[0]+=(int16_t)(((int32_t)amp*qam16_table[qam16_table_offset_re])>>15); - ((int16_t *)&txdataF[0][tti_offset])[1]+=(int16_t)(((int32_t)amp*qam16_table[qam16_table_offset_im])>>15); + ((int16_t *)&txdataF[0][tti_offset])[0]+=(int16_t)(((int32_t)amp*qam16_table[qam16_table_offset_re])>>15); + ((int16_t *)&txdataF[0][tti_offset])[1]+=(int16_t)(((int32_t)amp*qam16_table[qam16_table_offset_im])>>15); - // Antenna 1 position n Real part -> -x1* + // Antenna 1 position n Real part -> -x1* - qam16_table_offset_re = 0; - qam16_table_offset_im = 0; + qam16_table_offset_re = 0; + qam16_table_offset_im = 0; - if (x0[*jj] == 1) - qam16_table_offset_re+=2; + if (x0[*jj] == 1) + qam16_table_offset_re+=2; - *jj=*jj+1; + *jj=*jj+1; - if (x0[*jj] == 1) - qam16_table_offset_im+=2; + if (x0[*jj] == 1) + qam16_table_offset_im+=2; - *jj=*jj+1; + *jj=*jj+1; - if (x0[*jj] == 1) - qam16_table_offset_re+=1; + if (x0[*jj] == 1) + qam16_table_offset_re+=1; - *jj=*jj+1; + *jj=*jj+1; - if (x0[*jj] == 1) - qam16_table_offset_im+=1; + if (x0[*jj] == 1) + qam16_table_offset_im+=1; - *jj=*jj+1; + *jj=*jj+1; - ((int16_t *)&txdataF[1][tti_offset])[0]+=-(int16_t)(((int32_t)amp*qam16_table[qam16_table_offset_re])>>15); - ((int16_t *)&txdataF[1][tti_offset])[1]+=(int16_t)(((int32_t)amp*qam16_table[qam16_table_offset_im])>>15); + ((int16_t *)&txdataF[1][tti_offset])[0]+=-(int16_t)(((int32_t)amp*qam16_table[qam16_table_offset_re])>>15); + ((int16_t *)&txdataF[1][tti_offset])[1]+=(int16_t)(((int32_t)amp*qam16_table[qam16_table_offset_im])>>15); - break; + break; - case 6: // 64-QAM + case 6: // 64-QAM - // Antenna 0 - qam64_table_offset_re = 0; - qam64_table_offset_im = 0; + // Antenna 0 + qam64_table_offset_re = 0; + qam64_table_offset_im = 0; - if (x0[*jj] == 1) - qam64_table_offset_re+=4; + if (x0[*jj] == 1) + qam64_table_offset_re+=4; - *jj=*jj+1; + *jj=*jj+1; - if (x0[*jj] == 1) - qam64_table_offset_im+=4; + if (x0[*jj] == 1) + qam64_table_offset_im+=4; - *jj=*jj+1; + *jj=*jj+1; - if (x0[*jj] == 1) - qam64_table_offset_re+=2; + if (x0[*jj] == 1) + qam64_table_offset_re+=2; - *jj=*jj+1; + *jj=*jj+1; - if (x0[*jj] == 1) - qam64_table_offset_im+=2; + if (x0[*jj] == 1) + qam64_table_offset_im+=2; - *jj=*jj+1; + *jj=*jj+1; - if (x0[*jj] == 1) - qam64_table_offset_re+=1; + if (x0[*jj] == 1) + qam64_table_offset_re+=1; - *jj=*jj+1; + *jj=*jj+1; - if (x0[*jj] == 1) - qam64_table_offset_im+=1; + if (x0[*jj] == 1) + qam64_table_offset_im+=1; - *jj=*jj+1; + *jj=*jj+1; - ((int16_t *)&txdataF[0][tti_offset])[0]+=(int16_t)(((int32_t)amp*qam64_table[qam64_table_offset_re])>>15); - ((int16_t *)&txdataF[0][tti_offset])[1]+=(int16_t)(((int32_t)amp*qam64_table[qam64_table_offset_im])>>15); + ((int16_t *)&txdataF[0][tti_offset])[0]+=(int16_t)(((int32_t)amp*qam64_table[qam64_table_offset_re])>>15); + ((int16_t *)&txdataF[0][tti_offset])[1]+=(int16_t)(((int32_t)amp*qam64_table[qam64_table_offset_im])>>15); - // Antenna 1 => -x1* - qam64_table_offset_re = 0; - qam64_table_offset_im = 0; + // Antenna 1 => -x1* + qam64_table_offset_re = 0; + qam64_table_offset_im = 0; - if (x0[*jj] == 1) - qam64_table_offset_re+=4; + if (x0[*jj] == 1) + qam64_table_offset_re+=4; - *jj=*jj+1; + *jj=*jj+1; - if (x0[*jj] == 1) - qam64_table_offset_im+=4; + if (x0[*jj] == 1) + qam64_table_offset_im+=4; - *jj=*jj+1; + *jj=*jj+1; - if (x0[*jj] == 1) - qam64_table_offset_re+=2; + if (x0[*jj] == 1) + qam64_table_offset_re+=2; - *jj=*jj+1; + *jj=*jj+1; - if (x0[*jj] == 1) - qam64_table_offset_im+=2; + if (x0[*jj] == 1) + qam64_table_offset_im+=2; - *jj=*jj+1; + *jj=*jj+1; - if (x0[*jj] == 1) - qam64_table_offset_re+=1; + if (x0[*jj] == 1) + qam64_table_offset_re+=1; - *jj=*jj+1; + *jj=*jj+1; - if (x0[*jj] == 1) - qam64_table_offset_im+=1; + if (x0[*jj] == 1) + qam64_table_offset_im+=1; - *jj=*jj+1; + *jj=*jj+1; - ((int16_t *)&txdataF[1][tti_offset])[0]+=-(int16_t)(((int32_t)amp*qam64_table[qam64_table_offset_re])>>15); - ((int16_t *)&txdataF[1][tti_offset])[1]+=(int16_t)(((int32_t)amp*qam64_table[qam64_table_offset_im])>>15); + ((int16_t *)&txdataF[1][tti_offset])[0]+=-(int16_t)(((int32_t)amp*qam64_table[qam64_table_offset_re])>>15); + ((int16_t *)&txdataF[1][tti_offset])[1]+=(int16_t)(((int32_t)amp*qam64_table[qam64_table_offset_im])>>15); - break; + break; } // fill in the rest of the ALAMOUTI precoding @@ -550,182 +590,182 @@ int allocate_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms, if (frame_parms->nb_antennas_tx == 2) { switch (mod_order0) { - default: - LOG_E(PHY,"Unknown mod_order0 %d\n",mod_order0); - xx0_re=xx0_im=0; - break; + default: + LOG_E(PHY,"Unknown mod_order0 %d\n",mod_order0); + xx0_re=xx0_im=0; + break; - case 2: //QPSK - // printf("%d(%d) : %d,%d => ",tti_offset,*jj,((int16_t*)&txdataF[0][tti_offset])[0],((int16_t*)&txdataF[0][tti_offset])[1]); - xx0_re = (x0[*jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK; - *jj = *jj + 1; - xx0_im = (x0[*jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK; - *jj = *jj + 1; + case 2: //QPSK + // printf("%d(%d) : %d,%d => ",tti_offset,*jj,((int16_t*)&txdataF[0][tti_offset])[0],((int16_t*)&txdataF[0][tti_offset])[1]); + xx0_re = (x0[*jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK; + *jj = *jj + 1; + xx0_im = (x0[*jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK; + *jj = *jj + 1; - // printf("%d,%d\n",((int16_t*)&txdataF[0][tti_offset])[0],((int16_t*)&txdataF[0][tti_offset])[1]); - break; + // printf("%d,%d\n",((int16_t*)&txdataF[0][tti_offset])[0],((int16_t*)&txdataF[0][tti_offset])[1]); + break; - case 4: //16QAM + case 4: //16QAM - qam16_table_offset_re0 = 0; - qam16_table_offset_im0 = 0; + qam16_table_offset_re0 = 0; + qam16_table_offset_im0 = 0; - if (x0[*jj] == 1) - qam16_table_offset_re0+=2; + if (x0[*jj] == 1) + qam16_table_offset_re0+=2; - *jj=*jj+1; + *jj=*jj+1; - if (x0[*jj] == 1) - qam16_table_offset_im0+=2; + if (x0[*jj] == 1) + qam16_table_offset_im0+=2; - *jj=*jj+1; + *jj=*jj+1; - if (x0[*jj] == 1) - qam16_table_offset_re0+=1; + if (x0[*jj] == 1) + qam16_table_offset_re0+=1; - *jj=*jj+1; + *jj=*jj+1; - if (x0[*jj] == 1) - qam16_table_offset_im0+=1; + if (x0[*jj] == 1) + qam16_table_offset_im0+=1; - *jj=*jj+1; + *jj=*jj+1; - xx0_re = qam_table_s0[qam16_table_offset_re0]; - xx0_im = qam_table_s0[qam16_table_offset_im0]; + xx0_re = qam_table_s0[qam16_table_offset_re0]; + xx0_im = qam_table_s0[qam16_table_offset_im0]; - break; + break; - case 6: //64QAM + case 6: //64QAM - qam64_table_offset_re0 = 0; - qam64_table_offset_im0 = 0; + qam64_table_offset_re0 = 0; + qam64_table_offset_im0 = 0; - if (x0[*jj] == 1) - qam64_table_offset_re0+=4; + if (x0[*jj] == 1) + qam64_table_offset_re0+=4; - *jj=*jj+1; + *jj=*jj+1; - if (x0[*jj] == 1) - qam64_table_offset_im0+=4; + if (x0[*jj] == 1) + qam64_table_offset_im0+=4; - *jj=*jj+1; + *jj=*jj+1; - if (x0[*jj] == 1) - qam64_table_offset_re0+=2; + if (x0[*jj] == 1) + qam64_table_offset_re0+=2; - *jj=*jj+1; + *jj=*jj+1; - if (x0[*jj] == 1) - qam64_table_offset_im0+=2; + if (x0[*jj] == 1) + qam64_table_offset_im0+=2; - *jj=*jj+1; + *jj=*jj+1; - if (x0[*jj] == 1) - qam64_table_offset_re0+=1; + if (x0[*jj] == 1) + qam64_table_offset_re0+=1; - *jj=*jj+1; + *jj=*jj+1; - if (x0[*jj] == 1) - qam64_table_offset_im0+=1; + if (x0[*jj] == 1) + qam64_table_offset_im0+=1; - *jj=*jj+1; + *jj=*jj+1; - xx0_re = qam_table_s0[qam64_table_offset_re0]; - xx0_im = qam_table_s0[qam64_table_offset_im0]; + xx0_re = qam_table_s0[qam64_table_offset_re0]; + xx0_im = qam_table_s0[qam64_table_offset_im0]; - break; + break; } switch (mod_order1) { - default: - LOG_E(PHY,"Unknown mod_order1 %d\n",mod_order1); - xx1_re=xx1_im=0; - break; + default: + LOG_E(PHY,"Unknown mod_order1 %d\n",mod_order1); + xx1_re=xx1_im=0; + break; - case 2: //QPSK - // printf("%d(%d) : %d,%d => ",tti_offset,*jj,((int16_t*)&txdataF[0][tti_offset])[0],((int16_t*)&txdataF[0][tti_offset])[1]); - xx1_re = (x1[*jj2]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK; - *jj2 = *jj2 + 1; - xx1_im = (x1[*jj2]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK; - *jj2 = *jj2 + 1; - // printf("%d,%d\n",((int16_t*)&txdataF[0][tti_offset])[0],((int16_t*)&txdataF[0][tti_offset])[1]); - break; + case 2: //QPSK + // printf("%d(%d) : %d,%d => ",tti_offset,*jj,((int16_t*)&txdataF[0][tti_offset])[0],((int16_t*)&txdataF[0][tti_offset])[1]); + xx1_re = (x1[*jj2]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK; + *jj2 = *jj2 + 1; + xx1_im = (x1[*jj2]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK; + *jj2 = *jj2 + 1; + // printf("%d,%d\n",((int16_t*)&txdataF[0][tti_offset])[0],((int16_t*)&txdataF[0][tti_offset])[1]); + break; - case 4: //16QAM + case 4: //16QAM - qam16_table_offset_re1 = 0; - qam16_table_offset_im1 = 0; + qam16_table_offset_re1 = 0; + qam16_table_offset_im1 = 0; - if (x1[*jj2] == 1) - qam16_table_offset_re1+=2; + if (x1[*jj2] == 1) + qam16_table_offset_re1+=2; - *jj2 = *jj2 + 1; + *jj2 = *jj2 + 1; - if (x1[*jj2] == 1) - qam16_table_offset_im1+=2; + if (x1[*jj2] == 1) + qam16_table_offset_im1+=2; - *jj2 = *jj2 + 1; + *jj2 = *jj2 + 1; - if (x1[*jj2] == 1) - qam16_table_offset_re1+=1; + if (x1[*jj2] == 1) + qam16_table_offset_re1+=1; - *jj2 = *jj2 + 1; + *jj2 = *jj2 + 1; - if (x1[*jj2] == 1) - qam16_table_offset_im1+=1; + if (x1[*jj2] == 1) + qam16_table_offset_im1+=1; - *jj2 = *jj2 + 1; + *jj2 = *jj2 + 1; - xx1_re = qam_table_s1[qam16_table_offset_re1]; - xx1_im = qam_table_s1[qam16_table_offset_im1]; + xx1_re = qam_table_s1[qam16_table_offset_re1]; + xx1_im = qam_table_s1[qam16_table_offset_im1]; - break; + break; - case 6: //64QAM + case 6: //64QAM - qam64_table_offset_re1 = 0; - qam64_table_offset_im1 = 0; + qam64_table_offset_re1 = 0; + qam64_table_offset_im1 = 0; - if (x1[*jj2] == 1) - qam64_table_offset_re1+=4; + if (x1[*jj2] == 1) + qam64_table_offset_re1+=4; - *jj2 = *jj2 + 1; + *jj2 = *jj2 + 1; - if (x1[*jj2] == 1) - qam64_table_offset_im1+=4; + if (x1[*jj2] == 1) + qam64_table_offset_im1+=4; - *jj2 = *jj2 + 1; + *jj2 = *jj2 + 1; - if (x1[*jj2] == 1) - qam64_table_offset_re1+=2; + if (x1[*jj2] == 1) + qam64_table_offset_re1+=2; - *jj2 = *jj2 + 1; + *jj2 = *jj2 + 1; - if (x1[*jj2] == 1) - qam64_table_offset_im1+=2; + if (x1[*jj2] == 1) + qam64_table_offset_im1+=2; - *jj2 = *jj2 + 1; + *jj2 = *jj2 + 1; - if (x1[*jj2] == 1) - qam64_table_offset_re1+=1; + if (x1[*jj2] == 1) + qam64_table_offset_re1+=1; - *jj2 = *jj2 + 1; + *jj2 = *jj2 + 1; - if (x1[*jj2] == 1) - qam64_table_offset_im1+=1; + if (x1[*jj2] == 1) + qam64_table_offset_im1+=1; - *jj2 = *jj2 + 1; + *jj2 = *jj2 + 1; - xx1_re = qam_table_s1[qam64_table_offset_re1]; - xx1_im = qam_table_s1[qam64_table_offset_im1]; + xx1_re = qam_table_s1[qam64_table_offset_re1]; + xx1_im = qam_table_s1[qam64_table_offset_im1]; - break; + break; } @@ -740,10 +780,10 @@ int allocate_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms, ((int16_t *)&txdataF[0][tti_offset])[1]+=((xx0_im+xx1_im)>>1); ((int16_t *)&txdataF[1][tti_offset])[1]+=(s*((xx0_im-xx1_im)>>1)); /* - printf("CDD: xx0 (%d,%d), xx1(%d,%d), s(%d), txF[0] (%d,%d), txF[1] (%d,%d)\n", - xx0_re,xx0_im,xx1_re,xx1_im, s, ((int16_t *)&txdataF[0][tti_offset])[0],((int16_t *)&txdataF[0][tti_offset])[1], - ((int16_t *)&txdataF[1][tti_offset])[0],((int16_t *)&txdataF[1][tti_offset])[1]); - */ + printf("CDD: xx0 (%d,%d), xx1(%d,%d), s(%d), txF[0] (%d,%d), txF[1] (%d,%d)\n", + xx0_re,xx0_im,xx1_re,xx1_im, s, ((int16_t *)&txdataF[0][tti_offset])[0],((int16_t *)&txdataF[0][tti_offset])[1], + ((int16_t *)&txdataF[1][tti_offset])[0],((int16_t *)&txdataF[1][tti_offset])[1]); + */ // s alternates +1/-1 for each RE s = -s; } @@ -753,173 +793,61 @@ int allocate_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms, amp = (int16_t)(((int32_t)tmp_amp*ONE_OVER_SQRT2_Q15)>>15); switch (mod_order0) { - case 2: //QPSK - - ((int16_t*)&tmp_sample1)[0] = (x0[*jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK; - *jj = *jj + 1; - ((int16_t*)&tmp_sample1)[1] = (x0[*jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK; - *jj = *jj + 1; - - // normalization for 2 tx antennas - ((int16_t*)&txdataF[0][tti_offset])[0] += (int16_t)((((int16_t*)&tmp_sample1)[0]*ONE_OVER_SQRT2_Q15)>>15); - ((int16_t*)&txdataF[0][tti_offset])[1] += (int16_t)((((int16_t*)&tmp_sample1)[1]*ONE_OVER_SQRT2_Q15)>>15); - - if (frame_parms->nb_antennas_tx == 2) { - layer1prec2A(&tmp_sample1,&tmp_sample2,precoder_index); - ((int16_t*)&txdataF[1][tti_offset])[0] += (int16_t)((((int16_t*)&tmp_sample2)[0]*ONE_OVER_SQRT2_Q15)>>15); - ((int16_t*)&txdataF[1][tti_offset])[1] += (int16_t)((((int16_t*)&tmp_sample2)[1]*ONE_OVER_SQRT2_Q15)>>15); - } - - break; - - case 4: //16QAM - - qam16_table_offset_re = 0; - qam16_table_offset_im = 0; - - if (x0[*jj] == 1) - qam16_table_offset_re+=2; - - *jj=*jj+1; - - if (x0[*jj] == 1) - qam16_table_offset_im+=2; - - *jj=*jj+1; - - - if (x0[*jj] == 1) - qam16_table_offset_re+=1; - - *jj=*jj+1; - - if (x0[*jj] == 1) - qam16_table_offset_im+=1; - - *jj=*jj+1; - - ((int16_t*)&tmp_sample1)[0] = (int16_t)(((int32_t)amp*qam16_table[qam16_table_offset_re])>>15); - ((int16_t*)&tmp_sample1)[1] = (int16_t)(((int32_t)amp*qam16_table[qam16_table_offset_im])>>15); - - ((int16_t *)&txdataF[0][tti_offset])[0] += ((int16_t*)&tmp_sample1)[0]; - ((int16_t *)&txdataF[0][tti_offset])[1] += ((int16_t*)&tmp_sample1)[1]; - - if (frame_parms->nb_antennas_tx == 2) { - layer1prec2A(&tmp_sample1,&tmp_sample2,precoder_index); - ((int16_t*)&txdataF[1][tti_offset])[0] += ((int16_t*)&tmp_sample2)[0]; - ((int16_t*)&txdataF[1][tti_offset])[1] += ((int16_t*)&tmp_sample2)[1]; - } - - break; - - case 6: //64QAM - - - qam64_table_offset_re = 0; - qam64_table_offset_im = 0; - - if (x0[*jj] == 1) - qam64_table_offset_re+=4; - - *jj=*jj+1; - - if (x0[*jj] == 1) - qam64_table_offset_im+=4; - - *jj=*jj+1; - - if (x0[*jj] == 1) - qam64_table_offset_re+=2; - - *jj=*jj+1; - - if (x0[*jj] == 1) - qam64_table_offset_im+=2; - - *jj=*jj+1; - - if (x0[*jj] == 1) - qam64_table_offset_re+=1; - - *jj=*jj+1; - - if (x0[*jj] == 1) - qam64_table_offset_im+=1; - - *jj=*jj+1; - - ((int16_t*)&tmp_sample1)[0] = (int16_t)(((int32_t)amp*qam64_table[qam64_table_offset_re])>>15); - ((int16_t*)&tmp_sample1)[1] = (int16_t)(((int32_t)amp*qam64_table[qam64_table_offset_im])>>15); - - ((int16_t *)&txdataF[0][tti_offset])[0] += ((int16_t*)&tmp_sample1)[0]; - ((int16_t *)&txdataF[0][tti_offset])[1] += ((int16_t*)&tmp_sample1)[1]; - - if (frame_parms->nb_antennas_tx == 2) { - layer1prec2A(&tmp_sample1,&tmp_sample2,precoder_index); - ((int16_t*)&txdataF[1][tti_offset])[0] += ((int16_t*)&tmp_sample2)[0]; - ((int16_t*)&txdataF[1][tti_offset])[1] += ((int16_t*)&tmp_sample2)[1]; - } - - break; - - } - } - - if (mimo_mode == ALAMOUTI) { - re++; // adjacent carriers are taken care of by precoding - *re_allocated = *re_allocated + 1; - - if (is_not_pilot(pilots,re,frame_parms->nushift,use2ndpilots)==0) { - re++; - *re_allocated = *re_allocated + 1; - } - } - - if (mimo_mode >= TM8) { //TM8,TM9,TM10 - - if (is_not_UEspecRS(first_layer0,re)) { - switch (mod_order0) { case 2: //QPSK - // printf("%d : %d,%d => ",tti_offset,((int16_t*)&txdataF[0][tti_offset])[0],((int16_t*)&txdataF[0][tti_offset])[1]); - for (int layer=first_layer0; layer<=(first_layer0+Nlayers0); layer++) { - ((int16_t*)&txdataF[layer][tti_offset])[0] = (x0[*jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK; //I //b_i - *jj = *jj + 1; - ((int16_t*)&txdataF[layer][tti_offset])[1] = (x0[*jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK; //Q //b_{i+1} - *jj = *jj + 1; + ((int16_t*)&tmp_sample1)[0] = (x0[*jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK; + *jj = *jj + 1; + ((int16_t*)&tmp_sample1)[1] = (x0[*jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK; + *jj = *jj + 1; + + // normalization for 2 tx antennas + ((int16_t*)&txdataF[0][tti_offset])[0] += (int16_t)((((int16_t*)&tmp_sample1)[0]*ONE_OVER_SQRT2_Q15)>>15); + ((int16_t*)&txdataF[0][tti_offset])[1] += (int16_t)((((int16_t*)&tmp_sample1)[1]*ONE_OVER_SQRT2_Q15)>>15); + + if (frame_parms->nb_antennas_tx == 2) { + layer1prec2A(&tmp_sample1,&tmp_sample2,precoder_index); + ((int16_t*)&txdataF[1][tti_offset])[0] += (int16_t)((((int16_t*)&tmp_sample2)[0]*ONE_OVER_SQRT2_Q15)>>15); + ((int16_t*)&txdataF[1][tti_offset])[1] += (int16_t)((((int16_t*)&tmp_sample2)[1]*ONE_OVER_SQRT2_Q15)>>15); } break; case 4: //16QAM - if (is_not_UEspecRS(0/*layer (FIXME uninitialized!)*/,re)) { - qam16_table_offset_re = 0; - qam16_table_offset_im = 0; - if (x0[*jj] == 1) - qam16_table_offset_re+=2; + qam16_table_offset_re = 0; + qam16_table_offset_im = 0; - *jj = *jj + 1; + if (x0[*jj] == 1) + qam16_table_offset_re+=2; - if (x0[*jj] == 1) - qam16_table_offset_im+=2; + *jj=*jj+1; - *jj = *jj + 1; + if (x0[*jj] == 1) + qam16_table_offset_im+=2; - if (x0[*jj] == 1) - qam16_table_offset_re+=1; + *jj=*jj+1; - *jj = *jj + 1; - if (x0[*jj] == 1) - qam16_table_offset_im+=1; + if (x0[*jj] == 1) + qam16_table_offset_re+=1; - *jj = *jj + 1; + *jj=*jj+1; - for (int layer=first_layer0; layer<=(first_layer0+Nlayers0); layer++) { - ((int16_t*)&txdataF[layer][tti_offset])[0] = qam_table_s0[qam16_table_offset_re]; - ((int16_t*)&txdataF[layer][tti_offset])[1] = qam_table_s0[qam16_table_offset_im]; - } + if (x0[*jj] == 1) + qam16_table_offset_im+=1; + + *jj=*jj+1; + + ((int16_t*)&tmp_sample1)[0] = (int16_t)(((int32_t)amp*qam16_table[qam16_table_offset_re])>>15); + ((int16_t*)&tmp_sample1)[1] = (int16_t)(((int32_t)amp*qam16_table[qam16_table_offset_im])>>15); + + ((int16_t *)&txdataF[0][tti_offset])[0] += ((int16_t*)&tmp_sample1)[0]; + ((int16_t *)&txdataF[0][tti_offset])[1] += ((int16_t*)&tmp_sample1)[1]; + + if (frame_parms->nb_antennas_tx == 2) { + layer1prec2A(&tmp_sample1,&tmp_sample2,precoder_index); + ((int16_t*)&txdataF[1][tti_offset])[0] += ((int16_t*)&tmp_sample2)[0]; + ((int16_t*)&txdataF[1][tti_offset])[1] += ((int16_t*)&tmp_sample2)[1]; } break; @@ -933,66 +861,221 @@ int allocate_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms, if (x0[*jj] == 1) qam64_table_offset_re+=4; - *jj = *jj + 1; + *jj=*jj+1; if (x0[*jj] == 1) qam64_table_offset_im+=4; - *jj = *jj + 1; + *jj=*jj+1; if (x0[*jj] == 1) qam64_table_offset_re+=2; - *jj = *jj + 1; + *jj=*jj+1; if (x0[*jj] == 1) qam64_table_offset_im+=2; - *jj = *jj + 1; + *jj=*jj+1; if (x0[*jj] == 1) qam64_table_offset_re+=1; - *jj = *jj + 1; + *jj=*jj+1; if (x0[*jj] == 1) qam64_table_offset_im+=1; - *jj = *jj + 1; + *jj=*jj+1; - for (int layer=first_layer0; layer<=(first_layer0+Nlayers0); layer++) { - ((int16_t*)&txdataF[layer][tti_offset])[0] = qam_table_s0[qam64_table_offset_re]; - ((int16_t*)&txdataF[layer][tti_offset])[1] = qam_table_s0[qam64_table_offset_im]; + ((int16_t*)&tmp_sample1)[0] = (int16_t)(((int32_t)amp*qam64_table[qam64_table_offset_re])>>15); + ((int16_t*)&tmp_sample1)[1] = (int16_t)(((int32_t)amp*qam64_table[qam64_table_offset_im])>>15); + + ((int16_t *)&txdataF[0][tti_offset])[0] += ((int16_t*)&tmp_sample1)[0]; + ((int16_t *)&txdataF[0][tti_offset])[1] += ((int16_t*)&tmp_sample1)[1]; + + if (frame_parms->nb_antennas_tx == 2) { + layer1prec2A(&tmp_sample1,&tmp_sample2,precoder_index); + ((int16_t*)&txdataF[1][tti_offset])[0] += ((int16_t*)&tmp_sample2)[0]; + ((int16_t*)&txdataF[1][tti_offset])[1] += ((int16_t*)&tmp_sample2)[1]; } break; - } } - } else if (mimo_mode>=TM9_10) { + } else if(mimo_mode == TM7){ + *re_allocated = *re_allocated + 1; + + if (is_not_UEspecRS(lprime,re,frame_parms->Nid_cell%3,frame_parms->Ncp,7)) { + + switch (mod_order0){ + case 2: //QPSK + + ((int16_t*)&tmp_sample1)[0] = (x0[*jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK; + *jj = *jj + 1; + ((int16_t*)&tmp_sample1)[1] = (x0[*jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK; + *jj = *jj + 1; + + //printf("%d(%d) : %d,%d => ",tti_offset,*jj,((int16_t*)&txdataF[0][tti_offset])[0],((int16_t*)&txdataF[0][tti_offset])[1]); + //printf("%d(%d) : %d,%d => ",tti_offset,*jj,((int16_t*)&tmp_sample1)[0],((int16_t*)&tmp_sample1)[1]); + for (aa=0; aa>15); + ((int16_t*)&txdataF[aa][tti_offset])[0] +=-(int16_t)((((int16_t*)&tmp_sample1)[1]*((uint16_t*)&beamforming_weights[re][aa])[1])>>15); + ((int16_t*)&txdataF[aa][tti_offset])[1] += (int16_t)((((int16_t*)&tmp_sample1)[0]*((uint16_t*)&beamforming_weights[re][aa])[1])>>15); + ((int16_t*)&txdataF[aa][tti_offset])[1] += (int16_t)((((int16_t*)&tmp_sample1)[1]*((uint16_t*)&beamforming_weights[re][aa])[0])>>15); + /* ((int16_t*)&txdataF[aa][tti_offset])[0] = ((int16_t*)&tmp_sample1)[0]; + ((int16_t*)&txdataF[aa][tti_offset])[1] = ((int16_t*)&tmp_sample1)[1]; */ + } + + //printf("%d,%d\n",((int16_t*)&txdataF[0][tti_offset])[0],((int16_t*)&txdataF[0][tti_offset])[1]); + break; + + case 4: //16QAM + + qam16_table_offset_re = 0; + qam16_table_offset_im = 0; + + if (x0[*jj] == 1) + qam16_table_offset_re+=2; + + *jj=*jj+1; + + if (x0[*jj] == 1) + qam16_table_offset_im+=2; + + *jj=*jj+1; + + + if (x0[*jj] == 1) + qam16_table_offset_re+=1; + + *jj=*jj+1; + + if (x0[*jj] == 1) + qam16_table_offset_im+=1; + + *jj=*jj+1; + + ((int16_t*)&tmp_sample1)[0] = (int16_t)(((int32_t)amp*qam16_table[qam16_table_offset_re])>>15); + ((int16_t*)&tmp_sample1)[1] = (int16_t)(((int32_t)amp*qam16_table[qam16_table_offset_im])>>15); + + for (aa=0; aa>15); + ((int16_t*)&txdataF[aa][tti_offset])[0] +=-(int16_t)((((int16_t*)&tmp_sample1)[1]*((int16_t*)&beamforming_weights[re][aa])[1])>>15); + ((int16_t*)&txdataF[aa][tti_offset])[1] += (int16_t)((((int16_t*)&tmp_sample1)[0]*((int16_t*)&beamforming_weights[re][aa])[1])>>15); + ((int16_t*)&txdataF[aa][tti_offset])[1] += (int16_t)((((int16_t*)&tmp_sample1)[1]*((int16_t*)&beamforming_weights[re][aa])[0])>>15); + } + + break; + + case 6: //64QAM + + + qam64_table_offset_re = 0; + qam64_table_offset_im = 0; + + if (x0[*jj] == 1) + qam64_table_offset_re+=4; + + *jj=*jj+1; + + if (x0[*jj] == 1) + qam64_table_offset_im+=4; + + *jj=*jj+1; + + if (x0[*jj] == 1) + qam64_table_offset_re+=2; + + *jj=*jj+1; + + if (x0[*jj] == 1) + qam64_table_offset_im+=2; + + *jj=*jj+1; + + if (x0[*jj] == 1) + qam64_table_offset_re+=1; + + *jj=*jj+1; + + if (x0[*jj] == 1) + qam64_table_offset_im+=1; + + *jj=*jj+1; + + ((int16_t*)&tmp_sample1)[0] = (int16_t)(((int32_t)amp*qam64_table[qam64_table_offset_re])>>15); + ((int16_t*)&tmp_sample1)[1] = (int16_t)(((int32_t)amp*qam64_table[qam64_table_offset_im])>>15); + + for (aa=0; aa>15); + ((int16_t*)&txdataF[aa][tti_offset])[0] +=-(int16_t)((((int16_t*)&tmp_sample1)[1]*((int16_t*)&beamforming_weights[re][aa])[1])>>15); + ((int16_t*)&txdataF[aa][tti_offset])[1] += (int16_t)((((int16_t*)&tmp_sample1)[0]*((int16_t*)&beamforming_weights[re][aa])[1])>>15); + ((int16_t*)&txdataF[aa][tti_offset])[1] += (int16_t)((((int16_t*)&tmp_sample1)[1]*((int16_t*)&beamforming_weights[re][aa])[0])>>15); + } + + break; + + } + } else{ + //precoding UE spec RS + //printf("precoding UE spec RS\n"); + + for (aa=0; aa>4; + mprime_qpsk_symb = mprime2&0xf; + + tmp_sample1 = qpsk[(phy_vars_eNB->lte_gold_uespec_port5_table[0][Ns][lprime][mprime_dword]>>(2*mprime_qpsk_symb))&3]; + //printf("tmp_sample1=%d+i%d\n",((int16_t*)&tmp_sample1)[0],((int16_t*)&tmp_sample1)[1]); + //printf("beamforing_weights[%d][%d]=%d+i%d\n",re,aa,((int16_t*)&beamforming_weights[re][aa])[0],((int16_t*)&beamforming_weights[re][aa])[1]); + + ((int16_t*)&txdataF[aa][tti_offset])[0] += (int16_t)((((int16_t*)&tmp_sample1)[0]*((uint16_t*)&beamforming_weights[re][aa])[0])>>15); + ((int16_t*)&txdataF[aa][tti_offset])[0] +=-(int16_t)((((int16_t*)&tmp_sample1)[1]*((uint16_t*)&beamforming_weights[re][aa])[1])>>15); + ((int16_t*)&txdataF[aa][tti_offset])[1] += (int16_t)((((int16_t*)&tmp_sample1)[0]*((uint16_t*)&beamforming_weights[re][aa])[1])>>15); + ((int16_t*)&txdataF[aa][tti_offset])[1] += (int16_t)((((int16_t*)&tmp_sample1)[1]*((uint16_t*)&beamforming_weights[re][aa])[0])>>15); + + // ((int16_t*)&txdataF[aa][tti_offset])[0] = 0xffff; + // ((int16_t*)&txdataF[aa][tti_offset])[1] = 0xffff; + + mprime2 = mprime2++; + //printf("**txdataF[%d][%d]= %d+i%d\n ",aa,tti_offset,((int16_t*)&txdataF[aa][tti_offset])[0],((int16_t*)&txdataF[aa][tti_offset])[1]); + } + + } + } else if (mimo_mode == TM8) { //TM8 msg("allocate_REs_in_RB() [dlsch.c] : ERROR, unknown mimo_mode %d\n",mimo_mode); return(-1); } + if (mimo_mode == ALAMOUTI) { + re++; // adjacent carriers are taken care of by precoding + *re_allocated = *re_allocated + 1; + + if (is_not_pilot(pilots,re,frame_parms->nushift,use2ndpilots)==0) { + re++; + *re_allocated = *re_allocated + 1; + } + } + } } - return(0); +return(0); } int allocate_REs_in_RB_MCH(mod_sym_t **txdataF, uint32_t *jj, - uint16_t re_offset, - uint32_t symbol_offset, - uint8_t *x0, - uint8_t l, - uint8_t mod_order, - int16_t amp, - int16_t *qam_table_s, - uint32_t *re_allocated, - uint8_t skip_dc, - LTE_DL_FRAME_PARMS *frame_parms) + uint16_t re_offset, + uint32_t symbol_offset, + uint8_t *x0, + uint8_t l, + uint8_t mod_order, + int16_t amp, + int16_t *qam_table_s, + uint32_t *re_allocated, + uint8_t skip_dc, + LTE_DL_FRAME_PARMS *frame_parms) { uint32_t tti_offset,aa; @@ -1033,99 +1116,99 @@ int allocate_REs_in_RB_MCH(mod_sym_t **txdataF, switch (mod_order) { - case 2: //QPSK + case 2: //QPSK - // printf("%d : %d,%d => ",tti_offset,((int16_t*)&txdataF[0][tti_offset])[0],((int16_t*)&txdataF[0][tti_offset])[1]); - for (aa=0; aanb_antennas_tx; aa++) - ((int16_t*)&txdataF[aa][tti_offset])[0] += (x0[*jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK; //I //b_i + // printf("%d : %d,%d => ",tti_offset,((int16_t*)&txdataF[0][tti_offset])[0],((int16_t*)&txdataF[0][tti_offset])[1]); + for (aa=0; aanb_antennas_tx; aa++) + ((int16_t*)&txdataF[aa][tti_offset])[0] += (x0[*jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK; //I //b_i - *jj = *jj + 1; + *jj = *jj + 1; - for (aa=0; aanb_antennas_tx; aa++) - ((int16_t*)&txdataF[aa][tti_offset])[1] += (x0[*jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK; //Q //b_{i+1} + for (aa=0; aanb_antennas_tx; aa++) + ((int16_t*)&txdataF[aa][tti_offset])[1] += (x0[*jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK; //Q //b_{i+1} - *jj = *jj + 1; + *jj = *jj + 1; - // printf("%d,%d\n",((int16_t*)&txdataF[0][tti_offset])[0],((int16_t*)&txdataF[0][tti_offset])[1]); - break; + // printf("%d,%d\n",((int16_t*)&txdataF[0][tti_offset])[0],((int16_t*)&txdataF[0][tti_offset])[1]); + break; - case 4: //16QAM + case 4: //16QAM - qam16_table_offset_re = 0; - qam16_table_offset_im = 0; + qam16_table_offset_re = 0; + qam16_table_offset_im = 0; - if (x0[*jj] == 1) - qam16_table_offset_re+=2; + if (x0[*jj] == 1) + qam16_table_offset_re+=2; - *jj=*jj+1; + *jj=*jj+1; - if (x0[*jj] == 1) - qam16_table_offset_im+=2; + if (x0[*jj] == 1) + qam16_table_offset_im+=2; - *jj=*jj+1; + *jj=*jj+1; - if (x0[*jj] == 1) - qam16_table_offset_re+=1; + if (x0[*jj] == 1) + qam16_table_offset_re+=1; - *jj=*jj+1; + *jj=*jj+1; - if (x0[*jj] == 1) - qam16_table_offset_im+=1; + if (x0[*jj] == 1) + qam16_table_offset_im+=1; - *jj=*jj+1; + *jj=*jj+1; - for (aa=0; aanb_antennas_tx; aa++) { - ((int16_t *)&txdataF[aa][tti_offset])[0]+=qam_table_s[qam16_table_offset_re]; - ((int16_t *)&txdataF[aa][tti_offset])[1]+=qam_table_s[qam16_table_offset_im]; - // ((int16_t *)&txdataF[aa][tti_offset])[0]+=(int16_t)(((int32_t)amp*qam16_table[qam16_table_offset_re])>>15); - // ((int16_t *)&txdataF[aa][tti_offset])[1]+=(int16_t)(((int32_t)amp*qam16_table[qam16_table_offset_im])>>15); - } + for (aa=0; aanb_antennas_tx; aa++) { + ((int16_t *)&txdataF[aa][tti_offset])[0]+=qam_table_s[qam16_table_offset_re]; + ((int16_t *)&txdataF[aa][tti_offset])[1]+=qam_table_s[qam16_table_offset_im]; + // ((int16_t *)&txdataF[aa][tti_offset])[0]+=(int16_t)(((int32_t)amp*qam16_table[qam16_table_offset_re])>>15); + // ((int16_t *)&txdataF[aa][tti_offset])[1]+=(int16_t)(((int32_t)amp*qam16_table[qam16_table_offset_im])>>15); + } - break; + break; - case 6: //64QAM + case 6: //64QAM - qam64_table_offset_re = 0; - qam64_table_offset_im = 0; + qam64_table_offset_re = 0; + qam64_table_offset_im = 0; - if (x0[*jj] == 1) - qam64_table_offset_re+=4; + if (x0[*jj] == 1) + qam64_table_offset_re+=4; - *jj=*jj+1; + *jj=*jj+1; - if (x0[*jj] == 1) - qam64_table_offset_im+=4; + if (x0[*jj] == 1) + qam64_table_offset_im+=4; - *jj=*jj+1; + *jj=*jj+1; - if (x0[*jj] == 1) - qam64_table_offset_re+=2; + if (x0[*jj] == 1) + qam64_table_offset_re+=2; - *jj=*jj+1; + *jj=*jj+1; - if (x0[*jj] == 1) - qam64_table_offset_im+=2; + if (x0[*jj] == 1) + qam64_table_offset_im+=2; - *jj=*jj+1; + *jj=*jj+1; - if (x0[*jj] == 1) - qam64_table_offset_re+=1; + if (x0[*jj] == 1) + qam64_table_offset_re+=1; - *jj=*jj+1; + *jj=*jj+1; - if (x0[*jj] == 1) - qam64_table_offset_im+=1; + if (x0[*jj] == 1) + qam64_table_offset_im+=1; - *jj=*jj+1; + *jj=*jj+1; - for (aa=0; aanb_antennas_tx; aa++) { - ((int16_t *)&txdataF[aa][tti_offset])[0]+=qam_table_s[qam64_table_offset_re];//(int16_t)(((int32_t)amp*qam64_table[qam64_table_offset_re])>>15); - ((int16_t *)&txdataF[aa][tti_offset])[1]+=qam_table_s[qam64_table_offset_im];//(int16_t)(((int32_t)amp*qam64_table[qam64_table_offset_im])>>15); - } + for (aa=0; aanb_antennas_tx; aa++) { + ((int16_t *)&txdataF[aa][tti_offset])[0]+=qam_table_s[qam64_table_offset_re];//(int16_t)(((int32_t)amp*qam64_table[qam64_table_offset_re])>>15); + ((int16_t *)&txdataF[aa][tti_offset])[1]+=qam_table_s[qam64_table_offset_im];//(int16_t)(((int32_t)amp*qam64_table[qam64_table_offset_im])>>15); + } - break; + break; } } @@ -1142,50 +1225,52 @@ uint8_t get_pmi(uint8_t N_RB_DL,LTE_DL_eNB_HARQ_t *dlsch_harq,uint16_t rb) // printf("Getting pmi for RB %d => %d\n",rb,(pmi_alloc>>((rb>>2)<<1))&3); switch (N_RB_DL) { - case 6: // 1 PRB per subband - if (mode <= PUSCH_PRECODING1) - return((pmi_alloc>>(rb<<1))&3); - else - return((pmi_alloc>>rb)&1); + case 6: // 1 PRB per subband + if (mode <= PUSCH_PRECODING1) + return((pmi_alloc>>(rb<<1))&3); + else + return((pmi_alloc>>rb)&1); - break; + break; - default: - case 25: // 4 PRBs per subband - if (mode <= PUSCH_PRECODING1) - return((pmi_alloc>>((rb>>2)<<1))&3); - else - return((pmi_alloc>>(rb>>2))&1); + default: + case 25: // 4 PRBs per subband + if (mode <= PUSCH_PRECODING1) + return((pmi_alloc>>((rb>>2)<<1))&3); + else + return((pmi_alloc>>(rb>>2))&1); - break; + break; - case 50: // 6 PRBs per subband - if (mode <= PUSCH_PRECODING1) - return((pmi_alloc>>((rb/6)<<1))&3); - else - return((pmi_alloc>>(rb/6))&1); + case 50: // 6 PRBs per subband + if (mode <= PUSCH_PRECODING1) + return((pmi_alloc>>((rb/6)<<1))&3); + else + return((pmi_alloc>>(rb/6))&1); - break; + break; - case 100: // 8 PRBs per subband - if (mode <= PUSCH_PRECODING1) - return((pmi_alloc>>((rb>>3)<<1))&3); - else - return((pmi_alloc>>(rb>>3))&1); + case 100: // 8 PRBs per subband + if (mode <= PUSCH_PRECODING1) + return((pmi_alloc>>((rb>>3)<<1))&3); + else + return((pmi_alloc>>(rb>>3))&1); - break; + break; } } -int dlsch_modulation(mod_sym_t **txdataF, +int dlsch_modulation(PHY_VARS_eNB* phy_vars_eNB, + mod_sym_t **txdataF, int16_t amp, uint32_t subframe_offset, - LTE_DL_FRAME_PARMS *frame_parms, uint8_t num_pdcch_symbols, LTE_eNB_DLSCH_t *dlsch0, - LTE_eNB_DLSCH_t *dlsch1) + LTE_eNB_DLSCH_t *dlsch1, + int32_t **beamforming_weights) { + LTE_DL_FRAME_PARMS *frame_parms = &phy_vars_eNB->lte_frame_parms; uint8_t nsymb; uint8_t harq_pid = dlsch0->current_harq_pid; @@ -1195,7 +1280,7 @@ int dlsch_modulation(mod_sym_t **txdataF, uint16_t l,rb,re_offset; uint32_t rb_alloc_ind; uint32_t *rb_alloc = dlsch0_harq->rb_alloc; - uint8_t pilots=0; + uint8_t pilots=0,ue_spec_rs=0; uint8_t skip_dc,skip_half; uint8_t mod_order0 = get_Qm(dlsch0_harq->mcs); uint8_t mod_order1 = 0; @@ -1203,6 +1288,11 @@ int dlsch_modulation(mod_sym_t **txdataF, int16_t qam16_table_a0[4],qam64_table_a0[8],qam16_table_b0[4],qam64_table_b0[8]; int16_t qam16_table_a1[4],qam64_table_a1[8],qam16_table_b1[4],qam64_table_b1[8]; int16_t *qam_table_s0,*qam_table_s1; + MIMO_mode_t mimo_mode = dlsch0_harq->mimo_mode; + uint8_t beamforming_mode = 0; + int32_t **beamforming_weights_RB = beamforming_weights; + uint8_t lprime, mprime=0,Ns; + #ifdef DEBUG_DLSCH_MODULATION uint8_t Nl0 = dlsch0_harq->Nl; uint8_t Nl1; @@ -1224,7 +1314,7 @@ int dlsch_modulation(mod_sym_t **txdataF, amp_rho_b = (int16_t)(((int32_t)amp*dlsch0->sqrt_rho_b)>>13); if (mod_order0 == 4) - for (i=0; i<4; i++) { + for (i=0;i<4; i++) { qam16_table_a0[i] = (int16_t)(((int32_t)qam16_table[i]*amp_rho_a)>>15); qam16_table_b0[i] = (int16_t)(((int32_t)qam16_table[i]*amp_rho_b)>>15); } @@ -1281,6 +1371,35 @@ int dlsch_modulation(mod_sym_t **txdataF, pilots=0; } + if(mimo_mode==TM7){ //36.211 V8.6.0 2009-03 + beamforming_mode = 7; + mprime = 0; + if (frame_parms->Ncp==0) { // normal prefix + if ((l==6)||(l==12)) + lprime=2; // pilots in nushift+3, nushift+9 + else if ((l==3)||(l==9)) + lprime=1; // pilots in nushift, nushift+6 + else + lprime=0; + } else { + if ((l==7)) + lprime=2; + else if ((l==4)||(l==10)) + lprime=1; + else + lprime=0; + } + }else if(mimo_mode==TM8){ + beamforming_mode = 8; + }else if(mimo_mode==TM9_10){ + beamforming_mode = 9; + } + + if(l<=(nsymb>>2)) + Ns=0; + else + Ns=1; + re_offset = frame_parms->first_carrier_offset; symbol_offset = (uint32_t)frame_parms->ofdm_symbol_size*(l+(subframe_offset*nsymb)); @@ -1392,7 +1511,7 @@ int dlsch_modulation(mod_sym_t **txdataF, if (frame_parms->frame_type == TDD) { // TDD //SSS if (((subframe_offset==0)|| - (subframe_offset==5)) && + (subframe_offset==5)) && (rb>=((frame_parms->N_RB_DL>>1)-3)) && (rb<((frame_parms->N_RB_DL>>1)+3)) && (l==nsymb-1) ) { @@ -1401,7 +1520,7 @@ int dlsch_modulation(mod_sym_t **txdataF, //PSS if (((subframe_offset==1)|| - (subframe_offset==6)) && + (subframe_offset==6)) && (rb>=((frame_parms->N_RB_DL>>1)-3)) && (rb<((frame_parms->N_RB_DL>>1)+3)) && (l==2) ) { @@ -1448,7 +1567,7 @@ int dlsch_modulation(mod_sym_t **txdataF, if (rb_alloc_ind > 0) { // printf("Allocated rb %d/symbol %d, skip_half %d, subframe_offset %d, symbol_offset %d, re_offset %d, jj %d\n",rb,l,skip_half,subframe_offset,symbol_offset,re_offset,jj); - allocate_REs_in_RB(frame_parms, + allocate_REs_in_RB(phy_vars_eNB, txdataF, &jj, &jj2, @@ -1463,23 +1582,36 @@ int dlsch_modulation(mod_sym_t **txdataF, qam_table_s1, &re_allocated, skip_dc, - skip_half); + skip_half, + lprime, + mprime, + Ns, + beamforming_weights_RB); + + if(mimo_mode==TM7){ + if(frame_parms->Ncp==0&&(l==3||l==6||l==9||l==12)) + mprime +=3; + else if(frame_parms->Ncp==1&&(l==4||l==7||l==10)) + mprime +=4; + } } re_offset+=12; // go to next RB + beamforming_weights_RB +=12; // check if we crossed the symbol boundary and skip DC if (re_offset >= frame_parms->ofdm_symbol_size) { - if (skip_dc == 0) //even number of RBs (doesn't straddle DC) - re_offset=1; - else - re_offset=7; // odd number of RBs - } - } + if (skip_dc == 0) //even number of RBs (doesn't straddle DC) + re_offset=1; + else + re_offset=7; // odd number of RBs + } + beamforming_weights_RB = beamforming_weights; + } - } + } diff --git a/openair1/PHY/LTE_TRANSPORT/lte_mcs.c b/openair1/PHY/LTE_TRANSPORT/lte_mcs.c index 6e253c3b63..0c846f3aa7 100644 --- a/openair1/PHY/LTE_TRANSPORT/lte_mcs.c +++ b/openair1/PHY/LTE_TRANSPORT/lte_mcs.c @@ -333,11 +333,8 @@ int adjust_G(LTE_DL_FRAME_PARMS *frame_parms,uint32_t *rb_alloc,uint8_t mod_orde return(0); } -int get_G(LTE_DL_FRAME_PARMS *frame_parms,uint16_t nb_rb,uint32_t *rb_alloc,uint8_t mod_order,uint8_t Nl,uint8_t num_pdcch_symbols,int frame,uint8_t subframe) +int get_G(LTE_DL_FRAME_PARMS *frame_parms,uint16_t nb_rb,uint32_t *rb_alloc,uint8_t mod_order,uint8_t Nl,uint8_t num_pdcch_symbols,int frame,uint8_t subframe,uint8_t beamforming_mode) { - - - int G_adj; if (is_pmch_subframe(frame,subframe,frame_parms) == 0) { @@ -348,9 +345,11 @@ int get_G(LTE_DL_FRAME_PARMS *frame_parms,uint16_t nb_rb,uint32_t *rb_alloc,uint // PDDDPDD PDDDPDD - 13 PDSCH symbols, 10 full, 3 w/ pilots = 10*12 + 3*8 // PCDDPDD PDDDPDD - 12 PDSCH symbols, 9 full, 3 w/ pilots = 9*12 + 3*8 // PCCDPDD PDDDPDD - 11 PDSCH symbols, 8 full, 3 w/pilots = 8*12 + 3*8 - if (frame_parms->mode1_flag==0) // SISO + if (beamforming_mode==0 && frame_parms->mode1_flag==0) return((((int)nb_rb * mod_order * ((11-num_pdcch_symbols)*12 + 3*8)) - G_adj)*Nl); - else + else if(beamforming_mode==7) + return(((int)nb_rb * mod_order * ((7-num_pdcch_symbols)*12 + 3*10 + 4*9)) - G_adj); + else //SISO return(((int)nb_rb * mod_order * ((11-num_pdcch_symbols)*12 + 3*10)) - G_adj); } else { // PDDPDD PDDPDD - 11 PDSCH symbols, 8 full, 3 w/ pilots = 8*12 + 3*8 @@ -358,7 +357,9 @@ int get_G(LTE_DL_FRAME_PARMS *frame_parms,uint16_t nb_rb,uint32_t *rb_alloc,uint // PCCPDD PDDPDD - 9 PDSCH symbols, 6 full, 3 w/pilots = 6*12 + 3*8 if (frame_parms->mode1_flag==0) return((((int)nb_rb * mod_order * ((9-num_pdcch_symbols)*12 + 3*8)) - G_adj)*Nl); - else + else if(beamforming_mode==7) + return(((int)nb_rb * mod_order * ((5-num_pdcch_symbols)*12 + 3*8 + 4*9)) - G_adj); + else //SISO return(((int)nb_rb * mod_order * ((9-num_pdcch_symbols)*12 + 3*10)) - G_adj); } } else { // This is an MBSFN subframe diff --git a/openair1/PHY/LTE_TRANSPORT/pilots_ue_spec.c b/openair1/PHY/LTE_TRANSPORT/pilots_ue_spec.c new file mode 100644 index 0000000000..310204eea9 --- /dev/null +++ b/openair1/PHY/LTE_TRANSPORT/pilots_ue_spec.c @@ -0,0 +1,217 @@ +/******************************************************************************* + OpenAirInterface + Copyright(c) 1999 - 2014 Eurecom + + OpenAirInterface is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + + OpenAirInterface is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with OpenAirInterface.The full GNU General Public License is + included in this distribution in the file called "COPYING". If not, + see . + + Contact Information + OpenAirInterface Admin: openair_admin@eurecom.fr + OpenAirInterface Tech : openair_tech@eurecom.fr + OpenAirInterface Dev : openair4g-devel@eurecom.fr + + Address : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE + + *******************************************************************************/ + +/*! \file PHY/LTE_TRANSPORT/uespec_pilots.c +* \brief Top-level routines for generating DL ue-specific reference signals V12.5 2015-03 +* \author X.JIANG +* \date 2011 +* \version 0.1 +* \company Eurecom +* \email: xiwen.jiangeurecom.fr +* \note +* \warning +*/ +//#include "defs.h" +#include "PHY/defs.h" + +void generate_ue_spec_pilots(PHY_VARS_eNB *phy_vars_eNB, + uint8_t UE_id, + mod_sym_t **txdataF, + int16_t amp, + uint16_t Ntti, + uint8_t beamforming_mode) +{ + + LTE_DL_FRAME_PARMS *frame_parms = &phy_vars_eNB->lte_frame_parms; + + uint32_t tti,tti_offset,slot_offset,Nsymb,samples_per_symbol; + uint8_t second_pilot,aa; + + // printf("Doing TX pilots Nsymb %d, second_pilot %d\n",Nsymb,second_pilot); + + switch(beamforming_mode){ + case 7: + for (tti=0; ttiofdm_symbol_size*Nsymb; + samples_per_symbol = frame_parms->ofdm_symbol_size; + slot_offset = (tti*2)%20; + + // printf("tti %d : offset %d (slot %d)\n",tti,tti_offset,slot_offset); + //Generate UE specific Pilots + printf("generate_dl_ue_spec:tti_offset=%d\n",tti_offset); + + if(frame_parms->Ncp==0) { + for(aa=0;aanb_antennas_tx_phy;aa++){ + //antenna port 5 symbol 0 slot 0 + lte_dl_ue_spec(phy_vars_eNB, + UE_id, + &txdataF[aa][tti_offset+3*samples_per_symbol], + amp, + slot_offset, + 1, + 5, + 0); + + //antenna port 5 symbol 1 slot 0 + lte_dl_ue_spec(phy_vars_eNB, + UE_id, + &txdataF[aa][tti_offset+6*samples_per_symbol], + amp, + slot_offset, + 1, + 5, + 0); + + //antenna port 5 symbol 0 slot 1 + lte_dl_ue_spec(phy_vars_eNB, + UE_id, + &txdataF[aa][tti_offset+9*samples_per_symbol], + amp, + slot_offset+1, + 0, + 5, + 0); + + //antenna port 5 symbol 1 slot 1 + lte_dl_ue_spec(phy_vars_eNB, + UE_id, + &txdataF[aa][tti_offset+12*samples_per_symbol], + amp, + slot_offset+1, + 1, + 5, + 0); + } + } else{ + msg("generate_ue_soec_pilots:Extented Cyclic Prefix for TM7 is not supported yet.\n"); + } + + + } + break; + + case 8: + case 9: + case 10: + default: + msg("[generate_ue_spec_pilots(in uespec_pilots.c)]ERROR:beamforming mode %d is not supported\n",beamforming_mode); + + } +} + +/*int generate_ue_spec_pilots_slot(PHY_VARS_eNB *phy_vars_eNB, + mod_sym_t **txdataF, + int16_t amp, + uint16_t slot, + int first_pilot_only) +{ + + LTE_DL_FRAME_PARMS *frame_parms = &phy_vars_eNB->lte_frame_parms; + uint32_t slot_offset,Nsymb,samples_per_symbol; + uint8_t second_pilot; + + if (slot<0 || slot>= 20) { + msg("generate_pilots_slot: slot not in range (%d)\n",slot); + return(-1); + } + + Nsymb = (frame_parms->Ncp==0)?7:6; + second_pilot = (frame_parms->Ncp==0)?4:3; + + + slot_offset = slot*frame_parms->ofdm_symbol_size*Nsymb; + samples_per_symbol = frame_parms->ofdm_symbol_size; + + // printf("tti %d : offset %d (slot %d)\n",tti,tti_offset,slot_offset); + //Generate Pilots + + //antenna 0 symbol 0 slot 0 + lte_dl_cell_spec(phy_vars_eNB, + &txdataF[0][slot_offset], + amp, + slot, + 0, + 0); + + + if (first_pilot_only==0) { + //antenna 0 symbol 3 slot 0 + lte_dl_cell_spec(phy_vars_eNB, + &txdataF[0][slot_offset+(second_pilot*samples_per_symbol)], + amp, + slot, + 1, + 0); + } + + if (frame_parms->nb_antennas_tx > 1) { + if (frame_parms->mode1_flag) { + // antenna 1 symbol 0 slot 0 + lte_dl_cell_spec(phy_vars_eNB, + &txdataF[1][slot_offset], + amp, + slot, + 0, + 0); + + if (first_pilot_only==0) { + // antenna 1 symbol 3 slot 0 + lte_dl_cell_spec(phy_vars_eNB, + &txdataF[1][slot_offset+(second_pilot*samples_per_symbol)], + amp, + slot, + 1, + 0); + } + } else { + + // antenna 1 symbol 0 slot 0 + lte_dl_cell_spec(phy_vars_eNB, + &txdataF[1][slot_offset], + amp, + slot, + 0, + 1); + + if (first_pilot_only == 0) { + // antenna 1 symbol 3 slot 0 + lte_dl_cell_spec(phy_vars_eNB, + &txdataF[1][slot_offset+(second_pilot*samples_per_symbol)], + amp, + slot, + 1, + 1); + } + } + } + + return(0); +}*/ + diff --git a/openair1/PHY/LTE_TRANSPORT/pmch.c b/openair1/PHY/LTE_TRANSPORT/pmch.c index 3082bff917..422f607464 100644 --- a/openair1/PHY/LTE_TRANSPORT/pmch.c +++ b/openair1/PHY/LTE_TRANSPORT/pmch.c @@ -304,7 +304,7 @@ void generate_mch(PHY_VARS_eNB *phy_vars_eNB,int sched_subframe,uint8_t *a,int a phy_vars_eNB->lte_frame_parms.N_RB_DL, phy_vars_eNB->dlsch_eNB_MCH->harq_processes[0]->rb_alloc, get_Qm(phy_vars_eNB->dlsch_eNB_MCH->harq_processes[0]->mcs),1, - 2,phy_vars_eNB->proc[sched_subframe].frame_tx,subframe); + 2,phy_vars_eNB->proc[sched_subframe].frame_tx,subframe,0); generate_mbsfn_pilot(phy_vars_eNB, phy_vars_eNB->lte_eNB_common_vars.txdataF[0], @@ -319,8 +319,7 @@ void generate_mch(PHY_VARS_eNB *phy_vars_eNB,int sched_subframe,uint8_t *a,int a subframe, &phy_vars_eNB->dlsch_rate_matching_stats, &phy_vars_eNB->dlsch_turbo_encoding_stats, - &phy_vars_eNB->dlsch_interleaving_stats - )<0) + &phy_vars_eNB->dlsch_interleaving_stats)<0) mac_xface->macphy_exit("problem in dlsch_encoding"); dlsch_scrambling(&phy_vars_eNB->lte_frame_parms,1,phy_vars_eNB->dlsch_eNB_MCH,G,0,subframe<<1); diff --git a/openair1/PHY/LTE_TRANSPORT/proto.h b/openair1/PHY/LTE_TRANSPORT/proto.h index 5fe7518004..58a1177a37 100644 --- a/openair1/PHY/LTE_TRANSPORT/proto.h +++ b/openair1/PHY/LTE_TRANSPORT/proto.h @@ -1,4 +1,4 @@ -/******************************************************************************* +/****************************************************************************** OpenAirInterface Copyright(c) 1999 - 2014 Eurecom @@ -157,11 +157,14 @@ void dlsch_encoding_emul(PHY_VARS_eNB *phy_vars_eNB, \param re_allocated pointer to allocation counter \param skip_dc offset for positive RBs \param skip_half indicate that first or second half of RB must be skipped for PBCH/PSS/SSS + \param ue_spec_rs UE specific RS indicator + \param nb_antennas_tx_phy Physical antenna elements which can be different with antenna port number, especially in beamforming case + \param beamforming_weights_rb Beamforming weights applied on each antenna element and each carrier in case of TM7-10 \param use2ndpilots Set to use the pilots from antenna port 1 for PDSCH \param frame_parms Frame parameter descriptor */ -int32_t allocate_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms, +int32_t allocate_REs_in_RB(PHY_VARS_eNB* phy_vars_eNB, mod_sym_t **txdataF, uint32_t *jj, uint32_t *jj2, @@ -176,8 +179,11 @@ int32_t allocate_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms, int16_t *qam_table_s1, uint32_t *re_allocated, uint8_t skip_dc, - uint8_t skip_half); - + uint8_t skip_half, + uint8_t lprime, + uint8_t mprime, + uint8_t Ns, + int32_t **beamforming_weights); /** \fn int32_t dlsch_modulation(mod_sym_t **txdataF, int16_t amp, @@ -194,15 +200,17 @@ int32_t allocate_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms, @param num_pdcch_symbols Number of PDCCH symbols in this subframe @param dlsch0 Pointer to Transport Block 0 DLSCH descriptor for this allocation @param dlsch1 Pointer to Transport Block 0 DLSCH descriptor for this allocation - + @param nb_antennas_tx_phy Physical antenna elements which can be different with antenna port number, especially in beamforming case + @param beamforming_weights Beamforming weights applied on each antenna element and each carrier in case of TM7-10 */ -int32_t dlsch_modulation(mod_sym_t **txdataF, +int32_t dlsch_modulation(PHY_VARS_eNB* phy_vars_eNB, + mod_sym_t **txdataF, int16_t amp, uint32_t sub_frame_offset, - LTE_DL_FRAME_PARMS *frame_parms, uint8_t num_pdcch_symbols, LTE_eNB_DLSCH_t *dlsch0, - LTE_eNB_DLSCH_t *dlsch1); + LTE_eNB_DLSCH_t *dlsch1, + int32_t **beamforming_weights); /* \brief This function is the top-level routine for generation of the sub-frame signal (frequency-domain) for MCH. @param txdataF Table of pointers for frequency-domain TX signals @@ -295,6 +303,13 @@ int32_t generate_mbsfn_pilot(PHY_VARS_eNB *phy_vars_eNB, int16_t amp, uint16_t subframe); +void generate_ue_spec_pilots(PHY_VARS_eNB *phy_vars_eNB, + uint8_t UE_id, + mod_sym_t **txdataF, + int16_t amp, + uint16_t Ntti, + uint8_t beamforming_mode); + int32_t generate_pss(mod_sym_t **txdataF, int16_t amp, LTE_DL_FRAME_PARMS *frame_parms, @@ -680,6 +695,7 @@ int dlsch_64qam_64qam_llr(LTE_DL_FRAME_PARMS *frame_parms, @param nb_rb number of RBs for this allocation @param pbch_pss_sss_adj Number of channel bits taken by PBCH/PSS/SSS @param llr128p pointer to pointer to symbol in dlsch_llr + @param beamforming_mode beamforming mode */ int32_t dlsch_qpsk_llr(LTE_DL_FRAME_PARMS *frame_parms, int32_t **rxdataF_comp, @@ -688,7 +704,8 @@ int32_t dlsch_qpsk_llr(LTE_DL_FRAME_PARMS *frame_parms, uint8_t first_symbol_flag, uint16_t nb_rb, uint16_t pbch_pss_sss_adj, - int16_t **llr128p); + int16_t **llr128p, + uint8_t beamforming_mode); /** \brief This function generates log-likelihood ratios (decoder input) for single-stream 16QAM received waveforms @@ -904,6 +921,16 @@ uint16_t dlsch_extract_rbs_dual(int32_t **rxdataF, uint32_t high_speed_flag, LTE_DL_FRAME_PARMS *frame_parms); +uint16_t dlsch_extract_rbs_TM7(int32_t **rxdataF, + int32_t **dl_bf_ch_estimates, + int32_t **rxdataF_ext, + int32_t **dl_bf_ch_estimates_ext, + uint32_t *rb_alloc, + uint8_t symbol, + uint8_t subframe, + uint32_t high_speed_flag, + LTE_DL_FRAME_PARMS *frame_parms); + /** \brief This function performs channel compensation (matched filtering) on the received RBs for this allocation. In addition, it computes the squared-magnitude of the channel with weightings for 16QAM/64QAM detection as well as dual-stream detection (cross-correlation) @param rxdataF_ext Frequency-domain received signal in RBs to be demodulated @param dl_ch_estimates_ext Frequency-domain channel estimates in RBs to be demodulated @@ -1249,7 +1276,7 @@ uint8_t get_transmission_mode(module_id_t Mod_id, uint8_t CC_id, rnti_t rnti); */ uint32_t conv_nprb(uint8_t ra_header,uint32_t rb_alloc,int N_RB_DL); -int get_G(LTE_DL_FRAME_PARMS *frame_parms,uint16_t nb_rb,uint32_t *rb_alloc,uint8_t mod_order,uint8_t Nl,uint8_t num_pdcch_symbols,int frame,uint8_t subframe); +int get_G(LTE_DL_FRAME_PARMS *frame_parms,uint16_t nb_rb,uint32_t *rb_alloc,uint8_t mod_order,uint8_t Nl,uint8_t num_pdcch_symbols,int frame,uint8_t subframe, uint8_t beamforming_mode); int adjust_G(LTE_DL_FRAME_PARMS *frame_parms,uint32_t *rb_alloc,uint8_t mod_order,uint8_t subframe); int adjust_G2(LTE_DL_FRAME_PARMS *frame_parms,uint32_t *rb_alloc,uint8_t mod_order,uint8_t subframe,uint8_t symbol); @@ -1551,7 +1578,7 @@ uint8_t phich_subframe2_pusch_subframe(LTE_DL_FRAME_PARMS *frame_parms,uint8_t s @param subframe Subframe of received/transmitted PHICH @returns frame of PUSCH transmission */ -uint8_t phich_frame2_pusch_frame(LTE_DL_FRAME_PARMS *frame_parms,frame_t frame,uint8_t subframe);; +uint8_t phich_frame2_pusch_frame(LTE_DL_FRAME_PARMS *frame_parms,frame_t frame,uint8_t subframe); void print_CQI(void *o,UCI_format_t uci_format,uint8_t eNB_id,int N_RB_DL); diff --git a/openair1/PHY/MODULATION/slot_fep.c b/openair1/PHY/MODULATION/slot_fep.c index 670a852b67..5bbea87c88 100644 --- a/openair1/PHY/MODULATION/slot_fep.c +++ b/openair1/PHY/MODULATION/slot_fep.c @@ -241,6 +241,15 @@ int slot_fep(PHY_VARS_UE *phy_vars_ue, } } + // printf("slot_fep:transmission_mode[%d] = %d\n", eNB_id, phy_vars_ue->transmission_mode[eNB_id]); + if(phy_vars_ue->transmission_mode[eNB_id] == 7) + if(frame_parms->Ncp==0 && (symbol==3) || (symbol==6) || (symbol==9) || (symbol==12)) + lte_dl_bf_channel_estimation(phy_vars_ue,eNB_id,0,Ns,5,symbol); + else if(frame_parms->Ncp==1 && (symbol==4) || (symbol==7) || (symbol==10)) + msg("slot_fep(slot_fep.c):channel estimation not supported yet for TM7 extented CP.\n"); + else if(phy_vars_ue->transmission_mode[eNB_id] > 7) + msg("slot_fep(slot_fep.c):transmission mode not supported yet.\n"); + } #ifdef DEBUG_FEP diff --git a/openair1/PHY/Makefile.inc b/openair1/PHY/Makefile.inc index 2105e1209d..1586f353c0 100644 --- a/openair1/PHY/Makefile.inc +++ b/openair1/PHY/Makefile.inc @@ -1,6 +1,7 @@ PHY_OBJS = $(TOP_DIR)/PHY/LTE_TRANSPORT/pss.o PHY_OBJS += $(TOP_DIR)/PHY/LTE_TRANSPORT/sss.o PHY_OBJS += $(TOP_DIR)/PHY/LTE_TRANSPORT/pilots.o +PHY_OBJS += $(TOP_DIR)/PHY/LTE_TRANSPORT/pilots_ue_spec.o PHY_OBJS += $(TOP_DIR)/PHY/LTE_TRANSPORT/pilots_mbsfn.o PHY_OBJS += $(TOP_DIR)/PHY/LTE_TRANSPORT/dlsch_coding.o PHY_OBJS += $(TOP_DIR)/PHY/LTE_TRANSPORT/dlsch_modulation.o @@ -40,6 +41,7 @@ PHY_OBJS += $(TOP_DIR)/PHY/LTE_ESTIMATION/lte_sync_time.o PHY_OBJS += $(TOP_DIR)/PHY/LTE_ESTIMATION/lte_sync_timefreq.o PHY_OBJS += $(TOP_DIR)/PHY/LTE_ESTIMATION/lte_adjust_sync.o PHY_OBJS += $(TOP_DIR)/PHY/LTE_ESTIMATION/lte_dl_channel_estimation.o +PHY_OBJS += $(TOP_DIR)/PHY/LTE_ESTIMATION/lte_dl_bf_channel_estimation.o PHY_OBJS += $(TOP_DIR)/PHY/LTE_ESTIMATION/lte_dl_mbsfn_channel_estimation.o PHY_OBJS += $(TOP_DIR)/PHY/LTE_ESTIMATION/lte_ul_channel_estimation.o PHY_OBJS += $(TOP_DIR)/PHY/LTE_ESTIMATION/lte_est_freq_offset.o @@ -47,7 +49,7 @@ PHY_OBJS += $(TOP_DIR)/PHY/LTE_ESTIMATION/lte_ue_measurements.o PHY_OBJS += $(TOP_DIR)/PHY/LTE_ESTIMATION/lte_eNB_measurements.o PHY_OBJS += $(TOP_DIR)/PHY/LTE_ESTIMATION/adjust_gain.o PHY_OBJS += $(TOP_DIR)/PHY/LTE_REFSIG/lte_dl_cell_spec.o -PHY_OBJS += $(TOP_DIR)/PHY/LTE_REFSIG/lte_dl_uespec.o +PHY_OBJS += $(TOP_DIR)/PHY/LTE_REFSIG/lte_dl_ue_spec.o PHY_OBJS += $(TOP_DIR)/PHY/LTE_REFSIG/lte_gold.o PHY_OBJS += $(TOP_DIR)/PHY/LTE_REFSIG/lte_gold_mbsfn.o PHY_OBJS += $(TOP_DIR)/PHY/LTE_REFSIG/lte_dl_mbsfn.o @@ -69,7 +71,7 @@ PHY_OBJS += $(TOP_DIR)/PHY/INIT/lte_init.o PHY_OBJS += $(TOP_DIR)/PHY/INIT/lte_parms.o PHY_OBJS += $(TOP_DIR)/PHY/INIT/init_top.o PHY_OBJS += $(TOP_DIR)/PHY/TOOLS/file_output.o -PHY_OBJS += $(TOP_DIR)/PHY/TOOLS/fft.o +#PHY_OBJS += $(TOP_DIR)/PHY/TOOLS/fft.o PHY_OBJS += $(TOP_DIR)/PHY/TOOLS/lte_dfts.o PHY_OBJS += $(TOP_DIR)/PHY/TOOLS/log2_approx.o PHY_OBJS += $(TOP_DIR)/PHY/TOOLS/cmult_sv.o diff --git a/openair1/PHY/defs.h b/openair1/PHY/defs.h index 7a46d9c444..80c6b4ef01 100755 --- a/openair1/PHY/defs.h +++ b/openair1/PHY/defs.h @@ -220,6 +220,7 @@ typedef struct PHY_VARS_eNB_s { eNB_proc_t proc[NUM_ENB_THREADS]; uint8_t local_flag; uint32_t rx_total_gain_eNB_dB; + uint8_t nb_antennas_tx_phy; LTE_DL_FRAME_PARMS lte_frame_parms; PHY_MEASUREMENTS_eNB PHY_measurements_eNB[NUMBER_OF_eNB_SECTORS_MAX]; /// Measurement variables LTE_eNB_COMMON lte_eNB_common_vars; @@ -241,6 +242,9 @@ typedef struct PHY_VARS_eNB_s { /// cell-specific reference symbols uint32_t lte_gold_table[20][2][14]; + /// UE-specific reference symbols (p=5), TM 7 + uint32_t lte_gold_uespec_port5_table[NUMBER_OF_UE_MAX][20][2][21]; + /// UE-specific reference symbols (p=7...14), TM 8/9/10 uint32_t lte_gold_uespec_table[2][20][2][21]; @@ -505,8 +509,11 @@ typedef struct { /// cell-specific reference symbols uint32_t lte_gold_table[7][20][2][14]; + /// UE-specific reference symbols (p=5), TM 7 + uint32_t lte_gold_uespec_port5_table[20][2][21]; + /// ue-specific reference symbols - uint32_t lte_gold_uespec_table[2][20][2][21]; + uint32_t lte_gold_uespec_table[2][20][2][21]; /// mbsfn reference symbols uint32_t lte_gold_mbsfn_table[10][3][42]; diff --git a/openair1/PHY/impl_defs_lte.h b/openair1/PHY/impl_defs_lte.h index 47c32d87c8..a7574575a3 100644 --- a/openair1/PHY/impl_defs_lte.h +++ b/openair1/PHY/impl_defs_lte.h @@ -587,8 +587,9 @@ typedef enum { DUALSTREAM_UNIFORM_PRECODING1=9, DUALSTREAM_UNIFORM_PRECODINGj=10, DUALSTREAM_PUSCH_PRECODING=11, - TM8=12, - TM9_10=13 + TM7=12, + TM8=13, + TM9_10=14 } MIMO_mode_t; typedef struct { @@ -784,6 +785,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 **rxdataF_ext; + /// \brief Received frequency-domain ue specific pilots. + /// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx + /// - second index: ? [0..12*N_RB_DL[ + int32_t **rxdataF_uespec_pilots; /// \brief Received frequency-domain signal after extraction and channel compensation. /// - first index: ? [0..7] (hard coded) FIXME! accessed via \c nb_antennas_rx /// - second index: ? [0..168*N_RB_DL[ @@ -797,6 +802,14 @@ 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_estimates_ext; + /// \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)[ + int32_t **dl_bf_ch_estimates; + /// \brief Downlink beamforming channel estimates. + /// - 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[ diff --git a/openair1/SCHED/phy_procedures_lte_eNb.c b/openair1/SCHED/phy_procedures_lte_eNb.c index 3828a9be72..32ff858996 100755 --- a/openair1/SCHED/phy_procedures_lte_eNb.c +++ b/openair1/SCHED/phy_procedures_lte_eNb.c @@ -2203,7 +2203,9 @@ void phy_procedures_eNB_TX(unsigned char sched_subframe,PHY_VARS_eNB *phy_vars_e phy_vars_eNB->dlsch_eNB_SI->harq_processes[0]->rb_alloc, get_Qm(phy_vars_eNB->dlsch_eNB_SI->harq_processes[0]->mcs), 1, - num_pdcch_symbols,phy_vars_eNB->proc[sched_subframe].frame_tx,subframe), + num_pdcch_symbols,phy_vars_eNB->proc[sched_subframe].frame_tx, + subframe, + (phy_vars_eNB->transmission_mode[(uint8_t)UE_id]<7?0:phy_vars_eNB->transmission_mode[(uint8_t)UE_id])), 0, subframe<<1); @@ -2211,13 +2213,14 @@ void phy_procedures_eNB_TX(unsigned char sched_subframe,PHY_VARS_eNB *phy_vars_e start_meas(&phy_vars_eNB->dlsch_modulation_stats); // for (sect_id=0;sect_idlte_eNB_common_vars.txdataF[0], + re_allocated = dlsch_modulation(&phy_vars_eNB, + phy_vars_eNB->lte_eNB_common_vars.txdataF[0], AMP, subframe, - &phy_vars_eNB->lte_frame_parms, num_pdcch_symbols, phy_vars_eNB->dlsch_eNB_SI, - (LTE_eNB_DLSCH_t *)NULL); + (LTE_eNB_DLSCH_t *)NULL, + (int32_t **)NULL); stop_meas(&phy_vars_eNB->dlsch_modulation_stats); } @@ -2338,17 +2341,22 @@ void phy_procedures_eNB_TX(unsigned char sched_subframe,PHY_VARS_eNB *phy_vars_e phy_vars_eNB->dlsch_eNB_ra->harq_processes[0]->rb_alloc, get_Qm(phy_vars_eNB->dlsch_eNB_ra->harq_processes[0]->mcs), 1, - num_pdcch_symbols,phy_vars_eNB->proc[sched_subframe].frame_tx,subframe), + num_pdcch_symbols, + phy_vars_eNB->proc[sched_subframe].frame_tx, + subframe, + (phy_vars_eNB->transmission_mode[(uint8_t)UE_id]<7?0:phy_vars_eNB->transmission_mode[(uint8_t)UE_id]<7)), 0, subframe<<1); // for (sect_id=0;sect_idlte_eNB_common_vars.txdataF[0], + re_allocated = dlsch_modulation(phy_vars_eNB, + phy_vars_eNB->lte_eNB_common_vars.txdataF[0], AMP, subframe, - &phy_vars_eNB->lte_frame_parms, num_pdcch_symbols, phy_vars_eNB->dlsch_eNB_ra, - (LTE_eNB_DLSCH_t *)NULL); + (LTE_eNB_DLSCH_t *)NULL, + (int32_t **)NULL); + } #ifdef PHY_ABSTRACTION @@ -2394,7 +2402,10 @@ void phy_procedures_eNB_TX(unsigned char sched_subframe,PHY_VARS_eNB *phy_vars_e phy_vars_eNB->dlsch_eNB[(uint8_t)UE_id][0]->harq_processes[harq_pid]->rb_alloc, get_Qm(phy_vars_eNB->dlsch_eNB[(uint8_t)UE_id][0]->harq_processes[harq_pid]->mcs), phy_vars_eNB->dlsch_eNB[(uint8_t)UE_id][0]->harq_processes[harq_pid]->Nl, - num_pdcch_symbols,phy_vars_eNB->proc[sched_subframe].frame_tx,subframe), + num_pdcch_symbols, + phy_vars_eNB->proc[sched_subframe].frame_tx, + subframe, + (phy_vars_eNB->transmission_mode[(uint8_t)UE_id]<7?0:phy_vars_eNB->transmission_mode[(uint8_t)UE_id])), phy_vars_eNB->dlsch_eNB[(uint8_t)UE_id][0]->harq_processes[harq_pid]->nb_rb, phy_vars_eNB->dlsch_eNB[(uint8_t)UE_id][0]->harq_processes[harq_pid]->mcs, pmi2hex_2Ar1(phy_vars_eNB->dlsch_eNB[(uint8_t)UE_id][0]->harq_processes[harq_pid]->pmi_alloc), @@ -2413,7 +2424,10 @@ void phy_procedures_eNB_TX(unsigned char sched_subframe,PHY_VARS_eNB *phy_vars_e phy_vars_eNB->dlsch_eNB[(uint8_t)UE_id][0]->harq_processes[harq_pid]->rb_alloc, get_Qm(phy_vars_eNB->dlsch_eNB[(uint8_t)UE_id][0]->harq_processes[harq_pid]->mcs), phy_vars_eNB->dlsch_eNB[(uint8_t)UE_id][0]->harq_processes[harq_pid]->Nl, - num_pdcch_symbols,phy_vars_eNB->proc[sched_subframe].frame_tx,subframe), + num_pdcch_symbols, + phy_vars_eNB->proc[sched_subframe].frame_tx, + subframe, + (phy_vars_eNB->transmission_mode[(uint8_t)UE_id]<7?0:phy_vars_eNB->transmission_mode[(uint8_t)UE_id]<7)), phy_vars_eNB->dlsch_eNB[(uint8_t)UE_id][0]->harq_processes[harq_pid]->nb_rb, phy_vars_eNB->dlsch_eNB[(uint8_t)UE_id][0]->harq_processes[harq_pid]->mcs, pmi2hex_2Ar1(phy_vars_eNB->dlsch_eNB[(uint8_t)UE_id][0]->harq_processes[harq_pid]->pmi_alloc), @@ -2495,7 +2509,10 @@ void phy_procedures_eNB_TX(unsigned char sched_subframe,PHY_VARS_eNB *phy_vars_e phy_vars_eNB->dlsch_eNB[(uint8_t)UE_id][0]->harq_processes[harq_pid]->rb_alloc, get_Qm(phy_vars_eNB->dlsch_eNB[(uint8_t)UE_id][0]->harq_processes[harq_pid]->mcs), phy_vars_eNB->dlsch_eNB[(uint8_t)UE_id][0]->harq_processes[harq_pid]->Nl, - num_pdcch_symbols,phy_vars_eNB->proc[sched_subframe].frame_tx,subframe), + num_pdcch_symbols, + phy_vars_eNB->proc[sched_subframe].frame_tx, + subframe, + phy_vars_eNB->transmission_mode[(uint8_t)UE_id]), 0, subframe<<1); stop_meas(&phy_vars_eNB->dlsch_scrambling_stats); @@ -2510,13 +2527,14 @@ void phy_procedures_eNB_TX(unsigned char sched_subframe,PHY_VARS_eNB *phy_vars_e // if (UE_id == 1) // LOG_I(PHY,"[MYEMOS] MCS_i %d\n", phy_vars_eNB->dlsch_eNB[(uint8_t)UE_id][0]->harq_processes[harq_pid]->mcs); - re_allocated = dlsch_modulation(phy_vars_eNB->lte_eNB_common_vars.txdataF[0], + re_allocated = dlsch_modulation(phy_vars_eNB, + phy_vars_eNB->lte_eNB_common_vars.txdataF[0], AMP, subframe, - &phy_vars_eNB->lte_frame_parms, num_pdcch_symbols, phy_vars_eNB->dlsch_eNB[(uint8_t)UE_id][0], - phy_vars_eNB->dlsch_eNB[(uint8_t)UE_id][1]); + phy_vars_eNB->dlsch_eNB[(uint8_t)UE_id][1], + (int32_t **)NULL); stop_meas(&phy_vars_eNB->dlsch_modulation_stats); } diff --git a/openair1/SCHED/phy_procedures_lte_ue.c b/openair1/SCHED/phy_procedures_lte_ue.c index 6394c7dff6..7efee84b84 100755 --- a/openair1/SCHED/phy_procedures_lte_ue.c +++ b/openair1/SCHED/phy_procedures_lte_ue.c @@ -138,7 +138,9 @@ void dump_dlsch(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t subframe,uint8_t get_Qm(phy_vars_ue->dlsch_ue[eNB_id][0]->harq_processes[harq_pid]->mcs), phy_vars_ue->dlsch_ue[eNB_id][0]->harq_processes[harq_pid]->Nl, phy_vars_ue->lte_ue_pdcch_vars[eNB_id]->num_pdcch_symbols, - phy_vars_ue->frame_rx,subframe); + phy_vars_ue->frame_rx, + subframe, + phy_vars_ue->transmission_mode[eNB_id]); write_output("rxsigF0.m","rxsF0", phy_vars_ue->lte_ue_common_vars.rxdataF[0],2*nsymb*phy_vars_ue->lte_frame_parms.ofdm_symbol_size,2,1); write_output("rxsigF0_ext.m","rxsF0_ext", phy_vars_ue->lte_ue_pdsch_vars[0]->rxdataF_ext[0],2*nsymb*phy_vars_ue->lte_frame_parms.ofdm_symbol_size,1,1); @@ -167,7 +169,9 @@ void dump_dlsch_SI(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t subframe) get_Qm(phy_vars_ue->dlsch_ue_SI[eNB_id]->harq_processes[0]->mcs), 1, phy_vars_ue->lte_ue_pdcch_vars[eNB_id]->num_pdcch_symbols, - phy_vars_ue->frame_rx,subframe); + phy_vars_ue->frame_rx, + subframe, + phy_vars_ue->transmission_mode[eNB_id]); LOG_D(PHY,"[UE %d] Dumping dlsch_SI : nb_rb %d, mcs %d, nb_rb %d, num_pdcch_symbols %d,G %d\n", phy_vars_ue->Mod_id, phy_vars_ue->dlsch_ue_SI[eNB_id]->harq_processes[0]->nb_rb, @@ -221,7 +225,9 @@ void dump_dlsch_ra(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t subframe) get_Qm(phy_vars_ue->dlsch_ue_ra[eNB_id]->harq_processes[0]->mcs), 1, phy_vars_ue->lte_ue_pdcch_vars[eNB_id]->num_pdcch_symbols, - phy_vars_ue->frame_rx,subframe); + phy_vars_ue->frame_rx, + subframe, + phy_vars_ue->transmission_mode[eNB_id]); LOG_D(PHY,"[UE %d] Dumping dlsch_ra : nb_rb %d, mcs %d, nb_rb %d, num_pdcch_symbols %d,G %d\n", phy_vars_ue->Mod_id, phy_vars_ue->dlsch_ue_ra[eNB_id]->harq_processes[0]->nb_rb, @@ -2625,7 +2631,9 @@ int phy_procedures_UE_RX(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstrac get_Qm(phy_vars_ue->dlsch_ue[eNB_id][0]->harq_processes[harq_pid]->mcs), phy_vars_ue->dlsch_ue[eNB_id][0]->harq_processes[harq_pid]->Nl, phy_vars_ue->lte_ue_pdcch_vars[eNB_id]->num_pdcch_symbols, - frame_rx,subframe_prev); + frame_rx, + subframe_prev, + phy_vars_ue->transmission_mode[eNB_id]); start_meas(&phy_vars_ue->dlsch_unscrambling_stats); dlsch_unscrambling(&phy_vars_ue->lte_frame_parms, 0, @@ -2782,7 +2790,9 @@ int phy_procedures_UE_RX(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstrac phy_vars_ue->dlsch_ue_SI[eNB_id]->harq_processes[0]->rb_alloc, get_Qm(phy_vars_ue->dlsch_ue_SI[eNB_id]->harq_processes[0]->mcs),1, phy_vars_ue->lte_ue_pdcch_vars[eNB_id]->num_pdcch_symbols, - frame_rx,subframe_prev); + frame_rx, + subframe_prev, + phy_vars_ue->transmission_mode[eNB_id]); #ifdef DEBUG_PHY_PROC LOG_D(PHY,"Decoding DLSCH_SI : rb_alloc %x : nb_rb %d G %d TBS %d, num_pdcch_sym %d\n",phy_vars_ue->dlsch_ue_SI[eNB_id]->harq_processes[0]->rb_alloc[0], @@ -2926,7 +2936,8 @@ int phy_procedures_UE_RX(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstrac get_Qm(phy_vars_ue->dlsch_ue_ra[eNB_id]->harq_processes[0]->mcs),1, phy_vars_ue->lte_ue_pdcch_vars[eNB_id]->num_pdcch_symbols, frame_rx, - subframe_prev); + subframe_prev, + phy_vars_ue->transmission_mode[eNB_id]); #ifdef DEBUG_PHY_PROC LOG_D(PHY,"[UE] decoding RA (subframe %d): G %d,rnti %x\n" ,subframe_prev, @@ -3301,7 +3312,9 @@ int phy_procedures_UE_RX(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstrac get_Qm(phy_vars_ue->dlsch_ue_MCH[0]->harq_processes[0]->mcs), 1, 2, - (subframe_rx==9?-1:0)+frame_rx,subframe_rx); + (subframe_rx==9?-1:0)+frame_rx, + subframe_rx, + phy_vars_ue->transmission_mode[eNB_id]); dlsch_unscrambling(&phy_vars_ue->lte_frame_parms,1,phy_vars_ue->dlsch_ue_MCH[0], phy_vars_ue->dlsch_ue_MCH[0]->harq_processes[0]->G, diff --git a/openair1/SIMULATION/LTE_PHY/dlsim.c b/openair1/SIMULATION/LTE_PHY/dlsim.c index 969e485b23..7a3b3bba1d 100644 --- a/openair1/SIMULATION/LTE_PHY/dlsim.c +++ b/openair1/SIMULATION/LTE_PHY/dlsim.c @@ -1,5 +1,5 @@ -/******************************************************************************* - OpenAirInterface +/****************************************************************************** + ipenAirInterface Copyright(c) 1999 - 2014 Eurecom OpenAirInterface is free software: you can redistribute it and/or modify @@ -107,8 +107,7 @@ void handler(int sig) exit(1); } -void lte_param_init(unsigned char N_tx, unsigned char N_rx,unsigned char transmission_mode,uint8_t extended_prefix_flag,uint8_t fdd_flag, uint16_t Nid_cell,uint8_t tdd_config,uint8_t N_RB_DL, - uint8_t osf,uint32_t perfect_ce) +void lte_param_init(unsigned char N_tx, unsigned char N_tx_phy, unsigned char N_rx,unsigned char transmission_mode,uint8_t extended_prefix_flag,uint8_t fdd_flag, uint16_t Nid_cell,uint8_t tdd_config,uint8_t N_RB_DL, uint8_t osf,uint32_t perfect_ce) { LTE_DL_FRAME_PARMS *lte_frame_parms; @@ -123,7 +122,8 @@ void lte_param_init(unsigned char N_tx, unsigned char N_rx,unsigned char transmi srand(0); randominit(0); - set_taus_seed(0); + //set_taus_seed(0); + set_taus_seed(1234); lte_frame_parms = &(PHY_vars_eNB->lte_frame_parms); @@ -142,7 +142,8 @@ void lte_param_init(unsigned char N_tx, unsigned char N_rx,unsigned char transmi // lte_frame_parms->Bsrs = 0; // lte_frame_parms->kTC = 0;44 // lte_frame_parms->n_RRC = 0; - lte_frame_parms->mode1_flag = (transmission_mode == 1)? 1 : 0; + //lte_frame_parms->mode1_flag = (transmission_mode == 1)? 1 : 0; + lte_frame_parms->mode1_flag = (transmission_mode == 1 || transmission_mode ==7)? 1 : 0; init_frame_parms(lte_frame_parms,osf); @@ -154,6 +155,11 @@ void lte_param_init(unsigned char N_tx, unsigned char N_rx,unsigned char transmi PHY_vars_UE->lte_frame_parms = *lte_frame_parms; PHY_vars_eNB->lte_frame_parms = *lte_frame_parms; + PHY_vars_eNB->transmission_mode[0] = transmission_mode; + PHY_vars_UE->transmission_mode[0] = transmission_mode; + //printf("lte_param_init: transmission mode = %d\n",PHY_vars_eNB->transmission_mode[0]); + PHY_vars_eNB->nb_antennas_tx_phy = N_tx_phy; + phy_init_lte_top(lte_frame_parms); dump_frame_parms(lte_frame_parms); @@ -166,12 +172,14 @@ void lte_param_init(unsigned char N_tx, unsigned char N_rx,unsigned char transmi phy_init_lte_ue(PHY_vars_UE,1,0); phy_init_lte_eNB(PHY_vars_eNB,0,0,0); + generate_pcfich_reg_mapping(&PHY_vars_UE->lte_frame_parms); generate_phich_reg_mapping(&PHY_vars_UE->lte_frame_parms); // DL power control init - if (transmission_mode == 1) { + //if (transmission_mode == 1) { + if (transmission_mode == 1 || transmission_mode ==7) { PHY_vars_eNB->pdsch_config_dedicated->p_a = dB0; // 4 = 0dB ((PHY_vars_eNB->lte_frame_parms).pdsch_config_common).p_b = 0; PHY_vars_UE->pdsch_config_dedicated->p_a = dB0; // 4 = 0dB @@ -200,7 +208,7 @@ uint64_t DLSCH_alloc_pdu_1[2]; #define CCCH_RB_ALLOC computeRIV(PHY_vars_eNB->lte_frame_parms.N_RB_UL,0,2) //#define DLSCH_RB_ALLOC 0x1fbf // igore DC component,RB13 //#define DLSCH_RB_ALLOC 0x0001 -void do_OFDM_mod_l(mod_sym_t **txdataF, int32_t **txdata, uint16_t next_slot, LTE_DL_FRAME_PARMS *frame_parms) +void do_OFDM_mod_l(mod_sym_t **txdataF, int32_t **txdata, uint16_t next_slot, LTE_DL_FRAME_PARMS *frame_parms, uint8_t nb_antennas_tx_phy) { int aa, slot_offset, slot_offset_F; @@ -208,7 +216,7 @@ void do_OFDM_mod_l(mod_sym_t **txdataF, int32_t **txdata, uint16_t next_slot, LT slot_offset_F = (next_slot)*(frame_parms->ofdm_symbol_size)*((frame_parms->Ncp==1) ? 6 : 7); slot_offset = (next_slot)*(frame_parms->samples_per_tti>>1); - for (aa=0; aanb_antennas_tx; aa++) { + for (aa=0; aaNcp == 1) @@ -234,7 +242,7 @@ int main(int argc, char **argv) { char c; - int k,i,aa,aarx,aatx; + int k,i,aa,aarx,aatx,re; int s,Kr,Kr_bytes; @@ -246,8 +254,9 @@ int main(int argc, char **argv) double forgetting_factor=0.0; //in [0,1] 0 means a new channel every time, 1 means keep the same channel double iqim=0.0; - uint8_t extended_prefix_flag=0,transmission_mode=1,n_tx=1,n_rx=2; + uint8_t extended_prefix_flag=0,transmission_mode=1,n_tx=1,n_rx=2,n_tx_phy=1; uint16_t Nid_cell=0; + int32_t **beamforming_weights; int eNB_id = 0, eNB_id_i = 1; unsigned char mcs1=0,mcs2=0,mcs_i=0,dual_stream_UE = 0,awgn_flag=0,round,dci_flag=0; @@ -285,7 +294,7 @@ int main(int argc, char **argv) char input_trch_val[16]; double channelx,channely; - // unsigned char pbch_pdu[6]; + unsigned char pbch_pdu[6]; DCI_ALLOC_t dci_alloc[8],dci_alloc_rx[8]; int num_common_dci=0,num_ue_spec_dci=0,num_dci=0; @@ -525,13 +534,20 @@ int main(int argc, char **argv) (transmission_mode!=2) && (transmission_mode!=3) && (transmission_mode!=5) && - (transmission_mode!=6)) { + (transmission_mode!=6) && + (transmission_mode!=7)) { msg("Unsupported transmission mode %d\n",transmission_mode); exit(-1); } - if (transmission_mode>1) { + if (transmission_mode>1 && transmission_mode<7) { n_tx = 2; + n_tx_phy = n_tx; + } + if (transmission_mode>=7){ + n_tx = 1; + n_tx_phy = 1; + n_rx = 1; } break; @@ -539,9 +555,13 @@ int main(int argc, char **argv) case 'y': n_tx=atoi(optarg); - if ((n_tx==0) || (n_tx>2)) { - msg("Unsupported number of tx antennas %d\n",n_tx); - exit(-1); + if (transmission_mode<7){ + n_tx_phy = n_tx; + + if ((n_tx==0) || ((n_tx>2))) { + msg("Unsupported number of tx antennas %d\n",n_tx); + exit(-1); + } } break; @@ -633,7 +653,7 @@ int main(int argc, char **argv) case 'h': default: - printf("%s -h(elp) -a(wgn on) -d(ci decoding on) -p(extended prefix on) -m mcs1 -M mcs2 -n n_frames -s snr0 -x transmission mode (1,2,5,6) -y TXant -z RXant -I trch_file\n",argv[0]); + printf("%s -h(elp) -a(wgn on) -d(ci decoding on) -p(extended prefix on) -m mcs1 -M mcs2 -n n_frames -s snr0 -x transmission mode (1,2,5,6,7) -y TXant -z RXant -I trch_file\n",argv[0]); printf("-h This message\n"); printf("-a Use AWGN channel and not multipath\n"); printf("-c Number of PDCCH symbols\n"); @@ -648,7 +668,7 @@ int main(int argc, char **argv) printf("-r ressource block allocation (see section 7.1.6.3 in 36.213\n"); printf("-g [A:M] Use 3GPP 25.814 SCM-A/B/C/D('A','B','C','D') or 36-101 EPA('E'), EVA ('F'),ETU('G') models (ignores delay spread and Ricean factor), Rayghleigh8 ('H'), Rayleigh1('I'), Rayleigh1_corr('J'), Rayleigh1_anticorr ('K'), Rice8('L'), Rice1('M')\n"); printf("-F forgetting factor (0 new channel every trial, 1 channel constant\n"); - printf("-x Transmission mode (1,2,6 for the moment)\n"); + printf("-x Transmission mode (1,2,6,7 for the moment)\n"); printf("-y Number of TX antennas used in eNB\n"); printf("-z Number of RX antennas used in UE\n"); printf("-t MCS of interfering UE\n"); @@ -697,8 +717,8 @@ int main(int argc, char **argv) NB_RB=conv_nprb(0,DLSCH_RB_ALLOC,N_RB_DL); - if ((transmission_mode > 1) && (n_tx != 2)) - printf("n_tx must be >1 for transmission_mode %d\n",transmission_mode); + if ((transmission_mode > 1) && (n_tx_phy == 1)) + printf("n_tx_phy must be >1 for transmission_mode %d\n",transmission_mode); #ifdef XFORMS fl_initialize (&argc, argv, NULL, 0, 0); @@ -720,7 +740,19 @@ int main(int argc, char **argv) printf("dual_stream_UE=%d\n", dual_stream_UE); } - lte_param_init(n_tx,n_rx,transmission_mode,extended_prefix_flag,fdd_flag,Nid_cell,tdd_config,N_RB_DL,osf,perfect_ce); + + lte_param_init(n_tx,n_tx_phy,n_rx,transmission_mode,extended_prefix_flag,fdd_flag,Nid_cell,tdd_config,N_RB_DL,osf,perfect_ce); + + if (transmission_mode==7){ + lte_gold_ue_spec_port5(PHY_vars_eNB->lte_gold_uespec_port5_table[0],Nid_cell,n_rnti); + lte_gold_ue_spec_port5(PHY_vars_UE->lte_gold_uespec_port5_table,Nid_cell,n_rnti); + beamforming_weights = (int32_t **)malloc(12*N_RB_DL*sizeof(int32_t*)); + for(re=0;re<12*N_RB_DL;re++){ + beamforming_weights[re]=(int32_t *)malloc(n_tx_phy*sizeof(int32_t)); + for(aa=0;aan_connected_eNB; @@ -728,7 +760,7 @@ int main(int argc, char **argv) printf("Setting mcs2 = %d\n",mcs2); printf("NPRB = %d\n",NB_RB); printf("n_frames = %d\n",n_frames); - printf("Transmission mode %d with %dx%d antenna configuration, Extended Prefix %d\n",transmission_mode,n_tx,n_rx,extended_prefix_flag); + printf("Transmission mode %d with %dx%d antenna configuration, Extended Prefix %d\n",transmission_mode,n_tx_phy,n_rx,extended_prefix_flag); snr1 = snr0+snr_int; printf("SNR0 %f, SNR1 %f\n",snr0,snr1); @@ -745,8 +777,8 @@ int main(int argc, char **argv) frame_parms = &PHY_vars_eNB->lte_frame_parms; - s_re = malloc(2*sizeof(double*)); - s_im = malloc(2*sizeof(double*)); + s_re = malloc(n_tx_phy*sizeof(double*)); + s_im = malloc(n_tx_phy*sizeof(double*)); r_re = malloc(2*sizeof(double*)); r_im = malloc(2*sizeof(double*)); // r_re0 = malloc(2*sizeof(double*)); @@ -883,9 +915,12 @@ int main(int argc, char **argv) } */ - for (i=0; i<2; i++) { + for (i=0; ilte_frame_parms.frame_type == TDD) { @@ -1157,6 +1193,9 @@ int main(int argc, char **argv) P_RNTI, PHY_vars_eNB->eNB_UE_stats[0].DL_pmi_single); + if(transmission_mode==7) + PHY_vars_eNB->dlsch_eNB[0][0]->harq_processes[0]->mimo_mode = TM7; //Xiwen: to check about harq_pid + num_dci++; num_ue_spec_dci++; } else { @@ -1300,7 +1339,7 @@ int main(int argc, char **argv) num_dci++; } - + break; case 3: @@ -2027,13 +2066,15 @@ int main(int argc, char **argv) get_Qm(PHY_vars_eNB->dlsch_eNB[0][0]->harq_processes[0]->mcs), PHY_vars_eNB->dlsch_eNB[0][0]->harq_processes[0]->Nl, num_pdcch_symbols, - 0,subframe); + 0, + subframe, + (transmission_mode<7?0:transmission_mode)); uncoded_ber_bit = (short*) malloc(sizeof(short)*coded_bits_per_codeword); printf("uncoded_ber_bit=%p\n",uncoded_ber_bit); snr_step = input_snr_step; - PHY_vars_UE->high_speed_flag = 1; + PHY_vars_UE->high_speed_flag = 0; //1 PHY_vars_UE->ch_est_alpha=0; for (ch_realization=0; ch_realizationdlsch_ue[0][0]->max_turbo_iterations+1; while ((round < num_rounds) && (ret > PHY_vars_UE->dlsch_ue[0][0]->max_turbo_iterations)) { - // printf("Trial %d, round %d\n",trials,round); + printf("Trial %d, round %d\n",trials,round); round_trials[round]++; - if(transmission_mode>=5) + if(transmission_mode>=5&&transmission_mode<7) pmi_feedback=1; else pmi_feedback=0; @@ -2136,7 +2177,7 @@ int main(int argc, char **argv) PMI_FEEDBACK: - // printf("Trial %d : Round %d, pmi_feedback %d \n",trials,round,pmi_feedback); + printf("Trial %d : Round %d, pmi_feedback %d \n",trials,round,pmi_feedback); for (aa=0; aalte_frame_parms.nb_antennas_tx; aa++) { memset(&PHY_vars_eNB->lte_eNB_common_vars.txdataF[eNB_id][aa][0],0,FRAME_LENGTH_COMPLEX_SAMPLES_NO_PREFIX*sizeof(mod_sym_t)); } @@ -2158,6 +2199,7 @@ PMI_FEEDBACK: switch (transmission_mode) { case 1: case 2: + case 7: switch (PHY_vars_eNB->lte_frame_parms.N_RB_DL) { case 6: ((DCI1_1_5MHz_TDD_t *)&DLSCH_alloc_pdu_1[0])->ndi = trials&1; @@ -2228,11 +2270,13 @@ PMI_FEEDBACK: DLSCH_alloc_pdu2_1E[0].rv = 0; memcpy(&dci_alloc[0].dci_pdu[0],&DLSCH_alloc_pdu2_1E[0],sizeof(DCI1E_5MHz_2A_M10PRB_TDD_t)); break; + } } else { // FDD switch (transmission_mode) { case 1: case 2: + case 7: switch (PHY_vars_eNB->lte_frame_parms.N_RB_DL) { case 6: ((DCI1_1_5MHz_FDD_t *)&DLSCH_alloc_pdu_1[0])->ndi = trials&1; @@ -2260,7 +2304,6 @@ PMI_FEEDBACK: } break; - case 3: switch (PHY_vars_eNB->lte_frame_parms.N_RB_DL) { case 6: @@ -2315,6 +2358,7 @@ PMI_FEEDBACK: switch (transmission_mode) { case 1: case 2: + case 7: switch (PHY_vars_eNB->lte_frame_parms.N_RB_DL) { case 6: ((DCI1_1_5MHz_TDD_t *)&DLSCH_alloc_pdu_1[0])->ndi = trials&1; @@ -2422,6 +2466,7 @@ PMI_FEEDBACK: switch (transmission_mode) { case 1: case 2: + case 7: switch (PHY_vars_eNB->lte_frame_parms.N_RB_DL) { case 6: ((DCI1_1_5MHz_FDD_t *)&DLSCH_alloc_pdu_1[0])->ndi = trials&1; @@ -2551,7 +2596,9 @@ PMI_FEEDBACK: get_Qm(PHY_vars_eNB->dlsch_eNB[k][cw]->harq_processes[0]->mcs), PHY_vars_eNB->dlsch_eNB[k][cw]->harq_processes[0]->Nl, num_pdcch_symbols, - 0,subframe); + 0, + subframe, + (transmission_mode<7?0:transmission_mode)); #ifdef TBS_FIX // This is for MESH operation!!! tbs = (double)3*TBStable[get_I_TBS(PHY_vars_eNB->dlsch_eNB[k][cw]->harq_processes[0]->mcs)][PHY_vars_eNB->dlsch_eNB[k][cw]->nb_rb-1]/4; @@ -2596,8 +2643,7 @@ PMI_FEEDBACK: 0,subframe, &PHY_vars_eNB->dlsch_rate_matching_stats, &PHY_vars_eNB->dlsch_turbo_encoding_stats, - &PHY_vars_eNB->dlsch_interleaving_stats - )<0) + &PHY_vars_eNB->dlsch_interleaving_stats)<0) exit(-1); /* @@ -2640,15 +2686,16 @@ PMI_FEEDBACK: } } } - + start_meas(&PHY_vars_eNB->dlsch_modulation_stats); - re_allocated = dlsch_modulation(PHY_vars_eNB->lte_eNB_common_vars.txdataF[eNB_id], + re_allocated = dlsch_modulation(PHY_vars_eNB, + PHY_vars_eNB->lte_eNB_common_vars.txdataF[eNB_id], AMP, subframe, - &PHY_vars_eNB->lte_frame_parms, num_pdcch_symbols, PHY_vars_eNB->dlsch_eNB[k][0], - PHY_vars_eNB->dlsch_eNB[k][1]); + PHY_vars_eNB->dlsch_eNB[k][1], + beamforming_weights); stop_meas(&PHY_vars_eNB->dlsch_modulation_stats); /* if (trials==0 && round==0) @@ -2661,18 +2708,149 @@ PMI_FEEDBACK: PHY_vars_eNB->lte_eNB_common_vars.txdataF[eNB_id], AMP, LTE_NUMBER_OF_SUBFRAMES_PER_FRAME); +/* + //PSS/SSS + if (PHY_vars_eNB->lte_frame_parms.frame_type == FDD) { + generate_pss(PHY_vars_eNB->lte_eNB_common_vars.txdataF[0], + AMP, + &PHY_vars_eNB->lte_frame_parms, + (PHY_vars_eNB->lte_frame_parms.Ncp==NORMAL) ? 6 : 5, + 0); + generate_sss(PHY_vars_eNB->lte_eNB_common_vars.txdataF[0], + AMP, + &PHY_vars_eNB->lte_frame_parms, + (PHY_vars_eNB->lte_frame_parms.Ncp==NORMAL) ? 5 : 4, + 0); + generate_pss(PHY_vars_eNB->lte_eNB_common_vars.txdataF[0], + AMP, + &PHY_vars_eNB->lte_frame_parms, + (PHY_vars_eNB->lte_frame_parms.Ncp==NORMAL) ? 6 : 5, + 10); + generate_sss(PHY_vars_eNB->lte_eNB_common_vars.txdataF[0], + AMP, + &PHY_vars_eNB->lte_frame_parms, + (PHY_vars_eNB->lte_frame_parms.Ncp==NORMAL) ? 5 : 4, + 10); + } + else if (PHY_vars_eNB->lte_frame_parms.frame_type == TDD) { + generate_sss(PHY_vars_eNB->lte_eNB_common_vars.txdataF[0], + AMP, + &PHY_vars_eNB->lte_frame_parms, + (PHY_vars_eNB->lte_frame_parms.Ncp==NORMAL) ? 6 : 5, + 1); + generate_pss(PHY_vars_eNB->lte_eNB_common_vars.txdataF[0], + AMP, + &PHY_vars_eNB->lte_frame_parms, + 2, + 2); + generate_sss(PHY_vars_eNB->lte_eNB_common_vars.txdataF[0], + AMP, + &PHY_vars_eNB->lte_frame_parms, + (PHY_vars_eNB->lte_frame_parms.Ncp==NORMAL) ? 6 : 5, + 11); + generate_pss(PHY_vars_eNB->lte_eNB_common_vars.txdataF[0], + AMP, + &PHY_vars_eNB->lte_frame_parms, + 2, + 12); + } + + //PBCH + pbch_pdu[2] = 0; + + // FIXME setting pbch_pdu[2] to zero makes the switch statement easier: remove all the or-operators + switch (PHY_vars_eNB->lte_frame_parms.N_RB_DL) { + case 6: + pbch_pdu[2] = (pbch_pdu[2]&0x1f) | (0<<5); + break; + + case 15: + pbch_pdu[2] = (pbch_pdu[2]&0x1f) | (1<<5); + break; + + case 25: + pbch_pdu[2] = (pbch_pdu[2]&0x1f) | (2<<5); + break; + + case 50: + pbch_pdu[2] = (pbch_pdu[2]&0x1f) | (3<<5); + break; + + case 75: + pbch_pdu[2] = (pbch_pdu[2]&0x1f) | (4<<5); + break; + + case 100: + pbch_pdu[2] = (pbch_pdu[2]&0x1f) | (5<<5); + break; + + default: + // FIXME if we get here, this should be flagged as an error, right? + pbch_pdu[2] = (pbch_pdu[2]&0x1f) | (2<<5); + break; + } + + pbch_pdu[2] = (pbch_pdu[2]&0xef) | + ((PHY_vars_eNB->lte_frame_parms.phich_config_common.phich_duration << 4)&0x10); + + switch (PHY_vars_eNB->lte_frame_parms.phich_config_common.phich_resource) { + case oneSixth: + pbch_pdu[2] = (pbch_pdu[2]&0xf3) | (0<<2); + break; + + case half: + pbch_pdu[2] = (pbch_pdu[2]&0xf3) | (1<<2); + break; + + case one: + pbch_pdu[2] = (pbch_pdu[2]&0xf3) | (2<<2); + break; + + case two: + pbch_pdu[2] = (pbch_pdu[2]&0xf3) | (3<<2); + break; + + default: + // unreachable + break; + + + pbch_pdu[2] = (pbch_pdu[2]&0xfc) | ((0>>8)&0x3); + pbch_pdu[1] = 0&0xfc; + pbch_pdu[0] = 0; + } + + generate_pbch(&PHY_vars_eNB->lte_eNB_pbch, + PHY_vars_eNB->lte_eNB_common_vars.txdataF[0], + AMP, + &PHY_vars_eNB->lte_frame_parms, + pbch_pdu, + 0&3); +*/ start_meas(&PHY_vars_eNB->ofdm_mod_stats); +/* + for(i=0;i<20;i++){ + + do_OFDM_mod_l(PHY_vars_eNB->lte_eNB_common_vars.txdataF[eNB_id], + PHY_vars_eNB->lte_eNB_common_vars.txdata[eNB_id], + i, + &PHY_vars_eNB->lte_frame_parms, + PHY_vars_eNB->nb_antennas_tx_phy); + } +*/ do_OFDM_mod_l(PHY_vars_eNB->lte_eNB_common_vars.txdataF[eNB_id], PHY_vars_eNB->lte_eNB_common_vars.txdata[eNB_id], (subframe*2), - &PHY_vars_eNB->lte_frame_parms); + &PHY_vars_eNB->lte_frame_parms, + PHY_vars_eNB->nb_antennas_tx_phy); do_OFDM_mod_l(PHY_vars_eNB->lte_eNB_common_vars.txdataF[eNB_id], PHY_vars_eNB->lte_eNB_common_vars.txdata[eNB_id], (subframe*2)+1, - &PHY_vars_eNB->lte_frame_parms); + &PHY_vars_eNB->lte_frame_parms, + PHY_vars_eNB->nb_antennas_tx_phy); stop_meas(&PHY_vars_eNB->ofdm_mod_stats); stop_meas(&PHY_vars_eNB->phy_proc_tx); @@ -2680,20 +2858,21 @@ PMI_FEEDBACK: do_OFDM_mod_l(PHY_vars_eNB->lte_eNB_common_vars.txdataF[eNB_id], PHY_vars_eNB->lte_eNB_common_vars.txdata[eNB_id], (subframe*2)+2, - &PHY_vars_eNB->lte_frame_parms); + &PHY_vars_eNB->lte_frame_parms, + PHY_vars_eNB->nb_antennas_tx_phy); if (n_frames==1) { write_output("txsigF0.m","txsF0", &PHY_vars_eNB->lte_eNB_common_vars.txdataF[eNB_id][0][subframe*nsymb*PHY_vars_eNB->lte_frame_parms.ofdm_symbol_size], nsymb*PHY_vars_eNB->lte_frame_parms.ofdm_symbol_size,1,1); - if (PHY_vars_eNB->lte_frame_parms.nb_antennas_tx>1) + if (PHY_vars_eNB->nb_antennas_tx_phy>1)// to be updated write_output("txsigF1.m","txsF1", &PHY_vars_eNB->lte_eNB_common_vars.txdataF[eNB_id][1][subframe*nsymb*PHY_vars_eNB->lte_frame_parms.ofdm_symbol_size], nsymb*PHY_vars_eNB->lte_frame_parms.ofdm_symbol_size,1,1); - } + } tx_lev = 0; - for (aa=0; aalte_frame_parms.nb_antennas_tx; aa++) { + for (aa=0; aanb_antennas_tx_phy; aa++) { tx_lev += signal_energy(&PHY_vars_eNB->lte_eNB_common_vars.txdata[eNB_id][aa] [subframe*PHY_vars_eNB->lte_frame_parms.samples_per_tti], PHY_vars_eNB->lte_frame_parms.samples_per_tti); @@ -2703,9 +2882,8 @@ PMI_FEEDBACK: if (n_frames==1) { printf("tx_lev = %d (%d dB)\n",tx_lev,tx_lev_dB); - write_output("txsig0.m","txs0", &PHY_vars_eNB->lte_eNB_common_vars.txdata[eNB_id][0][subframe* PHY_vars_eNB->lte_frame_parms.samples_per_tti], - - PHY_vars_eNB->lte_frame_parms.samples_per_tti,1,1); + write_output("txsig0.m","txs0", &PHY_vars_eNB->lte_eNB_common_vars.txdata[eNB_id][0][subframe*PHY_vars_eNB->lte_frame_parms.samples_per_tti],PHY_vars_eNB->lte_frame_parms.samples_per_tti,1,1); + // write_output("txsig0.m","txs0",&PHY_vars_eNB->lte_eNB_common_vars.txdata[eNB_id][0][0*PHY_vars_eNB->lte_frame_parms.samples_per_tti],PHY_vars_eNB->lte_frame_parms.samples_per_tti*10,1,1); } } @@ -2736,7 +2914,7 @@ PMI_FEEDBACK: // printf("Copying tx ..., nsymb %d (n_tx %d), awgn %d\n",nsymb,PHY_vars_eNB->lte_frame_parms.nb_antennas_tx,awgn_flag); for (i=0; i<2*frame_parms->samples_per_tti; i++) { - for (aa=0; aalte_frame_parms.nb_antennas_tx; aa++) { + for (aa=0; aanb_antennas_tx_phy; aa++) { if (awgn_flag == 0) { s_re[aa][i] = ((double)(((short *)PHY_vars_eNB->lte_eNB_common_vars.txdata[eNB_id][aa]))[(2*subframe*PHY_vars_UE->lte_frame_parms.samples_per_tti) + (i<<1)]); s_im[aa][i] = ((double)(((short *)PHY_vars_eNB->lte_eNB_common_vars.txdata[eNB_id][aa]))[(2*subframe*PHY_vars_UE->lte_frame_parms.samples_per_tti) +(i<<1)+1]); @@ -2745,6 +2923,7 @@ PMI_FEEDBACK: if (aa==0) { r_re[aarx][i] = ((double)(((short *)PHY_vars_eNB->lte_eNB_common_vars.txdata[eNB_id][aa]))[(2*subframe*PHY_vars_UE->lte_frame_parms.samples_per_tti) +(i<<1)]); r_im[aarx][i] = ((double)(((short *)PHY_vars_eNB->lte_eNB_common_vars.txdata[eNB_id][aa]))[(2*subframe*PHY_vars_UE->lte_frame_parms.samples_per_tti) +(i<<1)+1]); + //printf("r[%d][%d]=> %f, %f\n",aarx,i,r_re[aarx][i],r_im[aarx][i]); } else { r_re[aarx][i] += ((double)(((short *)PHY_vars_eNB->lte_eNB_common_vars.txdata[eNB_id][aa]))[(2*subframe*PHY_vars_UE->lte_frame_parms.samples_per_tti) +(i<<1)]); r_im[aarx][i] += ((double)(((short *)PHY_vars_eNB->lte_eNB_common_vars.txdata[eNB_id][aa]))[(2*subframe*PHY_vars_UE->lte_frame_parms.samples_per_tti) +(i<<1)+1]); @@ -2837,14 +3016,18 @@ PMI_FEEDBACK: for (i=0; i<2*frame_parms->samples_per_tti; i++) { for (aa=0; aalte_frame_parms.nb_antennas_rx; aa++) { - //printf("s_re[0][%d]=> %f , r_re[0][%d]=> %f\n",i,s_re[aa][i],i,r_re[aa][i]); - ((short*) PHY_vars_UE->lte_ue_common_vars.rxdata[aa])[(2*subframe*PHY_vars_UE->lte_frame_parms.samples_per_tti)+2*i] = + // printf("s_re[0][%d]=> %f , r_re[0][%d]=> %f\n",i,s_re[aa][i],i,r_re[aa][i]); + /*((short*) PHY_vars_UE->lte_ue_common_vars.rxdata[aa])[(2*subframe*PHY_vars_UE->lte_frame_parms.samples_per_tti)+2*i] = (short) (r_re[aa][i] + sqrt(sigma2/2)*gaussdouble(0.0,1.0)); ((short*) PHY_vars_UE->lte_ue_common_vars.rxdata[aa])[(2*subframe*PHY_vars_UE->lte_frame_parms.samples_per_tti)+2*i+1] = - (short) (r_im[aa][i] + (iqim*r_re[aa][i]) + sqrt(sigma2/2)*gaussdouble(0.0,1.0)); + (short) (r_im[aa][i] + (iqim*r_re[aa][i]) + sqrt(sigma2/2)*gaussdouble(0.0,1.0));*/ + ((short*) PHY_vars_UE->lte_ue_common_vars.rxdata[aa])[(2*subframe*PHY_vars_UE->lte_frame_parms.samples_per_tti)+2*i] = (short) (r_re[aa][i]); + ((short*) PHY_vars_UE->lte_ue_common_vars.rxdata[aa])[(2*subframe*PHY_vars_UE->lte_frame_parms.samples_per_tti)+2*i+1] = (short) (r_im[aa][i] + (iqim*r_re[aa][i])); + //printf("rxdata[%d][%d]=> %d, %d\n",aa,subframe*PHY_vars_UE->lte_frame_parms.samples_per_tti+i,r_re[aa][i],r_im[aa][i]); } } + // lte_sync_time_init(PHY_vars_eNB->lte_frame_parms,lte_ue_common_vars); // lte_sync_time(lte_ue_common_vars->rxdata, PHY_vars_eNB->lte_frame_parms); // lte_sync_time_free(); @@ -2888,7 +3071,7 @@ PMI_FEEDBACK: for (Ns=(2*subframe); Ns<((2*subframe)+3); Ns++) { for (l=0; lofdm_demod_stats); + //write_output("rxsigF0.m","rxsF0", &PHY_vars_UE->lte_ue_common_vars.rxdataF[0][0],PHY_vars_UE->lte_frame_parms.ofdm_symbol_size*nsymb,1,1); if (PHY_vars_UE->perfect_ce==1) { if (awgn_flag==0) { @@ -3045,7 +3229,12 @@ PMI_FEEDBACK: get_Qm(PHY_vars_UE->dlsch_ue[0][0]->harq_processes[PHY_vars_UE->dlsch_ue[0][0]->current_harq_pid]->mcs), PHY_vars_UE->dlsch_ue[0][0]->harq_processes[PHY_vars_UE->dlsch_ue[0][0]->current_harq_pid]->Nl, PHY_vars_UE->lte_ue_pdcch_vars[0]->num_pdcch_symbols, - 0,subframe); + 0, + subframe, + (transmission_mode<7?0:transmission_mode)); + if (transmission_mode==7 && common_flag==0) + PHY_vars_UE->dlsch_ue[0][0]->harq_processes[0]->mimo_mode = TM7; + /* rate = (double)dlsch_tbs25[get_I_TBS(PHY_vars_UE->dlsch_ue[0][0]->harq_processes[PHY_vars_UE->dlsch_ue[0][0]->current_harq_pid]->mcs)][PHY_vars_UE->dlsch_ue[0][0]->nb_rb-1]/(coded_bits_per_codeword); rate*=get_Qm(PHY_vars_UE->dlsch_ue[0][0]->harq_processes[PHY_vars_UE->dlsch_ue[0][0]->current_harq_pid]->mcs); @@ -3084,6 +3273,7 @@ PMI_FEEDBACK: switch (transmission_mode) { case 1: case 2: + case 7: generate_ue_dlsch_params_from_dci(0, &DLSCH_alloc_pdu_1[0], (common_flag==0)? C_RNTI : SI_RNTI, @@ -3094,6 +3284,8 @@ PMI_FEEDBACK: SI_RNTI, 0, P_RNTI); + if(transmission_mode==7 && common_flag==0) + PHY_vars_UE->dlsch_ue[0][0]->harq_processes[0]->mimo_mode = TM7; break; case 3: @@ -3210,6 +3402,7 @@ PMI_FEEDBACK: for (m=pilot3; mlte_frame_parms.symbols_per_tti; m++) { + //printf("m=%d\n",m); if (rx_pdsch(PHY_vars_UE, PDSCH, eNB_id, @@ -3228,6 +3421,7 @@ PMI_FEEDBACK: stop_meas(&PHY_vars_UE->dlsch_llr_stats); } + if (test_perf ==0 ) { if ((n_frames==1) && (Ns==(2+(2*subframe))) && (l==0)) { write_output("ch0.m","ch0",eNB2UE[0]->ch[0],eNB2UE[0]->channel_length,1,8); @@ -3236,7 +3430,9 @@ PMI_FEEDBACK: write_output("ch1.m","ch1",eNB2UE[0]->ch[PHY_vars_eNB->lte_frame_parms.nb_antennas_rx],eNB2UE[0]->channel_length,1,8); //common vars - write_output("rxsig0.m","rxs0", &PHY_vars_UE->lte_ue_common_vars.rxdata[0][0],10*PHY_vars_UE->lte_frame_parms.samples_per_tti,1,1); + //write_output("rxsig0.m","rxs0", &PHY_vars_UE->lte_ue_common_vars.rxdata[0][0],10*PHY_vars_UE->lte_frame_parms.samples_per_tti,1,1); + write_output("rxsig0.m","rxs0", &PHY_vars_UE->lte_ue_common_vars.rxdata[0][subframe*PHY_vars_UE->lte_frame_parms.samples_per_tti],PHY_vars_UE->lte_frame_parms.samples_per_tti,1,1); + //write_output("rxsigF0.m","rxsF0", &PHY_vars_UE->lte_ue_common_vars.rxdataF[0][subframe*nsymb*PHY_vars_eNB->lte_frame_parms.ofdm_symbol_size],PHY_vars_UE->lte_frame_parms.ofdm_symbol_size*nsymb,1,1); write_output("rxsigF0.m","rxsF0", &PHY_vars_UE->lte_ue_common_vars.rxdataF[0][0],PHY_vars_UE->lte_frame_parms.ofdm_symbol_size*nsymb,1,1); if (PHY_vars_UE->lte_frame_parms.nb_antennas_rx>1) { @@ -3284,7 +3480,7 @@ PMI_FEEDBACK: //saving PMI in case of Transmission Mode > 5 if(abstx) { - if (trials==0 && round==0 && transmission_mode>=5) { + if (trials==0 && round==0 && transmission_mode>=5 && transmission_mode<7) { for (iii=0; iiilte_ue_pdsch_vars[eNB_id]->pmi_ext[iii]),(PHY_vars_UE->lte_ue_pdsch_vars[eNB_id_i]->pmi_ext[iii])); fprintf(csv_fd,"%x,%x,",(PHY_vars_UE->lte_ue_pdsch_vars[eNB_id]->pmi_ext[iii]),(PHY_vars_UE->lte_ue_pdsch_vars[eNB_id]->pmi_ext[iii])); @@ -3301,7 +3497,9 @@ PMI_FEEDBACK: get_Qm(PHY_vars_eNB->dlsch_eNB[0][cw]->harq_processes[0]->mcs), PHY_vars_eNB->dlsch_eNB[0][cw]->harq_processes[0]->Nl, num_pdcch_symbols, - 0,subframe); + 0, + subframe, + (transmission_mode<7?0:transmission_mode)); PHY_vars_UE->dlsch_ue[0][cw]->harq_processes[PHY_vars_UE->dlsch_ue[0][cw]->current_harq_pid]->G = coded_bits_per_codeword; @@ -3415,7 +3613,7 @@ PMI_FEEDBACK: iter_trials++; if (n_frames==1) { - //if ((n_frames==1) || (SNR>=30)) { + //if ((n_frames==1) || (SNR>=30)) printf("DLSCH errors found (round %d), uncoded ber %f\n",round,uncoded_ber); for (s=0; sdlsch_ue[0][0]->harq_processes[0]->C; s++) { @@ -4054,9 +4252,12 @@ PMI_FEEDBACK: printf("Freeing channel I/O\n"); - for (i=0; i<2; i++) { + for (i=0; idlsch_ue_MCH[0]->harq_processes[0]->rb_alloc, get_Qm(PHY_vars_UE->dlsch_ue_MCH[0]->harq_processes[0]->mcs), 1,2, - PHY_vars_UE->frame_tx,subframe); + PHY_vars_UE->frame_tx,subframe,0); dlsch_unscrambling(&PHY_vars_UE->lte_frame_parms,1,PHY_vars_UE->dlsch_ue_MCH[0], PHY_vars_UE->dlsch_ue_MCH[0]->harq_processes[0]->G, PHY_vars_UE->lte_ue_pdsch_vars_MCH[0]->llr[0],0,subframe<<1); diff --git a/targets/ARCH/EXMIMO/USERSPACE/OCTAVE/txsig.m b/targets/ARCH/EXMIMO/USERSPACE/OCTAVE/txsig.m index ad33d26123..0ebf4a0a87 100644 --- a/targets/ARCH/EXMIMO/USERSPACE/OCTAVE/txsig.m +++ b/targets/ARCH/EXMIMO/USERSPACE/OCTAVE/txsig.m @@ -6,7 +6,7 @@ rxgain=0; txgain=0; eNB_flag = 0; card = 0; -active_rf = [1 1 1 1]; +active_rf = [1 0 0 0]; autocal = [1 1 1 1]; resampling_factor = [2 2 2 2]; limeparms; @@ -38,14 +38,14 @@ rffe_band = B19G_TDD*[1 1 1 1]; oarf_config_exmimo(card, freq_rx,freq_tx,tdd_config,syncmode,rxgain,txgain,eNB_flag,rf_mode,rf_rxdc,rf_local,rf_vcocal,rffe_rxg_low,rffe_rxg_final,rffe_band,autocal,resampling_factor); %oarf_config_exmimo(1, freq_rx,freq_tx,tdd_config,syncmode,rxgain,txgain,eNB_flag,rf_mode,rf_rxdc,rf_local,rf_vcocal,rffe_rxg_low,rffe_rxg_final,rffe_band,autocal,resampling_factor); -amp = pow2(14)-1; +amp = pow2(10)-1; n_bit = 16; length = 307200/pow2(resampling_factor(1)); s = zeros(length,4); -select = 1; +select = 7; switch(select) @@ -73,7 +73,8 @@ case 3 case 4 pss0_f0=[0,0,0,0,0,0,0,0,0,0,32767,0,-26120,-19785,11971,-30502,-24020,-22288,32117,6492,31311,9658,-16384,-28378,25100,-21063,-7292,-31946,20429,25618,14948,29158,11971,-30502,31311,9658,25100,-21063,-16384,28377,-24020,22287,32117,6492,-7292,31945,20429,25618,-26120,-19785,-16384,-28378,-16384,28377,-26120,-19785,-32402,4883,31311,-9659,32117,6492,-7292,-31946,32767,-1,25100,-21063,-24020,22287,-32402,4883,-32402,4883,-24020,22287,25100,-21063,32767,-1,-7292,-31946,32117,6492,31311,-9659,-32402,4883,-26120,-19785,-16384,28377,-16384,-28378,-26120,-19785,20429,25618,-7292,31945,32117,6492,-24020,22287,-16384,28377,25100,-21063,31311,9658,11971,-30502,14948,29158,20429,25618,-7292,-31946,25100,-21063,-16384,-28378,31311,9658,32117,6492,-24020,-22288,11971,-30502,-26120,-19785,32767,0,0,0,0,0,0,0,0,0,0,0]; - pss0_f = pss0_f0(1:2:length(pss0_f0)) + sqrt(-1)*pss0_f0(2:2:length(pss0_f0)); + %pss0_f = pss0_f0(1:2:length(pss0_f0)) + sqrt(-1)*pss0_f0(2:2:length(pss0_f0)); + pss0_f = pss0_f0(1:2:size(pss0_f0,2)) + sqrt(-1)*pss0_f0(2:2:size(pss0_f0,2)); pss0_f = [0 pss0_f(37:72) zeros(1,512-73) pss0_f(1:36)]; pss0_t = ifft(pss0_f); @@ -84,10 +85,15 @@ case 4 pss0_t_fp_re = floor(real(8192*pss0_t/pss0_max)); pss0_t_fp_im = floor(imag(8192*pss0_t/pss0_max)); + %keyboard; s(38400+(1:length(pss0_t_fp_re)),1) = 2*floor(pss0_t_fp_re) + 2*sqrt(-1)*floor(pss0_t_fp_im); s(38400+(1:length(pss0_t_fp_re)),2) = 2*floor(pss0_t_fp_re) + 2*sqrt(-1)*floor(pss0_t_fp_im); s(38400+(1:length(pss0_t_fp_re)),3) = 2*floor(pss0_t_fp_re) + 2*sqrt(-1)*floor(pss0_t_fp_im); s(38400+(1:length(pss0_t_fp_re)),4) = 2*floor(pss0_t_fp_re) + 2*sqrt(-1)*floor(pss0_t_fp_im); + %s(38400+(1:size(pss0_t_fp_re,2)),1) = 2*floor(pss0_t_fp_re) + 2*sqrt(-1)*floor(pss0_t_fp_im); + %s(38400+(1:size(pss0_t_fp_re,2)),2) = 2*floor(pss0_t_fp_re) + 2*sqrt(-1)*floor(pss0_t_fp_im); + %s(38400+(1:size(pss0_t_fp_re,2)),3) = 2*floor(pss0_t_fp_re) + 2*sqrt(-1)*floor(pss0_t_fp_im); + %s(38400+(1:size(pss0_t_fp_re,2)),4) = 2*floor(pss0_t_fp_re) + 2*sqrt(-1)*floor(pss0_t_fp_im); case 5 x=1:length; @@ -108,7 +114,9 @@ case 6 s(:,1) = OFDM_TX_FRAME(num_carriers,num_zeros,prefix_length,num_symbols_frame,preamble_length); s(:,1) = floor(amp*(s(:,1)./max([real(s(:,1)); imag(s(:,1))]))); - + +case 7 + s(:,1) = floor(txs0); otherwise error('unknown case') From cf4a005e320c0a6e140d9a24d04b47f76a5f44e4 Mon Sep 17 00:00:00 2001 From: Xiwen JIANG Date: Wed, 9 Sep 2015 09:53:59 +0200 Subject: [PATCH 002/349] Beamforming channel estimation based on UE specific reference signal --- openair1/PHY/INIT/lte_init.c | 4 +- .../LTE_ESTIMATION/bf_freq_domain_filters.m | 40 +- openair1/PHY/LTE_ESTIMATION/defs.h | 1 - openair1/PHY/LTE_ESTIMATION/filt12_32.h | 14 + .../lte_dl_bf_channel_estimation.c | 688 +++++++++++++++++- openair1/PHY/LTE_REFSIG/defs.h | 8 +- openair1/PHY/LTE_REFSIG/lte_dl_ue_spec.c | 125 ++-- openair1/PHY/LTE_REFSIG/lte_dl_uespec.c | 0 openair1/PHY/LTE_REFSIG/lte_gold.c | 54 +- .../PHY/LTE_TRANSPORT/dlsch_demodulation.c | 83 ++- openair1/PHY/LTE_TRANSPORT/dlsch_modulation.c | 66 +- openair1/PHY/LTE_TRANSPORT/pilots_ue_spec.c | 4 +- openair1/PHY/LTE_TRANSPORT/proto.h | 2 + openair1/PHY/MODULATION/slot_fep.c | 24 +- openair1/PHY/defs.h | 4 +- openair1/SIMULATION/LTE_PHY/dlsim.c | 26 +- 16 files changed, 918 insertions(+), 225 deletions(-) delete mode 100644 openair1/PHY/LTE_REFSIG/lte_dl_uespec.c diff --git a/openair1/PHY/INIT/lte_init.c b/openair1/PHY/INIT/lte_init.c index 51c4939c56..512b5192c0 100644 --- a/openair1/PHY/INIT/lte_init.c +++ b/openair1/PHY/INIT/lte_init.c @@ -948,8 +948,8 @@ void phy_init_lte_ue__PDSCH( LTE_UE_PDSCH* const pdsch, const LTE_DL_FRAME_PARMS pdsch->rxdataF_uespec_pilots[idx] = (int32_t*)malloc16_clear( sizeof(int32_t) * frame_parms->N_RB_DL*12); pdsch->rxdataF_comp0[idx] = (int32_t*)malloc16_clear( sizeof(int32_t) * num ); 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) * num ); - pdsch->dl_bf_ch_estimates_ext[idx] = (int32_t*)malloc16_clear( sizeof(int32_t)*frame_parms->symbols_per_tti*(frame_parms->ofdm_symbol_size+LTE_CE_FILTER_LENGTH) ); + pdsch->dl_bf_ch_estimates[idx] = (int32_t*)malloc16_clear( sizeof(int32_t) * frame_parms->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 ); diff --git a/openair1/PHY/LTE_ESTIMATION/bf_freq_domain_filters.m b/openair1/PHY/LTE_ESTIMATION/bf_freq_domain_filters.m index 557c54dddd..e0c0a0f18f 100644 --- a/openair1/PHY/LTE_ESTIMATION/bf_freq_domain_filters.m +++ b/openair1/PHY/LTE_ESTIMATION/bf_freq_domain_filters.m @@ -1,57 +1,57 @@ -filter_length = 12; +filt_len = 16; F = -3/4:1/4:7/4; -F_l = zeros(8,12); -F_r = zeros(8,12); -F_m = zeros(8,12); +F_l = zeros(8,filt_len); +F_r = zeros(8,filt_len); +F_m = zeros(8,filt_len); F2 =-3/5:1/5:8/5; for i=0:3 - F_l(i+1,:) = floor(16384*[F(8+i:-1:4) zeros(1,7-i)]); - F_r(i+1,:) = floor(16384*[zeros(1,4+i) F(4:end-i)]); - F_m(i+1,:) = floor(16384*[F(4-i:8) F(7:-1:1+i)]); + F_l(i+1,:) = floor(16384*[F(8+i:-1:4) zeros(1,7-i) zeros(1,4)]); + F_r(i+1,:) = floor(16384*[zeros(1,4+i) F(4:end-i) zeros(1,4)]); + F_m(i+1,:) = floor(16384*[F(4-i:8) F(7:-1:1+i) zeros(1,4)]); end for i=0:1 - F_l(i+5,:) = floor(16384*[F(8:-1:4-i) zeros(1,7-i)]); - F_r(i+5,:) = floor(16384*[zeros(1,5+i) F2(5+i) F2(7:end-i)]); - F_m(i+5,:) = floor(16384*[F(4-i:8) F2(8-i) F2(6:-1:1+i)]); + F_l(i+5,:) = floor(16384*[F(8:-1:4-i) zeros(1,7-i) zeros(1,4)]); + F_r(i+5,:) = floor(16384*[zeros(1,5+i) F2(5+i) F2(7:end-i) zeros(1,4)]); + F_m(i+5,:) = floor(16384*[F(4-i:8) F2(8-i) F2(6:-1:1+i) zeros(1,4)]); end for i=2:3 - F_l(i+5,:) = floor(16384*[F2(end:-1:7) F2(8-i) zeros(1,5)]); - F_r(i+5,:) = floor(16384*[zeros(1,4+i) F(4:end-i)]); - F_m(i+5,:) = floor(16384*[F2(4-i:6) F2(4+i) F(8:-1:1+i)]); + F_l(i+5,:) = floor(16384*[F2(end:-1:7) F2(8-i) zeros(1,5) zeros(1,4)]); + F_r(i+5,:) = floor(16384*[zeros(1,4+i) F(4:end-i) zeros(1,4)]); + F_m(i+5,:) = floor(16384*[F2(4-i:6) F2(4+i) F(8:-1:1+i) zeros(1,4)]); end -fd = fopen("filt12_32.h","w"); +fd = fopen("filt16_32.h","w"); for i=0:3 - fprintf(fd,"short filt12_l%d[12] = {\n",i); + fprintf(fd,"short filt%d_l%d[%d] = {\n",filt_len,i,filt_len); fprintf(fd,"%d,",F_l(i+1,1:end-1)); fprintf(fd,"%d};\n\n",F_l(i+1,end)); - fprintf(fd,"short filt12_r%d[12] = {\n",i); + fprintf(fd,"short filt%d_r%d[%d] = {\n",filt_len,i,filt_len); fprintf(fd,"%d,",F_r(i+1,1:end-1)); fprintf(fd,"%d};\n\n",F_r(i+1,end)); - fprintf(fd,"short filt12_m%d[12] = {\n",i); + fprintf(fd,"short filt%d_m%d[%d] = {\n",filt_len,i,filt_len); fprintf(fd,"%d,",F_m(i+1,1:end-1)); fprintf(fd,"%d};\n\n",F_m(i+1,end)); end for i=0:3 - fprintf(fd,"short filt12_l%d_dc[12] = {\n",i); + fprintf(fd,"short filt%d_l%d_dc[%d] = {\n",filt_len,i,filt_len); fprintf(fd,"%d,",F_l(i+5,1:end-1)); fprintf(fd,"%d};\n\n",F_l(i+5,end)); - fprintf(fd,"short filt12_r%d_dc[12] = {\n",i); + fprintf(fd,"short filt%d_r%d_dc[%d] = {\n",filt_len,i,filt_len); fprintf(fd,"%d,",F_r(i+5,1:end-1)); fprintf(fd,"%d};\n\n",F_r(i+5,end)); - fprintf(fd,"short filt12_m%d_dc[12] = {\n",i); + fprintf(fd,"short filt%d_m%d_dc[%d] = {\n",filt_len,i,filt_len); fprintf(fd,"%d,",F_m(i+5,1:end-1)); fprintf(fd,"%d};\n\n",F_m(i+5,end)); end diff --git a/openair1/PHY/LTE_ESTIMATION/defs.h b/openair1/PHY/LTE_ESTIMATION/defs.h index 4763602525..1a747c1cc8 100644 --- a/openair1/PHY/LTE_ESTIMATION/defs.h +++ b/openair1/PHY/LTE_ESTIMATION/defs.h @@ -123,7 +123,6 @@ int lte_dl_channel_estimation(PHY_VARS_UE *phy_vars_ue, uint8_t l, uint8_t symbol); - int lte_dl_bf_channel_estimation(PHY_VARS_UE *phy_vars_ue, module_id_t eNB_id, uint8_t eNB_offset, diff --git a/openair1/PHY/LTE_ESTIMATION/filt12_32.h b/openair1/PHY/LTE_ESTIMATION/filt12_32.h index 602f7c2c3f..a5dfdb0365 100644 --- a/openair1/PHY/LTE_ESTIMATION/filt12_32.h +++ b/openair1/PHY/LTE_ESTIMATION/filt12_32.h @@ -70,3 +70,17 @@ short filt12_r3_dc[12] = { short filt12_m3_dc[12] = { -9831,-6554,-3277,0,3276,6553,9830,16384,12288,8192,4096,0}; +short filt12_1[12] = { +16384,16384,16384,16384,16384,16384,16384,16384,16384,16384,16384,16384}; + +short filt12_2l0[12] = { +16384,12288,8192,4096,-4096,0,0,0,0,0,0,0}; + +short filt12_2r0[12] = { +0,4096,8192,12288,16384,20480,0,0,0,0,0,0}; + +short filt12_2l1[12] = { +20480,16384,12288,8192,4096,0,0,0,0,0,0,0}; + +short filt12_2r1[12] = { +-4096,0,4096,8192,12288,16384,0,0,0,0,0,0}; diff --git a/openair1/PHY/LTE_ESTIMATION/lte_dl_bf_channel_estimation.c b/openair1/PHY/LTE_ESTIMATION/lte_dl_bf_channel_estimation.c index 9707b15b35..457aaeed56 100644 --- a/openair1/PHY/LTE_ESTIMATION/lte_dl_bf_channel_estimation.c +++ b/openair1/PHY/LTE_ESTIMATION/lte_dl_bf_channel_estimation.c @@ -31,10 +31,9 @@ #endif #include "defs.h" #include "PHY/defs.h" -#include "filt12_32.h" +#include "filt16_32.h" //#define DEBUG_CH -/*To be accomplished*/ int lte_dl_bf_channel_estimation(PHY_VARS_UE *phy_vars_ue, uint8_t eNB_id, uint8_t eNB_offset, @@ -43,53 +42,670 @@ int lte_dl_bf_channel_estimation(PHY_VARS_UE *phy_vars_ue, unsigned char symbol) { - unsigned char aarx; - int uespec_pilot[9][200]; - short *pil, *rxF; + unsigned short rb,nb_rb=0; + unsigned char aarx,l,lprime,nsymb,skip_half=0,sss_symb,pss_symb=0,rb_alloc_ind,harq_pid,uespec_pilots=0; + int beamforming_mode, ch_offset; + uint8_t subframe; + int8_t uespec_nushift, uespec_poffset=0, pil_offset; + uint8_t pilot0,pilot1,pilot2,pilot3; - //LTE_UE_PDSCH *lte_ue_pdsch_vars = phy_vars_ue->lte_ue_pdsch_vars[eNB_id]; - int **rxdataF = phy_vars_ue->lte_ue_common_vars.rxdataF; - int32_t **dl_bf_ch_estimates = phy_vars_ue->lte_ue_pdsch_vars[eNB_id]->dl_bf_ch_estimates; + short ch[2], *pil, *rxF, *dl_bf_ch, *dl_bf_ch_prev; + short *fl, *fm, *fr, *fl_dc, *fm_dc, *fr_dc, *f1, *f2l, *f2r; - int beamforming_mode = phy_vars_ue->transmission_mode>7?phy_vars_ue->transmission_mode : 0; - - // define interpolation filters - //.... + unsigned int *rb_alloc; + int **rxdataF; + int32_t **dl_bf_ch_estimates; + int uespec_pilot[300]; - //ch_offset = phy_vars_ue->lte_frame_parms.ofdm_symbol_size*symbol; + LTE_DL_FRAME_PARMS *frame_parms = &phy_vars_ue->lte_frame_parms; + LTE_UE_DLSCH_t **dlsch_ue = phy_vars_ue->dlsch_ue[eNB_id]; + LTE_DL_UE_HARQ_t *dlsch0_harq; - //generate ue specific pilots - if(beamforming_mode==7) - lte_dl_ue_spec_rx(phy_vars_ue,&uespec_pilot[p-5][0],Ns,p,0); - else if (beamforming_mode>7) - lte_dl_ue_spec_rx(phy_vars_ue,&uespec_pilot[p-6][0],Ns,p,0); - else if (beamforming_mode==0) - msg("No beamforming is performed.\n"); + harq_pid = dlsch_ue[0]->current_harq_pid; + dlsch0_harq = dlsch_ue[0]->harq_processes[harq_pid]; + + rb_alloc = dlsch0_harq->rb_alloc; + + rxdataF = phy_vars_ue->lte_ue_common_vars.rxdataF; + + dl_bf_ch_estimates = phy_vars_ue->lte_ue_pdsch_vars[eNB_id]->dl_bf_ch_estimates; + beamforming_mode = phy_vars_ue->transmission_mode[eNB_id]>6 ? phy_vars_ue->transmission_mode[eNB_id] : 0; + + if (phy_vars_ue->high_speed_flag == 0) // use second channel estimate position for temporary storage + ch_offset = frame_parms->ofdm_symbol_size; else - msg("Beamforming mode not supported yet.\n"); + ch_offset = frame_parms->ofdm_symbol_size*symbol; + + uespec_nushift = frame_parms->Nid_cell%3; + subframe = Ns>>1; + - if(beamforming_mode==7) { + if (beamforming_mode==7) { + //generate ue specific pilots + lprime = symbol/3-1; + lte_dl_ue_spec_rx(phy_vars_ue,uespec_pilot,Ns,5,lprime,0,dlsch0_harq->nb_rb); + write_output("uespec_pilot_rx.m","uespec_pilot",uespec_pilot,300,1,1); + + if (frame_parms->Ncp==0){ + if (symbol==3 || symbol==6 || symbol==9 || symbol==12) + uespec_pilots = 1; + } else{ + if (symbol==4 || symbol==7 || symbol==10) + uespec_pilots = 1; + } - for (aarx=0; aarxlte_frame_parms.nb_antennas_rx;aarx++) { + if ((frame_parms->Ncp==0 && (symbol==6 ||symbol ==12)) || (frame_parms->Ncp==1 && symbol==7)) + uespec_poffset = 2; - /* pil = (short *)&uespec_pilot[0][0]; - rxF = (short *)&rxdataF_uespec[aarx][(symbol-1)/3*frame_parms->N_RB_DL*(3+frame_parms->Ncp)]; - dl_ch = (short *)&dl_bf_ch_estimates[aarx][ch_offset]; - - memset(dl_ch,0,4*(phy_vars_ue->lte_frame_parms.ofdm_symbol_size)); - //estimation and interpolation */ + if (phy_vars_ue->lte_frame_parms.Ncp == 0) { // normal prefix + pilot0 = 3; + pilot1 = 6; + pilot2 = 9; + pilot3 = 12; + } else { // extended prefix + pilot0 = 4; + pilot1 = 7; + pilot2 = 10; } - } else if (beamforming_mode==0){ - msg("No beamforming is performed.\n"); - return(-1); - } else { - msg("Beamforming mode is not supported yet.\n"); - return(-1); + //define the filter + pil_offset = (uespec_nushift+uespec_poffset)%3; + // printf("symbol=%d,pil_offset=%d\n",symbol,pil_offset); + switch (pil_offset) { + case 0: + fl = filt16_l0; + fm = filt16_m0; + fr = filt16_r0; + fl_dc = filt16_l0; + fm_dc = filt16_m0; + fr_dc = filt16_r0; + f1 = filt16_1; + f2l = filt16_2l0; + f2r = filt16_2r0; + break; + + case 1: + fl = filt16_l1; + fm = filt16_m1; + fr = filt16_r1; + fl_dc = filt16_l1; + fm_dc = filt16_m1; + fr_dc = filt16_r1; + f1 = filt16_1; + f2l = filt16_2l1; + f2r = filt16_2r1; + break; + + case 2: + fl = filt16_l2; + fm = filt16_m2; + fr = filt16_r2; + fl_dc = filt16_l2; + fm_dc = filt16_m2; + fr_dc = filt16_r2; + f1 = filt16_1; + f2l = filt16_2l0; + f2r = filt16_2r0; + break; + + case 3: + fl = filt16_l3; + fm = filt16_m3; + fr = filt16_r3; + fl_dc = filt16_l3; + fm_dc = filt16_m3; + fr_dc = filt16_r3; + f1 = filt16_1; + f2l = filt16_2l1; + f2r = filt16_2r1; + break; + } } + else if (beamforming_mode==0) + msg("lte_dl_bf_channel_estimation:No beamforming is performed.\n"); + else + msg("lte_dl_bf_channel_estimation:Beamforming mode not supported yet.\n"); - //temporal interpolation + + l=symbol; + nsymb = (frame_parms->Ncp==NORMAL) ? 14:12; + + if (frame_parms->frame_type == TDD) { //TDD + sss_symb = nsymb-1; + pss_symb = 2; + } else { + sss_symb = (nsymb>>1)-2; + pss_symb = (nsymb>>1)-1; + } + + + for (aarx=0; aarxnb_antennas_rx; aarx++) { + + rxF = (short *)&rxdataF[aarx][pil_offset + frame_parms->first_carrier_offset + symbol*frame_parms->ofdm_symbol_size]; + pil = (short*)uespec_pilot; + dl_bf_ch = (short *)&dl_bf_ch_estimates[aarx][ch_offset]; + + memset(dl_bf_ch,0,4*(frame_parms->ofdm_symbol_size)); + //memset(dl_bf_ch,0,2*(frame_parms->ofdm_symbol_size)); + + if (phy_vars_ue->high_speed_flag==0) // multiply previous channel estimate by ch_est_alpha + if (frame_parms->Ncp==0) + multadd_complex_vector_real_scalar(dl_bf_ch-(frame_parms->ofdm_symbol_size<<1), + phy_vars_ue->ch_est_alpha,dl_bf_ch-(frame_parms->ofdm_symbol_size<<1), + 1,frame_parms->ofdm_symbol_size); + else + msg("lte_dl_bf_channel_estimation: beamforming channel estimation not supported for TM7 Extended CP.\n"); // phy_vars_ue->ch_est_beta should be defined equaling 1/3 + + //estimation and interpolation + + if ((frame_parms->N_RB_DL&1) == 0) // even number of RBs + for (rb=0; rbN_RB_DL; rb++) { + + if (rb < 32) + rb_alloc_ind = (rb_alloc[0]>>rb) & 1; + else if (rb < 64) + rb_alloc_ind = (rb_alloc[1]>>(rb-32)) & 1; + else if (rb < 96) + rb_alloc_ind = (rb_alloc[2]>>(rb-64)) & 1; + else if (rb < 100) + rb_alloc_ind = (rb_alloc[3]>>(rb-96)) & 1; + else + rb_alloc_ind = 0; + + // For second half of RBs skip DC carrier + if (rb==(frame_parms->N_RB_DL>>1)) { + rxF = &rxdataF[aarx][(1 + (symbol*(frame_parms->ofdm_symbol_size)))]; + } + + if (rb_alloc_ind==1) { + if (uespec_pilots==1) { + if (beamforming_mode==7) { + if (frame_parms->Ncp==0) { + + ch[0] = (short)(((int)pil[0]*rxF[0] - (int)pil[1]*rxF[1])>>15); + ch[1] = (short)(((int)pil[0]*rxF[1] + (int)pil[1]*rxF[0])>>15); + multadd_real_vector_complex_scalar(fl,ch,dl_bf_ch,16); + //printf("rxF[%d]=(%d,%d),pil=(%d,%d),ch=(%d,%d)\n",pil_offset,rxF[0],rxF[1],pil[0],pil[1],ch[0],ch[1]); + + ch[0] = (short)(((int)pil[0]*rxF[8] - (int)pil[1]*rxF[9])>>15); + ch[1] = (short)(((int)pil[0]*rxF[9] + (int)pil[1]*rxF[8])>>15); + multadd_real_vector_complex_scalar(fm,ch,dl_bf_ch,16); + + ch[0] = (short)(((int)pil[0]*rxF[16] - (int)pil[1]*rxF[17])>>15); + ch[1] = (short)(((int)pil[0]*rxF[17] + (int)pil[1]*rxF[16])>>15); + multadd_real_vector_complex_scalar(fr,ch,dl_bf_ch,16); + } + } else { + msg("lte_dl_bf_channel_estimation(lte_dl_bf_channel_estimation.c):TM7 beamgforming channel estimation not supported for extented CP\n"); + exit(-1); + } + + } else { + msg("lte_dl_bf_channel_estimation(lte_dl_bf_channel_estimation.c): transmission mode not supported.\n"); + } + nb_rb++; + } + + rxF+=24; + dl_bf_ch+=24; + } + else { // Odd number of RBs + for (rb=0; rbN_RB_DL>>1; rb++) { + skip_half=0; + + if (rb < 32) + rb_alloc_ind = (rb_alloc[0]>>rb) & 1; + else if (rb < 64) + rb_alloc_ind = (rb_alloc[1]>>(rb-32)) & 1; + else if (rb < 96) + rb_alloc_ind = (rb_alloc[2]>>(rb-64)) & 1; + else if (rb < 100) + rb_alloc_ind = (rb_alloc[3]>>(rb-96)) & 1; + else + rb_alloc_ind = 0; + + // PBCH + if ((subframe==0) && (rb>((frame_parms->N_RB_DL>>1)-3)) && (rb<((frame_parms->N_RB_DL>>1)+3)) && (l>=(nsymb>>1)) && (l<((nsymb>>1) + 4))) { + rb_alloc_ind = 0; + } + + //PBCH subframe 0, symbols nsymb>>1 ... nsymb>>1 + 3 + if ((subframe==0) && (rb==((frame_parms->N_RB_DL>>1)-3)) && (l>=(nsymb>>1)) && (l<((nsymb>>1) + 4))) + skip_half=1; + else if ((subframe==0) && (rb==((frame_parms->N_RB_DL>>1)+3)) && (l>=(nsymb>>1)) && (l<((nsymb>>1) + 4))) + skip_half=2; + + //SSS + if (((subframe==0)||(subframe==5)) && + (rb>((frame_parms->N_RB_DL>>1)-3)) && + (rb<((frame_parms->N_RB_DL>>1)+3)) && + (l==sss_symb) ) { + rb_alloc_ind = 0; + } + + //SSS + if (((subframe==0)||(subframe==5)) && + (rb==((frame_parms->N_RB_DL>>1)-3)) && + (l==sss_symb)) + skip_half=1; + else if (((subframe==0)||(subframe==5)) && + (rb==((frame_parms->N_RB_DL>>1)+3)) && + (l==sss_symb)) + skip_half=2; + + //PSS in subframe 0/5 if FDD + if (frame_parms->frame_type == FDD) { //FDD + if (((subframe==0)||(subframe==5)) && (rb>((frame_parms->N_RB_DL>>1)-3)) && (rb<((frame_parms->N_RB_DL>>1)+3)) && (l==pss_symb) ) { + rb_alloc_ind = 0; + } + + if (((subframe==0)||(subframe==5)) && (rb==((frame_parms->N_RB_DL>>1)-3)) && (l==pss_symb)) + skip_half=1; + else if (((subframe==0)||(subframe==5)) && (rb==((frame_parms->N_RB_DL>>1)+3)) && (l==pss_symb)) + skip_half=2; + } + + if ((frame_parms->frame_type == TDD) && + (subframe==6)) { //TDD Subframe 6 + if ((rb>((frame_parms->N_RB_DL>>1)-3)) && (rb<((frame_parms->N_RB_DL>>1)+3)) && (l==pss_symb) ) { + rb_alloc_ind = 0; + } + + if ((rb==((frame_parms->N_RB_DL>>1)-3)) && (l==pss_symb)) + skip_half=1; + else if ((rb==((frame_parms->N_RB_DL>>1)+3)) && (l==pss_symb)) + skip_half=2; + } + + //printf("symbol=%d,pil_offset=%d\ni,rb_alloc_ind=%d,uespec_pilots=%d,beamforming_mode=%d,Ncp=%d,skip_half=%d\n",symbol,pil_offset,rb_alloc_ind,uespec_pilots,beamforming_mode,frame_parms->Ncp,skip_half); + if (rb_alloc_ind==1) { + if (uespec_pilots==1) { + if (beamforming_mode==7) { + if (frame_parms->Ncp==0) { + if (skip_half==1) { + if (pil_offset<2) { + + ch[0] = (short)(((int)pil[0]*rxF[0] - (int)pil[1]*rxF[1])>>15); + ch[1] = (short)(((int)pil[0]*rxF[1] + (int)pil[1]*rxF[0])>>15); + multadd_real_vector_complex_scalar(f2l,ch,dl_bf_ch,16); + pil+=2; + + ch[0] = (short)(((int)pil[0]*rxF[8] - (int)pil[1]*rxF[9])>>15); + ch[1] = (short)(((int)pil[0]*rxF[9] + (int)pil[1]*rxF[8])>>15); + multadd_real_vector_complex_scalar(f2r,ch,dl_bf_ch,16); + pil+=2; + + } else { + + ch[0] = (short)(((int)pil[0]*rxF[0] - (int)pil[1]*rxF[1])>>15); + ch[1] = (short)(((int)pil[0]*rxF[1] + (int)pil[1]*rxF[0])>>15); + multadd_real_vector_complex_scalar(f1,ch,dl_bf_ch,16); + pil+=2; + } + } else if (skip_half==2) { + if (pil_offset<2) { + + ch[0] = (short)(((int)pil[0]*rxF[16] - (int)pil[1]*rxF[17])>>15); + ch[1] = (short)(((int)pil[0]*rxF[17] + (int)pil[1]*rxF[16])>>15); + multadd_real_vector_complex_scalar(f1,ch,dl_bf_ch,16); + pil+=2; + + } else { + + ch[0] = (short)(((int)pil[0]*rxF[8] - (int)pil[1]*rxF[9])>>15); + ch[1] = (short)(((int)pil[0]*rxF[9] + (int)pil[1]*rxF[8])>>15); + multadd_real_vector_complex_scalar(f2l,ch,dl_bf_ch,16); + pil+=2; + + ch[0] = (short)(((int)pil[0]*rxF[16] - (int)pil[1]*rxF[17])>>15); + ch[1] = (short)(((int)pil[0]*rxF[17] + (int)pil[1]*rxF[16])>>15); + multadd_real_vector_complex_scalar(f2r,ch,dl_bf_ch,16); + pil+=2; + + } + } else { + + ch[0] = (short)(((int)pil[0]*rxF[0] - (int)pil[1]*rxF[1])>>15); + ch[1] = (short)(((int)pil[0]*rxF[1] + (int)pil[1]*rxF[0])>>15); + multadd_real_vector_complex_scalar(fl,ch,dl_bf_ch,16); + //printf("symbol=%d,rxF[%d]=(%d,%d),pil=(%d,%d),ch=(%d,%d)\n",symbol,pil_offset,rxF[0],rxF[1],pil[0],pil[1],ch[0],ch[1]); + pil+=2; + + ch[0] = (short)(((int)pil[0]*rxF[8] - (int)pil[1]*rxF[9])>>15); + ch[1] = (short)(((int)pil[0]*rxF[9] + (int)pil[1]*rxF[8])>>15); + multadd_real_vector_complex_scalar(fm,ch,dl_bf_ch,16); + //printf("symbol=%d,rxF[%d]=(%d,%d),pil=(%d,%d),ch=(%d,%d)\n",symbol,pil_offset,rxF[0],rxF[1],pil[0],pil[1],ch[0],ch[1]); + pil+=2; + + ch[0] = (short)(((int)pil[0]*rxF[16] - (int)pil[1]*rxF[17])>>15); + ch[1] = (short)(((int)pil[0]*rxF[17] + (int)pil[1]*rxF[16])>>15); + multadd_real_vector_complex_scalar(fr,ch,dl_bf_ch,16); + //printf("symbol=%d,rxF[%d]=(%d,%d),pil=(%d,%d),ch=(%d,%d)\n",symbol,pil_offset,rxF[0],rxF[1],pil[0],pil[1],ch[0],ch[1]); + pil+=2; + + } + } else { + msg("lte_dl_bf_channel_estimation(lte_dl_bf_channel_estimation.c):TM7 beamgforming channel estimation not supported for extented CP\n"); + exit(-1); + } + + } else { + msg("lte_dl_bf_channel_estimation(lte_dl_bf_channel_estimation.c):transmission mode not supported.\n"); + } + } + nb_rb++; + } + + rxF+=24; + dl_bf_ch+=24; + } // first half loop + + // Do middle RB (around DC) + if (rb < 32) + rb_alloc_ind = (rb_alloc[0]>>rb) & 1; + else if (rb < 64) + rb_alloc_ind = (rb_alloc[1]>>(rb-32)) & 1; + else if (rb < 96) + rb_alloc_ind = (rb_alloc[2]>>(rb-64)) & 1; + else if (rb < 100) + rb_alloc_ind = (rb_alloc[3]>>(rb-96)) & 1; + else + rb_alloc_ind = 0; + + // PBCH + if ((subframe==0) && (rb>=((frame_parms->N_RB_DL>>1)-3)) && (rb<((frame_parms->N_RB_DL>>1)+3)) && (l>=(nsymb>>1)) && (l<((nsymb>>1) + 4))) { + rb_alloc_ind = 0; + } + + //SSS + if (((subframe==0)||(subframe==5)) && (rb>=((frame_parms->N_RB_DL>>1)-3)) && (rb<((frame_parms->N_RB_DL>>1)+3)) && (l==sss_symb) ) { + rb_alloc_ind = 0; + } + + if (frame_parms->frame_type == FDD) { + //PSS + if (((subframe==0)||(subframe==5)) && (rb>=((frame_parms->N_RB_DL>>1)-3)) && (rb<((frame_parms->N_RB_DL>>1)+3)) && (l==pss_symb) ) { + rb_alloc_ind = 0; + } + } + + if ((frame_parms->frame_type == TDD) && (subframe==6)) { + //PSS + if ((rb>((frame_parms->N_RB_DL>>1)-3)) && (rb<((frame_parms->N_RB_DL>>1)+3)) && (l==pss_symb) ) { + rb_alloc_ind = 0; + } + } + + //printf("DC rb %d (%p)\n",rb,rxF); + if (rb_alloc_ind==1) { + if (pil_offset<2) { + ch[0] = (short)(((int)pil[0]*rxF[0] - (int)pil[1]*rxF[1])>>15); + ch[1] = (short)(((int)pil[0]*rxF[1] + (int)pil[1]*rxF[0])>>15); + multadd_real_vector_complex_scalar(fl_dc,ch,dl_bf_ch,16); + //printf("symbol=%d,rxF[%d]=(%d,%d),pil=(%d,%d),ch=(%d,%d)\n",symbol,pil_offset,rxF[0],rxF[1],pil[0],pil[1],ch[0],ch[1]); + pil+=2;; + + ch[0] = (short)(((int)pil[0]*rxF[8] - (int)pil[1]*rxF[9])>>15); + ch[1] = (short)(((int)pil[0]*rxF[9] + (int)pil[1]*rxF[8])>>15); + multadd_real_vector_complex_scalar(fm_dc,ch,dl_bf_ch,16); + //printf("symbol=%d,rxF[%d]=(%d,%d),pil=(%d,%d),ch=(%d,%d)\n",symbol,pil_offset,rxF[8],rxF[9],pil[0],pil[1],ch[0],ch[1]); + pil+=2;; + + rxF = (short *)&rxdataF[aarx][symbol*(frame_parms->ofdm_symbol_size)]; + + ch[0] = (short)(((int)pil[0]*rxF[6] - (int)pil[1]*rxF[7])>>15); + ch[1] = (short)(((int)pil[0]*rxF[7] + (int)pil[1]*rxF[6])>>15); + multadd_real_vector_complex_scalar(fr_dc,ch,dl_bf_ch,16); + //printf("symbol=%d,rxF[%d]=(%d,%d),pil=(%d,%d),ch=(%d,%d)\n",symbol,pil_offset,rxF[6],rxF[7],pil[0],pil[1],ch[0],ch[1]); + pil+=2;; + } else { + ch[0] = (short)(((int)pil[0]*rxF[0] - (int)pil[1]*rxF[1])>>15); + ch[1] = (short)(((int)pil[0]*rxF[1] + (int)pil[1]*rxF[0])>>15); + multadd_real_vector_complex_scalar(fl_dc,ch,dl_bf_ch,16); + //printf("symbol=%d,rxF[%d]=(%d,%d),pil=(%d,%d),ch=(%d,%d)\n",symbol,pil_offset,rxF[0],rxF[1],pil[0],pil[1],ch[0],ch[1]); + pil+=2;; + + rxF = (short *)&rxdataF[aarx][symbol*(frame_parms->ofdm_symbol_size)]; + + ch[0] = (short)(((int)pil[0]*rxF[2] - (int)pil[1]*rxF[3])>>15); + ch[1] = (short)(((int)pil[0]*rxF[3] + (int)pil[1]*rxF[2])>>15); + multadd_real_vector_complex_scalar(fm_dc,ch,dl_bf_ch,16); + //printf("symbol=%d,rxF[%d]=(%d,%d),pil=(%d,%d),ch=(%d,%d)\n",symbol,pil_offset,rxF[2],rxF[3],pil[0],pil[1],ch[0],ch[1]); + pil+=2;; + + ch[0] = (short)(((int)pil[0]*rxF[10] - (int)pil[1]*rxF[11])>>15); + ch[1] = (short)(((int)pil[0]*rxF[11] + (int)pil[1]*rxF[10])>>15); + multadd_real_vector_complex_scalar(fr_dc,ch,dl_bf_ch,16); + //printf("symbol=%d,rxF[%d]=(%d,%d),pil=(%d,%d),ch=(%d,%d)\n",symbol,pil_offset,rxF[10],rxF[11],pil[0],pil[1],ch[0],ch[1]); + pil+=2;; + } + } // rballoc==1 + else { + rxF = (short *)&rxdataF[aarx][pil_offset+((symbol*(frame_parms->ofdm_symbol_size)))]; + } + + rxF+=14+2*pil_offset; + dl_bf_ch+=24; + rb++; + + for (; rbN_RB_DL; rb++) { + skip_half=0; + + if (rb < 32) + rb_alloc_ind = (rb_alloc[0]>>rb) & 1; + else if (rb < 64) + rb_alloc_ind = (rb_alloc[1]>>(rb-32)) & 1; + else if (rb < 96) + rb_alloc_ind = (rb_alloc[2]>>(rb-64)) & 1; + else if (rb < 100) + rb_alloc_ind = (rb_alloc[3]>>(rb-96)) & 1; + else + rb_alloc_ind = 0; + + // PBCH + if ((subframe==0) && (rb>((frame_parms->N_RB_DL>>1)-3)) && (rb<((frame_parms->N_RB_DL>>1)+3)) && (l>=nsymb>>1) && (l<((nsymb>>1) + 4))) { + rb_alloc_ind = 0; + } + + //PBCH subframe 0, symbols nsymb>>1 ... nsymb>>1 + 3 + if ((subframe==0) && (rb==((frame_parms->N_RB_DL>>1)-3)) && (l>=(nsymb>>1)) && (l<((nsymb>>1) + 4))) + skip_half=1; + else if ((subframe==0) && (rb==((frame_parms->N_RB_DL>>1)+3)) && (l>=(nsymb>>1)) && (l<((nsymb>>1) + 4))) + skip_half=2; + + //SSS + if (((subframe==0)||(subframe==5)) && (rb>((frame_parms->N_RB_DL>>1)-3)) && (rb<((frame_parms->N_RB_DL>>1)+3)) && (l==sss_symb) ) { + rb_alloc_ind = 0; + } + + //SSS + if (((subframe==0)||(subframe==5)) && (rb==((frame_parms->N_RB_DL>>1)-3)) && (l==sss_symb)) + skip_half=1; + else if (((subframe==0)||(subframe==5)) && (rb==((frame_parms->N_RB_DL>>1)+3)) && (l==sss_symb)) + skip_half=2; + + if (frame_parms->frame_type == FDD) { + //PSS + if (((subframe==0)||(subframe==5)) && (rb>((frame_parms->N_RB_DL>>1)-3)) && (rb<((frame_parms->N_RB_DL>>1)+3)) && (l==pss_symb) ) { + rb_alloc_ind = 0; + } + + //PSS + if (((subframe==0)||(subframe==5)) && (rb==((frame_parms->N_RB_DL>>1)-3)) && (l==pss_symb)) + skip_half=1; + else if (((subframe==0)||(subframe==5)) && (rb==((frame_parms->N_RB_DL>>1)+3)) && (l==pss_symb)) + skip_half=2; + } + + if ((frame_parms->frame_type == TDD) && + (subframe==6)) { //TDD Subframe 6 + if ((rb>((frame_parms->N_RB_DL>>1)-3)) && (rb<((frame_parms->N_RB_DL>>1)+3)) && (l==pss_symb) ) { + rb_alloc_ind = 0; + } + + if ((rb==((frame_parms->N_RB_DL>>1)-3)) && (l==pss_symb)) + skip_half=1; + else if ((rb==((frame_parms->N_RB_DL>>1)+3)) && (l==pss_symb)) + skip_half=2; + } + + if (rb_alloc_ind==1) { + if (uespec_pilots==1) { + if (beamforming_mode==7) { + if (frame_parms->Ncp==0) { + if (skip_half==1) { + if (pil_offset<2) { + + ch[0] = (short)(((int)pil[0]*rxF[0] - (int)pil[1]*rxF[1])>>15); + ch[1] = (short)(((int)pil[0]*rxF[1] + (int)pil[1]*rxF[0])>>15); + multadd_real_vector_complex_scalar(f2l,ch,dl_bf_ch,16); + pil+=2; + + ch[0] = (short)(((int)pil[0]*rxF[8] - (int)pil[1]*rxF[9])>>15); + ch[1] = (short)(((int)pil[0]*rxF[9] + (int)pil[1]*rxF[8])>>15); + multadd_real_vector_complex_scalar(f2r,ch,dl_bf_ch,16); + pil+=2; + + + } else { + + ch[0] = (short)(((int)pil[0]*rxF[0] - (int)pil[1]*rxF[1])>>15); + ch[1] = (short)(((int)pil[0]*rxF[1] + (int)pil[1]*rxF[0])>>15); + multadd_real_vector_complex_scalar(f1,ch,dl_bf_ch,16); + pil+=2; + } + } else if (skip_half==2) { + if (pil_offset<2) { + + ch[0] = (short)(((int)pil[0]*rxF[16] - (int)pil[1]*rxF[17])>>15); + ch[1] = (short)(((int)pil[0]*rxF[17] + (int)pil[1]*rxF[16])>>15); + multadd_real_vector_complex_scalar(f1,ch,dl_bf_ch,16); + pil+=2; + + } else { + + ch[0] = (short)(((int)pil[0]*rxF[8] - (int)pil[1]*rxF[9])>>15); + ch[1] = (short)(((int)pil[0]*rxF[9] + (int)pil[1]*rxF[8])>>15); + multadd_real_vector_complex_scalar(f2l,ch,dl_bf_ch,16); + pil+=2; + + ch[0] = (short)(((int)pil[0]*rxF[16] - (int)pil[1]*rxF[17])>>15); + ch[1] = (short)(((int)pil[0]*rxF[17] + (int)pil[1]*rxF[16])>>15); + multadd_real_vector_complex_scalar(f2r,ch,dl_bf_ch,16); + pil+=2; + + } + } else { + + ch[0] = (short)(((int)pil[0]*rxF[0] - (int)pil[1]*rxF[1])>>15); + ch[1] = (short)(((int)pil[0]*rxF[1] + (int)pil[1]*rxF[0])>>15); + multadd_real_vector_complex_scalar(fl,ch,dl_bf_ch,16); + // printf("symbol=%d,rxF[%d]=(%d,%d),pil=(%d,%d),ch=(%d,%d)\n",symbol,pil_offset,rxF[0],rxF[1],pil[0],pil[1],ch[0],ch[1]); + pil+=2; + + ch[0] = (short)(((int)pil[0]*rxF[8] - (int)pil[1]*rxF[9])>>15); + ch[1] = (short)(((int)pil[0]*rxF[9] + (int)pil[1]*rxF[8])>>15); + multadd_real_vector_complex_scalar(fm,ch,dl_bf_ch,16); + // printf("symbol=%d,rxF[%d]=(%d,%d),pil=(%d,%d),ch=(%d,%d)\n",symbol,pil_offset,rxF[8],rxF[9],pil[0],pil[1],ch[0],ch[1]); + pil+=2; + + ch[0] = (short)(((int)pil[0]*rxF[16] - (int)pil[1]*rxF[17])>>15); + ch[1] = (short)(((int)pil[0]*rxF[17] + (int)pil[1]*rxF[16])>>15); + multadd_real_vector_complex_scalar(fr,ch,dl_bf_ch,16); + // printf("symbol=%d,rxF[%d]=(%d,%d),pil=(%d,%d),ch=(%d,%d)\n",symbol,pil_offset,rxF[16],rxF[17],pil[0],pil[1],ch[0],ch[1]); + pil+=2; + + } + } else { + msg("lte_dl_bf_channel_estimation(lte_dl_bf_channel_estimation.c):TM7 beamgforming channel estimation not supported for extented CP\n"); + exit(-1); + } + + } else { + msg("lte_dl_bf_channel_estimation(lte_dl_bf_channel_estimation.c):transmission mode not supported.\n"); + } + } + nb_rb++; + } + + rxF+=24; + dl_bf_ch+=24; + } // second half of RBs + } // odd number of RBs + + // Temporal Interpolation + if (phy_vars_ue->perfect_ce == 0) { + + dl_bf_ch = (short *)&dl_bf_ch_estimates[aarx][ch_offset]; + printf("dlsch_bf_ch_est.c:symbol %d, dl_bf_ch (%d,%d)\n",symbol,dl_bf_ch[0],dl_bf_ch[1]); + + if (phy_vars_ue->high_speed_flag == 0) { + multadd_complex_vector_real_scalar(dl_bf_ch, + 32767-phy_vars_ue->ch_est_alpha, + dl_bf_ch-(frame_parms->ofdm_symbol_size<<1),0,frame_parms->ofdm_symbol_size); + printf("dlsch_bf_ch_est.c:symbol %d,dl_bf_ch (%d,%d)\n",symbol,*(dl_bf_ch-512*2),*(dl_bf_ch-512*2+1)); + } else { // high_speed_flag == 1 + if (beamforming_mode==7) { + if (frame_parms->Ncp==0) { + if (symbol == pilot0) { + // printf("Interpolating %d->0\n",4-phy_vars_ue->lte_frame_parms.Ncp); + // dl_bf_ch_prev = (short *)&dl_bf_ch_estimates[aarx][(4-phy_vars_ue->lte_frame_parms.Ncp)*(frame_parms->ofdm_symbol_size)]; + dl_bf_ch_prev = (short *)&dl_bf_ch_estimates[aarx][pilot3*(frame_parms->ofdm_symbol_size)]; + + // pilot spacing 5 symbols (1/5,2/5,3/5,4/5 combination) + multadd_complex_vector_real_scalar(dl_bf_ch_prev,26214,dl_bf_ch_prev+(2*(frame_parms->ofdm_symbol_size)),1,frame_parms->ofdm_symbol_size); + multadd_complex_vector_real_scalar(dl_bf_ch,6554,dl_bf_ch_prev+(2*(frame_parms->ofdm_symbol_size)),0,frame_parms->ofdm_symbol_size); + + multadd_complex_vector_real_scalar(dl_bf_ch_prev,19661,dl_bf_ch-(3*2*(frame_parms->ofdm_symbol_size)),1,frame_parms->ofdm_symbol_size); + multadd_complex_vector_real_scalar(dl_bf_ch,13107,dl_bf_ch-(3*2*(frame_parms->ofdm_symbol_size)),0,frame_parms->ofdm_symbol_size); + + multadd_complex_vector_real_scalar(dl_bf_ch_prev,13107,dl_bf_ch-(2*((frame_parms->ofdm_symbol_size)<<1)),1,frame_parms->ofdm_symbol_size); + multadd_complex_vector_real_scalar(dl_bf_ch,19661,dl_bf_ch-(2*((frame_parms->ofdm_symbol_size)<<1)),0,frame_parms->ofdm_symbol_size); + + multadd_complex_vector_real_scalar(dl_bf_ch_prev,6554,dl_bf_ch-(2*(frame_parms->ofdm_symbol_size)),1,frame_parms->ofdm_symbol_size); + multadd_complex_vector_real_scalar(dl_bf_ch,26214,dl_bf_ch-(2*(frame_parms->ofdm_symbol_size)),0,frame_parms->ofdm_symbol_size); + } else if (symbol == pilot1) { + dl_bf_ch_prev = (short *)&dl_bf_ch_estimates[aarx][pilot0*(frame_parms->ofdm_symbol_size)]; + + // pilot spacing 3 symbols (1/3,2/3 combination) + multadd_complex_vector_real_scalar(dl_bf_ch_prev,21845,dl_bf_ch_prev+(2*(frame_parms->ofdm_symbol_size)),1,frame_parms->ofdm_symbol_size); + multadd_complex_vector_real_scalar(dl_bf_ch,10923,dl_bf_ch_prev+(2*(frame_parms->ofdm_symbol_size)),0,frame_parms->ofdm_symbol_size); + + multadd_complex_vector_real_scalar(dl_bf_ch_prev,10923,dl_bf_ch_prev+(2*((frame_parms->ofdm_symbol_size)<<1)),1,frame_parms->ofdm_symbol_size); + multadd_complex_vector_real_scalar(dl_bf_ch,21845,dl_bf_ch_prev+(2*((frame_parms->ofdm_symbol_size)<<1)),0,frame_parms->ofdm_symbol_size); + + } else if (symbol == pilot2) { + dl_bf_ch_prev = (short *)&dl_bf_ch_estimates[aarx][pilot1*(frame_parms->ofdm_symbol_size)]; + + multadd_complex_vector_real_scalar(dl_bf_ch_prev,21845,dl_bf_ch_prev+(2*(frame_parms->ofdm_symbol_size)),1,frame_parms->ofdm_symbol_size); + multadd_complex_vector_real_scalar(dl_bf_ch,10923,dl_bf_ch_prev+(2*(frame_parms->ofdm_symbol_size)),0,frame_parms->ofdm_symbol_size); + + multadd_complex_vector_real_scalar(dl_bf_ch_prev,10923,dl_bf_ch_prev+(2*((frame_parms->ofdm_symbol_size)<<1)),1,frame_parms->ofdm_symbol_size); + multadd_complex_vector_real_scalar(dl_bf_ch,21845,dl_bf_ch_prev+(2*((frame_parms->ofdm_symbol_size)<<1)),0,frame_parms->ofdm_symbol_size); + } else { // symbol == pilot3 + // printf("Interpolating 0->%d\n",4-phy_vars_ue->lte_frame_parms.Ncp); + dl_bf_ch_prev = (short *)&dl_bf_ch_estimates[aarx][pilot2*(frame_parms->ofdm_symbol_size)]; + + // pilot spacing 3 symbols (1/3,2/3 combination) + multadd_complex_vector_real_scalar(dl_bf_ch_prev,21845,dl_bf_ch_prev+(2*(frame_parms->ofdm_symbol_size)),1,frame_parms->ofdm_symbol_size); + multadd_complex_vector_real_scalar(dl_bf_ch,10923,dl_bf_ch_prev+(2*(frame_parms->ofdm_symbol_size)),0,frame_parms->ofdm_symbol_size); + + multadd_complex_vector_real_scalar(dl_bf_ch_prev,10923,dl_bf_ch_prev+(2*((frame_parms->ofdm_symbol_size)<<1)),1,frame_parms->ofdm_symbol_size); + multadd_complex_vector_real_scalar(dl_bf_ch,21845,dl_bf_ch_prev+(2*((frame_parms->ofdm_symbol_size)<<1)),0,frame_parms->ofdm_symbol_size); + } + + } else { + msg("lte_dl_bf_channel_estimation:temporal interpolation not supported for TM7 extented CP.\n"); + } + } else { + msg("lte_dl_bf_channel_estimation:temporal interpolation not supported for this beamforming mode.\n"); + } + } + } + } //aarx + + //printf("[dlsch bf ch est]: dl_bf_estimates[0][600] %d, %d \n",*(short *)&dl_bf_ch_estimates[0][600],*(short*)&phy_vars_ue->lte_ue_pdsch_vars[eNB_id]->dl_bf_ch_estimates[0][600]); return(0); diff --git a/openair1/PHY/LTE_REFSIG/defs.h b/openair1/PHY/LTE_REFSIG/defs.h index e9482060a7..6d52d4a5f7 100644 --- a/openair1/PHY/LTE_REFSIG/defs.h +++ b/openair1/PHY/LTE_REFSIG/defs.h @@ -54,6 +54,8 @@ void lte_gold(LTE_DL_FRAME_PARMS *frame_parms,uint32_t lte_gold_table[20][2][14] void lte_gold_ue_spec(LTE_DL_FRAME_PARMS *frame_parms,uint32_t lte_gold_uespec_table[2][20][2][21],uint16_t Nid_cell, uint16_t *n_idDMRS); +void lte_gold_ue_spec_port5(uint32_t lte_gold_uespec_port5_table[20][38],uint16_t Nid_cell, uint16_t n_rnti); + /*!\brief This function generates the LTE Gold sequence (36-211, Sec 7.2), specifically for DL UE-specific reference signals for antenna ports 7..14. @param frame_parms LTE DL Frame parameters @param lte_gold_uespec_table pointer to table where sequences are stored @@ -96,7 +98,7 @@ int lte_dl_ue_spec(PHY_VARS_eNB *phy_vars_eNB, uint8_t Ns, uint8_t lprime, uint8_t p, - int SS_flag ); + int SS_flag); /*! \brief This function generates the MBSFN reference signal sequence (36-211, Sec 6.10.1.2) @param phy_vars_eNB Pointer to eNB variables @@ -130,7 +132,9 @@ int lte_dl_ue_spec_rx(PHY_VARS_UE *phy_vars_ue, mod_sym_t *output, unsigned char Ns, unsigned char p, - int SS_flag); + int lprime, + int SS_flag, + uint16_t nRB_PDSCH); int lte_dl_mbsfn_rx(PHY_VARS_UE *phy_vars_ue, int *output, diff --git a/openair1/PHY/LTE_REFSIG/lte_dl_ue_spec.c b/openair1/PHY/LTE_REFSIG/lte_dl_ue_spec.c index 64c4e8782e..505a6e19cd 100644 --- a/openair1/PHY/LTE_REFSIG/lte_dl_ue_spec.c +++ b/openair1/PHY/LTE_REFSIG/lte_dl_ue_spec.c @@ -59,12 +59,12 @@ int lte_dl_ue_spec(PHY_VARS_eNB *phy_vars_eNB, uint8_t Ns, uint8_t lprime, uint8_t p, - int SS_flag ) + int SS_flag) { - mod_sym_t qpsk[4],nqpsk[4]; + /* mod_sym_t qpsk[4],nqpsk[4]; int16_t k=0,a; - int mprime,mprime_dword,mprime_qpsk_symb; + int mprime,ind,ind_dword,ind_qpsk_symb; unsigned nushift,kprime; // LTE_eNB_DLSCH_t *dlsch = phy_vars_eNB->dlsch_eNB[UE_id][0]; @@ -103,12 +103,13 @@ int lte_dl_ue_spec(PHY_VARS_eNB *phy_vars_eNB, k = kprime+phy_vars_eNB->lte_frame_parms.first_carrier_offset; printf("lte_dl_ue_spec:k=%d\n",k); - for (mprime=0;mprime<3*phy_vars_eNB->lte_frame_parms.N_RB_DL-1;mprime++) { - mprime_dword = mprime>>4; - mprime_qpsk_symb = mprime&0xf; + for (mprime=0;mprime<3*nRB_PDSCH-1;mprime++) { + ind = 3*lprime*nRB_PDSCH+mprime; + ind_dword = ind>>4; + ind_qpsk_symb = ind&0xf; - //output[k] = qpsk[(phy_vars_eNB->lte_gold_uespec_port5_table[0][Ns][lprime][ind_dword]>>(2*ind_qpsk_symb))&3]; - output[k] = 0xffffffff; + output[k] = qpsk[(phy_vars_UE->lte_gold_uespec_port5_table[Ns][ind_dword]>>(2*ind_qpsk_symb))&3]; + //output[k] = 0xffffffff; k += 4; if (k >= phy_vars_eNB->lte_frame_parms.ofdm_symbol_size) { @@ -125,19 +126,21 @@ int lte_dl_ue_spec(PHY_VARS_eNB *phy_vars_eNB, LOG_E(PHY,"Illegal p %d UE specific pilots\n",p); } - return(0); + return(0);*/ } int lte_dl_ue_spec_rx(PHY_VARS_UE *phy_vars_ue, - mod_sym_t *output, - unsigned char Ns, - unsigned char p, - int SS_flag) + mod_sym_t *output, + unsigned char Ns, + unsigned char p, + int lprime, + int SS_flag, + uint16_t nRB_PDSCH) { mod_sym_t qpsk[4],nqpsk[4],*qpsk_p,*output_p; int16_t a; - int w,lprime,mprime,ind,l,ind_dword,ind_qpsk_symb,nPRB; + int w,mprime,ind,l,ind_dword,ind_qpsk_symb,nPRB; short pamp; // Compute the correct pilot amplitude, sqrt_rho_b = Q3.13 @@ -169,7 +172,7 @@ int lte_dl_ue_spec_rx(PHY_VARS_UE *phy_vars_ue, output_p = output; - for (lprime=0; lprime<2; lprime++) { + //for (lprime=0; lprime<2; lprime++) { ind = 3*lprime*phy_vars_ue->lte_frame_parms.N_RB_DL; l = lprime + ((Ns&1)<<1); @@ -288,25 +291,29 @@ int lte_dl_ue_spec_rx(PHY_VARS_UE *phy_vars_ue, output_p++; ind++; } - } + // } } else { LOG_E(PHY,"Special subframe not supported for UE specific pilots yet\n"); } } } else if (p==5) { if (SS_flag==0) { - if (phy_vars_ue->lte_frame_parms.Ncp == NORMAL) { - - for (lprime=0;lprime<2;lprime++) { - ind = 3*lprime*phy_vars_ue->lte_frame_parms.N_RB_DL; - - for (mprime=0;mprime<3*phy_vars_ue->lte_frame_parms.N_RB_DL-1;mprime++) { - ind_dword = ind>>4; - ind_qpsk_symb = ind&0xf; - *output_p = qpsk_p[(phy_vars_ue->lte_gold_uespec_port5_table[Ns][lprime][ind_dword]>>(2*ind_qpsk_symb))&3]; - *output_p++; - } + output_p = output; + + if (phy_vars_ue->lte_frame_parms.Ncp == NORMAL) { + //for (lprime=0;lprime<4;lprime++) { + for (mprime=0;mprime<3*nRB_PDSCH;mprime++) { + + ind = 3*lprime*nRB_PDSCH+mprime; + ind_dword = ind>>4; + ind_qpsk_symb = ind&0xf; + + *output_p = qpsk[(phy_vars_ue->lte_gold_uespec_port5_table[Ns][ind_dword]>>(2*ind_qpsk_symb))&3]; + //printf("lprime=%d,ind=%d,Ns=%d,output_p=(%d,%d)\n",lprime,ind,Ns,((short *)&output_p[0])[0],((short *)&output_p[0])[1]); + *output_p++; + } + // } } } } else { @@ -343,44 +350,44 @@ main() lte_gold(Nid_cell,Ncp); lte_dl_ue_spec(output00, - ONE_OVER_SQRT2_Q15, - 50, - Nid_cell, - Ncp, - 0, - 0, - 0, - 0); + ONE_OVER_SQRT2_Q15, + 50, + Nid_cell, + Ncp, + 0, + 0, + 0, + 0); lte_dl_ue_spec(output10, - ONE_OVER_SQRT2_Q15, - 50, - Nid_cell, - Ncp, - 0, - 1, - 0, - 0); + ONE_OVER_SQRT2_Q15, + 50, + Nid_cell, + Ncp, + 0, + 1, + 0, + 0); lte_dl_ue_spec(output01, - ONE_OVER_SQRT2_Q15, - 50, - Nid_cell, - Ncp, - 0, - 0, - 1, - 0); + ONE_OVER_SQRT2_Q15, + 50, + Nid_cell, + Ncp, + 0, + 0, + 1, + 0); lte_dl_ue_spec(output11, - ONE_OVER_SQRT2_Q15, - 50, - Nid_cell, - Ncp, - 0, - 1, - 1, - 0); + ONE_OVER_SQRT2_Q15, + 50, + Nid_cell, + Ncp, + 0, + 1, + 1, + 0); write_output("dl_ue_spec00.m","dl_cs00",output00,1024,1,1); diff --git a/openair1/PHY/LTE_REFSIG/lte_dl_uespec.c b/openair1/PHY/LTE_REFSIG/lte_dl_uespec.c deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/openair1/PHY/LTE_REFSIG/lte_gold.c b/openair1/PHY/LTE_REFSIG/lte_gold.c index 456a2b17d1..cdf78b6844 100644 --- a/openair1/PHY/LTE_REFSIG/lte_gold.c +++ b/openair1/PHY/LTE_REFSIG/lte_gold.c @@ -142,7 +142,7 @@ void lte_gold_ue_spec(LTE_DL_FRAME_PARMS *frame_parms,uint32_t lte_gold_uespec_t } } -void lte_gold_ue_spec_port5(uint32_t lte_gold_uespec_port5_table[20][2][21],uint16_t Nid_cell, uint16_t n_rnti) +void lte_gold_ue_spec_port5(uint32_t lte_gold_uespec_port5_table[20][38],uint16_t Nid_cell, uint16_t n_rnti) { unsigned char ns,l; @@ -151,36 +151,36 @@ void lte_gold_ue_spec_port5(uint32_t lte_gold_uespec_port5_table[20][2][21],uint for (ns=0; ns<20; ns++) { - for (l=0; l<2; l++) { + //for (l=0; l<2; l++) { - x2 = ((((ns>>1)+1)*((Nid_cell<<1)+1))<<16) + n_rnti; - //x2 = frame_parms->Ncp + (Nid_cell<<1) + (1+(Nid_cell<<1))*(1 + (3*l) + (7*(1+ns))); //cinit - //n = 0 - // printf("cinit (ns %d, l %d) => %d\n",ns,l,x2); - x1 = 1+ (1<<31); - x2=x2 ^ ((x2 ^ (x2>>1) ^ (x2>>2) ^ (x2>>3))<<31); - - // skip first 50 double words (1600 bits) - //printf("n=0 : x1 %x, x2 %x\n",x1,x2); - for (n=1; n<50; n++) { - x1 = (x1>>1) ^ (x1>>4); - x1 = x1 ^ (x1<<31) ^ (x1<<28); - x2 = (x2>>1) ^ (x2>>2) ^ (x2>>3) ^ (x2>>4); - x2 = x2 ^ (x2<<31) ^ (x2<<30) ^ (x2<<29) ^ (x2<<28); - // printf("x1 : %x, x2 : %x\n",x1,x2); - } - - for (n=0; n<14; n++) { - x1 = (x1>>1) ^ (x1>>4); - x1 = x1 ^ (x1<<31) ^ (x1<<28); - x2 = (x2>>1) ^ (x2>>2) ^ (x2>>3) ^ (x2>>4); - x2 = x2 ^ (x2<<31) ^ (x2<<30) ^ (x2<<29) ^ (x2<<28); - lte_gold_uespec_port5_table[ns][l][n] = x1^x2; - // printf("n=%d : c %x\n",n,x1^x2); - } + x2 = ((((ns>>1)+1)*((Nid_cell<<1)+1))<<16) + n_rnti; + //x2 = frame_parms->Ncp + (Nid_cell<<1) + (1+(Nid_cell<<1))*(1 + (3*l) + (7*(1+ns))); //cinit + //n = 0 + // printf("cinit (ns %d, l %d) => %d\n",ns,l,x2); + x1 = 1+ (1<<31); + x2=x2 ^ ((x2 ^ (x2>>1) ^ (x2>>2) ^ (x2>>3))<<31); + // skip first 50 double words (1600 bits) + //printf("n=0 : x1 %x, x2 %x\n",x1,x2); + for (n=1; n<50; n++) { + x1 = (x1>>1) ^ (x1>>4); + x1 = x1 ^ (x1<<31) ^ (x1<<28); + x2 = (x2>>1) ^ (x2>>2) ^ (x2>>3) ^ (x2>>4); + x2 = x2 ^ (x2<<31) ^ (x2<<30) ^ (x2<<29) ^ (x2<<28); + // printf("x1 : %x, x2 : %x\n",x1,x2); } + + for (n=0; n<38; n++) { + x1 = (x1>>1) ^ (x1>>4); + x1 = x1 ^ (x1<<31) ^ (x1<<28); + x2 = (x2>>1) ^ (x2>>2) ^ (x2>>3) ^ (x2>>4); + x2 = x2 ^ (x2<<31) ^ (x2<<30) ^ (x2<<29) ^ (x2<<28); + lte_gold_uespec_port5_table[ns][n] = x1^x2; + // printf("n=%d : c %x\n",n,x1^x2); + } + + // } } } diff --git a/openair1/PHY/LTE_TRANSPORT/dlsch_demodulation.c b/openair1/PHY/LTE_TRANSPORT/dlsch_demodulation.c index 3aa3f72312..89dadbbd1c 100644 --- a/openair1/PHY/LTE_TRANSPORT/dlsch_demodulation.c +++ b/openair1/PHY/LTE_TRANSPORT/dlsch_demodulation.c @@ -246,15 +246,16 @@ int rx_pdsch(PHY_VARS_UE *phy_vars_ue, } } else if (beamforming_mode==7) { //else n_tx>1 nb_rb = dlsch_extract_rbs_TM7(lte_ue_common_vars->rxdataF, - lte_ue_common_vars->dl_ch_estimates[eNB_id], + lte_ue_pdsch_vars[eNB_id]->dl_bf_ch_estimates, lte_ue_pdsch_vars[eNB_id]->rxdataF_ext, - lte_ue_pdsch_vars[eNB_id]->dl_ch_estimates_ext, + lte_ue_pdsch_vars[eNB_id]->dl_bf_ch_estimates_ext, dlsch0_harq->rb_alloc, symbol, subframe, phy_vars_ue->high_speed_flag, frame_parms); + printf("dlsch extract: symbol %d, dl_bf_estimates_ext[0][300] %d \n",symbol, lte_ue_pdsch_vars[eNB_id]->dl_bf_ch_estimates_ext[0][300]); } else if(beamforming_mode>7) { LOG_W(PHY,"dlsch_demodulation:beamforming mode not supported yet.\n"); @@ -275,11 +276,19 @@ int rx_pdsch(PHY_VARS_UE *phy_vars_ue, nb_rb); */ if (first_symbol_flag==1) { - dlsch_channel_level(lte_ue_pdsch_vars[eNB_id]->dl_ch_estimates_ext, - frame_parms, - avg, - symbol, - nb_rb); + if (beamforming_mode==0) + dlsch_channel_level(lte_ue_pdsch_vars[eNB_id]->dl_ch_estimates_ext, + frame_parms, + avg, + symbol, + nb_rb); + else + dlsch_channel_level(lte_ue_pdsch_vars[eNB_id]->dl_bf_ch_estimates_ext, + frame_parms, + avg, + symbol, + nb_rb); + #ifdef DEBUG_PHY LOG_D(PHY,"[DLSCH] avg[0] %d\n",avg[0]); #endif @@ -329,6 +338,8 @@ int rx_pdsch(PHY_VARS_UE *phy_vars_ue, aarx = frame_parms->nb_antennas_rx; if (dlsch0_harq->mimo_modedl_ch_estimates_ext[0][300]); + printf("dlsch compensation: symbol %d, dl_estimates_ext[0][2400] %d \n",symbol, lte_ue_pdsch_vars[eNB_id]->dl_ch_estimates_ext[0][2400]); dlsch_channel_compensation(lte_ue_pdsch_vars[eNB_id]->rxdataF_ext, lte_ue_pdsch_vars[eNB_id]->dl_ch_estimates_ext, @@ -546,9 +557,11 @@ int rx_pdsch(PHY_VARS_UE *phy_vars_ue, 1); } } else if (dlsch0_harq->mimo_mode==TM7) { //TM7 + printf("dlsch compensation: symbol %d, dl_bf_estimates_ext[0][300] %d \n",symbol, *(short*)<e_ue_pdsch_vars[eNB_id]->dl_bf_ch_estimates_ext[0][300]); + printf("dlsch compensation: symbol %d, dl_bf_estimates_ext[0][2400] %d \n",symbol, lte_ue_pdsch_vars[eNB_id]->dl_bf_ch_estimates_ext[0][2400]); dlsch_channel_compensation(lte_ue_pdsch_vars[eNB_id]->rxdataF_ext, - lte_ue_pdsch_vars[eNB_id]->dl_ch_estimates_ext, + lte_ue_pdsch_vars[eNB_id]->dl_bf_ch_estimates_ext, lte_ue_pdsch_vars[eNB_id]->dl_ch_mag0, lte_ue_pdsch_vars[eNB_id]->dl_ch_magb0, lte_ue_pdsch_vars[eNB_id]->rxdataF_comp0, @@ -558,6 +571,7 @@ int rx_pdsch(PHY_VARS_UE *phy_vars_ue, first_symbol_flag, get_Qm(dlsch0_harq->mcs), nb_rb, + //9, lte_ue_pdsch_vars[eNB_id]->log2_maxh, phy_measurements); // log2_maxh+I0_shift } @@ -4209,9 +4223,9 @@ unsigned short dlsch_extract_rbs_dual(int **rxdataF, } unsigned short dlsch_extract_rbs_TM7(int **rxdataF, - int **dl_ch_estimates, + int **dl_bf_ch_estimates, int **rxdataF_ext, - int **dl_ch_estimates_ext, + int **dl_bf_ch_estimates_ext, unsigned int *rb_alloc, unsigned char symbol, unsigned char subframe, @@ -4240,7 +4254,7 @@ unsigned short dlsch_extract_rbs_TM7(int **rxdataF, uespec_pilots = 1; } - if (frame_parms->frame_type == TDD) { // TDD + if (frame_parms->frame_type == TDD) {// TDD sss_symb = nsymb-1; pss_symb = 2; } else { @@ -4257,15 +4271,17 @@ unsigned short dlsch_extract_rbs_TM7(int **rxdataF, for (aarx=0; aarxnb_antennas_rx; aarx++) { if (high_speed_flag == 1) - dl_ch0 = &dl_ch_estimates[aarx][5+(symbol*(frame_parms->ofdm_symbol_size))]; + //dl_ch0 = &dl_bf_ch_estimates[aarx][5+(symbol*(frame_parms->ofdm_symbol_size))]; + dl_ch0 = &dl_bf_ch_estimates[aarx][symbol*(frame_parms->ofdm_symbol_size)]; else - dl_ch0 = &dl_ch_estimates[aarx][5]; + //dl_ch0 = &dl_bf_ch_estimates[aarx][5]; + dl_ch0 = &dl_bf_ch_estimates[aarx][0]; - dl_ch0_ext = &dl_ch_estimates_ext[aarx][symbol*(frame_parms->N_RB_DL*12)]; + dl_ch0_ext = &dl_bf_ch_estimates_ext[aarx][symbol*(frame_parms->N_RB_DL*12)]; rxF_ext = &rxdataF_ext[aarx][symbol*(frame_parms->N_RB_DL*12)]; rxF = &rxdataF[aarx][(frame_parms->first_carrier_offset + (symbol*(frame_parms->ofdm_symbol_size)))]; - printf("symbol:%d, (symbol-1)/3:%d\n",symbol,(symbol-1)/3); + //printf("symbol:%d, (symbol-1)/3:%d\n",symbol,(symbol-1)/3); //rxF_uespec = &rxdataF_uespec_pilots[aarx][(symbol-1)/3*frame_parms->N_RB_DL*(3+frame_parms->Ncp)]; //printf("symbol, rxF_uespec offset:%d\n",symbol,(symbol-1)/3*frame_parms->N_RB_DL*(3+frame_parms->Ncp)); @@ -4291,7 +4307,7 @@ unsigned short dlsch_extract_rbs_TM7(int **rxdataF, if (rb_alloc_ind==1) { //*pmi_ext = (pmi>>((rb>>2)<<1))&3; - memcpy(dl_ch0_ext,dl_ch0,12*sizeof(int)); + //memcpy(dl_ch0_ext,dl_ch0,12*sizeof(int)); /* printf("rb %d\n",rb); @@ -4300,11 +4316,10 @@ unsigned short dlsch_extract_rbs_TM7(int **rxdataF, printf("\n"); */ if (pilots==0 && uespec_pilots==0) { + memcpy(dl_ch0_ext,dl_ch0,12*sizeof(int)); + for (i=0; i<12; i++) { rxF_ext[i]=rxF[i]; - /* - printf("%d : (%d,%d)\n",(rxF+i-&rxdataF[aarx][( (symbol*(frame_parms->ofdm_symbol_size)))]), - ((short*)&rxF[i])[0],((short*)&rxF[i])[1]);*/ } dl_ch0_ext+=12; @@ -4316,9 +4331,7 @@ unsigned short dlsch_extract_rbs_TM7(int **rxdataF, if ((i!=(frame_parms->nushift+poffset)) && (i!=((frame_parms->nushift+poffset+6)%12))) { rxF_ext[j]=rxF[i]; - // printf("extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[j],*(1+(short*)&rxF_ext[j])); dl_ch0_ext[j++]=dl_ch0[i]; - } } @@ -4432,7 +4445,7 @@ unsigned short dlsch_extract_rbs_TM7(int **rxdataF, if (rb_alloc_ind==1) { - // printf("rb %d/symbol %d (skip_half %d)\n",rb,l,skip_half); + //printf("rb %d/symbol %d pilots %d, uespec_pilots %d, (skip_half %d)\n",rb,l,pilots,uespec_pilots,skip_half); if (pilots==0 && uespec_pilots==0) { // printf("Extracting w/o pilots (symbol %d, rb %d, skip_half %d)\n",l,rb,skip_half); @@ -4493,8 +4506,9 @@ unsigned short dlsch_extract_rbs_TM7(int **rxdataF, if ((i!=(frame_parms->nushift+poffset)) && (i!=((frame_parms->nushift+poffset+6)%12))) { rxF_ext[j]=rxF[i]; - // printf("extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[j],*(1+(short*)&rxF_ext[j])); + //printf("extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[j],*(1+(short*)&rxF_ext[j])); dl_ch0_ext[j++]=dl_ch0[i]; + //printf("symbol %d, extract rb %d => (%d,%d)\n",symbol,rb,*(short *)&dl_ch0[i],*(1+(short*)&dl_ch0[i])); } } @@ -4558,6 +4572,8 @@ unsigned short dlsch_extract_rbs_TM7(int **rxdataF, if (i!=uespec_nushift+uespec_poffset && i!=uespec_nushift+uespec_poffset+4 && i!=(uespec_nushift+uespec_poffset+8)%12){ rxF_ext[j] = rxF[i]; dl_ch0_ext[j++] = dl_ch0[i]; + //printf("symbol %d, extract rb %d, re %d => (%d,%d)\n",symbol,rb,i,*(short *)&dl_ch0[j],*(1+(short*)&dl_ch0[i])); + //printf("symbol %d, extract rb %d, re %d, j %d => (%d,%d)\n",symbol,rb,i,j-1,*(short *)&dl_ch0[j],*(1+(short*)&dl_ch0[i])); } } else{ if (i!=uespec_nushift+uespec_poffset && i!=uespec_nushift+uespec_poffset+3 && i!=uespec_nushift+uespec_poffset+6 && i!=(uespec_nushift+uespec_poffset+9)%12){ @@ -4676,13 +4692,13 @@ unsigned short dlsch_extract_rbs_TM7(int **rxdataF, if (i!=uespec_nushift+uespec_poffset && i!=uespec_nushift+uespec_poffset+4 && i!=(uespec_nushift+uespec_poffset+8)%12){ 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])); + //printf("symbol %d, extract rb %d, re %d, j %d => (%d,%d)\n",symbol,rb,i,j-1,*(short *)&dl_ch0[j],*(1+(short*)&dl_ch0[i])); + //printf("extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[j-1],*(1+(short*)&rxF_ext[j-1])); } } else { if (i!=uespec_nushift+uespec_poffset && i!=uespec_nushift+uespec_poffset+3 && i!=uespec_nushift+uespec_poffset+6 && i!=(uespec_nushift+uespec_poffset+9)%12){ 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])); } } } @@ -4694,7 +4710,8 @@ unsigned short dlsch_extract_rbs_TM7(int **rxdataF, if (i!=uespec_nushift+uespec_poffset && i!=uespec_nushift+uespec_poffset+4 && i!=(uespec_nushift+uespec_poffset+8)%12){ 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])); + // printf("symbol %d, extract rb %d, re %d, j %d => (%d,%d)\n",symbol,rb,i,j-1,*(short *)&dl_ch0[j],*(1+(short*)&dl_ch0[i])); + // printf("extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[j-1],*(1+(short*)&rxF_ext[j-1])); } } else { if (i!=uespec_nushift+uespec_poffset && i!=uespec_nushift+uespec_poffset+3 && i!=uespec_nushift+uespec_poffset+6 && i!=(uespec_nushift+uespec_poffset+9)%12){ @@ -4814,6 +4831,7 @@ unsigned short dlsch_extract_rbs_TM7(int **rxdataF, } else { memcpy(dl_ch0_ext,dl_ch0,12*sizeof(int)); + //printf("symbol %d, extract rb %d, => (%d,%d)\n",symbol,rb,*(short *)&dl_ch0[j],*(1+(short*)&dl_ch0[i])); for (i=0; i<12; i++) rxF_ext[i]=rxF[i]; @@ -4854,6 +4872,7 @@ unsigned short dlsch_extract_rbs_TM7(int **rxdataF, rxF_ext[j]=rxF[i]; //printf("extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[j],*(1+(short*)&rxF_ext[j])); dl_ch0_ext[j++]=dl_ch0[i]; + //printf("symbol %d, extract rb %d => (%d,%d)\n",symbol,rb,*(short *)&dl_ch0[i],*(1+(short*)&dl_ch0[i])); } } @@ -4914,6 +4933,7 @@ unsigned short dlsch_extract_rbs_TM7(int **rxdataF, if (i!=uespec_nushift+uespec_poffset && i!=uespec_nushift+uespec_poffset+4 && i!=(uespec_nushift+uespec_poffset+8)%12){ rxF_ext[j] = rxF[i]; dl_ch0_ext[j++]=dl_ch0[i]; + // printf("symbol %d, extract rb %d, re %d, j %d => (%d,%d)\n",symbol,rb,i,j-1,*(short *)&dl_ch0[j],*(1+(short*)&dl_ch0[i])); } } else{ if (i!=uespec_nushift+uespec_poffset && i!=uespec_nushift+uespec_poffset+3 && i!=uespec_nushift+uespec_poffset+6 && i!=(uespec_nushift+uespec_poffset+9)%12){ @@ -4972,6 +4992,17 @@ void dump_dlsch2(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint16_t coded_bits_per sprintf(vname,"dl%d_ch_r%d_ext00",eNB_id,round); write_output(fname,vname,phy_vars_ue->lte_ue_pdsch_vars[eNB_id]->dl_ch_estimates_ext[0],12*N_RB_DL*nsymb,1,1); + if (phy_vars_ue->transmission_mode[eNB_id]==7){ + sprintf(fname,"dlsch%d_bf_ch_r%d.m",eNB_id,round); + sprintf(vname,"dl%d_bf_ch_r%d",eNB_id,round); + write_output(fname,vname,phy_vars_ue->lte_ue_pdsch_vars[eNB_id]->dl_bf_ch_estimates[0],512*nsymb,1,1); + //write_output(fname,vname,phy_vars_ue->lte_ue_pdsch_vars[eNB_id]->dl_bf_ch_estimates[0],512,1,1); + + sprintf(fname,"dlsch%d_bf_ch_r%d_ext00.m",eNB_id,round); + sprintf(vname,"dl%d_bf_ch_r%d_ext00",eNB_id,round); + write_output(fname,vname,phy_vars_ue->lte_ue_pdsch_vars[eNB_id]->dl_bf_ch_estimates_ext[0],12*N_RB_DL*nsymb,1,1); + } + if (phy_vars_ue->lte_frame_parms.nb_antennas_rx == 2) { sprintf(fname,"dlsch%d_ch_r%d_ext01.m",eNB_id,round); sprintf(vname,"dl%d_ch_r%d_ext01",eNB_id,round); diff --git a/openair1/PHY/LTE_TRANSPORT/dlsch_modulation.c b/openair1/PHY/LTE_TRANSPORT/dlsch_modulation.c index d14c26c13d..2d769a6ccf 100644 --- a/openair1/PHY/LTE_TRANSPORT/dlsch_modulation.c +++ b/openair1/PHY/LTE_TRANSPORT/dlsch_modulation.c @@ -71,13 +71,13 @@ uint8_t is_not_pilot(uint8_t pilots, uint8_t re, uint8_t nushift, uint8_t use2nd } //uint8_t is_not_UEspecRS(int first_layer,int re) -uint8_t is_not_UEspecRS(uint8_t lprime, uint8_t re, uint8_t nushift, uint8_t Ncp, uint8_t beamforming_mode) +uint8_t is_not_UEspecRS(int8_t lprime, uint8_t re, uint8_t nushift, uint8_t Ncp, uint8_t beamforming_mode) { - uint8_t offset = (lprime==2)?2:0; - if(lprime==0) + uint8_t offset = (lprime==1||lprime==3)?2:0; + if (lprime==-1) return(1); - switch(beamforming_mode){ + switch (beamforming_mode) { case 7: if (Ncp == NORMAL){ if ((re!=nushift+offset) && (re!=((nushift+4+offset)%12)) && (re!=((nushift+8+offset)%12))) @@ -225,7 +225,7 @@ int allocate_REs_in_RB(PHY_VARS_eNB *phy_vars_eNB, uint8_t layer; int s=1; - uint8_t mprime2 = mprime,mprime_dword,mprime_qpsk_symb; + int mprime2 = mprime,ind,ind_dword,ind_qpsk_symb; mod_sym_t qpsk[4]; gain_lin_QPSK = (int16_t)((amp*ONE_OVER_SQRT2_Q15)>>15); @@ -1022,12 +1022,13 @@ break; //printf("precoding UE spec RS\n"); for (aa=0; aa>4; - mprime_qpsk_symb = mprime2&0xf; + + ind = 3*lprime*dlsch0_harq->nb_rb+mprime2; + ind_dword = ind>>4; + ind_qpsk_symb = ind&0xf; - tmp_sample1 = qpsk[(phy_vars_eNB->lte_gold_uespec_port5_table[0][Ns][lprime][mprime_dword]>>(2*mprime_qpsk_symb))&3]; - //printf("tmp_sample1=%d+i%d\n",((int16_t*)&tmp_sample1)[0],((int16_t*)&tmp_sample1)[1]); - //printf("beamforing_weights[%d][%d]=%d+i%d\n",re,aa,((int16_t*)&beamforming_weights[re][aa])[0],((int16_t*)&beamforming_weights[re][aa])[1]); + tmp_sample1 = qpsk[(phy_vars_eNB->lte_gold_uespec_port5_table[0][Ns][ind_dword]>>(2*ind_qpsk_symb))&3]; + //printf("lprime=%d,nb_rb=%d,mprime2=%d,ind=%d,Ns=%d,tmp_sample1=(%d,%d)\n",lprime,dlsch0_harq->nb_rb,mprime2,ind,Ns,((int16_t*)&tmp_sample1)[0],((int16_t*)&tmp_sample1)[1]); ((int16_t*)&txdataF[aa][tti_offset])[0] += (int16_t)((((int16_t*)&tmp_sample1)[0]*((uint16_t*)&beamforming_weights[re][aa])[0])>>15); ((int16_t*)&txdataF[aa][tti_offset])[0] +=-(int16_t)((((int16_t*)&tmp_sample1)[1]*((uint16_t*)&beamforming_weights[re][aa])[1])>>15); @@ -1037,8 +1038,11 @@ break; // ((int16_t*)&txdataF[aa][tti_offset])[0] = 0xffff; // ((int16_t*)&txdataF[aa][tti_offset])[1] = 0xffff; + //printf("tmp_sample1=%d+i%d\n",((int16_t*)&tmp_sample1)[0],((int16_t*)&tmp_sample1)[1]); + //printf("beamforing_weights[%d][%d]=%d+i%d\n",re,aa,((int16_t*)&beamforming_weights[re][aa])[0],((int16_t*)&beamforming_weights[re][aa])[1]); + //printf("txdataF[%d][%d]= %d+i%d\n ",aa,tti_offset,((int16_t*)&txdataF[aa][tti_offset])[0],((int16_t*)&txdataF[aa][tti_offset])[1]); + mprime2 = mprime2++; - //printf("**txdataF[%d][%d]= %d+i%d\n ",aa,tti_offset,((int16_t*)&txdataF[aa][tti_offset])[0],((int16_t*)&txdataF[aa][tti_offset])[1]); } } @@ -1291,7 +1295,8 @@ int dlsch_modulation(PHY_VARS_eNB* phy_vars_eNB, MIMO_mode_t mimo_mode = dlsch0_harq->mimo_mode; uint8_t beamforming_mode = 0; int32_t **beamforming_weights_RB = beamforming_weights; - uint8_t lprime, mprime=0,Ns; + uint8_t mprime=0,Ns; + int8_t lprime=-1; #ifdef DEBUG_DLSCH_MODULATION uint8_t Nl0 = dlsch0_harq->Nl; @@ -1375,19 +1380,25 @@ int dlsch_modulation(PHY_VARS_eNB* phy_vars_eNB, beamforming_mode = 7; mprime = 0; if (frame_parms->Ncp==0) { // normal prefix - if ((l==6)||(l==12)) - lprime=2; // pilots in nushift+3, nushift+9 - else if ((l==3)||(l==9)) - lprime=1; // pilots in nushift, nushift+6 + if (l==12) + lprime=3; // pilots in nushift+3, nushift+9 + else if (l==9) + lprime=2; // pilots in nushift, nushift+6 + else if (l==6) + lprime=1; // pilots in nushift+3, nushift+9 + else if (l==3) + lprime=0; // pilots in nushift, nushift+6 else - lprime=0; + lprime=-1; } else { - if ((l==7)) + if (l==10) lprime=2; - else if ((l==4)||(l==10)) + else if (l==7) lprime=1; - else + else if (l==4) lprime=0; + else + lprime=-1; } }else if(mimo_mode==TM8){ beamforming_mode = 8; @@ -1395,10 +1406,7 @@ int dlsch_modulation(PHY_VARS_eNB* phy_vars_eNB, beamforming_mode = 9; } - if(l<=(nsymb>>2)) - Ns=0; - else - Ns=1; + Ns = 2*subframe_offset+(l>=(nsymb>>1)); re_offset = frame_parms->first_carrier_offset; symbol_offset = (uint32_t)frame_parms->ofdm_symbol_size*(l+(subframe_offset*nsymb)); @@ -1566,7 +1574,7 @@ int dlsch_modulation(PHY_VARS_eNB* phy_vars_eNB, qam_table_s1 = NULL; if (rb_alloc_ind > 0) { - // printf("Allocated rb %d/symbol %d, skip_half %d, subframe_offset %d, symbol_offset %d, re_offset %d, jj %d\n",rb,l,skip_half,subframe_offset,symbol_offset,re_offset,jj); + // printf("Allocated rb %d/symbol %d, skip_half %d, subframe_offset %d, symbol_offset %d, re_offset %d, jj %d\n",rb,l,skip_half,subframe_offset,symbol_offset,re_offset,jj); allocate_REs_in_RB(phy_vars_eNB, txdataF, &jj, @@ -1588,12 +1596,8 @@ int dlsch_modulation(PHY_VARS_eNB* phy_vars_eNB, Ns, beamforming_weights_RB); - if(mimo_mode==TM7){ - if(frame_parms->Ncp==0&&(l==3||l==6||l==9||l==12)) - mprime +=3; - else if(frame_parms->Ncp==1&&(l==4||l==7||l==10)) - mprime +=4; - } + if(mimo_mode==TM7 && lprime>=0) + mprime +=3+frame_parms->Ncp; } diff --git a/openair1/PHY/LTE_TRANSPORT/pilots_ue_spec.c b/openair1/PHY/LTE_TRANSPORT/pilots_ue_spec.c index 310204eea9..2287c44a5f 100644 --- a/openair1/PHY/LTE_TRANSPORT/pilots_ue_spec.c +++ b/openair1/PHY/LTE_TRANSPORT/pilots_ue_spec.c @@ -48,7 +48,7 @@ void generate_ue_spec_pilots(PHY_VARS_eNB *phy_vars_eNB, uint8_t beamforming_mode) { - LTE_DL_FRAME_PARMS *frame_parms = &phy_vars_eNB->lte_frame_parms; + /*LTE_DL_FRAME_PARMS *frame_parms = &phy_vars_eNB->lte_frame_parms; uint32_t tti,tti_offset,slot_offset,Nsymb,samples_per_symbol; uint8_t second_pilot,aa; @@ -123,7 +123,7 @@ void generate_ue_spec_pilots(PHY_VARS_eNB *phy_vars_eNB, default: msg("[generate_ue_spec_pilots(in uespec_pilots.c)]ERROR:beamforming mode %d is not supported\n",beamforming_mode); - } + }*/ } /*int generate_ue_spec_pilots_slot(PHY_VARS_eNB *phy_vars_eNB, diff --git a/openair1/PHY/LTE_TRANSPORT/proto.h b/openair1/PHY/LTE_TRANSPORT/proto.h index 58a1177a37..5c3db65afc 100644 --- a/openair1/PHY/LTE_TRANSPORT/proto.h +++ b/openair1/PHY/LTE_TRANSPORT/proto.h @@ -1756,6 +1756,8 @@ int is_pmch_subframe(frame_t frame, int subframe, LTE_DL_FRAME_PARMS *frame_parm uint8_t is_not_pilot(uint8_t pilots, uint8_t re, uint8_t nushift, uint8_t use2ndpilots); +uint8_t is_not_UEspecRS(int8_t lprime, uint8_t re, uint8_t nushift, uint8_t Ncp, uint8_t beamforming_mode); + uint32_t dlsch_decoding_abstraction(double *dlsch_MIPB, LTE_DL_FRAME_PARMS *lte_frame_parms, LTE_UE_DLSCH_t *dlsch, diff --git a/openair1/PHY/MODULATION/slot_fep.c b/openair1/PHY/MODULATION/slot_fep.c index 5bbea87c88..a7639d9291 100644 --- a/openair1/PHY/MODULATION/slot_fep.c +++ b/openair1/PHY/MODULATION/slot_fep.c @@ -64,6 +64,11 @@ int slot_fep(PHY_VARS_UE *phy_vars_ue, unsigned int frame_length_samples = frame_parms->samples_per_tti * 10; unsigned int rx_offset; + /*LTE_UE_DLSCH_t **dlsch_ue = phy_vars_ue->dlsch_ue[eNB_id]; + unsigned char harq_pid = dlsch_ue[0]->current_harq_pid; + LTE_DL_UE_HARQ_t *dlsch0_harq = dlsch_ue[0]->harq_processes[harq_pid]; + int uespec_pilot[9][1200];*/ + void (*dft)(int16_t *,int16_t *, int); int tmp_dft_in[256]; // This is for misalignment issues for 6 and 15 PRBs @@ -241,15 +246,18 @@ int slot_fep(PHY_VARS_UE *phy_vars_ue, } } - // printf("slot_fep:transmission_mode[%d] = %d\n", eNB_id, phy_vars_ue->transmission_mode[eNB_id]); - if(phy_vars_ue->transmission_mode[eNB_id] == 7) - if(frame_parms->Ncp==0 && (symbol==3) || (symbol==6) || (symbol==9) || (symbol==12)) - lte_dl_bf_channel_estimation(phy_vars_ue,eNB_id,0,Ns,5,symbol); - else if(frame_parms->Ncp==1 && (symbol==4) || (symbol==7) || (symbol==10)) - msg("slot_fep(slot_fep.c):channel estimation not supported yet for TM7 extented CP.\n"); - else if(phy_vars_ue->transmission_mode[eNB_id] > 7) - msg("slot_fep(slot_fep.c):transmission mode not supported yet.\n"); + if(phy_vars_ue->transmission_mode[eNB_id] == 7) { + + if(frame_parms->Ncp==0 && ((symbol==3) || (symbol==6) || (symbol==9) || (symbol==12))) + lte_dl_bf_channel_estimation(phy_vars_ue,eNB_id,0,Ns,5,symbol); + + else if(frame_parms->Ncp==1 && ((symbol==4) || (symbol==7) || (symbol==10))) + msg("slot_fep(slot_fep.c):channel estimation not supported yet for TM7 extented CP.\n"); + + } else if(phy_vars_ue->transmission_mode[eNB_id] > 7) { + msg("slot_fep(slot_fep.c):transmission mode not supported yet.\n"); + } } #ifdef DEBUG_FEP diff --git a/openair1/PHY/defs.h b/openair1/PHY/defs.h index 80c6b4ef01..7cce9d3cd1 100755 --- a/openair1/PHY/defs.h +++ b/openair1/PHY/defs.h @@ -243,7 +243,7 @@ typedef struct PHY_VARS_eNB_s { uint32_t lte_gold_table[20][2][14]; /// UE-specific reference symbols (p=5), TM 7 - uint32_t lte_gold_uespec_port5_table[NUMBER_OF_UE_MAX][20][2][21]; + uint32_t lte_gold_uespec_port5_table[NUMBER_OF_UE_MAX][20][38]; /// UE-specific reference symbols (p=7...14), TM 8/9/10 uint32_t lte_gold_uespec_table[2][20][2][21]; @@ -510,7 +510,7 @@ typedef struct { uint32_t lte_gold_table[7][20][2][14]; /// UE-specific reference symbols (p=5), TM 7 - uint32_t lte_gold_uespec_port5_table[20][2][21]; + uint32_t lte_gold_uespec_port5_table[20][38]; /// ue-specific reference symbols uint32_t lte_gold_uespec_table[2][20][2][21]; diff --git a/openair1/SIMULATION/LTE_PHY/dlsim.c b/openair1/SIMULATION/LTE_PHY/dlsim.c index 7a3b3bba1d..4d382c64ca 100644 --- a/openair1/SIMULATION/LTE_PHY/dlsim.c +++ b/openair1/SIMULATION/LTE_PHY/dlsim.c @@ -172,7 +172,6 @@ void lte_param_init(unsigned char N_tx, unsigned char N_tx_phy, unsigned char N_ phy_init_lte_ue(PHY_vars_UE,1,0); phy_init_lte_eNB(PHY_vars_eNB,0,0,0); - generate_pcfich_reg_mapping(&PHY_vars_UE->lte_frame_parms); generate_phich_reg_mapping(&PHY_vars_UE->lte_frame_parms); @@ -746,6 +745,7 @@ int main(int argc, char **argv) if (transmission_mode==7){ lte_gold_ue_spec_port5(PHY_vars_eNB->lte_gold_uespec_port5_table[0],Nid_cell,n_rnti); lte_gold_ue_spec_port5(PHY_vars_UE->lte_gold_uespec_port5_table,Nid_cell,n_rnti); + beamforming_weights = (int32_t **)malloc(12*N_RB_DL*sizeof(int32_t*)); for(re=0;re<12*N_RB_DL;re++){ beamforming_weights[re]=(int32_t *)malloc(n_tx_phy*sizeof(int32_t)); @@ -3064,10 +3064,12 @@ PMI_FEEDBACK: pilot2 = 6; pilot3 = 9; } + start_meas(&PHY_vars_UE->phy_proc_rx); // Inner receiver scheduling for 3 slots + for (Ns=(2*subframe); Ns<((2*subframe)+3); Ns++) { for (l=0; lofdm_demod_stats); - slot_fep(PHY_vars_UE, - l, - Ns%20, - 0, - 0); - stop_meas(&PHY_vars_UE->ofdm_demod_stats); + if(Ns==(2*subframe) || Ns==(2*subframe+1)) { + start_meas(&PHY_vars_UE->ofdm_demod_stats); + slot_fep(PHY_vars_UE, + l, + Ns%20, + 0, + 0); + stop_meas(&PHY_vars_UE->ofdm_demod_stats); + } //write_output("rxsigF0.m","rxsF0", &PHY_vars_UE->lte_ue_common_vars.rxdataF[0][0],PHY_vars_UE->lte_frame_parms.ofdm_symbol_size*nsymb,1,1); if (PHY_vars_UE->perfect_ce==1) { @@ -3120,6 +3123,11 @@ PMI_FEEDBACK: for (i=0; iN_RB_DL*12; i++) { ((int16_t *) PHY_vars_UE->lte_ue_common_vars.dl_ch_estimates[0][(aa<<1)+aarx])[2*i+((l+(Ns%2)*pilot2)*frame_parms->ofdm_symbol_size+LTE_CE_FILTER_LENGTH)*2]=(short)(AMP); ((int16_t *) PHY_vars_UE->lte_ue_common_vars.dl_ch_estimates[0][(aa<<1)+aarx])[2*i+1+((l+(Ns%2)*pilot2)*frame_parms->ofdm_symbol_size+LTE_CE_FILTER_LENGTH)*2]=0/2; + if (transmission_mode == 7){ + ((int16_t *) PHY_vars_UE->lte_ue_pdsch_vars[0]->dl_bf_ch_estimates[(aa<<1)+aarx])[2*i+((l+(Ns%2)*pilot2)*frame_parms->ofdm_symbol_size)*2]=(short)(AMP); + ((int16_t *) PHY_vars_UE->lte_ue_pdsch_vars[0]->dl_bf_ch_estimates[(aa<<1)+aarx])[2*i+1+((l+(Ns%2)*pilot2)*frame_parms->ofdm_symbol_size)*2]=0/2; + + } } } } From f905243047e2e302aa5367db10b88fe1e2746164 Mon Sep 17 00:00:00 2001 From: Xiwen JIANG Date: Wed, 9 Sep 2015 09:58:23 +0200 Subject: [PATCH 003/349] update beamforming channel estimation frequency interpolation filter head file --- openair1/PHY/LTE_ESTIMATION/filt12_32.h | 86 ------------------------- openair1/PHY/LTE_ESTIMATION/filt16_32.h | 86 +++++++++++++++++++++++++ 2 files changed, 86 insertions(+), 86 deletions(-) delete mode 100644 openair1/PHY/LTE_ESTIMATION/filt12_32.h create mode 100644 openair1/PHY/LTE_ESTIMATION/filt16_32.h diff --git a/openair1/PHY/LTE_ESTIMATION/filt12_32.h b/openair1/PHY/LTE_ESTIMATION/filt12_32.h deleted file mode 100644 index a5dfdb0365..0000000000 --- a/openair1/PHY/LTE_ESTIMATION/filt12_32.h +++ /dev/null @@ -1,86 +0,0 @@ -short filt12_l0[12] = { -16384,12288,8192,4096,0,0,0,0,0,0,0,0}; - -short filt12_r0[12] = { -0,0,0,0,0,4096,8192,12288,16384,20480,24576,28672}; - -short filt12_m0[12] = { -0,4096,8192,12288,16384,12288,8192,4096,0,-4096,-8192,-12288}; - -short filt12_l1[12] = { -20480,16384,12288,8192,4096,0,0,0,0,0,0,0}; - -short filt12_r1[12] = { -0,0,0,0,0,0,4096,8192,12288,16384,20480,24576}; - -short filt12_m1[12] = { --4096,0,4096,8192,12288,16384,12288,8192,4096,0,-4096,-8192}; - -short filt12_l2[12] = { -24576,20480,16384,12288,8192,4096,0,0,0,0,0,0}; - -short filt12_r2[12] = { -0,0,0,0,0,0,0,4096,8192,12288,16384,20480}; - -short filt12_m2[12] = { --8192,-4096,0,4096,8192,12288,16384,12288,8192,4096,0,-4096}; - -short filt12_l3[12] = { -28672,24576,20480,16384,12288,8192,4096,0,0,0,0,0}; - -short filt12_r3[12] = { -0,0,0,0,0,0,0,0,4096,8192,12288,16384}; - -short filt12_m3[12] = { --12288,-8192,-4096,0,4096,8192,12288,16384,12288,8192,4096,0}; - -short filt12_l0_dc[12] = { -16384,12288,8192,4096,0,0,0,0,0,0,0,0}; - -short filt12_r0_dc[12] = { -0,0,0,0,0,3276,9830,13107,16384,19660,22937,26214}; - -short filt12_m0_dc[12] = { -0,4096,8192,12288,16384,13107,6553,3276,0,-3277,-6554,-9831}; - -short filt12_l1_dc[12] = { -16384,12288,8192,4096,0,-4096,0,0,0,0,0,0}; - -short filt12_r1_dc[12] = { -0,0,0,0,0,0,6553,9830,13107,16384,19660,22937}; - -short filt12_m1_dc[12] = { --4096,0,4096,8192,12288,16384,9830,6553,3276,0,-3277,-6554}; - -short filt12_l2_dc[12] = { -26214,22937,19660,16384,13107,9830,6553,0,0,0,0,0}; - -short filt12_r2_dc[12] = { -0,0,0,0,0,0,0,4096,8192,12288,16384,20480}; - -short filt12_m2_dc[12] = { --6554,-3277,0,3276,6553,6553,16384,12288,8192,4096,0,-4096}; - -short filt12_l3_dc[12] = { -26214,22937,19660,16384,13107,9830,3276,0,0,0,0,0}; - -short filt12_r3_dc[12] = { -0,0,0,0,0,0,0,0,4096,8192,12288,16384}; - -short filt12_m3_dc[12] = { --9831,-6554,-3277,0,3276,6553,9830,16384,12288,8192,4096,0}; - -short filt12_1[12] = { -16384,16384,16384,16384,16384,16384,16384,16384,16384,16384,16384,16384}; - -short filt12_2l0[12] = { -16384,12288,8192,4096,-4096,0,0,0,0,0,0,0}; - -short filt12_2r0[12] = { -0,4096,8192,12288,16384,20480,0,0,0,0,0,0}; - -short filt12_2l1[12] = { -20480,16384,12288,8192,4096,0,0,0,0,0,0,0}; - -short filt12_2r1[12] = { --4096,0,4096,8192,12288,16384,0,0,0,0,0,0}; diff --git a/openair1/PHY/LTE_ESTIMATION/filt16_32.h b/openair1/PHY/LTE_ESTIMATION/filt16_32.h new file mode 100644 index 0000000000..3487fd3466 --- /dev/null +++ b/openair1/PHY/LTE_ESTIMATION/filt16_32.h @@ -0,0 +1,86 @@ +short filt16_l0[16] = { +16384,12288,8192,4096,0,0,0,0,0,0,0,0,0,0,0,0}; + +short filt16_r0[16] = { +0,0,0,0,0,4096,8192,12288,16384,20480,24576,28672,0,0,0,0}; + +short filt16_m0[16] = { +0,4096,8192,12288,16384,12288,8192,4096,0,-4096,-8192,-12288,0,0,0,0}; + +short filt16_l1[16] = { +20480,16384,12288,8192,4096,0,0,0,0,0,0,0,0,0,0,0}; + +short filt16_r1[16] = { +0,0,0,0,0,0,4096,8192,12288,16384,20480,24576,0,0,0,0}; + +short filt16_m1[16] = { +-4096,0,4096,8192,12288,16384,12288,8192,4096,0,-4096,-8192,0,0,0,0}; + +short filt16_l2[16] = { +24576,20480,16384,12288,8192,4096,0,0,0,0,0,0,0,0,0,0}; + +short filt16_r2[16] = { +0,0,0,0,0,0,0,4096,8192,12288,16384,20480,0,0,0,0}; + +short filt16_m2[16] = { +-8192,-4096,0,4096,8192,12288,16384,12288,8192,4096,0,-4096,0,0,0,0}; + +short filt16_l3[16] = { +28672,24576,20480,16384,12288,8192,4096,0,0,0,0,0,0,0,0,0}; + +short filt16_r3[16] = { +0,0,0,0,0,0,0,0,4096,8192,12288,16384,0,0,0,0}; + +short filt16_m3[16] = { +-12288,-8192,-4096,0,4096,8192,12288,16384,12288,8192,4096,0,0,0,0,0}; + +short filt16_l0_dc[16] = { +16384,12288,8192,4096,0,0,0,0,0,0,0,0,0,0,0,0}; + +short filt16_r0_dc[16] = { +0,0,0,0,0,3276,9830,13107,16384,19660,22937,26214,0,0,0,0}; + +short filt16_m0_dc[16] = { +0,4096,8192,12288,16384,13107,6553,3276,0,-3277,-6554,-9831,0,0,0,0}; + +short filt16_l1_dc[16] = { +16384,12288,8192,4096,0,-4096,0,0,0,0,0,0,0,0,0,0}; + +short filt16_r1_dc[16] = { +0,0,0,0,0,0,6553,9830,13107,16384,19660,22937,0,0,0,0}; + +short filt16_m1_dc[16] = { +-4096,0,4096,8192,12288,16384,9830,6553,3276,0,-3277,-6554,0,0,0,0}; + +short filt16_l2_dc[16] = { +26214,22937,19660,16384,13107,9830,6553,0,0,0,0,0,0,0,0,0}; + +short filt16_r2_dc[16] = { +0,0,0,0,0,0,0,4096,8192,12288,16384,20480,0,0,0,0}; + +short filt16_m2_dc[16] = { +-6554,-3277,0,3276,6553,6553,16384,12288,8192,4096,0,-4096,0,0,0,0}; + +short filt16_l3_dc[16] = { +26214,22937,19660,16384,13107,9830,3276,0,0,0,0,0,0,0,0,0}; + +short filt16_r3_dc[16] = { +0,0,0,0,0,0,0,0,4096,8192,12288,16384,0,0,0,0}; + +short filt16_m3_dc[16] = { +-9831,-6554,-3277,0,3276,6553,9830,16384,12288,8192,4096,0,0,0,0,0}; + +short filt16_1[16] = { +16384,16384,16384,16384,16384,16384,16384,16384,16384,16384,16384,16384}; + +short filt16_2l0[16] = { +16384,12288,8192,4096,-4096,0,0,0,0,0,0,0,0,0,0,0}; + +short filt16_2r0[16] = { +0,4096,8192,12288,16384,20480,0,0,0,0,0,0,0,0,0,0}; + +short filt16_2l1[16] = { +20480,16384,12288,8192,4096,0,0,0,0,0,0,0,0,0,0,0}; + +short filt16_2r1[16] = { +-4096,0,4096,8192,12288,16384,0,0,0,0,0,0,0,0,0,0}; From 3a5eda8cae87a53a5d4d1110d4614fb56acbdc8a Mon Sep 17 00:00:00 2001 From: Xiwen JIANG Date: Wed, 9 Sep 2015 11:37:24 +0200 Subject: [PATCH 004/349] cleanness and comments --- .../lte_dl_bf_channel_estimation.c | 23 +-- openair1/PHY/LTE_REFSIG/defs.h | 14 +- openair1/PHY/LTE_REFSIG/lte_dl_ue_spec.c | 158 +++++++++--------- openair1/PHY/LTE_REFSIG/lte_gold.c | 14 +- openair1/PHY/LTE_TRANSPORT/dlsch_coding.c | 10 +- .../PHY/LTE_TRANSPORT/dlsch_demodulation.c | 13 +- openair1/PHY/LTE_TRANSPORT/dlsch_modulation.c | 22 +-- openair1/PHY/LTE_TRANSPORT/proto.h | 21 +++ 8 files changed, 142 insertions(+), 133 deletions(-) diff --git a/openair1/PHY/LTE_ESTIMATION/lte_dl_bf_channel_estimation.c b/openair1/PHY/LTE_ESTIMATION/lte_dl_bf_channel_estimation.c index 457aaeed56..5feb1aaeda 100644 --- a/openair1/PHY/LTE_ESTIMATION/lte_dl_bf_channel_estimation.c +++ b/openair1/PHY/LTE_ESTIMATION/lte_dl_bf_channel_estimation.c @@ -46,7 +46,7 @@ int lte_dl_bf_channel_estimation(PHY_VARS_UE *phy_vars_ue, unsigned char aarx,l,lprime,nsymb,skip_half=0,sss_symb,pss_symb=0,rb_alloc_ind,harq_pid,uespec_pilots=0; int beamforming_mode, ch_offset; uint8_t subframe; - int8_t uespec_nushift, uespec_poffset=0, pil_offset; + int8_t uespec_nushift, uespec_poffset=0, pil_offset=0; uint8_t pilot0,pilot1,pilot2,pilot3; short ch[2], *pil, *rxF, *dl_bf_ch, *dl_bf_ch_prev; @@ -81,7 +81,7 @@ int lte_dl_bf_channel_estimation(PHY_VARS_UE *phy_vars_ue, subframe = Ns>>1; - if (beamforming_mode==7) { + // if (beamforming_mode==7) { //generate ue specific pilots lprime = symbol/3-1; lte_dl_ue_spec_rx(phy_vars_ue,uespec_pilot,Ns,5,lprime,0,dlsch0_harq->nb_rb); @@ -161,11 +161,12 @@ int lte_dl_bf_channel_estimation(PHY_VARS_UE *phy_vars_ue, f2r = filt16_2r1; break; } - } + // beamforming mode extension + /* } else if (beamforming_mode==0) msg("lte_dl_bf_channel_estimation:No beamforming is performed.\n"); else - msg("lte_dl_bf_channel_estimation:Beamforming mode not supported yet.\n"); + msg("lte_dl_bf_channel_estimation:Beamforming mode not supported yet.\n");*/ l=symbol; @@ -183,20 +184,22 @@ int lte_dl_bf_channel_estimation(PHY_VARS_UE *phy_vars_ue, for (aarx=0; aarxnb_antennas_rx; aarx++) { rxF = (short *)&rxdataF[aarx][pil_offset + frame_parms->first_carrier_offset + symbol*frame_parms->ofdm_symbol_size]; - pil = (short*)uespec_pilot; + pil = (short *)uespec_pilot; dl_bf_ch = (short *)&dl_bf_ch_estimates[aarx][ch_offset]; memset(dl_bf_ch,0,4*(frame_parms->ofdm_symbol_size)); //memset(dl_bf_ch,0,2*(frame_parms->ofdm_symbol_size)); - if (phy_vars_ue->high_speed_flag==0) // multiply previous channel estimate by ch_est_alpha - if (frame_parms->Ncp==0) + if (phy_vars_ue->high_speed_flag==0) { + // multiply previous channel estimate by ch_est_alpha + if (frame_parms->Ncp==0){ multadd_complex_vector_real_scalar(dl_bf_ch-(frame_parms->ofdm_symbol_size<<1), phy_vars_ue->ch_est_alpha,dl_bf_ch-(frame_parms->ofdm_symbol_size<<1), 1,frame_parms->ofdm_symbol_size); - else + } else { msg("lte_dl_bf_channel_estimation: beamforming channel estimation not supported for TM7 Extended CP.\n"); // phy_vars_ue->ch_est_beta should be defined equaling 1/3 - + } + } //estimation and interpolation if ((frame_parms->N_RB_DL&1) == 0) // even number of RBs @@ -215,7 +218,7 @@ int lte_dl_bf_channel_estimation(PHY_VARS_UE *phy_vars_ue, // For second half of RBs skip DC carrier if (rb==(frame_parms->N_RB_DL>>1)) { - rxF = &rxdataF[aarx][(1 + (symbol*(frame_parms->ofdm_symbol_size)))]; + rxF = (short *)&rxdataF[aarx][(1 + (symbol*(frame_parms->ofdm_symbol_size)))]; } if (rb_alloc_ind==1) { diff --git a/openair1/PHY/LTE_REFSIG/defs.h b/openair1/PHY/LTE_REFSIG/defs.h index 6d52d4a5f7..1ced7f52e8 100644 --- a/openair1/PHY/LTE_REFSIG/defs.h +++ b/openair1/PHY/LTE_REFSIG/defs.h @@ -91,14 +91,14 @@ int lte_dl_cell_spec(PHY_VARS_eNB *phy_vars_eNB, @param p antenna index @param SS_flag Flag to indicate special subframe */ -int lte_dl_ue_spec(PHY_VARS_eNB *phy_vars_eNB, +/*int lte_dl_ue_spec(PHY_VARS_eNB *phy_vars_eNB, uint8_t UE_id, mod_sym_t *output, short amp, uint8_t Ns, uint8_t lprime, uint8_t p, - int SS_flag); + int SS_flag);*/ /*! \brief This function generates the MBSFN reference signal sequence (36-211, Sec 6.10.1.2) @param phy_vars_eNB Pointer to eNB variables @@ -128,6 +128,16 @@ int lte_dl_cell_spec_rx(PHY_VARS_UE *phy_vars_ue, unsigned char l, unsigned char p); +/*!\brief This function generates the ue-specific reference signal + * sequence (36-211, Sec 6.10.3.1) for beamforming channel estimation upon reception +@param phy_vars_ue Pointer to UE variables +@param output Output vector for OFDM symbol (Frequency Domain) +@param Ns Slot number (0..19) +@param p antenna port intex +@param lprime symbol (0,1) +@param SS_flag Flag to indicate special subframe +@param nRB_PDSCH number of allocated PDSCH RBs +*/ int lte_dl_ue_spec_rx(PHY_VARS_UE *phy_vars_ue, mod_sym_t *output, unsigned char Ns, diff --git a/openair1/PHY/LTE_REFSIG/lte_dl_ue_spec.c b/openair1/PHY/LTE_REFSIG/lte_dl_ue_spec.c index 505a6e19cd..d029f959ed 100644 --- a/openair1/PHY/LTE_REFSIG/lte_dl_ue_spec.c +++ b/openair1/PHY/LTE_REFSIG/lte_dl_ue_spec.c @@ -52,6 +52,7 @@ int Wbar_NCP[8][4] = {{1,1,1,1},{1,-1,1,-1},{1,1,1,1},{1,-1,1,-1},{1,1,-1,-1},{-1,-1,1,1},{1,-1,-1,1},{-1,1,1,-1}}; +/* int lte_dl_ue_spec(PHY_VARS_eNB *phy_vars_eNB, uint8_t UE_id, mod_sym_t *output, @@ -62,7 +63,7 @@ int lte_dl_ue_spec(PHY_VARS_eNB *phy_vars_eNB, int SS_flag) { - /* mod_sym_t qpsk[4],nqpsk[4]; + mod_sym_t qpsk[4],nqpsk[4]; int16_t k=0,a; int mprime,ind,ind_dword,ind_qpsk_symb; unsigned nushift,kprime; @@ -126,8 +127,9 @@ int lte_dl_ue_spec(PHY_VARS_eNB *phy_vars_eNB, LOG_E(PHY,"Illegal p %d UE specific pilots\n",p); } - return(0);*/ + return(0); } +*/ int lte_dl_ue_spec_rx(PHY_VARS_UE *phy_vars_ue, @@ -139,7 +141,6 @@ int lte_dl_ue_spec_rx(PHY_VARS_UE *phy_vars_ue, uint16_t nRB_PDSCH) { mod_sym_t qpsk[4],nqpsk[4],*qpsk_p,*output_p; - int16_t a; int w,mprime,ind,l,ind_dword,ind_qpsk_symb,nPRB; short pamp; @@ -172,126 +173,123 @@ int lte_dl_ue_spec_rx(PHY_VARS_UE *phy_vars_ue, output_p = output; - //for (lprime=0; lprime<2; lprime++) { + ind = 3*lprime*phy_vars_ue->lte_frame_parms.N_RB_DL; + l = lprime + ((Ns&1)<<1); - ind = 3*lprime*phy_vars_ue->lte_frame_parms.N_RB_DL; - l = lprime + ((Ns&1)<<1); + // loop over pairs of PRBs, this is the periodicity of the W_bar_NCP sequence + // unroll the computations for the 6 pilots, select qpsk or nqpsk as function of W_bar_NCP + for (nPRB=0; nPRBlte_frame_parms.N_RB_DL; nPRB+=2) { - // loop over pairs of PRBs, this is the periodicity of the W_bar_NCP sequence - // unroll the computations for the 6 pilots, select qpsk or nqpsk as function of W_bar_NCP - for (nPRB=0; nPRBlte_frame_parms.N_RB_DL; nPRB+=2) { - - // First pilot - w = Wbar_NCP[p-7][l]; - qpsk_p = (w==1) ? qpsk : nqpsk; + // First pilot + w = Wbar_NCP[p-7][l]; + qpsk_p = (w==1) ? qpsk : nqpsk; - ind_dword = ind>>4; - ind_qpsk_symb = ind&0xf; + ind_dword = ind>>4; + ind_qpsk_symb = ind&0xf; - *output_p = qpsk_p[(phy_vars_ue->lte_gold_uespec_table[0][Ns][lprime][ind_dword]>>(2*ind_qpsk_symb))&3]; + *output_p = qpsk_p[(phy_vars_ue->lte_gold_uespec_table[0][Ns][lprime][ind_dword]>>(2*ind_qpsk_symb))&3]; #ifdef DEBUG_DL_UESPEC - LOG_D(PHY,"Ns %d, l %d, m %d,ind_dword %d, ind_qpsk_symbol %d\n", - Ns,l,m,ind_dword,ind_qpsk_symb); - LOG_D(PHY,"index = %d\n",(phy_vars_eNB->lte_gold_uespec_table[0][Ns][lprime][ind_dword]>>(2*ind_qpsk_symb))&3); + LOG_D(PHY,"Ns %d, l %d, m %d,ind_dword %d, ind_qpsk_symbol %d\n", + Ns,l,m,ind_dword,ind_qpsk_symb); + LOG_D(PHY,"index = %d\n",(phy_vars_eNB->lte_gold_uespec_table[0][Ns][lprime][ind_dword]>>(2*ind_qpsk_symb))&3); #endif - output_p++; - ind++; + output_p++; + ind++; - w = Wbar_NCP[p-7][3-l]; - qpsk_p = (w==1) ? qpsk : nqpsk; + w = Wbar_NCP[p-7][3-l]; + qpsk_p = (w==1) ? qpsk : nqpsk; - // Second pilot - ind_dword = ind>>4; - ind_qpsk_symb = ind&0xf; + // Second pilot + ind_dword = ind>>4; + ind_qpsk_symb = ind&0xf; - *output_p = qpsk_p[(phy_vars_ue->lte_gold_uespec_table[0][Ns][lprime][ind_dword]>>(2*ind_qpsk_symb))&3]; + *output_p = qpsk_p[(phy_vars_ue->lte_gold_uespec_table[0][Ns][lprime][ind_dword]>>(2*ind_qpsk_symb))&3]; #ifdef DEBUG_DL_UESPEC - LOG_D(PHY,"Ns %d, l %d, m %d,ind_dword %d, ind_qpsk_symbol %d\n", - Ns,l,m,ind_dword,ind_qpsk_symb); - LOG_D(PHY,"index = %d\n",(phy_vars_ue->lte_gold_uespec_table[0][Ns][lprime][ind_dword]>>(2*ind_qpsk_symb))&3); + LOG_D(PHY,"Ns %d, l %d, m %d,ind_dword %d, ind_qpsk_symbol %d\n", + Ns,l,m,ind_dword,ind_qpsk_symb); + LOG_D(PHY,"index = %d\n",(phy_vars_ue->lte_gold_uespec_table[0][Ns][lprime][ind_dword]>>(2*ind_qpsk_symb))&3); #endif - output_p++; - ind++; + output_p++; + ind++; - w = Wbar_NCP[p-7][l]; - qpsk_p = (w==1) ? qpsk : nqpsk; - // Third pilot - ind_dword = ind>>4; - ind_qpsk_symb = ind&0xf; + w = Wbar_NCP[p-7][l]; + qpsk_p = (w==1) ? qpsk : nqpsk; + // Third pilot + ind_dword = ind>>4; + ind_qpsk_symb = ind&0xf; - *output_p = qpsk_p[(phy_vars_ue->lte_gold_uespec_table[0][Ns][lprime][ind_dword]>>(2*ind_qpsk_symb))&3]; + *output_p = qpsk_p[(phy_vars_ue->lte_gold_uespec_table[0][Ns][lprime][ind_dword]>>(2*ind_qpsk_symb))&3]; #ifdef DEBUG_DL_UESPEC - LOG_D(PHY,"Ns %d, l %d, m %d,ind_dword %d, ind_qpsk_symbol %d\n", - Ns,l,m,ind_dword,ind_qpsk_symb); - LOG_D(PHY,"index = %d\n",(phy_vars_eNB->lte_gold_uespec_table[0][Ns][lprime][ind_dword]>>(2*ind_qpsk_symb))&3); + LOG_D(PHY,"Ns %d, l %d, m %d,ind_dword %d, ind_qpsk_symbol %d\n", + Ns,l,m,ind_dword,ind_qpsk_symb); + LOG_D(PHY,"index = %d\n",(phy_vars_eNB->lte_gold_uespec_table[0][Ns][lprime][ind_dword]>>(2*ind_qpsk_symb))&3); #endif - output_p++; - ind++; + output_p++; + ind++; - // Fourth pilot - w = Wbar_NCP[p-7][3-l]; - qpsk_p = (w==1) ? qpsk : nqpsk; + // Fourth pilot + w = Wbar_NCP[p-7][3-l]; + qpsk_p = (w==1) ? qpsk : nqpsk; - ind_dword = ind>>4; - ind_qpsk_symb = ind&0xf; + ind_dword = ind>>4; + ind_qpsk_symb = ind&0xf; - *output_p = qpsk_p[(phy_vars_ue->lte_gold_uespec_table[0][Ns][lprime][ind_dword]>>(2*ind_qpsk_symb))&3]; + *output_p = qpsk_p[(phy_vars_ue->lte_gold_uespec_table[0][Ns][lprime][ind_dword]>>(2*ind_qpsk_symb))&3]; #ifdef DEBUG_DL_UESPEC - LOG_D(PHY,"Ns %d, l %d, m %d,ind_dword %d, ind_qpsk_symbol %d\n", - Ns,l,m,ind_dword,ind_qpsk_symb); - LOG_D(PHY,"index = %d\n",(phy_vars_ue->lte_gold_uespec_table[0][Ns][lprime][ind_dword]>>(2*ind_qpsk_symb))&3); + LOG_D(PHY,"Ns %d, l %d, m %d,ind_dword %d, ind_qpsk_symbol %d\n", + Ns,l,m,ind_dword,ind_qpsk_symb); + LOG_D(PHY,"index = %d\n",(phy_vars_ue->lte_gold_uespec_table[0][Ns][lprime][ind_dword]>>(2*ind_qpsk_symb))&3); #endif - output_p++; - ind++; + output_p++; + ind++; - w = Wbar_NCP[p-7][l]; - qpsk_p = (w==1) ? qpsk : nqpsk; + w = Wbar_NCP[p-7][l]; + qpsk_p = (w==1) ? qpsk : nqpsk; - // Fifth pilot - ind_dword = ind>>4; - ind_qpsk_symb = ind&0xf; + // Fifth pilot + ind_dword = ind>>4; + ind_qpsk_symb = ind&0xf; - *output_p = qpsk_p[(phy_vars_ue->lte_gold_uespec_table[0][Ns][lprime][ind_dword]>>(2*ind_qpsk_symb))&3]; + *output_p = qpsk_p[(phy_vars_ue->lte_gold_uespec_table[0][Ns][lprime][ind_dword]>>(2*ind_qpsk_symb))&3]; #ifdef DEBUG_DL_UESPEC - LOG_D(PHY,"Ns %d, l %d, m %d,ind_dword %d, ind_qpsk_symbol %d\n", - Ns,l,m,ind_dword,ind_qpsk_symb); - LOG_D(PHY,"index = %d\n",(phy_vars_ue->lte_gold_uespec_table[0][Ns][lprime][ind_dword]>>(2*ind_qpsk_symb))&3); + LOG_D(PHY,"Ns %d, l %d, m %d,ind_dword %d, ind_qpsk_symbol %d\n", + Ns,l,m,ind_dword,ind_qpsk_symb); + LOG_D(PHY,"index = %d\n",(phy_vars_ue->lte_gold_uespec_table[0][Ns][lprime][ind_dword]>>(2*ind_qpsk_symb))&3); #endif - output_p++; - ind++; + output_p++; + ind++; - w = Wbar_NCP[p-7][3-l]; - qpsk_p = (w==1) ? qpsk : nqpsk; - // Sixth pilot - ind_dword = ind>>4; - ind_qpsk_symb = ind&0xf; + w = Wbar_NCP[p-7][3-l]; + qpsk_p = (w==1) ? qpsk : nqpsk; + // Sixth pilot + ind_dword = ind>>4; + ind_qpsk_symb = ind&0xf; - *output_p = qpsk_p[(phy_vars_ue->lte_gold_uespec_table[0][Ns][lprime][ind_dword]>>(2*ind_qpsk_symb))&3]; + *output_p = qpsk_p[(phy_vars_ue->lte_gold_uespec_table[0][Ns][lprime][ind_dword]>>(2*ind_qpsk_symb))&3]; #ifdef DEBUG_DL_UESPEC - LOG_D(PHY,"Ns %d, l %d, m %d,ind_dword %d, ind_qpsk_symbol %d\n", - Ns,l,m,ind_dword,ind_qpsk_symb); - LOG_D(PHY,"index = %d\n",(phy_vars_ue->lte_gold_uespec_table[0][Ns][lprime][ind_dword]>>(2*ind_qpsk_symb))&3); + LOG_D(PHY,"Ns %d, l %d, m %d,ind_dword %d, ind_qpsk_symbol %d\n", + Ns,l,m,ind_dword,ind_qpsk_symb); + LOG_D(PHY,"index = %d\n",(phy_vars_ue->lte_gold_uespec_table[0][Ns][lprime][ind_dword]>>(2*ind_qpsk_symb))&3); #endif - output_p++; - ind++; - } - // } + output_p++; + ind++; + } } else { LOG_E(PHY,"Special subframe not supported for UE specific pilots yet\n"); } @@ -301,7 +299,6 @@ int lte_dl_ue_spec_rx(PHY_VARS_UE *phy_vars_ue, output_p = output; if (phy_vars_ue->lte_frame_parms.Ncp == NORMAL) { - //for (lprime=0;lprime<4;lprime++) { for (mprime=0;mprime<3*nRB_PDSCH;mprime++) { ind = 3*lprime*nRB_PDSCH+mprime; @@ -310,10 +307,9 @@ int lte_dl_ue_spec_rx(PHY_VARS_UE *phy_vars_ue, *output_p = qpsk[(phy_vars_ue->lte_gold_uespec_port5_table[Ns][ind_dword]>>(2*ind_qpsk_symb))&3]; //printf("lprime=%d,ind=%d,Ns=%d,output_p=(%d,%d)\n",lprime,ind,Ns,((short *)&output_p[0])[0],((short *)&output_p[0])[1]); - *output_p++; + output_p++; } - // } } } } else { diff --git a/openair1/PHY/LTE_REFSIG/lte_gold.c b/openair1/PHY/LTE_REFSIG/lte_gold.c index cdf78b6844..5861e314ff 100644 --- a/openair1/PHY/LTE_REFSIG/lte_gold.c +++ b/openair1/PHY/LTE_REFSIG/lte_gold.c @@ -145,30 +145,27 @@ void lte_gold_ue_spec(LTE_DL_FRAME_PARMS *frame_parms,uint32_t lte_gold_uespec_t void lte_gold_ue_spec_port5(uint32_t lte_gold_uespec_port5_table[20][38],uint16_t Nid_cell, uint16_t n_rnti) { - unsigned char ns,l; + unsigned char ns; unsigned int n,x1,x2; for (ns=0; ns<20; ns++) { - //for (l=0; l<2; l++) { - - x2 = ((((ns>>1)+1)*((Nid_cell<<1)+1))<<16) + n_rnti; //x2 = frame_parms->Ncp + (Nid_cell<<1) + (1+(Nid_cell<<1))*(1 + (3*l) + (7*(1+ns))); //cinit //n = 0 - // printf("cinit (ns %d, l %d) => %d\n",ns,l,x2); + //printf("cinit (ns %d, l %d) => %d\n",ns,l,x2); x1 = 1+ (1<<31); x2=x2 ^ ((x2 ^ (x2>>1) ^ (x2>>2) ^ (x2>>3))<<31); - // skip first 50 double words (1600 bits) + //skip first 50 double words (1600 bits) //printf("n=0 : x1 %x, x2 %x\n",x1,x2); for (n=1; n<50; n++) { x1 = (x1>>1) ^ (x1>>4); x1 = x1 ^ (x1<<31) ^ (x1<<28); x2 = (x2>>1) ^ (x2>>2) ^ (x2>>3) ^ (x2>>4); x2 = x2 ^ (x2<<31) ^ (x2<<30) ^ (x2<<29) ^ (x2<<28); - // printf("x1 : %x, x2 : %x\n",x1,x2); + //printf("x1 : %x, x2 : %x\n",x1,x2); } for (n=0; n<38; n++) { @@ -177,10 +174,9 @@ void lte_gold_ue_spec_port5(uint32_t lte_gold_uespec_port5_table[20][38],uint16_ x2 = (x2>>1) ^ (x2>>2) ^ (x2>>3) ^ (x2>>4); x2 = x2 ^ (x2<<31) ^ (x2<<30) ^ (x2<<29) ^ (x2<<28); lte_gold_uespec_port5_table[ns][n] = x1^x2; - // printf("n=%d : c %x\n",n,x1^x2); + //printf("n=%d : c %x\n",n,x1^x2); } - // } } } diff --git a/openair1/PHY/LTE_TRANSPORT/dlsch_coding.c b/openair1/PHY/LTE_TRANSPORT/dlsch_coding.c index db95c2362c..a13f6a100e 100644 --- a/openair1/PHY/LTE_TRANSPORT/dlsch_coding.c +++ b/openair1/PHY/LTE_TRANSPORT/dlsch_coding.c @@ -259,7 +259,7 @@ int dlsch_encoding(unsigned char *a, unsigned char mod_order; unsigned int Kr=0,Kr_bytes,r,r_offset=0; unsigned short m=dlsch->harq_processes[harq_pid]->mcs; - uint8_t transmission_mode_7to9=0; + uint8_t beamforming_mode=0; VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_ENCODING, VCD_FUNCTION_IN); @@ -268,12 +268,12 @@ int dlsch_encoding(unsigned char *a, mod_order = get_Qm(dlsch->harq_processes[harq_pid]->mcs); if(dlsch->harq_processes[harq_pid]->mimo_mode == TM7) - transmission_mode_7to9 = 7; + beamforming_mode = 7; else if(dlsch->harq_processes[harq_pid]->mimo_mode == TM8) - transmission_mode_7to9 = 8; + beamforming_mode = 8; else if(dlsch->harq_processes[harq_pid]->mimo_mode == TM9_10) - transmission_mode_7to9 = 9; - G = get_G(frame_parms,nb_rb,dlsch->harq_processes[harq_pid]->rb_alloc,mod_order,dlsch->harq_processes[harq_pid]->Nl,num_pdcch_symbols,frame,subframe,transmission_mode_7to9); + beamforming_mode = 9; + G = get_G(frame_parms,nb_rb,dlsch->harq_processes[harq_pid]->rb_alloc,mod_order,dlsch->harq_processes[harq_pid]->Nl,num_pdcch_symbols,frame,subframe,beamforming_mode); // if (dlsch->harq_processes[harq_pid]->Ndi == 1) { // this is a new packet diff --git a/openair1/PHY/LTE_TRANSPORT/dlsch_demodulation.c b/openair1/PHY/LTE_TRANSPORT/dlsch_demodulation.c index 89dadbbd1c..c822543477 100644 --- a/openair1/PHY/LTE_TRANSPORT/dlsch_demodulation.c +++ b/openair1/PHY/LTE_TRANSPORT/dlsch_demodulation.c @@ -338,8 +338,6 @@ int rx_pdsch(PHY_VARS_UE *phy_vars_ue, aarx = frame_parms->nb_antennas_rx; if (dlsch0_harq->mimo_modedl_ch_estimates_ext[0][300]); - printf("dlsch compensation: symbol %d, dl_estimates_ext[0][2400] %d \n",symbol, lte_ue_pdsch_vars[eNB_id]->dl_ch_estimates_ext[0][2400]); dlsch_channel_compensation(lte_ue_pdsch_vars[eNB_id]->rxdataF_ext, lte_ue_pdsch_vars[eNB_id]->dl_ch_estimates_ext, @@ -557,8 +555,6 @@ int rx_pdsch(PHY_VARS_UE *phy_vars_ue, 1); } } else if (dlsch0_harq->mimo_mode==TM7) { //TM7 - printf("dlsch compensation: symbol %d, dl_bf_estimates_ext[0][300] %d \n",symbol, *(short*)<e_ue_pdsch_vars[eNB_id]->dl_bf_ch_estimates_ext[0][300]); - printf("dlsch compensation: symbol %d, dl_bf_estimates_ext[0][2400] %d \n",symbol, lte_ue_pdsch_vars[eNB_id]->dl_bf_ch_estimates_ext[0][2400]); dlsch_channel_compensation(lte_ue_pdsch_vars[eNB_id]->rxdataF_ext, lte_ue_pdsch_vars[eNB_id]->dl_bf_ch_estimates_ext, @@ -4236,9 +4232,9 @@ unsigned short dlsch_extract_rbs_TM7(int **rxdataF, unsigned short rb,nb_rb=0; unsigned char rb_alloc_ind; unsigned char i,aarx,l,nsymb,skip_half=0,sss_symb,pss_symb=0; - int *dl_ch0,*dl_ch0_ext,*rxF,*rxF_ext,*rxF_uespec; + int *dl_ch0,*dl_ch0_ext,*rxF,*rxF_ext; - unsigned char symbol_mod,pilots=0,uespec_pilots=0,j=0,k=0,poffset=0,uespec_poffset=0; + unsigned char symbol_mod,pilots=0,uespec_pilots=0,j=0,poffset=0,uespec_poffset=0; int8_t uespec_nushift = frame_parms->Nid_cell%3; symbol_mod = (symbol>=(7-frame_parms->Ncp)) ? symbol-(7-frame_parms->Ncp) : symbol; @@ -4340,7 +4336,7 @@ unsigned short dlsch_extract_rbs_TM7(int **rxdataF, } else if (pilots==0 && uespec_pilots==1) { j=0; - k=0; + for (i=0; i<12; i++){ if (frame_parms->Ncp==0){ @@ -4519,7 +4515,6 @@ unsigned short dlsch_extract_rbs_TM7(int **rxdataF, } else if(pilots==0 && uespec_pilots==1){ //printf("Extracting with uespec pilots (symbol %d, rb %d, skip_half %d)\n",l,rb,skip_half); j=0; - k=0; if (skip_half==1) { if (frame_parms->Ncp==0){ @@ -4685,7 +4680,6 @@ unsigned short dlsch_extract_rbs_TM7(int **rxdataF, rxF_ext+=10; } else if(pilots==0 && uespec_pilots==1) { j=0; - k=0; for (i=0; i<6; i++) { if (frame_parms->Ncp==0){ @@ -4881,7 +4875,6 @@ unsigned short dlsch_extract_rbs_TM7(int **rxdataF, } } else if(pilots==0 && uespec_pilots==1) { j=0; - k=0; if (skip_half==1) { if (frame_parms->Ncp==0){ diff --git a/openair1/PHY/LTE_TRANSPORT/dlsch_modulation.c b/openair1/PHY/LTE_TRANSPORT/dlsch_modulation.c index 2d769a6ccf..5366efcc12 100644 --- a/openair1/PHY/LTE_TRANSPORT/dlsch_modulation.c +++ b/openair1/PHY/LTE_TRANSPORT/dlsch_modulation.c @@ -916,15 +916,12 @@ break; ((int16_t*)&tmp_sample1)[1] = (x0[*jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK; *jj = *jj + 1; - //printf("%d(%d) : %d,%d => ",tti_offset,*jj,((int16_t*)&txdataF[0][tti_offset])[0],((int16_t*)&txdataF[0][tti_offset])[1]); //printf("%d(%d) : %d,%d => ",tti_offset,*jj,((int16_t*)&tmp_sample1)[0],((int16_t*)&tmp_sample1)[1]); for (aa=0; aa>15); ((int16_t*)&txdataF[aa][tti_offset])[0] +=-(int16_t)((((int16_t*)&tmp_sample1)[1]*((uint16_t*)&beamforming_weights[re][aa])[1])>>15); ((int16_t*)&txdataF[aa][tti_offset])[1] += (int16_t)((((int16_t*)&tmp_sample1)[0]*((uint16_t*)&beamforming_weights[re][aa])[1])>>15); ((int16_t*)&txdataF[aa][tti_offset])[1] += (int16_t)((((int16_t*)&tmp_sample1)[1]*((uint16_t*)&beamforming_weights[re][aa])[0])>>15); - /* ((int16_t*)&txdataF[aa][tti_offset])[0] = ((int16_t*)&tmp_sample1)[0]; - ((int16_t*)&txdataF[aa][tti_offset])[1] = ((int16_t*)&tmp_sample1)[1]; */ } //printf("%d,%d\n",((int16_t*)&txdataF[0][tti_offset])[0],((int16_t*)&txdataF[0][tti_offset])[1]); @@ -1028,7 +1025,6 @@ break; ind_qpsk_symb = ind&0xf; tmp_sample1 = qpsk[(phy_vars_eNB->lte_gold_uespec_port5_table[0][Ns][ind_dword]>>(2*ind_qpsk_symb))&3]; - //printf("lprime=%d,nb_rb=%d,mprime2=%d,ind=%d,Ns=%d,tmp_sample1=(%d,%d)\n",lprime,dlsch0_harq->nb_rb,mprime2,ind,Ns,((int16_t*)&tmp_sample1)[0],((int16_t*)&tmp_sample1)[1]); ((int16_t*)&txdataF[aa][tti_offset])[0] += (int16_t)((((int16_t*)&tmp_sample1)[0]*((uint16_t*)&beamforming_weights[re][aa])[0])>>15); ((int16_t*)&txdataF[aa][tti_offset])[0] +=-(int16_t)((((int16_t*)&tmp_sample1)[1]*((uint16_t*)&beamforming_weights[re][aa])[1])>>15); @@ -1037,12 +1033,12 @@ break; // ((int16_t*)&txdataF[aa][tti_offset])[0] = 0xffff; // ((int16_t*)&txdataF[aa][tti_offset])[1] = 0xffff; + //printf("lprime=%d,nb_rb=%d,mprime2=%d,ind=%d,Ns=%d\n",lprime,dlsch0_harq->nb_rb,mprime2,ind,Ns); + //printf("tmp_sample1=(%d,%d)\n",((int16_t*)&tmp_sample1)[0],((int16_t*)&tmp_sample1)[1]); + //printf("beamforing_weights[%d][%d]=(%d,%d)\n",re,aa,((int16_t*)&beamforming_weights[re][aa])[0],((int16_t*)&beamforming_weights[re][aa])[1]); + //printf("txdataF[%d][%d]= (%d,%d)\n ",aa,tti_offset,((int16_t*)&txdataF[aa][tti_offset])[0],((int16_t*)&txdataF[aa][tti_offset])[1]); - //printf("tmp_sample1=%d+i%d\n",((int16_t*)&tmp_sample1)[0],((int16_t*)&tmp_sample1)[1]); - //printf("beamforing_weights[%d][%d]=%d+i%d\n",re,aa,((int16_t*)&beamforming_weights[re][aa])[0],((int16_t*)&beamforming_weights[re][aa])[1]); - //printf("txdataF[%d][%d]= %d+i%d\n ",aa,tti_offset,((int16_t*)&txdataF[aa][tti_offset])[0],((int16_t*)&txdataF[aa][tti_offset])[1]); - - mprime2 = mprime2++; + mprime2++; } } @@ -1284,7 +1280,7 @@ int dlsch_modulation(PHY_VARS_eNB* phy_vars_eNB, uint16_t l,rb,re_offset; uint32_t rb_alloc_ind; uint32_t *rb_alloc = dlsch0_harq->rb_alloc; - uint8_t pilots=0,ue_spec_rs=0; + uint8_t pilots=0; uint8_t skip_dc,skip_half; uint8_t mod_order0 = get_Qm(dlsch0_harq->mcs); uint8_t mod_order1 = 0; @@ -1293,7 +1289,6 @@ int dlsch_modulation(PHY_VARS_eNB* phy_vars_eNB, int16_t qam16_table_a1[4],qam64_table_a1[8],qam16_table_b1[4],qam64_table_b1[8]; int16_t *qam_table_s0,*qam_table_s1; MIMO_mode_t mimo_mode = dlsch0_harq->mimo_mode; - uint8_t beamforming_mode = 0; int32_t **beamforming_weights_RB = beamforming_weights; uint8_t mprime=0,Ns; int8_t lprime=-1; @@ -1377,7 +1372,6 @@ int dlsch_modulation(PHY_VARS_eNB* phy_vars_eNB, } if(mimo_mode==TM7){ //36.211 V8.6.0 2009-03 - beamforming_mode = 7; mprime = 0; if (frame_parms->Ncp==0) { // normal prefix if (l==12) @@ -1400,10 +1394,6 @@ int dlsch_modulation(PHY_VARS_eNB* phy_vars_eNB, else lprime=-1; } - }else if(mimo_mode==TM8){ - beamforming_mode = 8; - }else if(mimo_mode==TM9_10){ - beamforming_mode = 9; } Ns = 2*subframe_offset+(l>=(nsymb>>1)); diff --git a/openair1/PHY/LTE_TRANSPORT/proto.h b/openair1/PHY/LTE_TRANSPORT/proto.h index 5c3db65afc..af67b54a96 100644 --- a/openair1/PHY/LTE_TRANSPORT/proto.h +++ b/openair1/PHY/LTE_TRANSPORT/proto.h @@ -921,6 +921,27 @@ uint16_t dlsch_extract_rbs_dual(int32_t **rxdataF, uint32_t high_speed_flag, LTE_DL_FRAME_PARMS *frame_parms); +/** \fn dlsch_extract_rbs_TM7(int32_t **rxdataF, + int32_t **dl_bf_ch_estimates, + int32_t **rxdataF_ext, + int32_t **dl_bf_ch_estimates_ext, + uint32_t *rb_alloc, + uint8_t symbol, + uint8_t subframe, + uint32_t high_speed_flag, + LTE_DL_FRAME_PARMS *frame_parms) + \brief This function extracts the received resource blocks, both channel estimates and data symbols, + for the current allocation and for single antenna eNB transmission. + @param rxdataF Raw FFT output of received signal + @param dl_bf_ch_estimates Beamforming channel estimates of current slot + @param rxdataF_ext FFT output for RBs in this allocation + @param dl_bf_ch_estimates_ext Beamforming channel estimates for RBs in this allocation + @param rb_alloc RB allocation vector + @param symbol Symbol to extract + @param subframe Subframe number + @param high_speed_flag + @param frame_parms Pointer to frame descriptor +*/ uint16_t dlsch_extract_rbs_TM7(int32_t **rxdataF, int32_t **dl_bf_ch_estimates, int32_t **rxdataF_ext, From 70e1e0cecfbfcbfd94204b1b186198d9cb76262a Mon Sep 17 00:00:00 2001 From: Xiwen JIANG Date: Wed, 9 Sep 2015 11:57:44 +0200 Subject: [PATCH 005/349] more cleanness --- openair1/PHY/LTE_TRANSPORT/dlsch_demodulation.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/openair1/PHY/LTE_TRANSPORT/dlsch_demodulation.c b/openair1/PHY/LTE_TRANSPORT/dlsch_demodulation.c index c822543477..fdc1ae846c 100644 --- a/openair1/PHY/LTE_TRANSPORT/dlsch_demodulation.c +++ b/openair1/PHY/LTE_TRANSPORT/dlsch_demodulation.c @@ -255,8 +255,6 @@ int rx_pdsch(PHY_VARS_UE *phy_vars_ue, phy_vars_ue->high_speed_flag, frame_parms); - printf("dlsch extract: symbol %d, dl_bf_estimates_ext[0][300] %d \n",symbol, lte_ue_pdsch_vars[eNB_id]->dl_bf_ch_estimates_ext[0][300]); - } else if(beamforming_mode>7) { LOG_W(PHY,"dlsch_demodulation:beamforming mode not supported yet.\n"); } @@ -4278,7 +4276,6 @@ unsigned short dlsch_extract_rbs_TM7(int **rxdataF, rxF_ext = &rxdataF_ext[aarx][symbol*(frame_parms->N_RB_DL*12)]; rxF = &rxdataF[aarx][(frame_parms->first_carrier_offset + (symbol*(frame_parms->ofdm_symbol_size)))]; //printf("symbol:%d, (symbol-1)/3:%d\n",symbol,(symbol-1)/3); - //rxF_uespec = &rxdataF_uespec_pilots[aarx][(symbol-1)/3*frame_parms->N_RB_DL*(3+frame_parms->Ncp)]; //printf("symbol, rxF_uespec offset:%d\n",symbol,(symbol-1)/3*frame_parms->N_RB_DL*(3+frame_parms->Ncp)); if ((frame_parms->N_RB_DL&1) == 0) // even number of RBs @@ -4662,7 +4659,6 @@ unsigned short dlsch_extract_rbs_TM7(int **rxdataF, if (i!=((frame_parms->nushift+poffset)%6)) { 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])); } } From aca66630ffc8681c2ddb8f9ab7c95cab76eb0385 Mon Sep 17 00:00:00 2001 From: Xiwen JIANG Date: Wed, 23 Sep 2015 16:33:18 +0200 Subject: [PATCH 006/349] pass physical antenna number as an dlsim option --- openair1/SIMULATION/LTE_PHY/dlsim.c | 30 +++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/openair1/SIMULATION/LTE_PHY/dlsim.c b/openair1/SIMULATION/LTE_PHY/dlsim.c index 4d382c64ca..624fae921e 100644 --- a/openair1/SIMULATION/LTE_PHY/dlsim.c +++ b/openair1/SIMULATION/LTE_PHY/dlsim.c @@ -374,7 +374,7 @@ int main(int argc, char **argv) num_layers = 1; perfect_ce = 0; - while ((c = getopt (argc, argv, "ahdpZDe:m:n:o:s:f:t:c:g:r:F:x:y:z:AM:N:I:i:O:R:S:C:T:b:u:v:w:B:PLl:Y")) != -1) { + while ((c = getopt (argc, argv, "ahdpZDe:m:n:o:s:f:t:c:g:r:F:x:y:q:z:AM:N:I:i:O:R:S:C:T:b:u:v:w:B:PLl:Y")) != -1) { switch (c) { case 'a': awgn_flag = 1; @@ -539,28 +539,29 @@ int main(int argc, char **argv) exit(-1); } - if (transmission_mode>1 && transmission_mode<7) { + if (transmission_mode>1 && transmission_mode<7){ n_tx = 2; n_tx_phy = n_tx; } - if (transmission_mode>=7){ - n_tx = 1; - n_tx_phy = 1; - n_rx = 1; - } break; case 'y': n_tx=atoi(optarg); - if (transmission_mode<7){ - n_tx_phy = n_tx; + if ((n_tx==0) || ((n_tx>2))) { + msg("Unsupported number of tx antennas ports %d\n",n_tx); + exit(-1); + } - if ((n_tx==0) || ((n_tx>2))) { - msg("Unsupported number of tx antennas %d\n",n_tx); - exit(-1); - } + break; + + case 'q': + n_tx_phy=atoi(optarg); + + if (transmission_mode<7 && n_tx_phy!=n_tx) { + msg("For transmission mode below TM7, physical antenna number should be the same as antenna port number.\n"); + exit(-1); } break; @@ -668,7 +669,8 @@ int main(int argc, char **argv) printf("-g [A:M] Use 3GPP 25.814 SCM-A/B/C/D('A','B','C','D') or 36-101 EPA('E'), EVA ('F'),ETU('G') models (ignores delay spread and Ricean factor), Rayghleigh8 ('H'), Rayleigh1('I'), Rayleigh1_corr('J'), Rayleigh1_anticorr ('K'), Rice8('L'), Rice1('M')\n"); printf("-F forgetting factor (0 new channel every trial, 1 channel constant\n"); printf("-x Transmission mode (1,2,6,7 for the moment)\n"); - printf("-y Number of TX antennas used in eNB\n"); + printf("-y Number of TX antennas ports used in eNB\n"); + printf("-q Number of physical TX antennas used in eNB\n"); printf("-z Number of RX antennas used in UE\n"); printf("-t MCS of interfering UE\n"); printf("-R Number of HARQ rounds (fixed)\n"); From 3353735f3c7e5e6c258fe6165cd303a13f8c29a1 Mon Sep 17 00:00:00 2001 From: Xiwen JIANG Date: Fri, 25 Sep 2015 11:32:07 +0200 Subject: [PATCH 007/349] beamforming weights modification --- openair1/PHY/LTE_TRANSPORT/dlsch_modulation.c | 8 ++++---- openair1/SIMULATION/LTE_PHY/dlsim.c | 10 +++++++++- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/openair1/PHY/LTE_TRANSPORT/dlsch_modulation.c b/openair1/PHY/LTE_TRANSPORT/dlsch_modulation.c index 5366efcc12..f2ec6afdfc 100644 --- a/openair1/PHY/LTE_TRANSPORT/dlsch_modulation.c +++ b/openair1/PHY/LTE_TRANSPORT/dlsch_modulation.c @@ -918,10 +918,10 @@ break; //printf("%d(%d) : %d,%d => ",tti_offset,*jj,((int16_t*)&tmp_sample1)[0],((int16_t*)&tmp_sample1)[1]); for (aa=0; aa>15); - ((int16_t*)&txdataF[aa][tti_offset])[0] +=-(int16_t)((((int16_t*)&tmp_sample1)[1]*((uint16_t*)&beamforming_weights[re][aa])[1])>>15); - ((int16_t*)&txdataF[aa][tti_offset])[1] += (int16_t)((((int16_t*)&tmp_sample1)[0]*((uint16_t*)&beamforming_weights[re][aa])[1])>>15); - ((int16_t*)&txdataF[aa][tti_offset])[1] += (int16_t)((((int16_t*)&tmp_sample1)[1]*((uint16_t*)&beamforming_weights[re][aa])[0])>>15); + ((int16_t*)&txdataF[aa][tti_offset])[0] += (int16_t)((((int16_t*)&tmp_sample1)[0]*((int16_t*)&beamforming_weights[re][aa])[0])>>15); + ((int16_t*)&txdataF[aa][tti_offset])[0] +=-(int16_t)((((int16_t*)&tmp_sample1)[1]*((int16_t*)&beamforming_weights[re][aa])[1])>>15); + ((int16_t*)&txdataF[aa][tti_offset])[1] += (int16_t)((((int16_t*)&tmp_sample1)[0]*((int16_t*)&beamforming_weights[re][aa])[1])>>15); + ((int16_t*)&txdataF[aa][tti_offset])[1] += (int16_t)((((int16_t*)&tmp_sample1)[1]*((int16_t*)&beamforming_weights[re][aa])[0])>>15); } //printf("%d,%d\n",((int16_t*)&txdataF[0][tti_offset])[0],((int16_t*)&txdataF[0][tti_offset])[1]); diff --git a/openair1/SIMULATION/LTE_PHY/dlsim.c b/openair1/SIMULATION/LTE_PHY/dlsim.c index 624fae921e..0e993b1fe5 100644 --- a/openair1/SIMULATION/LTE_PHY/dlsim.c +++ b/openair1/SIMULATION/LTE_PHY/dlsim.c @@ -752,7 +752,8 @@ int main(int argc, char **argv) for(re=0;re<12*N_RB_DL;re++){ beamforming_weights[re]=(int32_t *)malloc(n_tx_phy*sizeof(int32_t)); for(aa=0;aachF[aarx+(aa*frame_parms->nb_antennas_rx)][i].x*AMP); ((int16_t *) PHY_vars_UE->lte_ue_common_vars.dl_ch_estimates[k][(aa<<1)+aarx])[2*i+1+((l+(Ns%2)*pilot2)*frame_parms->ofdm_symbol_size+LTE_CE_FILTER_LENGTH)*2]=(int16_t)( eNB2UE[round]->chF[aarx+(aa*frame_parms->nb_antennas_rx)][i].y*AMP); + + if (transmission_mode == 7){ + ((int16_t *)PHY_vars_UE->lte_ue_pdsch_vars[0]->dl_bf_ch_estimates[(aa<<1)+aarx])[2*i+((l+(Ns%2)*pilot2)*frame_parms->ofdm_symbol_size)*2]=(int16_t)( + eNB2UE[round]->chF[aarx+(aa*frame_parms->nb_antennas_rx)][i].x*AMP); + ((int16_t *)PHY_vars_UE->lte_ue_pdsch_vars[0]->dl_bf_ch_estimates[(aa<<1)+aarx])[2*i+1+((l+(Ns%2)*pilot2)*frame_parms->ofdm_symbol_size)*2]=(int16_t)( + eNB2UE[round]->chF[aarx+(aa*frame_parms->nb_antennas_rx)][i].y*AMP); + } } } } From fdea4022d191ecce45d6c87d67830b56bf1d495d Mon Sep 17 00:00:00 2001 From: Xiwen JIANG Date: Fri, 25 Sep 2015 18:14:22 +0200 Subject: [PATCH 008/349] bug fixed for more than 1 physical antenna --- .../lte_dl_bf_channel_estimation.c | 15 ++++++------ .../lte_dl_channel_estimation.c | 3 --- openair1/PHY/LTE_TRANSPORT/dlsch_modulation.c | 24 +++++++++---------- openair1/SIMULATION/LTE_PHY/dlsim.c | 21 +++++++++------- 4 files changed, 32 insertions(+), 31 deletions(-) diff --git a/openair1/PHY/LTE_ESTIMATION/lte_dl_bf_channel_estimation.c b/openair1/PHY/LTE_ESTIMATION/lte_dl_bf_channel_estimation.c index 5feb1aaeda..e36a164468 100644 --- a/openair1/PHY/LTE_ESTIMATION/lte_dl_bf_channel_estimation.c +++ b/openair1/PHY/LTE_ESTIMATION/lte_dl_bf_channel_estimation.c @@ -229,7 +229,6 @@ int lte_dl_bf_channel_estimation(PHY_VARS_UE *phy_vars_ue, ch[0] = (short)(((int)pil[0]*rxF[0] - (int)pil[1]*rxF[1])>>15); ch[1] = (short)(((int)pil[0]*rxF[1] + (int)pil[1]*rxF[0])>>15); multadd_real_vector_complex_scalar(fl,ch,dl_bf_ch,16); - //printf("rxF[%d]=(%d,%d),pil=(%d,%d),ch=(%d,%d)\n",pil_offset,rxF[0],rxF[1],pil[0],pil[1],ch[0],ch[1]); ch[0] = (short)(((int)pil[0]*rxF[8] - (int)pil[1]*rxF[9])>>15); ch[1] = (short)(((int)pil[0]*rxF[9] + (int)pil[1]*rxF[8])>>15); @@ -378,13 +377,13 @@ int lte_dl_bf_channel_estimation(PHY_VARS_UE *phy_vars_ue, ch[0] = (short)(((int)pil[0]*rxF[8] - (int)pil[1]*rxF[9])>>15); ch[1] = (short)(((int)pil[0]*rxF[9] + (int)pil[1]*rxF[8])>>15); multadd_real_vector_complex_scalar(fm,ch,dl_bf_ch,16); - //printf("symbol=%d,rxF[%d]=(%d,%d),pil=(%d,%d),ch=(%d,%d)\n",symbol,pil_offset,rxF[0],rxF[1],pil[0],pil[1],ch[0],ch[1]); + //printf("symbol=%d,rxF[%d]=(%d,%d),pil=(%d,%d),ch=(%d,%d)\n",symbol,pil_offset,rxF[8],rxF[9],pil[0],pil[1],ch[0],ch[1]); pil+=2; ch[0] = (short)(((int)pil[0]*rxF[16] - (int)pil[1]*rxF[17])>>15); ch[1] = (short)(((int)pil[0]*rxF[17] + (int)pil[1]*rxF[16])>>15); multadd_real_vector_complex_scalar(fr,ch,dl_bf_ch,16); - //printf("symbol=%d,rxF[%d]=(%d,%d),pil=(%d,%d),ch=(%d,%d)\n",symbol,pil_offset,rxF[0],rxF[1],pil[0],pil[1],ch[0],ch[1]); + //printf("symbol=%d,rxF[%d]=(%d,%d),pil=(%d,%d),ch=(%d,%d)\n",symbol,pil_offset,rxF[16],rxF[17],pil[0],pil[1],ch[0],ch[1]); pil+=2; } @@ -604,19 +603,19 @@ int lte_dl_bf_channel_estimation(PHY_VARS_UE *phy_vars_ue, ch[0] = (short)(((int)pil[0]*rxF[0] - (int)pil[1]*rxF[1])>>15); ch[1] = (short)(((int)pil[0]*rxF[1] + (int)pil[1]*rxF[0])>>15); multadd_real_vector_complex_scalar(fl,ch,dl_bf_ch,16); - // printf("symbol=%d,rxF[%d]=(%d,%d),pil=(%d,%d),ch=(%d,%d)\n",symbol,pil_offset,rxF[0],rxF[1],pil[0],pil[1],ch[0],ch[1]); + //printf("symbol=%d,rxF[%d]=(%d,%d),pil=(%d,%d),ch=(%d,%d)\n",symbol,pil_offset,rxF[0],rxF[1],pil[0],pil[1],ch[0],ch[1]); pil+=2; ch[0] = (short)(((int)pil[0]*rxF[8] - (int)pil[1]*rxF[9])>>15); ch[1] = (short)(((int)pil[0]*rxF[9] + (int)pil[1]*rxF[8])>>15); multadd_real_vector_complex_scalar(fm,ch,dl_bf_ch,16); - // printf("symbol=%d,rxF[%d]=(%d,%d),pil=(%d,%d),ch=(%d,%d)\n",symbol,pil_offset,rxF[8],rxF[9],pil[0],pil[1],ch[0],ch[1]); + //printf("symbol=%d,rxF[%d]=(%d,%d),pil=(%d,%d),ch=(%d,%d)\n",symbol,pil_offset,rxF[8],rxF[9],pil[0],pil[1],ch[0],ch[1]); pil+=2; ch[0] = (short)(((int)pil[0]*rxF[16] - (int)pil[1]*rxF[17])>>15); ch[1] = (short)(((int)pil[0]*rxF[17] + (int)pil[1]*rxF[16])>>15); multadd_real_vector_complex_scalar(fr,ch,dl_bf_ch,16); - // printf("symbol=%d,rxF[%d]=(%d,%d),pil=(%d,%d),ch=(%d,%d)\n",symbol,pil_offset,rxF[16],rxF[17],pil[0],pil[1],ch[0],ch[1]); + //printf("symbol=%d,rxF[%d]=(%d,%d),pil=(%d,%d),ch=(%d,%d)\n",symbol,pil_offset,rxF[16],rxF[17],pil[0],pil[1],ch[0],ch[1]); pil+=2; } @@ -641,13 +640,13 @@ int lte_dl_bf_channel_estimation(PHY_VARS_UE *phy_vars_ue, if (phy_vars_ue->perfect_ce == 0) { dl_bf_ch = (short *)&dl_bf_ch_estimates[aarx][ch_offset]; - printf("dlsch_bf_ch_est.c:symbol %d, dl_bf_ch (%d,%d)\n",symbol,dl_bf_ch[0],dl_bf_ch[1]); + //printf("dlsch_bf_ch_est.c:symbol %d, dl_bf_ch (%d,%d)\n",symbol,dl_bf_ch[0],dl_bf_ch[1]); if (phy_vars_ue->high_speed_flag == 0) { multadd_complex_vector_real_scalar(dl_bf_ch, 32767-phy_vars_ue->ch_est_alpha, dl_bf_ch-(frame_parms->ofdm_symbol_size<<1),0,frame_parms->ofdm_symbol_size); - printf("dlsch_bf_ch_est.c:symbol %d,dl_bf_ch (%d,%d)\n",symbol,*(dl_bf_ch-512*2),*(dl_bf_ch-512*2+1)); + //printf("dlsch_bf_ch_est.c:symbol %d,dl_bf_ch (%d,%d)\n",symbol,*(dl_bf_ch-512*2),*(dl_bf_ch-512*2+1)); } else { // high_speed_flag == 1 if (beamforming_mode==7) { if (frame_parms->Ncp==0) { diff --git a/openair1/PHY/LTE_ESTIMATION/lte_dl_channel_estimation.c b/openair1/PHY/LTE_ESTIMATION/lte_dl_channel_estimation.c index 27e9018477..318d499ccd 100644 --- a/openair1/PHY/LTE_ESTIMATION/lte_dl_channel_estimation.c +++ b/openair1/PHY/LTE_ESTIMATION/lte_dl_channel_estimation.c @@ -42,9 +42,6 @@ int lte_dl_channel_estimation(PHY_VARS_UE *phy_vars_ue, unsigned char l, unsigned char symbol) { - - - int pilot[2][200] __attribute__((aligned(16))); unsigned char nu,aarx; unsigned short k; diff --git a/openair1/PHY/LTE_TRANSPORT/dlsch_modulation.c b/openair1/PHY/LTE_TRANSPORT/dlsch_modulation.c index f2ec6afdfc..685d77b802 100644 --- a/openair1/PHY/LTE_TRANSPORT/dlsch_modulation.c +++ b/openair1/PHY/LTE_TRANSPORT/dlsch_modulation.c @@ -1018,18 +1018,20 @@ break; //precoding UE spec RS //printf("precoding UE spec RS\n"); + ind = 3*lprime*dlsch0_harq->nb_rb+mprime2; + ind_dword = ind>>4; + ind_qpsk_symb = ind&0xf; + + tmp_sample1 = qpsk[(phy_vars_eNB->lte_gold_uespec_port5_table[0][Ns][ind_dword]>>(2*ind_qpsk_symb))&3]; + mprime2++; + for (aa=0; aanb_rb+mprime2; - ind_dword = ind>>4; - ind_qpsk_symb = ind&0xf; - - tmp_sample1 = qpsk[(phy_vars_eNB->lte_gold_uespec_port5_table[0][Ns][ind_dword]>>(2*ind_qpsk_symb))&3]; - - ((int16_t*)&txdataF[aa][tti_offset])[0] += (int16_t)((((int16_t*)&tmp_sample1)[0]*((uint16_t*)&beamforming_weights[re][aa])[0])>>15); - ((int16_t*)&txdataF[aa][tti_offset])[0] +=-(int16_t)((((int16_t*)&tmp_sample1)[1]*((uint16_t*)&beamforming_weights[re][aa])[1])>>15); - ((int16_t*)&txdataF[aa][tti_offset])[1] += (int16_t)((((int16_t*)&tmp_sample1)[0]*((uint16_t*)&beamforming_weights[re][aa])[1])>>15); - ((int16_t*)&txdataF[aa][tti_offset])[1] += (int16_t)((((int16_t*)&tmp_sample1)[1]*((uint16_t*)&beamforming_weights[re][aa])[0])>>15); + ((int16_t*)&txdataF[aa][tti_offset])[0] += (int16_t)((((int16_t*)&tmp_sample1)[0]*((int16_t*)&beamforming_weights[re][aa])[0])>>15); + ((int16_t*)&txdataF[aa][tti_offset])[0] +=-(int16_t)((((int16_t*)&tmp_sample1)[1]*((int16_t*)&beamforming_weights[re][aa])[1])>>15); + ((int16_t*)&txdataF[aa][tti_offset])[1] += (int16_t)((((int16_t*)&tmp_sample1)[0]*((int16_t*)&beamforming_weights[re][aa])[1])>>15); + ((int16_t*)&txdataF[aa][tti_offset])[1] += (int16_t)((((int16_t*)&tmp_sample1)[1]*((int16_t*)&beamforming_weights[re][aa])[0])>>15); // ((int16_t*)&txdataF[aa][tti_offset])[0] = 0xffff; // ((int16_t*)&txdataF[aa][tti_offset])[1] = 0xffff; @@ -1037,8 +1039,6 @@ break; //printf("tmp_sample1=(%d,%d)\n",((int16_t*)&tmp_sample1)[0],((int16_t*)&tmp_sample1)[1]); //printf("beamforing_weights[%d][%d]=(%d,%d)\n",re,aa,((int16_t*)&beamforming_weights[re][aa])[0],((int16_t*)&beamforming_weights[re][aa])[1]); //printf("txdataF[%d][%d]= (%d,%d)\n ",aa,tti_offset,((int16_t*)&txdataF[aa][tti_offset])[0],((int16_t*)&txdataF[aa][tti_offset])[1]); - - mprime2++; } } diff --git a/openair1/SIMULATION/LTE_PHY/dlsim.c b/openair1/SIMULATION/LTE_PHY/dlsim.c index 0e993b1fe5..39a0095ac3 100644 --- a/openair1/SIMULATION/LTE_PHY/dlsim.c +++ b/openair1/SIMULATION/LTE_PHY/dlsim.c @@ -564,6 +564,11 @@ int main(int argc, char **argv) exit(-1); } + if (transmission_mode==7 && (n_tx_phy!=2 && n_tx_phy!=4 && n_tx_phy!=8 && n_tx_phy!=16 && n_tx_phy!=64)) { + msg("For TM7, physical antenna number should be an exponent of 2, maximum 64 antennas supported.\n"); + exit(-1); + } + break; case 'z': @@ -753,7 +758,7 @@ int main(int argc, char **argv) beamforming_weights[re]=(int32_t *)malloc(n_tx_phy*sizeof(int32_t)); for(aa=0;aa>(n_tx_phy>>1); } } @@ -2924,12 +2929,12 @@ PMI_FEEDBACK: } else { for (aarx=0; aarxlte_frame_parms.nb_antennas_rx; aarx++) { if (aa==0) { - r_re[aarx][i] = ((double)(((short *)PHY_vars_eNB->lte_eNB_common_vars.txdata[eNB_id][aa]))[(2*subframe*PHY_vars_UE->lte_frame_parms.samples_per_tti) +(i<<1)]); - r_im[aarx][i] = ((double)(((short *)PHY_vars_eNB->lte_eNB_common_vars.txdata[eNB_id][aa]))[(2*subframe*PHY_vars_UE->lte_frame_parms.samples_per_tti) +(i<<1)+1]); + r_re[aarx][i] = (double)(((short *)PHY_vars_eNB->lte_eNB_common_vars.txdata[eNB_id][aa]))[(2*subframe*PHY_vars_UE->lte_frame_parms.samples_per_tti) +(i<<1)]; + r_im[aarx][i] = (double)(((short *)PHY_vars_eNB->lte_eNB_common_vars.txdata[eNB_id][aa]))[(2*subframe*PHY_vars_UE->lte_frame_parms.samples_per_tti) +(i<<1)+1]; //printf("r[%d][%d]=> %f, %f\n",aarx,i,r_re[aarx][i],r_im[aarx][i]); } else { - r_re[aarx][i] += ((double)(((short *)PHY_vars_eNB->lte_eNB_common_vars.txdata[eNB_id][aa]))[(2*subframe*PHY_vars_UE->lte_frame_parms.samples_per_tti) +(i<<1)]); - r_im[aarx][i] += ((double)(((short *)PHY_vars_eNB->lte_eNB_common_vars.txdata[eNB_id][aa]))[(2*subframe*PHY_vars_UE->lte_frame_parms.samples_per_tti) +(i<<1)+1]); + r_re[aarx][i] += (double)(((short *)PHY_vars_eNB->lte_eNB_common_vars.txdata[eNB_id][aa]))[(2*subframe*PHY_vars_UE->lte_frame_parms.samples_per_tti) +(i<<1)]; + r_im[aarx][i] += (double)(((short *)PHY_vars_eNB->lte_eNB_common_vars.txdata[eNB_id][aa]))[(2*subframe*PHY_vars_UE->lte_frame_parms.samples_per_tti) +(i<<1)+1]; } } @@ -3022,10 +3027,10 @@ PMI_FEEDBACK: // printf("s_re[0][%d]=> %f , r_re[0][%d]=> %f\n",i,s_re[aa][i],i,r_re[aa][i]); /*((short*) PHY_vars_UE->lte_ue_common_vars.rxdata[aa])[(2*subframe*PHY_vars_UE->lte_frame_parms.samples_per_tti)+2*i] = (short) (r_re[aa][i] + sqrt(sigma2/2)*gaussdouble(0.0,1.0)); - ((short*) PHY_vars_UE->lte_ue_common_vars.rxdata[aa])[(2*subframe*PHY_vars_UE->lte_frame_parms.samples_per_tti)+2*i+1] = + ((short*) PHY_vars_UE->lte_ue_common_vars.rxdata[aa])[(2*subframe*PHY_vars_UE->lte_frame_parms.samples_per_tti)+2*i+1] = (short) (r_im[aa][i] + (iqim*r_re[aa][i]) + sqrt(sigma2/2)*gaussdouble(0.0,1.0));*/ - ((short*) PHY_vars_UE->lte_ue_common_vars.rxdata[aa])[(2*subframe*PHY_vars_UE->lte_frame_parms.samples_per_tti)+2*i] = (short) (r_re[aa][i]); - ((short*) PHY_vars_UE->lte_ue_common_vars.rxdata[aa])[(2*subframe*PHY_vars_UE->lte_frame_parms.samples_per_tti)+2*i+1] = (short) (r_im[aa][i] + (iqim*r_re[aa][i])); + ((short*) PHY_vars_UE->lte_ue_common_vars.rxdata[aa])[(2*subframe*PHY_vars_UE->lte_frame_parms.samples_per_tti)+2*i] = (short) r_re[aa][i]; + ((short*) PHY_vars_UE->lte_ue_common_vars.rxdata[aa])[(2*subframe*PHY_vars_UE->lte_frame_parms.samples_per_tti)+2*i+1] = (short) r_im[aa][i]; //printf("rxdata[%d][%d]=> %d, %d\n",aa,subframe*PHY_vars_UE->lte_frame_parms.samples_per_tti+i,r_re[aa][i],r_im[aa][i]); } } From 1a1d843f16dabcfa8740a5e148107f4df73d899d Mon Sep 17 00:00:00 2001 From: Xiwen JIANG Date: Fri, 25 Sep 2015 18:34:23 +0200 Subject: [PATCH 009/349] compilation for XFORMS --- openair1/PHY/LTE_TRANSPORT/dlsch_modulation.c | 1 - openair1/PHY/TOOLS/lte_phy_scope.c | 4 +++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/openair1/PHY/LTE_TRANSPORT/dlsch_modulation.c b/openair1/PHY/LTE_TRANSPORT/dlsch_modulation.c index 685d77b802..9176f11fae 100644 --- a/openair1/PHY/LTE_TRANSPORT/dlsch_modulation.c +++ b/openair1/PHY/LTE_TRANSPORT/dlsch_modulation.c @@ -1026,7 +1026,6 @@ break; mprime2++; for (aa=0; aa>15); ((int16_t*)&txdataF[aa][tti_offset])[0] +=-(int16_t)((((int16_t*)&tmp_sample1)[1]*((int16_t*)&beamforming_weights[re][aa])[1])>>15); diff --git a/openair1/PHY/TOOLS/lte_phy_scope.c b/openair1/PHY/TOOLS/lte_phy_scope.c index 5fdf89f253..0b5bc1c0fa 100644 --- a/openair1/PHY/TOOLS/lte_phy_scope.c +++ b/openair1/PHY/TOOLS/lte_phy_scope.c @@ -468,6 +468,7 @@ void phy_scope_UE(FD_lte_phy_scope_ue *form, int coded_bits_per_codeword = 0; int mcs = 0; unsigned char harq_pid = 0; + int beamforming_mode = phy_vars_ue->transmission_mode[eNB_id]>6 ? phy_vars_ue->transmission_mode[eNB_id] : 0; if (phy_vars_ue->dlsch_ue[eNB_id][0]!=NULL) { harq_pid = phy_vars_ue->dlsch_ue[eNB_id][0]->current_harq_pid; @@ -497,7 +498,8 @@ void phy_scope_UE(FD_lte_phy_scope_ue *form, phy_vars_ue->dlsch_ue[eNB_id][0]->harq_processes[harq_pid]->Nl, num_pdcch_symbols, frame, - subframe); + subframe, + beamforming_mode); } else { coded_bits_per_codeword = 0; //frame_parms->N_RB_DL*12*get_Qm(mcs)*(frame_parms->symbols_per_tti); } From e5013e5327608e42fc945dc9b9eb829b859863c8 Mon Sep 17 00:00:00 2001 From: Xiwen JIANG Date: Tue, 29 Sep 2015 10:34:55 +0200 Subject: [PATCH 010/349] move DL beamforming channel estimation to dlsim top level file --- openair1/PHY/MODULATION/slot_fep.c | 11 ----------- openair1/SIMULATION/LTE_PHY/dlsim.c | 14 +++++++++++++- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/openair1/PHY/MODULATION/slot_fep.c b/openair1/PHY/MODULATION/slot_fep.c index a7639d9291..5597f3f7fb 100644 --- a/openair1/PHY/MODULATION/slot_fep.c +++ b/openair1/PHY/MODULATION/slot_fep.c @@ -247,17 +247,6 @@ int slot_fep(PHY_VARS_UE *phy_vars_ue, } } - if(phy_vars_ue->transmission_mode[eNB_id] == 7) { - - if(frame_parms->Ncp==0 && ((symbol==3) || (symbol==6) || (symbol==9) || (symbol==12))) - lte_dl_bf_channel_estimation(phy_vars_ue,eNB_id,0,Ns,5,symbol); - - else if(frame_parms->Ncp==1 && ((symbol==4) || (symbol==7) || (symbol==10))) - msg("slot_fep(slot_fep.c):channel estimation not supported yet for TM7 extented CP.\n"); - - } else if(phy_vars_ue->transmission_mode[eNB_id] > 7) { - msg("slot_fep(slot_fep.c):transmission mode not supported yet.\n"); - } } #ifdef DEBUG_FEP diff --git a/openair1/SIMULATION/LTE_PHY/dlsim.c b/openair1/SIMULATION/LTE_PHY/dlsim.c index 39a0095ac3..96c6dfc14e 100644 --- a/openair1/SIMULATION/LTE_PHY/dlsim.c +++ b/openair1/SIMULATION/LTE_PHY/dlsim.c @@ -564,7 +564,7 @@ int main(int argc, char **argv) exit(-1); } - if (transmission_mode==7 && (n_tx_phy!=2 && n_tx_phy!=4 && n_tx_phy!=8 && n_tx_phy!=16 && n_tx_phy!=64)) { + if (transmission_mode==7 && (n_tx_phy!=1 && n_tx_phy!=2 && n_tx_phy!=4 && n_tx_phy!=8 && n_tx_phy!=16 && n_tx_phy!=64)) { msg("For TM7, physical antenna number should be an exponent of 2, maximum 64 antennas supported.\n"); exit(-1); } @@ -3360,6 +3360,18 @@ PMI_FEEDBACK: } if (dlsch_active == 1) { + + if (transmission_mode==7) { + if (PHY_vars_UE->lte_frame_parms.Ncp==0) { + if ((Ns==(2*subframe) && ((l==3) || (l==6))) || + Ns==(1+(2*subframe)) && ((l==3) || (l==6))) { + lte_dl_bf_channel_estimation(PHY_vars_UE,eNB_id,0,Ns,5,l+7*(Ns%2==1)); + } + } else { + msg("Beamforming channel estimation not supported yet for TM7 extented CP.\n"); + } + } + if ((Ns==(1+(2*subframe))) && (l==0)) {// process PDSCH symbols 1,2,3,4,5,(6 Normal Prefix) if ((transmission_mode == 5) && From d89807b6ebaefe5872fa76e30ef6fc71e82ed22a Mon Sep 17 00:00:00 2001 From: Xiwen JIANG Date: Tue, 29 Sep 2015 10:35:47 +0200 Subject: [PATCH 011/349] skip half creterion for PSS RBs --- .../lte_dl_bf_channel_estimation.c | 8 ++--- .../PHY/LTE_TRANSPORT/dlsch_demodulation.c | 31 +++++++------------ 2 files changed, 14 insertions(+), 25 deletions(-) diff --git a/openair1/PHY/LTE_ESTIMATION/lte_dl_bf_channel_estimation.c b/openair1/PHY/LTE_ESTIMATION/lte_dl_bf_channel_estimation.c index e36a164468..909c7bd12e 100644 --- a/openair1/PHY/LTE_ESTIMATION/lte_dl_bf_channel_estimation.c +++ b/openair1/PHY/LTE_ESTIMATION/lte_dl_bf_channel_estimation.c @@ -308,8 +308,7 @@ int lte_dl_bf_channel_estimation(PHY_VARS_UE *phy_vars_ue, skip_half=2; } - if ((frame_parms->frame_type == TDD) && - (subframe==6)) { //TDD Subframe 6 + if ((frame_parms->frame_type == TDD) && ((subframe==1)||(subframe==6))) { //TDD Subframe 1 and 6 if ((rb>((frame_parms->N_RB_DL>>1)-3)) && (rb<((frame_parms->N_RB_DL>>1)+3)) && (l==pss_symb) ) { rb_alloc_ind = 0; } @@ -432,7 +431,7 @@ int lte_dl_bf_channel_estimation(PHY_VARS_UE *phy_vars_ue, } } - if ((frame_parms->frame_type == TDD) && (subframe==6)) { + if ((frame_parms->frame_type == TDD) && ((subframe==1)||(subframe==6))) { //PSS if ((rb>((frame_parms->N_RB_DL>>1)-3)) && (rb<((frame_parms->N_RB_DL>>1)+3)) && (l==pss_symb) ) { rb_alloc_ind = 0; @@ -540,8 +539,7 @@ int lte_dl_bf_channel_estimation(PHY_VARS_UE *phy_vars_ue, skip_half=2; } - if ((frame_parms->frame_type == TDD) && - (subframe==6)) { //TDD Subframe 6 + if ((frame_parms->frame_type == TDD) && ((subframe==1)||(subframe==6))) { //TDD Subframe 1 and 6 if ((rb>((frame_parms->N_RB_DL>>1)-3)) && (rb<((frame_parms->N_RB_DL>>1)+3)) && (l==pss_symb) ) { rb_alloc_ind = 0; } diff --git a/openair1/PHY/LTE_TRANSPORT/dlsch_demodulation.c b/openair1/PHY/LTE_TRANSPORT/dlsch_demodulation.c index fdc1ae846c..0d7ed4f16d 100644 --- a/openair1/PHY/LTE_TRANSPORT/dlsch_demodulation.c +++ b/openair1/PHY/LTE_TRANSPORT/dlsch_demodulation.c @@ -4265,18 +4265,14 @@ unsigned short dlsch_extract_rbs_TM7(int **rxdataF, for (aarx=0; aarxnb_antennas_rx; aarx++) { if (high_speed_flag == 1) - //dl_ch0 = &dl_bf_ch_estimates[aarx][5+(symbol*(frame_parms->ofdm_symbol_size))]; dl_ch0 = &dl_bf_ch_estimates[aarx][symbol*(frame_parms->ofdm_symbol_size)]; else - //dl_ch0 = &dl_bf_ch_estimates[aarx][5]; dl_ch0 = &dl_bf_ch_estimates[aarx][0]; dl_ch0_ext = &dl_bf_ch_estimates_ext[aarx][symbol*(frame_parms->N_RB_DL*12)]; rxF_ext = &rxdataF_ext[aarx][symbol*(frame_parms->N_RB_DL*12)]; rxF = &rxdataF[aarx][(frame_parms->first_carrier_offset + (symbol*(frame_parms->ofdm_symbol_size)))]; - //printf("symbol:%d, (symbol-1)/3:%d\n",symbol,(symbol-1)/3); - //printf("symbol, rxF_uespec offset:%d\n",symbol,(symbol-1)/3*frame_parms->N_RB_DL*(3+frame_parms->Ncp)); if ((frame_parms->N_RB_DL&1) == 0) // even number of RBs for (rb=0; rbN_RB_DL; rb++) { @@ -4367,7 +4363,6 @@ unsigned short dlsch_extract_rbs_TM7(int **rxdataF, } else { // Odd number of RBs for (rb=0; rbN_RB_DL>>1; rb++) { - // printf("dlch_ext %d\n",dl_ch0_ext-&dl_ch_estimates_ext[aarx][0]); skip_half=0; if (rb < 32) @@ -4424,8 +4419,7 @@ unsigned short dlsch_extract_rbs_TM7(int **rxdataF, skip_half=2; } - if ((frame_parms->frame_type == TDD) && - (subframe==6)) { //TDD Subframe 6 + if ((frame_parms->frame_type == TDD) && ((subframe==1)||(subframe==6))) { //TDD Subframe 1 and 6 if ((rb>((frame_parms->N_RB_DL>>1)-3)) && (rb<((frame_parms->N_RB_DL>>1)+3)) && (l==pss_symb) ) { rb_alloc_ind = 0; } @@ -4441,7 +4435,7 @@ unsigned short dlsch_extract_rbs_TM7(int **rxdataF, //printf("rb %d/symbol %d pilots %d, uespec_pilots %d, (skip_half %d)\n",rb,l,pilots,uespec_pilots,skip_half); if (pilots==0 && uespec_pilots==0) { - // printf("Extracting w/o pilots (symbol %d, rb %d, skip_half %d)\n",l,rb,skip_half); + //printf("Extracting w/o pilots (symbol %d, rb %d, skip_half %d)\n",l,rb,skip_half); if (skip_half==1) { memcpy(dl_ch0_ext,dl_ch0,6*sizeof(int)); @@ -4462,13 +4456,14 @@ unsigned short dlsch_extract_rbs_TM7(int **rxdataF, } else { memcpy(dl_ch0_ext,dl_ch0,12*sizeof(int)); - for (i=0; i<12; i++) + for (i=0; i<12; i++){ rxF_ext[i]=rxF[i]; - + //printf("symbol %d, extract rb %d, re %d => (%d,%d)\n",symbol,rb,i,*(short *)&rxF[i],*(1+(short*)&rxF[i])); + } dl_ch0_ext+=12; rxF_ext+=12; } - } else if (pilots==1 && uespec_pilots==0){ + } else if (pilots==1 && uespec_pilots==0) { // printf("Extracting with pilots (symbol %d, rb %d, skip_half %d)\n",l,rb,skip_half); j=0; @@ -4564,7 +4559,6 @@ unsigned short dlsch_extract_rbs_TM7(int **rxdataF, if (i!=uespec_nushift+uespec_poffset && i!=uespec_nushift+uespec_poffset+4 && i!=(uespec_nushift+uespec_poffset+8)%12){ rxF_ext[j] = rxF[i]; dl_ch0_ext[j++] = dl_ch0[i]; - //printf("symbol %d, extract rb %d, re %d => (%d,%d)\n",symbol,rb,i,*(short *)&dl_ch0[j],*(1+(short*)&dl_ch0[i])); //printf("symbol %d, extract rb %d, re %d, j %d => (%d,%d)\n",symbol,rb,i,j-1,*(short *)&dl_ch0[j],*(1+(short*)&dl_ch0[i])); } } else{ @@ -4625,8 +4619,7 @@ unsigned short dlsch_extract_rbs_TM7(int **rxdataF, } } - if ((frame_parms->frame_type == TDD) && - (subframe==6)) { + if ((frame_parms->frame_type == TDD) && ((subframe==1)||(subframe==6))) { //PSS if ((rb>((frame_parms->N_RB_DL>>1)-3)) && (rb<((frame_parms->N_RB_DL>>1)+3)) && (l==pss_symb) ) { rb_alloc_ind = 0; @@ -4766,21 +4759,19 @@ unsigned short dlsch_extract_rbs_TM7(int **rxdataF, else if (((subframe==0)||(subframe==5)) && (rb==((frame_parms->N_RB_DL>>1)+3)) && (l==sss_symb)) skip_half=2; + //PSS if (frame_parms->frame_type == FDD) { - //PSS if (((subframe==0)||(subframe==5)) && (rb>((frame_parms->N_RB_DL>>1)-3)) && (rb<((frame_parms->N_RB_DL>>1)+3)) && (l==pss_symb) ) { rb_alloc_ind = 0; } - //PSS if (((subframe==0)||(subframe==5)) && (rb==((frame_parms->N_RB_DL>>1)-3)) && (l==pss_symb)) skip_half=1; else if (((subframe==0)||(subframe==5)) && (rb==((frame_parms->N_RB_DL>>1)+3)) && (l==pss_symb)) skip_half=2; } - if ((frame_parms->frame_type == TDD) && - (subframe==6)) { //TDD Subframe 6 + if ((frame_parms->frame_type == TDD) && ((subframe==1)||(subframe==6))) { //TDD Subframe 1 and 6 if ((rb>((frame_parms->N_RB_DL>>1)-3)) && (rb<((frame_parms->N_RB_DL>>1)+3)) && (l==pss_symb) ) { rb_alloc_ind = 0; } @@ -4814,7 +4805,7 @@ unsigned short dlsch_extract_rbs_TM7(int **rxdataF, memcpy(dl_ch0_ext,dl_ch0+6,6*sizeof(int)); for (i=0; i<6; i++) - rxF_ext[i]=rxF[(i+6)]; + rxF_ext[i]=rxF[i+6]; dl_ch0_ext+=6; rxF_ext+=6; @@ -4898,7 +4889,7 @@ unsigned short dlsch_extract_rbs_TM7(int **rxdataF, if(frame_parms->Ncp==0){ for (i=0; i<6; i++) { if (i!=uespec_nushift+uespec_poffset && i!=uespec_nushift+uespec_poffset+4 && i!=(uespec_nushift+uespec_poffset+8)%12){ - rxF_ext[j]=rxF[(i+6)]; + rxF_ext[j]=rxF[i+6]; dl_ch0_ext[j++]=dl_ch0[i+6]; } } From a6f2310e4b5e6e0dd42d42113c41bc27a2eb550e Mon Sep 17 00:00:00 2001 From: Xiwen JIANG Date: Tue, 29 Sep 2015 14:02:57 +0200 Subject: [PATCH 012/349] add beamforming mode as an input parameter of llr computation --- .../PHY/LTE_TRANSPORT/dlsch_demodulation.c | 6 ++- .../PHY/LTE_TRANSPORT/dlsch_llr_computation.c | 46 +++++++++++-------- openair1/PHY/LTE_TRANSPORT/proto.h | 8 +++- 3 files changed, 38 insertions(+), 22 deletions(-) diff --git a/openair1/PHY/LTE_TRANSPORT/dlsch_demodulation.c b/openair1/PHY/LTE_TRANSPORT/dlsch_demodulation.c index 0d7ed4f16d..b2e8218b37 100644 --- a/openair1/PHY/LTE_TRANSPORT/dlsch_demodulation.c +++ b/openair1/PHY/LTE_TRANSPORT/dlsch_demodulation.c @@ -739,7 +739,8 @@ int rx_pdsch(PHY_VARS_UE *phy_vars_ue, lte_ue_pdsch_vars[eNB_id]->dl_ch_mag0, symbol,first_symbol_flag,nb_rb, adjust_G2(frame_parms,dlsch0_harq->rb_alloc,4,subframe,symbol), - lte_ue_pdsch_vars[eNB_id]->llr128); + lte_ue_pdsch_vars[eNB_id]->llr128, + beamforming_mode); } else if (i_mod == 2) { dlsch_16qam_qpsk_llr(frame_parms, lte_ue_pdsch_vars[eNB_id]->rxdataF_comp0, @@ -785,7 +786,8 @@ int rx_pdsch(PHY_VARS_UE *phy_vars_ue, lte_ue_pdsch_vars[eNB_id]->dl_ch_magb0, symbol,first_symbol_flag,nb_rb, adjust_G2(frame_parms,dlsch0_harq->rb_alloc,6,subframe,symbol), - lte_ue_pdsch_vars[eNB_id]->llr128); + lte_ue_pdsch_vars[eNB_id]->llr128, + beamforming_mode); } else if (i_mod == 2) { dlsch_64qam_qpsk_llr(frame_parms, lte_ue_pdsch_vars[eNB_id]->rxdataF_comp0, diff --git a/openair1/PHY/LTE_TRANSPORT/dlsch_llr_computation.c b/openair1/PHY/LTE_TRANSPORT/dlsch_llr_computation.c index 951e4afcd0..9ff04cb0ec 100644 --- a/openair1/PHY/LTE_TRANSPORT/dlsch_llr_computation.c +++ b/openair1/PHY/LTE_TRANSPORT/dlsch_llr_computation.c @@ -1,4 +1,5 @@ -/******************************************************************************* +/* +***************************************************************************** OpenAirInterface Copyright(c) 1999 - 2014 Eurecom @@ -663,16 +664,15 @@ int dlsch_qpsk_llr(LTE_DL_FRAME_PARMS *frame_parms, if ((symbol_mod==0) || (symbol_mod==(4-frame_parms->Ncp))) { if (frame_parms->mode1_flag==0 && beamforming_mode!=7) - len = (nb_rb*8);// - (2*pbch_pss_sss_adjust/3); + len = (nb_rb*8) - (2*pbch_pss_sss_adjust/3); else - len = (nb_rb*10);// - (5*pbch_pss_sss_adjust/6); + len = (nb_rb*10) - (5*pbch_pss_sss_adjust/6); } else if((beamforming_mode==7) && (frame_parms->Ncp==0) && (symbol==3 || symbol==6 || symbol==9 || symbol==12)){ - len = (nb_rb*9); + len = (nb_rb*9) - (3*pbch_pss_sss_adjust/4); } else if((beamforming_mode==7) && (frame_parms->Ncp==1) && (symbol==4 || symbol==7 || symbol==10)){ - len = (nb_rb*8); - } - else { - len = (nb_rb*12);// - pbch_pss_sss_adjust; + len = (nb_rb*8) - (2*pbch_pss_sss_adjust/3); + } else { + len = (nb_rb*12) - pbch_pss_sss_adjust; } // printf("dlsch_qpsk_llr: symbol %d,nb_rb %d, len %d,pbch_pss_sss_adjust %d\n",symbol,nb_rb,len,pbch_pss_sss_adjust); @@ -702,7 +702,8 @@ void dlsch_16qam_llr(LTE_DL_FRAME_PARMS *frame_parms, uint8_t first_symbol_flag, unsigned short nb_rb, uint16_t pbch_pss_sss_adjust, - int16_t **llr32p) + int16_t **llr32p, + uint8_t beamforming_mode) { __m128i *rxF = (__m128i*)&rxdataF_comp[0][(symbol*frame_parms->N_RB_DL*12)]; @@ -724,12 +725,16 @@ void dlsch_16qam_llr(LTE_DL_FRAME_PARMS *frame_parms, ch_mag = (__m128i*)&dl_ch_mag[0][(symbol*frame_parms->N_RB_DL*12)]; if ((symbol_mod==0) || (symbol_mod==(4-frame_parms->Ncp))) { - if (frame_parms->mode1_flag==0) - len = nb_rb*8 - (2*pbch_pss_sss_adjust/3); + if (frame_parms->mode1_flag==0 && beamforming_mode!=7) + len = (nb_rb*8) - (2*pbch_pss_sss_adjust/3); else - len = nb_rb*10 - (5*pbch_pss_sss_adjust/6); + len = (nb_rb*10) - (5*pbch_pss_sss_adjust/6); + } else if((beamforming_mode==7) && (frame_parms->Ncp==0) && (symbol==3 || symbol==6 || symbol==9 || symbol==12)){ + len = (nb_rb*9) - (3*pbch_pss_sss_adjust/4); + } else if((beamforming_mode==7) && (frame_parms->Ncp==1) && (symbol==4 || symbol==7 || symbol==10)){ + len = (nb_rb*8) - (2*pbch_pss_sss_adjust/3); } else { - len = nb_rb*12 - pbch_pss_sss_adjust; + len = (nb_rb*12) - pbch_pss_sss_adjust; } // update output pointer according to number of REs in this symbol (<<2 because 4 bits per RE) @@ -778,7 +783,8 @@ void dlsch_64qam_llr(LTE_DL_FRAME_PARMS *frame_parms, uint8_t first_symbol_flag, unsigned short nb_rb, uint16_t pbch_pss_sss_adjust, - short **llr_save) + short **llr_save, + uint8_t beamforming_mode) { __m128i *rxF = (__m128i*)&rxdataF_comp[0][(symbol*frame_parms->N_RB_DL*12)]; @@ -799,12 +805,16 @@ void dlsch_64qam_llr(LTE_DL_FRAME_PARMS *frame_parms, ch_magb = (__m128i*)&dl_ch_magb[0][(symbol*frame_parms->N_RB_DL*12)]; if ((symbol_mod==0) || (symbol_mod==(4-frame_parms->Ncp))) { - if (frame_parms->mode1_flag==0) - len = nb_rb*8 - (2*pbch_pss_sss_adjust/3); + if (frame_parms->mode1_flag==0 && beamforming_mode!=7) + len = (nb_rb*8) - (2*pbch_pss_sss_adjust/3); else - len = nb_rb*10 - (5*pbch_pss_sss_adjust/6); + len = (nb_rb*10) - (5*pbch_pss_sss_adjust/6); + } else if((beamforming_mode==7) && (frame_parms->Ncp==0) && (symbol==3 || symbol==6 || symbol==9 || symbol==12)){ + len = (nb_rb*9) - (3*pbch_pss_sss_adjust/4); + } else if((beamforming_mode==7) && (frame_parms->Ncp==1) && (symbol==4 || symbol==7 || symbol==10)){ + len = (nb_rb*8) - (2*pbch_pss_sss_adjust/3); } else { - len = nb_rb*12 - pbch_pss_sss_adjust; + len = (nb_rb*12) - pbch_pss_sss_adjust; } llr2 = llr; diff --git a/openair1/PHY/LTE_TRANSPORT/proto.h b/openair1/PHY/LTE_TRANSPORT/proto.h index af67b54a96..3879c11db8 100644 --- a/openair1/PHY/LTE_TRANSPORT/proto.h +++ b/openair1/PHY/LTE_TRANSPORT/proto.h @@ -718,6 +718,7 @@ int32_t dlsch_qpsk_llr(LTE_DL_FRAME_PARMS *frame_parms, @param nb_rb number of RBs for this allocation @param pbch_pss_sss_adjust Adjustment factor in RE for PBCH/PSS/SSS allocations @param llr128p pointer to pointer to symbol in dlsch_llr + @param beamforming_mode beamforming mode */ void dlsch_16qam_llr(LTE_DL_FRAME_PARMS *frame_parms, @@ -728,7 +729,8 @@ void dlsch_16qam_llr(LTE_DL_FRAME_PARMS *frame_parms, uint8_t first_symbol_flag, uint16_t nb_rb, uint16_t pbch_pss_sss_adjust, - int16_t **llr128p); + int16_t **llr128p, + uint8_t beamforming_mode); /** \brief This function generates log-likelihood ratios (decoder input) for single-stream 16QAM received waveforms @@ -741,6 +743,7 @@ void dlsch_16qam_llr(LTE_DL_FRAME_PARMS *frame_parms, @param first_symbol_flag @param nb_rb number of RBs for this allocation @param pbch_pss_sss_adjust PBCH/PSS/SSS RE adjustment (in REs) + @param beamforming_mode beamforming mode */ void dlsch_64qam_llr(LTE_DL_FRAME_PARMS *frame_parms, int32_t **rxdataF_comp, @@ -751,7 +754,8 @@ void dlsch_64qam_llr(LTE_DL_FRAME_PARMS *frame_parms, uint8_t first_symbol_flag, uint16_t nb_rb, uint16_t pbch_pss_sss_adjust, - short **llr_save); + short **llr_save, + uint8_t beamforming_mode); /** \fn dlsch_siso(LTE_DL_FRAME_PARMS *frame_parms, int32_t **rxdataF_comp, From d09d042806e7f8a4159e57973cab78ddbc87d1ab Mon Sep 17 00:00:00 2001 From: Xiwen JIANG Date: Tue, 29 Sep 2015 17:00:17 +0200 Subject: [PATCH 013/349] bug fixed for symbols to activate beamforming channel estimation --- openair1/PHY/LTE_ESTIMATION/lte_dl_bf_channel_estimation.c | 1 - openair1/SIMULATION/LTE_PHY/dlsim.c | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/openair1/PHY/LTE_ESTIMATION/lte_dl_bf_channel_estimation.c b/openair1/PHY/LTE_ESTIMATION/lte_dl_bf_channel_estimation.c index 909c7bd12e..8b9405b499 100644 --- a/openair1/PHY/LTE_ESTIMATION/lte_dl_bf_channel_estimation.c +++ b/openair1/PHY/LTE_ESTIMATION/lte_dl_bf_channel_estimation.c @@ -81,7 +81,6 @@ int lte_dl_bf_channel_estimation(PHY_VARS_UE *phy_vars_ue, subframe = Ns>>1; - // if (beamforming_mode==7) { //generate ue specific pilots lprime = symbol/3-1; lte_dl_ue_spec_rx(phy_vars_ue,uespec_pilot,Ns,5,lprime,0,dlsch0_harq->nb_rb); diff --git a/openair1/SIMULATION/LTE_PHY/dlsim.c b/openair1/SIMULATION/LTE_PHY/dlsim.c index 96c6dfc14e..1b483b35f6 100644 --- a/openair1/SIMULATION/LTE_PHY/dlsim.c +++ b/openair1/SIMULATION/LTE_PHY/dlsim.c @@ -3364,7 +3364,7 @@ PMI_FEEDBACK: if (transmission_mode==7) { if (PHY_vars_UE->lte_frame_parms.Ncp==0) { if ((Ns==(2*subframe) && ((l==3) || (l==6))) || - Ns==(1+(2*subframe)) && ((l==3) || (l==6))) { + Ns==(1+(2*subframe)) && ((l==2) || (l==5))) { lte_dl_bf_channel_estimation(PHY_vars_UE,eNB_id,0,Ns,5,l+7*(Ns%2==1)); } } else { From b6b7bd1c1927adb68d43685093ab5bd979bb6c11 Mon Sep 17 00:00:00 2001 From: Xiwen JIANG Date: Thu, 1 Oct 2015 17:38:02 +0200 Subject: [PATCH 014/349] comment writing to file line --- openair1/PHY/LTE_ESTIMATION/lte_dl_bf_channel_estimation.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openair1/PHY/LTE_ESTIMATION/lte_dl_bf_channel_estimation.c b/openair1/PHY/LTE_ESTIMATION/lte_dl_bf_channel_estimation.c index 8b9405b499..faf366c520 100644 --- a/openair1/PHY/LTE_ESTIMATION/lte_dl_bf_channel_estimation.c +++ b/openair1/PHY/LTE_ESTIMATION/lte_dl_bf_channel_estimation.c @@ -84,7 +84,7 @@ int lte_dl_bf_channel_estimation(PHY_VARS_UE *phy_vars_ue, //generate ue specific pilots lprime = symbol/3-1; lte_dl_ue_spec_rx(phy_vars_ue,uespec_pilot,Ns,5,lprime,0,dlsch0_harq->nb_rb); - write_output("uespec_pilot_rx.m","uespec_pilot",uespec_pilot,300,1,1); + //write_output("uespec_pilot_rx.m","uespec_pilot",uespec_pilot,300,1,1); if (frame_parms->Ncp==0){ if (symbol==3 || symbol==6 || symbol==9 || symbol==12) From dc636f2b44e7f3e8a6089e32af73ebadde68e479 Mon Sep 17 00:00:00 2001 From: Xiwen JIANG Date: Thu, 1 Oct 2015 17:42:20 +0200 Subject: [PATCH 015/349] calculate channel level for TM7 --- .../PHY/LTE_TRANSPORT/dlsch_demodulation.c | 74 ++++++++++++++++++- openair1/PHY/LTE_TRANSPORT/proto.h | 6 ++ 2 files changed, 78 insertions(+), 2 deletions(-) diff --git a/openair1/PHY/LTE_TRANSPORT/dlsch_demodulation.c b/openair1/PHY/LTE_TRANSPORT/dlsch_demodulation.c index b2e8218b37..e87519225b 100644 --- a/openair1/PHY/LTE_TRANSPORT/dlsch_demodulation.c +++ b/openair1/PHY/LTE_TRANSPORT/dlsch_demodulation.c @@ -280,8 +280,8 @@ int rx_pdsch(PHY_VARS_UE *phy_vars_ue, avg, symbol, nb_rb); - else - dlsch_channel_level(lte_ue_pdsch_vars[eNB_id]->dl_bf_ch_estimates_ext, + else if (beamforming_mode==7) + dlsch_channel_level_TM7(lte_ue_pdsch_vars[eNB_id]->dl_bf_ch_estimates_ext, frame_parms, avg, symbol, @@ -2972,6 +2972,76 @@ void dlsch_channel_level_TM56(int **dl_ch_estimates_ext, #endif } +//compute average channel_level for TM7 +void dlsch_channel_level_TM7(int **dl_bf_ch_estimates_ext, + LTE_DL_FRAME_PARMS *frame_parms, + int *avg, + uint8_t symbol, + unsigned short nb_rb) +{ + +#if defined(__x86_64__)||defined(__i386__) + + short rb; + unsigned char aatx,aarx,nre=12,symbol_mod; + __m128i *dl_ch128,avg128D; + + symbol_mod = (symbol>=(7-frame_parms->Ncp)) ? symbol-(7-frame_parms->Ncp) : symbol; + + for (aatx=0; aatxnb_antennas_tx_eNB; aatx++) + for (aarx=0; aarxnb_antennas_rx; aarx++) { + //clear average level + avg128D = _mm_setzero_si128(); + // 5 is always a symbol with no pilots for both normal and extended prefix + + dl_ch128=(__m128i *)&dl_bf_ch_estimates_ext[(aatx<<1)+aarx][symbol*frame_parms->N_RB_DL*12]; + + for (rb=0; rbNcp-1)))&&(frame_parms->mode1_flag==0)) { + dl_ch128+=2; + } else { + avg128D = _mm_add_epi32(avg128D,_mm_madd_epi16(dl_ch128[2],dl_ch128[2])); + dl_ch128+=3; + } + + /* + if (rb==0) { + print_shorts("dl_ch128",&dl_ch128[0]); + print_shorts("dl_ch128",&dl_ch128[1]); + print_shorts("dl_ch128",&dl_ch128[2]); + } + */ + } + + if (((symbol_mod == 0) || (symbol_mod == (frame_parms->Ncp-1)))) + nre=10; + else if ((frame_parms->Ncp==0) && (symbol==3 || symbol==6 || symbol==9 || symbol==12)) + nre=9; + else if ((frame_parms->Ncp==1) && (symbol==4 || symbol==7 || symbol==9)) + nre=8; + else + nre=12; + + avg[(aatx<<1)+aarx] = (((int*)&avg128D)[0] + + ((int*)&avg128D)[1] + + ((int*)&avg128D)[2] + + ((int*)&avg128D)[3])/(nb_rb*nre); + + // printf("Channel level : %d\n",avg[(aatx<<1)+aarx]); + } + + _mm_empty(); + _m_empty(); + +#elif defined(__arm__) + +#endif +} void dlsch_alamouti(LTE_DL_FRAME_PARMS *frame_parms, int **rxdataF_comp, diff --git a/openair1/PHY/LTE_TRANSPORT/proto.h b/openair1/PHY/LTE_TRANSPORT/proto.h index 3879c11db8..0bb327aa8a 100644 --- a/openair1/PHY/LTE_TRANSPORT/proto.h +++ b/openair1/PHY/LTE_TRANSPORT/proto.h @@ -1046,6 +1046,12 @@ void dlsch_channel_level_TM56(int32_t **dl_ch_estimates_ext, uint8_t symbol_mod, uint16_t nb_rb); +void dlsch_channel_level_TM7(int32_t **dl_bf_ch_estimates_ext, + LTE_DL_FRAME_PARMS *frame_parms, + int32_t *avg, + uint8_t pilots_flag, + uint16_t nb_rb); + void dlsch_scale_channel(int32_t **dl_ch_estimates_ext, LTE_DL_FRAME_PARMS *frame_parms, LTE_UE_DLSCH_t **dlsch_ue, From 7882472b73bfbf77ca6b4ba6e054bf6450facd3d Mon Sep 17 00:00:00 2001 From: Xiwen JIANG Date: Thu, 1 Oct 2015 17:43:46 +0200 Subject: [PATCH 016/349] revert dlsch_llr_computation --- openair1/PHY/LTE_TRANSPORT/dlsch_llr_computation.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/openair1/PHY/LTE_TRANSPORT/dlsch_llr_computation.c b/openair1/PHY/LTE_TRANSPORT/dlsch_llr_computation.c index 9ff04cb0ec..551043ea96 100644 --- a/openair1/PHY/LTE_TRANSPORT/dlsch_llr_computation.c +++ b/openair1/PHY/LTE_TRANSPORT/dlsch_llr_computation.c @@ -663,7 +663,7 @@ int dlsch_qpsk_llr(LTE_DL_FRAME_PARMS *frame_parms, if ((symbol_mod==0) || (symbol_mod==(4-frame_parms->Ncp))) { - if (frame_parms->mode1_flag==0 && beamforming_mode!=7) + if (frame_parms->mode1_flag==0) len = (nb_rb*8) - (2*pbch_pss_sss_adjust/3); else len = (nb_rb*10) - (5*pbch_pss_sss_adjust/6); @@ -725,7 +725,7 @@ void dlsch_16qam_llr(LTE_DL_FRAME_PARMS *frame_parms, ch_mag = (__m128i*)&dl_ch_mag[0][(symbol*frame_parms->N_RB_DL*12)]; if ((symbol_mod==0) || (symbol_mod==(4-frame_parms->Ncp))) { - if (frame_parms->mode1_flag==0 && beamforming_mode!=7) + if (frame_parms->mode1_flag==0) len = (nb_rb*8) - (2*pbch_pss_sss_adjust/3); else len = (nb_rb*10) - (5*pbch_pss_sss_adjust/6); @@ -805,7 +805,7 @@ void dlsch_64qam_llr(LTE_DL_FRAME_PARMS *frame_parms, ch_magb = (__m128i*)&dl_ch_magb[0][(symbol*frame_parms->N_RB_DL*12)]; if ((symbol_mod==0) || (symbol_mod==(4-frame_parms->Ncp))) { - if (frame_parms->mode1_flag==0 && beamforming_mode!=7) + if (frame_parms->mode1_flag==0) len = (nb_rb*8) - (2*pbch_pss_sss_adjust/3); else len = (nb_rb*10) - (5*pbch_pss_sss_adjust/6); From b40ed6af9ba73870fa9f232bccd3e872a7c97649 Mon Sep 17 00:00:00 2001 From: Xiwen JIANG Date: Fri, 2 Oct 2015 11:44:30 +0200 Subject: [PATCH 017/349] TM7 works for dlsim. --- openair1/SIMULATION/LTE_PHY/dlsim.c | 67 +++++++++++++++++++---------- targets/RT/USER/Makefile | 10 +++-- 2 files changed, 51 insertions(+), 26 deletions(-) diff --git a/openair1/SIMULATION/LTE_PHY/dlsim.c b/openair1/SIMULATION/LTE_PHY/dlsim.c index 1b483b35f6..27ca4b8fbd 100644 --- a/openair1/SIMULATION/LTE_PHY/dlsim.c +++ b/openair1/SIMULATION/LTE_PHY/dlsim.c @@ -253,7 +253,8 @@ int main(int argc, char **argv) double forgetting_factor=0.0; //in [0,1] 0 means a new channel every time, 1 means keep the same channel double iqim=0.0; - uint8_t extended_prefix_flag=0,transmission_mode=1,n_tx=1,n_rx=2,n_tx_phy=1; + uint8_t extended_prefix_flag=0,transmission_mode=1,n_tx=1,n_rx=1; + uint16_t n_tx_phy=1; uint16_t Nid_cell=0; int32_t **beamforming_weights; @@ -564,8 +565,9 @@ int main(int argc, char **argv) exit(-1); } - if (transmission_mode==7 && (n_tx_phy!=1 && n_tx_phy!=2 && n_tx_phy!=4 && n_tx_phy!=8 && n_tx_phy!=16 && n_tx_phy!=64)) { - msg("For TM7, physical antenna number should be an exponent of 2, maximum 64 antennas supported.\n"); + //if (transmission_mode==7 && (n_tx_phy!=1 && n_tx_phy!=2 && n_tx_phy!=4 && n_tx_phy!=8 && n_tx_phy!=16 && n_tx_phy!=64 && n_tx_phy!=128)) { + if (transmission_mode==7 && (n_tx_phy!=1 && n_tx_phy!=4 && n_tx_phy!=16 && n_tx_phy!=64)) { + msg("For TM7, physical antenna number should be an exponent of 4, maximum 64 antennas supported.\n"); exit(-1); } @@ -723,8 +725,10 @@ int main(int argc, char **argv) NB_RB=conv_nprb(0,DLSCH_RB_ALLOC,N_RB_DL); - if ((transmission_mode > 1) && (n_tx_phy == 1)) - printf("n_tx_phy must be >1 for transmission_mode %d\n",transmission_mode); + if ((transmission_mode>1&&transmission_mode<7) && (n_tx_phy == 1)){ + msg("n_tx_phy must be >1 for transmission_mode %d\n",transmission_mode); + exit(-1); + } #ifdef XFORMS fl_initialize (&argc, argv, NULL, 0, 0); @@ -756,10 +760,19 @@ int main(int argc, char **argv) beamforming_weights = (int32_t **)malloc(12*N_RB_DL*sizeof(int32_t*)); for(re=0;re<12*N_RB_DL;re++){ beamforming_weights[re]=(int32_t *)malloc(n_tx_phy*sizeof(int32_t)); - for(aa=0;aa>(n_tx_phy>>1); + for(aa=0;aa>1; + else if (n_tx_phy==16) + beamforming_weights[re][aa] = 0x00007fff>>2; + else if (n_tx_phy==64) + beamforming_weights[re][aa] = 0x00007fff>>3; + } } + printf("***n_tx_phy=%d,n_tx_phy>>2=%d,beamforming_weights=%d\n",n_tx_phy,n_tx_phy>>2,beamforming_weights[0][0]); } eNB_id_i = PHY_vars_UE->n_connected_eNB; @@ -799,9 +812,9 @@ int main(int argc, char **argv) SCM_A, SCM_B, SCM_C, SCM_D, EPA, EVA, ETU, Rayleigh8, Rayleigh1, Rayleigh1_corr, Rayleigh1_anticorr, Rice1, Rice8); if(transmission_mode==5) - sprintf(bler_fname,"bler_tx%d_chan%d_nrx%d_mcs%d_mcsi%d_u%d_imod%d.csv",transmission_mode,channel_model,n_rx,mcs1,mcs_i,dual_stream_UE,i_mod); + sprintf(bler_fname,"bler_tm%d_chan%d_perfce%d_ntx%d_nrx%d_mcs%d_mcsi%d_u%d_imod%d.csv",transmission_mode,channel_model,perfect_ce,n_tx_phy,n_rx,mcs1,mcs_i,dual_stream_UE,i_mod); else - sprintf(bler_fname,"bler_tx%d_chan%d_nrx%d_mcs%d.csv",transmission_mode,channel_model,n_rx,mcs1); + sprintf(bler_fname,"bler_tm%d_chan%d_perfce%d_ntx%d_nrx%d_mcs%d.csv",transmission_mode,channel_model,perfect_ce,n_tx_phy,n_rx,mcs1); bler_fd = fopen(bler_fname,"w"); fprintf(bler_fd,"SNR; MCS; TBS; rate; err0; trials0; err1; trials1; err2; trials2; err3; trials3; dci_err\n"); @@ -2167,7 +2180,7 @@ int main(int argc, char **argv) ret = PHY_vars_UE->dlsch_ue[0][0]->max_turbo_iterations+1; while ((round < num_rounds) && (ret > PHY_vars_UE->dlsch_ue[0][0]->max_turbo_iterations)) { - printf("Trial %d, round %d\n",trials,round); + //printf("Trial %d, round %d\n",trials,round); round_trials[round]++; if(transmission_mode>=5&&transmission_mode<7) @@ -2185,8 +2198,9 @@ int main(int argc, char **argv) PMI_FEEDBACK: - printf("Trial %d : Round %d, pmi_feedback %d \n",trials,round,pmi_feedback); - for (aa=0; aalte_frame_parms.nb_antennas_tx; aa++) { + //printf("Trial %d : Round %d, pmi_feedback %d \n",trials,round,pmi_feedback); + //for (aa=0; aalte_frame_parms.nb_antennas_tx; aa++) { + for (aa=0; aanb_antennas_tx_phy; aa++) { memset(&PHY_vars_eNB->lte_eNB_common_vars.txdataF[eNB_id][aa][0],0,FRAME_LENGTH_COMPLEX_SAMPLES_NO_PREFIX*sizeof(mod_sym_t)); } @@ -3025,10 +3039,10 @@ PMI_FEEDBACK: for (i=0; i<2*frame_parms->samples_per_tti; i++) { for (aa=0; aalte_frame_parms.nb_antennas_rx; aa++) { // printf("s_re[0][%d]=> %f , r_re[0][%d]=> %f\n",i,s_re[aa][i],i,r_re[aa][i]); - /*((short*) PHY_vars_UE->lte_ue_common_vars.rxdata[aa])[(2*subframe*PHY_vars_UE->lte_frame_parms.samples_per_tti)+2*i] = - (short) (r_re[aa][i] + sqrt(sigma2/2)*gaussdouble(0.0,1.0)); - ((short*) PHY_vars_UE->lte_ue_common_vars.rxdata[aa])[(2*subframe*PHY_vars_UE->lte_frame_parms.samples_per_tti)+2*i+1] = - (short) (r_im[aa][i] + (iqim*r_re[aa][i]) + sqrt(sigma2/2)*gaussdouble(0.0,1.0));*/ + //((short*) PHY_vars_UE->lte_ue_common_vars.rxdata[aa])[(2*subframe*PHY_vars_UE->lte_frame_parms.samples_per_tti)+2*i] = + // (short) (r_re[aa][i] + sqrt(sigma2/2)*gaussdouble(0.0,1.0)); + // ((short*) PHY_vars_UE->lte_ue_common_vars.rxdata[aa])[(2*subframe*PHY_vars_UE->lte_frame_parms.samples_per_tti)+2*i+1] = + // (short) (r_im[aa][i] + (iqim*r_re[aa][i]) + sqrt(sigma2/2)*gaussdouble(0.0,1.0)); ((short*) PHY_vars_UE->lte_ue_common_vars.rxdata[aa])[(2*subframe*PHY_vars_UE->lte_frame_parms.samples_per_tti)+2*i] = (short) r_re[aa][i]; ((short*) PHY_vars_UE->lte_ue_common_vars.rxdata[aa])[(2*subframe*PHY_vars_UE->lte_frame_parms.samples_per_tti)+2*i+1] = (short) r_im[aa][i]; //printf("rxdata[%d][%d]=> %d, %d\n",aa,subframe*PHY_vars_UE->lte_frame_parms.samples_per_tti+i,r_re[aa][i],r_im[aa][i]); @@ -3081,7 +3095,7 @@ PMI_FEEDBACK: for (Ns=(2*subframe); Ns<((2*subframe)+3); Ns++) { for (l=0; llte_ue_common_vars.dl_ch_estimates[0][(aa<<1)+aarx])[2*i+((l+(Ns%2)*pilot2)*frame_parms->ofdm_symbol_size+LTE_CE_FILTER_LENGTH)*2]=(short)(AMP); ((int16_t *) PHY_vars_UE->lte_ue_common_vars.dl_ch_estimates[0][(aa<<1)+aarx])[2*i+1+((l+(Ns%2)*pilot2)*frame_parms->ofdm_symbol_size+LTE_CE_FILTER_LENGTH)*2]=0/2; if (transmission_mode == 7){ - ((int16_t *) PHY_vars_UE->lte_ue_pdsch_vars[0]->dl_bf_ch_estimates[(aa<<1)+aarx])[2*i+((l+(Ns%2)*pilot2)*frame_parms->ofdm_symbol_size)*2]=(short)(AMP); - ((int16_t *) PHY_vars_UE->lte_ue_pdsch_vars[0]->dl_bf_ch_estimates[(aa<<1)+aarx])[2*i+1+((l+(Ns%2)*pilot2)*frame_parms->ofdm_symbol_size)*2]=0/2; - + if (PHY_vars_UE->high_speed_flag==0){ + ((int16_t *) PHY_vars_UE->lte_ue_pdsch_vars[0]->dl_bf_ch_estimates[(aa<<1)+aarx])[2*i]=(short)(AMP); + ((int16_t *) PHY_vars_UE->lte_ue_pdsch_vars[0]->dl_bf_ch_estimates[(aa<<1)+aarx])[2*i+1]=0/2; + } else { + ((int16_t *) PHY_vars_UE->lte_ue_pdsch_vars[0]->dl_bf_ch_estimates[(aa<<1)+aarx])[2*i+((l+(Ns%2)*pilot2)*frame_parms->ofdm_symbol_size)*2]=(short)(AMP); + ((int16_t *) PHY_vars_UE->lte_ue_pdsch_vars[0]->dl_bf_ch_estimates[(aa<<1)+aarx])[2*i+1+((l+(Ns%2)*pilot2)*frame_parms->ofdm_symbol_size)*2]=0/2; + } } } } @@ -3365,7 +3383,8 @@ PMI_FEEDBACK: if (PHY_vars_UE->lte_frame_parms.Ncp==0) { if ((Ns==(2*subframe) && ((l==3) || (l==6))) || Ns==(1+(2*subframe)) && ((l==2) || (l==5))) { - lte_dl_bf_channel_estimation(PHY_vars_UE,eNB_id,0,Ns,5,l+7*(Ns%2==1)); + if (perfect_ce==0) + lte_dl_bf_channel_estimation(PHY_vars_UE,eNB_id,0,Ns,5,l+7*(Ns%2==1)); } } else { msg("Beamforming channel estimation not supported yet for TM7 extented CP.\n"); @@ -4297,10 +4316,14 @@ PMI_FEEDBACK: free(r_im[i]); } + for(i=0;i<12*N_RB_DL;i++) + free(beamforming_weights[i]); + free(s_re); free(s_im); free(r_re); free(r_im); + free(beamforming_weights); // lte_sync_time_free(); diff --git a/targets/RT/USER/Makefile b/targets/RT/USER/Makefile index 531907d6af..72f9587e0a 100644 --- a/targets/RT/USER/Makefile +++ b/targets/RT/USER/Makefile @@ -194,7 +194,7 @@ CFLAGS += -DHARD_RT endif ifeq ($(EMOS),1) -CFLAGS += -D_FILE_OFFSET_BITS=64 -DEMOS #-DEMOS_CHANNEL +CFLAGS += -D_FILE_OFFSET_BITS=64 #-DEMOS -DEMOS_CHANNEL LDFLAGS += -lgps endif @@ -317,10 +317,12 @@ synctest_UE: synctest cp synctest synctest_UE drivers: - cd $(OPENAIR2_DIR) && make clean && make nasmesh_netlink.ko - cd $(OPENAIR2_DIR)/NAS/DRIVER/MESH/RB_TOOL && make clean && make - cd $(OPENAIR_TARGETS)/ARCH/EXMIMO/DRIVER/eurecom && make clean && make +# cd $(OPENAIR2_DIR) && make clean && make nasmesh_netlink.ko +# cd $(OPENAIR2_DIR)/NAS/DRIVER/MESH/RB_TOOL && make clean && make + cd $(OPENAIR_TARGETS)/ARCH/EXMIMO/DRIVER/eurecom && make clean && make + cp $(OPENAIR_TARGETS)/ARCH/EXMIMO/DRIVER/eurecom/openair_rf.ko $(OPENAIR_TARGETS)/bin/. cd $(OPENAIR_TARGETS)/ARCH/EXMIMO/USERSPACE/OAI_FW_INIT && make clean && make + cp $(OPENAIR_TARGETS)/ARCH/EXMIMO/USERSPACE/OAI_FW_INIT/updatefw $(OPENAIR_TARGETS)/bin/. run: condtest rtai-load condtest --verbose From fac6a63f670e0f016cf00b6aaf967625b629c7bc Mon Sep 17 00:00:00 2001 From: Xiwen JIANG Date: Mon, 5 Oct 2015 15:41:18 +0200 Subject: [PATCH 018/349] adding new file --- openair1/PHY/LTE_REFSIG/lte_dl_uespec.c | 396 ++++++++++++++++++++++++ 1 file changed, 396 insertions(+) create mode 100644 openair1/PHY/LTE_REFSIG/lte_dl_uespec.c diff --git a/openair1/PHY/LTE_REFSIG/lte_dl_uespec.c b/openair1/PHY/LTE_REFSIG/lte_dl_uespec.c new file mode 100644 index 0000000000..d029f959ed --- /dev/null +++ b/openair1/PHY/LTE_REFSIG/lte_dl_uespec.c @@ -0,0 +1,396 @@ +/******************************************************************************* + OpenAirInterface + Copyright(c) 1999 - 2014 Eurecom + + OpenAirInterface is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + + OpenAirInterface is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with OpenAirInterface.The full GNU General Public License is + included in this distribution in the file called "COPYING". If not, + see . + + Contact Information + OpenAirInterface Admin: openair_admin@eurecom.fr + OpenAirInterface Tech : openair_tech@eurecom.fr + OpenAirInterface Dev : openair4g-devel@eurecom.fr + + Address : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE + + *******************************************************************************/ + +/*! \file PHY/LTE_REFSIG/lte_dl_ue_spec.c +* \brief Top-level routines for generating UE-specific Reference signals from 36-211, V11.3.0 2013-06 +* \author R. Knopp X. Jiang +* \date 2015 +* \version 0.1 +* \company Eurecom +* \email: knopp@eurecom.fr xiwen.jiang@eurecom.fr +* \note +* \warning +*/ + +#ifdef USER_MODE +#include +#include +#endif + +#include "defs.h" +#include "PHY/defs.h" +#include "log.h" + +//extern unsigned int lte_gold_table[3][20][2][14]; +//#define DEBUG_DL_CELL_SPEC + +int Wbar_NCP[8][4] = {{1,1,1,1},{1,-1,1,-1},{1,1,1,1},{1,-1,1,-1},{1,1,-1,-1},{-1,-1,1,1},{1,-1,-1,1},{-1,1,1,-1}}; + +/* +int lte_dl_ue_spec(PHY_VARS_eNB *phy_vars_eNB, + uint8_t UE_id, + mod_sym_t *output, + short amp, + uint8_t Ns, + uint8_t lprime, + uint8_t p, + int SS_flag) +{ + + mod_sym_t qpsk[4],nqpsk[4]; + int16_t k=0,a; + int mprime,ind,ind_dword,ind_qpsk_symb; + unsigned nushift,kprime; + // LTE_eNB_DLSCH_t *dlsch = phy_vars_eNB->dlsch_eNB[UE_id][0]; + + a = (amp*ONE_OVER_SQRT2_Q15)>>15; + ((short *)&qpsk[0])[0] = a; + ((short *)&qpsk[0])[1] = a; + ((short *)&qpsk[1])[0] = -a; + ((short *)&qpsk[1])[1] = a; + ((short *)&qpsk[2])[0] = a; + ((short *)&qpsk[2])[1] = -a; + ((short *)&qpsk[3])[0] = -a; + ((short *)&qpsk[3])[1] = -a; + + ((short *)&nqpsk[0])[0] = -a; + ((short *)&nqpsk[0])[1] = -a; + ((short *)&nqpsk[1])[0] = a; + ((short *)&nqpsk[1])[1] = -a; + ((short *)&nqpsk[2])[0] = -a; + ((short *)&nqpsk[2])[1] = a; + ((short *)&nqpsk[3])[0] = a; + ((short *)&nqpsk[3])[1] = a; + + if (p==5) { + if (SS_flag==0) { + if (phy_vars_eNB->lte_frame_parms.Ncp == NORMAL) { + // this is 3GPP 36-211 6.10.3.2, NORMAL CP, p=5 + + nushift = phy_vars_eNB->lte_frame_parms.Nid_cell%3; + + if(lprime==0){ + kprime=nushift; + }else{ + kprime=(nushift+2*lprime)%4; + } + + k = kprime+phy_vars_eNB->lte_frame_parms.first_carrier_offset; + printf("lte_dl_ue_spec:k=%d\n",k); + + for (mprime=0;mprime<3*nRB_PDSCH-1;mprime++) { + ind = 3*lprime*nRB_PDSCH+mprime; + ind_dword = ind>>4; + ind_qpsk_symb = ind&0xf; + + output[k] = qpsk[(phy_vars_UE->lte_gold_uespec_port5_table[Ns][ind_dword]>>(2*ind_qpsk_symb))&3]; + //output[k] = 0xffffffff; + + k += 4; + if (k >= phy_vars_eNB->lte_frame_parms.ofdm_symbol_size) { + k++; // skip DC carrier + k-=phy_vars_eNB->lte_frame_parms.ofdm_symbol_size; + } + + } + } + } + } else if (p>=7) { + printf("lte_dl_ue_spec:antenna ports >=7 not supported yet!\n"); + } else { + LOG_E(PHY,"Illegal p %d UE specific pilots\n",p); + } + + return(0); +} +*/ + + +int lte_dl_ue_spec_rx(PHY_VARS_UE *phy_vars_ue, + mod_sym_t *output, + unsigned char Ns, + unsigned char p, + int lprime, + int SS_flag, + uint16_t nRB_PDSCH) +{ + mod_sym_t qpsk[4],nqpsk[4],*qpsk_p,*output_p; + int w,mprime,ind,l,ind_dword,ind_qpsk_symb,nPRB; + short pamp; + + // Compute the correct pilot amplitude, sqrt_rho_b = Q3.13 + pamp = ONE_OVER_SQRT2_Q15; + + // This includes complex conjugate for channel estimation + ((short *)&qpsk[0])[0] = pamp; + ((short *)&qpsk[0])[1] = -pamp; + ((short *)&qpsk[1])[0] = -pamp; + ((short *)&qpsk[1])[1] = -pamp; + ((short *)&qpsk[2])[0] = pamp; + ((short *)&qpsk[2])[1] = pamp; + ((short *)&qpsk[3])[0] = -pamp; + ((short *)&qpsk[3])[1] = pamp; + + ((short *)&nqpsk[0])[0] = -pamp; + ((short *)&nqpsk[0])[1] = pamp; + ((short *)&nqpsk[1])[0] = pamp; + ((short *)&nqpsk[1])[1] = pamp; + ((short *)&nqpsk[2])[0] = -pamp; + ((short *)&nqpsk[2])[1] = -pamp; + ((short *)&nqpsk[3])[0] = pamp; + ((short *)&nqpsk[3])[1] = -pamp; + + if (p>=7) { + if (SS_flag==0) { + if (phy_vars_ue->lte_frame_parms.Ncp == NORMAL) { + // this is 3GPP 36-211 6.10.3.2, NORMAL CP, p>=7 + + output_p = output; + + ind = 3*lprime*phy_vars_ue->lte_frame_parms.N_RB_DL; + l = lprime + ((Ns&1)<<1); + + // loop over pairs of PRBs, this is the periodicity of the W_bar_NCP sequence + // unroll the computations for the 6 pilots, select qpsk or nqpsk as function of W_bar_NCP + for (nPRB=0; nPRBlte_frame_parms.N_RB_DL; nPRB+=2) { + + // First pilot + w = Wbar_NCP[p-7][l]; + qpsk_p = (w==1) ? qpsk : nqpsk; + + + ind_dword = ind>>4; + ind_qpsk_symb = ind&0xf; + + *output_p = qpsk_p[(phy_vars_ue->lte_gold_uespec_table[0][Ns][lprime][ind_dword]>>(2*ind_qpsk_symb))&3]; + + +#ifdef DEBUG_DL_UESPEC + LOG_D(PHY,"Ns %d, l %d, m %d,ind_dword %d, ind_qpsk_symbol %d\n", + Ns,l,m,ind_dword,ind_qpsk_symb); + LOG_D(PHY,"index = %d\n",(phy_vars_eNB->lte_gold_uespec_table[0][Ns][lprime][ind_dword]>>(2*ind_qpsk_symb))&3); +#endif + + output_p++; + ind++; + + w = Wbar_NCP[p-7][3-l]; + qpsk_p = (w==1) ? qpsk : nqpsk; + + // Second pilot + ind_dword = ind>>4; + ind_qpsk_symb = ind&0xf; + + *output_p = qpsk_p[(phy_vars_ue->lte_gold_uespec_table[0][Ns][lprime][ind_dword]>>(2*ind_qpsk_symb))&3]; + +#ifdef DEBUG_DL_UESPEC + LOG_D(PHY,"Ns %d, l %d, m %d,ind_dword %d, ind_qpsk_symbol %d\n", + Ns,l,m,ind_dword,ind_qpsk_symb); + LOG_D(PHY,"index = %d\n",(phy_vars_ue->lte_gold_uespec_table[0][Ns][lprime][ind_dword]>>(2*ind_qpsk_symb))&3); +#endif + + output_p++; + ind++; + + w = Wbar_NCP[p-7][l]; + qpsk_p = (w==1) ? qpsk : nqpsk; + // Third pilot + ind_dword = ind>>4; + ind_qpsk_symb = ind&0xf; + + *output_p = qpsk_p[(phy_vars_ue->lte_gold_uespec_table[0][Ns][lprime][ind_dword]>>(2*ind_qpsk_symb))&3]; + +#ifdef DEBUG_DL_UESPEC + LOG_D(PHY,"Ns %d, l %d, m %d,ind_dword %d, ind_qpsk_symbol %d\n", + Ns,l,m,ind_dword,ind_qpsk_symb); + LOG_D(PHY,"index = %d\n",(phy_vars_eNB->lte_gold_uespec_table[0][Ns][lprime][ind_dword]>>(2*ind_qpsk_symb))&3); +#endif + + output_p++; + ind++; + + // Fourth pilot + w = Wbar_NCP[p-7][3-l]; + qpsk_p = (w==1) ? qpsk : nqpsk; + + + ind_dword = ind>>4; + ind_qpsk_symb = ind&0xf; + + *output_p = qpsk_p[(phy_vars_ue->lte_gold_uespec_table[0][Ns][lprime][ind_dword]>>(2*ind_qpsk_symb))&3]; + + +#ifdef DEBUG_DL_UESPEC + LOG_D(PHY,"Ns %d, l %d, m %d,ind_dword %d, ind_qpsk_symbol %d\n", + Ns,l,m,ind_dword,ind_qpsk_symb); + LOG_D(PHY,"index = %d\n",(phy_vars_ue->lte_gold_uespec_table[0][Ns][lprime][ind_dword]>>(2*ind_qpsk_symb))&3); +#endif + + output_p++; + ind++; + + w = Wbar_NCP[p-7][l]; + qpsk_p = (w==1) ? qpsk : nqpsk; + + // Fifth pilot + ind_dword = ind>>4; + ind_qpsk_symb = ind&0xf; + + *output_p = qpsk_p[(phy_vars_ue->lte_gold_uespec_table[0][Ns][lprime][ind_dword]>>(2*ind_qpsk_symb))&3]; + +#ifdef DEBUG_DL_UESPEC + LOG_D(PHY,"Ns %d, l %d, m %d,ind_dword %d, ind_qpsk_symbol %d\n", + Ns,l,m,ind_dword,ind_qpsk_symb); + LOG_D(PHY,"index = %d\n",(phy_vars_ue->lte_gold_uespec_table[0][Ns][lprime][ind_dword]>>(2*ind_qpsk_symb))&3); +#endif + + output_p++; + ind++; + + w = Wbar_NCP[p-7][3-l]; + qpsk_p = (w==1) ? qpsk : nqpsk; + // Sixth pilot + ind_dword = ind>>4; + ind_qpsk_symb = ind&0xf; + + *output_p = qpsk_p[(phy_vars_ue->lte_gold_uespec_table[0][Ns][lprime][ind_dword]>>(2*ind_qpsk_symb))&3]; + +#ifdef DEBUG_DL_UESPEC + LOG_D(PHY,"Ns %d, l %d, m %d,ind_dword %d, ind_qpsk_symbol %d\n", + Ns,l,m,ind_dword,ind_qpsk_symb); + LOG_D(PHY,"index = %d\n",(phy_vars_ue->lte_gold_uespec_table[0][Ns][lprime][ind_dword]>>(2*ind_qpsk_symb))&3); +#endif + + output_p++; + ind++; + } + } else { + LOG_E(PHY,"Special subframe not supported for UE specific pilots yet\n"); + } + } + } else if (p==5) { + if (SS_flag==0) { + output_p = output; + + if (phy_vars_ue->lte_frame_parms.Ncp == NORMAL) { + for (mprime=0;mprime<3*nRB_PDSCH;mprime++) { + + ind = 3*lprime*nRB_PDSCH+mprime; + ind_dword = ind>>4; + ind_qpsk_symb = ind&0xf; + + *output_p = qpsk[(phy_vars_ue->lte_gold_uespec_port5_table[Ns][ind_dword]>>(2*ind_qpsk_symb))&3]; + //printf("lprime=%d,ind=%d,Ns=%d,output_p=(%d,%d)\n",lprime,ind,Ns,((short *)&output_p[0])[0],((short *)&output_p[0])[1]); + output_p++; + + } + } + } + } else { + LOG_E(PHY,"Illegal p %d UE specific pilots\n",p); + } + + return(0); +} + + + +#ifdef LTE_DL_CELL_SPEC_MAIN + + + +//extern int write_output(const char *,const char *,void *,int,int,char); +// flag change eren +extern int write_output(const char *,const char *,void *,int,int,char); +main() +{ + + unsigned short Nid_cell=0; + unsigned int Ncp = 0; + int output00[1024]; + int output01[1024]; + int output10[1024]; + int output11[1024]; + + memset(output00,0,1024*sizeof(int)); + memset(output01,0,1024*sizeof(int)); + memset(output10,0,1024*sizeof(int)); + memset(output11,0,1024*sizeof(int)); + + lte_gold(Nid_cell,Ncp); + + lte_dl_ue_spec(output00, + ONE_OVER_SQRT2_Q15, + 50, + Nid_cell, + Ncp, + 0, + 0, + 0, + 0); + + lte_dl_ue_spec(output10, + ONE_OVER_SQRT2_Q15, + 50, + Nid_cell, + Ncp, + 0, + 1, + 0, + 0); + + lte_dl_ue_spec(output01, + ONE_OVER_SQRT2_Q15, + 50, + Nid_cell, + Ncp, + 0, + 0, + 1, + 0); + + lte_dl_ue_spec(output11, + ONE_OVER_SQRT2_Q15, + 50, + Nid_cell, + Ncp, + 0, + 1, + 1, + 0); + + + write_output("dl_ue_spec00.m","dl_cs00",output00,1024,1,1); + write_output("dl_ue_spec01.m","dl_cs01",output01,1024,1,1); + write_output("dl_ue_spec10.m","dl_cs10",output10,1024,1,1); + write_output("dl_ue_spec11.m","dl_cs11",output11,1024,1,1); +} + + +#endif From 67262694de414a9dda8156cac8d1eb5d62f44369 Mon Sep 17 00:00:00 2001 From: Xiwen JIANG Date: Mon, 5 Oct 2015 16:19:52 +0200 Subject: [PATCH 019/349] bug fixed in free beamforming weights --- openair1/SIMULATION/LTE_PHY/dlsim.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/openair1/SIMULATION/LTE_PHY/dlsim.c b/openair1/SIMULATION/LTE_PHY/dlsim.c index 139d507e61..347b80cbc6 100644 --- a/openair1/SIMULATION/LTE_PHY/dlsim.c +++ b/openair1/SIMULATION/LTE_PHY/dlsim.c @@ -3059,12 +3059,12 @@ PMI_FEEDBACK: for (i=0; i<2*frame_parms->samples_per_tti; i++) { for (aa=0; aalte_frame_parms.nb_antennas_rx; aa++) { // printf("s_re[0][%d]=> %f , r_re[0][%d]=> %f\n",i,s_re[aa][i],i,r_re[aa][i]); - //((short*) PHY_vars_UE->lte_ue_common_vars.rxdata[aa])[(2*subframe*PHY_vars_UE->lte_frame_parms.samples_per_tti)+2*i] = - // (short) (r_re[aa][i] + sqrt(sigma2/2)*gaussdouble(0.0,1.0)); - // ((short*) PHY_vars_UE->lte_ue_common_vars.rxdata[aa])[(2*subframe*PHY_vars_UE->lte_frame_parms.samples_per_tti)+2*i+1] = - // (short) (r_im[aa][i] + (iqim*r_re[aa][i]) + sqrt(sigma2/2)*gaussdouble(0.0,1.0)); - ((short*) PHY_vars_UE->lte_ue_common_vars.rxdata[aa])[(2*subframe*PHY_vars_UE->lte_frame_parms.samples_per_tti)+2*i] = (short) r_re[aa][i]; - ((short*) PHY_vars_UE->lte_ue_common_vars.rxdata[aa])[(2*subframe*PHY_vars_UE->lte_frame_parms.samples_per_tti)+2*i+1] = (short) r_im[aa][i]; + ((short*) PHY_vars_UE->lte_ue_common_vars.rxdata[aa])[(2*subframe*PHY_vars_UE->lte_frame_parms.samples_per_tti)+2*i] = + (short) (r_re[aa][i] + sqrt(sigma2/2)*gaussdouble(0.0,1.0)); + ((short*) PHY_vars_UE->lte_ue_common_vars.rxdata[aa])[(2*subframe*PHY_vars_UE->lte_frame_parms.samples_per_tti)+2*i+1] = + (short) (r_im[aa][i] + (iqim*r_re[aa][i]) + sqrt(sigma2/2)*gaussdouble(0.0,1.0)); + //((short*) PHY_vars_UE->lte_ue_common_vars.rxdata[aa])[(2*subframe*PHY_vars_UE->lte_frame_parms.samples_per_tti)+2*i] = (short) r_re[aa][i]; + //((short*) PHY_vars_UE->lte_ue_common_vars.rxdata[aa])[(2*subframe*PHY_vars_UE->lte_frame_parms.samples_per_tti)+2*i+1] = (short) r_im[aa][i]; //printf("rxdata[%d][%d]=> %d, %d\n",aa,subframe*PHY_vars_UE->lte_frame_parms.samples_per_tti+i,r_re[aa][i],r_im[aa][i]); } } @@ -4340,8 +4340,10 @@ PMI_FEEDBACK: free(r_im[i]); } - for(i=0;i<12*N_RB_DL;i++) - free(beamforming_weights[i]); + if(transmission_mode == 7){ + for(i=0;i<12*N_RB_DL;i++) + free(beamforming_weights[i]); + } free(s_re); free(s_im); From 0d681a0e727c61a95f95106d95eace3067e2a524 Mon Sep 17 00:00:00 2001 From: Xiwen JIANG Date: Fri, 9 Oct 2015 10:04:25 +0200 Subject: [PATCH 020/349] use nb_antennas_tx as physical antenna number and nb_antennas_tx_eNB as antenna port --- openair1/PHY/INIT/lte_init.c | 12 +- openair1/PHY/LTE_TRANSPORT/dlsch_modulation.c | 9 +- openair1/PHY/LTE_TRANSPORT/pilots_ue_spec.c | 2 +- openair1/PHY/defs.h | 1 - openair1/SIMULATION/LTE_PHY/dlsim.c | 119 +++++++++--------- 5 files changed, 74 insertions(+), 69 deletions(-) diff --git a/openair1/PHY/INIT/lte_init.c b/openair1/PHY/INIT/lte_init.c index 83ed9c632c..b139f5cf4f 100644 --- a/openair1/PHY/INIT/lte_init.c +++ b/openair1/PHY/INIT/lte_init.c @@ -1275,10 +1275,10 @@ int phy_init_lte_eNB(PHY_VARS_eNB *phy_vars_eNB, if (abstraction_flag==0) { // TX vars - eNB_common_vars->txdata[eNB_id] = (int32_t**)malloc16(phy_vars_eNB->nb_antennas_tx_phy*sizeof(int32_t*) ); - eNB_common_vars->txdataF[eNB_id] = (mod_sym_t **)malloc16(phy_vars_eNB->nb_antennas_tx_phy*sizeof(mod_sym_t*) ); + eNB_common_vars->txdata[eNB_id] = (int32_t**)malloc16(frame_parms->nb_antennas_tx*sizeof(int32_t*) ); + eNB_common_vars->txdataF[eNB_id] = (mod_sym_t **)malloc16(frame_parms->nb_antennas_tx*sizeof(mod_sym_t*) ); - for (i=0; inb_antennas_tx_phy; i++) { + for (i=0; inb_antennas_tx; i++) { #ifdef USER_MODE eNB_common_vars->txdata[eNB_id][i] = (int32_t*)malloc16_clear( FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(int32_t) ); eNB_common_vars->txdataF[eNB_id][i] = (mod_sym_t*)malloc16_clear( FRAME_LENGTH_COMPLEX_SAMPLES_NO_PREFIX*sizeof(mod_sym_t) ); @@ -1295,9 +1295,9 @@ int phy_init_lte_eNB(PHY_VARS_eNB *phy_vars_eNB, } // RX vars - eNB_common_vars->rxdata[eNB_id] = (int32_t**)malloc16( frame_parms->nb_antennas_rx*sizeof(int32_t*) ); - eNB_common_vars->rxdata_7_5kHz[eNB_id] = (int32_t**)malloc16( frame_parms->nb_antennas_rx*sizeof(int32_t*) ); - eNB_common_vars->rxdataF[eNB_id] = (int32_t**)malloc16( frame_parms->nb_antennas_rx*sizeof(int32_t*) ); + eNB_common_vars->rxdata[eNB_id] = (int32_t**)malloc16(frame_parms->nb_antennas_rx*sizeof(int32_t*) ); + eNB_common_vars->rxdata_7_5kHz[eNB_id] = (int32_t**)malloc16(frame_parms->nb_antennas_rx*sizeof(int32_t*) ); + eNB_common_vars->rxdataF[eNB_id] = (int32_t**)malloc16(frame_parms->nb_antennas_rx*sizeof(int32_t*) ); for (i=0; inb_antennas_rx; i++) { #ifndef USER_MODE diff --git a/openair1/PHY/LTE_TRANSPORT/dlsch_modulation.c b/openair1/PHY/LTE_TRANSPORT/dlsch_modulation.c index 313134c28a..6580e827c1 100644 --- a/openair1/PHY/LTE_TRANSPORT/dlsch_modulation.c +++ b/openair1/PHY/LTE_TRANSPORT/dlsch_modulation.c @@ -192,7 +192,6 @@ int allocate_REs_in_RB(PHY_VARS_eNB *phy_vars_eNB, uint8_t *x1=NULL; uint8_t mod_order1=2; - uint8_t nb_antennas_tx_phy = phy_vars_eNB->nb_antennas_tx_phy; // Fill these in later for TM8-10 // int Nlayers1; @@ -917,7 +916,7 @@ break; *jj = *jj + 1; //printf("%d(%d) : %d,%d => ",tti_offset,*jj,((int16_t*)&tmp_sample1)[0],((int16_t*)&tmp_sample1)[1]); - for (aa=0; aanb_antennas_tx; aa++) { ((int16_t*)&txdataF[aa][tti_offset])[0] += (int16_t)((((int16_t*)&tmp_sample1)[0]*((int16_t*)&beamforming_weights[re][aa])[0])>>15); ((int16_t*)&txdataF[aa][tti_offset])[0] +=-(int16_t)((((int16_t*)&tmp_sample1)[1]*((int16_t*)&beamforming_weights[re][aa])[1])>>15); ((int16_t*)&txdataF[aa][tti_offset])[1] += (int16_t)((((int16_t*)&tmp_sample1)[0]*((int16_t*)&beamforming_weights[re][aa])[1])>>15); @@ -956,7 +955,7 @@ break; ((int16_t*)&tmp_sample1)[0] = (int16_t)(((int32_t)amp*qam16_table[qam16_table_offset_re])>>15); ((int16_t*)&tmp_sample1)[1] = (int16_t)(((int32_t)amp*qam16_table[qam16_table_offset_im])>>15); - for (aa=0; aanb_antennas_tx; aa++) { ((int16_t*)&txdataF[aa][tti_offset])[0] += (int16_t)((((int16_t*)&tmp_sample1)[0]*((int16_t*)&beamforming_weights[re][aa])[0])>>15); ((int16_t*)&txdataF[aa][tti_offset])[0] +=-(int16_t)((((int16_t*)&tmp_sample1)[1]*((int16_t*)&beamforming_weights[re][aa])[1])>>15); ((int16_t*)&txdataF[aa][tti_offset])[1] += (int16_t)((((int16_t*)&tmp_sample1)[0]*((int16_t*)&beamforming_weights[re][aa])[1])>>15); @@ -1004,7 +1003,7 @@ break; ((int16_t*)&tmp_sample1)[0] = (int16_t)(((int32_t)amp*qam64_table[qam64_table_offset_re])>>15); ((int16_t*)&tmp_sample1)[1] = (int16_t)(((int32_t)amp*qam64_table[qam64_table_offset_im])>>15); - for (aa=0; aanb_antennas_tx; aa++) { ((int16_t*)&txdataF[aa][tti_offset])[0] += (int16_t)((((int16_t*)&tmp_sample1)[0]*((int16_t*)&beamforming_weights[re][aa])[0])>>15); ((int16_t*)&txdataF[aa][tti_offset])[0] +=-(int16_t)((((int16_t*)&tmp_sample1)[1]*((int16_t*)&beamforming_weights[re][aa])[1])>>15); ((int16_t*)&txdataF[aa][tti_offset])[1] += (int16_t)((((int16_t*)&tmp_sample1)[0]*((int16_t*)&beamforming_weights[re][aa])[1])>>15); @@ -1025,7 +1024,7 @@ break; tmp_sample1 = qpsk[(phy_vars_eNB->lte_gold_uespec_port5_table[0][Ns][ind_dword]>>(2*ind_qpsk_symb))&3]; mprime2++; - for (aa=0; aanb_antennas_tx; aa++) { ((int16_t*)&txdataF[aa][tti_offset])[0] += (int16_t)((((int16_t*)&tmp_sample1)[0]*((int16_t*)&beamforming_weights[re][aa])[0])>>15); ((int16_t*)&txdataF[aa][tti_offset])[0] +=-(int16_t)((((int16_t*)&tmp_sample1)[1]*((int16_t*)&beamforming_weights[re][aa])[1])>>15); diff --git a/openair1/PHY/LTE_TRANSPORT/pilots_ue_spec.c b/openair1/PHY/LTE_TRANSPORT/pilots_ue_spec.c index 2287c44a5f..4651308dfd 100644 --- a/openair1/PHY/LTE_TRANSPORT/pilots_ue_spec.c +++ b/openair1/PHY/LTE_TRANSPORT/pilots_ue_spec.c @@ -68,7 +68,7 @@ void generate_ue_spec_pilots(PHY_VARS_eNB *phy_vars_eNB, printf("generate_dl_ue_spec:tti_offset=%d\n",tti_offset); if(frame_parms->Ncp==0) { - for(aa=0;aanb_antennas_tx_phy;aa++){ + for(aa=0;aanb_antennas_tx;aa++){ //antenna port 5 symbol 0 slot 0 lte_dl_ue_spec(phy_vars_eNB, UE_id, diff --git a/openair1/PHY/defs.h b/openair1/PHY/defs.h index ceacd43ee1..d9965b4e75 100755 --- a/openair1/PHY/defs.h +++ b/openair1/PHY/defs.h @@ -209,7 +209,6 @@ typedef struct PHY_VARS_eNB_s { eNB_proc_t proc[NUM_ENB_THREADS]; uint8_t local_flag; uint32_t rx_total_gain_eNB_dB; - uint8_t nb_antennas_tx_phy; LTE_DL_FRAME_PARMS lte_frame_parms; PHY_MEASUREMENTS_eNB PHY_measurements_eNB[NUMBER_OF_eNB_SECTORS_MAX]; /// Measurement variables LTE_eNB_COMMON lte_eNB_common_vars; diff --git a/openair1/SIMULATION/LTE_PHY/dlsim.c b/openair1/SIMULATION/LTE_PHY/dlsim.c index 347b80cbc6..2501baff25 100644 --- a/openair1/SIMULATION/LTE_PHY/dlsim.c +++ b/openair1/SIMULATION/LTE_PHY/dlsim.c @@ -1,4 +1,4 @@ -/****************************************************************************** + /****************************************************************************** ipenAirInterface Copyright(c) 1999 - 2014 Eurecom @@ -107,7 +107,7 @@ void handler(int sig) exit(1); } -void lte_param_init(unsigned char N_tx, unsigned char N_tx_phy, unsigned char N_rx,unsigned char transmission_mode,uint8_t extended_prefix_flag,uint8_t fdd_flag, uint16_t Nid_cell,uint8_t tdd_config,uint8_t N_RB_DL, uint8_t osf,uint32_t perfect_ce) +void lte_param_init(unsigned char N_tx_port_eNB, unsigned char N_tx_phy, unsigned char N_rx,unsigned char transmission_mode,uint8_t extended_prefix_flag,uint8_t fdd_flag, uint16_t Nid_cell,uint8_t tdd_config,uint8_t N_RB_DL, uint8_t osf,uint32_t perfect_ce) { LTE_DL_FRAME_PARMS *lte_frame_parms; @@ -132,9 +132,9 @@ void lte_param_init(unsigned char N_tx, unsigned char N_tx_phy, unsigned char N_ lte_frame_parms->Ncp = extended_prefix_flag; lte_frame_parms->Nid_cell = Nid_cell; lte_frame_parms->nushift = Nid_cell%6; - lte_frame_parms->nb_antennas_tx = N_tx; + lte_frame_parms->nb_antennas_tx = N_tx_phy; lte_frame_parms->nb_antennas_rx = N_rx; - lte_frame_parms->nb_antennas_tx_eNB = N_tx; + lte_frame_parms->nb_antennas_tx_eNB = N_tx_port_eNB; lte_frame_parms->phich_config_common.phich_resource = one; lte_frame_parms->tdd_config = tdd_config; lte_frame_parms->frame_type = (fdd_flag==1)?0 : 1; @@ -157,8 +157,6 @@ void lte_param_init(unsigned char N_tx, unsigned char N_tx_phy, unsigned char N_ PHY_vars_eNB->transmission_mode[0] = transmission_mode; PHY_vars_UE->transmission_mode[0] = transmission_mode; - //printf("lte_param_init: transmission mode = %d\n",PHY_vars_eNB->transmission_mode[0]); - PHY_vars_eNB->nb_antennas_tx_phy = N_tx_phy; phy_init_lte_top(lte_frame_parms); dump_frame_parms(lte_frame_parms); @@ -207,7 +205,7 @@ uint64_t DLSCH_alloc_pdu_1[2]; #define CCCH_RB_ALLOC computeRIV(PHY_vars_eNB->lte_frame_parms.N_RB_UL,0,2) //#define DLSCH_RB_ALLOC 0x1fbf // igore DC component,RB13 //#define DLSCH_RB_ALLOC 0x0001 -void do_OFDM_mod_l(mod_sym_t **txdataF, int32_t **txdata, uint16_t next_slot, LTE_DL_FRAME_PARMS *frame_parms, uint8_t nb_antennas_tx_phy) +void do_OFDM_mod_l(mod_sym_t **txdataF, int32_t **txdata, uint16_t next_slot, LTE_DL_FRAME_PARMS *frame_parms) { int aa, slot_offset, slot_offset_F; @@ -215,7 +213,7 @@ void do_OFDM_mod_l(mod_sym_t **txdataF, int32_t **txdata, uint16_t next_slot, LT slot_offset_F = (next_slot)*(frame_parms->ofdm_symbol_size)*((frame_parms->Ncp==1) ? 6 : 7); slot_offset = (next_slot)*(frame_parms->samples_per_tti>>1); - for (aa=0; aanb_antennas_tx; aa++) { // printf("Thread %d starting ... aa %d (%llu)\n",omp_get_thread_num(),aa,rdtsc()); if (frame_parms->Ncp == 1) @@ -253,8 +251,7 @@ int main(int argc, char **argv) double forgetting_factor=0.0; //in [0,1] 0 means a new channel every time, 1 means keep the same channel double iqim=0.0; - uint8_t extended_prefix_flag=0,transmission_mode=1,n_tx=1,n_rx=1; - uint16_t n_tx_phy=1; + uint8_t extended_prefix_flag=0,transmission_mode=1,n_tx_port=1,n_tx_phy=1,n_rx=1; uint16_t Nid_cell=0; int32_t **beamforming_weights; @@ -335,7 +332,8 @@ int main(int argc, char **argv) uint32_t DLSCH_RB_ALLOC = 0x1fff; int numCCE=0; int dci_length_bytes=0,dci_length=0; - double BW = 5.0; + //double BW = 5.0; + double BW = 7.68; int common_flag=0,TPC=0; double cpu_freq_GHz; @@ -387,7 +385,7 @@ int main(int argc, char **argv) num_layers = 1; perfect_ce = 0; - while ((c = getopt (argc, argv, "ahdpZDe:m:n:o:s:f:t:c:g:r:F:x:y:q:z:AM:N:I:i:O:R:S:C:T:b:u:v:w:B:PLl:Y")) != -1) { + while ((c = getopt (argc, argv, "ahdqZDe:m:n:o:s:f:t:c:g:r:F:x:p:y:z:AM:N:I:i:O:R:S:C:T:b:u:v:w:B:PLl:Y")) != -1) { switch (c) { case 'a': awgn_flag = 1; @@ -464,7 +462,7 @@ int main(int argc, char **argv) n_ch_rlz= atof(optarg); break; - case 'p': + case 'q': extended_prefix_flag=1; break; @@ -554,32 +552,39 @@ int main(int argc, char **argv) } if (transmission_mode>1 && transmission_mode<7){ - n_tx = 2; - n_tx_phy = n_tx; + n_tx_port = 2; + n_tx_phy = n_tx_port; + } else if (transmission_mode==7){ + n_tx_port = 1; } break; - case 'y': - n_tx=atoi(optarg); + case 'p': + n_tx_port=atoi(optarg); - if ((n_tx==0) || ((n_tx>2))) { - msg("Unsupported number of tx antennas ports %d\n",n_tx); + if ((n_tx_port==0) || ((n_tx_port>2))) { + msg("Unsupported number of cell specific antennas ports %d\n",n_tx_port); exit(-1); } break; - case 'q': + case 'y': n_tx_phy=atoi(optarg); - if (transmission_mode<7 && n_tx_phy!=n_tx) { - msg("For transmission mode below TM7, physical antenna number should be the same as antenna port number.\n"); - exit(-1); + if (transmission_mode>1&&transmission_mode<7) { + if(n_tx_phy==1) { + msg("n_tx_phy must be >1 for transmission_mode %d\n",transmission_mode); + exit(-1); + } else if (n_tx_phy!=n_tx_port) { // to be changed + msg("For transmission mode TM2-TM6, physical antenna number should be the same as antenna port number.\n"); + exit(-1); + } } //if (transmission_mode==7 && (n_tx_phy!=1 && n_tx_phy!=2 && n_tx_phy!=4 && n_tx_phy!=8 && n_tx_phy!=16 && n_tx_phy!=64 && n_tx_phy!=128)) { - if (transmission_mode==7 && (n_tx_phy!=1 && n_tx_phy!=4 && n_tx_phy!=16 && n_tx_phy!=64)) { + if (transmission_mode==7 && (n_tx_phy!=1 && n_tx_phy!=2 && n_tx_phy!=4 && n_tx_phy!=16 && n_tx_phy!=64)) { msg("For TM7, physical antenna number should be an exponent of 4, maximum 64 antennas supported.\n"); exit(-1); } @@ -629,7 +634,7 @@ int main(int argc, char **argv) dual_stream_UE=1; openair_daq_vars.use_ia_receiver = 1; - if ((n_tx!=2) || (transmission_mode!=5)) { + if ((n_tx_port!=2) || (transmission_mode!=5)) { msg("IA receiver only supported for TM5!"); exit(-1); } @@ -689,8 +694,8 @@ int main(int argc, char **argv) printf("-g [A:M] Use 3GPP 25.814 SCM-A/B/C/D('A','B','C','D') or 36-101 EPA('E'), EVA ('F'),ETU('G') models (ignores delay spread and Ricean factor), Rayghleigh8 ('H'), Rayleigh1('I'), Rayleigh1_corr('J'), Rayleigh1_anticorr ('K'), Rice8('L'), Rice1('M')\n"); printf("-F forgetting factor (0 new channel every trial, 1 channel constant\n"); printf("-x Transmission mode (1,2,6,7 for the moment)\n"); - printf("-y Number of TX antennas ports used in eNB\n"); - printf("-q Number of physical TX antennas used in eNB\n"); + printf("-p Number of TX antennas ports used in eNB\n"); + printf("-y Number of physical TX antennas used in eNB\n"); printf("-z Number of RX antennas used in UE\n"); printf("-t MCS of interfering UE\n"); printf("-R Number of HARQ rounds (fixed)\n"); @@ -738,10 +743,6 @@ int main(int argc, char **argv) NB_RB=conv_nprb(0,DLSCH_RB_ALLOC,N_RB_DL); - if ((transmission_mode>1&&transmission_mode<7) && (n_tx_phy == 1)){ - msg("n_tx_phy must be >1 for transmission_mode %d\n",transmission_mode); - exit(-1); - } #ifdef XFORMS fl_initialize (&argc, argv, NULL, 0, 0); @@ -764,7 +765,7 @@ int main(int argc, char **argv) } - lte_param_init(n_tx,n_tx_phy,n_rx,transmission_mode,extended_prefix_flag,fdd_flag,Nid_cell,tdd_config,N_RB_DL,osf,perfect_ce); + lte_param_init(n_tx_port,n_tx_phy,n_rx,transmission_mode,extended_prefix_flag,fdd_flag,Nid_cell,tdd_config,N_RB_DL,osf,perfect_ce); if (transmission_mode==7){ lte_gold_ue_spec_port5(PHY_vars_eNB->lte_gold_uespec_port5_table[0],Nid_cell,n_rnti); @@ -775,14 +776,14 @@ int main(int argc, char **argv) beamforming_weights[i]=(int32_t *)malloc(n_tx_phy*sizeof(int32_t)); for(aa=0;aa>1; else if (n_tx_phy==16) beamforming_weights[i][aa] = 0x00007fff>>2; else if (n_tx_phy==64) - beamforming_weights[i][aa] = 0x00007fff>>3; + beamforming_weights[i][aa] = 0x00007fff>>4;//3 } } printf("***n_tx_phy=%d,n_tx_phy>>2=%d,beamforming_weights=%d\n",n_tx_phy,n_tx_phy>>2,beamforming_weights[0][0]); @@ -840,7 +841,7 @@ int main(int argc, char **argv) char dirname[FILENAME_MAX]; sprintf(dirname, "%s/SIMU/USER/pre-ci-logs-%s", getenv("OPENAIR_TARGETS"),hostname ); sprintf(time_meas_fname,"%s/time_meas_prb%d_mcs%d_anttx%d_antrx%d_pdcch%d_channel%s_tx%d.csv", - dirname,N_RB_DL,mcs1,n_tx,n_rx,num_pdcch_symbols,channel_model_input,transmission_mode); + dirname,N_RB_DL,mcs1,n_tx_phy,n_rx,num_pdcch_symbols,channel_model_input,transmission_mode); mkdir(dirname,0777); time_meas_fd = fopen(time_meas_fname,"w"); } @@ -2221,7 +2222,7 @@ PMI_FEEDBACK: //printf("Trial %d : Round %d, pmi_feedback %d \n",trials,round,pmi_feedback); //for (aa=0; aalte_frame_parms.nb_antennas_tx; aa++) { - for (aa=0; aanb_antennas_tx_phy; aa++) { + for (aa=0; aalte_frame_parms.nb_antennas_tx; aa++) { memset(&PHY_vars_eNB->lte_eNB_common_vars.txdataF[eNB_id][aa][0],0,FRAME_LENGTH_COMPLEX_SAMPLES_NO_PREFIX*sizeof(mod_sym_t)); } @@ -2878,22 +2879,19 @@ PMI_FEEDBACK: do_OFDM_mod_l(PHY_vars_eNB->lte_eNB_common_vars.txdataF[eNB_id], PHY_vars_eNB->lte_eNB_common_vars.txdata[eNB_id], i, - &PHY_vars_eNB->lte_frame_parms, - PHY_vars_eNB->nb_antennas_tx_phy); + &PHY_vars_eNB->lte_frame_parms); } */ do_OFDM_mod_l(PHY_vars_eNB->lte_eNB_common_vars.txdataF[eNB_id], PHY_vars_eNB->lte_eNB_common_vars.txdata[eNB_id], (subframe*2), - &PHY_vars_eNB->lte_frame_parms, - PHY_vars_eNB->nb_antennas_tx_phy); + &PHY_vars_eNB->lte_frame_parms); do_OFDM_mod_l(PHY_vars_eNB->lte_eNB_common_vars.txdataF[eNB_id], PHY_vars_eNB->lte_eNB_common_vars.txdata[eNB_id], (subframe*2)+1, - &PHY_vars_eNB->lte_frame_parms, - PHY_vars_eNB->nb_antennas_tx_phy); + &PHY_vars_eNB->lte_frame_parms); stop_meas(&PHY_vars_eNB->ofdm_mod_stats); stop_meas(&PHY_vars_eNB->phy_proc_tx); @@ -2901,20 +2899,19 @@ PMI_FEEDBACK: do_OFDM_mod_l(PHY_vars_eNB->lte_eNB_common_vars.txdataF[eNB_id], PHY_vars_eNB->lte_eNB_common_vars.txdata[eNB_id], (subframe*2)+2, - &PHY_vars_eNB->lte_frame_parms, - PHY_vars_eNB->nb_antennas_tx_phy); + &PHY_vars_eNB->lte_frame_parms); if (n_frames==1) { write_output("txsigF0.m","txsF0", &PHY_vars_eNB->lte_eNB_common_vars.txdataF[eNB_id][0][subframe*nsymb*PHY_vars_eNB->lte_frame_parms.ofdm_symbol_size], nsymb*PHY_vars_eNB->lte_frame_parms.ofdm_symbol_size,1,1); - if (PHY_vars_eNB->nb_antennas_tx_phy>1)// to be updated + if (PHY_vars_eNB->lte_frame_parms.nb_antennas_tx>1)// to be updated write_output("txsigF1.m","txsF1", &PHY_vars_eNB->lte_eNB_common_vars.txdataF[eNB_id][1][subframe*nsymb*PHY_vars_eNB->lte_frame_parms.ofdm_symbol_size], nsymb*PHY_vars_eNB->lte_frame_parms.ofdm_symbol_size,1,1); } tx_lev = 0; - for (aa=0; aanb_antennas_tx_phy; aa++) { + for (aa=0; aalte_frame_parms.nb_antennas_tx; aa++) { tx_lev += signal_energy(&PHY_vars_eNB->lte_eNB_common_vars.txdata[eNB_id][aa] [subframe*PHY_vars_eNB->lte_frame_parms.samples_per_tti], PHY_vars_eNB->lte_frame_parms.samples_per_tti); @@ -2956,7 +2953,7 @@ PMI_FEEDBACK: // printf("Copying tx ..., nsymb %d (n_tx %d), awgn %d\n",nsymb,PHY_vars_eNB->lte_frame_parms.nb_antennas_tx,awgn_flag); for (i=0; i<2*frame_parms->samples_per_tti; i++) { - for (aa=0; aanb_antennas_tx_phy; aa++) { + for (aa=0; aalte_frame_parms.nb_antennas_tx; aa++) { if (awgn_flag == 0) { s_re[aa][i] = ((double)(((short *)PHY_vars_eNB->lte_eNB_common_vars.txdata[eNB_id][aa]))[(2*subframe*PHY_vars_UE->lte_frame_parms.samples_per_tti) + (i<<1)]); s_im[aa][i] = ((double)(((short *)PHY_vars_eNB->lte_eNB_common_vars.txdata[eNB_id][aa]))[(2*subframe*PHY_vars_UE->lte_frame_parms.samples_per_tti) +(i<<1)+1]); @@ -3147,31 +3144,41 @@ PMI_FEEDBACK: //write_output("channel.m","ch",desc1->ch[0],desc1->channel_length,1,8); //write_output("channelF.m","chF",desc1->chF[0],nb_samples,1,8); for(k=0; knb_antennas_tx; aa++) { + for(aa=0; aanb_antennas_tx_eNB; aa++) { for (aarx=0; aarxnb_antennas_rx; aarx++) { for (i=0; iN_RB_DL*12; i++) { ((int16_t *) PHY_vars_UE->lte_ue_common_vars.dl_ch_estimates[k][(aa<<1)+aarx])[2*i+((l+(Ns%2)*pilot2)*frame_parms->ofdm_symbol_size+LTE_CE_FILTER_LENGTH)*2]=(int16_t)( eNB2UE[round]->chF[aarx+(aa*frame_parms->nb_antennas_rx)][i].x*AMP); + //printf("x=%d,AMP=%d\n",eNB2UE[round]->chF[aarx+(aa*frame_parms->nb_antennas_rx)][i].x,AMP); ((int16_t *) PHY_vars_UE->lte_ue_common_vars.dl_ch_estimates[k][(aa<<1)+aarx])[2*i+1+((l+(Ns%2)*pilot2)*frame_parms->ofdm_symbol_size+LTE_CE_FILTER_LENGTH)*2]=(int16_t)( eNB2UE[round]->chF[aarx+(aa*frame_parms->nb_antennas_rx)][i].y*AMP); if (transmission_mode == 7){ - ((int16_t *)PHY_vars_UE->lte_ue_pdsch_vars[0]->dl_bf_ch_estimates[(aa<<1)+aarx])[2*i+((l+(Ns%2)*pilot2)*frame_parms->ofdm_symbol_size)*2]=(int16_t)( - eNB2UE[round]->chF[aarx+(aa*frame_parms->nb_antennas_rx)][i].x*AMP); - ((int16_t *)PHY_vars_UE->lte_ue_pdsch_vars[0]->dl_bf_ch_estimates[(aa<<1)+aarx])[2*i+1+((l+(Ns%2)*pilot2)*frame_parms->ofdm_symbol_size)*2]=(int16_t)( - eNB2UE[round]->chF[aarx+(aa*frame_parms->nb_antennas_rx)][i].y*AMP); + if (PHY_vars_UE->high_speed_flag==0) { + ((int16_t *)PHY_vars_UE->lte_ue_pdsch_vars[0]->dl_bf_ch_estimates[(aa<<1)+aarx])[2*i]=(int16_t)( + eNB2UE[round]->chF[aarx+(aa*frame_parms->nb_antennas_rx)][i].x*AMP); + ((int16_t *)PHY_vars_UE->lte_ue_pdsch_vars[0]->dl_bf_ch_estimates[(aa<<1)+aarx])[2*i+1]=(int16_t)( + eNB2UE[round]->chF[aarx+(aa*frame_parms->nb_antennas_rx)][i].y*AMP); + //printf("**,x=%d,AMP=%d\n",eNB2UE[round]->chF[aarx+(aa*frame_parms->nb_antennas_rx)][i].x,AMP); + } else { + ((int16_t *)PHY_vars_UE->lte_ue_pdsch_vars[0]->dl_bf_ch_estimates[(aa<<1)+aarx])[2*i+((l+(Ns%2)*pilot2)*frame_parms->ofdm_symbol_size)*2]=(int16_t)( + eNB2UE[round]->chF[aarx+(aa*frame_parms->nb_antennas_rx)][i].x*AMP); + ((int16_t *)PHY_vars_UE->lte_ue_pdsch_vars[0]->dl_bf_ch_estimates[(aa<<1)+aarx])[2*i+1+((l+(Ns%2)*pilot2)*frame_parms->ofdm_symbol_size)*2]=(int16_t)( + eNB2UE[round]->chF[aarx+(aa*frame_parms->nb_antennas_rx)][i].y*AMP); + + } } } } } } } else { - for(aa=0; aanb_antennas_tx; aa++) { + for(aa=0; aanb_antennas_tx_eNB; aa++) { for (aarx=0; aarxnb_antennas_rx; aarx++) { for (i=0; iN_RB_DL*12; i++) { - ((int16_t *) PHY_vars_UE->lte_ue_common_vars.dl_ch_estimates[0][(aa<<1)+aarx])[2*i+((l+(Ns%2)*pilot2)*frame_parms->ofdm_symbol_size+LTE_CE_FILTER_LENGTH)*2]=(short)(AMP); - ((int16_t *) PHY_vars_UE->lte_ue_common_vars.dl_ch_estimates[0][(aa<<1)+aarx])[2*i+1+((l+(Ns%2)*pilot2)*frame_parms->ofdm_symbol_size+LTE_CE_FILTER_LENGTH)*2]=0/2; - if (transmission_mode == 7){ + ((int16_t *) PHY_vars_UE->lte_ue_common_vars.dl_ch_estimates[0][(aa<<1)+aarx])[2*i+((l+(Ns%2)*pilot2)*frame_parms->ofdm_symbol_size+LTE_CE_FILTER_LENGTH)*2]=(short)(AMP); + ((int16_t *) PHY_vars_UE->lte_ue_common_vars.dl_ch_estimates[0][(aa<<1)+aarx])[2*i+1+((l+(Ns%2)*pilot2)*frame_parms->ofdm_symbol_size+LTE_CE_FILTER_LENGTH)*2]=0/2; + if (transmission_mode == 7) { if (PHY_vars_UE->high_speed_flag==0){ ((int16_t *) PHY_vars_UE->lte_ue_pdsch_vars[0]->dl_bf_ch_estimates[(aa<<1)+aarx])[2*i]=(short)(AMP); ((int16_t *) PHY_vars_UE->lte_ue_pdsch_vars[0]->dl_bf_ch_estimates[(aa<<1)+aarx])[2*i+1]=0/2; From ed83cbd1ebeb79fd7a7fd72ba2b943282e2bc5b6 Mon Sep 17 00:00:00 2001 From: Xiwen JIANG Date: Thu, 26 Nov 2015 10:32:43 +0100 Subject: [PATCH 021/349] TM7 dlsim works --- cmake_targets/CMakeLists.txt | 4 +- common/utils/Makefile.inc | 4 +- openair1/PHY/INIT/lte_init.c | 58 +++- .../lte_dl_channel_estimation.c | 2 +- .../PHY/LTE_ESTIMATION/lte_ue_measurements.c | 2 +- .../lte_ul_channel_estimation.c | 4 +- openair1/PHY/LTE_TRANSPORT/dci.c | 76 ++--- openair1/PHY/LTE_TRANSPORT/dci_tools.c | 74 ++--- openair1/PHY/LTE_TRANSPORT/defs.h | 2 + openair1/PHY/LTE_TRANSPORT/dlsch_coding.c | 14 +- .../PHY/LTE_TRANSPORT/dlsch_demodulation.c | 36 +-- openair1/PHY/LTE_TRANSPORT/dlsch_modulation.c | 294 +++++++++++------- openair1/PHY/LTE_TRANSPORT/initial_sync.c | 4 +- openair1/PHY/LTE_TRANSPORT/pbch.c | 14 +- openair1/PHY/LTE_TRANSPORT/pcfich.c | 2 +- openair1/PHY/LTE_TRANSPORT/pilots.c | 99 ++---- openair1/PHY/LTE_TRANSPORT/proto.h | 56 +++- openair1/PHY/MODULATION/slot_fep.c | 2 +- openair1/PHY/TOOLS/lte_phy_scope.c | 2 +- openair1/PHY/TOOLS/smbv.c | 2 +- openair1/PHY/defs.h | 4 +- openair1/PHY/impl_defs_lte.h | 28 +- openair1/PHY/impl_defs_top.h | 1 + openair1/SCHED/phy_procedures_lte_eNb.c | 11 +- openair1/SIMULATION/LTE_PHY/dlsim.c | 174 +++++++---- openair1/SIMULATION/LTE_PHY/framegen.c | 2 +- openair1/SIMULATION/LTE_PHY/pbchsim.c | 2 +- openair1/SIMULATION/LTE_PHY/pdcchsim.c | 14 +- openair1/SIMULATION/LTE_PHY/scansim.c | 2 +- 29 files changed, 563 insertions(+), 426 deletions(-) diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index ba7aa6c932..6898f21e4f 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -119,6 +119,7 @@ endmacro(add_list_string_option) #################################################### # compilation flags ############################################# +set(CMAKE_BUILD_TYPE "Debug") if (CMAKE_BUILD_TYPE STREQUAL "") set(CMAKE_BUILD_TYPE "RelWithDebInfo") endif() @@ -406,7 +407,7 @@ include_directories ("${X2AP_DIR}") # Hardware dependant options ################################### add_list1_option(NB_ANTENNAS_RX "2" "Number of antennas in reception" "1" "2" "4") -add_list1_option(NB_ANTENNAS_TX "2" "Number of antennas in transmission" "1" "2" "4") +add_list1_option(NB_ANTENNAS_TX "4" "Number of antennas in transmission" "1" "2" "4") add_list1_option(NB_ANTENNAS_TXRX "2" "Number of antennas in ????" "1" "2" "4") add_list2_option(RF_BOARD "EXMIMO" "RF head type" "False" "EXMIMO" "OAI_USRP" "ETHERNET" "OAI_BLADERF" "CPRIGW") @@ -819,6 +820,7 @@ set(PHY_SRC ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/rar_tools.c ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/print_stats.c ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/initial_sync.c + ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/beamforming.c ${OPENAIR1_DIR}/PHY/MODULATION/ofdm_mod.c ${OPENAIR1_DIR}/PHY/MODULATION/slot_fep.c ${OPENAIR1_DIR}/PHY/MODULATION/slot_fep_mbsfn.c diff --git a/common/utils/Makefile.inc b/common/utils/Makefile.inc index 8c4ebbe31e..33c126b8d7 100644 --- a/common/utils/Makefile.inc +++ b/common/utils/Makefile.inc @@ -11,8 +11,8 @@ CFLAGS += -Wall -g -ggdb -Wstrict-prototypes -fno-strict-aliasing CFLAGS += $(call cc-option,-mpreferred-stack-boundary=4) #For performance, if some option doesn't exist in all gcc versions, use $(call cc-option,MY_OPTION) -CFLAGS += -O2 -CFLAGS += -funroll-loops +#CFLAGS += -O2 +#CFLAGS += -funroll-loops CFLAGS += -Wno-packed-bitfield-compat # This is the minimum CPU faetures for OAI diff --git a/openair1/PHY/INIT/lte_init.c b/openair1/PHY/INIT/lte_init.c index b139f5cf4f..50c70b6d02 100644 --- a/openair1/PHY/INIT/lte_init.c +++ b/openair1/PHY/INIT/lte_init.c @@ -77,7 +77,7 @@ void phy_config_mib(LTE_DL_FRAME_PARMS *lte_frame_parms, lte_frame_parms->nushift = Nid_cell%6; lte_frame_parms->Ncp = Ncp; lte_frame_parms->frame_type = frame_type; - lte_frame_parms->nb_antennas_tx_eNB = p_eNB; + lte_frame_parms->nb_antenna_ports_eNB = p_eNB; lte_frame_parms->phich_config_common.phich_resource = phich_config->phich_resource; lte_frame_parms->phich_config_common.phich_duration = phich_config->phich_duration; } @@ -1262,8 +1262,7 @@ int phy_init_lte_eNB(PHY_VARS_eNB *phy_vars_eNB, phy_vars_eNB->physicalConfigDedicated[UE_id] = NULL; } - phy_vars_eNB->first_run_I0_measurements = - 1; ///This flag used to be static. With multiple eNBs this does no longer work, hence we put it in the structure. However it has to be initialized with 1, which is performed here. + phy_vars_eNB->first_run_I0_measurements = 1; ///This flag used to be static. With multiple eNBs this does no longer work, hence we put it in the structure. However it has to be initialized with 1, which is performed here. #ifndef USER_MODE AssertFatal( frame_parms->nb_antennas_tx <= NB_ANTENNAS_TX, "nb_antennas_tx too large" ); @@ -1275,25 +1274,58 @@ int phy_init_lte_eNB(PHY_VARS_eNB *phy_vars_eNB, if (abstraction_flag==0) { // TX vars - eNB_common_vars->txdata[eNB_id] = (int32_t**)malloc16(frame_parms->nb_antennas_tx*sizeof(int32_t*) ); - eNB_common_vars->txdataF[eNB_id] = (mod_sym_t **)malloc16(frame_parms->nb_antennas_tx*sizeof(mod_sym_t*) ); + eNB_common_vars->txdata[eNB_id] = (int32_t**)malloc16(frame_parms->nb_antennas_tx*sizeof(int32_t*)); + eNB_common_vars->txdataF[eNB_id] = (mod_sym_t **)malloc16(NB_ANTENNA_PORTS_ENB*sizeof(mod_sym_t*)); + eNB_common_vars->txdataF_BF[eNB_id] = (mod_sym_t ***)malloc16(frame_parms->nb_antennas_tx*sizeof(mod_sym_t**)); - for (i=0; inb_antennas_tx; i++) { -#ifdef USER_MODE - eNB_common_vars->txdata[eNB_id][i] = (int32_t*)malloc16_clear( FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(int32_t) ); + for (i=0; i<14; i++) { eNB_common_vars->txdataF[eNB_id][i] = (mod_sym_t*)malloc16_clear( FRAME_LENGTH_COMPLEX_SAMPLES_NO_PREFIX*sizeof(mod_sym_t) ); -#else // USER_MODE - eNB_common_vars->txdata[eNB_id][i] = TX_DMA_BUFFER[eNB_id][i]; - eNB_common_vars->txdataF[eNB_id][i] = (mod_sym_t *)malloc16_clear( FRAME_LENGTH_COMPLEX_SAMPLES_NO_PREFIX*sizeof(mod_sym_t) ); -#endif //USER_MODE #ifdef DEBUG_PHY - msg("[openair][LTE_PHY][INIT] lte_eNB_common_vars->txdata[%d][%d] = %p\n",eNB_id,i,eNB_common_vars->txdata[eNB_id][i]); msg("[openair][LTE_PHY][INIT] lte_eNB_common_vars->txdataF[%d][%d] = %p (%d bytes)\n", eNB_id,i,eNB_common_vars->txdataF[eNB_id][i], FRAME_LENGTH_COMPLEX_SAMPLES_NO_PREFIX*sizeof(mod_sym_t)); #endif } + for (i=0; inb_antennas_tx; i++) { + eNB_common_vars->txdataF_BF[eNB_id][i] = (mod_sym_t*)malloc16_clear( OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES*sizeof(mod_sym_t*) ); +#ifdef USER_MODE + eNB_common_vars->txdata[eNB_id][i] = (int32_t*)malloc16_clear( FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(int32_t) ); +#else // USER_MODE + eNB_common_vars->txdata[eNB_id][i] = TX_DMA_BUFFER[eNB_id][i]; +#endif // USER_MODE +#ifdef DEBUG_PHY + msg("[openair][LTE_PHY][INIT] lte_eNB_common_vars->txdataF_BF[%d][%d][%d] = %p (%d bytes)\n", + eNB_id,i,j,eNB_common_vars->txdataF_BF[eNB_id][i][j], + OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES*sizeof(mod_sym_t)); + msg("[openair][LTE_PHY][INIT] lte_eNB_common_vars->txdata[%d][%d] = %p\n",eNB_id,i,eNB_common_vars->txdata[eNB_id][i]); +#endif + } + + for (i=0; i<2; i++) { // 2 is the total number of cell specific antenna ports + eNB_common_vars->cell_spec_bf_weights[eNB_id][i] = (int32_t **)malloc16_clear(frame_parms->nb_antennas_tx*sizeof(int32_t*)); + for (j=0; jnb_antennas_tx; j++) { + eNB_common_vars->cell_spec_bf_weights[eNB_id][i][j] = (int32_t*)malloc16_clear(OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES*sizeof(int32_t)); +#ifdef DEBUG_PUY + msg("[openair][LTE_PHY][INIT] lte_eNB_common_vars->cell_spec_bf_weights[%d][%d][%d] = %p (%d bytes)\n", + eNB_id,i,j,eNB_common_vars->cell_spec_bf_weights[eNB_id][i][j], + OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES*sizeof(int32_t)); +#endif + } + } + + for (i=0; i<8; i++) { //antenna port 5 for TM7, antenna port 7-15 for TM8-10 + eNB_common_vars->ue_spec_bf_weights[eNB_id][i] = (int32_t **)malloc16_clear(frame_parms->nb_antennas_tx*sizeof(int32_t*)); + for (j=0; jnb_antennas_tx; j++) { + eNB_common_vars->ue_spec_bf_weights[eNB_id][i][j] = (int32_t*)malloc16_clear(OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES*sizeof(int32_t)); +#ifdef DEBUG_PUY + msg("[openair][LTE_PHY][INIT] lte_eNB_common_vars->ue_spec_bf_weights[%d][%d][%d] = %p (%d bytes)\n", + eNB_id,i,j,eNB_common_vars->ue_spec_bf_weights[eNB_id][i][j], + OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES*sizeof(int32_t)); +#endif + } + } + // RX vars eNB_common_vars->rxdata[eNB_id] = (int32_t**)malloc16(frame_parms->nb_antennas_rx*sizeof(int32_t*) ); eNB_common_vars->rxdata_7_5kHz[eNB_id] = (int32_t**)malloc16(frame_parms->nb_antennas_rx*sizeof(int32_t*) ); diff --git a/openair1/PHY/LTE_ESTIMATION/lte_dl_channel_estimation.c b/openair1/PHY/LTE_ESTIMATION/lte_dl_channel_estimation.c index 56a097bfda..dd1d954b7b 100644 --- a/openair1/PHY/LTE_ESTIMATION/lte_dl_channel_estimation.c +++ b/openair1/PHY/LTE_ESTIMATION/lte_dl_channel_estimation.c @@ -728,7 +728,7 @@ int lte_dl_channel_estimation(PHY_VARS_UE *phy_vars_ue, // do ifft of channel estimate for (aarx=0; aarxlte_frame_parms.nb_antennas_rx; aarx++) - for (p=0; plte_frame_parms.nb_antennas_tx_eNB; p++) { + for (p=0; plte_frame_parms.nb_antenna_ports_eNB; p++) { if (phy_vars_ue->lte_ue_common_vars.dl_ch_estimates[eNB_offset][(p<<1)+aarx]) idft((int16_t*) &phy_vars_ue->lte_ue_common_vars.dl_ch_estimates[eNB_offset][(p<<1)+aarx][8], (int16_t*) phy_vars_ue->lte_ue_common_vars.dl_ch_estimates_time[eNB_offset][(p<<1)+aarx],1); diff --git a/openair1/PHY/LTE_ESTIMATION/lte_ue_measurements.c b/openair1/PHY/LTE_ESTIMATION/lte_ue_measurements.c index 0fa0fc4ce1..50a71eb47a 100644 --- a/openair1/PHY/LTE_ESTIMATION/lte_ue_measurements.c +++ b/openair1/PHY/LTE_ESTIMATION/lte_ue_measurements.c @@ -453,7 +453,7 @@ void lte_ue_measurements(PHY_VARS_UE *phy_vars_ue, // signal measurements for (eNB_id=0; eNB_idn_connected_eNB; eNB_id++) { for (aarx=0; aarxnb_antennas_rx; aarx++) { - for (aatx=0; aatxnb_antennas_tx_eNB; aatx++) { + for (aatx=0; aatxnb_antenna_ports_eNB; aatx++) { phy_vars_ue->PHY_measurements.rx_spatial_power[eNB_id][aatx][aarx] = (signal_energy_nodc(&phy_vars_ue->lte_ue_common_vars.dl_ch_estimates[eNB_id][(aatx<<1) + aarx][0], (N_RB_DL*12))); diff --git a/openair1/PHY/LTE_ESTIMATION/lte_ul_channel_estimation.c b/openair1/PHY/LTE_ESTIMATION/lte_ul_channel_estimation.c index 9a47a6b355..44214e8b9d 100644 --- a/openair1/PHY/LTE_ESTIMATION/lte_ul_channel_estimation.c +++ b/openair1/PHY/LTE_ESTIMATION/lte_ul_channel_estimation.c @@ -84,7 +84,7 @@ int32_t lte_ul_channel_estimation(PHY_VARS_eNB *phy_vars_eNB, int16_t ul_ch_estimates_re,ul_ch_estimates_im; int32_t rx_power_correction; - //uint8_t nb_antennas_rx = frame_parms->nb_antennas_tx_eNB; + //uint8_t nb_antennas_rx = frame_parms->nb_antenna_ports_eNB; uint8_t nb_antennas_rx = frame_parms->nb_antennas_rx; uint8_t cyclic_shift; @@ -678,7 +678,7 @@ int32_t lte_srs_channel_estimation(LTE_DL_FRAME_PARMS *frame_parms, int T_SFC,aa; int N_symb,symbol; - uint8_t nb_antennas_rx = frame_parms->nb_antennas_tx_eNB; + uint8_t nb_antennas_rx = frame_parms->nb_antenna_ports_eNB; #ifdef DEBUG_SRS char fname[40], vname[40]; #endif diff --git a/openair1/PHY/LTE_TRANSPORT/dci.c b/openair1/PHY/LTE_TRANSPORT/dci.c index 43d2410cbb..dd18d16108 100644 --- a/openair1/PHY/LTE_TRANSPORT/dci.c +++ b/openair1/PHY/LTE_TRANSPORT/dci.c @@ -74,7 +74,7 @@ uint32_t check_phich_reg(LTE_DL_FRAME_PARMS *frame_parms,uint32_t kprime,uint8_t // compute REG based on symbol if ((lprime == 0)|| - ((lprime==1)&&(frame_parms->nb_antennas_tx_eNB == 4))) + ((lprime==1)&&(frame_parms->nb_antenna_ports_eNB == 4))) mprime = kprime/6; else mprime = kprime>>2; @@ -301,7 +301,7 @@ void pdcch_interleaving(LTE_DL_FRAME_PARMS *frame_parms,mod_sym_t **z, mod_sym_t for (row=0; row=ND) { - for (a=0; anb_antennas_tx_eNB; a++) { + for (a=0; anb_antenna_ports_eNB; a++) { //printf("a %d k %d\n",a,k); wptr = &wtemp[a][k<<2]; @@ -325,7 +325,7 @@ void pdcch_interleaving(LTE_DL_FRAME_PARMS *frame_parms,mod_sym_t **z, mod_sym_t // permutation for (i=0; inb_antennas_tx_eNB; a++) { + for (a=0; anb_antenna_ports_eNB; a++) { //wptr = &wtemp[a][i<<2]; //wptr2 = &wbar[a][((i+frame_parms->Nid_cell)%Mquad)<<2]; @@ -417,7 +417,7 @@ void pdcch_demapping(uint16_t *llr,uint16_t *wbar,LTE_DL_FRAME_PARMS *frame_parm re_offset0++; } } - } else if ((lprime==1)&&(frame_parms->nb_antennas_tx_eNB == 4)) { + } else if ((lprime==1)&&(frame_parms->nb_antenna_ports_eNB == 4)) { // LATER!!!! } else { // no pilots in this symbol kprime_mod12 = kprime%12; @@ -655,7 +655,7 @@ void pdcch_channel_level(int32_t **dl_ch_estimates_ext, int16x8_t *dl_ch128; int32x4_t *avg128P; #endif - for (aatx=0; aatxnb_antennas_tx_eNB; aatx++) + for (aatx=0; aatxnb_antenna_ports_eNB; aatx++) for (aarx=0; aarxnb_antennas_rx; aarx++) { //clear average level #if defined(__x86_64__) || defined(__i386__) @@ -833,7 +833,7 @@ void pdcch_detection_mrc_i(LTE_DL_FRAME_PARMS *frame_parms, int32_t i; if (frame_parms->nb_antennas_rx>1) { - for (aatx=0; aatxnb_antennas_tx_eNB; aatx++) { + for (aatx=0; aatxnb_antenna_ports_eNB; aatx++) { //if (frame_parms->mode1_flag && (aatx>0)) break; #if defined(__x86_64__) || defined(__i386__) @@ -1396,8 +1396,8 @@ void pdcch_channel_compensation(int32_t **rxdataF_ext, if (symbol==0) pilots=1; - for (aatx=0; aatxnb_antennas_tx_eNB; aatx++) { - //if (frame_parms->mode1_flag && aatx>0) break; //if mode1_flag is set then there is only one stream to extract, independent of nb_antennas_tx_eNB + for (aatx=0; aatxnb_antenna_ports_eNB; aatx++) { + //if (frame_parms->mode1_flag && aatx>0) break; //if mode1_flag is set then there is only one stream to extract, independent of nb_antenna_ports_eNB for (aarx=0; aarxnb_antennas_rx; aarx++) { @@ -1603,7 +1603,7 @@ void pdcch_detection_mrc(LTE_DL_FRAME_PARMS *frame_parms, int32_t i; if (frame_parms->nb_antennas_rx>1) { - for (aatx=0; aatxnb_antennas_tx_eNB; aatx++) { + for (aatx=0; aatxnb_antenna_ports_eNB; aatx++) { #if defined(__x86_64__) || defined(__i386__) rxdataF_comp128_0 = (__m128i *)&rxdataF_comp[(aatx<<1)][symbol*frame_parms->N_RB_DL*12]; rxdataF_comp128_1 = (__m128i *)&rxdataF_comp[(aatx<<1)+1][symbol*frame_parms->N_RB_DL*12]; @@ -1724,7 +1724,7 @@ int32_t rx_pdcch(LTE_UE_COMMON *lte_ue_common_vars, high_speed_flag, frame_parms); #endif //MU_RECEIVER - } else if (frame_parms->nb_antennas_tx_eNB>1) { + } else if (frame_parms->nb_antenna_ports_eNB>1) { pdcch_extract_rbs_dual(lte_ue_common_vars->rxdataF, lte_ue_common_vars->dl_ch_estimates[eNB_id], lte_ue_pdcch_vars[eNB_id]->rxdataF_ext, @@ -1750,7 +1750,7 @@ int32_t rx_pdcch(LTE_UE_COMMON *lte_ue_common_vars, avgs = 0; - for (aatx=0; aatxnb_antennas_tx_eNB; aatx++) + for (aatx=0; aatxnb_antenna_ports_eNB; aatx++) for (aarx=0; aarxnb_antennas_rx; aarx++) avgs = cmax(avgs,avgP[(aarx<<1)+aatx]); @@ -1991,10 +1991,10 @@ uint8_t get_num_pdcch_symbols(uint8_t num_dci, //if ((9*numCCE) <= (frame_parms->N_RB_DL*2)) if (numCCE <= get_nCCE(1, frame_parms, get_mi(frame_parms, subframe))) return(cmax(1,nCCEmin)); - //else if ((9*numCCE) <= (frame_parms->N_RB_DL*((frame_parms->nb_antennas_tx_eNB==4) ? 4 : 5))) + //else if ((9*numCCE) <= (frame_parms->N_RB_DL*((frame_parms->nb_antenna_ports_eNB==4) ? 4 : 5))) else if (numCCE <= get_nCCE(2, frame_parms, get_mi(frame_parms, subframe))) return(cmax(2,nCCEmin)); - //else if ((9*numCCE) <= (frame_parms->N_RB_DL*((frame_parms->nb_antennas_tx_eNB==4) ? 7 : 8))) + //else if ((9*numCCE) <= (frame_parms->N_RB_DL*((frame_parms->nb_antenna_ports_eNB==4) ? 7 : 8))) else if (numCCE <= get_nCCE(3, frame_parms, get_mi(frame_parms, subframe))) return(cmax(3,nCCEmin)); else if (frame_parms->N_RB_DL<=10) { @@ -2004,10 +2004,10 @@ uint8_t get_num_pdcch_symbols(uint8_t num_dci, get_nCCE(2, frame_parms, get_mi(frame_parms, subframe)), get_nCCE(3, frame_parms, get_mi(frame_parms, subframe))); - if ((9*numCCE) <= (frame_parms->N_RB_DL*((frame_parms->nb_antennas_tx_eNB==4) ? 10 : 11))) + if ((9*numCCE) <= (frame_parms->N_RB_DL*((frame_parms->nb_antenna_ports_eNB==4) ? 10 : 11))) return(4); } else { // extended CP - if ((9*numCCE) <= (frame_parms->N_RB_DL*((frame_parms->nb_antennas_tx_eNB==4) ? 9 : 10))) + if ((9*numCCE) <= (frame_parms->N_RB_DL*((frame_parms->nb_antenna_ports_eNB==4) ? 9 : 10))) return(4); } } @@ -2246,7 +2246,7 @@ uint8_t generate_dci_top(uint8_t num_ue_spec_dci, // Copy REG to TX buffer if ((lprime == 0)|| - ((lprime==1)&&(frame_parms->nb_antennas_tx_eNB == 4))) { + ((lprime==1)&&(frame_parms->nb_antenna_ports_eNB == 4))) { // first symbol, or second symbol+4 TX antennas skip pilots kprime_mod12 = kprime%12; @@ -2258,7 +2258,7 @@ uint8_t generate_dci_top(uint8_t num_ue_spec_dci, if ((i!=(nushiftmod3))&&(i!=(nushiftmod3+3))) { txdataF[0][tti_offset+i] = wbar[0][mprime]; - if (frame_parms->nb_antennas_tx_eNB > 1) + if (frame_parms->nb_antenna_ports_eNB > 1) txdataF[1][tti_offset+i] = wbar[1][mprime]; #ifdef DEBUG_DCI_ENCODING @@ -2277,7 +2277,7 @@ uint8_t generate_dci_top(uint8_t num_ue_spec_dci, for (i=0; i<4; i++) { txdataF[0][tti_offset+i] = wbar[0][mprime]; - if (frame_parms->nb_antennas_tx_eNB > 1) + if (frame_parms->nb_antenna_ports_eNB > 1) txdataF[1][tti_offset+i] = wbar[1][mprime]; #ifdef DEBUG_DCI_ENCODING @@ -2288,7 +2288,7 @@ uint8_t generate_dci_top(uint8_t num_ue_spec_dci, } else { txdataF[0][tti_offset+0] = wbar[0][mprime]; - if (frame_parms->nb_antennas_tx_eNB > 1) + if (frame_parms->nb_antenna_ports_eNB > 1) txdataF[1][tti_offset+0] = wbar[1][mprime]; #ifdef DEBUG_DCI_ENCODING @@ -2297,7 +2297,7 @@ uint8_t generate_dci_top(uint8_t num_ue_spec_dci, mprime++; txdataF[0][tti_offset+1] = wbar[0][mprime]; - if (frame_parms->nb_antennas_tx_eNB > 1) + if (frame_parms->nb_antenna_ports_eNB > 1) txdataF[1][tti_offset+1] = wbar[1][mprime]; #ifdef DEBUG_DCI_ENCODING @@ -2306,7 +2306,7 @@ uint8_t generate_dci_top(uint8_t num_ue_spec_dci, mprime++; txdataF[0][tti_offset-frame_parms->ofdm_symbol_size+3] = wbar[0][mprime]; - if (frame_parms->nb_antennas_tx_eNB > 1) + if (frame_parms->nb_antenna_ports_eNB > 1) txdataF[1][tti_offset-frame_parms->ofdm_symbol_size+3] = wbar[1][mprime]; #ifdef DEBUG_DCI_ENCODING @@ -2316,7 +2316,7 @@ uint8_t generate_dci_top(uint8_t num_ue_spec_dci, mprime++; txdataF[0][tti_offset-frame_parms->ofdm_symbol_size+4] = wbar[0][mprime]; - if (frame_parms->nb_antennas_tx_eNB > 1) + if (frame_parms->nb_antenna_ports_eNB > 1) txdataF[1][tti_offset-frame_parms->ofdm_symbol_size+4] = wbar[1][mprime]; #ifdef DEBUG_DCI_ENCODING @@ -2820,12 +2820,12 @@ uint16_t dci_decoding_procedure(PHY_VARS_UE *phy_vars_ue, format1_size_bits = sizeof_DCI1_1_5MHz_TDD_t; format1_size_bytes = sizeof(DCI1_1_5MHz_TDD_t); - if (frame_parms->nb_antennas_tx_eNB == 2) { + if (frame_parms->nb_antenna_ports_eNB == 2) { format2_size_bits = sizeof_DCI2_1_5MHz_2A_TDD_t; format2_size_bytes = sizeof(DCI2_1_5MHz_2A_TDD_t); format2A_size_bits = sizeof_DCI2A_1_5MHz_2A_TDD_t; format2A_size_bytes = sizeof(DCI2A_1_5MHz_2A_TDD_t); - } else if (frame_parms->nb_antennas_tx_eNB == 4) { + } else if (frame_parms->nb_antenna_ports_eNB == 4) { format2_size_bits = sizeof_DCI2_1_5MHz_4A_TDD_t; format2_size_bytes = sizeof(DCI2_1_5MHz_4A_TDD_t); format2A_size_bits = sizeof_DCI2A_1_5MHz_4A_TDD_t; @@ -2841,12 +2841,12 @@ uint16_t dci_decoding_procedure(PHY_VARS_UE *phy_vars_ue, format1_size_bits = sizeof_DCI1_1_5MHz_FDD_t; format1_size_bytes = sizeof(DCI1_1_5MHz_FDD_t); - if (frame_parms->nb_antennas_tx_eNB == 2) { + if (frame_parms->nb_antenna_ports_eNB == 2) { format2_size_bits = sizeof_DCI2_1_5MHz_2A_FDD_t; format2_size_bytes = sizeof(DCI2_1_5MHz_2A_FDD_t); format2A_size_bits = sizeof_DCI2A_1_5MHz_2A_FDD_t; format2A_size_bytes = sizeof(DCI2A_1_5MHz_2A_FDD_t); - } else if (frame_parms->nb_antennas_tx_eNB == 4) { + } else if (frame_parms->nb_antenna_ports_eNB == 4) { format2_size_bits = sizeof_DCI2_1_5MHz_4A_FDD_t; format2_size_bytes = sizeof(DCI2_1_5MHz_4A_FDD_t); format2A_size_bits = sizeof_DCI2A_1_5MHz_4A_FDD_t; @@ -2868,12 +2868,12 @@ uint16_t dci_decoding_procedure(PHY_VARS_UE *phy_vars_ue, format1_size_bits = sizeof_DCI1_5MHz_TDD_t; format1_size_bytes = sizeof(DCI1_5MHz_TDD_t); - if (frame_parms->nb_antennas_tx_eNB == 2) { + if (frame_parms->nb_antenna_ports_eNB == 2) { format2_size_bits = sizeof_DCI2_5MHz_2A_TDD_t; format2_size_bytes = sizeof(DCI2_5MHz_2A_TDD_t); format2A_size_bits = sizeof_DCI2A_5MHz_2A_TDD_t; format2A_size_bytes = sizeof(DCI2A_5MHz_2A_TDD_t); - } else if (frame_parms->nb_antennas_tx_eNB == 4) { + } else if (frame_parms->nb_antenna_ports_eNB == 4) { format2_size_bits = sizeof_DCI2_5MHz_4A_TDD_t; format2_size_bytes = sizeof(DCI2_5MHz_4A_TDD_t); format2A_size_bits = sizeof_DCI2A_5MHz_4A_TDD_t; @@ -2889,12 +2889,12 @@ uint16_t dci_decoding_procedure(PHY_VARS_UE *phy_vars_ue, format1_size_bits = sizeof_DCI1_5MHz_FDD_t; format1_size_bytes = sizeof(DCI1_5MHz_FDD_t); - if (frame_parms->nb_antennas_tx_eNB == 2) { + if (frame_parms->nb_antenna_ports_eNB == 2) { format2_size_bits = sizeof_DCI2_5MHz_2A_FDD_t; format2_size_bytes = sizeof(DCI2_5MHz_2A_FDD_t); format2A_size_bits = sizeof_DCI2A_5MHz_2A_FDD_t; format2A_size_bytes = sizeof(DCI2A_5MHz_2A_FDD_t); - } else if (frame_parms->nb_antennas_tx_eNB == 4) { + } else if (frame_parms->nb_antenna_ports_eNB == 4) { format2_size_bits = sizeof_DCI2_5MHz_4A_FDD_t; format2_size_bytes = sizeof(DCI2_5MHz_4A_FDD_t); format2A_size_bits = sizeof_DCI2A_5MHz_4A_FDD_t; @@ -2915,12 +2915,12 @@ uint16_t dci_decoding_procedure(PHY_VARS_UE *phy_vars_ue, format1_size_bits = sizeof_DCI1_10MHz_TDD_t; format1_size_bytes = sizeof(DCI1_10MHz_TDD_t); - if (frame_parms->nb_antennas_tx_eNB == 2) { + if (frame_parms->nb_antenna_ports_eNB == 2) { format2_size_bits = sizeof_DCI2_10MHz_2A_TDD_t; format2_size_bytes = sizeof(DCI2_10MHz_2A_TDD_t); format2A_size_bits = sizeof_DCI2A_10MHz_2A_TDD_t; format2A_size_bytes = sizeof(DCI2A_10MHz_2A_TDD_t); - } else if (frame_parms->nb_antennas_tx_eNB == 4) { + } else if (frame_parms->nb_antenna_ports_eNB == 4) { format2_size_bits = sizeof_DCI2_10MHz_4A_TDD_t; format2_size_bytes = sizeof(DCI2_10MHz_4A_TDD_t); format2A_size_bits = sizeof_DCI2A_10MHz_4A_TDD_t; @@ -2936,12 +2936,12 @@ uint16_t dci_decoding_procedure(PHY_VARS_UE *phy_vars_ue, format1_size_bits = sizeof_DCI1_10MHz_FDD_t; format1_size_bytes = sizeof(DCI1_10MHz_FDD_t); - if (frame_parms->nb_antennas_tx_eNB == 2) { + if (frame_parms->nb_antenna_ports_eNB == 2) { format2_size_bits = sizeof_DCI2_10MHz_2A_FDD_t; format2_size_bytes = sizeof(DCI2_10MHz_2A_FDD_t); format2A_size_bits = sizeof_DCI2A_10MHz_2A_FDD_t; format2A_size_bytes = sizeof(DCI2A_10MHz_2A_FDD_t); - } else if (frame_parms->nb_antennas_tx_eNB == 4) { + } else if (frame_parms->nb_antenna_ports_eNB == 4) { format2_size_bits = sizeof_DCI2_10MHz_4A_FDD_t; format2_size_bytes = sizeof(DCI2_10MHz_4A_FDD_t); format2A_size_bits = sizeof_DCI2A_10MHz_4A_FDD_t; @@ -2962,12 +2962,12 @@ uint16_t dci_decoding_procedure(PHY_VARS_UE *phy_vars_ue, format1_size_bits = sizeof_DCI1_20MHz_TDD_t; format1_size_bytes = sizeof(DCI1_20MHz_TDD_t); - if (frame_parms->nb_antennas_tx_eNB == 2) { + if (frame_parms->nb_antenna_ports_eNB == 2) { format2_size_bits = sizeof_DCI2_20MHz_2A_TDD_t; format2_size_bytes = sizeof(DCI2_20MHz_2A_TDD_t); format2A_size_bits = sizeof_DCI2A_20MHz_2A_TDD_t; format2A_size_bytes = sizeof(DCI2A_20MHz_2A_TDD_t); - } else if (frame_parms->nb_antennas_tx_eNB == 4) { + } else if (frame_parms->nb_antenna_ports_eNB == 4) { format2_size_bits = sizeof_DCI2_20MHz_4A_TDD_t; format2_size_bytes = sizeof(DCI2_20MHz_4A_TDD_t); format2A_size_bits = sizeof_DCI2A_20MHz_4A_TDD_t; @@ -2983,12 +2983,12 @@ uint16_t dci_decoding_procedure(PHY_VARS_UE *phy_vars_ue, format1_size_bits = sizeof_DCI1_20MHz_FDD_t; format1_size_bytes = sizeof(DCI1_20MHz_FDD_t); - if (frame_parms->nb_antennas_tx_eNB == 2) { + if (frame_parms->nb_antenna_ports_eNB == 2) { format2_size_bits = sizeof_DCI2_20MHz_2A_FDD_t; format2_size_bytes = sizeof(DCI2_20MHz_2A_FDD_t); format2A_size_bits = sizeof_DCI2A_20MHz_2A_FDD_t; format2A_size_bytes = sizeof(DCI2A_20MHz_2A_FDD_t); - } else if (frame_parms->nb_antennas_tx_eNB == 4) { + } else if (frame_parms->nb_antenna_ports_eNB == 4) { format2_size_bits = sizeof_DCI2_20MHz_4A_FDD_t; format2_size_bytes = sizeof(DCI2_20MHz_4A_FDD_t); format2A_size_bits = sizeof_DCI2A_20MHz_4A_FDD_t; diff --git a/openair1/PHY/LTE_TRANSPORT/dci_tools.c b/openair1/PHY/LTE_TRANSPORT/dci_tools.c index a0b4cba24e..7cb47a49e9 100644 --- a/openair1/PHY/LTE_TRANSPORT/dci_tools.c +++ b/openair1/PHY/LTE_TRANSPORT/dci_tools.c @@ -2662,7 +2662,7 @@ int generate_eNB_dlsch_params_from_dci(int frame, // compute DL power control parameters computeRhoA_eNB(pdsch_config_dedicated, dlsch[0],dlsch0_harq->dl_power_off); - computeRhoB_eNB(pdsch_config_dedicated,&(frame_parms->pdsch_config_common),frame_parms->nb_antennas_tx_eNB,dlsch[0],dlsch0_harq->dl_power_off); + computeRhoB_eNB(pdsch_config_dedicated,&(frame_parms->pdsch_config_common),frame_parms->nb_antenna_ports_eNB,dlsch[0],dlsch0_harq->dl_power_off); return(0); } @@ -3428,7 +3428,7 @@ int dump_dci(LTE_DL_FRAME_PARMS *frame_parms, DCI_ALLOC_t *dci) if ((frame_parms->frame_type == TDD) && (frame_parms->tdd_config>0)) { - if (frame_parms->nb_antennas_tx_eNB == 2) { + if (frame_parms->nb_antenna_ports_eNB == 2) { switch(frame_parms->N_RB_DL) { case 6: LOG_D(PHY,"DCI format2A 2 antennas (FDD 1.5 MHz), rnti %x (%x): rb_alloc %x, mcs1 %d, mcs2 %d, harq_pid %d, ndi1 %d, ndi2 %d, RV1 %d, RV2 %d, TPC %d, dai %d, tbswap %d\n", @@ -3507,7 +3507,7 @@ int dump_dci(LTE_DL_FRAME_PARMS *frame_parms, DCI_ALLOC_t *dci) DevParam (frame_parms->N_RB_DL, 0, 0); break; } - } else if (frame_parms->nb_antennas_tx_eNB == 4) { + } else if (frame_parms->nb_antenna_ports_eNB == 4) { switch(frame_parms->N_RB_DL) { case 6: LOG_D(PHY,"DCI format2A 4 antennas (TDD 1.5 MHz), rnti %x (%llx): rb_alloc %x, mcs1 %d, mcs2 %d, harq_pid %d, ndi1 %d, ndi2 %d, RV1 %d, RV2 %d, TPC %d, dai %d, tbswap %d, tpmi %d\n", @@ -3592,7 +3592,7 @@ int dump_dci(LTE_DL_FRAME_PARMS *frame_parms, DCI_ALLOC_t *dci) } } } else if (frame_parms->frame_type == FDD) { - if (frame_parms->nb_antennas_tx_eNB == 2) { + if (frame_parms->nb_antenna_ports_eNB == 2) { switch(frame_parms->N_RB_DL) { case 6: LOG_D(PHY,"DCI format2A 2 antennas (FDD, 1.5 MHz), rnti %x (%x): rb_alloc %x, mcs1 %d, mcs2 %d, harq_pid %d, ndi1 %d, ndi2 %d, RV1 %d, RV2 %d, tb_swap %d, TPC %d\n", @@ -3666,7 +3666,7 @@ int dump_dci(LTE_DL_FRAME_PARMS *frame_parms, DCI_ALLOC_t *dci) DevParam (frame_parms->N_RB_DL, 0, 0); break; } - } else if (frame_parms->nb_antennas_tx_eNB == 4) { + } else if (frame_parms->nb_antenna_ports_eNB == 4) { switch(frame_parms->N_RB_DL) { case 6: @@ -4467,7 +4467,7 @@ int generate_ue_dlsch_params_from_dci(int frame, switch (frame_parms->N_RB_DL) { case 6: - if (frame_parms->nb_antennas_tx_eNB == 2) { + if (frame_parms->nb_antenna_ports_eNB == 2) { if (frame_type == TDD) { mcs1 = ((DCI2_1_5MHz_2A_TDD_t *)dci_pdu)->mcs1; mcs2 = ((DCI2_1_5MHz_2A_TDD_t *)dci_pdu)->mcs2; @@ -4487,7 +4487,7 @@ int generate_ue_dlsch_params_from_dci(int frame, tbswap = ((DCI2_1_5MHz_2A_FDD_t *)dci_pdu)->tb_swap; tpmi = ((DCI2_1_5MHz_2A_FDD_t *)dci_pdu)->tpmi; } - } else if (frame_parms->nb_antennas_tx_eNB == 4) { + } else if (frame_parms->nb_antenna_ports_eNB == 4) { if (frame_type == TDD) { mcs1 = ((DCI2_1_5MHz_4A_TDD_t *)dci_pdu)->mcs1; mcs2 = ((DCI2_1_5MHz_4A_TDD_t *)dci_pdu)->mcs2; @@ -4508,13 +4508,13 @@ int generate_ue_dlsch_params_from_dci(int frame, tpmi = ((DCI2_1_5MHz_4A_FDD_t *)dci_pdu)->tpmi; } } else { - LOG_E(PHY,"UE: subframe %d Format2 DCI: unsupported number of TX antennas %d\n",subframe,frame_parms->nb_antennas_tx_eNB); + LOG_E(PHY,"UE: subframe %d Format2 DCI: unsupported number of TX antennas %d\n",subframe,frame_parms->nb_antenna_ports_eNB); } break; case 25: - if (frame_parms->nb_antennas_tx_eNB == 2) { + if (frame_parms->nb_antenna_ports_eNB == 2) { if (frame_type == TDD) { mcs1 = ((DCI2_5MHz_2A_TDD_t *)dci_pdu)->mcs1; mcs2 = ((DCI2_5MHz_2A_TDD_t *)dci_pdu)->mcs2; @@ -4536,7 +4536,7 @@ int generate_ue_dlsch_params_from_dci(int frame, tbswap = ((DCI2_5MHz_2A_FDD_t *)dci_pdu)->tb_swap; tpmi = ((DCI2_5MHz_2A_FDD_t *)dci_pdu)->tpmi; } - } else if (frame_parms->nb_antennas_tx_eNB == 4) { + } else if (frame_parms->nb_antenna_ports_eNB == 4) { if (frame_type == TDD) { mcs1 = ((DCI2_5MHz_4A_TDD_t *)dci_pdu)->mcs1; mcs2 = ((DCI2_5MHz_4A_TDD_t *)dci_pdu)->mcs2; @@ -4559,13 +4559,13 @@ int generate_ue_dlsch_params_from_dci(int frame, tpmi = ((DCI2_5MHz_4A_FDD_t *)dci_pdu)->tpmi; } } else { - LOG_E(PHY,"UE: Format2 DCI: unsupported number of TX antennas %d\n",frame_parms->nb_antennas_tx_eNB); + LOG_E(PHY,"UE: Format2 DCI: unsupported number of TX antennas %d\n",frame_parms->nb_antenna_ports_eNB); } break; case 50: - if (frame_parms->nb_antennas_tx_eNB == 2) { + if (frame_parms->nb_antenna_ports_eNB == 2) { if (frame_type == TDD) { mcs1 = ((DCI2_10MHz_2A_TDD_t *)dci_pdu)->mcs1; mcs2 = ((DCI2_10MHz_2A_TDD_t *)dci_pdu)->mcs2; @@ -4587,7 +4587,7 @@ int generate_ue_dlsch_params_from_dci(int frame, tbswap = ((DCI2_10MHz_2A_FDD_t *)dci_pdu)->tb_swap; tpmi = ((DCI2_10MHz_2A_FDD_t *)dci_pdu)->tpmi; } - } else if (frame_parms->nb_antennas_tx_eNB == 4) { + } else if (frame_parms->nb_antenna_ports_eNB == 4) { if (frame_type == TDD) { mcs1 = ((DCI2_10MHz_4A_TDD_t *)dci_pdu)->mcs1; mcs2 = ((DCI2_10MHz_4A_TDD_t *)dci_pdu)->mcs2; @@ -4610,13 +4610,13 @@ int generate_ue_dlsch_params_from_dci(int frame, tpmi = ((DCI2_10MHz_4A_FDD_t *)dci_pdu)->tpmi; } } else { - LOG_E(PHY,"UE: Format2A DCI: unsupported number of TX antennas %d\n",frame_parms->nb_antennas_tx_eNB); + LOG_E(PHY,"UE: Format2A DCI: unsupported number of TX antennas %d\n",frame_parms->nb_antenna_ports_eNB); } break; case 100: - if (frame_parms->nb_antennas_tx_eNB == 2) { + if (frame_parms->nb_antenna_ports_eNB == 2) { if (frame_type == TDD) { mcs1 = ((DCI2_20MHz_2A_TDD_t *)dci_pdu)->mcs1; mcs2 = ((DCI2_20MHz_2A_TDD_t *)dci_pdu)->mcs2; @@ -4638,7 +4638,7 @@ int generate_ue_dlsch_params_from_dci(int frame, tbswap = ((DCI2_20MHz_2A_FDD_t *)dci_pdu)->tb_swap; tpmi = ((DCI2_20MHz_2A_FDD_t *)dci_pdu)->tpmi; } - } else if (frame_parms->nb_antennas_tx_eNB == 4) { + } else if (frame_parms->nb_antenna_ports_eNB == 4) { if (frame_type == TDD) { mcs1 = ((DCI2_20MHz_4A_TDD_t *)dci_pdu)->mcs1; mcs2 = ((DCI2_20MHz_4A_TDD_t *)dci_pdu)->mcs2; @@ -4661,7 +4661,7 @@ int generate_ue_dlsch_params_from_dci(int frame, tpmi = ((DCI2_20MHz_4A_FDD_t *)dci_pdu)->tpmi; } } else { - LOG_E(PHY,"UE: Format2A DCI: unsupported number of TX antennas %d\n",frame_parms->nb_antennas_tx_eNB); + LOG_E(PHY,"UE: Format2A DCI: unsupported number of TX antennas %d\n",frame_parms->nb_antenna_ports_eNB); } break; @@ -4856,7 +4856,7 @@ int generate_ue_dlsch_params_from_dci(int frame, switch (frame_parms->N_RB_DL) { case 6: - if (frame_parms->nb_antennas_tx_eNB == 2) { + if (frame_parms->nb_antenna_ports_eNB == 2) { if (frame_type == TDD) { mcs1 = ((DCI2A_1_5MHz_2A_TDD_t *)dci_pdu)->mcs1; mcs2 = ((DCI2A_1_5MHz_2A_TDD_t *)dci_pdu)->mcs2; @@ -4878,7 +4878,7 @@ int generate_ue_dlsch_params_from_dci(int frame, harq_pid = ((DCI2A_1_5MHz_2A_FDD_t *)dci_pdu)->harq_pid; tbswap = ((DCI2A_1_5MHz_2A_FDD_t *)dci_pdu)->tb_swap; } - } else if (frame_parms->nb_antennas_tx_eNB == 4) { + } else if (frame_parms->nb_antenna_ports_eNB == 4) { if (frame_type == TDD) { mcs1 = ((DCI2A_1_5MHz_4A_TDD_t *)dci_pdu)->mcs1; mcs2 = ((DCI2A_1_5MHz_4A_TDD_t *)dci_pdu)->mcs2; @@ -4903,13 +4903,13 @@ int generate_ue_dlsch_params_from_dci(int frame, tpmi = ((DCI2A_1_5MHz_4A_FDD_t *)dci_pdu)->tpmi; } } else { - LOG_E(PHY,"eNB: subframe %d UE %x, Format2A DCI: unsupported number of TX antennas %d\n",subframe,rnti,frame_parms->nb_antennas_tx_eNB); + LOG_E(PHY,"eNB: subframe %d UE %x, Format2A DCI: unsupported number of TX antennas %d\n",subframe,rnti,frame_parms->nb_antenna_ports_eNB); } break; case 25: - if (frame_parms->nb_antennas_tx_eNB == 2) { + if (frame_parms->nb_antenna_ports_eNB == 2) { if (frame_type == TDD) { mcs1 = ((DCI2A_5MHz_2A_TDD_t *)dci_pdu)->mcs1; mcs2 = ((DCI2A_5MHz_2A_TDD_t *)dci_pdu)->mcs2; @@ -4933,7 +4933,7 @@ int generate_ue_dlsch_params_from_dci(int frame, harq_pid = ((DCI2A_5MHz_2A_FDD_t *)dci_pdu)->harq_pid; tbswap = ((DCI2A_5MHz_2A_FDD_t *)dci_pdu)->tb_swap; } - } else if (frame_parms->nb_antennas_tx_eNB == 4) { + } else if (frame_parms->nb_antenna_ports_eNB == 4) { if (frame_type == TDD) { mcs1 = ((DCI2A_5MHz_4A_TDD_t *)dci_pdu)->mcs1; mcs2 = ((DCI2A_5MHz_4A_TDD_t *)dci_pdu)->mcs2; @@ -4960,13 +4960,13 @@ int generate_ue_dlsch_params_from_dci(int frame, tpmi = ((DCI2A_5MHz_4A_FDD_t *)dci_pdu)->tpmi; } } else { - LOG_E(PHY,"eNB: subframe %d UE %x, Format2A DCI: unsupported number of TX antennas %d\n",subframe,rnti,frame_parms->nb_antennas_tx_eNB); + LOG_E(PHY,"eNB: subframe %d UE %x, Format2A DCI: unsupported number of TX antennas %d\n",subframe,rnti,frame_parms->nb_antenna_ports_eNB); } break; case 50: - if (frame_parms->nb_antennas_tx_eNB == 2) { + if (frame_parms->nb_antenna_ports_eNB == 2) { if (frame_type == TDD) { mcs1 = ((DCI2A_10MHz_2A_TDD_t *)dci_pdu)->mcs1; mcs2 = ((DCI2A_10MHz_2A_TDD_t *)dci_pdu)->mcs2; @@ -4990,7 +4990,7 @@ int generate_ue_dlsch_params_from_dci(int frame, harq_pid = ((DCI2A_10MHz_2A_FDD_t *)dci_pdu)->harq_pid; tbswap = ((DCI2A_10MHz_2A_FDD_t *)dci_pdu)->tb_swap; } - } else if (frame_parms->nb_antennas_tx_eNB == 4) { + } else if (frame_parms->nb_antenna_ports_eNB == 4) { if (frame_type == TDD) { mcs1 = ((DCI2A_10MHz_4A_TDD_t *)dci_pdu)->mcs1; mcs2 = ((DCI2A_10MHz_4A_TDD_t *)dci_pdu)->mcs2; @@ -5017,13 +5017,13 @@ int generate_ue_dlsch_params_from_dci(int frame, tpmi = ((DCI2A_10MHz_4A_FDD_t *)dci_pdu)->tpmi; } } else { - LOG_E(PHY,"eNB: subframe %d UE %x, Format2A DCI: unsupported number of TX antennas %d\n",subframe,rnti,frame_parms->nb_antennas_tx_eNB); + LOG_E(PHY,"eNB: subframe %d UE %x, Format2A DCI: unsupported number of TX antennas %d\n",subframe,rnti,frame_parms->nb_antenna_ports_eNB); } break; case 100: - if (frame_parms->nb_antennas_tx_eNB == 2) { + if (frame_parms->nb_antenna_ports_eNB == 2) { if (frame_type == TDD) { mcs1 = ((DCI2A_20MHz_2A_TDD_t *)dci_pdu)->mcs1; mcs2 = ((DCI2A_20MHz_2A_TDD_t *)dci_pdu)->mcs2; @@ -5047,7 +5047,7 @@ int generate_ue_dlsch_params_from_dci(int frame, harq_pid = ((DCI2A_20MHz_2A_FDD_t *)dci_pdu)->harq_pid; tbswap = ((DCI2A_20MHz_2A_FDD_t *)dci_pdu)->tb_swap; } - } else if (frame_parms->nb_antennas_tx_eNB == 4) { + } else if (frame_parms->nb_antenna_ports_eNB == 4) { if (frame_type == TDD) { mcs1 = ((DCI2A_20MHz_4A_TDD_t *)dci_pdu)->mcs1; mcs2 = ((DCI2A_20MHz_4A_TDD_t *)dci_pdu)->mcs2; @@ -5074,7 +5074,7 @@ int generate_ue_dlsch_params_from_dci(int frame, tpmi = ((DCI2A_20MHz_4A_FDD_t *)dci_pdu)->tpmi; } } else { - LOG_E(PHY,"eNB: subframe %d UE %x, Format2A DCI: unsupported number of TX antennas %d\n",subframe,rnti,frame_parms->nb_antennas_tx_eNB); + LOG_E(PHY,"eNB: subframe %d UE %x, Format2A DCI: unsupported number of TX antennas %d\n",subframe,rnti,frame_parms->nb_antenna_ports_eNB); } break; @@ -5217,7 +5217,7 @@ int generate_ue_dlsch_params_from_dci(int frame, } } - if (frame_parms->nb_antennas_tx_eNB == 2) { + if (frame_parms->nb_antenna_ports_eNB == 2) { dlsch0_harq->TBS = TBStable[get_I_TBS(dlsch0_harq->mcs)][dlsch0_harq->nb_rb-1]; dlsch1_harq->TBS = TBStable[get_I_TBS(dlsch1_harq->mcs)][dlsch0_harq->nb_rb-1]; @@ -5232,7 +5232,7 @@ int generate_ue_dlsch_params_from_dci(int frame, dlsch0_harq->mimo_mode = ALAMOUTI; dlsch1_harq->mimo_mode = ALAMOUTI; } - } else if (frame_parms->nb_antennas_tx_eNB == 4) { // 4 antenna case + } else if (frame_parms->nb_antenna_ports_eNB == 4) { // 4 antenna case if ((dlsch0->active==1) && (dlsch1->active==1)) { switch (tpmi) { case 0: // one layer per transport block @@ -5316,7 +5316,7 @@ int generate_ue_dlsch_params_from_dci(int frame, } } } else { - LOG_E(PHY,"Illegal number of antennas for eNB %d\n",frame_parms->nb_antennas_tx_eNB); + LOG_E(PHY,"Illegal number of antennas for eNB %d\n",frame_parms->nb_antenna_ports_eNB); } if (mcs1 <= 28) @@ -5528,7 +5528,7 @@ int generate_ue_dlsch_params_from_dci(int frame, // compute DL power control parameters computeRhoA_UE(pdsch_config_dedicated, dlsch[0],dlsch0_harq->dl_power_off); - computeRhoB_UE(pdsch_config_dedicated,&(frame_parms->pdsch_config_common),frame_parms->nb_antennas_tx_eNB,dlsch[0],dlsch0_harq->dl_power_off); + computeRhoB_UE(pdsch_config_dedicated,&(frame_parms->pdsch_config_common),frame_parms->nb_antenna_ports_eNB,dlsch[0],dlsch0_harq->dl_power_off); return(0); } @@ -7676,7 +7676,7 @@ double sinr_eff_cqi_calc(PHY_VARS_UE *phy_vars_ue, uint8_t eNB_id) switch(transmission_mode) { case 1: for (count=0; countN_RB_DL*12; count++) { - for(a_tx=0; a_txnb_antennas_tx_eNB; a_tx++) { + for(a_tx=0; a_txnb_antenna_ports_eNB; a_tx++) { for (a_rx=0; a_rxnb_antennas_rx; a_rx++) { s_dB[count] = 10*log10(pow(((int16_t *) dl_channel_est[(a_tx<<1)+a_rx])[2*count+(LTE_CE_FILTER_LENGTH)*2],2) + pow(((int16_t *) dl_channel_est[(a_tx<<1)+a_rx])[2*count+1+(LTE_CE_FILTER_LENGTH)*2], 2)) - meas->n0_power_avg_dB; @@ -7690,7 +7690,7 @@ double sinr_eff_cqi_calc(PHY_VARS_UE *phy_vars_ue, uint8_t eNB_id) for (count=0; countN_RB_DL*12; count++) { abs_channel=0; - for(a_tx=0; a_txnb_antennas_tx_eNB; a_tx++) { + for(a_tx=0; a_txnb_antenna_ports_eNB; a_tx++) { for (a_rx=0; a_rxnb_antennas_rx; a_rx++) { abs_channel += (pow(((int16_t *) dl_channel_est[(a_tx<<1)+a_rx])[2*count+(LTE_CE_FILTER_LENGTH)*2],2) + pow(((int16_t *) dl_channel_est[(a_tx<<1)+a_rx])[2*count+1+(LTE_CE_FILTER_LENGTH)*2],2)); } @@ -7710,7 +7710,7 @@ double sinr_eff_cqi_calc(PHY_VARS_UE *phy_vars_ue, uint8_t eNB_id) qq = (q>>(((count/12)>>2)<<1))&3; //printf("pmi_alloc %d: rb %d, pmi %d\n",q,count/12,qq); - for(a_tx=0; a_txnb_antennas_tx_eNB; a_tx++) { + for(a_tx=0; a_txnb_antenna_ports_eNB; a_tx++) { for (a_rx=0; a_rxnb_antennas_rx; a_rx++) { switch(qq) { case 0: @@ -7792,7 +7792,7 @@ double sinr_eff_cqi_calc(PHY_VARS_UE *phy_vars_ue, uint8_t eNB_id) qq = (q>>(((count/12)>>2)<<1))&3; //printf("pmi_alloc %d: rb %d, pmi %d\n",q,count/12,qq); - for(a_tx=0; a_txnb_antennas_tx_eNB; a_tx++) { + for(a_tx=0; a_txnb_antenna_ports_eNB; a_tx++) { for (a_rx=0; a_rxnb_antennas_rx; a_rx++) { switch(qq) { case 0: diff --git a/openair1/PHY/LTE_TRANSPORT/defs.h b/openair1/PHY/LTE_TRANSPORT/defs.h index 0d3d028c8a..96c2b7d760 100644 --- a/openair1/PHY/LTE_TRANSPORT/defs.h +++ b/openair1/PHY/LTE_TRANSPORT/defs.h @@ -240,6 +240,8 @@ typedef struct { typedef struct { /// TX buffers for UE-spec transmission (antenna ports 5 or 7..14, prior to precoding) uint32_t *txdataF[8]; + /// beamforming weights for UE-spec transmission (antenna ports 5 or 7..14), for each codeword, maximum 4 layers? + uint32_t **ue_spec_bf_weights[4]; /// Allocated RNTI (0 means DLSCH_t is not currently used) uint16_t rnti; /// Active flag for baseband transmitter processing diff --git a/openair1/PHY/LTE_TRANSPORT/dlsch_coding.c b/openair1/PHY/LTE_TRANSPORT/dlsch_coding.c index f8af3038d3..0db7708860 100644 --- a/openair1/PHY/LTE_TRANSPORT/dlsch_coding.c +++ b/openair1/PHY/LTE_TRANSPORT/dlsch_coding.c @@ -117,12 +117,13 @@ void free_eNB_dlsch(LTE_eNB_DLSCH_t *dlsch) } -LTE_eNB_DLSCH_t *new_eNB_dlsch(unsigned char Kmimo,unsigned char Mdlharq,unsigned char N_RB_DL, uint8_t abstraction_flag) +LTE_eNB_DLSCH_t *new_eNB_dlsch(unsigned char Kmimo,unsigned char Mdlharq,unsigned char N_RB_DL, uint8_t abstraction_flag, LTE_DL_FRAME_PARMS* frame_parms) { LTE_eNB_DLSCH_t *dlsch; - unsigned char exit_flag = 0,i,j,r; + unsigned char exit_flag = 0,i,j,r,aa; unsigned char bw_scaling =1; + uint8_t nb_antennas_tx = frame_parms->nb_antennas_tx; switch (N_RB_DL) { case 6: @@ -193,6 +194,15 @@ LTE_eNB_DLSCH_t *new_eNB_dlsch(unsigned char Kmimo,unsigned char Mdlharq,unsigne exit_flag=3; } } + + for (i=0; i<4; i++) { + dlsch->ue_spec_bf_weights[i] = (int32_t **)malloc16(nb_antennas_tx*sizeof(int32_t*)); + dlsch->ue_spec_bf_weights[i] = (int32_t **)malloc16(nb_antennas_tx*sizeof(int32_t*)); + + for (aa=0; aaue_spec_bf_weights[i][aa] = (int32_t *)malloc16(OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES*sizeof(int32_t)); + } + } if (exit_flag==0) { for (i=0; irb_alloc_even; - if (frame_parms->nb_antennas_tx_eNB>1 && beamforming_mode==0) { + if (frame_parms->nb_antenna_ports_eNB>1 && beamforming_mode==0) { #ifdef DEBUG_DLSCH_MOD LOG_I(PHY,"dlsch: using pmi %x (%p), rb_alloc %x\n",pmi2hex_2Ar1(dlsch0_harq->pmi_alloc),dlsch_ue[0],dlsch0_harq->rb_alloc_even[0]); #endif @@ -296,7 +296,7 @@ int rx_pdsch(PHY_VARS_UE *phy_vars_ue, // in case of precoding we add an additional factor of two for the precoding gain avgs = 0; - for (aatx=0; aatxnb_antennas_tx_eNB; aatx++) + for (aatx=0; aatxnb_antenna_ports_eNB; aatx++) for (aarx=0; aarxnb_antennas_rx; aarx++) avgs = cmax(avgs,avg[(aatx<<1)+aarx]); @@ -304,7 +304,7 @@ int rx_pdsch(PHY_VARS_UE *phy_vars_ue, lte_ue_pdsch_vars[eNB_id]->log2_maxh = (log2_approx(avgs)/2); - // + log2_approx(frame_parms->nb_antennas_tx_eNB-1) //-1 because log2_approx counts the number of bits + // + log2_approx(frame_parms->nb_antenna_ports_eNB-1) //-1 because log2_approx counts the number of bits // + log2_approx(frame_parms->nb_antennas_rx-1); if ((dlsch0_harq->mimo_mode>=UNIFORM_PRECODING11) && @@ -317,11 +317,11 @@ int rx_pdsch(PHY_VARS_UE *phy_vars_ue, Nb_tx*Nb_rx in TM2,4,5 Nb_tx^2*Nb_rx in TM6 */ /* - K = frame_parms->nb_antennas_rx*frame_parms->nb_antennas_tx_eNB; //that also covers TM1 since Nb_tx=1 + K = frame_parms->nb_antennas_rx*frame_parms->nb_antenna_ports_eNB; //that also covers TM1 since Nb_tx=1 if ((dlsch0_harq->mimo_mode>=UNIFORM_PRECODING11) && (dlsch0_harq->mimo_mode< DUALSTREAM_UNIFORM_PRECODING1) && (dlsch0_harq->dl_power_off==1)) // we are in TM 6 - K *= frame_parms->nb_antennas_tx_eNB; + K *= frame_parms->nb_antenna_ports_eNB; lte_ue_pdsch_vars[eNB_id]->log2_maxh = (log2_approx(K*avgs)/2); */ @@ -332,7 +332,7 @@ int rx_pdsch(PHY_VARS_UE *phy_vars_ue, #endif } - aatx = frame_parms->nb_antennas_tx_eNB; + aatx = frame_parms->nb_antenna_ports_eNB; aarx = frame_parms->nb_antennas_rx; if (dlsch0_harq->mimo_modemimo_mode == LARGE_CDD) { // TM3 // LOG_I(PHY,"Running PDSCH RX for TM3\n"); - if (frame_parms->nb_antennas_tx_eNB == 2) { + if (frame_parms->nb_antenna_ports_eNB == 2) { if (first_symbol_flag==1) { // effective channel of desired user is always stronger than interfering eff. channel dlsch_channel_level_TM3(lte_ue_pdsch_vars[eNB_id]->dl_ch_estimates_ext, @@ -573,7 +573,7 @@ int rx_pdsch(PHY_VARS_UE *phy_vars_ue, // printf("MRC\n"); if (frame_parms->nb_antennas_rx > 1) { if (dlsch0_harq->mimo_mode == LARGE_CDD) { - if (frame_parms->nb_antennas_tx_eNB == 2) { + if (frame_parms->nb_antenna_ports_eNB == 2) { dlsch_detection_mrc(frame_parms, lte_ue_pdsch_vars[eNB_id]->rxdataF_comp0, lte_ue_pdsch_vars[eNB_id]->rxdataF_comp1[dlsch0_harq->round], @@ -870,7 +870,7 @@ void dlsch_channel_compensation(int **rxdataF_ext, pilots=1; } - for (aatx=0; aatxnb_antennas_tx_eNB; aatx++) { + for (aatx=0; aatxnb_antenna_ports_eNB; aatx++) { if (mod_order == 4) { QAM_amp128 = _mm_set1_epi16(QAM16_n1); // 2/sqrt(10) QAM_amp128b = _mm_setzero_si128(); @@ -1130,7 +1130,7 @@ void dlsch_channel_compensation(int **rxdataF_ext, } } - for (aatx=0; aatxnb_antennas_tx_eNB; aatx++) { + for (aatx=0; aatxnb_antenna_ports_eNB; aatx++) { if (mod_order == 4) { QAM_amp128 = vmovq_n_s16(QAM16_n1); // 2/sqrt(10) QAM_amp128b = vmovq_n_s16(0); @@ -2643,7 +2643,7 @@ void dlsch_detection_mrc(LTE_DL_FRAME_PARMS *frame_parms, if (frame_parms->nb_antennas_rx>1) { - for (aatx=0; aatxnb_antennas_tx_eNB; aatx++) { + for (aatx=0; aatxnb_antenna_ports_eNB; aatx++) { rxdataF_comp128_0 = (__m128i *)&rxdataF_comp[(aatx<<1)][symbol*frame_parms->N_RB_DL*12]; rxdataF_comp128_1 = (__m128i *)&rxdataF_comp[(aatx<<1)+1][symbol*frame_parms->N_RB_DL*12]; @@ -2703,7 +2703,7 @@ void dlsch_detection_mrc(LTE_DL_FRAME_PARMS *frame_parms, if (frame_parms->nb_antennas_rx>1) { - for (aatx=0; aatxnb_antennas_tx_eNB; aatx++) { + for (aatx=0; aatxnb_antenna_ports_eNB; aatx++) { rxdataF_comp128_0 = (int16x8_t *)&rxdataF_comp[(aatx<<1)][symbol*frame_parms->N_RB_DL*12]; rxdataF_comp128_1 = (int16x8_t *)&rxdataF_comp[(aatx<<1)+1][symbol*frame_parms->N_RB_DL*12]; @@ -2785,7 +2785,7 @@ void dlsch_scale_channel(int **dl_ch_estimates_ext, ch_amp128 = _mm_set1_epi16(ch_amp); // Q3.13 - for (aatx=0; aatxnb_antennas_tx_eNB; aatx++) { + for (aatx=0; aatxnb_antenna_ports_eNB; aatx++) { for (aarx=0; aarxnb_antennas_rx; aarx++) { dl_ch128=(__m128i *)&dl_ch_estimates_ext[(aatx<<1)+aarx][symbol*frame_parms->N_RB_DL*12]; @@ -2829,7 +2829,7 @@ void dlsch_channel_level(int **dl_ch_estimates_ext, symbol_mod = (symbol>=(7-frame_parms->Ncp)) ? symbol-(7-frame_parms->Ncp) : symbol; - for (aatx=0; aatxnb_antennas_tx_eNB; aatx++) + for (aatx=0; aatxnb_antenna_ports_eNB; aatx++) for (aarx=0; aarxnb_antennas_rx; aarx++) { //clear average level avg128D = _mm_setzero_si128(); @@ -2886,7 +2886,7 @@ void dlsch_channel_level(int **dl_ch_estimates_ext, symbol_mod = (symbol>=(7-frame_parms->Ncp)) ? symbol-(7-frame_parms->Ncp) : symbol; - for (aatx=0; aatxnb_antennas_tx_eNB; aatx++) + for (aatx=0; aatxnb_antenna_ports_eNB; aatx++) for (aarx=0; aarxnb_antennas_rx; aarx++) { //clear average level avg128D = vdupq_n_s32(0); @@ -3119,7 +3119,7 @@ void dlsch_channel_level_TM7(int **dl_bf_ch_estimates_ext, symbol_mod = (symbol>=(7-frame_parms->Ncp)) ? symbol-(7-frame_parms->Ncp) : symbol; - for (aatx=0; aatxnb_antennas_tx_eNB; aatx++) + for (aatx=0; aatxnb_antenna_ports_eNB; aatx++) for (aarx=0; aarxnb_antennas_rx; aarx++) { //clear average level avg128D = _mm_setzero_si128(); @@ -4931,7 +4931,7 @@ void dump_dlsch2(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint16_t coded_bits_per write_output(fname,vname,phy_vars_ue->lte_ue_pdsch_vars[eNB_id]->dl_ch_estimates_ext[1],12*N_RB_DL*nsymb,1,1); } - if (phy_vars_ue->lte_frame_parms.nb_antennas_tx_eNB == 2) { + if (phy_vars_ue->lte_frame_parms.nb_antenna_ports_eNB == 2) { sprintf(fname,"dlsch%d_ch_r%d_ext10.m",eNB_id,round); sprintf(vname,"dl%d_ch_r%d_ext10",eNB_id,round); write_output(fname,vname,phy_vars_ue->lte_ue_pdsch_vars[eNB_id]->dl_ch_estimates_ext[2],12*N_RB_DL*nsymb,1,1); @@ -4959,7 +4959,7 @@ void dump_dlsch2(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint16_t coded_bits_per sprintf(fname,"dlsch%d_rxF_r%d_comp0.m",eNB_id,round); sprintf(vname,"dl%d_rxF_r%d_comp0",eNB_id,round); write_output(fname,vname,phy_vars_ue->lte_ue_pdsch_vars[eNB_id]->rxdataF_comp0[0],12*N_RB_DL*nsymb,1,1); - if (phy_vars_ue->lte_frame_parms.nb_antennas_tx_eNB == 2) { + if (phy_vars_ue->lte_frame_parms.nb_antenna_ports_eNB == 2) { sprintf(fname,"dlsch%d_rxF_r%d_comp1.m",eNB_id,round); sprintf(vname,"dl%d_rxF_r%d_comp1",eNB_id,round); write_output(fname,vname,phy_vars_ue->lte_ue_pdsch_vars[eNB_id]->rxdataF_comp1[0][round],12*N_RB_DL*nsymb,1,1); diff --git a/openair1/PHY/LTE_TRANSPORT/dlsch_modulation.c b/openair1/PHY/LTE_TRANSPORT/dlsch_modulation.c index 6580e827c1..6f05b14f87 100644 --- a/openair1/PHY/LTE_TRANSPORT/dlsch_modulation.c +++ b/openair1/PHY/LTE_TRANSPORT/dlsch_modulation.c @@ -70,7 +70,10 @@ uint8_t is_not_pilot(uint8_t pilots, uint8_t re, uint8_t nushift, uint8_t use2nd return(0); } -//uint8_t is_not_UEspecRS(int first_layer,int re) +/*uint8_t is_not_UEspecRS(int first_layer,int re) +{ + return(1); +}*/ uint8_t is_not_UEspecRS(int8_t lprime, uint8_t re, uint8_t nushift, uint8_t Ncp, uint8_t beamforming_mode) { uint8_t offset = (lprime==1||lprime==3)?2:0; @@ -165,8 +168,8 @@ int allocate_REs_in_RB(PHY_VARS_eNB *phy_vars_eNB, uint32_t *jj2, uint16_t re_offset, uint32_t symbol_offset, - LTE_DL_eNB_HARQ_t *dlsch0_harq, - LTE_DL_eNB_HARQ_t *dlsch1_harq, + LTE_eNB_DLSCH_t *dlsch0, + LTE_eNB_DLSCH_t *dlsch1, uint8_t pilots, int16_t amp, uint8_t precoder_index, @@ -177,10 +180,13 @@ int allocate_REs_in_RB(PHY_VARS_eNB *phy_vars_eNB, uint8_t skip_half, uint8_t lprime, uint8_t mprime, - uint8_t Ns, - int32_t **beamforming_weights) + uint8_t Ns) { + uint8_t harq_pid = dlsch0->current_harq_pid; + LTE_DL_eNB_HARQ_t *dlsch0_harq = dlsch0->harq_processes[harq_pid]; + LTE_DL_eNB_HARQ_t *dlsch1_harq = (dlsch1==NULL) ? NULL : dlsch1->harq_processes[harq_pid]; + LTE_DL_FRAME_PARMS *frame_parms = &phy_vars_eNB->lte_frame_parms; uint8_t *x0 = dlsch0_harq->e; MIMO_mode_t mimo_mode = dlsch0_harq->mimo_mode; @@ -192,10 +198,11 @@ int allocate_REs_in_RB(PHY_VARS_eNB *phy_vars_eNB, uint8_t *x1=NULL; uint8_t mod_order1=2; - // Fill these in later for TM8-10 // int Nlayers1; // int first_layer1; + + int use2ndpilots = (frame_parms->mode1_flag==1)?1:0; uint32_t tti_offset,aa; @@ -281,7 +288,7 @@ break; else if (skip_half==2) first_re=6; - for (re=first_re; reofdm_symbol_size+1; @@ -301,20 +308,16 @@ break; switch (mod_order0) { case 2: //QPSK -// printf("%d(%d) : %d,%d => ",tti_offset,*jj,((int16_t*)&txdataF[0][tti_offset])[0],((int16_t*)&txdataF[0][tti_offset])[1]); - for (aa=0; aanb_antennas_tx; aa++) { - ((int16_t*)&txdataF[aa][tti_offset])[0] += (x0[*jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK; //I //b_i - } + //printf("%d(%d) : %d,%d => ",tti_offset,*jj,((int16_t*)&txdataF[0][tti_offset])[0],((int16_t*)&txdataF[0][tti_offset])[1]); + ((int16_t*)&txdataF[0][tti_offset])[0] = (x0[*jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK; //I //b_i *jj = *jj + 1; - for (aa=0; aanb_antennas_tx; aa++) { - ((int16_t*)&txdataF[aa][tti_offset])[1] += (x0[*jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK; //Q //b_{i+1} - } + ((int16_t*)&txdataF[0][tti_offset])[1] = (x0[*jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK; //Q //b_{i+1} *jj = *jj + 1; - // printf("%d,%d\n",((int16_t*)&txdataF[0][tti_offset])[0],((int16_t*)&txdataF[0][tti_offset])[1]); + //printf("%d,%d\n",((int16_t*)&txdataF[0][tti_offset])[0],((int16_t*)&txdataF[0][tti_offset])[1]); break; case 4: //16QAM @@ -343,12 +346,8 @@ break; *jj=*jj+1; - for (aa=0; aanb_antennas_tx; aa++) { - ((int16_t *)&txdataF[aa][tti_offset])[0]+=qam_table_s0[qam16_table_offset_re]; - ((int16_t *)&txdataF[aa][tti_offset])[1]+=qam_table_s0[qam16_table_offset_im]; - // ((int16_t *)&txdataF[aa][tti_offset])[0]+=(int16_t)(((int32_t)amp*qam16_table[qam16_table_offset_re])>>15); - // ((int16_t *)&txdataF[aa][tti_offset])[1]+=(int16_t)(((int32_t)amp*qam16_table[qam16_table_offset_im])>>15); - } + ((int16_t *)&txdataF[0][tti_offset])[0]=qam_table_s0[qam16_table_offset_re];//(int16_t)(((int32_t)amp*qam16_table[qam16_table_offset_re])>>15); + ((int16_t *)&txdataF[0][tti_offset])[1]=qam_table_s0[qam16_table_offset_im];//(int16_t)(((int32_t)amp*qam16_table[qam16_table_offset_im])>>15); break; @@ -388,10 +387,8 @@ break; *jj=*jj+1; - for (aa=0; aanb_antennas_tx; aa++) { - ((int16_t *)&txdataF[aa][tti_offset])[0]+=qam_table_s0[qam64_table_offset_re];//(int16_t)(((int32_t)amp*qam64_table[qam64_table_offset_re])>>15); - ((int16_t *)&txdataF[aa][tti_offset])[1]+=qam_table_s0[qam64_table_offset_im];//(int16_t)(((int32_t)amp*qam64_table[qam64_table_offset_im])>>15); - } + ((int16_t *)&txdataF[aa][tti_offset])[0]=qam_table_s0[qam64_table_offset_re];//(int16_t)(((int32_t)amp*qam64_table[qam64_table_offset_re])>>15); + ((int16_t *)&txdataF[aa][tti_offset])[1]=qam_table_s0[qam64_table_offset_im];//(int16_t)(((int32_t)amp*qam64_table[qam64_table_offset_im])>>15); break; @@ -587,7 +584,7 @@ break; *re_allocated = *re_allocated + 1; - if (frame_parms->nb_antennas_tx == 2) { + if (frame_parms->nb_antenna_ports_eNB == 2) { switch (mod_order0) { default: LOG_E(PHY,"Unknown mod_order0 %d\n",mod_order0); @@ -799,11 +796,11 @@ break; ((int16_t*)&tmp_sample1)[1] = (x0[*jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK; *jj = *jj + 1; - // normalization for 2 tx antennas + // normalization for 2 tx antenna ports ((int16_t*)&txdataF[0][tti_offset])[0] += (int16_t)((((int16_t*)&tmp_sample1)[0]*ONE_OVER_SQRT2_Q15)>>15); ((int16_t*)&txdataF[0][tti_offset])[1] += (int16_t)((((int16_t*)&tmp_sample1)[1]*ONE_OVER_SQRT2_Q15)>>15); - if (frame_parms->nb_antennas_tx == 2) { + if (frame_parms->nb_antenna_ports_eNB == 2) { layer1prec2A(&tmp_sample1,&tmp_sample2,precoder_index); ((int16_t*)&txdataF[1][tti_offset])[0] += (int16_t)((((int16_t*)&tmp_sample2)[0]*ONE_OVER_SQRT2_Q15)>>15); ((int16_t*)&txdataF[1][tti_offset])[1] += (int16_t)((((int16_t*)&tmp_sample2)[1]*ONE_OVER_SQRT2_Q15)>>15); @@ -843,7 +840,7 @@ break; ((int16_t *)&txdataF[0][tti_offset])[0] += ((int16_t*)&tmp_sample1)[0]; ((int16_t *)&txdataF[0][tti_offset])[1] += ((int16_t*)&tmp_sample1)[1]; - if (frame_parms->nb_antennas_tx == 2) { + if (frame_parms->nb_antenna_ports_eNB == 2) { layer1prec2A(&tmp_sample1,&tmp_sample2,precoder_index); ((int16_t*)&txdataF[1][tti_offset])[0] += ((int16_t*)&tmp_sample2)[0]; ((int16_t*)&txdataF[1][tti_offset])[1] += ((int16_t*)&tmp_sample2)[1]; @@ -893,7 +890,7 @@ break; ((int16_t *)&txdataF[0][tti_offset])[0] += ((int16_t*)&tmp_sample1)[0]; ((int16_t *)&txdataF[0][tti_offset])[1] += ((int16_t*)&tmp_sample1)[1]; - if (frame_parms->nb_antennas_tx == 2) { + if (frame_parms->nb_antenna_ports_eNB == 2) { layer1prec2A(&tmp_sample1,&tmp_sample2,precoder_index); ((int16_t*)&txdataF[1][tti_offset])[0] += ((int16_t*)&tmp_sample2)[0]; ((int16_t*)&txdataF[1][tti_offset])[1] += ((int16_t*)&tmp_sample2)[1]; @@ -902,7 +899,19 @@ break; break; } - } else if(mimo_mode == TM7){ + } + + if (mimo_mode == ALAMOUTI) { + re++; // adjacent carriers are taken care of by precoding + *re_allocated = *re_allocated + 1; + + if (is_not_pilot(pilots,re,frame_parms->nushift,use2ndpilots)==0) { + re++; + *re_allocated = *re_allocated + 1; + } + } + + if(mimo_mode == TM7) { *re_allocated = *re_allocated + 1; if (is_not_UEspecRS(lprime,re,frame_parms->Nid_cell%3,frame_parms->Ncp,7)) { @@ -910,20 +919,12 @@ break; switch (mod_order0){ case 2: //QPSK - ((int16_t*)&tmp_sample1)[0] = (x0[*jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK; + ((int16_t*)&txdataF[5][tti_offset])[0] = (x0[*jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK; *jj = *jj + 1; - ((int16_t*)&tmp_sample1)[1] = (x0[*jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK; + ((int16_t*)&txdataF[5][tti_offset])[1] = (x0[*jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK; *jj = *jj + 1; //printf("%d(%d) : %d,%d => ",tti_offset,*jj,((int16_t*)&tmp_sample1)[0],((int16_t*)&tmp_sample1)[1]); - for (aa=0; aanb_antennas_tx; aa++) { - ((int16_t*)&txdataF[aa][tti_offset])[0] += (int16_t)((((int16_t*)&tmp_sample1)[0]*((int16_t*)&beamforming_weights[re][aa])[0])>>15); - ((int16_t*)&txdataF[aa][tti_offset])[0] +=-(int16_t)((((int16_t*)&tmp_sample1)[1]*((int16_t*)&beamforming_weights[re][aa])[1])>>15); - ((int16_t*)&txdataF[aa][tti_offset])[1] += (int16_t)((((int16_t*)&tmp_sample1)[0]*((int16_t*)&beamforming_weights[re][aa])[1])>>15); - ((int16_t*)&txdataF[aa][tti_offset])[1] += (int16_t)((((int16_t*)&tmp_sample1)[1]*((int16_t*)&beamforming_weights[re][aa])[0])>>15); - } - - //printf("%d,%d\n",((int16_t*)&txdataF[0][tti_offset])[0],((int16_t*)&txdataF[0][tti_offset])[1]); break; case 4: //16QAM @@ -952,15 +953,8 @@ break; *jj=*jj+1; - ((int16_t*)&tmp_sample1)[0] = (int16_t)(((int32_t)amp*qam16_table[qam16_table_offset_re])>>15); - ((int16_t*)&tmp_sample1)[1] = (int16_t)(((int32_t)amp*qam16_table[qam16_table_offset_im])>>15); - - for (aa=0; aanb_antennas_tx; aa++) { - ((int16_t*)&txdataF[aa][tti_offset])[0] += (int16_t)((((int16_t*)&tmp_sample1)[0]*((int16_t*)&beamforming_weights[re][aa])[0])>>15); - ((int16_t*)&txdataF[aa][tti_offset])[0] +=-(int16_t)((((int16_t*)&tmp_sample1)[1]*((int16_t*)&beamforming_weights[re][aa])[1])>>15); - ((int16_t*)&txdataF[aa][tti_offset])[1] += (int16_t)((((int16_t*)&tmp_sample1)[0]*((int16_t*)&beamforming_weights[re][aa])[1])>>15); - ((int16_t*)&txdataF[aa][tti_offset])[1] += (int16_t)((((int16_t*)&tmp_sample1)[1]*((int16_t*)&beamforming_weights[re][aa])[0])>>15); - } + ((int16_t*)&txdataF[5][tti_offset])[0] = (int16_t)(((int32_t)amp*qam16_table[qam16_table_offset_re])>>15); + ((int16_t*)&txdataF[5][tti_offset])[1] = (int16_t)(((int32_t)amp*qam16_table[qam16_table_offset_im])>>15); break; @@ -1000,20 +994,13 @@ break; *jj=*jj+1; - ((int16_t*)&tmp_sample1)[0] = (int16_t)(((int32_t)amp*qam64_table[qam64_table_offset_re])>>15); - ((int16_t*)&tmp_sample1)[1] = (int16_t)(((int32_t)amp*qam64_table[qam64_table_offset_im])>>15); - - for (aa=0; aanb_antennas_tx; aa++) { - ((int16_t*)&txdataF[aa][tti_offset])[0] += (int16_t)((((int16_t*)&tmp_sample1)[0]*((int16_t*)&beamforming_weights[re][aa])[0])>>15); - ((int16_t*)&txdataF[aa][tti_offset])[0] +=-(int16_t)((((int16_t*)&tmp_sample1)[1]*((int16_t*)&beamforming_weights[re][aa])[1])>>15); - ((int16_t*)&txdataF[aa][tti_offset])[1] += (int16_t)((((int16_t*)&tmp_sample1)[0]*((int16_t*)&beamforming_weights[re][aa])[1])>>15); - ((int16_t*)&txdataF[aa][tti_offset])[1] += (int16_t)((((int16_t*)&tmp_sample1)[1]*((int16_t*)&beamforming_weights[re][aa])[0])>>15); - } + ((int16_t*)&txdataF[5][tti_offset])[0] = (int16_t)(((int32_t)amp*qam64_table[qam64_table_offset_re])>>15); + ((int16_t*)&txdataF[5][tti_offset])[1] = (int16_t)(((int32_t)amp*qam64_table[qam64_table_offset_im])>>15); break; } - } else{ + } else { //precoding UE spec RS //printf("precoding UE spec RS\n"); @@ -1021,38 +1008,111 @@ break; ind_dword = ind>>4; ind_qpsk_symb = ind&0xf; - tmp_sample1 = qpsk[(phy_vars_eNB->lte_gold_uespec_port5_table[0][Ns][ind_dword]>>(2*ind_qpsk_symb))&3]; + txdataF[5][tti_offset] = qpsk[(phy_vars_eNB->lte_gold_uespec_port5_table[0][Ns][ind_dword]>>(2*ind_qpsk_symb))&3]; mprime2++; - for (aa=0; aanb_antennas_tx; aa++) { - - ((int16_t*)&txdataF[aa][tti_offset])[0] += (int16_t)((((int16_t*)&tmp_sample1)[0]*((int16_t*)&beamforming_weights[re][aa])[0])>>15); - ((int16_t*)&txdataF[aa][tti_offset])[0] +=-(int16_t)((((int16_t*)&tmp_sample1)[1]*((int16_t*)&beamforming_weights[re][aa])[1])>>15); - ((int16_t*)&txdataF[aa][tti_offset])[1] += (int16_t)((((int16_t*)&tmp_sample1)[0]*((int16_t*)&beamforming_weights[re][aa])[1])>>15); - ((int16_t*)&txdataF[aa][tti_offset])[1] += (int16_t)((((int16_t*)&tmp_sample1)[1]*((int16_t*)&beamforming_weights[re][aa])[0])>>15); - - // ((int16_t*)&txdataF[aa][tti_offset])[0] = 0xffff; - // ((int16_t*)&txdataF[aa][tti_offset])[1] = 0xffff; - //printf("lprime=%d,nb_rb=%d,mprime2=%d,ind=%d,Ns=%d\n",lprime,dlsch0_harq->nb_rb,mprime2,ind,Ns); - //printf("tmp_sample1=(%d,%d)\n",((int16_t*)&tmp_sample1)[0],((int16_t*)&tmp_sample1)[1]); - //printf("beamforing_weights[%d][%d]=(%d,%d)\n",re,aa,((int16_t*)&beamforming_weights[re][aa])[0],((int16_t*)&beamforming_weights[re][aa])[1]); - //printf("txdataF[%d][%d]= (%d,%d)\n ",aa,tti_offset,((int16_t*)&txdataF[aa][tti_offset])[0],((int16_t*)&txdataF[aa][tti_offset])[1]); - } - } + } else if (mimo_mode == TM8) { //TM8 + + // if (is_not_UEspecRS(first_layer0,re)) { + if (is_not_UEspecRS(lprime,re,frame_parms->Nid_cell%3,frame_parms->Ncp,8)) { + switch (mod_order0) { + case 2: //QPSK + + // printf("%d : %d,%d => ",tti_offset,((int16_t*)&txdataF[0][tti_offset])[0],((int16_t*)&txdataF[0][tti_offset])[1]); + for (int layer=first_layer0; layer<=(first_layer0+Nlayers0); layer++) { + ((int16_t*)&txdataF[layer][tti_offset])[0] = (x0[*jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK; //I //b_i + *jj = *jj + 1; + ((int16_t*)&txdataF[layer][tti_offset])[1] = (x0[*jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK; //Q //b_{i+1} + *jj = *jj + 1; + } + + break; + + case 4: //16QAM + // if (is_not_UEspecRS(0/*layer (FIXME uninitialized!)*/,re)) { + if (is_not_UEspecRS(lprime,re,frame_parms->Nid_cell%3,frame_parms->Ncp,8)) { + qam16_table_offset_re = 0; + qam16_table_offset_im = 0; + + if (x0[*jj] == 1) + qam16_table_offset_re+=2; + + *jj = *jj + 1; + + if (x0[*jj] == 1) + qam16_table_offset_im+=2; + + *jj = *jj + 1; + + if (x0[*jj] == 1) + qam16_table_offset_re+=1; + + *jj = *jj + 1; + + if (x0[*jj] == 1) + qam16_table_offset_im+=1; + + *jj = *jj + 1; + + for (int layer=first_layer0; layer<=(first_layer0+Nlayers0); layer++) { + ((int16_t*)&txdataF[layer][tti_offset])[0] = qam_table_s0[qam16_table_offset_re]; + ((int16_t*)&txdataF[layer][tti_offset])[1] = qam_table_s0[qam16_table_offset_im]; + } + } + + break; + + case 6: //64QAM + + + qam64_table_offset_re = 0; + qam64_table_offset_im = 0; + + if (x0[*jj] == 1) + qam64_table_offset_re+=4; + + *jj = *jj + 1; + + if (x0[*jj] == 1) + qam64_table_offset_im+=4; + + *jj = *jj + 1; + + if (x0[*jj] == 1) + qam64_table_offset_re+=2; + + *jj = *jj + 1; + + if (x0[*jj] == 1) + qam64_table_offset_im+=2; + + *jj = *jj + 1; + + if (x0[*jj] == 1) + qam64_table_offset_re+=1; + + *jj = *jj + 1; + + if (x0[*jj] == 1) + qam64_table_offset_im+=1; + + *jj = *jj + 1; + + for (int layer=first_layer0; layer<=(first_layer0+Nlayers0); layer++) { + ((int16_t*)&txdataF[layer][tti_offset])[0] = qam_table_s0[qam64_table_offset_re]; + ((int16_t*)&txdataF[layer][tti_offset])[1] = qam_table_s0[qam64_table_offset_im]; + } + + break; + + } + } + } else if (mimo_mode>=TM9_10) { msg("allocate_REs_in_RB() [dlsch.c] : ERROR, unknown mimo_mode %d\n",mimo_mode); return(-1); } - if (mimo_mode == ALAMOUTI) { - re++; // adjacent carriers are taken care of by precoding - *re_allocated = *re_allocated + 1; - - if (is_not_pilot(pilots,re,frame_parms->nushift,use2ndpilots)==0) { - re++; - *re_allocated = *re_allocated + 1; - } - } } @@ -1076,7 +1136,7 @@ int allocate_REs_in_RB_MCH(mod_sym_t **txdataF, LTE_DL_FRAME_PARMS *frame_parms) { - uint32_t tti_offset,aa; + uint32_t tti_offset; uint8_t re; uint8_t qam64_table_offset_re = 0; uint8_t qam64_table_offset_im = 0; @@ -1117,15 +1177,13 @@ int allocate_REs_in_RB_MCH(mod_sym_t **txdataF, case 2: //QPSK // printf("%d : %d,%d => ",tti_offset,((int16_t*)&txdataF[0][tti_offset])[0],((int16_t*)&txdataF[0][tti_offset])[1]); - for (aa=0; aanb_antennas_tx; aa++) - ((int16_t*)&txdataF[aa][tti_offset])[0] += (x0[*jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK; //I //b_i + ((int16_t*)&txdataF[4][tti_offset])[0] = (x0[*jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK; //I //b_i - *jj = *jj + 1; + *jj = *jj + 1; - for (aa=0; aanb_antennas_tx; aa++) - ((int16_t*)&txdataF[aa][tti_offset])[1] += (x0[*jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK; //Q //b_{i+1} + ((int16_t*)&txdataF[4][tti_offset])[1] = (x0[*jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK; //Q //b_{i+1} - *jj = *jj + 1; + *jj = *jj + 1; // printf("%d,%d\n",((int16_t*)&txdataF[0][tti_offset])[0],((int16_t*)&txdataF[0][tti_offset])[1]); break; @@ -1156,12 +1214,8 @@ int allocate_REs_in_RB_MCH(mod_sym_t **txdataF, *jj=*jj+1; - for (aa=0; aanb_antennas_tx; aa++) { - ((int16_t *)&txdataF[aa][tti_offset])[0]+=qam_table_s[qam16_table_offset_re]; - ((int16_t *)&txdataF[aa][tti_offset])[1]+=qam_table_s[qam16_table_offset_im]; - // ((int16_t *)&txdataF[aa][tti_offset])[0]+=(int16_t)(((int32_t)amp*qam16_table[qam16_table_offset_re])>>15); - // ((int16_t *)&txdataF[aa][tti_offset])[1]+=(int16_t)(((int32_t)amp*qam16_table[qam16_table_offset_im])>>15); - } + ((int16_t *)&txdataF[4][tti_offset])[0]=qam_table_s[qam16_table_offset_re];//(int16_t)(((int32_t)amp*qam16_table[qam16_table_offset_re])>>15); + ((int16_t *)&txdataF[4][tti_offset])[1]=qam_table_s[qam16_table_offset_im];//(int16_t)(((int32_t)amp*qam16_table[qam16_table_offset_im])>>15); break; @@ -1201,10 +1255,8 @@ int allocate_REs_in_RB_MCH(mod_sym_t **txdataF, *jj=*jj+1; - for (aa=0; aanb_antennas_tx; aa++) { - ((int16_t *)&txdataF[aa][tti_offset])[0]+=qam_table_s[qam64_table_offset_re];//(int16_t)(((int32_t)amp*qam64_table[qam64_table_offset_re])>>15); - ((int16_t *)&txdataF[aa][tti_offset])[1]+=qam_table_s[qam64_table_offset_im];//(int16_t)(((int32_t)amp*qam64_table[qam64_table_offset_im])>>15); - } + ((int16_t *)&txdataF[4][tti_offset])[0]=qam_table_s[qam64_table_offset_re];//(int16_t)(((int32_t)amp*qam64_table[qam64_table_offset_re])>>15); + ((int16_t *)&txdataF[4][tti_offset])[1]=qam_table_s[qam64_table_offset_im];//(int16_t)(((int32_t)amp*qam64_table[qam64_table_offset_im])>>15); break; @@ -1265,8 +1317,7 @@ int dlsch_modulation(PHY_VARS_eNB* phy_vars_eNB, uint32_t subframe_offset, uint8_t num_pdcch_symbols, LTE_eNB_DLSCH_t *dlsch0, - LTE_eNB_DLSCH_t *dlsch1, - int32_t **beamforming_weights) + LTE_eNB_DLSCH_t *dlsch1) { LTE_DL_FRAME_PARMS *frame_parms = &phy_vars_eNB->lte_frame_parms; @@ -1287,9 +1338,9 @@ int dlsch_modulation(PHY_VARS_eNB* phy_vars_eNB, int16_t qam16_table_a1[4],qam64_table_a1[8],qam16_table_b1[4],qam64_table_b1[8]; int16_t *qam_table_s0,*qam_table_s1; MIMO_mode_t mimo_mode = dlsch0_harq->mimo_mode; - int32_t **beamforming_weights_RB = beamforming_weights; uint8_t mprime=0,Ns; int8_t lprime=-1; + int aa=0; #ifdef DEBUG_DLSCH_MODULATION uint8_t Nl0 = dlsch0_harq->Nl; @@ -1392,6 +1443,12 @@ int dlsch_modulation(PHY_VARS_eNB* phy_vars_eNB, else lprime=-1; } + + // mapping ue specific beamforming weights from UE specified DLSCH structure to common space + for (aa=0;aanb_antennas_tx;aa++){ + memcpy(phy_vars_eNB->lte_eNB_common_vars.ue_spec_bf_weights[0][0][aa],dlsch0->ue_spec_bf_weights[0][aa],frame_parms->ofdm_symbol_size*sizeof(int32_t)); + } + } Ns = 2*subframe_offset+(l>=(nsymb>>1)); @@ -1399,8 +1456,7 @@ int dlsch_modulation(PHY_VARS_eNB* phy_vars_eNB, re_offset = frame_parms->first_carrier_offset; symbol_offset = (uint32_t)frame_parms->ofdm_symbol_size*(l+(subframe_offset*nsymb)); - //for (aa=0;aanb_antennas_tx;aa++) - // memset(&txdataF[aa][symbol_offset],0,frame_parms->ofdm_symbol_size<<2); + //memset(&txdataF[aa][symbol_offset],0,frame_parms->ofdm_symbol_size<<2); //printf("symbol_offset %d,subframe offset %d : pilots %d\n",symbol_offset,subframe_offset,pilots); for (rb=0; rbN_RB_DL; rb++) { @@ -1569,8 +1625,8 @@ int dlsch_modulation(PHY_VARS_eNB* phy_vars_eNB, &jj2, re_offset, symbol_offset, - dlsch0->harq_processes[harq_pid], - (dlsch1==NULL) ? NULL : dlsch1->harq_processes[harq_pid], + dlsch0, + dlsch1, pilots, ((pilots) ? amp_rho_b : amp_rho_a), get_pmi(frame_parms->N_RB_DL,dlsch0->harq_processes[harq_pid],rb), @@ -1581,8 +1637,7 @@ int dlsch_modulation(PHY_VARS_eNB* phy_vars_eNB, skip_half, lprime, mprime, - Ns, - beamforming_weights_RB); + Ns); if(mimo_mode==TM7 && lprime>=0) mprime +=3+frame_parms->Ncp; @@ -1590,20 +1645,17 @@ int dlsch_modulation(PHY_VARS_eNB* phy_vars_eNB, } re_offset+=12; // go to next RB - beamforming_weights_RB +=12; - // check if we crossed the symbol boundary and skip DC if (re_offset >= frame_parms->ofdm_symbol_size) { - if (skip_dc == 0) //even number of RBs (doesn't straddle DC) - re_offset=1; - else - re_offset=7; // odd number of RBs - } - beamforming_weights_RB = beamforming_weights; - } - + if (skip_dc == 0) //even number of RBs (doesn't straddle DC) + re_offset=1; + else + re_offset=7; // odd number of RBs } + } + + } diff --git a/openair1/PHY/LTE_TRANSPORT/initial_sync.c b/openair1/PHY/LTE_TRANSPORT/initial_sync.c index 69351e297f..10815bc3e0 100644 --- a/openair1/PHY/LTE_TRANSPORT/initial_sync.c +++ b/openair1/PHY/LTE_TRANSPORT/initial_sync.c @@ -163,7 +163,7 @@ char phich_resource[6]; if (pbch_decoded) { - frame_parms->nb_antennas_tx_eNB = pbch_tx_ant; + frame_parms->nb_antenna_ports_eNB = pbch_tx_ant; // set initial transmission mode to 1 or 2 depending on number of detected TX antennas frame_parms->mode1_flag = (pbch_tx_ant==1); @@ -566,7 +566,7 @@ int initial_sync(PHY_VARS_UE *phy_vars_ue, runmode_t mode) phy_vars_ue->lte_frame_parms.N_RB_DL, phy_vars_ue->lte_frame_parms.phich_config_common.phich_duration, phich_string[phy_vars_ue->lte_frame_parms.phich_config_common.phich_resource], - phy_vars_ue->lte_frame_parms.nb_antennas_tx_eNB); + phy_vars_ue->lte_frame_parms.nb_antenna_ports_eNB); #if defined(OAI_USRP) || defined(EXMIMO) LOG_I(PHY,"[UE %d] Frame %d Measured Carrier Frequency %.0f Hz (offset %d Hz)\n", phy_vars_ue->Mod_id, diff --git a/openair1/PHY/LTE_TRANSPORT/pbch.c b/openair1/PHY/LTE_TRANSPORT/pbch.c index 0582a63956..21061c1654 100755 --- a/openair1/PHY/LTE_TRANSPORT/pbch.c +++ b/openair1/PHY/LTE_TRANSPORT/pbch.c @@ -200,7 +200,7 @@ int generate_pbch(LTE_eNB_PBCH *eNB_pbch, /* // scramble crc with PBCH CRC mask (Table 5.3.1.1-1 of 3GPP 36.212-860) - switch (frame_parms->nb_antennas_tx_eNB) { + switch (frame_parms->nb_antenna_ports_eNB) { case 1: crc = crc ^ (uint16_t) 0; break; @@ -232,7 +232,7 @@ int generate_pbch(LTE_eNB_PBCH *eNB_pbch, if (frame_parms->mode1_flag == 1) amask = 0x0000; else { - switch (frame_parms->nb_antennas_tx_eNB) { + switch (frame_parms->nb_antenna_ports_eNB) { case 1: amask = 0x0000; break; @@ -492,7 +492,7 @@ uint16_t pbch_extract(int **rxdataF, } } - for (aatx=0; aatx<4; aatx++) { //frame_parms->nb_antennas_tx_eNB;aatx++) { + for (aatx=0; aatx<4; aatx++) { //frame_parms->nb_antenna_ports_eNB;aatx++) { if (high_speed_flag == 1) dl_ch0 = &dl_ch_estimates[(aatx<<1)+aarx][LTE_CE_OFFSET+ch_offset+(symbol*(frame_parms->ofdm_symbol_size))]; else @@ -554,7 +554,7 @@ int pbch_channel_level(int **dl_ch_estimates_ext, uint32_t nsymb = (frame_parms->Ncp==0) ? 7:6; uint32_t symbol_mod = symbol % nsymb; - for (aatx=0; aatx<4; aatx++) //frame_parms->nb_antennas_tx_eNB;aatx++) + for (aatx=0; aatx<4; aatx++) //frame_parms->nb_antenna_ports_eNB;aatx++) for (aarx=0; aarxnb_antennas_rx; aarx++) { //clear average level @@ -624,7 +624,7 @@ void pbch_channel_compensation(int **rxdataF_ext, #endif symbol_mod = (symbol>=(7-frame_parms->Ncp)) ? symbol-(7-frame_parms->Ncp) : symbol; - for (aatx=0; aatx<4; aatx++) //frame_parms->nb_antennas_tx_eNB;aatx++) + for (aatx=0; aatx<4; aatx++) //frame_parms->nb_antenna_ports_eNB;aatx++) for (aarx=0; aarxnb_antennas_rx; aarx++) { #if defined(__x86_64__) || defined(__i386__) @@ -731,7 +731,7 @@ void pbch_detection_mrc(LTE_DL_FRAME_PARMS *frame_parms, symbol_mod = (symbol>=(7-frame_parms->Ncp)) ? symbol-(7-frame_parms->Ncp) : symbol; if (frame_parms->nb_antennas_rx>1) { - for (aatx=0; aatx<4; aatx++) { //frame_parms->nb_antennas_tx_eNB;aatx++) { + for (aatx=0; aatx<4; aatx++) { //frame_parms->nb_antenna_ports_eNB;aatx++) { #if defined(__x86_64__) || defined(__i386__) rxdataF_comp128_0 = (__m128i *)&rxdataF_comp[(aatx<<1)][symbol_mod*6*12]; rxdataF_comp128_1 = (__m128i *)&rxdataF_comp[(aatx<<1)+1][symbol_mod*6*12]; @@ -1077,7 +1077,7 @@ uint16_t rx_pbch_emul(PHY_VARS_UE *phy_vars_ue, if (pbch_phase == (phy_vars_ue->frame_rx % 4)) { if (uniformrandom() >= bler) { memcpy(phy_vars_ue->lte_ue_pbch_vars[eNB_id]->decoded_output,PHY_vars_eNB_g[eNB_id][CC_id]->pbch_pdu,PBCH_PDU_SIZE); - return(PHY_vars_eNB_g[eNB_id][CC_id]->lte_frame_parms.nb_antennas_tx_eNB); + return(PHY_vars_eNB_g[eNB_id][CC_id]->lte_frame_parms.nb_antenna_ports_eNB); } else return(-1); } else diff --git a/openair1/PHY/LTE_TRANSPORT/pcfich.c b/openair1/PHY/LTE_TRANSPORT/pcfich.c index 8e9038666b..aeac370001 100644 --- a/openair1/PHY/LTE_TRANSPORT/pcfich.c +++ b/openair1/PHY/LTE_TRANSPORT/pcfich.c @@ -217,7 +217,7 @@ void generate_pcfich(uint8_t num_pdcch_symbols, if ((i!=nushiftmod3)&&(i!=(nushiftmod3+3))) { txdataF[0][symbol_offset+reg_offset+i] = pcfich_d[0][m]; - if (frame_parms->nb_antennas_tx_eNB>1) + if (frame_parms->nb_antenna_ports_eNB>1) txdataF[1][symbol_offset+reg_offset+i] = pcfich_d[1][m]; m++; diff --git a/openair1/PHY/LTE_TRANSPORT/pilots.c b/openair1/PHY/LTE_TRANSPORT/pilots.c index 772a47e131..4c5409a8ae 100644 --- a/openair1/PHY/LTE_TRANSPORT/pilots.c +++ b/openair1/PHY/LTE_TRANSPORT/pilots.c @@ -70,7 +70,7 @@ void generate_pilots(PHY_VARS_eNB *phy_vars_eNB, // printf("tti %d : offset %d (slot %d)\n",tti,tti_offset,slot_offset); //Generate Pilots - //antenna 0 symbol 0 slot 0 + //antenna port 0 symbol 0 slot 0 lte_dl_cell_spec(phy_vars_eNB,&txdataF[0][tti_offset], amp, slot_offset, @@ -79,7 +79,7 @@ void generate_pilots(PHY_VARS_eNB *phy_vars_eNB, // printf("tti %d : second_pilot offset %d \n",tti,tti_offset+(second_pilot*samples_per_symbol)); - //antenna 0 symbol 3/4 slot 0 + //antenna port 0 symbol 3/4 slot 0 lte_dl_cell_spec(phy_vars_eNB,&txdataF[0][tti_offset+(second_pilot*samples_per_symbol)], amp, slot_offset, @@ -87,7 +87,7 @@ void generate_pilots(PHY_VARS_eNB *phy_vars_eNB, 0); // printf("tti %d : third_pilot offset %d \n",tti,tti_offset+((Nsymb>>1)*samples_per_symbol)); - //antenna 0 symbol 0 slot 1 + //antenna port 0 symbol 0 slot 1 lte_dl_cell_spec(phy_vars_eNB,&txdataF[0][tti_offset+((Nsymb>>1)*samples_per_symbol)], amp, 1+slot_offset, @@ -95,7 +95,7 @@ void generate_pilots(PHY_VARS_eNB *phy_vars_eNB, 0); // printf("tti %d : third_pilot offset %d \n",tti,tti_offset+(((Nsymb>>1)+second_pilot)*samples_per_symbol)); - //antenna 0 symbol 3/4 slot 1 + //antenna port 0 symbol 3/4 slot 1 lte_dl_cell_spec(phy_vars_eNB,&txdataF[0][tti_offset+(((Nsymb>>1)+second_pilot)*samples_per_symbol)], amp, 1+slot_offset, @@ -103,66 +103,35 @@ void generate_pilots(PHY_VARS_eNB *phy_vars_eNB, 0); - if (frame_parms->nb_antennas_tx > 1) { - if (frame_parms->mode1_flag) { - // antenna 1 symbol 0 slot 0 - lte_dl_cell_spec(phy_vars_eNB,&txdataF[1][tti_offset], - amp, - slot_offset, - 0, - 0); + if (frame_parms->nb_antenna_ports_eNB > 1) { - // antenna 1 symbol 3 slot 0 - lte_dl_cell_spec(phy_vars_eNB,&txdataF[1][tti_offset+(second_pilot*samples_per_symbol)], - amp, - slot_offset, - 1, - 0); - - //antenna 1 symbol 0 slot 1 - lte_dl_cell_spec(phy_vars_eNB,&txdataF[1][tti_offset+(Nsymb>>1)*samples_per_symbol], - amp, - 1+slot_offset, - 0, - 0); - - // antenna 1 symbol 3 slot 1 - lte_dl_cell_spec(phy_vars_eNB,&txdataF[1][tti_offset+(((Nsymb>>1)+second_pilot)*samples_per_symbol)], - amp, - 1+slot_offset, - 1, - 0); - - } else { - - // antenna 1 symbol 0 slot 0 + // antenna port 1 symbol 0 slot 0 lte_dl_cell_spec(phy_vars_eNB,&txdataF[1][tti_offset], amp, slot_offset, 0, 1); - // antenna 1 symbol 3 slot 0 + // antenna port 1 symbol 3 slot 0 lte_dl_cell_spec(phy_vars_eNB,&txdataF[1][tti_offset+(second_pilot*samples_per_symbol)], amp, slot_offset, 1, 1); - //antenna 1 symbol 0 slot 1 + //antenna port 1 symbol 0 slot 1 lte_dl_cell_spec(phy_vars_eNB,&txdataF[1][tti_offset+(Nsymb>>1)*samples_per_symbol], amp, 1+slot_offset, 0, 1); - // antenna 1 symbol 3 slot 1 + // antenna port 1 symbol 3 slot 1 lte_dl_cell_spec(phy_vars_eNB,&txdataF[1][tti_offset+(((Nsymb>>1)+second_pilot)*samples_per_symbol)], amp, 1+slot_offset, 1, 1); - } } } } @@ -193,7 +162,7 @@ int generate_pilots_slot(PHY_VARS_eNB *phy_vars_eNB, // printf("tti %d : offset %d (slot %d)\n",tti,tti_offset,slot_offset); //Generate Pilots - //antenna 0 symbol 0 slot 0 + //antenna port 0 symbol 0 slot 0 lte_dl_cell_spec(phy_vars_eNB, &txdataF[0][slot_offset], amp, @@ -212,44 +181,24 @@ int generate_pilots_slot(PHY_VARS_eNB *phy_vars_eNB, 0); } - if (frame_parms->nb_antennas_tx > 1) { - if (frame_parms->mode1_flag) { - // antenna 1 symbol 0 slot 0 + if (frame_parms->nb_antenna_ports_eNB > 1) { + + // antenna port 1 symbol 0 slot 0 + lte_dl_cell_spec(phy_vars_eNB, + &txdataF[1][slot_offset], + amp, + slot, + 0, + 1); + + if (first_pilot_only == 0) { + // antenna port 1 symbol 3 slot 0 lte_dl_cell_spec(phy_vars_eNB, - &txdataF[1][slot_offset], + &txdataF[1][slot_offset+(second_pilot*samples_per_symbol)], amp, slot, - 0, - 0); - - if (first_pilot_only==0) { - // antenna 1 symbol 3 slot 0 - lte_dl_cell_spec(phy_vars_eNB, - &txdataF[1][slot_offset+(second_pilot*samples_per_symbol)], - amp, - slot, - 1, - 0); - } - } else { - - // antenna 1 symbol 0 slot 0 - lte_dl_cell_spec(phy_vars_eNB, - &txdataF[1][slot_offset], - amp, - slot, - 0, + 1, 1); - - if (first_pilot_only == 0) { - // antenna 1 symbol 3 slot 0 - lte_dl_cell_spec(phy_vars_eNB, - &txdataF[1][slot_offset+(second_pilot*samples_per_symbol)], - amp, - slot, - 1, - 1); - } } } diff --git a/openair1/PHY/LTE_TRANSPORT/proto.h b/openair1/PHY/LTE_TRANSPORT/proto.h index 1161950e8f..4d450ba5f5 100644 --- a/openair1/PHY/LTE_TRANSPORT/proto.h +++ b/openair1/PHY/LTE_TRANSPORT/proto.h @@ -63,8 +63,10 @@ void clean_eNb_dlsch(LTE_eNB_DLSCH_t *dlsch, uint8_t abstraction_flag); @param Mdlharq Maximum number of HARQ rounds (36-212/36-213) @params N_RB_DL total number of resource blocks (determine the operating BW) @param abstraction_flag Flag to indicate abstracted interface + @param nb_antenna_tx number of physical transmit antennas at eNB */ -LTE_eNB_DLSCH_t *new_eNB_dlsch(uint8_t Kmimo,uint8_t Mdlharq,uint8_t N_RB_DL, uint8_t abstraction_flag); +LTE_eNB_DLSCH_t *new_eNB_dlsch(uint8_t Kmimo,uint8_t Mdlharq,uint8_t +N_RB_DL, uint8_t abstraction_flag, LTE_DL_FRAME_PARMS* frame_parms); /** \fn free_ue_dlsch(LTE_UE_DLSCH_t *dlsch) \brief This function frees memory allocated for a particular DLSCH at UE @@ -157,7 +159,6 @@ void dlsch_encoding_emul(PHY_VARS_eNB *phy_vars_eNB, \param skip_half indicate that first or second half of RB must be skipped for PBCH/PSS/SSS \param ue_spec_rs UE specific RS indicator \param nb_antennas_tx_phy Physical antenna elements which can be different with antenna port number, especially in beamforming case - \param beamforming_weights_rb Beamforming weights applied on each antenna element and each carrier in case of TM7-10 \param use2ndpilots Set to use the pilots from antenna port 1 for PDSCH \param frame_parms Frame parameter descriptor */ @@ -168,8 +169,8 @@ int32_t allocate_REs_in_RB(PHY_VARS_eNB* phy_vars_eNB, uint32_t *jj2, uint16_t re_offset, uint32_t symbol_offset, - LTE_DL_eNB_HARQ_t *dlsch0_harq, - LTE_DL_eNB_HARQ_t *dlsch1_harq, + LTE_eNB_DLSCH_t *dlsch0, + LTE_eNB_DLSCH_t *dlsch1, uint8_t pilots, int16_t amp, uint8_t precoder_index, @@ -178,10 +179,9 @@ int32_t allocate_REs_in_RB(PHY_VARS_eNB* phy_vars_eNB, uint32_t *re_allocated, uint8_t skip_dc, uint8_t skip_half, - uint8_t lprime, - uint8_t mprime, - uint8_t Ns, - int32_t **beamforming_weights); + uint8_t lprime, + uint8_t mprime, + uint8_t Ns); /** \fn int32_t dlsch_modulation(mod_sym_t **txdataF, int16_t amp, @@ -198,8 +198,6 @@ int32_t allocate_REs_in_RB(PHY_VARS_eNB* phy_vars_eNB, @param num_pdcch_symbols Number of PDCCH symbols in this subframe @param dlsch0 Pointer to Transport Block 0 DLSCH descriptor for this allocation @param dlsch1 Pointer to Transport Block 0 DLSCH descriptor for this allocation - @param nb_antennas_tx_phy Physical antenna elements which can be different with antenna port number, especially in beamforming case - @param beamforming_weights Beamforming weights applied on each antenna element and each carrier in case of TM7-10 */ int32_t dlsch_modulation(PHY_VARS_eNB* phy_vars_eNB, mod_sym_t **txdataF, @@ -207,8 +205,7 @@ int32_t dlsch_modulation(PHY_VARS_eNB* phy_vars_eNB, uint32_t sub_frame_offset, uint8_t num_pdcch_symbols, LTE_eNB_DLSCH_t *dlsch0, - LTE_eNB_DLSCH_t *dlsch1, - int32_t **beamforming_weights); + LTE_eNB_DLSCH_t *dlsch1); /* \brief This function is the top-level routine for generation of the sub-frame signal (frequency-domain) for MCH. @param txdataF Table of pointers for frequency-domain TX signals @@ -331,6 +328,41 @@ int32_t generate_pbch(LTE_eNB_PBCH *eNB_pbch, int32_t generate_pbch_emul(PHY_VARS_eNB *phy_vars_eNB,uint8_t *pbch_pdu); + +/** \brief This function performs UE specific beamforming especially for + * transmission mode TM7-10 + @param txdataF Table of pointers for frequency-domain TX signals + @param txdataF_BF Table of pointers for frequency-domain TX signals +after beamforming + @param frame_parms Frame descriptor structure + @param ue_spec_bf_weights UE specific beamforming weights applied on +each antenna element and each carrier + @param slot Slot number + @param symbol Symbol index on which to act*/ +int ue_spec_beamforming(int32_t **txdataF, + int32_t **txdataF_BF, + LTE_DL_FRAME_PARMS *frame_parms, + int32_t ***ue_spec_bf_weights, + int slot, + int symbol); + +/** \brief This function performs cell specific beamforming for common + * data + @param txdataF Table of pointers for frequency-domain TX signals + @param txdataF_BF Table of pointers for frequency-domain TX signals + @param frame_parms Frame descriptor structure +after beamforming + @param cell_spec_bf_weights Common beamforming weights applied on each +antenna element and each carrier + @param slot Slot number + @param symbol Symbol index on which to act*/ +int cell_spec_beamforming(int32_t **txdataF, + int32_t **txdataF_BF, + LTE_DL_FRAME_PARMS *frame_parms, + int32_t ***cell_spec_bf_weights, + int slot, + int symbol); + /** \brief This function computes the LLRs for ML (max-logsum approximation) dual-stream QPSK/QPSK reception. @param stream0_in Input from channel compensated (MR combined) stream 0 @param stream1_in Input from channel compensated (MR combined) stream 1 diff --git a/openair1/PHY/MODULATION/slot_fep.c b/openair1/PHY/MODULATION/slot_fep.c index ec1c0045b0..b259bc5148 100644 --- a/openair1/PHY/MODULATION/slot_fep.c +++ b/openair1/PHY/MODULATION/slot_fep.c @@ -184,7 +184,7 @@ int slot_fep(PHY_VARS_UE *phy_vars_ue, if (phy_vars_ue->perfect_ce == 0) { if ((l==0) || (l==(4-frame_parms->Ncp))) { - for (aa=0; aanb_antennas_tx_eNB; aa++) { + for (aa=0; aanb_antenna_ports_eNB; aa++) { #ifdef DEBUG_FEP msg("Channel estimation eNB %d, aatx %d, slot %d, symbol %d\n",eNB_id,aa,Ns,l); diff --git a/openair1/PHY/TOOLS/lte_phy_scope.c b/openair1/PHY/TOOLS/lte_phy_scope.c index bc3dbcf289..ba361247db 100644 --- a/openair1/PHY/TOOLS/lte_phy_scope.c +++ b/openair1/PHY/TOOLS/lte_phy_scope.c @@ -482,7 +482,7 @@ void phy_scope_UE(FD_lte_phy_scope_ue *form, LTE_DL_FRAME_PARMS *frame_parms = &phy_vars_ue->lte_frame_parms; int nsymb_ce = frame_parms->ofdm_symbol_size;//*frame_parms->symbols_per_tti; uint8_t nb_antennas_rx = frame_parms->nb_antennas_rx; - uint8_t nb_antennas_tx = frame_parms->nb_antennas_tx_eNB; + uint8_t nb_antennas_tx = frame_parms->nb_antennas_ports_eNB; int16_t **rxsig_t; int16_t **chest_t; int16_t **chest_f; diff --git a/openair1/PHY/TOOLS/smbv.c b/openair1/PHY/TOOLS/smbv.c index 426fb5b68e..25585d0c1c 100644 --- a/openair1/PHY/TOOLS/smbv.c +++ b/openair1/PHY/TOOLS/smbv.c @@ -127,7 +127,7 @@ int smbv_write_config_from_frame_parms(const char* fname, LTE_DL_FRAME_PARMS *fr fprintf(f_ptr, "BB:EUTR:TDD:SPSC %d\n",frame_parms->tdd_config_S); // MIMO - fprintf(f_ptr, "BB:EUTR:DL:MIMO:CONF TX%d\n",frame_parms->nb_antennas_tx_eNB); + fprintf(f_ptr, "BB:EUTR:DL:MIMO:CONF TX%d\n",frame_parms->nb_antenna_ports_eNB); fprintf(f_ptr, "BB:EUTR:DL:MIMO:ANTA ANT1\n"); fprintf(f_ptr, "BB:EUTR:DL:MIMO:ANTB NONE\n"); diff --git a/openair1/PHY/defs.h b/openair1/PHY/defs.h index d9965b4e75..5697ff0dd2 100755 --- a/openair1/PHY/defs.h +++ b/openair1/PHY/defs.h @@ -220,8 +220,8 @@ typedef struct PHY_VARS_eNB_s { LTE_eNB_PUSCH *lte_eNB_pusch_vars[NUMBER_OF_UE_MAX]; LTE_eNB_PRACH lte_eNB_prach_vars; LTE_eNB_DLSCH_t *dlsch_eNB[NUMBER_OF_UE_MAX][2]; // Nusers times two spatial streams - // old: LTE_eNB_DLSCH_t **dlsch_eNB[2]; // Nusers times two spatial streams - LTE_eNB_ULSCH_t *ulsch_eNB[NUMBER_OF_UE_MAX+1]; // Nusers + number of RA + // old: LTE_eNB_DLSCH_t **dlsch_eNB[2]; // Nusers times two spatial streams + LTE_eNB_ULSCH_t *ulsch_eNB[NUMBER_OF_UE_MAX+1]; // Nusers + number of RA LTE_eNB_DLSCH_t *dlsch_eNB_SI,*dlsch_eNB_ra; LTE_eNB_DLSCH_t *dlsch_eNB_MCH; LTE_eNB_UE_stats eNB_UE_stats[NUMBER_OF_UE_MAX]; diff --git a/openair1/PHY/impl_defs_lte.h b/openair1/PHY/impl_defs_lte.h index f580340827..3de93e100e 100644 --- a/openair1/PHY/impl_defs_lte.h +++ b/openair1/PHY/impl_defs_lte.h @@ -530,12 +530,12 @@ typedef struct { uint32_t samples_per_tti; /// Number of OFDM/SC-FDMA symbols in one subframe (to be modified to account for potential different in UL/DL) uint16_t symbols_per_tti; - /// Number of Transmit antennas in node + /// Number of Physical transmit antennas in node uint8_t nb_antennas_tx; /// Number of Receive antennas in node uint8_t nb_antennas_rx; - /// Number of Transmit antennas in eNodeB - uint8_t nb_antennas_tx_eNB; + /// Number of Logical transmit antenna ports in eNodeB + uint8_t nb_antenna_ports_eNB; /// PRACH_CONFIG PRACH_CONFIG_COMMON prach_config_common; /// PUCCH Config Common (from 36-331 RRC spec) @@ -602,11 +602,17 @@ typedef struct { /// - third index: int32_t **txdata[3]; /// \brief holds the transmit data in the frequency domain. - /// For IFFT_FPGA this points to the same memory as PHY_vars->rx_vars[a].RX_DMA_BUFFER. + /// For IFFT_FPGA this points to the same memory as PHY_vars->rx_vars[a].RX_DMA_BUFFER. //? + /// - first index: eNB id [0..2] (hard coded) + /// - second index: tx antenna [0..14[ where 14 is the total supported antenna ports. + /// - third index: sample [0..] + mod_sym_t **txdataF[3]; + /// \brief holds the transmit data after beamforming in the frequency domain. + /// For IFFT_FPGA this points to the same memory as PHY_vars->rx_vars[a].RX_DMA_BUFFER. //? /// - first index: eNB id [0..2] (hard coded) /// - second index: tx antenna [0..nb_antennas_tx[ /// - third index: sample [0..] - mod_sym_t **txdataF[3]; + mod_sym_t **txdataF_BF[3]; /// \brief Holds the received data in time domain. /// Should point to the same memory as PHY_vars->rx_vars[a].RX_DMA_BUFFER. /// - first index: eNB id [0..2] (hard coded) @@ -627,6 +633,18 @@ typedef struct { /// - first index: eNB id [0..2] (hard coded) /// - second index: sample [0..samples_per_tti*10[ uint32_t *sync_corr[3]; + /// \brief Holds the cell specific beamforming weights + /// - first index: eNB id [0..2] (hard coded) + /// - second index: cell specific eNB antenna port index, up to 2 logical antenna ports are supported + /// - third index: tx antenna [0..nb_antennas_tx[ + /// - fourth index: sample [0..] + int32_t **cell_spec_bf_weights[3][2]; + /// \brief Holds the ue specific beamforming weights + /// - first index: eNB id [0..2] (hard coded) + /// - second index: ue specific eNB antenna port index, port5->index0, port7-15->index0-7 + /// - third index: tx antenna [0..nb_antennas_tx[ + /// - fourth index: sample [0..] + int32_t **ue_spec_bf_weights[3][8]; } LTE_eNB_COMMON; typedef struct { diff --git a/openair1/PHY/impl_defs_top.h b/openair1/PHY/impl_defs_top.h index a0302fd526..0663d8152e 100755 --- a/openair1/PHY/impl_defs_top.h +++ b/openair1/PHY/impl_defs_top.h @@ -183,6 +183,7 @@ #define DMA_BLKS_PER_SLOT (SLOT_LENGTH_BYTES/2048) // Number of DMA blocks per slot #define SLOT_TIME_NS (SLOT_LENGTH_SAMPLES*(1e3)/7.68) // slot time in ns +#define NB_ANTENNA_PORTS_ENB 14 // total number of eNB antenna ports #ifdef EXMIMO #define TARGET_RX_POWER 55 // Target digital power for the AGC diff --git a/openair1/SCHED/phy_procedures_lte_eNb.c b/openair1/SCHED/phy_procedures_lte_eNb.c index aa4df65eff..106007cc22 100755 --- a/openair1/SCHED/phy_procedures_lte_eNb.c +++ b/openair1/SCHED/phy_procedures_lte_eNb.c @@ -1434,7 +1434,7 @@ void phy_procedures_eNB_TX(unsigned char sched_subframe,PHY_VARS_eNB *phy_vars_e if (abstraction_flag==0) { // clear the transmit data array for the current subframe - for (aa=0; aalte_frame_parms.nb_antennas_tx_eNB; aa++) { + for (aa=0; aalte_frame_parms.nb_antenna_ports_eNB; aa++) { memset(&phy_vars_eNB->lte_eNB_common_vars.txdataF[0][aa][subframe*phy_vars_eNB->lte_frame_parms.ofdm_symbol_size*(phy_vars_eNB->lte_frame_parms.symbols_per_tti)], 0,phy_vars_eNB->lte_frame_parms.ofdm_symbol_size*(phy_vars_eNB->lte_frame_parms.symbols_per_tti)*sizeof(mod_sym_t)); @@ -2243,8 +2243,7 @@ void phy_procedures_eNB_TX(unsigned char sched_subframe,PHY_VARS_eNB *phy_vars_e subframe, num_pdcch_symbols, phy_vars_eNB->dlsch_eNB_SI, - (LTE_eNB_DLSCH_t *)NULL, - (int32_t **)NULL); + (LTE_eNB_DLSCH_t *)NULL); stop_meas(&phy_vars_eNB->dlsch_modulation_stats); } @@ -2381,8 +2380,7 @@ void phy_procedures_eNB_TX(unsigned char sched_subframe,PHY_VARS_eNB *phy_vars_e subframe, num_pdcch_symbols, phy_vars_eNB->dlsch_eNB_ra, - (LTE_eNB_DLSCH_t *)NULL, - (int32_t **)NULL); + (LTE_eNB_DLSCH_t *)NULL); } @@ -2560,8 +2558,7 @@ void phy_procedures_eNB_TX(unsigned char sched_subframe,PHY_VARS_eNB *phy_vars_e subframe, num_pdcch_symbols, phy_vars_eNB->dlsch_eNB[(uint8_t)UE_id][0], - phy_vars_eNB->dlsch_eNB[(uint8_t)UE_id][1], - (int32_t **)NULL); + phy_vars_eNB->dlsch_eNB[(uint8_t)UE_id][1]); stop_meas(&phy_vars_eNB->dlsch_modulation_stats); } diff --git a/openair1/SIMULATION/LTE_PHY/dlsim.c b/openair1/SIMULATION/LTE_PHY/dlsim.c index 2501baff25..fcea2f53af 100644 --- a/openair1/SIMULATION/LTE_PHY/dlsim.c +++ b/openair1/SIMULATION/LTE_PHY/dlsim.c @@ -134,7 +134,7 @@ void lte_param_init(unsigned char N_tx_port_eNB, unsigned char N_tx_phy, unsigne lte_frame_parms->nushift = Nid_cell%6; lte_frame_parms->nb_antennas_tx = N_tx_phy; lte_frame_parms->nb_antennas_rx = N_rx; - lte_frame_parms->nb_antennas_tx_eNB = N_tx_port_eNB; + lte_frame_parms->nb_antenna_ports_eNB = N_tx_port_eNB; lte_frame_parms->phich_config_common.phich_resource = one; lte_frame_parms->tdd_config = tdd_config; lte_frame_parms->frame_type = (fdd_flag==1)?0 : 1; @@ -205,32 +205,59 @@ uint64_t DLSCH_alloc_pdu_1[2]; #define CCCH_RB_ALLOC computeRIV(PHY_vars_eNB->lte_frame_parms.N_RB_UL,0,2) //#define DLSCH_RB_ALLOC 0x1fbf // igore DC component,RB13 //#define DLSCH_RB_ALLOC 0x0001 -void do_OFDM_mod_l(mod_sym_t **txdataF, int32_t **txdata, uint16_t next_slot, LTE_DL_FRAME_PARMS *frame_parms) +void do_OFDM_mod_l(LTE_eNB_COMMON *eNB_common_vars, int eNB_id, uint16_t next_slot, LTE_DL_FRAME_PARMS *frame_parms, uint8_t num_pdcch_symbols, unsigned char transmission_mode) { - int aa, slot_offset, slot_offset_F; + int aa, l, slot_offset, slot_offset_F; + mod_sym_t **txdataF = eNB_common_vars->txdataF[eNB_id]; + mod_sym_t **txdataF_BF = eNB_common_vars->txdataF_BF[eNB_id]; + int32_t **txdata = eNB_common_vars->txdata[eNB_id]; - slot_offset_F = (next_slot)*(frame_parms->ofdm_symbol_size)*((frame_parms->Ncp==1) ? 6 : 7); + //slot_offset_F = (next_slot)*(frame_parms->ofdm_symbol_size)*((frame_parms->Ncp==1) ? 6 : 7); slot_offset = (next_slot)*(frame_parms->samples_per_tti>>1); - for (aa=0; aanb_antennas_tx; aa++) { - // printf("Thread %d starting ... aa %d (%llu)\n",omp_get_thread_num(),aa,rdtsc()); + // printf("Thread %d starting ... aa %d (%llu)\n",omp_get_thread_num(),aa,rdtsc()); + for (l=0; lsymbols_per_tti>>1; l++) { + + //printf("do_OFDM_mod_l, slot=%d, l=%d, NUMBER_OF_OFDM_CARRIERS=%d,OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES=%d\n",next_slot, l,NUMBER_OF_OFDM_CARRIERS,OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES); + if (lcell_spec_bf_weights,next_slot,l); + else + if (transmission_mode<7) + cell_spec_beamforming(txdataF,txdataF_BF,frame_parms,eNB_common_vars->cell_spec_bf_weights,next_slot,l); + else + ue_spec_beamforming(txdataF,txdataF_BF,frame_parms,eNB_common_vars->ue_spec_bf_weights,next_slot,l); - if (frame_parms->Ncp == 1) - PHY_ofdm_mod(&txdataF[aa][slot_offset_F], // input - &txdata[aa][slot_offset], // output - frame_parms->log2_symbol_size, // log2_fft_size - 6, // number of symbols - frame_parms->nb_prefix_samples, // number of prefix samples - CYCLIC_PREFIX); - else { - normal_prefix_mod(&txdataF[aa][slot_offset_F], - &txdata[aa][slot_offset], - 7, - frame_parms); + for (aa=0; aanb_antennas_tx; aa++) { + + if (frame_parms->Ncp == 1) + PHY_ofdm_mod(txdataF_BF[aa], // input + &txdata[aa][slot_offset+l*OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES], // output + frame_parms->log2_symbol_size, // log2_fft_size + 1, // number of symbols + frame_parms->nb_prefix_samples, // number of prefix samples + CYCLIC_PREFIX); + else { + if (l==0) { + PHY_ofdm_mod(txdataF_BF[aa], // input + &txdata[aa][slot_offset], // output + frame_parms->log2_symbol_size, // log2_fft_size + 1, // number of symbols + frame_parms->nb_prefix_samples0, // number of prefix samples + CYCLIC_PREFIX); + + } else { + PHY_ofdm_mod(txdataF_BF[aa], // input + &txdata[aa][slot_offset+OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES0+(l-1)*OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES], // output + frame_parms->log2_symbol_size, // log2_fft_size + 1, // number of symbols + frame_parms->nb_prefix_samples, // number of prefix samples + CYCLIC_PREFIX); + } + } + + } - - } } @@ -239,7 +266,8 @@ int main(int argc, char **argv) { int c; - int k,i,aa,aarx,aatx; + int k,i,j,aa,aarx,aatx; + int re; int s,Kr,Kr_bytes; @@ -253,7 +281,7 @@ int main(int argc, char **argv) uint8_t extended_prefix_flag=0,transmission_mode=1,n_tx_port=1,n_tx_phy=1,n_rx=1; uint16_t Nid_cell=0; - int32_t **beamforming_weights; + int32_t **ue_spec_bf_weights, **cell_spec_bf_weights; int eNB_id = 0, eNB_id_i = 1; unsigned char mcs1=0,mcs2=0,mcs_i=0,dual_stream_UE = 0,awgn_flag=0,round,dci_flag=0; @@ -585,7 +613,7 @@ int main(int argc, char **argv) //if (transmission_mode==7 && (n_tx_phy!=1 && n_tx_phy!=2 && n_tx_phy!=4 && n_tx_phy!=8 && n_tx_phy!=16 && n_tx_phy!=64 && n_tx_phy!=128)) { if (transmission_mode==7 && (n_tx_phy!=1 && n_tx_phy!=2 && n_tx_phy!=4 && n_tx_phy!=16 && n_tx_phy!=64)) { - msg("For TM7, physical antenna number should be an exponent of 4, maximum 64 antennas supported.\n"); + msg("Physical number of antennas not supported for TM7.\n"); exit(-1); } @@ -767,28 +795,21 @@ int main(int argc, char **argv) lte_param_init(n_tx_port,n_tx_phy,n_rx,transmission_mode,extended_prefix_flag,fdd_flag,Nid_cell,tdd_config,N_RB_DL,osf,perfect_ce); + frame_parms = &PHY_vars_eNB->lte_frame_parms; + + cell_spec_bf_weights = PHY_vars_eNB->lte_eNB_common_vars.cell_spec_bf_weights[0][0]; + for(aa=0;aaofdm_symbol_size;i++) { + cell_spec_bf_weights[aa][i] = 0x00007fff; + } + } + if (transmission_mode==7){ lte_gold_ue_spec_port5(PHY_vars_eNB->lte_gold_uespec_port5_table[0],Nid_cell,n_rnti); lte_gold_ue_spec_port5(PHY_vars_UE->lte_gold_uespec_port5_table,Nid_cell,n_rnti); - - beamforming_weights = (int32_t **)malloc(12*N_RB_DL*sizeof(int32_t*)); - for(i=0;i<12*N_RB_DL;i++){ - beamforming_weights[i]=(int32_t *)malloc(n_tx_phy*sizeof(int32_t)); - for(aa=0;aa>1; - else if (n_tx_phy==16) - beamforming_weights[i][aa] = 0x00007fff>>2; - else if (n_tx_phy==64) - beamforming_weights[i][aa] = 0x00007fff>>4;//3 - } - } - printf("***n_tx_phy=%d,n_tx_phy>>2=%d,beamforming_weights=%d\n",n_tx_phy,n_tx_phy>>2,beamforming_weights[0][0]); } + eNB_id_i = PHY_vars_UE->n_connected_eNB; printf("Setting mcs1 = %d\n",mcs1); @@ -810,8 +831,6 @@ int main(int argc, char **argv) txdata[1] = (int *)malloc16(FRAME_LENGTH_BYTES); */ - frame_parms = &PHY_vars_eNB->lte_frame_parms; - s_re = malloc(n_tx_phy*sizeof(double*)); s_im = malloc(n_tx_phy*sizeof(double*)); r_re = malloc(2*sizeof(double*)); @@ -1041,11 +1060,31 @@ int main(int argc, char **argv) for (k=0; kdlsch_eNB[k][i] = new_eNB_dlsch(Kmimo,8,N_RB_DL,0); + + PHY_vars_eNB->dlsch_eNB[k][i] = new_eNB_dlsch(Kmimo,8,N_RB_DL,0,&PHY_vars_UE->lte_frame_parms); if (!PHY_vars_eNB->dlsch_eNB[k][i]) { printf("Can't get eNB dlsch structures\n"); exit(-1); + } else { + // this initilisation may should be moved to another place + for (j=0; j<4; j++) { // antenna port 5,7-14 + + ue_spec_bf_weights = PHY_vars_eNB->dlsch_eNB[k][i]->ue_spec_bf_weights[j]; + + for (aa=0; aanb_antennas_tx; aa++) { + for (re=0;reofdm_symbol_size;re++) { + if (n_tx_phy==1 || n_tx_phy==2) + ue_spec_bf_weights[aa][re] = 0x00007fff; + else if (n_tx_phy==4) + ue_spec_bf_weights[aa][re] = 0x00007fff>>1; + else if (n_tx_phy==16) + ue_spec_bf_weights[aa][re] = 0x00007fff>>2; + else if (n_tx_phy==64) + ue_spec_bf_weights[aa][re] = 0x00007fff>>4; + } + } + } } PHY_vars_eNB->dlsch_eNB[k][i]->rnti = n_rnti+k; @@ -1064,7 +1103,7 @@ int main(int argc, char **argv) } // structure for SIC at UE - PHY_vars_UE->dlsch_eNB[0] = new_eNB_dlsch(Kmimo,8,N_RB_DL,0); + PHY_vars_UE->dlsch_eNB[0] = new_eNB_dlsch(Kmimo,8,N_RB_DL,0,&PHY_vars_eNB->lte_frame_parms); if (DLSCH_alloc_pdu2_1E[0].tpmi == 5) { @@ -2221,8 +2260,7 @@ int main(int argc, char **argv) PMI_FEEDBACK: //printf("Trial %d : Round %d, pmi_feedback %d \n",trials,round,pmi_feedback); - //for (aa=0; aalte_frame_parms.nb_antennas_tx; aa++) { - for (aa=0; aalte_frame_parms.nb_antennas_tx; aa++) { + for (aa=0; aalte_eNB_common_vars.txdataF[eNB_id][aa][0],0,FRAME_LENGTH_COMPLEX_SAMPLES_NO_PREFIX*sizeof(mod_sym_t)); } @@ -2738,8 +2776,7 @@ PMI_FEEDBACK: subframe, num_pdcch_symbols, PHY_vars_eNB->dlsch_eNB[k][0], - PHY_vars_eNB->dlsch_eNB[k][1], - beamforming_weights); + PHY_vars_eNB->dlsch_eNB[k][1]); stop_meas(&PHY_vars_eNB->dlsch_modulation_stats); /* if (trials==0 && round==0) @@ -2883,27 +2920,37 @@ PMI_FEEDBACK: } */ - do_OFDM_mod_l(PHY_vars_eNB->lte_eNB_common_vars.txdataF[eNB_id], - PHY_vars_eNB->lte_eNB_common_vars.txdata[eNB_id], + do_OFDM_mod_l(&PHY_vars_eNB->lte_eNB_common_vars, + eNB_id, (subframe*2), - &PHY_vars_eNB->lte_frame_parms); + &PHY_vars_eNB->lte_frame_parms, + num_pdcch_symbols, + transmission_mode); - do_OFDM_mod_l(PHY_vars_eNB->lte_eNB_common_vars.txdataF[eNB_id], - PHY_vars_eNB->lte_eNB_common_vars.txdata[eNB_id], + do_OFDM_mod_l(&PHY_vars_eNB->lte_eNB_common_vars, + eNB_id, (subframe*2)+1, - &PHY_vars_eNB->lte_frame_parms); + &PHY_vars_eNB->lte_frame_parms, + num_pdcch_symbols, + transmission_mode); stop_meas(&PHY_vars_eNB->ofdm_mod_stats); stop_meas(&PHY_vars_eNB->phy_proc_tx); - do_OFDM_mod_l(PHY_vars_eNB->lte_eNB_common_vars.txdataF[eNB_id], - PHY_vars_eNB->lte_eNB_common_vars.txdata[eNB_id], + /* do_OFDM_mod_l(&PHY_vars_eNB->lte_eNB_common_vars, + eNB_id, (subframe*2)+2, - &PHY_vars_eNB->lte_frame_parms); + &PHY_vars_eNB->lte_frame_parms); */ if (n_frames==1) { - write_output("txsigF0.m","txsF0", &PHY_vars_eNB->lte_eNB_common_vars.txdataF[eNB_id][0][subframe*nsymb*PHY_vars_eNB->lte_frame_parms.ofdm_symbol_size], - nsymb*PHY_vars_eNB->lte_frame_parms.ofdm_symbol_size,1,1); + if (transmission_mode<7) + write_output("txsigF0.m","txsF0", &PHY_vars_eNB->lte_eNB_common_vars.txdataF[eNB_id][0][subframe*nsymb*PHY_vars_eNB->lte_frame_parms.ofdm_symbol_size], + nsymb*PHY_vars_eNB->lte_frame_parms.ofdm_symbol_size,1,1); + else if (transmission_mode==7) + write_output("txsigF0.m","txsF0", &PHY_vars_eNB->lte_eNB_common_vars.txdataF[eNB_id][5][subframe*nsymb*PHY_vars_eNB->lte_frame_parms.ofdm_symbol_size], + nsymb*PHY_vars_eNB->lte_frame_parms.ofdm_symbol_size,1,1); + write_output("txsigF0_BF.m","txsF0_BF", &PHY_vars_eNB->lte_eNB_common_vars.txdataF_BF[eNB_id][0][0], + PHY_vars_eNB->lte_frame_parms.ofdm_symbol_size,1,1); if (PHY_vars_eNB->lte_frame_parms.nb_antennas_tx>1)// to be updated write_output("txsigF1.m","txsF1", &PHY_vars_eNB->lte_eNB_common_vars.txdataF[eNB_id][1][subframe*nsymb*PHY_vars_eNB->lte_frame_parms.ofdm_symbol_size], @@ -3144,7 +3191,7 @@ PMI_FEEDBACK: //write_output("channel.m","ch",desc1->ch[0],desc1->channel_length,1,8); //write_output("channelF.m","chF",desc1->chF[0],nb_samples,1,8); for(k=0; knb_antennas_tx_eNB; aa++) { + for(aa=0; aanb_antenna_ports_eNB; aa++) { for (aarx=0; aarxnb_antennas_rx; aarx++) { for (i=0; iN_RB_DL*12; i++) { ((int16_t *) PHY_vars_UE->lte_ue_common_vars.dl_ch_estimates[k][(aa<<1)+aarx])[2*i+((l+(Ns%2)*pilot2)*frame_parms->ofdm_symbol_size+LTE_CE_FILTER_LENGTH)*2]=(int16_t)( @@ -3173,7 +3220,7 @@ PMI_FEEDBACK: } } } else { - for(aa=0; aanb_antennas_tx_eNB; aa++) { + for(aa=0; aanb_antenna_ports_eNB; aa++) { for (aarx=0; aarxnb_antennas_rx; aarx++) { for (i=0; iN_RB_DL*12; i++) { ((int16_t *) PHY_vars_UE->lte_ue_common_vars.dl_ch_estimates[0][(aa<<1)+aarx])[2*i+((l+(Ns%2)*pilot2)*frame_parms->ofdm_symbol_size+LTE_CE_FILTER_LENGTH)*2]=(short)(AMP); @@ -4347,16 +4394,11 @@ PMI_FEEDBACK: free(r_im[i]); } - if(transmission_mode == 7){ - for(i=0;i<12*N_RB_DL;i++) - free(beamforming_weights[i]); - } free(s_re); free(s_im); free(r_re); free(r_im); - free(beamforming_weights); // lte_sync_time_free(); diff --git a/openair1/SIMULATION/LTE_PHY/framegen.c b/openair1/SIMULATION/LTE_PHY/framegen.c index 21124eba8d..db85d1f251 100644 --- a/openair1/SIMULATION/LTE_PHY/framegen.c +++ b/openair1/SIMULATION/LTE_PHY/framegen.c @@ -401,7 +401,7 @@ void lte_param_init( unsigned char transmission_mode, lte_frame_parms->Nid_cell = Nid_cell; lte_frame_parms->nushift = Nid_cell%6; lte_frame_parms->nb_antennas_tx = (transmission_mode == 1) ? 1 : 2; - lte_frame_parms->nb_antennas_tx_eNB = (transmission_mode == 1) ? 1 : 2; + lte_frame_parms->nb_antenna_ports_eNB = (transmission_mode == 1) ? 1 : 2; lte_frame_parms->nb_antennas_rx = (transmission_mode == 1) ? 1 : 2; lte_frame_parms->mode1_flag = (transmission_mode == 1)? 1 : 0; lte_frame_parms->phich_config_common.phich_resource = oneSixth; diff --git a/openair1/SIMULATION/LTE_PHY/pbchsim.c b/openair1/SIMULATION/LTE_PHY/pbchsim.c index 67080836b7..3533c7529c 100644 --- a/openair1/SIMULATION/LTE_PHY/pbchsim.c +++ b/openair1/SIMULATION/LTE_PHY/pbchsim.c @@ -88,7 +88,7 @@ void lte_param_init(unsigned char N_tx, unsigned char N_rx,unsigned char transmi lte_frame_parms->Nid_cell = Nid_cell; lte_frame_parms->nushift = Nid_cell%6; lte_frame_parms->nb_antennas_tx = N_tx; - lte_frame_parms->nb_antennas_tx_eNB = N_tx; + lte_frame_parms->nb_antenna_ports_eNB = N_tx; lte_frame_parms->nb_antennas_rx = N_rx; // lte_frame_parms->Csrs = 2; // lte_frame_parms->Bsrs = 0; diff --git a/openair1/SIMULATION/LTE_PHY/pdcchsim.c b/openair1/SIMULATION/LTE_PHY/pdcchsim.c index 1852e349ec..8c3feaf538 100644 --- a/openair1/SIMULATION/LTE_PHY/pdcchsim.c +++ b/openair1/SIMULATION/LTE_PHY/pdcchsim.c @@ -85,7 +85,7 @@ void lte_param_init(unsigned char N_tx, unsigned char N_rx,unsigned char transmi lte_frame_parms->Ncp = extended_prefix_flag; lte_frame_parms->Nid_cell = Nid_cell; lte_frame_parms->nushift = Nid_cell%6; - lte_frame_parms->nb_antennas_tx_eNB = N_tx; + lte_frame_parms->nb_antenna_ports_eNB = N_tx; lte_frame_parms->nb_antennas_tx = N_tx; lte_frame_parms->nb_antennas_rx = N_rx; lte_frame_parms->phich_config_common.phich_resource = one; //half @@ -858,7 +858,7 @@ int main(int argc, char **argv) break; } - eNB2UE = new_channel_desc_scm(PHY_vars_eNB->lte_frame_parms.nb_antennas_tx_eNB, + eNB2UE = new_channel_desc_scm(PHY_vars_eNB->lte_frame_parms.nb_antenna_ports_eNB, PHY_vars_UE->lte_frame_parms.nb_antennas_rx, channel_model, BW, @@ -940,7 +940,7 @@ int main(int argc, char **argv) for (trial=0; triallte_eNB_common_vars.txdataF[eNb_id][aa][512*14*subframe],&PHY_vars_eNB->lte_eNB_common_vars.txdataF[eNb_id][aa][0]); - for (aa=0; aalte_frame_parms.nb_antennas_tx_eNB; aa++) { + for (aa=0; aalte_frame_parms.nb_antenna_ports_eNB; aa++) { memset(&PHY_vars_eNB->lte_eNB_common_vars.txdataF[eNb_id][aa][0],0,FRAME_LENGTH_COMPLEX_SAMPLES_NO_PREFIX*sizeof(mod_sym_t)); /* @@ -1090,7 +1090,7 @@ int main(int argc, char **argv) if (n_frames==1) { write_output("txsigF0.m","txsF0", PHY_vars_eNB->lte_eNB_common_vars.txdataF[eNb_id][0],4*nsymb*OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES_NO_PREFIX,1,1); - if (PHY_vars_eNB->lte_frame_parms.nb_antennas_tx_eNB > 1) + if (PHY_vars_eNB->lte_frame_parms.nb_antenna_ports_eNB > 1) write_output("txsigF1.m","txsF1", PHY_vars_eNB->lte_eNB_common_vars.txdataF[eNb_id][1],4*nsymb*OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES_NO_PREFIX,1,1); } @@ -1098,7 +1098,7 @@ int main(int argc, char **argv) - for (aa=0; aalte_frame_parms.nb_antennas_tx_eNB; aa++) { + for (aa=0; aalte_frame_parms.nb_antenna_ports_eNB; aa++) { if (PHY_vars_eNB->lte_frame_parms.Ncp == 1) PHY_ofdm_mod(&PHY_vars_eNB->lte_eNB_common_vars.txdataF[eNb_id][aa][subframe*nsymb*PHY_vars_eNB->lte_frame_parms.ofdm_symbol_size], // input, &txdata[aa][subframe*PHY_vars_eNB->lte_frame_parms.samples_per_tti], // output @@ -1123,7 +1123,7 @@ int main(int argc, char **argv) for (i=0; i<2*nsymb*OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES; i++) { - for (aa=0; aalte_frame_parms.nb_antennas_tx_eNB; aa++) { + for (aa=0; aalte_frame_parms.nb_antenna_ports_eNB; aa++) { if (awgn_flag == 0) { s_re[aa][i] = ((double)(((short *)txdata[aa]))[(2*subframe*PHY_vars_UE->lte_frame_parms.samples_per_tti) + (i<<1)]); s_im[aa][i] = ((double)(((short *)txdata[aa]))[(2*subframe*PHY_vars_UE->lte_frame_parms.samples_per_tti) + (i<<1)+1]); @@ -1211,7 +1211,7 @@ int main(int argc, char **argv) } } } else { - for(aa=0; aanb_antennas_tx_eNB; aa++) { + for(aa=0; aanb_antenna_ports_eNB; aa++) { for (aarx=0; aarxnb_antennas_rx; aarx++) { for (i=0; iN_RB_DL*12; i++) { ((int16_t *) PHY_vars_UE->lte_ue_common_vars.dl_ch_estimates[0][(aa<<1)+aarx])[2*i+(l*frame_parms->ofdm_symbol_size+LTE_CE_FILTER_LENGTH)*2]=(short)(AMP); diff --git a/openair1/SIMULATION/LTE_PHY/scansim.c b/openair1/SIMULATION/LTE_PHY/scansim.c index 24167984b2..3bc042b86b 100644 --- a/openair1/SIMULATION/LTE_PHY/scansim.c +++ b/openair1/SIMULATION/LTE_PHY/scansim.c @@ -88,7 +88,7 @@ void lte_param_init(unsigned char N_tx, unsigned char N_rx,unsigned char transmi lte_frame_parms->Nid_cell = Nid_cell; lte_frame_parms->nushift = Nid_cell%6; lte_frame_parms->nb_antennas_tx = N_tx; - lte_frame_parms->nb_antennas_tx_eNB = N_tx; + lte_frame_parms->nb_antenna_ports_eNB = N_tx; lte_frame_parms->nb_antennas_rx = N_rx; // lte_frame_parms->Csrs = 2; // lte_frame_parms->Bsrs = 0; From ad5e6a9eeae1d327abaac155f6b8f229507d608c Mon Sep 17 00:00:00 2001 From: Xiwen JIANG Date: Thu, 26 Nov 2015 11:48:53 +0100 Subject: [PATCH 022/349] ulsim and mbmssim adaption --- openair1/SIMULATION/LTE_PHY/mbmssim.c | 2 +- openair1/SIMULATION/LTE_PHY/ulsim.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/openair1/SIMULATION/LTE_PHY/mbmssim.c b/openair1/SIMULATION/LTE_PHY/mbmssim.c index 20d4e04cd8..9f426c9c6e 100644 --- a/openair1/SIMULATION/LTE_PHY/mbmssim.c +++ b/openair1/SIMULATION/LTE_PHY/mbmssim.c @@ -403,7 +403,7 @@ int main(int argc, char **argv) 0); // Create transport channel structures for 2 transport blocks (MIMO) - PHY_vars_eNB->dlsch_eNB_MCH = new_eNB_dlsch(1,8,N_RB_DL,0); + PHY_vars_eNB->dlsch_eNB_MCH = new_eNB_dlsch(1,8,N_RB_DL,0,&PHY_vars_eNB->lte_frame_parms); if (!PHY_vars_eNB->dlsch_eNB_MCH) { printf("Can't get eNB dlsch structures\n"); diff --git a/openair1/SIMULATION/LTE_PHY/ulsim.c b/openair1/SIMULATION/LTE_PHY/ulsim.c index dd697899b8..050071fa02 100644 --- a/openair1/SIMULATION/LTE_PHY/ulsim.c +++ b/openair1/SIMULATION/LTE_PHY/ulsim.c @@ -693,7 +693,7 @@ int main(int argc, char **argv) // Create transport channel structures for 2 transport blocks (MIMO) for (i=0; i<2; i++) { - PHY_vars_eNB->dlsch_eNB[0][i] = new_eNB_dlsch(1,8,N_RB_DL,0); + PHY_vars_eNB->dlsch_eNB[0][i] = new_eNB_dlsch(1,8,N_RB_DL,0,&PHY_vars_eNB->lte_frame_parms); PHY_vars_UE->dlsch_ue[0][i] = new_ue_dlsch(1,8,MAX_TURBO_ITERATIONS,N_RB_DL,0); if (!PHY_vars_eNB->dlsch_eNB[0][i]) { From 4a4a878507ecabd8a003249d56b4e0c187da61c5 Mon Sep 17 00:00:00 2001 From: Xiwen JIANG Date: Thu, 26 Nov 2015 11:49:48 +0100 Subject: [PATCH 023/349] dlsim adaption for new_eNB_dlsch() --- openair1/SIMULATION/LTE_PHY/dlsim.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openair1/SIMULATION/LTE_PHY/dlsim.c b/openair1/SIMULATION/LTE_PHY/dlsim.c index 5cb91e3025..43cf078b8f 100644 --- a/openair1/SIMULATION/LTE_PHY/dlsim.c +++ b/openair1/SIMULATION/LTE_PHY/dlsim.c @@ -1061,7 +1061,7 @@ int main(int argc, char **argv) // Create transport channel structures for 2 transport blocks (MIMO) for (i=0; i<2; i++) { - PHY_vars_eNB->dlsch_eNB[k][i] = new_eNB_dlsch(Kmimo,8,N_RB_DL,0,&PHY_vars_UE->lte_frame_parms); + PHY_vars_eNB->dlsch_eNB[k][i] = new_eNB_dlsch(Kmimo,8,N_RB_DL,0,&PHY_vars_eNB->lte_frame_parms); if (!PHY_vars_eNB->dlsch_eNB[k][i]) { printf("Can't get eNB dlsch structures\n"); From 8b56ae1755f5d76ba496fb126aa4f020c2cf3104 Mon Sep 17 00:00:00 2001 From: Xiwen JIANG Date: Thu, 26 Nov 2015 17:21:14 +0100 Subject: [PATCH 024/349] bug fixed in do_OFDM_l() for the 7th symbol in a subframe --- openair1/SIMULATION/LTE_PHY/dlsim.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openair1/SIMULATION/LTE_PHY/dlsim.c b/openair1/SIMULATION/LTE_PHY/dlsim.c index 43cf078b8f..1bcbe57717 100644 --- a/openair1/SIMULATION/LTE_PHY/dlsim.c +++ b/openair1/SIMULATION/LTE_PHY/dlsim.c @@ -220,7 +220,7 @@ void do_OFDM_mod_l(LTE_eNB_COMMON *eNB_common_vars, int eNB_id, uint16_t next_sl for (l=0; lsymbols_per_tti>>1; l++) { //printf("do_OFDM_mod_l, slot=%d, l=%d, NUMBER_OF_OFDM_CARRIERS=%d,OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES=%d\n",next_slot, l,NUMBER_OF_OFDM_CARRIERS,OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES); - if (lcell_spec_bf_weights,next_slot,l); else if (transmission_mode<7) From b86efd9cbe12c74c698ea045540d739264b3d0e8 Mon Sep 17 00:00:00 2001 From: Xiwen JIANG Date: Thu, 26 Nov 2015 17:59:29 +0100 Subject: [PATCH 025/349] add printf for debug mode in TM7 data extraction --- .../PHY/LTE_TRANSPORT/dlsch_demodulation.c | 172 +++++++++++++++--- 1 file changed, 143 insertions(+), 29 deletions(-) diff --git a/openair1/PHY/LTE_TRANSPORT/dlsch_demodulation.c b/openair1/PHY/LTE_TRANSPORT/dlsch_demodulation.c index 3e5ec84d46..9a5e670481 100644 --- a/openair1/PHY/LTE_TRANSPORT/dlsch_demodulation.c +++ b/openair1/PHY/LTE_TRANSPORT/dlsch_demodulation.c @@ -52,7 +52,7 @@ #endif //#define DEBUG_PHY 1 -//#define DEBUG_DLSCH_DEMOD 1 +#define DEBUG_DLSCH_DEMOD 1 int avg[4]; @@ -4373,15 +4373,41 @@ unsigned short dlsch_extract_rbs_TM7(int **rxdataF, else rb_alloc_ind = 0; + if (rb_alloc_ind == 1) + nb_rb++; + // For second half of RBs skip DC carrier if (rb==(frame_parms->N_RB_DL>>1)) { rxF = &rxdataF[aarx][(1 + (symbol*(frame_parms->ofdm_symbol_size)))]; //dl_ch0++; } + + // PBCH + if ((subframe==0) && (rb>=((frame_parms->N_RB_DL>>1)-3)) && (rb<((frame_parms->N_RB_DL>>1)+3)) && (l>=nsymb>>1) && (l<((nsymb>>1) + 4))) { + rb_alloc_ind = 0; + } + + //SSS + if (((subframe==0)||(subframe==5)) && (rb>=((frame_parms->N_RB_DL>>1)-3)) && (rb<((frame_parms->N_RB_DL>>1)+3)) && (l==sss_symb) ) { + rb_alloc_ind = 0; + } + + + if (frame_parms->frame_type == FDD) { + //PSS + if (((subframe==0)||(subframe==5)) && (rb>=((frame_parms->N_RB_DL>>1)-3)) && (rb<((frame_parms->N_RB_DL>>1)+3)) && (l==pss_symb) ) { + rb_alloc_ind = 0; + } + } + + if ((frame_parms->frame_type == TDD) && + (subframe==6)) { //TDD Subframe 6 + if ((rb>=((frame_parms->N_RB_DL>>1)-3)) && (rb<((frame_parms->N_RB_DL>>1)+3)) && (l==pss_symb) ) { + rb_alloc_ind = 0; + } + } if (rb_alloc_ind==1) { - //*pmi_ext = (pmi>>((rb>>2)<<1))&3; - //memcpy(dl_ch0_ext,dl_ch0,12*sizeof(int)); /* printf("rb %d\n",rb); @@ -4439,7 +4465,6 @@ unsigned short dlsch_extract_rbs_TM7(int **rxdataF, exit(-1); } - nb_rb++; } dl_ch0+=12; @@ -4517,7 +4542,9 @@ unsigned short dlsch_extract_rbs_TM7(int **rxdataF, if (rb_alloc_ind==1) { - //printf("rb %d/symbol %d pilots %d, uespec_pilots %d, (skip_half %d)\n",rb,l,pilots,uespec_pilots,skip_half); +#ifdef DEBUG_DLSCH_DEMOD + printf("rb %d/symbol %d pilots %d, uespec_pilots %d, (skip_half %d)\n",rb,l,pilots,uespec_pilots,skip_half); +#endif if (pilots==0 && uespec_pilots==0) { //printf("Extracting w/o pilots (symbol %d, rb %d, skip_half %d)\n",l,rb,skip_half); @@ -4525,16 +4552,24 @@ unsigned short dlsch_extract_rbs_TM7(int **rxdataF, if (skip_half==1) { memcpy(dl_ch0_ext,dl_ch0,6*sizeof(int)); - for (i=0; i<6; i++) + for (i=0; i<6; i++) { rxF_ext[i]=rxF[i]; +#ifdef DEBUG_DLSCH_DEMOD + printf("extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[i],*(1+(short*)&rxF_ext[i])); +#endif + } dl_ch0_ext+=6; rxF_ext+=6; } else if (skip_half==2) { memcpy(dl_ch0_ext,dl_ch0+6,6*sizeof(int)); - for (i=0; i<6; i++) + for (i=0; i<6; i++) { rxF_ext[i]=rxF[(i+6)]; +#ifdef DEBUG_DLSCH_DEMOD + printf("extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[i],*(1+(short*)&rxF_ext[i])); +#endif + } dl_ch0_ext+=6; rxF_ext+=6; @@ -4543,7 +4578,9 @@ unsigned short dlsch_extract_rbs_TM7(int **rxdataF, for (i=0; i<12; i++){ rxF_ext[i]=rxF[i]; - //printf("symbol %d, extract rb %d, re %d => (%d,%d)\n",symbol,rb,i,*(short *)&rxF[i],*(1+(short*)&rxF[i])); +#ifdef DEBUG_DLSCH_DEMOD + printf("extract rb %d, re %d => (%d,%d)\n",symbol,rb,i,*(short *)&rxF[i],*(1+(short*)&rxF[i])); +#endif } dl_ch0_ext+=12; rxF_ext+=12; @@ -4556,8 +4593,10 @@ unsigned short dlsch_extract_rbs_TM7(int **rxdataF, for (i=0; i<6; i++) { if (i!=((frame_parms->nushift+poffset)%6)) { rxF_ext[j]=rxF[i]; - // printf("extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[j],*(1+(short*)&rxF_ext[j])); dl_ch0_ext[j++]=dl_ch0[i]; +#ifdef DEBUG_DLSCH_DEMOD + printf("extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[i],*(1+(short*)&rxF_ext[i])); +#endif } } @@ -4567,8 +4606,10 @@ unsigned short dlsch_extract_rbs_TM7(int **rxdataF, for (i=0; i<6; i++) { if (i!=((frame_parms->nushift+poffset)%6)) { rxF_ext[j]=rxF[(i+6)]; - // printf("extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[j],*(1+(short*)&rxF_ext[j])); dl_ch0_ext[j++]=dl_ch0[i+6]; +#ifdef DEBUG_DLSCH_DEMOD + printf("extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[i],*(1+(short*)&rxF_ext[i])); +#endif } } @@ -4579,9 +4620,10 @@ unsigned short dlsch_extract_rbs_TM7(int **rxdataF, if ((i!=(frame_parms->nushift+poffset)) && (i!=((frame_parms->nushift+poffset+6)%12))) { rxF_ext[j]=rxF[i]; - //printf("extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[j],*(1+(short*)&rxF_ext[j])); +#ifdef DEBUG_DLSCH_DEMOD + printf("extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[j],*(1+(short*)&rxF_ext[j])); +#endif dl_ch0_ext[j++]=dl_ch0[i]; - //printf("symbol %d, extract rb %d => (%d,%d)\n",symbol,rb,*(short *)&dl_ch0[i],*(1+(short*)&dl_ch0[i])); } } @@ -4599,6 +4641,9 @@ unsigned short dlsch_extract_rbs_TM7(int **rxdataF, if (i!=uespec_nushift+uespec_poffset && i!=uespec_nushift+uespec_poffset+4 && i!=(uespec_nushift+uespec_poffset+8)%12){ rxF_ext[j]=rxF[i]; dl_ch0_ext[j++]=dl_ch0[i]; +#ifdef DEBUG_DLSCH_DEMOD + printf("extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[i],*(1+(short*)&rxF_ext[i])); +#endif } } dl_ch0_ext+=6-(uespec_nushift+uespec_poffset<6)-(uespec_nushift+uespec_poffset+4<6)-((uespec_nushift+uespec_poffset+8)%12<6); @@ -4609,6 +4654,9 @@ unsigned short dlsch_extract_rbs_TM7(int **rxdataF, if (i!=uespec_nushift+uespec_poffset && i!=uespec_nushift+uespec_poffset+3 && i!=uespec_nushift+uespec_poffset+6 && i!=(uespec_nushift+uespec_poffset+9)%12){ rxF_ext[j]=rxF[i]; dl_ch0_ext[j++]=dl_ch0[i]; +#ifdef DEBUG_DLSCH_DEMOD + printf("extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[i],*(1+(short*)&rxF_ext[i])); +#endif } } dl_ch0_ext+=4; @@ -4621,6 +4669,9 @@ unsigned short dlsch_extract_rbs_TM7(int **rxdataF, if (i!=uespec_nushift+uespec_poffset && i!=uespec_nushift+uespec_poffset+4 && i!=(uespec_nushift+uespec_poffset+8)%12){ rxF_ext[j]=rxF[(i+6)]; dl_ch0_ext[j++]=dl_ch0[i+6]; +#ifdef DEBUG_DLSCH_DEMOD + printf("extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[i],*(1+(short*)&rxF_ext[i])); +#endif } } dl_ch0_ext+=6-(uespec_nushift+uespec_poffset>6)-(uespec_nushift+uespec_poffset+4>6)-((uespec_nushift+uespec_poffset+8)%12>6); @@ -4631,6 +4682,9 @@ unsigned short dlsch_extract_rbs_TM7(int **rxdataF, if (i!=uespec_nushift+uespec_poffset && i!=uespec_nushift+uespec_poffset+3 && i!=uespec_nushift+uespec_poffset+6 && i!=(uespec_nushift+uespec_poffset+9)%12){ rxF_ext[j]=rxF[(i+6)]; dl_ch0_ext[j++]=dl_ch0[i+6]; +#ifdef DEBUG_DLSCH_DEMOD + printf("extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[i],*(1+(short*)&rxF_ext[i])); +#endif } } dl_ch0_ext+=4; @@ -4644,12 +4698,17 @@ unsigned short dlsch_extract_rbs_TM7(int **rxdataF, if (i!=uespec_nushift+uespec_poffset && i!=uespec_nushift+uespec_poffset+4 && i!=(uespec_nushift+uespec_poffset+8)%12){ rxF_ext[j] = rxF[i]; dl_ch0_ext[j++] = dl_ch0[i]; - //printf("symbol %d, extract rb %d, re %d, j %d => (%d,%d)\n",symbol,rb,i,j-1,*(short *)&dl_ch0[j],*(1+(short*)&dl_ch0[i])); +#ifdef DEBUG_DLSCH_DEMOD + printf("extract rb %d, re %d, j %d => (%d,%d)\n",symbol,rb,i,j-1,*(short *)&dl_ch0[j],*(1+(short*)&dl_ch0[i])); +#endif } } else{ if (i!=uespec_nushift+uespec_poffset && i!=uespec_nushift+uespec_poffset+3 && i!=uespec_nushift+uespec_poffset+6 && i!=(uespec_nushift+uespec_poffset+9)%12){ rxF_ext[j] = rxF[i]; dl_ch0_ext[j++]=dl_ch0[i]; +#ifdef DEBUG_DLSCH_DEMOD + printf("extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[i],*(1+(short*)&rxF_ext[i])); +#endif } } @@ -4685,7 +4744,8 @@ unsigned short dlsch_extract_rbs_TM7(int **rxdataF, else rb_alloc_ind = 0; - + if (rb_alloc_ind == 1) + nb_rb++; // PBCH if ((subframe==0) && (rb>=((frame_parms->N_RB_DL>>1)-3)) && (rb<((frame_parms->N_RB_DL>>1)+3)) && (l>=(nsymb>>1)) && (l<((nsymb>>1) + 4))) { @@ -4719,6 +4779,9 @@ unsigned short dlsch_extract_rbs_TM7(int **rxdataF, for (i=0; i<6; i++) { dl_ch0_ext[i]=dl_ch0[i]; rxF_ext[i]=rxF[i]; +#ifdef DEBUG_DLSCH_DEMOD + printf("extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[i],*(1+(short*)&rxF_ext[i])); +#endif } rxF = &rxdataF[aarx][((symbol*(frame_parms->ofdm_symbol_size)))]; @@ -4726,6 +4789,9 @@ unsigned short dlsch_extract_rbs_TM7(int **rxdataF, for (; i<12; i++) { dl_ch0_ext[i]=dl_ch0[i]; rxF_ext[i]=rxF[(1+i-6)]; +#ifdef DEBUG_DLSCH_DEMOD + printf("extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[i],*(1+(short*)&rxF_ext[i])); +#endif } dl_ch0_ext+=12; @@ -4737,6 +4803,9 @@ unsigned short dlsch_extract_rbs_TM7(int **rxdataF, if (i!=((frame_parms->nushift+poffset)%6)) { dl_ch0_ext[j]=dl_ch0[i]; rxF_ext[j++]=rxF[i]; +#ifdef DEBUG_DLSCH_DEMOD + printf("extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[i],*(1+(short*)&rxF_ext[i])); +#endif } } @@ -4746,7 +4815,9 @@ unsigned short dlsch_extract_rbs_TM7(int **rxdataF, if (i!=((frame_parms->nushift+6+poffset)%12)) { 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])); +#ifdef DEBUG_DLSCH_DEMOD + printf("extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[i],*(1+(short*)&rxF_ext[i])); +#endif } } @@ -4760,13 +4831,17 @@ unsigned short dlsch_extract_rbs_TM7(int **rxdataF, if (i!=uespec_nushift+uespec_poffset && i!=uespec_nushift+uespec_poffset+4 && i!=(uespec_nushift+uespec_poffset+8)%12){ dl_ch0_ext[j]=dl_ch0[i]; rxF_ext[j++] = rxF[i]; - //printf("symbol %d, extract rb %d, re %d, j %d => (%d,%d)\n",symbol,rb,i,j-1,*(short *)&dl_ch0[j],*(1+(short*)&dl_ch0[i])); - //printf("extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[j-1],*(1+(short*)&rxF_ext[j-1])); +#ifdef DEBUG_DLSCH_DEMOD + printf("extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[i],*(1+(short*)&rxF_ext[i])); +#endif } } else { if (i!=uespec_nushift+uespec_poffset && i!=uespec_nushift+uespec_poffset+3 && i!=uespec_nushift+uespec_poffset+6 && i!=(uespec_nushift+uespec_poffset+9)%12){ dl_ch0_ext[j]=dl_ch0[i]; rxF_ext[j++] = rxF[i]; +#ifdef DEBUG_DLSCH_DEMOD + printf("extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[i],*(1+(short*)&rxF_ext[i])); +#endif } } } @@ -4778,13 +4853,17 @@ unsigned short dlsch_extract_rbs_TM7(int **rxdataF, if (i!=uespec_nushift+uespec_poffset && i!=uespec_nushift+uespec_poffset+4 && i!=(uespec_nushift+uespec_poffset+8)%12){ dl_ch0_ext[j]=dl_ch0[i]; rxF_ext[j++]=rxF[(1+i-6)]; - // printf("symbol %d, extract rb %d, re %d, j %d => (%d,%d)\n",symbol,rb,i,j-1,*(short *)&dl_ch0[j],*(1+(short*)&dl_ch0[i])); - // printf("extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[j-1],*(1+(short*)&rxF_ext[j-1])); +#ifdef DEBUG_DLSCH_DEMOD + printf("extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[i],*(1+(short*)&rxF_ext[i])); +#endif } } else { if (i!=uespec_nushift+uespec_poffset && i!=uespec_nushift+uespec_poffset+3 && i!=uespec_nushift+uespec_poffset+6 && i!=(uespec_nushift+uespec_poffset+9)%12){ dl_ch0_ext[j]=dl_ch0[i]; rxF_ext[j++] = rxF[(1+i-6)]; +#ifdef DEBUG_DLSCH_DEMOD + printf("extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[i],*(1+(short*)&rxF_ext[i])); +#endif } } } @@ -4794,7 +4873,6 @@ unsigned short dlsch_extract_rbs_TM7(int **rxdataF, }// symbol_mod==0 - nb_rb++; } // rballoc==1 else { rxF = &rxdataF[aarx][((symbol*(frame_parms->ofdm_symbol_size)))]; @@ -4868,7 +4946,9 @@ unsigned short dlsch_extract_rbs_TM7(int **rxdataF, } if (rb_alloc_ind==1) { - // printf("rb %d/symbol %d (skip_half %d)\n",rb,l,skip_half); +#ifdef DEBUG_DLSCH_DEMOD + printf("rb %d/symbol %d (skip_half %d)\n",rb,l,skip_half); +#endif /* printf("rb %d\n",rb); for (i=0;i<12;i++) @@ -4880,8 +4960,12 @@ unsigned short dlsch_extract_rbs_TM7(int **rxdataF, if (skip_half==1) { memcpy(dl_ch0_ext,dl_ch0,6*sizeof(int)); - for (i=0; i<6; i++) + for (i=0; i<6; i++) { rxF_ext[i]=rxF[i]; +#ifdef DEBUG_DLSCH_DEMOD + printf("extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[i],*(1+(short*)&rxF_ext[i])); +#endif + } dl_ch0_ext+=6; rxF_ext+=6; @@ -4889,8 +4973,12 @@ unsigned short dlsch_extract_rbs_TM7(int **rxdataF, } else if (skip_half==2) { memcpy(dl_ch0_ext,dl_ch0+6,6*sizeof(int)); - for (i=0; i<6; i++) + for (i=0; i<6; i++) { rxF_ext[i]=rxF[i+6]; +#ifdef DEBUG_DLSCH_DEMOD + printf("extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[i],*(1+(short*)&rxF_ext[i])); +#endif + } dl_ch0_ext+=6; rxF_ext+=6; @@ -4899,8 +4987,12 @@ unsigned short dlsch_extract_rbs_TM7(int **rxdataF, memcpy(dl_ch0_ext,dl_ch0,12*sizeof(int)); //printf("symbol %d, extract rb %d, => (%d,%d)\n",symbol,rb,*(short *)&dl_ch0[j],*(1+(short*)&dl_ch0[i])); - for (i=0; i<12; i++) + for (i=0; i<12; i++) { rxF_ext[i]=rxF[i]; +#ifdef DEBUG_DLSCH_DEMOD + printf("extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[i],*(1+(short*)&rxF_ext[i])); +#endif + } dl_ch0_ext+=12; rxF_ext+=12; @@ -4913,8 +5005,10 @@ unsigned short dlsch_extract_rbs_TM7(int **rxdataF, for (i=0; i<6; i++) { if (i!=((frame_parms->nushift+poffset)%6)) { rxF_ext[j]=rxF[i]; - //printf("extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[j],*(1+(short*)&rxF_ext[j])); dl_ch0_ext[j++]=dl_ch0[i]; +#ifdef DEBUG_DLSCH_DEMOD + printf("extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[i],*(1+(short*)&rxF_ext[i])); +#endif } } @@ -4924,8 +5018,10 @@ unsigned short dlsch_extract_rbs_TM7(int **rxdataF, for (i=0; i<6; i++) { if (i!=((frame_parms->nushift+poffset)%6)) { rxF_ext[j]=rxF[(i+6)]; - //printf("extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[j],*(1+(short*)&rxF_ext[j])); dl_ch0_ext[j++]=dl_ch0[i+6]; +#ifdef DEBUG_DLSCH_DEMOD + printf("extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[i],*(1+(short*)&rxF_ext[i])); +#endif } } @@ -4936,9 +5032,10 @@ unsigned short dlsch_extract_rbs_TM7(int **rxdataF, if ((i!=(frame_parms->nushift+poffset)) && (i!=((frame_parms->nushift+poffset+6)%12))) { rxF_ext[j]=rxF[i]; - //printf("extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[j],*(1+(short*)&rxF_ext[j])); +#ifdef DEBUG_DLSCH_DEMOD + printf("extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[j],*(1+(short*)&rxF_ext[j])); +#endif dl_ch0_ext[j++]=dl_ch0[i]; - //printf("symbol %d, extract rb %d => (%d,%d)\n",symbol,rb,*(short *)&dl_ch0[i],*(1+(short*)&dl_ch0[i])); } } @@ -4954,6 +5051,9 @@ unsigned short dlsch_extract_rbs_TM7(int **rxdataF, if (i!=uespec_nushift+uespec_poffset && i!=uespec_nushift+uespec_poffset+4 && i!=(uespec_nushift+uespec_poffset+8)%12){ rxF_ext[j]=rxF[i]; dl_ch0_ext[j++]=dl_ch0[i]; +#ifdef DEBUG_DLSCH_DEMOD + printf("extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[i],*(1+(short*)&rxF_ext[i])); +#endif } } dl_ch0_ext+=6-(uespec_nushift+uespec_poffset<6)-(uespec_nushift+uespec_poffset+4<6)-((uespec_nushift+uespec_poffset+8)%12<6); @@ -4964,6 +5064,9 @@ unsigned short dlsch_extract_rbs_TM7(int **rxdataF, if (i!=uespec_nushift+uespec_poffset && i!=uespec_nushift+uespec_poffset+3 && i!=uespec_nushift+uespec_poffset+6 && i!=(uespec_nushift+uespec_poffset+9)%12){ rxF_ext[j]=rxF[i]; dl_ch0_ext[j++]=dl_ch0[i]; +#ifdef DEBUG_DLSCH_DEMOD + printf("extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[i],*(1+(short*)&rxF_ext[i])); +#endif } } dl_ch0_ext+=4; @@ -4976,6 +5079,9 @@ unsigned short dlsch_extract_rbs_TM7(int **rxdataF, if (i!=uespec_nushift+uespec_poffset && i!=uespec_nushift+uespec_poffset+4 && i!=(uespec_nushift+uespec_poffset+8)%12){ rxF_ext[j]=rxF[i+6]; dl_ch0_ext[j++]=dl_ch0[i+6]; +#ifdef DEBUG_DLSCH_DEMOD + printf("extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[i],*(1+(short*)&rxF_ext[i])); +#endif } } dl_ch0_ext+=6-(uespec_nushift+uespec_poffset>6)-(uespec_nushift+uespec_poffset+4>6)-((uespec_nushift+uespec_poffset+8)%12>6); @@ -4986,6 +5092,9 @@ unsigned short dlsch_extract_rbs_TM7(int **rxdataF, if (i!=uespec_nushift+uespec_poffset && i!=uespec_nushift+uespec_poffset+3 && i!=uespec_nushift+uespec_poffset+6 && i!=(uespec_nushift+uespec_poffset+9)%12){ rxF_ext[j]=rxF[(i+6)]; dl_ch0_ext[j++]=dl_ch0[i+6]; +#ifdef DEBUG_DLSCH_DEMOD + printf("extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[i],*(1+(short*)&rxF_ext[i])); +#endif } } dl_ch0_ext+=4; @@ -4998,12 +5107,17 @@ unsigned short dlsch_extract_rbs_TM7(int **rxdataF, if (i!=uespec_nushift+uespec_poffset && i!=uespec_nushift+uespec_poffset+4 && i!=(uespec_nushift+uespec_poffset+8)%12){ rxF_ext[j] = rxF[i]; dl_ch0_ext[j++]=dl_ch0[i]; - // printf("symbol %d, extract rb %d, re %d, j %d => (%d,%d)\n",symbol,rb,i,j-1,*(short *)&dl_ch0[j],*(1+(short*)&dl_ch0[i])); +#ifdef DEBUG_DLSCH_DEMOD + printf("extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[i],*(1+(short*)&rxF_ext[i])); +#endif } } else{ if (i!=uespec_nushift+uespec_poffset && i!=uespec_nushift+uespec_poffset+3 && i!=uespec_nushift+uespec_poffset+6 && i!=(uespec_nushift+uespec_poffset+9)%12){ rxF_ext[j] = rxF[i]; dl_ch0_ext[j++]=dl_ch0[i]; +#ifdef DEBUG_DLSCH_DEMOD + printf("extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[i],*(1+(short*)&rxF_ext[i])); +#endif } } } From 62e38a05c01608267d88477ee395a2df9feff78f Mon Sep 17 00:00:00 2001 From: Xiwen JIANG Date: Thu, 26 Nov 2015 18:03:39 +0100 Subject: [PATCH 026/349] comment debug mode in dlsch_demodulation --- openair1/PHY/LTE_TRANSPORT/dlsch_demodulation.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openair1/PHY/LTE_TRANSPORT/dlsch_demodulation.c b/openair1/PHY/LTE_TRANSPORT/dlsch_demodulation.c index 9a5e670481..45a36e27a5 100644 --- a/openair1/PHY/LTE_TRANSPORT/dlsch_demodulation.c +++ b/openair1/PHY/LTE_TRANSPORT/dlsch_demodulation.c @@ -52,7 +52,7 @@ #endif //#define DEBUG_PHY 1 -#define DEBUG_DLSCH_DEMOD 1 +//#define DEBUG_DLSCH_DEMOD 1 int avg[4]; From bed11c711e536366ffe6c45e6a86a16306804f28 Mon Sep 17 00:00:00 2001 From: Xiwen JIANG Date: Mon, 30 Nov 2015 15:29:10 +0100 Subject: [PATCH 027/349] dlsch data extraction bug fixed for special subframes in TM7 --- openair1/PHY/LTE_TRANSPORT/dlsch_demodulation.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/openair1/PHY/LTE_TRANSPORT/dlsch_demodulation.c b/openair1/PHY/LTE_TRANSPORT/dlsch_demodulation.c index 45a36e27a5..f578c6f3e4 100644 --- a/openair1/PHY/LTE_TRANSPORT/dlsch_demodulation.c +++ b/openair1/PHY/LTE_TRANSPORT/dlsch_demodulation.c @@ -4486,6 +4486,8 @@ unsigned short dlsch_extract_rbs_TM7(int **rxdataF, else rb_alloc_ind = 0; + if (rb_alloc_ind == 1) + nb_rb++; // PBCH if ((subframe==0) && (rb>((frame_parms->N_RB_DL>>1)-3)) && (rb<((frame_parms->N_RB_DL>>1)+3)) && (l>=(nsymb>>1)) && (l<((nsymb>>1) + 4))) { @@ -4723,8 +4725,6 @@ unsigned short dlsch_extract_rbs_TM7(int **rxdataF, exit(-1); } - - nb_rb++; } dl_ch0+=12; @@ -4898,7 +4898,8 @@ unsigned short dlsch_extract_rbs_TM7(int **rxdataF, else rb_alloc_ind = 0; - + if (rb_alloc_ind==1) + nb_rb++; // PBCH if ((subframe==0) && (rb>((frame_parms->N_RB_DL>>1)-3)) && (rb<((frame_parms->N_RB_DL>>1)+3)) && (l>=nsymb>>1) && (l<((nsymb>>1) + 4))) { @@ -5128,8 +5129,6 @@ unsigned short dlsch_extract_rbs_TM7(int **rxdataF, } }// pilots=0 - - nb_rb++; } dl_ch0+=12; From 1096744662ea84bc15fe47cdd5821d9843ff30c5 Mon Sep 17 00:00:00 2001 From: Xiwen JIANG Date: Mon, 30 Nov 2015 15:31:33 +0100 Subject: [PATCH 028/349] cell specific beamforming weights adaption nb of tx antennas --- openair1/SIMULATION/LTE_PHY/dlsim.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/openair1/SIMULATION/LTE_PHY/dlsim.c b/openair1/SIMULATION/LTE_PHY/dlsim.c index 1bcbe57717..5c1c8fc896 100644 --- a/openair1/SIMULATION/LTE_PHY/dlsim.c +++ b/openair1/SIMULATION/LTE_PHY/dlsim.c @@ -799,8 +799,15 @@ int main(int argc, char **argv) cell_spec_bf_weights = PHY_vars_eNB->lte_eNB_common_vars.cell_spec_bf_weights[0][0]; for(aa=0;aaofdm_symbol_size;i++) { - cell_spec_bf_weights[aa][i] = 0x00007fff; + for(re=0;reofdm_symbol_size;re++) { + if (n_tx_phy==1 || n_tx_phy==2) + cell_spec_bf_weights[aa][re] = 0x00007fff; + else if (n_tx_phy==4) + cell_spec_bf_weights[aa][re] = 0x00007fff>>1; + else if (n_tx_phy==16) + cell_spec_bf_weights[aa][re] = 0x00007fff>>2; + else if (n_tx_phy==64) + cell_spec_bf_weights[aa][re] = 0x00007fff>>4; } } From 5c0098e2f0ed7c90ab121482cc8f402884f05551 Mon Sep 17 00:00:00 2001 From: Navid Nikaein Date: Tue, 15 Dec 2015 11:53:47 +0100 Subject: [PATCH 029/349] * add async interface support for eNB agent and create a lib --- cmake_targets/CMakeLists.txt | 15 +- openair2/UTIL/ASYNC_IF/link_manager.c | 247 +++++++++++++++++ openair2/UTIL/ASYNC_IF/link_manager.h | 69 +++++ openair2/UTIL/ASYNC_IF/message_queue.c | 211 +++++++++++++++ openair2/UTIL/ASYNC_IF/message_queue.h | 71 +++++ openair2/UTIL/ASYNC_IF/socket_link.c | 349 +++++++++++++++++++++++++ openair2/UTIL/ASYNC_IF/socket_link.h | 65 +++++ 7 files changed, 1026 insertions(+), 1 deletion(-) create mode 100644 openair2/UTIL/ASYNC_IF/link_manager.c create mode 100644 openair2/UTIL/ASYNC_IF/link_manager.h create mode 100644 openair2/UTIL/ASYNC_IF/message_queue.c create mode 100644 openair2/UTIL/ASYNC_IF/message_queue.h create mode 100644 openair2/UTIL/ASYNC_IF/socket_link.c create mode 100644 openair2/UTIL/ASYNC_IF/socket_link.h diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index d7a656e61c..122d41baa2 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -473,6 +473,9 @@ add_list_string_option(PACKAGE_NAME "NotDefined" "As per attribute name") add_boolean_option(MESSAGE_CHART_GENERATOR False "For generating sequence diagrams") add_boolean_option(MESSAGE_CHART_GENERATOR_RLC_MAC False "trace RLC-MAC exchanges in sequence diagrams") add_boolean_option(MESSAGE_CHART_GENERATOR_PHY False "trace some PHY exchanges in sequence diagrams") + +add_boolean_option(ENB_AGENT True "enable eNB agent to inteface with a SDN contrller") + ######################## # Include order ########################## @@ -687,6 +690,16 @@ include_directories("${OPENAIR_DIR}") # Utilities Library ################ +if (ENB_AGENT) + add_library(ASYNC_IF + ${OPENAIR2_DIR}/UTIL/ASYNC_IF/socket_link.c + ${OPENAIR2_DIR}/UTIL/ASYNC_IF/link_manager.c + ${OPENAIR2_DIR}/UTIL/ASYNC_IF/message_queue.c + ) + set(ASYNC_IF_LIB ASYNC_IF) +endif() +include_directories(${OPENAIR2_DIR}/UTIL/ASYNC_IF) + add_library(HASHTABLE ${OPENAIR_DIR}/common/utils/collection/hashtable/hashtable.c ${OPENAIR_DIR}/common/utils/collection/hashtable/obj_hashtable.c @@ -1591,7 +1604,7 @@ add_executable(oaisim_nos1 target_include_directories(oaisim_nos1 PUBLIC ${OPENAIR_TARGETS}/SIMU/USER) target_link_libraries (oaisim_nos1 -Wl,--start-group - RRC_LIB X2AP_LIB SECU_CN UTIL HASHTABLE SCHED_LIB PHY LFDS ${MSC_LIB} L2 ${RAL_LIB} SIMU SIMU_ETH SECU_OSA ${ITTI_LIB} ${MIH_LIB} + RRC_LIB X2AP_LIB SECU_CN UTIL HASHTABLE SCHED_LIB PHY LFDS ${MSC_LIB} L2 ${RAL_LIB} SIMU SIMU_ETH SECU_OSA ${ITTI_LIB} ${MIH_LIB} ${ASYNC_IF_LIB} -Wl,--end-group ) target_link_libraries (oaisim_nos1 ${LIBXML2_LIBRARIES} ${LAPACK_LIBRARIES}) diff --git a/openair2/UTIL/ASYNC_IF/link_manager.c b/openair2/UTIL/ASYNC_IF/link_manager.c new file mode 100644 index 0000000000..9b31fc043b --- /dev/null +++ b/openair2/UTIL/ASYNC_IF/link_manager.c @@ -0,0 +1,247 @@ +/******************************************************************************* + OpenAirInterface + Copyright(c) 1999 - 2015 Eurecom + + OpenAirInterface is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + + OpenAirInterface is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with OpenAirInterface.The full GNU General Public License is + included in this distribution in the file called "COPYING". If not, + see . + + Contact Information + OpenAirInterface Admin: openair_admin@eurecom.fr + OpenAirInterface Tech : openair_tech@eurecom.fr + OpenAirInterface Dev : openair4g-devel@eurecom.fr + + Address : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE + +*******************************************************************************/ +/*! \file link_manager.c + * \brief this is the implementation of a link manager + * \author Cedric Roux + * \date November 2015 + * \version 1.0 + * \email: cedric.roux@eurecom.fr + * @ingroup _mac + */ + +#include "link_manager.h" +#include "log.h" + +#include +#include +#include + +/* that thread reads messages in the queue and sends them to the link */ +static void *link_manager_sender_thread(void *_manager) +{ + link_manager_t *manager = _manager; + void *data; + int size; + int priority; + + LOG_D(MAC, "starting link manager sender thread\n"); + + while (manager->run) { + if (message_get(manager->send_queue, &data, &size, &priority)) + goto error; + if (link_send_packet(manager->socket_link, data, size)) + goto error; + free(data); + } + + LOG_D(MAC, "link manager sender thread quits\n"); + + return NULL; + +error: + LOG_E(MAC, "%s: error\n", __FUNCTION__); + return NULL; +} + +/* that thread receives messages from the link and puts them in the queue */ +static void *link_manager_receiver_thread(void *_manager) +{ + link_manager_t *manager = _manager; + void *data; + int size; + + LOG_D(MAC, "starting link manager receiver thread\n"); + + while (manager->run) { + if (link_receive_packet(manager->socket_link, &data, &size)) + goto error; + /* todo: priority */ + if (message_put(manager->receive_queue, data, size, 0)) + goto error; + } + + LOG_D(MAC, "link manager receiver thread quits\n"); + + return NULL; + +error: + LOG_E(MAC, "%s: error\n", __FUNCTION__); + return NULL; +} + +link_manager_t *create_link_manager( + message_queue_t *send_queue, + message_queue_t *receive_queue, + socket_link_t *link) +{ + link_manager_t *ret = NULL; + pthread_attr_t attr; + pthread_t t; + + LOG_D(MAC, "create new link manager\n"); + + ret = calloc(1, sizeof(link_manager_t)); + if (ret == NULL) + goto error; + + ret->send_queue = send_queue; + ret->receive_queue = receive_queue; + ret->socket_link = link; + ret->run = 1; + + if (pthread_attr_init(&attr)) + goto error; + + if (pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED)) + goto error; + + if (pthread_create(&t, &attr, link_manager_sender_thread, ret)) + goto error; + ret->sender = t; + + if (pthread_create(&t, &attr, link_manager_receiver_thread, ret)) + /* we should destroy the other thread here */ + goto error; + ret->receiver = t; + + if (pthread_attr_destroy(&attr)) + /* to be clean we should destroy the threads at this point, + * even if in practice we never reach it */ + goto error; + + return ret; + +error: + LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); + free(ret); + return NULL; +} + +void destroy_link_manager(link_manager_t *manager) +{ + LOG_D(MAC, "destroying link manager\n"); + manager->run = 0; + /* todo: force threads to stop (using a dummy message?) */ +} + +#ifdef SERVER_TEST + +#include + +int main(void) +{ + socket_link_t *link; + message_queue_t *send_queue; + message_queue_t *receive_queue; + link_manager_t *manager; + void *data; + int size; + int priority; + + printf("starting server\n"); + + link = new_link_server(2210); + if (link == NULL) goto error; + + send_queue = new_message_queue(); + if (send_queue == NULL) goto error; + receive_queue = new_message_queue(); + if (receive_queue == NULL) goto error; + + manager = create_link_manager(send_queue, receive_queue, link); + if (manager == NULL) goto error; + + data = strdup("hello"); if (data == NULL) goto error; + if (message_put(send_queue, data, 6, 100)) goto error; + + if (message_get(receive_queue, &data, &size, &priority)) goto error; + printf("received message:\n"); + printf(" data: %s\n", (char *)data); + printf(" size: %d\n", size); + printf(" priority: %d\n", priority); + + printf("server ends\n"); + return 0; + +error: + printf("there was an error\n"); + return 1; +} + +#endif + +#ifdef CLIENT_TEST + +#include +#include + +int main(void) +{ + socket_link_t *link; + message_queue_t *send_queue; + message_queue_t *receive_queue; + link_manager_t *manager; + void *data; + int size; + int priority; + + printf("starting client\n"); + + link = new_link_client("127.0.0.1", 2210); + if (link == NULL) goto error; + + send_queue = new_message_queue(); + if (send_queue == NULL) goto error; + receive_queue = new_message_queue(); + if (receive_queue == NULL) goto error; + + manager = create_link_manager(send_queue, receive_queue, link); + if (manager == NULL) goto error; + + if (message_get(receive_queue, &data, &size, &priority)) goto error; + printf("received message:\n"); + printf(" data: %s\n", (char *)data); + printf(" size: %d\n", size); + printf(" priority: %d\n", priority); + + data = strdup("world"); if (data == NULL) goto error; + if (message_put(send_queue, data, 6, 200)) goto error; + + /* let's wait for the message to be sent (unreliable sleep, but does it for the test) */ + sleep(1); + + printf("client ends\n"); + return 0; + +error: + printf("there was an error\n"); + return 1; +} + +#endif diff --git a/openair2/UTIL/ASYNC_IF/link_manager.h b/openair2/UTIL/ASYNC_IF/link_manager.h new file mode 100644 index 0000000000..3e24b8679a --- /dev/null +++ b/openair2/UTIL/ASYNC_IF/link_manager.h @@ -0,0 +1,69 @@ +/******************************************************************************* + OpenAirInterface + Copyright(c) 1999 - 2015 Eurecom + + OpenAirInterface is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + + OpenAirInterface is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with OpenAirInterface.The full GNU General Public License is + included in this distribution in the file called "COPYING". If not, + see . + + Contact Information + OpenAirInterface Admin: openair_admin@eurecom.fr + OpenAirInterface Tech : openair_tech@eurecom.fr + OpenAirInterface Dev : openair4g-devel@eurecom.fr + + Address : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE + +*******************************************************************************/ +/*! \file link_manager.h + * \brief this is the implementation of a link manager + * \author Cedric Roux + * \date November 2015 + * \version 1.0 + * \email: cedric.roux@eurecom.fr + * @ingroup _mac + */ + +#ifndef LINK_MANAGER_H +#define LINK_MANAGER_H + +#include "message_queue.h" +#include "socket_link.h" + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct { + message_queue_t *send_queue; + message_queue_t *receive_queue; + socket_link_t *socket_link; + pthread_t sender; + pthread_t receiver; + volatile int run; +} link_manager_t; + +link_manager_t *create_link_manager( + message_queue_t *send_queue, + message_queue_t *receive_queue, + socket_link_t *link); +void destroy_link_manager(link_manager_t *); + +#ifdef __cplusplus +} +#endif + +#endif /* LINK_MANAGER_H */ diff --git a/openair2/UTIL/ASYNC_IF/message_queue.c b/openair2/UTIL/ASYNC_IF/message_queue.c new file mode 100644 index 0000000000..3e06b5021a --- /dev/null +++ b/openair2/UTIL/ASYNC_IF/message_queue.c @@ -0,0 +1,211 @@ +/******************************************************************************* + OpenAirInterface + Copyright(c) 1999 - 2015 Eurecom + + OpenAirInterface is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + + OpenAirInterface is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with OpenAirInterface.The full GNU General Public License is + included in this distribution in the file called "COPYING". If not, + see . + + Contact Information + OpenAirInterface Admin: openair_admin@eurecom.fr + OpenAirInterface Tech : openair_tech@eurecom.fr + OpenAirInterface Dev : openair4g-devel@eurecom.fr + + Address : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE + +*******************************************************************************/ +/*! \file message_queue.c + * \brief this is the implementation of a message queue + * \author Cedric Roux + * \date November 2015 + * \version 1.0 + * \email: cedric.roux@eurecom.fr + * @ingroup _mac + */ + +#include "message_queue.h" +#include "log.h" + +#include +#include +#include +#include + +message_queue_t *new_message_queue(void) +{ + message_queue_t *ret = NULL; + + ret = calloc(1, sizeof(message_queue_t)); + if (ret == NULL) + goto error; + + ret->mutex = calloc(1, sizeof(pthread_mutex_t)); + if (ret->mutex == NULL) + goto error; + if (pthread_mutex_init(ret->mutex, NULL)) + goto error; + + ret->cond = calloc(1, sizeof(pthread_cond_t)); + if (ret->cond == NULL) + goto error; + if (pthread_cond_init(ret->cond, NULL)) + goto error; + + return ret; + +error: + LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); + if (ret != NULL) { + free(ret->mutex); + free(ret->cond); + memset(ret, 0, sizeof(message_queue_t)); + free(ret); + } + return NULL; +} + +int message_put(message_queue_t *queue, void *data, int size, int priority) +{ + message_t *m = NULL; + + m = calloc(1, sizeof(message_t)); + if (m == NULL) + goto error; + + m->data = data; + m->size = size; + m->priority = priority; + m->next = NULL; + + if (pthread_mutex_lock(queue->mutex)) + goto error; + + if (queue->count == 0) + queue->head = m; + else + queue->tail->next = m; + queue->tail = m; + + queue->count++; + + if (pthread_cond_signal(queue->cond)) { + LOG_E(MAC, "%s:%d:%s: fatal error\n", __FILE__, __LINE__, __FUNCTION__); + pthread_mutex_unlock(queue->mutex); + exit(1); + } + if (pthread_mutex_unlock(queue->mutex)) { + LOG_E(MAC, "%s:%d:%s: fatal error\n", __FILE__, __LINE__, __FUNCTION__); + exit(1); + } + + return 0; + +error: + free(m); + LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); + return -1; +} + +int message_get(message_queue_t *queue, void **data, int *size, int *priority) +{ + message_t *m; + + if (pthread_mutex_lock(queue->mutex)) + goto error; + + while (queue->count == 0) { + if (pthread_cond_wait(queue->cond, queue->mutex)) { + pthread_mutex_unlock(queue->mutex); + goto error; + } + } + + m = queue->head; + queue->head = queue->head->next; + if (queue->head == NULL) + queue->tail = NULL; + + queue->count--; + + if (pthread_mutex_unlock(queue->mutex)) + goto error; + + *data = m->data; + *size = m->size; + *priority = m->priority; + free(m); + + return 0; + +error: + LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); + return -1; +} + +/* when calling this function, the queue must not be used anymore (we don't lock it) */ +/* we suppose that the data pointer in messages was allocated by malloc/calloc/realloc */ +void destroy_message_queue(message_queue_t *queue) +{ + while (queue->head) { + message_t *m = queue->head; + queue->head = queue->head->next; + free(m->data); + memset(m, 0, sizeof(message_t)); + free(m); + } + free(queue->mutex); + free(queue->cond); + memset(queue, 0, sizeof(message_queue_t)); + free(queue); +} + +#ifdef TEST + +/* some very basic tests */ +int main(void) +{ + void *data; + int size; + int priority; + message_queue_t *q; + char *s; + + q = new_message_queue(); + if (q == NULL) goto error; + + if (message_put(q, "hello", 6, 0)) goto error; + if (message_put(q, "world", 6, 1)) goto error; + + if (message_get(q, &data, &size, &priority)) goto error; + printf("message:\n data: '%s'\n size: %d\n priority: %d\n", + (char *)data, size, priority); + if (message_get(q, &data, &size, &priority)) goto error; + printf("message:\n data: '%s'\n size: %d\n priority: %d\n", + (char *)data, size, priority); + + /* let's put a message before destroying the queue */ + s = malloc(10); if (s == NULL) goto error; + sprintf(s, "hello"); + if (message_put(q, s, 6, 0)) goto error; + destroy_message_queue(q); + + return 0; + +error: + printf("error\n"); + return 1; +} + +#endif diff --git a/openair2/UTIL/ASYNC_IF/message_queue.h b/openair2/UTIL/ASYNC_IF/message_queue.h new file mode 100644 index 0000000000..15fc4335a1 --- /dev/null +++ b/openair2/UTIL/ASYNC_IF/message_queue.h @@ -0,0 +1,71 @@ +/******************************************************************************* + OpenAirInterface + Copyright(c) 1999 - 2015 Eurecom + + OpenAirInterface is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + + OpenAirInterface is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with OpenAirInterface.The full GNU General Public License is + included in this distribution in the file called "COPYING". If not, + see . + + Contact Information + OpenAirInterface Admin: openair_admin@eurecom.fr + OpenAirInterface Tech : openair_tech@eurecom.fr + OpenAirInterface Dev : openair4g-devel@eurecom.fr + + Address : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE + +*******************************************************************************/ +/*! \file message_queue.h + * \brief this is the implementation of a message queue + * \author Cedric Roux + * \date November 2015 + * \version 1.0 + * \email: cedric.roux@eurecom.fr + * @ingroup _mac + */ + +#ifndef MESSAGE_QUEUE_H +#define MESSAGE_QUEUE_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct message_t { + void *data; + int size; + int priority; + struct message_t *next; +} message_t; + +typedef struct { + message_t *head; + message_t *tail; + volatile int count; + pthread_mutex_t *mutex; + pthread_cond_t *cond; +} message_queue_t; + +message_queue_t *new_message_queue(void); +int message_put(message_queue_t *queue, void *data, int size, int priority); +int message_get(message_queue_t *queue, void **data, int *size, int *priority); +void destroy_message_queue(message_queue_t *queue); + +#ifdef __cplusplus +} +#endif + +#endif /* MESSAGE_QUEUE_H */ diff --git a/openair2/UTIL/ASYNC_IF/socket_link.c b/openair2/UTIL/ASYNC_IF/socket_link.c new file mode 100644 index 0000000000..95a92ae3ee --- /dev/null +++ b/openair2/UTIL/ASYNC_IF/socket_link.c @@ -0,0 +1,349 @@ +/******************************************************************************* + OpenAirInterface + Copyright(c) 1999 - 2015 Eurecom + + OpenAirInterface is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + + OpenAirInterface is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with OpenAirInterface.The full GNU General Public License is + included in this distribution in the file called "COPYING". If not, + see . + + Contact Information + OpenAirInterface Admin: openair_admin@eurecom.fr + OpenAirInterface Tech : openair_tech@eurecom.fr + OpenAirInterface Dev : openair4g-devel@eurecom.fr + + Address : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE + +*******************************************************************************/ +/*! \file socket_link.c + * \brief this is the implementation of a TCP socket ASYNC IF + * \author Cedric Roux + * \date November 2015 + * \version 1.0 + * \email: cedric.roux@eurecom.fr + * @ingroup _mac + */ + +#include "socket_link.h" +#include "log.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +socket_link_t *new_link_server(int port) +{ + socket_link_t *ret = NULL; + int reuse; + struct sockaddr_in addr; + socklen_t addrlen; + int socket_server = -1; + + ret = calloc(1, sizeof(socket_link_t)); + if (ret == NULL) { + LOG_E(MAC, "%s:%d: out of memory\n", __FILE__, __LINE__); + goto error; + } + ret->socket_fd = -1; + + LOG_D(MAC, "create a new link server socket at port %d\n", port); + + socket_server = socket(AF_INET, SOCK_STREAM, 0); + if (socket_server == -1) { + LOG_E(MAC, "%s:%d: socket: %s\n", __FILE__, __LINE__, strerror(errno)); + goto error; + } + + reuse = 1; + if (setsockopt(socket_server, SOL_SOCKET, SO_REUSEADDR, &reuse, sizeof(reuse)) == -1) { + LOG_E(MAC, "%s:%d: setsockopt: %s\n", __FILE__, __LINE__, strerror(errno)); + goto error; + } + + addr.sin_family = AF_INET; + addr.sin_port = htons(port); + addr.sin_addr.s_addr = INADDR_ANY; + if (bind(socket_server, (struct sockaddr *)&addr, sizeof(addr)) == -1) { + LOG_E(MAC, "%s:%d: bind: %s\n", __FILE__, __LINE__, strerror(errno)); + goto error; + } + + if (listen(socket_server, 5)) { + LOG_E(MAC, "%s:%d: listen: %s\n", __FILE__, __LINE__, strerror(errno)); + goto error; + } + + addrlen = sizeof(addr); + ret->socket_fd = accept(socket_server, (struct sockaddr *)&addr, &addrlen); + if (ret->socket_fd == -1) { + LOG_E(MAC, "%s:%d: accept: %s\n", __FILE__, __LINE__, strerror(errno)); + goto error; + } + + close(socket_server); + + LOG_D(MAC, "connection from %s:%d\n", inet_ntoa(addr.sin_addr), ntohs(addr.sin_port)); + return ret; + +error: + close(socket_server); + if (ret != NULL) close(ret->socket_fd); + free(ret); + LOG_E(MAC, "ERROR in new_link_server (see above), returning NULL\n"); + return NULL; +} + +socket_link_t *new_link_client(char *server, int port) +{ + socket_link_t *ret = NULL; + struct sockaddr_in addr; + + ret = calloc(1, sizeof(socket_link_t)); + if (ret == NULL) { + LOG_E(MAC, "%s:%d: out of memory\n", __FILE__, __LINE__); + goto error; + } + ret->socket_fd = -1; + + LOG_D(MAC, "create a new link client socket connecting to %s:%d\n", server, port); + + ret->socket_fd = socket(AF_INET, SOCK_STREAM, 0); + if (ret->socket_fd == -1) { + LOG_E(MAC, "%s:%d: socket: %s\n", __FILE__, __LINE__, strerror(errno)); + goto error; + } + + addr.sin_family = AF_INET; + addr.sin_port = htons(port); + if (inet_aton(server, &addr.sin_addr) == 0) { + LOG_E(MAC, "invalid IP address '%s', use a.b.c.d notation\n", server); + goto error; + } + if (connect(ret->socket_fd, (struct sockaddr *)&addr, sizeof(addr)) == -1) { + LOG_E(MAC, "%s:%d: connect: %s\n", __FILE__, __LINE__, strerror(errno)); + goto error; + } + + LOG_D(MAC, "connection to %s:%d established\n", inet_ntoa(addr.sin_addr), ntohs(addr.sin_port)); + return ret; + +error: + if (ret != NULL) close(ret->socket_fd); + free(ret); + LOG_E(MAC, "ERROR in new_link_client (see above), returning NULL\n"); + return NULL; +} + +/* + * return -1 on error and 0 if the sending was fine + */ +static int socket_send(int socket_fd, void *buf, int size) +{ + char *s = buf; + int l; + + while (size) { + l = send(socket_fd, s, size, MSG_NOSIGNAL); + if (l == -1) goto error; + if (l == 0) { LOG_E(MAC, "%s:%d: this cannot happen, normally...\n", __FILE__, __LINE__); abort(); } + size -= l; + s += l; + } + + return 0; + +error: + LOG_E(MAC, "socket_send: ERROR: %s\n", strerror(errno)); + return -1; +} + +/* + * return -1 on error and 0 if the receiving was fine + */ +static int socket_receive(int socket_fd, void *buf, int size) +{ + char *s = buf; + int l; + + while (size) { + l = read(socket_fd, s, size); + if (l == -1) goto error; + if (l == 0) goto socket_closed; + size -= l; + s += l; + } + + return 0; + +error: + LOG_E(MAC, "socket_receive: ERROR: %s\n", strerror(errno)); + return -1; + +socket_closed: + LOG_E(MAC, "socket_receive: socket closed\n"); + return -1; +} + +/* + * return -1 on error and 0 if the sending was fine + */ +int link_send_packet(socket_link_t *link, void *data, int size) +{ + char sizebuf[4]; + int32_t s = size; + + /* send the size first, maximum is 2^31 bytes */ + sizebuf[0] = (s >> 24) & 255; + sizebuf[1] = (s >> 16) & 255; + sizebuf[2] = (s >> 8) & 255; + sizebuf[3] = s & 255; + + if (socket_send(link->socket_fd, sizebuf, 4) == -1) + goto error; + + link->bytes_sent += 4; + + if (socket_send(link->socket_fd, data, size) == -1) + goto error; + + link->bytes_sent += size; + link->packets_sent++; + + return 0; + +error: + return -1; +} + +/* + * return -1 on error and 0 if the sending was fine + */ +int link_receive_packet(socket_link_t *link, void **ret_data, int *ret_size) +{ + unsigned char sizebuf[4]; + int32_t size; + void *data = NULL; + + /* received the size first, maximum is 2^31 bytes */ + if (socket_receive(link->socket_fd, sizebuf, 4) == -1) + goto error; + + size = (sizebuf[0] << 24) | + (sizebuf[1] << 16) | + (sizebuf[2] << 8) | + sizebuf[3]; + + link->bytes_received += 4; + + data = malloc(size); + if (data == NULL) { + LOG_E(MAC, "%s:%d: out of memory\n", __FILE__, __LINE__); + goto error; + } + + if (socket_receive(link->socket_fd, data, size) == -1) + goto error; + + link->bytes_received += size; + link->packets_received++; + + *ret_data = data; + *ret_size = size; + return 0; + +error: + free(data); + *ret_data = NULL; + *ret_size = 0; + return -1; +} + +/* + * return -1 on error, 0 if all is fine + */ +int close_link(socket_link_t *link) +{ + close(link->socket_fd); + memset(link, 0, sizeof(socket_link_t)); + free(link); + return 0; +} + +#ifdef SERVER_TEST + +#include + +int main(void) +{ + void *data; + int size; + socket_link_t *l = new_link_server(2210); + if (l == NULL) { printf("no link created\n"); return 1; } + printf("link is up\n"); + printf("server starts sleeping...\n"); + /* this sleep is here to test for broken pipe. You can run "nc localhost 2210" + * and interrupt it quickly so that the server gets a 'broken' pipe on the + * following link_send_packet. + */ + sleep(1); + printf("... done\n"); + if (link_send_packet(l, "hello\n", 6+1) || + link_send_packet(l, "world\n", 6+1)) return 1; + if (link_receive_packet(l, &data, &size)) return 1; printf("%s", (char *)data); free(data); + if (link_receive_packet(l, &data, &size)) return 1; printf("%s", (char *)data); free(data); + printf("stats:\n"); + printf(" sent packets %"PRIu64"\n", l->packets_sent); + printf(" sent bytes %"PRIu64"\n", l->bytes_sent); + printf(" received packets %"PRIu64"\n", l->packets_received); + printf(" received bytes %"PRIu64"\n", l->bytes_received); + if (close_link(l)) return 1; + printf("link is down\n"); + return 0; +} + +#endif + +#ifdef CLIENT_TEST + +#include + +int main(void) +{ + void *data; + int size; + socket_link_t *l = new_link_client("127.0.0.1", 2210); + if (l == NULL) { printf("no link created\n"); return 1; } + printf("link is up\n"); + if (link_receive_packet(l, &data, &size)) return 1; printf("%s", (char *)data); free(data); + if (link_receive_packet(l, &data, &size)) return 1; printf("%s", (char *)data); free(data); + if (link_send_packet(l, "bye\n", 4+1) || + link_send_packet(l, "server\n", 7+1)) return 1; + printf("stats:\n"); + printf(" sent packets %"PRIu64"\n", l->packets_sent); + printf(" sent bytes %"PRIu64"\n", l->bytes_sent); + printf(" received packets %"PRIu64"\n", l->packets_received); + printf(" received bytes %"PRIu64"\n", l->bytes_received); + if (close_link(l)) return 1; + printf("link is down\n"); + return 0; +} + +#endif diff --git a/openair2/UTIL/ASYNC_IF/socket_link.h b/openair2/UTIL/ASYNC_IF/socket_link.h new file mode 100644 index 0000000000..c9e99b839f --- /dev/null +++ b/openair2/UTIL/ASYNC_IF/socket_link.h @@ -0,0 +1,65 @@ +/******************************************************************************* + OpenAirInterface + Copyright(c) 1999 - 2015 Eurecom + + OpenAirInterface is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + + OpenAirInterface is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with OpenAirInterface.The full GNU General Public License is + included in this distribution in the file called "COPYING". If not, + see . + + Contact Information + OpenAirInterface Admin: openair_admin@eurecom.fr + OpenAirInterface Tech : openair_tech@eurecom.fr + OpenAirInterface Dev : openair4g-devel@eurecom.fr + + Address : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE + +*******************************************************************************/ +/*! \file socket_link.h + * \brief this is the implementation of a TCP socket ASYNC IF + * \author Cedric Roux + * \date November 2015 + * \version 1.0 + * \email: cedric.roux@eurecom.fr + * @ingroup _mac + */ + +#ifndef SOCKET_LINK_H +#define SOCKET_LINK_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct { + int socket_fd; + uint64_t bytes_sent; + uint64_t packets_sent; + uint64_t bytes_received; + uint64_t packets_received; +} socket_link_t; + +socket_link_t *new_link_server(int port); +socket_link_t *new_link_client(char *server, int port); +int link_send_packet(socket_link_t *link, void *data, int size); +int link_receive_packet(socket_link_t *link, void **data, int *size); +int close_link(socket_link_t *link); + +#ifdef __cplusplus +} +#endif + +#endif /* SOCKET_LINK_H */ From 7ccf7a917f2928858e3cc8ac86dea88e43a3be82 Mon Sep 17 00:00:00 2001 From: Navid Nikaein Date: Tue, 15 Dec 2015 19:44:12 +0100 Subject: [PATCH 030/349] * add protobuf messages and compliation directives --- openair2/ENB_APP/MESSAGES/V2/header.proto | 19 ++ openair2/ENB_APP/MESSAGES/V2/progran.proto | 69 +++++++ .../ENB_APP/MESSAGES/V2/stats_common.proto | 176 ++++++++++++++++++ .../ENB_APP/MESSAGES/V2/stats_messages.proto | 86 +++++++++ 4 files changed, 350 insertions(+) create mode 100644 openair2/ENB_APP/MESSAGES/V2/header.proto create mode 100644 openair2/ENB_APP/MESSAGES/V2/progran.proto create mode 100644 openair2/ENB_APP/MESSAGES/V2/stats_common.proto create mode 100644 openair2/ENB_APP/MESSAGES/V2/stats_messages.proto diff --git a/openair2/ENB_APP/MESSAGES/V2/header.proto b/openair2/ENB_APP/MESSAGES/V2/header.proto new file mode 100644 index 0000000000..9193696491 --- /dev/null +++ b/openair2/ENB_APP/MESSAGES/V2/header.proto @@ -0,0 +1,19 @@ +package protocol; + +message prp_header { + optional uint32 version = 1; + optional uint32 type = 2; + optional uint32 length = 3; + optional uint32 xid = 4; +} + +enum prp_type { + // Discovery and maintenance messages + PRPT_HELLO = 0; + PRPT_ECHO_REQUEST = 1; + PRPT_ECHO_REPLY = 2; + + // Statistics and measurement messages + PRPT_STATS_REQUEST = 3; + PRPT_STATS_REPLY = 4; +} \ No newline at end of file diff --git a/openair2/ENB_APP/MESSAGES/V2/progran.proto b/openair2/ENB_APP/MESSAGES/V2/progran.proto new file mode 100644 index 0000000000..9e29f99532 --- /dev/null +++ b/openair2/ENB_APP/MESSAGES/V2/progran.proto @@ -0,0 +1,69 @@ +package protocol; + +import "stats_messages.proto"; + +// +// Maintenance and discovery messages +// + +// Empty message. Does not really have to be used. +// Could use only the header with the type set to PRPT_HELLO +message prp_hello { +} + +message prp_echo_request { + extensions 100 to 199; +} + + +message prp_echo_reply { + extensions 100 to 199; +} + + + +// +// Statistics request and reply message +// + +message prp_stats_request { + optional prp_stats_type type = 1; + oneof body { + prp_complete_stats_request complete_stats_request = 2; + prp_cell_stats_request cell_stats_request = 3; + prp_ue_stats_request ue_stats_request = 4; + } +} + +message prp_stats_reply { + optional prp_ue_stats_report ue_report = 1; + optional prp_cell_stats_report cell_report = 2; +} + + +// Extensions of the echo request and reply +// messages for carrying a latency value in ms +message prp_echo_request_latency { + extend prp_echo_request { + optional uint32 latency = 100; + } +} + +message prp_echo_reply_latency { + extend prp_echo_reply { + optional uint32 latency = 100; + } +} + + +//message progran_body { +// oneof msg { +// prp_hello hello_msg = 1; +// prp_echo_request echo_request_msg = 2; +// prp_echo_reply echo_reply_msg = 3; +// prp_stats_request stats_request_msg = 4; +// prp_stats_reply stats_reply_msg = 5; +// } +//} + + diff --git a/openair2/ENB_APP/MESSAGES/V2/stats_common.proto b/openair2/ENB_APP/MESSAGES/V2/stats_common.proto new file mode 100644 index 0000000000..77df92a68b --- /dev/null +++ b/openair2/ENB_APP/MESSAGES/V2/stats_common.proto @@ -0,0 +1,176 @@ +package protocol; + +// +// UE related statistics +// + +// RLC buffer status for a specific logical channel of a UE +message prp_rlc_bsr { + optional uint32 lc_id = 1; + optional uint32 tx_queue_size = 2; + optional uint32 tx_queue_hol_delay = 3; + optional uint32 retransmission_queue_size = 4; + optional uint32 retransmission_queue_hol_delay = 5; + optional uint32 status_pdu_size = 6; +} + +// Flags for MAC Control Elements +enum prp_ce_type { + PRPCET_TA = 1; + PRPCET_DRX = 2; + PRPCET_CR = 4; + PRPCET_CA = 8; +} + +// Types of DL CSI reports +enum prp_csi_type { + PRCSIT_P10 = 0; + PRCSIT_P11 = 1; + PRCSIT_P20 = 2; + PRCSIT_P21 = 3; + PRCSIT_A12 = 4; + PRCSIT_A22 = 5; + PRCSIT_A20 = 6; + PRCSIT_A30 = 7; + PRCSIT_A31 = 8; +} + +// CSI type P10 +message prp_csi_p10 { + optional uint32 wb_cqi = 1; +} + +// CSI type P11 +message prp_csi_p11 { + repeated uint32 wb_cqi = 1; + optional uint32 wb_pmi = 2; +} + +// CSI type P20 +message prp_csi_p20 { + optional uint32 wb_cqi = 1; + optional uint32 sb_cqi = 2; + optional uint32 bandwidth_part_index = 3; + optional uint32 sb_index = 4; +} + +// CSI type P21 +message prp_csi_p21 { + repeated uint32 wb_cqi = 1; + optional uint32 wb_pmi = 2; + repeated uint32 sb_cqi = 3; + optional uint32 badwidth_part_index = 4; + optional uint32 sb_index = 5; +} + +// CSI type A12 +message prp_csi_a12 { + repeated uint32 wb_cqi = 1; + repeated uint32 sb_pmi = 2; +} + +// CSI type A22 +message prp_csi_a22 { + repeated uint32 wb_cqi = 1; + repeated uint32 sb_cqi = 2; + optional uint32 wb_pmi = 3; + optional uint32 sb_pmi = 4; + repeated uint32 sb_list = 5; +} + +// CSI type A20 +message prp_csi_a20 { + optional uint32 wb_cqi = 1; + optional uint32 sb_cqi = 2; + repeated uint32 sb_list = 3; +} + +// CSI type A30 +message prp_csi_a30 { + optional uint32 wb_cqi = 1; + repeated uint32 sb_cqi = 2; +} + +// CSI type A31 +message prp_csi_a31 { + repeated uint32 wb_cqi = 1; + repeated prp_msb_cqi sb_cqi = 2; + optional uint32 wb_pmi = 3; +} + +// The CQI for the M-preffered subband +message prp_msb_cqi { + repeated uint32 sb_cqi = 1; +} + +// The CSI report of the UE for a specific servCellIndex +message prp_dl_csi { + optional uint32 serv_cell_index = 1; + optional uint32 ri = 2; + optional prp_csi_type type = 3; + oneof report { + prp_csi_p10 p10csi = 4; + prp_csi_p11 p11csi = 5; + prp_csi_p20 p20csi = 6; + prp_csi_p21 p21csi = 7; + prp_csi_a12 a12csi = 8; + prp_csi_a22 a22csi = 9; + prp_csi_a20 a20csi = 10; + prp_csi_a30 a30csi = 11; + prp_csi_a31 a31csi = 12; + } +} + +// The full DL CQI report for all CC of a UE +message prp_dl_cqi_report { + optional uint32 sfn_sn = 1; + repeated prp_dl_csi csi_report = 2; +} + +// Paging message info +message prp_paging_info { + optional uint32 paging_index = 1; + optional uint32 paging_message_size = 2; + optional uint32 paging_subframe = 3; + optional uint32 carrier_index = 4; +} + +// Report for the paging buffer status +message prp_paging_buffer_report { + repeated prp_paging_info paging_info = 1; +} + +// The type of UL CQI +enum prp_ul_cqi_type { + PRUCT_SRS = 0; + PRUCT_PUSCH = 1; + PRUCT_PUCCH_1 = 2; + PRUCT_PUCCH_2 = 3; + PRUCT_PRACH = 4; +} + +// UL CQI report for a specific UE for a given report type +message prp_ul_cqi { + optional prp_ul_cqi_type type = 1; + repeated uint32 sinr = 2; + optional uint32 serv_cell_index = 3; +} + +// Full UL CQI report for a specific UE +message prp_ul_cqi_report { + optional uint32 sfn_sn = 1; + repeated prp_ul_cqi cqi_meas = 2; +} + + +// +// Cell related statistics +// + +// The UL noise and interference report for a UE +message prp_noise_interference_report { + optional uint32 sfn_sf = 1; + optional uint32 rip = 2; + optional uint32 tnp = 3; +} + diff --git a/openair2/ENB_APP/MESSAGES/V2/stats_messages.proto b/openair2/ENB_APP/MESSAGES/V2/stats_messages.proto new file mode 100644 index 0000000000..5ec7ae690c --- /dev/null +++ b/openair2/ENB_APP/MESSAGES/V2/stats_messages.proto @@ -0,0 +1,86 @@ +package protocol; + +//import "header.proto"; +import "stats_common.proto"; + +// +// Bodies of statistics report requests +// + +message prp_complete_stats_request { + optional prp_stats_report_freq report_frequency = 1; + optional uint32 sf = 2; + optional uint32 cell_report_flags = 3; + optional uint32 ue_report_flags = 4; +} + +message prp_cell_stats_request { + repeated uint32 cell = 1; + optional uint32 flags = 2; +} + +message prp_ue_stats_request { + repeated uint32 rnti = 1; + optional uint32 flags = 2; +} + +// +// Bodies of statistics reports +// + +// The full statistics report for a specific cell +message prp_cell_stats_report { + optional uint32 carrier_index = 1; + optional uint32 flags = 2; + optional prp_noise_interference_report noise_inter_report = 3; +} + +// Statistics report for a specific UE +message prp_ue_stats_report { + optional uint32 rnti = 1; + optional uint32 flags = 2; + repeated uint32 bsr = 3; + optional uint32 phr = 4; + repeated prp_rlc_bsr rlc_report = 5; + optional uint32 pending_mac_ces = 6; + optional prp_dl_cqi_report dl_cqi_report = 7; + optional prp_paging_buffer_report pbr = 8; + optional prp_ul_cqi_report ul_cqi_report = 9; +} + +// +// Types of statistics related enums +// + + +//Types of statistics requested by the controller +enum prp_stats_type { + PRST_COMPLETE_STATS = 0; + PRST_CELL_STATS = 1; + PRST_UE_STATS = 2; +} + +// Report frequency for the requested statistics +enum prp_stats_report_freq { + PRSRF_ONCE = 0; + PRSRF_PERIODICAL = 1; + PRSRF_CONTINUOUS = 2; + PRSRF_OFF = 3; +} + +// Flags for cell statistics +enum prp_cell_stats_type { + PRCST_NOISE_INTERFERENCE = 1; +} + +// Flags for UE-related statistics +enum prp_ue_stats_type { + PRUST_BSR = 1; + PRUST_PRH = 2; + PRUST_RLC_BS = 4; + PRUST_MAC_CE_BS = 8; + PRUST_DL_CQI = 16; + PRUST_PBS = 32; + PRUST_UL_CQI = 64; + // To be extended with more types of stats +} \ No newline at end of file From 694718963a9b6bbf3de73ea7fff3844b4e23e2c3 Mon Sep 17 00:00:00 2001 From: Navid Nikaein Date: Tue, 15 Dec 2015 19:46:52 +0100 Subject: [PATCH 031/349] * script for automatic generation of protobug messages --- cmake_targets/tools/generate_protobuf | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100755 cmake_targets/tools/generate_protobuf diff --git a/cmake_targets/tools/generate_protobuf b/cmake_targets/tools/generate_protobuf new file mode 100755 index 0000000000..203fd1b0de --- /dev/null +++ b/cmake_targets/tools/generate_protobuf @@ -0,0 +1,15 @@ +#!/bin/bash + +function main() +{ +mkdir -p $1 +cd $1 + +echo generate protobuf messages inside $1 $2 + +protoc-c --c_out=$1 $2 +protoc --cpp_out=$1 $2 + +} + +main "$@" From 5f1f1abe3f5d7c4e52d4294d7876782fd2cc799b Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Tue, 15 Dec 2015 22:47:08 +0200 Subject: [PATCH 032/349] Added header in messages and removed length field --- openair2/ENB_APP/MESSAGES/V2/header.proto | 5 ++- openair2/ENB_APP/MESSAGES/V2/progran.proto | 42 ++++++++++++---------- 2 files changed, 25 insertions(+), 22 deletions(-) diff --git a/openair2/ENB_APP/MESSAGES/V2/header.proto b/openair2/ENB_APP/MESSAGES/V2/header.proto index 9193696491..f25613d86d 100644 --- a/openair2/ENB_APP/MESSAGES/V2/header.proto +++ b/openair2/ENB_APP/MESSAGES/V2/header.proto @@ -3,8 +3,7 @@ package protocol; message prp_header { optional uint32 version = 1; optional uint32 type = 2; - optional uint32 length = 3; - optional uint32 xid = 4; + optional uint32 xid = 3; } enum prp_type { @@ -16,4 +15,4 @@ enum prp_type { // Statistics and measurement messages PRPT_STATS_REQUEST = 3; PRPT_STATS_REPLY = 4; -} \ No newline at end of file +} diff --git a/openair2/ENB_APP/MESSAGES/V2/progran.proto b/openair2/ENB_APP/MESSAGES/V2/progran.proto index 9e29f99532..731bb2c4f5 100644 --- a/openair2/ENB_APP/MESSAGES/V2/progran.proto +++ b/openair2/ENB_APP/MESSAGES/V2/progran.proto @@ -1,22 +1,35 @@ package protocol; import "stats_messages.proto"; +import "header.proto" + +message progran_message { + oneof msg { + prp_hello hello_msg = 1; + prp_echo_request echo_request_msg = 2; + prp_echo_reply echo_reply_msg = 3; + prp_stats_request stats_request_msg = 4; + prp_stats_reply stats_reply_msg = 5; + } +} + // // Maintenance and discovery messages // -// Empty message. Does not really have to be used. -// Could use only the header with the type set to PRPT_HELLO message prp_hello { + optional prp_header header = 1; } message prp_echo_request { + optional prp_header header = 1; extensions 100 to 199; } message prp_echo_reply { + optional prp_header header = 1; extensions 100 to 199; } @@ -27,17 +40,19 @@ message prp_echo_reply { // message prp_stats_request { - optional prp_stats_type type = 1; + optional prp_header header = 1; + optional prp_stats_type type = 2; oneof body { - prp_complete_stats_request complete_stats_request = 2; - prp_cell_stats_request cell_stats_request = 3; - prp_ue_stats_request ue_stats_request = 4; + prp_complete_stats_request complete_stats_request = 3; + prp_cell_stats_request cell_stats_request = 4; + prp_ue_stats_request ue_stats_request = 5; } } message prp_stats_reply { - optional prp_ue_stats_report ue_report = 1; - optional prp_cell_stats_report cell_report = 2; + optional prp_header header = 1; + optional prp_ue_stats_report ue_report = 2; + optional prp_cell_stats_report cell_report = 3; } @@ -56,14 +71,3 @@ message prp_echo_reply_latency { } -//message progran_body { -// oneof msg { -// prp_hello hello_msg = 1; -// prp_echo_request echo_request_msg = 2; -// prp_echo_reply echo_reply_msg = 3; -// prp_stats_request stats_request_msg = 4; -// prp_stats_reply stats_reply_msg = 5; -// } -//} - - From 183e105f871d959609f9d541bb9fad63d38bd529 Mon Sep 17 00:00:00 2001 From: Navid Nikaein Date: Wed, 16 Dec 2015 11:58:48 +0100 Subject: [PATCH 033/349] update CMakeLists--generate .c files for protobufs --- cmake_targets/CMakeLists.txt | 45 +++++++++++++++++++++++++++++++++++- 1 file changed, 44 insertions(+), 1 deletion(-) diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index 122d41baa2..f8b1a343a5 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -244,6 +244,9 @@ endif (${RTAI}) set(asn1c_call "${OPENAIR_CMAKE}/tools/generate_asn1") set(asn1_generated_dir ${OPENAIR_BIN_DIR}) +set(protoc_call "${OPENAIR_CMAKE}/tools/generate_protobuf") +set(protobuf_generated_dir ${OPENAIR_BIN_DIR}) + # RRC ###### add_list2_option(RRC_ASN1_VERSION "Rel10" "ASN.1 version of RRC interface" "Rel8" "Rel10" "CBA") @@ -691,14 +694,54 @@ include_directories("${OPENAIR_DIR}") # Utilities Library ################ if (ENB_AGENT) + # set the version of protobuf messages, V3 not supported yet + add_list1_option(PRPT_VERSION V2 "PRPT MSG protobuf grammar version" V2 V3) + + if (${PRPT_VERSION} STREQUAL "V2") + set (PRPTDIR V2) + elseif (${PRPT_VERSION} STREQUAL "V3") + set (PRPTDIR V3) + endif(${PRPT_VERSION} STREQUAL "V2") + + set(PRPT_MSG_DIR ${OPENAIR2_DIR}/ENB_APP/MESSAGES/${PRPTDIR} ) + set(PRPT_MSG_FILES + ${PRPT_MSG_DIR}/header.proto + ${PRPT_MSG_DIR}/progran.proto + ${PRPT_MSG_DIR}/stats_common.proto + ${PRPT_MSG_DIR}/stats_messages.proto + ) + + set(PRPT_C_DIR ${protobuf_generated_dir}/${PRPTDIR}) + message("calling ${protoc_call} ${PRPT_C_DIR} ${PRPT_MSG_FILES}") + execute_process(COMMAND ${protoc_call} ${PRPT_C_DIR} ${PRPT_MSG_FILES}) + file(GLOB PRPT_source ${PRPT_C_DIR}/*.c) + set(PRPT_OAI_generated + ${PRPT_C_DIR}/header.pb-c.c + ${PRPT_C_DIR}/progran.pb-c.c + ${PRPT_C_DIR}/stats_common.pb-c.c + ${PRPT_C_DIR}/stats_messages.pb-c.c + ) + + file(GLOB prpt_h ${PRPT_C_DIR}/*.h) + set(prpt_h ${prpt_h} ) + + add_library(PRPT_MSG + ${PRPT_OAI_generated} + ${PRPT_source} + ) + + include_directories ("${PRPT_C_DIR}") + add_library(ASYNC_IF ${OPENAIR2_DIR}/UTIL/ASYNC_IF/socket_link.c ${OPENAIR2_DIR}/UTIL/ASYNC_IF/link_manager.c ${OPENAIR2_DIR}/UTIL/ASYNC_IF/message_queue.c ) set(ASYNC_IF_LIB ASYNC_IF) + include_directories(${OPENAIR2_DIR}/UTIL/ASYNC_IF) + endif() -include_directories(${OPENAIR2_DIR}/UTIL/ASYNC_IF) + add_library(HASHTABLE ${OPENAIR_DIR}/common/utils/collection/hashtable/hashtable.c From 988b483ab0c069f6b452c9beb392badc1ba330ce Mon Sep 17 00:00:00 2001 From: Navid Nikaein Date: Wed, 16 Dec 2015 16:53:37 +0100 Subject: [PATCH 034/349] * automatic generation of protobuf messages in CMakeList.txt --- cmake_targets/CMakeLists.txt | 8 ++++---- cmake_targets/tools/generate_protobuf | 12 ++++++++---- openair2/ENB_APP/MESSAGES/V2/progran.proto | 2 +- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index f8b1a343a5..197b94699c 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -712,8 +712,8 @@ if (ENB_AGENT) ) set(PRPT_C_DIR ${protobuf_generated_dir}/${PRPTDIR}) - message("calling ${protoc_call} ${PRPT_C_DIR} ${PRPT_MSG_FILES}") - execute_process(COMMAND ${protoc_call} ${PRPT_C_DIR} ${PRPT_MSG_FILES}) + #message("calling protoc_call=${protoc_call} PRPT_C_DIR=${PRPT_C_DIR} PRPT_MSG_FILES=${PRPT_MSG_FILES}") + execute_process(COMMAND ${protoc_call} ${PRPT_C_DIR} ${PRPT_MSG_DIR} ${PRPT_MSG_FILES}) file(GLOB PRPT_source ${PRPT_C_DIR}/*.c) set(PRPT_OAI_generated ${PRPT_C_DIR}/header.pb-c.c @@ -729,7 +729,7 @@ if (ENB_AGENT) ${PRPT_OAI_generated} ${PRPT_source} ) - + set(PRPT_MSG_LIB PRPT_MSG) include_directories ("${PRPT_C_DIR}") add_library(ASYNC_IF @@ -1647,7 +1647,7 @@ add_executable(oaisim_nos1 target_include_directories(oaisim_nos1 PUBLIC ${OPENAIR_TARGETS}/SIMU/USER) target_link_libraries (oaisim_nos1 -Wl,--start-group - RRC_LIB X2AP_LIB SECU_CN UTIL HASHTABLE SCHED_LIB PHY LFDS ${MSC_LIB} L2 ${RAL_LIB} SIMU SIMU_ETH SECU_OSA ${ITTI_LIB} ${MIH_LIB} ${ASYNC_IF_LIB} + RRC_LIB X2AP_LIB SECU_CN UTIL HASHTABLE SCHED_LIB PHY LFDS ${MSC_LIB} L2 ${RAL_LIB} SIMU SIMU_ETH SECU_OSA ${ITTI_LIB} ${MIH_LIB} ${PRPT_MSG_LIB} ${ASYNC_IF_LIB} -Wl,--end-group ) target_link_libraries (oaisim_nos1 ${LIBXML2_LIBRARIES} ${LAPACK_LIBRARIES}) diff --git a/cmake_targets/tools/generate_protobuf b/cmake_targets/tools/generate_protobuf index 203fd1b0de..5c1b523f8c 100755 --- a/cmake_targets/tools/generate_protobuf +++ b/cmake_targets/tools/generate_protobuf @@ -3,12 +3,16 @@ function main() { mkdir -p $1 -cd $1 -echo generate protobuf messages inside $1 $2 +#echo generate protobuf messages inside $1 $2 -protoc-c --c_out=$1 $2 -protoc --cpp_out=$1 $2 +c_out=$1 +shift +proto_path=$1 +shift + +protoc-c --c_out=$c_out --proto_path=$proto_path $* +#protoc --cpp_out=$c_out --proto_path=$proto_path $* } diff --git a/openair2/ENB_APP/MESSAGES/V2/progran.proto b/openair2/ENB_APP/MESSAGES/V2/progran.proto index 731bb2c4f5..41bbeaaf81 100644 --- a/openair2/ENB_APP/MESSAGES/V2/progran.proto +++ b/openair2/ENB_APP/MESSAGES/V2/progran.proto @@ -1,7 +1,7 @@ package protocol; import "stats_messages.proto"; -import "header.proto" +import "header.proto"; message progran_message { oneof msg { From 0dee574c578091efe8fc02c62b203cb910497eea Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Thu, 17 Dec 2015 11:37:18 +0200 Subject: [PATCH 035/349] Changed prp_stats_reply message to support multiple UE and cell reports --- openair2/ENB_APP/MESSAGES/V2/progran.proto | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openair2/ENB_APP/MESSAGES/V2/progran.proto b/openair2/ENB_APP/MESSAGES/V2/progran.proto index 41bbeaaf81..e631762946 100644 --- a/openair2/ENB_APP/MESSAGES/V2/progran.proto +++ b/openair2/ENB_APP/MESSAGES/V2/progran.proto @@ -51,8 +51,8 @@ message prp_stats_request { message prp_stats_reply { optional prp_header header = 1; - optional prp_ue_stats_report ue_report = 2; - optional prp_cell_stats_report cell_report = 3; + repeated prp_ue_stats_report ue_report = 2; + repeated prp_cell_stats_report cell_report = 3; } From 17251ddaacb491793c3b1b2bbf42fb741a0f0e22 Mon Sep 17 00:00:00 2001 From: Navid Nikaein Date: Mon, 21 Dec 2015 03:36:37 +0100 Subject: [PATCH 036/349] Very basic version of the enb agent --- cmake_targets/CMakeLists.txt | 24 +- .../oaisim_noS1_build_oai/CMakeLists.template | 2 +- openair2/ENB_APP/MESSAGES/V2/header.proto | 3 +- openair2/ENB_APP/MESSAGES/V2/progran.proto | 31 +- openair2/ENB_APP/enb_agent.c | 202 +++++++ openair2/ENB_APP/enb_agent.h | 47 ++ openair2/ENB_APP/enb_agent_common.c | 246 ++++++++ openair2/ENB_APP/enb_agent_common.h | 88 +++ openair2/ENB_APP/enb_agent_handler.c | 133 +++++ openair2/ENB_APP/enb_agent_mac.c | 552 ++++++++++++++++++ openair2/ENB_APP/enb_agent_mac.h | 77 +++ openair2/ENB_APP/enb_app.c | 9 + targets/SIMU/USER/oaisim.c | 9 + 13 files changed, 1414 insertions(+), 9 deletions(-) create mode 100644 openair2/ENB_APP/enb_agent.c create mode 100644 openair2/ENB_APP/enb_agent.h create mode 100644 openair2/ENB_APP/enb_agent_common.c create mode 100644 openair2/ENB_APP/enb_agent_common.h create mode 100644 openair2/ENB_APP/enb_agent_handler.c create mode 100644 openair2/ENB_APP/enb_agent_mac.c create mode 100644 openair2/ENB_APP/enb_agent_mac.h diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index 197b94699c..6fa30b2b35 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -477,7 +477,7 @@ add_boolean_option(MESSAGE_CHART_GENERATOR False "For generating sequenc add_boolean_option(MESSAGE_CHART_GENERATOR_RLC_MAC False "trace RLC-MAC exchanges in sequence diagrams") add_boolean_option(MESSAGE_CHART_GENERATOR_PHY False "trace some PHY exchanges in sequence diagrams") -add_boolean_option(ENB_AGENT True "enable eNB agent to inteface with a SDN contrller") +add_boolean_option(ENB_AGENT_SB_IF True "enable eNB agent to inteface with a SDN contrller") ######################## # Include order @@ -693,7 +693,7 @@ include_directories("${OPENAIR_DIR}") # Utilities Library ################ -if (ENB_AGENT) +if (ENB_AGENT_SB_IF) # set the version of protobuf messages, V3 not supported yet add_list1_option(PRPT_VERSION V2 "PRPT MSG protobuf grammar version" V2 V3) @@ -730,7 +730,8 @@ if (ENB_AGENT) ${PRPT_source} ) set(PRPT_MSG_LIB PRPT_MSG) - include_directories ("${PRPT_C_DIR}") + #message("prpt c dir is : ${PRPT_C_DIR}") + include_directories (${PRPT_C_DIR}) add_library(ASYNC_IF ${OPENAIR2_DIR}/UTIL/ASYNC_IF/socket_link.c @@ -740,6 +741,18 @@ if (ENB_AGENT) set(ASYNC_IF_LIB ASYNC_IF) include_directories(${OPENAIR2_DIR}/UTIL/ASYNC_IF) + add_library(ENB_AGENT + ${OPENAIR2_DIR}/ENB_APP/enb_agent_handler.c + ${OPENAIR2_DIR}/ENB_APP/enb_agent_common.c + ${OPENAIR2_DIR}/ENB_APP/enb_agent_mac.c + ${OPENAIR2_DIR}/ENB_APP/enb_agent.c + ) + set(ENB_AGENT_LIB ENB_AGENT) + #include_directories(${OPENAIR2_DIR}/ENB_APP) + + set(PROTOBUF_LIB "protobuf-c") + + #set(PROTOBUF_LIB "protobuf") #for Cpp endif() @@ -1647,15 +1660,16 @@ add_executable(oaisim_nos1 target_include_directories(oaisim_nos1 PUBLIC ${OPENAIR_TARGETS}/SIMU/USER) target_link_libraries (oaisim_nos1 -Wl,--start-group - RRC_LIB X2AP_LIB SECU_CN UTIL HASHTABLE SCHED_LIB PHY LFDS ${MSC_LIB} L2 ${RAL_LIB} SIMU SIMU_ETH SECU_OSA ${ITTI_LIB} ${MIH_LIB} ${PRPT_MSG_LIB} ${ASYNC_IF_LIB} + RRC_LIB X2AP_LIB SECU_CN UTIL HASHTABLE SCHED_LIB PHY LFDS ${MSC_LIB} L2 ${RAL_LIB} SIMU SIMU_ETH SECU_OSA ${ITTI_LIB} ${MIH_LIB} ${PRPT_MSG_LIB} ${ASYNC_IF_LIB} ${ENB_AGENT_LIB} -Wl,--end-group ) target_link_libraries (oaisim_nos1 ${LIBXML2_LIBRARIES} ${LAPACK_LIBRARIES}) target_link_libraries (oaisim_nos1 pthread m ${CONFIG_LIBRARIES} rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${NETTLE_LIBRARIES} ${option_HW_lib} - ${ATLAS_LIBRARIES} ${XFORMS_LIBRARIES} ${OPENPGM_LIBRARIES}) + ${ATLAS_LIBRARIES} ${XFORMS_LIBRARIES} ${OPENPGM_LIBRARIES} ${PROTOBUF_LIB}) #Force link with forms, regardless XFORMS option target_link_libraries (oaisim_nos1 forms) +#message("protobuflib is ${PROTOBUF_LIB}") # Unitary tests for each piece of L1: example, mbmssim is MBMS L1 simulator ##################################### diff --git a/cmake_targets/oaisim_noS1_build_oai/CMakeLists.template b/cmake_targets/oaisim_noS1_build_oai/CMakeLists.template index a905510150..7bdf252352 100644 --- a/cmake_targets/oaisim_noS1_build_oai/CMakeLists.template +++ b/cmake_targets/oaisim_noS1_build_oai/CMakeLists.template @@ -48,7 +48,7 @@ set ( NEW_FFT True ) set ( NO_RRM True ) set ( OAI_EMU True ) set ( OAISIM True ) -set ( OAI_NW_DRIVER_TYPE_ETHERNET True ) +set ( OAI_NW_DRIVER_TYPE_ETHERNET False ) set ( OAI_NW_DRIVER_USE_NETLINK True ) set ( OPENAIR1 True ) set ( OPENAIR2 True ) diff --git a/openair2/ENB_APP/MESSAGES/V2/header.proto b/openair2/ENB_APP/MESSAGES/V2/header.proto index f25613d86d..b2319c8220 100644 --- a/openair2/ENB_APP/MESSAGES/V2/header.proto +++ b/openair2/ENB_APP/MESSAGES/V2/header.proto @@ -3,7 +3,7 @@ package protocol; message prp_header { optional uint32 version = 1; optional uint32 type = 2; - optional uint32 xid = 3; + optional uint32 xid = 4; } enum prp_type { @@ -16,3 +16,4 @@ enum prp_type { PRPT_STATS_REQUEST = 3; PRPT_STATS_REPLY = 4; } + diff --git a/openair2/ENB_APP/MESSAGES/V2/progran.proto b/openair2/ENB_APP/MESSAGES/V2/progran.proto index e631762946..363592d6e3 100644 --- a/openair2/ENB_APP/MESSAGES/V2/progran.proto +++ b/openair2/ENB_APP/MESSAGES/V2/progran.proto @@ -1,10 +1,12 @@ +//'syntax = "proto2";' package protocol; import "stats_messages.proto"; import "header.proto"; message progran_message { - oneof msg { + required progran_direction msg_dir = 100; + oneof msg { prp_hello hello_msg = 1; prp_echo_request echo_request_msg = 2; prp_echo_reply echo_reply_msg = 3; @@ -13,6 +15,32 @@ message progran_message { } } +enum progran_direction { + //option allow_alias = true; + NOT_SET = 0; + INITIATING_MESSAGE = 1; + SUCCESSFUL_OUTCOME=2; + UNSUCCESSFUL_OUTCOME=3; +} + +enum progran_err { + option allow_alias = true; + // message errors + NO_ERR = 0; + MSG_DEQUEUING = -1; + MSG_ENQUEUING = -2; + MSG_DECODING = -3; + MSG_ENCODING = -4; + MSG_BUILD = -5; + MSG_NOT_SUPPORTED = -6; + MSG_NOT_HANDLED = -7; + MSG_NOT_VALIDATED = -8; + MSG_OUT_DATED = -9; + + + // other erros + UNEXPECTED = -100; +} // // Maintenance and discovery messages @@ -34,7 +62,6 @@ message prp_echo_reply { } - // // Statistics request and reply message // diff --git a/openair2/ENB_APP/enb_agent.c b/openair2/ENB_APP/enb_agent.c new file mode 100644 index 0000000000..c9a00ae9ce --- /dev/null +++ b/openair2/ENB_APP/enb_agent.c @@ -0,0 +1,202 @@ +/******************************************************************************* + OpenAirInterface + Copyright(c) 1999 - 2014 Eurecom + + OpenAirInterface is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + + OpenAirInterface is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with OpenAirInterface.The full GNU General Public License is + included in this distribution in the file called "COPYING". If not, + see . + + Contact Information + OpenAirInterface Admin: openair_admin@eurecom.fr + OpenAirInterface Tech : openair_tech@eurecom.fr + OpenAirInterface Dev : openair4g-devel@lists.eurecom.fr + + Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. + + *******************************************************************************/ + +/*! \file + * \brief + * \author + * \date 2016 + * \version 0.1 + */ + + +#include +#include +#include +#include +#include + +#include "enb_agent_common.h" +#include "link_manager.h" +#include "log.h" +#include "enb_agent.h" + +typedef uint8_t xid_t; + +// tx and rx shared context +typedef struct { + message_queue_t *tx_mq; + message_queue_t *rx_mq; + xid_t tx_xid; + xid_t rx_xid; +} msg_context_t; +msg_context_t shared_ctxt; + +void *send_thread(void *arg); +void *receive_thread(void *arg); +pthread_t new_thread(void *(*f)(void *), void *b); + +void *send_thread(void *arg) { + + msg_context_t *d = arg; + void *data; + int size; + int priority; + + + while (1) { + // need logic for the timer, and + usleep(10); + if (message_put(d->tx_mq, data, size, priority)) goto error; + } + + return NULL; + +error: + printf("receive_thread: there was an error\n"); + return NULL; +} + +void *receive_thread(void *arg) { + + msg_context_t *d = arg; + void *data; + int size; + int priority; + err_code_t err_code; + + Protocol__ProgranMessage *msg; + + while (1) { + if (message_get(d->rx_mq, &data, &size, &priority)){ + err_code = PROTOCOL__PROGRAN_ERR__MSG_DEQUEUING; + goto error; + } + LOG_D(ENB_APP,"received message with size %d\n", size); + + + msg=enb_agent_handle_message(d->rx_xid, data, size); + + free(data); + + d->rx_xid = ((d->rx_xid)+1)%4; + d->tx_xid = d->rx_xid; + + // check if there is something to send back to the controller + if (msg != NULL){ + data=enb_agent_send_message(d->tx_xid,msg,&size); + + if (message_put(d->tx_mq, data, size, priority)){ + err_code = PROTOCOL__PROGRAN_ERR__MSG_ENQUEUING; + goto error; + } + LOG_D(ENB_APP,"sent message with size %d\n", size); + } + + } + + return NULL; + +error: + printf("receive_thread: error %d occured\n",err_code); + return NULL; +} + + +/* utility function to create a thread */ +pthread_t new_thread(void *(*f)(void *), void *b) { + pthread_t t; + pthread_attr_t att; + + if (pthread_attr_init(&att)){ + fprintf(stderr, "pthread_attr_init err\n"); + exit(1); + } + if (pthread_attr_setdetachstate(&att, PTHREAD_CREATE_DETACHED)) { + fprintf(stderr, "pthread_attr_setdetachstate err\n"); + exit(1); + } + if (pthread_create(&t, &att, f, b)) { + fprintf(stderr, "pthread_create err\n"); + exit(1); + } + if (pthread_attr_destroy(&att)) { + fprintf(stderr, "pthread_attr_destroy err\n"); + exit(1); + } + + return t; +} + +int enb_agent_start(){ + + socket_link_t *link; + message_queue_t *send_queue; + message_queue_t *receive_queue; + link_manager_t *manager; + + LOG_I(ENB_APP,"starting enb agent client\n"); + + link = new_link_client("127.0.0.1", 2210); + if (link == NULL) goto error; + + send_queue = new_message_queue(); + if (send_queue == NULL) goto error; + receive_queue = new_message_queue(); + if (receive_queue == NULL) goto error; + + manager = create_link_manager(send_queue, receive_queue, link); + if (manager == NULL) goto error; + + + memset(&shared_ctxt, 0, sizeof(msg_context_t)); + + shared_ctxt.tx_mq = send_queue; + shared_ctxt.rx_mq = receive_queue; + + new_thread(receive_thread, &shared_ctxt); + + // new_thread(send_thread, &shared_ctxt); + + // while (1) pause(); + + printf("client ends\n"); + return 0; + +error: + printf("there was an error\n"); + return 1; + +} + + + +int enb_agent_stop(){ + + +} diff --git a/openair2/ENB_APP/enb_agent.h b/openair2/ENB_APP/enb_agent.h new file mode 100644 index 0000000000..89d1d9e0c2 --- /dev/null +++ b/openair2/ENB_APP/enb_agent.h @@ -0,0 +1,47 @@ + +/******************************************************************************* + OpenAirInterface + Copyright(c) 1999 - 2014 Eurecom + + OpenAirInterface is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + + OpenAirInterface is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with OpenAirInterface.The full GNU General Public License is + included in this distribution in the file called "COPYING". If not, + see . + + Contact Information + OpenAirInterface Admin: openair_admin@eurecom.fr + OpenAirInterface Tech : openair_tech@eurecom.fr + OpenAirInterface Dev : openair4g-devel@lists.eurecom.fr + + Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. + + *******************************************************************************/ + +/*! \file + * \brief + * \author + * \date 2016 + * \version 0.1 + */ + +#ifndef ENB_AGENT_H_ +#define ENB_AGENT_H_ + + +int enb_agent_start(); + +int enb_agent_stop(); + + +#endif diff --git a/openair2/ENB_APP/enb_agent_common.c b/openair2/ENB_APP/enb_agent_common.c new file mode 100644 index 0000000000..d71a5a6acc --- /dev/null +++ b/openair2/ENB_APP/enb_agent_common.c @@ -0,0 +1,246 @@ +/******************************************************************************* + OpenAirInterface + Copyright(c) 1999 - 2014 Eurecom + + OpenAirInterface is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + + OpenAirInterface is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with OpenAirInterface.The full GNU General Public License is + included in this distribution in the file called "COPYING". If not, + see . + + Contact Information + OpenAirInterface Admin: openair_admin@eurecom.fr + OpenAirInterface Tech : openair_tech@eurecom.fr + OpenAirInterface Dev : openair4g-devel@lists.eurecom.fr + + Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. + + *******************************************************************************/ + +/*! \file + * \brief + * \author + * \date 2016 + * \version 0.1 + */ + + +#include "enb_agent_common.h" +#include "log.h" + + +int enb_agent_serialize_message(Protocol__ProgranMessage *msg, void **buf, int *size) { + + *size = protocol__progran_message__get_packed_size(msg); + + *buf = malloc(*size); + if (buf == NULL) + goto error; + + protocol__progran_message__pack(msg, *buf); + + return 0; + + error: + LOG_E(ENB_APP, "an error occured\n"); // change the com + return -1; +} + + + +/* We assume that the buffer size is equal to the message size. + Should be chekced durint Tx/Rx */ +int enb_agent_deserialize_message(void *data, int size, Protocol__ProgranMessage **msg) { + *msg = protocol__progran_message__unpack(NULL, size, data); + if (*msg == NULL) + goto error; + + return 0; + + error: + //LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); + return -1; +} + + + + + +int prp_create_header(uint32_t xid, Protocol__PrpType type, Protocol__PrpHeader **header) { + + *header = malloc(sizeof(Protocol__PrpHeader)); + if(*header == NULL) + goto error; + + protocol__prp_header__init(*header); + (*header)->version = PROGRAN_VERSION; + (*header)->has_version = 1; + // check if the type is set + (*header)->type = type; + (*header)->has_type = 1; + (*header)->xid = xid; + (*header)->has_xid = 1; + return 0; + + error: + LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); + return -1; +} + + +int enb_agent_hello(uint32_t xid, Protocol__ProgranMessage **msg) { + + Protocol__PrpHeader *header; + if (prp_create_header(xid, PROTOCOL__PRP_TYPE__PRPT_HELLO, &header) != 0) + goto error; + + Protocol__PrpHello *hello_msg; + hello_msg = malloc(sizeof(Protocol__PrpHello)); + if(hello_msg == NULL) + goto error; + protocol__prp_hello__init(hello_msg); + hello_msg->header = header; + + *msg = malloc(sizeof(Protocol__ProgranMessage)); + if(*msg == NULL) + goto error; + + protocol__progran_message__init(*msg); + (*msg)->msg_case = PROTOCOL__PROGRAN_MESSAGE__MSG_HELLO_MSG; + (*msg)->msg_dir = PROTOCOL__PROGRAN_DIRECTION__INITIATING_MESSAGE; + (*msg)->hello_msg = hello_msg; + return 0; + + error: + if(header != NULL) + free(header); + if(hello_msg != NULL) + free(hello_msg); + if(*msg != NULL) + free(*msg); + LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); + return -1; +} + + +int enb_agent_destroy_hello_message(Protocol__ProgranMessage *msg) { + + if(msg->msg_case != PROTOCOL__PROGRAN_MESSAGE__MSG_HELLO_MSG) + goto error; + + free(msg->hello_msg->header); + free(msg->hello_msg); + free(msg); + return 0; + + error: + LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); + return -1; +} + + +int enb_agent_echo_request(uint32_t xid, Protocol__ProgranMessage **msg) { + Protocol__PrpHeader *header; + if (prp_create_header(xid, PROTOCOL__PRP_TYPE__PRPT_ECHO_REQUEST, &header) != 0) + goto error; + + Protocol__PrpEchoRequest *echo_request_msg; + echo_request_msg = malloc(sizeof(Protocol__PrpEchoRequest)); + if(echo_request_msg == NULL) + goto error; + protocol__prp_echo_request__init(echo_request_msg); + echo_request_msg->header = header; + + *msg = malloc(sizeof(Protocol__ProgranMessage)); + if(*msg == NULL) + goto error; + protocol__progran_message__init(*msg); + (*msg)->msg_case = PROTOCOL__PROGRAN_MESSAGE__MSG_ECHO_REQUEST_MSG; + (*msg)->msg_dir = PROTOCOL__PROGRAN_DIRECTION__INITIATING_MESSAGE; + (*msg)->echo_request_msg = echo_request_msg; + return 0; + + error: + if(header != NULL) + free(header); + if(echo_request_msg != NULL) + free(echo_request_msg); + if(*msg != NULL) + free(*msg); + //LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); + return -1; +} + + +int enb_agent_destroy_echo_request(Protocol__ProgranMessage *msg) { + if(msg->msg_case != PROTOCOL__PROGRAN_MESSAGE__MSG_ECHO_REQUEST_MSG) + goto error; + + free(msg->echo_request_msg->header); + free(msg->echo_request_msg); + free(msg); + return 0; + + error: + LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); + return -1; +} + + + +int enb_agent_echo_reply(uint32_t xid, Protocol__ProgranMessage **msg) { + Protocol__PrpHeader *header; + if (prp_create_header(xid, PROTOCOL__PRP_TYPE__PRPT_ECHO_REPLY, &header) != 0) + goto error; + + Protocol__PrpEchoReply *echo_reply_msg; + echo_reply_msg = malloc(sizeof(Protocol__PrpEchoReply)); + if(echo_reply_msg == NULL) + goto error; + protocol__prp_echo_reply__init(echo_reply_msg); + echo_reply_msg->header = header; + + *msg = malloc(sizeof(Protocol__ProgranMessage)); + if(*msg == NULL) + goto error; + protocol__progran_message__init(*msg); + (*msg)->msg_case = PROTOCOL__PROGRAN_MESSAGE__MSG_ECHO_REPLY_MSG; + (*msg)->msg_dir = PROTOCOL__PROGRAN_DIRECTION__SUCCESSFUL_OUTCOME; + (*msg)->echo_reply_msg = echo_reply_msg; + return 0; + + error: + if(header != NULL) + free(header); + if(echo_reply_msg != NULL) + free(echo_reply_msg); + if(*msg != NULL) + free(*msg); + LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); + return -1; +} + + +int enb_agent_destroy_echo_reply(Protocol__ProgranMessage *msg) { + if(msg->msg_case != PROTOCOL__PROGRAN_MESSAGE__MSG_ECHO_REPLY_MSG) + goto error; + + free(msg->echo_reply_msg->header); + free(msg->echo_reply_msg); + free(msg); + return 0; + + error: + LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); + return -1; +} diff --git a/openair2/ENB_APP/enb_agent_common.h b/openair2/ENB_APP/enb_agent_common.h new file mode 100644 index 0000000000..3fb0d366ac --- /dev/null +++ b/openair2/ENB_APP/enb_agent_common.h @@ -0,0 +1,88 @@ +/******************************************************************************* + OpenAirInterface + Copyright(c) 1999 - 2014 Eurecom + + OpenAirInterface is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + + OpenAirInterface is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with OpenAirInterface.The full GNU General Public License is + included in this distribution in the file called "COPYING". If not, + see . + + Contact Information + OpenAirInterface Admin: openair_admin@eurecom.fr + OpenAirInterface Tech : openair_tech@eurecom.fr + OpenAirInterface Dev : openair4g-devel@lists.eurecom.fr + + Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. + + *******************************************************************************/ + +/*! \file + * \brief + * \author + * \date 2016 + * \version 0.1 + */ + + + +#ifndef ENB_AGENT_COMMON_H_ +#define ENB_AGENT_COMMON_H_ + + +#include "header.pb-c.h" +#include "progran.pb-c.h" +#include "stats_messages.pb-c.h" +#include "stats_common.pb-c.h" + +#define PROGRAN_VERSION 0 + +typedef int (*enb_agent_message_decoded_callback)( + uint32_t xid, + Protocol__ProgranMessage **msg +); + +typedef int32_t err_code_t; + +int enb_agent_serialize_message(Protocol__ProgranMessage *msg, void **buf, int *size); +int enb_agent_deserialize_message(void *data, int size, Protocol__ProgranMessage **msg); + +int prp_create_header(uint32_t xid, Protocol__PrpType type, Protocol__PrpHeader **header); + +int enb_agent_hello(uint32_t xid, Protocol__ProgranMessage **msg); +int enb_agent_destroy_hello(Protocol__ProgranMessage *msg); + +int enb_agent_echo_request(uint32_t xid, Protocol__ProgranMessage **msg); +int enb_agent_destroy_echo_request(Protocol__ProgranMessage *msg); + +int enb_agent_echo_reply(uint32_t xid, Protocol__ProgranMessage **msg); +int enb_agent_destroy_echo_reply(Protocol__ProgranMessage *msg); + + +Protocol__ProgranMessage* enb_agent_handle_message (uint32_t xid, + uint8_t *data, + uint32_t size); + +void * enb_agent_send_message(uint32_t xid, + Protocol__ProgranMessage *msg, + uint32_t * size); + + +#endif + + + + + + + diff --git a/openair2/ENB_APP/enb_agent_handler.c b/openair2/ENB_APP/enb_agent_handler.c new file mode 100644 index 0000000000..2b9509f48e --- /dev/null +++ b/openair2/ENB_APP/enb_agent_handler.c @@ -0,0 +1,133 @@ +/******************************************************************************* + OpenAirInterface + Copyright(c) 1999 - 2014 Eurecom + + OpenAirInterface is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + + OpenAirInterface is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with OpenAirInterface.The full GNU General Public License is + included in this distribution in the file called "COPYING". If not, + see . + + Contact Information + OpenAirInterface Admin: openair_admin@eurecom.fr + OpenAirInterface Tech : openair_tech@eurecom.fr + OpenAirInterface Dev : openair4g-devel@lists.eurecom.fr + + Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. + + *******************************************************************************/ + +/*! \file + * \brief + * \author + * \date 2016 + * \version 0.1 + */ + + +#include "enb_agent_common.h" +#include "enb_agent_mac.h" +#include "log.h" + +#include "assertions.h" + +enb_agent_message_decoded_callback messages_callback[][3] = { + {enb_agent_hello, enb_agent_hello,0}, /*PROTOCOL__PROGRAN_MESSAGE__MSG_HELLO_MSG*/ + {enb_agent_echo_request, enb_agent_echo_reply,0}, /**/ + {0, enb_agent_mac_reply,0}, /*stats*/ + {0,0,0}, + +}; + +static const char *enb_agent_direction2String[] = { + "", /* not_set */ + "originating message", /* originating message */ + "successfull outcome", /* successfull outcome */ + "unsuccessfull outcome", /* unsuccessfull outcome */ +}; + + +Protocol__ProgranMessage* enb_agent_handle_message (uint32_t xid, + uint8_t *data, + uint32_t size){ + + Protocol__ProgranMessage *message; + err_code_t err_code; + DevAssert(data != NULL); + + if (enb_agent_deserialize_message(data, size, &message) < 0) { + err_code= PROTOCOL__PROGRAN_ERR__MSG_DECODING; + goto error; + } + + if ((message->msg_case > sizeof(messages_callback) / (3*sizeof(enb_agent_message_decoded_callback))) || + (message->msg_dir > PROTOCOL__PROGRAN_DIRECTION__UNSUCCESSFUL_OUTCOME)){ + err_code= PROTOCOL__PROGRAN_ERR__MSG_NOT_HANDLED; + goto error; + } + + if (messages_callback[message->msg_case][message->msg_dir] == NULL) { + err_code= PROTOCOL__PROGRAN_ERR__MSG_NOT_SUPPORTED; + goto error; + + } + + err_code= ((*messages_callback[message->msg_case-1][message->msg_dir-1])(xid, &message)); + if ( err_code < 0 ){ + goto error; + } + + return message; + +error: + LOG_E(ENB_APP,"errno %d occured\n",err_code); + return err_code; + +} + + + +void * enb_agent_send_message(uint32_t xid, + Protocol__ProgranMessage *msg, + uint32_t * size){ + + void * buffer; + err_code_t err_code = PROTOCOL__PROGRAN_ERR__NO_ERR; + + if (enb_agent_serialize_message(msg, &buffer, size) < 0 ) { + err_code = PROTOCOL__PROGRAN_ERR__MSG_ENCODING; + goto error; + } + + // free the msg --> later keep this in the data struct and just update the values + enb_agent_mac_destroy_stats_reply(msg); + + DevAssert(buffer !=NULL); + + LOG_D(ENB_APP,"Serilized the enb mac stats reply (size %d)\n", size); + + return buffer; + +error : +LOG_E(ENB_APP,"errno %d occured\n",err_code); +return NULL; + +} + + + + + + + + diff --git a/openair2/ENB_APP/enb_agent_mac.c b/openair2/ENB_APP/enb_agent_mac.c new file mode 100644 index 0000000000..0399d53d18 --- /dev/null +++ b/openair2/ENB_APP/enb_agent_mac.c @@ -0,0 +1,552 @@ +/******************************************************************************* + OpenAirInterface + Copyright(c) 1999 - 2014 Eurecom + + OpenAirInterface is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + + OpenAirInterface is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with OpenAirInterface.The full GNU General Public License is + included in this distribution in the file called "COPYING". If not, + see . + + Contact Information + OpenAirInterface Admin: openair_admin@eurecom.fr + OpenAirInterface Tech : openair_tech@eurecom.fr + OpenAirInterface Dev : openair4g-devel@lists.eurecom.fr + + Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. + + *******************************************************************************/ + +/*! \file + * \brief + * \author + * \date 2016 + * \version 0.1 + */ + +#include "enb_agent_mac.h" +#include "enb_agent_common.h" +#include "LAYER2/MAC/extern.h" +#include "LAYER2/RLC/rlc.h" +#include "log.h" + +int enb_agent_mac_reply(uint32_t xid, Protocol__ProgranMessage **msg){ + + void *buffer; + int size; + err_code_t err_code; + // test code + + + // Create and serialize a stats reply message. This would be done by one of the agents + // Let's assume that we want the power headroom, the pending CEs for UEs 1 & 2 and their + // DL CQI reports as well as the noise and interference for cell 1 + report_config_t report_config; + + // We set the flags indicating what kind of stats we need for each UE. Both UEs will have + // the same flags in this example + uint32_t ue_flags = 0; + // Set the power headroom flag + ue_flags |= PROTOCOL__PRP_UE_STATS_TYPE__PRUST_PRH; + // Set the pending CEs flag + ue_flags |= PROTOCOL__PRP_UE_STATS_TYPE__PRUST_MAC_CE_BS; + // Set the DL CQI report flag + ue_flags |= PROTOCOL__PRP_UE_STATS_TYPE__PRUST_DL_CQI; + + // We do the same with the Cell flags + uint32_t c_flags = 0; + // Set the noise and interference flag + c_flags |= PROTOCOL__PRP_CELL_STATS_TYPE__PRCST_NOISE_INTERFERENCE; + + // We create the appropriate configurations + ue_report_type_t ue_configs[2]; + cc_report_type_t cell_configs[1]; + + // Create the config for UE with RNTI 1 + ue_report_type_t ue1_config; + ue1_config.ue_rnti = 1; + ue1_config.ue_report_flags = ue_flags; + + // Do the same for UE with RNTI 2 + ue_report_type_t ue2_config; + ue2_config.ue_rnti = 2; + ue2_config.ue_report_flags = ue_flags; + + // Add them to the UE list + ue_configs[0] = ue1_config; + ue_configs[1] = ue2_config; + + // Do the same for cell with id 1 + cc_report_type_t c1_config; + c1_config.cc_id = 1; + c1_config.cc_report_flags = c_flags; + + // Add them to the cell list + cell_configs[0] = c1_config; + + //Create the full report configuration + report_config.nr_ue = 2; + report_config.nr_cc = 1; + report_config.ue_report_type = ue_configs; + report_config.cc_report_type = cell_configs; + + if (enb_agent_mac_stats_reply(xid, &report_config, msg) < 0 ){ + err_code = PROTOCOL__PROGRAN_ERR__MSG_BUILD; + goto error; + } + + return 0; + + error : + LOG_E(ENB_APP, "errno %d occured\n", err_code); + return err_code; +} + +int enb_agent_mac_stats_reply(uint32_t xid, + const report_config_t *report_config, + Protocol__ProgranMessage **msg) { + Protocol__PrpHeader *header; + int i, j, k; + int cc_id = 0; + int enb_id = 0; + eNB_MAC_INST *eNB = &eNB_mac_inst[enb_id]; + UE_list_t *eNB_UE_list= &eNB->UE_list; + + + if (prp_create_header(xid, PROTOCOL__PRP_TYPE__PRPT_STATS_REPLY, &header) != 0) + goto error; + + Protocol__PrpStatsReply *stats_reply_msg; + stats_reply_msg = malloc(sizeof(Protocol__PrpStatsReply)); + if (stats_reply_msg == NULL) + goto error; + protocol__prp_stats_reply__init(stats_reply_msg); + stats_reply_msg->header = header; + + stats_reply_msg->n_ue_report = report_config->nr_ue; + stats_reply_msg->n_cell_report = report_config->nr_cc; + + Protocol__PrpUeStatsReport **ue_report; + Protocol__PrpCellStatsReport **cell_report; + + + /* Allocate memory for list of UE reports */ + if (report_config->nr_ue > 0) { + ue_report = malloc(sizeof(Protocol__PrpUeStatsReport *) * report_config->nr_ue); + if (ue_report == NULL) + goto error; + for (i = 0; i < report_config->nr_ue; i++) { + ue_report[i] = malloc(sizeof(Protocol__PrpUeStatsReport)); + protocol__prp_ue_stats_report__init(ue_report[i]); + ue_report[i]->rnti = report_config->ue_report_type[i].ue_rnti; + ue_report[i]->has_rnti = 1; + ue_report[i]->flags = report_config->ue_report_type[i].ue_report_flags; + ue_report[i]->has_flags = 1; + /* Check the types of reports that need to be constructed based on flag values */ + + /* Check flag for creation of buffer status report */ + if (report_config->ue_report_type[i].ue_report_flags & PROTOCOL__PRP_UE_STATS_TYPE__PRUST_BSR) { + //TODO: Create a report for each LCG (4 elements). See prp_ue_stats_report of + // progRAN specifications for more details + ue_report[i]->n_bsr = 4; + uint32_t *elem; + elem = (uint32_t *) malloc(sizeof(uint32_t)*ue_report[i]->n_bsr); + if (elem == NULL) + goto error; + for (j = 0; j++; j < ue_report[i]->n_bsr) { + // Set the actual BSR for LCG j of the current UE + // NN: we need to know the cc_id here, consider the first one + elem[j] = eNB_UE_list->UE_template[UE_PCCID(enb_id,i)][i].bsr_info[j]; + } + ue_report[i]->bsr = elem; + } + + /* Check flag for creation of PRH report */ + if (report_config->ue_report_type[i].ue_report_flags & PROTOCOL__PRP_UE_STATS_TYPE__PRUST_PRH) { + // TODO: Fill in the actual power headroom value for the RNTI + ue_report[i]->phr = eNB_UE_list->UE_template[UE_PCCID(enb_id,i)][i].phr_info; + ue_report[i]->has_phr = 1; + } + + /* Check flag for creation of RLC buffer status report */ + if (report_config->ue_report_type[i].ue_report_flags & PROTOCOL__PRP_UE_STATS_TYPE__PRUST_RLC_BS) { + // TODO: Fill in the actual RLC buffer status reports + ue_report[i]->n_rlc_report = 1; // Set this to the number of LCs for this UE + Protocol__PrpRlcBsr ** rlc_reports; + rlc_reports = malloc(sizeof(Protocol__PrpRlcBsr) * ue_report[i]->n_rlc_report); + if (rlc_reports == NULL) + goto error; + + // Fill the buffer status report for each logical channel of the UE + // NN: see LAYER2/openair2_proc.c for rlc status + for (j = 0; j < ue_report[i]->n_rlc_report; j++) { + rlc_reports[j] = malloc(sizeof(Protocol__PrpRlcBsr)); + if (rlc_reports[j] == NULL) + goto error; + protocol__prp_rlc_bsr__init(rlc_reports[j]); + //TODO:Set logical channel id + rlc_reports[j]->lc_id = 1; + rlc_reports[j]->has_lc_id = 1; + //TODO:Set tx queue size in bytes + rlc_reports[j]->tx_queue_size = 10; + rlc_reports[j]->has_tx_queue_size = 1; + //TODO:Set tx queue head of line delay in ms + rlc_reports[j]->tx_queue_hol_delay = 100; + rlc_reports[j]->has_tx_queue_hol_delay = 1; + //TODO:Set retransmission queue size in bytes + rlc_reports[j]->retransmission_queue_size = 10; + rlc_reports[j]->has_retransmission_queue_size = 1; + //TODO:Set retransmission queue head of line delay in ms + rlc_reports[j]->retransmission_queue_hol_delay = 100; + rlc_reports[j]->has_retransmission_queue_hol_delay = 1; + //TODO:Set current size of the pending message in bytes + rlc_reports[j]->status_pdu_size = 100; + rlc_reports[j]->has_status_pdu_size = 1; + } + // Add RLC buffer status reports to the full report + if (ue_report[i]->n_rlc_report > 0) + ue_report[i]->rlc_report = rlc_reports; + } + + /* Check flag for creation of MAC CE buffer status report */ + if (report_config->ue_report_type[i].ue_report_flags & PROTOCOL__PRP_UE_STATS_TYPE__PRUST_MAC_CE_BS) { + // TODO: Fill in the actual MAC CE buffer status report + ue_report[i]->pending_mac_ces = -1; /* Use as bitmap. Set one or more of the + PROTOCOL__PRP_CE_TYPE__PRPCET_ values + found in stats_common.pb-c.h. See + prp_ce_type in progRAN specification */ + ue_report[i]->has_pending_mac_ces = 1; + } + + /* Check flag for creation of DL CQI report */ + if (report_config->ue_report_type[i].ue_report_flags & PROTOCOL__PRP_UE_STATS_TYPE__PRUST_DL_CQI) { + // TODO: Fill in the actual DL CQI report for the UE based on its configuration + Protocol__PrpDlCqiReport * dl_report; + dl_report = malloc(sizeof(Protocol__PrpDlCqiReport)); + if (dl_report == NULL) + goto error; + protocol__prp_dl_cqi_report__init(dl_report); + //TODO:Set the SFN and SF of the last report held in the agent. + dl_report->sfn_sn = eNB->frame*10 + eNB->subframe; + dl_report->has_sfn_sn = 1; + //TODO:Set the number of DL CQI reports for this UE. One for each CC + dl_report->n_csi_report = 1; + //TODO:Create the actual CSI reports. + Protocol__PrpDlCsi **csi_reports; + csi_reports = malloc(sizeof(Protocol__PrpDlCsi *)); + if (csi_reports == NULL) + goto error; + for (j = 0; j < dl_report->n_csi_report; j++) { + csi_reports[j] = malloc(sizeof(Protocol__PrpDlCsi)); + if (csi_reports[j] == NULL) + goto error; + protocol__prp_dl_csi__init(csi_reports[j]); + //TODO: the servCellIndex for this report + csi_reports[j]->serv_cell_index = 0; + csi_reports[j]->has_serv_cell_index = 1; + //TODO: the rank indicator value for this cc + csi_reports[j]->ri = 1; + csi_reports[j]->has_ri = 1; + //TODO: the type of CSI report based on the configuration of the UE + //For this example we use type P10, which only needs a wideband value + //The full set of types can be found in stats_common.pb-c.h and + //in the progRAN specifications + csi_reports[j]->type = PROTOCOL__PRP_CSI_TYPE__PRCSIT_P10; + csi_reports[j]->has_type = 1; + csi_reports[j]->report_case = PROTOCOL__PRP_DL_CSI__REPORT_P10CSI; + Protocol__PrpCsiP10 *csi10; + csi10 = malloc(sizeof(Protocol__PrpCsiP10)); + if (csi10 == NULL) + goto error; + protocol__prp_csi_p10__init(csi10); + //TODO: set the wideband value + // NN: this is also depends on cc_id + csi10->wb_cqi = eNB_UE_list->eNB_UE_stats[UE_PCCID(enb_id,i)][i].dl_cqi; + csi10->has_wb_cqi = 1; + //Add the type of measurements to the csi report in the proper union type + csi_reports[j]->p10csi = csi10; + } + //Add the csi reports to the full DL CQI report + dl_report->csi_report = csi_reports; + //Add the DL CQI report to the stats report + ue_report[i]->dl_cqi_report = dl_report; + } + + /* Check flag for creation of paging buffer status report */ + if (report_config->ue_report_type[i].ue_report_flags & PROTOCOL__PRP_UE_STATS_TYPE__PRUST_PBS) { + //TODO: Fill in the actual paging buffer status report. For this field to be valid, the RNTI + //set in the report must be a P-RNTI + Protocol__PrpPagingBufferReport *paging_report; + paging_report = malloc(sizeof(Protocol__PrpPagingBufferReport)); + if (paging_report == NULL) + goto error; + protocol__prp_paging_buffer_report__init(paging_report); + //Set the number of pending paging messages + paging_report->n_paging_info = 1; + //Provide a report for each pending paging message + Protocol__PrpPagingInfo **p_info; + p_info = malloc(sizeof(Protocol__PrpPagingInfo *)); + if (p_info == NULL) + goto error; + for (j = 0; j < paging_report->n_paging_info; j++) { + p_info[j] = malloc(sizeof(Protocol__PrpPagingInfo)); + if(p_info[j] == NULL) + goto error; + protocol__prp_paging_info__init(p_info[j]); + //TODO: Set paging index. This index is the same that will be used for the scheduling of the + //paging message by the controller + p_info[j]->paging_index = 10; + p_info[j]->has_paging_index = 1; + //TODO:Set the paging message size + p_info[j]->paging_message_size = 100; + p_info[j]->has_paging_message_size = 1; + //TODO: Set the paging subframe + p_info[j]->paging_subframe = 10; + p_info[j]->has_paging_subframe = 1; + //TODO: Set the carrier index for the pending paging message + p_info[j]->carrier_index = 0; + p_info[j]->has_carrier_index = 1; + } + //Add all paging info to the paging buffer rerport + paging_report->paging_info = p_info; + //Add the paging report to the UE report + ue_report[i]->pbr = paging_report; + } + + /* Check flag for creation of UL CQI report */ + if (report_config->ue_report_type[i].ue_report_flags & PROTOCOL__PRP_UE_STATS_TYPE__PRUST_UL_CQI) { + //Fill in the full UL CQI report of the UE + Protocol__PrpUlCqiReport *full_ul_report; + full_ul_report = malloc(sizeof(Protocol__PrpUlCqiReport)); + if(full_ul_report == NULL) + goto error; + protocol__prp_ul_cqi_report__init(full_ul_report); + //TODO:Set the SFN and SF of the generated report + full_ul_report->sfn_sn = 100; + full_ul_report->has_sfn_sn = 1; + //TODO:Set the number of UL measurement reports based on the types of measurements + //configured for this UE and on the servCellIndex + full_ul_report->n_cqi_meas = 1; + Protocol__PrpUlCqi **ul_report; + ul_report = malloc(sizeof(Protocol__PrpUlCqi *) * full_ul_report->n_cqi_meas); + if(ul_report == NULL) + goto error; + //Fill each UL report of the UE for each of the configured report types + for(j = 0; j++; j < full_ul_report->n_cqi_meas) { + ul_report[j] = malloc(sizeof(Protocol__PrpUlCqi)); + if(ul_report[j] == NULL) + goto error; + protocol__prp_ul_cqi__init(ul_report[j]); + //TODO: Set the type of the UL report. As an example set it to SRS UL report + // See enum prp_ul_cqi_type in progRAN specification for more details + ul_report[j]->type = PROTOCOL__PRP_UL_CQI_TYPE__PRUCT_SRS; + ul_report[j]->has_type = 1; + //TODO:Set the number of SINR measurements based on the report type + //See struct prp_ul_cqi in progRAN specification for more details + ul_report[j]->n_sinr = 100; + uint32_t *sinr_meas; + sinr_meas = (uint32_t *) malloc(sizeof(uint32_t) * ul_report[j]->n_sinr); + if (sinr_meas == NULL) + goto error; + //TODO:Set the SINR measurements for the specified type + for (k = 0; k < ul_report[j]->n_sinr; k++) { + sinr_meas[k] = 10; + } + ul_report[j]->sinr = sinr_meas; + //TODO: Set the servCellIndex for this report + ul_report[j]->serv_cell_index = 0; + ul_report[j]->has_serv_cell_index = 1; + //Set the list of UL reports of this UE to the full UL report + full_ul_report->cqi_meas = ul_report; + //Add full UL CQI report to the UE report + ue_report[i]->ul_cqi_report = full_ul_report; + } + } + } + /* Add list of all UE reports to the message */ + stats_reply_msg->ue_report = ue_report; + } + + /* Allocate memory for list of cell reports */ + if (report_config->nr_cc > 0) { + cell_report = malloc(sizeof(Protocol__PrpCellStatsReport *) * report_config->nr_cc); + if (cell_report == NULL) + goto error; + // Fill in the Cell reports + for (i = 0; i < report_config->nr_cc; i++) { + cell_report[i] = malloc(sizeof(Protocol__PrpCellStatsReport)); + if(ue_report[i] == NULL) + goto error; + protocol__prp_cell_stats_report__init(cell_report[i]); + cell_report[i]->carrier_index = report_config->cc_report_type[i].cc_id; + cell_report[i]->has_carrier_index = 1; + cell_report[i]->flags = report_config->cc_report_type[i].cc_report_flags; + cell_report[i]->has_flags = 1; + + /* Check flag for creation of noise and interference report */ + if(report_config->cc_report_type[i].cc_report_flags & PROTOCOL__PRP_CELL_STATS_TYPE__PRCST_NOISE_INTERFERENCE) { + // TODO: Fill in the actual noise and interference report for this cell + Protocol__PrpNoiseInterferenceReport *ni_report; + ni_report = malloc(sizeof(Protocol__PrpNoiseInterferenceReport)); + if(ni_report == NULL) + goto error; + protocol__prp_noise_interference_report__init(ni_report); + // Current frame and subframe number + ni_report->sfn_sf = 0; + ni_report->has_sfn_sf = 1; + // Received interference power in dbm + ni_report->rip = 0; + ni_report->has_rip = 1; + // Thermal noise power in dbm + ni_report->tnp = 0; + ni_report->has_tnp = 1; + cell_report[i]->noise_inter_report = ni_report; + } + } + /* Add list of all cell reports to the message */ + stats_reply_msg->cell_report = cell_report; + } + + *msg = malloc(sizeof(Protocol__ProgranMessage)); + if(*msg == NULL) + goto error; + protocol__progran_message__init(*msg); + (*msg)->msg_case = PROTOCOL__PROGRAN_MESSAGE__MSG_STATS_REPLY_MSG; + (*msg)->msg_dir = PROTOCOL__PROGRAN_DIRECTION__SUCCESSFUL_OUTCOME; + (*msg)->stats_reply_msg = stats_reply_msg; + return 0; + + error: + // TODO: Need to make proper error handling + if (header != NULL) + free(header); + if (stats_reply_msg != NULL) + free(stats_reply_msg); + if(*msg != NULL) + free(*msg); + //LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); + return -1; +} + +int enb_agent_mac_destroy_stats_reply(Protocol__ProgranMessage *msg) { + //TODO: Need to deallocate memory for the stats reply message + if(msg->msg_case != PROTOCOL__PROGRAN_MESSAGE__MSG_STATS_REPLY_MSG) + goto error; + free(msg->stats_reply_msg->header); + int i, j, k; + + Protocol__PrpStatsReply *reply = msg->stats_reply_msg; + Protocol__PrpDlCqiReport *dl_report; + Protocol__PrpUlCqiReport *ul_report; + Protocol__PrpPagingBufferReport *paging_report; + + // Free the memory for the UE reports + for (i = 0; i < reply->n_ue_report; i++) { + free(reply->ue_report[i]->bsr); + for (j = 0; j < reply->ue_report[i]->n_rlc_report; j++) { + free(reply->ue_report[i]->rlc_report[j]); + } + free(reply->ue_report[i]->rlc_report); + // If DL CQI report flag was set + if (reply->ue_report[i]->flags & PROTOCOL__PRP_UE_STATS_TYPE__PRUST_DL_CQI) { + dl_report = reply->ue_report[i]->dl_cqi_report; + // Delete all CSI reports + for (j = 0; j < dl_report->n_csi_report; j++) { + //Must free memory based on the type of report + switch(dl_report->csi_report[j]->report_case) { + case PROTOCOL__PRP_DL_CSI__REPORT_P10CSI: + free(dl_report->csi_report[j]->p10csi); + break; + case PROTOCOL__PRP_DL_CSI__REPORT_P11CSI: + free(dl_report->csi_report[j]->p11csi->wb_cqi); + free(dl_report->csi_report[j]->p11csi); + break; + case PROTOCOL__PRP_DL_CSI__REPORT_P20CSI: + free(dl_report->csi_report[j]->p20csi); + break; + case PROTOCOL__PRP_DL_CSI__REPORT_P21CSI: + free(dl_report->csi_report[j]->p21csi->wb_cqi); + free(dl_report->csi_report[j]->p21csi->sb_cqi); + free(dl_report->csi_report[j]->p21csi); + break; + case PROTOCOL__PRP_DL_CSI__REPORT_A12CSI: + free(dl_report->csi_report[j]->a12csi->wb_cqi); + free(dl_report->csi_report[j]->a12csi->sb_pmi); + free(dl_report->csi_report[j]->a12csi); + break; + case PROTOCOL__PRP_DL_CSI__REPORT_A22CSI: + free(dl_report->csi_report[j]->a22csi->wb_cqi); + free(dl_report->csi_report[j]->a22csi->sb_cqi); + free(dl_report->csi_report[j]->a22csi->sb_list); + free(dl_report->csi_report[j]->a22csi); + break; + case PROTOCOL__PRP_DL_CSI__REPORT_A20CSI: + free(dl_report->csi_report[j]->a20csi->sb_list); + free(dl_report->csi_report[j]->a20csi); + break; + case PROTOCOL__PRP_DL_CSI__REPORT_A30CSI: + free(dl_report->csi_report[j]->a30csi->sb_cqi); + free(dl_report->csi_report[j]->a30csi); + break; + case PROTOCOL__PRP_DL_CSI__REPORT_A31CSI: + free(dl_report->csi_report[j]->a31csi->wb_cqi); + for (k = 0; k < dl_report->csi_report[j]->a31csi->n_sb_cqi; k++) { + free(dl_report->csi_report[j]->a31csi->sb_cqi[k]); + } + free(dl_report->csi_report[j]->a31csi->sb_cqi); + break; + } + + free(dl_report->csi_report[j]); + } + free(dl_report->csi_report); + free(dl_report); + } + // If Paging buffer report flag was set + if (reply->ue_report[i]->flags & PROTOCOL__PRP_UE_STATS_TYPE__PRUST_PBS) { + paging_report = reply->ue_report[i]->pbr; + // Delete all paging buffer reports + for (j = 0; j < paging_report->n_paging_info; j++) { + free(paging_report->paging_info[j]); + } + free(paging_report->paging_info); + free(paging_report); + } + // If UL CQI report flag was set + if (reply->ue_report[i]->flags & PROTOCOL__PRP_UE_STATS_TYPE__PRUST_UL_CQI) { + ul_report = reply->ue_report[i]->ul_cqi_report; + for (j = 0; j < ul_report->n_cqi_meas; j++) { + free(ul_report->cqi_meas[j]->sinr); + free(ul_report->cqi_meas[j]); + } + free(ul_report->cqi_meas); + } + free(reply->ue_report[i]); + } + free(reply->ue_report); + + // Free memory for all Cell reports + for (i = 0; i < reply->n_cell_report; i++) { + free(reply->cell_report[i]->noise_inter_report); + free(reply->cell_report[i]); + } + free(reply->cell_report); + + free(reply); + free(msg); + return 0; + + error: + //LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); + return -1; +} diff --git a/openair2/ENB_APP/enb_agent_mac.h b/openair2/ENB_APP/enb_agent_mac.h new file mode 100644 index 0000000000..6d36bbb6a1 --- /dev/null +++ b/openair2/ENB_APP/enb_agent_mac.h @@ -0,0 +1,77 @@ +/******************************************************************************* + OpenAirInterface + Copyright(c) 1999 - 2014 Eurecom + + OpenAirInterface is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + + OpenAirInterface is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with OpenAirInterface.The full GNU General Public License is + included in this distribution in the file called "COPYING". If not, + see . + + Contact Information + OpenAirInterface Admin: openair_admin@eurecom.fr + OpenAirInterface Tech : openair_tech@eurecom.fr + OpenAirInterface Dev : openair4g-devel@lists.eurecom.fr + + Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. + + *******************************************************************************/ + +/*! \file + * \brief + * \author + * \date 2016 + * \version 0.1 + */ + +#ifndef ENB_AGENT_MAC_H_ +#define ENB_AGENT_MAC_H_ + +#include "header.pb-c.h" +#include "progran.pb-c.h" +#include "stats_messages.pb-c.h" +#include "stats_common.pb-c.h" + + +/* These types will be used to give + instructions for the type of stats reports + we need to create */ +typedef struct { + uint16_t ue_rnti; + uint32_t ue_report_flags; /* Indicates the report elements + required for this UE id. See + ProgRAN specification 1.2.4.2 */ +} ue_report_type_t; + +typedef struct { + uint16_t cc_id; + uint32_t cc_report_flags; /* Indicates the report elements + required for this CC index. See + ProgRAN specification 1.2.4.3 */ +} cc_report_type_t; + +typedef struct { + int nr_ue; + ue_report_type_t *ue_report_type; + int nr_cc; + cc_report_type_t *cc_report_type; +} report_config_t; + + +int enb_agent_mac_reply(uint32_t xid, Protocol__ProgranMessage **msg); + +int enb_agent_mac_stats_reply(uint32_t xid, const report_config_t *report_config, Protocol__ProgranMessage **msg); + +int enb_agent_mac_destroy_stats_reply(Protocol__ProgranMessage *msg); + +#endif diff --git a/openair2/ENB_APP/enb_app.c b/openair2/ENB_APP/enb_app.c index 70fb5ad61f..d63d895711 100644 --- a/openair2/ENB_APP/enb_app.c +++ b/openair2/ENB_APP/enb_app.c @@ -57,6 +57,10 @@ # include "gtpv1u_eNB_task.h" # endif +#if defined(ENB_AGENT_SB_IF) +# include "enb_agent.h" +#endif + extern unsigned char NB_eNB_INST; #endif @@ -310,6 +314,11 @@ void *eNB_app_task(void *args_p) configure_rrc(enb_id, enb_properties_p); } +#if defined (ENB_AGENT_SB_IF) + printf("\n start enb agent\n"); + enb_agent_start(); +#endif + # if defined(ENABLE_USE_MME) /* Try to register each eNB */ registered_enb = 0; diff --git a/targets/SIMU/USER/oaisim.c b/targets/SIMU/USER/oaisim.c index c1d4d64ef6..7d31f476ef 100644 --- a/targets/SIMU/USER/oaisim.c +++ b/targets/SIMU/USER/oaisim.c @@ -90,6 +90,11 @@ uint8_t config_smbv = 0; char smbv_ip[16]; #endif +#if defined(ENB_AGENT_SB_IF) +# include "enb_agent.h" +#endif + + #include "oaisim_functions.h" #include "oaisim.h" @@ -1332,6 +1337,10 @@ main (int argc, char **argv) smbv_write_config_from_frame_parms(smbv_fname, &PHY_vars_eNB_g[0][0]->lte_frame_parms); #endif +#if defined (ENB_AGENT_SB_IF) + enb_agent_start(); +#endif + // add events to future event list: Currently not used //oai_emulation.info.oeh_enabled = 1; if (oai_emulation.info.oeh_enabled == 1) From 915af964f42bf38f9ad0b189148bffcc932ee363 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Tue, 22 Dec 2015 17:04:18 +0200 Subject: [PATCH 037/349] Fixed top-level message field msg_dir to be optional --- openair2/ENB_APP/MESSAGES/V2/progran.proto | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openair2/ENB_APP/MESSAGES/V2/progran.proto b/openair2/ENB_APP/MESSAGES/V2/progran.proto index 363592d6e3..4f989361a9 100644 --- a/openair2/ENB_APP/MESSAGES/V2/progran.proto +++ b/openair2/ENB_APP/MESSAGES/V2/progran.proto @@ -5,7 +5,7 @@ import "stats_messages.proto"; import "header.proto"; message progran_message { - required progran_direction msg_dir = 100; + optional progran_direction msg_dir = 100; oneof msg { prp_hello hello_msg = 1; prp_echo_request echo_request_msg = 2; From d5830ced240aa9599f7278e53f034af22cb566e5 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Tue, 22 Dec 2015 17:06:37 +0200 Subject: [PATCH 038/349] Allow only a single instance of the eNB agent --- targets/SIMU/USER/oaisim.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/targets/SIMU/USER/oaisim.c b/targets/SIMU/USER/oaisim.c index 7d31f476ef..f54742fb8d 100644 --- a/targets/SIMU/USER/oaisim.c +++ b/targets/SIMU/USER/oaisim.c @@ -1337,9 +1337,9 @@ main (int argc, char **argv) smbv_write_config_from_frame_parms(smbv_fname, &PHY_vars_eNB_g[0][0]->lte_frame_parms); #endif -#if defined (ENB_AGENT_SB_IF) + /* #if defined (ENB_AGENT_SB_IF) enb_agent_start(); -#endif + #endif */ // add events to future event list: Currently not used //oai_emulation.info.oeh_enabled = 1; From 4f618d617077cb5acc651193676f583bd0d4e063 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Tue, 22 Dec 2015 17:08:16 +0200 Subject: [PATCH 039/349] Fixed some bugs that would lead to segfaults and modified to support changes in protocol --- openair2/ENB_APP/enb_agent_common.c | 4 +++- openair2/ENB_APP/enb_agent_handler.c | 30 ++++++++++++++++------------ 2 files changed, 20 insertions(+), 14 deletions(-) diff --git a/openair2/ENB_APP/enb_agent_common.c b/openair2/ENB_APP/enb_agent_common.c index d71a5a6acc..132044cf1f 100644 --- a/openair2/ENB_APP/enb_agent_common.c +++ b/openair2/ENB_APP/enb_agent_common.c @@ -64,7 +64,7 @@ int enb_agent_deserialize_message(void *data, int size, Protocol__ProgranMessage *msg = protocol__progran_message__unpack(NULL, size, data); if (*msg == NULL) goto error; - + return 0; error: @@ -118,6 +118,7 @@ int enb_agent_hello(uint32_t xid, Protocol__ProgranMessage **msg) { protocol__progran_message__init(*msg); (*msg)->msg_case = PROTOCOL__PROGRAN_MESSAGE__MSG_HELLO_MSG; (*msg)->msg_dir = PROTOCOL__PROGRAN_DIRECTION__INITIATING_MESSAGE; + (*msg)->has_msg_dir = 1; (*msg)->hello_msg = hello_msg; return 0; @@ -216,6 +217,7 @@ int enb_agent_echo_reply(uint32_t xid, Protocol__ProgranMessage **msg) { protocol__progran_message__init(*msg); (*msg)->msg_case = PROTOCOL__PROGRAN_MESSAGE__MSG_ECHO_REPLY_MSG; (*msg)->msg_dir = PROTOCOL__PROGRAN_DIRECTION__SUCCESSFUL_OUTCOME; + (*msg)->has_msg_dir = 1; (*msg)->echo_reply_msg = echo_reply_msg; return 0; diff --git a/openair2/ENB_APP/enb_agent_handler.c b/openair2/ENB_APP/enb_agent_handler.c index 2b9509f48e..2457ddbfdc 100644 --- a/openair2/ENB_APP/enb_agent_handler.c +++ b/openair2/ENB_APP/enb_agent_handler.c @@ -42,10 +42,11 @@ #include "assertions.h" enb_agent_message_decoded_callback messages_callback[][3] = { - {enb_agent_hello, enb_agent_hello,0}, /*PROTOCOL__PROGRAN_MESSAGE__MSG_HELLO_MSG*/ - {enb_agent_echo_request, enb_agent_echo_reply,0}, /**/ - {0, enb_agent_mac_reply,0}, /*stats*/ - {0,0,0}, + {enb_agent_hello, 0, 0}, /*PROTOCOL__PROGRAN_MESSAGE__MSG_HELLO_MSG*/ + {enb_agent_echo_reply, 0, 0}, /*PROTOCOL__PROGRAN_MESSAGE__MSG_ECHO_REQUEST_MSG*/ + {0, 0, 0}, /*PROTOCOL__PROGRAN_MESSAGE__MSG_ECHO_REPLY_MSG*/ //Must add handler when receiving echo reply + {enb_agent_mac_reply, 0, 0}, /*PROTOCOL__PROGRAN_MESSAGE__MSG_STATS_REQUEST_MSG*/ + {0,0,0}, /*PROTOCOL__PROGRAN_MESSAGE__MSG_STATS_REPLY_MSG*/ }; @@ -61,33 +62,35 @@ Protocol__ProgranMessage* enb_agent_handle_message (uint32_t xid, uint8_t *data, uint32_t size){ - Protocol__ProgranMessage *message; + Protocol__ProgranMessage *decoded_message, *reply_message; err_code_t err_code; DevAssert(data != NULL); - if (enb_agent_deserialize_message(data, size, &message) < 0) { + if (enb_agent_deserialize_message(data, size, &decoded_message) < 0) { err_code= PROTOCOL__PROGRAN_ERR__MSG_DECODING; goto error; } - if ((message->msg_case > sizeof(messages_callback) / (3*sizeof(enb_agent_message_decoded_callback))) || - (message->msg_dir > PROTOCOL__PROGRAN_DIRECTION__UNSUCCESSFUL_OUTCOME)){ + if ((decoded_message->msg_case > sizeof(messages_callback) / (3*sizeof(enb_agent_message_decoded_callback))) || + (decoded_message->msg_dir > PROTOCOL__PROGRAN_DIRECTION__UNSUCCESSFUL_OUTCOME)){ err_code= PROTOCOL__PROGRAN_ERR__MSG_NOT_HANDLED; goto error; } - if (messages_callback[message->msg_case][message->msg_dir] == NULL) { + if (messages_callback[decoded_message->msg_case-1][decoded_message->msg_dir-1] == NULL) { err_code= PROTOCOL__PROGRAN_ERR__MSG_NOT_SUPPORTED; goto error; } - err_code= ((*messages_callback[message->msg_case-1][message->msg_dir-1])(xid, &message)); + err_code= ((*messages_callback[decoded_message->msg_case-1][decoded_message->msg_dir-1])(xid, &reply_message)); if ( err_code < 0 ){ goto error; } - return message; + protocol__progran_message__free_unpacked(decoded_message, NULL); + + return reply_message; error: LOG_E(ENB_APP,"errno %d occured\n",err_code); @@ -110,11 +113,12 @@ void * enb_agent_send_message(uint32_t xid, } // free the msg --> later keep this in the data struct and just update the values - enb_agent_mac_destroy_stats_reply(msg); + //TODO call proper destroy function + // enb_agent_mac_destroy_stats_reply(msg); DevAssert(buffer !=NULL); - LOG_D(ENB_APP,"Serilized the enb mac stats reply (size %d)\n", size); + LOG_D(ENB_APP,"Serilized the enb mac stats reply (size %d)\n", *size); return buffer; From 7241aa6a385d8cae566bbdde99cdd5da1e2c18b1 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Wed, 23 Dec 2015 12:17:52 +0200 Subject: [PATCH 040/349] Added support for parameters in handlers --- openair2/ENB_APP/enb_agent_common.c | 6 +++--- openair2/ENB_APP/enb_agent_common.h | 7 ++++--- openair2/ENB_APP/enb_agent_handler.c | 2 +- openair2/ENB_APP/enb_agent_mac.c | 2 +- openair2/ENB_APP/enb_agent_mac.h | 2 +- 5 files changed, 10 insertions(+), 9 deletions(-) diff --git a/openair2/ENB_APP/enb_agent_common.c b/openair2/ENB_APP/enb_agent_common.c index 132044cf1f..a8ac24144b 100644 --- a/openair2/ENB_APP/enb_agent_common.c +++ b/openair2/ENB_APP/enb_agent_common.c @@ -98,7 +98,7 @@ int prp_create_header(uint32_t xid, Protocol__PrpType type, Protocol__PrpHeader } -int enb_agent_hello(uint32_t xid, Protocol__ProgranMessage **msg) { +int enb_agent_hello(uint32_t xid, const void *params, Protocol__ProgranMessage **msg) { Protocol__PrpHeader *header; if (prp_create_header(xid, PROTOCOL__PRP_TYPE__PRPT_HELLO, &header) != 0) @@ -150,7 +150,7 @@ int enb_agent_destroy_hello_message(Protocol__ProgranMessage *msg) { } -int enb_agent_echo_request(uint32_t xid, Protocol__ProgranMessage **msg) { +int enb_agent_echo_request(uint32_t xid, const void* params, Protocol__ProgranMessage **msg) { Protocol__PrpHeader *header; if (prp_create_header(xid, PROTOCOL__PRP_TYPE__PRPT_ECHO_REQUEST, &header) != 0) goto error; @@ -199,7 +199,7 @@ int enb_agent_destroy_echo_request(Protocol__ProgranMessage *msg) { -int enb_agent_echo_reply(uint32_t xid, Protocol__ProgranMessage **msg) { +int enb_agent_echo_reply(uint32_t xid, const void *params, Protocol__ProgranMessage **msg) { Protocol__PrpHeader *header; if (prp_create_header(xid, PROTOCOL__PRP_TYPE__PRPT_ECHO_REPLY, &header) != 0) goto error; diff --git a/openair2/ENB_APP/enb_agent_common.h b/openair2/ENB_APP/enb_agent_common.h index 3fb0d366ac..5aac604c1e 100644 --- a/openair2/ENB_APP/enb_agent_common.h +++ b/openair2/ENB_APP/enb_agent_common.h @@ -49,6 +49,7 @@ typedef int (*enb_agent_message_decoded_callback)( uint32_t xid, + const void *params, Protocol__ProgranMessage **msg ); @@ -59,13 +60,13 @@ int enb_agent_deserialize_message(void *data, int size, Protocol__ProgranMessage int prp_create_header(uint32_t xid, Protocol__PrpType type, Protocol__PrpHeader **header); -int enb_agent_hello(uint32_t xid, Protocol__ProgranMessage **msg); +int enb_agent_hello(uint32_t xid, const void *params, Protocol__ProgranMessage **msg); int enb_agent_destroy_hello(Protocol__ProgranMessage *msg); -int enb_agent_echo_request(uint32_t xid, Protocol__ProgranMessage **msg); +int enb_agent_echo_request(uint32_t xid, const void *params, Protocol__ProgranMessage **msg); int enb_agent_destroy_echo_request(Protocol__ProgranMessage *msg); -int enb_agent_echo_reply(uint32_t xid, Protocol__ProgranMessage **msg); +int enb_agent_echo_reply(uint32_t xid, const void *params, Protocol__ProgranMessage **msg); int enb_agent_destroy_echo_reply(Protocol__ProgranMessage *msg); diff --git a/openair2/ENB_APP/enb_agent_handler.c b/openair2/ENB_APP/enb_agent_handler.c index 2457ddbfdc..dd39a7315a 100644 --- a/openair2/ENB_APP/enb_agent_handler.c +++ b/openair2/ENB_APP/enb_agent_handler.c @@ -83,7 +83,7 @@ Protocol__ProgranMessage* enb_agent_handle_message (uint32_t xid, } - err_code= ((*messages_callback[decoded_message->msg_case-1][decoded_message->msg_dir-1])(xid, &reply_message)); + err_code= ((*messages_callback[decoded_message->msg_case-1][decoded_message->msg_dir-1])(xid, (void *) decoded_message, &reply_message)); if ( err_code < 0 ){ goto error; } diff --git a/openair2/ENB_APP/enb_agent_mac.c b/openair2/ENB_APP/enb_agent_mac.c index 0399d53d18..4b299ca919 100644 --- a/openair2/ENB_APP/enb_agent_mac.c +++ b/openair2/ENB_APP/enb_agent_mac.c @@ -40,7 +40,7 @@ #include "LAYER2/RLC/rlc.h" #include "log.h" -int enb_agent_mac_reply(uint32_t xid, Protocol__ProgranMessage **msg){ +int enb_agent_mac_reply(uint32_t xid, const void *params, Protocol__ProgranMessage **msg){ void *buffer; int size; diff --git a/openair2/ENB_APP/enb_agent_mac.h b/openair2/ENB_APP/enb_agent_mac.h index 6d36bbb6a1..590570630e 100644 --- a/openair2/ENB_APP/enb_agent_mac.h +++ b/openair2/ENB_APP/enb_agent_mac.h @@ -68,7 +68,7 @@ typedef struct { } report_config_t; -int enb_agent_mac_reply(uint32_t xid, Protocol__ProgranMessage **msg); +int enb_agent_mac_reply(uint32_t xid, const void *params, Protocol__ProgranMessage **msg); int enb_agent_mac_stats_reply(uint32_t xid, const report_config_t *report_config, Protocol__ProgranMessage **msg); From 0bea0aafc44c5fdb413229e4625906d8e00afcdb Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Wed, 23 Dec 2015 15:29:28 +0200 Subject: [PATCH 041/349] Restructured statistics handler to consider the request message parameters --- openair2/ENB_APP/enb_agent_handler.c | 2 +- openair2/ENB_APP/enb_agent_mac.c | 148 ++++++++++++++++++--------- openair2/ENB_APP/enb_agent_mac.h | 2 +- 3 files changed, 104 insertions(+), 48 deletions(-) diff --git a/openair2/ENB_APP/enb_agent_handler.c b/openair2/ENB_APP/enb_agent_handler.c index dd39a7315a..9a37d01fc1 100644 --- a/openair2/ENB_APP/enb_agent_handler.c +++ b/openair2/ENB_APP/enb_agent_handler.c @@ -45,7 +45,7 @@ enb_agent_message_decoded_callback messages_callback[][3] = { {enb_agent_hello, 0, 0}, /*PROTOCOL__PROGRAN_MESSAGE__MSG_HELLO_MSG*/ {enb_agent_echo_reply, 0, 0}, /*PROTOCOL__PROGRAN_MESSAGE__MSG_ECHO_REQUEST_MSG*/ {0, 0, 0}, /*PROTOCOL__PROGRAN_MESSAGE__MSG_ECHO_REPLY_MSG*/ //Must add handler when receiving echo reply - {enb_agent_mac_reply, 0, 0}, /*PROTOCOL__PROGRAN_MESSAGE__MSG_STATS_REQUEST_MSG*/ + {enb_agent_mac_handle_stats, 0, 0}, /*PROTOCOL__PROGRAN_MESSAGE__MSG_STATS_REQUEST_MSG*/ {0,0,0}, /*PROTOCOL__PROGRAN_MESSAGE__MSG_STATS_REPLY_MSG*/ }; diff --git a/openair2/ENB_APP/enb_agent_mac.c b/openair2/ENB_APP/enb_agent_mac.c index 4b299ca919..e1c465105a 100644 --- a/openair2/ENB_APP/enb_agent_mac.c +++ b/openair2/ENB_APP/enb_agent_mac.c @@ -40,71 +40,127 @@ #include "LAYER2/RLC/rlc.h" #include "log.h" -int enb_agent_mac_reply(uint32_t xid, const void *params, Protocol__ProgranMessage **msg){ +int enb_agent_mac_handle_stats(uint32_t xid, const void *params, Protocol__ProgranMessage **msg){ + // TODO: Must deal with sanitization of input + // TODO: Must check if RNTIs and cell ids of the request actually exist + + int i; void *buffer; int size; err_code_t err_code; - // test code + + //TODO: We do not deal with multiple CCs at the moment and eNB id is 0 + int cc_id = 0; + int enb_id = 0; + eNB_MAC_INST *eNB = &eNB_mac_inst[enb_id]; + UE_list_t *eNB_UE_list= &eNB->UE_list; - // Create and serialize a stats reply message. This would be done by one of the agents - // Let's assume that we want the power headroom, the pending CEs for UEs 1 & 2 and their - // DL CQI reports as well as the noise and interference for cell 1 report_config_t report_config; - // We set the flags indicating what kind of stats we need for each UE. Both UEs will have - // the same flags in this example uint32_t ue_flags = 0; - // Set the power headroom flag - ue_flags |= PROTOCOL__PRP_UE_STATS_TYPE__PRUST_PRH; - // Set the pending CEs flag - ue_flags |= PROTOCOL__PRP_UE_STATS_TYPE__PRUST_MAC_CE_BS; - // Set the DL CQI report flag - ue_flags |= PROTOCOL__PRP_UE_STATS_TYPE__PRUST_DL_CQI; - - // We do the same with the Cell flags uint32_t c_flags = 0; - // Set the noise and interference flag - c_flags |= PROTOCOL__PRP_CELL_STATS_TYPE__PRCST_NOISE_INTERFERENCE; - // We create the appropriate configurations - ue_report_type_t ue_configs[2]; - cc_report_type_t cell_configs[1]; + Protocol__ProgranMessage *input = (Protocol__ProgranMessage *)params; - // Create the config for UE with RNTI 1 - ue_report_type_t ue1_config; - ue1_config.ue_rnti = 1; - ue1_config.ue_report_flags = ue_flags; + Protocol__PrpStatsRequest *stats_req = input->stats_request_msg; - // Do the same for UE with RNTI 2 - ue_report_type_t ue2_config; - ue2_config.ue_rnti = 2; - ue2_config.ue_report_flags = ue_flags; - - // Add them to the UE list - ue_configs[0] = ue1_config; - ue_configs[1] = ue2_config; - - // Do the same for cell with id 1 - cc_report_type_t c1_config; - c1_config.cc_id = 1; - c1_config.cc_report_flags = c_flags; - - // Add them to the cell list - cell_configs[0] = c1_config; - - //Create the full report configuration - report_config.nr_ue = 2; - report_config.nr_cc = 1; - report_config.ue_report_type = ue_configs; - report_config.cc_report_type = cell_configs; + // Check the type of request that is made + switch(stats_req->body_case) { + case PROTOCOL__PRP_STATS_REQUEST__BODY_COMPLETE_STATS_REQUEST: ; + Protocol__PrpCompleteStatsRequest *comp_req = stats_req->complete_stats_request; + if (comp_req->report_frequency == PROTOCOL__PRP_STATS_REPORT_FREQ__PRSRF_PERIODICAL) { + //TODO: Must create a periodic report. Implement once the + // timer functionality is supported + return -1; + } else if (comp_req->report_frequency == PROTOCOL__PRP_STATS_REPORT_FREQ__PRSRF_CONTINUOUS) { + //TODO: Must create an event based report mechanism + return -1; + } else if (comp_req->report_frequency == PROTOCOL__PRP_STATS_REPORT_FREQ__PRSRF_OFF) { + //TODO: Must implement to deactivate the event based reporting + } else { //One-off reporting + //Set the proper flags + ue_flags = comp_req->ue_report_flags; + c_flags = comp_req->cell_report_flags; + //Create a list of all eNB RNTIs and cells + + //Set the number of UEs and create list with their RNTIs stats configs + report_config.nr_ue = eNB_UE_list->num_UEs; + report_config.ue_report_type = (ue_report_type_t *) malloc(sizeof(ue_report_type_t) * report_config.nr_ue); + if (report_config.ue_report_type == NULL) { + // TODO: Add appropriate error code + err_code = -100; + goto error; + } + for (i = 0; i < report_config.nr_ue; i++) { + report_config.ue_report_type[i].ue_rnti = eNB_UE_list->eNB_UE_stats[UE_PCCID(enb_id,i)][i].crnti; + report_config.ue_report_type[i].ue_report_flags = ue_flags; + } + //Set the number of CCs and create a list with the cell stats configs + report_config.nr_cc = MAX_NUM_CCs; + report_config.cc_report_type = (cc_report_type_t *) malloc(sizeof(cc_report_type_t) * report_config.nr_cc); + if (report_config.cc_report_type == NULL) { + // TODO: Add appropriate error code + err_code = -100; + goto error; + } + for (i = 0; i < report_config.nr_cc; i++) { + //TODO: Must fill in the proper cell ids + report_config.cc_report_type[i].cc_id = i; + report_config.cc_report_type[i].cc_report_flags = c_flags; + } + } + break; + case PROTOCOL__PRP_STATS_REQUEST__BODY_CELL_STATS_REQUEST:; + Protocol__PrpCellStatsRequest *cell_req = stats_req->cell_stats_request; + // UE report config will be blank + report_config.nr_ue = 0; + report_config.ue_report_type = NULL; + report_config.nr_cc = cell_req->n_cell; + report_config.cc_report_type = (cc_report_type_t *) malloc(sizeof(cc_report_type_t) * report_config.nr_cc); + if (report_config.cc_report_type == NULL) { + // TODO: Add appropriate error code + err_code = -100; + goto error; + } + for (i = 0; i < report_config.nr_cc; i++) { + //TODO: Must fill in the proper cell ids + report_config.cc_report_type[i].cc_id = cell_req->cell[i]; + report_config.cc_report_type[i].cc_report_flags = cell_req->flags; + } + break; + case PROTOCOL__PRP_STATS_REQUEST__BODY_UE_STATS_REQUEST:; + Protocol__PrpUeStatsRequest *ue_req = stats_req->ue_stats_request; + // Cell report config will be blank + report_config.nr_cc = 0; + report_config.cc_report_type = NULL; + report_config.nr_ue = ue_req->n_rnti; + report_config.ue_report_type = (ue_report_type_t *) malloc(sizeof(ue_report_type_t) * report_config.nr_ue); + if (report_config.ue_report_type == NULL) { + // TODO: Add appropriate error code + err_code = -100; + goto error; + } + for (i = 0; i < report_config.nr_ue; i++) { + report_config.ue_report_type[i].ue_rnti = ue_req->rnti[i]; + report_config.ue_report_type[i].ue_report_flags = ue_req->flags; + } + break; + default: + //TODO: Add appropriate error code + err_code = -100; + goto error; + } if (enb_agent_mac_stats_reply(xid, &report_config, msg) < 0 ){ err_code = PROTOCOL__PROGRAN_ERR__MSG_BUILD; goto error; } + free(report_config.ue_report_type); + free(report_config.cc_report_type); + return 0; error : diff --git a/openair2/ENB_APP/enb_agent_mac.h b/openair2/ENB_APP/enb_agent_mac.h index 590570630e..e22253cf27 100644 --- a/openair2/ENB_APP/enb_agent_mac.h +++ b/openair2/ENB_APP/enb_agent_mac.h @@ -68,7 +68,7 @@ typedef struct { } report_config_t; -int enb_agent_mac_reply(uint32_t xid, const void *params, Protocol__ProgranMessage **msg); +int enb_agent_mac_handle_stats(uint32_t xid, const void *params, Protocol__ProgranMessage **msg); int enb_agent_mac_stats_reply(uint32_t xid, const report_config_t *report_config, Protocol__ProgranMessage **msg); From b9cf840a10c6212cd75d0a422a4f1094258ac700 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Mon, 28 Dec 2015 15:25:27 +0200 Subject: [PATCH 042/349] Created callback mechanism for destruction of protocol messages sent by the agent --- openair2/ENB_APP/enb_agent_common.c | 2 +- openair2/ENB_APP/enb_agent_common.h | 4 ++++ openair2/ENB_APP/enb_agent_handler.c | 11 ++++++++++- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/openair2/ENB_APP/enb_agent_common.c b/openair2/ENB_APP/enb_agent_common.c index a8ac24144b..848c10b6fa 100644 --- a/openair2/ENB_APP/enb_agent_common.c +++ b/openair2/ENB_APP/enb_agent_common.c @@ -134,7 +134,7 @@ int enb_agent_hello(uint32_t xid, const void *params, Protocol__ProgranMessage * } -int enb_agent_destroy_hello_message(Protocol__ProgranMessage *msg) { +int enb_agent_destroy_hello(Protocol__ProgranMessage *msg) { if(msg->msg_case != PROTOCOL__PROGRAN_MESSAGE__MSG_HELLO_MSG) goto error; diff --git a/openair2/ENB_APP/enb_agent_common.h b/openair2/ENB_APP/enb_agent_common.h index 5aac604c1e..3bb6596f2e 100644 --- a/openair2/ENB_APP/enb_agent_common.h +++ b/openair2/ENB_APP/enb_agent_common.h @@ -53,6 +53,10 @@ typedef int (*enb_agent_message_decoded_callback)( Protocol__ProgranMessage **msg ); +typedef int (*enb_agent_message_destruction_callback)( + Protocol__ProgranMessage *msg +); + typedef int32_t err_code_t; int enb_agent_serialize_message(Protocol__ProgranMessage *msg, void **buf, int *size); diff --git a/openair2/ENB_APP/enb_agent_handler.c b/openair2/ENB_APP/enb_agent_handler.c index 9a37d01fc1..5049e669e9 100644 --- a/openair2/ENB_APP/enb_agent_handler.c +++ b/openair2/ENB_APP/enb_agent_handler.c @@ -50,6 +50,15 @@ enb_agent_message_decoded_callback messages_callback[][3] = { }; +enb_agent_message_destruction_callback message_destruction_callback[] = { + enb_agent_destroy_hello, + enb_agent_destroy_echo_request, + enb_agent_destroy_echo_reply, + 0, /*No stats request message is created in the agent. No need for a callback*/ + enb_agent_mac_destroy_stats_reply, + +}; + static const char *enb_agent_direction2String[] = { "", /* not_set */ "originating message", /* originating message */ @@ -114,7 +123,7 @@ void * enb_agent_send_message(uint32_t xid, // free the msg --> later keep this in the data struct and just update the values //TODO call proper destroy function - // enb_agent_mac_destroy_stats_reply(msg); + err_code = ((*message_destruction_callback[msg->msg_case-1])(msg)); DevAssert(buffer !=NULL); From e5e58ec2f47a4b0e429e39e5042aadc2cdae785e Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Tue, 29 Dec 2015 15:43:42 +0200 Subject: [PATCH 043/349] Fixed mac stats handler for periodic and continuous stats updates --- openair2/ENB_APP/enb_agent_mac.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/openair2/ENB_APP/enb_agent_mac.c b/openair2/ENB_APP/enb_agent_mac.c index e1c465105a..3c188881fb 100644 --- a/openair2/ENB_APP/enb_agent_mac.c +++ b/openair2/ENB_APP/enb_agent_mac.c @@ -73,12 +73,16 @@ int enb_agent_mac_handle_stats(uint32_t xid, const void *params, Protocol__Progr if (comp_req->report_frequency == PROTOCOL__PRP_STATS_REPORT_FREQ__PRSRF_PERIODICAL) { //TODO: Must create a periodic report. Implement once the // timer functionality is supported - return -1; + *msg = NULL; + return 0; } else if (comp_req->report_frequency == PROTOCOL__PRP_STATS_REPORT_FREQ__PRSRF_CONTINUOUS) { //TODO: Must create an event based report mechanism - return -1; + *msg = NULL; + return 0; } else if (comp_req->report_frequency == PROTOCOL__PRP_STATS_REPORT_FREQ__PRSRF_OFF) { //TODO: Must implement to deactivate the event based reporting + *msg = NULL; + return 0; } else { //One-off reporting //Set the proper flags ue_flags = comp_req->ue_report_flags; From e42dd369679f05bc39f66ffd61c020eb8d52de06 Mon Sep 17 00:00:00 2001 From: Navid Nikaein Date: Fri, 1 Jan 2016 20:05:15 +0100 Subject: [PATCH 044/349] update the itti timer --- common/utils/itti/timer.c | 6 +++++- maketags | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/common/utils/itti/timer.c b/common/utils/itti/timer.c index 40e8791022..864ab16746 100644 --- a/common/utils/itti/timer.c +++ b/common/utils/itti/timer.c @@ -96,6 +96,8 @@ int timer_handle_signal(siginfo_t *info) // LG: To many traces for msc timer: // TMR_DEBUG("Timer with id 0x%lx has expired\n", (long)timer_p->timer); +#if defined(ENABLE_ITTI) + task_id = timer_p->task_id; instance = timer_p->instance; message_p = itti_alloc_new_message(TASK_TIMER, TIMER_HAS_EXPIRED); @@ -104,6 +106,7 @@ int timer_handle_signal(siginfo_t *info) timer_expired_p->timer_id = (long)timer_p->timer; timer_expired_p->arg = timer_p->timer_arg; +#endif /* Timer is a one shot timer, remove it */ if (timer_p->type == TIMER_ONE_SHOT) { @@ -120,13 +123,14 @@ int timer_handle_signal(siginfo_t *info) TMR_DEBUG("Failed to delete timer 0x%lx\n", (long)timer_p->timer); } } - +#ifdefined ENABLE_ITTI /* Notify task of timer expiry */ if (itti_send_msg_to_task(task_id, instance, message_p) < 0) { TMR_DEBUG("Failed to send msg TIMER_HAS_EXPIRED to task %u\n", task_id); free(message_p); return -1; } +#endif return 0; } diff --git a/maketags b/maketags index ec283c8bec..53bc1c12d0 100755 --- a/maketags +++ b/maketags @@ -1,3 +1,3 @@ #!/bin/sh echo "building ctags for openair1 and openair2 ..." -ctags -e -R --exclude=openair1/DOCS/ --exclude=openair2/DOCS/ --exclude=openair2/RRC/CELLULAR/ --exclude=openair2/NAS/DRIVER/CELLULAR/ --exclude=openair2/SIMULATION/ --exclude=targets/DOCS/ --exclude=targets/PROJECTS/ openair1 openair2 targets +ctags -e -R --exclude=openair1/DOCS/ --exclude=openair2/DOCS/ --exclude=openair2/RRC/CELLULAR/ --exclude=openair2/NAS/DRIVER/CELLULAR/ --exclude=openair2/SIMULATION/ --exclude=targets/DOCS/ --exclude=targets/PROJECTS/ openair1 openair2 openair3 targets common From 1f213b0b8e24bcc7498534b965b952173a5e8e3e Mon Sep 17 00:00:00 2001 From: Navid Nikaein Date: Tue, 5 Jan 2016 11:33:40 +0100 Subject: [PATCH 045/349] * add options to enb configuration file for the enb agent * add timer api for the periodic and oneshot operations * create enb agent task --- common/utils/itti/timer.c | 16 +- openair2/COMMON/tasks_def.h | 2 + openair2/ENB_APP/MESSAGES/V2/progran.proto | 2 +- openair2/ENB_APP/enb_agent.c | 247 +++++++++++---- openair2/ENB_APP/enb_agent.h | 13 +- openair2/ENB_APP/enb_agent_common.c | 284 +++++++++++++++++- openair2/ENB_APP/enb_agent_common.h | 165 +++++++++- openair2/ENB_APP/enb_agent_defs.h | 142 +++++++++ openair2/ENB_APP/enb_agent_handler.c | 58 ++-- openair2/ENB_APP/enb_agent_mac.c | 45 ++- openair2/ENB_APP/enb_agent_mac.h | 12 +- openair2/ENB_APP/enb_app.c | 7 +- openair2/ENB_APP/enb_config.c | 43 +++ openair2/ENB_APP/enb_config.h | 3 + openair2/UTIL/LOG/log.c | 8 + openair2/UTIL/LOG/log.h | 1 + .../enb.band7.agent.oaisim.local_no_mme.conf | 153 ++++++++++ 17 files changed, 1059 insertions(+), 142 deletions(-) create mode 100644 openair2/ENB_APP/enb_agent_defs.h create mode 100644 targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.agent.oaisim.local_no_mme.conf diff --git a/common/utils/itti/timer.c b/common/utils/itti/timer.c index 864ab16746..683efd1279 100644 --- a/common/utils/itti/timer.c +++ b/common/utils/itti/timer.c @@ -94,9 +94,8 @@ int timer_handle_signal(siginfo_t *info) timer_p = (struct timer_elm_s *)info->si_ptr; // LG: To many traces for msc timer: - // TMR_DEBUG("Timer with id 0x%lx has expired\n", (long)timer_p->timer); - -#if defined(ENABLE_ITTI) + TMR_DEBUG("Timer with id 0x%lx has expired\n", (long)timer_p->timer); + printf("Timer with id 0x%lx has expired\n", (long)timer_p->timer); task_id = timer_p->task_id; instance = timer_p->instance; @@ -106,7 +105,6 @@ int timer_handle_signal(siginfo_t *info) timer_expired_p->timer_id = (long)timer_p->timer; timer_expired_p->arg = timer_p->timer_arg; -#endif /* Timer is a one shot timer, remove it */ if (timer_p->type == TIMER_ONE_SHOT) { @@ -123,13 +121,16 @@ int timer_handle_signal(siginfo_t *info) TMR_DEBUG("Failed to delete timer 0x%lx\n", (long)timer_p->timer); } } -#ifdefined ENABLE_ITTI + /* Notify task of timer expiry */ if (itti_send_msg_to_task(task_id, instance, message_p) < 0) { TMR_DEBUG("Failed to send msg TIMER_HAS_EXPIRED to task %u\n", task_id); free(message_p); return -1; } + +#if defined(ENB_AGENT_SB_IF) + #endif return 0; @@ -209,6 +210,11 @@ int timer_setup( type == TIMER_PERIODIC ? "periodic" : "single shot", *timer_id, interval_sec, interval_us); + printf("Requesting new %s timer with id 0x%lx that expires within " + "%d sec and %d usec\n", + type == TIMER_PERIODIC ? "periodic" : "single shot", + *timer_id, interval_sec, interval_us); + timer_p->timer = timer; /* Lock the queue and insert the timer at the tail */ diff --git a/openair2/COMMON/tasks_def.h b/openair2/COMMON/tasks_def.h index 5e0f8bd211..6cd74c3aed 100644 --- a/openair2/COMMON/tasks_def.h +++ b/openair2/COMMON/tasks_def.h @@ -63,6 +63,8 @@ TASK_DEF(TASK_X2AP, TASK_PRIORITY_MED, 200) TASK_DEF(TASK_SCTP, TASK_PRIORITY_MED, 200) /// eNB APP task TASK_DEF(TASK_ENB_APP, TASK_PRIORITY_MED, 200) +/// eNB Agent task +TASK_DEF(TASK_ENB_AGENT, TASK_PRIORITY_MED, 200) // UE tasks and sub-tasks: //// Layer 2 and Layer 1 sub-tasks diff --git a/openair2/ENB_APP/MESSAGES/V2/progran.proto b/openair2/ENB_APP/MESSAGES/V2/progran.proto index 4f989361a9..995cd6861b 100644 --- a/openair2/ENB_APP/MESSAGES/V2/progran.proto +++ b/openair2/ENB_APP/MESSAGES/V2/progran.proto @@ -37,7 +37,7 @@ enum progran_err { MSG_NOT_VALIDATED = -8; MSG_OUT_DATED = -9; - + // other erros UNEXPECTED = -100; } diff --git a/openair2/ENB_APP/enb_agent.c b/openair2/ENB_APP/enb_agent.c index c9a00ae9ce..7003a2c638 100644 --- a/openair2/ENB_APP/enb_agent.c +++ b/openair2/ENB_APP/enb_agent.c @@ -27,43 +27,82 @@ *******************************************************************************/ -/*! \file - * \brief - * \author +/*! \file enb_agent.h + * \brief top level enb agent receive thread and itti task + * \author Navid Nikaein and Xenofon Foukas * \date 2016 * \version 0.1 */ - -#include -#include -#include -#include -#include - #include "enb_agent_common.h" -#include "link_manager.h" #include "log.h" #include "enb_agent.h" -typedef uint8_t xid_t; +#include "assertions.h" -// tx and rx shared context -typedef struct { - message_queue_t *tx_mq; - message_queue_t *rx_mq; - xid_t tx_xid; - xid_t rx_xid; -} msg_context_t; -msg_context_t shared_ctxt; -void *send_thread(void *arg); -void *receive_thread(void *arg); +enb_agent_instance_t enb_agent[NUM_MAX_ENB_AGENT]; +msg_context_t shared_ctxt[NUM_MAX_ENB_AGENT]; +/* this could also go into enb_agent struct*/ +enb_agent_info_t enb_agent_info; + +char in_ip[40]; +static uint16_t in_port; + +//void *send_thread(void *args); +void *receive_thread(void *args); pthread_t new_thread(void *(*f)(void *), void *b); +err_code_t enb_agent_timeout(void* args); -void *send_thread(void *arg) { +/* + * enb agent task mainly wakes up the tx thread for periodic and oneshot messages to the controller + * and can interact with other itti tasks +*/ +void *enb_agent_task(void *args){ - msg_context_t *d = arg; + MessageDef *msg_p = NULL; + const char *msg_name = NULL; + instance_t instance; + int result; + + + itti_mark_task_ready(TASK_ENB_AGENT); + + do { + // Wait for a message + itti_receive_msg (TASK_ENB_AGENT, &msg_p); + DevAssert(msg_p != NULL); + msg_name = ITTI_MSG_NAME (msg_p); + instance = ITTI_MSG_INSTANCE (msg_p); + + switch (ITTI_MSG_ID(msg_p)) { + case TERMINATE_MESSAGE: + itti_exit_task (); + break; + + case MESSAGE_TEST: + LOG_I(ENB_AGENT, "Received %s\n", ITTI_MSG_NAME(msg_p)); + break; + + case TIMER_HAS_EXPIRED: + enb_agent_process_timeout(msg_p->ittiMsg.timer_has_expired.timer_id, &msg_p->ittiMsg.timer_has_expired.arg); + break; + + default: + LOG_E(ENB_AGENT, "Received unexpected message %s\n", msg_name); + break; + } + + result = itti_free (ITTI_MSG_ORIGIN_ID(msg_p), msg_p); + AssertFatal (result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result); + } while (1); + + return NULL; +} +/* +void *send_thread(void *args) { + + msg_context_t *d = args; void *data; int size; int priority; @@ -81,10 +120,10 @@ error: printf("receive_thread: there was an error\n"); return NULL; } +*/ +void *receive_thread(void *args) { -void *receive_thread(void *arg) { - - msg_context_t *d = arg; + msg_context_t *d = args; void *data; int size; int priority; @@ -97,10 +136,10 @@ void *receive_thread(void *arg) { err_code = PROTOCOL__PROGRAN_ERR__MSG_DEQUEUING; goto error; } - LOG_D(ENB_APP,"received message with size %d\n", size); + LOG_D(ENB_AGENT,"received message with size %d\n", size); - msg=enb_agent_handle_message(d->rx_xid, data, size); + msg=enb_agent_handle_message(d->mod_id, d->rx_xid, data, size); free(data); @@ -115,7 +154,7 @@ void *receive_thread(void *arg) { err_code = PROTOCOL__PROGRAN_ERR__MSG_ENQUEUING; goto error; } - LOG_D(ENB_APP,"sent message with size %d\n", size); + LOG_D(ENB_AGENT,"sent message with size %d\n", size); } } @@ -123,7 +162,7 @@ void *receive_thread(void *arg) { return NULL; error: - printf("receive_thread: error %d occured\n",err_code); + LOG_E(ENB_AGENT,"receive_thread: error %d occured\n",err_code); return NULL; } @@ -153,50 +192,146 @@ pthread_t new_thread(void *(*f)(void *), void *b) { return t; } -int enb_agent_start(){ +int enb_agent_start(mid_t mod_id, const Enb_properties_array_t* enb_properties){ - socket_link_t *link; - message_queue_t *send_queue; - message_queue_t *receive_queue; - link_manager_t *manager; + // + set_enb_vars(mod_id, RAN_LTE_OAI); + enb_agent[mod_id].mod_id = mod_id; + enb_agent_info.nb_modules+=1; + + /* + * check the configuration + */ + if (enb_properties->properties[mod_id]->enb_agent_ipv4_address != NULL) { + strncpy(in_ip, enb_properties->properties[mod_id]->enb_agent_ipv4_address, sizeof(in_ip) ); + in_ip[sizeof(in_ip) - 1] = 0; // terminate string + } else { + strcpy(in_ip, DEFAULT_ENB_AGENT_IPv4_ADDRESS ); + } + + if (enb_properties->properties[mod_id]->enb_agent_port != 0 ) { + in_port = enb_properties->properties[mod_id]->enb_agent_port; + } else { + in_port = DEFAULT_ENB_AGENT_PORT ; + } + LOG_I(ENB_AGENT,"starting enb agent client for module id %d on ipv4 %s, port %d\n", + enb_agent[mod_id].mod_id, + in_ip, + in_port); - LOG_I(ENB_APP,"starting enb agent client\n"); - - link = new_link_client("127.0.0.1", 2210); - if (link == NULL) goto error; - - send_queue = new_message_queue(); - if (send_queue == NULL) goto error; - receive_queue = new_message_queue(); - if (receive_queue == NULL) goto error; - - manager = create_link_manager(send_queue, receive_queue, link); - if (manager == NULL) goto error; + //#define TEST_TIMER 0 +#if !defined TEST_TIMER + /* + * create a socket + */ + enb_agent[mod_id].link = new_link_client(in_ip, in_port); + if (enb_agent[mod_id].link == NULL) goto error; + + LOG_I(ENB_AGENT,"starting enb agent client for module id %d on ipv4 %s, port %d\n", + enb_agent[mod_id].mod_id, + in_ip, + in_port); + /* + * create a message queue + */ + + enb_agent[mod_id].send_queue = new_message_queue(); + if (enb_agent[mod_id].send_queue == NULL) goto error; + enb_agent[mod_id].receive_queue = new_message_queue(); + if (enb_agent[mod_id].receive_queue == NULL) goto error; + + /* + * create a link manager + */ + + enb_agent[mod_id].manager = create_link_manager(enb_agent[mod_id].send_queue, enb_agent[mod_id].receive_queue, enb_agent[mod_id].link); + if (enb_agent[mod_id].manager == NULL) goto error; memset(&shared_ctxt, 0, sizeof(msg_context_t)); - shared_ctxt.tx_mq = send_queue; - shared_ctxt.rx_mq = receive_queue; + shared_ctxt[mod_id].mod_id = mod_id; + shared_ctxt[mod_id].tx_mq = enb_agent[mod_id].send_queue; + shared_ctxt[mod_id].rx_mq = enb_agent[mod_id].receive_queue; - new_thread(receive_thread, &shared_ctxt); + /* + * start the enb agent rx thread + */ + new_thread(receive_thread, &shared_ctxt[mod_id]); + +#endif + + /* + * initilize a timer + */ + + enb_agent_init_timer(); + + + + /* + * start the enb agent task for tx and interaction with the underlying network function + */ + + if (itti_create_task (TASK_ENB_AGENT, enb_agent_task, NULL) < 0) { + LOG_E(ENB_AGENT, "Create task for eNB Agent failed\n"); + return -1; + } + + +#ifdef TEST_TIMER + long timer_id=0; + enb_agent_timer_args_t timer_args; + memset (&timer_args, 0, sizeof(enb_agent_timer_args_t)); + timer_args.mod_id = mod_id; + timer_args.cc_actions= ENB_AGENT_ACTION_APPLY; + timer_args.cc_report_flags = PROTOCOL__PRP_CELL_STATS_TYPE__PRCST_NOISE_INTERFERENCE; + timer_args.ue_actions = ENB_AGENT_ACTION_SEND; + timer_args.ue_report_flags = PROTOCOL__PRP_UE_STATS_TYPE__PRUST_BSR | PROTOCOL__PRP_UE_STATS_TYPE__PRUST_DL_CQI; + enb_agent_create_timer(1, 0, ENB_AGENT_DEFAULT, mod_id, ENB_AGENT_TIMER_TYPE_PERIODIC, enb_agent_timeout,(void*)&timer_args, &timer_id); +#endif + // new_thread(send_thread, &shared_ctxt); - // while (1) pause(); + //while (1) pause(); - printf("client ends\n"); + LOG_I(ENB_AGENT,"client ends\n"); return 0; error: - printf("there was an error\n"); + LOG_I(ENB_AGENT,"there was an error\n"); return 1; } -int enb_agent_stop(){ - +int enb_agent_stop(mid_t mod_id){ + + int i=0; + enb_agent_destroy_timers(); + for ( i =0; i < enb_agent_info.nb_modules; i++) { + + destroy_link_manager(enb_agent[i].manager); + + destroy_message_queue(enb_agent[i].send_queue); + destroy_message_queue(enb_agent[i].receive_queue); + + close_link(enb_agent[i].link); + } +} + + + +err_code_t enb_agent_timeout(void* args){ + + enb_agent_timer_args_t *timer_args = (enb_agent_timer_args_t *) args; + + LOG_I(ENB_AGENT, "enb_agent %d timeout\n", timer_args->mod_id); + LOG_I(ENB_AGENT, "eNB action %d ENB flags %d \n", timer_args->cc_actions,timer_args->cc_report_flags); + LOG_I(ENB_AGENT, "UE action %d UE flags %d \n", timer_args->ue_actions,timer_args->ue_report_flags); + + return 0; } diff --git a/openair2/ENB_APP/enb_agent.h b/openair2/ENB_APP/enb_agent.h index 89d1d9e0c2..1a53841d45 100644 --- a/openair2/ENB_APP/enb_agent.h +++ b/openair2/ENB_APP/enb_agent.h @@ -28,9 +28,9 @@ *******************************************************************************/ -/*! \file - * \brief - * \author +/*! \file enb_agent.h + * \brief top level enb agent + * \author Navid Nikaein and Xenofon Foukas * \date 2016 * \version 0.1 */ @@ -38,10 +38,13 @@ #ifndef ENB_AGENT_H_ #define ENB_AGENT_H_ +#include "enb_config.h" // for enb properties +#include "enb_agent_common.h" -int enb_agent_start(); +int enb_agent_start(mid_t mod_id, const Enb_properties_array_t* enb_properties); -int enb_agent_stop(); +int enb_agent_stop(mid_t mod_id); +void *enb_agent_task(void *args); #endif diff --git a/openair2/ENB_APP/enb_agent_common.c b/openair2/ENB_APP/enb_agent_common.c index 848c10b6fa..c2653f4c85 100644 --- a/openair2/ENB_APP/enb_agent_common.c +++ b/openair2/ENB_APP/enb_agent_common.c @@ -27,9 +27,9 @@ *******************************************************************************/ -/*! \file - * \brief - * \author +/*! \file enb_agent_common.c + * \brief common primitives for all agents + * \author Navid Nikaein and Xenofon Foukas * \date 2016 * \version 0.1 */ @@ -39,6 +39,12 @@ #include "log.h" +void * enb[NUM_MAX_ENB_AGENT]; +void * enb_ue[NUM_MAX_ENB_AGENT]; +/* + * message primitives + */ + int enb_agent_serialize_message(Protocol__ProgranMessage *msg, void **buf, int *size) { *size = protocol__progran_message__get_packed_size(msg); @@ -52,7 +58,7 @@ int enb_agent_serialize_message(Protocol__ProgranMessage *msg, void **buf, int * return 0; error: - LOG_E(ENB_APP, "an error occured\n"); // change the com + LOG_E(ENB_AGENT, "an error occured\n"); // change the com return -1; } @@ -74,9 +80,7 @@ int enb_agent_deserialize_message(void *data, int size, Protocol__ProgranMessage - - -int prp_create_header(uint32_t xid, Protocol__PrpType type, Protocol__PrpHeader **header) { +int prp_create_header(xid_t xid, Protocol__PrpType type, Protocol__PrpHeader **header) { *header = malloc(sizeof(Protocol__PrpHeader)); if(*header == NULL) @@ -98,7 +102,7 @@ int prp_create_header(uint32_t xid, Protocol__PrpType type, Protocol__PrpHeader } -int enb_agent_hello(uint32_t xid, const void *params, Protocol__ProgranMessage **msg) { +int enb_agent_hello(mid_t mod_id, xid_t xid, const void *params, Protocol__ProgranMessage **msg) { Protocol__PrpHeader *header; if (prp_create_header(xid, PROTOCOL__PRP_TYPE__PRPT_HELLO, &header) != 0) @@ -150,7 +154,7 @@ int enb_agent_destroy_hello(Protocol__ProgranMessage *msg) { } -int enb_agent_echo_request(uint32_t xid, const void* params, Protocol__ProgranMessage **msg) { +int enb_agent_echo_request(mid_t mod_id, xid_t xid, const void* params, Protocol__ProgranMessage **msg) { Protocol__PrpHeader *header; if (prp_create_header(xid, PROTOCOL__PRP_TYPE__PRPT_ECHO_REQUEST, &header) != 0) goto error; @@ -199,7 +203,7 @@ int enb_agent_destroy_echo_request(Protocol__ProgranMessage *msg) { -int enb_agent_echo_reply(uint32_t xid, const void *params, Protocol__ProgranMessage **msg) { +int enb_agent_echo_reply(mid_t mod_id, xid_t xid, const void *params, Protocol__ProgranMessage **msg) { Protocol__PrpHeader *header; if (prp_create_header(xid, PROTOCOL__PRP_TYPE__PRPT_ECHO_REPLY, &header) != 0) goto error; @@ -246,3 +250,263 @@ int enb_agent_destroy_echo_reply(Protocol__ProgranMessage *msg) { LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); return -1; } + +/* + * get generic info from RAN + */ + +void set_enb_vars(mid_t mod_id, ran_name_t ran){ + + switch (ran){ + case RAN_LTE_OAI : + enb[mod_id] = (void *)&eNB_mac_inst[mod_id]; + enb_ue[mod_id] = (void *)&eNB_mac_inst[mod_id].UE_list; + break; + default : + goto error; + } + + return; + + error: + LOG_E(ENB_AGENT, "unknown RAN name %d\n", ran); +} + +int get_current_time_ms (mid_t mod_id, int subframe_flag){ + + if (subframe_flag == 1){ + return ((eNB_MAC_INST *)enb[mod_id])->frame*10 + ((eNB_MAC_INST *)enb[mod_id])->subframe; + }else { + return ((eNB_MAC_INST *)enb[mod_id])->frame*10; + } + +} + +int get_num_ues (mid_t mod_id){ + + return ((UE_list_t *)enb_ue[mod_id])->num_UEs; +} + +int get_ue_crnti (mid_t mod_id, mid_t ue_id){ + + return ((UE_list_t *)enb_ue[mod_id])->eNB_UE_stats[UE_PCCID(mod_id,ue_id)][ue_id].crnti; +} + +int get_ue_bsr (mid_t mod_id, mid_t ue_id, lcid_t lcid) { + + return ((UE_list_t *)enb_ue[mod_id])->UE_template[UE_PCCID(mod_id,ue_id)][ue_id].bsr_info[lcid]; +} + +int get_ue_phr (mid_t mod_id, mid_t ue_id) { + + return ((UE_list_t *)enb_ue[mod_id])->UE_template[UE_PCCID(mod_id,ue_id)][ue_id].phr_info; +} + +int get_ue_wcqi (mid_t mod_id, mid_t ue_id) { + + return ((UE_list_t *)enb_ue[mod_id])->eNB_UE_stats[UE_PCCID(mod_id,ue_id)][ue_id].dl_cqi; +} +/* + * timer primitives + */ + + +//struct enb_agent_map agent_map; + +/* The timer_id might not be the best choice for the comparison */ +int enb_agent_compare_timer(struct enb_agent_timer_element_s *a, struct enb_agent_timer_element_s *b){ + + //if (a->timer_id) return 0; + //if (b->timer_id) return 0; + + if (a->timer_id < b->timer_id) return -1; + if (a->timer_id > b->timer_id) return 1; + + // equal timers + return 0; +} + +RB_GENERATE(enb_agent_map,enb_agent_timer_element_s, entry, enb_agent_compare_timer); + +err_code_t enb_agent_init_timer(void){ + + RB_INIT(&enb_agent_head); + + /* + struct enb_agent_timer_element_s e; + memset(&e, 0, sizeof(enb_agent_timer_element_t)); + RB_INSERT(enb_agent_map, &agent_map, &e); + */ + return PROTOCOL__PROGRAN_ERR__NO_ERR; +} + +err_code_t enb_agent_create_timer(uint32_t interval_sec, + uint32_t interval_usec, + agent_id_t agent_id, + instance_t instance, + uint32_t timer_type, + enb_agent_timer_callback_t cb, + void* timer_args, + long *timer_id){ + + struct enb_agent_timer_element_s e; +//uint32_t timer_id; + int ret=-1; + + if ((interval_sec == 0) && (interval_usec == 0 )) + return TIMER_NULL; + + if (timer_type >= ENB_AGENT_TIMER_TYPE_MAX) + return TIMER_TYPE_INVALIDE; + + if (timer_type == ENB_AGENT_TIMER_TYPE_ONESHOT){ + ret = timer_setup(interval_sec, + interval_usec, + TASK_ENB_AGENT, + instance, + TIMER_ONE_SHOT, + timer_args, + timer_id); + + e.type = TIMER_ONE_SHOT; + } + else if (timer_type == ENB_AGENT_TIMER_TYPE_PERIODIC ){ + ret = timer_setup(interval_sec, + interval_usec, + TASK_ENB_AGENT, + instance, + TIMER_PERIODIC, + timer_args, + timer_id); + + e.type = TIMER_PERIODIC; + } + + if (ret < 0 ) { + return TIMER_SETUP_FAILED; + } + + e.agent_id = agent_id; + e.instance = instance; + e.state = ENB_AGENT_TIMER_STATE_ACTIVE; + e.timer_id = *timer_id; + e.timer_args = timer_args; + e.cb = cb; + + LOG_I(ENB_AGENT,"created a timer with id 0x%lx for agent %d, instance %d \n", + e.timer_id, e.agent_id, e.instance); + + RB_INSERT(enb_agent_map, &enb_agent_head, &e); + + + /* + struct enb_agent_timer_element_s search; + search.timer_id = *timer_id; + printf("search 1: %p (expected %p)\n", RB_FIND(enb_agent_map, &enb_agent_head, &search), &e); + printf("search 1: %p (expected %p)\n", get_timer_entry(e.timer_id), &e); + */ + return 0; +} + +err_code_t enb_agent_destroy_timer(long timer_id){ + + struct enb_agent_timer_element_s *e = get_timer_entry(timer_id); + + if (e != NULL ) { + RB_REMOVE(enb_agent_map, &enb_agent_head, &e); + free(e); + } + + if (timer_remove(timer_id) < 0 ) + goto error; + + return 0; + + error: + LOG_E(ENB_AGENT, "timer can't be removed\n"); + return TIMER_REMOVED_FAILED ; +} + +err_code_t enb_agent_destroy_timers(void){ + + struct enb_agent_timer_element_s *e = NULL; + + RB_FOREACH(e, enb_agent_map, &enb_agent_head) { + RB_REMOVE(enb_agent_map, &enb_agent_head, e); + timer_remove(e->timer_id); + free(e); + } + + return 0; + +} + +struct enb_agent_timer_element_s * get_timer_entry(long timer_id) { + + struct enb_agent_timer_element_s search, *e; + memset(&search, 0, sizeof(struct enb_agent_timer_element_s)); + search.timer_id = timer_id; + + return RB_FIND(enb_agent_map, &enb_agent_head, &search); +} + +/* + int i =0; + RB_FOREACH(e, enb_agent_map, &enb_agent_head) { + printf("%d: %p\n", i, e); i++; + } +*/ + +/* +err_code_t enb_agent_stop_timer(uint32_t timer_id){ + + struct enb_agent_timer_element_s *e=NULL; + + RB_FOREACH(e, enb_agent_map, &enb_agent_head) { + if (e->timer_id == timer_id) + break; + } + + if (e != NULL ) { + e->state = ENB_AGENT_TIMER_STATE_STOPPED; + } + + timer_remove(timer_id); + + return 0; + +} + +// this will change the timer_id +err_code_t enb_agent_restart_timer(uint32_t *timer_id){ + + struct enb_agent_timer_element_s *e=NULL; + + RB_FOREACH(e, enb_agent_map, &enb_agent_head) { + if (e->timer_id == timer_id) + break; + } + + if (e != NULL ) { + e->state = ENB_AGENT_TIMER_STATE_ACTIVE; + } + + ret = timer_setup(e->interval_sec, + e->interval_usec, + e->agent_id, + e->instance, + e->type, + e->timer_args, + &timer_id); + + } + + if (ret < 0 ) { + return PROTOCOL__PROGRAN_ERR__TIMER_SETUP_FAILED; + } + + return 0; + +} + +*/ diff --git a/openair2/ENB_APP/enb_agent_common.h b/openair2/ENB_APP/enb_agent_common.h index 3bb6596f2e..eb3de96145 100644 --- a/openair2/ENB_APP/enb_agent_common.h +++ b/openair2/ENB_APP/enb_agent_common.h @@ -27,9 +27,9 @@ *******************************************************************************/ -/*! \file - * \brief - * \author +/*! \file enb_agent_common.h + * \brief common message primitves and utilities + * \author Navid Nikaein and Xenofon Foukas * \date 2016 * \version 0.1 */ @@ -45,10 +45,20 @@ #include "stats_messages.pb-c.h" #include "stats_common.pb-c.h" +# include "enb_agent_defs.h" + +#include "LAYER2/MAC/extern.h" +#include "LAYER2/RLC/rlc.h" + +# include "tree.h" +# include "intertask_interface.h" +# include "timer.h" + #define PROGRAN_VERSION 0 typedef int (*enb_agent_message_decoded_callback)( - uint32_t xid, + mid_t mod_id, + xid_t xid, const void *params, Protocol__ProgranMessage **msg ); @@ -57,32 +67,163 @@ typedef int (*enb_agent_message_destruction_callback)( Protocol__ProgranMessage *msg ); -typedef int32_t err_code_t; - int enb_agent_serialize_message(Protocol__ProgranMessage *msg, void **buf, int *size); int enb_agent_deserialize_message(void *data, int size, Protocol__ProgranMessage **msg); -int prp_create_header(uint32_t xid, Protocol__PrpType type, Protocol__PrpHeader **header); +int prp_create_header(xid_t xid, Protocol__PrpType type, Protocol__PrpHeader **header); -int enb_agent_hello(uint32_t xid, const void *params, Protocol__ProgranMessage **msg); +int enb_agent_hello(mid_t mod_id, xid_t xid, const void *params, Protocol__ProgranMessage **msg); int enb_agent_destroy_hello(Protocol__ProgranMessage *msg); -int enb_agent_echo_request(uint32_t xid, const void *params, Protocol__ProgranMessage **msg); +int enb_agent_echo_request(mid_t mod_id, xid_t xid, const void *params, Protocol__ProgranMessage **msg); int enb_agent_destroy_echo_request(Protocol__ProgranMessage *msg); -int enb_agent_echo_reply(uint32_t xid, const void *params, Protocol__ProgranMessage **msg); +int enb_agent_echo_reply(mid_t mod_id, xid_t xid, const void *params, Protocol__ProgranMessage **msg); int enb_agent_destroy_echo_reply(Protocol__ProgranMessage *msg); -Protocol__ProgranMessage* enb_agent_handle_message (uint32_t xid, +Protocol__ProgranMessage* enb_agent_handle_message (mid_t mod_id, + xid_t xid, uint8_t *data, uint32_t size); -void * enb_agent_send_message(uint32_t xid, +void * enb_agent_send_message(xid_t xid, Protocol__ProgranMessage *msg, uint32_t * size); + + + + +/**************************** + * get generic info from RAN + ****************************/ + +void set_enb_vars(mid_t mod_id, ran_name_t ran); + +int get_current_time_ms (mid_t mod_id, int subframe_flag); + +int get_num_ues(mid_t mod_id); + +int get_ue_crnti (mid_t mod_id, mid_t ue_id); + +int get_ue_bsr (mid_t mod_id, mid_t ue_id, lcid_t lcid); + +int get_ue_phr (mid_t mod_id, mid_t ue_id); + +int get_ue_wcqi (mid_t mod_id, mid_t ue_id); + + + + + + +/******************* + * timer primitves + *******************/ + +#define TIMER_NULL -1 +#define TIMER_TYPE_INVALIDE -2 +#define TIMER_SETUP_FAILED -3 +#define TIMER_REMOVED_FAILED -4 +#define TIMER_ELEMENT_NOT_FOUND -5 + + +/* Type of the callback executed when the timer expired */ +typedef err_code_t (*enb_agent_timer_callback_t)(void*); + +typedef enum { + /* oneshot timer: */ + ENB_AGENT_TIMER_TYPE_ONESHOT = 0x0, + + /* periodic timer */ + ENB_AGENT_TIMER_TYPE_PERIODIC = 0x1, + + /* Inactive state: initial state for any timer. */ + ENB_AGENT_TIMER_TYPE_EVENT_DRIVEN = 0x2, + + /* Max number of states available */ + ENB_AGENT_TIMER_TYPE_MAX, +} eNB_agent_timer_type_t; + +typedef enum { + /* Inactive state: initial state for any timer. */ + ENB_AGENT_TIMER_STATE_INACTIVE = 0x0, + + /* Inactive state: initial state for any timer. */ + ENB_AGENT_TIMER_STATE_ACTIVE = 0x1, + + /* Inactive state: initial state for any timer. */ + ENB_AGENT_TIMER_STATE_STOPPED = 0x2, + + /* Max number of states available */ + ENB_AGENT_TIMER_STATE_MAX, +} eNB_agent_timer_state_t; + +typedef struct enb_agent_timer_args_s{ + mid_t mod_id; + + agent_action_t cc_actions; + uint32_t cc_report_flags; + + agent_action_t ue_actions; + uint32_t ue_report_flags; + +} enb_agent_timer_args_t; + + + +typedef struct enb_agent_timer_element_s{ + RB_ENTRY(enb_agent_timer_element_s) entry; + + agent_id_t agent_id; + instance_t instance; + + eNB_agent_timer_type_t type; + eNB_agent_timer_state_t state; + + uint32_t interval_sec; + uint32_t interval_usec; + + long timer_id; /* Timer id returned by the timer API*/ + + enb_agent_timer_callback_t cb; + void* timer_args; + +} enb_agent_timer_element_t; + + +err_code_t enb_agent_init_timer(void); + +err_code_t enb_agent_create_timer(uint32_t interval_sec, + uint32_t interval_usec, + agent_id_t agent_id, + instance_t instance, + uint32_t timer_type, + enb_agent_timer_callback_t cb, + void* timer_args, + long *timer_id); + +err_code_t enb_agent_destroy_timers(void); +err_code_t enb_agent_destroy_timer(long timer_id); + +err_code_t enb_agent_stop_timer(long timer_id); + +err_code_t enb_agent_restart_timer(long *timer_id); + +struct enb_agent_timer_element_s * get_timer_entry(long timer_id); + +int enb_agent_compare_timer(struct enb_agent_timer_element_s *a, struct enb_agent_timer_element_s *b); + +err_code_t enb_agent_process_timeout(long timer_id, void* timer_args); + +RB_HEAD(enb_agent_map, enb_agent_timer_element_s) enb_agent_head; + +/* RB_PROTOTYPE is for .h files */ +RB_PROTOTYPE(enb_agent_map, enb_agent_timer_element_s, entry, enb_agent_compare_timer); + + #endif diff --git a/openair2/ENB_APP/enb_agent_defs.h b/openair2/ENB_APP/enb_agent_defs.h new file mode 100644 index 0000000000..416e61a431 --- /dev/null +++ b/openair2/ENB_APP/enb_agent_defs.h @@ -0,0 +1,142 @@ +/******************************************************************************* + OpenAirInterface + Copyright(c) 1999 - 2016 Eurecom + + OpenAirInterface is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + + OpenAirInterface is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with OpenAirInterface.The full GNU General Public License is + included in this distribution in the file called "COPYING". If not, + see . + + Contact Information + OpenAirInterface Admin: openair_admin@eurecom.fr + OpenAirInterface Tech : openair_tech@eurecom.fr + OpenAirInterface Dev : openair4g-devel@lists.eurecom.fr + + Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. + + *******************************************************************************/ + +/*! \file enb_agent_defs.h + * \brief enb agent common definitions + * \author Navid Nikaein and Xenofon Foukas + * \date 2016 + * \version 0.1 + */ +#ifndef ENB_AGENT_DEFS_H_ +#define ENB_AGENT_DEFS_H_ + +#include +#include +#include +#include + +#include "link_manager.h" + +#define NUM_MAX_ENB_AGENT 2 +#define DEFAULT_ENB_AGENT_IPv4_ADDRESS "127.0.0.1" +#define DEFAULT_ENB_AGENT_PORT 2210 + +typedef enum { + + ENB_AGENT_DEFAULT=0, + + ENB_AGENT_PHY=1, + ENB_AGENT_MAC=2, + ENB_AGENT_RLC=3, + ENB_AGENT_PDCP=4, + ENB_AGENT_RRC=5, + ENB_AGENT_S1AP=6, + ENB_AGENT_GTP=7, + ENB_AGENT_X2AP=8, + + ENB_AGENT_MAX=9, + +} agent_id_t; + +typedef enum { + /* no action */ + ENB_AGENT_ACTION_NONE = 0x0, + + /* send action */ + ENB_AGENT_ACTION_SEND = 0x1, + + /* apply action */ + ENB_AGENT_ACTION_APPLY = 0x2, + + /* clear action */ + ENB_AGENT_ACTION_CLEAR = 0x4, + + /* write action */ + ENB_AGENT_ACTION_WRITE = 0x8, + + /* filter action */ + ENB_AGENT_ACTION_FILTER = 0x10, + + /* preprocess action */ + ENB_AGENT_ACTION_PREPROCESS = 0x20, + + /* meter action */ + ENB_AGENT_ACTION_METER = 0x40, + + /* Max number of states available */ + ENB_AGENT_ACTION_MAX = 0x7f, +} agent_action_t; + + +typedef enum { + + RAN_LTE_OAI= 0, + + /* Max number of states available */ + RAN_NAME_MAX = 0x7f, +} ran_name_t; + +typedef uint8_t xid_t; +typedef uint8_t mid_t; // module or enb id +typedef uint8_t lcid_t; +typedef int32_t err_code_t; + +// tx and rx shared context +typedef struct { + mid_t mod_id; + socket_link_t *link; + message_queue_t *send_queue; + message_queue_t *receive_queue; + link_manager_t *manager; +}enb_agent_instance_t; + +typedef struct { + /* general info */ + uint32_t nb_modules; + + + /* stats */ + + uint32_t total_rx_msg; + uint32_t total_tx_msg; + + uint32_t rx_msg[NUM_MAX_ENB_AGENT]; + uint32_t tx_msg[NUM_MAX_ENB_AGENT]; + +}enb_agent_info_t; + +typedef struct { + mid_t mod_id; + message_queue_t *tx_mq; + message_queue_t *rx_mq; + xid_t tx_xid; + xid_t rx_xid; +} msg_context_t; + +#endif diff --git a/openair2/ENB_APP/enb_agent_handler.c b/openair2/ENB_APP/enb_agent_handler.c index 5049e669e9..27536c8b7f 100644 --- a/openair2/ENB_APP/enb_agent_handler.c +++ b/openair2/ENB_APP/enb_agent_handler.c @@ -27,9 +27,9 @@ *******************************************************************************/ -/*! \file - * \brief - * \author +/*! \file enb_agent_handler.c + * \brief enb agent tx and rx message handler + * \author Navid Nikaein and Xenofon Foukas * \date 2016 * \version 0.1 */ @@ -67,7 +67,8 @@ static const char *enb_agent_direction2String[] = { }; -Protocol__ProgranMessage* enb_agent_handle_message (uint32_t xid, +Protocol__ProgranMessage* enb_agent_handle_message (mid_t mod_id, + xid_t xid, uint8_t *data, uint32_t size){ @@ -92,7 +93,7 @@ Protocol__ProgranMessage* enb_agent_handle_message (uint32_t xid, } - err_code= ((*messages_callback[decoded_message->msg_case-1][decoded_message->msg_dir-1])(xid, (void *) decoded_message, &reply_message)); + err_code = ((*messages_callback[decoded_message->msg_case-1][decoded_message->msg_dir-1])(mod_id, xid, (void *) decoded_message, &reply_message)); if ( err_code < 0 ){ goto error; } @@ -102,16 +103,16 @@ Protocol__ProgranMessage* enb_agent_handle_message (uint32_t xid, return reply_message; error: - LOG_E(ENB_APP,"errno %d occured\n",err_code); - return err_code; + LOG_E(ENB_AGENT,"errno %d occured\n",err_code); + return NULL; } -void * enb_agent_send_message(uint32_t xid, - Protocol__ProgranMessage *msg, - uint32_t * size){ +void * enb_agent_send_message(xid_t xid, + Protocol__ProgranMessage *msg, + uint32_t * size){ void * buffer; err_code_t err_code = PROTOCOL__PROGRAN_ERR__NO_ERR; @@ -126,21 +127,32 @@ void * enb_agent_send_message(uint32_t xid, err_code = ((*message_destruction_callback[msg->msg_case-1])(msg)); DevAssert(buffer !=NULL); - - LOG_D(ENB_APP,"Serilized the enb mac stats reply (size %d)\n", *size); - + + LOG_D(ENB_AGENT,"Serilized the enb mac stats reply (size %d)\n", *size); + return buffer; - -error : -LOG_E(ENB_APP,"errno %d occured\n",err_code); -return NULL; + + error : + LOG_E(ENB_AGENT,"errno %d occured\n",err_code); + + return NULL; } +err_code_t enb_agent_process_timeout(long timer_id, void* timer_args){ + + struct enb_agent_timer_element_s *e = get_timer_entry(timer_id); + + LOG_I(ENB_AGENT, "element %p: timer_id is 0x%lx 0x%lx\n", e, timer_id, e->timer_id); + + if (e == NULL ) goto error; + if (timer_args == NULL) + LOG_W(ENB_AGENT,"null timer args\n"); + + return e->cb(timer_args); + - - - - - - + error: + LOG_E(ENB_AGENT, "can't get the timer element\n"); + return TIMER_ELEMENT_NOT_FOUND; +} diff --git a/openair2/ENB_APP/enb_agent_mac.c b/openair2/ENB_APP/enb_agent_mac.c index 3c188881fb..edf1406296 100644 --- a/openair2/ENB_APP/enb_agent_mac.c +++ b/openair2/ENB_APP/enb_agent_mac.c @@ -27,20 +27,18 @@ *******************************************************************************/ -/*! \file - * \brief - * \author +/*! \file enb_agent_mac.c + * \brief enb agent message handler for MAC layer + * \author Navid Nikaein and Xenofon Foukas * \date 2016 * \version 0.1 */ #include "enb_agent_mac.h" -#include "enb_agent_common.h" -#include "LAYER2/MAC/extern.h" -#include "LAYER2/RLC/rlc.h" + #include "log.h" -int enb_agent_mac_handle_stats(uint32_t xid, const void *params, Protocol__ProgranMessage **msg){ +int enb_agent_mac_handle_stats(mid_t mod_id, xid_t xid, const void *params, Protocol__ProgranMessage **msg){ // TODO: Must deal with sanitization of input // TODO: Must check if RNTIs and cell ids of the request actually exist @@ -52,11 +50,11 @@ int enb_agent_mac_handle_stats(uint32_t xid, const void *params, Protocol__Progr //TODO: We do not deal with multiple CCs at the moment and eNB id is 0 int cc_id = 0; - int enb_id = 0; - - eNB_MAC_INST *eNB = &eNB_mac_inst[enb_id]; - UE_list_t *eNB_UE_list= &eNB->UE_list; + int enb_id = mod_id; + //eNB_MAC_INST *eNB = &eNB_mac_inst[enb_id]; + //UE_list_t *eNB_UE_list= &eNB->UE_list; + report_config_t report_config; uint32_t ue_flags = 0; @@ -90,7 +88,7 @@ int enb_agent_mac_handle_stats(uint32_t xid, const void *params, Protocol__Progr //Create a list of all eNB RNTIs and cells //Set the number of UEs and create list with their RNTIs stats configs - report_config.nr_ue = eNB_UE_list->num_UEs; + report_config.nr_ue = get_num_ues(mod_id); //eNB_UE_list->num_UEs report_config.ue_report_type = (ue_report_type_t *) malloc(sizeof(ue_report_type_t) * report_config.nr_ue); if (report_config.ue_report_type == NULL) { // TODO: Add appropriate error code @@ -98,7 +96,7 @@ int enb_agent_mac_handle_stats(uint32_t xid, const void *params, Protocol__Progr goto error; } for (i = 0; i < report_config.nr_ue; i++) { - report_config.ue_report_type[i].ue_rnti = eNB_UE_list->eNB_UE_stats[UE_PCCID(enb_id,i)][i].crnti; + report_config.ue_report_type[i].ue_rnti = get_ue_crnti(enb_id, i); //eNB_UE_list->eNB_UE_stats[UE_PCCID(enb_id,i)][i].crnti; report_config.ue_report_type[i].ue_report_flags = ue_flags; } //Set the number of CCs and create a list with the cell stats configs @@ -157,7 +155,7 @@ int enb_agent_mac_handle_stats(uint32_t xid, const void *params, Protocol__Progr goto error; } - if (enb_agent_mac_stats_reply(xid, &report_config, msg) < 0 ){ + if (enb_agent_mac_stats_reply(enb_id, xid, &report_config, msg) < 0 ){ err_code = PROTOCOL__PROGRAN_ERR__MSG_BUILD; goto error; } @@ -168,19 +166,20 @@ int enb_agent_mac_handle_stats(uint32_t xid, const void *params, Protocol__Progr return 0; error : - LOG_E(ENB_APP, "errno %d occured\n", err_code); + LOG_E(ENB_AGENT, "errno %d occured\n", err_code); return err_code; } -int enb_agent_mac_stats_reply(uint32_t xid, +int enb_agent_mac_stats_reply(mid_t mod_id, + xid_t xid, const report_config_t *report_config, Protocol__ProgranMessage **msg) { Protocol__PrpHeader *header; int i, j, k; int cc_id = 0; - int enb_id = 0; - eNB_MAC_INST *eNB = &eNB_mac_inst[enb_id]; - UE_list_t *eNB_UE_list= &eNB->UE_list; + int enb_id = mod_id; + //eNB_MAC_INST *eNB = &eNB_mac_inst[enb_id]; + //UE_list_t *eNB_UE_list= &eNB->UE_list; if (prp_create_header(xid, PROTOCOL__PRP_TYPE__PRPT_STATS_REPLY, &header) != 0) @@ -226,7 +225,7 @@ int enb_agent_mac_stats_reply(uint32_t xid, for (j = 0; j++; j < ue_report[i]->n_bsr) { // Set the actual BSR for LCG j of the current UE // NN: we need to know the cc_id here, consider the first one - elem[j] = eNB_UE_list->UE_template[UE_PCCID(enb_id,i)][i].bsr_info[j]; + elem[j] = get_ue_bsr (enb_id, i, j); //eNB_UE_list->UE_template[UE_PCCID(enb_id,i)][i].bsr_info[j]; } ue_report[i]->bsr = elem; } @@ -234,7 +233,7 @@ int enb_agent_mac_stats_reply(uint32_t xid, /* Check flag for creation of PRH report */ if (report_config->ue_report_type[i].ue_report_flags & PROTOCOL__PRP_UE_STATS_TYPE__PRUST_PRH) { // TODO: Fill in the actual power headroom value for the RNTI - ue_report[i]->phr = eNB_UE_list->UE_template[UE_PCCID(enb_id,i)][i].phr_info; + ue_report[i]->phr = get_ue_phr (enb_id, i); // eNB_UE_list->UE_template[UE_PCCID(enb_id,i)][i].phr_info; ue_report[i]->has_phr = 1; } @@ -297,7 +296,7 @@ int enb_agent_mac_stats_reply(uint32_t xid, goto error; protocol__prp_dl_cqi_report__init(dl_report); //TODO:Set the SFN and SF of the last report held in the agent. - dl_report->sfn_sn = eNB->frame*10 + eNB->subframe; + dl_report->sfn_sn = get_current_time_ms(enb_id, 1); dl_report->has_sfn_sn = 1; //TODO:Set the number of DL CQI reports for this UE. One for each CC dl_report->n_csi_report = 1; @@ -331,7 +330,7 @@ int enb_agent_mac_stats_reply(uint32_t xid, protocol__prp_csi_p10__init(csi10); //TODO: set the wideband value // NN: this is also depends on cc_id - csi10->wb_cqi = eNB_UE_list->eNB_UE_stats[UE_PCCID(enb_id,i)][i].dl_cqi; + csi10->wb_cqi = get_ue_wcqi (enb_id, i); //eNB_UE_list->eNB_UE_stats[UE_PCCID(enb_id,i)][i].dl_cqi; csi10->has_wb_cqi = 1; //Add the type of measurements to the csi report in the proper union type csi_reports[j]->p10csi = csi10; diff --git a/openair2/ENB_APP/enb_agent_mac.h b/openair2/ENB_APP/enb_agent_mac.h index e22253cf27..6584111825 100644 --- a/openair2/ENB_APP/enb_agent_mac.h +++ b/openair2/ENB_APP/enb_agent_mac.h @@ -27,9 +27,9 @@ *******************************************************************************/ -/*! \file - * \brief - * \author +/*! \file enb_agent_mac.h + * \brief enb agent message handler APIs for MAC layer + * \author Navid Nikaein and Xenofon Foukas * \date 2016 * \version 0.1 */ @@ -42,6 +42,8 @@ #include "stats_messages.pb-c.h" #include "stats_common.pb-c.h" +#include "enb_agent_common.h" + /* These types will be used to give instructions for the type of stats reports @@ -68,9 +70,9 @@ typedef struct { } report_config_t; -int enb_agent_mac_handle_stats(uint32_t xid, const void *params, Protocol__ProgranMessage **msg); +int enb_agent_mac_handle_stats(mid_t mod_id, xid_t xid, const void *params, Protocol__ProgranMessage **msg); -int enb_agent_mac_stats_reply(uint32_t xid, const report_config_t *report_config, Protocol__ProgranMessage **msg); +int enb_agent_mac_stats_reply(mid_t mod_id, xid_t xid, const report_config_t *report_config, Protocol__ProgranMessage **msg); int enb_agent_mac_destroy_stats_reply(Protocol__ProgranMessage *msg); diff --git a/openair2/ENB_APP/enb_app.c b/openair2/ENB_APP/enb_app.c index d63d895711..b20d0912d8 100644 --- a/openair2/ENB_APP/enb_app.c +++ b/openair2/ENB_APP/enb_app.c @@ -315,8 +315,11 @@ void *eNB_app_task(void *args_p) } #if defined (ENB_AGENT_SB_IF) - printf("\n start enb agent\n"); - enb_agent_start(); + + for (enb_id = enb_id_start; (enb_id < enb_id_end) ; enb_id++) { + printf("\n start enb agent %d\n", enb_id); + enb_agent_start(enb_id, enb_properties_p); + } #endif # if defined(ENABLE_USE_MME) diff --git a/openair2/ENB_APP/enb_config.c b/openair2/ENB_APP/enb_config.c index 07e0ffa640..39bd5028d8 100755 --- a/openair2/ENB_APP/enb_config.c +++ b/openair2/ENB_APP/enb_config.c @@ -170,6 +170,11 @@ #define ENB_CONFIG_STRING_ENB_IPV4_ADDR_FOR_S1U "ENB_IPV4_ADDRESS_FOR_S1U" #define ENB_CONFIG_STRING_ENB_PORT_FOR_S1U "ENB_PORT_FOR_S1U" +#define ENB_CONFIG_STRING_NETWORK_CONTROLLER_CONFIG "NETWORK_CONTROLLER" +#define ENB_CONFIG_STRING_ENB_AGENT_INTERFACE_NAME "ENB_AGENT_INTERFACE_NAME" +#define ENB_CONFIG_STRING_ENB_AGENT_IPV4_ADDRESS "ENB_AGENT_IPV4_ADDRESS" +#define ENB_CONFIG_STRING_ENB_AGENT_PORT "ENB_AGENT_PORT" + #define ENB_CONFIG_STRING_ASN1_VERBOSITY "Asn1_verbosity" #define ENB_CONFIG_STRING_ASN1_VERBOSITY_NONE "none" @@ -275,6 +280,14 @@ static void enb_config_display(void) printf( "\tMNC: \t%02"PRIu16":\n",enb_properties.properties[i]->mnc); } +#if defined(ENB_AGENT_SB_IF) + printf( "\nENB AGENT CONFIG : \n\n"); + printf( "\tInterface name: \t%s:\n",enb_properties.properties[i]->enb_agent_interface_name); + printf( "\tInterface IP Address: \t%s:\n",enb_properties.properties[i]->enb_agent_ipv4_address); + printf( "\tInterface PORT: \t%d:\n\n",enb_properties.properties[i]->enb_agent_port); + +#endif + for (j=0; j< enb_properties.properties[i]->nb_cc; j++) { printf( "\teutra band for CC %d: \t%"PRId16":\n",j,enb_properties.properties[i]->eutra_band[j]); printf( "\tdownlink freq for CC %d: \t%"PRIu64":\n",j,enb_properties.properties[i]->downlink_frequency[j]); @@ -571,6 +584,9 @@ const Enb_properties_array_t *enb_config_init(char* lib_config_file_name_pP) char *address = NULL; char *cidr = NULL; char *astring = NULL; + char* enb_agent_interface_name = NULL; + char* enb_agent_ipv4_address = NULL; + libconfig_int enb_agent_port = 0; libconfig_int otg_ue_id = 0; char* otg_app_type = NULL; char* otg_bg_traffic = NULL; @@ -2190,6 +2206,33 @@ const Enb_properties_array_t *enb_config_init(char* lib_config_file_name_pP) } } } + + // Network Controller + subsetting = config_setting_get_member (setting_enb, ENB_CONFIG_STRING_NETWORK_CONTROLLER_CONFIG); + + if (subsetting != NULL) { + if ( ( + config_setting_lookup_string( subsetting, ENB_CONFIG_STRING_ENB_AGENT_INTERFACE_NAME, + (const char **)&enb_agent_interface_name) + && config_setting_lookup_string( subsetting, ENB_CONFIG_STRING_ENB_AGENT_IPV4_ADDRESS, + (const char **)&enb_agent_ipv4_address) + && config_setting_lookup_int(subsetting, ENB_CONFIG_STRING_ENB_AGENT_PORT, + &enb_agent_port) + ) + ) { + enb_properties.properties[enb_properties_index]->enb_agent_interface_name = strdup(enb_agent_interface_name); + cidr = enb_agent_ipv4_address; + address = strtok(cidr, "/"); + enb_properties.properties[enb_properties_index]->enb_agent_ipv4_address = strdup(address); + /* if (address) { + IPV4_STR_ADDR_TO_INT_NWBO (address, enb_properties.properties[enb_properties_index]->enb_agent_ipv4_address, "BAD IP ADDRESS FORMAT FOR eNB Agent !\n" ); + }*/ + + enb_properties.properties[enb_properties_index]->enb_agent_port = enb_agent_port; + + } + } + // OTG _CONFIG setting_otg = config_setting_get_member (setting_enb, ENB_CONF_STRING_OTG_CONFIG); diff --git a/openair2/ENB_APP/enb_config.h b/openair2/ENB_APP/enb_config.h index 113681dafe..7182628de0 100755 --- a/openair2/ENB_APP/enb_config.h +++ b/openair2/ENB_APP/enb_config.h @@ -203,6 +203,9 @@ typedef struct Enb_properties_s { char *enb_interface_name_for_S1_MME; in_addr_t enb_ipv4_address_for_S1_MME; + char *enb_agent_interface_name; + in_addr_t enb_agent_ipv4_address; + tcp_udp_port_t enb_agent_port; // otg config /* Nb of OTG elements */ uint8_t num_otg_elements; diff --git a/openair2/UTIL/LOG/log.c b/openair2/UTIL/LOG/log.c index abbdbc01ab..f8326be820 100755 --- a/openair2/UTIL/LOG/log.c +++ b/openair2/UTIL/LOG/log.c @@ -333,6 +333,14 @@ int logInit (void) g_log->log_component[ENB_APP].filelog = 0; g_log->log_component[ENB_APP].filelog_name = ""; + g_log->log_component[ENB_AGENT].name = "ENB_AGENT"; + g_log->log_component[ENB_AGENT].level = LOG_DEBUG; + g_log->log_component[ENB_AGENT].flag = LOG_MED; + g_log->log_component[ENB_AGENT].interval = 1; + g_log->log_component[ENB_AGENT].fd = 0; + g_log->log_component[ENB_AGENT].filelog = 0; + g_log->log_component[ENB_AGENT].filelog_name = ""; + g_log->log_component[TMR].name = "TMR"; g_log->log_component[TMR].level = LOG_EMERG; g_log->log_component[TMR].flag = LOG_MED; diff --git a/openair2/UTIL/LOG/log.h b/openair2/UTIL/LOG/log.h index c6abbfa001..1eb68f6e44 100755 --- a/openair2/UTIL/LOG/log.h +++ b/openair2/UTIL/LOG/log.h @@ -264,6 +264,7 @@ typedef enum { RAL_ENB, RAL_UE, ENB_APP, + ENB_AGENT, TMR, USIM, LOCALIZE, diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.agent.oaisim.local_no_mme.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.agent.oaisim.local_no_mme.conf new file mode 100644 index 0000000000..045a2855a0 --- /dev/null +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.agent.oaisim.local_no_mme.conf @@ -0,0 +1,153 @@ +Active_eNBs = ( "eNB_Eurecom_LTEBox"); +# Asn1_verbosity, choice in: none, info, annoying +Asn1_verbosity = "none"; + +eNBs = +( + { + ////////// Identification parameters: + eNB_ID = 0xe00; + + cell_type = "CELL_MACRO_ENB"; + + eNB_name = "eNB_Eurecom_LTEBox"; + + // Tracking area code, 0x0000 and 0xfffe are reserved values + tracking_area_code = "1"; + + mobile_country_code = "208"; + + mobile_network_code = "10"; + + ////////// Physical parameters: + + component_carriers = ( + { + frame_type = "FDD"; + tdd_config = 3; + tdd_config_s = 0; + prefix_type = "NORMAL"; + eutra_band = 7; + downlink_frequency = 2680000000L; + uplink_frequency_offset = -120000000; + Nid_cell = 0; + N_RB_DL = 25; + Nid_cell_mbsfn = 0; + nb_antennas_tx = 1; + nb_antennas_rx = 1; + tx_gain = 25; + rx_gain = 20; + prach_root = 0; + prach_config_index = 0; + prach_high_speed = "DISABLE"; + prach_zero_correlation = 1; + prach_freq_offset = 2; + pucch_delta_shift = 1; + pucch_nRB_CQI = 1; + pucch_nCS_AN = 0; + pucch_n1_AN = 32; + pdsch_referenceSignalPower = 0; + pdsch_p_b = 0; + pusch_n_SB = 1; + pusch_enable64QAM = "DISABLE"; + pusch_hoppingMode = "interSubFrame"; + pusch_hoppingOffset = 0; + pusch_groupHoppingEnabled = "ENABLE"; + pusch_groupAssignment = 0; + pusch_sequenceHoppingEnabled = "DISABLE"; + pusch_nDMRS1 = 0; + phich_duration = "NORMAL"; + phich_resource = "ONESIXTH"; + srs_enable = "DISABLE"; + /* srs_BandwidthConfig =; + srs_SubframeConfig =; + srs_ackNackST =; + srs_MaxUpPts =;*/ + + pusch_p0_Nominal = -108; + pusch_alpha = "AL1"; + pucch_p0_Nominal = -108; + msg3_delta_Preamble = 6; + pucch_deltaF_Format1 = "deltaF2"; + pucch_deltaF_Format1b = "deltaF3"; + pucch_deltaF_Format2 = "deltaF0"; + pucch_deltaF_Format2a = "deltaF0"; + pucch_deltaF_Format2b = "deltaF0"; + + rach_numberOfRA_Preambles = 64; + rach_preamblesGroupAConfig = "DISABLE"; + /* + rach_sizeOfRA_PreamblesGroupA = ; + rach_messageSizeGroupA = ; + rach_messagePowerOffsetGroupB = ; + */ + rach_powerRampingStep = 2; + rach_preambleInitialReceivedTargetPower = -100; + rach_preambleTransMax = 10; + rach_raResponseWindowSize = 10; + rach_macContentionResolutionTimer = 48; + rach_maxHARQ_Msg3Tx = 4; + + pcch_default_PagingCycle = 128; + pcch_nB = "oneT"; + bcch_modificationPeriodCoeff = 2; + ue_TimersAndConstants_t300 = 1000; + ue_TimersAndConstants_t301 = 1000; + ue_TimersAndConstants_t310 = 1000; + ue_TimersAndConstants_t311 = 10000; + ue_TimersAndConstants_n310 = 20; + ue_TimersAndConstants_n311 = 1; + } + ); + + ////////// MME parameters: + mme_ip_address = ( { ipv4 = "0.0.0.0"; + ipv6 = "0::0"; + active = "yes"; + preference = "ipv4"; + } + ); + + NETWORK_INTERFACES : + { + ENB_INTERFACE_NAME_FOR_S1_MME = "none"; + ENB_IPV4_ADDRESS_FOR_S1_MME = "0.0.0.0/24"; + + ENB_INTERFACE_NAME_FOR_S1U = "none"; + ENB_IPV4_ADDRESS_FOR_S1U = "0.0.0.0/24"; + ENB_PORT_FOR_S1U = 2153; # Spec 2152 + }; + + NETWORK_CONTROLLER : + { + ENB_AGENT_INTERFACE_NAME = "eth0"; + ENB_AGENT_IPV4_ADDRESS = "127.0.0.1/24"; + ENB_AGENT_PORT = 2210; + }; + + log_config : + { + global_log_level ="trace"; + global_log_verbosity ="medium"; + hw_log_level ="info"; + hw_log_verbosity ="medium"; + phy_log_level ="trace"; + phy_log_verbosity ="medium"; + mac_log_level ="trace"; + mac_log_verbosity ="medium"; + rlc_log_level ="trace"; + rlc_log_verbosity ="medium"; + pdcp_log_level ="trace"; + pdcp_log_verbosity ="medium"; + rrc_log_level ="trace"; + rrc_log_verbosity ="medium"; + gtpu_log_level ="debug"; + gtpu_log_verbosity ="medium"; + udp_log_level ="debug"; + udp_log_verbosity ="medium"; + osa_log_level ="debug"; + osa_log_verbosity ="low"; + }; + + } +); From f7d591f150841ad30d9e4de3a5d68b1f43060fcc Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Tue, 5 Jan 2016 13:57:52 +0200 Subject: [PATCH 046/349] Created task manager support for agent messages in the for of a priority queue --- cmake_targets/CMakeLists.txt | 1 + openair2/ENB_APP/enb_agent_task_manager.c | 303 ++++++++++++++++++++++ openair2/ENB_APP/enb_agent_task_manager.h | 158 +++++++++++ 3 files changed, 462 insertions(+) create mode 100644 openair2/ENB_APP/enb_agent_task_manager.c create mode 100644 openair2/ENB_APP/enb_agent_task_manager.h diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index 6fa30b2b35..0777e1f3a0 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -746,6 +746,7 @@ if (ENB_AGENT_SB_IF) ${OPENAIR2_DIR}/ENB_APP/enb_agent_common.c ${OPENAIR2_DIR}/ENB_APP/enb_agent_mac.c ${OPENAIR2_DIR}/ENB_APP/enb_agent.c + ${OPENAIR2_DIR}/ENB_APP/enb_agent_task_manager.c ) set(ENB_AGENT_LIB ENB_AGENT) #include_directories(${OPENAIR2_DIR}/ENB_APP) diff --git a/openair2/ENB_APP/enb_agent_task_manager.c b/openair2/ENB_APP/enb_agent_task_manager.c new file mode 100644 index 0000000000..0b987f1c22 --- /dev/null +++ b/openair2/ENB_APP/enb_agent_task_manager.c @@ -0,0 +1,303 @@ +/******************************************************************************* + OpenAirInterface + Copyright(c) 1999 - 2015 Eurecom + + OpenAirInterface is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + + OpenAirInterface is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with OpenAirInterface.The full GNU General Public License is + included in this distribution in the file called "COPYING". If not, + see . + + Contact Information + OpenAirInterface Admin: openair_admin@eurecom.fr + OpenAirInterface Tech : openair_tech@eurecom.fr + OpenAirInterface Dev : openair4g-devel@eurecom.fr + + Address : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE + +*******************************************************************************/ +/*! \file enb_agent_task_manager.h + * \brief Implementation of scheduled tasks manager for the enb agent + * \author Xenofon Foukas + * \date January 2016 + * \version 0.1 + * \email: x.foukas@sms.ed.ac.uk + * @ingroup _mac + */ + +#include +#include +#include + +#include "enb_agent_task_manager.h" + + +/* Util macros */ +#define LEFT(x) (2 * (x) + 1) +#define RIGHT(x) (2 * (x) + 2) +#define PARENT(x) ((x - 1) / 2) + +enb_agent_task_t *enb_agent_task_create(Protocol__ProgranMessage *msg, + uint16_t frame_num, uint8_t subframe_num) { + enb_agent_task_t *task = NULL; + task = malloc(sizeof(enb_agent_task_t)); + + if (task == NULL) + goto error; + + task->frame_num = frame_num; + task->subframe_num = subframe_num; + task->task = msg; + + return task; + + error: + return NULL; +} + +void enb_agent_task_destroy(enb_agent_task_t *task) { + if (task == NULL) + return; + + /* TODO: must free the task properly */ + free(task->task); + free(task); +} + +enb_agent_task_queue_t *enb_agent_task_queue_init(size_t capacity, + int (*cmp)(const enb_agent_task_t *t1, const enb_agent_task_t *t2)) { + enb_agent_task_queue_t *queue = NULL; + + queue = malloc(sizeof(enb_agent_task_queue_t)); + if (queue == NULL) + goto error; + + /* If no comparator was given, use the default one */ + if (cmp == NULL) + queue->cmp = _enb_agent_task_queue_cmp; + else + queue->cmp = cmp; + + queue->first_frame = 0; + queue->first_subframe = 0; + + queue->task = malloc(capacity * sizeof(enb_agent_task_t *)); + if (queue->task == NULL) + goto error; + + queue->count = 0; + queue->capacity = capacity; + + queue->mutex = malloc(sizeof(pthread_mutex_t)); + if (queue->mutex == NULL) + goto error; + if (pthread_mutex_init(queue->mutex, NULL)) + goto error; + + return queue; + + error: + if (queue != NULL) { + free(queue->mutex); + free(queue->task); + free(queue); + } + return NULL; +} + +enb_agent_task_queue_t *enb_agent_task_queue_default_init() { + return enb_agent_task_queue_init(DEFAULT_CAPACITY, NULL); +} + +void enb_agent_task_queue_destroy(enb_agent_task_queue_t *queue) { + int i; + + if (queue == NULL) + return; + + for (i = 0; i < queue->count; i++) { + enb_agent_task_destroy(queue->task[i]); + } + free(queue->task); + free(queue->mutex); + free(queue); +} + +int enb_agent_task_queue_put(enb_agent_task_queue_t *queue, enb_agent_task_t *task) { + size_t i; + enb_agent_task_t *tmp = NULL; + int realloc_status, err_code; + + if (pthread_mutex_lock(queue->mutex)) { + /*TODO*/ + err_code = -1; + goto error; + } + + if (queue->count >= queue->capacity) { + /*TODO: need to call realloc heap*/ + realloc_status = _enb_agent_task_queue_realloc_heap(queue); + if (realloc_status != HEAP_OK) { + err_code = realloc_status; + goto error; + } + } + + queue->task[queue->count] = task; + i = queue->count; + queue->count++; + /*Swap elements to maintain heap properties*/ + while(i > 0 && queue->cmp(queue->task[i], queue->task[PARENT(i)]) > 0) { + tmp = queue->task[i]; + queue->task[i] = queue->task[PARENT(i)]; + queue->task[PARENT(i)] = tmp; + i = PARENT(i); + } + + if (pthread_mutex_unlock(queue->mutex)) { + // LOG_E(MAC, "%s:%d:%s: fatal error\n", __FILE__, __LINE__, __FUNCTION__); + exit(1); + } + return 0; + + error: + /*TODO*/ + return err_code; +} + + +int enb_agent_task_queue_get_current_task(enb_agent_task_queue_t *queue, enb_agent_task_t **task) { + int err_code; + + /*TODO*/ + /* Find current frame and subframe number */ + uint16_t curr_frame=1; + uint8_t curr_subframe=1; + + if (pthread_mutex_lock(queue->mutex)) { + /*TODO*/ + err_code = -1; + goto error; + } + + if (queue->count < 1) { + /* Priority Queue is empty */ + err_code = HEAP_EMPTY; + goto error; + } + /* If no task is scheduled for the current subframe, return without any task */ + if(queue->task[0]->frame_num != curr_frame || queue->task[0]->subframe_num != curr_subframe) { + *task = NULL; + return 0; + } + /* Otherwise, the first task should be returned */ + *task = queue->task[0]; + queue->task[0] = queue->task[queue->count-1]; + queue->count--; + /* Restore heap property */ + _enb_agent_task_queue_heapify(queue, 0); + + if (pthread_mutex_unlock(queue->mutex)) { + // LOG_E(MAC, "%s:%d:%s: fatal error\n", __FILE__, __LINE__, __FUNCTION__); + exit(1); + } + return HEAP_OK; + + error: + /*TODO*/ + return err_code; +} + +/*Warning: Internal function. Should not be called as API function. Not thread safe*/ +void _enb_agent_task_queue_heapify(enb_agent_task_queue_t *queue, size_t idx) { + /* left index, right index, largest */ + enb_agent_task_t *tmp = NULL; + size_t l_idx, r_idx, lrg_idx; + + l_idx = LEFT(idx); + r_idx = RIGHT(idx); + + /* Left child exists, compare left child with its parent */ + if (l_idx < queue->count && queue->cmp(queue->task[l_idx], queue->task[idx]) > 0) { + lrg_idx = l_idx; + } else { + lrg_idx = idx; + } + + /* Right child exists, compare right child with the largest element */ + if (r_idx < queue->count && queue->cmp(queue->task[r_idx], queue->task[lrg_idx]) > 0) { + lrg_idx = r_idx; + } + + /* At this point largest element was determined */ + if (lrg_idx != idx) { + /* Swap between the index at the largest element */ + tmp = queue->task[lrg_idx]; + queue->task[lrg_idx] = queue->task[idx]; + queue->task[idx] = tmp; + /* Heapify again */ + _enb_agent_task_queue_heapify(queue, lrg_idx); + } +} + +/*Warning: Internal function. Should not be called as API function. Not thread safe*/ +int _enb_agent_task_queue_realloc_heap(enb_agent_task_queue_t *queue) { + enb_agent_task_t **resized_task_heap; + if (queue->count >= queue->capacity) { + size_t task_size = sizeof(enb_agent_task_t); + + resized_task_heap = realloc(queue->task, (2*queue->capacity) * task_size); + if (resized_task_heap != NULL) { + queue->capacity *= 2; + queue->task = (enb_agent_task_t **) resized_task_heap; + return HEAP_OK; + } else return HEAP_REALLOCERROR; + } + return HEAP_NOREALLOC; +} + +int _enb_agent_task_queue_cmp(const enb_agent_task_t *t1, const enb_agent_task_t *t2) { + if ((t1->frame_num == t2->frame_num) && (t1->subframe_num == t2->subframe_num)) + return 0; + /* TODO: need to get current frame and subframe number */ + uint16_t curr_frame = 0; + uint8_t curr_subframe = 7; + + int f_offset, sf_offset, tmp1, tmp2; + + /*Check if the offsets have the same sign and compare the tasks position frame-wise*/ + tmp1 = t1->frame_num - curr_frame; + tmp2 = t2->frame_num - curr_frame; + if ((tmp1 >= 0) ^ (tmp2 < 0)) { + f_offset = tmp2 - tmp1; + } + else { + f_offset = tmp1 - tmp2; + } + /*Do the same for the subframe*/ + tmp1 = t1->subframe_num - curr_subframe; + tmp2 = t2->subframe_num - curr_subframe; + if ((tmp1 >= 0) ^ (tmp2 < 0)) + sf_offset = tmp2 - tmp1; + else + sf_offset = tmp1 - tmp2; + + /*Subframe position matters only if f_offset is 0. Multiply f_offset by 100 + to be the only comparisson parameter in all other cases */ + return f_offset*100 + sf_offset; +} + + +int main(int argc, char **argv) { + return 0; +} diff --git a/openair2/ENB_APP/enb_agent_task_manager.h b/openair2/ENB_APP/enb_agent_task_manager.h new file mode 100644 index 0000000000..5a3b5eb327 --- /dev/null +++ b/openair2/ENB_APP/enb_agent_task_manager.h @@ -0,0 +1,158 @@ +/******************************************************************************* + OpenAirInterface + Copyright(c) 1999 - 2015 Eurecom + + OpenAirInterface is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + + OpenAirInterface is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with OpenAirInterface.The full GNU General Public License is + included in this distribution in the file called "COPYING". If not, + see . + + Contact Information + OpenAirInterface Admin: openair_admin@eurecom.fr + OpenAirInterface Tech : openair_tech@eurecom.fr + OpenAirInterface Dev : openair4g-devel@eurecom.fr + + Address : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE + +*******************************************************************************/ +/*! \file enb_agent_task_manager.h + * \brief Implementation of scheduled tasks manager for the enb agent + * \author Xenofon Foukas + * \date January 2016 + * \version 0.1 + * \email: x.foukas@sms.ed.ac.uk + * @ingroup _mac + */ + +#ifndef ENB_AGENT_TASK_MANAGER_ +#define ENB_AGENT_TASK_MANAGER_ + +#include +#include + +#include "progran.pb-c.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define DEFAULT_CAPACITY 512 + +/** + * The structure containing the enb agent task to be executed + */ +typedef struct enb_agent_task_s { + /* The frame in which the task needs to be executed */ + uint16_t frame_num; + /* The subframe in which the task needs to be executed */ + uint8_t subframe_num; + /* The task to be executed in the form of a Protocol__ProgranMessage */ + Protocol__ProgranMessage *task; +} enb_agent_task_t; + +/** + * Priority Queue Structure for tasks + */ +typedef struct enb_agent_task_queue_s { + /* The amount of allocated memory for agent tasks in the heap*/ + volatile size_t capacity; + /* The actual size of the tasks heap at a certain time */ + volatile size_t count; + /* The earliest frame that has a pending task */ + volatile uint16_t first_frame; + /* The earliest subframe within the frame that has a pending task */ + volatile uint8_t first_subframe; + /* An array of prioritized tasks stored in a heap */ + enb_agent_task_t **task; + /* A pointer to a comparator function, used to prioritize elements */ + int (*cmp)(const enb_agent_task_t *t1, const enb_agent_task_t *t2); + pthread_mutex_t *mutex; +} enb_agent_task_queue_t; + +typedef enum { + HEAP_OK = 0, + HEAP_EMPTY, + HEAP_FAILED, + HEAP_REALLOCERROR, + HEAP_NOREALLOC, + HEAP_FATAL, +} heapstatus_e; + +/** + * Allocate memory for a task in the queue + */ +enb_agent_task_t *enb_agent_task_create(Protocol__ProgranMessage *msg, + uint16_t frame_num, uint8_t subframe_num); + +/** + * Free memory for a task of the queue + */ +void enb_agent_task_destroy(enb_agent_task_t *task); + +/** + * Allocate initial memory for storing the tasks + */ +enb_agent_task_queue_t *enb_agent_task_queue_init(size_t capacity, + int (*cmp)(const enb_agent_task_t *t1, const enb_agent_task_t *t2)); + +/** + * Allocate initial memory for storing the tasks using default parameters + */ +enb_agent_task_queue_t *enb_agent_task_queue_default_init(); + +/** + * De-allocate memory for the tasks queue + */ +void enb_agent_task_queue_destroy(enb_agent_task_queue_t *queue); + +/** + * Insert task into the queue + */ +int enb_agent_task_queue_put(enb_agent_task_queue_t *queue, enb_agent_task_t *task); + +/** + * Remove the task with the highest priority from the queue + * task becomes NULL if there is no task for the current frame and subframe + */ +int enb_agent_task_queue_get_current_task(enb_agent_task_queue_t *queue, enb_agent_task_t **task); + +/** + * Check if the top priority task is for a specific frame and subframe + */ +int enb_agent_task_queue_has_upcoming_task (enb_agent_task_queue_t *queue, + const uint16_t frame, const uint8_t subframe); + +/** + * Restructure heap after modifications + */ +void _enb_agent_task_queue_heapify(enb_agent_task_queue_t *queue, size_t idx); + +/** + * Reallocate memory once the heap reaches max size + */ +int _enb_agent_task_queue_realloc_heap(enb_agent_task_queue_t *queue); + +/** + * Compare two agent tasks based on frame and subframe + * returns 0 if tasks t1, t2 have the same priority + * return negative value if t1 needs to be executed after t2 + * return positive value if t1 preceeds t2 + */ +int _enb_agent_task_queue_cmp(const enb_agent_task_t *t1, const enb_agent_task_t *t2); + +#ifdef __cplusplus +} +#endif + +#endif /*ENB_AGENT_TASK_MANAGER_*/ From f2f0e68f9db76695d0c91dc109d0f59cfba56c1d Mon Sep 17 00:00:00 2001 From: Navid Nikaein Date: Tue, 5 Jan 2016 19:26:45 +0100 Subject: [PATCH 047/349] Fix the bug in the RB tree, and sanity test for the timer API --- common/utils/collection/tree.h | 231 ++++++++++++++++++++------- common/utils/itti/timer.c | 8 +- openair2/ENB_APP/enb_agent.c | 5 +- openair2/ENB_APP/enb_agent_common.c | 85 +++++----- openair2/ENB_APP/enb_agent_common.h | 9 +- openair2/ENB_APP/enb_agent_handler.c | 10 +- 6 files changed, 232 insertions(+), 116 deletions(-) diff --git a/common/utils/collection/tree.h b/common/utils/collection/tree.h index 8e4e35c408..c9df686fbb 100755 --- a/common/utils/collection/tree.h +++ b/common/utils/collection/tree.h @@ -1,4 +1,8 @@ -/* +/* $NetBSD: tree.h,v 1.8 2004/03/28 19:38:30 provos Exp $ */ +/* $OpenBSD: tree.h,v 1.7 2002/10/17 21:51:54 art Exp $ */ +/* $FreeBSD$ */ + +/*- * Copyright 2002 Niels Provos * All rights reserved. * @@ -26,6 +30,8 @@ #ifndef _SYS_TREE_H_ #define _SYS_TREE_H_ +#include + /* * This file defines data structures for different types of trees: * splay trees and red-black trees. @@ -63,7 +69,7 @@ struct name { \ #define SPLAY_INIT(root) do { \ (root)->sph_root = NULL; \ -} while (0) +} while (/*CONSTCOND*/ 0) #define SPLAY_ENTRY(type) \ struct { \ @@ -81,32 +87,32 @@ struct { \ SPLAY_LEFT((head)->sph_root, field) = SPLAY_RIGHT(tmp, field); \ SPLAY_RIGHT(tmp, field) = (head)->sph_root; \ (head)->sph_root = tmp; \ -} while (0) +} while (/*CONSTCOND*/ 0) #define SPLAY_ROTATE_LEFT(head, tmp, field) do { \ SPLAY_RIGHT((head)->sph_root, field) = SPLAY_LEFT(tmp, field); \ SPLAY_LEFT(tmp, field) = (head)->sph_root; \ (head)->sph_root = tmp; \ -} while (0) +} while (/*CONSTCOND*/ 0) #define SPLAY_LINKLEFT(head, tmp, field) do { \ SPLAY_LEFT(tmp, field) = (head)->sph_root; \ tmp = (head)->sph_root; \ (head)->sph_root = SPLAY_LEFT((head)->sph_root, field); \ -} while (0) +} while (/*CONSTCOND*/ 0) #define SPLAY_LINKRIGHT(head, tmp, field) do { \ SPLAY_RIGHT(tmp, field) = (head)->sph_root; \ tmp = (head)->sph_root; \ (head)->sph_root = SPLAY_RIGHT((head)->sph_root, field); \ -} while (0) +} while (/*CONSTCOND*/ 0) #define SPLAY_ASSEMBLE(head, node, left, right, field) do { \ SPLAY_RIGHT(left, field) = SPLAY_LEFT((head)->sph_root, field); \ SPLAY_LEFT(right, field) = SPLAY_RIGHT((head)->sph_root, field);\ SPLAY_LEFT((head)->sph_root, field) = SPLAY_RIGHT(node, field); \ SPLAY_RIGHT((head)->sph_root, field) = SPLAY_LEFT(node, field); \ -} while (0) +} while (/*CONSTCOND*/ 0) /* Generates prototypes and inline functions */ @@ -207,7 +213,7 @@ name##_SPLAY(struct name *head, struct type *elm) \ SPLAY_LEFT(&__node, field) = SPLAY_RIGHT(&__node, field) = NULL;\ __left = __right = &__node; \ \ - while ((__comp = (cmp)(elm, (head)->sph_root))) { \ + while ((__comp = (cmp)(elm, (head)->sph_root)) != 0) { \ if (__comp < 0) { \ __tmp = SPLAY_LEFT((head)->sph_root, field); \ if (__tmp == NULL) \ @@ -286,7 +292,7 @@ void name##_SPLAY_MINMAX(struct name *head, int __comp) \ (x) != NULL; \ (x) = SPLAY_NEXT(name, head, x)) -/* Macros that define a red-back tree */ +/* Macros that define a red-black tree */ #define RB_HEAD(name, type) \ struct name { \ struct type *rbh_root; /* root of the tree */ \ @@ -297,7 +303,7 @@ struct name { \ #define RB_INIT(root) do { \ (root)->rbh_root = NULL; \ -} while (0) +} while (/*CONSTCOND*/ 0) #define RB_BLACK 0 #define RB_RED 1 @@ -320,24 +326,24 @@ struct { \ RB_PARENT(elm, field) = parent; \ RB_LEFT(elm, field) = RB_RIGHT(elm, field) = NULL; \ RB_COLOR(elm, field) = RB_RED; \ -} while (0) +} while (/*CONSTCOND*/ 0) #define RB_SET_BLACKRED(black, red, field) do { \ RB_COLOR(black, field) = RB_BLACK; \ RB_COLOR(red, field) = RB_RED; \ -} while (0) +} while (/*CONSTCOND*/ 0) #ifndef RB_AUGMENT -#define RB_AUGMENT(x) +#define RB_AUGMENT(x) do {} while (0) #endif #define RB_ROTATE_LEFT(head, elm, tmp, field) do { \ (tmp) = RB_RIGHT(elm, field); \ - if ((RB_RIGHT(elm, field) = RB_LEFT(tmp, field))) { \ + if ((RB_RIGHT(elm, field) = RB_LEFT(tmp, field)) != NULL) { \ RB_PARENT(RB_LEFT(tmp, field), field) = (elm); \ } \ RB_AUGMENT(elm); \ - if ((RB_PARENT(tmp, field) = RB_PARENT(elm, field))) { \ + if ((RB_PARENT(tmp, field) = RB_PARENT(elm, field)) != NULL) { \ if ((elm) == RB_LEFT(RB_PARENT(elm, field), field)) \ RB_LEFT(RB_PARENT(elm, field), field) = (tmp); \ else \ @@ -349,15 +355,15 @@ struct { \ RB_AUGMENT(tmp); \ if ((RB_PARENT(tmp, field))) \ RB_AUGMENT(RB_PARENT(tmp, field)); \ -} while (0) +} while (/*CONSTCOND*/ 0) #define RB_ROTATE_RIGHT(head, elm, tmp, field) do { \ (tmp) = RB_LEFT(elm, field); \ - if ((RB_LEFT(elm, field) = RB_RIGHT(tmp, field))) { \ + if ((RB_LEFT(elm, field) = RB_RIGHT(tmp, field)) != NULL) { \ RB_PARENT(RB_RIGHT(tmp, field), field) = (elm); \ } \ RB_AUGMENT(elm); \ - if ((RB_PARENT(tmp, field) = RB_PARENT(elm, field))) { \ + if ((RB_PARENT(tmp, field) = RB_PARENT(elm, field)) != NULL) { \ if ((elm) == RB_LEFT(RB_PARENT(elm, field), field)) \ RB_LEFT(RB_PARENT(elm, field), field) = (tmp); \ else \ @@ -369,28 +375,66 @@ struct { \ RB_AUGMENT(tmp); \ if ((RB_PARENT(tmp, field))) \ RB_AUGMENT(RB_PARENT(tmp, field)); \ -} while (0) +} while (/*CONSTCOND*/ 0) /* Generates prototypes and inline functions */ -#define RB_PROTOTYPE(name, type, field, cmp) \ -void name##_RB_INSERT_COLOR(struct name *, struct type *); \ -void name##_RB_REMOVE_COLOR(struct name *, struct type *, struct type *);\ -struct type *name##_RB_REMOVE(struct name *, struct type *); \ -struct type *name##_RB_INSERT(struct name *, struct type *); \ -struct type *name##_RB_FIND(struct name *, struct type *); \ -struct type *name##_RB_NEXT(struct type *); \ -struct type *name##_RB_MINMAX(struct name *, int); \ - \ +#define RB_PROTOTYPE(name, type, field, cmp) \ + RB_PROTOTYPE_INTERNAL(name, type, field, cmp,) +#define RB_PROTOTYPE_STATIC(name, type, field, cmp) \ + RB_PROTOTYPE_INTERNAL(name, type, field, cmp, __unused static) +#define RB_PROTOTYPE_INTERNAL(name, type, field, cmp, attr) \ + RB_PROTOTYPE_INSERT_COLOR(name, type, attr); \ + RB_PROTOTYPE_REMOVE_COLOR(name, type, attr); \ + RB_PROTOTYPE_INSERT(name, type, attr); \ + RB_PROTOTYPE_REMOVE(name, type, attr); \ + RB_PROTOTYPE_FIND(name, type, attr); \ + RB_PROTOTYPE_NFIND(name, type, attr); \ + RB_PROTOTYPE_NEXT(name, type, attr); \ + RB_PROTOTYPE_PREV(name, type, attr); \ + RB_PROTOTYPE_MINMAX(name, type, attr); +#define RB_PROTOTYPE_INSERT_COLOR(name, type, attr) \ + attr void name##_RB_INSERT_COLOR(struct name *, struct type *) +#define RB_PROTOTYPE_REMOVE_COLOR(name, type, attr) \ + attr void name##_RB_REMOVE_COLOR(struct name *, struct type *, struct type *) +#define RB_PROTOTYPE_REMOVE(name, type, attr) \ + attr struct type *name##_RB_REMOVE(struct name *, struct type *) +#define RB_PROTOTYPE_INSERT(name, type, attr) \ + attr struct type *name##_RB_INSERT(struct name *, struct type *) +#define RB_PROTOTYPE_FIND(name, type, attr) \ + attr struct type *name##_RB_FIND(struct name *, struct type *) +#define RB_PROTOTYPE_NFIND(name, type, attr) \ + attr struct type *name##_RB_NFIND(struct name *, struct type *) +#define RB_PROTOTYPE_NEXT(name, type, attr) \ + attr struct type *name##_RB_NEXT(struct type *) +#define RB_PROTOTYPE_PREV(name, type, attr) \ + attr struct type *name##_RB_PREV(struct type *) +#define RB_PROTOTYPE_MINMAX(name, type, attr) \ + attr struct type *name##_RB_MINMAX(struct name *, int) /* Main rb operation. * Moves node close to the key of elm to top */ -#define RB_GENERATE(name, type, field, cmp) \ -void \ +#define RB_GENERATE(name, type, field, cmp) \ + RB_GENERATE_INTERNAL(name, type, field, cmp,) +#define RB_GENERATE_STATIC(name, type, field, cmp) \ + RB_GENERATE_INTERNAL(name, type, field, cmp, __unused static) +#define RB_GENERATE_INTERNAL(name, type, field, cmp, attr) \ + RB_GENERATE_INSERT_COLOR(name, type, field, attr) \ + RB_GENERATE_REMOVE_COLOR(name, type, field, attr) \ + RB_GENERATE_INSERT(name, type, field, cmp, attr) \ + RB_GENERATE_REMOVE(name, type, field, attr) \ + RB_GENERATE_FIND(name, type, field, cmp, attr) \ + RB_GENERATE_NFIND(name, type, field, cmp, attr) \ + RB_GENERATE_NEXT(name, type, field, attr) \ + RB_GENERATE_PREV(name, type, field, attr) \ + RB_GENERATE_MINMAX(name, type, field, attr) + +#define RB_GENERATE_INSERT_COLOR(name, type, field, attr) \ +attr void \ name##_RB_INSERT_COLOR(struct name *head, struct type *elm) \ { \ struct type *parent, *gparent, *tmp; \ - while ((parent = RB_PARENT(elm, field)) && \ + while ((parent = RB_PARENT(elm, field)) != NULL && \ RB_COLOR(parent, field) == RB_RED) { \ gparent = RB_PARENT(parent, field); \ if (parent == RB_LEFT(gparent, field)) { \ @@ -428,9 +472,10 @@ name##_RB_INSERT_COLOR(struct name *head, struct type *elm) \ } \ } \ RB_COLOR(head->rbh_root, field) = RB_BLACK; \ -} \ - \ -void \ +} + +#define RB_GENERATE_REMOVE_COLOR(name, type, field, attr) \ +attr void \ name##_RB_REMOVE_COLOR(struct name *head, struct type *parent, struct type *elm) \ { \ struct type *tmp; \ @@ -454,7 +499,8 @@ name##_RB_REMOVE_COLOR(struct name *head, struct type *parent, struct type *elm) if (RB_RIGHT(tmp, field) == NULL || \ RB_COLOR(RB_RIGHT(tmp, field), field) == RB_BLACK) {\ struct type *oleft; \ - if ((oleft = RB_LEFT(tmp, field)))\ + if ((oleft = RB_LEFT(tmp, field)) \ + != NULL) \ RB_COLOR(oleft, field) = RB_BLACK;\ RB_COLOR(tmp, field) = RB_RED; \ RB_ROTATE_RIGHT(head, tmp, oleft, field);\ @@ -486,7 +532,8 @@ name##_RB_REMOVE_COLOR(struct name *head, struct type *parent, struct type *elm) if (RB_LEFT(tmp, field) == NULL || \ RB_COLOR(RB_LEFT(tmp, field), field) == RB_BLACK) {\ struct type *oright; \ - if ((oright = RB_RIGHT(tmp, field)))\ + if ((oright = RB_RIGHT(tmp, field)) \ + != NULL) \ RB_COLOR(oright, field) = RB_BLACK;\ RB_COLOR(tmp, field) = RB_RED; \ RB_ROTATE_LEFT(head, tmp, oright, field);\ @@ -504,9 +551,10 @@ name##_RB_REMOVE_COLOR(struct name *head, struct type *parent, struct type *elm) } \ if (elm) \ RB_COLOR(elm, field) = RB_BLACK; \ -} \ - \ -struct type * \ +} + +#define RB_GENERATE_REMOVE(name, type, field, attr) \ +attr struct type * \ name##_RB_REMOVE(struct name *head, struct type *elm) \ { \ struct type *child, *parent, *old = elm; \ @@ -518,7 +566,7 @@ name##_RB_REMOVE(struct name *head, struct type *elm) \ else { \ struct type *left; \ elm = RB_RIGHT(elm, field); \ - while ((left = RB_LEFT(elm, field))) \ + while ((left = RB_LEFT(elm, field)) != NULL) \ elm = left; \ child = RB_RIGHT(elm, field); \ parent = RB_PARENT(elm, field); \ @@ -551,7 +599,7 @@ name##_RB_REMOVE(struct name *head, struct type *elm) \ left = parent; \ do { \ RB_AUGMENT(left); \ - } while ((left = RB_PARENT(left, field))); \ + } while ((left = RB_PARENT(left, field)) != NULL); \ } \ goto color; \ } \ @@ -572,9 +620,10 @@ color: \ name##_RB_REMOVE_COLOR(head, parent, child); \ return (old); \ } \ - \ + +#define RB_GENERATE_INSERT(name, type, field, cmp, attr) \ /* Inserts a node into the RB tree */ \ -struct type * \ +attr struct type * \ name##_RB_INSERT(struct name *head, struct type *elm) \ { \ struct type *tmp; \ @@ -599,15 +648,14 @@ name##_RB_INSERT(struct name *head, struct type *elm) \ RB_RIGHT(parent, field) = elm; \ RB_AUGMENT(parent); \ } else \ - { \ RB_ROOT(head) = elm; \ - } \ name##_RB_INSERT_COLOR(head, elm); \ return (NULL); \ -} \ - \ +} + +#define RB_GENERATE_FIND(name, type, field, cmp, attr) \ /* Finds the node with the same key as elm */ \ -struct type * \ +attr struct type * \ name##_RB_FIND(struct name *head, struct type *elm) \ { \ struct type *tmp = RB_ROOT(head); \ @@ -622,9 +670,33 @@ name##_RB_FIND(struct name *head, struct type *elm) \ return (tmp); \ } \ return (NULL); \ -} \ - \ -struct type * \ +} + +#define RB_GENERATE_NFIND(name, type, field, cmp, attr) \ +/* Finds the first node greater than or equal to the search key */ \ +attr struct type * \ +name##_RB_NFIND(struct name *head, struct type *elm) \ +{ \ + struct type *tmp = RB_ROOT(head); \ + struct type *res = NULL; \ + int comp; \ + while (tmp) { \ + comp = cmp(elm, tmp); \ + if (comp < 0) { \ + res = tmp; \ + tmp = RB_LEFT(tmp, field); \ + } \ + else if (comp > 0) \ + tmp = RB_RIGHT(tmp, field); \ + else \ + return (tmp); \ + } \ + return (res); \ +} + +#define RB_GENERATE_NEXT(name, type, field, attr) \ +/* ARGSUSED */ \ +attr struct type * \ name##_RB_NEXT(struct type *elm) \ { \ if (RB_RIGHT(elm, field)) { \ @@ -643,9 +715,33 @@ name##_RB_NEXT(struct type *elm) \ } \ } \ return (elm); \ -} \ - \ -struct type * \ +} + +#define RB_GENERATE_PREV(name, type, field, attr) \ +/* ARGSUSED */ \ +attr struct type * \ +name##_RB_PREV(struct type *elm) \ +{ \ + if (RB_LEFT(elm, field)) { \ + elm = RB_LEFT(elm, field); \ + while (RB_RIGHT(elm, field)) \ + elm = RB_RIGHT(elm, field); \ + } else { \ + if (RB_PARENT(elm, field) && \ + (elm == RB_RIGHT(RB_PARENT(elm, field), field))) \ + elm = RB_PARENT(elm, field); \ + else { \ + while (RB_PARENT(elm, field) && \ + (elm == RB_LEFT(RB_PARENT(elm, field), field)))\ + elm = RB_PARENT(elm, field); \ + elm = RB_PARENT(elm, field); \ + } \ + } \ + return (elm); \ +} + +#define RB_GENERATE_MINMAX(name, type, field, attr) \ +attr struct type * \ name##_RB_MINMAX(struct name *head, int val) \ { \ struct type *tmp = RB_ROOT(head); \ @@ -666,7 +762,9 @@ name##_RB_MINMAX(struct name *head, int val) \ #define RB_INSERT(name, x, y) name##_RB_INSERT(x, y) #define RB_REMOVE(name, x, y) name##_RB_REMOVE(x, y) #define RB_FIND(name, x, y) name##_RB_FIND(x, y) +#define RB_NFIND(name, x, y) name##_RB_NFIND(x, y) #define RB_NEXT(name, x, y) name##_RB_NEXT(y) +#define RB_PREV(name, x, y) name##_RB_PREV(y) #define RB_MIN(name, x) name##_RB_MINMAX(x, RB_NEGINF) #define RB_MAX(name, x) name##_RB_MINMAX(x, RB_INF) @@ -675,4 +773,29 @@ name##_RB_MINMAX(struct name *head, int val) \ (x) != NULL; \ (x) = name##_RB_NEXT(x)) +#define RB_FOREACH_FROM(x, name, y) \ + for ((x) = (y); \ + ((x) != NULL) && ((y) = name##_RB_NEXT(x), (x) != NULL); \ + (x) = (y)) + +#define RB_FOREACH_SAFE(x, name, head, y) \ + for ((x) = RB_MIN(name, head); \ + ((x) != NULL) && ((y) = name##_RB_NEXT(x), (x) != NULL); \ + (x) = (y)) + +#define RB_FOREACH_REVERSE(x, name, head) \ + for ((x) = RB_MAX(name, head); \ + (x) != NULL; \ + (x) = name##_RB_PREV(x)) + +#define RB_FOREACH_REVERSE_FROM(x, name, y) \ + for ((x) = (y); \ + ((x) != NULL) && ((y) = name##_RB_PREV(x), (x) != NULL); \ + (x) = (y)) + +#define RB_FOREACH_REVERSE_SAFE(x, name, head, y) \ + for ((x) = RB_MAX(name, head); \ + ((x) != NULL) && ((y) = name##_RB_PREV(x), (x) != NULL); \ + (x) = (y)) + #endif /* _SYS_TREE_H_ */ diff --git a/common/utils/itti/timer.c b/common/utils/itti/timer.c index 683efd1279..9c742c19cc 100644 --- a/common/utils/itti/timer.c +++ b/common/utils/itti/timer.c @@ -95,8 +95,7 @@ int timer_handle_signal(siginfo_t *info) // LG: To many traces for msc timer: TMR_DEBUG("Timer with id 0x%lx has expired\n", (long)timer_p->timer); - printf("Timer with id 0x%lx has expired\n", (long)timer_p->timer); - + task_id = timer_p->task_id; instance = timer_p->instance; message_p = itti_alloc_new_message(TASK_TIMER, TIMER_HAS_EXPIRED); @@ -210,11 +209,6 @@ int timer_setup( type == TIMER_PERIODIC ? "periodic" : "single shot", *timer_id, interval_sec, interval_us); - printf("Requesting new %s timer with id 0x%lx that expires within " - "%d sec and %d usec\n", - type == TIMER_PERIODIC ? "periodic" : "single shot", - *timer_id, interval_sec, interval_us); - timer_p->timer = timer; /* Lock the queue and insert the timer at the tail */ diff --git a/openair2/ENB_APP/enb_agent.c b/openair2/ENB_APP/enb_agent.c index 7003a2c638..01eb61fc0b 100644 --- a/openair2/ENB_APP/enb_agent.c +++ b/openair2/ENB_APP/enb_agent.c @@ -40,6 +40,7 @@ #include "assertions.h" +//#define TEST_TIMER enb_agent_instance_t enb_agent[NUM_MAX_ENB_AGENT]; msg_context_t shared_ctxt[NUM_MAX_ENB_AGENT]; @@ -327,8 +328,10 @@ int enb_agent_stop(mid_t mod_id){ err_code_t enb_agent_timeout(void* args){ + // enb_agent_timer_args_t *timer_args = calloc(1, sizeof(*timer_args)); + //memcpy (timer_args, args, sizeof(*timer_args)); enb_agent_timer_args_t *timer_args = (enb_agent_timer_args_t *) args; - + LOG_I(ENB_AGENT, "enb_agent %d timeout\n", timer_args->mod_id); LOG_I(ENB_AGENT, "eNB action %d ENB flags %d \n", timer_args->cc_actions,timer_args->cc_report_flags); LOG_I(ENB_AGENT, "UE action %d UE flags %d \n", timer_args->ue_actions,timer_args->ue_report_flags); diff --git a/openair2/ENB_APP/enb_agent_common.c b/openair2/ENB_APP/enb_agent_common.c index c2653f4c85..70f1092bdd 100644 --- a/openair2/ENB_APP/enb_agent_common.c +++ b/openair2/ENB_APP/enb_agent_common.c @@ -312,25 +312,12 @@ int get_ue_wcqi (mid_t mod_id, mid_t ue_id) { //struct enb_agent_map agent_map; - -/* The timer_id might not be the best choice for the comparison */ -int enb_agent_compare_timer(struct enb_agent_timer_element_s *a, struct enb_agent_timer_element_s *b){ - - //if (a->timer_id) return 0; - //if (b->timer_id) return 0; - - if (a->timer_id < b->timer_id) return -1; - if (a->timer_id > b->timer_id) return 1; - - // equal timers - return 0; -} - -RB_GENERATE(enb_agent_map,enb_agent_timer_element_s, entry, enb_agent_compare_timer); - +enb_agent_timer_instance_t timer_instance; err_code_t enb_agent_init_timer(void){ + + LOG_I(ENB_AGENT, "init RB tree\n"); - RB_INIT(&enb_agent_head); + RB_INIT(&timer_instance.enb_agent_head); /* struct enb_agent_timer_element_s e; @@ -340,6 +327,18 @@ err_code_t enb_agent_init_timer(void){ return PROTOCOL__PROGRAN_ERR__NO_ERR; } +RB_GENERATE(enb_agent_map,enb_agent_timer_element_s, entry, enb_agent_compare_timer); + +/* The timer_id might not be the best choice for the comparison */ +int enb_agent_compare_timer(struct enb_agent_timer_element_s *a, struct enb_agent_timer_element_s *b){ + + if (a->timer_id < b->timer_id) return -1; + if (a->timer_id > b->timer_id) return 1; + + // equal timers + return 0; +} + err_code_t enb_agent_create_timer(uint32_t interval_sec, uint32_t interval_usec, agent_id_t agent_id, @@ -349,7 +348,9 @@ err_code_t enb_agent_create_timer(uint32_t interval_sec, void* timer_args, long *timer_id){ - struct enb_agent_timer_element_s e; + struct enb_agent_timer_element_s *e = calloc(1, sizeof(*e)); + DevAssert(e != NULL); + //uint32_t timer_id; int ret=-1; @@ -368,7 +369,7 @@ err_code_t enb_agent_create_timer(uint32_t interval_sec, timer_args, timer_id); - e.type = TIMER_ONE_SHOT; + e->type = TIMER_ONE_SHOT; } else if (timer_type == ENB_AGENT_TIMER_TYPE_PERIODIC ){ ret = timer_setup(interval_sec, @@ -379,32 +380,25 @@ err_code_t enb_agent_create_timer(uint32_t interval_sec, timer_args, timer_id); - e.type = TIMER_PERIODIC; + e->type = TIMER_PERIODIC; } if (ret < 0 ) { return TIMER_SETUP_FAILED; } - e.agent_id = agent_id; - e.instance = instance; - e.state = ENB_AGENT_TIMER_STATE_ACTIVE; - e.timer_id = *timer_id; - e.timer_args = timer_args; - e.cb = cb; - - LOG_I(ENB_AGENT,"created a timer with id 0x%lx for agent %d, instance %d \n", - e.timer_id, e.agent_id, e.instance); - - RB_INSERT(enb_agent_map, &enb_agent_head, &e); + e->agent_id = agent_id; + e->instance = instance; + e->state = ENB_AGENT_TIMER_STATE_ACTIVE; + e->timer_id = *timer_id; + // e->timer_args = timer_args; + e->cb = cb; + /*element should be a real pointer*/ + RB_INSERT(enb_agent_map, &timer_instance.enb_agent_head, e); - - /* - struct enb_agent_timer_element_s search; - search.timer_id = *timer_id; - printf("search 1: %p (expected %p)\n", RB_FIND(enb_agent_map, &enb_agent_head, &search), &e); - printf("search 1: %p (expected %p)\n", get_timer_entry(e.timer_id), &e); - */ + LOG_I(ENB_AGENT,"Created a new timer with id 0x%lx for agent %d, instance %d \n", + e->timer_id, e->agent_id, e->instance); + return 0; } @@ -413,7 +407,7 @@ err_code_t enb_agent_destroy_timer(long timer_id){ struct enb_agent_timer_element_s *e = get_timer_entry(timer_id); if (e != NULL ) { - RB_REMOVE(enb_agent_map, &enb_agent_head, &e); + RB_REMOVE(enb_agent_map, &timer_instance.enb_agent_head, &e); free(e); } @@ -431,8 +425,8 @@ err_code_t enb_agent_destroy_timers(void){ struct enb_agent_timer_element_s *e = NULL; - RB_FOREACH(e, enb_agent_map, &enb_agent_head) { - RB_REMOVE(enb_agent_map, &enb_agent_head, e); + RB_FOREACH(e, enb_agent_map, &timer_instance.enb_agent_head) { + RB_REMOVE(enb_agent_map, &timer_instance.enb_agent_head, e); timer_remove(e->timer_id); free(e); } @@ -443,11 +437,10 @@ err_code_t enb_agent_destroy_timers(void){ struct enb_agent_timer_element_s * get_timer_entry(long timer_id) { - struct enb_agent_timer_element_s search, *e; - memset(&search, 0, sizeof(struct enb_agent_timer_element_s)); - search.timer_id = timer_id; - - return RB_FIND(enb_agent_map, &enb_agent_head, &search); + struct enb_agent_timer_element_s *search= calloc(1,sizeof(*search)); + search->timer_id = timer_id; + + return RB_FIND(enb_agent_map, &timer_instance.enb_agent_head, search); } /* diff --git a/openair2/ENB_APP/enb_agent_common.h b/openair2/ENB_APP/enb_agent_common.h index eb3de96145..662ea73ed7 100644 --- a/openair2/ENB_APP/enb_agent_common.h +++ b/openair2/ENB_APP/enb_agent_common.h @@ -189,10 +189,13 @@ typedef struct enb_agent_timer_element_s{ long timer_id; /* Timer id returned by the timer API*/ enb_agent_timer_callback_t cb; - void* timer_args; + // void* timer_args; } enb_agent_timer_element_t; +typedef struct enb_agent_timer_instance_s{ + RB_HEAD(enb_agent_map, enb_agent_timer_element_s) enb_agent_head; +}enb_agent_timer_instance_t; err_code_t enb_agent_init_timer(void); @@ -214,11 +217,11 @@ err_code_t enb_agent_restart_timer(long *timer_id); struct enb_agent_timer_element_s * get_timer_entry(long timer_id); -int enb_agent_compare_timer(struct enb_agent_timer_element_s *a, struct enb_agent_timer_element_s *b); + err_code_t enb_agent_process_timeout(long timer_id, void* timer_args); -RB_HEAD(enb_agent_map, enb_agent_timer_element_s) enb_agent_head; +int enb_agent_compare_timer(struct enb_agent_timer_element_s *a, struct enb_agent_timer_element_s *b); /* RB_PROTOTYPE is for .h files */ RB_PROTOTYPE(enb_agent_map, enb_agent_timer_element_s, entry, enb_agent_compare_timer); diff --git a/openair2/ENB_APP/enb_agent_handler.c b/openair2/ENB_APP/enb_agent_handler.c index 27536c8b7f..1b8457d474 100644 --- a/openair2/ENB_APP/enb_agent_handler.c +++ b/openair2/ENB_APP/enb_agent_handler.c @@ -141,15 +141,15 @@ void * enb_agent_send_message(xid_t xid, err_code_t enb_agent_process_timeout(long timer_id, void* timer_args){ - struct enb_agent_timer_element_s *e = get_timer_entry(timer_id); + struct enb_agent_timer_element_s *found = get_timer_entry(timer_id); + + if (found == NULL ) goto error; + LOG_I(ENB_AGENT, "Found the entry (%p): timer_id is 0x%lx 0x%lx\n", found, timer_id, found->timer_id); - LOG_I(ENB_AGENT, "element %p: timer_id is 0x%lx 0x%lx\n", e, timer_id, e->timer_id); - - if (e == NULL ) goto error; if (timer_args == NULL) LOG_W(ENB_AGENT,"null timer args\n"); - return e->cb(timer_args); + return found->cb(timer_args); error: From 99cf3b654ab8b4a42fac031bdac116f98b8247cc Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Tue, 5 Jan 2016 21:30:55 +0200 Subject: [PATCH 048/349] Added functions to get the current frame and subframe --- openair2/ENB_APP/enb_agent_common.c | 12 ++++++++++++ openair2/ENB_APP/enb_agent_common.h | 4 ++++ 2 files changed, 16 insertions(+) diff --git a/openair2/ENB_APP/enb_agent_common.c b/openair2/ENB_APP/enb_agent_common.c index 70f1092bdd..c1d65f95cc 100644 --- a/openair2/ENB_APP/enb_agent_common.c +++ b/openair2/ENB_APP/enb_agent_common.c @@ -282,6 +282,18 @@ int get_current_time_ms (mid_t mod_id, int subframe_flag){ } +int get_current_frame (mid_t mod_id) { + + return ((eNB_MAC_INST *)enb[mod_id])->frame; + +} + +int get_current_subframe (mid_t mod_id) { + + return ((eNB_MAC_INST *)enb[mod_id])->subframe; + +} + int get_num_ues (mid_t mod_id){ return ((UE_list_t *)enb_ue[mod_id])->num_UEs; diff --git a/openair2/ENB_APP/enb_agent_common.h b/openair2/ENB_APP/enb_agent_common.h index 662ea73ed7..ca5aafbfdd 100644 --- a/openair2/ENB_APP/enb_agent_common.h +++ b/openair2/ENB_APP/enb_agent_common.h @@ -104,6 +104,10 @@ void set_enb_vars(mid_t mod_id, ran_name_t ran); int get_current_time_ms (mid_t mod_id, int subframe_flag); +int get_current_frame(mid_t mod_id); + +int get_current_subframe(mid_t mod_id); + int get_num_ues(mid_t mod_id); int get_ue_crnti (mid_t mod_id, mid_t ue_id); From 3bc88cfd11b581bcd1ab1615b377cf8734b91fc9 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Tue, 5 Jan 2016 21:52:05 +0200 Subject: [PATCH 049/349] Fixed agent to support proper frame and subframe reporting in progRAN messages --- openair2/ENB_APP/enb_agent_common.c | 11 +++++++++++ openair2/ENB_APP/enb_agent_common.h | 4 ++++ openair2/ENB_APP/enb_agent_mac.c | 6 +++--- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/openair2/ENB_APP/enb_agent_common.c b/openair2/ENB_APP/enb_agent_common.c index c1d65f95cc..c719777aaf 100644 --- a/openair2/ENB_APP/enb_agent_common.c +++ b/openair2/ENB_APP/enb_agent_common.c @@ -294,6 +294,17 @@ int get_current_subframe (mid_t mod_id) { } +uint16_t get_sfn_sf (mid_t mod_id) { + + uint16_t frame, subframe; + uint16_t sfn_sf; + + frame = (uint16_t) get_current_frame(mod_id); + subframe = (uint16_t) get_current_subframe(mod_id); + sfn_sf = (frame << 12) | subframe; + return sfn_sf; +} + int get_num_ues (mid_t mod_id){ return ((UE_list_t *)enb_ue[mod_id])->num_UEs; diff --git a/openair2/ENB_APP/enb_agent_common.h b/openair2/ENB_APP/enb_agent_common.h index ca5aafbfdd..9c5f4044fa 100644 --- a/openair2/ENB_APP/enb_agent_common.h +++ b/openair2/ENB_APP/enb_agent_common.h @@ -108,6 +108,10 @@ int get_current_frame(mid_t mod_id); int get_current_subframe(mid_t mod_id); +/*Return the frame and subframe number in compact 16-bit format. + Bits 0-3 frame, rest for subframe. Required by progRAN protocol*/ +uint16_t get_sfn_sf (mid_t mod_id); + int get_num_ues(mid_t mod_id); int get_ue_crnti (mid_t mod_id, mid_t ue_id); diff --git a/openair2/ENB_APP/enb_agent_mac.c b/openair2/ENB_APP/enb_agent_mac.c index edf1406296..4801d21686 100644 --- a/openair2/ENB_APP/enb_agent_mac.c +++ b/openair2/ENB_APP/enb_agent_mac.c @@ -296,7 +296,7 @@ int enb_agent_mac_stats_reply(mid_t mod_id, goto error; protocol__prp_dl_cqi_report__init(dl_report); //TODO:Set the SFN and SF of the last report held in the agent. - dl_report->sfn_sn = get_current_time_ms(enb_id, 1); + dl_report->sfn_sn = get_sfn_sf(enb_id); dl_report->has_sfn_sn = 1; //TODO:Set the number of DL CQI reports for this UE. One for each CC dl_report->n_csi_report = 1; @@ -391,7 +391,7 @@ int enb_agent_mac_stats_reply(mid_t mod_id, goto error; protocol__prp_ul_cqi_report__init(full_ul_report); //TODO:Set the SFN and SF of the generated report - full_ul_report->sfn_sn = 100; + full_ul_report->sfn_sn = get_sfn_sf(enb_id); full_ul_report->has_sfn_sn = 1; //TODO:Set the number of UL measurement reports based on the types of measurements //configured for this UE and on the servCellIndex @@ -461,7 +461,7 @@ int enb_agent_mac_stats_reply(mid_t mod_id, goto error; protocol__prp_noise_interference_report__init(ni_report); // Current frame and subframe number - ni_report->sfn_sf = 0; + ni_report->sfn_sf = get_sfn_sf(enb_id); ni_report->has_sfn_sf = 1; // Received interference power in dbm ni_report->rip = 0; From e0c459be755f002e81bbefb0a8a78ee38d3b87ba Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Wed, 6 Jan 2016 11:57:03 +0200 Subject: [PATCH 050/349] Changed handlers not to require the xid in their signature. Containted in the received message, or generated in them --- openair2/ENB_APP/enb_agent.c | 4 ++-- openair2/ENB_APP/enb_agent_common.c | 16 +++++++++++++--- openair2/ENB_APP/enb_agent_common.h | 13 +++++-------- openair2/ENB_APP/enb_agent_handler.c | 6 ++---- openair2/ENB_APP/enb_agent_mac.c | 4 +++- openair2/ENB_APP/enb_agent_mac.h | 2 +- 6 files changed, 26 insertions(+), 19 deletions(-) diff --git a/openair2/ENB_APP/enb_agent.c b/openair2/ENB_APP/enb_agent.c index 01eb61fc0b..3c9ad7d24d 100644 --- a/openair2/ENB_APP/enb_agent.c +++ b/openair2/ENB_APP/enb_agent.c @@ -140,7 +140,7 @@ void *receive_thread(void *args) { LOG_D(ENB_AGENT,"received message with size %d\n", size); - msg=enb_agent_handle_message(d->mod_id, d->rx_xid, data, size); + msg=enb_agent_handle_message(d->mod_id, data, size); free(data); @@ -149,7 +149,7 @@ void *receive_thread(void *args) { // check if there is something to send back to the controller if (msg != NULL){ - data=enb_agent_send_message(d->tx_xid,msg,&size); + data=enb_agent_send_message(msg,&size); if (message_put(d->tx_mq, data, size, priority)){ err_code = PROTOCOL__PROGRAN_ERR__MSG_ENQUEUING; diff --git a/openair2/ENB_APP/enb_agent_common.c b/openair2/ENB_APP/enb_agent_common.c index c719777aaf..0fe2c8e1ac 100644 --- a/openair2/ENB_APP/enb_agent_common.c +++ b/openair2/ENB_APP/enb_agent_common.c @@ -102,9 +102,11 @@ int prp_create_header(xid_t xid, Protocol__PrpType type, Protocol__PrpHeader ** } -int enb_agent_hello(mid_t mod_id, xid_t xid, const void *params, Protocol__ProgranMessage **msg) { +int enb_agent_hello(mid_t mod_id, const void *params, Protocol__ProgranMessage **msg) { Protocol__PrpHeader *header; + /*TODO: Need to set random xid or xid from received hello message*/ + xid_t xid = 1; if (prp_create_header(xid, PROTOCOL__PRP_TYPE__PRPT_HELLO, &header) != 0) goto error; @@ -154,8 +156,10 @@ int enb_agent_destroy_hello(Protocol__ProgranMessage *msg) { } -int enb_agent_echo_request(mid_t mod_id, xid_t xid, const void* params, Protocol__ProgranMessage **msg) { +int enb_agent_echo_request(mid_t mod_id, const void* params, Protocol__ProgranMessage **msg) { Protocol__PrpHeader *header; + /*TODO: Need to set a random xid*/ + xid_t xid = 1; if (prp_create_header(xid, PROTOCOL__PRP_TYPE__PRPT_ECHO_REQUEST, &header) != 0) goto error; @@ -203,7 +207,13 @@ int enb_agent_destroy_echo_request(Protocol__ProgranMessage *msg) { -int enb_agent_echo_reply(mid_t mod_id, xid_t xid, const void *params, Protocol__ProgranMessage **msg) { +int enb_agent_echo_reply(mid_t mod_id, const void *params, Protocol__ProgranMessage **msg) { + + xid_t xid; + Protocol__ProgranMessage *input = (Protocol__ProgranMessage *)params; + Protocol__PrpEchoRequest *echo_req = input->echo_request_msg; + xid = (echo_req->header)->xid; + Protocol__PrpHeader *header; if (prp_create_header(xid, PROTOCOL__PRP_TYPE__PRPT_ECHO_REPLY, &header) != 0) goto error; diff --git a/openair2/ENB_APP/enb_agent_common.h b/openair2/ENB_APP/enb_agent_common.h index 9c5f4044fa..f918914f92 100644 --- a/openair2/ENB_APP/enb_agent_common.h +++ b/openair2/ENB_APP/enb_agent_common.h @@ -58,8 +58,7 @@ typedef int (*enb_agent_message_decoded_callback)( mid_t mod_id, - xid_t xid, - const void *params, + const void *params, Protocol__ProgranMessage **msg ); @@ -72,23 +71,21 @@ int enb_agent_deserialize_message(void *data, int size, Protocol__ProgranMessage int prp_create_header(xid_t xid, Protocol__PrpType type, Protocol__PrpHeader **header); -int enb_agent_hello(mid_t mod_id, xid_t xid, const void *params, Protocol__ProgranMessage **msg); +int enb_agent_hello(mid_t mod_id, const void *params, Protocol__ProgranMessage **msg); int enb_agent_destroy_hello(Protocol__ProgranMessage *msg); -int enb_agent_echo_request(mid_t mod_id, xid_t xid, const void *params, Protocol__ProgranMessage **msg); +int enb_agent_echo_request(mid_t mod_id, const void *params, Protocol__ProgranMessage **msg); int enb_agent_destroy_echo_request(Protocol__ProgranMessage *msg); -int enb_agent_echo_reply(mid_t mod_id, xid_t xid, const void *params, Protocol__ProgranMessage **msg); +int enb_agent_echo_reply(mid_t mod_id, const void *params, Protocol__ProgranMessage **msg); int enb_agent_destroy_echo_reply(Protocol__ProgranMessage *msg); Protocol__ProgranMessage* enb_agent_handle_message (mid_t mod_id, - xid_t xid, uint8_t *data, uint32_t size); -void * enb_agent_send_message(xid_t xid, - Protocol__ProgranMessage *msg, +void * enb_agent_send_message(Protocol__ProgranMessage *msg, uint32_t * size); diff --git a/openair2/ENB_APP/enb_agent_handler.c b/openair2/ENB_APP/enb_agent_handler.c index 1b8457d474..8c2b9e010a 100644 --- a/openair2/ENB_APP/enb_agent_handler.c +++ b/openair2/ENB_APP/enb_agent_handler.c @@ -68,7 +68,6 @@ static const char *enb_agent_direction2String[] = { Protocol__ProgranMessage* enb_agent_handle_message (mid_t mod_id, - xid_t xid, uint8_t *data, uint32_t size){ @@ -93,7 +92,7 @@ Protocol__ProgranMessage* enb_agent_handle_message (mid_t mod_id, } - err_code = ((*messages_callback[decoded_message->msg_case-1][decoded_message->msg_dir-1])(mod_id, xid, (void *) decoded_message, &reply_message)); + err_code = ((*messages_callback[decoded_message->msg_case-1][decoded_message->msg_dir-1])(mod_id, (void *) decoded_message, &reply_message)); if ( err_code < 0 ){ goto error; } @@ -110,8 +109,7 @@ error: -void * enb_agent_send_message(xid_t xid, - Protocol__ProgranMessage *msg, +void * enb_agent_send_message(Protocol__ProgranMessage *msg, uint32_t * size){ void * buffer; diff --git a/openair2/ENB_APP/enb_agent_mac.c b/openair2/ENB_APP/enb_agent_mac.c index 4801d21686..d2504e4dec 100644 --- a/openair2/ENB_APP/enb_agent_mac.c +++ b/openair2/ENB_APP/enb_agent_mac.c @@ -38,7 +38,7 @@ #include "log.h" -int enb_agent_mac_handle_stats(mid_t mod_id, xid_t xid, const void *params, Protocol__ProgranMessage **msg){ +int enb_agent_mac_handle_stats(mid_t mod_id, const void *params, Protocol__ProgranMessage **msg){ // TODO: Must deal with sanitization of input // TODO: Must check if RNTIs and cell ids of the request actually exist @@ -47,6 +47,7 @@ int enb_agent_mac_handle_stats(mid_t mod_id, xid_t xid, const void *params, Prot void *buffer; int size; err_code_t err_code; + xid_t xid; //TODO: We do not deal with multiple CCs at the moment and eNB id is 0 int cc_id = 0; @@ -63,6 +64,7 @@ int enb_agent_mac_handle_stats(mid_t mod_id, xid_t xid, const void *params, Prot Protocol__ProgranMessage *input = (Protocol__ProgranMessage *)params; Protocol__PrpStatsRequest *stats_req = input->stats_request_msg; + xid = (stats_req->header)->xid; // Check the type of request that is made switch(stats_req->body_case) { diff --git a/openair2/ENB_APP/enb_agent_mac.h b/openair2/ENB_APP/enb_agent_mac.h index 6584111825..569eb51e5e 100644 --- a/openair2/ENB_APP/enb_agent_mac.h +++ b/openair2/ENB_APP/enb_agent_mac.h @@ -70,7 +70,7 @@ typedef struct { } report_config_t; -int enb_agent_mac_handle_stats(mid_t mod_id, xid_t xid, const void *params, Protocol__ProgranMessage **msg); +int enb_agent_mac_handle_stats(mid_t mod_id, const void *params, Protocol__ProgranMessage **msg); int enb_agent_mac_stats_reply(mid_t mod_id, xid_t xid, const report_config_t *report_config, Protocol__ProgranMessage **msg); From e78075e8310de179176db94aa6ae0be7746d872d Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Wed, 6 Jan 2016 16:22:59 +0200 Subject: [PATCH 051/349] Integrated task manager with system frame and subframe clock and added support for one task queue per eNB --- openair2/ENB_APP/enb_agent_task_manager.c | 51 +++++++++++++---------- openair2/ENB_APP/enb_agent_task_manager.h | 14 ++++--- 2 files changed, 38 insertions(+), 27 deletions(-) diff --git a/openair2/ENB_APP/enb_agent_task_manager.c b/openair2/ENB_APP/enb_agent_task_manager.c index 0b987f1c22..e2c31319e4 100644 --- a/openair2/ENB_APP/enb_agent_task_manager.c +++ b/openair2/ENB_APP/enb_agent_task_manager.c @@ -40,6 +40,7 @@ #include #include "enb_agent_task_manager.h" +#include "enb_agent_common.c" /* Util macros */ @@ -74,8 +75,8 @@ void enb_agent_task_destroy(enb_agent_task_t *task) { free(task); } -enb_agent_task_queue_t *enb_agent_task_queue_init(size_t capacity, - int (*cmp)(const enb_agent_task_t *t1, const enb_agent_task_t *t2)) { +enb_agent_task_queue_t *enb_agent_task_queue_init(mid_t mod_id, size_t capacity, + int (*cmp)(mid_t mod_id, const enb_agent_task_t *t1, const enb_agent_task_t *t2)) { enb_agent_task_queue_t *queue = NULL; queue = malloc(sizeof(enb_agent_task_queue_t)); @@ -88,6 +89,8 @@ enb_agent_task_queue_t *enb_agent_task_queue_init(size_t capacity, else queue->cmp = cmp; + queue->mod_id = mod_id; + queue->first_frame = 0; queue->first_subframe = 0; @@ -115,8 +118,8 @@ enb_agent_task_queue_t *enb_agent_task_queue_init(size_t capacity, return NULL; } -enb_agent_task_queue_t *enb_agent_task_queue_default_init() { - return enb_agent_task_queue_init(DEFAULT_CAPACITY, NULL); +enb_agent_task_queue_t *enb_agent_task_queue_default_init(mid_t mod_id) { + return enb_agent_task_queue_init(mod_id, DEFAULT_CAPACITY, NULL); } void enb_agent_task_queue_destroy(enb_agent_task_queue_t *queue) { @@ -157,7 +160,7 @@ int enb_agent_task_queue_put(enb_agent_task_queue_t *queue, enb_agent_task_t *ta i = queue->count; queue->count++; /*Swap elements to maintain heap properties*/ - while(i > 0 && queue->cmp(queue->task[i], queue->task[PARENT(i)]) > 0) { + while(i > 0 && queue->cmp(queue->mod_id, queue->task[i], queue->task[PARENT(i)]) > 0) { tmp = queue->task[i]; queue->task[i] = queue->task[PARENT(i)]; queue->task[PARENT(i)] = tmp; @@ -178,11 +181,6 @@ int enb_agent_task_queue_put(enb_agent_task_queue_t *queue, enb_agent_task_t *ta int enb_agent_task_queue_get_current_task(enb_agent_task_queue_t *queue, enb_agent_task_t **task) { int err_code; - - /*TODO*/ - /* Find current frame and subframe number */ - uint16_t curr_frame=1; - uint8_t curr_subframe=1; if (pthread_mutex_lock(queue->mutex)) { /*TODO*/ @@ -195,6 +193,11 @@ int enb_agent_task_queue_get_current_task(enb_agent_task_queue_t *queue, enb_age err_code = HEAP_EMPTY; goto error; } + + /* Find current frame and subframe number */ + uint16_t curr_frame=get_current_frame(queue->mod_id); + uint8_t curr_subframe=get_current_subframe(queue->mod_id); + /* If no task is scheduled for the current subframe, return without any task */ if(queue->task[0]->frame_num != curr_frame || queue->task[0]->subframe_num != curr_subframe) { *task = NULL; @@ -206,7 +209,16 @@ int enb_agent_task_queue_get_current_task(enb_agent_task_queue_t *queue, enb_age queue->count--; /* Restore heap property */ _enb_agent_task_queue_heapify(queue, 0); - + + /*If queue has no element*/ + if (queue->count < 1) { + queue->first_frame = 0; + queue->first_subframe = 0; + } else { + queue->first_frame = queue->task[0]->frame_num; + queue->first_subframe = queue->task[0]->subframe_num; + } + if (pthread_mutex_unlock(queue->mutex)) { // LOG_E(MAC, "%s:%d:%s: fatal error\n", __FILE__, __LINE__, __FUNCTION__); exit(1); @@ -228,14 +240,14 @@ void _enb_agent_task_queue_heapify(enb_agent_task_queue_t *queue, size_t idx) { r_idx = RIGHT(idx); /* Left child exists, compare left child with its parent */ - if (l_idx < queue->count && queue->cmp(queue->task[l_idx], queue->task[idx]) > 0) { + if (l_idx < queue->count && queue->cmp(queue->mod_id, queue->task[l_idx], queue->task[idx]) > 0) { lrg_idx = l_idx; } else { lrg_idx = idx; } /* Right child exists, compare right child with the largest element */ - if (r_idx < queue->count && queue->cmp(queue->task[r_idx], queue->task[lrg_idx]) > 0) { + if (r_idx < queue->count && queue->cmp(queue->mod_id, queue->task[r_idx], queue->task[lrg_idx]) > 0) { lrg_idx = r_idx; } @@ -266,12 +278,12 @@ int _enb_agent_task_queue_realloc_heap(enb_agent_task_queue_t *queue) { return HEAP_NOREALLOC; } -int _enb_agent_task_queue_cmp(const enb_agent_task_t *t1, const enb_agent_task_t *t2) { +int _enb_agent_task_queue_cmp(mid_t mod_id, const enb_agent_task_t *t1, const enb_agent_task_t *t2) { if ((t1->frame_num == t2->frame_num) && (t1->subframe_num == t2->subframe_num)) return 0; - /* TODO: need to get current frame and subframe number */ - uint16_t curr_frame = 0; - uint8_t curr_subframe = 7; + + uint16_t curr_frame = get_current_frame(mod_id); + uint8_t curr_subframe = get_current_subframe(mod_id); int f_offset, sf_offset, tmp1, tmp2; @@ -296,8 +308,3 @@ int _enb_agent_task_queue_cmp(const enb_agent_task_t *t1, const enb_agent_task_t to be the only comparisson parameter in all other cases */ return f_offset*100 + sf_offset; } - - -int main(int argc, char **argv) { - return 0; -} diff --git a/openair2/ENB_APP/enb_agent_task_manager.h b/openair2/ENB_APP/enb_agent_task_manager.h index 5a3b5eb327..ef60152b27 100644 --- a/openair2/ENB_APP/enb_agent_task_manager.h +++ b/openair2/ENB_APP/enb_agent_task_manager.h @@ -43,6 +43,8 @@ #include "progran.pb-c.h" +#include "enb_agent_common.h" + #ifdef __cplusplus extern "C" { #endif @@ -65,6 +67,7 @@ typedef struct enb_agent_task_s { * Priority Queue Structure for tasks */ typedef struct enb_agent_task_queue_s { + mid_t mod_id; /* The amount of allocated memory for agent tasks in the heap*/ volatile size_t capacity; /* The actual size of the tasks heap at a certain time */ @@ -76,7 +79,7 @@ typedef struct enb_agent_task_queue_s { /* An array of prioritized tasks stored in a heap */ enb_agent_task_t **task; /* A pointer to a comparator function, used to prioritize elements */ - int (*cmp)(const enb_agent_task_t *t1, const enb_agent_task_t *t2); + int (*cmp)(mid_t mod_id, const enb_agent_task_t *t1, const enb_agent_task_t *t2); pthread_mutex_t *mutex; } enb_agent_task_queue_t; @@ -103,13 +106,13 @@ void enb_agent_task_destroy(enb_agent_task_t *task); /** * Allocate initial memory for storing the tasks */ -enb_agent_task_queue_t *enb_agent_task_queue_init(size_t capacity, - int (*cmp)(const enb_agent_task_t *t1, const enb_agent_task_t *t2)); + enb_agent_task_queue_t *enb_agent_task_queue_init(mid_t mod_id, size_t capacity, + int (*cmp)(mid_t mod_id, const enb_agent_task_t *t1, const enb_agent_task_t *t2)); /** * Allocate initial memory for storing the tasks using default parameters */ -enb_agent_task_queue_t *enb_agent_task_queue_default_init(); +enb_agent_task_queue_t *enb_agent_task_queue_default_init(mid_t mod_id); /** * De-allocate memory for the tasks queue @@ -148,8 +151,9 @@ int _enb_agent_task_queue_realloc_heap(enb_agent_task_queue_t *queue); * returns 0 if tasks t1, t2 have the same priority * return negative value if t1 needs to be executed after t2 * return positive value if t1 preceeds t2 + * Need to give eNB id for the comparisson based on the current frame-subframe */ -int _enb_agent_task_queue_cmp(const enb_agent_task_t *t1, const enb_agent_task_t *t2); + int _enb_agent_task_queue_cmp(mid_t mod_id, const enb_agent_task_t *t1, const enb_agent_task_t *t2); #ifdef __cplusplus } From e88779c4ef7c265c32d73f83ca7ba3ca78821638 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Wed, 6 Jan 2016 18:06:48 +0200 Subject: [PATCH 052/349] Added support for lightweight finegrained task timer --- openair2/ENB_APP/enb_agent.c | 30 ++++++++++++++++++++++------- openair2/ENB_APP/enb_agent_common.c | 9 +++++++++ openair2/ENB_APP/enb_agent_common.h | 4 ++++ 3 files changed, 36 insertions(+), 7 deletions(-) diff --git a/openair2/ENB_APP/enb_agent.c b/openair2/ENB_APP/enb_agent.c index 3c9ad7d24d..e8a4466b26 100644 --- a/openair2/ENB_APP/enb_agent.c +++ b/openair2/ENB_APP/enb_agent.c @@ -50,7 +50,7 @@ enb_agent_info_t enb_agent_info; char in_ip[40]; static uint16_t in_port; -//void *send_thread(void *args); +void *send_thread(void *args); void *receive_thread(void *args); pthread_t new_thread(void *(*f)(void *), void *b); err_code_t enb_agent_timeout(void* args); @@ -100,20 +100,35 @@ void *enb_agent_task(void *args){ return NULL; } -/* + void *send_thread(void *args) { +#ifdef TEST_TIMER + msg_context_t *d = args; void *data; int size; int priority; - - while (1) { + struct timeval t1, t2; + long long t; + struct timespec ts; + unsigned int delay = 250*1000; + while(1) { + gettimeofday(&t1, NULL); + enb_agent_sleep_until(&ts, delay); + gettimeofday(&t2, NULL); + t = ((t2.tv_sec * 1000000) + t2.tv_usec) - ((t1.tv_sec * 1000000) + t1.tv_usec); + LOG_I(ENB_AGENT, "Call to sleep_until(%d) took %lld us\n", delay, t); + sleep(1); + } + +#endif + /* while (1) { // need logic for the timer, and usleep(10); if (message_put(d->tx_mq, data, size, priority)) goto error; - } + }*/ return NULL; @@ -121,7 +136,7 @@ error: printf("receive_thread: there was an error\n"); return NULL; } -*/ + void *receive_thread(void *args) { msg_context_t *d = args; @@ -293,9 +308,10 @@ int enb_agent_start(mid_t mod_id, const Enb_properties_array_t* enb_properties){ enb_agent_create_timer(1, 0, ENB_AGENT_DEFAULT, mod_id, ENB_AGENT_TIMER_TYPE_PERIODIC, enb_agent_timeout,(void*)&timer_args, &timer_id); #endif - // new_thread(send_thread, &shared_ctxt); + new_thread(send_thread, &shared_ctxt); //while (1) pause(); + LOG_I(ENB_AGENT,"client ends\n"); return 0; diff --git a/openair2/ENB_APP/enb_agent_common.c b/openair2/ENB_APP/enb_agent_common.c index 0fe2c8e1ac..490658c671 100644 --- a/openair2/ENB_APP/enb_agent_common.c +++ b/openair2/ENB_APP/enb_agent_common.c @@ -476,6 +476,15 @@ struct enb_agent_timer_element_s * get_timer_entry(long timer_id) { return RB_FIND(enb_agent_map, &timer_instance.enb_agent_head, search); } +void enb_agent_sleep_until(struct timespec *ts, int delay) { + ts->tv_nsec += delay; + if(ts->tv_nsec >= 1000*1000*1000){ + ts->tv_nsec -= 1000*1000*1000; + ts->tv_sec++; + } + clock_nanosleep(CLOCK_MONOTONIC, TIMER_ABSTIME, ts, NULL); +} + /* int i =0; RB_FOREACH(e, enb_agent_map, &enb_agent_head) { diff --git a/openair2/ENB_APP/enb_agent_common.h b/openair2/ENB_APP/enb_agent_common.h index f918914f92..d12d3849ec 100644 --- a/openair2/ENB_APP/enb_agent_common.h +++ b/openair2/ENB_APP/enb_agent_common.h @@ -39,6 +39,7 @@ #ifndef ENB_AGENT_COMMON_H_ #define ENB_AGENT_COMMON_H_ +#include #include "header.pb-c.h" #include "progran.pb-c.h" @@ -228,6 +229,9 @@ err_code_t enb_agent_process_timeout(long timer_id, void* timer_args); int enb_agent_compare_timer(struct enb_agent_timer_element_s *a, struct enb_agent_timer_element_s *b); +/*Specify a delay in nanoseconds to timespec and sleep until then*/ +void enb_agent_sleep_until(struct timespec *ts, int delay); + /* RB_PROTOTYPE is for .h files */ RB_PROTOTYPE(enb_agent_map, enb_agent_timer_element_s, entry, enb_agent_compare_timer); From 11b2f829367c39ab7479a0b410cd62e773d24117 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Thu, 7 Jan 2016 17:41:51 +0200 Subject: [PATCH 053/349] Integrated timer to work with periodic report messages and agent tasks --- openair2/ENB_APP/enb_agent.c | 104 ++++++++++------- openair2/ENB_APP/enb_agent_common.c | 2 +- openair2/ENB_APP/enb_agent_common.h | 16 +-- openair2/ENB_APP/enb_agent_handler.c | 24 +++- openair2/ENB_APP/enb_agent_mac.c | 169 +++++++++++++++++++++++++-- openair2/ENB_APP/enb_agent_mac.h | 13 +++ 6 files changed, 263 insertions(+), 65 deletions(-) diff --git a/openair2/ENB_APP/enb_agent.c b/openair2/ENB_APP/enb_agent.c index e8a4466b26..dbefc60502 100644 --- a/openair2/ENB_APP/enb_agent.c +++ b/openair2/ENB_APP/enb_agent.c @@ -53,7 +53,7 @@ static uint16_t in_port; void *send_thread(void *args); void *receive_thread(void *args); pthread_t new_thread(void *(*f)(void *), void *b); -err_code_t enb_agent_timeout(void* args); +Protocol__ProgranMessage *enb_agent_timeout(void* args); /* * enb agent task mainly wakes up the tx thread for periodic and oneshot messages to the controller @@ -61,6 +61,13 @@ err_code_t enb_agent_timeout(void* args); */ void *enb_agent_task(void *args){ + msg_context_t *d = (msg_context_t *) args; + Protocol__ProgranMessage *msg; + void *data; + int size; + err_code_t err_code; + int priority; + MessageDef *msg_p = NULL; const char *msg_name = NULL; instance_t instance; @@ -86,7 +93,15 @@ void *enb_agent_task(void *args){ break; case TIMER_HAS_EXPIRED: - enb_agent_process_timeout(msg_p->ittiMsg.timer_has_expired.timer_id, &msg_p->ittiMsg.timer_has_expired.arg); + msg = enb_agent_process_timeout(msg_p->ittiMsg.timer_has_expired.timer_id, msg_p->ittiMsg.timer_has_expired.arg); + if (msg != NULL){ + data=enb_agent_send_message(msg,&size); + if (message_put(d->tx_mq, data, size, priority)){ + err_code = PROTOCOL__PROGRAN_ERR__MSG_ENQUEUING; + goto error; + } + LOG_D(ENB_AGENT,"sent message with size %d\n", size); + } break; default: @@ -96,46 +111,49 @@ void *enb_agent_task(void *args){ result = itti_free (ITTI_MSG_ORIGIN_ID(msg_p), msg_p); AssertFatal (result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result); + continue; + error: + LOG_E(ENB_AGENT,"enb_agent_task: error %d occured\n",err_code); } while (1); return NULL; } -void *send_thread(void *args) { +/* void *send_thread(void *args) { */ -#ifdef TEST_TIMER +/* #ifdef TEST_TIMER */ - msg_context_t *d = args; - void *data; - int size; - int priority; +/* msg_context_t *d = args; */ +/* void *data; */ +/* int size; */ +/* int priority; */ - struct timeval t1, t2; - long long t; - struct timespec ts; - unsigned int delay = 250*1000; - while(1) { - gettimeofday(&t1, NULL); - enb_agent_sleep_until(&ts, delay); - gettimeofday(&t2, NULL); - t = ((t2.tv_sec * 1000000) + t2.tv_usec) - ((t1.tv_sec * 1000000) + t1.tv_usec); - LOG_I(ENB_AGENT, "Call to sleep_until(%d) took %lld us\n", delay, t); - sleep(1); - } +/* struct timeval t1, t2; */ +/* long long t; */ +/* struct timespec ts; */ +/* unsigned int delay = 250*1000; */ +/* while(1) { */ +/* gettimeofday(&t1, NULL); */ +/* enb_agent_sleep_until(&ts, delay); */ +/* gettimeofday(&t2, NULL); */ +/* t = ((t2.tv_sec * 1000000) + t2.tv_usec) - ((t1.tv_sec * 1000000) + t1.tv_usec); */ +/* LOG_I(ENB_AGENT, "Call to sleep_until(%d) took %lld us\n", delay, t); */ +/* sleep(1); */ +/* } */ -#endif - /* while (1) { - // need logic for the timer, and - usleep(10); - if (message_put(d->tx_mq, data, size, priority)) goto error; - }*/ +/* #endif */ +/* /\* while (1) { */ +/* // need logic for the timer, and */ +/* usleep(10); */ +/* if (message_put(d->tx_mq, data, size, priority)) goto error; */ +/* }*\/ */ - return NULL; +/* return NULL; */ -error: - printf("receive_thread: there was an error\n"); - return NULL; -} +/* error: */ +/* printf("receive_thread: there was an error\n"); */ +/* return NULL; */ +/* } */ void *receive_thread(void *args) { @@ -290,25 +308,25 @@ int enb_agent_start(mid_t mod_id, const Enb_properties_array_t* enb_properties){ * start the enb agent task for tx and interaction with the underlying network function */ - if (itti_create_task (TASK_ENB_AGENT, enb_agent_task, NULL) < 0) { + if (itti_create_task (TASK_ENB_AGENT, enb_agent_task, (void *) &shared_ctxt[mod_id]) < 0) { LOG_E(ENB_AGENT, "Create task for eNB Agent failed\n"); return -1; } -#ifdef TEST_TIMER + //#ifdef TEST_TIMER long timer_id=0; enb_agent_timer_args_t timer_args; memset (&timer_args, 0, sizeof(enb_agent_timer_args_t)); timer_args.mod_id = mod_id; - timer_args.cc_actions= ENB_AGENT_ACTION_APPLY; - timer_args.cc_report_flags = PROTOCOL__PRP_CELL_STATS_TYPE__PRCST_NOISE_INTERFERENCE; - timer_args.ue_actions = ENB_AGENT_ACTION_SEND; - timer_args.ue_report_flags = PROTOCOL__PRP_UE_STATS_TYPE__PRUST_BSR | PROTOCOL__PRP_UE_STATS_TYPE__PRUST_DL_CQI; + //timer_args.cc_actions= ENB_AGENT_ACTION_APPLY; + //timer_args.cc_report_flags = PROTOCOL__PRP_CELL_STATS_TYPE__PRCST_NOISE_INTERFERENCE; + //timer_args.ue_actions = ENB_AGENT_ACTION_SEND; + //timer_args.ue_report_flags = PROTOCOL__PRP_UE_STATS_TYPE__PRUST_BSR | PROTOCOL__PRP_UE_STATS_TYPE__PRUST_DL_CQI; enb_agent_create_timer(1, 0, ENB_AGENT_DEFAULT, mod_id, ENB_AGENT_TIMER_TYPE_PERIODIC, enb_agent_timeout,(void*)&timer_args, &timer_id); -#endif + //#endif - new_thread(send_thread, &shared_ctxt); + //new_thread(send_thread, &shared_ctxt); //while (1) pause(); @@ -342,15 +360,15 @@ int enb_agent_stop(mid_t mod_id){ -err_code_t enb_agent_timeout(void* args){ +Protocol__ProgranMessage *enb_agent_timeout(void* args){ // enb_agent_timer_args_t *timer_args = calloc(1, sizeof(*timer_args)); //memcpy (timer_args, args, sizeof(*timer_args)); enb_agent_timer_args_t *timer_args = (enb_agent_timer_args_t *) args; LOG_I(ENB_AGENT, "enb_agent %d timeout\n", timer_args->mod_id); - LOG_I(ENB_AGENT, "eNB action %d ENB flags %d \n", timer_args->cc_actions,timer_args->cc_report_flags); - LOG_I(ENB_AGENT, "UE action %d UE flags %d \n", timer_args->ue_actions,timer_args->ue_report_flags); + //LOG_I(ENB_AGENT, "eNB action %d ENB flags %d \n", timer_args->cc_actions,timer_args->cc_report_flags); + //LOG_I(ENB_AGENT, "UE action %d UE flags %d \n", timer_args->ue_actions,timer_args->ue_report_flags); - return 0; + return NULL; } diff --git a/openair2/ENB_APP/enb_agent_common.c b/openair2/ENB_APP/enb_agent_common.c index 490658c671..0417f4956e 100644 --- a/openair2/ENB_APP/enb_agent_common.c +++ b/openair2/ENB_APP/enb_agent_common.c @@ -311,7 +311,7 @@ uint16_t get_sfn_sf (mid_t mod_id) { frame = (uint16_t) get_current_frame(mod_id); subframe = (uint16_t) get_current_subframe(mod_id); - sfn_sf = (frame << 12) | subframe; + sfn_sf = (subframe << 12) | frame; return sfn_sf; } diff --git a/openair2/ENB_APP/enb_agent_common.h b/openair2/ENB_APP/enb_agent_common.h index d12d3849ec..31d882d0c9 100644 --- a/openair2/ENB_APP/enb_agent_common.h +++ b/openair2/ENB_APP/enb_agent_common.h @@ -86,6 +86,8 @@ Protocol__ProgranMessage* enb_agent_handle_message (mid_t mod_id, uint8_t *data, uint32_t size); +Protocol__ProgranMessage *enb_agent_handle_timed_task(void *args); + void * enb_agent_send_message(Protocol__ProgranMessage *msg, uint32_t * size); @@ -107,7 +109,7 @@ int get_current_frame(mid_t mod_id); int get_current_subframe(mid_t mod_id); /*Return the frame and subframe number in compact 16-bit format. - Bits 0-3 frame, rest for subframe. Required by progRAN protocol*/ + Bits 0-3 subframe, rest for frame. Required by progRAN protocol*/ uint16_t get_sfn_sf (mid_t mod_id); int get_num_ues(mid_t mod_id); @@ -137,7 +139,7 @@ int get_ue_wcqi (mid_t mod_id, mid_t ue_id); /* Type of the callback executed when the timer expired */ -typedef err_code_t (*enb_agent_timer_callback_t)(void*); +typedef Protocol__ProgranMessage *(*enb_agent_timer_callback_t)(void*); typedef enum { /* oneshot timer: */ @@ -169,13 +171,7 @@ typedef enum { typedef struct enb_agent_timer_args_s{ mid_t mod_id; - - agent_action_t cc_actions; - uint32_t cc_report_flags; - - agent_action_t ue_actions; - uint32_t ue_report_flags; - + Protocol__ProgranMessage *msg; } enb_agent_timer_args_t; @@ -225,7 +221,7 @@ struct enb_agent_timer_element_s * get_timer_entry(long timer_id); -err_code_t enb_agent_process_timeout(long timer_id, void* timer_args); +Protocol__ProgranMessage * enb_agent_process_timeout(long timer_id, void* timer_args); int enb_agent_compare_timer(struct enb_agent_timer_element_s *a, struct enb_agent_timer_element_s *b); diff --git a/openair2/ENB_APP/enb_agent_handler.c b/openair2/ENB_APP/enb_agent_handler.c index 8c2b9e010a..2841f9b6e5 100644 --- a/openair2/ENB_APP/enb_agent_handler.c +++ b/openair2/ENB_APP/enb_agent_handler.c @@ -133,11 +133,28 @@ void * enb_agent_send_message(Protocol__ProgranMessage *msg, error : LOG_E(ENB_AGENT,"errno %d occured\n",err_code); - return NULL; - + return NULL; } -err_code_t enb_agent_process_timeout(long timer_id, void* timer_args){ +Protocol__ProgranMessage *enb_agent_handle_timed_task(void *args) { + err_code_t err_code; + enb_agent_timer_args_t *timer_args = (enb_agent_timer_args_t *) args; + + Protocol__ProgranMessage *timed_task, *reply_message; + timed_task = timer_args->msg; + err_code = ((*messages_callback[timed_task->msg_case-1][timed_task->msg_dir-1])(timer_args->mod_id, (void *) timed_task, &reply_message)); + if ( err_code < 0 ){ + goto error; + } + + return reply_message; + + error: + LOG_E(ENB_AGENT,"errno %d occured\n",err_code); + return NULL; +} + +Protocol__ProgranMessage* enb_agent_process_timeout(long timer_id, void* timer_args){ struct enb_agent_timer_element_s *found = get_timer_entry(timer_id); @@ -148,7 +165,6 @@ err_code_t enb_agent_process_timeout(long timer_id, void* timer_args){ LOG_W(ENB_AGENT,"null timer args\n"); return found->cb(timer_args); - error: LOG_E(ENB_AGENT, "can't get the timer element\n"); diff --git a/openair2/ENB_APP/enb_agent_mac.c b/openair2/ENB_APP/enb_agent_mac.c index d2504e4dec..1a21db5e15 100644 --- a/openair2/ENB_APP/enb_agent_mac.c +++ b/openair2/ENB_APP/enb_agent_mac.c @@ -48,6 +48,7 @@ int enb_agent_mac_handle_stats(mid_t mod_id, const void *params, Protocol__Progr int size; err_code_t err_code; xid_t xid; + uint32_t usec_interval, sec_interval; //TODO: We do not deal with multiple CCs at the moment and eNB id is 0 int cc_id = 0; @@ -70,12 +71,13 @@ int enb_agent_mac_handle_stats(mid_t mod_id, const void *params, Protocol__Progr switch(stats_req->body_case) { case PROTOCOL__PRP_STATS_REQUEST__BODY_COMPLETE_STATS_REQUEST: ; Protocol__PrpCompleteStatsRequest *comp_req = stats_req->complete_stats_request; - if (comp_req->report_frequency == PROTOCOL__PRP_STATS_REPORT_FREQ__PRSRF_PERIODICAL) { - //TODO: Must create a periodic report. Implement once the - // timer functionality is supported - *msg = NULL; - return 0; - } else if (comp_req->report_frequency == PROTOCOL__PRP_STATS_REPORT_FREQ__PRSRF_CONTINUOUS) { + /* if (comp_req->report_frequency == PROTOCOL__PRP_STATS_REPORT_FREQ__PRSRF_PERIODICAL) { */ + /* //TODO: Must create a periodic report. Implement once the */ + /* // timer functionality is supported */ + /* *msg = NULL; */ + /* return 0; */ + /* } else */ + if (comp_req->report_frequency == PROTOCOL__PRP_STATS_REPORT_FREQ__PRSRF_CONTINUOUS) { //TODO: Must create an event based report mechanism *msg = NULL; return 0; @@ -83,7 +85,7 @@ int enb_agent_mac_handle_stats(mid_t mod_id, const void *params, Protocol__Progr //TODO: Must implement to deactivate the event based reporting *msg = NULL; return 0; - } else { //One-off reporting + } else { //One-off or periodical reporting //Set the proper flags ue_flags = comp_req->ue_report_flags; c_flags = comp_req->cell_report_flags; @@ -114,6 +116,33 @@ int enb_agent_mac_handle_stats(mid_t mod_id, const void *params, Protocol__Progr report_config.cc_report_type[i].cc_id = i; report_config.cc_report_type[i].cc_report_flags = c_flags; } + /* Check if request was periodical */ + if (comp_req->report_frequency == PROTOCOL__PRP_STATS_REPORT_FREQ__PRSRF_PERIODICAL) { + /* Create a one off progran message as an argument for the periodical task */ + Protocol__ProgranMessage *timer_msg; + stats_request_config_t request_config; + request_config.report_type = PROTOCOL__PRP_STATS_TYPE__PRST_COMPLETE_STATS; + request_config.report_frequency = PROTOCOL__PRP_STATS_REPORT_FREQ__PRSRF_ONCE; + request_config.period = 0; + request_config.config = &report_config; + enb_agent_mac_stats_request(enb_id, xid, &request_config, &timer_msg); + /* Create a timer */ + long timer_id = 0; + enb_agent_timer_args_t *timer_args; + timer_args = malloc(sizeof(enb_agent_timer_args_t)); + memset (timer_args, 0, sizeof(enb_agent_timer_args_t)); + timer_args->mod_id = enb_id; + timer_args->msg = timer_msg; + /*Convert subframes to usec time*/ + usec_interval = 1000*comp_req->sf; + sec_interval = 0; + /*add seconds if required*/ + if (usec_interval >= 1000*1000) { + sec_interval = usec_interval/(1000*1000); + usec_interval = usec_interval%(1000*1000); + } + enb_agent_create_timer(sec_interval, usec_interval, ENB_AGENT_DEFAULT, enb_id, ENB_AGENT_TIMER_TYPE_PERIODIC, enb_agent_handle_timed_task,(void*) timer_args, &timer_id); + } } break; case PROTOCOL__PRP_STATS_REQUEST__BODY_CELL_STATS_REQUEST:; @@ -172,6 +201,132 @@ int enb_agent_mac_handle_stats(mid_t mod_id, const void *params, Protocol__Progr return err_code; } +int enb_agent_mac_stats_request(mid_t mod_id, + xid_t xid, + const stats_request_config_t *report_config, + Protocol__ProgranMessage **msg) { + Protocol__PrpHeader *header; + int i; + + if (prp_create_header(xid, PROTOCOL__PRP_TYPE__PRPT_STATS_REQUEST, &header) != 0) + goto error; + + Protocol__PrpStatsRequest *stats_request_msg; + stats_request_msg = malloc(sizeof(Protocol__PrpStatsRequest)); + if(stats_request_msg == NULL) + goto error; + + protocol__prp_stats_request__init(stats_request_msg); + stats_request_msg->header = header; + + stats_request_msg->type = report_config->report_type; + stats_request_msg->has_type = 1; + + switch (report_config->report_type) { + case PROTOCOL__PRP_STATS_TYPE__PRST_COMPLETE_STATS: + stats_request_msg->body_case = PROTOCOL__PRP_STATS_REQUEST__BODY_COMPLETE_STATS_REQUEST; + Protocol__PrpCompleteStatsRequest *complete_stats; + complete_stats = malloc(sizeof(Protocol__PrpCompleteStatsRequest)); + if(complete_stats == NULL) + goto error; + protocol__prp_complete_stats_request__init(complete_stats); + complete_stats->report_frequency = report_config->report_frequency; + complete_stats->has_report_frequency = 1; + complete_stats->sf = report_config->period; + complete_stats->has_sf = 1; + complete_stats->has_cell_report_flags = 1; + complete_stats->has_ue_report_flags = 1; + if (report_config->config->nr_cc > 0) { + complete_stats->cell_report_flags = report_config->config->cc_report_type[0].cc_report_flags; + } + if (report_config->config->nr_ue > 0) { + complete_stats->ue_report_flags = report_config->config->ue_report_type[0].ue_report_flags; + } + stats_request_msg->complete_stats_request = complete_stats; + break; + case PROTOCOL__PRP_STATS_TYPE__PRST_CELL_STATS: + stats_request_msg->body_case = PROTOCOL__PRP_STATS_REQUEST__BODY_CELL_STATS_REQUEST; + Protocol__PrpCellStatsRequest *cell_stats; + cell_stats = malloc(sizeof(Protocol__PrpCellStatsRequest)); + if(cell_stats == NULL) + goto error; + protocol__prp_cell_stats_request__init(cell_stats); + cell_stats->n_cell = report_config->config->nr_cc; + cell_stats->has_flags = 1; + if (cell_stats->n_cell > 0) { + uint32_t *cells; + cells = (uint32_t *) malloc(sizeof(uint32_t)*cell_stats->n_cell); + for (i = 0; i < cell_stats->n_cell; i++) { + cells[i] = report_config->config->cc_report_type[i].cc_id; + } + cell_stats->cell = cells; + cell_stats->flags = report_config->config->cc_report_type[i].cc_report_flags; + } + stats_request_msg->cell_stats_request = cell_stats; + break; + case PROTOCOL__PRP_STATS_TYPE__PRST_UE_STATS: + stats_request_msg->body_case = PROTOCOL__PRP_STATS_REQUEST__BODY_UE_STATS_REQUEST; + Protocol__PrpUeStatsRequest *ue_stats; + ue_stats = malloc(sizeof(Protocol__PrpUeStatsRequest)); + if(ue_stats == NULL) + goto error; + protocol__prp_ue_stats_request__init(ue_stats); + ue_stats->n_rnti = report_config->config->nr_ue; + ue_stats->has_flags = 1; + if (ue_stats->n_rnti > 0) { + uint32_t *ues; + ues = (uint32_t *) malloc(sizeof(uint32_t)*ue_stats->n_rnti); + for (i = 0; i < ue_stats->n_rnti; i++) { + ues[i] = report_config->config->ue_report_type[i].ue_rnti; + } + ue_stats->rnti = ues; + ue_stats->flags = report_config->config->ue_report_type[i].ue_report_flags; + } + stats_request_msg->ue_stats_request = ue_stats; + break; + default: + goto error; + } + *msg = malloc(sizeof(Protocol__ProgranMessage)); + if(*msg == NULL) + goto error; + protocol__progran_message__init(*msg); + (*msg)->msg_case = PROTOCOL__PROGRAN_MESSAGE__MSG_STATS_REQUEST_MSG; + (*msg)->msg_dir = PROTOCOL__PROGRAN_DIRECTION__INITIATING_MESSAGE; + (*msg)->stats_request_msg = stats_request_msg; + return 0; + + error: + // TODO: Need to make proper error handling + if (header != NULL) + free(header); + if (stats_request_msg != NULL) + free(stats_request_msg); + if(*msg != NULL) + free(*msg); + //LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); + return -1; +} + +int enb_agent_mac_destroy_stats_request(Protocol__ProgranMessage *msg) { + if(msg->msg_case != PROTOCOL__PROGRAN_MESSAGE__MSG_STATS_REQUEST_MSG) + goto error; + free(msg->stats_request_msg->header); + if (msg->stats_request_msg->body_case == PROTOCOL__PRP_STATS_REQUEST__BODY_CELL_STATS_REQUEST) { + free(msg->stats_request_msg->cell_stats_request->cell); + } + if (msg->stats_request_msg->body_case == PROTOCOL__PRP_STATS_REQUEST__BODY_UE_STATS_REQUEST) { + free(msg->stats_request_msg->ue_stats_request->rnti); + } + free(msg->stats_request_msg); + free(msg); + return 0; + + error: + //LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); + return -1; +} + int enb_agent_mac_stats_reply(mid_t mod_id, xid_t xid, const report_config_t *report_config, diff --git a/openair2/ENB_APP/enb_agent_mac.h b/openair2/ENB_APP/enb_agent_mac.h index 569eb51e5e..871d6e5ae2 100644 --- a/openair2/ENB_APP/enb_agent_mac.h +++ b/openair2/ENB_APP/enb_agent_mac.h @@ -69,11 +69,24 @@ typedef struct { cc_report_type_t *cc_report_type; } report_config_t; +typedef struct { + uint8_t report_type; + uint8_t report_frequency; + uint16_t period; /*In number of subframes*/ + report_config_t *config; +} stats_request_config_t; + int enb_agent_mac_handle_stats(mid_t mod_id, const void *params, Protocol__ProgranMessage **msg); +int enb_agent_mac_stats_request(mid_t mod_id, xid_t xid, const stats_request_config_t *report_config, Protocol__ProgranMessage **msg); + +int enb_agent_mac_destroy_stats_request(Protocol__ProgranMessage *msg); + int enb_agent_mac_stats_reply(mid_t mod_id, xid_t xid, const report_config_t *report_config, Protocol__ProgranMessage **msg); int enb_agent_mac_destroy_stats_reply(Protocol__ProgranMessage *msg); + + #endif From 3e2adfbcbc8d2e51c364c3573a42def46b528199 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Fri, 8 Jan 2016 12:53:34 +0200 Subject: [PATCH 054/349] Fixed bug to allocate memory in the stack instead of dynamically for the timer search key --- openair2/ENB_APP/enb_agent_common.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/openair2/ENB_APP/enb_agent_common.c b/openair2/ENB_APP/enb_agent_common.c index 0417f4956e..1522cad07d 100644 --- a/openair2/ENB_APP/enb_agent_common.c +++ b/openair2/ENB_APP/enb_agent_common.c @@ -470,10 +470,11 @@ err_code_t enb_agent_destroy_timers(void){ struct enb_agent_timer_element_s * get_timer_entry(long timer_id) { - struct enb_agent_timer_element_s *search= calloc(1,sizeof(*search)); - search->timer_id = timer_id; + struct enb_agent_timer_element_s search; + memset(&search, 0, sizeof(struct enb_agent_timer_element_s)); + search.timer_id = timer_id; - return RB_FIND(enb_agent_map, &timer_instance.enb_agent_head, search); + return RB_FIND(enb_agent_map, &timer_instance.enb_agent_head, &search); } void enb_agent_sleep_until(struct timespec *ts, int delay) { From 2ef32ad9bc4683016d32906a228ec9bee9c3590e Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Fri, 8 Jan 2016 15:59:24 +0200 Subject: [PATCH 055/349] Added support for turning off periodical timer tasks --- openair2/ENB_APP/enb_agent.c | 13 ------ openair2/ENB_APP/enb_agent_common.c | 65 +++++++++++++++++++--------- openair2/ENB_APP/enb_agent_common.h | 10 +++-- openair2/ENB_APP/enb_agent_handler.c | 7 ++- openair2/ENB_APP/enb_agent_mac.c | 10 +---- 5 files changed, 59 insertions(+), 46 deletions(-) diff --git a/openair2/ENB_APP/enb_agent.c b/openair2/ENB_APP/enb_agent.c index dbefc60502..6fff535590 100644 --- a/openair2/ENB_APP/enb_agent.c +++ b/openair2/ENB_APP/enb_agent.c @@ -313,19 +313,6 @@ int enb_agent_start(mid_t mod_id, const Enb_properties_array_t* enb_properties){ return -1; } - - //#ifdef TEST_TIMER - long timer_id=0; - enb_agent_timer_args_t timer_args; - memset (&timer_args, 0, sizeof(enb_agent_timer_args_t)); - timer_args.mod_id = mod_id; - //timer_args.cc_actions= ENB_AGENT_ACTION_APPLY; - //timer_args.cc_report_flags = PROTOCOL__PRP_CELL_STATS_TYPE__PRCST_NOISE_INTERFERENCE; - //timer_args.ue_actions = ENB_AGENT_ACTION_SEND; - //timer_args.ue_report_flags = PROTOCOL__PRP_UE_STATS_TYPE__PRUST_BSR | PROTOCOL__PRP_UE_STATS_TYPE__PRUST_DL_CQI; - enb_agent_create_timer(1, 0, ENB_AGENT_DEFAULT, mod_id, ENB_AGENT_TIMER_TYPE_PERIODIC, enb_agent_timeout,(void*)&timer_args, &timer_id); - //#endif - //new_thread(send_thread, &shared_ctxt); //while (1) pause(); diff --git a/openair2/ENB_APP/enb_agent_common.c b/openair2/ENB_APP/enb_agent_common.c index 1522cad07d..8d9997e746 100644 --- a/openair2/ENB_APP/enb_agent_common.c +++ b/openair2/ENB_APP/enb_agent_common.c @@ -377,6 +377,7 @@ err_code_t enb_agent_create_timer(uint32_t interval_sec, agent_id_t agent_id, instance_t instance, uint32_t timer_type, + xid_t xid, enb_agent_timer_callback_t cb, void* timer_args, long *timer_id){ @@ -424,7 +425,8 @@ err_code_t enb_agent_create_timer(uint32_t interval_sec, e->instance = instance; e->state = ENB_AGENT_TIMER_STATE_ACTIVE; e->timer_id = *timer_id; - // e->timer_args = timer_args; + e->xid = xid; + e->timer_args = timer_args; e->cb = cb; /*element should be a real pointer*/ RB_INSERT(enb_agent_map, &timer_instance.enb_agent_head, e); @@ -440,7 +442,8 @@ err_code_t enb_agent_destroy_timer(long timer_id){ struct enb_agent_timer_element_s *e = get_timer_entry(timer_id); if (e != NULL ) { - RB_REMOVE(enb_agent_map, &timer_instance.enb_agent_head, &e); + RB_REMOVE(enb_agent_map, &timer_instance.enb_agent_head, e); + enb_agent_destroy_progran_message(e->timer_args->msg); free(e); } @@ -454,13 +457,35 @@ err_code_t enb_agent_destroy_timer(long timer_id){ return TIMER_REMOVED_FAILED ; } +err_code_t enb_agent_destroy_timer_by_task_id(xid_t xid) { + struct enb_agent_timer_element_s *e = NULL; + long timer_id; + RB_FOREACH(e, enb_agent_map, &timer_instance.enb_agent_head) { + if (e->xid == xid) { + timer_id = e->timer_id; + RB_REMOVE(enb_agent_map, &timer_instance.enb_agent_head, e); + enb_agent_destroy_progran_message(e->timer_args->msg); + free(e); + if (timer_remove(timer_id) < 0 ) { + goto error; + } + } + } + return 0; + + error: + LOG_E(ENB_AGENT, "timer can't be removed\n"); + return TIMER_REMOVED_FAILED ; +} + err_code_t enb_agent_destroy_timers(void){ struct enb_agent_timer_element_s *e = NULL; RB_FOREACH(e, enb_agent_map, &timer_instance.enb_agent_head) { RB_REMOVE(enb_agent_map, &timer_instance.enb_agent_head, e); - timer_remove(e->timer_id); + timer_remove(e->timer_id); + enb_agent_destroy_progran_message(e->timer_args->msg); free(e); } @@ -468,15 +493,6 @@ err_code_t enb_agent_destroy_timers(void){ } -struct enb_agent_timer_element_s * get_timer_entry(long timer_id) { - - struct enb_agent_timer_element_s search; - memset(&search, 0, sizeof(struct enb_agent_timer_element_s)); - search.timer_id = timer_id; - - return RB_FIND(enb_agent_map, &timer_instance.enb_agent_head, &search); -} - void enb_agent_sleep_until(struct timespec *ts, int delay) { ts->tv_nsec += delay; if(ts->tv_nsec >= 1000*1000*1000){ @@ -493,15 +509,15 @@ void enb_agent_sleep_until(struct timespec *ts, int delay) { } */ -/* -err_code_t enb_agent_stop_timer(uint32_t timer_id){ + +err_code_t enb_agent_stop_timer(long timer_id){ struct enb_agent_timer_element_s *e=NULL; - - RB_FOREACH(e, enb_agent_map, &enb_agent_head) { - if (e->timer_id == timer_id) - break; - } + struct enb_agent_timer_element_s search; + memset(&search, 0, sizeof(struct enb_agent_timer_element_s)); + search.timer_id = timer_id; + + e = RB_FIND(enb_agent_map, &timer_instance.enb_agent_head, &search); if (e != NULL ) { e->state = ENB_AGENT_TIMER_STATE_STOPPED; @@ -510,9 +526,18 @@ err_code_t enb_agent_stop_timer(uint32_t timer_id){ timer_remove(timer_id); return 0; - } +struct enb_agent_timer_element_s * get_timer_entry(long timer_id) { + + struct enb_agent_timer_element_s search; + memset(&search, 0, sizeof(struct enb_agent_timer_element_s)); + search.timer_id = timer_id; + + return RB_FIND(enb_agent_map, &timer_instance.enb_agent_head, &search); +} + +/* // this will change the timer_id err_code_t enb_agent_restart_timer(uint32_t *timer_id){ diff --git a/openair2/ENB_APP/enb_agent_common.h b/openair2/ENB_APP/enb_agent_common.h index 31d882d0c9..c2c57ca4ea 100644 --- a/openair2/ENB_APP/enb_agent_common.h +++ b/openair2/ENB_APP/enb_agent_common.h @@ -70,6 +70,8 @@ typedef int (*enb_agent_message_destruction_callback)( int enb_agent_serialize_message(Protocol__ProgranMessage *msg, void **buf, int *size); int enb_agent_deserialize_message(void *data, int size, Protocol__ProgranMessage **msg); +err_code_t enb_agent_destroy_progran_message(Protocol__ProgranMessage *msg); + int prp_create_header(xid_t xid, Protocol__PrpType type, Protocol__PrpHeader **header); int enb_agent_hello(mid_t mod_id, const void *params, Protocol__ProgranMessage **msg); @@ -189,9 +191,11 @@ typedef struct enb_agent_timer_element_s{ uint32_t interval_usec; long timer_id; /* Timer id returned by the timer API*/ + xid_t xid; /*The id of the task as received by the controller + message*/ enb_agent_timer_callback_t cb; - // void* timer_args; + enb_agent_timer_args_t *timer_args; } enb_agent_timer_element_t; @@ -206,12 +210,14 @@ err_code_t enb_agent_create_timer(uint32_t interval_sec, agent_id_t agent_id, instance_t instance, uint32_t timer_type, + xid_t xid, enb_agent_timer_callback_t cb, void* timer_args, long *timer_id); err_code_t enb_agent_destroy_timers(void); err_code_t enb_agent_destroy_timer(long timer_id); +err_code_t enb_agent_destroy_timer_by_task_id(xid_t xid); err_code_t enb_agent_stop_timer(long timer_id); @@ -219,8 +225,6 @@ err_code_t enb_agent_restart_timer(long *timer_id); struct enb_agent_timer_element_s * get_timer_entry(long timer_id); - - Protocol__ProgranMessage * enb_agent_process_timeout(long timer_id, void* timer_args); int enb_agent_compare_timer(struct enb_agent_timer_element_s *a, struct enb_agent_timer_element_s *b); diff --git a/openair2/ENB_APP/enb_agent_handler.c b/openair2/ENB_APP/enb_agent_handler.c index 2841f9b6e5..02092a84f8 100644 --- a/openair2/ENB_APP/enb_agent_handler.c +++ b/openair2/ENB_APP/enb_agent_handler.c @@ -54,9 +54,8 @@ enb_agent_message_destruction_callback message_destruction_callback[] = { enb_agent_destroy_hello, enb_agent_destroy_echo_request, enb_agent_destroy_echo_reply, - 0, /*No stats request message is created in the agent. No need for a callback*/ + enb_agent_mac_destroy_stats_request, enb_agent_mac_destroy_stats_reply, - }; static const char *enb_agent_direction2String[] = { @@ -170,3 +169,7 @@ Protocol__ProgranMessage* enb_agent_process_timeout(long timer_id, void* timer_a LOG_E(ENB_AGENT, "can't get the timer element\n"); return TIMER_ELEMENT_NOT_FOUND; } + +err_code_t enb_agent_destroy_progran_message(Protocol__ProgranMessage *msg) { + return ((*message_destruction_callback[msg->msg_case-1])(msg)); +} diff --git a/openair2/ENB_APP/enb_agent_mac.c b/openair2/ENB_APP/enb_agent_mac.c index 1a21db5e15..411480254f 100644 --- a/openair2/ENB_APP/enb_agent_mac.c +++ b/openair2/ENB_APP/enb_agent_mac.c @@ -71,18 +71,12 @@ int enb_agent_mac_handle_stats(mid_t mod_id, const void *params, Protocol__Progr switch(stats_req->body_case) { case PROTOCOL__PRP_STATS_REQUEST__BODY_COMPLETE_STATS_REQUEST: ; Protocol__PrpCompleteStatsRequest *comp_req = stats_req->complete_stats_request; - /* if (comp_req->report_frequency == PROTOCOL__PRP_STATS_REPORT_FREQ__PRSRF_PERIODICAL) { */ - /* //TODO: Must create a periodic report. Implement once the */ - /* // timer functionality is supported */ - /* *msg = NULL; */ - /* return 0; */ - /* } else */ if (comp_req->report_frequency == PROTOCOL__PRP_STATS_REPORT_FREQ__PRSRF_CONTINUOUS) { //TODO: Must create an event based report mechanism *msg = NULL; return 0; } else if (comp_req->report_frequency == PROTOCOL__PRP_STATS_REPORT_FREQ__PRSRF_OFF) { - //TODO: Must implement to deactivate the event based reporting + enb_agent_destroy_timer_by_task_id(xid); *msg = NULL; return 0; } else { //One-off or periodical reporting @@ -141,7 +135,7 @@ int enb_agent_mac_handle_stats(mid_t mod_id, const void *params, Protocol__Progr sec_interval = usec_interval/(1000*1000); usec_interval = usec_interval%(1000*1000); } - enb_agent_create_timer(sec_interval, usec_interval, ENB_AGENT_DEFAULT, enb_id, ENB_AGENT_TIMER_TYPE_PERIODIC, enb_agent_handle_timed_task,(void*) timer_args, &timer_id); + enb_agent_create_timer(sec_interval, usec_interval, ENB_AGENT_DEFAULT, enb_id, ENB_AGENT_TIMER_TYPE_PERIODIC, xid, enb_agent_handle_timed_task,(void*) timer_args, &timer_id); } } break; From a9a67824dd8c7f343bf25bed72710a2f8bc28df8 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Mon, 11 Jan 2016 14:58:31 +0200 Subject: [PATCH 056/349] Added API functions for eNB agent - technology interaction --- openair2/ENB_APP/enb_agent_mac.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/openair2/ENB_APP/enb_agent_mac.h b/openair2/ENB_APP/enb_agent_mac.h index 871d6e5ae2..11e981a51b 100644 --- a/openair2/ENB_APP/enb_agent_mac.h +++ b/openair2/ENB_APP/enb_agent_mac.h @@ -88,5 +88,19 @@ int enb_agent_mac_stats_reply(mid_t mod_id, xid_t xid, const report_config_t *re int enb_agent_mac_destroy_stats_reply(Protocol__ProgranMessage *msg); +/********************************** + * eNB agent - technology mac API + **********************************/ + +/*Set DCI for particular RNTI in defined subframe (UL/DL)*/ +int enb_agent_mac_dl_config(mid_t mod_id, Protocol__ProgranMessage *msg); + +int enb_agent_mac_ul_config(mid_t mod_id, Protocol__ProgranMessage *msg); + +/*Push controller configurations to the eNB for cells and UEs*/ +int enb_agent_set_cell_config(mid_t mod_id, Protocol__ProgranMessage *msg); + +int enb_agent_set_ue_config(mid_t mod_id, Protocol__ProgranMessage *msg); + #endif From 3ce2ba4e5d19cda16176981304d0b2f69cdb1300 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Tue, 12 Jan 2016 14:24:31 +0200 Subject: [PATCH 057/349] Added support for scheduling requests messages --- openair2/ENB_APP/MESSAGES/V2/progran.proto | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/openair2/ENB_APP/MESSAGES/V2/progran.proto b/openair2/ENB_APP/MESSAGES/V2/progran.proto index 995cd6861b..53718b87c4 100644 --- a/openair2/ENB_APP/MESSAGES/V2/progran.proto +++ b/openair2/ENB_APP/MESSAGES/V2/progran.proto @@ -12,6 +12,7 @@ message progran_message { prp_echo_reply echo_reply_msg = 3; prp_stats_request stats_request_msg = 4; prp_stats_reply stats_reply_msg = 5; + prp_ul_sr_info ul_sr_info_msg = 6; } } @@ -82,6 +83,15 @@ message prp_stats_reply { repeated prp_cell_stats_report cell_report = 3; } +// +// Asynchronous messages +// + +message prp_ul_sr_info { + optional prp_header header = 1; + optional uint32 sfn_sf = 2; + repeated uint32 rnti = 3; +} // Extensions of the echo request and reply // messages for carrying a latency value in ms From a8dabcefea873ab7f7374b292d8a55516af29971 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Tue, 12 Jan 2016 17:58:09 +0200 Subject: [PATCH 058/349] Added support for UL SR info type in the header of progRAN messages --- openair2/ENB_APP/MESSAGES/V2/header.proto | 3 +++ 1 file changed, 3 insertions(+) diff --git a/openair2/ENB_APP/MESSAGES/V2/header.proto b/openair2/ENB_APP/MESSAGES/V2/header.proto index b2319c8220..5670b9bd77 100644 --- a/openair2/ENB_APP/MESSAGES/V2/header.proto +++ b/openair2/ENB_APP/MESSAGES/V2/header.proto @@ -15,5 +15,8 @@ enum prp_type { // Statistics and measurement messages PRPT_STATS_REQUEST = 3; PRPT_STATS_REPLY = 4; + + //Asynchronous messages + PRPT_UL_SR_INFO = 5; } From 694a5bb1b5a03339143ced6bee734ce544ef4dd2 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Tue, 12 Jan 2016 18:02:07 +0200 Subject: [PATCH 059/349] Changed the function signature for handling the packing of protocol messages --- openair2/ENB_APP/enb_agent.c | 6 ++++-- openair2/ENB_APP/enb_agent_common.h | 13 ++++++++----- openair2/ENB_APP/enb_agent_handler.c | 3 ++- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/openair2/ENB_APP/enb_agent.c b/openair2/ENB_APP/enb_agent.c index 6fff535590..d3e74348f8 100644 --- a/openair2/ENB_APP/enb_agent.c +++ b/openair2/ENB_APP/enb_agent.c @@ -38,6 +38,8 @@ #include "log.h" #include "enb_agent.h" +#include "enb_agent_extern.h" + #include "assertions.h" //#define TEST_TIMER @@ -95,7 +97,7 @@ void *enb_agent_task(void *args){ case TIMER_HAS_EXPIRED: msg = enb_agent_process_timeout(msg_p->ittiMsg.timer_has_expired.timer_id, msg_p->ittiMsg.timer_has_expired.arg); if (msg != NULL){ - data=enb_agent_send_message(msg,&size); + data=enb_agent_pack_message(msg,&size); if (message_put(d->tx_mq, data, size, priority)){ err_code = PROTOCOL__PROGRAN_ERR__MSG_ENQUEUING; goto error; @@ -182,7 +184,7 @@ void *receive_thread(void *args) { // check if there is something to send back to the controller if (msg != NULL){ - data=enb_agent_send_message(msg,&size); + data=enb_agent_pack_message(msg,&size); if (message_put(d->tx_mq, data, size, priority)){ err_code = PROTOCOL__PROGRAN_ERR__MSG_ENQUEUING; diff --git a/openair2/ENB_APP/enb_agent_common.h b/openair2/ENB_APP/enb_agent_common.h index c2c57ca4ea..f4add1ae2e 100644 --- a/openair2/ENB_APP/enb_agent_common.h +++ b/openair2/ENB_APP/enb_agent_common.h @@ -67,9 +67,17 @@ typedef int (*enb_agent_message_destruction_callback)( Protocol__ProgranMessage *msg ); +/********************************** + * progRAN protocol messages helper + * functions and generic handlers + **********************************/ + int enb_agent_serialize_message(Protocol__ProgranMessage *msg, void **buf, int *size); int enb_agent_deserialize_message(void *data, int size, Protocol__ProgranMessage **msg); +void * enb_agent_pack_message(Protocol__ProgranMessage *msg, + uint32_t * size); + err_code_t enb_agent_destroy_progran_message(Protocol__ProgranMessage *msg); int prp_create_header(xid_t xid, Protocol__PrpType type, Protocol__PrpHeader **header); @@ -90,11 +98,6 @@ Protocol__ProgranMessage* enb_agent_handle_message (mid_t mod_id, Protocol__ProgranMessage *enb_agent_handle_timed_task(void *args); -void * enb_agent_send_message(Protocol__ProgranMessage *msg, - uint32_t * size); - - - diff --git a/openair2/ENB_APP/enb_agent_handler.c b/openair2/ENB_APP/enb_agent_handler.c index 02092a84f8..0f5146fe6d 100644 --- a/openair2/ENB_APP/enb_agent_handler.c +++ b/openair2/ENB_APP/enb_agent_handler.c @@ -56,6 +56,7 @@ enb_agent_message_destruction_callback message_destruction_callback[] = { enb_agent_destroy_echo_reply, enb_agent_mac_destroy_stats_request, enb_agent_mac_destroy_stats_reply, + enb_agent_mac_destroy_sr_info, }; static const char *enb_agent_direction2String[] = { @@ -108,7 +109,7 @@ error: -void * enb_agent_send_message(Protocol__ProgranMessage *msg, +void * enb_agent_pack_message(Protocol__ProgranMessage *msg, uint32_t * size){ void * buffer; From 22d0f60e126b359aa348a062f53a5fcdc0f50bae Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Tue, 12 Jan 2016 18:08:57 +0200 Subject: [PATCH 060/349] Added support for creation of SR protocol messages and defined initial MAC-Agent interface --- openair2/ENB_APP/enb_agent_extern.h | 50 +++++++++++ openair2/ENB_APP/enb_agent_mac.c | 121 ++++++++++++++++++++++++++ openair2/ENB_APP/enb_agent_mac.h | 21 +++-- openair2/ENB_APP/enb_agent_mac_defs.h | 54 ++++++++++++ 4 files changed, 238 insertions(+), 8 deletions(-) create mode 100644 openair2/ENB_APP/enb_agent_extern.h create mode 100644 openair2/ENB_APP/enb_agent_mac_defs.h diff --git a/openair2/ENB_APP/enb_agent_extern.h b/openair2/ENB_APP/enb_agent_extern.h new file mode 100644 index 0000000000..2cd072f25a --- /dev/null +++ b/openair2/ENB_APP/enb_agent_extern.h @@ -0,0 +1,50 @@ +/******************************************************************************* + OpenAirInterface + Copyright(c) 1999 - 2016 Eurecom + + OpenAirInterface is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + + OpenAirInterface is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with OpenAirInterface.The full GNU General Public License is + included in this distribution in the file called "COPYING". If not, + see . + + Contact Information + OpenAirInterface Admin: openair_admin@eurecom.fr + OpenAirInterface Tech : openair_tech@eurecom.fr + OpenAirInterface Dev : openair4g-devel@lists.eurecom.fr + + Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. + + *******************************************************************************/ + +/*! \file ENB_APP/extern.h + * \brief enb agent - mac interface primitives + * \author Xenofon Foukas + * \date 2016 + * \version 0.1 + * \mail x.foukas@sms.ed.ac.uk + */ + +#ifndef __ENB_AGENT_EXTERN_H__ +#define __ENB_AGENT_EXTERN_H__ + +#include "enb_agent_defs.h" +#include "enb_agent_mac_defs.h" + +extern msg_context_t shared_ctxt[NUM_MAX_ENB_AGENT]; + +extern AGENT_MAC_xface *agent_mac_xface; + +extern unsigned int mac_agent_registered[NUM_MAX_ENB_AGENT]; + +#endif diff --git a/openair2/ENB_APP/enb_agent_mac.c b/openair2/ENB_APP/enb_agent_mac.c index 411480254f..36b7788d23 100644 --- a/openair2/ENB_APP/enb_agent_mac.c +++ b/openair2/ENB_APP/enb_agent_mac.c @@ -760,3 +760,124 @@ int enb_agent_mac_destroy_stats_reply(Protocol__ProgranMessage *msg) { //LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); return -1; } + +int enb_agent_mac_sr_info(mid_t mod_id, const void *params, Protocol__ProgranMessage **msg) { + Protocol__PrpHeader *header; + int i; + const int xid = *((int *)params); + if (prp_create_header(xid, PROTOCOL__PRP_TYPE__PRPT_UL_SR_INFO, &header) != 0) + goto error; + + Protocol__PrpUlSrInfo *ul_sr_info_msg; + ul_sr_info_msg = malloc(sizeof(Protocol__PrpUlSrInfo)); + if (ul_sr_info_msg == NULL) { + goto error; + } + protocol__prp_ul_sr_info__init(ul_sr_info_msg); + + ul_sr_info_msg->header = header; + ul_sr_info_msg->has_sfn_sf = 1; + ul_sr_info_msg->sfn_sf = get_sfn_sf(mod_id); + /*TODO: Set the number of UEs that sent an SR */ + ul_sr_info_msg->n_rnti = 1; + ul_sr_info_msg->rnti = (uint32_t *) malloc(ul_sr_info_msg->n_rnti * sizeof(uint32_t)); + + if(ul_sr_info_msg->rnti == NULL) { + goto error; + } + /*TODO:Set the rnti of the UEs that sent an SR */ + for (i = 0; i < ul_sr_info_msg->n_rnti; i++) { + ul_sr_info_msg->rnti[i] = 1; + } + + *msg = malloc(sizeof(Protocol__ProgranMessage)); + if(*msg == NULL) + goto error; + protocol__progran_message__init(*msg); + (*msg)->msg_case = PROTOCOL__PROGRAN_MESSAGE__MSG_UL_SR_INFO_MSG; + (*msg)->msg_dir = PROTOCOL__PROGRAN_DIRECTION__INITIATING_MESSAGE; + (*msg)->ul_sr_info_msg = ul_sr_info_msg; + return 0; + + error: + // TODO: Need to make proper error handling + if (header != NULL) + free(header); + if (ul_sr_info_msg != NULL) { + free(ul_sr_info_msg->rnti); + free(ul_sr_info_msg); + } + if(*msg != NULL) + free(*msg); + //LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); + return -1; +} + +int enb_agent_mac_destroy_sr_info(Protocol__ProgranMessage *msg) { + if(msg->msg_case != PROTOCOL__PROGRAN_MESSAGE__MSG_UL_SR_INFO_MSG) + goto error; + + free(msg->ul_sr_info_msg->header); + free(msg->ul_sr_info_msg->rnti); + free(msg->ul_sr_info_msg); + free(msg); + return 0; + + error: + //LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); + return -1; +} + +void enb_agent_send_sr_info(mid_t mod_id, msg_context_t *context) { + int size; + Protocol__ProgranMessage *msg; + void *data; + int priority; + err_code_t err_code; + + /*TODO: Must use a proper xid*/ + int xid = 1; + err_code = enb_agent_mac_sr_info(mod_id, (void *) &xid, &msg); + if (err_code < 0) { + goto error; + } + + if (msg != NULL){ + data=enb_agent_pack_message(msg, &size); + + if (message_put(context->tx_mq, data, size, priority)){ + err_code = PROTOCOL__PROGRAN_ERR__MSG_ENQUEUING; + goto error; + } + LOG_D(ENB_AGENT,"sent message with size %d\n", size); + } + error: + LOG_D(ENB_AGENT, "Could not send sr message\n"); +} + +int enb_agent_register_mac_xface(mid_t mod_id, AGENT_MAC_xface *xface) { + if (!mac_agent_registered[mod_id]) { + LOG_E(MAC, "MAC agent for eNB %d is already registered\n", mod_id); + return -1; + } + + xface->agent_ctxt = &shared_ctxt[mod_id]; + xface->enb_agent_send_sr_info = enb_agent_send_sr_info; + + mac_agent_registered[mod_id] = 1; + return 1; +} + +int enb_agent_unregister_mac_xface(mid_t mod_id, AGENT_MAC_xface *xface) { + + if(mac_agent_registered[mod_id]) { + LOG_E(MAC, "MAC agent for eNB %d is already registered\n", mod_id); + return -1; + } + + xface->agent_ctxt = NULL; + xface->enb_agent_send_sr_info = NULL; + + mac_agent_registered[mod_id] = NULL; + return 1; +} diff --git a/openair2/ENB_APP/enb_agent_mac.h b/openair2/ENB_APP/enb_agent_mac.h index 11e981a51b..7945082410 100644 --- a/openair2/ENB_APP/enb_agent_mac.h +++ b/openair2/ENB_APP/enb_agent_mac.h @@ -43,7 +43,10 @@ #include "stats_common.pb-c.h" #include "enb_agent_common.h" +#include "enb_agent_extern.h" +/*Flags showing if a mac agent has already been registered*/ +unsigned int mac_agent_registered[NUM_MAX_ENB_AGENT]; /* These types will be used to give instructions for the type of stats reports @@ -87,20 +90,22 @@ int enb_agent_mac_stats_reply(mid_t mod_id, xid_t xid, const report_config_t *re int enb_agent_mac_destroy_stats_reply(Protocol__ProgranMessage *msg); +int enb_agent_mac_sr_info(mid_t mod_id, const void *params, Protocol__ProgranMessage **msg); + +int enb_agent_mac_destroy_sr_info(Protocol__ProgranMessage *msg); + /********************************** * eNB agent - technology mac API **********************************/ -/*Set DCI for particular RNTI in defined subframe (UL/DL)*/ -int enb_agent_mac_dl_config(mid_t mod_id, Protocol__ProgranMessage *msg); +/*Inform controller about received scheduling requests during a subframe*/ +void enb_agent_send_sr_info(mid_t mod_id, msg_context_t *context); -int enb_agent_mac_ul_config(mid_t mod_id, Protocol__ProgranMessage *msg); - -/*Push controller configurations to the eNB for cells and UEs*/ -int enb_agent_set_cell_config(mid_t mod_id, Protocol__ProgranMessage *msg); - -int enb_agent_set_ue_config(mid_t mod_id, Protocol__ProgranMessage *msg); +/*Register technology specific interface callbacks*/ +int enb_agent_register_mac_xface(mid_t mod_id, AGENT_MAC_xface *xface); +/*Unregister technology specific callbacks*/ +int enb_agent_unregister_mac_xface(mid_t mod_id, AGENT_MAC_xface*xface); #endif diff --git a/openair2/ENB_APP/enb_agent_mac_defs.h b/openair2/ENB_APP/enb_agent_mac_defs.h new file mode 100644 index 0000000000..28a424706b --- /dev/null +++ b/openair2/ENB_APP/enb_agent_mac_defs.h @@ -0,0 +1,54 @@ +/******************************************************************************* + OpenAirInterface + Copyright(c) 1999 - 2016 Eurecom + + OpenAirInterface is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + + OpenAirInterface is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with OpenAirInterface.The full GNU General Public License is + included in this distribution in the file called "COPYING". If not, + see . + + Contact Information + OpenAirInterface Admin: openair_admin@eurecom.fr + OpenAirInterface Tech : openair_tech@eurecom.fr + OpenAirInterface Dev : openair4g-devel@lists.eurecom.fr + + Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. + + *******************************************************************************/ + +/*! \file enb_agent_mac_defs.h + * \brief enb agent - mac interface primitives + * \author Xenofon Foukas + * \date 2016 + * \version 0.1 + * \mail x.foukas@sms.ed.ac.uk + */ + +#ifndef __ENB_AGENT_MAC_PRIMITIVES_H__ +#define __ENB_AGENT_MAC_PRIMITIVES_H__ + +#include "enb_agent_defs.h" + +/* ENB AGENT-MAC Interface */ +typedef struct { + msg_context_t *agent_ctxt; + + /// Inform the controller about the scheduling requests received during the subframe + void (*enb_agent_send_sr_info)(mid_t mod_id, msg_context_t *context); + + /*TODO: Fill in with the rest of the MAC layer technology specific callbacks (UL/DL scheduling, RACH info etc)*/ + +} AGENT_MAC_xface; + +#endif From dbcf482f07284a547400b835d37e5cd8256c1c44 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Thu, 14 Jan 2016 17:46:06 +0200 Subject: [PATCH 061/349] Added eNB agent abstract network interface support --- cmake_targets/CMakeLists.txt | 1 + openair2/ENB_APP/enb_agent_net_comm.c | 196 ++++++++++++++++++++++++++ openair2/ENB_APP/enb_agent_net_comm.h | 90 ++++++++++++ 3 files changed, 287 insertions(+) create mode 100644 openair2/ENB_APP/enb_agent_net_comm.c create mode 100644 openair2/ENB_APP/enb_agent_net_comm.h diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index 0777e1f3a0..8cd37613fa 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -747,6 +747,7 @@ if (ENB_AGENT_SB_IF) ${OPENAIR2_DIR}/ENB_APP/enb_agent_mac.c ${OPENAIR2_DIR}/ENB_APP/enb_agent.c ${OPENAIR2_DIR}/ENB_APP/enb_agent_task_manager.c + ${OPENAIR2_DIR}/ENB_APP/enb_agent_net_comm.c ) set(ENB_AGENT_LIB ENB_AGENT) #include_directories(${OPENAIR2_DIR}/ENB_APP) diff --git a/openair2/ENB_APP/enb_agent_net_comm.c b/openair2/ENB_APP/enb_agent_net_comm.c new file mode 100644 index 0000000000..096779f261 --- /dev/null +++ b/openair2/ENB_APP/enb_agent_net_comm.c @@ -0,0 +1,196 @@ +/******************************************************************************* + OpenAirInterface + Copyright(c) 1999 - 2016 Eurecom + + OpenAirInterface is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + + OpenAirInterface is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with OpenAirInterface.The full GNU General Public License is + included in this distribution in the file called "COPYING". If not, + see . + + Contact Information + OpenAirInterface Admin: openair_admin@eurecom.fr + OpenAirInterface Tech : openair_tech@eurecom.fr + OpenAirInterface Dev : openair4g-devel@lists.eurecom.fr + + Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. + + *******************************************************************************/ + +/*! \file enb_agent_net_comm.c + * \brief enb agent network interface abstraction + * \author Xenofon Foukas + * \date 2016 + * \version 0.1 + */ + +#include "enb_agent_net_comm.h" +#include "log.h" + +enb_agent_channel_t *agent_channel[ENB_AGENT_MAX]; +enb_agent_channel_instance_t channel_instance; +int enb_agent_channel_id = 0; + +int enb_agent_msg_send(void *data, int size, int priority, agent_id_t agent_id) { + /*Check if agent id is valid*/ + if (agent_id >= ENB_AGENT_MAX || agent_id < 0) { + goto error; + } + enb_agent_channel_t *channel; + channel = agent_channel[agent_id]; + + /*Check if agent has a channel registered*/ + if (channel == NULL) { + goto error; + } + + return channel->msg_send(data, size, priority, channel->channel_info); + + error: + LOG_E(ENB_AGENT, "No channel registered for agent with id %d\n", agent_id); + return -1; +} + +int enb_agent_msg_recv(void **data, int *size, int *priority, agent_id_t agent_id) { + /*Check if agent id is valid*/ + if (agent_id >= ENB_AGENT_MAX || agent_id < 0) { + goto error; + } + enb_agent_channel_t *channel; + channel = agent_channel[agent_id]; + + /*Check if agent has a channel registered*/ + if (channel == NULL) { + goto error; + } + + return channel->msg_recv(data, size, priority, channel->channel_info); + + error: + LOG_E(ENB_AGENT, "No channel registered for agent with id %d\n", agent_id); + return -1; +} + +int enb_agent_register_channel(enb_agent_channel_t *channel, agent_id_t agent_id) { + int i; + + if (channel == NULL) { + return -1; + } + + if (agent_id == ENB_AGENT_MAX) { + for (i = 0; i < ENB_AGENT_MAX; i++) { + agent_channel[i] = channel; + } + } else { + agent_channel[agent_id] = channel; + } + return 0; +} + +void enb_agent_unregister_channel(agent_id_t agent_id) { + int i; + + if (agent_id == ENB_AGENT_MAX) { + for (i = 0; i < ENB_AGENT_MAX; i++) { + agent_channel[i] = NULL; + } + } else { + agent_channel[agent_id] = NULL; + } +} + +int enb_agent_create_channel(void *channel_info, + int (*msg_send)(void *data, int size, int priority, void *channel_info), + int (*msg_recv)(void **data, int *size, int *priority, void *channel_info), + void (*release)(enb_agent_channel_t *channel)) { + + int channel_id = ++enb_agent_channel_id; + enb_agent_channel_t *channel = (enb_agent_channel_t *) malloc(sizeof(enb_agent_channel_t)); + channel->channel_id = channel_id; + channel->channel_info = channel_info; + channel->msg_send = msg_send; + channel->msg_recv = msg_recv; + channel->release = release; + + /*element should be a real pointer*/ + RB_INSERT(enb_agent_channel_map, &channel_instance.enb_agent_head, channel); + + LOG_I(ENB_AGENT,"Created a new channel with id 0x%lx\n", channel->channel_id); + + return channel_id; +} + +int enb_agent_destroy_channel(int channel_id) { + int i; + + /*Check to see if channel exists*/ + struct enb_agent_channel_s *e = NULL; + struct enb_agent_channel_s search; + memset(&search, 0, sizeof(struct enb_agent_channel_s)); + + e = RB_FIND(enb_agent_channel_map, &channel_instance.enb_agent_head, &search); + + if (e == NULL) { + return -1; + } + + /*Unregister the channel from all agents*/ + for (i = 0; i < ENB_AGENT_MAX; i++) { + if (agent_channel[i] != NULL) { + if (agent_channel[i]->channel_id == e->channel_id) { + agent_channel[i] == NULL; + } + } + } + + /*Remove the channel from the tree and free memory*/ + RB_REMOVE(enb_agent_channel_map, &channel_instance.enb_agent_head, e); + e->release(e); + free(e); + + return 0; +} + +err_code_t enb_agent_init_channel_container(void) { + int i; + LOG_I(ENB_AGENT, "init RB tree for channel container\n"); + + RB_INIT(&channel_instance.enb_agent_head); + + for (i = 0; i < ENB_AGENT_MAX; i++) { + agent_channel[i] == NULL; + } + + return 0; +} + +RB_GENERATE(enb_agent_channel_map,enb_agent_channel_s, entry, enb_agent_compare_channel); + +int enb_agent_compare_channel(struct enb_agent_channel_s *a, struct enb_agent_channel_s *b) { + if (a->channel_id < b->channel_id) return -1; + if (a->channel_id > b->channel_id) return 1; + + // equal timers + return 0; +} + +enb_agent_channel_t * get_channel(int channel_id) { + + struct enb_agent_channel_s search; + memset(&search, 0, sizeof(struct enb_agent_channel_s)); + search.channel_id = channel_id; + + return RB_FIND(enb_agent_channel_map, &channel_instance.enb_agent_head, &search); + +} diff --git a/openair2/ENB_APP/enb_agent_net_comm.h b/openair2/ENB_APP/enb_agent_net_comm.h new file mode 100644 index 0000000000..50237379d4 --- /dev/null +++ b/openair2/ENB_APP/enb_agent_net_comm.h @@ -0,0 +1,90 @@ +/******************************************************************************* + OpenAirInterface + Copyright(c) 1999 - 2016 Eurecom + + OpenAirInterface is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + + OpenAirInterface is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with OpenAirInterface.The full GNU General Public License is + included in this distribution in the file called "COPYING". If not, + see . + + Contact Information + OpenAirInterface Admin: openair_admin@eurecom.fr + OpenAirInterface Tech : openair_tech@eurecom.fr + OpenAirInterface Dev : openair4g-devel@lists.eurecom.fr + + Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. + + *******************************************************************************/ + +/*! \file enb_agent_net_comm.h + * \brief enb agent network interface abstraction + * \autho Xenofon Foukas + * \date 2016 + * \version 0.1 + */ +#ifndef ENB_AGENT_NET_COMM_H_ +#define ENB_AGENT_NET_COMM_H_ + +#include "enb_agent_defs.h" + +#include "tree.h" + +/*Channel related information used for Tx/Rx of protocol messages*/ +typedef struct enb_agent_channel_s { + RB_ENTRY(enb_agent_channel_s) entry; +int channel_id; +void *channel_info; +/*Callbacks for channel message Tx and Rx*/ +int (*msg_send)(void *data, int size, int priority, void *channel_info); +int (*msg_recv)(void **data, int *size, int *priority, void *channel_info); +void (*release)(struct enb_agent_channel_s *channel); +} enb_agent_channel_t; + +typedef struct enb_agent_channel_instance_s{ + RB_HEAD(enb_agent_channel_map, enb_agent_channel_s) enb_agent_head; +} enb_agent_channel_instance_t; + +/*Send and receive messages using the channel registered for a specific agent*/ +int enb_agent_msg_send(void *data, int size, int priority, agent_id_t agent_id); + +int enb_agent_msg_recv(void **data, int *size, int *priority, agent_id_t agent_id); + +/*Register a channel to an agent. Use ENB_AGENT_MAX to register the + *same channel to all agents*/ +int enb_agent_register_channel(enb_agent_channel_t *channel, agent_id_t agent_id); + +/*Unregister the current channel of an agent. Use ENB_AGENT_MAX to unregister all channels*/ +void enb_agent_unregister_channel(agent_id_t agent_id); + +/*Create a new channel. Returns the id of the new channel or negative number otherwise*/ +int enb_agent_create_channel(void *channel_info, + int (*msg_send)(void *data, int size, int priority, void *channel_info), + int (*msg_recv)(void **data, int *size, int *priority, void *channel_info), + void (*release)(enb_agent_channel_t *channel)); + +/*Unregister a channel from all agents and destroy it. Returns 0 in case of success*/ +int enb_agent_destroy_channel(int channel_id); + +/*Return an agent communication channel based on its id*/ +enb_agent_channel_t * get_channel(int channel_id); + +/*Should be called before performing any channel operations*/ +err_code_t enb_agent_init_channel_container(void); + +int enb_agent_compare_channel(struct enb_agent_channel_s *a, struct enb_agent_channel_s *b); + +/* RB_PROTOTYPE is for .h files */ +RB_PROTOTYPE(enb_agent_channel_map, enb_agent_channel_s, entry, enb_agent_compare_channel); + +#endif /*ENB_AGENT_COMM_H_*/ From e6762ffe1fbade7087bea5031b09814f97a94e13 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Thu, 14 Jan 2016 19:10:27 +0200 Subject: [PATCH 062/349] Added support for multiple eNBs in an emulation environment --- openair2/ENB_APP/enb_agent_net_comm.c | 44 +++++++++++++++------------ openair2/ENB_APP/enb_agent_net_comm.h | 8 ++--- 2 files changed, 28 insertions(+), 24 deletions(-) diff --git a/openair2/ENB_APP/enb_agent_net_comm.c b/openair2/ENB_APP/enb_agent_net_comm.c index 096779f261..5c4544ad63 100644 --- a/openair2/ENB_APP/enb_agent_net_comm.c +++ b/openair2/ENB_APP/enb_agent_net_comm.c @@ -37,17 +37,17 @@ #include "enb_agent_net_comm.h" #include "log.h" -enb_agent_channel_t *agent_channel[ENB_AGENT_MAX]; +enb_agent_channel_t *agent_channel[NUM_MAX_ENB_AGENT][ENB_AGENT_MAX]; enb_agent_channel_instance_t channel_instance; int enb_agent_channel_id = 0; -int enb_agent_msg_send(void *data, int size, int priority, agent_id_t agent_id) { +int enb_agent_msg_send(mid_t mod_id, agent_id_t agent_id, void *data, int size, int priority) { /*Check if agent id is valid*/ if (agent_id >= ENB_AGENT_MAX || agent_id < 0) { goto error; } enb_agent_channel_t *channel; - channel = agent_channel[agent_id]; + channel = agent_channel[mod_id][agent_id]; /*Check if agent has a channel registered*/ if (channel == NULL) { @@ -61,13 +61,13 @@ int enb_agent_msg_send(void *data, int size, int priority, agent_id_t agent_id) return -1; } -int enb_agent_msg_recv(void **data, int *size, int *priority, agent_id_t agent_id) { +int enb_agent_msg_recv(mid_t mod_id, agent_id_t agent_id, void **data, int *size, int *priority) { /*Check if agent id is valid*/ if (agent_id >= ENB_AGENT_MAX || agent_id < 0) { goto error; } enb_agent_channel_t *channel; - channel = agent_channel[agent_id]; + channel = agent_channel[mod_id][agent_id]; /*Check if agent has a channel registered*/ if (channel == NULL) { @@ -81,7 +81,7 @@ int enb_agent_msg_recv(void **data, int *size, int *priority, agent_id_t agent_i return -1; } -int enb_agent_register_channel(enb_agent_channel_t *channel, agent_id_t agent_id) { +int enb_agent_register_channel(mid_t mod_id, enb_agent_channel_t *channel, agent_id_t agent_id) { int i; if (channel == NULL) { @@ -90,23 +90,23 @@ int enb_agent_register_channel(enb_agent_channel_t *channel, agent_id_t agent_id if (agent_id == ENB_AGENT_MAX) { for (i = 0; i < ENB_AGENT_MAX; i++) { - agent_channel[i] = channel; + agent_channel[mod_id][i] = channel; } } else { - agent_channel[agent_id] = channel; + agent_channel[mod_id][agent_id] = channel; } return 0; } -void enb_agent_unregister_channel(agent_id_t agent_id) { +void enb_agent_unregister_channel(mid_t mod_id, agent_id_t agent_id) { int i; if (agent_id == ENB_AGENT_MAX) { for (i = 0; i < ENB_AGENT_MAX; i++) { - agent_channel[i] = NULL; + agent_channel[mod_id][i] = NULL; } } else { - agent_channel[agent_id] = NULL; + agent_channel[mod_id][agent_id] = NULL; } } @@ -132,7 +132,7 @@ int enb_agent_create_channel(void *channel_info, } int enb_agent_destroy_channel(int channel_id) { - int i; + int i, j; /*Check to see if channel exists*/ struct enb_agent_channel_s *e = NULL; @@ -146,10 +146,12 @@ int enb_agent_destroy_channel(int channel_id) { } /*Unregister the channel from all agents*/ - for (i = 0; i < ENB_AGENT_MAX; i++) { - if (agent_channel[i] != NULL) { - if (agent_channel[i]->channel_id == e->channel_id) { - agent_channel[i] == NULL; + for (i = 0; i < NUM_MAX_ENB_AGENT; i++) { + for (j = 0; j < ENB_AGENT_MAX; j++) { + if (agent_channel[i][j] != NULL) { + if (agent_channel[i][j]->channel_id == e->channel_id) { + agent_channel[i][j] == NULL; + } } } } @@ -163,13 +165,15 @@ int enb_agent_destroy_channel(int channel_id) { } err_code_t enb_agent_init_channel_container(void) { - int i; + int i, j; LOG_I(ENB_AGENT, "init RB tree for channel container\n"); RB_INIT(&channel_instance.enb_agent_head); - - for (i = 0; i < ENB_AGENT_MAX; i++) { - agent_channel[i] == NULL; + + for (i = 0; i < NUM_MAX_ENB_AGENT; i++) { + for (j = 0; j < ENB_AGENT_MAX; j++) { + agent_channel[i][j] == NULL; + } } return 0; diff --git a/openair2/ENB_APP/enb_agent_net_comm.h b/openair2/ENB_APP/enb_agent_net_comm.h index 50237379d4..ab42bdc34f 100644 --- a/openair2/ENB_APP/enb_agent_net_comm.h +++ b/openair2/ENB_APP/enb_agent_net_comm.h @@ -56,16 +56,16 @@ typedef struct enb_agent_channel_instance_s{ } enb_agent_channel_instance_t; /*Send and receive messages using the channel registered for a specific agent*/ -int enb_agent_msg_send(void *data, int size, int priority, agent_id_t agent_id); +int enb_agent_msg_send(mid_t mod_id, agent_id_t agent_id, void *data, int size, int priority); -int enb_agent_msg_recv(void **data, int *size, int *priority, agent_id_t agent_id); +int enb_agent_msg_recv(mid_t mod_id, agent_id_t agent_id, void **data, int *size, int *priority); /*Register a channel to an agent. Use ENB_AGENT_MAX to register the *same channel to all agents*/ -int enb_agent_register_channel(enb_agent_channel_t *channel, agent_id_t agent_id); +int enb_agent_register_channel(mid_t mod_id, enb_agent_channel_t *channel, agent_id_t agent_id); /*Unregister the current channel of an agent. Use ENB_AGENT_MAX to unregister all channels*/ -void enb_agent_unregister_channel(agent_id_t agent_id); +void enb_agent_unregister_channel(mid_t mod_id, agent_id_t agent_id); /*Create a new channel. Returns the id of the new channel or negative number otherwise*/ int enb_agent_create_channel(void *channel_info, From 8fde111b93ba7c6736758300ef4df4d8ba8e18cb Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Thu, 14 Jan 2016 19:49:02 +0200 Subject: [PATCH 063/349] Channel implementation for async interface --- cmake_targets/CMakeLists.txt | 1 + openair2/ENB_APP/enb_agent_async.c | 107 +++++++++++++++++++++++++++++ openair2/ENB_APP/enb_agent_async.h | 51 ++++++++++++++ 3 files changed, 159 insertions(+) create mode 100644 openair2/ENB_APP/enb_agent_async.c create mode 100644 openair2/ENB_APP/enb_agent_async.h diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index 8cd37613fa..56ee7b71d3 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -748,6 +748,7 @@ if (ENB_AGENT_SB_IF) ${OPENAIR2_DIR}/ENB_APP/enb_agent.c ${OPENAIR2_DIR}/ENB_APP/enb_agent_task_manager.c ${OPENAIR2_DIR}/ENB_APP/enb_agent_net_comm.c + ${OPENAIR2_DIR}/ENB_APP/enb_agent_async.c ) set(ENB_AGENT_LIB ENB_AGENT) #include_directories(${OPENAIR2_DIR}/ENB_APP) diff --git a/openair2/ENB_APP/enb_agent_async.c b/openair2/ENB_APP/enb_agent_async.c new file mode 100644 index 0000000000..962e1a81ed --- /dev/null +++ b/openair2/ENB_APP/enb_agent_async.c @@ -0,0 +1,107 @@ +/******************************************************************************* + OpenAirInterface + Copyright(c) 1999 - 2014 Eurecom + + OpenAirInterface is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + + OpenAirInterface is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with OpenAirInterface.The full GNU General Public License is + included in this distribution in the file called "COPYING". If not, + see . + + Contact Information + OpenAirInterface Admin: openair_admin@eurecom.fr + OpenAirInterface Tech : openair_tech@eurecom.fr + OpenAirInterface Dev : openair4g-devel@lists.eurecom.fr + + Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. + + *******************************************************************************/ + +/*! \file enb_agent_async.c + * \brief channel implementation for async interface + * \author Xenofon Foukas + * \date 2016 + * \version 0.1 + */ + +#include "enb_agent_async.h" +#include "enb_agent_defs.h" + +#include "log.h" + +enb_agent_instance_t * enb_agent_async_channel_info(mid_t mod_id, char *dst_ip, uint16_t dst_port) { + + enb_agent_instance_t *channel; + channel = (enb_agent_instance_t *) malloc(sizeof(enb_agent_instance_t)); + + if (channel == NULL) + goto error; + + channel->mod_id = mod_id; + /*Create a socket*/ + channel->link = new_link_client(dst_ip, dst_port); + if (channel->link == NULL) goto error; + + LOG_I(ENB_AGENT,"starting enb agent client for module id %d on ipv4 %s, port %d\n", + channel->mod_id, + dst_ip, + dst_port); + + /* + * create a message queue + */ + + channel->send_queue = new_message_queue(); + if (channel->send_queue == NULL) goto error; + channel->receive_queue = new_message_queue(); + if (channel->receive_queue == NULL) goto error; + + /* + * create a link manager + */ + channel->manager = create_link_manager(channel->send_queue, channel->receive_queue, channel->link); + if (channel->manager == NULL) goto error; + + return channel; + + error: + LOG_I(ENB_AGENT,"there was an error\n"); + return 1; +} + +int enb_agent_async_msg_send(void *data, int size, int priority, void *channel_info) { + enb_agent_instance_t *channel; + channel = (enb_agent_instance_t *)channel_info; + + return message_put(channel->send_queue, data, size, priority); +} + +int enb_agent_async_msg_recv(void **data, int *size, int *priority, void *channel_info) { + enb_agent_instance_t *channel; + channel = (enb_agent_instance_t *)channel_info; + + return message_get(channel->receive_queue, data, size, priority); +} + +void enb_agent_async_release(enb_agent_channel_t *channel) { + enb_agent_instance_t *channel_info; + channel_info = (enb_agent_instance_t *) channel->channel_info; + + destroy_link_manager(channel_info->manager); + + destroy_message_queue(channel_info->send_queue); + destroy_message_queue(channel_info->receive_queue); + + close_link(channel_info->link); + free(channel_info); +} diff --git a/openair2/ENB_APP/enb_agent_async.h b/openair2/ENB_APP/enb_agent_async.h new file mode 100644 index 0000000000..53614cc87d --- /dev/null +++ b/openair2/ENB_APP/enb_agent_async.h @@ -0,0 +1,51 @@ +/******************************************************************************* + OpenAirInterface + Copyright(c) 1999 - 2014 Eurecom + + OpenAirInterface is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + + OpenAirInterface is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with OpenAirInterface.The full GNU General Public License is + included in this distribution in the file called "COPYING". If not, + see . + + Contact Information + OpenAirInterface Admin: openair_admin@eurecom.fr + OpenAirInterface Tech : openair_tech@eurecom.fr + OpenAirInterface Dev : openair4g-devel@lists.eurecom.fr + + Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. + + *******************************************************************************/ + +/*! \file enb_agent_async.h + * \brief channel implementation for async interface + * \author Xenofon Foukas + * \date 2016 + * \version 0.1 + */ + +#ifndef ENB_AGENT_ASYNC_H_ +#define ENB_AGENT_ASYNC_H_ + +#include "enb_agent_net_comm.h" + +enb_agent_instance_t * enb_agent_async_channel_info(mid_t mod_id, char *dst_ip, uint16_t dst_port); + +int enb_agent_async_msg_send(void *data, int size, int priority, void *channel_info); + +int enb_agent_async_msg_recv(void **data, int *size, int *priority, void *channel_info); + +void enb_agent_async_release(enb_agent_channel_t *channel); + + +#endif /*ENB_AGENT_ASYNC_H_*/ From ed7e13c6ebf0bdfb95bc3951d512e76cb6d0fef3 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Fri, 15 Jan 2016 14:31:21 +0200 Subject: [PATCH 064/349] Integrated abstract network communication in main agent --- openair2/ENB_APP/enb_agent.c | 169 ++++++++++++++++-------------- openair2/ENB_APP/enb_agent_defs.h | 4 +- openair2/ENB_APP/enb_agent_mac.c | 12 ++- 3 files changed, 98 insertions(+), 87 deletions(-) diff --git a/openair2/ENB_APP/enb_agent.c b/openair2/ENB_APP/enb_agent.c index d3e74348f8..fa24cacf8a 100644 --- a/openair2/ENB_APP/enb_agent.c +++ b/openair2/ENB_APP/enb_agent.c @@ -42,6 +42,9 @@ #include "assertions.h" +#include "enb_agent_net_comm.h" +#include "enb_agent_async.h" + //#define TEST_TIMER enb_agent_instance_t enb_agent[NUM_MAX_ENB_AGENT]; @@ -98,10 +101,15 @@ void *enb_agent_task(void *args){ msg = enb_agent_process_timeout(msg_p->ittiMsg.timer_has_expired.timer_id, msg_p->ittiMsg.timer_has_expired.arg); if (msg != NULL){ data=enb_agent_pack_message(msg,&size); - if (message_put(d->tx_mq, data, size, priority)){ + if (enb_agent_msg_send(d->mod_id, ENB_AGENT_DEFAULT, data, size, priority)) { err_code = PROTOCOL__PROGRAN_ERR__MSG_ENQUEUING; goto error; } + + /* if (message_put(d->tx_mq, data, size, priority)){ */ + /* err_code = PROTOCOL__PROGRAN_ERR__MSG_ENQUEUING; */ + /* goto error; */ + /* } */ LOG_D(ENB_AGENT,"sent message with size %d\n", size); } break; @@ -121,42 +129,6 @@ void *enb_agent_task(void *args){ return NULL; } -/* void *send_thread(void *args) { */ - -/* #ifdef TEST_TIMER */ - -/* msg_context_t *d = args; */ -/* void *data; */ -/* int size; */ -/* int priority; */ - -/* struct timeval t1, t2; */ -/* long long t; */ -/* struct timespec ts; */ -/* unsigned int delay = 250*1000; */ -/* while(1) { */ -/* gettimeofday(&t1, NULL); */ -/* enb_agent_sleep_until(&ts, delay); */ -/* gettimeofday(&t2, NULL); */ -/* t = ((t2.tv_sec * 1000000) + t2.tv_usec) - ((t1.tv_sec * 1000000) + t1.tv_usec); */ -/* LOG_I(ENB_AGENT, "Call to sleep_until(%d) took %lld us\n", delay, t); */ -/* sleep(1); */ -/* } */ - -/* #endif */ -/* /\* while (1) { */ -/* // need logic for the timer, and */ -/* usleep(10); */ -/* if (message_put(d->tx_mq, data, size, priority)) goto error; */ -/* }*\/ */ - -/* return NULL; */ - -/* error: */ -/* printf("receive_thread: there was an error\n"); */ -/* return NULL; */ -/* } */ - void *receive_thread(void *args) { msg_context_t *d = args; @@ -168,10 +140,15 @@ void *receive_thread(void *args) { Protocol__ProgranMessage *msg; while (1) { - if (message_get(d->rx_mq, &data, &size, &priority)){ + if (enb_agent_msg_recv(d->mod_id, ENB_AGENT_DEFAULT, &data, &size, &priority)) { err_code = PROTOCOL__PROGRAN_ERR__MSG_DEQUEUING; goto error; } + + /* if (message_get(d->rx_mq, &data, &size, &priority)){ */ + /* err_code = PROTOCOL__PROGRAN_ERR__MSG_DEQUEUING; */ + /* goto error; */ + /* } */ LOG_D(ENB_AGENT,"received message with size %d\n", size); @@ -186,10 +163,15 @@ void *receive_thread(void *args) { if (msg != NULL){ data=enb_agent_pack_message(msg,&size); - if (message_put(d->tx_mq, data, size, priority)){ + if (enb_agent_msg_send(d->mod_id, ENB_AGENT_DEFAULT, data, size, priority)) { err_code = PROTOCOL__PROGRAN_ERR__MSG_ENQUEUING; goto error; } + + /* if (message_put(d->tx_mq, data, size, priority)){ */ + /* err_code = PROTOCOL__PROGRAN_ERR__MSG_ENQUEUING; */ + /* goto error; */ + /* } */ LOG_D(ENB_AGENT,"sent message with size %d\n", size); } @@ -229,7 +211,9 @@ pthread_t new_thread(void *(*f)(void *), void *b) { } int enb_agent_start(mid_t mod_id, const Enb_properties_array_t* enb_properties){ - + + int channel_id; + // set_enb_vars(mod_id, RAN_LTE_OAI); enb_agent[mod_id].mod_id = mod_id; @@ -255,48 +239,78 @@ int enb_agent_start(mid_t mod_id, const Enb_properties_array_t* enb_properties){ in_ip, in_port); - //#define TEST_TIMER 0 -#if !defined TEST_TIMER + /* + * Initialize the channel container + */ + enb_agent_init_channel_container(); - /* - * create a socket - */ - enb_agent[mod_id].link = new_link_client(in_ip, in_port); - if (enb_agent[mod_id].link == NULL) goto error; - - LOG_I(ENB_AGENT,"starting enb agent client for module id %d on ipv4 %s, port %d\n", - enb_agent[mod_id].mod_id, - in_ip, - in_port); - /* - * create a message queue - */ - - enb_agent[mod_id].send_queue = new_message_queue(); - if (enb_agent[mod_id].send_queue == NULL) goto error; - enb_agent[mod_id].receive_queue = new_message_queue(); - if (enb_agent[mod_id].receive_queue == NULL) goto error; - - /* - * create a link manager - */ - - enb_agent[mod_id].manager = create_link_manager(enb_agent[mod_id].send_queue, enb_agent[mod_id].receive_queue, enb_agent[mod_id].link); - if (enb_agent[mod_id].manager == NULL) goto error; + /*Create the async channel info*/ + enb_agent_instance_t *channel_info = enb_agent_async_channel_info(mod_id, in_ip, in_port); + + /*Create a channel using the async channel info*/ + channel_id = enb_agent_create_channel((void *) channel_info, + enb_agent_async_msg_send, + enb_agent_async_msg_recv, + enb_agent_async_release); - memset(&shared_ctxt, 0, sizeof(msg_context_t)); - shared_ctxt[mod_id].mod_id = mod_id; - shared_ctxt[mod_id].tx_mq = enb_agent[mod_id].send_queue; - shared_ctxt[mod_id].rx_mq = enb_agent[mod_id].receive_queue; + if (channel_id <= 0) { + goto error; + } + + enb_agent_channel_t *channel = get_channel(channel_id); + + if (channel == NULL) { + goto error; + } + + /*Register the channel for all underlying agents (use ENB_AGENT_MAX)*/ + enb_agent_register_channel(mod_id, channel, ENB_AGENT_MAX); + + /*Example of registration for a specific agent(MAC): + *enb_agent_register_channel(mod_id, channel, ENB_AGENT_MAC); + */ + + /* /\* */ + /* * create a socket */ + /* *\/ */ + /* enb_agent[mod_id].link = new_link_client(in_ip, in_port); */ + /* if (enb_agent[mod_id].link == NULL) goto error; */ + + /* LOG_I(ENB_AGENT,"starting enb agent client for module id %d on ipv4 %s, port %d\n", */ + /* enb_agent[mod_id].mod_id, */ + /* in_ip, */ + /* in_port); */ + /* /\* */ + /* * create a message queue */ + /* *\/ */ + + /* enb_agent[mod_id].send_queue = new_message_queue(); */ + /* if (enb_agent[mod_id].send_queue == NULL) goto error; */ + /* enb_agent[mod_id].receive_queue = new_message_queue(); */ + /* if (enb_agent[mod_id].receive_queue == NULL) goto error; */ + + /* /\* */ + /* * create a link manager */ + /* *\/ */ + + /* enb_agent[mod_id].manager = create_link_manager(enb_agent[mod_id].send_queue, enb_agent[mod_id].receive_queue, enb_agent[mod_id].link); */ + /* if (enb_agent[mod_id].manager == NULL) goto error; */ + + /* memset(&shared_ctxt, 0, sizeof(msg_context_t)); */ + + /* shared_ctxt[mod_id].mod_id = mod_id; */ + /* shared_ctxt[mod_id].tx_mq = enb_agent[mod_id].send_queue; */ + /* shared_ctxt[mod_id].rx_mq = enb_agent[mod_id].receive_queue; */ /* * start the enb agent rx thread */ + memset(&shared_ctxt, 0, sizeof(msg_context_t)); + shared_ctxt[mod_id].mod_id = mod_id; + new_thread(receive_thread, &shared_ctxt[mod_id]); - -#endif /* * initilize a timer @@ -304,8 +318,6 @@ int enb_agent_start(mid_t mod_id, const Enb_properties_array_t* enb_properties){ enb_agent_init_timer(); - - /* * start the enb agent task for tx and interaction with the underlying network function */ @@ -313,12 +325,7 @@ int enb_agent_start(mid_t mod_id, const Enb_properties_array_t* enb_properties){ if (itti_create_task (TASK_ENB_AGENT, enb_agent_task, (void *) &shared_ctxt[mod_id]) < 0) { LOG_E(ENB_AGENT, "Create task for eNB Agent failed\n"); return -1; - } - - //new_thread(send_thread, &shared_ctxt); - - //while (1) pause(); - + } LOG_I(ENB_AGENT,"client ends\n"); return 0; diff --git a/openair2/ENB_APP/enb_agent_defs.h b/openair2/ENB_APP/enb_agent_defs.h index 416e61a431..e7ffe60c3f 100644 --- a/openair2/ENB_APP/enb_agent_defs.h +++ b/openair2/ENB_APP/enb_agent_defs.h @@ -133,8 +133,8 @@ typedef struct { typedef struct { mid_t mod_id; - message_queue_t *tx_mq; - message_queue_t *rx_mq; + // message_queue_t *tx_mq; + // message_queue_t *rx_mq; xid_t tx_xid; xid_t rx_xid; } msg_context_t; diff --git a/openair2/ENB_APP/enb_agent_mac.c b/openair2/ENB_APP/enb_agent_mac.c index 36b7788d23..41a3ff6a3b 100644 --- a/openair2/ENB_APP/enb_agent_mac.c +++ b/openair2/ENB_APP/enb_agent_mac.c @@ -836,19 +836,23 @@ void enb_agent_send_sr_info(mid_t mod_id, msg_context_t *context) { err_code_t err_code; /*TODO: Must use a proper xid*/ - int xid = 1; - err_code = enb_agent_mac_sr_info(mod_id, (void *) &xid, &msg); + err_code = enb_agent_mac_sr_info(mod_id, (void *) &(context->tx_xid), &msg); if (err_code < 0) { goto error; } if (msg != NULL){ data=enb_agent_pack_message(msg, &size); - - if (message_put(context->tx_mq, data, size, priority)){ + /*Send sr info using the MAC channel of the eNB*/ + if (enb_agent_msg_send(mod_id, ENB_AGENT_MAC, data, size, priority)) { err_code = PROTOCOL__PROGRAN_ERR__MSG_ENQUEUING; goto error; } + + /* if (message_put(context->tx_mq, data, size, priority)){ */ + /* err_code = PROTOCOL__PROGRAN_ERR__MSG_ENQUEUING; */ + /* goto error; */ + /* } */ LOG_D(ENB_AGENT,"sent message with size %d\n", size); } error: From 2fbe01e15fd2c020f6a448d20db16db16c5d2808 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Fri, 15 Jan 2016 16:38:37 +0200 Subject: [PATCH 065/349] Added support for timing messages in DL/UL --- cmake_targets/CMakeLists.txt | 2 ++ openair2/ENB_APP/MESSAGES/V2/header.proto | 6 +++- openair2/ENB_APP/MESSAGES/V2/progran.proto | 21 +++++++++++++- .../ENB_APP/MESSAGES/V2/time_common.proto | 29 +++++++++++++++++++ openair2/ENB_APP/enb_agent_handler.c | 5 ++++ 5 files changed, 61 insertions(+), 2 deletions(-) create mode 100644 openair2/ENB_APP/MESSAGES/V2/time_common.proto diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index 56ee7b71d3..a040013e56 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -709,6 +709,7 @@ if (ENB_AGENT_SB_IF) ${PRPT_MSG_DIR}/progran.proto ${PRPT_MSG_DIR}/stats_common.proto ${PRPT_MSG_DIR}/stats_messages.proto + ${PRPT_MSG_DIR}/time_common.proto ) set(PRPT_C_DIR ${protobuf_generated_dir}/${PRPTDIR}) @@ -720,6 +721,7 @@ if (ENB_AGENT_SB_IF) ${PRPT_C_DIR}/progran.pb-c.c ${PRPT_C_DIR}/stats_common.pb-c.c ${PRPT_C_DIR}/stats_messages.pb-c.c + ${PRPT_C_DIR}/time_common.pb-c.c ) file(GLOB prpt_h ${PRPT_C_DIR}/*.h) diff --git a/openair2/ENB_APP/MESSAGES/V2/header.proto b/openair2/ENB_APP/MESSAGES/V2/header.proto index 5670b9bd77..7130f8448c 100644 --- a/openair2/ENB_APP/MESSAGES/V2/header.proto +++ b/openair2/ENB_APP/MESSAGES/V2/header.proto @@ -15,8 +15,12 @@ enum prp_type { // Statistics and measurement messages PRPT_STATS_REQUEST = 3; PRPT_STATS_REPLY = 4; + + // Time indication messages + PRPT_DL_TRIGGER = 5; + PRPT_UL_TRIGGER = 6; //Asynchronous messages - PRPT_UL_SR_INFO = 5; + PRPT_UL_SR_INFO = 7; } diff --git a/openair2/ENB_APP/MESSAGES/V2/progran.proto b/openair2/ENB_APP/MESSAGES/V2/progran.proto index 53718b87c4..314678b1d6 100644 --- a/openair2/ENB_APP/MESSAGES/V2/progran.proto +++ b/openair2/ENB_APP/MESSAGES/V2/progran.proto @@ -3,6 +3,7 @@ package protocol; import "stats_messages.proto"; import "header.proto"; +import "time_common.proto"; message progran_message { optional progran_direction msg_dir = 100; @@ -12,7 +13,9 @@ message progran_message { prp_echo_reply echo_reply_msg = 3; prp_stats_request stats_request_msg = 4; prp_stats_reply stats_reply_msg = 5; - prp_ul_sr_info ul_sr_info_msg = 6; + prp_dl_trigger dl_trigger_msg = 6; + prp_ul_trigger ul_trigger_msg = 7; + prp_ul_sr_info ul_sr_info_msg = 8; } } @@ -83,6 +86,22 @@ message prp_stats_reply { repeated prp_cell_stats_report cell_report = 3; } +// +// Time indication messages +// + +message prp_dl_trigger { + optional prp_header header = 1; + optional uint32 sfn_sf = 2; + repeated prp_dl_info dl_info = 3; +} + +message prp_ul_trigger { + optional prp_header header = 1; + optional uint32 sfn_sf = 2; + repeated prp_ul_info ul_info = 3; +} + // // Asynchronous messages // diff --git a/openair2/ENB_APP/MESSAGES/V2/time_common.proto b/openair2/ENB_APP/MESSAGES/V2/time_common.proto new file mode 100644 index 0000000000..4c3ac4911e --- /dev/null +++ b/openair2/ENB_APP/MESSAGES/V2/time_common.proto @@ -0,0 +1,29 @@ +package protocol; + +enum prp_harq_status { + PRHS_ACK = 0; + PRHS_NACK = 1; + PRHS_DTX = 2; +} + +enum prp_reception_status { + PRRS_OK = 0; + PRRS_NOT_OK = 1; + PRRS_NOT_VALID = 2; +} + +message prp_dl_info { + optional uint32 rnti = 1; + optional uint32 harq_process_id = 2; + repeated uint32 harq_status = 3; + optional uint32 serv_cell_index = 4; +} + +message prp_ul_info { + optional uint32 rnti = 1; + repeated uint32 ul_reception = 2; + optional uint32 reception_status = 3; + optional uint32 tpc = 4; + optional uint32 serv_cell_index = 5; +} + diff --git a/openair2/ENB_APP/enb_agent_handler.c b/openair2/ENB_APP/enb_agent_handler.c index 0f5146fe6d..62b026e63b 100644 --- a/openair2/ENB_APP/enb_agent_handler.c +++ b/openair2/ENB_APP/enb_agent_handler.c @@ -47,6 +47,9 @@ enb_agent_message_decoded_callback messages_callback[][3] = { {0, 0, 0}, /*PROTOCOL__PROGRAN_MESSAGE__MSG_ECHO_REPLY_MSG*/ //Must add handler when receiving echo reply {enb_agent_mac_handle_stats, 0, 0}, /*PROTOCOL__PROGRAN_MESSAGE__MSG_STATS_REQUEST_MSG*/ {0,0,0}, /*PROTOCOL__PROGRAN_MESSAGE__MSG_STATS_REPLY_MSG*/ + {0,0,0}, /*DL_TRIGGER*/ + {0,0,0}, /*UL_TRIGGER*/ + {0,0,0}, /*SR_INFO*/ }; @@ -56,6 +59,8 @@ enb_agent_message_destruction_callback message_destruction_callback[] = { enb_agent_destroy_echo_reply, enb_agent_mac_destroy_stats_request, enb_agent_mac_destroy_stats_reply, + 0, + 0, enb_agent_mac_destroy_sr_info, }; From 5cec297209a9253f0a342e38778c99e94af50060 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Fri, 15 Jan 2016 18:07:42 +0200 Subject: [PATCH 066/349] Implemented handlers for the UL/DL trigger messages --- openair2/ENB_APP/enb_agent_handler.c | 4 +- openair2/ENB_APP/enb_agent_mac.c | 261 +++++++++++++++++++++++++- openair2/ENB_APP/enb_agent_mac.h | 13 ++ openair2/ENB_APP/enb_agent_mac_defs.h | 4 + 4 files changed, 276 insertions(+), 6 deletions(-) diff --git a/openair2/ENB_APP/enb_agent_handler.c b/openair2/ENB_APP/enb_agent_handler.c index 62b026e63b..4a936ff3db 100644 --- a/openair2/ENB_APP/enb_agent_handler.c +++ b/openair2/ENB_APP/enb_agent_handler.c @@ -59,8 +59,8 @@ enb_agent_message_destruction_callback message_destruction_callback[] = { enb_agent_destroy_echo_reply, enb_agent_mac_destroy_stats_request, enb_agent_mac_destroy_stats_reply, - 0, - 0, + enb_agent_mac_destroy_dl_trigger, + enb_agent_mac_destroy_ul_trigger, enb_agent_mac_destroy_sr_info, }; diff --git a/openair2/ENB_APP/enb_agent_mac.c b/openair2/ENB_APP/enb_agent_mac.c index 41a3ff6a3b..194d8c96b8 100644 --- a/openair2/ENB_APP/enb_agent_mac.c +++ b/openair2/ENB_APP/enb_agent_mac.c @@ -828,6 +828,209 @@ int enb_agent_mac_destroy_sr_info(Protocol__ProgranMessage *msg) { return -1; } +int enb_agent_mac_dl_trigger(mid_t mod_id, const void *params, Protocol__ProgranMessage **msg) { + Protocol__PrpHeader *header; + int i,j; + const int xid = *((int *)params); + if (prp_create_header(xid, PROTOCOL__PRP_TYPE__PRPT_DL_TRIGGER, &header) != 0) + goto error; + + Protocol__PrpDlTrigger *dl_trigger_msg; + dl_trigger_msg = malloc(sizeof(Protocol__PrpDlTrigger)); + if (dl_trigger_msg == NULL) { + goto error; + } + protocol__prp_dl_trigger__init(dl_trigger_msg); + + dl_trigger_msg->header = header; + dl_trigger_msg->has_sfn_sf = 1; + dl_trigger_msg->sfn_sf = get_sfn_sf(mod_id); + + /*TODO: Fill in the number of dl HARQ related info, based on the number of currently + *transmitting UEs + */ + dl_trigger_msg->n_dl_info = get_num_ues(mod_id); + + Protocol__PrpDlInfo **dl_info = NULL; + + if (dl_trigger_msg->n_dl_info > 0) { + dl_info = malloc(sizeof(Protocol__PrpDlInfo *) * dl_trigger_msg->n_dl_info); + if(dl_info == NULL) + goto error; + //Fill the status of the current HARQ process for each UE + for(i = 0; i++; i < dl_trigger_msg->n_dl_info) { + dl_info[i] = malloc(sizeof(Protocol__PrpDlInfo)); + if(dl_info[i] == NULL) + goto error; + protocol__prp_dl_info__init(dl_info[i]); + dl_info[i]->rnti = get_ue_crnti(mod_id, i); + dl_info[i]->has_rnti = 1; + /*TODO: fill in the right id of this round's HARQ process for this UE*/ + dl_info[i]->harq_process_id = 1; + dl_info[i]->has_harq_process_id = 1; + /*TODO: fill in the status of the HARQ process (2 TBs)*/ + dl_info[i]->n_harq_status = 2; + dl_info[i]->harq_status = malloc(sizeof(uint32_t) * dl_info[i]->n_harq_status); + for (j = 0; j < dl_info[j]->n_harq_status; j++) { + dl_info[i]->harq_status[j] = PROTOCOL__PRP_HARQ_STATUS__PRHS_ACK; + } + /*TODO: fill in the serving cell index for this UE */ + dl_info[i]->serv_cell_index = 0; + dl_info[i]->has_serv_cell_index = 1; + } + } + + dl_trigger_msg->dl_info = dl_info; + + *msg = malloc(sizeof(Protocol__ProgranMessage)); + if(*msg == NULL) + goto error; + protocol__progran_message__init(*msg); + (*msg)->msg_case = PROTOCOL__PROGRAN_MESSAGE__MSG_DL_TRIGGER_MSG; + (*msg)->msg_dir = PROTOCOL__PROGRAN_DIRECTION__INITIATING_MESSAGE; + (*msg)->dl_trigger_msg = dl_trigger_msg; + return 0; + + error: + if (header != NULL) + free(header); + if (dl_trigger_msg != NULL) { + for (i = 0; i < dl_trigger_msg->n_dl_info; i++) { + free(dl_trigger_msg->dl_info[i]->harq_status); + } + free(dl_trigger_msg->dl_info); + free(dl_trigger_msg); + } + if(*msg != NULL) + free(*msg); + //LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); + return -1; +} + +int enb_agent_mac_destroy_dl_trigger(Protocol__ProgranMessage *msg) { + int i; + if(msg->msg_case != PROTOCOL__PROGRAN_MESSAGE__MSG_DL_TRIGGER_MSG) + goto error; + + free(msg->dl_trigger_msg->header); + for (i = 0; i < msg->dl_trigger_msg->n_dl_info; i++) { + free(msg->dl_trigger_msg->dl_info[i]->harq_status); + } + free(msg->dl_trigger_msg->dl_info); + free(msg->dl_trigger_msg); + free(msg); + + return 0; + + error: + //LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); + return -1; +} + +int enb_agent_mac_ul_trigger(mid_t mod_id, const void *params, Protocol__ProgranMessage **msg) { + Protocol__PrpHeader *header; + int i,j; + const int xid = *((int *)params); + if (prp_create_header(xid, PROTOCOL__PRP_TYPE__PRPT_UL_TRIGGER, &header) != 0) + goto error; + + Protocol__PrpUlTrigger *ul_trigger_msg; + ul_trigger_msg = malloc(sizeof(Protocol__PrpUlTrigger)); + if (ul_trigger_msg == NULL) { + goto error; + } + protocol__prp_ul_trigger__init(ul_trigger_msg); + + ul_trigger_msg->header = header; + ul_trigger_msg->has_sfn_sf = 1; + /*TODO: Must fix this to get the proper subframe number*/ + ul_trigger_msg->sfn_sf = get_sfn_sf(mod_id); + + /*TODO: Fill in the number of UL reception status related info, based on the number of currently + *transmitting UEs + */ + ul_trigger_msg->n_ul_info = get_num_ues(mod_id); + + Protocol__PrpUlInfo **ul_info = NULL; + + if (ul_trigger_msg->n_ul_info > 0) { + ul_info = malloc(sizeof(Protocol__PrpUlInfo *) * ul_trigger_msg->n_ul_info); + if(ul_info == NULL) + goto error; + //Fill the reception info for each transmitting UE + for(i = 0; i++; i < ul_trigger_msg->n_ul_info) { + ul_info[i] = malloc(sizeof(Protocol__PrpUlInfo)); + if(ul_info[i] == NULL) + goto error; + protocol__prp_ul_info__init(ul_info[i]); + ul_info[i]->rnti = get_ue_crnti(mod_id, i); + ul_info[i]->has_rnti = 1; + /*TODO: fill in the Tx power control command for this UE (if available)*/ + ul_info[i]->tpc = 1; + ul_info[i]->has_tpc = 0; + /*TODO: fill in the amount of data in bytes in the MAC SDU received in this subframe for the + given logical channel*/ + ul_info[i]->n_ul_reception = 11; + ul_info[i]->ul_reception = malloc(sizeof(uint32_t) * ul_info[i]->n_ul_reception); + for (j = 0; j < ul_info[j]->n_ul_reception; j++) { + ul_info[i]->ul_reception[j] = 100; + } + /*TODO: Fill in the reception status for each UEs data*/ + ul_info[i]->reception_status = PROTOCOL__PRP_RECEPTION_STATUS__PRRS_OK; + ul_info[i]->has_reception_status = 1; + /*TODO: fill in the serving cell index for this UE */ + ul_info[i]->serv_cell_index = 0; + ul_info[i]->has_serv_cell_index = 1; + } + } + + ul_trigger_msg->ul_info = ul_info; + + *msg = malloc(sizeof(Protocol__ProgranMessage)); + if(*msg == NULL) + goto error; + protocol__progran_message__init(*msg); + (*msg)->msg_case = PROTOCOL__PROGRAN_MESSAGE__MSG_UL_TRIGGER_MSG; + (*msg)->msg_dir = PROTOCOL__PROGRAN_DIRECTION__INITIATING_MESSAGE; + (*msg)->ul_trigger_msg = ul_trigger_msg; + return 0; + + error: + if (header != NULL) + free(header); + if (ul_trigger_msg != NULL) { + for (i = 0; i < ul_trigger_msg->n_ul_info; i++) { + free(ul_trigger_msg->ul_info[i]->reception_status); + } + free(ul_trigger_msg->ul_info); + free(ul_trigger_msg); + } + if(*msg != NULL) + free(*msg); + //LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); + return -1; +} + +int enb_agent_mac_destroy_ul_trigger(Protocol__ProgranMessage *msg) { + int i; + if(msg->msg_case != PROTOCOL__PROGRAN_MESSAGE__MSG_UL_TRIGGER_MSG) + goto error; + + free(msg->ul_trigger_msg->header); + for (i = 0; i < msg->ul_trigger_msg->n_ul_info; i++) { + free(msg->ul_trigger_msg->ul_info[i]->reception_status); + } + free(msg->ul_trigger_msg->ul_info); + free(msg->ul_trigger_msg); + free(msg); + + return 0; + + error: + //LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); + return -1; +} + void enb_agent_send_sr_info(mid_t mod_id, msg_context_t *context) { int size; Protocol__ProgranMessage *msg; @@ -849,16 +1052,66 @@ void enb_agent_send_sr_info(mid_t mod_id, msg_context_t *context) { goto error; } - /* if (message_put(context->tx_mq, data, size, priority)){ */ - /* err_code = PROTOCOL__PROGRAN_ERR__MSG_ENQUEUING; */ - /* goto error; */ - /* } */ LOG_D(ENB_AGENT,"sent message with size %d\n", size); } error: LOG_D(ENB_AGENT, "Could not send sr message\n"); } +void enb_agent_send_dl_trigger(mid_t mod_id, msg_context_t *context) { + int size; + Protocol__ProgranMessage *msg; + void *data; + int priority; + err_code_t err_code; + + /*TODO: Must use a proper xid*/ + err_code = enb_agent_mac_dl_trigger(mod_id, (void *) &(context->tx_xid), &msg); + if (err_code < 0) { + goto error; + } + + if (msg != NULL){ + data=enb_agent_pack_message(msg, &size); + /*Send sr info using the MAC channel of the eNB*/ + if (enb_agent_msg_send(mod_id, ENB_AGENT_MAC, data, size, priority)) { + err_code = PROTOCOL__PROGRAN_ERR__MSG_ENQUEUING; + goto error; + } + + LOG_D(ENB_AGENT,"sent message with size %d\n", size); + } + error: + LOG_D(ENB_AGENT, "Could not send dl trigger message\n"); +} + +void enb_agent_send_ul_trigger(mid_t mod_id, msg_context_t *context) { + int size; + Protocol__ProgranMessage *msg; + void *data; + int priority; + err_code_t err_code; + + /*TODO: Must use a proper xid*/ + err_code = enb_agent_mac_ul_trigger(mod_id, (void *) &(context->tx_xid), &msg); + if (err_code < 0) { + goto error; + } + + if (msg != NULL){ + data=enb_agent_pack_message(msg, &size); + /*Send sr info using the MAC channel of the eNB*/ + if (enb_agent_msg_send(mod_id, ENB_AGENT_MAC, data, size, priority)) { + err_code = PROTOCOL__PROGRAN_ERR__MSG_ENQUEUING; + goto error; + } + + LOG_D(ENB_AGENT,"sent message with size %d\n", size); + } + error: + LOG_D(ENB_AGENT, "Could not send ul trigger message\n"); +} + int enb_agent_register_mac_xface(mid_t mod_id, AGENT_MAC_xface *xface) { if (!mac_agent_registered[mod_id]) { LOG_E(MAC, "MAC agent for eNB %d is already registered\n", mod_id); diff --git a/openair2/ENB_APP/enb_agent_mac.h b/openair2/ENB_APP/enb_agent_mac.h index 7945082410..18a91716b0 100644 --- a/openair2/ENB_APP/enb_agent_mac.h +++ b/openair2/ENB_APP/enb_agent_mac.h @@ -94,6 +94,14 @@ int enb_agent_mac_sr_info(mid_t mod_id, const void *params, Protocol__ProgranMes int enb_agent_mac_destroy_sr_info(Protocol__ProgranMessage *msg); +int enb_agent_mac_dl_trigger(mid_t mod_id, const void *params, Protocol__ProgranMessage **msg); + +int enb_agent_mac_destroy_dl_trigger(Protocol__ProgranMessage *msg); + +int enb_agent_mac_ul_trigger(mid_t mod_id, const void *params, Protocol__ProgranMessage **msg); + +int enb_agent_mac_destroy_ul_trigger(Protocol__ProgranMessage *msg); + /********************************** * eNB agent - technology mac API @@ -102,6 +110,11 @@ int enb_agent_mac_destroy_sr_info(Protocol__ProgranMessage *msg); /*Inform controller about received scheduling requests during a subframe*/ void enb_agent_send_sr_info(mid_t mod_id, msg_context_t *context); +/*Inform the controller about the current UL/DL subframe*/ +void enb_agent_send_dl_trigger(mid_t mod_id, msg_context_t *context); + +void enb_agent_send_ul_trigger(mid_t mod_id, msg_context_t *context); + /*Register technology specific interface callbacks*/ int enb_agent_register_mac_xface(mid_t mod_id, AGENT_MAC_xface *xface); diff --git a/openair2/ENB_APP/enb_agent_mac_defs.h b/openair2/ENB_APP/enb_agent_mac_defs.h index 28a424706b..14d149f40c 100644 --- a/openair2/ENB_APP/enb_agent_mac_defs.h +++ b/openair2/ENB_APP/enb_agent_mac_defs.h @@ -46,6 +46,10 @@ typedef struct { /// Inform the controller about the scheduling requests received during the subframe void (*enb_agent_send_sr_info)(mid_t mod_id, msg_context_t *context); + + /// Inform the controller about the current UL/DL subframe + void (*enb_agent_send_dl_trigger)(mid_t mod_id, msg_context_t *context); + void (*enb_agent_send_ul_trigger)(mid_t mod_id, msg_context_t *context); /*TODO: Fill in with the rest of the MAC layer technology specific callbacks (UL/DL scheduling, RACH info etc)*/ From 876d9eac5214e3ad954d3ac075f64bced0785f5a Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Tue, 19 Jan 2016 10:12:48 +0000 Subject: [PATCH 067/349] Fixed bug when creating cell report stats reply --- openair2/ENB_APP/enb_agent_mac.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openair2/ENB_APP/enb_agent_mac.c b/openair2/ENB_APP/enb_agent_mac.c index 194d8c96b8..d13f7fa63a 100644 --- a/openair2/ENB_APP/enb_agent_mac.c +++ b/openair2/ENB_APP/enb_agent_mac.c @@ -595,7 +595,7 @@ int enb_agent_mac_stats_reply(mid_t mod_id, // Fill in the Cell reports for (i = 0; i < report_config->nr_cc; i++) { cell_report[i] = malloc(sizeof(Protocol__PrpCellStatsReport)); - if(ue_report[i] == NULL) + if(cell_report[i] == NULL) goto error; protocol__prp_cell_stats_report__init(cell_report[i]); cell_report[i]->carrier_index = report_config->cc_report_type[i].cc_id; From 1f520630658f071c32b89b13cfd126cdeea0a002 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Tue, 19 Jan 2016 11:11:05 +0000 Subject: [PATCH 068/349] Merged UL/DL trigger messages to a single SF trigger message --- openair2/ENB_APP/MESSAGES/V2/header.proto | 5 +- openair2/ENB_APP/MESSAGES/V2/progran.proto | 14 +- openair2/ENB_APP/enb_agent_handler.c | 6 +- openair2/ENB_APP/enb_agent_mac.c | 177 ++++++--------------- openair2/ENB_APP/enb_agent_mac.h | 12 +- openair2/ENB_APP/enb_agent_mac_defs.h | 3 +- 6 files changed, 60 insertions(+), 157 deletions(-) diff --git a/openair2/ENB_APP/MESSAGES/V2/header.proto b/openair2/ENB_APP/MESSAGES/V2/header.proto index 7130f8448c..8534d2f304 100644 --- a/openair2/ENB_APP/MESSAGES/V2/header.proto +++ b/openair2/ENB_APP/MESSAGES/V2/header.proto @@ -17,10 +17,9 @@ enum prp_type { PRPT_STATS_REPLY = 4; // Time indication messages - PRPT_DL_TRIGGER = 5; - PRPT_UL_TRIGGER = 6; + PRPT_SF_TRIGGER = 5; //Asynchronous messages - PRPT_UL_SR_INFO = 7; + PRPT_UL_SR_INFO = 6; } diff --git a/openair2/ENB_APP/MESSAGES/V2/progran.proto b/openair2/ENB_APP/MESSAGES/V2/progran.proto index 314678b1d6..730726aab4 100644 --- a/openair2/ENB_APP/MESSAGES/V2/progran.proto +++ b/openair2/ENB_APP/MESSAGES/V2/progran.proto @@ -13,9 +13,8 @@ message progran_message { prp_echo_reply echo_reply_msg = 3; prp_stats_request stats_request_msg = 4; prp_stats_reply stats_reply_msg = 5; - prp_dl_trigger dl_trigger_msg = 6; - prp_ul_trigger ul_trigger_msg = 7; - prp_ul_sr_info ul_sr_info_msg = 8; + prp_sf_trigger sf_trigger_msg = 6; + prp_ul_sr_info ul_sr_info_msg = 7; } } @@ -90,16 +89,11 @@ message prp_stats_reply { // Time indication messages // -message prp_dl_trigger { +message prp_sf_trigger { optional prp_header header = 1; optional uint32 sfn_sf = 2; repeated prp_dl_info dl_info = 3; -} - -message prp_ul_trigger { - optional prp_header header = 1; - optional uint32 sfn_sf = 2; - repeated prp_ul_info ul_info = 3; + repeated prp_ul_info ul_info = 4; } // diff --git a/openair2/ENB_APP/enb_agent_handler.c b/openair2/ENB_APP/enb_agent_handler.c index 4a936ff3db..7b63227d7e 100644 --- a/openair2/ENB_APP/enb_agent_handler.c +++ b/openair2/ENB_APP/enb_agent_handler.c @@ -47,8 +47,7 @@ enb_agent_message_decoded_callback messages_callback[][3] = { {0, 0, 0}, /*PROTOCOL__PROGRAN_MESSAGE__MSG_ECHO_REPLY_MSG*/ //Must add handler when receiving echo reply {enb_agent_mac_handle_stats, 0, 0}, /*PROTOCOL__PROGRAN_MESSAGE__MSG_STATS_REQUEST_MSG*/ {0,0,0}, /*PROTOCOL__PROGRAN_MESSAGE__MSG_STATS_REPLY_MSG*/ - {0,0,0}, /*DL_TRIGGER*/ - {0,0,0}, /*UL_TRIGGER*/ + {0,0,0}, /*PROTOCOK__PROGRAN_MESSAGE__MSG_SF_TRIGGER_MSG*/ {0,0,0}, /*SR_INFO*/ }; @@ -59,8 +58,7 @@ enb_agent_message_destruction_callback message_destruction_callback[] = { enb_agent_destroy_echo_reply, enb_agent_mac_destroy_stats_request, enb_agent_mac_destroy_stats_reply, - enb_agent_mac_destroy_dl_trigger, - enb_agent_mac_destroy_ul_trigger, + enb_agent_mac_destroy_sf_trigger, enb_agent_mac_destroy_sr_info, }; diff --git a/openair2/ENB_APP/enb_agent_mac.c b/openair2/ENB_APP/enb_agent_mac.c index d13f7fa63a..34423ee01a 100644 --- a/openair2/ENB_APP/enb_agent_mac.c +++ b/openair2/ENB_APP/enb_agent_mac.c @@ -828,37 +828,37 @@ int enb_agent_mac_destroy_sr_info(Protocol__ProgranMessage *msg) { return -1; } -int enb_agent_mac_dl_trigger(mid_t mod_id, const void *params, Protocol__ProgranMessage **msg) { +int enb_agent_mac_sf_trigger(mid_t mod_id, const void *params, Protocol__ProgranMessage **msg) { Protocol__PrpHeader *header; int i,j; const int xid = *((int *)params); - if (prp_create_header(xid, PROTOCOL__PRP_TYPE__PRPT_DL_TRIGGER, &header) != 0) + if (prp_create_header(xid, PROTOCOL__PRP_TYPE__PRPT_SF_TRIGGER, &header) != 0) goto error; - Protocol__PrpDlTrigger *dl_trigger_msg; - dl_trigger_msg = malloc(sizeof(Protocol__PrpDlTrigger)); - if (dl_trigger_msg == NULL) { + Protocol__PrpSfTrigger *sf_trigger_msg; + sf_trigger_msg = malloc(sizeof(Protocol__PrpSfTrigger)); + if (sf_trigger_msg == NULL) { goto error; } - protocol__prp_dl_trigger__init(dl_trigger_msg); + protocol__prp_sf_trigger__init(sf_trigger_msg); - dl_trigger_msg->header = header; - dl_trigger_msg->has_sfn_sf = 1; - dl_trigger_msg->sfn_sf = get_sfn_sf(mod_id); + sf_trigger_msg->header = header; + sf_trigger_msg->has_sfn_sf = 1; + sf_trigger_msg->sfn_sf = get_sfn_sf(mod_id); /*TODO: Fill in the number of dl HARQ related info, based on the number of currently *transmitting UEs */ - dl_trigger_msg->n_dl_info = get_num_ues(mod_id); + sf_trigger_msg->n_dl_info = get_num_ues(mod_id); Protocol__PrpDlInfo **dl_info = NULL; - if (dl_trigger_msg->n_dl_info > 0) { - dl_info = malloc(sizeof(Protocol__PrpDlInfo *) * dl_trigger_msg->n_dl_info); + if (sf_trigger_msg->n_dl_info > 0) { + dl_info = malloc(sizeof(Protocol__PrpDlInfo *) * sf_trigger_msg->n_dl_info); if(dl_info == NULL) goto error; //Fill the status of the current HARQ process for each UE - for(i = 0; i++; i < dl_trigger_msg->n_dl_info) { + for(i = 0; i++; i < sf_trigger_msg->n_dl_info) { dl_info[i] = malloc(sizeof(Protocol__PrpDlInfo)); if(dl_info[i] == NULL) goto error; @@ -880,85 +880,21 @@ int enb_agent_mac_dl_trigger(mid_t mod_id, const void *params, Protocol__Progran } } - dl_trigger_msg->dl_info = dl_info; - - *msg = malloc(sizeof(Protocol__ProgranMessage)); - if(*msg == NULL) - goto error; - protocol__progran_message__init(*msg); - (*msg)->msg_case = PROTOCOL__PROGRAN_MESSAGE__MSG_DL_TRIGGER_MSG; - (*msg)->msg_dir = PROTOCOL__PROGRAN_DIRECTION__INITIATING_MESSAGE; - (*msg)->dl_trigger_msg = dl_trigger_msg; - return 0; - - error: - if (header != NULL) - free(header); - if (dl_trigger_msg != NULL) { - for (i = 0; i < dl_trigger_msg->n_dl_info; i++) { - free(dl_trigger_msg->dl_info[i]->harq_status); - } - free(dl_trigger_msg->dl_info); - free(dl_trigger_msg); - } - if(*msg != NULL) - free(*msg); - //LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); - return -1; -} + sf_trigger_msg->dl_info = dl_info; -int enb_agent_mac_destroy_dl_trigger(Protocol__ProgranMessage *msg) { - int i; - if(msg->msg_case != PROTOCOL__PROGRAN_MESSAGE__MSG_DL_TRIGGER_MSG) - goto error; - - free(msg->dl_trigger_msg->header); - for (i = 0; i < msg->dl_trigger_msg->n_dl_info; i++) { - free(msg->dl_trigger_msg->dl_info[i]->harq_status); - } - free(msg->dl_trigger_msg->dl_info); - free(msg->dl_trigger_msg); - free(msg); - - return 0; - - error: - //LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); - return -1; -} - -int enb_agent_mac_ul_trigger(mid_t mod_id, const void *params, Protocol__ProgranMessage **msg) { - Protocol__PrpHeader *header; - int i,j; - const int xid = *((int *)params); - if (prp_create_header(xid, PROTOCOL__PRP_TYPE__PRPT_UL_TRIGGER, &header) != 0) - goto error; - - Protocol__PrpUlTrigger *ul_trigger_msg; - ul_trigger_msg = malloc(sizeof(Protocol__PrpUlTrigger)); - if (ul_trigger_msg == NULL) { - goto error; - } - protocol__prp_ul_trigger__init(ul_trigger_msg); - - ul_trigger_msg->header = header; - ul_trigger_msg->has_sfn_sf = 1; - /*TODO: Must fix this to get the proper subframe number*/ - ul_trigger_msg->sfn_sf = get_sfn_sf(mod_id); - - /*TODO: Fill in the number of UL reception status related info, based on the number of currently + /*TODO: Fill in the number of UL reception status related info, based on the number of currently *transmitting UEs */ - ul_trigger_msg->n_ul_info = get_num_ues(mod_id); + sf_trigger_msg->n_ul_info = get_num_ues(mod_id); Protocol__PrpUlInfo **ul_info = NULL; - if (ul_trigger_msg->n_ul_info > 0) { - ul_info = malloc(sizeof(Protocol__PrpUlInfo *) * ul_trigger_msg->n_ul_info); + if (sf_trigger_msg->n_ul_info > 0) { + ul_info = malloc(sizeof(Protocol__PrpUlInfo *) * sf_trigger_msg->n_ul_info); if(ul_info == NULL) goto error; //Fill the reception info for each transmitting UE - for(i = 0; i++; i < ul_trigger_msg->n_ul_info) { + for(i = 0; i++; i < sf_trigger_msg->n_ul_info) { ul_info[i] = malloc(sizeof(Protocol__PrpUlInfo)); if(ul_info[i] == NULL) goto error; @@ -984,26 +920,30 @@ int enb_agent_mac_ul_trigger(mid_t mod_id, const void *params, Protocol__Progran } } - ul_trigger_msg->ul_info = ul_info; - + sf_trigger_msg->ul_info = ul_info; + *msg = malloc(sizeof(Protocol__ProgranMessage)); if(*msg == NULL) goto error; protocol__progran_message__init(*msg); - (*msg)->msg_case = PROTOCOL__PROGRAN_MESSAGE__MSG_UL_TRIGGER_MSG; + (*msg)->msg_case = PROTOCOL__PROGRAN_MESSAGE__MSG_SF_TRIGGER_MSG; (*msg)->msg_dir = PROTOCOL__PROGRAN_DIRECTION__INITIATING_MESSAGE; - (*msg)->ul_trigger_msg = ul_trigger_msg; + (*msg)->sf_trigger_msg = sf_trigger_msg; return 0; error: if (header != NULL) free(header); - if (ul_trigger_msg != NULL) { - for (i = 0; i < ul_trigger_msg->n_ul_info; i++) { - free(ul_trigger_msg->ul_info[i]->reception_status); + if (sf_trigger_msg != NULL) { + for (i = 0; i < sf_trigger_msg->n_dl_info; i++) { + free(sf_trigger_msg->dl_info[i]->harq_status); } - free(ul_trigger_msg->ul_info); - free(ul_trigger_msg); + free(sf_trigger_msg->dl_info); + for (i = 0; i < sf_trigger_msg->n_ul_info; i++) { + free(sf_trigger_msg->ul_info[i]->reception_status); + } + free(sf_trigger_msg->ul_info); + free(sf_trigger_msg); } if(*msg != NULL) free(*msg); @@ -1011,17 +951,21 @@ int enb_agent_mac_ul_trigger(mid_t mod_id, const void *params, Protocol__Progran return -1; } -int enb_agent_mac_destroy_ul_trigger(Protocol__ProgranMessage *msg) { +int enb_agent_mac_destroy_sf_trigger(Protocol__ProgranMessage *msg) { int i; - if(msg->msg_case != PROTOCOL__PROGRAN_MESSAGE__MSG_UL_TRIGGER_MSG) + if(msg->msg_case != PROTOCOL__PROGRAN_MESSAGE__MSG_SF_TRIGGER_MSG) goto error; - free(msg->ul_trigger_msg->header); - for (i = 0; i < msg->ul_trigger_msg->n_ul_info; i++) { - free(msg->ul_trigger_msg->ul_info[i]->reception_status); + free(msg->sf_trigger_msg->header); + for (i = 0; i < msg->sf_trigger_msg->n_dl_info; i++) { + free(msg->sf_trigger_msg->dl_info[i]->harq_status); } - free(msg->ul_trigger_msg->ul_info); - free(msg->ul_trigger_msg); + free(msg->sf_trigger_msg->dl_info); + for (i = 0; i < msg->sf_trigger_msg->n_ul_info; i++) { + free(msg->sf_trigger_msg->ul_info[i]->reception_status); + } + free(msg->sf_trigger_msg->ul_info); + free(msg->sf_trigger_msg); free(msg); return 0; @@ -1058,7 +1002,7 @@ void enb_agent_send_sr_info(mid_t mod_id, msg_context_t *context) { LOG_D(ENB_AGENT, "Could not send sr message\n"); } -void enb_agent_send_dl_trigger(mid_t mod_id, msg_context_t *context) { +void enb_agent_send_sf_trigger(mid_t mod_id, msg_context_t *context) { int size; Protocol__ProgranMessage *msg; void *data; @@ -1066,7 +1010,7 @@ void enb_agent_send_dl_trigger(mid_t mod_id, msg_context_t *context) { err_code_t err_code; /*TODO: Must use a proper xid*/ - err_code = enb_agent_mac_dl_trigger(mod_id, (void *) &(context->tx_xid), &msg); + err_code = enb_agent_mac_sf_trigger(mod_id, (void *) &(context->tx_xid), &msg); if (err_code < 0) { goto error; } @@ -1082,34 +1026,7 @@ void enb_agent_send_dl_trigger(mid_t mod_id, msg_context_t *context) { LOG_D(ENB_AGENT,"sent message with size %d\n", size); } error: - LOG_D(ENB_AGENT, "Could not send dl trigger message\n"); -} - -void enb_agent_send_ul_trigger(mid_t mod_id, msg_context_t *context) { - int size; - Protocol__ProgranMessage *msg; - void *data; - int priority; - err_code_t err_code; - - /*TODO: Must use a proper xid*/ - err_code = enb_agent_mac_ul_trigger(mod_id, (void *) &(context->tx_xid), &msg); - if (err_code < 0) { - goto error; - } - - if (msg != NULL){ - data=enb_agent_pack_message(msg, &size); - /*Send sr info using the MAC channel of the eNB*/ - if (enb_agent_msg_send(mod_id, ENB_AGENT_MAC, data, size, priority)) { - err_code = PROTOCOL__PROGRAN_ERR__MSG_ENQUEUING; - goto error; - } - - LOG_D(ENB_AGENT,"sent message with size %d\n", size); - } - error: - LOG_D(ENB_AGENT, "Could not send ul trigger message\n"); + LOG_D(ENB_AGENT, "Could not send sf trigger message\n"); } int enb_agent_register_mac_xface(mid_t mod_id, AGENT_MAC_xface *xface) { @@ -1120,6 +1037,7 @@ int enb_agent_register_mac_xface(mid_t mod_id, AGENT_MAC_xface *xface) { xface->agent_ctxt = &shared_ctxt[mod_id]; xface->enb_agent_send_sr_info = enb_agent_send_sr_info; + xface->enb_agent_send_sf_trigger = enb_agent_send_sf_trigger; mac_agent_registered[mod_id] = 1; return 1; @@ -1134,6 +1052,7 @@ int enb_agent_unregister_mac_xface(mid_t mod_id, AGENT_MAC_xface *xface) { xface->agent_ctxt = NULL; xface->enb_agent_send_sr_info = NULL; + xface->enb_agent_send_sf_trigger = NULL; mac_agent_registered[mod_id] = NULL; return 1; diff --git a/openair2/ENB_APP/enb_agent_mac.h b/openair2/ENB_APP/enb_agent_mac.h index 18a91716b0..4f8afbac08 100644 --- a/openair2/ENB_APP/enb_agent_mac.h +++ b/openair2/ENB_APP/enb_agent_mac.h @@ -94,13 +94,9 @@ int enb_agent_mac_sr_info(mid_t mod_id, const void *params, Protocol__ProgranMes int enb_agent_mac_destroy_sr_info(Protocol__ProgranMessage *msg); -int enb_agent_mac_dl_trigger(mid_t mod_id, const void *params, Protocol__ProgranMessage **msg); +int enb_agent_mac_sf_trigger(mid_t mod_id, const void *params, Protocol__ProgranMessage **msg); -int enb_agent_mac_destroy_dl_trigger(Protocol__ProgranMessage *msg); - -int enb_agent_mac_ul_trigger(mid_t mod_id, const void *params, Protocol__ProgranMessage **msg); - -int enb_agent_mac_destroy_ul_trigger(Protocol__ProgranMessage *msg); +int enb_agent_mac_destroy_sf_trigger(Protocol__ProgranMessage *msg); /********************************** @@ -111,9 +107,7 @@ int enb_agent_mac_destroy_ul_trigger(Protocol__ProgranMessage *msg); void enb_agent_send_sr_info(mid_t mod_id, msg_context_t *context); /*Inform the controller about the current UL/DL subframe*/ -void enb_agent_send_dl_trigger(mid_t mod_id, msg_context_t *context); - -void enb_agent_send_ul_trigger(mid_t mod_id, msg_context_t *context); +void enb_agent_send_sf_trigger(mid_t mod_id, msg_context_t *context); /*Register technology specific interface callbacks*/ int enb_agent_register_mac_xface(mid_t mod_id, AGENT_MAC_xface *xface); diff --git a/openair2/ENB_APP/enb_agent_mac_defs.h b/openair2/ENB_APP/enb_agent_mac_defs.h index 14d149f40c..a570165919 100644 --- a/openair2/ENB_APP/enb_agent_mac_defs.h +++ b/openair2/ENB_APP/enb_agent_mac_defs.h @@ -48,8 +48,7 @@ typedef struct { void (*enb_agent_send_sr_info)(mid_t mod_id, msg_context_t *context); /// Inform the controller about the current UL/DL subframe - void (*enb_agent_send_dl_trigger)(mid_t mod_id, msg_context_t *context); - void (*enb_agent_send_ul_trigger)(mid_t mod_id, msg_context_t *context); + void (*enb_agent_send_sf_trigger)(mid_t mod_id, msg_context_t *context); /*TODO: Fill in with the rest of the MAC layer technology specific callbacks (UL/DL scheduling, RACH info etc)*/ From 78bc736c19584dcac9106ad33cbaa39e0b9d05d2 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Tue, 19 Jan 2016 14:51:20 +0000 Subject: [PATCH 069/349] Fixed frame-subframe numbering bug --- openair2/ENB_APP/enb_agent_common.c | 25 +++++++++++++++++-------- openair2/ENB_APP/enb_agent_common.h | 10 ++++++++-- 2 files changed, 25 insertions(+), 10 deletions(-) diff --git a/openair2/ENB_APP/enb_agent_common.c b/openair2/ENB_APP/enb_agent_common.c index 8d9997e746..ce838766ee 100644 --- a/openair2/ENB_APP/enb_agent_common.c +++ b/openair2/ENB_APP/enb_agent_common.c @@ -292,13 +292,18 @@ int get_current_time_ms (mid_t mod_id, int subframe_flag){ } -int get_current_frame (mid_t mod_id) { - +unsigned int get_current_frame (mid_t mod_id) { + + #warning "SFN will not be in [0-1023] when oaisim is used" return ((eNB_MAC_INST *)enb[mod_id])->frame; } -int get_current_subframe (mid_t mod_id) { +unsigned int get_current_system_frame_num(mid_t mod_id) { + return (get_current_frame(mod_id) %1024); +} + +unsigned int get_current_subframe (mid_t mod_id) { return ((eNB_MAC_INST *)enb[mod_id])->subframe; @@ -306,12 +311,16 @@ int get_current_subframe (mid_t mod_id) { uint16_t get_sfn_sf (mid_t mod_id) { - uint16_t frame, subframe; - uint16_t sfn_sf; + frame_t frame; + sub_frame_t subframe; + uint16_t sfn_sf, frame_mask, sf_mask; + + frame = (frame_t) get_current_system_frame_num(mod_id); + subframe = (sub_frame_t) get_current_subframe(mod_id); + frame_mask = ((1<<12) - 1); + sf_mask = ((1<<4) -1); + sfn_sf = (subframe & sf_mask) | ((frame & frame_mask) << 4); - frame = (uint16_t) get_current_frame(mod_id); - subframe = (uint16_t) get_current_subframe(mod_id); - sfn_sf = (subframe << 12) | frame; return sfn_sf; } diff --git a/openair2/ENB_APP/enb_agent_common.h b/openair2/ENB_APP/enb_agent_common.h index f4add1ae2e..4762637b66 100644 --- a/openair2/ENB_APP/enb_agent_common.h +++ b/openair2/ENB_APP/enb_agent_common.h @@ -109,9 +109,15 @@ void set_enb_vars(mid_t mod_id, ran_name_t ran); int get_current_time_ms (mid_t mod_id, int subframe_flag); -int get_current_frame(mid_t mod_id); +/*Return the current frame number + *Could be using implementation specific numbering of frames + */ +unsigned int get_current_frame(mid_t mod_id); -int get_current_subframe(mid_t mod_id); +/*Return the current SFN (0-1023)*/ +unsigned int get_current_system_frame_num(mid_t mod_id); + +unsigned int get_current_subframe(mid_t mod_id); /*Return the frame and subframe number in compact 16-bit format. Bits 0-3 subframe, rest for frame. Required by progRAN protocol*/ From a054eb81396bb49504fb8875ffafb719ff87dbbc Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Thu, 21 Jan 2016 15:27:52 +0000 Subject: [PATCH 070/349] Added helper functions for the continuous update of MAC stats --- cmake_targets/CMakeLists.txt | 1 + openair2/ENB_APP/enb_agent_defs.h | 1 + openair2/ENB_APP/enb_agent_mac_internal.c | 560 ++++++++++++++++++++++ openair2/ENB_APP/enb_agent_mac_internal.h | 104 ++++ 4 files changed, 666 insertions(+) create mode 100644 openair2/ENB_APP/enb_agent_mac_internal.c create mode 100644 openair2/ENB_APP/enb_agent_mac_internal.h diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index a040013e56..eb9474e670 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -751,6 +751,7 @@ if (ENB_AGENT_SB_IF) ${OPENAIR2_DIR}/ENB_APP/enb_agent_task_manager.c ${OPENAIR2_DIR}/ENB_APP/enb_agent_net_comm.c ${OPENAIR2_DIR}/ENB_APP/enb_agent_async.c + ${OPENAIR2_DIR}/ENB_APP/enb_agent_mac_internal.c ) set(ENB_AGENT_LIB ENB_AGENT) #include_directories(${OPENAIR2_DIR}/ENB_APP) diff --git a/openair2/ENB_APP/enb_agent_defs.h b/openair2/ENB_APP/enb_agent_defs.h index e7ffe60c3f..0ddbc2064e 100644 --- a/openair2/ENB_APP/enb_agent_defs.h +++ b/openair2/ENB_APP/enb_agent_defs.h @@ -44,6 +44,7 @@ #include "link_manager.h" #define NUM_MAX_ENB_AGENT 2 +#define NUM_MAX_UE 2048 #define DEFAULT_ENB_AGENT_IPv4_ADDRESS "127.0.0.1" #define DEFAULT_ENB_AGENT_PORT 2210 diff --git a/openair2/ENB_APP/enb_agent_mac_internal.c b/openair2/ENB_APP/enb_agent_mac_internal.c new file mode 100644 index 0000000000..c3cc584bcd --- /dev/null +++ b/openair2/ENB_APP/enb_agent_mac_internal.c @@ -0,0 +1,560 @@ +/******************************************************************************* + OpenAirInterface + Copyright(c) 1999 - 2014 Eurecom + + OpenAirInterface is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + + OpenAirInterface is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with OpenAirInterface.The full GNU General Public License is + included in this distribution in the file called "COPYING". If not, + see . + + Contact Information + OpenAirInterface Admin: openair_admin@eurecom.fr + OpenAirInterface Tech : openair_tech@eurecom.fr + OpenAirInterface Dev : openair4g-devel@lists.eurecom.fr + + Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. + + *******************************************************************************/ + +/*! \file enb_agent_mac_internal.c + * \brief Helper functions for the MAC agent + * \author Xenofon Foukas + * \date 2016 + * \version 0.1 + */ + +#include "enb_agent_mac_internal.h" + +Protocol__ProgranMessage * enb_agent_generate_diff_mac_stats_report(Protocol__ProgranMessage *new_message, + Protocol__ProgranMessage *old_message) { + + int i, j; + + Protocol__PrpStatsReply *old_report, *new_report; + + Protocol__PrpStatsReply *stats_reply_msg = NULL; + Protocol__ProgranMessage *msg = NULL; + + Protocol__PrpUeStatsReport **ue_report; + Protocol__PrpUeStatsReport *tmp_ue_report[NUM_MAX_UE]; + Protocol__PrpCellStatsReport **cell_report; + Protocol__PrpCellStatsReport *tmp_cell_report[NUM_MAX_UE]; + + old_report = old_message->stats_reply_msg; + new_report = new_message->stats_reply_msg; + + /*Flags to designate changes in various levels of the message*/ + int stats_had_changes = 0; + int ue_had_change = 0; + int cell_had_change = 0; + + /*See how many and which UE reports should be included in the final stats message*/ + int n_ue_report = 0; + int ue_found = 0; + + /*Go through each RNTI of the new report and see if it exists in the old one*/ + for (i = 0; i < new_report->n_ue_report; i++) { + for (j = 0; j < old_report->n_ue_report; i++) { + if (new_report->ue_report[i]->rnti == old_report->ue_report[j]->rnti) { + ue_found = 1; + /*Need to check if something changed*/ + if (compare_ue_stats_reports(new_report->ue_report[i], old_report->ue_report[j]) != 0) { + tmp_ue_report[n_ue_report] = copy_ue_stats_report(new_report->ue_report[i]); + n_ue_report++; + } + break; + } + } + if (!ue_found) { + tmp_ue_report[n_ue_report] = copy_ue_stats_report(new_report->ue_report[i]); + n_ue_report++; + } + ue_found = 0; + } + + /*See how many and which cell reports should be included in the final stats message*/ + int n_cell_report = 0; + int cell_found = 0; + + /*Go through each cell of the new report and see if it exists in the old one*/ + for (i = 0; i < new_report->n_cell_report; i++) { + for (j = 0; j < old_report->n_cell_report; i++) { + if (new_report->cell_report[i]->carrier_index == old_report->cell_report[j]->carrier_index) { + cell_found = 1; + /*Need to check if something changed*/ + if (compare_cell_stats_reports(new_report->cell_report[i], old_report->cell_report[j]) != 0) { + tmp_cell_report[n_cell_report] = copy_cell_stats_report(new_report->cell_report[i]); + n_cell_report++; + } + break; + } + } + if (!cell_found) { + tmp_cell_report[n_cell_report] = copy_cell_stats_report(new_report->cell_report[i]); + n_cell_report++; + } + cell_found = 0; + } + + /*TODO: create the reply message based on the findings*/ + /*Create ue report list*/ + if (n_ue_report > 0) { + ue_report = malloc(sizeof(Protocol__PrpUeStatsReport *)); + for (i = 0; i 0) { + cell_report = malloc(sizeof(Protocol__PrpCellStatsReport *)); + for (i = 0; i 0 || n_ue_report > 0) { + /*Create header*/ + int xid = old_report->header->xid; + Protocol__PrpHeader *header; + if (prp_create_header(xid, PROTOCOL__PRP_TYPE__PRPT_STATS_REPLY, &header) != 0) { + goto error; + } + stats_reply_msg = malloc(sizeof(Protocol__PrpStatsReply)); + protocol__prp_stats_reply__init(stats_reply_msg); + stats_reply_msg->header = header; + stats_reply_msg->n_ue_report = n_ue_report; + stats_reply_msg->ue_report = ue_report; + stats_reply_msg->n_cell_report = n_cell_report; + stats_reply_msg->cell_report = cell_report; + msg = malloc(sizeof(Protocol__ProgranMessage)); + if(msg == NULL) + goto error; + protocol__progran_message__init(msg); + msg->msg_case = PROTOCOL__PROGRAN_MESSAGE__MSG_STATS_REPLY_MSG; + msg->msg_dir = PROTOCOL__PROGRAN_DIRECTION__SUCCESSFUL_OUTCOME; + msg->stats_reply_msg = stats_reply_msg; + } + return msg; + + error: + return NULL; +} + +int compare_ue_stats_reports(Protocol__PrpUeStatsReport *rep1, + Protocol__PrpUeStatsReport *rep2) { + return 1; +} + +int compare_cell_stats_reports(Protocol__PrpCellStatsReport *rep1, + Protocol__PrpCellStatsReport *rep2) { + return 1; +} + +Protocol__PrpUeStatsReport * copy_ue_stats_report(Protocol__PrpUeStatsReport * original) { + int i; + Protocol__PrpUeStatsReport *copy = malloc(sizeof(Protocol__PrpUeStatsReport)); + if (copy == NULL) + goto error; + protocol__prp_ue_stats_report__init(copy); + copy->rnti = original->rnti; + copy->has_rnti = original->has_rnti; + copy->flags = original->flags; + copy->has_flags = original->has_flags; + + if (copy->flags & PROTOCOL__PRP_UE_STATS_TYPE__PRUST_BSR) { + copy->n_bsr = original->n_bsr; + if (copy->n_bsr > 0) { + uint32_t *elem; + elem = (uint32_t *) malloc(sizeof(uint32_t)*copy->n_bsr); + if (elem == NULL) + goto error; + for (i = 0; i < original->n_bsr; i++) { + elem[i] = original->bsr[i]; + } + copy->bsr = elem; + } + } + + if (copy->flags & PROTOCOL__PRP_UE_STATS_TYPE__PRUST_PRH) { + copy->has_phr = original->has_phr; + copy->phr = original->phr; + } + + if (copy->flags & PROTOCOL__PRP_UE_STATS_TYPE__PRUST_RLC_BS) { + copy->n_rlc_report = original->n_rlc_report; + if (copy->n_rlc_report > 0) { + Protocol__PrpRlcBsr ** rlc_reports; + rlc_reports = malloc(sizeof(Protocol__PrpRlcBsr) * copy->n_rlc_report); + if (rlc_reports == NULL) + goto error; + for (i = 0; i < copy->n_rlc_report; i++) { + rlc_reports[i] = copy_rlc_report(original->rlc_report[i]); + } + copy->rlc_report = rlc_reports; + } + } + + if (copy->flags & PROTOCOL__PRP_UE_STATS_TYPE__PRUST_MAC_CE_BS) { + copy->has_pending_mac_ces = original->has_pending_mac_ces; + copy->pending_mac_ces = original->pending_mac_ces; + + } + + if (copy->flags & PROTOCOL__PRP_UE_STATS_TYPE__PRUST_DL_CQI) { + copy->dl_cqi_report = copy_dl_cqi_report(original->dl_cqi_report); + } + + if (copy->flags & PROTOCOL__PRP_UE_STATS_TYPE__PRUST_PBS) { + /*Copy the Paging Buffer report*/ + copy->pbr = copy_paging_buffer_report(original->pbr); + } + + if (copy->flags & PROTOCOL__PRP_UE_STATS_TYPE__PRUST_UL_CQI) { + /*TODO: Copy the UL report*/ + copy->ul_cqi_report = copy_ul_cqi_report(original->ul_cqi_report); + } + + return copy; + + error: + return NULL; +} + +Protocol__PrpRlcBsr * copy_rlc_report(Protocol__PrpRlcBsr * original) { + Protocol__PrpRlcBsr * copy = malloc(sizeof(Protocol__PrpRlcBsr)); + if (copy == NULL) + goto error; + protocol__prp_rlc_bsr__init(copy); + copy->lc_id = original->lc_id; + copy->has_lc_id = original->has_lc_id; + copy->tx_queue_size = original->tx_queue_size; + copy->has_tx_queue_size = original->has_tx_queue_size; + copy->tx_queue_hol_delay = original->tx_queue_hol_delay; + copy->has_tx_queue_hol_delay = original->has_tx_queue_hol_delay; + copy->retransmission_queue_size = original->retransmission_queue_size; + copy->has_retransmission_queue_size = original->has_retransmission_queue_size; + copy->retransmission_queue_hol_delay = original->retransmission_queue_hol_delay; + copy->has_retransmission_queue_hol_delay = original->has_retransmission_queue_hol_delay; + copy->status_pdu_size = original->status_pdu_size; + copy->has_status_pdu_size = original->has_status_pdu_size; + + return copy; + + error: + return NULL; +} + +Protocol__PrpUlCqiReport * copy_ul_cqi_report(Protocol__PrpUlCqiReport * original) { + int i, j; + + //Fill in the full UL CQI report of the UE + Protocol__PrpUlCqiReport *full_ul_report; + full_ul_report = malloc(sizeof(Protocol__PrpUlCqiReport)); + if(full_ul_report == NULL) { + goto error; + } + protocol__prp_ul_cqi_report__init(full_ul_report); + //TODO:Set the SFN and SF of the generated report + full_ul_report->sfn_sn = original->sfn_sn; + full_ul_report->has_sfn_sn = original->has_sfn_sn; + full_ul_report->n_cqi_meas = original->n_cqi_meas; + + Protocol__PrpUlCqi **ul_report; + ul_report = malloc(sizeof(Protocol__PrpUlCqi *) * full_ul_report->n_cqi_meas); + if(ul_report == NULL) + goto error; + for(i = 0; i++; i < full_ul_report->n_cqi_meas) { + ul_report[i] = malloc(sizeof(Protocol__PrpUlCqi)); + if(ul_report[i] == NULL) + goto error; + protocol__prp_ul_cqi__init(ul_report[i]); + ul_report[i]->type = original->cqi_meas[i]->type; + ul_report[i]->has_type = original->cqi_meas[i]->has_type; + ul_report[i]->n_sinr = original->cqi_meas[i]->n_sinr; + uint32_t *sinr_meas; + sinr_meas = (uint32_t *) malloc(sizeof(uint32_t) * ul_report[i]->n_sinr); + if (sinr_meas == NULL) + goto error; + for (j = 0; j < ul_report[i]->n_sinr; j++) { + sinr_meas[j] = original->cqi_meas[i]->sinr[j]; + } + ul_report[i]->sinr = sinr_meas; + ul_report[i]->serv_cell_index = original->cqi_meas[i]->serv_cell_index; + ul_report[i]->has_serv_cell_index = original->cqi_meas[i]->has_serv_cell_index; + } + full_ul_report->cqi_meas = ul_report; + + return full_ul_report; + + error: + return NULL; +} + +Protocol__PrpDlCqiReport * copy_dl_cqi_report(Protocol__PrpDlCqiReport * original) { + int i; + /*Copy the DL report*/ + Protocol__PrpDlCqiReport * dl_report; + dl_report = malloc(sizeof(Protocol__PrpDlCqiReport)); + if (dl_report == NULL) + goto error; + protocol__prp_dl_cqi_report__init(dl_report); + + dl_report->sfn_sn = original->sfn_sn; + dl_report->has_sfn_sn = original->has_sfn_sn; + dl_report->n_csi_report = original->n_csi_report; + + Protocol__PrpDlCsi **csi_reports; + csi_reports = malloc(sizeof(Protocol__PrpDlCsi *) * dl_report->n_csi_report); + if (csi_reports == NULL) + goto error; + + for (i = 0; i < dl_report->n_csi_report; i++) { + csi_reports[i] = copy_csi_report(original->csi_report[i]); + } + dl_report->csi_report = csi_reports; + return dl_report; + + error: + /*TODO: Must free memory properly*/ + return NULL; +} + +Protocol__PrpPagingBufferReport * copy_paging_buffer_report(Protocol__PrpPagingBufferReport *original) { + + int i; + Protocol__PrpPagingBufferReport *copy; + copy = malloc(sizeof(Protocol__PrpPagingBufferReport)); + if (copy == NULL) + goto error; + + protocol__prp_paging_buffer_report__init(copy); + copy->n_paging_info = original->n_paging_info; + + Protocol__PrpPagingInfo **p_info; + p_info = malloc(sizeof(Protocol__PrpPagingInfo *) * copy->n_paging_info); + if (p_info == NULL) + goto error; + for (i = 0; i < copy->n_paging_info; i++) { + p_info[i] = malloc(sizeof(Protocol__PrpPagingInfo)); + if(p_info[i] == NULL) + goto error; + protocol__prp_paging_info__init(p_info[i]); + p_info[i]->paging_index = original->paging_info[i]->paging_index; + p_info[i]->has_paging_index = original->paging_info[i]->has_paging_index;; + p_info[i]->paging_message_size = original->paging_info[i]->paging_message_size; + p_info[i]->has_paging_message_size = original->paging_info[i]->has_paging_message_size; + p_info[i]->paging_subframe = original->paging_info[i]->paging_subframe; + p_info[i]->has_paging_subframe = original->paging_info[i]->has_paging_subframe; + p_info[i]->carrier_index = original->paging_info[i]->carrier_index; + p_info[i]->has_carrier_index = original->paging_info[i]->has_carrier_index; + } + copy->paging_info = p_info; + return copy; + + error: + /*TODO: free memory properly*/ + return NULL; +} + +Protocol__PrpDlCsi * copy_csi_report(Protocol__PrpDlCsi * original) { + int i, j; + Protocol__PrpDlCsi *copy = malloc(sizeof(Protocol__PrpDlCsi)); + if (copy == NULL) + goto error; + protocol__prp_dl_csi__init(copy); + copy->serv_cell_index = original->serv_cell_index; + copy->has_serv_cell_index = original->has_serv_cell_index; + copy->ri = original->ri; + copy->has_ri = original->ri; + + copy->type = original->type; + copy->has_type = original->has_type; + copy->report_case = original->report_case; + + switch (copy->report_case) { + case PROTOCOL__PRP_DL_CSI__REPORT_P10CSI: + copy->p10csi->wb_cqi = original->p10csi->wb_cqi; + copy->p10csi->has_wb_cqi = original->p10csi->has_wb_cqi; + break; + case PROTOCOL__PRP_DL_CSI__REPORT_P11CSI: + copy->p11csi->n_wb_cqi = original->p11csi->n_wb_cqi; + copy->p11csi->wb_cqi = (uint32_t *) malloc(sizeof(uint32_t) * copy->p11csi->n_wb_cqi); + for (i = 0; i < copy->p11csi->n_wb_cqi; i++) { + copy->p11csi->wb_cqi[i] = original->p11csi->wb_cqi[i]; + } + copy->p11csi->has_wb_pmi = original->p11csi->has_wb_pmi; + copy->p11csi->wb_pmi = original->p11csi->wb_pmi; + break; + case PROTOCOL__PRP_DL_CSI__REPORT_P20CSI: + copy->p20csi->has_wb_cqi = original->p20csi->has_wb_cqi; + copy->p20csi->wb_cqi = original->p20csi->wb_cqi; + copy->p20csi->has_sb_cqi = original->p20csi->has_sb_cqi; + copy->p20csi->sb_cqi = original->p20csi->sb_cqi; + copy->p20csi->has_bandwidth_part_index = original->p20csi->has_bandwidth_part_index; + copy->p20csi->bandwidth_part_index = original->p20csi->bandwidth_part_index; + copy->p20csi->has_sb_index = original->p20csi->has_sb_index; + copy->p20csi->sb_index = original->p20csi->sb_index; + break; + case PROTOCOL__PRP_DL_CSI__REPORT_P21CSI: + copy->p21csi->n_wb_cqi = original->p21csi->n_wb_cqi; + copy->p21csi->wb_cqi = (uint32_t *) malloc(sizeof(uint32_t) * copy->p21csi->n_wb_cqi); + for (i = 0; i < copy->p21csi->n_wb_cqi; i++) { + copy->p21csi->wb_cqi[i] = original->p21csi->wb_cqi[i]; + } + copy->p21csi->has_wb_pmi = original->p21csi->has_wb_pmi; + copy->p21csi->wb_pmi = original->p21csi->wb_pmi; + copy->p21csi->n_sb_cqi = original->p21csi->n_sb_cqi; + copy->p21csi->sb_cqi = (uint32_t *) malloc(sizeof(uint32_t) * copy->p21csi->n_sb_cqi); + for (i = 0; i < copy->p21csi->n_sb_cqi; i++) { + copy->p21csi->sb_cqi[i] = original->p21csi->sb_cqi[i]; + } + copy->p21csi->has_badwidth_part_index = original->p21csi->has_badwidth_part_index; + copy->p21csi->badwidth_part_index = original->p21csi->badwidth_part_index; + copy->p21csi->has_sb_index = original->p21csi->has_sb_index; + copy->p21csi->sb_index = original->p21csi->sb_index; + break; + case PROTOCOL__PRP_DL_CSI__REPORT_A12CSI: + copy->a12csi->n_wb_cqi = original->a12csi->n_wb_cqi; + copy->a12csi->wb_cqi = (uint32_t *) malloc(sizeof(uint32_t) * copy->a12csi->n_wb_cqi); + for (i = 0; i < copy->a12csi->n_wb_cqi; i++) { + copy->a12csi->wb_cqi[i] = original->a12csi->wb_cqi[i]; + } + copy->a12csi->n_sb_pmi = original->a12csi->n_sb_pmi; + copy->a12csi->sb_pmi = (uint32_t *) malloc(sizeof(uint32_t) * copy->a12csi->n_sb_pmi); + for (i = 0; i < copy->a12csi->n_sb_pmi; i++) { + copy->a12csi->sb_pmi[i] = original->a12csi->sb_pmi[i]; + } + break; + case PROTOCOL__PRP_DL_CSI__REPORT_A22CSI: + copy->a22csi->n_wb_cqi = original->a22csi->n_wb_cqi; + copy->a22csi->wb_cqi = (uint32_t *) malloc(sizeof(uint32_t) * copy->a22csi->n_wb_cqi); + for (i = 0; i < copy->a22csi->n_wb_cqi; i++) { + copy->a22csi->wb_cqi[i] = original->a22csi->wb_cqi[i]; + } + copy->a22csi->n_sb_cqi = original->a22csi->n_sb_cqi; + copy->a22csi->sb_cqi = (uint32_t *) malloc(sizeof(uint32_t) * copy->a22csi->n_sb_cqi); + for (i = 0; i < copy->a22csi->n_sb_cqi; i++) { + copy->a22csi->sb_cqi[i] = original->a22csi->sb_cqi[i]; + } + copy->a22csi->has_wb_pmi = original->a22csi->has_wb_pmi; + copy->a22csi->wb_pmi = original->a22csi->wb_pmi; + copy->a22csi->has_sb_pmi = original->a22csi->has_sb_pmi; + copy->a22csi->sb_pmi = original->a22csi->sb_pmi; + copy->a22csi->n_sb_list = original->a22csi->n_sb_list; + copy->a22csi->sb_list = (uint32_t *) malloc(sizeof(uint32_t) * copy->a22csi->n_sb_list); + for (i = 0; i < copy->a22csi->n_sb_list; i++) { + copy->a22csi->sb_list[i] = original->a22csi->sb_list[i]; + } + break; + case PROTOCOL__PRP_DL_CSI__REPORT_A20CSI: + copy->a20csi->has_wb_cqi = original->a20csi->has_wb_cqi; + copy->a20csi->wb_cqi = original->a20csi->wb_cqi; + copy->a20csi->has_sb_cqi = original->a20csi->has_sb_cqi; + copy->a20csi->sb_cqi = original->a20csi->sb_cqi; + copy->a20csi->n_sb_list = original->a20csi->n_sb_list; + copy->a20csi->sb_list = (uint32_t *) malloc(sizeof(uint32_t) * copy->a20csi->n_sb_list); + for (i = 0; i < copy->a20csi->n_sb_list; i++) { + copy->a20csi->sb_list[i] = original->a20csi->sb_list[i]; + } + break; + case PROTOCOL__PRP_DL_CSI__REPORT_A30CSI: + copy->a30csi->has_wb_cqi = original->a30csi->has_wb_cqi; + copy->a30csi->wb_cqi = original->a30csi->wb_cqi; + copy->a30csi->n_sb_cqi = original->a30csi->n_sb_cqi; + copy->a30csi->sb_cqi = (uint32_t *) malloc(sizeof(uint32_t) * copy->a30csi->n_sb_cqi); + for (i = 0; i < copy->a30csi->n_sb_cqi; i++) { + copy->a30csi->sb_cqi[i] = original->a30csi->sb_cqi[i]; + } + break; + case PROTOCOL__PRP_DL_CSI__REPORT_A31CSI: + copy->a31csi->n_wb_cqi = original->a31csi->n_wb_cqi; + copy->a31csi->wb_cqi = (uint32_t *) malloc(sizeof(uint32_t) * copy->a31csi->n_wb_cqi); + for (i = 0; i < copy->a31csi->n_wb_cqi; i++) { + copy->a31csi->wb_cqi[i] = original->a31csi->wb_cqi[i]; + } + copy->a31csi->has_wb_pmi = original->a31csi->has_wb_pmi; + copy->a31csi->wb_pmi = original->a31csi->wb_pmi; + copy->a31csi->n_sb_cqi = original->a31csi->n_sb_cqi; + copy->a31csi->sb_cqi = malloc(sizeof(Protocol__PrpMsbCqi *) * copy->a31csi->n_sb_cqi); + if (copy->a31csi == NULL) { + goto error; + } + for (i = 0; i < copy->a31csi->n_sb_cqi; i++) { + copy->a31csi->sb_cqi[i] = malloc(sizeof(Protocol__PrpMsbCqi)); + if (copy->a31csi->sb_cqi[i] == NULL) { + goto error; + } + protocol__prp_msb_cqi__init(copy->a31csi->sb_cqi[i]); + copy->a31csi->sb_cqi[i]->n_sb_cqi = original->a31csi->sb_cqi[i]->n_sb_cqi; + copy->a31csi->sb_cqi[i]->sb_cqi = (uint32_t *) malloc(sizeof(uint32_t) * copy->a31csi->sb_cqi[i]->n_sb_cqi); + for (j = 0; j < copy->a31csi->sb_cqi[i]->n_sb_cqi; j++) { + copy->a31csi->sb_cqi[i]->sb_cqi[j] = original->a31csi->sb_cqi[i]->sb_cqi[j]; + } + } + break; + default: + goto error; + } + return copy; + + error: + return NULL; +} + +Protocol__PrpCellStatsReport * copy_cell_stats_report(Protocol__PrpCellStatsReport *original) { + + Protocol__PrpCellStatsReport * copy = malloc(sizeof(Protocol__PrpCellStatsReport)); + + if(copy == NULL) { + goto error; + } + protocol__prp_cell_stats_report__init(copy); + copy->carrier_index = original->carrier_index; + copy->has_carrier_index = original->has_carrier_index; + copy->flags = original->flags; + copy->has_flags = original->has_flags; + + if(copy->flags & PROTOCOL__PRP_CELL_STATS_TYPE__PRCST_NOISE_INTERFERENCE) { + copy->noise_inter_report = copy_noise_inter_report(original->noise_inter_report); + } + + return copy; + + error: + return NULL; +} + +Protocol__PrpNoiseInterferenceReport * copy_noise_inter_report(Protocol__PrpNoiseInterferenceReport *original) { + Protocol__PrpNoiseInterferenceReport *ni_report; + ni_report = malloc(sizeof(Protocol__PrpNoiseInterferenceReport)); + if(ni_report == NULL) { + goto error; + } + protocol__prp_noise_interference_report__init(ni_report); + // Current frame and subframe number + ni_report->sfn_sf = original->sfn_sf; + ni_report->has_sfn_sf = original->sfn_sf; + // Received interference power in dbm + ni_report->rip = original->rip; + ni_report->has_rip = original->has_rip; + // Thermal noise power in dbm + ni_report->tnp = original->tnp; + ni_report->has_tnp = original->has_tnp; + + return ni_report; + + error: + return NULL; +} diff --git a/openair2/ENB_APP/enb_agent_mac_internal.h b/openair2/ENB_APP/enb_agent_mac_internal.h new file mode 100644 index 0000000000..98c15e083f --- /dev/null +++ b/openair2/ENB_APP/enb_agent_mac_internal.h @@ -0,0 +1,104 @@ +/******************************************************************************* + OpenAirInterface + Copyright(c) 1999 - 2014 Eurecom + + OpenAirInterface is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + + OpenAirInterface is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with OpenAirInterface.The full GNU General Public License is + included in this distribution in the file called "COPYING". If not, + see . + + Contact Information + OpenAirInterface Admin: openair_admin@eurecom.fr + OpenAirInterface Tech : openair_tech@eurecom.fr + OpenAirInterface Dev : openair4g-devel@lists.eurecom.fr + + Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. + + *******************************************************************************/ + +/*! \file enb_agent_mac_internal.h + * \brief Implementation specific definitions for the eNB MAC agent + * \author Xenofon Foukas + * \date 2016 + * \version 0.1 + */ + +#ifndef ENB_AGENT_MAC_INTERNAL_H_ +#define ENB_AGENT_MAC_INTERNAL_H_ + +#include + +#include "enb_agent_mac.h" +#include "enb_agent_common.h" + + +/*Flags showing if a mac agent has already been registered*/ +unsigned int mac_agent_registered[NUM_MAX_ENB_AGENT]; + +/*This will be used for producing continuous status updates for the MAC + *Needs to be thread-safe + */ +typedef struct { + /*Flag showing if continuous mac stats update is enabled*/ + uint8_t is_initialized; + volatile uint8_t cont_update; + xid_t xid; + Protocol__ProgranMessage *stats_req; + Protocol__ProgranMessage *prev_stats_reply; + + pthread_mutex_t *mutex; +} mac_stats_updates_context_t; + +/*Array holding the last stats reports for each eNB. Used for continuous reporting*/ +mac_stats_updates_context_t mac_stats_context[NUM_MAX_ENB_AGENT]; + +/*Functions to initialize and destroy the struct required for the + *continuous stats update report*/ +err_code_t enb_agent_init_cont_mac_stats_update(mid_t mod_id); + +err_code_t enb_agent_destroy_cont_mac_stats_update(mid_t mod_id); + + +/*Enable/Disable the continuous stats update service for the MAC*/ +err_code_t enb_agent_enable_cont_mac_stats_update(mid_t mod_id, xid_t xid, + stats_request_config_t *stats_req); + +err_code_t enb_agent_disable_cont_mac_stats_update(mid_t mod_id); + +Protocol__ProgranMessage * enb_agent_generate_diff_mac_stats_report(Protocol__ProgranMessage *new_report, + Protocol__ProgranMessage *old_report); + +Protocol__PrpUeStatsReport * copy_ue_stats_report(Protocol__PrpUeStatsReport * original); + +Protocol__PrpCellStatsReport * copy_cell_stats_report(Protocol__PrpCellStatsReport *original); + +Protocol__PrpRlcBsr * copy_rlc_report(Protocol__PrpRlcBsr * original); + +Protocol__PrpUlCqiReport * copy_ul_cqi_report(Protocol__PrpUlCqiReport * original); + +Protocol__PrpDlCqiReport * copy_dl_cqi_report(Protocol__PrpDlCqiReport * original); + +Protocol__PrpPagingBufferReport * copy_paging_buffer_report(Protocol__PrpPagingBufferReport *original); + +Protocol__PrpDlCsi * copy_csi_report(Protocol__PrpDlCsi * original); + +Protocol__PrpNoiseInterferenceReport * copy_noise_inter_report(Protocol__PrpNoiseInterferenceReport *original); + +int compare_ue_stats_reports(Protocol__PrpUeStatsReport *rep1, + Protocol__PrpUeStatsReport *rep2); + +int compare_cell_stats_reports(Protocol__PrpCellStatsReport *rep1, + Protocol__PrpCellStatsReport *rep2); + +#endif /*ENB_AGENT_MAC_INTERNAL_H_*/ From dec1c93c3dc716bfc9c0abd86677bef8fe1e6c17 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Fri, 22 Jan 2016 16:18:54 +0000 Subject: [PATCH 071/349] Changed channel struct for async_channel implementation --- openair2/ENB_APP/enb_agent_async.c | 22 +++++++++++----------- openair2/ENB_APP/enb_agent_async.h | 10 +++++++++- openair2/ENB_APP/enb_agent_net_comm.c | 6 +++--- 3 files changed, 23 insertions(+), 15 deletions(-) diff --git a/openair2/ENB_APP/enb_agent_async.c b/openair2/ENB_APP/enb_agent_async.c index 962e1a81ed..d6389ea65f 100644 --- a/openair2/ENB_APP/enb_agent_async.c +++ b/openair2/ENB_APP/enb_agent_async.c @@ -39,21 +39,21 @@ #include "log.h" -enb_agent_instance_t * enb_agent_async_channel_info(mid_t mod_id, char *dst_ip, uint16_t dst_port) { +enb_agent_async_channel_t * enb_agent_async_channel_info(mid_t mod_id, char *dst_ip, uint16_t dst_port) { - enb_agent_instance_t *channel; - channel = (enb_agent_instance_t *) malloc(sizeof(enb_agent_instance_t)); + enb_agent_async_channel_t *channel; + channel = (enb_agent_async_channel_t *) malloc(sizeof(enb_agent_channel_t)); if (channel == NULL) goto error; - channel->mod_id = mod_id; + channel->enb_id = mod_id; /*Create a socket*/ channel->link = new_link_client(dst_ip, dst_port); if (channel->link == NULL) goto error; LOG_I(ENB_AGENT,"starting enb agent client for module id %d on ipv4 %s, port %d\n", - channel->mod_id, + channel->enb_id, dst_ip, dst_port); @@ -80,22 +80,22 @@ enb_agent_instance_t * enb_agent_async_channel_info(mid_t mod_id, char *dst_ip, } int enb_agent_async_msg_send(void *data, int size, int priority, void *channel_info) { - enb_agent_instance_t *channel; - channel = (enb_agent_instance_t *)channel_info; + enb_agent_async_channel_t *channel; + channel = (enb_agent_channel_t *)channel_info; return message_put(channel->send_queue, data, size, priority); } int enb_agent_async_msg_recv(void **data, int *size, int *priority, void *channel_info) { - enb_agent_instance_t *channel; - channel = (enb_agent_instance_t *)channel_info; + enb_agent_async_channel_t *channel; + channel = (enb_agent_async_channel_t *)channel_info; return message_get(channel->receive_queue, data, size, priority); } void enb_agent_async_release(enb_agent_channel_t *channel) { - enb_agent_instance_t *channel_info; - channel_info = (enb_agent_instance_t *) channel->channel_info; + enb_agent_async_channel_t *channel_info; + channel_info = (enb_agent_async_channel_t *) channel->channel_info; destroy_link_manager(channel_info->manager); diff --git a/openair2/ENB_APP/enb_agent_async.h b/openair2/ENB_APP/enb_agent_async.h index 53614cc87d..d722f92a8e 100644 --- a/openair2/ENB_APP/enb_agent_async.h +++ b/openair2/ENB_APP/enb_agent_async.h @@ -39,7 +39,15 @@ #include "enb_agent_net_comm.h" -enb_agent_instance_t * enb_agent_async_channel_info(mid_t mod_id, char *dst_ip, uint16_t dst_port); +typedef struct { + mid_t enb_id; + socket_link_t *link; + message_queue_t *send_queue; + message_queue_t *receive_queue; + link_manager_t *manager; +} enb_agent_async_channel_t; + +enb_agent_async_channel_t * enb_agent_async_channel_info(mid_t mod_id, char *dst_ip, uint16_t dst_port); int enb_agent_async_msg_send(void *data, int size, int priority, void *channel_info); diff --git a/openair2/ENB_APP/enb_agent_net_comm.c b/openair2/ENB_APP/enb_agent_net_comm.c index 5c4544ad63..e180d7affd 100644 --- a/openair2/ENB_APP/enb_agent_net_comm.c +++ b/openair2/ENB_APP/enb_agent_net_comm.c @@ -37,7 +37,7 @@ #include "enb_agent_net_comm.h" #include "log.h" -enb_agent_channel_t *agent_channel[NUM_MAX_ENB_AGENT][ENB_AGENT_MAX]; +enb_agent_channel_t *agent_channel[NUM_MAX_ENB][ENB_AGENT_MAX]; enb_agent_channel_instance_t channel_instance; int enb_agent_channel_id = 0; @@ -146,7 +146,7 @@ int enb_agent_destroy_channel(int channel_id) { } /*Unregister the channel from all agents*/ - for (i = 0; i < NUM_MAX_ENB_AGENT; i++) { + for (i = 0; i < NUM_MAX_ENB; i++) { for (j = 0; j < ENB_AGENT_MAX; j++) { if (agent_channel[i][j] != NULL) { if (agent_channel[i][j]->channel_id == e->channel_id) { @@ -170,7 +170,7 @@ err_code_t enb_agent_init_channel_container(void) { RB_INIT(&channel_instance.enb_agent_head); - for (i = 0; i < NUM_MAX_ENB_AGENT; i++) { + for (i = 0; i < NUM_MAX_ENB; i++) { for (j = 0; j < ENB_AGENT_MAX; j++) { agent_channel[i][j] == NULL; } From 3ad4d26fd1f619ef98f3fa94f41e5973ce537493 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Fri, 22 Jan 2016 16:26:06 +0000 Subject: [PATCH 072/349] Changed the structures for storing agent context info --- openair2/ENB_APP/enb_agent.c | 103 +++++----------------- openair2/ENB_APP/enb_agent_common.c | 4 +- openair2/ENB_APP/enb_agent_defs.h | 29 ++---- openair2/ENB_APP/enb_agent_extern.h | 7 +- openair2/ENB_APP/enb_agent_mac_defs.h | 10 ++- openair2/ENB_APP/enb_agent_mac_internal.h | 5 +- 6 files changed, 47 insertions(+), 111 deletions(-) diff --git a/openair2/ENB_APP/enb_agent.c b/openair2/ENB_APP/enb_agent.c index fa24cacf8a..c48f8f67fb 100644 --- a/openair2/ENB_APP/enb_agent.c +++ b/openair2/ENB_APP/enb_agent.c @@ -37,6 +37,7 @@ #include "enb_agent_common.h" #include "log.h" #include "enb_agent.h" +#include "enb_agent_mac_defs.h" #include "enb_agent_extern.h" @@ -47,10 +48,7 @@ //#define TEST_TIMER -enb_agent_instance_t enb_agent[NUM_MAX_ENB_AGENT]; -msg_context_t shared_ctxt[NUM_MAX_ENB_AGENT]; -/* this could also go into enb_agent struct*/ -enb_agent_info_t enb_agent_info; +enb_agent_instance_t enb_agent[NUM_MAX_ENB]; char in_ip[40]; static uint16_t in_port; @@ -66,7 +64,7 @@ Protocol__ProgranMessage *enb_agent_timeout(void* args); */ void *enb_agent_task(void *args){ - msg_context_t *d = (msg_context_t *) args; + enb_agent_instance_t *d = (enb_agent_instance_t *) args; Protocol__ProgranMessage *msg; void *data; int size; @@ -101,15 +99,11 @@ void *enb_agent_task(void *args){ msg = enb_agent_process_timeout(msg_p->ittiMsg.timer_has_expired.timer_id, msg_p->ittiMsg.timer_has_expired.arg); if (msg != NULL){ data=enb_agent_pack_message(msg,&size); - if (enb_agent_msg_send(d->mod_id, ENB_AGENT_DEFAULT, data, size, priority)) { + if (enb_agent_msg_send(d->enb_id, ENB_AGENT_DEFAULT, data, size, priority)) { err_code = PROTOCOL__PROGRAN_ERR__MSG_ENQUEUING; goto error; } - /* if (message_put(d->tx_mq, data, size, priority)){ */ - /* err_code = PROTOCOL__PROGRAN_ERR__MSG_ENQUEUING; */ - /* goto error; */ - /* } */ LOG_D(ENB_AGENT,"sent message with size %d\n", size); } break; @@ -131,7 +125,7 @@ void *enb_agent_task(void *args){ void *receive_thread(void *args) { - msg_context_t *d = args; + enb_agent_instance_t *d = args; void *data; int size; int priority; @@ -140,38 +134,27 @@ void *receive_thread(void *args) { Protocol__ProgranMessage *msg; while (1) { - if (enb_agent_msg_recv(d->mod_id, ENB_AGENT_DEFAULT, &data, &size, &priority)) { + if (enb_agent_msg_recv(d->enb_id, ENB_AGENT_DEFAULT, &data, &size, &priority)) { err_code = PROTOCOL__PROGRAN_ERR__MSG_DEQUEUING; goto error; } - /* if (message_get(d->rx_mq, &data, &size, &priority)){ */ - /* err_code = PROTOCOL__PROGRAN_ERR__MSG_DEQUEUING; */ - /* goto error; */ - /* } */ LOG_D(ENB_AGENT,"received message with size %d\n", size); - msg=enb_agent_handle_message(d->mod_id, data, size); + msg=enb_agent_handle_message(d->enb_id, data, size); free(data); - d->rx_xid = ((d->rx_xid)+1)%4; - d->tx_xid = d->rx_xid; - // check if there is something to send back to the controller if (msg != NULL){ data=enb_agent_pack_message(msg,&size); - if (enb_agent_msg_send(d->mod_id, ENB_AGENT_DEFAULT, data, size, priority)) { + if (enb_agent_msg_send(d->enb_id, ENB_AGENT_DEFAULT, data, size, priority)) { err_code = PROTOCOL__PROGRAN_ERR__MSG_ENQUEUING; goto error; } - /* if (message_put(d->tx_mq, data, size, priority)){ */ - /* err_code = PROTOCOL__PROGRAN_ERR__MSG_ENQUEUING; */ - /* goto error; */ - /* } */ LOG_D(ENB_AGENT,"sent message with size %d\n", size); } @@ -214,10 +197,8 @@ int enb_agent_start(mid_t mod_id, const Enb_properties_array_t* enb_properties){ int channel_id; - // set_enb_vars(mod_id, RAN_LTE_OAI); - enb_agent[mod_id].mod_id = mod_id; - enb_agent_info.nb_modules+=1; + enb_agent[mod_id].enb_id = mod_id; /* * check the configuration @@ -235,7 +216,7 @@ int enb_agent_start(mid_t mod_id, const Enb_properties_array_t* enb_properties){ in_port = DEFAULT_ENB_AGENT_PORT ; } LOG_I(ENB_AGENT,"starting enb agent client for module id %d on ipv4 %s, port %d\n", - enb_agent[mod_id].mod_id, + enb_agent[mod_id].enb_id, in_ip, in_port); @@ -271,46 +252,10 @@ int enb_agent_start(mid_t mod_id, const Enb_properties_array_t* enb_properties){ *enb_agent_register_channel(mod_id, channel, ENB_AGENT_MAC); */ - /* /\* */ - /* * create a socket */ - /* *\/ */ - /* enb_agent[mod_id].link = new_link_client(in_ip, in_port); */ - /* if (enb_agent[mod_id].link == NULL) goto error; */ + /*Initialize the continuous MAC stats update mechanism*/ + enb_agent_init_cont_mac_stats_update(mod_id); - /* LOG_I(ENB_AGENT,"starting enb agent client for module id %d on ipv4 %s, port %d\n", */ - /* enb_agent[mod_id].mod_id, */ - /* in_ip, */ - /* in_port); */ - /* /\* */ - /* * create a message queue */ - /* *\/ */ - - /* enb_agent[mod_id].send_queue = new_message_queue(); */ - /* if (enb_agent[mod_id].send_queue == NULL) goto error; */ - /* enb_agent[mod_id].receive_queue = new_message_queue(); */ - /* if (enb_agent[mod_id].receive_queue == NULL) goto error; */ - - /* /\* */ - /* * create a link manager */ - /* *\/ */ - - /* enb_agent[mod_id].manager = create_link_manager(enb_agent[mod_id].send_queue, enb_agent[mod_id].receive_queue, enb_agent[mod_id].link); */ - /* if (enb_agent[mod_id].manager == NULL) goto error; */ - - /* memset(&shared_ctxt, 0, sizeof(msg_context_t)); */ - - /* shared_ctxt[mod_id].mod_id = mod_id; */ - /* shared_ctxt[mod_id].tx_mq = enb_agent[mod_id].send_queue; */ - /* shared_ctxt[mod_id].rx_mq = enb_agent[mod_id].receive_queue; */ - - /* - * start the enb agent rx thread - */ - - memset(&shared_ctxt, 0, sizeof(msg_context_t)); - shared_ctxt[mod_id].mod_id = mod_id; - - new_thread(receive_thread, &shared_ctxt[mod_id]); + new_thread(receive_thread, &enb_agent[mod_id]); /* * initilize a timer @@ -322,7 +267,7 @@ int enb_agent_start(mid_t mod_id, const Enb_properties_array_t* enb_properties){ * start the enb agent task for tx and interaction with the underlying network function */ - if (itti_create_task (TASK_ENB_AGENT, enb_agent_task, (void *) &shared_ctxt[mod_id]) < 0) { + if (itti_create_task (TASK_ENB_AGENT, enb_agent_task, (void *) &enb_agent[mod_id]) < 0) { LOG_E(ENB_AGENT, "Create task for eNB Agent failed\n"); return -1; } @@ -338,21 +283,21 @@ error: -int enb_agent_stop(mid_t mod_id){ +/* int enb_agent_stop(mid_t mod_id){ */ - int i=0; +/* int i=0; */ - enb_agent_destroy_timers(); - for ( i =0; i < enb_agent_info.nb_modules; i++) { +/* enb_agent_destroy_timers(); */ +/* for ( i =0; i < enb_agent_info.nb_modules; i++) { */ - destroy_link_manager(enb_agent[i].manager); +/* destroy_link_manager(enb_agent[i].manager); */ - destroy_message_queue(enb_agent[i].send_queue); - destroy_message_queue(enb_agent[i].receive_queue); +/* destroy_message_queue(enb_agent[i].send_queue); */ +/* destroy_message_queue(enb_agent[i].receive_queue); */ - close_link(enb_agent[i].link); - } -} +/* close_link(enb_agent[i].link); */ +/* } */ +/* } */ diff --git a/openair2/ENB_APP/enb_agent_common.c b/openair2/ENB_APP/enb_agent_common.c index ce838766ee..ab9546036f 100644 --- a/openair2/ENB_APP/enb_agent_common.c +++ b/openair2/ENB_APP/enb_agent_common.c @@ -39,8 +39,8 @@ #include "log.h" -void * enb[NUM_MAX_ENB_AGENT]; -void * enb_ue[NUM_MAX_ENB_AGENT]; +void * enb[NUM_MAX_ENB]; +void * enb_ue[NUM_MAX_ENB]; /* * message primitives */ diff --git a/openair2/ENB_APP/enb_agent_defs.h b/openair2/ENB_APP/enb_agent_defs.h index 0ddbc2064e..020c631ff1 100644 --- a/openair2/ENB_APP/enb_agent_defs.h +++ b/openair2/ENB_APP/enb_agent_defs.h @@ -43,7 +43,7 @@ #include "link_manager.h" -#define NUM_MAX_ENB_AGENT 2 +#define NUM_MAX_ENB 2 #define NUM_MAX_UE 2048 #define DEFAULT_ENB_AGENT_IPv4_ADDRESS "127.0.0.1" #define DEFAULT_ENB_AGENT_PORT 2210 @@ -108,36 +108,25 @@ typedef uint8_t mid_t; // module or enb id typedef uint8_t lcid_t; typedef int32_t err_code_t; -// tx and rx shared context -typedef struct { - mid_t mod_id; - socket_link_t *link; - message_queue_t *send_queue; - message_queue_t *receive_queue; - link_manager_t *manager; -}enb_agent_instance_t; + typedef struct { /* general info */ - uint32_t nb_modules; - - + /* stats */ uint32_t total_rx_msg; uint32_t total_tx_msg; - uint32_t rx_msg[NUM_MAX_ENB_AGENT]; - uint32_t tx_msg[NUM_MAX_ENB_AGENT]; + uint32_t rx_msg[NUM_MAX_ENB]; + uint32_t tx_msg[NUM_MAX_ENB]; }enb_agent_info_t; typedef struct { - mid_t mod_id; - // message_queue_t *tx_mq; - // message_queue_t *rx_mq; - xid_t tx_xid; - xid_t rx_xid; -} msg_context_t; + mid_t enb_id; + enb_agent_info_t agent_info; + +}enb_agent_instance_t; #endif diff --git a/openair2/ENB_APP/enb_agent_extern.h b/openair2/ENB_APP/enb_agent_extern.h index 2cd072f25a..f191d86907 100644 --- a/openair2/ENB_APP/enb_agent_extern.h +++ b/openair2/ENB_APP/enb_agent_extern.h @@ -41,10 +41,11 @@ #include "enb_agent_defs.h" #include "enb_agent_mac_defs.h" -extern msg_context_t shared_ctxt[NUM_MAX_ENB_AGENT]; -extern AGENT_MAC_xface *agent_mac_xface; +//extern msg_context_t shared_ctxt[NUM_MAX_ENB][ENB_AGENT_MAX]; -extern unsigned int mac_agent_registered[NUM_MAX_ENB_AGENT]; +extern AGENT_MAC_xface *agent_mac_xface[NUM_MAX_ENB][ENB_AGENT_MAX]; + +extern unsigned int mac_agent_registered[NUM_MAX_ENB]; #endif diff --git a/openair2/ENB_APP/enb_agent_mac_defs.h b/openair2/ENB_APP/enb_agent_mac_defs.h index a570165919..f6dccb1570 100644 --- a/openair2/ENB_APP/enb_agent_mac_defs.h +++ b/openair2/ENB_APP/enb_agent_mac_defs.h @@ -42,14 +42,18 @@ /* ENB AGENT-MAC Interface */ typedef struct { - msg_context_t *agent_ctxt; + //msg_context_t *agent_ctxt; /// Inform the controller about the scheduling requests received during the subframe - void (*enb_agent_send_sr_info)(mid_t mod_id, msg_context_t *context); + void (*enb_agent_send_sr_info)(mid_t mod_id); /// Inform the controller about the current UL/DL subframe - void (*enb_agent_send_sf_trigger)(mid_t mod_id, msg_context_t *context); + void (*enb_agent_send_sf_trigger)(mid_t mod_id); + /// Send to the controller all the mac stat updates that occured during this subframe + /// based on the stats request configuration + void (*enb_agent_send_update_mac_stats)(mid_t mod_id); + /*TODO: Fill in with the rest of the MAC layer technology specific callbacks (UL/DL scheduling, RACH info etc)*/ } AGENT_MAC_xface; diff --git a/openair2/ENB_APP/enb_agent_mac_internal.h b/openair2/ENB_APP/enb_agent_mac_internal.h index 98c15e083f..394d3e7730 100644 --- a/openair2/ENB_APP/enb_agent_mac_internal.h +++ b/openair2/ENB_APP/enb_agent_mac_internal.h @@ -43,9 +43,6 @@ #include "enb_agent_common.h" -/*Flags showing if a mac agent has already been registered*/ -unsigned int mac_agent_registered[NUM_MAX_ENB_AGENT]; - /*This will be used for producing continuous status updates for the MAC *Needs to be thread-safe */ @@ -61,7 +58,7 @@ typedef struct { } mac_stats_updates_context_t; /*Array holding the last stats reports for each eNB. Used for continuous reporting*/ -mac_stats_updates_context_t mac_stats_context[NUM_MAX_ENB_AGENT]; +mac_stats_updates_context_t mac_stats_context[NUM_MAX_ENB]; /*Functions to initialize and destroy the struct required for the *continuous stats update report*/ From e3e01a64c97a8db2f8b9501f09f1b48e91959965 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Fri, 22 Jan 2016 16:28:44 +0000 Subject: [PATCH 073/349] Added continuous update functionality in the MAC layer --- openair2/ENB_APP/enb_agent_mac.c | 200 ++++++++++++++++++++++++++++--- 1 file changed, 184 insertions(+), 16 deletions(-) diff --git a/openair2/ENB_APP/enb_agent_mac.c b/openair2/ENB_APP/enb_agent_mac.c index 34423ee01a..6e66267391 100644 --- a/openair2/ENB_APP/enb_agent_mac.c +++ b/openair2/ENB_APP/enb_agent_mac.c @@ -35,14 +35,22 @@ */ #include "enb_agent_mac.h" +#include "enb_agent_extern.h" +#include "enb_agent_common.h" +#include "enb_agent_mac_internal.h" #include "log.h" + +/*Flags showing if a mac agent has already been registered*/ +unsigned int mac_agent_registered[NUM_MAX_ENB]; + int enb_agent_mac_handle_stats(mid_t mod_id, const void *params, Protocol__ProgranMessage **msg){ // TODO: Must deal with sanitization of input // TODO: Must check if RNTIs and cell ids of the request actually exist - + // TODO: Must resolve conflicts among stats requests + int i; void *buffer; int size; @@ -71,15 +79,13 @@ int enb_agent_mac_handle_stats(mid_t mod_id, const void *params, Protocol__Progr switch(stats_req->body_case) { case PROTOCOL__PRP_STATS_REQUEST__BODY_COMPLETE_STATS_REQUEST: ; Protocol__PrpCompleteStatsRequest *comp_req = stats_req->complete_stats_request; - if (comp_req->report_frequency == PROTOCOL__PRP_STATS_REPORT_FREQ__PRSRF_CONTINUOUS) { - //TODO: Must create an event based report mechanism - *msg = NULL; - return 0; - } else if (comp_req->report_frequency == PROTOCOL__PRP_STATS_REPORT_FREQ__PRSRF_OFF) { + if (comp_req->report_frequency == PROTOCOL__PRP_STATS_REPORT_FREQ__PRSRF_OFF) { + /*Disable both periodic and continuous updates*/ + enb_agent_disable_cont_mac_stats_update(mod_id); enb_agent_destroy_timer_by_task_id(xid); *msg = NULL; return 0; - } else { //One-off or periodical reporting + } else { //One-off, periodical or continuous reporting //Set the proper flags ue_flags = comp_req->ue_report_flags; c_flags = comp_req->cell_report_flags; @@ -136,6 +142,16 @@ int enb_agent_mac_handle_stats(mid_t mod_id, const void *params, Protocol__Progr usec_interval = usec_interval%(1000*1000); } enb_agent_create_timer(sec_interval, usec_interval, ENB_AGENT_DEFAULT, enb_id, ENB_AGENT_TIMER_TYPE_PERIODIC, xid, enb_agent_handle_timed_task,(void*) timer_args, &timer_id); + } else if (comp_req->report_frequency == PROTOCOL__PRP_STATS_REPORT_FREQ__PRSRF_CONTINUOUS) { + /*If request was for continuous updates, disable the previous configuration and + set up a new one*/ + enb_agent_disable_cont_mac_stats_update(mod_id); + stats_request_config_t request_config; + request_config.report_type = PROTOCOL__PRP_STATS_TYPE__PRST_COMPLETE_STATS; + request_config.report_frequency = PROTOCOL__PRP_STATS_REPORT_FREQ__PRSRF_ONCE; + request_config.period = 0; + request_config.config = &report_config; + enb_agent_enable_cont_mac_stats_update(enb_id, xid, &request_config); } } break; @@ -453,7 +469,7 @@ int enb_agent_mac_stats_reply(mid_t mod_id, dl_report->n_csi_report = 1; //TODO:Create the actual CSI reports. Protocol__PrpDlCsi **csi_reports; - csi_reports = malloc(sizeof(Protocol__PrpDlCsi *)); + csi_reports = malloc(sizeof(Protocol__PrpDlCsi *)*dl_report->n_csi_report); if (csi_reports == NULL) goto error; for (j = 0; j < dl_report->n_csi_report; j++) { @@ -505,7 +521,7 @@ int enb_agent_mac_stats_reply(mid_t mod_id, paging_report->n_paging_info = 1; //Provide a report for each pending paging message Protocol__PrpPagingInfo **p_info; - p_info = malloc(sizeof(Protocol__PrpPagingInfo *)); + p_info = malloc(sizeof(Protocol__PrpPagingInfo *) * paging_report->n_paging_info); if (p_info == NULL) goto error; for (j = 0; j < paging_report->n_paging_info; j++) { @@ -975,15 +991,21 @@ int enb_agent_mac_destroy_sf_trigger(Protocol__ProgranMessage *msg) { return -1; } -void enb_agent_send_sr_info(mid_t mod_id, msg_context_t *context) { +/*********************************************** + * eNB agent - technology mac API implementation + ***********************************************/ + +void enb_agent_send_sr_info(mid_t mod_id) { int size; Protocol__ProgranMessage *msg; void *data; int priority; err_code_t err_code; + int xid = 0; + /*TODO: Must use a proper xid*/ - err_code = enb_agent_mac_sr_info(mod_id, (void *) &(context->tx_xid), &msg); + err_code = enb_agent_mac_sr_info(mod_id, (void *) &xid, &msg); if (err_code < 0) { goto error; } @@ -997,20 +1019,23 @@ void enb_agent_send_sr_info(mid_t mod_id, msg_context_t *context) { } LOG_D(ENB_AGENT,"sent message with size %d\n", size); + return; } error: LOG_D(ENB_AGENT, "Could not send sr message\n"); } -void enb_agent_send_sf_trigger(mid_t mod_id, msg_context_t *context) { +void enb_agent_send_sf_trigger(mid_t mod_id) { int size; Protocol__ProgranMessage *msg; void *data; int priority; err_code_t err_code; + int xid = 0; + /*TODO: Must use a proper xid*/ - err_code = enb_agent_mac_sf_trigger(mod_id, (void *) &(context->tx_xid), &msg); + err_code = enb_agent_mac_sf_trigger(mod_id, (void *) &xid, &msg); if (err_code < 0) { goto error; } @@ -1024,6 +1049,60 @@ void enb_agent_send_sf_trigger(mid_t mod_id, msg_context_t *context) { } LOG_D(ENB_AGENT,"sent message with size %d\n", size); + return; + } + error: + LOG_D(ENB_AGENT, "Could not send sf trigger message\n"); +} + +void enb_agent_send_update_mac_stats(mid_t mod_id) { + + Protocol__ProgranMessage *current_report, *msg; + void *data; + int size; + err_code_t err_code; + int priority; + + mac_stats_updates_context_t stats_context = mac_stats_context[mod_id]; + + if (pthread_mutex_lock(mac_stats_context[mod_id].mutex)) { + goto error; + } + + /*Create a fresh report with the required flags*/ + err_code = enb_agent_mac_handle_stats(mod_id, (void *) mac_stats_context[mod_id].stats_req, ¤t_report); + if (err_code < 0) { + goto error; + } + + /*TODO:Check if a previous reports exists and if yes, generate a report + *that is the diff between the old and the new report, + *respecting the thresholds. Otherwise send the new report*/ + if (mac_stats_context[mod_id].prev_stats_reply != NULL) { + + msg = enb_agent_generate_diff_mac_stats_report(current_report, mac_stats_context[mod_id].prev_stats_reply); + + /*Destroy the old stats*/ + enb_agent_destroy_progran_message(mac_stats_context[mod_id].prev_stats_reply); + } + /*Use the current report for future comparissons*/ + mac_stats_context[mod_id].prev_stats_reply = current_report; + + + if (pthread_mutex_unlock(mac_stats_context[mod_id].mutex)) { + goto error; + } + + if (msg != NULL){ + data=enb_agent_pack_message(msg, &size); + /*Send any stats updates using the MAC channel of the eNB*/ + if (enb_agent_msg_send(mod_id, ENB_AGENT_MAC, data, size, priority)) { + err_code = PROTOCOL__PROGRAN_ERR__MSG_ENQUEUING; + goto error; + } + + LOG_D(ENB_AGENT,"sent message with size %d\n", size); + return; } error: LOG_D(ENB_AGENT, "Could not send sf trigger message\n"); @@ -1035,12 +1114,14 @@ int enb_agent_register_mac_xface(mid_t mod_id, AGENT_MAC_xface *xface) { return -1; } - xface->agent_ctxt = &shared_ctxt[mod_id]; + //xface->agent_ctxt = &shared_ctxt[mod_id]; xface->enb_agent_send_sr_info = enb_agent_send_sr_info; xface->enb_agent_send_sf_trigger = enb_agent_send_sf_trigger; + xface->enb_agent_send_update_mac_stats = enb_agent_send_update_mac_stats; mac_agent_registered[mod_id] = 1; - return 1; + + return 0; } int enb_agent_unregister_mac_xface(mid_t mod_id, AGENT_MAC_xface *xface) { @@ -1050,10 +1131,97 @@ int enb_agent_unregister_mac_xface(mid_t mod_id, AGENT_MAC_xface *xface) { return -1; } - xface->agent_ctxt = NULL; + //xface->agent_ctxt = NULL; xface->enb_agent_send_sr_info = NULL; xface->enb_agent_send_sf_trigger = NULL; + return 0; +} + + +/****************************************************** + *Implementations of enb_agent_mac_internal.h functions + ******************************************************/ + +err_code_t enb_agent_init_cont_mac_stats_update(mid_t mod_id) { + + /*Initialize the Mac stats update structure*/ + /*Initially the continuous update is set to false*/ + mac_stats_context[mod_id].cont_update = 0; + mac_stats_context[mod_id].is_initialized = 1; + mac_stats_context[mod_id].stats_req = NULL; + mac_stats_context[mod_id].prev_stats_reply = NULL; + mac_stats_context[mod_id].mutex = calloc(1, sizeof(pthread_mutex_t)); + if (mac_stats_context[mod_id].mutex == NULL) + goto error; + if (pthread_mutex_init(mac_stats_context[mod_id].mutex, NULL)) + goto error;; + + return 0; + + error: + return -1; +} + +err_code_t enb_agent_destroy_cont_mac_stats_update(mid_t mod_id) { + /*Disable the continuous updates for the MAC*/ + mac_stats_context[mod_id].cont_update = 0; + mac_stats_context[mod_id].is_initialized = 0; + enb_agent_destroy_progran_message(mac_stats_context[mod_id].stats_req); + enb_agent_destroy_progran_message(mac_stats_context[mod_id].prev_stats_reply); + free(mac_stats_context[mod_id].mutex); + mac_agent_registered[mod_id] = NULL; return 1; } + + +err_code_t enb_agent_enable_cont_mac_stats_update(mid_t mod_id, + xid_t xid, stats_request_config_t *stats_req) { + /*Enable the continuous updates for the MAC*/ + if (pthread_mutex_lock(mac_stats_context[mod_id].mutex)) { + goto error; + } + + Protocol__ProgranMessage *req_msg; + + enb_agent_mac_stats_request(mod_id, xid, stats_req, &req_msg); + mac_stats_context[mod_id].stats_req = req_msg; + mac_stats_context[mod_id].prev_stats_reply = NULL; + + mac_stats_context[mod_id].cont_update = 1; + mac_stats_context[mod_id].xid = xid; + + if (pthread_mutex_unlock(mac_stats_context[mod_id].mutex)) { + goto error; + } + return 0; + + error: + LOG_E(ENB_AGENT, "mac_stats_context for eNB %d is not initialized\n", mod_id); + return -1; +} + +err_code_t enb_agent_disable_cont_mac_stats_update(mid_t mod_id) { + /*Disable the continuous updates for the MAC*/ + if (pthread_mutex_lock(mac_stats_context[mod_id].mutex)) { + goto error; + } + mac_stats_context[mod_id].cont_update = 0; + mac_stats_context[mod_id].xid = 0; + if (mac_stats_context[mod_id].stats_req != NULL) { + enb_agent_destroy_progran_message(mac_stats_context[mod_id].stats_req); + } + if (mac_stats_context[mod_id].prev_stats_reply != NULL) { + enb_agent_destroy_progran_message(mac_stats_context[mod_id].prev_stats_reply); + } + if (pthread_mutex_unlock(mac_stats_context[mod_id].mutex)) { + goto error; + } + return 0; + + error: + LOG_E(ENB_AGENT, "mac_stats_context for eNB %d is not initialized\n", mod_id); + return -1; + +} From 16bbb96d5bb0bdd692bc8365e781bc5e29643b01 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Fri, 22 Jan 2016 16:28:44 +0000 Subject: [PATCH 074/349] Added continuous update functionality in the MAC layer --- openair2/ENB_APP/enb_agent_mac.c | 200 ++++++++++++++++++++++++++++--- openair2/ENB_APP/enb_agent_mac.h | 14 +-- 2 files changed, 191 insertions(+), 23 deletions(-) diff --git a/openair2/ENB_APP/enb_agent_mac.c b/openair2/ENB_APP/enb_agent_mac.c index 34423ee01a..6e66267391 100644 --- a/openair2/ENB_APP/enb_agent_mac.c +++ b/openair2/ENB_APP/enb_agent_mac.c @@ -35,14 +35,22 @@ */ #include "enb_agent_mac.h" +#include "enb_agent_extern.h" +#include "enb_agent_common.h" +#include "enb_agent_mac_internal.h" #include "log.h" + +/*Flags showing if a mac agent has already been registered*/ +unsigned int mac_agent_registered[NUM_MAX_ENB]; + int enb_agent_mac_handle_stats(mid_t mod_id, const void *params, Protocol__ProgranMessage **msg){ // TODO: Must deal with sanitization of input // TODO: Must check if RNTIs and cell ids of the request actually exist - + // TODO: Must resolve conflicts among stats requests + int i; void *buffer; int size; @@ -71,15 +79,13 @@ int enb_agent_mac_handle_stats(mid_t mod_id, const void *params, Protocol__Progr switch(stats_req->body_case) { case PROTOCOL__PRP_STATS_REQUEST__BODY_COMPLETE_STATS_REQUEST: ; Protocol__PrpCompleteStatsRequest *comp_req = stats_req->complete_stats_request; - if (comp_req->report_frequency == PROTOCOL__PRP_STATS_REPORT_FREQ__PRSRF_CONTINUOUS) { - //TODO: Must create an event based report mechanism - *msg = NULL; - return 0; - } else if (comp_req->report_frequency == PROTOCOL__PRP_STATS_REPORT_FREQ__PRSRF_OFF) { + if (comp_req->report_frequency == PROTOCOL__PRP_STATS_REPORT_FREQ__PRSRF_OFF) { + /*Disable both periodic and continuous updates*/ + enb_agent_disable_cont_mac_stats_update(mod_id); enb_agent_destroy_timer_by_task_id(xid); *msg = NULL; return 0; - } else { //One-off or periodical reporting + } else { //One-off, periodical or continuous reporting //Set the proper flags ue_flags = comp_req->ue_report_flags; c_flags = comp_req->cell_report_flags; @@ -136,6 +142,16 @@ int enb_agent_mac_handle_stats(mid_t mod_id, const void *params, Protocol__Progr usec_interval = usec_interval%(1000*1000); } enb_agent_create_timer(sec_interval, usec_interval, ENB_AGENT_DEFAULT, enb_id, ENB_AGENT_TIMER_TYPE_PERIODIC, xid, enb_agent_handle_timed_task,(void*) timer_args, &timer_id); + } else if (comp_req->report_frequency == PROTOCOL__PRP_STATS_REPORT_FREQ__PRSRF_CONTINUOUS) { + /*If request was for continuous updates, disable the previous configuration and + set up a new one*/ + enb_agent_disable_cont_mac_stats_update(mod_id); + stats_request_config_t request_config; + request_config.report_type = PROTOCOL__PRP_STATS_TYPE__PRST_COMPLETE_STATS; + request_config.report_frequency = PROTOCOL__PRP_STATS_REPORT_FREQ__PRSRF_ONCE; + request_config.period = 0; + request_config.config = &report_config; + enb_agent_enable_cont_mac_stats_update(enb_id, xid, &request_config); } } break; @@ -453,7 +469,7 @@ int enb_agent_mac_stats_reply(mid_t mod_id, dl_report->n_csi_report = 1; //TODO:Create the actual CSI reports. Protocol__PrpDlCsi **csi_reports; - csi_reports = malloc(sizeof(Protocol__PrpDlCsi *)); + csi_reports = malloc(sizeof(Protocol__PrpDlCsi *)*dl_report->n_csi_report); if (csi_reports == NULL) goto error; for (j = 0; j < dl_report->n_csi_report; j++) { @@ -505,7 +521,7 @@ int enb_agent_mac_stats_reply(mid_t mod_id, paging_report->n_paging_info = 1; //Provide a report for each pending paging message Protocol__PrpPagingInfo **p_info; - p_info = malloc(sizeof(Protocol__PrpPagingInfo *)); + p_info = malloc(sizeof(Protocol__PrpPagingInfo *) * paging_report->n_paging_info); if (p_info == NULL) goto error; for (j = 0; j < paging_report->n_paging_info; j++) { @@ -975,15 +991,21 @@ int enb_agent_mac_destroy_sf_trigger(Protocol__ProgranMessage *msg) { return -1; } -void enb_agent_send_sr_info(mid_t mod_id, msg_context_t *context) { +/*********************************************** + * eNB agent - technology mac API implementation + ***********************************************/ + +void enb_agent_send_sr_info(mid_t mod_id) { int size; Protocol__ProgranMessage *msg; void *data; int priority; err_code_t err_code; + int xid = 0; + /*TODO: Must use a proper xid*/ - err_code = enb_agent_mac_sr_info(mod_id, (void *) &(context->tx_xid), &msg); + err_code = enb_agent_mac_sr_info(mod_id, (void *) &xid, &msg); if (err_code < 0) { goto error; } @@ -997,20 +1019,23 @@ void enb_agent_send_sr_info(mid_t mod_id, msg_context_t *context) { } LOG_D(ENB_AGENT,"sent message with size %d\n", size); + return; } error: LOG_D(ENB_AGENT, "Could not send sr message\n"); } -void enb_agent_send_sf_trigger(mid_t mod_id, msg_context_t *context) { +void enb_agent_send_sf_trigger(mid_t mod_id) { int size; Protocol__ProgranMessage *msg; void *data; int priority; err_code_t err_code; + int xid = 0; + /*TODO: Must use a proper xid*/ - err_code = enb_agent_mac_sf_trigger(mod_id, (void *) &(context->tx_xid), &msg); + err_code = enb_agent_mac_sf_trigger(mod_id, (void *) &xid, &msg); if (err_code < 0) { goto error; } @@ -1024,6 +1049,60 @@ void enb_agent_send_sf_trigger(mid_t mod_id, msg_context_t *context) { } LOG_D(ENB_AGENT,"sent message with size %d\n", size); + return; + } + error: + LOG_D(ENB_AGENT, "Could not send sf trigger message\n"); +} + +void enb_agent_send_update_mac_stats(mid_t mod_id) { + + Protocol__ProgranMessage *current_report, *msg; + void *data; + int size; + err_code_t err_code; + int priority; + + mac_stats_updates_context_t stats_context = mac_stats_context[mod_id]; + + if (pthread_mutex_lock(mac_stats_context[mod_id].mutex)) { + goto error; + } + + /*Create a fresh report with the required flags*/ + err_code = enb_agent_mac_handle_stats(mod_id, (void *) mac_stats_context[mod_id].stats_req, ¤t_report); + if (err_code < 0) { + goto error; + } + + /*TODO:Check if a previous reports exists and if yes, generate a report + *that is the diff between the old and the new report, + *respecting the thresholds. Otherwise send the new report*/ + if (mac_stats_context[mod_id].prev_stats_reply != NULL) { + + msg = enb_agent_generate_diff_mac_stats_report(current_report, mac_stats_context[mod_id].prev_stats_reply); + + /*Destroy the old stats*/ + enb_agent_destroy_progran_message(mac_stats_context[mod_id].prev_stats_reply); + } + /*Use the current report for future comparissons*/ + mac_stats_context[mod_id].prev_stats_reply = current_report; + + + if (pthread_mutex_unlock(mac_stats_context[mod_id].mutex)) { + goto error; + } + + if (msg != NULL){ + data=enb_agent_pack_message(msg, &size); + /*Send any stats updates using the MAC channel of the eNB*/ + if (enb_agent_msg_send(mod_id, ENB_AGENT_MAC, data, size, priority)) { + err_code = PROTOCOL__PROGRAN_ERR__MSG_ENQUEUING; + goto error; + } + + LOG_D(ENB_AGENT,"sent message with size %d\n", size); + return; } error: LOG_D(ENB_AGENT, "Could not send sf trigger message\n"); @@ -1035,12 +1114,14 @@ int enb_agent_register_mac_xface(mid_t mod_id, AGENT_MAC_xface *xface) { return -1; } - xface->agent_ctxt = &shared_ctxt[mod_id]; + //xface->agent_ctxt = &shared_ctxt[mod_id]; xface->enb_agent_send_sr_info = enb_agent_send_sr_info; xface->enb_agent_send_sf_trigger = enb_agent_send_sf_trigger; + xface->enb_agent_send_update_mac_stats = enb_agent_send_update_mac_stats; mac_agent_registered[mod_id] = 1; - return 1; + + return 0; } int enb_agent_unregister_mac_xface(mid_t mod_id, AGENT_MAC_xface *xface) { @@ -1050,10 +1131,97 @@ int enb_agent_unregister_mac_xface(mid_t mod_id, AGENT_MAC_xface *xface) { return -1; } - xface->agent_ctxt = NULL; + //xface->agent_ctxt = NULL; xface->enb_agent_send_sr_info = NULL; xface->enb_agent_send_sf_trigger = NULL; + return 0; +} + + +/****************************************************** + *Implementations of enb_agent_mac_internal.h functions + ******************************************************/ + +err_code_t enb_agent_init_cont_mac_stats_update(mid_t mod_id) { + + /*Initialize the Mac stats update structure*/ + /*Initially the continuous update is set to false*/ + mac_stats_context[mod_id].cont_update = 0; + mac_stats_context[mod_id].is_initialized = 1; + mac_stats_context[mod_id].stats_req = NULL; + mac_stats_context[mod_id].prev_stats_reply = NULL; + mac_stats_context[mod_id].mutex = calloc(1, sizeof(pthread_mutex_t)); + if (mac_stats_context[mod_id].mutex == NULL) + goto error; + if (pthread_mutex_init(mac_stats_context[mod_id].mutex, NULL)) + goto error;; + + return 0; + + error: + return -1; +} + +err_code_t enb_agent_destroy_cont_mac_stats_update(mid_t mod_id) { + /*Disable the continuous updates for the MAC*/ + mac_stats_context[mod_id].cont_update = 0; + mac_stats_context[mod_id].is_initialized = 0; + enb_agent_destroy_progran_message(mac_stats_context[mod_id].stats_req); + enb_agent_destroy_progran_message(mac_stats_context[mod_id].prev_stats_reply); + free(mac_stats_context[mod_id].mutex); + mac_agent_registered[mod_id] = NULL; return 1; } + + +err_code_t enb_agent_enable_cont_mac_stats_update(mid_t mod_id, + xid_t xid, stats_request_config_t *stats_req) { + /*Enable the continuous updates for the MAC*/ + if (pthread_mutex_lock(mac_stats_context[mod_id].mutex)) { + goto error; + } + + Protocol__ProgranMessage *req_msg; + + enb_agent_mac_stats_request(mod_id, xid, stats_req, &req_msg); + mac_stats_context[mod_id].stats_req = req_msg; + mac_stats_context[mod_id].prev_stats_reply = NULL; + + mac_stats_context[mod_id].cont_update = 1; + mac_stats_context[mod_id].xid = xid; + + if (pthread_mutex_unlock(mac_stats_context[mod_id].mutex)) { + goto error; + } + return 0; + + error: + LOG_E(ENB_AGENT, "mac_stats_context for eNB %d is not initialized\n", mod_id); + return -1; +} + +err_code_t enb_agent_disable_cont_mac_stats_update(mid_t mod_id) { + /*Disable the continuous updates for the MAC*/ + if (pthread_mutex_lock(mac_stats_context[mod_id].mutex)) { + goto error; + } + mac_stats_context[mod_id].cont_update = 0; + mac_stats_context[mod_id].xid = 0; + if (mac_stats_context[mod_id].stats_req != NULL) { + enb_agent_destroy_progran_message(mac_stats_context[mod_id].stats_req); + } + if (mac_stats_context[mod_id].prev_stats_reply != NULL) { + enb_agent_destroy_progran_message(mac_stats_context[mod_id].prev_stats_reply); + } + if (pthread_mutex_unlock(mac_stats_context[mod_id].mutex)) { + goto error; + } + return 0; + + error: + LOG_E(ENB_AGENT, "mac_stats_context for eNB %d is not initialized\n", mod_id); + return -1; + +} diff --git a/openair2/ENB_APP/enb_agent_mac.h b/openair2/ENB_APP/enb_agent_mac.h index 4f8afbac08..c30da76d3e 100644 --- a/openair2/ENB_APP/enb_agent_mac.h +++ b/openair2/ENB_APP/enb_agent_mac.h @@ -45,9 +45,6 @@ #include "enb_agent_common.h" #include "enb_agent_extern.h" -/*Flags showing if a mac agent has already been registered*/ -unsigned int mac_agent_registered[NUM_MAX_ENB_AGENT]; - /* These types will be used to give instructions for the type of stats reports we need to create */ @@ -72,14 +69,13 @@ typedef struct { cc_report_type_t *cc_report_type; } report_config_t; -typedef struct { +typedef struct stats_request_config_s{ uint8_t report_type; uint8_t report_frequency; uint16_t period; /*In number of subframes*/ report_config_t *config; } stats_request_config_t; - int enb_agent_mac_handle_stats(mid_t mod_id, const void *params, Protocol__ProgranMessage **msg); int enb_agent_mac_stats_request(mid_t mod_id, xid_t xid, const stats_request_config_t *report_config, Protocol__ProgranMessage **msg); @@ -104,10 +100,14 @@ int enb_agent_mac_destroy_sf_trigger(Protocol__ProgranMessage *msg); **********************************/ /*Inform controller about received scheduling requests during a subframe*/ -void enb_agent_send_sr_info(mid_t mod_id, msg_context_t *context); +void enb_agent_send_sr_info(mid_t mod_id); /*Inform the controller about the current UL/DL subframe*/ -void enb_agent_send_sf_trigger(mid_t mod_id, msg_context_t *context); +void enb_agent_send_sf_trigger(mid_t mod_id); + +/// Send to the controller all the mac stat updates that occured during this subframe +/// based on the stats request configuration +void enb_agent_send_update_mac_stats(mid_t mod_id); /*Register technology specific interface callbacks*/ int enb_agent_register_mac_xface(mid_t mod_id, AGENT_MAC_xface *xface); From c1c9b0bcbe31fd026f607b2d37f1a73dd248976d Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Wed, 27 Jan 2016 12:01:37 +0000 Subject: [PATCH 075/349] Added support for DL scheduling command messages --- cmake_targets/CMakeLists.txt | 4 + .../MESSAGES/V2/controller_commands.proto | 58 ++++++++++++++ openair2/ENB_APP/MESSAGES/V2/header.proto | 3 + .../ENB_APP/MESSAGES/V2/mac_primitives.proto | 76 +++++++++++++++++++ openair2/ENB_APP/MESSAGES/V2/progran.proto | 15 ++++ 5 files changed, 156 insertions(+) create mode 100644 openair2/ENB_APP/MESSAGES/V2/controller_commands.proto create mode 100644 openair2/ENB_APP/MESSAGES/V2/mac_primitives.proto diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index eb9474e670..2a847b3073 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -710,6 +710,8 @@ if (ENB_AGENT_SB_IF) ${PRPT_MSG_DIR}/stats_common.proto ${PRPT_MSG_DIR}/stats_messages.proto ${PRPT_MSG_DIR}/time_common.proto + ${PRPT_MSG_DIR}/controller_commands.proto + ${PRPT_MSG_DIR}/mac_primitives.proto ) set(PRPT_C_DIR ${protobuf_generated_dir}/${PRPTDIR}) @@ -722,6 +724,8 @@ if (ENB_AGENT_SB_IF) ${PRPT_C_DIR}/stats_common.pb-c.c ${PRPT_C_DIR}/stats_messages.pb-c.c ${PRPT_C_DIR}/time_common.pb-c.c + ${PRPT_C_DIR}/controller_commands.pb-c.c + ${PRPT_C_DIR}/mac_primitives.pb-c.c ) file(GLOB prpt_h ${PRPT_C_DIR}/*.h) diff --git a/openair2/ENB_APP/MESSAGES/V2/controller_commands.proto b/openair2/ENB_APP/MESSAGES/V2/controller_commands.proto new file mode 100644 index 0000000000..4ef8c0a370 --- /dev/null +++ b/openair2/ENB_APP/MESSAGES/V2/controller_commands.proto @@ -0,0 +1,58 @@ +package protocol; + +import "mac_primitives.proto"; + +// +// Body of UE DL MAC scheduling configuration info +// + +message prp_dl_data { + optional uint32 rnti = 1; + optional prp_dl_dci dl_dci = 2; + repeated uint32 ce_bitmap = 3; // list of 2 MAC CEs, one for each TB + repeated prp_rlc_pdu rlc_pdu = 4; // list of parameters for the creation of RLC PDUs. One for each lcid + optional uint32 serv_cell_index = 5; + optional uint32 act_deact_ce = 6; //Hex content of MAC CE for Activation/Deactivation in CA +} + +// +// Body of the RAR scheduler configuration +// +message prp_dl_rar { + optional uint32 rnti = 1; + optional uint32 grant = 2; // The 20-bit UL grant. TS 36.213, sec 6.2 + optional prp_dl_dci rar_dci = 3; + optional uint32 carrier_index = 4; // The carrier index for the RAR +} + +// +// Body of the paging/broadcast configuration message +// + +message prp_dl_broadcast { + optional uint32 type = 1; // The PRBT_* values + optional uint32 index = 2; // Index of the broadcast message: + // 0 - SIB1, + // 1..31 - Six, + // 32..63 - PCCH (PCCH index obtained from prp_paging_info) + optional prp_dl_dci broad_dci = 3; + optional uint32 carrier_index = 4; // Index of the carrier for broadcast +} + +// +// Body of the OFDM symbol count message +// + +message prp_pdcch_ofdm_sym_count { + optional uint32 carrier_index = 1; + optional uint32 num_pdcch_ofdm_symbols = 2; +} + +// +// Types of commands related enums +// + +enum prp_broadcast_type { + PRBT_BCCH = 0; + PRBT_PCCH = 1; +} \ No newline at end of file diff --git a/openair2/ENB_APP/MESSAGES/V2/header.proto b/openair2/ENB_APP/MESSAGES/V2/header.proto index 8534d2f304..10a18ddcef 100644 --- a/openair2/ENB_APP/MESSAGES/V2/header.proto +++ b/openair2/ENB_APP/MESSAGES/V2/header.proto @@ -21,5 +21,8 @@ enum prp_type { //Asynchronous messages PRPT_UL_SR_INFO = 6; + + //Controller command messages + PRPT_DL_MAC_CONFIG = 7; } diff --git a/openair2/ENB_APP/MESSAGES/V2/mac_primitives.proto b/openair2/ENB_APP/MESSAGES/V2/mac_primitives.proto new file mode 100644 index 0000000000..4378e6d668 --- /dev/null +++ b/openair2/ENB_APP/MESSAGES/V2/mac_primitives.proto @@ -0,0 +1,76 @@ +package protocol; + +// +// Message containing the DL DCI info +// + +message prp_dl_dci { + optional uint32 rnti = 1; + optional uint32 res_alloc = 2; // Type of resource allocation + optional uint32 rb_bitmap = 3; // Bitmap for RB allocation + optional uint32 rb_shift = 4; // See TS 36.214, section 7.1.6.2 + repeated uint32 tbs_size = 5; // The size of each TBS + repeated uint32 mcs = 6; // The MCS of each TB + repeated uint32 ndi = 7; // New data indicator of each TB + repeated uint32 rv = 8; // Redundancy version of each TB + optional uint32 cce_index = 9; // CCE index used to send the DCI + optional uint32 aggr_level = 10; + optional uint32 precoding_info = 11; // 2 antenna ports:0..6, + // 4 antenna ports:0..50 + optional uint32 format = 12; // DCI format. A PRDCIF_* value + optional uint32 tpc = 13; // TS 36.213, sec 5.1.1.1 + optional uint32 harq_process = 14; // HARQ process ID + optional uint32 dai = 15; // TDD only + optional uint32 vrb_format = 16; // One of the PRVRBF_* values + optional uint32 tb_swap = 17; // Boolean. TB to codeword swap flag + optional uint32 sps_release = 18; // Flag value + optional uint32 pdcch_order = 19; + optional uint32 preamble_index = 20; // Only valid if pdcch_order = 1 + optional uint32 prach_mask_index = 21; // Only valid if pdcch_order = 1 + optional uint32 n_gap = 22; // One of the PRNGV_* values + optional uint32 tbs_idx = 23; // The TBS index for Format 1A + optional uint32 dl_power_offset = 24; // For format 1D + optional uint32 pdcch_power_offset = 25; // DL PDCCH power boosting in dB + optional uint32 cif_present = 26; // Boolean. Indication of CIF field + optional uint32 cif = 27; // CIF for cross-carrier scheduling +} + +// +// Messages related to the creation of RLC PDUs +// + +message prp_rlc_pdu { + repeated prp_rlc_pdu_tb rlc_pdu_tb = 1; // list of parameters for the creation of RLC PDUs. One for each TB +} + +message prp_rlc_pdu_tb { + optional uint32 logical_channel_id = 1; + optional uint32 size = 2; // Maximum RLC PDU to be created in bytes +} + +// +// MAC content types related enums +// + +enum prp_dci_format { + PRDCIF_1 = 0; + PRDCIF_1A = 1; + PRDCIF_1B = 2; + PRDCIF_1C = 3; + PRDCIF_1D = 4; + PRDCIF_2 = 5; + PRDCIF_2A = 6; + PRDCIF_2B = 7; + PRDCIF_3 = 8; + PRDCIF_3A = 9; +} + +enum prp_vrb_format { + PRVRBF_LOCALIZED = 0; + PRVRBF_DISTRIBUTED = 1; +} + +enum prp_ngap_val { + PRNGV_1 = 0; + PRNGV_2 = 1; +} \ No newline at end of file diff --git a/openair2/ENB_APP/MESSAGES/V2/progran.proto b/openair2/ENB_APP/MESSAGES/V2/progran.proto index 730726aab4..5d0ec15518 100644 --- a/openair2/ENB_APP/MESSAGES/V2/progran.proto +++ b/openair2/ENB_APP/MESSAGES/V2/progran.proto @@ -4,6 +4,7 @@ package protocol; import "stats_messages.proto"; import "header.proto"; import "time_common.proto"; +import "controller_commands.proto"; message progran_message { optional progran_direction msg_dir = 100; @@ -15,6 +16,7 @@ message progran_message { prp_stats_reply stats_reply_msg = 5; prp_sf_trigger sf_trigger_msg = 6; prp_ul_sr_info ul_sr_info_msg = 7; + prp_dl_mac_config dl_mac_config_msg = 8; } } @@ -106,6 +108,19 @@ message prp_ul_sr_info { repeated uint32 rnti = 3; } +// +// Controller command messages +// + +message prp_dl_mac_config { + optional prp_header header = 1; + optional uint32 sfn_sf = 2; + repeated prp_dl_data dl_ue_data = 3; + repeated prp_dl_rar dl_rar = 4; + repeated prp_dl_broadcast dl_broadcast = 5; + repeated prp_pdcch_ofdm_sym_count ofdm_sym = 6; // OFDM symbol count for each CC +} + // Extensions of the echo request and reply // messages for carrying a latency value in ms message prp_echo_request_latency { From 92f547655c4a352d7c65053a30f453b6a06c599b Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Wed, 27 Jan 2016 12:54:33 +0000 Subject: [PATCH 076/349] Integrated MAC DL config progran message to agent --- openair2/ENB_APP/enb_agent_handler.c | 8 +++-- openair2/ENB_APP/enb_agent_mac.c | 53 ++++++++++++++++++++++++---- openair2/ENB_APP/enb_agent_mac.h | 4 +++ 3 files changed, 56 insertions(+), 9 deletions(-) diff --git a/openair2/ENB_APP/enb_agent_handler.c b/openair2/ENB_APP/enb_agent_handler.c index 7b63227d7e..3e9752b539 100644 --- a/openair2/ENB_APP/enb_agent_handler.c +++ b/openair2/ENB_APP/enb_agent_handler.c @@ -46,9 +46,10 @@ enb_agent_message_decoded_callback messages_callback[][3] = { {enb_agent_echo_reply, 0, 0}, /*PROTOCOL__PROGRAN_MESSAGE__MSG_ECHO_REQUEST_MSG*/ {0, 0, 0}, /*PROTOCOL__PROGRAN_MESSAGE__MSG_ECHO_REPLY_MSG*/ //Must add handler when receiving echo reply {enb_agent_mac_handle_stats, 0, 0}, /*PROTOCOL__PROGRAN_MESSAGE__MSG_STATS_REQUEST_MSG*/ - {0,0,0}, /*PROTOCOL__PROGRAN_MESSAGE__MSG_STATS_REPLY_MSG*/ - {0,0,0}, /*PROTOCOK__PROGRAN_MESSAGE__MSG_SF_TRIGGER_MSG*/ - {0,0,0}, /*SR_INFO*/ + {0, 0, 0}, /*PROTOCOL__PROGRAN_MESSAGE__MSG_STATS_REPLY_MSG*/ + {0, 0, 0}, /*PROTOCOK__PROGRAN_MESSAGE__MSG_SF_TRIGGER_MSG*/ + {0, 0, 0}, /*SR_INFO*/ + {0, 0, 0}, /*DL_MAC_CONFIG*/ }; @@ -60,6 +61,7 @@ enb_agent_message_destruction_callback message_destruction_callback[] = { enb_agent_mac_destroy_stats_reply, enb_agent_mac_destroy_sf_trigger, enb_agent_mac_destroy_sr_info, + enb_agent_mac_destroy_dl_config, }; static const char *enb_agent_direction2String[] = { diff --git a/openair2/ENB_APP/enb_agent_mac.c b/openair2/ENB_APP/enb_agent_mac.c index 6e66267391..157b83581d 100644 --- a/openair2/ENB_APP/enb_agent_mac.c +++ b/openair2/ENB_APP/enb_agent_mac.c @@ -45,6 +45,9 @@ /*Flags showing if a mac agent has already been registered*/ unsigned int mac_agent_registered[NUM_MAX_ENB]; +/*Array containing the Agent-MAC interfaces*/ +AGENT_MAC_xface *agent_mac_xface[NUM_MAX_ENB]; + int enb_agent_mac_handle_stats(mid_t mod_id, const void *params, Protocol__ProgranMessage **msg){ // TODO: Must deal with sanitization of input @@ -991,6 +994,43 @@ int enb_agent_mac_destroy_sf_trigger(Protocol__ProgranMessage *msg) { return -1; } +int enb_agent_mac_create_empty_dl_config(mid_t mod_id, Protocol__ProgranMessage **msg) { + + int xid = 0; + Protocol__PrpHeader *header; + if (prp_create_header(xid, PROTOCOL__PRP_TYPE__PRPT_DL_MAC_CONFIG, &header) != 0) + goto error; + + Protocol__PrpDlMacConfig *dl_mac_config_msg; + dl_mac_config_msg = malloc(sizeof(Protocol__PrpDlMacConfig)); + if (dl_mac_config_msg == NULL) { + goto error; + } + protocol__prp_dl_mac_config__init(dl_mac_config_msg); + + dl_mac_config_msg->header = header; + dl_mac_config_msg->has_sfn_sf = 1; + dl_mac_config_msg->sfn_sf = get_sfn_sf(mod_id); + + *msg = malloc(sizeof(Protocol__ProgranMessage)); + if(*msg == NULL) + goto error; + protocol__progran_message__init(*msg); + (*msg)->msg_case = PROTOCOL__PROGRAN_MESSAGE__MSG_DL_MAC_CONFIG_MSG; + (*msg)->msg_dir = PROTOCOL__PROGRAN_DIRECTION__INITIATING_MESSAGE; + (*msg)->dl_mac_config_msg = dl_mac_config_msg; + + return 0; + + error: + return -1; +} + +int enb_agent_mac_destroy_dl_config(Protocol__ProgranMessage *msg) { + //TODO: De-allocate the memory of the message + return -1; +} + /*********************************************** * eNB agent - technology mac API implementation ***********************************************/ @@ -1109,7 +1149,7 @@ void enb_agent_send_update_mac_stats(mid_t mod_id) { } int enb_agent_register_mac_xface(mid_t mod_id, AGENT_MAC_xface *xface) { - if (!mac_agent_registered[mod_id]) { + if (mac_agent_registered[mod_id]) { LOG_E(MAC, "MAC agent for eNB %d is already registered\n", mod_id); return -1; } @@ -1119,22 +1159,23 @@ int enb_agent_register_mac_xface(mid_t mod_id, AGENT_MAC_xface *xface) { xface->enb_agent_send_sf_trigger = enb_agent_send_sf_trigger; xface->enb_agent_send_update_mac_stats = enb_agent_send_update_mac_stats; + mac_agent_registered[mod_id] = 1; + agent_mac_xface[mod_id] = xface; return 0; } int enb_agent_unregister_mac_xface(mid_t mod_id, AGENT_MAC_xface *xface) { - if(mac_agent_registered[mod_id]) { - LOG_E(MAC, "MAC agent for eNB %d is already registered\n", mod_id); - return -1; - } - //xface->agent_ctxt = NULL; xface->enb_agent_send_sr_info = NULL; xface->enb_agent_send_sf_trigger = NULL; + xface->enb_agent_send_update_mac_stats = NULL; + mac_agent_registered[mod_id] = 0; + agent_mac_xface[mod_id] = NULL; + return 0; } diff --git a/openair2/ENB_APP/enb_agent_mac.h b/openair2/ENB_APP/enb_agent_mac.h index c30da76d3e..221d76e57f 100644 --- a/openair2/ENB_APP/enb_agent_mac.h +++ b/openair2/ENB_APP/enb_agent_mac.h @@ -94,6 +94,10 @@ int enb_agent_mac_sf_trigger(mid_t mod_id, const void *params, Protocol__Progran int enb_agent_mac_destroy_sf_trigger(Protocol__ProgranMessage *msg); +int enb_agent_mac_create_empty_dl_config(mid_t mod_id, Protocol__ProgranMessage **msg); + +int enb_agent_mac_destroy_dl_config(Protocol__ProgranMessage *msg); + /********************************** * eNB agent - technology mac API From cb8007bb3182acf0be139d94b67ba9f821064d90 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Thu, 28 Jan 2016 14:45:47 +0000 Subject: [PATCH 077/349] Added support for enb agent MAC scheduler hot-plugging. Deactivated schedule_ue_spec and added agent UE specific DL scheduler --- cmake_targets/CMakeLists.txt | 1 + openair2/ENB_APP/enb_agent.c | 6 + openair2/ENB_APP/enb_agent_extern.h | 2 +- openair2/ENB_APP/enb_agent_mac.c | 4 + openair2/ENB_APP/enb_agent_mac_defs.h | 9 +- .../LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c | 944 ++++++++++++++++++ openair2/LAYER2/MAC/eNB_scheduler.c | 273 ++++- openair2/LAYER2/MAC/proto.h | 10 + 8 files changed, 1228 insertions(+), 21 deletions(-) create mode 100644 openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index 2a847b3073..01d0c8aabd 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -1007,6 +1007,7 @@ set (MAC_SRC ${MAC_DIR}/eNB_scheduler_RA.c ${MAC_DIR}/pre_processor.c ${MAC_DIR}/config.c + ${MAC_DIR}/eNB_agent_scheduler_dlsch_ue.c ) set (ENB_APP_SRC diff --git a/openair2/ENB_APP/enb_agent.c b/openair2/ENB_APP/enb_agent.c index c48f8f67fb..c9c42a41d9 100644 --- a/openair2/ENB_APP/enb_agent.c +++ b/openair2/ENB_APP/enb_agent.c @@ -256,6 +256,12 @@ int enb_agent_start(mid_t mod_id, const Enb_properties_array_t* enb_properties){ enb_agent_init_cont_mac_stats_update(mod_id); new_thread(receive_thread, &enb_agent[mod_id]); + + /*Initialize and register the mac xface. Must be modified later + *for more flexibility in agent management */ + + AGENT_MAC_xface *mac_agent_xface = (AGENT_MAC_xface *) malloc(sizeof(AGENT_MAC_xface)); + enb_agent_register_mac_xface(mod_id, mac_agent_xface); /* * initilize a timer diff --git a/openair2/ENB_APP/enb_agent_extern.h b/openair2/ENB_APP/enb_agent_extern.h index f191d86907..1ef2250483 100644 --- a/openair2/ENB_APP/enb_agent_extern.h +++ b/openair2/ENB_APP/enb_agent_extern.h @@ -44,7 +44,7 @@ //extern msg_context_t shared_ctxt[NUM_MAX_ENB][ENB_AGENT_MAX]; -extern AGENT_MAC_xface *agent_mac_xface[NUM_MAX_ENB][ENB_AGENT_MAX]; +extern AGENT_MAC_xface *agent_mac_xface[NUM_MAX_ENB]; extern unsigned int mac_agent_registered[NUM_MAX_ENB]; diff --git a/openair2/ENB_APP/enb_agent_mac.c b/openair2/ENB_APP/enb_agent_mac.c index 157b83581d..05b2a7a364 100644 --- a/openair2/ENB_APP/enb_agent_mac.c +++ b/openair2/ENB_APP/enb_agent_mac.c @@ -39,6 +39,8 @@ #include "enb_agent_common.h" #include "enb_agent_mac_internal.h" +#include "LAYER2/MAC/proto.h" + #include "log.h" @@ -1158,6 +1160,7 @@ int enb_agent_register_mac_xface(mid_t mod_id, AGENT_MAC_xface *xface) { xface->enb_agent_send_sr_info = enb_agent_send_sr_info; xface->enb_agent_send_sf_trigger = enb_agent_send_sf_trigger; xface->enb_agent_send_update_mac_stats = enb_agent_send_update_mac_stats; + xface->enb_agent_schedule_ue_spec = schedule_ue_spec_default; mac_agent_registered[mod_id] = 1; @@ -1172,6 +1175,7 @@ int enb_agent_unregister_mac_xface(mid_t mod_id, AGENT_MAC_xface *xface) { xface->enb_agent_send_sr_info = NULL; xface->enb_agent_send_sf_trigger = NULL; xface->enb_agent_send_update_mac_stats = NULL; + xface->enb_agent_schedule_ue_spec = NULL; mac_agent_registered[mod_id] = 0; agent_mac_xface[mod_id] = NULL; diff --git a/openair2/ENB_APP/enb_agent_mac_defs.h b/openair2/ENB_APP/enb_agent_mac_defs.h index f6dccb1570..67b89bf610 100644 --- a/openair2/ENB_APP/enb_agent_mac_defs.h +++ b/openair2/ENB_APP/enb_agent_mac_defs.h @@ -53,7 +53,14 @@ typedef struct { /// Send to the controller all the mac stat updates that occured during this subframe /// based on the stats request configuration void (*enb_agent_send_update_mac_stats)(mid_t mod_id); - + + /// Run the UE DL scheduler and fill the Protocol__ProgranMessage. Assumes that + /// dl_info is already initialized as prp_dl_mac_config and fills the + /// prp_dl_data part of it + void (*enb_agent_schedule_ue_spec)(mid_t mod_id, uint32_t frame, uint32_t subframe, + unsigned int *nb_rb_used, unsigned int *nCCE_used, + int *mbsfn_flag, Protocol__ProgranMessage *dl_info); + /*TODO: Fill in with the rest of the MAC layer technology specific callbacks (UL/DL scheduling, RACH info etc)*/ } AGENT_MAC_xface; diff --git a/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c b/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c new file mode 100644 index 0000000000..5adc4abc40 --- /dev/null +++ b/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c @@ -0,0 +1,944 @@ +/******************************************************************************* + OpenAirInterface + Copyright(c) 1999 - 2014 Eurecom + + OpenAirInterface is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + + OpenAirInterface is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with OpenAirInterface.The full GNU General Public License is + included in this distribution in the file called "COPYING". If not, + see . + + Contact Information + OpenAirInterface Admin: openair_admin@eurecom.fr + OpenAirInterface Tech : openair_tech@eurecom.fr + OpenAirInterface Dev : openair4g-devel@lists.eurecom.fr + + Address : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE + +*******************************************************************************/ + +/*! \file eNB_agent_scheduler_dlsch_ue.c + * \brief procedures related to eNB for the DLSCH transport channel + * \author Xenofon Foukas + * \date 2016 + * \email: x.foukas@sms.ed.ac.uk + * \version 0.1 + * @ingroup _mac + + */ + +#include "assertions.h" +#include "PHY/defs.h" +#include "PHY/extern.h" + +#include "SCHED/defs.h" +#include "SCHED/extern.h" + +#include "LAYER2/MAC/defs.h" +#include "LAYER2/MAC/proto.h" +#include "LAYER2/MAC/extern.h" +#include "UTIL/LOG/log.h" +#include "UTIL/LOG/vcd_signal_dumper.h" +#include "UTIL/OPT/opt.h" +#include "OCG.h" +#include "OCG_extern.h" + +#include "RRC/LITE/extern.h" +#include "RRC/L2_INTERFACE/openair_rrc_L2_interface.h" + +#include "ENB_APP/enb_agent_defs.h" + +//#include "LAYER2/MAC/pre_processor.c" +#include "pdcp.h" + +#include "header.pb-c.h" +#include "progran.pb-c.h" + +#include "SIMULATION/TOOLS/defs.h" // for taus + +#if defined(ENABLE_ITTI) +# include "intertask_interface.h" +#endif + +#define ENABLE_MAC_PAYLOAD_DEBUG + +//------------------------------------------------------------------------------ +void +schedule_ue_spec_default( + mid_t mod_id, + uint32_t frame, + uint32_t subframe, + unsigned int *nb_rb_used, + unsigned int *nCCE_used, + int *mbsfn_flag, + Protocol__ProgranMessage *dl_info +) +//------------------------------------------------------------------------------ +{ + //TODO + uint8_t CC_id; + int UE_id; + uint16_t nCCE[MAX_NUM_CCs]; + int N_RBG[MAX_NUM_CCs]; + unsigned char aggregation; + mac_rlc_status_resp_t rlc_status; + unsigned char header_len_dcch=0, header_len_dcch_tmp=0,header_len_dtch=0,header_len_dtch_tmp=0, ta_len=0; + unsigned char sdu_lcids[11],offset,num_sdus=0; + uint16_t nb_rb,nb_rb_temp,total_nb_available_rb[MAX_NUM_CCs],nb_available_rb; + uint16_t TBS,j,sdu_lengths[11],rnti,padding=0,post_padding=0; + unsigned char dlsch_buffer[MAX_DLSCH_PAYLOAD_BYTES]; + unsigned char round = 0; + unsigned char harq_pid = 0; + void *DLSCH_dci = NULL; + LTE_eNB_UE_stats *eNB_UE_stats = NULL; + uint16_t sdu_length_total = 0; + // uint8_t dl_pow_off[MAX_NUM_CCs][NUMBER_OF_UE_MAX]; + // unsigned char rballoc_sub_UE[MAX_NUM_CCs][NUMBER_OF_UE_MAX][N_RBG_MAX]; + // uint16_t pre_nb_available_rbs[MAX_NUM_CCs][NUMBER_OF_UE_MAX]; + int mcs; + uint16_t min_rb_unit[MAX_NUM_CCs]; + short ta_update = 0; + eNB_MAC_INST *eNB = &eNB_mac_inst[mod_id]; + UE_list_t *UE_list = &eNB->UE_list; + LTE_DL_FRAME_PARMS *frame_parms[MAX_NUM_CCs]; + int continue_flag=0; + int32_t normalized_rx_power, target_rx_power; + int32_t tpc=1; + static int32_t tpc_accumulated=0; + UE_sched_ctrl *ue_sched_ctl; + + Protocol__PrpDlData *dl_data[NUM_MAX_UE]; + int num_ues_added = 0; + + Protocol__PrpDlDci *dl_dci; + Protocol__PrpRlcPdu *rlc_pdus[11]; + uint32_t *ce_bitmap; + Protocol__PrpRlcPdu **rlc_pdu; + int num_tb; + uint32_t ce_flags = 0; + + uint8_t rballoc_sub[25]; + int i; + + + if (UE_list->head==-1) { + return; + } + + start_meas(&eNB->schedule_dlsch); + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_SCHEDULE_DLSCH,VCD_FUNCTION_IN); + + //weight = get_ue_weight(module_idP,UE_id); + aggregation = 1; // set to the maximum aggregation level + + for (CC_id=0; CC_idget_lte_frame_parms(mod_id, CC_id); + total_nb_available_rb[CC_id] = frame_parms[CC_id]->N_RB_DL - nb_rb_used[CC_id]; + nCCE[CC_id] = mac_xface->get_nCCE_max(mod_id, CC_id) - nCCE_used[CC_id]; + N_RBG[CC_id] = frame_parms[CC_id]->N_RBG; + + // store the global enb stats: + eNB->eNB_stats[CC_id].num_dlactive_UEs = UE_list->num_UEs; + eNB->eNB_stats[CC_id].available_prbs = total_nb_available_rb[CC_id]; + eNB->eNB_stats[CC_id].total_available_prbs += total_nb_available_rb[CC_id]; + eNB->eNB_stats[CC_id].available_ncces = nCCE[CC_id]; + eNB->eNB_stats[CC_id].dlsch_bytes_tx=0; + eNB->eNB_stats[CC_id].dlsch_pdus_tx=0; + } + + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_PREPROCESSOR,VCD_FUNCTION_IN); + + start_meas(&eNB->schedule_dlsch_preprocessor); + dlsch_scheduler_pre_processor(mod_id, + frame, + subframe, + N_RBG, + mbsfn_flag); + stop_meas(&eNB->schedule_dlsch_preprocessor); + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_PREPROCESSOR,VCD_FUNCTION_OUT); + + for (CC_id=0; CC_id0) + continue; + + for (UE_id=UE_list->head; UE_id>=0; UE_id=UE_list->next[UE_id]) { + continue_flag=0; // reset the flag to allow allocation for the remaining UEs + rnti = UE_RNTI(mod_id, UE_id); + eNB_UE_stats = mac_xface->get_eNB_UE_stats(mod_id, CC_id, rnti); + ue_sched_ctl = &UE_list->UE_sched_ctrl[UE_id]; + + if (rnti==NOT_A_RNTI) { + LOG_D(MAC,"Cannot find rnti for UE_id %d (num_UEs %d)\n",UE_id,UE_list->num_UEs); + // mac_xface->macphy_exit("Cannot find rnti for UE_id"); + continue_flag=1; + } + + if (eNB_UE_stats==NULL) { + LOG_D(MAC,"[eNB] Cannot find eNB_UE_stats\n"); + // mac_xface->macphy_exit("[MAC][eNB] Cannot find eNB_UE_stats\n"); + continue_flag=1; + } + + if ((ue_sched_ctl->pre_nb_available_rbs[CC_id] == 0) || (nCCE[CC_id] < (1<pre_nb_available_rbs[CC_id], nCCE[CC_id], aggregation); + //if(mac_xface->get_transmission_mode(module_idP,rnti)==5) + continue_flag=1; //to next user (there might be rbs availiable for other UEs in TM5 + // else + // break; + } + + if (frame_parms[CC_id]->frame_type == TDD) { + set_ue_dai (subframe, + frame_parms[CC_id]->tdd_config, + UE_id, + CC_id, + UE_list); + // update UL DAI after DLSCH scheduling + set_ul_DAI(mod_id, UE_id, CC_id, frame, subframe,frame_parms); + } + + if (continue_flag == 1 ) { + add_ue_dlsch_info(mod_id, + CC_id, + UE_id, + subframe, + S_DL_NONE); + continue; + } + + // After this point all the UEs will be scheduled + // TODO create a Protocol__PrpDlData struct for the UE + dl_data[num_ues_added] = (Protocol__PrpDlData *) malloc(sizeof(Protocol__PrpDlData)); + protocol__prp_dl_data__init(dl_data[num_ues_added]); + dl_data[num_ues_added]->has_rnti = 1; + dl_data[num_ues_added]->rnti = rnti; + dl_data[num_ues_added]->n_rlc_pdu = 0; + dl_data[num_ues_added]->has_serv_cell_index = 1; + dl_data[num_ues_added]->serv_cell_index = CC_id; + + nb_available_rb = ue_sched_ctl->pre_nb_available_rbs[CC_id]; + harq_pid = ue_sched_ctl->harq_pid[CC_id]; + round = ue_sched_ctl->round[CC_id]; + UE_list->eNB_UE_stats[CC_id][UE_id].crnti= rnti; + UE_list->eNB_UE_stats[CC_id][UE_id].rrc_status=mac_eNB_get_rrc_status(mod_id, rnti); + UE_list->eNB_UE_stats[CC_id][UE_id].harq_pid = harq_pid; + UE_list->eNB_UE_stats[CC_id][UE_id].harq_round = round; + + + sdu_length_total=0; + num_sdus=0; + + /* + DevCheck(((eNB_UE_stats->DL_cqi[0] < MIN_CQI_VALUE) || (eNB_UE_stats->DL_cqi[0] > MAX_CQI_VALUE)), + eNB_UE_stats->DL_cqi[0], MIN_CQI_VALUE, MAX_CQI_VALUE); + */ + eNB_UE_stats->dlsch_mcs1 = cqi_to_mcs[eNB_UE_stats->DL_cqi[0]]; + eNB_UE_stats->dlsch_mcs1 = cmin(eNB_UE_stats->dlsch_mcs1, openair_daq_vars.target_ue_dl_mcs); + + +#ifdef EXMIMO + + if (mac_xface->get_transmission_mode(mod_id, CC_id, rnti)==5) { + eNB_UE_stats->dlsch_mcs1 = cmin(eNB_UE_stats->dlsch_mcs1,16); + } + +#endif + + // store stats + UE_list->eNB_UE_stats[CC_id][UE_id].dl_cqi= eNB_UE_stats->DL_cqi[0]; + + // initializing the rb allocation indicator for each UE + for(j=0; jN_RBG; j++) { + UE_list->UE_template[CC_id][UE_id].rballoc_subband[harq_pid][j] = 0; + } + + LOG_D(MAC,"[eNB %d] Frame %d: Scheduling UE %d on CC_id %d (rnti %x, harq_pid %d, round %d, rb %d, cqi %d, mcs %d, ncc %d, rrc %d)\n", + mod_id, frame, UE_id, CC_id, rnti, harq_pid, round, nb_available_rb, + eNB_UE_stats->DL_cqi[0], eNB_UE_stats->dlsch_mcs1, + nCCE[CC_id], + UE_list->eNB_UE_stats[CC_id][UE_id].rrc_status); + + dl_dci = (Protocol__PrpDlDci*) malloc(sizeof(Protocol__PrpDlDci)); + protocol__prp_dl_dci__init(dl_dci); + dl_data[num_ues_added]->dl_dci = dl_dci; + + + dl_dci->has_rnti = 1; + dl_dci->rnti = rnti; + dl_dci->has_harq_process = 1; + dl_dci->harq_process = harq_pid; + + /* process retransmission */ + + if (round > 0) { + + if (frame_parms[CC_id]->frame_type == TDD) { + UE_list->UE_template[CC_id][UE_id].DAI++; + update_ul_dci(mod_id, CC_id, rnti, UE_list->UE_template[CC_id][UE_id].DAI); + LOG_D(MAC,"DAI update: CC_id %d subframeP %d: UE %d, DAI %d\n", + CC_id, subframe,UE_id,UE_list->UE_template[CC_id][UE_id].DAI); + } + + // get freq_allocation + nb_rb = UE_list->UE_template[CC_id][UE_id].nb_rb[harq_pid]; + + if (nb_rb <= nb_available_rb) { + + if(nb_rb == ue_sched_ctl->pre_nb_available_rbs[CC_id]) { + for(j=0; jN_RBG; j++) { // for indicating the rballoc for each sub-band + UE_list->UE_template[CC_id][UE_id].rballoc_subband[harq_pid][j] = ue_sched_ctl->rballoc_sub_UE[CC_id][j]; + } + } else { + nb_rb_temp = nb_rb; + j = 0; + + while((nb_rb_temp > 0) && (jN_RBG)) { + if(ue_sched_ctl->rballoc_sub_UE[CC_id][j] == 1) { + UE_list->UE_template[CC_id][UE_id].rballoc_subband[harq_pid][j] = ue_sched_ctl->rballoc_sub_UE[CC_id][j]; + if((j == frame_parms[CC_id]->N_RBG-1) && + ((frame_parms[CC_id]->N_RB_DL == 25)|| + (frame_parms[CC_id]->N_RB_DL == 50))) { + nb_rb_temp = nb_rb_temp - min_rb_unit[CC_id]+1; + } else { + nb_rb_temp = nb_rb_temp - min_rb_unit[CC_id]; + } + } + + j = j + 1; + } + } + + nb_available_rb -= nb_rb; + aggregation = process_ue_cqi(mod_id, UE_id); + nCCE[CC_id]-=(1<mu_mimo_mode[UE_id].pre_nb_available_rbs = nb_rb; + PHY_vars_eNB_g[mod_id][CC_id]->mu_mimo_mode[UE_id].dl_pow_off = ue_sched_ctl->dl_pow_off[CC_id]; + + for(j=0; jN_RBG; j++) { + PHY_vars_eNB_g[mod_id][CC_id]->mu_mimo_mode[UE_id].rballoc_sub[j] = UE_list->UE_template[CC_id][UE_id].rballoc_subband[harq_pid][j]; + } + + switch (mac_xface->get_transmission_mode(mod_id,CC_id,rnti)) { + case 1: + case 2: + default: + dl_dci->has_format = 1; + dl_dci->format = PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1; + dl_dci->n_ndi = 1; + dl_dci->ndi = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_ndi); + dl_dci->ndi[0] = 0; + dl_dci->n_rv = 1; + dl_dci->rv = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_rv); + dl_dci->rv[0] = round&3; + if (frame_parms[CC_id]->frame_type == TDD) { + dl_dci->has_dai = 1; + dl_dci->dai = (UE_list->UE_template[CC_id][UE_id].DAI-1)&3; + LOG_D(MAC,"[eNB %d] Retransmission CC_id %d : harq_pid %d, round %d, dai %d\n", + mod_id, CC_id, harq_pid, round,(UE_list->UE_template[CC_id][UE_id].DAI-1)); + } else { + LOG_D(MAC,"[eNB %d] Retransmission CC_id %d : harq_pid %d, round %d\n", + mod_id, CC_id, harq_pid, round); + } + break; + case 4: + dl_dci->has_format = 1; + dl_dci->format = PROTOCOL__PRP_DCI_FORMAT__PRDCIF_2A; + dl_dci->n_ndi = 2; + dl_dci->ndi = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_ndi); + dl_dci->ndi[0] = 0; + dl_dci->ndi[1] = 0; + dl_dci->has_dai = 1; + dl_dci->dai = (UE_list->UE_template[CC_id][UE_id].DAI-1)&3; + dl_dci->n_rv = 2; + dl_dci->rv = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_rv); + dl_dci->rv[0] = round&3; + dl_dci->rv[1] = round&3; + + break; + case 5: + dl_dci->has_format = 1; + dl_dci->format = PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1D; + dl_dci->n_ndi = 1; + dl_dci->ndi = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_ndi); + dl_dci->ndi[0] = 0; + dl_dci->has_dai = 1; + dl_dci->dai = (UE_list->UE_template[CC_id][UE_id].DAI-1)&3; + dl_dci->n_rv = 1; + dl_dci->rv = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_rv); + dl_dci->rv[0] = round&3; + + if(ue_sched_ctl->dl_pow_off[CC_id] == 2) { + ue_sched_ctl->dl_pow_off[CC_id] = 1; + } + + dl_dci->has_dl_power_offset = 1; + dl_dci->dl_power_offset = ue_sched_ctl->dl_pow_off[CC_id]; + + break; + case 6: + dl_dci->has_format = 1; + dl_dci->format = PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1D; + dl_dci->n_ndi = 1; + dl_dci->ndi = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_ndi); + dl_dci->ndi[0] = 0; + dl_dci->has_dai = 1; + dl_dci->dai = (UE_list->UE_template[CC_id][UE_id].DAI-1)&3; + dl_dci->n_rv = 1; + dl_dci->rv = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_rv); + dl_dci->rv[0] = round&3; + dl_dci->has_dl_power_offset = 1; + dl_dci->dl_power_offset = ue_sched_ctl->dl_pow_off[CC_id]; + + break; + } + + add_ue_dlsch_info(mod_id, + CC_id, + UE_id, + subframe, + S_DL_SCHEDULED); + + //eNB_UE_stats->dlsch_trials[round]++; + UE_list->eNB_UE_stats[CC_id][UE_id].num_retransmission+=1; + UE_list->eNB_UE_stats[CC_id][UE_id].rbs_used_retx=nb_rb; + UE_list->eNB_UE_stats[CC_id][UE_id].total_rbs_used_retx+=nb_rb; + UE_list->eNB_UE_stats[CC_id][UE_id].ncce_used_retx=nCCE[CC_id]; + UE_list->eNB_UE_stats[CC_id][UE_id].dlsch_mcs1=eNB_UE_stats->dlsch_mcs1; + UE_list->eNB_UE_stats[CC_id][UE_id].dlsch_mcs2=eNB_UE_stats->dlsch_mcs1; + } else { + LOG_D(MAC,"[eNB %d] Frame %d CC_id %d : don't schedule UE %d, its retransmission takes more resources than we have\n", + mod_id, frame, CC_id, UE_id); + } + + num_ues_added += 1; + + } else { /* This is a potentially new SDU opportunity */ + + rlc_status.bytes_in_buffer = 0; + // Now check RLC information to compute number of required RBs + // get maximum TBS size for RLC request + //TBS = mac_xface->get_TBS(eNB_UE_stats->DL_cqi[0]<<1,nb_available_rb); + TBS = mac_xface->get_TBS_DL(eNB_UE_stats->dlsch_mcs1,nb_available_rb); + // check first for RLC data on DCCH + // add the length for all the control elements (timing adv, drx, etc) : header + payload + + //#ifndef EXMIMO_IOT + // to be checked by RK, NN, FK + uint8_t update_TA=4; + + switch (frame_parms[CC_id]->N_RB_DL) { + case 6: + update_TA = 1; + break; + + case 25: + update_TA = 4; + break; + + case 50: + update_TA = 8; + break; + + case 100: + update_TA = 16; + break; + } + + ta_len = ((eNB_UE_stats->timing_advance_update/update_TA)!=0) ? 2 : 0; + + dl_data[num_ues_added]->n_ce_bitmap = 2; + dl_data[num_ues_added]->ce_bitmap = (uint32_t *) malloc(sizeof(uint32_t) * 2); + + if (ta_len > 0) { + ce_flags |= PROTOCOL__PRP_CE_TYPE__PRPCET_TA; + } + + + header_len_dcch = 2; // 2 bytes DCCH SDU subheader + + if ( TBS-ta_len-header_len_dcch > 0 ) { + + + rlc_status = mac_rlc_status_ind( + mod_id, + rnti, + mod_id, + frame, + ENB_FLAG_YES, + MBMS_FLAG_NO, + DCCH, + (TBS-ta_len-header_len_dcch)); // transport block set size + + if (rlc_status.bytes_in_buffer > 0) { + sdu_length_total = cmin(rlc_status.bytes_in_buffer, TBS-ta_len-header_len_dcch); + // TODO: This should be replaced with the proper description of the CE + ce_flags |= PROTOCOL__PRP_CE_TYPE__PRPCET_CR; + } else { + header_len_dcch = 0; + sdu_length_total = 0; + } + } + + // check for DCCH1 and update header information (assume 2 byte sub-header) + if (TBS-ta_len-header_len_dcch-sdu_length_total > 0 ) { + rlc_status = mac_rlc_status_ind( + mod_id, + rnti, + mod_id, + frame, + ENB_FLAG_YES, + MBMS_FLAG_NO, + DCCH+1, + (TBS-ta_len-header_len_dcch-sdu_length_total)); // transport block set size less allocations for timing advance and + // DCCH SDU + + if (rlc_status.bytes_in_buffer > 0) { + // TODO: Again hypothetical flag. Need to check how to find the actual type of CE + ce_flags |= PROTOCOL__PRP_CE_TYPE__PRPCET_CA; + sdu_length_total += cmin(rlc_status.bytes_in_buffer, TBS-ta_len-header_len_dcch-sdu_length_total); + header_len_dcch += 2; + } + } + + // Add the control element flags to the progran message + dl_data[num_ues_added]->ce_bitmap = ce_flags; + + // check for DTCH and update header information + // here we should loop over all possible DTCH + + header_len_dtch = 3; // 3 bytes DTCH SDU subheader + + LOG_D(MAC,"[eNB %d], Frame %d, DTCH->DLSCH, CC_id %d, Checking RLC status (rab %d, tbs %d, len %d)\n", + mod_id, frame, CC_id, DTCH, TBS, + TBS-ta_len-header_len_dcch-sdu_length_total-header_len_dtch); + + if (TBS-ta_len-header_len_dcch-sdu_length_total-header_len_dtch > 0 ) { + rlc_status = mac_rlc_status_ind( + mod_id, + rnti, + mod_id, + frame, + ENB_FLAG_YES, + MBMS_FLAG_NO, + DTCH, + TBS-ta_len-header_len_dcch-sdu_length_total-header_len_dtch); + + if (rlc_status.bytes_in_buffer > 0) { + + //TODO: Set rlc pdu info. Hardcoded for the moment + + dl_data[num_ues_added]->n_rlc_pdu++; + rlc_pdus[0] = (Protocol__PrpRlcPdu *) malloc(sizeof(Protocol__PrpRlcPdu)); + protocol__prp_rlc_pdu__init(rlc_pdus[0]); + rlc_pdus[0]->n_rlc_pdu_tb = 2; + rlc_pdus[0]->rlc_pdu_tb = (Protocol__PrpRlcPduTb **) malloc(sizeof(Protocol__PrpRlcPduTb *) * 2); + rlc_pdus[0]->rlc_pdu_tb[0] = (Protocol__PrpRlcPduTb *) malloc(sizeof(Protocol__PrpRlcPduTb)); + rlc_pdus[0]->rlc_pdu_tb[0]->has_logical_channel_id = 1; + rlc_pdus[0]->rlc_pdu_tb[0]->logical_channel_id = DTCH; + rlc_pdus[0]->rlc_pdu_tb[0]->has_size = 1; + rlc_pdus[0]->rlc_pdu_tb[0]->size = TBS-ta_len-header_len_dcch-sdu_length_total-header_len_dtch; + rlc_pdus[0]->rlc_pdu_tb[1] = (Protocol__PrpRlcPduTb *) malloc(sizeof(Protocol__PrpRlcPduTb)); + rlc_pdus[0]->rlc_pdu_tb[1]->has_logical_channel_id = 1; + rlc_pdus[0]->rlc_pdu_tb[1]->logical_channel_id = DTCH; + rlc_pdus[0]->rlc_pdu_tb[1]->has_size = 1; + rlc_pdus[0]->rlc_pdu_tb[1]->size = TBS-ta_len-header_len_dcch-sdu_length_total-header_len_dtch; + + // Add rlc_pdus to the dl_data message + dl_data[num_ues_added]->rlc_pdu = (Protocol__PrpRlcPdu **) malloc(sizeof(Protocol__PrpRlcPdu *) * + dl_data[num_ues_added]->n_rlc_pdu); + for (i = 0; i< dl_data[num_ues_added]->n_rlc_pdu; i++) { + dl_data[num_ues_added]->rlc_pdu[i] = rlc_pdus[i]; + } + + sdu_length_total += cmin(rlc_status.bytes_in_buffer, TBS-ta_len-header_len_dcch-sdu_length_total-header_len_dtch); + + if(cmin(rlc_status.bytes_in_buffer, TBS-ta_len-header_len_dcch-sdu_length_total-header_len_dtch) < 128) { + header_len_dtch = 2; + } + + } else { + header_len_dtch = 0; + } + } + + // there is a payload + if (((sdu_length_total + header_len_dcch + header_len_dtch )> 0)) { + // Now compute number of required RBs for total sdu length + // Assume RAH format 2 + // adjust header lengths + header_len_dcch_tmp = header_len_dcch; + header_len_dtch_tmp = header_len_dtch; + + if (header_len_dtch==0) { + header_len_dcch = (header_len_dcch >0) ? 1 : header_len_dcch; // remove length field + } else { + header_len_dtch = (header_len_dtch > 0) ? 1 :header_len_dtch; // remove length field for the last SDU + } + + mcs = eNB_UE_stats->dlsch_mcs1; + + if (mcs==0) { + nb_rb = 4; // don't let the TBS get too small + } else { + nb_rb=min_rb_unit[CC_id]; + } + + TBS = mac_xface->get_TBS_DL(mcs,nb_rb); + + while (TBS < (sdu_length_total + header_len_dcch + header_len_dtch + ta_len)) { + nb_rb += min_rb_unit[CC_id]; // + + if (nb_rb>nb_available_rb) { // if we've gone beyond the maximum number of RBs + // (can happen if N_RB_DL is odd) + TBS = mac_xface->get_TBS_DL(eNB_UE_stats->dlsch_mcs1,nb_available_rb); + nb_rb = nb_available_rb; + break; + } + + TBS = mac_xface->get_TBS_DL(eNB_UE_stats->dlsch_mcs1,nb_rb); + } + + if(nb_rb == ue_sched_ctl->pre_nb_available_rbs[CC_id]) { + for(j=0; jN_RBG; j++) { // for indicating the rballoc for each sub-band + UE_list->UE_template[CC_id][UE_id].rballoc_subband[harq_pid][j] = ue_sched_ctl->rballoc_sub_UE[CC_id][j]; + } + } else { + nb_rb_temp = nb_rb; + j = 0; + + while((nb_rb_temp > 0) && (jN_RBG)) { + if(ue_sched_ctl->rballoc_sub_UE[CC_id][j] == 1) { + UE_list->UE_template[CC_id][UE_id].rballoc_subband[harq_pid][j] = ue_sched_ctl->rballoc_sub_UE[CC_id][j]; + + if ((j == frame_parms[CC_id]->N_RBG-1) && + ((frame_parms[CC_id]->N_RB_DL == 25)|| + (frame_parms[CC_id]->N_RB_DL == 50))) { + nb_rb_temp = nb_rb_temp - min_rb_unit[CC_id]+1; + } else { + nb_rb_temp = nb_rb_temp - min_rb_unit[CC_id]; + } + } + + j = j+1; + } + } + + PHY_vars_eNB_g[mod_id][CC_id]->mu_mimo_mode[UE_id].pre_nb_available_rbs = nb_rb; + PHY_vars_eNB_g[mod_id][CC_id]->mu_mimo_mode[UE_id].dl_pow_off = ue_sched_ctl->dl_pow_off[CC_id]; + + for(j=0; jN_RBG; j++) { + PHY_vars_eNB_g[mod_id][CC_id]->mu_mimo_mode[UE_id].rballoc_sub[j] = UE_list->UE_template[CC_id][UE_id].rballoc_subband[harq_pid][j]; + } + + // decrease mcs until TBS falls below required length + while ((TBS > (sdu_length_total + header_len_dcch + header_len_dtch + ta_len)) && (mcs>0)) { + mcs--; + TBS = mac_xface->get_TBS_DL(mcs,nb_rb); + } + + // if we have decreased too much or we don't have enough RBs, increase MCS + while ((TBS < (sdu_length_total + header_len_dcch + header_len_dtch + ta_len)) && ((( ue_sched_ctl->dl_pow_off[CC_id]>0) && (mcs<28)) + || ( (ue_sched_ctl->dl_pow_off[CC_id]==0) && (mcs<=15)))) { + mcs++; + TBS = mac_xface->get_TBS_DL(mcs,nb_rb); + } + + dl_dci->n_tbs_size = 2; + dl_dci->tbs_size = (uint32_t *) malloc(sizeof(uint32_t) * 2); + dl_dci->tbs_size[0] = TBS; + dl_dci->tbs_size[1] = TBS; + + LOG_D(MAC,"dlsch_mcs before and after the rate matching = (%d, %d)\n",eNB_UE_stats->dlsch_mcs1, mcs); + + aggregation = process_ue_cqi(mod_id,UE_id); + dl_dci->has_aggr_level = 1; + dl_dci->aggr_level = aggregation; + dl_dci->has_cce_index = 1; + dl_dci->cce_index = nCCE_used[CC_id]; + nCCE[CC_id]-=(1<UE_template[CC_id][UE_id].nb_rb[harq_pid] = nb_rb; + + add_ue_dlsch_info(mod_id, + CC_id, + UE_id, + subframe, + S_DL_SCHEDULED); + + if (frame_parms[CC_id]->frame_type == TDD) { + UE_list->UE_template[CC_id][UE_id].DAI++; + // printf("DAI update: subframeP %d: UE %d, DAI %d\n",subframeP,UE_id,UE_list->UE_template[CC_id][UE_id].DAI); +#warning only for 5MHz channel + update_ul_dci(mod_id, CC_id, rnti, UE_list->UE_template[CC_id][UE_id].DAI); + } + + // do PUCCH power control + // this is the normalized RX power + eNB_UE_stats = mac_xface->get_eNB_UE_stats(mod_id, CC_id, rnti); + normalized_rx_power = eNB_UE_stats->Po_PUCCH_dBm; + target_rx_power = mac_xface->get_target_pucch_rx_power(mod_id, CC_id) + 10; + + // this assumes accumulated tpc + // make sure that we are only sending a tpc update once a frame, otherwise the control loop will freak out + int32_t framex10psubframe = UE_list->UE_template[CC_id][UE_id].pucch_tpc_tx_frame*10+UE_list->UE_template[CC_id][UE_id].pucch_tpc_tx_subframe; + + if (((framex10psubframe+10)<=(frame*10+subframe)) || //normal case + ((framex10psubframe>(frame*10+subframe)) && (((10240-framex10psubframe+frame*10+subframe)>=10)))) //frame wrap-around + if (eNB_UE_stats->Po_PUCCH_update == 1) { + eNB_UE_stats->Po_PUCCH_update = 0; + + UE_list->UE_template[CC_id][UE_id].pucch_tpc_tx_frame=frame; + UE_list->UE_template[CC_id][UE_id].pucch_tpc_tx_subframe=subframe; + if (normalized_rx_power>(target_rx_power+1)) { + tpc = 0; //-1 + tpc_accumulated--; + } else if (normalized_rx_power<(target_rx_power-1)) { + tpc = 2; //+1 + tpc_accumulated++; + } else { + tpc = 1; //0 + } + LOG_D(MAC,"[eNB %d] DLSCH scheduler: frame %d, subframe %d, harq_pid %d, tpc %d, accumulated %d, normalized/target rx power %d/%d\n", + mod_id, frame, subframe, harq_pid, tpc, + tpc_accumulated, normalized_rx_power, target_rx_power); + } // Po_PUCCH has been updated + else { + tpc = 1; //0 + } // time to do TPC update + else { + tpc = 1; //0 + } + + for(i=0; ilte_frame_parms.N_RBG; i++) { + rballoc_sub[i] = UE_list->UE_template[CC_id][UE_id].rballoc_subband[harq_pid][i]; + } + + switch (mac_xface->get_transmission_mode(mod_id, CC_id, rnti)) { + case 1: + case 2: + default: + dl_dci->has_res_alloc = 1; + dl_dci->res_alloc = 0; + dl_dci->has_vrb_format = 1; + dl_dci->vrb_format = PROTOCOL__PRP_VRB_FORMAT__PRVRBF_LOCALIZED; + dl_dci->has_format = 1; + dl_dci->format = PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1; + dl_dci->has_rb_bitmap = 1; + dl_dci->rb_bitmap = allocate_prbs_sub(nb_rb, rballoc_sub); + dl_dci->has_rb_shift = 1; + dl_dci->rb_shift = 0; + dl_dci->n_ndi = 1; + dl_dci->ndi = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_ndi); + dl_dci->ndi[0] = 1-UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]; + dl_dci->n_rv = 1; + dl_dci->rv = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_rv); + dl_dci->rv[0] = 0; + dl_dci->has_tpc = 1; + dl_dci->tpc = tpc; + dl_dci->n_mcs = 1; + dl_dci->mcs = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_mcs); + dl_dci->mcs[0] = mcs; + if (frame_parms[CC_id]->frame_type == TDD) { + dl_dci->has_dai = 1; + dl_dci->dai = (UE_list->UE_template[CC_id][UE_id].DAI-1)&3; + LOG_D(MAC,"[eNB %d] Retransmission CC_id %d : harq_pid %d, round %d, dai %d\n", + mod_id, CC_id, harq_pid, round,(UE_list->UE_template[CC_id][UE_id].DAI-1)); + } else { + LOG_D(MAC,"[eNB %d] Retransmission CC_id %d : harq_pid %d, round %d\n", + mod_id, CC_id, harq_pid, round); + } + break; + case 3: + dl_dci->has_res_alloc = 1; + dl_dci->res_alloc = 0; + dl_dci->has_vrb_format = 1; + dl_dci->vrb_format = PROTOCOL__PRP_VRB_FORMAT__PRVRBF_LOCALIZED; + dl_dci->has_format = 1; + dl_dci->format = PROTOCOL__PRP_DCI_FORMAT__PRDCIF_2A; + dl_dci->has_rb_bitmap = 1; + dl_dci->rb_bitmap = allocate_prbs_sub(nb_rb, rballoc_sub); + dl_dci->has_rb_shift = 1; + dl_dci->rb_shift = 0; + dl_dci->n_ndi = 2; + dl_dci->ndi = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_ndi); + dl_dci->ndi[0] = 1-UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]; + dl_dci->ndi[1] = 0; + dl_dci->n_rv = 2; + dl_dci->rv = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_rv); + dl_dci->rv[0] = 0; + dl_dci->rv[1] = 1; + dl_dci->has_tpc = 1; + dl_dci->tpc = tpc; + dl_dci->n_mcs = 2; + dl_dci->mcs = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_mcs); + dl_dci->mcs[0] = mcs; + dl_dci->mcs[1] = 0; + if (frame_parms[CC_id]->frame_type == TDD) { + dl_dci->has_dai = 1; + dl_dci->dai = (UE_list->UE_template[CC_id][UE_id].DAI-1)&3; + LOG_D(MAC,"[eNB %d] Retransmission CC_id %d : harq_pid %d, round %d, dai %d\n", + mod_id, CC_id, harq_pid, round,(UE_list->UE_template[CC_id][UE_id].DAI-1)); + } else { + LOG_D(MAC,"[eNB %d] Retransmission CC_id %d : harq_pid %d, round %d\n", + mod_id, CC_id, harq_pid, round); + } + break; + case 4: + dl_dci->has_res_alloc = 1; + dl_dci->res_alloc = 0; + dl_dci->has_vrb_format = 1; + dl_dci->vrb_format = PROTOCOL__PRP_VRB_FORMAT__PRVRBF_LOCALIZED; + dl_dci->has_format = 1; + dl_dci->format = PROTOCOL__PRP_DCI_FORMAT__PRDCIF_2; + dl_dci->has_rb_bitmap = 1; + dl_dci->rb_bitmap = allocate_prbs_sub(nb_rb, rballoc_sub); + dl_dci->has_rb_shift = 1; + dl_dci->rb_shift = 0; + dl_dci->n_ndi = 2; + dl_dci->ndi = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_ndi); + dl_dci->ndi[0] = 1-UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]; + dl_dci->ndi[1] = 0; + dl_dci->n_rv = 2; + dl_dci->rv = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_rv); + dl_dci->rv[0] = 0; + dl_dci->rv[1] = round&3; + dl_dci->has_tpc = 1; + dl_dci->tpc = tpc; + dl_dci->n_mcs = 2; + dl_dci->mcs = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_mcs); + dl_dci->mcs[0] = mcs; + dl_dci->mcs[1] = 0; + if (frame_parms[CC_id]->frame_type == TDD) { + dl_dci->has_dai = 1; + dl_dci->dai = (UE_list->UE_template[CC_id][UE_id].DAI-1)&3; + LOG_D(MAC,"[eNB %d] Retransmission CC_id %d : harq_pid %d, round %d, dai %d\n", + mod_id, CC_id, harq_pid, round,(UE_list->UE_template[CC_id][UE_id].DAI-1)); + } else { + LOG_D(MAC,"[eNB %d] Retransmission CC_id %d : harq_pid %d, round %d\n", + mod_id, CC_id, harq_pid, round); + } + break; + case 5: + dl_dci->has_res_alloc = 1; + dl_dci->res_alloc = 0; + dl_dci->has_vrb_format = 1; + dl_dci->vrb_format = PROTOCOL__PRP_VRB_FORMAT__PRVRBF_LOCALIZED; + dl_dci->has_format = 1; + dl_dci->format = PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1D; + dl_dci->has_rb_bitmap = 1; + dl_dci->rb_bitmap = allocate_prbs_sub(nb_rb, rballoc_sub); + dl_dci->has_rb_shift = 1; + dl_dci->rb_shift = 0; + dl_dci->n_ndi = 1; + dl_dci->ndi = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_ndi); + dl_dci->ndi[0] = 1; + dl_dci->n_rv = 1; + dl_dci->rv = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_rv); + dl_dci->rv[0] = round&3; + dl_dci->has_tpc = 1; + dl_dci->tpc = tpc; + dl_dci->n_mcs = 1; + dl_dci->mcs = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_mcs); + dl_dci->mcs[0] = mcs; + if (frame_parms[CC_id]->frame_type == TDD) { + dl_dci->has_dai = 1; + dl_dci->dai = (UE_list->UE_template[CC_id][UE_id].DAI-1)&3; + LOG_D(MAC,"[eNB %d] Retransmission CC_id %d : harq_pid %d, round %d, dai %d\n", + mod_id, CC_id, harq_pid, round,(UE_list->UE_template[CC_id][UE_id].DAI-1)); + } else { + LOG_D(MAC,"[eNB %d] Retransmission CC_id %d : harq_pid %d, round %d\n", + mod_id, CC_id, harq_pid, round); + } + + if(ue_sched_ctl->dl_pow_off[CC_id] == 2) { + ue_sched_ctl->dl_pow_off[CC_id] = 1; + } + + dl_dci->has_dl_power_offset = 1; + dl_dci->dl_power_offset = ue_sched_ctl->dl_pow_off[CC_id]; + dl_dci->has_precoding_info = 1; + dl_dci->precoding_info = 5; // Is this right?? + + break; + case 6: + dl_dci->has_res_alloc = 1; + dl_dci->res_alloc = 0; + dl_dci->has_vrb_format = 1; + dl_dci->vrb_format = PROTOCOL__PRP_VRB_FORMAT__PRVRBF_LOCALIZED; + dl_dci->has_format = 1; + dl_dci->format = PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1D; + dl_dci->has_rb_bitmap = 1; + dl_dci->rb_bitmap = allocate_prbs_sub(nb_rb, rballoc_sub); + dl_dci->has_rb_shift = 1; + dl_dci->rb_shift = 0; + dl_dci->n_ndi = 1; + dl_dci->ndi = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_ndi); + dl_dci->ndi[0] = 1; + dl_dci->n_rv = 1; + dl_dci->rv = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_rv); + dl_dci->rv[0] = round&3; + dl_dci->has_tpc = 1; + dl_dci->tpc = tpc; + dl_dci->n_mcs = 1; + dl_dci->mcs = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_mcs); + dl_dci->mcs[0] = mcs; + if (frame_parms[CC_id]->frame_type == TDD) { + dl_dci->has_dai = 1; + dl_dci->dai = (UE_list->UE_template[CC_id][UE_id].DAI-1)&3; + LOG_D(MAC,"[eNB %d] Retransmission CC_id %d : harq_pid %d, round %d, dai %d\n", + mod_id, CC_id, harq_pid, round,(UE_list->UE_template[CC_id][UE_id].DAI-1)); + } else { + LOG_D(MAC,"[eNB %d] Retransmission CC_id %d : harq_pid %d, round %d\n", + mod_id, CC_id, harq_pid, round); + } + + dl_dci->has_dl_power_offset = 1; + dl_dci->dl_power_offset = ue_sched_ctl->dl_pow_off[CC_id]; + dl_dci->has_precoding_info = 1; + dl_dci->precoding_info = 5; // Is this right?? + break; + } + // Toggle NDI for next time + LOG_D(MAC,"CC_id %d Frame %d, subframeP %d: Toggling Format1 NDI for UE %d (rnti %x/%d) oldNDI %d\n", + CC_id, frame, subframe, UE_id, + UE_list->UE_template[CC_id][UE_id].rnti,harq_pid, UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]); + UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]=1-UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]; + + // Increase the pointer for the number of scheduled UEs + num_ues_added++; + } else { // There is no data from RLC or MAC header, so don't schedule + + } + } + if (frame_parms[CC_id]->frame_type == TDD) { + set_ul_DAI(mod_id, UE_id, CC_id, frame, subframe, frame_parms); + } + } + } + + // Add all the dl_data elements to the progran message + dl_info->dl_mac_config_msg->n_dl_ue_data = num_ues_added; + dl_info->dl_mac_config_msg->dl_ue_data = (Protocol__PrpDlData **) malloc(sizeof(Protocol__PrpDlData *) * num_ues_added); + for (i = 0; i < num_ues_added; i++) { + dl_info->dl_mac_config_msg->dl_ue_data[i] = dl_data[i]; + } + + stop_meas(&eNB->schedule_dlsch); + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_SCHEDULE_DLSCH,VCD_FUNCTION_OUT); +} diff --git a/openair2/LAYER2/MAC/eNB_scheduler.c b/openair2/LAYER2/MAC/eNB_scheduler.c index 329c40be05..0de9253fef 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler.c +++ b/openair2/LAYER2/MAC/eNB_scheduler.c @@ -59,6 +59,10 @@ //#include "LAYER2/MAC/pre_processor.c" #include "pdcp.h" +//Agent-related headers +#include "ENB_APP/enb_agent_extern.h" +#include "ENB_APP/enb_agent_mac.h" + #if defined(ENABLE_ITTI) # include "intertask_interface.h" #endif @@ -85,6 +89,9 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, int mbsfn_status[MAX_NUM_CCs]; uint32_t RBalloc[MAX_NUM_CCs]; protocol_ctxt_t ctxt; + + Protocol__ProgranMessage *msg; + #ifdef EXMIMO int ret; #endif @@ -275,7 +282,19 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, break; } } else { //FDD - schedule_ue_spec(module_idP,frameP,subframeP,nprb,nCCE,mbsfn_status); + if (mac_agent_registered[module_idP]) { + enb_agent_mac_create_empty_dl_config(module_idP, &msg); + agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( + module_idP, + frameP, + subframeP, + nprb, + nCCE, + mbsfn_status, + msg); + enb_agent_mac_destroy_dl_config(msg); + } + //schedule_ue_spec(module_idP,frameP,subframeP,nprb,nCCE,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,RBalloc,0,mbsfn_status); schedule_ulsch(module_idP,frameP,cooperation_flag,1,5,nCCE); } @@ -287,7 +306,19 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, // TDD, nothing // FDD, normal UL/DLSCH if (mac_xface->lte_frame_parms->frame_type == FDD) { //FDD - schedule_ue_spec(module_idP,frameP,subframeP,nprb,nCCE,mbsfn_status); + if (mac_agent_registered[module_idP]) { + enb_agent_mac_create_empty_dl_config(module_idP, &msg); + agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( + module_idP, + frameP, + subframeP, + nprb, + nCCE, + mbsfn_status, + msg); + enb_agent_mac_destroy_dl_config(msg); + } + //schedule_ue_spec(module_idP,frameP,subframeP,nprb,nCCE,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,RBalloc,0,mbsfn_status); schedule_ulsch(module_idP,frameP,cooperation_flag,2,6,nCCE); } @@ -306,7 +337,19 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, // no break here! case 5: - schedule_ue_spec(module_idP,frameP,subframeP,nprb,nCCE,mbsfn_status); + if (mac_agent_registered[module_idP]) { + enb_agent_mac_create_empty_dl_config(module_idP, &msg); + agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( + module_idP, + frameP, + subframeP, + nprb, + nCCE, + mbsfn_status, + msg); + enb_agent_mac_destroy_dl_config(msg); + } + //schedule_ue_spec(module_idP,frameP,subframeP,nprb,nCCE,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,RBalloc,0,mbsfn_status); break; @@ -314,7 +357,19 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, break; } } else { //FDD - schedule_ue_spec(module_idP,frameP,subframeP,nprb,nCCE,mbsfn_status); + if (mac_agent_registered[module_idP]) { + enb_agent_mac_create_empty_dl_config(module_idP, &msg); + agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( + module_idP, + frameP, + subframeP, + nprb, + nCCE, + mbsfn_status, + msg); + enb_agent_mac_destroy_dl_config(msg); + } + //schedule_ue_spec(module_idP,frameP,subframeP,nprb,nCCE,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,RBalloc,0,mbsfn_status); schedule_ulsch(module_idP,frameP,cooperation_flag,3,7,nCCE); @@ -341,7 +396,19 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, // no break here! case 5: - schedule_ue_spec(module_idP,frameP,subframeP,nprb,nCCE,mbsfn_status); + if (mac_agent_registered[module_idP]) { + enb_agent_mac_create_empty_dl_config(module_idP, &msg); + agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( + module_idP, + frameP, + subframeP, + nprb, + nCCE, + mbsfn_status, + msg); + enb_agent_mac_destroy_dl_config(msg); + } + //schedule_ue_spec(module_idP,frameP,subframeP,nprb,nCCE,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,RBalloc,1,mbsfn_status); break; @@ -352,7 +419,19 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, if (mac_xface->lte_frame_parms->frame_type == FDD) { //FDD // schedule_RA(module_idP,frameP, subframeP, 0, nprb, nCCE); // schedule_ulsch(module_idP, frameP, cooperation_flag, 4, 8, nCCE); - schedule_ue_spec(module_idP, frameP, subframeP, nprb, nCCE, mbsfn_status); + if (mac_agent_registered[module_idP]) { + enb_agent_mac_create_empty_dl_config(module_idP, &msg); + agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( + module_idP, + frameP, + subframeP, + nprb, + nCCE, + mbsfn_status, + msg); + enb_agent_mac_destroy_dl_config(msg); + } + //schedule_ue_spec(module_idP, frameP, subframeP, nprb, nCCE, mbsfn_status); fill_DLSCH_dci(module_idP, frameP, subframeP, RBalloc, 1, mbsfn_status); } @@ -408,13 +487,37 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, case 5: schedule_RA(module_idP,frameP,subframeP,2,nprb,nCCE); - schedule_ue_spec(module_idP,frameP,subframeP,nprb,nCCE,mbsfn_status); + if (mac_agent_registered[module_idP]) { + enb_agent_mac_create_empty_dl_config(module_idP, &msg); + agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( + module_idP, + frameP, + subframeP, + nprb, + nCCE, + mbsfn_status, + msg); + enb_agent_mac_destroy_dl_config(msg); + } + //schedule_ue_spec(module_idP,frameP,subframeP,nprb,nCCE,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,RBalloc,1,mbsfn_status); break; case 3: case 4: - schedule_ue_spec(module_idP,frameP,subframeP,nprb,nCCE,mbsfn_status); + if (mac_agent_registered[module_idP]) { + enb_agent_mac_create_empty_dl_config(module_idP, &msg); + agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( + module_idP, + frameP, + subframeP, + nprb, + nCCE, + mbsfn_status, + msg); + enb_agent_mac_destroy_dl_config(msg); + } + //schedule_ue_spec(module_idP,frameP,subframeP,nprb,nCCE,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,RBalloc,0,mbsfn_status); break; @@ -423,7 +526,19 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, } } else { //FDD // schedule_ulsch(module_idP,frameP,cooperation_flag,6,0,nCCE); - schedule_ue_spec(module_idP,frameP,subframeP,nprb,nCCE,mbsfn_status); + if (mac_agent_registered[module_idP]) { + enb_agent_mac_create_empty_dl_config(module_idP, &msg); + agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( + module_idP, + frameP, + subframeP, + nprb, + nCCE, + mbsfn_status, + msg); + enb_agent_mac_destroy_dl_config(msg); + } + //schedule_ue_spec(module_idP,frameP,subframeP,nprb,nCCE,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,RBalloc,0,mbsfn_status); } @@ -438,12 +553,36 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, case 3: case 4: schedule_RA(module_idP,frameP,subframeP,3,nprb,nCCE); // 3 = Msg3 subframeP, not - schedule_ue_spec(module_idP,frameP,subframeP,nprb,nCCE,mbsfn_status); + if (mac_agent_registered[module_idP]) { + enb_agent_mac_create_empty_dl_config(module_idP, &msg); + agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( + module_idP, + frameP, + subframeP, + nprb, + nCCE, + mbsfn_status, + msg); + enb_agent_mac_destroy_dl_config(msg); + } + //schedule_ue_spec(module_idP,frameP,subframeP,nprb,nCCE,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,RBalloc,1,mbsfn_status); break; case 5: - schedule_ue_spec(module_idP,frameP,subframeP,nprb,nCCE,mbsfn_status); + //schedule_ue_spec(module_idP,frameP,subframeP,nprb,nCCE,mbsfn_status); + if (mac_agent_registered[module_idP]) { + enb_agent_mac_create_empty_dl_config(module_idP, &msg); + agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( + module_idP, + frameP, + subframeP, + nprb, + nCCE, + mbsfn_status, + msg); + enb_agent_mac_destroy_dl_config(msg); + } fill_DLSCH_dci(module_idP,frameP,subframeP,RBalloc,0,mbsfn_status); break; @@ -452,7 +591,19 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, } } else { //FDD //schedule_ulsch(module_idP,frameP,cooperation_flag,7,1,nCCE); - schedule_ue_spec(module_idP,frameP,subframeP,nprb,nCCE,mbsfn_status); + if (mac_agent_registered[module_idP]) { + enb_agent_mac_create_empty_dl_config(module_idP, &msg); + agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( + module_idP, + frameP, + subframeP, + nprb, + nCCE, + mbsfn_status, + msg); + enb_agent_mac_destroy_dl_config(msg); + } + //schedule_ue_spec(module_idP,frameP,subframeP,nprb,nCCE,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,RBalloc,0,mbsfn_status); } @@ -472,7 +623,19 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, // schedule_RA(module_idP,subframeP,nprb,nCCE); schedule_ulsch(module_idP,frameP,cooperation_flag,subframeP,2,nCCE); - schedule_ue_spec(module_idP,frameP,subframeP,nprb,nCCE,mbsfn_status); + if (mac_agent_registered[module_idP]) { + enb_agent_mac_create_empty_dl_config(module_idP, &msg); + agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( + module_idP, + frameP, + subframeP, + nprb, + nCCE, + mbsfn_status, + msg); + enb_agent_mac_destroy_dl_config(msg); + } + //schedule_ue_spec(module_idP,frameP,subframeP,nprb,nCCE,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,RBalloc,0,mbsfn_status); break; @@ -481,7 +644,19 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, } } else { //FDD //schedule_ulsch(module_idP,frameP,cooperation_flag,8,2,nCCE); - schedule_ue_spec(module_idP,frameP,subframeP,nprb,nCCE,mbsfn_status); + if (mac_agent_registered[module_idP]) { + enb_agent_mac_create_empty_dl_config(module_idP, &msg); + agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( + module_idP, + frameP, + subframeP, + nprb, + nCCE, + mbsfn_status, + msg); + enb_agent_mac_destroy_dl_config(msg); + } + //schedule_ue_spec(module_idP,frameP,subframeP,nprb,nCCE,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,RBalloc,0,mbsfn_status); } @@ -495,28 +670,76 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, case 1: schedule_ulsch(module_idP,frameP,cooperation_flag,subframeP,3,nCCE); schedule_RA(module_idP,frameP,subframeP,7,nprb,nCCE); // 7 = Msg3 subframeP, not - schedule_ue_spec(module_idP,frameP,subframeP,nprb,nCCE,mbsfn_status); + if (mac_agent_registered[module_idP]) { + enb_agent_mac_create_empty_dl_config(module_idP, &msg); + agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( + module_idP, + frameP, + subframeP, + nprb, + nCCE, + mbsfn_status, + msg); + enb_agent_mac_destroy_dl_config(msg); + } + //schedule_ue_spec(module_idP,frameP,subframeP,nprb,nCCE,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,RBalloc,1,mbsfn_status); break; case 3: case 4: schedule_ulsch(module_idP,frameP,cooperation_flag,subframeP,3,nCCE); - schedule_ue_spec(module_idP,frameP,subframeP,nprb,nCCE,mbsfn_status); + if (mac_agent_registered[module_idP]) { + enb_agent_mac_create_empty_dl_config(module_idP, &msg); + agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( + module_idP, + frameP, + subframeP, + nprb, + nCCE, + mbsfn_status, + msg); + enb_agent_mac_destroy_dl_config(msg); + } + //schedule_ue_spec(module_idP,frameP,subframeP,nprb,nCCE,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,RBalloc,0,mbsfn_status); break; case 6: schedule_ulsch(module_idP,frameP,cooperation_flag,subframeP,4,nCCE); //schedule_RA(module_idP,frameP,subframeP,nprb,nCCE); - schedule_ue_spec(module_idP,frameP,subframeP,nprb,nCCE,mbsfn_status); + if (mac_agent_registered[module_idP]) { + enb_agent_mac_create_empty_dl_config(module_idP, &msg); + agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( + module_idP, + frameP, + subframeP, + nprb, + nCCE, + mbsfn_status, + msg); + enb_agent_mac_destroy_dl_config(msg); + } + //schedule_ue_spec(module_idP,frameP,subframeP,nprb,nCCE,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,RBalloc,0,mbsfn_status); break; case 2: case 5: //schedule_RA(module_idP,frameP,subframeP,nprb,nCCE); - schedule_ue_spec(module_idP,frameP,subframeP,nprb,nCCE,mbsfn_status); + if (mac_agent_registered[module_idP]) { + enb_agent_mac_create_empty_dl_config(module_idP, &msg); + agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( + module_idP, + frameP, + subframeP, + nprb, + nCCE, + mbsfn_status, + msg); + enb_agent_mac_destroy_dl_config(msg); + } + //schedule_ue_spec(module_idP,frameP,subframeP,nprb,nCCE,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,RBalloc,0,mbsfn_status); break; @@ -525,7 +748,19 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, } } else { //FDD // schedule_ulsch(module_idP,frameP,cooperation_flag,9,3,nCCE); - schedule_ue_spec(module_idP,frameP,subframeP,nprb,nCCE,mbsfn_status); + if (mac_agent_registered[module_idP]) { + enb_agent_mac_create_empty_dl_config(module_idP, &msg); + agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( + module_idP, + frameP, + subframeP, + nprb, + nCCE, + mbsfn_status, + msg); + enb_agent_mac_destroy_dl_config(msg); + } + //schedule_ue_spec(module_idP,frameP,subframeP,nprb,nCCE,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,RBalloc,0,mbsfn_status); } diff --git a/openair2/LAYER2/MAC/proto.h b/openair2/LAYER2/MAC/proto.h index d02e42ee16..28df04ef64 100644 --- a/openair2/LAYER2/MAC/proto.h +++ b/openair2/LAYER2/MAC/proto.h @@ -35,6 +35,11 @@ */ #ifndef __LAYER2_MAC_PROTO_H__ #define __LAYER2_MAC_PROTO_H__ + +#include "enb_agent_defs.h" +#include "header.pb-c.h" +#include "progran.pb-c.h" + /** \addtogroup _mac * @{ */ @@ -139,6 +144,11 @@ void fill_DLSCH_dci(module_id_t module_idP,frame_t frameP,sub_frame_t subframe,u */ void schedule_ue_spec(module_id_t module_idP,frame_t frameP,sub_frame_t subframe,unsigned int *nb_rb_used0,unsigned int *nCCE_used,int *mbsfn_flag); +//To be used by the agent +void schedule_ue_spec_default(mid_t mod_id, uint32_t frame, uint32_t subframe, + unsigned int *nb_rb_used, unsigned int *nCCE_used, + int *mbsfn_flag, Protocol__ProgranMessage *dl_info); + /** \brief Function for UE/PHY to compute PUSCH transmit power in power-control procedure. @param Mod_id Module id of UE @returns Po_NOMINAL_PUSCH (PREAMBLE_RECEIVED_TARGET_POWER+DELTA_PREAMBLE From cdb3e36b9949f15dbfbe57f0b62dd7af217df19b Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Sun, 31 Jan 2016 18:13:05 +0000 Subject: [PATCH 078/349] Fixes to merge with develop --- .../LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c | 691 ++++++++++++++++-- openair2/LAYER2/MAC/eNB_scheduler.c | 273 +------ 2 files changed, 630 insertions(+), 334 deletions(-) diff --git a/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c b/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c index 5adc4abc40..30894909a7 100644 --- a/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c +++ b/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c @@ -129,6 +129,8 @@ schedule_ue_spec_default( uint8_t rballoc_sub[25]; int i; + uint32_t data_to_request; + uint32_t dci_tbs; if (UE_list->head==-1) { @@ -233,10 +235,10 @@ schedule_ue_spec_default( nb_available_rb = ue_sched_ctl->pre_nb_available_rbs[CC_id]; harq_pid = ue_sched_ctl->harq_pid[CC_id]; round = ue_sched_ctl->round[CC_id]; - UE_list->eNB_UE_stats[CC_id][UE_id].crnti= rnti; - UE_list->eNB_UE_stats[CC_id][UE_id].rrc_status=mac_eNB_get_rrc_status(mod_id, rnti); - UE_list->eNB_UE_stats[CC_id][UE_id].harq_pid = harq_pid; - UE_list->eNB_UE_stats[CC_id][UE_id].harq_round = round; + //UE_list->eNB_UE_stats[CC_id][UE_id].crnti= rnti; + //UE_list->eNB_UE_stats[CC_id][UE_id].rrc_status=mac_eNB_get_rrc_status(mod_id, rnti); + //UE_list->eNB_UE_stats[CC_id][UE_id].harq_pid = harq_pid; + //UE_list->eNB_UE_stats[CC_id][UE_id].harq_round = round; sdu_length_total=0; @@ -246,20 +248,22 @@ schedule_ue_spec_default( DevCheck(((eNB_UE_stats->DL_cqi[0] < MIN_CQI_VALUE) || (eNB_UE_stats->DL_cqi[0] > MAX_CQI_VALUE)), eNB_UE_stats->DL_cqi[0], MIN_CQI_VALUE, MAX_CQI_VALUE); */ - eNB_UE_stats->dlsch_mcs1 = cqi_to_mcs[eNB_UE_stats->DL_cqi[0]]; - eNB_UE_stats->dlsch_mcs1 = cmin(eNB_UE_stats->dlsch_mcs1, openair_daq_vars.target_ue_dl_mcs); + + mcs = cqi_to_mcs[eNB_UE_stats->DL_cqi[0]]; + //eNB_UE_stats->dlsch_mcs1 = cqi_to_mcs[eNB_UE_stats->DL_cqi[0]]; + //eNB_UE_stats->dlsch_mcs1 = cmin(eNB_UE_stats->dlsch_mcs1, openair_daq_vars.target_ue_dl_mcs); #ifdef EXMIMO - if (mac_xface->get_transmission_mode(mod_id, CC_id, rnti)==5) { - eNB_UE_stats->dlsch_mcs1 = cmin(eNB_UE_stats->dlsch_mcs1,16); - } + // if (mac_xface->get_transmission_mode(mod_id, CC_id, rnti)==5) { + // eNB_UE_stats->dlsch_mcs1 = cmin(eNB_UE_stats->dlsch_mcs1,16); + // } #endif // store stats - UE_list->eNB_UE_stats[CC_id][UE_id].dl_cqi= eNB_UE_stats->DL_cqi[0]; + //UE_list->eNB_UE_stats[CC_id][UE_id].dl_cqi= eNB_UE_stats->DL_cqi[0]; // initializing the rb allocation indicator for each UE for(j=0; jN_RBG; j++) { @@ -268,7 +272,7 @@ schedule_ue_spec_default( LOG_D(MAC,"[eNB %d] Frame %d: Scheduling UE %d on CC_id %d (rnti %x, harq_pid %d, round %d, rb %d, cqi %d, mcs %d, ncc %d, rrc %d)\n", mod_id, frame, UE_id, CC_id, rnti, harq_pid, round, nb_available_rb, - eNB_UE_stats->DL_cqi[0], eNB_UE_stats->dlsch_mcs1, + eNB_UE_stats->DL_cqi[0], mcs, nCCE[CC_id], UE_list->eNB_UE_stats[CC_id][UE_id].rrc_status); @@ -338,8 +342,21 @@ schedule_ue_spec_default( case 1: case 2: default: + dl_dci->has_res_alloc = 1; + dl_dci->res_alloc = 0; + dl_dci->n_mcs = 1; + dl_dci->mcs = (uint32_t *)malloc(sizeof(uint32_t)); + dl_dci->mcs[0] = mcs; //eNB_UE_stats->dlsch_mcs1; + dl_dci->has_tpc = 1; + dl_dci->tpc = 1; + dl_dci->has_vrb_format = 1; + dl_dci->vrb_format = PROTOCOL__PRP_VRB_FORMAT__PRVRBF_LOCALIZED; dl_dci->has_format = 1; dl_dci->format = PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1; + dl_dci->has_rb_bitmap = 1; + dl_dci->rb_bitmap = allocate_prbs_sub(UE_list->UE_template[CC_id][UE_id].nb_rb[harq_pid], UE_list->UE_template[CC_id][UE_id].rballoc_subband); + dl_dci->has_rb_shift = 1; + dl_dci->rb_shift = 0; dl_dci->n_ndi = 1; dl_dci->ndi = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_ndi); dl_dci->ndi[0] = 0; @@ -357,12 +374,20 @@ schedule_ue_spec_default( } break; case 4: + dl_dci->has_res_alloc = 1; + dl_dci->res_alloc = 0; + dl_dci->has_vrb_format = 1; + dl_dci->vrb_format = PROTOCOL__PRP_VRB_FORMAT__PRVRBF_LOCALIZED; dl_dci->has_format = 1; dl_dci->format = PROTOCOL__PRP_DCI_FORMAT__PRDCIF_2A; dl_dci->n_ndi = 2; dl_dci->ndi = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_ndi); dl_dci->ndi[0] = 0; dl_dci->ndi[1] = 0; + //dl_dci->has_rb_bitmap = 1; + //dl_dci->rb_bitmap = allocate_prbs_sub(nb_rb, rballoc_sub); + dl_dci->has_rb_shift = 1; + dl_dci->rb_shift = 0; dl_dci->has_dai = 1; dl_dci->dai = (UE_list->UE_template[CC_id][UE_id].DAI-1)&3; dl_dci->n_rv = 2; @@ -372,11 +397,19 @@ schedule_ue_spec_default( break; case 5: + dl_dci->has_res_alloc = 1; + dl_dci->res_alloc = 0; + dl_dci->has_vrb_format = 1; + dl_dci->vrb_format = PROTOCOL__PRP_VRB_FORMAT__PRVRBF_LOCALIZED; dl_dci->has_format = 1; dl_dci->format = PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1D; dl_dci->n_ndi = 1; dl_dci->ndi = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_ndi); dl_dci->ndi[0] = 0; + //dl_dci->has_rb_bitmap = 1; + //dl_dci->rb_bitmap = allocate_prbs_sub(nb_rb, rballoc_sub); + dl_dci->has_rb_shift = 1; + dl_dci->rb_shift = 0; dl_dci->has_dai = 1; dl_dci->dai = (UE_list->UE_template[CC_id][UE_id].DAI-1)&3; dl_dci->n_rv = 1; @@ -392,11 +425,19 @@ schedule_ue_spec_default( break; case 6: + dl_dci->has_res_alloc = 1; + dl_dci->res_alloc = 0; + dl_dci->has_vrb_format = 1; + dl_dci->vrb_format = PROTOCOL__PRP_VRB_FORMAT__PRVRBF_LOCALIZED; dl_dci->has_format = 1; dl_dci->format = PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1D; dl_dci->n_ndi = 1; dl_dci->ndi = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_ndi); dl_dci->ndi[0] = 0; + //dl_dci->has_rb_bitmap = 1; + //dl_dci->rb_bitmap = allocate_prbs_sub(nb_rb, rballoc_sub); + dl_dci->has_rb_shift = 1; + dl_dci->rb_shift = 0; dl_dci->has_dai = 1; dl_dci->dai = (UE_list->UE_template[CC_id][UE_id].DAI-1)&3; dl_dci->n_rv = 1; @@ -415,18 +456,18 @@ schedule_ue_spec_default( S_DL_SCHEDULED); //eNB_UE_stats->dlsch_trials[round]++; - UE_list->eNB_UE_stats[CC_id][UE_id].num_retransmission+=1; - UE_list->eNB_UE_stats[CC_id][UE_id].rbs_used_retx=nb_rb; - UE_list->eNB_UE_stats[CC_id][UE_id].total_rbs_used_retx+=nb_rb; - UE_list->eNB_UE_stats[CC_id][UE_id].ncce_used_retx=nCCE[CC_id]; - UE_list->eNB_UE_stats[CC_id][UE_id].dlsch_mcs1=eNB_UE_stats->dlsch_mcs1; - UE_list->eNB_UE_stats[CC_id][UE_id].dlsch_mcs2=eNB_UE_stats->dlsch_mcs1; + //UE_list->eNB_UE_stats[CC_id][UE_id].num_retransmission+=1; + //UE_list->eNB_UE_stats[CC_id][UE_id].rbs_used_retx=nb_rb; + //UE_list->eNB_UE_stats[CC_id][UE_id].total_rbs_used_retx+=nb_rb; + //UE_list->eNB_UE_stats[CC_id][UE_id].ncce_used_retx=nCCE[CC_id]; + //UE_list->eNB_UE_stats[CC_id][UE_id].dlsch_mcs1=eNB_UE_stats->dlsch_mcs1; + //UE_list->eNB_UE_stats[CC_id][UE_id].dlsch_mcs2=eNB_UE_stats->dlsch_mcs1; + + num_ues_added += 1; } else { LOG_D(MAC,"[eNB %d] Frame %d CC_id %d : don't schedule UE %d, its retransmission takes more resources than we have\n", mod_id, frame, CC_id, UE_id); } - - num_ues_added += 1; } else { /* This is a potentially new SDU opportunity */ @@ -434,7 +475,8 @@ schedule_ue_spec_default( // Now check RLC information to compute number of required RBs // get maximum TBS size for RLC request //TBS = mac_xface->get_TBS(eNB_UE_stats->DL_cqi[0]<<1,nb_available_rb); - TBS = mac_xface->get_TBS_DL(eNB_UE_stats->dlsch_mcs1,nb_available_rb); + TBS = mac_xface->get_TBS_DL(mcs, nb_available_rb); + dci_tbs = TBS; // check first for RLC data on DCCH // add the length for all the control elements (timing adv, drx, etc) : header + payload @@ -468,13 +510,19 @@ schedule_ue_spec_default( if (ta_len > 0) { ce_flags |= PROTOCOL__PRP_CE_TYPE__PRPCET_TA; } - + + + // Add the control element flags to the progran message + dl_data[num_ues_added]->ce_bitmap[0] = ce_flags; + dl_data[num_ues_added]->ce_bitmap[1] = ce_flags; header_len_dcch = 2; // 2 bytes DCCH SDU subheader + // Need to see if we have space for data from this channel if ( TBS-ta_len-header_len_dcch > 0 ) { - + //If we have space, we need to see how much data we can request at most (if any are available) + rlc_status = mac_rlc_status_ind( mod_id, rnti, @@ -485,10 +533,30 @@ schedule_ue_spec_default( DCCH, (TBS-ta_len-header_len_dcch)); // transport block set size + //If data are available in the DCCH if (rlc_status.bytes_in_buffer > 0) { - sdu_length_total = cmin(rlc_status.bytes_in_buffer, TBS-ta_len-header_len_dcch); - // TODO: This should be replaced with the proper description of the CE - ce_flags |= PROTOCOL__PRP_CE_TYPE__PRPCET_CR; + + // Fill at most 1/3 of the remaining TB + data_to_request = 3;//cmin(3, rlc_status.bytes_in_buffer); + + rlc_pdus[0] = (Protocol__PrpRlcPdu *) malloc(sizeof(Protocol__PrpRlcPdu)); + protocol__prp_rlc_pdu__init(rlc_pdus[0]); + rlc_pdus[0]->n_rlc_pdu_tb = 2; + rlc_pdus[0]->rlc_pdu_tb = (Protocol__PrpRlcPduTb **) malloc(sizeof(Protocol__PrpRlcPduTb *) * 2); + rlc_pdus[0]->rlc_pdu_tb[0] = (Protocol__PrpRlcPduTb *) malloc(sizeof(Protocol__PrpRlcPduTb)); + rlc_pdus[0]->rlc_pdu_tb[0]->has_logical_channel_id = 1; + rlc_pdus[0]->rlc_pdu_tb[0]->logical_channel_id = DCCH; + rlc_pdus[0]->rlc_pdu_tb[0]->has_size = 1; + rlc_pdus[0]->rlc_pdu_tb[0]->size = data_to_request; + rlc_pdus[0]->rlc_pdu_tb[1] = (Protocol__PrpRlcPduTb *) malloc(sizeof(Protocol__PrpRlcPduTb)); + rlc_pdus[0]->rlc_pdu_tb[1]->has_logical_channel_id = 1; + rlc_pdus[0]->rlc_pdu_tb[1]->logical_channel_id = DCCH; + rlc_pdus[0]->rlc_pdu_tb[1]->has_size = 1; + rlc_pdus[0]->rlc_pdu_tb[1]->size = data_to_request; + dl_data[num_ues_added]->n_rlc_pdu++; + + //Set this to the max value that we might request + sdu_length_total = data_to_request; } else { header_len_dcch = 0; sdu_length_total = 0; @@ -496,7 +564,9 @@ schedule_ue_spec_default( } // check for DCCH1 and update header information (assume 2 byte sub-header) - if (TBS-ta_len-header_len_dcch-sdu_length_total > 0 ) { + if (TBS-ta_len-header_len_dcch+2-sdu_length_total > 0 ) { + + //If we have space, we need to see how much data we can request at most (if any are available) rlc_status = mac_rlc_status_ind( mod_id, rnti, @@ -505,20 +575,36 @@ schedule_ue_spec_default( ENB_FLAG_YES, MBMS_FLAG_NO, DCCH+1, - (TBS-ta_len-header_len_dcch-sdu_length_total)); // transport block set size less allocations for timing advance and + (TBS-ta_len-header_len_dcch+2-sdu_length_total)); // transport block set size less allocations for timing advance and // DCCH SDU + // If data are available in DCCH1 if (rlc_status.bytes_in_buffer > 0) { - // TODO: Again hypothetical flag. Need to check how to find the actual type of CE - ce_flags |= PROTOCOL__PRP_CE_TYPE__PRPCET_CA; - sdu_length_total += cmin(rlc_status.bytes_in_buffer, TBS-ta_len-header_len_dcch-sdu_length_total); header_len_dcch += 2; + + //Fill another 1/3 of the remaining TB + data_to_request = 3;//cmin(3, rlc_status.bytes_in_buffer); + + rlc_pdus[1] = (Protocol__PrpRlcPdu *) malloc(sizeof(Protocol__PrpRlcPdu)); + protocol__prp_rlc_pdu__init(rlc_pdus[1]); + rlc_pdus[1]->n_rlc_pdu_tb = 2; + rlc_pdus[1]->rlc_pdu_tb = (Protocol__PrpRlcPduTb **) malloc(sizeof(Protocol__PrpRlcPduTb *) * 2); + rlc_pdus[1]->rlc_pdu_tb[0] = (Protocol__PrpRlcPduTb *) malloc(sizeof(Protocol__PrpRlcPduTb)); + rlc_pdus[1]->rlc_pdu_tb[0]->has_logical_channel_id = 1; + rlc_pdus[1]->rlc_pdu_tb[0]->logical_channel_id = DCCH; + rlc_pdus[1]->rlc_pdu_tb[0]->has_size = 1; + rlc_pdus[1]->rlc_pdu_tb[0]->size = data_to_request; + rlc_pdus[1]->rlc_pdu_tb[1] = (Protocol__PrpRlcPduTb *) malloc(sizeof(Protocol__PrpRlcPduTb)); + rlc_pdus[1]->rlc_pdu_tb[1]->has_logical_channel_id = 1; + rlc_pdus[1]->rlc_pdu_tb[1]->logical_channel_id = DCCH+1; + rlc_pdus[1]->rlc_pdu_tb[1]->has_size = 1; + rlc_pdus[1]->rlc_pdu_tb[1]->size = data_to_request; + dl_data[num_ues_added]->n_rlc_pdu++; + + sdu_length_total += data_to_request; } } - // Add the control element flags to the progran message - dl_data[num_ues_added]->ce_bitmap = ce_flags; - // check for DTCH and update header information // here we should loop over all possible DTCH @@ -529,6 +615,8 @@ schedule_ue_spec_default( TBS-ta_len-header_len_dcch-sdu_length_total-header_len_dtch); if (TBS-ta_len-header_len_dcch-sdu_length_total-header_len_dtch > 0 ) { + + //If we have space, we need to see how much data we can request at most (if any are available) rlc_status = mac_rlc_status_ind( mod_id, rnti, @@ -539,36 +627,31 @@ schedule_ue_spec_default( DTCH, TBS-ta_len-header_len_dcch-sdu_length_total-header_len_dtch); + // If data are available in DTCH if (rlc_status.bytes_in_buffer > 0) { - //TODO: Set rlc pdu info. Hardcoded for the moment + //Fill what remains in the TB + data_to_request = 3;//cmin(3, rlc_status.bytes_in_buffer); + rlc_pdus[2] = (Protocol__PrpRlcPdu *) malloc(sizeof(Protocol__PrpRlcPdu)); + protocol__prp_rlc_pdu__init(rlc_pdus[2]); + rlc_pdus[2]->n_rlc_pdu_tb = 2; + rlc_pdus[2]->rlc_pdu_tb = (Protocol__PrpRlcPduTb **) malloc(sizeof(Protocol__PrpRlcPduTb *) * 2); + rlc_pdus[2]->rlc_pdu_tb[0] = (Protocol__PrpRlcPduTb *) malloc(sizeof(Protocol__PrpRlcPduTb)); + rlc_pdus[2]->rlc_pdu_tb[0]->has_logical_channel_id = 1; + rlc_pdus[2]->rlc_pdu_tb[0]->logical_channel_id = DTCH; + rlc_pdus[2]->rlc_pdu_tb[0]->has_size = 1; + rlc_pdus[2]->rlc_pdu_tb[0]->size = data_to_request; + rlc_pdus[2]->rlc_pdu_tb[1] = (Protocol__PrpRlcPduTb *) malloc(sizeof(Protocol__PrpRlcPduTb)); + rlc_pdus[2]->rlc_pdu_tb[1]->has_logical_channel_id = 1; + rlc_pdus[2]->rlc_pdu_tb[1]->logical_channel_id = DTCH; + rlc_pdus[2]->rlc_pdu_tb[1]->has_size = 1; + rlc_pdus[2]->rlc_pdu_tb[1]->size = data_to_request; dl_data[num_ues_added]->n_rlc_pdu++; - rlc_pdus[0] = (Protocol__PrpRlcPdu *) malloc(sizeof(Protocol__PrpRlcPdu)); - protocol__prp_rlc_pdu__init(rlc_pdus[0]); - rlc_pdus[0]->n_rlc_pdu_tb = 2; - rlc_pdus[0]->rlc_pdu_tb = (Protocol__PrpRlcPduTb **) malloc(sizeof(Protocol__PrpRlcPduTb *) * 2); - rlc_pdus[0]->rlc_pdu_tb[0] = (Protocol__PrpRlcPduTb *) malloc(sizeof(Protocol__PrpRlcPduTb)); - rlc_pdus[0]->rlc_pdu_tb[0]->has_logical_channel_id = 1; - rlc_pdus[0]->rlc_pdu_tb[0]->logical_channel_id = DTCH; - rlc_pdus[0]->rlc_pdu_tb[0]->has_size = 1; - rlc_pdus[0]->rlc_pdu_tb[0]->size = TBS-ta_len-header_len_dcch-sdu_length_total-header_len_dtch; - rlc_pdus[0]->rlc_pdu_tb[1] = (Protocol__PrpRlcPduTb *) malloc(sizeof(Protocol__PrpRlcPduTb)); - rlc_pdus[0]->rlc_pdu_tb[1]->has_logical_channel_id = 1; - rlc_pdus[0]->rlc_pdu_tb[1]->logical_channel_id = DTCH; - rlc_pdus[0]->rlc_pdu_tb[1]->has_size = 1; - rlc_pdus[0]->rlc_pdu_tb[1]->size = TBS-ta_len-header_len_dcch-sdu_length_total-header_len_dtch; - // Add rlc_pdus to the dl_data message - dl_data[num_ues_added]->rlc_pdu = (Protocol__PrpRlcPdu **) malloc(sizeof(Protocol__PrpRlcPdu *) * - dl_data[num_ues_added]->n_rlc_pdu); - for (i = 0; i< dl_data[num_ues_added]->n_rlc_pdu; i++) { - dl_data[num_ues_added]->rlc_pdu[i] = rlc_pdus[i]; - } + sdu_length_total += data_to_request; - sdu_length_total += cmin(rlc_status.bytes_in_buffer, TBS-ta_len-header_len_dcch-sdu_length_total-header_len_dtch); - - if(cmin(rlc_status.bytes_in_buffer, TBS-ta_len-header_len_dcch-sdu_length_total-header_len_dtch) < 128) { + if(data_to_request < 128) { header_len_dtch = 2; } @@ -577,41 +660,53 @@ schedule_ue_spec_default( } } + // Add rlc_pdus to the dl_data message + dl_data[num_ues_added]->rlc_pdu = (Protocol__PrpRlcPdu **) malloc(sizeof(Protocol__PrpRlcPdu *) * + dl_data[num_ues_added]->n_rlc_pdu); + for (i = 0; i< dl_data[num_ues_added]->n_rlc_pdu; i++) { + dl_data[num_ues_added]->rlc_pdu[i] = rlc_pdus[i]; + } + // there is a payload - if (((sdu_length_total + header_len_dcch + header_len_dtch )> 0)) { + if (((sdu_length_total + header_len_dcch + header_len_dtch) > 0)) { // Now compute number of required RBs for total sdu length // Assume RAH format 2 // adjust header lengths header_len_dcch_tmp = header_len_dcch; header_len_dtch_tmp = header_len_dtch; - if (header_len_dtch==0) { + if (header_len_dtch == 0) { header_len_dcch = (header_len_dcch >0) ? 1 : header_len_dcch; // remove length field } else { header_len_dtch = (header_len_dtch > 0) ? 1 :header_len_dtch; // remove length field for the last SDU } - mcs = eNB_UE_stats->dlsch_mcs1; + int mcs2; - if (mcs==0) { + mcs2 = mcs; + + // TODO: Need to compute this and not take it from the stats + // mcs = eNB_UE_stats->dlsch_mcs1; + + if (mcs2==0) { nb_rb = 4; // don't let the TBS get too small } else { nb_rb=min_rb_unit[CC_id]; } - TBS = mac_xface->get_TBS_DL(mcs,nb_rb); + TBS = mac_xface->get_TBS_DL(mcs2,nb_rb); while (TBS < (sdu_length_total + header_len_dcch + header_len_dtch + ta_len)) { nb_rb += min_rb_unit[CC_id]; // if (nb_rb>nb_available_rb) { // if we've gone beyond the maximum number of RBs // (can happen if N_RB_DL is odd) - TBS = mac_xface->get_TBS_DL(eNB_UE_stats->dlsch_mcs1,nb_available_rb); + TBS = mac_xface->get_TBS_DL(mcs2, nb_available_rb); nb_rb = nb_available_rb; break; } - TBS = mac_xface->get_TBS_DL(eNB_UE_stats->dlsch_mcs1,nb_rb); + TBS = mac_xface->get_TBS_DL(mcs, nb_rb); } if(nb_rb == ue_sched_ctl->pre_nb_available_rbs[CC_id]) { @@ -647,16 +742,16 @@ schedule_ue_spec_default( } // decrease mcs until TBS falls below required length - while ((TBS > (sdu_length_total + header_len_dcch + header_len_dtch + ta_len)) && (mcs>0)) { - mcs--; - TBS = mac_xface->get_TBS_DL(mcs,nb_rb); + while ((TBS > (sdu_length_total + header_len_dcch + header_len_dtch + ta_len)) && (mcs2>0)) { + mcs2--; + TBS = mac_xface->get_TBS_DL(mcs2,nb_rb); } // if we have decreased too much or we don't have enough RBs, increase MCS - while ((TBS < (sdu_length_total + header_len_dcch + header_len_dtch + ta_len)) && ((( ue_sched_ctl->dl_pow_off[CC_id]>0) && (mcs<28)) - || ( (ue_sched_ctl->dl_pow_off[CC_id]==0) && (mcs<=15)))) { - mcs++; - TBS = mac_xface->get_TBS_DL(mcs,nb_rb); + while ((TBS < (sdu_length_total + header_len_dcch + header_len_dtch + ta_len)) && ((( ue_sched_ctl->dl_pow_off[CC_id]>0) && (mcs2<28)) + || ( (ue_sched_ctl->dl_pow_off[CC_id]==0) && (mcs2<=15)))) { + mcs2++; + TBS = mac_xface->get_TBS_DL(mcs2,nb_rb); } dl_dci->n_tbs_size = 2; @@ -664,7 +759,7 @@ schedule_ue_spec_default( dl_dci->tbs_size[0] = TBS; dl_dci->tbs_size[1] = TBS; - LOG_D(MAC,"dlsch_mcs before and after the rate matching = (%d, %d)\n",eNB_UE_stats->dlsch_mcs1, mcs); + LOG_D(MAC,"dlsch_mcs before and after the rate matching = (%d, %d)\n", mcs, mcs2); aggregation = process_ue_cqi(mod_id,UE_id); dl_dci->has_aggr_level = 1; @@ -745,7 +840,7 @@ schedule_ue_spec_default( dl_dci->rb_shift = 0; dl_dci->n_ndi = 1; dl_dci->ndi = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_ndi); - dl_dci->ndi[0] = 1-UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]; + dl_dci->ndi[0] = 1; //1-UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]; dl_dci->n_rv = 1; dl_dci->rv = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_rv); dl_dci->rv[0] = 0; @@ -754,6 +849,9 @@ schedule_ue_spec_default( dl_dci->n_mcs = 1; dl_dci->mcs = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_mcs); dl_dci->mcs[0] = mcs; + dl_dci->n_tbs_size = 1; + dl_dci->tbs_size = (uint32_t *) malloc(sizeof(uint32_t)); + dl_dci->tbs_size[0] = dci_tbs; if (frame_parms[CC_id]->frame_type == TDD) { dl_dci->has_dai = 1; dl_dci->dai = (UE_list->UE_template[CC_id][UE_id].DAI-1)&3; @@ -777,7 +875,7 @@ schedule_ue_spec_default( dl_dci->rb_shift = 0; dl_dci->n_ndi = 2; dl_dci->ndi = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_ndi); - dl_dci->ndi[0] = 1-UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]; + dl_dci->ndi[0] = 1; //1-UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]; dl_dci->ndi[1] = 0; dl_dci->n_rv = 2; dl_dci->rv = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_rv); @@ -812,7 +910,7 @@ schedule_ue_spec_default( dl_dci->rb_shift = 0; dl_dci->n_ndi = 2; dl_dci->ndi = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_ndi); - dl_dci->ndi[0] = 1-UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]; + dl_dci->ndi[0] = 1; // 1-UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]; dl_dci->ndi[1] = 0; dl_dci->n_rv = 2; dl_dci->rv = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_rv); @@ -846,7 +944,7 @@ schedule_ue_spec_default( dl_dci->has_rb_shift = 1; dl_dci->rb_shift = 0; dl_dci->n_ndi = 1; - dl_dci->ndi = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_ndi); + dl_dci->ndi = 1;//(uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_ndi); dl_dci->ndi[0] = 1; dl_dci->n_rv = 1; dl_dci->rv = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_rv); @@ -915,10 +1013,10 @@ schedule_ue_spec_default( break; } // Toggle NDI for next time - LOG_D(MAC,"CC_id %d Frame %d, subframeP %d: Toggling Format1 NDI for UE %d (rnti %x/%d) oldNDI %d\n", - CC_id, frame, subframe, UE_id, - UE_list->UE_template[CC_id][UE_id].rnti,harq_pid, UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]); - UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]=1-UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]; + //LOG_D(MAC,"CC_id %d Frame %d, subframeP %d: Toggling Format1 NDI for UE %d (rnti %x/%d) oldNDI %d\n", + // CC_id, frame, subframe, UE_id, + // UE_list->UE_template[CC_id][UE_id].rnti,harq_pid, UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]); + //UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]=1-UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]; // Increase the pointer for the number of scheduled UEs num_ues_added++; @@ -942,3 +1040,436 @@ schedule_ue_spec_default( stop_meas(&eNB->schedule_dlsch); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_SCHEDULE_DLSCH,VCD_FUNCTION_OUT); } + +void apply_scheduling_decisions(mid_t mod_id, + uint32_t frame, + uint32_t subframe, + uint32_t *rballoc, + int *mbsfn_flag, + Protocol__ProgranMessage *dl_scheduling_info) { + + uint8_t CC_id; + int UE_id; + uint16_t nCCE[MAX_NUM_CCs]; + int N_RBG[MAX_NUM_CCs]; + unsigned char aggregation; + mac_rlc_status_resp_t rlc_status; + unsigned char header_len_dcch=0, header_len_dcch_tmp=0,header_len_dtch=0,header_len_dtch_tmp=0, ta_len=0; + unsigned char sdu_lcids[11],offset,num_sdus=0; + uint16_t nb_rb,nb_rb_temp,total_nb_available_rb[MAX_NUM_CCs],nb_available_rb; + uint16_t TBS,j,sdu_lengths[11],rnti,padding=0,post_padding=0; + unsigned char dlsch_buffer[MAX_DLSCH_PAYLOAD_BYTES]; + unsigned char round = 0; + unsigned char harq_pid = 0; + void *DLSCH_dci = NULL; + DCI_PDU *DCI_pdu; + + LTE_eNB_UE_stats *eNB_UE_stats = NULL; + uint16_t sdu_length_total = 0; + int mcs; + uint16_t min_rb_unit[MAX_NUM_CCs]; + short ta_update = 0; + eNB_MAC_INST *eNB = &eNB_mac_inst[mod_id]; + UE_list_t *UE_list = &eNB->UE_list; + LTE_DL_FRAME_PARMS *frame_parms[MAX_NUM_CCs]; + int32_t normalized_rx_power, target_rx_power; + int32_t tpc=1; + static int32_t tpc_accumulated=0; + UE_sched_ctrl *ue_sched_ctl; + + int i; + int size_bits,size_bytes; + + Protocol__PrpDlMacConfig *mac_config = dl_scheduling_info->dl_mac_config_msg; + Protocol__PrpDlData *dl_data; + Protocol__PrpDlDci *dl_dci; + + uint32_t rlc_size, n_lc, lcid; + + // Check if there is any scheduling command for UE data + if (mac_config->n_dl_ue_data > 0) { + + // For each UE-related command + for (i = 0; i < mac_config->n_dl_ue_data; i++) { + + dl_data = mac_config->dl_ue_data[i]; + dl_dci = dl_data->dl_dci; + + CC_id = dl_data->serv_cell_index; + rnti = dl_data->rnti; + UE_id = find_ue(rnti, PHY_vars_eNB_g[mod_id][CC_id]); + + //NOTICE: Maybe later will not be required, once scheduler fully restructured + eNB_dlsch_info[mod_id][CC_id][UE_id].status = S_DL_WAITING; + + ue_sched_ctl = &UE_list->UE_sched_ctrl[UE_id]; + eNB_UE_stats = mac_xface->get_eNB_UE_stats(mod_id,CC_id,rnti); + + round = dl_dci->rv[0]; + harq_pid = dl_dci->harq_process; + + // Note this code is for a specific DCI format + DLSCH_dci = (void *)UE_list->UE_template[CC_id][UE_id].DLSCH_DCI[harq_pid]; + DCI_pdu = &eNB->common_channels[CC_id].DCI_pdu; + + frame_parms[CC_id] = mac_xface->get_lte_frame_parms(mod_id, CC_id); + + switch (frame_parms[CC_id]->N_RB_DL) { + case 6: + if (frame_parms[CC_id]->frame_type == TDD) { + if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1) { + ((DCI1_1_5MHz_TDD_t*)DLSCH_dci)->harq_pid = harq_pid; + ((DCI1_1_5MHz_TDD_t*)DLSCH_dci)->rv = round; + ((DCI1_1_5MHz_TDD_t*)DLSCH_dci)->dai = dl_dci->dai; + ((DCI1_1_5MHz_TDD_t*)DLSCH_dci)->rballoc = dl_dci->rb_bitmap; + ((DCI1_1_5MHz_TDD_t*)DLSCH_dci)->rah = dl_dci->rb_shift; + ((DCI1_1_5MHz_TDD_t*)DLSCH_dci)->mcs = dl_dci->mcs[0]; + ((DCI1_1_5MHz_TDD_t*)DLSCH_dci)->TPC = dl_dci->tpc; + ((DCI1_1_5MHz_TDD_t*)DLSCH_dci)->ndi = dl_dci->ndi[0]; + size_bytes = sizeof(DCI1_1_5MHz_TDD_t); + size_bits = sizeof_DCI1_1_5MHz_TDD_t; + } else if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_2A) { + //TODO + } else if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1D) { + //TODO + } + } else { + if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1) { + ((DCI1_1_5MHz_FDD_t*)DLSCH_dci)->harq_pid = harq_pid; + ((DCI1_1_5MHz_FDD_t*)DLSCH_dci)->rv = round; + ((DCI1_1_5MHz_FDD_t*)DLSCH_dci)->rballoc = dl_dci->rb_bitmap; + ((DCI1_1_5MHz_FDD_t*)DLSCH_dci)->rah = dl_dci->rb_shift; + ((DCI1_1_5MHz_FDD_t*)DLSCH_dci)->mcs = dl_dci->mcs[0]; + ((DCI1_1_5MHz_FDD_t*)DLSCH_dci)->TPC = dl_dci->tpc; + ((DCI1_1_5MHz_FDD_t*)DLSCH_dci)->ndi = dl_dci->ndi[0]; + size_bytes = sizeof(DCI1_1_5MHz_FDD_t); + size_bits = sizeof_DCI1_1_5MHz_FDD_t; + } else if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_2A) { + //TODO + } else if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1D) { + //TODO + } + } + break; + case 25: + if (frame_parms[CC_id]->frame_type == TDD) { + if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1) { + ((DCI1_5MHz_TDD_t*)DLSCH_dci)->harq_pid = harq_pid; + ((DCI1_5MHz_TDD_t*)DLSCH_dci)->rv = round; + ((DCI1_5MHz_TDD_t*)DLSCH_dci)->dai = dl_dci->dai; + ((DCI1_5MHz_TDD_t*)DLSCH_dci)->rballoc = dl_dci->rb_bitmap; + ((DCI1_5MHz_TDD_t*)DLSCH_dci)->rah = dl_dci->rb_shift; + ((DCI1_5MHz_TDD_t*)DLSCH_dci)->mcs = dl_dci->mcs[0]; + ((DCI1_5MHz_TDD_t*)DLSCH_dci)->TPC = dl_dci->tpc; + ((DCI1_5MHz_TDD_t*)DLSCH_dci)->ndi = dl_dci->ndi[0]; + size_bytes = sizeof(DCI1_5MHz_TDD_t); + size_bits = sizeof_DCI1_5MHz_TDD_t; + } else if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_2A) { + //TODO + } else if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1D) { + //TODO + } + } else { + if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1) { + ((DCI1_5MHz_FDD_t*)DLSCH_dci)->harq_pid = harq_pid; + ((DCI1_5MHz_FDD_t*)DLSCH_dci)->rv = round; + if (dl_dci->has_rb_bitmap) { + ((DCI1_5MHz_FDD_t*)DLSCH_dci)->rballoc = dl_dci->rb_bitmap; + } + ((DCI1_5MHz_FDD_t*)DLSCH_dci)->rah = dl_dci->rb_shift; + ((DCI1_5MHz_FDD_t*)DLSCH_dci)->mcs = dl_dci->mcs[0]; + ((DCI1_5MHz_FDD_t*)DLSCH_dci)->TPC = dl_dci->tpc; + ((DCI1_5MHz_FDD_t*)DLSCH_dci)->ndi = dl_dci->ndi[0]; + size_bytes = sizeof(DCI1_5MHz_FDD_t); + size_bits = sizeof_DCI1_5MHz_FDD_t; + } else if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_2A) { + //TODO + } else if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1D) { + //TODO + } + } + break; + case 50: + if (frame_parms[CC_id]->frame_type == TDD) { + if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1) { + ((DCI1_10MHz_TDD_t*)DLSCH_dci)->harq_pid = harq_pid; + ((DCI1_10MHz_TDD_t*)DLSCH_dci)->rv = round; + ((DCI1_10MHz_TDD_t*)DLSCH_dci)->dai = dl_dci->dai; + ((DCI1_10MHz_TDD_t*)DLSCH_dci)->rballoc = dl_dci->rb_bitmap; + ((DCI1_10MHz_TDD_t*)DLSCH_dci)->rah = dl_dci->rb_shift; + ((DCI1_10MHz_TDD_t*)DLSCH_dci)->mcs = dl_dci->mcs[0]; + ((DCI1_10MHz_TDD_t*)DLSCH_dci)->TPC = dl_dci->tpc; + ((DCI1_10MHz_TDD_t*)DLSCH_dci)->ndi = dl_dci->ndi[0]; + size_bytes = sizeof(DCI1_10MHz_TDD_t); + size_bits = sizeof_DCI1_10MHz_TDD_t; + } else if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_2A) { + //TODO + } else if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1D) { + //TODO + } + } else { + if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1) { + ((DCI1_10MHz_FDD_t*)DLSCH_dci)->harq_pid = harq_pid; + ((DCI1_10MHz_FDD_t*)DLSCH_dci)->rv = round; + ((DCI1_10MHz_FDD_t*)DLSCH_dci)->rballoc = dl_dci->rb_bitmap; + ((DCI1_10MHz_FDD_t*)DLSCH_dci)->rah = dl_dci->rb_shift; + ((DCI1_10MHz_FDD_t*)DLSCH_dci)->mcs = dl_dci->mcs[0]; + ((DCI1_10MHz_FDD_t*)DLSCH_dci)->TPC = dl_dci->tpc; + ((DCI1_10MHz_TDD_t*)DLSCH_dci)->ndi = dl_dci->ndi[0]; + size_bytes = sizeof(DCI1_10MHz_FDD_t); + size_bits = sizeof_DCI1_10MHz_FDD_t; + } else if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_2A) { + //TODO + } else if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1D) { + //TODO + } + } + break; + case 100: + if (frame_parms[CC_id]->frame_type == TDD) { + if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1) { + ((DCI1_20MHz_TDD_t*)DLSCH_dci)->harq_pid = harq_pid; + ((DCI1_20MHz_TDD_t*)DLSCH_dci)->rv = round; + ((DCI1_20MHz_TDD_t*)DLSCH_dci)->dai = dl_dci->dai; + ((DCI1_20MHz_TDD_t*)DLSCH_dci)->rballoc = dl_dci->rb_bitmap; + ((DCI1_20MHz_TDD_t*)DLSCH_dci)->rah = dl_dci->rb_shift; + ((DCI1_20MHz_TDD_t*)DLSCH_dci)->mcs = dl_dci->mcs[0]; + ((DCI1_20MHz_TDD_t*)DLSCH_dci)->TPC = dl_dci->tpc; + ((DCI1_20MHz_TDD_t*)DLSCH_dci)->ndi = dl_dci->ndi[0]; + size_bytes = sizeof(DCI1_20MHz_TDD_t); + size_bits = sizeof_DCI1_20MHz_TDD_t; + } else if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_2A) { + //TODO + } else if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1D) { + //TODO + } + } else { + if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1) { + ((DCI1_20MHz_FDD_t*)DLSCH_dci)->harq_pid = harq_pid; + ((DCI1_20MHz_FDD_t*)DLSCH_dci)->rv = round; + ((DCI1_20MHz_FDD_t*)DLSCH_dci)->rballoc = dl_dci->rb_bitmap; + ((DCI1_20MHz_FDD_t*)DLSCH_dci)->rah = dl_dci->rb_shift; + ((DCI1_20MHz_FDD_t*)DLSCH_dci)->mcs = dl_dci->mcs[0]; + ((DCI1_20MHz_FDD_t*)DLSCH_dci)->TPC = dl_dci->tpc; + ((DCI1_20MHz_FDD_t*)DLSCH_dci)->ndi = dl_dci->ndi[0]; + size_bytes = sizeof(DCI1_20MHz_FDD_t); + size_bits = sizeof_DCI1_20MHz_FDD_t; + } else if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_2A) { + //TODO + } else if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1D) { + //TODO + } + } + break; + } + + // If this is a new transmission + if (round == 0) { + // First we have to deal with the creation of the PDU based on the message instructions + rlc_status.bytes_in_buffer = 0; + + TBS = dl_dci->tbs_size[0]; + + if (dl_data->n_ce_bitmap > 0) { + //Check if there is TA command + if (dl_data->ce_bitmap[0] & PROTOCOL__PRP_CE_TYPE__PRPCET_TA) { + ta_len = 2; + } else { + ta_len = 0; + } + } + + n_lc = dl_data->n_rlc_pdu; + num_sdus = 0; + // Go through each one of the channel commands and create SDUs + for (i = 0; i < n_lc; i++) { + lcid = dl_data->rlc_pdu[i]->rlc_pdu_tb[0]->logical_channel_id; + rlc_size = dl_data->rlc_pdu[i]->rlc_pdu_tb[0]->size; + + if (rlc_size > 0) { + rlc_status = mac_rlc_status_ind( + mod_id, + rnti, + mod_id, + frame, + ENB_FLAG_YES, + MBMS_FLAG_NO, + lcid, + rlc_size); // transport block set size + + sdu_lengths[i]=0; + + LOG_D(MAC,"[eNB %d] Frame %d, LCID %d, CC_id %d, Requesting %d bytes from RLC (RRC message)\n", + mod_id, frame, lcid, CC_id, rlc_size); + + sdu_lengths[i] += mac_rlc_data_req( + mod_id, + rnti, + mod_id, + frame, + ENB_FLAG_YES, + MBMS_FLAG_NO, + lcid, + (char *)&dlsch_buffer[sdu_lengths[i]]); + + LOG_D(MAC,"[eNB %d][DCCH] CC_id %d Got %d bytes from RLC\n",mod_id, CC_id, sdu_lengths[i]); + sdu_length_total += sdu_lengths[i]; + sdu_lcids[i] = lcid; + + if (lcid == DCCH || lcid == DCCH+1) { + header_len_dcch += 2; + } else if (lcid == DTCH) { + if (sdu_lengths[i] < 128) { + header_len_dtch = 2; + } else { + header_len_dtch = 3; + } + } + + UE_list->eNB_UE_stats[CC_id][UE_id].num_pdu_tx[DCCH] += 1; + UE_list->eNB_UE_stats[CC_id][UE_id].num_bytes_tx[DCCH] += sdu_lengths[i]; + num_sdus++; + + } + } // SDU creation end + + + if (header_len_dtch==0) { + header_len_dcch = (header_len_dcch >0) ? 1 : header_len_dcch; // remove length field + } else { + header_len_dtch = (header_len_dtch > 0) ? 1 :header_len_dtch; // remove length field for the last SDU + } + + // there is a payload + if (((sdu_length_total + header_len_dcch + header_len_dtch ) > 0)) { + if ((TBS - header_len_dcch - header_len_dtch - sdu_length_total - ta_len) <= 2) { + padding = (TBS - header_len_dcch - header_len_dtch - sdu_length_total - ta_len); + post_padding = 0; + } else { + padding = 0; + + // adjust the header len + if (header_len_dtch==0) { + header_len_dcch = header_len_dcch_tmp; + } else { //if (( header_len_dcch==0)&&((header_len_dtch==1)||(header_len_dtch==2))) + header_len_dtch = header_len_dtch_tmp; + } + + post_padding = TBS - sdu_length_total - header_len_dcch - header_len_dtch - ta_len ; // 1 is for the postpadding header + } + } + + uint8_t update_TA=4; + + switch (frame_parms[CC_id]->N_RB_DL) { + case 6: + update_TA = 1; + break; + + case 25: + update_TA = 4; + break; + + case 50: + update_TA = 8; + break; + + case 100: + update_TA = 16; + break; + } + + if (ta_len > 0) { + ta_update = eNB_UE_stats->timing_advance_update/update_TA; + } else { + ta_update = 0; + } + /*#else + ta_update = 0; + #endif*/ + + offset = generate_dlsch_header((unsigned char*)UE_list->DLSCH_pdu[CC_id][0][UE_id].payload[0], + // offset = generate_dlsch_header((unsigned char*)eNB_mac_inst[0].DLSCH_pdu[0][0].payload[0], + num_sdus, //num_sdus + sdu_lengths, // + sdu_lcids, + 255, // no drx + ta_update, // timing advance + NULL, // contention res id + padding, + post_padding); + + +#ifdef DEBUG_eNB_SCHEDULER + LOG_T(MAC,"[eNB %d] First 16 bytes of DLSCH : \n"); + + for (i=0; i<16; i++) { + LOG_T(MAC,"%x.",dlsch_buffer[i]); + } + + LOG_T(MAC,"\n"); +#endif + // cycle through SDUs and place in dlsch_buffer + memcpy(&UE_list->DLSCH_pdu[CC_id][0][UE_id].payload[0][offset],dlsch_buffer,sdu_length_total); + // memcpy(&eNB_mac_inst[0].DLSCH_pdu[0][0].payload[0][offset],dcch_buffer,sdu_lengths[0]); + + // fill remainder of DLSCH with random data + for (j=0; j<(TBS-sdu_length_total-offset); j++) { + UE_list->DLSCH_pdu[CC_id][0][UE_id].payload[0][offset+sdu_length_total+j] = (char)(taus()&0xff); + } + + //eNB_mac_inst[0].DLSCH_pdu[0][0].payload[0][offset+sdu_lengths[0]+j] = (char)(taus()&0xff); + if (opt_enabled == 1) { + trace_pdu(1, (uint8_t *)UE_list->DLSCH_pdu[CC_id][0][UE_id].payload[0], + TBS, mod_id, 3, UE_RNTI(mod_id, UE_id), + eNB->subframe,0,0); + LOG_D(OPT,"[eNB %d][DLSCH] CC_id %d Frame %d rnti %x with size %d\n", + mod_id, CC_id, frame, UE_RNTI(mod_id,UE_id), TBS); + } + + // store stats + eNB->eNB_stats[CC_id].dlsch_bytes_tx+=sdu_length_total; + eNB->eNB_stats[CC_id].dlsch_pdus_tx+=1; + + UE_list->eNB_UE_stats[CC_id][UE_id].rbs_used = nb_rb; + UE_list->eNB_UE_stats[CC_id][UE_id].total_rbs_used += nb_rb; + UE_list->eNB_UE_stats[CC_id][UE_id].ncce_used = nCCE[CC_id]; + UE_list->eNB_UE_stats[CC_id][UE_id].dlsch_mcs1=dl_dci->mcs[0]; + UE_list->eNB_UE_stats[CC_id][UE_id].dlsch_mcs2=dl_dci->mcs[0]; + UE_list->eNB_UE_stats[CC_id][UE_id].TBS = TBS; + + UE_list->eNB_UE_stats[CC_id][UE_id].overhead_bytes= TBS- sdu_length_total; + UE_list->eNB_UE_stats[CC_id][UE_id].total_sdu_bytes+= sdu_length_total; + UE_list->eNB_UE_stats[CC_id][UE_id].total_pdu_bytes+= TBS; + UE_list->eNB_UE_stats[CC_id][UE_id].total_num_pdus+=1; + // TODO + + + } else { + // No need to create anything apart of DCI in case of retransmission + } + + //Add DCI based on format + if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1) { + add_ue_spec_dci(DCI_pdu, + DLSCH_dci, + rnti, + size_bytes, + process_ue_cqi (mod_id, UE_id),//aggregation + size_bits, + format1, + 0); + } else if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_2A) { + add_ue_spec_dci(DCI_pdu, + DLSCH_dci, + rnti, + size_bytes, + process_ue_cqi (mod_id, UE_id),//aggregation + size_bits, + format2A, + 0); + } + } + } +} + diff --git a/openair2/LAYER2/MAC/eNB_scheduler.c b/openair2/LAYER2/MAC/eNB_scheduler.c index 0de9253fef..329c40be05 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler.c +++ b/openair2/LAYER2/MAC/eNB_scheduler.c @@ -59,10 +59,6 @@ //#include "LAYER2/MAC/pre_processor.c" #include "pdcp.h" -//Agent-related headers -#include "ENB_APP/enb_agent_extern.h" -#include "ENB_APP/enb_agent_mac.h" - #if defined(ENABLE_ITTI) # include "intertask_interface.h" #endif @@ -89,9 +85,6 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, int mbsfn_status[MAX_NUM_CCs]; uint32_t RBalloc[MAX_NUM_CCs]; protocol_ctxt_t ctxt; - - Protocol__ProgranMessage *msg; - #ifdef EXMIMO int ret; #endif @@ -282,19 +275,7 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, break; } } else { //FDD - if (mac_agent_registered[module_idP]) { - enb_agent_mac_create_empty_dl_config(module_idP, &msg); - agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( - module_idP, - frameP, - subframeP, - nprb, - nCCE, - mbsfn_status, - msg); - enb_agent_mac_destroy_dl_config(msg); - } - //schedule_ue_spec(module_idP,frameP,subframeP,nprb,nCCE,mbsfn_status); + schedule_ue_spec(module_idP,frameP,subframeP,nprb,nCCE,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,RBalloc,0,mbsfn_status); schedule_ulsch(module_idP,frameP,cooperation_flag,1,5,nCCE); } @@ -306,19 +287,7 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, // TDD, nothing // FDD, normal UL/DLSCH if (mac_xface->lte_frame_parms->frame_type == FDD) { //FDD - if (mac_agent_registered[module_idP]) { - enb_agent_mac_create_empty_dl_config(module_idP, &msg); - agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( - module_idP, - frameP, - subframeP, - nprb, - nCCE, - mbsfn_status, - msg); - enb_agent_mac_destroy_dl_config(msg); - } - //schedule_ue_spec(module_idP,frameP,subframeP,nprb,nCCE,mbsfn_status); + schedule_ue_spec(module_idP,frameP,subframeP,nprb,nCCE,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,RBalloc,0,mbsfn_status); schedule_ulsch(module_idP,frameP,cooperation_flag,2,6,nCCE); } @@ -337,19 +306,7 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, // no break here! case 5: - if (mac_agent_registered[module_idP]) { - enb_agent_mac_create_empty_dl_config(module_idP, &msg); - agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( - module_idP, - frameP, - subframeP, - nprb, - nCCE, - mbsfn_status, - msg); - enb_agent_mac_destroy_dl_config(msg); - } - //schedule_ue_spec(module_idP,frameP,subframeP,nprb,nCCE,mbsfn_status); + schedule_ue_spec(module_idP,frameP,subframeP,nprb,nCCE,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,RBalloc,0,mbsfn_status); break; @@ -357,19 +314,7 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, break; } } else { //FDD - if (mac_agent_registered[module_idP]) { - enb_agent_mac_create_empty_dl_config(module_idP, &msg); - agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( - module_idP, - frameP, - subframeP, - nprb, - nCCE, - mbsfn_status, - msg); - enb_agent_mac_destroy_dl_config(msg); - } - //schedule_ue_spec(module_idP,frameP,subframeP,nprb,nCCE,mbsfn_status); + schedule_ue_spec(module_idP,frameP,subframeP,nprb,nCCE,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,RBalloc,0,mbsfn_status); schedule_ulsch(module_idP,frameP,cooperation_flag,3,7,nCCE); @@ -396,19 +341,7 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, // no break here! case 5: - if (mac_agent_registered[module_idP]) { - enb_agent_mac_create_empty_dl_config(module_idP, &msg); - agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( - module_idP, - frameP, - subframeP, - nprb, - nCCE, - mbsfn_status, - msg); - enb_agent_mac_destroy_dl_config(msg); - } - //schedule_ue_spec(module_idP,frameP,subframeP,nprb,nCCE,mbsfn_status); + schedule_ue_spec(module_idP,frameP,subframeP,nprb,nCCE,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,RBalloc,1,mbsfn_status); break; @@ -419,19 +352,7 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, if (mac_xface->lte_frame_parms->frame_type == FDD) { //FDD // schedule_RA(module_idP,frameP, subframeP, 0, nprb, nCCE); // schedule_ulsch(module_idP, frameP, cooperation_flag, 4, 8, nCCE); - if (mac_agent_registered[module_idP]) { - enb_agent_mac_create_empty_dl_config(module_idP, &msg); - agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( - module_idP, - frameP, - subframeP, - nprb, - nCCE, - mbsfn_status, - msg); - enb_agent_mac_destroy_dl_config(msg); - } - //schedule_ue_spec(module_idP, frameP, subframeP, nprb, nCCE, mbsfn_status); + schedule_ue_spec(module_idP, frameP, subframeP, nprb, nCCE, mbsfn_status); fill_DLSCH_dci(module_idP, frameP, subframeP, RBalloc, 1, mbsfn_status); } @@ -487,37 +408,13 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, case 5: schedule_RA(module_idP,frameP,subframeP,2,nprb,nCCE); - if (mac_agent_registered[module_idP]) { - enb_agent_mac_create_empty_dl_config(module_idP, &msg); - agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( - module_idP, - frameP, - subframeP, - nprb, - nCCE, - mbsfn_status, - msg); - enb_agent_mac_destroy_dl_config(msg); - } - //schedule_ue_spec(module_idP,frameP,subframeP,nprb,nCCE,mbsfn_status); + schedule_ue_spec(module_idP,frameP,subframeP,nprb,nCCE,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,RBalloc,1,mbsfn_status); break; case 3: case 4: - if (mac_agent_registered[module_idP]) { - enb_agent_mac_create_empty_dl_config(module_idP, &msg); - agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( - module_idP, - frameP, - subframeP, - nprb, - nCCE, - mbsfn_status, - msg); - enb_agent_mac_destroy_dl_config(msg); - } - //schedule_ue_spec(module_idP,frameP,subframeP,nprb,nCCE,mbsfn_status); + schedule_ue_spec(module_idP,frameP,subframeP,nprb,nCCE,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,RBalloc,0,mbsfn_status); break; @@ -526,19 +423,7 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, } } else { //FDD // schedule_ulsch(module_idP,frameP,cooperation_flag,6,0,nCCE); - if (mac_agent_registered[module_idP]) { - enb_agent_mac_create_empty_dl_config(module_idP, &msg); - agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( - module_idP, - frameP, - subframeP, - nprb, - nCCE, - mbsfn_status, - msg); - enb_agent_mac_destroy_dl_config(msg); - } - //schedule_ue_spec(module_idP,frameP,subframeP,nprb,nCCE,mbsfn_status); + schedule_ue_spec(module_idP,frameP,subframeP,nprb,nCCE,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,RBalloc,0,mbsfn_status); } @@ -553,36 +438,12 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, case 3: case 4: schedule_RA(module_idP,frameP,subframeP,3,nprb,nCCE); // 3 = Msg3 subframeP, not - if (mac_agent_registered[module_idP]) { - enb_agent_mac_create_empty_dl_config(module_idP, &msg); - agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( - module_idP, - frameP, - subframeP, - nprb, - nCCE, - mbsfn_status, - msg); - enb_agent_mac_destroy_dl_config(msg); - } - //schedule_ue_spec(module_idP,frameP,subframeP,nprb,nCCE,mbsfn_status); + schedule_ue_spec(module_idP,frameP,subframeP,nprb,nCCE,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,RBalloc,1,mbsfn_status); break; case 5: - //schedule_ue_spec(module_idP,frameP,subframeP,nprb,nCCE,mbsfn_status); - if (mac_agent_registered[module_idP]) { - enb_agent_mac_create_empty_dl_config(module_idP, &msg); - agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( - module_idP, - frameP, - subframeP, - nprb, - nCCE, - mbsfn_status, - msg); - enb_agent_mac_destroy_dl_config(msg); - } + schedule_ue_spec(module_idP,frameP,subframeP,nprb,nCCE,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,RBalloc,0,mbsfn_status); break; @@ -591,19 +452,7 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, } } else { //FDD //schedule_ulsch(module_idP,frameP,cooperation_flag,7,1,nCCE); - if (mac_agent_registered[module_idP]) { - enb_agent_mac_create_empty_dl_config(module_idP, &msg); - agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( - module_idP, - frameP, - subframeP, - nprb, - nCCE, - mbsfn_status, - msg); - enb_agent_mac_destroy_dl_config(msg); - } - //schedule_ue_spec(module_idP,frameP,subframeP,nprb,nCCE,mbsfn_status); + schedule_ue_spec(module_idP,frameP,subframeP,nprb,nCCE,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,RBalloc,0,mbsfn_status); } @@ -623,19 +472,7 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, // schedule_RA(module_idP,subframeP,nprb,nCCE); schedule_ulsch(module_idP,frameP,cooperation_flag,subframeP,2,nCCE); - if (mac_agent_registered[module_idP]) { - enb_agent_mac_create_empty_dl_config(module_idP, &msg); - agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( - module_idP, - frameP, - subframeP, - nprb, - nCCE, - mbsfn_status, - msg); - enb_agent_mac_destroy_dl_config(msg); - } - //schedule_ue_spec(module_idP,frameP,subframeP,nprb,nCCE,mbsfn_status); + schedule_ue_spec(module_idP,frameP,subframeP,nprb,nCCE,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,RBalloc,0,mbsfn_status); break; @@ -644,19 +481,7 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, } } else { //FDD //schedule_ulsch(module_idP,frameP,cooperation_flag,8,2,nCCE); - if (mac_agent_registered[module_idP]) { - enb_agent_mac_create_empty_dl_config(module_idP, &msg); - agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( - module_idP, - frameP, - subframeP, - nprb, - nCCE, - mbsfn_status, - msg); - enb_agent_mac_destroy_dl_config(msg); - } - //schedule_ue_spec(module_idP,frameP,subframeP,nprb,nCCE,mbsfn_status); + schedule_ue_spec(module_idP,frameP,subframeP,nprb,nCCE,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,RBalloc,0,mbsfn_status); } @@ -670,76 +495,28 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, case 1: schedule_ulsch(module_idP,frameP,cooperation_flag,subframeP,3,nCCE); schedule_RA(module_idP,frameP,subframeP,7,nprb,nCCE); // 7 = Msg3 subframeP, not - if (mac_agent_registered[module_idP]) { - enb_agent_mac_create_empty_dl_config(module_idP, &msg); - agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( - module_idP, - frameP, - subframeP, - nprb, - nCCE, - mbsfn_status, - msg); - enb_agent_mac_destroy_dl_config(msg); - } - //schedule_ue_spec(module_idP,frameP,subframeP,nprb,nCCE,mbsfn_status); + schedule_ue_spec(module_idP,frameP,subframeP,nprb,nCCE,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,RBalloc,1,mbsfn_status); break; case 3: case 4: schedule_ulsch(module_idP,frameP,cooperation_flag,subframeP,3,nCCE); - if (mac_agent_registered[module_idP]) { - enb_agent_mac_create_empty_dl_config(module_idP, &msg); - agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( - module_idP, - frameP, - subframeP, - nprb, - nCCE, - mbsfn_status, - msg); - enb_agent_mac_destroy_dl_config(msg); - } - //schedule_ue_spec(module_idP,frameP,subframeP,nprb,nCCE,mbsfn_status); + schedule_ue_spec(module_idP,frameP,subframeP,nprb,nCCE,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,RBalloc,0,mbsfn_status); break; case 6: schedule_ulsch(module_idP,frameP,cooperation_flag,subframeP,4,nCCE); //schedule_RA(module_idP,frameP,subframeP,nprb,nCCE); - if (mac_agent_registered[module_idP]) { - enb_agent_mac_create_empty_dl_config(module_idP, &msg); - agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( - module_idP, - frameP, - subframeP, - nprb, - nCCE, - mbsfn_status, - msg); - enb_agent_mac_destroy_dl_config(msg); - } - //schedule_ue_spec(module_idP,frameP,subframeP,nprb,nCCE,mbsfn_status); + schedule_ue_spec(module_idP,frameP,subframeP,nprb,nCCE,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,RBalloc,0,mbsfn_status); break; case 2: case 5: //schedule_RA(module_idP,frameP,subframeP,nprb,nCCE); - if (mac_agent_registered[module_idP]) { - enb_agent_mac_create_empty_dl_config(module_idP, &msg); - agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( - module_idP, - frameP, - subframeP, - nprb, - nCCE, - mbsfn_status, - msg); - enb_agent_mac_destroy_dl_config(msg); - } - //schedule_ue_spec(module_idP,frameP,subframeP,nprb,nCCE,mbsfn_status); + schedule_ue_spec(module_idP,frameP,subframeP,nprb,nCCE,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,RBalloc,0,mbsfn_status); break; @@ -748,19 +525,7 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, } } else { //FDD // schedule_ulsch(module_idP,frameP,cooperation_flag,9,3,nCCE); - if (mac_agent_registered[module_idP]) { - enb_agent_mac_create_empty_dl_config(module_idP, &msg); - agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( - module_idP, - frameP, - subframeP, - nprb, - nCCE, - mbsfn_status, - msg); - enb_agent_mac_destroy_dl_config(msg); - } - //schedule_ue_spec(module_idP,frameP,subframeP,nprb,nCCE,mbsfn_status); + schedule_ue_spec(module_idP,frameP,subframeP,nprb,nCCE,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,RBalloc,0,mbsfn_status); } From a91a25c97258ab6307628dc2de10b5f5359ae9e8 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Mon, 1 Feb 2016 11:38:07 +0000 Subject: [PATCH 079/349] Changed signature of DL scheduling function of agent --- openair2/ENB_APP/enb_agent_mac_defs.h | 1 - .../LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c | 17 +++++++---------- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/openair2/ENB_APP/enb_agent_mac_defs.h b/openair2/ENB_APP/enb_agent_mac_defs.h index 67b89bf610..c2891e87ca 100644 --- a/openair2/ENB_APP/enb_agent_mac_defs.h +++ b/openair2/ENB_APP/enb_agent_mac_defs.h @@ -58,7 +58,6 @@ typedef struct { /// dl_info is already initialized as prp_dl_mac_config and fills the /// prp_dl_data part of it void (*enb_agent_schedule_ue_spec)(mid_t mod_id, uint32_t frame, uint32_t subframe, - unsigned int *nb_rb_used, unsigned int *nCCE_used, int *mbsfn_flag, Protocol__ProgranMessage *dl_info); /*TODO: Fill in with the rest of the MAC layer technology specific callbacks (UL/DL scheduling, RACH info etc)*/ diff --git a/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c b/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c index 30894909a7..7435194d33 100644 --- a/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c +++ b/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c @@ -78,8 +78,6 @@ schedule_ue_spec_default( mid_t mod_id, uint32_t frame, uint32_t subframe, - unsigned int *nb_rb_used, - unsigned int *nCCE_used, int *mbsfn_flag, Protocol__ProgranMessage *dl_info ) @@ -146,8 +144,8 @@ schedule_ue_spec_default( for (CC_id=0; CC_idget_lte_frame_parms(mod_id, CC_id); - total_nb_available_rb[CC_id] = frame_parms[CC_id]->N_RB_DL - nb_rb_used[CC_id]; - nCCE[CC_id] = mac_xface->get_nCCE_max(mod_id, CC_id) - nCCE_used[CC_id]; + //total_nb_available_rb[CC_id] = frame_parms[CC_id]->N_RB_DL - nb_rb_used[CC_id]; + //nCCE[CC_id] = mac_xface->get_nCCE_max(mod_id, CC_id) - nCCE_used[CC_id]; N_RBG[CC_id] = frame_parms[CC_id]->N_RBG; // store the global enb stats: @@ -195,8 +193,8 @@ schedule_ue_spec_default( } if ((ue_sched_ctl->pre_nb_available_rbs[CC_id] == 0) || (nCCE[CC_id] < (1<pre_nb_available_rbs[CC_id], nCCE[CC_id], aggregation); + // LOG_D(MAC,"[eNB %d] Frame %d : no RB allocated for UE %d on CC_id %d: continue \n", + // mod_id, frame, UE_id, CC_id, nb_rb_used[CC_id], ue_sched_ctl->pre_nb_available_rbs[CC_id], nCCE[CC_id], aggregation); //if(mac_xface->get_transmission_mode(module_idP,rnti)==5) continue_flag=1; //to next user (there might be rbs availiable for other UEs in TM5 // else @@ -329,7 +327,7 @@ schedule_ue_spec_default( nb_available_rb -= nb_rb; aggregation = process_ue_cqi(mod_id, UE_id); nCCE[CC_id]-=(1<mu_mimo_mode[UE_id].pre_nb_available_rbs = nb_rb; PHY_vars_eNB_g[mod_id][CC_id]->mu_mimo_mode[UE_id].dl_pow_off = ue_sched_ctl->dl_pow_off[CC_id]; @@ -765,9 +763,9 @@ schedule_ue_spec_default( dl_dci->has_aggr_level = 1; dl_dci->aggr_level = aggregation; dl_dci->has_cce_index = 1; - dl_dci->cce_index = nCCE_used[CC_id]; + // dl_dci->cce_index = nCCE_used[CC_id]; nCCE[CC_id]-=(1<UE_template[CC_id][UE_id].nb_rb[harq_pid] = nb_rb; add_ue_dlsch_info(mod_id, @@ -1044,7 +1042,6 @@ schedule_ue_spec_default( void apply_scheduling_decisions(mid_t mod_id, uint32_t frame, uint32_t subframe, - uint32_t *rballoc, int *mbsfn_flag, Protocol__ProgranMessage *dl_scheduling_info) { From ab0e4aadaebe1fc40d4a4359f76424b866685210 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Mon, 1 Feb 2016 17:20:35 +0000 Subject: [PATCH 080/349] Reintroduced support for agent scheduler after merge with develop --- .../LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c | 476 +++++++++--------- openair2/LAYER2/MAC/eNB_scheduler.c | 441 +++++++++++++++- openair2/LAYER2/MAC/proto.h | 1 - 3 files changed, 668 insertions(+), 250 deletions(-) diff --git a/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c b/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c index 7435194d33..a4fbac6de2 100644 --- a/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c +++ b/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c @@ -86,7 +86,6 @@ schedule_ue_spec_default( //TODO uint8_t CC_id; int UE_id; - uint16_t nCCE[MAX_NUM_CCs]; int N_RBG[MAX_NUM_CCs]; unsigned char aggregation; mac_rlc_status_resp_t rlc_status; @@ -103,9 +102,8 @@ schedule_ue_spec_default( // uint8_t dl_pow_off[MAX_NUM_CCs][NUMBER_OF_UE_MAX]; // unsigned char rballoc_sub_UE[MAX_NUM_CCs][NUMBER_OF_UE_MAX][N_RBG_MAX]; // uint16_t pre_nb_available_rbs[MAX_NUM_CCs][NUMBER_OF_UE_MAX]; - int mcs; + int mcs, mcs_tmp; uint16_t min_rb_unit[MAX_NUM_CCs]; - short ta_update = 0; eNB_MAC_INST *eNB = &eNB_mac_inst[mod_id]; UE_list_t *UE_list = &eNB->UE_list; LTE_DL_FRAME_PARMS *frame_parms[MAX_NUM_CCs]; @@ -144,15 +142,18 @@ schedule_ue_spec_default( for (CC_id=0; CC_idget_lte_frame_parms(mod_id, CC_id); - //total_nb_available_rb[CC_id] = frame_parms[CC_id]->N_RB_DL - nb_rb_used[CC_id]; - //nCCE[CC_id] = mac_xface->get_nCCE_max(mod_id, CC_id) - nCCE_used[CC_id]; + // get number of PRBs less those used by common channels + total_nb_available_rb[CC_id] = frame_parms[CC_id]->N_RB_DL; + for (i=0;iN_RB_DL;i++) + if (eNB->common_channels[CC_id].vrb_map[i]!=0) + total_nb_available_rb[CC_id]--; + N_RBG[CC_id] = frame_parms[CC_id]->N_RBG; // store the global enb stats: eNB->eNB_stats[CC_id].num_dlactive_UEs = UE_list->num_UEs; eNB->eNB_stats[CC_id].available_prbs = total_nb_available_rb[CC_id]; eNB->eNB_stats[CC_id].total_available_prbs += total_nb_available_rb[CC_id]; - eNB->eNB_stats[CC_id].available_ncces = nCCE[CC_id]; eNB->eNB_stats[CC_id].dlsch_bytes_tx=0; eNB->eNB_stats[CC_id].dlsch_pdus_tx=0; } @@ -192,15 +193,17 @@ schedule_ue_spec_default( continue_flag=1; } - if ((ue_sched_ctl->pre_nb_available_rbs[CC_id] == 0) || (nCCE[CC_id] < (1<pre_nb_available_rbs[CC_id], nCCE[CC_id], aggregation); + if ((ue_sched_ctl->pre_nb_available_rbs[CC_id] == 0) || // no RBs allocated + CCE_allocation_infeasible(mod_id, CC_id, 0, subframe, aggregation, rnti) + ) { + LOG_D(MAC,"[eNB %d] Frame %d : no RB allocated for UE %d on CC_id %d: continue \n", + mod_id, frame, UE_id, CC_id); //if(mac_xface->get_transmission_mode(module_idP,rnti)==5) continue_flag=1; //to next user (there might be rbs availiable for other UEs in TM5 // else // break; } - + if (frame_parms[CC_id]->frame_type == TDD) { set_ue_dai (subframe, frame_parms[CC_id]->tdd_config, @@ -233,6 +236,8 @@ schedule_ue_spec_default( nb_available_rb = ue_sched_ctl->pre_nb_available_rbs[CC_id]; harq_pid = ue_sched_ctl->harq_pid[CC_id]; round = ue_sched_ctl->round[CC_id]; + + /* TODO: Must add these stats (probably in the apply_scheduling function) */ //UE_list->eNB_UE_stats[CC_id][UE_id].crnti= rnti; //UE_list->eNB_UE_stats[CC_id][UE_id].rrc_status=mac_eNB_get_rrc_status(mod_id, rnti); //UE_list->eNB_UE_stats[CC_id][UE_id].harq_pid = harq_pid; @@ -248,15 +253,18 @@ schedule_ue_spec_default( */ mcs = cqi_to_mcs[eNB_UE_stats->DL_cqi[0]]; + + /*TODO: Must also update these stats*/ //eNB_UE_stats->dlsch_mcs1 = cqi_to_mcs[eNB_UE_stats->DL_cqi[0]]; //eNB_UE_stats->dlsch_mcs1 = cmin(eNB_UE_stats->dlsch_mcs1, openair_daq_vars.target_ue_dl_mcs); #ifdef EXMIMO - // if (mac_xface->get_transmission_mode(mod_id, CC_id, rnti)==5) { - // eNB_UE_stats->dlsch_mcs1 = cmin(eNB_UE_stats->dlsch_mcs1,16); - // } + if (mac_xface->get_transmission_mode(mod_id, CC_id, rnti)==5) { + mcs = cqi_to_mcs[eNB_UE_stats->DL_cqi[0]]; + //eNB_UE_stats->dlsch_mcs1 = cmin(eNB_UE_stats->dlsch_mcs1,16); + } #endif @@ -264,14 +272,13 @@ schedule_ue_spec_default( //UE_list->eNB_UE_stats[CC_id][UE_id].dl_cqi= eNB_UE_stats->DL_cqi[0]; // initializing the rb allocation indicator for each UE - for(j=0; jN_RBG; j++) { + for(j = 0; j < frame_parms[CC_id]->N_RBG; j++) { UE_list->UE_template[CC_id][UE_id].rballoc_subband[harq_pid][j] = 0; } - LOG_D(MAC,"[eNB %d] Frame %d: Scheduling UE %d on CC_id %d (rnti %x, harq_pid %d, round %d, rb %d, cqi %d, mcs %d, ncc %d, rrc %d)\n", + LOG_D(MAC,"[eNB %d] Frame %d: Scheduling UE %d on CC_id %d (rnti %x, harq_pid %d, round %d, rb %d, cqi %d, mcs %d, rrc %d)\n", mod_id, frame, UE_id, CC_id, rnti, harq_pid, round, nb_available_rb, eNB_UE_stats->DL_cqi[0], mcs, - nCCE[CC_id], UE_list->eNB_UE_stats[CC_id][UE_id].rrc_status); dl_dci = (Protocol__PrpDlDci*) malloc(sizeof(Protocol__PrpDlDci)); @@ -301,14 +308,14 @@ schedule_ue_spec_default( if (nb_rb <= nb_available_rb) { if(nb_rb == ue_sched_ctl->pre_nb_available_rbs[CC_id]) { - for(j=0; jN_RBG; j++) { // for indicating the rballoc for each sub-band + for(j = 0; j < frame_parms[CC_id]->N_RBG; j++) { // for indicating the rballoc for each sub-band UE_list->UE_template[CC_id][UE_id].rballoc_subband[harq_pid][j] = ue_sched_ctl->rballoc_sub_UE[CC_id][j]; } } else { nb_rb_temp = nb_rb; j = 0; - while((nb_rb_temp > 0) && (jN_RBG)) { + while((nb_rb_temp > 0) && (j < frame_parms[CC_id]->N_RBG)) { if(ue_sched_ctl->rballoc_sub_UE[CC_id][j] == 1) { UE_list->UE_template[CC_id][UE_id].rballoc_subband[harq_pid][j] = ue_sched_ctl->rballoc_sub_UE[CC_id][j]; if((j == frame_parms[CC_id]->N_RBG-1) && @@ -326,8 +333,6 @@ schedule_ue_spec_default( nb_available_rb -= nb_rb; aggregation = process_ue_cqi(mod_id, UE_id); - nCCE[CC_id]-=(1<mu_mimo_mode[UE_id].pre_nb_available_rbs = nb_rb; PHY_vars_eNB_g[mod_id][CC_id]->mu_mimo_mode[UE_id].dl_pow_off = ue_sched_ctl->dl_pow_off[CC_id]; @@ -344,7 +349,8 @@ schedule_ue_spec_default( dl_dci->res_alloc = 0; dl_dci->n_mcs = 1; dl_dci->mcs = (uint32_t *)malloc(sizeof(uint32_t)); - dl_dci->mcs[0] = mcs; //eNB_UE_stats->dlsch_mcs1; + dl_dci->mcs[0] = mcs; + //TODO:Need to fix tpc for retransmissions dl_dci->has_tpc = 1; dl_dci->tpc = 1; dl_dci->has_vrb_format = 1; @@ -352,7 +358,7 @@ schedule_ue_spec_default( dl_dci->has_format = 1; dl_dci->format = PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1; dl_dci->has_rb_bitmap = 1; - dl_dci->rb_bitmap = allocate_prbs_sub(UE_list->UE_template[CC_id][UE_id].nb_rb[harq_pid], UE_list->UE_template[CC_id][UE_id].rballoc_subband); + dl_dci->rb_bitmap = allocate_prbs_sub(nb_rb, UE_list->UE_template[CC_id][UE_id].rballoc_subband); dl_dci->has_rb_shift = 1; dl_dci->rb_shift = 0; dl_dci->n_ndi = 1; @@ -374,29 +380,48 @@ schedule_ue_spec_default( case 4: dl_dci->has_res_alloc = 1; dl_dci->res_alloc = 0; + dl_dci->n_mcs = 2; + dl_dci->mcs = (uint32_t *)malloc(sizeof(uint32_t) * dl_dci->n_mcs); + dl_dci->mcs[0] = mcs; + dl_dci->mcs[1] = mcs; + //TODO:Need to fix tpc for retransmissions + dl_dci->has_tpc = 1; + dl_dci->tpc = 1; dl_dci->has_vrb_format = 1; dl_dci->vrb_format = PROTOCOL__PRP_VRB_FORMAT__PRVRBF_LOCALIZED; dl_dci->has_format = 1; dl_dci->format = PROTOCOL__PRP_DCI_FORMAT__PRDCIF_2A; + dl_dci->has_rb_bitmap = 1; + dl_dci->rb_bitmap = allocate_prbs_sub(nb_rb, UE_list->UE_template[CC_id][UE_id].rballoc_subband); + dl_dci->has_rb_shift = 1; + dl_dci->rb_shift = 0; dl_dci->n_ndi = 2; dl_dci->ndi = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_ndi); dl_dci->ndi[0] = 0; dl_dci->ndi[1] = 0; - //dl_dci->has_rb_bitmap = 1; - //dl_dci->rb_bitmap = allocate_prbs_sub(nb_rb, rballoc_sub); - dl_dci->has_rb_shift = 1; - dl_dci->rb_shift = 0; - dl_dci->has_dai = 1; - dl_dci->dai = (UE_list->UE_template[CC_id][UE_id].DAI-1)&3; dl_dci->n_rv = 2; dl_dci->rv = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_rv); dl_dci->rv[0] = round&3; dl_dci->rv[1] = round&3; - + if (frame_parms[CC_id]->frame_type == TDD) { + dl_dci->has_dai = 1; + dl_dci->dai = (UE_list->UE_template[CC_id][UE_id].DAI-1)&3; + LOG_D(MAC,"[eNB %d] Retransmission CC_id %d : harq_pid %d, round %d, dai %d\n", + mod_id, CC_id, harq_pid, round,(UE_list->UE_template[CC_id][UE_id].DAI-1)); + } else { + LOG_D(MAC,"[eNB %d] Retransmission CC_id %d : harq_pid %d, round %d\n", + mod_id, CC_id, harq_pid, round); + } break; case 5: dl_dci->has_res_alloc = 1; dl_dci->res_alloc = 0; + dl_dci->n_mcs = 1; + dl_dci->mcs = (uint32_t *)malloc(sizeof(uint32_t)); + dl_dci->mcs[0] = mcs; + //TODO:Need to fix tpc for retransmissions + dl_dci->has_tpc = 1; + dl_dci->tpc = 1; dl_dci->has_vrb_format = 1; dl_dci->vrb_format = PROTOCOL__PRP_VRB_FORMAT__PRVRBF_LOCALIZED; dl_dci->has_format = 1; @@ -404,8 +429,8 @@ schedule_ue_spec_default( dl_dci->n_ndi = 1; dl_dci->ndi = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_ndi); dl_dci->ndi[0] = 0; - //dl_dci->has_rb_bitmap = 1; - //dl_dci->rb_bitmap = allocate_prbs_sub(nb_rb, rballoc_sub); + dl_dci->has_rb_bitmap = 1; + dl_dci->rb_bitmap = allocate_prbs_sub(nb_rb, UE_list->UE_template[CC_id][UE_id].rballoc_subband); dl_dci->has_rb_shift = 1; dl_dci->rb_shift = 0; dl_dci->has_dai = 1; @@ -425,6 +450,12 @@ schedule_ue_spec_default( case 6: dl_dci->has_res_alloc = 1; dl_dci->res_alloc = 0; + dl_dci->n_mcs = 1; + dl_dci->mcs = (uint32_t *)malloc(sizeof(uint32_t)); + dl_dci->mcs[0] = mcs; + //TODO:Need to fix tpc for retransmissions + dl_dci->has_tpc = 1; + dl_dci->tpc = 1; dl_dci->has_vrb_format = 1; dl_dci->vrb_format = PROTOCOL__PRP_VRB_FORMAT__PRVRBF_LOCALIZED; dl_dci->has_format = 1; @@ -432,8 +463,8 @@ schedule_ue_spec_default( dl_dci->n_ndi = 1; dl_dci->ndi = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_ndi); dl_dci->ndi[0] = 0; - //dl_dci->has_rb_bitmap = 1; - //dl_dci->rb_bitmap = allocate_prbs_sub(nb_rb, rballoc_sub); + dl_dci->has_rb_bitmap = 1; + dl_dci->rb_bitmap = allocate_prbs_sub(nb_rb, UE_list->UE_template[CC_id][UE_id].rballoc_subband); dl_dci->has_rb_shift = 1; dl_dci->rb_shift = 0; dl_dci->has_dai = 1; @@ -447,17 +478,18 @@ schedule_ue_spec_default( break; } - add_ue_dlsch_info(mod_id, - CC_id, - UE_id, - subframe, - S_DL_SCHEDULED); + /*We now probably don't need this*/ + /* add_ue_dlsch_info(mod_id, */ + /* CC_id, */ + /* UE_id, */ + /* subframe, */ + /* S_DL_SCHEDULED); */ //eNB_UE_stats->dlsch_trials[round]++; //UE_list->eNB_UE_stats[CC_id][UE_id].num_retransmission+=1; //UE_list->eNB_UE_stats[CC_id][UE_id].rbs_used_retx=nb_rb; //UE_list->eNB_UE_stats[CC_id][UE_id].total_rbs_used_retx+=nb_rb; - //UE_list->eNB_UE_stats[CC_id][UE_id].ncce_used_retx=nCCE[CC_id]; + //UE_list->eNB_UE_stats[CC_id][UE_id].ncce_used_retx=nCCECC_id]; //UE_list->eNB_UE_stats[CC_id][UE_id].dlsch_mcs1=eNB_UE_stats->dlsch_mcs1; //UE_list->eNB_UE_stats[CC_id][UE_id].dlsch_mcs2=eNB_UE_stats->dlsch_mcs1; @@ -475,33 +507,12 @@ schedule_ue_spec_default( //TBS = mac_xface->get_TBS(eNB_UE_stats->DL_cqi[0]<<1,nb_available_rb); TBS = mac_xface->get_TBS_DL(mcs, nb_available_rb); dci_tbs = TBS; + // check first for RLC data on DCCH // add the length for all the control elements (timing adv, drx, etc) : header + payload - //#ifndef EXMIMO_IOT - // to be checked by RK, NN, FK - uint8_t update_TA=4; - - switch (frame_parms[CC_id]->N_RB_DL) { - case 6: - update_TA = 1; - break; - - case 25: - update_TA = 4; - break; - - case 50: - update_TA = 8; - break; - - case 100: - update_TA = 16; - break; - } - - ta_len = ((eNB_UE_stats->timing_advance_update/update_TA)!=0) ? 2 : 0; - + ta_len = (ue_sched_ctl->ta_update!=0) ? 2 : 0; + dl_data[num_ues_added]->n_ce_bitmap = 2; dl_data[num_ues_added]->ce_bitmap = (uint32_t *) malloc(sizeof(uint32_t) * 2); @@ -509,6 +520,7 @@ schedule_ue_spec_default( ce_flags |= PROTOCOL__PRP_CE_TYPE__PRPCET_TA; } + /*TODO: Add other flags if DRX and other CE are required*/ // Add the control element flags to the progran message dl_data[num_ues_added]->ce_bitmap[0] = ce_flags; @@ -519,24 +531,22 @@ schedule_ue_spec_default( // Need to see if we have space for data from this channel if ( TBS-ta_len-header_len_dcch > 0 ) { - //If we have space, we need to see how much data we can request at most (if any are available) - - rlc_status = mac_rlc_status_ind( - mod_id, - rnti, - mod_id, - frame, - ENB_FLAG_YES, - MBMS_FLAG_NO, - DCCH, - (TBS-ta_len-header_len_dcch)); // transport block set size + //If we have space, we need to see how much data we can request at most (if any available) + rlc_status = mac_rlc_status_ind(mod_id, + rnti, + mod_id, + frame, + ENB_FLAG_YES, + MBMS_FLAG_NO, + DCCH, + (dci_tbs-ta_len-header_len_dcch)); // transport block set size //If data are available in the DCCH if (rlc_status.bytes_in_buffer > 0) { - - // Fill at most 1/3 of the remaining TB - data_to_request = 3;//cmin(3, rlc_status.bytes_in_buffer); - + LOG_D(MAC, "[TEST]Have %d bytes in buffer DCCH during first call\n", rlc_status.bytes_in_buffer); + //Fill in as much as possible + data_to_request = cmin(dci_tbs-ta_len-header_len_dcch, rlc_status.bytes_in_buffer) + 1; + LOG_D(MAC, "[TEST]Will request %d \n", data_to_request); rlc_pdus[0] = (Protocol__PrpRlcPdu *) malloc(sizeof(Protocol__PrpRlcPdu)); protocol__prp_rlc_pdu__init(rlc_pdus[0]); rlc_pdus[0]->n_rlc_pdu_tb = 2; @@ -562,26 +572,25 @@ schedule_ue_spec_default( } // check for DCCH1 and update header information (assume 2 byte sub-header) - if (TBS-ta_len-header_len_dcch+2-sdu_length_total > 0 ) { + if (dci_tbs-ta_len-header_len_dcch-sdu_length_total > 0 ) { //If we have space, we need to see how much data we can request at most (if any are available) - rlc_status = mac_rlc_status_ind( - mod_id, + rlc_status = mac_rlc_status_ind(mod_id, rnti, mod_id, frame, ENB_FLAG_YES, MBMS_FLAG_NO, DCCH+1, - (TBS-ta_len-header_len_dcch+2-sdu_length_total)); // transport block set size less allocations for timing advance and + (dci_tbs-ta_len-header_len_dcch-sdu_length_total)); // transport block set size less allocations for timing advance and // DCCH SDU // If data are available in DCCH1 if (rlc_status.bytes_in_buffer > 0) { header_len_dcch += 2; - - //Fill another 1/3 of the remaining TB - data_to_request = 3;//cmin(3, rlc_status.bytes_in_buffer); + + //Fill in as much as possible + data_to_request = cmin(dci_tbs-ta_len-header_len_dcch-sdu_length_total, rlc_status.bytes_in_buffer) + 1; rlc_pdus[1] = (Protocol__PrpRlcPdu *) malloc(sizeof(Protocol__PrpRlcPdu)); protocol__prp_rlc_pdu__init(rlc_pdus[1]); @@ -589,7 +598,7 @@ schedule_ue_spec_default( rlc_pdus[1]->rlc_pdu_tb = (Protocol__PrpRlcPduTb **) malloc(sizeof(Protocol__PrpRlcPduTb *) * 2); rlc_pdus[1]->rlc_pdu_tb[0] = (Protocol__PrpRlcPduTb *) malloc(sizeof(Protocol__PrpRlcPduTb)); rlc_pdus[1]->rlc_pdu_tb[0]->has_logical_channel_id = 1; - rlc_pdus[1]->rlc_pdu_tb[0]->logical_channel_id = DCCH; + rlc_pdus[1]->rlc_pdu_tb[0]->logical_channel_id = DCCH+1; rlc_pdus[1]->rlc_pdu_tb[0]->has_size = 1; rlc_pdus[1]->rlc_pdu_tb[0]->size = data_to_request; rlc_pdus[1]->rlc_pdu_tb[1] = (Protocol__PrpRlcPduTb *) malloc(sizeof(Protocol__PrpRlcPduTb)); @@ -610,27 +619,26 @@ schedule_ue_spec_default( LOG_D(MAC,"[eNB %d], Frame %d, DTCH->DLSCH, CC_id %d, Checking RLC status (rab %d, tbs %d, len %d)\n", mod_id, frame, CC_id, DTCH, TBS, - TBS-ta_len-header_len_dcch-sdu_length_total-header_len_dtch); + dci_tbs-ta_len-header_len_dcch-sdu_length_total-header_len_dtch); - if (TBS-ta_len-header_len_dcch-sdu_length_total-header_len_dtch > 0 ) { + if (dci_tbs-ta_len-header_len_dcch-sdu_length_total-header_len_dtch > 0 ) { //If we have space, we need to see how much data we can request at most (if any are available) - rlc_status = mac_rlc_status_ind( - mod_id, + rlc_status = mac_rlc_status_ind(mod_id, rnti, mod_id, frame, ENB_FLAG_YES, MBMS_FLAG_NO, DTCH, - TBS-ta_len-header_len_dcch-sdu_length_total-header_len_dtch); + dci_tbs-ta_len-header_len_dcch-sdu_length_total-header_len_dtch); // If data are available in DTCH if (rlc_status.bytes_in_buffer > 0) { - + LOG_D(MAC, "[TEST] Have %d bytes in buffer DTCH during first call\n", rlc_status.bytes_in_buffer); //Fill what remains in the TB - data_to_request = 3;//cmin(3, rlc_status.bytes_in_buffer); - + data_to_request = cmin(dci_tbs-ta_len-header_len_dcch-sdu_length_total-header_len_dtch, rlc_status.bytes_in_buffer) + 1; + LOG_D(MAC, "[TEST]Will request %d \n", data_to_request); rlc_pdus[2] = (Protocol__PrpRlcPdu *) malloc(sizeof(Protocol__PrpRlcPdu)); protocol__prp_rlc_pdu__init(rlc_pdus[2]); rlc_pdus[2]->n_rlc_pdu_tb = 2; @@ -654,14 +662,14 @@ schedule_ue_spec_default( } } else { - header_len_dtch = 0; + header_len_dtch = 3; } } // Add rlc_pdus to the dl_data message dl_data[num_ues_added]->rlc_pdu = (Protocol__PrpRlcPdu **) malloc(sizeof(Protocol__PrpRlcPdu *) * dl_data[num_ues_added]->n_rlc_pdu); - for (i = 0; i< dl_data[num_ues_added]->n_rlc_pdu; i++) { + for (i = 0; i < dl_data[num_ues_added]->n_rlc_pdu; i++) { dl_data[num_ues_added]->rlc_pdu[i] = rlc_pdus[i]; } @@ -674,51 +682,48 @@ schedule_ue_spec_default( header_len_dtch_tmp = header_len_dtch; if (header_len_dtch == 0) { - header_len_dcch = (header_len_dcch >0) ? 1 : header_len_dcch; // remove length field + header_len_dcch = (header_len_dcch > 0) ? 1 : header_len_dcch; // remove length field } else { - header_len_dtch = (header_len_dtch > 0) ? 1 :header_len_dtch; // remove length field for the last SDU + header_len_dtch = (header_len_dtch > 0) ? 1 : header_len_dtch; // remove length field for the last SDU } - int mcs2; - - mcs2 = mcs; + mcs_tmp = mcs; // TODO: Need to compute this and not take it from the stats // mcs = eNB_UE_stats->dlsch_mcs1; - if (mcs2==0) { + if (mcs_tmp == 0) { nb_rb = 4; // don't let the TBS get too small } else { nb_rb=min_rb_unit[CC_id]; } - TBS = mac_xface->get_TBS_DL(mcs2,nb_rb); + TBS = mac_xface->get_TBS_DL(mcs_tmp, nb_rb); while (TBS < (sdu_length_total + header_len_dcch + header_len_dtch + ta_len)) { nb_rb += min_rb_unit[CC_id]; // - if (nb_rb>nb_available_rb) { // if we've gone beyond the maximum number of RBs + if (nb_rb > nb_available_rb) { // if we've gone beyond the maximum number of RBs // (can happen if N_RB_DL is odd) - TBS = mac_xface->get_TBS_DL(mcs2, nb_available_rb); + TBS = mac_xface->get_TBS_DL(mcs_tmp, nb_available_rb); nb_rb = nb_available_rb; break; } - TBS = mac_xface->get_TBS_DL(mcs, nb_rb); + TBS = mac_xface->get_TBS_DL(mcs_tmp, nb_rb); } if(nb_rb == ue_sched_ctl->pre_nb_available_rbs[CC_id]) { - for(j=0; jN_RBG; j++) { // for indicating the rballoc for each sub-band + for(j = 0; j < frame_parms[CC_id]->N_RBG; j++) { // for indicating the rballoc for each sub-band UE_list->UE_template[CC_id][UE_id].rballoc_subband[harq_pid][j] = ue_sched_ctl->rballoc_sub_UE[CC_id][j]; } } else { nb_rb_temp = nb_rb; j = 0; - while((nb_rb_temp > 0) && (jN_RBG)) { + while((nb_rb_temp > 0) && (j < frame_parms[CC_id]->N_RBG)) { if(ue_sched_ctl->rballoc_sub_UE[CC_id][j] == 1) { UE_list->UE_template[CC_id][UE_id].rballoc_subband[harq_pid][j] = ue_sched_ctl->rballoc_sub_UE[CC_id][j]; - if ((j == frame_parms[CC_id]->N_RBG-1) && ((frame_parms[CC_id]->N_RB_DL == 25)|| (frame_parms[CC_id]->N_RB_DL == 50))) { @@ -735,44 +740,41 @@ schedule_ue_spec_default( PHY_vars_eNB_g[mod_id][CC_id]->mu_mimo_mode[UE_id].pre_nb_available_rbs = nb_rb; PHY_vars_eNB_g[mod_id][CC_id]->mu_mimo_mode[UE_id].dl_pow_off = ue_sched_ctl->dl_pow_off[CC_id]; - for(j=0; jN_RBG; j++) { + for(j = 0; j < frame_parms[CC_id]->N_RBG; j++) { PHY_vars_eNB_g[mod_id][CC_id]->mu_mimo_mode[UE_id].rballoc_sub[j] = UE_list->UE_template[CC_id][UE_id].rballoc_subband[harq_pid][j]; } // decrease mcs until TBS falls below required length - while ((TBS > (sdu_length_total + header_len_dcch + header_len_dtch + ta_len)) && (mcs2>0)) { - mcs2--; - TBS = mac_xface->get_TBS_DL(mcs2,nb_rb); + while ((TBS > (sdu_length_total + header_len_dcch + header_len_dtch + ta_len)) && (mcs_tmp > 0)) { + mcs_tmp--; + TBS = mac_xface->get_TBS_DL(mcs_tmp, nb_rb); } // if we have decreased too much or we don't have enough RBs, increase MCS - while ((TBS < (sdu_length_total + header_len_dcch + header_len_dtch + ta_len)) && ((( ue_sched_ctl->dl_pow_off[CC_id]>0) && (mcs2<28)) - || ( (ue_sched_ctl->dl_pow_off[CC_id]==0) && (mcs2<=15)))) { - mcs2++; - TBS = mac_xface->get_TBS_DL(mcs2,nb_rb); + while ((TBS < (sdu_length_total + header_len_dcch + header_len_dtch + ta_len)) && + ((( ue_sched_ctl->dl_pow_off[CC_id] > 0) && (mcs_tmp < 28)) || ( (ue_sched_ctl->dl_pow_off[CC_id]==0) && (mcs_tmp <= 15)))) { + mcs_tmp++; + TBS = mac_xface->get_TBS_DL(mcs_tmp, nb_rb); } - dl_dci->n_tbs_size = 2; - dl_dci->tbs_size = (uint32_t *) malloc(sizeof(uint32_t) * 2); - dl_dci->tbs_size[0] = TBS; - dl_dci->tbs_size[1] = TBS; + LOG_D(MAC,"dlsch_mcs and TBS before and after the rate matching = (%d, %d) (%d, %d)\n", mcs, mcs_tmp, dci_tbs, TBS); - LOG_D(MAC,"dlsch_mcs before and after the rate matching = (%d, %d)\n", mcs, mcs2); + dci_tbs = TBS; + + mcs = mcs_tmp; aggregation = process_ue_cqi(mod_id,UE_id); dl_dci->has_aggr_level = 1; dl_dci->aggr_level = aggregation; - dl_dci->has_cce_index = 1; - // dl_dci->cce_index = nCCE_used[CC_id]; - nCCE[CC_id]-=(1<UE_template[CC_id][UE_id].nb_rb[harq_pid] = nb_rb; - add_ue_dlsch_info(mod_id, - CC_id, - UE_id, - subframe, - S_DL_SCHEDULED); + /*Deactivate here as well*/ + /* add_ue_dlsch_info(mod_id, */ + /* CC_id, */ + /* UE_id, */ + /* subframe, */ + /* S_DL_SCHEDULED); */ if (frame_parms[CC_id]->frame_type == TDD) { UE_list->UE_template[CC_id][UE_id].DAI++; @@ -838,8 +840,8 @@ schedule_ue_spec_default( dl_dci->rb_shift = 0; dl_dci->n_ndi = 1; dl_dci->ndi = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_ndi); - dl_dci->ndi[0] = 1; //1-UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]; - dl_dci->n_rv = 1; + dl_dci->ndi[0] = 1-UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]; + dl_dci->n_rv = 1-UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]; dl_dci->rv = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_rv); dl_dci->rv[0] = 0; dl_dci->has_tpc = 1; @@ -848,16 +850,11 @@ schedule_ue_spec_default( dl_dci->mcs = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_mcs); dl_dci->mcs[0] = mcs; dl_dci->n_tbs_size = 1; - dl_dci->tbs_size = (uint32_t *) malloc(sizeof(uint32_t)); + dl_dci->tbs_size = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_tbs_size); dl_dci->tbs_size[0] = dci_tbs; if (frame_parms[CC_id]->frame_type == TDD) { dl_dci->has_dai = 1; dl_dci->dai = (UE_list->UE_template[CC_id][UE_id].DAI-1)&3; - LOG_D(MAC,"[eNB %d] Retransmission CC_id %d : harq_pid %d, round %d, dai %d\n", - mod_id, CC_id, harq_pid, round,(UE_list->UE_template[CC_id][UE_id].DAI-1)); - } else { - LOG_D(MAC,"[eNB %d] Retransmission CC_id %d : harq_pid %d, round %d\n", - mod_id, CC_id, harq_pid, round); } break; case 3: @@ -873,26 +870,25 @@ schedule_ue_spec_default( dl_dci->rb_shift = 0; dl_dci->n_ndi = 2; dl_dci->ndi = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_ndi); - dl_dci->ndi[0] = 1; //1-UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]; - dl_dci->ndi[1] = 0; + dl_dci->ndi[0] = 1-UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid];; + dl_dci->ndi[1] = 1-UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid];; dl_dci->n_rv = 2; dl_dci->rv = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_rv); dl_dci->rv[0] = 0; - dl_dci->rv[1] = 1; + dl_dci->rv[1] = 0; dl_dci->has_tpc = 1; dl_dci->tpc = tpc; dl_dci->n_mcs = 2; dl_dci->mcs = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_mcs); dl_dci->mcs[0] = mcs; - dl_dci->mcs[1] = 0; + dl_dci->mcs[1] = mcs; + dl_dci->n_tbs_size = 2; + dl_dci->tbs_size = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_tbs_size); + dl_dci->tbs_size[0] = dci_tbs; + dl_dci->tbs_size[1] = dci_tbs; if (frame_parms[CC_id]->frame_type == TDD) { dl_dci->has_dai = 1; dl_dci->dai = (UE_list->UE_template[CC_id][UE_id].DAI-1)&3; - LOG_D(MAC,"[eNB %d] Retransmission CC_id %d : harq_pid %d, round %d, dai %d\n", - mod_id, CC_id, harq_pid, round,(UE_list->UE_template[CC_id][UE_id].DAI-1)); - } else { - LOG_D(MAC,"[eNB %d] Retransmission CC_id %d : harq_pid %d, round %d\n", - mod_id, CC_id, harq_pid, round); } break; case 4: @@ -901,33 +897,32 @@ schedule_ue_spec_default( dl_dci->has_vrb_format = 1; dl_dci->vrb_format = PROTOCOL__PRP_VRB_FORMAT__PRVRBF_LOCALIZED; dl_dci->has_format = 1; - dl_dci->format = PROTOCOL__PRP_DCI_FORMAT__PRDCIF_2; + dl_dci->format = PROTOCOL__PRP_DCI_FORMAT__PRDCIF_2A; dl_dci->has_rb_bitmap = 1; dl_dci->rb_bitmap = allocate_prbs_sub(nb_rb, rballoc_sub); dl_dci->has_rb_shift = 1; dl_dci->rb_shift = 0; dl_dci->n_ndi = 2; dl_dci->ndi = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_ndi); - dl_dci->ndi[0] = 1; // 1-UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]; - dl_dci->ndi[1] = 0; + dl_dci->ndi[0] = 1-UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid];; + dl_dci->ndi[1] = 1-UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid];; dl_dci->n_rv = 2; dl_dci->rv = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_rv); dl_dci->rv[0] = 0; - dl_dci->rv[1] = round&3; + dl_dci->rv[1] = 0; dl_dci->has_tpc = 1; dl_dci->tpc = tpc; dl_dci->n_mcs = 2; dl_dci->mcs = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_mcs); dl_dci->mcs[0] = mcs; - dl_dci->mcs[1] = 0; + dl_dci->mcs[1] = mcs; + dl_dci->n_tbs_size = 2; + dl_dci->tbs_size = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_tbs_size); + dl_dci->tbs_size[0] = dci_tbs; + dl_dci->tbs_size[1] = dci_tbs; if (frame_parms[CC_id]->frame_type == TDD) { dl_dci->has_dai = 1; dl_dci->dai = (UE_list->UE_template[CC_id][UE_id].DAI-1)&3; - LOG_D(MAC,"[eNB %d] Retransmission CC_id %d : harq_pid %d, round %d, dai %d\n", - mod_id, CC_id, harq_pid, round,(UE_list->UE_template[CC_id][UE_id].DAI-1)); - } else { - LOG_D(MAC,"[eNB %d] Retransmission CC_id %d : harq_pid %d, round %d\n", - mod_id, CC_id, harq_pid, round); } break; case 5: @@ -942,8 +937,8 @@ schedule_ue_spec_default( dl_dci->has_rb_shift = 1; dl_dci->rb_shift = 0; dl_dci->n_ndi = 1; - dl_dci->ndi = 1;//(uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_ndi); - dl_dci->ndi[0] = 1; + dl_dci->ndi = 1; + dl_dci->ndi[0] = 1-UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid];; dl_dci->n_rv = 1; dl_dci->rv = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_rv); dl_dci->rv[0] = round&3; @@ -952,14 +947,12 @@ schedule_ue_spec_default( dl_dci->n_mcs = 1; dl_dci->mcs = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_mcs); dl_dci->mcs[0] = mcs; + dl_dci->n_tbs_size = 1; + dl_dci->tbs_size = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_tbs_size); + dl_dci->tbs_size[0] = dci_tbs; if (frame_parms[CC_id]->frame_type == TDD) { dl_dci->has_dai = 1; dl_dci->dai = (UE_list->UE_template[CC_id][UE_id].DAI-1)&3; - LOG_D(MAC,"[eNB %d] Retransmission CC_id %d : harq_pid %d, round %d, dai %d\n", - mod_id, CC_id, harq_pid, round,(UE_list->UE_template[CC_id][UE_id].DAI-1)); - } else { - LOG_D(MAC,"[eNB %d] Retransmission CC_id %d : harq_pid %d, round %d\n", - mod_id, CC_id, harq_pid, round); } if(ue_sched_ctl->dl_pow_off[CC_id] == 2) { @@ -985,7 +978,7 @@ schedule_ue_spec_default( dl_dci->rb_shift = 0; dl_dci->n_ndi = 1; dl_dci->ndi = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_ndi); - dl_dci->ndi[0] = 1; + dl_dci->ndi[0] = 1-UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid];; dl_dci->n_rv = 1; dl_dci->rv = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_rv); dl_dci->rv[0] = round&3; @@ -997,11 +990,6 @@ schedule_ue_spec_default( if (frame_parms[CC_id]->frame_type == TDD) { dl_dci->has_dai = 1; dl_dci->dai = (UE_list->UE_template[CC_id][UE_id].DAI-1)&3; - LOG_D(MAC,"[eNB %d] Retransmission CC_id %d : harq_pid %d, round %d, dai %d\n", - mod_id, CC_id, harq_pid, round,(UE_list->UE_template[CC_id][UE_id].DAI-1)); - } else { - LOG_D(MAC,"[eNB %d] Retransmission CC_id %d : harq_pid %d, round %d\n", - mod_id, CC_id, harq_pid, round); } dl_dci->has_dl_power_offset = 1; @@ -1011,14 +999,14 @@ schedule_ue_spec_default( break; } // Toggle NDI for next time - //LOG_D(MAC,"CC_id %d Frame %d, subframeP %d: Toggling Format1 NDI for UE %d (rnti %x/%d) oldNDI %d\n", - // CC_id, frame, subframe, UE_id, - // UE_list->UE_template[CC_id][UE_id].rnti,harq_pid, UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]); - //UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]=1-UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]; + LOG_D(MAC,"CC_id %d Frame %d, subframeP %d: Toggling Format1 NDI for UE %d (rnti %x/%d) oldNDI %d\n", + CC_id, frame, subframe, UE_id, + UE_list->UE_template[CC_id][UE_id].rnti,harq_pid, UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]); + UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]=1-UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]; // Increase the pointer for the number of scheduled UEs num_ues_added++; - } else { // There is no data from RLC or MAC header, so don't schedule + } else { // There is no data from RLC or MAC header, so don't schedule } } @@ -1047,7 +1035,6 @@ void apply_scheduling_decisions(mid_t mod_id, uint8_t CC_id; int UE_id; - uint16_t nCCE[MAX_NUM_CCs]; int N_RBG[MAX_NUM_CCs]; unsigned char aggregation; mac_rlc_status_resp_t rlc_status; @@ -1097,7 +1084,7 @@ void apply_scheduling_decisions(mid_t mod_id, UE_id = find_ue(rnti, PHY_vars_eNB_g[mod_id][CC_id]); //NOTICE: Maybe later will not be required, once scheduler fully restructured - eNB_dlsch_info[mod_id][CC_id][UE_id].status = S_DL_WAITING; + //eNB_dlsch_info[mod_id][CC_id][UE_id].status = S_DL_WAITING; ue_sched_ctl = &UE_list->UE_sched_ctrl[UE_id]; eNB_UE_stats = mac_xface->get_eNB_UE_stats(mod_id,CC_id,rnti); @@ -1275,6 +1262,7 @@ void apply_scheduling_decisions(mid_t mod_id, ta_len = 0; } } + n_lc = dl_data->n_rlc_pdu; num_sdus = 0; @@ -1282,7 +1270,7 @@ void apply_scheduling_decisions(mid_t mod_id, for (i = 0; i < n_lc; i++) { lcid = dl_data->rlc_pdu[i]->rlc_pdu_tb[0]->logical_channel_id; rlc_size = dl_data->rlc_pdu[i]->rlc_pdu_tb[0]->size; - + LOG_D(MAC,"[TEST]Have to check %d channels\n", n_lc); if (rlc_size > 0) { rlc_status = mac_rlc_status_ind( mod_id, @@ -1294,11 +1282,13 @@ void apply_scheduling_decisions(mid_t mod_id, lcid, rlc_size); // transport block set size - sdu_lengths[i]=0; + sdu_lengths[i] = 0; LOG_D(MAC,"[eNB %d] Frame %d, LCID %d, CC_id %d, Requesting %d bytes from RLC (RRC message)\n", mod_id, frame, lcid, CC_id, rlc_size); + LOG_D(MAC, "[TEST] Have %d bytes in buffer DCCH during second call\n", rlc_status.bytes_in_buffer); + sdu_lengths[i] += mac_rlc_data_req( mod_id, rnti, @@ -1309,6 +1299,8 @@ void apply_scheduling_decisions(mid_t mod_id, lcid, (char *)&dlsch_buffer[sdu_lengths[i]]); + LOG_D(MAC, "[TEST] This is what I actuallty got %d\n", sdu_lengths[i]); + LOG_D(MAC,"[eNB %d][DCCH] CC_id %d Got %d bytes from RLC\n",mod_id, CC_id, sdu_lengths[i]); sdu_length_total += sdu_lengths[i]; sdu_lcids[i] = lcid; @@ -1331,72 +1323,58 @@ void apply_scheduling_decisions(mid_t mod_id, } // SDU creation end - if (header_len_dtch==0) { - header_len_dcch = (header_len_dcch >0) ? 1 : header_len_dcch; // remove length field - } else { - header_len_dtch = (header_len_dtch > 0) ? 1 :header_len_dtch; // remove length field for the last SDU - } + if (((sdu_length_total + header_len_dcch + header_len_dtch) > 0)) { - // there is a payload - if (((sdu_length_total + header_len_dcch + header_len_dtch ) > 0)) { - if ((TBS - header_len_dcch - header_len_dtch - sdu_length_total - ta_len) <= 2) { - padding = (TBS - header_len_dcch - header_len_dtch - sdu_length_total - ta_len); - post_padding = 0; - } else { - padding = 0; + header_len_dcch_tmp = header_len_dcch; + header_len_dtch_tmp = header_len_dtch; + + if (header_len_dtch==0) { + header_len_dcch = (header_len_dcch >0) ? 1 : header_len_dcch; // remove length field + } else { + header_len_dtch = (header_len_dtch > 0) ? 1 :header_len_dtch; // remove length field for the last SDU + } + + // there is a payload + LOG_D(MAC, "[TEST] This is the padding %d\n", TBS - header_len_dcch - header_len_dtch - sdu_length_total - ta_len); + if (((sdu_length_total + header_len_dcch + header_len_dtch ) > 0)) { + if ((TBS - header_len_dcch - header_len_dtch - sdu_length_total - ta_len) <= 2) { + padding = (TBS - header_len_dcch - header_len_dtch - sdu_length_total - ta_len); + post_padding = 0; + } else { + padding = 0; - // adjust the header len - if (header_len_dtch==0) { - header_len_dcch = header_len_dcch_tmp; - } else { //if (( header_len_dcch==0)&&((header_len_dtch==1)||(header_len_dtch==2))) - header_len_dtch = header_len_dtch_tmp; - } - - post_padding = TBS - sdu_length_total - header_len_dcch - header_len_dtch - ta_len ; // 1 is for the postpadding header - } - } - - uint8_t update_TA=4; - - switch (frame_parms[CC_id]->N_RB_DL) { - case 6: - update_TA = 1; - break; - - case 25: - update_TA = 4; - break; - - case 50: - update_TA = 8; - break; - - case 100: - update_TA = 16; - break; - } - - if (ta_len > 0) { - ta_update = eNB_UE_stats->timing_advance_update/update_TA; - } else { - ta_update = 0; - } - /*#else - ta_update = 0; - #endif*/ - - offset = generate_dlsch_header((unsigned char*)UE_list->DLSCH_pdu[CC_id][0][UE_id].payload[0], - // offset = generate_dlsch_header((unsigned char*)eNB_mac_inst[0].DLSCH_pdu[0][0].payload[0], - num_sdus, //num_sdus - sdu_lengths, // - sdu_lcids, - 255, // no drx - ta_update, // timing advance - NULL, // contention res id - padding, - post_padding); - - + // adjust the header len + if (header_len_dtch==0) { + header_len_dcch = header_len_dcch_tmp; + } else { //if (( header_len_dcch==0)&&((header_len_dtch==1)||(header_len_dtch==2))) + header_len_dtch = header_len_dtch_tmp; + } + + post_padding = TBS - sdu_length_total - header_len_dcch - header_len_dtch - ta_len ; // 1 is for the postpadding header + } + } + + LOG_D(MAC, "[TEST] This is the current SDU length %d and this is the TBS %d\n", sdu_length_total, TBS); + + + if (ta_len > 0) { + ta_update = ue_sched_ctl->ta_update; + } else { + ta_update = 0; + } + + offset = generate_dlsch_header((unsigned char*)UE_list->DLSCH_pdu[CC_id][0][UE_id].payload[0], + // offset = generate_dlsch_header((unsigned char*)eNB_mac_inst[0].DLSCH_pdu[0][0].payload[0], + num_sdus, //num_sdus + sdu_lengths, // + sdu_lcids, + 255, // no drx + ta_update, // timing advance + NULL, // contention res id + padding, + post_padding); + + #ifdef DEBUG_eNB_SCHEDULER LOG_T(MAC,"[eNB %d] First 16 bytes of DLSCH : \n"); @@ -1428,9 +1406,13 @@ void apply_scheduling_decisions(mid_t mod_id, eNB->eNB_stats[CC_id].dlsch_bytes_tx+=sdu_length_total; eNB->eNB_stats[CC_id].dlsch_pdus_tx+=1; + UE_list->eNB_UE_stats[CC_id][UE_id].crnti= rnti; + UE_list->eNB_UE_stats[CC_id][UE_id].rrc_status=mac_eNB_get_rrc_status(mod_id, rnti); + UE_list->eNB_UE_stats[CC_id][UE_id].harq_pid = harq_pid; + UE_list->eNB_UE_stats[CC_id][UE_id].harq_round = round; + UE_list->eNB_UE_stats[CC_id][UE_id].rbs_used = nb_rb; UE_list->eNB_UE_stats[CC_id][UE_id].total_rbs_used += nb_rb; - UE_list->eNB_UE_stats[CC_id][UE_id].ncce_used = nCCE[CC_id]; UE_list->eNB_UE_stats[CC_id][UE_id].dlsch_mcs1=dl_dci->mcs[0]; UE_list->eNB_UE_stats[CC_id][UE_id].dlsch_mcs2=dl_dci->mcs[0]; UE_list->eNB_UE_stats[CC_id][UE_id].TBS = TBS; @@ -1441,6 +1423,10 @@ void apply_scheduling_decisions(mid_t mod_id, UE_list->eNB_UE_stats[CC_id][UE_id].total_num_pdus+=1; // TODO + + } + + } else { // No need to create anything apart of DCI in case of retransmission diff --git a/openair2/LAYER2/MAC/eNB_scheduler.c b/openair2/LAYER2/MAC/eNB_scheduler.c index 21e9337dbb..f0e0a9f84b 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler.c +++ b/openair2/LAYER2/MAC/eNB_scheduler.c @@ -59,12 +59,18 @@ //#include "LAYER2/MAC/pre_processor.c" #include "pdcp.h" +//Agent-related headers +#include "ENB_APP/enb_agent_extern.h" +#include "ENB_APP/enb_agent_mac.h" + #if defined(ENABLE_ITTI) # include "intertask_interface.h" #endif #define ENABLE_MAC_PAYLOAD_DEBUG #define DEBUG_eNB_SCHEDULER 1 +//#define ENABLE_ENB_AGENT_DL_SCHEDULER + //#define DEBUG_HEADER_PARSING 1 //#define DEBUG_PACKET_TRACE 1 @@ -99,6 +105,8 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, UE_list_t *UE_list=&eNB_mac_inst[module_idP].UE_list; rnti_t rnti; + Protocol__ProgranMessage *msg; + LOG_D(MAC,"[eNB %d] Frame %d, Subframe %d, entering MAC scheduler (UE_list->head %d)\n",module_idP, frameP, subframeP,UE_list->head); start_meas(&eNB_mac_inst[module_idP].eNB_scheduler); @@ -252,10 +260,27 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, (mac_xface->lte_frame_parms->tdd_config == 6)) { //schedule_ulsch(module_idP,frameP,cooperation_flag,subframeP,4);//,calibration_flag); } - +#ifndef ENABLE_ENB_AGENT_DL_SCHEDULER schedule_ue_spec(module_idP,frameP,subframeP,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); - +#else + if (mac_agent_registered[module_idP]) { + enb_agent_mac_create_empty_dl_config(module_idP, &msg); + agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( + module_idP, + frameP, + subframeP, + mbsfn_status, + msg); + + apply_scheduling_decisions(module_idP, + frameP, + subframeP, + mbsfn_status, + msg); + enb_agent_mac_destroy_dl_config(msg); + } +#endif break; case 1: @@ -267,12 +292,16 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, case 0: case 1: schedule_ulsch(module_idP,frameP,cooperation_flag,subframeP,7); +#ifndef ENABLE_ENB_AGENT_DL_SCHEDULER fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); +#endif break; case 6: schedule_ulsch(module_idP,frameP,cooperation_flag,subframeP,8); +#ifndef ENABLE_ENB_AGENT_DL_SCHEDULER fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); +#endif break; default: @@ -280,8 +309,27 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, } } else { //FDD schedule_ulsch(module_idP,frameP,cooperation_flag,1,5); +#ifndef ENABLE_ENB_AGENT_DL_SCHEDULER schedule_ue_spec(module_idP,frameP,subframeP,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); +#else + if (mac_agent_registered[module_idP]) { + enb_agent_mac_create_empty_dl_config(module_idP, &msg); + agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( + module_idP, + frameP, + subframeP, + mbsfn_status, + msg); + + apply_scheduling_decisions(module_idP, + frameP, + subframeP, + mbsfn_status, + msg); + enb_agent_mac_destroy_dl_config(msg); + } +#endif } break; @@ -292,8 +340,27 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, // FDD, normal UL/DLSCH if (mac_xface->lte_frame_parms->frame_type == FDD) { //FDD schedule_ulsch(module_idP,frameP,cooperation_flag,2,6); +#ifndef ENABLE_ENB_AGENT_DL_SCHEDULER schedule_ue_spec(module_idP,frameP,subframeP,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); +#else + if (mac_agent_registered[module_idP]) { + enb_agent_mac_create_empty_dl_config(module_idP, &msg); + agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( + module_idP, + frameP, + subframeP, + mbsfn_status, + msg); + + apply_scheduling_decisions(module_idP, + frameP, + subframeP, + mbsfn_status, + msg); + enb_agent_mac_destroy_dl_config(msg); + } +#endif } break; @@ -310,8 +377,27 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, // no break here! case 5: +#ifndef ENABLE_ENB_AGENT_DL_SCHEDULER schedule_ue_spec(module_idP,frameP,subframeP,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); +#else + if (mac_agent_registered[module_idP]) { + enb_agent_mac_create_empty_dl_config(module_idP, &msg); + agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( + module_idP, + frameP, + subframeP, + mbsfn_status, + msg); + + apply_scheduling_decisions(module_idP, + frameP, + subframeP, + mbsfn_status, + msg); + enb_agent_mac_destroy_dl_config(msg); + } +#endif break; default: @@ -320,8 +406,27 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, } else { //FDD schedule_ulsch(module_idP,frameP,cooperation_flag,3,7); +#ifndef ENABLE_ENB_AGENT_DL_SCHEDULER schedule_ue_spec(module_idP,frameP,subframeP,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); +#else + if (mac_agent_registered[module_idP]) { + enb_agent_mac_create_empty_dl_config(module_idP, &msg); + agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( + module_idP, + frameP, + subframeP, + mbsfn_status, + msg); + + apply_scheduling_decisions(module_idP, + frameP, + subframeP, + mbsfn_status, + msg); + enb_agent_mac_destroy_dl_config(msg); + } +#endif } break; @@ -345,9 +450,27 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, // no break here! case 5: - +#ifndef ENABLE_ENB_AGENT_DL_SCHEDULER schedule_ue_spec(module_idP,frameP,subframeP,mbsfn_status); - fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); + fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); +#else + if (mac_agent_registered[module_idP]) { + enb_agent_mac_create_empty_dl_config(module_idP, &msg); + agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( + module_idP, + frameP, + subframeP, + mbsfn_status, + msg); + + apply_scheduling_decisions(module_idP, + frameP, + subframeP, + mbsfn_status, + msg); + enb_agent_mac_destroy_dl_config(msg); + } +#endif break; default: @@ -358,8 +481,27 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, // schedule_RA(module_idP,frameP, subframeP, 0); schedule_ulsch(module_idP, frameP, cooperation_flag, 4, 8); +#ifndef ENABLE_ENB_AGENT_DL_SCHEDULER schedule_ue_spec(module_idP, frameP, subframeP, mbsfn_status); fill_DLSCH_dci(module_idP, frameP, subframeP, mbsfn_status); +#else + if (mac_agent_registered[module_idP]) { + enb_agent_mac_create_empty_dl_config(module_idP, &msg); + agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( + module_idP, + frameP, + subframeP, + mbsfn_status, + msg); + + apply_scheduling_decisions(module_idP, + frameP, + subframeP, + mbsfn_status, + msg); + enb_agent_mac_destroy_dl_config(msg); + } +#endif } } @@ -376,15 +518,55 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, if (mac_xface->lte_frame_parms->frame_type == FDD) { schedule_RA(module_idP,frameP,subframeP,1); schedule_ulsch(module_idP,frameP,cooperation_flag,5,9); +#ifndef ENABLE_ENB_AGENT_DL_SCHEDULER schedule_ue_spec(module_idP, frameP, subframeP, mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); +#else + if (mac_agent_registered[module_idP]) { + enb_agent_mac_create_empty_dl_config(module_idP, &msg); + agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( + module_idP, + frameP, + subframeP, + mbsfn_status, + msg); + + apply_scheduling_decisions(module_idP, + frameP, + subframeP, + mbsfn_status, + msg); + enb_agent_mac_destroy_dl_config(msg); + } +#endif } else if ((mac_xface->lte_frame_parms->tdd_config == 0) || // TDD Config 0 (mac_xface->lte_frame_parms->tdd_config == 6)) { // TDD Config 6 //schedule_ulsch(module_idP,cooperation_flag,subframeP); +#ifndef ENABLE_ENB_AGENT_DL_SCHEDULER fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); +#endif } else { +#ifndef ENABLE_ENB_AGENT_DL_SCHEDULER schedule_ue_spec(module_idP,frameP,subframeP,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); +#else + if (mac_agent_registered[module_idP]) { + enb_agent_mac_create_empty_dl_config(module_idP, &msg); + agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( + module_idP, + frameP, + subframeP, + mbsfn_status, + msg); + + apply_scheduling_decisions(module_idP, + frameP, + subframeP, + mbsfn_status, + msg); + enb_agent_mac_destroy_dl_config(msg); + } +#endif } break; @@ -402,25 +584,67 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, case 1: schedule_ulsch(module_idP,frameP,cooperation_flag,subframeP,2); // schedule_ue_spec(module_idP,frameP,subframeP,mbsfn_status); +#ifndef ENABLE_ENB_AGENT_DL_SCHEDULER fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); +#endif break; case 6: schedule_ulsch(module_idP,frameP,cooperation_flag,subframeP,3); // schedule_ue_spec(module_idP,frameP,subframeP,mbsfn_status); +#ifndef ENABLE_ENB_AGENT_DL_SCHEDULER fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); +#endif break; case 5: schedule_RA(module_idP,frameP,subframeP,2); +#ifndef ENABLE_ENB_AGENT_DL_SCHEDULER schedule_ue_spec(module_idP,frameP,subframeP,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); +#else + if (mac_agent_registered[module_idP]) { + enb_agent_mac_create_empty_dl_config(module_idP, &msg); + agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( + module_idP, + frameP, + subframeP, + mbsfn_status, + msg); + + apply_scheduling_decisions(module_idP, + frameP, + subframeP, + mbsfn_status, + msg); + enb_agent_mac_destroy_dl_config(msg); + } +#endif break; case 3: case 4: +#ifndef ENABLE_ENB_AGENT_DL_SCHEDULER schedule_ue_spec(module_idP,frameP,subframeP,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); +#else + if (mac_agent_registered[module_idP]) { + enb_agent_mac_create_empty_dl_config(module_idP, &msg); + agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( + module_idP, + frameP, + subframeP, + mbsfn_status, + msg); + + apply_scheduling_decisions(module_idP, + frameP, + subframeP, + mbsfn_status, + msg); + enb_agent_mac_destroy_dl_config(msg); + } +#endif break; default: @@ -428,8 +652,27 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, } } else { //FDD // schedule_ulsch(module_idP,frameP,cooperation_flag,6,0); +#ifndef ENABLE_ENB_AGENT_DL_SCHEDULER schedule_ue_spec(module_idP,frameP,subframeP,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); +#else + if (mac_agent_registered[module_idP]) { + enb_agent_mac_create_empty_dl_config(module_idP, &msg); + agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( + module_idP, + frameP, + subframeP, + mbsfn_status, + msg); + + apply_scheduling_decisions(module_idP, + frameP, + subframeP, + mbsfn_status, + msg); + enb_agent_mac_destroy_dl_config(msg); + } +#endif } break; @@ -443,13 +686,51 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, case 3: case 4: schedule_RA(module_idP,frameP,subframeP,3); // 3 = Msg3 subframeP, not +#ifndef ENABLE_ENB_AGENT_DL_SCHEDULER schedule_ue_spec(module_idP,frameP,subframeP,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); +#else + if (mac_agent_registered[module_idP]) { + enb_agent_mac_create_empty_dl_config(module_idP, &msg); + agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( + module_idP, + frameP, + subframeP, + mbsfn_status, + msg); + + apply_scheduling_decisions(module_idP, + frameP, + subframeP, + mbsfn_status, + msg); + enb_agent_mac_destroy_dl_config(msg); + } +#endif break; case 5: +#ifndef ENABLE_ENB_AGENT_DL_SCHEDULER schedule_ue_spec(module_idP,frameP,subframeP,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); +#else + if (mac_agent_registered[module_idP]) { + enb_agent_mac_create_empty_dl_config(module_idP, &msg); + agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( + module_idP, + frameP, + subframeP, + mbsfn_status, + msg); + + apply_scheduling_decisions(module_idP, + frameP, + subframeP, + mbsfn_status, + msg); + enb_agent_mac_destroy_dl_config(msg); + } +#endif break; default: @@ -457,8 +738,27 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, } } else { //FDD //schedule_ulsch(module_idP,frameP,cooperation_flag,7,1); +#ifndef ENABLE_ENB_AGENT_DL_SCHEDULER schedule_ue_spec(module_idP,frameP,subframeP,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); +#else + if (mac_agent_registered[module_idP]) { + enb_agent_mac_create_empty_dl_config(module_idP, &msg); + agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( + module_idP, + frameP, + subframeP, + mbsfn_status, + msg); + + apply_scheduling_decisions(module_idP, + frameP, + subframeP, + mbsfn_status, + msg); + enb_agent_mac_destroy_dl_config(msg); + } +#endif } break; @@ -477,8 +777,27 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, // schedule_RA(module_idP,subframeP); schedule_ulsch(module_idP,frameP,cooperation_flag,subframeP,2); +#ifndef ENABLE_ENB_AGENT_DL_SCHEDULER schedule_ue_spec(module_idP,frameP,subframeP,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); +#else + if (mac_agent_registered[module_idP]) { + enb_agent_mac_create_empty_dl_config(module_idP, &msg); + agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( + module_idP, + frameP, + subframeP, + mbsfn_status, + msg); + + apply_scheduling_decisions(module_idP, + frameP, + subframeP, + mbsfn_status, + msg); + enb_agent_mac_destroy_dl_config(msg); + } +#endif break; default: @@ -486,8 +805,27 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, } } else { //FDD //schedule_ulsch(module_idP,frameP,cooperation_flag,8,2); +#ifndef ENABLE_ENB_AGENT_DL_SCHEDULER schedule_ue_spec(module_idP,frameP,subframeP,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); +#else + if (mac_agent_registered[module_idP]) { + enb_agent_mac_create_empty_dl_config(module_idP, &msg); + agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( + module_idP, + frameP, + subframeP, + mbsfn_status, + msg); + + apply_scheduling_decisions(module_idP, + frameP, + subframeP, + mbsfn_status, + msg); + enb_agent_mac_destroy_dl_config(msg); + } +#endif } break; @@ -500,29 +838,105 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, case 1: schedule_ulsch(module_idP,frameP,cooperation_flag,subframeP,3); schedule_RA(module_idP,frameP,subframeP,7); // 7 = Msg3 subframeP, not +#ifndef ENABLE_ENB_AGENT_DL_SCHEDULER schedule_ue_spec(module_idP,frameP,subframeP,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); +#else + if (mac_agent_registered[module_idP]) { + enb_agent_mac_create_empty_dl_config(module_idP, &msg); + agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( + module_idP, + frameP, + subframeP, + mbsfn_status, + msg); + + apply_scheduling_decisions(module_idP, + frameP, + subframeP, + mbsfn_status, + msg); + enb_agent_mac_destroy_dl_config(msg); + } +#endif break; case 3: case 4: schedule_ulsch(module_idP,frameP,cooperation_flag,subframeP,3); +#ifndef ENABLE_ENB_AGENT_DL_SCHEDULER schedule_ue_spec(module_idP,frameP,subframeP,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); +#else + if (mac_agent_registered[module_idP]) { + enb_agent_mac_create_empty_dl_config(module_idP, &msg); + agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( + module_idP, + frameP, + subframeP, + mbsfn_status, + msg); + + apply_scheduling_decisions(module_idP, + frameP, + subframeP, + mbsfn_status, + msg); + enb_agent_mac_destroy_dl_config(msg); + } +#endif break; case 6: schedule_ulsch(module_idP,frameP,cooperation_flag,subframeP,4); //schedule_RA(module_idP,frameP,subframeP); +#ifndef ENABLE_ENB_AGENT_DL_SCHEDULER schedule_ue_spec(module_idP,frameP,subframeP,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); +#else + if (mac_agent_registered[module_idP]) { + enb_agent_mac_create_empty_dl_config(module_idP, &msg); + agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( + module_idP, + frameP, + subframeP, + mbsfn_status, + msg); + + apply_scheduling_decisions(module_idP, + frameP, + subframeP, + mbsfn_status, + msg); + enb_agent_mac_destroy_dl_config(msg); + } +#endif break; case 2: case 5: //schedule_RA(module_idP,frameP,subframeP); +#ifndef ENABLE_ENB_AGENT_DL_SCHEDULER schedule_ue_spec(module_idP,frameP,subframeP,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); +#else + if (mac_agent_registered[module_idP]) { + enb_agent_mac_create_empty_dl_config(module_idP, &msg); + agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( + module_idP, + frameP, + subframeP, + mbsfn_status, + msg); + + apply_scheduling_decisions(module_idP, + frameP, + subframeP, + mbsfn_status, + msg); + enb_agent_mac_destroy_dl_config(msg); + } +#endif break; default: @@ -530,8 +944,27 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, } } else { //FDD // schedule_ulsch(module_idP,frameP,cooperation_flag,9,3); +#ifndef ENABLE_ENB_AGENT_DL_SCHEDULER schedule_ue_spec(module_idP,frameP,subframeP,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); +#else + if (mac_agent_registered[module_idP]) { + enb_agent_mac_create_empty_dl_config(module_idP, &msg); + agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( + module_idP, + frameP, + subframeP, + mbsfn_status, + msg); + + apply_scheduling_decisions(module_idP, + frameP, + subframeP, + mbsfn_status, + msg); + enb_agent_mac_destroy_dl_config(msg); + } +#endif } break; diff --git a/openair2/LAYER2/MAC/proto.h b/openair2/LAYER2/MAC/proto.h index c522d5920e..faf0bf9954 100644 --- a/openair2/LAYER2/MAC/proto.h +++ b/openair2/LAYER2/MAC/proto.h @@ -135,7 +135,6 @@ void schedule_ue_spec(module_id_t module_idP,frame_t frameP,sub_frame_t subframe //To be used by the agent void schedule_ue_spec_default(mid_t mod_id, uint32_t frame, uint32_t subframe, - unsigned int *nb_rb_used, unsigned int *nCCE_used, int *mbsfn_flag, Protocol__ProgranMessage *dl_info); /** \brief Function for UE/PHY to compute PUSCH transmit power in power-control procedure. From 07edce1712e61db5e8d72c908feb59745ad4653c Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Tue, 2 Feb 2016 16:39:39 +0000 Subject: [PATCH 081/349] Changes to the progran default scheduler --- .../LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c | 264 +++++++++--------- openair2/LAYER2/MAC/eNB_scheduler.c | 2 +- 2 files changed, 133 insertions(+), 133 deletions(-) diff --git a/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c b/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c index a4fbac6de2..fcf866d657 100644 --- a/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c +++ b/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c @@ -115,6 +115,7 @@ schedule_ue_spec_default( Protocol__PrpDlData *dl_data[NUM_MAX_UE]; int num_ues_added = 0; + int channels_added = 0; Protocol__PrpDlDci *dl_dci; Protocol__PrpRlcPdu *rlc_pdus[11]; @@ -237,11 +238,6 @@ schedule_ue_spec_default( harq_pid = ue_sched_ctl->harq_pid[CC_id]; round = ue_sched_ctl->round[CC_id]; - /* TODO: Must add these stats (probably in the apply_scheduling function) */ - //UE_list->eNB_UE_stats[CC_id][UE_id].crnti= rnti; - //UE_list->eNB_UE_stats[CC_id][UE_id].rrc_status=mac_eNB_get_rrc_status(mod_id, rnti); - //UE_list->eNB_UE_stats[CC_id][UE_id].harq_pid = harq_pid; - //UE_list->eNB_UE_stats[CC_id][UE_id].harq_round = round; sdu_length_total=0; @@ -363,10 +359,10 @@ schedule_ue_spec_default( dl_dci->rb_shift = 0; dl_dci->n_ndi = 1; dl_dci->ndi = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_ndi); - dl_dci->ndi[0] = 0; + dl_dci->ndi[0] = 1; dl_dci->n_rv = 1; dl_dci->rv = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_rv); - dl_dci->rv[0] = round&3; + dl_dci->rv[0] = (round+1) % 4; if (frame_parms[CC_id]->frame_type == TDD) { dl_dci->has_dai = 1; dl_dci->dai = (UE_list->UE_template[CC_id][UE_id].DAI-1)&3; @@ -401,8 +397,8 @@ schedule_ue_spec_default( dl_dci->ndi[1] = 0; dl_dci->n_rv = 2; dl_dci->rv = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_rv); - dl_dci->rv[0] = round&3; - dl_dci->rv[1] = round&3; + dl_dci->rv[0] = (round+1) % 4; + dl_dci->rv[1] = (round+1) % 4; if (frame_parms[CC_id]->frame_type == TDD) { dl_dci->has_dai = 1; dl_dci->dai = (UE_list->UE_template[CC_id][UE_id].DAI-1)&3; @@ -437,7 +433,7 @@ schedule_ue_spec_default( dl_dci->dai = (UE_list->UE_template[CC_id][UE_id].DAI-1)&3; dl_dci->n_rv = 1; dl_dci->rv = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_rv); - dl_dci->rv[0] = round&3; + dl_dci->rv[0] = (round + 1) % 4; if(ue_sched_ctl->dl_pow_off[CC_id] == 2) { ue_sched_ctl->dl_pow_off[CC_id] = 1; @@ -471,28 +467,12 @@ schedule_ue_spec_default( dl_dci->dai = (UE_list->UE_template[CC_id][UE_id].DAI-1)&3; dl_dci->n_rv = 1; dl_dci->rv = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_rv); - dl_dci->rv[0] = round&3; + dl_dci->rv[0] = (round + 1) % 4; dl_dci->has_dl_power_offset = 1; dl_dci->dl_power_offset = ue_sched_ctl->dl_pow_off[CC_id]; break; } - - /*We now probably don't need this*/ - /* add_ue_dlsch_info(mod_id, */ - /* CC_id, */ - /* UE_id, */ - /* subframe, */ - /* S_DL_SCHEDULED); */ - - //eNB_UE_stats->dlsch_trials[round]++; - //UE_list->eNB_UE_stats[CC_id][UE_id].num_retransmission+=1; - //UE_list->eNB_UE_stats[CC_id][UE_id].rbs_used_retx=nb_rb; - //UE_list->eNB_UE_stats[CC_id][UE_id].total_rbs_used_retx+=nb_rb; - //UE_list->eNB_UE_stats[CC_id][UE_id].ncce_used_retx=nCCECC_id]; - //UE_list->eNB_UE_stats[CC_id][UE_id].dlsch_mcs1=eNB_UE_stats->dlsch_mcs1; - //UE_list->eNB_UE_stats[CC_id][UE_id].dlsch_mcs2=eNB_UE_stats->dlsch_mcs1; - num_ues_added += 1; } else { LOG_D(MAC,"[eNB %d] Frame %d CC_id %d : don't schedule UE %d, its retransmission takes more resources than we have\n", @@ -529,6 +509,7 @@ schedule_ue_spec_default( header_len_dcch = 2; // 2 bytes DCCH SDU subheader // Need to see if we have space for data from this channel + if ( TBS-ta_len-header_len_dcch > 0 ) { //If we have space, we need to see how much data we can request at most (if any available) @@ -543,26 +524,28 @@ schedule_ue_spec_default( //If data are available in the DCCH if (rlc_status.bytes_in_buffer > 0) { - LOG_D(MAC, "[TEST]Have %d bytes in buffer DCCH during first call\n", rlc_status.bytes_in_buffer); + LOG_D(MAC, "[TEST]Have %d bytes in buffer during first call\n", rlc_status.bytes_in_buffer); //Fill in as much as possible data_to_request = cmin(dci_tbs-ta_len-header_len_dcch, rlc_status.bytes_in_buffer) + 1; LOG_D(MAC, "[TEST]Will request %d \n", data_to_request); - rlc_pdus[0] = (Protocol__PrpRlcPdu *) malloc(sizeof(Protocol__PrpRlcPdu)); - protocol__prp_rlc_pdu__init(rlc_pdus[0]); - rlc_pdus[0]->n_rlc_pdu_tb = 2; - rlc_pdus[0]->rlc_pdu_tb = (Protocol__PrpRlcPduTb **) malloc(sizeof(Protocol__PrpRlcPduTb *) * 2); - rlc_pdus[0]->rlc_pdu_tb[0] = (Protocol__PrpRlcPduTb *) malloc(sizeof(Protocol__PrpRlcPduTb)); - rlc_pdus[0]->rlc_pdu_tb[0]->has_logical_channel_id = 1; - rlc_pdus[0]->rlc_pdu_tb[0]->logical_channel_id = DCCH; - rlc_pdus[0]->rlc_pdu_tb[0]->has_size = 1; - rlc_pdus[0]->rlc_pdu_tb[0]->size = data_to_request; - rlc_pdus[0]->rlc_pdu_tb[1] = (Protocol__PrpRlcPduTb *) malloc(sizeof(Protocol__PrpRlcPduTb)); - rlc_pdus[0]->rlc_pdu_tb[1]->has_logical_channel_id = 1; - rlc_pdus[0]->rlc_pdu_tb[1]->logical_channel_id = DCCH; - rlc_pdus[0]->rlc_pdu_tb[1]->has_size = 1; - rlc_pdus[0]->rlc_pdu_tb[1]->size = data_to_request; + rlc_pdus[channels_added] = (Protocol__PrpRlcPdu *) malloc(sizeof(Protocol__PrpRlcPdu)); + protocol__prp_rlc_pdu__init(rlc_pdus[channels_added]); + rlc_pdus[channels_added]->n_rlc_pdu_tb = 2; + rlc_pdus[channels_added]->rlc_pdu_tb = (Protocol__PrpRlcPduTb **) malloc(sizeof(Protocol__PrpRlcPduTb *) * 2); + rlc_pdus[channels_added]->rlc_pdu_tb[0] = (Protocol__PrpRlcPduTb *) malloc(sizeof(Protocol__PrpRlcPduTb)); + protocol__prp_rlc_pdu_tb__init(rlc_pdus[channels_added]->rlc_pdu_tb[0]); + rlc_pdus[channels_added]->rlc_pdu_tb[0]->has_logical_channel_id = 1; + rlc_pdus[channels_added]->rlc_pdu_tb[0]->logical_channel_id = DCCH; + rlc_pdus[channels_added]->rlc_pdu_tb[0]->has_size = 1; + rlc_pdus[channels_added]->rlc_pdu_tb[0]->size = data_to_request; + rlc_pdus[channels_added]->rlc_pdu_tb[1] = (Protocol__PrpRlcPduTb *) malloc(sizeof(Protocol__PrpRlcPduTb)); + protocol__prp_rlc_pdu_tb__init(rlc_pdus[channels_added]->rlc_pdu_tb[1]); + rlc_pdus[channels_added]->rlc_pdu_tb[1]->has_logical_channel_id = 1; + rlc_pdus[channels_added]->rlc_pdu_tb[1]->logical_channel_id = DCCH; + rlc_pdus[channels_added]->rlc_pdu_tb[1]->has_size = 1; + rlc_pdus[channels_added]->rlc_pdu_tb[1]->size = data_to_request; dl_data[num_ues_added]->n_rlc_pdu++; - + channels_added++; //Set this to the max value that we might request sdu_length_total = data_to_request; } else { @@ -572,7 +555,7 @@ schedule_ue_spec_default( } // check for DCCH1 and update header information (assume 2 byte sub-header) - if (dci_tbs-ta_len-header_len_dcch-sdu_length_total > 0 ) { + if (dci_tbs-ta_len-header_len_dcch-sdu_length_total-2 > 0 ) { //If we have space, we need to see how much data we can request at most (if any are available) rlc_status = mac_rlc_status_ind(mod_id, @@ -581,33 +564,36 @@ schedule_ue_spec_default( frame, ENB_FLAG_YES, MBMS_FLAG_NO, - DCCH+1, - (dci_tbs-ta_len-header_len_dcch-sdu_length_total)); // transport block set size less allocations for timing advance and + DCCH1, + (dci_tbs-ta_len-header_len_dcch-sdu_length_total-2)); // transport block set size less allocations for timing advance and // DCCH SDU // If data are available in DCCH1 if (rlc_status.bytes_in_buffer > 0) { + //Add this subheader header_len_dcch += 2; //Fill in as much as possible data_to_request = cmin(dci_tbs-ta_len-header_len_dcch-sdu_length_total, rlc_status.bytes_in_buffer) + 1; - rlc_pdus[1] = (Protocol__PrpRlcPdu *) malloc(sizeof(Protocol__PrpRlcPdu)); - protocol__prp_rlc_pdu__init(rlc_pdus[1]); - rlc_pdus[1]->n_rlc_pdu_tb = 2; - rlc_pdus[1]->rlc_pdu_tb = (Protocol__PrpRlcPduTb **) malloc(sizeof(Protocol__PrpRlcPduTb *) * 2); - rlc_pdus[1]->rlc_pdu_tb[0] = (Protocol__PrpRlcPduTb *) malloc(sizeof(Protocol__PrpRlcPduTb)); - rlc_pdus[1]->rlc_pdu_tb[0]->has_logical_channel_id = 1; - rlc_pdus[1]->rlc_pdu_tb[0]->logical_channel_id = DCCH+1; - rlc_pdus[1]->rlc_pdu_tb[0]->has_size = 1; - rlc_pdus[1]->rlc_pdu_tb[0]->size = data_to_request; - rlc_pdus[1]->rlc_pdu_tb[1] = (Protocol__PrpRlcPduTb *) malloc(sizeof(Protocol__PrpRlcPduTb)); - rlc_pdus[1]->rlc_pdu_tb[1]->has_logical_channel_id = 1; - rlc_pdus[1]->rlc_pdu_tb[1]->logical_channel_id = DCCH+1; - rlc_pdus[1]->rlc_pdu_tb[1]->has_size = 1; - rlc_pdus[1]->rlc_pdu_tb[1]->size = data_to_request; + rlc_pdus[channels_added] = (Protocol__PrpRlcPdu *) malloc(sizeof(Protocol__PrpRlcPdu)); + protocol__prp_rlc_pdu__init(rlc_pdus[channels_added]); + rlc_pdus[channels_added]->n_rlc_pdu_tb = 2; + rlc_pdus[channels_added]->rlc_pdu_tb = (Protocol__PrpRlcPduTb **) malloc(sizeof(Protocol__PrpRlcPduTb *) * 2); + rlc_pdus[channels_added]->rlc_pdu_tb[0] = (Protocol__PrpRlcPduTb *) malloc(sizeof(Protocol__PrpRlcPduTb)); + protocol__prp_rlc_pdu_tb__init(rlc_pdus[channels_added]->rlc_pdu_tb[0]); + rlc_pdus[channels_added]->rlc_pdu_tb[0]->has_logical_channel_id = 1; + rlc_pdus[channels_added]->rlc_pdu_tb[0]->logical_channel_id = DCCH1; + rlc_pdus[channels_added]->rlc_pdu_tb[0]->has_size = 1; + rlc_pdus[channels_added]->rlc_pdu_tb[0]->size = data_to_request; + rlc_pdus[channels_added]->rlc_pdu_tb[1] = (Protocol__PrpRlcPduTb *) malloc(sizeof(Protocol__PrpRlcPduTb)); + protocol__prp_rlc_pdu_tb__init(rlc_pdus[channels_added]->rlc_pdu_tb[1]); + rlc_pdus[channels_added]->rlc_pdu_tb[1]->has_logical_channel_id = 1; + rlc_pdus[channels_added]->rlc_pdu_tb[1]->logical_channel_id = DCCH1; + rlc_pdus[channels_added]->rlc_pdu_tb[1]->has_size = 1; + rlc_pdus[channels_added]->rlc_pdu_tb[1]->size = data_to_request; dl_data[num_ues_added]->n_rlc_pdu++; - + channels_added++; sdu_length_total += data_to_request; } } @@ -615,7 +601,7 @@ schedule_ue_spec_default( // check for DTCH and update header information // here we should loop over all possible DTCH - header_len_dtch = 3; // 3 bytes DTCH SDU subheader + header_len_dtch = 3; // Assume max 3 bytes DTCH SDU subheader LOG_D(MAC,"[eNB %d], Frame %d, DTCH->DLSCH, CC_id %d, Checking RLC status (rab %d, tbs %d, len %d)\n", mod_id, frame, CC_id, DTCH, TBS, @@ -623,6 +609,8 @@ schedule_ue_spec_default( if (dci_tbs-ta_len-header_len_dcch-sdu_length_total-header_len_dtch > 0 ) { + LOG_D(MAC, "[TEST] This is how much we request at most during first call %d\n", dci_tbs-ta_len-header_len_dcch-sdu_length_total-header_len_dtch); + //If we have space, we need to see how much data we can request at most (if any are available) rlc_status = mac_rlc_status_ind(mod_id, rnti, @@ -639,33 +627,34 @@ schedule_ue_spec_default( //Fill what remains in the TB data_to_request = cmin(dci_tbs-ta_len-header_len_dcch-sdu_length_total-header_len_dtch, rlc_status.bytes_in_buffer) + 1; LOG_D(MAC, "[TEST]Will request %d \n", data_to_request); - rlc_pdus[2] = (Protocol__PrpRlcPdu *) malloc(sizeof(Protocol__PrpRlcPdu)); - protocol__prp_rlc_pdu__init(rlc_pdus[2]); - rlc_pdus[2]->n_rlc_pdu_tb = 2; - rlc_pdus[2]->rlc_pdu_tb = (Protocol__PrpRlcPduTb **) malloc(sizeof(Protocol__PrpRlcPduTb *) * 2); - rlc_pdus[2]->rlc_pdu_tb[0] = (Protocol__PrpRlcPduTb *) malloc(sizeof(Protocol__PrpRlcPduTb)); - rlc_pdus[2]->rlc_pdu_tb[0]->has_logical_channel_id = 1; - rlc_pdus[2]->rlc_pdu_tb[0]->logical_channel_id = DTCH; - rlc_pdus[2]->rlc_pdu_tb[0]->has_size = 1; - rlc_pdus[2]->rlc_pdu_tb[0]->size = data_to_request; - rlc_pdus[2]->rlc_pdu_tb[1] = (Protocol__PrpRlcPduTb *) malloc(sizeof(Protocol__PrpRlcPduTb)); - rlc_pdus[2]->rlc_pdu_tb[1]->has_logical_channel_id = 1; - rlc_pdus[2]->rlc_pdu_tb[1]->logical_channel_id = DTCH; - rlc_pdus[2]->rlc_pdu_tb[1]->has_size = 1; - rlc_pdus[2]->rlc_pdu_tb[1]->size = data_to_request; + rlc_pdus[channels_added] = (Protocol__PrpRlcPdu *) malloc(sizeof(Protocol__PrpRlcPdu)); + protocol__prp_rlc_pdu__init(rlc_pdus[channels_added]); + rlc_pdus[channels_added]->n_rlc_pdu_tb = 2; + rlc_pdus[channels_added]->rlc_pdu_tb = (Protocol__PrpRlcPduTb **) malloc(sizeof(Protocol__PrpRlcPduTb *) * 2); + rlc_pdus[channels_added]->rlc_pdu_tb[0] = (Protocol__PrpRlcPduTb *) malloc(sizeof(Protocol__PrpRlcPduTb)); + protocol__prp_rlc_pdu_tb__init(rlc_pdus[channels_added]->rlc_pdu_tb[0]); + rlc_pdus[channels_added]->rlc_pdu_tb[0]->has_logical_channel_id = 1; + rlc_pdus[channels_added]->rlc_pdu_tb[0]->logical_channel_id = DTCH; + rlc_pdus[channels_added]->rlc_pdu_tb[0]->has_size = 1; + rlc_pdus[channels_added]->rlc_pdu_tb[0]->size = data_to_request; + rlc_pdus[channels_added]->rlc_pdu_tb[1] = (Protocol__PrpRlcPduTb *) malloc(sizeof(Protocol__PrpRlcPduTb)); + protocol__prp_rlc_pdu_tb__init(rlc_pdus[channels_added]->rlc_pdu_tb[1]); + rlc_pdus[channels_added]->rlc_pdu_tb[1]->has_logical_channel_id = 1; + rlc_pdus[channels_added]->rlc_pdu_tb[1]->logical_channel_id = DTCH; + rlc_pdus[channels_added]->rlc_pdu_tb[1]->has_size = 1; + rlc_pdus[channels_added]->rlc_pdu_tb[1]->size = data_to_request; dl_data[num_ues_added]->n_rlc_pdu++; - + channels_added++; sdu_length_total += data_to_request; if(data_to_request < 128) { header_len_dtch = 2; } - } else { - header_len_dtch = 3; + header_len_dtch = 0; } } - + // Add rlc_pdus to the dl_data message dl_data[num_ues_added]->rlc_pdu = (Protocol__PrpRlcPdu **) malloc(sizeof(Protocol__PrpRlcPdu *) * dl_data[num_ues_added]->n_rlc_pdu); @@ -674,7 +663,7 @@ schedule_ue_spec_default( } // there is a payload - if (((sdu_length_total + header_len_dcch + header_len_dtch) > 0)) { + if (( dl_data[num_ues_added]->n_rlc_pdu > 0)) { // Now compute number of required RBs for total sdu length // Assume RAH format 2 // adjust header lengths @@ -682,15 +671,12 @@ schedule_ue_spec_default( header_len_dtch_tmp = header_len_dtch; if (header_len_dtch == 0) { - header_len_dcch = (header_len_dcch > 0) ? 1 : header_len_dcch; // remove length field + header_len_dcch = (header_len_dcch > 0) ? (header_len_dcch - 1) : header_len_dcch; // remove length field } else { header_len_dtch = (header_len_dtch > 0) ? 1 : header_len_dtch; // remove length field for the last SDU } mcs_tmp = mcs; - - // TODO: Need to compute this and not take it from the stats - // mcs = eNB_UE_stats->dlsch_mcs1; if (mcs_tmp == 0) { nb_rb = 4; // don't let the TBS get too small @@ -757,7 +743,7 @@ schedule_ue_spec_default( TBS = mac_xface->get_TBS_DL(mcs_tmp, nb_rb); } - LOG_D(MAC,"dlsch_mcs and TBS before and after the rate matching = (%d, %d) (%d, %d)\n", mcs, mcs_tmp, dci_tbs, TBS); + LOG_D(MAC,"[TEST] dlsch_mcs and TBS before and after the rate matching = (%d, %d) (%d, %d)\n", mcs, mcs_tmp, dci_tbs, TBS); dci_tbs = TBS; @@ -840,8 +826,8 @@ schedule_ue_spec_default( dl_dci->rb_shift = 0; dl_dci->n_ndi = 1; dl_dci->ndi = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_ndi); - dl_dci->ndi[0] = 1-UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]; - dl_dci->n_rv = 1-UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]; + dl_dci->ndi[0] = 1; + dl_dci->n_rv = 1; dl_dci->rv = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_rv); dl_dci->rv[0] = 0; dl_dci->has_tpc = 1; @@ -870,8 +856,8 @@ schedule_ue_spec_default( dl_dci->rb_shift = 0; dl_dci->n_ndi = 2; dl_dci->ndi = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_ndi); - dl_dci->ndi[0] = 1-UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid];; - dl_dci->ndi[1] = 1-UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid];; + dl_dci->ndi[0] = 1; + dl_dci->ndi[1] = 1; dl_dci->n_rv = 2; dl_dci->rv = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_rv); dl_dci->rv[0] = 0; @@ -904,8 +890,8 @@ schedule_ue_spec_default( dl_dci->rb_shift = 0; dl_dci->n_ndi = 2; dl_dci->ndi = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_ndi); - dl_dci->ndi[0] = 1-UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid];; - dl_dci->ndi[1] = 1-UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid];; + dl_dci->ndi[0] = 1; + dl_dci->ndi[1] = 1; dl_dci->n_rv = 2; dl_dci->rv = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_rv); dl_dci->rv[0] = 0; @@ -938,10 +924,10 @@ schedule_ue_spec_default( dl_dci->rb_shift = 0; dl_dci->n_ndi = 1; dl_dci->ndi = 1; - dl_dci->ndi[0] = 1-UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid];; + dl_dci->ndi[0] = 1; dl_dci->n_rv = 1; dl_dci->rv = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_rv); - dl_dci->rv[0] = round&3; + dl_dci->rv[0] = 0; dl_dci->has_tpc = 1; dl_dci->tpc = tpc; dl_dci->n_mcs = 1; @@ -978,7 +964,7 @@ schedule_ue_spec_default( dl_dci->rb_shift = 0; dl_dci->n_ndi = 1; dl_dci->ndi = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_ndi); - dl_dci->ndi[0] = 1-UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid];; + dl_dci->ndi[0] = 1; dl_dci->n_rv = 1; dl_dci->rv = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_rv); dl_dci->rv[0] = round&3; @@ -1106,7 +1092,7 @@ void apply_scheduling_decisions(mid_t mod_id, ((DCI1_1_5MHz_TDD_t*)DLSCH_dci)->rv = round; ((DCI1_1_5MHz_TDD_t*)DLSCH_dci)->dai = dl_dci->dai; ((DCI1_1_5MHz_TDD_t*)DLSCH_dci)->rballoc = dl_dci->rb_bitmap; - ((DCI1_1_5MHz_TDD_t*)DLSCH_dci)->rah = dl_dci->rb_shift; + ((DCI1_1_5MHz_TDD_t*)DLSCH_dci)->rah = dl_dci->res_alloc; ((DCI1_1_5MHz_TDD_t*)DLSCH_dci)->mcs = dl_dci->mcs[0]; ((DCI1_1_5MHz_TDD_t*)DLSCH_dci)->TPC = dl_dci->tpc; ((DCI1_1_5MHz_TDD_t*)DLSCH_dci)->ndi = dl_dci->ndi[0]; @@ -1122,7 +1108,7 @@ void apply_scheduling_decisions(mid_t mod_id, ((DCI1_1_5MHz_FDD_t*)DLSCH_dci)->harq_pid = harq_pid; ((DCI1_1_5MHz_FDD_t*)DLSCH_dci)->rv = round; ((DCI1_1_5MHz_FDD_t*)DLSCH_dci)->rballoc = dl_dci->rb_bitmap; - ((DCI1_1_5MHz_FDD_t*)DLSCH_dci)->rah = dl_dci->rb_shift; + ((DCI1_1_5MHz_FDD_t*)DLSCH_dci)->rah = dl_dci->res_alloc; ((DCI1_1_5MHz_FDD_t*)DLSCH_dci)->mcs = dl_dci->mcs[0]; ((DCI1_1_5MHz_FDD_t*)DLSCH_dci)->TPC = dl_dci->tpc; ((DCI1_1_5MHz_FDD_t*)DLSCH_dci)->ndi = dl_dci->ndi[0]; @@ -1142,7 +1128,7 @@ void apply_scheduling_decisions(mid_t mod_id, ((DCI1_5MHz_TDD_t*)DLSCH_dci)->rv = round; ((DCI1_5MHz_TDD_t*)DLSCH_dci)->dai = dl_dci->dai; ((DCI1_5MHz_TDD_t*)DLSCH_dci)->rballoc = dl_dci->rb_bitmap; - ((DCI1_5MHz_TDD_t*)DLSCH_dci)->rah = dl_dci->rb_shift; + ((DCI1_5MHz_TDD_t*)DLSCH_dci)->rah = dl_dci->res_alloc; ((DCI1_5MHz_TDD_t*)DLSCH_dci)->mcs = dl_dci->mcs[0]; ((DCI1_5MHz_TDD_t*)DLSCH_dci)->TPC = dl_dci->tpc; ((DCI1_5MHz_TDD_t*)DLSCH_dci)->ndi = dl_dci->ndi[0]; @@ -1157,10 +1143,8 @@ void apply_scheduling_decisions(mid_t mod_id, if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1) { ((DCI1_5MHz_FDD_t*)DLSCH_dci)->harq_pid = harq_pid; ((DCI1_5MHz_FDD_t*)DLSCH_dci)->rv = round; - if (dl_dci->has_rb_bitmap) { - ((DCI1_5MHz_FDD_t*)DLSCH_dci)->rballoc = dl_dci->rb_bitmap; - } - ((DCI1_5MHz_FDD_t*)DLSCH_dci)->rah = dl_dci->rb_shift; + ((DCI1_5MHz_FDD_t*)DLSCH_dci)->rballoc = dl_dci->rb_bitmap; + ((DCI1_5MHz_FDD_t*)DLSCH_dci)->rah = dl_dci->res_alloc; ((DCI1_5MHz_FDD_t*)DLSCH_dci)->mcs = dl_dci->mcs[0]; ((DCI1_5MHz_FDD_t*)DLSCH_dci)->TPC = dl_dci->tpc; ((DCI1_5MHz_FDD_t*)DLSCH_dci)->ndi = dl_dci->ndi[0]; @@ -1180,7 +1164,7 @@ void apply_scheduling_decisions(mid_t mod_id, ((DCI1_10MHz_TDD_t*)DLSCH_dci)->rv = round; ((DCI1_10MHz_TDD_t*)DLSCH_dci)->dai = dl_dci->dai; ((DCI1_10MHz_TDD_t*)DLSCH_dci)->rballoc = dl_dci->rb_bitmap; - ((DCI1_10MHz_TDD_t*)DLSCH_dci)->rah = dl_dci->rb_shift; + ((DCI1_10MHz_TDD_t*)DLSCH_dci)->rah = dl_dci->res_alloc; ((DCI1_10MHz_TDD_t*)DLSCH_dci)->mcs = dl_dci->mcs[0]; ((DCI1_10MHz_TDD_t*)DLSCH_dci)->TPC = dl_dci->tpc; ((DCI1_10MHz_TDD_t*)DLSCH_dci)->ndi = dl_dci->ndi[0]; @@ -1196,7 +1180,7 @@ void apply_scheduling_decisions(mid_t mod_id, ((DCI1_10MHz_FDD_t*)DLSCH_dci)->harq_pid = harq_pid; ((DCI1_10MHz_FDD_t*)DLSCH_dci)->rv = round; ((DCI1_10MHz_FDD_t*)DLSCH_dci)->rballoc = dl_dci->rb_bitmap; - ((DCI1_10MHz_FDD_t*)DLSCH_dci)->rah = dl_dci->rb_shift; + ((DCI1_10MHz_FDD_t*)DLSCH_dci)->rah = dl_dci->res_alloc; ((DCI1_10MHz_FDD_t*)DLSCH_dci)->mcs = dl_dci->mcs[0]; ((DCI1_10MHz_FDD_t*)DLSCH_dci)->TPC = dl_dci->tpc; ((DCI1_10MHz_TDD_t*)DLSCH_dci)->ndi = dl_dci->ndi[0]; @@ -1216,7 +1200,7 @@ void apply_scheduling_decisions(mid_t mod_id, ((DCI1_20MHz_TDD_t*)DLSCH_dci)->rv = round; ((DCI1_20MHz_TDD_t*)DLSCH_dci)->dai = dl_dci->dai; ((DCI1_20MHz_TDD_t*)DLSCH_dci)->rballoc = dl_dci->rb_bitmap; - ((DCI1_20MHz_TDD_t*)DLSCH_dci)->rah = dl_dci->rb_shift; + ((DCI1_20MHz_TDD_t*)DLSCH_dci)->rah = dl_dci->res_alloc; ((DCI1_20MHz_TDD_t*)DLSCH_dci)->mcs = dl_dci->mcs[0]; ((DCI1_20MHz_TDD_t*)DLSCH_dci)->TPC = dl_dci->tpc; ((DCI1_20MHz_TDD_t*)DLSCH_dci)->ndi = dl_dci->ndi[0]; @@ -1232,7 +1216,7 @@ void apply_scheduling_decisions(mid_t mod_id, ((DCI1_20MHz_FDD_t*)DLSCH_dci)->harq_pid = harq_pid; ((DCI1_20MHz_FDD_t*)DLSCH_dci)->rv = round; ((DCI1_20MHz_FDD_t*)DLSCH_dci)->rballoc = dl_dci->rb_bitmap; - ((DCI1_20MHz_FDD_t*)DLSCH_dci)->rah = dl_dci->rb_shift; + ((DCI1_20MHz_FDD_t*)DLSCH_dci)->rah = dl_dci->res_alloc; ((DCI1_20MHz_FDD_t*)DLSCH_dci)->mcs = dl_dci->mcs[0]; ((DCI1_20MHz_FDD_t*)DLSCH_dci)->TPC = dl_dci->tpc; ((DCI1_20MHz_FDD_t*)DLSCH_dci)->ndi = dl_dci->ndi[0]; @@ -1266,14 +1250,17 @@ void apply_scheduling_decisions(mid_t mod_id, n_lc = dl_data->n_rlc_pdu; num_sdus = 0; + sdu_length_total = 0; // Go through each one of the channel commands and create SDUs for (i = 0; i < n_lc; i++) { lcid = dl_data->rlc_pdu[i]->rlc_pdu_tb[0]->logical_channel_id; rlc_size = dl_data->rlc_pdu[i]->rlc_pdu_tb[0]->size; LOG_D(MAC,"[TEST]Have to check %d channels\n", n_lc); if (rlc_size > 0) { - rlc_status = mac_rlc_status_ind( - mod_id, + if (lcid == 3) { + rlc_size--; + } + rlc_status = mac_rlc_status_ind(mod_id, rnti, mod_id, frame, @@ -1287,25 +1274,27 @@ void apply_scheduling_decisions(mid_t mod_id, LOG_D(MAC,"[eNB %d] Frame %d, LCID %d, CC_id %d, Requesting %d bytes from RLC (RRC message)\n", mod_id, frame, lcid, CC_id, rlc_size); - LOG_D(MAC, "[TEST] Have %d bytes in buffer DCCH during second call\n", rlc_status.bytes_in_buffer); + LOG_D(MAC, "[TEST] Have %d bytes for LCID %d during second call\n", rlc_status.bytes_in_buffer, lcid); - sdu_lengths[i] += mac_rlc_data_req( - mod_id, + sdu_lengths[i] += mac_rlc_data_req(mod_id, rnti, mod_id, frame, ENB_FLAG_YES, MBMS_FLAG_NO, lcid, - (char *)&dlsch_buffer[sdu_lengths[i]]); + (char *)&dlsch_buffer[sdu_lengths[sdu_length_total]]); - LOG_D(MAC, "[TEST] This is what I actuallty got %d\n", sdu_lengths[i]); + LOG_D(MAC, "[TEST] This is what I actually got from LCID %d -> %d\n",lcid, sdu_lengths[i]); - LOG_D(MAC,"[eNB %d][DCCH] CC_id %d Got %d bytes from RLC\n",mod_id, CC_id, sdu_lengths[i]); + LOG_D(MAC,"[eNB %d][LCID %d] CC_id %d Got %d bytes from RLC\n",mod_id, lcid, CC_id, sdu_lengths[i]); sdu_length_total += sdu_lengths[i]; sdu_lcids[i] = lcid; - if (lcid == DCCH || lcid == DCCH+1) { + UE_list->eNB_UE_stats[CC_id][UE_id].num_pdu_tx[lcid] += 1; + UE_list->eNB_UE_stats[CC_id][UE_id].num_bytes_tx[lcid] += sdu_lengths[i]; + + if (lcid == DCCH || lcid == DCCH1) { header_len_dcch += 2; } else if (lcid == DTCH) { if (sdu_lengths[i] < 128) { @@ -1313,12 +1302,8 @@ void apply_scheduling_decisions(mid_t mod_id, } else { header_len_dtch = 3; } - } - - UE_list->eNB_UE_stats[CC_id][UE_id].num_pdu_tx[DCCH] += 1; - UE_list->eNB_UE_stats[CC_id][UE_id].num_bytes_tx[DCCH] += sdu_lengths[i]; + } num_sdus++; - } } // SDU creation end @@ -1329,15 +1314,16 @@ void apply_scheduling_decisions(mid_t mod_id, header_len_dtch_tmp = header_len_dtch; if (header_len_dtch==0) { - header_len_dcch = (header_len_dcch >0) ? 1 : header_len_dcch; // remove length field + header_len_dcch = (header_len_dcch >0) ? (header_len_dcch - 1) : header_len_dcch; // remove length field } else { - header_len_dtch = (header_len_dtch > 0) ? 1 :header_len_dtch; // remove length field for the last SDU + header_len_dtch = (header_len_dtch > 0) ? 1 : header_len_dtch; // remove length field for the last SDU } // there is a payload LOG_D(MAC, "[TEST] This is the padding %d\n", TBS - header_len_dcch - header_len_dtch - sdu_length_total - ta_len); if (((sdu_length_total + header_len_dcch + header_len_dtch ) > 0)) { - if ((TBS - header_len_dcch - header_len_dtch - sdu_length_total - ta_len) <= 2) { + if ((TBS - header_len_dcch - header_len_dtch - sdu_length_total - ta_len) <= 2 + || (TBS - header_len_dcch - header_len_dtch - sdu_length_total - ta_len) > TBS) { //protect from overflow padding = (TBS - header_len_dcch - header_len_dtch - sdu_length_total - ta_len); post_padding = 0; } else { @@ -1345,18 +1331,19 @@ void apply_scheduling_decisions(mid_t mod_id, // adjust the header len if (header_len_dtch==0) { - header_len_dcch = header_len_dcch_tmp; - } else { //if (( header_len_dcch==0)&&((header_len_dtch==1)||(header_len_dtch==2))) - header_len_dtch = header_len_dtch_tmp; + header_len_dcch = header_len_dcch_tmp; + } else { + header_len_dtch = header_len_dtch_tmp; } - post_padding = TBS - sdu_length_total - header_len_dcch - header_len_dtch - ta_len ; // 1 is for the postpadding header + post_padding = TBS - sdu_length_total - header_len_dcch - header_len_dtch - ta_len - 1; // 1 is for the postpadding header } } LOG_D(MAC, "[TEST] This is the current SDU length %d and this is the TBS %d\n", sdu_length_total, TBS); + if (ta_len > 0) { ta_update = ue_sched_ctl->ta_update; } else { @@ -1373,7 +1360,8 @@ void apply_scheduling_decisions(mid_t mod_id, NULL, // contention res id padding, post_padding); - + + LOG_D(MAC, "[TEST]Have to schedule %d SDUs with length %d. TBS is %d, LCID is %d, post padding is %d, padding is %d, header offset is %d, total sdu size is %d\n", num_sdus, sdu_lengths[0], TBS, sdu_lcids[0], post_padding, padding, offset, sdu_length_total); #ifdef DEBUG_eNB_SCHEDULER LOG_T(MAC,"[eNB %d] First 16 bytes of DLSCH : \n"); @@ -1411,8 +1399,8 @@ void apply_scheduling_decisions(mid_t mod_id, UE_list->eNB_UE_stats[CC_id][UE_id].harq_pid = harq_pid; UE_list->eNB_UE_stats[CC_id][UE_id].harq_round = round; - UE_list->eNB_UE_stats[CC_id][UE_id].rbs_used = nb_rb; - UE_list->eNB_UE_stats[CC_id][UE_id].total_rbs_used += nb_rb; + //UE_list->eNB_UE_stats[CC_id][UE_id].rbs_used = nb_rb; + //UE_list->eNB_UE_stats[CC_id][UE_id].total_rbs_used += nb_rb; UE_list->eNB_UE_stats[CC_id][UE_id].dlsch_mcs1=dl_dci->mcs[0]; UE_list->eNB_UE_stats[CC_id][UE_id].dlsch_mcs2=dl_dci->mcs[0]; UE_list->eNB_UE_stats[CC_id][UE_id].TBS = TBS; @@ -1421,6 +1409,9 @@ void apply_scheduling_decisions(mid_t mod_id, UE_list->eNB_UE_stats[CC_id][UE_id].total_sdu_bytes+= sdu_length_total; UE_list->eNB_UE_stats[CC_id][UE_id].total_pdu_bytes+= TBS; UE_list->eNB_UE_stats[CC_id][UE_id].total_num_pdus+=1; + + eNB_UE_stats->dlsch_mcs1 = cqi_to_mcs[eNB_UE_stats->DL_cqi[0]]; + eNB_UE_stats->dlsch_mcs1 = cmin(eNB_UE_stats->dlsch_mcs1, openair_daq_vars.target_ue_dl_mcs); // TODO @@ -1430,6 +1421,15 @@ void apply_scheduling_decisions(mid_t mod_id, } else { // No need to create anything apart of DCI in case of retransmission + + /*TODO: Must add these */ + //eNB_UE_stats->dlsch_trials[round]++; + //UE_list->eNB_UE_stats[CC_id][UE_id].num_retransmission+=1; + //UE_list->eNB_UE_stats[CC_id][UE_id].rbs_used_retx=nb_rb; + //UE_list->eNB_UE_stats[CC_id][UE_id].total_rbs_used_retx+=nb_rb; + //UE_list->eNB_UE_stats[CC_id][UE_id].ncce_used_retx=nCCECC_id]; + //UE_list->eNB_UE_stats[CC_id][UE_id].dlsch_mcs1=eNB_UE_stats->dlsch_mcs1; + //UE_list->eNB_UE_stats[CC_id][UE_id].dlsch_mcs2=eNB_UE_stats->dlsch_mcs1; } //Add DCI based on format @@ -1438,7 +1438,7 @@ void apply_scheduling_decisions(mid_t mod_id, DLSCH_dci, rnti, size_bytes, - process_ue_cqi (mod_id, UE_id),//aggregation + dl_dci->aggr_level,//aggregation size_bits, format1, 0); @@ -1447,7 +1447,7 @@ void apply_scheduling_decisions(mid_t mod_id, DLSCH_dci, rnti, size_bytes, - process_ue_cqi (mod_id, UE_id),//aggregation + dl_dci->aggr_level,//aggregation size_bits, format2A, 0); diff --git a/openair2/LAYER2/MAC/eNB_scheduler.c b/openair2/LAYER2/MAC/eNB_scheduler.c index f0e0a9f84b..caf7457fea 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler.c +++ b/openair2/LAYER2/MAC/eNB_scheduler.c @@ -69,7 +69,7 @@ #define ENABLE_MAC_PAYLOAD_DEBUG #define DEBUG_eNB_SCHEDULER 1 -//#define ENABLE_ENB_AGENT_DL_SCHEDULER +#define ENABLE_ENB_AGENT_DL_SCHEDULER //#define DEBUG_HEADER_PARSING 1 //#define DEBUG_PACKET_TRACE 1 From a8cd23944f2b3deec8b3d6e586e3588c16adab03 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Tue, 2 Feb 2016 19:18:42 +0000 Subject: [PATCH 082/349] Progran scheduler fixes --- .../LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c b/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c index fcf866d657..0b6157932f 100644 --- a/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c +++ b/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c @@ -487,6 +487,8 @@ schedule_ue_spec_default( //TBS = mac_xface->get_TBS(eNB_UE_stats->DL_cqi[0]<<1,nb_available_rb); TBS = mac_xface->get_TBS_DL(mcs, nb_available_rb); dci_tbs = TBS; + + // check first for RLC data on DCCH // add the length for all the control elements (timing adv, drx, etc) : header + payload @@ -511,7 +513,8 @@ schedule_ue_spec_default( // Need to see if we have space for data from this channel if ( TBS-ta_len-header_len_dcch > 0 ) { - + LOG_D(MAC, "[TEST]Requested %d bytes in DCCH buffer during first call\n", dci_tbs-ta_len-header_len_dcch); + LOG_D(MAC, "DCCH dci_tbus is %d\n", dci_tbs); //If we have space, we need to see how much data we can request at most (if any available) rlc_status = mac_rlc_status_ind(mod_id, rnti, @@ -524,10 +527,10 @@ schedule_ue_spec_default( //If data are available in the DCCH if (rlc_status.bytes_in_buffer > 0) { - LOG_D(MAC, "[TEST]Have %d bytes in buffer during first call\n", rlc_status.bytes_in_buffer); + LOG_D(MAC, "[TEST]Have %d bytes in DCCH buffer during first call\n", rlc_status.bytes_in_buffer); //Fill in as much as possible data_to_request = cmin(dci_tbs-ta_len-header_len_dcch, rlc_status.bytes_in_buffer) + 1; - LOG_D(MAC, "[TEST]Will request %d \n", data_to_request); + LOG_D(MAC, "[TEST]Will request %d from DCCH\n", data_to_request); rlc_pdus[channels_added] = (Protocol__PrpRlcPdu *) malloc(sizeof(Protocol__PrpRlcPdu)); protocol__prp_rlc_pdu__init(rlc_pdus[channels_added]); rlc_pdus[channels_added]->n_rlc_pdu_tb = 2; @@ -1257,9 +1260,6 @@ void apply_scheduling_decisions(mid_t mod_id, rlc_size = dl_data->rlc_pdu[i]->rlc_pdu_tb[0]->size; LOG_D(MAC,"[TEST]Have to check %d channels\n", n_lc); if (rlc_size > 0) { - if (lcid == 3) { - rlc_size--; - } rlc_status = mac_rlc_status_ind(mod_id, rnti, mod_id, @@ -1283,7 +1283,7 @@ void apply_scheduling_decisions(mid_t mod_id, ENB_FLAG_YES, MBMS_FLAG_NO, lcid, - (char *)&dlsch_buffer[sdu_lengths[sdu_length_total]]); + (char *)&dlsch_buffer[sdu_length_total]); LOG_D(MAC, "[TEST] This is what I actually got from LCID %d -> %d\n",lcid, sdu_lengths[i]); @@ -1302,7 +1302,8 @@ void apply_scheduling_decisions(mid_t mod_id, } else { header_len_dtch = 3; } - } + } + num_sdus++; } } // SDU creation end From fd09bd61bfed2ed92fc4273da79a2a7302aa1477 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Wed, 3 Feb 2016 14:27:17 +0000 Subject: [PATCH 083/349] Fixed bug with NDI toggling --- .../LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c | 63 ++++++++++++------- 1 file changed, 39 insertions(+), 24 deletions(-) diff --git a/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c b/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c index 0b6157932f..f31ed2bf86 100644 --- a/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c +++ b/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c @@ -249,6 +249,8 @@ schedule_ue_spec_default( */ mcs = cqi_to_mcs[eNB_UE_stats->DL_cqi[0]]; + mcs = cmin(mcs, openair_daq_vars.target_ue_dl_mcs); + /*TODO: Must also update these stats*/ //eNB_UE_stats->dlsch_mcs1 = cqi_to_mcs[eNB_UE_stats->DL_cqi[0]]; @@ -514,7 +516,6 @@ schedule_ue_spec_default( if ( TBS-ta_len-header_len_dcch > 0 ) { LOG_D(MAC, "[TEST]Requested %d bytes in DCCH buffer during first call\n", dci_tbs-ta_len-header_len_dcch); - LOG_D(MAC, "DCCH dci_tbus is %d\n", dci_tbs); //If we have space, we need to see how much data we can request at most (if any available) rlc_status = mac_rlc_status_ind(mod_id, rnti, @@ -552,6 +553,7 @@ schedule_ue_spec_default( //Set this to the max value that we might request sdu_length_total = data_to_request; } else { + LOG_D(MAC, "[TEST]Nothing here\n"); header_len_dcch = 0; sdu_length_total = 0; } @@ -559,6 +561,7 @@ schedule_ue_spec_default( // check for DCCH1 and update header information (assume 2 byte sub-header) if (dci_tbs-ta_len-header_len_dcch-sdu_length_total-2 > 0 ) { + LOG_D(MAC, "[TEST]Requested %d bytes in DCCH1 buffer during first call\n", dci_tbs-ta_len-header_len_dcch-sdu_length_total-2); //If we have space, we need to see how much data we can request at most (if any are available) rlc_status = mac_rlc_status_ind(mod_id, @@ -577,7 +580,7 @@ schedule_ue_spec_default( header_len_dcch += 2; //Fill in as much as possible - data_to_request = cmin(dci_tbs-ta_len-header_len_dcch-sdu_length_total, rlc_status.bytes_in_buffer) + 1; + data_to_request = cmin(dci_tbs-ta_len-header_len_dcch-sdu_length_total, rlc_status.bytes_in_buffer); rlc_pdus[channels_added] = (Protocol__PrpRlcPdu *) malloc(sizeof(Protocol__PrpRlcPdu)); protocol__prp_rlc_pdu__init(rlc_pdus[channels_added]); @@ -628,7 +631,7 @@ schedule_ue_spec_default( if (rlc_status.bytes_in_buffer > 0) { LOG_D(MAC, "[TEST] Have %d bytes in buffer DTCH during first call\n", rlc_status.bytes_in_buffer); //Fill what remains in the TB - data_to_request = cmin(dci_tbs-ta_len-header_len_dcch-sdu_length_total-header_len_dtch, rlc_status.bytes_in_buffer) + 1; + data_to_request = cmin(dci_tbs-ta_len-header_len_dcch-sdu_length_total-header_len_dtch, rlc_status.bytes_in_buffer); LOG_D(MAC, "[TEST]Will request %d \n", data_to_request); rlc_pdus[channels_added] = (Protocol__PrpRlcPdu *) malloc(sizeof(Protocol__PrpRlcPdu)); protocol__prp_rlc_pdu__init(rlc_pdus[channels_added]); @@ -687,11 +690,15 @@ schedule_ue_spec_default( nb_rb=min_rb_unit[CC_id]; } + LOG_D(MAC,"[TEST]The initial number of resource blocks was %d\n", nb_rb); + LOG_D(MAC,"[TEST] The initial mcs was %d\n", mcs_tmp); + TBS = mac_xface->get_TBS_DL(mcs_tmp, nb_rb); + LOG_D(MAC,"[TEST]The TBS during rate matching was %d\n", TBS); while (TBS < (sdu_length_total + header_len_dcch + header_len_dtch + ta_len)) { nb_rb += min_rb_unit[CC_id]; // - + LOG_D(MAC, "[TEST]Had to increase the number of RBs\n"); if (nb_rb > nb_available_rb) { // if we've gone beyond the maximum number of RBs // (can happen if N_RB_DL is odd) TBS = mac_xface->get_TBS_DL(mcs_tmp, nb_available_rb); @@ -702,14 +709,18 @@ schedule_ue_spec_default( TBS = mac_xface->get_TBS_DL(mcs_tmp, nb_rb); } + LOG_D(MAC,"[TEST] After the first pass the resource blocks became %d\n", nb_rb); + LOG_D(MAC,"[TEST] After the first pass the MCS was %d\n", mcs_tmp); + if(nb_rb == ue_sched_ctl->pre_nb_available_rbs[CC_id]) { + LOG_D(MAC, "[TEST]We had the exact number of rbs. Time to fill the rballoc subband\n"); for(j = 0; j < frame_parms[CC_id]->N_RBG; j++) { // for indicating the rballoc for each sub-band UE_list->UE_template[CC_id][UE_id].rballoc_subband[harq_pid][j] = ue_sched_ctl->rballoc_sub_UE[CC_id][j]; } } else { nb_rb_temp = nb_rb; j = 0; - + LOG_D(MAC, "[TEST]Will only partially fill the bitmap\n"); while((nb_rb_temp > 0) && (j < frame_parms[CC_id]->N_RBG)) { if(ue_sched_ctl->rballoc_sub_UE[CC_id][j] == 1) { UE_list->UE_template[CC_id][UE_id].rballoc_subband[harq_pid][j] = ue_sched_ctl->rballoc_sub_UE[CC_id][j]; @@ -726,6 +737,9 @@ schedule_ue_spec_default( } } + LOG_D(MAC,"[TEST] After the second pass the resource blocks became %d\n", nb_rb); + LOG_D(MAC,"[TEST] After the second pass the mcs was %d\n", mcs_tmp); + PHY_vars_eNB_g[mod_id][CC_id]->mu_mimo_mode[UE_id].pre_nb_available_rbs = nb_rb; PHY_vars_eNB_g[mod_id][CC_id]->mu_mimo_mode[UE_id].dl_pow_off = ue_sched_ctl->dl_pow_off[CC_id]; @@ -829,7 +843,7 @@ schedule_ue_spec_default( dl_dci->rb_shift = 0; dl_dci->n_ndi = 1; dl_dci->ndi = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_ndi); - dl_dci->ndi[0] = 1; + dl_dci->ndi[0] = 1-UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]; dl_dci->n_rv = 1; dl_dci->rv = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_rv); dl_dci->rv[0] = 0; @@ -987,6 +1001,7 @@ schedule_ue_spec_default( dl_dci->precoding_info = 5; // Is this right?? break; } + // Toggle NDI for next time LOG_D(MAC,"CC_id %d Frame %d, subframeP %d: Toggling Format1 NDI for UE %d (rnti %x/%d) oldNDI %d\n", CC_id, frame, subframe, UE_id, @@ -998,12 +1013,12 @@ schedule_ue_spec_default( } else { // There is no data from RLC or MAC header, so don't schedule } - } + } if (frame_parms[CC_id]->frame_type == TDD) { set_ul_DAI(mod_id, UE_id, CC_id, frame, subframe, frame_parms); } - } - } + } // UE_id loop + } // CC_id loop // Add all the dl_data elements to the progran message dl_info->dl_mac_config_msg->n_dl_ue_data = num_ues_added; @@ -1072,9 +1087,6 @@ void apply_scheduling_decisions(mid_t mod_id, rnti = dl_data->rnti; UE_id = find_ue(rnti, PHY_vars_eNB_g[mod_id][CC_id]); - //NOTICE: Maybe later will not be required, once scheduler fully restructured - //eNB_dlsch_info[mod_id][CC_id][UE_id].status = S_DL_WAITING; - ue_sched_ctl = &UE_list->UE_sched_ctrl[UE_id]; eNB_UE_stats = mac_xface->get_eNB_UE_stats(mod_id,CC_id,rnti); @@ -1108,6 +1120,7 @@ void apply_scheduling_decisions(mid_t mod_id, } } else { if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1) { + LOG_D(MAC,"[TEST] Setting DCI format 1\n"); ((DCI1_1_5MHz_FDD_t*)DLSCH_dci)->harq_pid = harq_pid; ((DCI1_1_5MHz_FDD_t*)DLSCH_dci)->rv = round; ((DCI1_1_5MHz_FDD_t*)DLSCH_dci)->rballoc = dl_dci->rb_bitmap; @@ -1240,13 +1253,16 @@ void apply_scheduling_decisions(mid_t mod_id, rlc_status.bytes_in_buffer = 0; TBS = dl_dci->tbs_size[0]; + LOG_D(MAC,"[TEST] The TBS during the creation process is %d\n", TBS); if (dl_data->n_ce_bitmap > 0) { //Check if there is TA command if (dl_data->ce_bitmap[0] & PROTOCOL__PRP_CE_TYPE__PRPCET_TA) { ta_len = 2; + LOG_D(MAC, "[TEST] Need to send timing advance\n"); } else { ta_len = 0; + LOG_D(MAC, "[TEST] No timing advance\n"); } } @@ -1257,9 +1273,12 @@ void apply_scheduling_decisions(mid_t mod_id, // Go through each one of the channel commands and create SDUs for (i = 0; i < n_lc; i++) { lcid = dl_data->rlc_pdu[i]->rlc_pdu_tb[0]->logical_channel_id; + LOG_D(MAC, "[TEST] Going through SDU of channel %d\n", lcid); rlc_size = dl_data->rlc_pdu[i]->rlc_pdu_tb[0]->size; - LOG_D(MAC,"[TEST]Have to check %d channels\n", n_lc); + LOG_D(MAC,"[TEST] [eNB %d] Frame %d, LCID %d, CC_id %d, Requesting %d bytes from RLC (RRC message)\n", + mod_id, frame, lcid, CC_id, rlc_size); if (rlc_size > 0) { + rlc_status = mac_rlc_status_ind(mod_id, rnti, mod_id, @@ -1271,10 +1290,7 @@ void apply_scheduling_decisions(mid_t mod_id, sdu_lengths[i] = 0; - LOG_D(MAC,"[eNB %d] Frame %d, LCID %d, CC_id %d, Requesting %d bytes from RLC (RRC message)\n", - mod_id, frame, lcid, CC_id, rlc_size); - - LOG_D(MAC, "[TEST] Have %d bytes for LCID %d during second call\n", rlc_status.bytes_in_buffer, lcid); + LOG_D(MAC, "[TEST] RLC can give %d bytes for LCID %d during second call\n", rlc_status.bytes_in_buffer, lcid); sdu_lengths[i] += mac_rlc_data_req(mod_id, rnti, @@ -1285,10 +1301,11 @@ void apply_scheduling_decisions(mid_t mod_id, lcid, (char *)&dlsch_buffer[sdu_length_total]); - LOG_D(MAC, "[TEST] This is what I actually got from LCID %d -> %d\n",lcid, sdu_lengths[i]); + LOG_D(MAC, "[TEST] RLC gave %d bytes in LCID %d\n", sdu_lengths[i], lcid); LOG_D(MAC,"[eNB %d][LCID %d] CC_id %d Got %d bytes from RLC\n",mod_id, lcid, CC_id, sdu_lengths[i]); sdu_length_total += sdu_lengths[i]; + LOG_D(MAC, "[TEST] Total sdu size became %d\n", sdu_length_total); sdu_lcids[i] = lcid; UE_list->eNB_UE_stats[CC_id][UE_id].num_pdu_tx[lcid] += 1; @@ -1321,7 +1338,6 @@ void apply_scheduling_decisions(mid_t mod_id, } // there is a payload - LOG_D(MAC, "[TEST] This is the padding %d\n", TBS - header_len_dcch - header_len_dtch - sdu_length_total - ta_len); if (((sdu_length_total + header_len_dcch + header_len_dtch ) > 0)) { if ((TBS - header_len_dcch - header_len_dtch - sdu_length_total - ta_len) <= 2 || (TBS - header_len_dcch - header_len_dtch - sdu_length_total - ta_len) > TBS) { //protect from overflow @@ -1341,9 +1357,6 @@ void apply_scheduling_decisions(mid_t mod_id, } } - LOG_D(MAC, "[TEST] This is the current SDU length %d and this is the TBS %d\n", sdu_length_total, TBS); - - if (ta_len > 0) { ta_update = ue_sched_ctl->ta_update; @@ -1400,8 +1413,10 @@ void apply_scheduling_decisions(mid_t mod_id, UE_list->eNB_UE_stats[CC_id][UE_id].harq_pid = harq_pid; UE_list->eNB_UE_stats[CC_id][UE_id].harq_round = round; - //UE_list->eNB_UE_stats[CC_id][UE_id].rbs_used = nb_rb; - //UE_list->eNB_UE_stats[CC_id][UE_id].total_rbs_used += nb_rb; + nb_rb = UE_list->UE_template[CC_id][UE_id].nb_rb[harq_pid]; + LOG_D(MAC,"[TEST] %d Number of resource blocks allocated\n", nb_rb); + UE_list->eNB_UE_stats[CC_id][UE_id].rbs_used = nb_rb; + UE_list->eNB_UE_stats[CC_id][UE_id].total_rbs_used += nb_rb; UE_list->eNB_UE_stats[CC_id][UE_id].dlsch_mcs1=dl_dci->mcs[0]; UE_list->eNB_UE_stats[CC_id][UE_id].dlsch_mcs2=dl_dci->mcs[0]; UE_list->eNB_UE_stats[CC_id][UE_id].TBS = TBS; From 3d3c0c7c03d6ed06c37ec4ca86891fa5372a1d76 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Wed, 3 Feb 2016 15:39:51 +0000 Subject: [PATCH 084/349] Bug fixes for UE retransmission --- .../LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c | 79 ++++++++++++------- 1 file changed, 50 insertions(+), 29 deletions(-) diff --git a/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c b/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c index f31ed2bf86..b97c15c9f5 100644 --- a/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c +++ b/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c @@ -251,12 +251,6 @@ schedule_ue_spec_default( mcs = cqi_to_mcs[eNB_UE_stats->DL_cqi[0]]; mcs = cmin(mcs, openair_daq_vars.target_ue_dl_mcs); - - /*TODO: Must also update these stats*/ - //eNB_UE_stats->dlsch_mcs1 = cqi_to_mcs[eNB_UE_stats->DL_cqi[0]]; - //eNB_UE_stats->dlsch_mcs1 = cmin(eNB_UE_stats->dlsch_mcs1, openair_daq_vars.target_ue_dl_mcs); - - #ifdef EXMIMO if (mac_xface->get_transmission_mode(mod_id, CC_id, rnti)==5) { @@ -293,6 +287,13 @@ schedule_ue_spec_default( if (round > 0) { + mcs = UE_list->eNB_UE_stats[CC_id][UE_id].dlsch_mcs1; + + // get freq_allocation + nb_rb = UE_list->UE_template[CC_id][UE_id].nb_rb[harq_pid]; + + dci_tbs = mac_xface->get_TBS_DL(mcs, nb_rb); + if (frame_parms[CC_id]->frame_type == TDD) { UE_list->UE_template[CC_id][UE_id].DAI++; update_ul_dci(mod_id, CC_id, rnti, UE_list->UE_template[CC_id][UE_id].DAI); @@ -300,8 +301,7 @@ schedule_ue_spec_default( CC_id, subframe,UE_id,UE_list->UE_template[CC_id][UE_id].DAI); } - // get freq_allocation - nb_rb = UE_list->UE_template[CC_id][UE_id].nb_rb[harq_pid]; + if (nb_rb <= nb_available_rb) { @@ -348,7 +348,6 @@ schedule_ue_spec_default( dl_dci->n_mcs = 1; dl_dci->mcs = (uint32_t *)malloc(sizeof(uint32_t)); dl_dci->mcs[0] = mcs; - //TODO:Need to fix tpc for retransmissions dl_dci->has_tpc = 1; dl_dci->tpc = 1; dl_dci->has_vrb_format = 1; @@ -359,12 +358,18 @@ schedule_ue_spec_default( dl_dci->rb_bitmap = allocate_prbs_sub(nb_rb, UE_list->UE_template[CC_id][UE_id].rballoc_subband); dl_dci->has_rb_shift = 1; dl_dci->rb_shift = 0; - dl_dci->n_ndi = 1; + dl_dci->n_ndi = UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]; dl_dci->ndi = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_ndi); dl_dci->ndi[0] = 1; dl_dci->n_rv = 1; dl_dci->rv = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_rv); - dl_dci->rv[0] = (round+1) % 4; + dl_dci->rv[0] = round&3; + dl_dci->n_mcs = 1; + dl_dci->mcs = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_mcs); + dl_dci->mcs[0] = mcs; + dl_dci->n_tbs_size = 1; + dl_dci->tbs_size = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_tbs_size); + dl_dci->tbs_size[0] = dci_tbs; if (frame_parms[CC_id]->frame_type == TDD) { dl_dci->has_dai = 1; dl_dci->dai = (UE_list->UE_template[CC_id][UE_id].DAI-1)&3; @@ -382,7 +387,6 @@ schedule_ue_spec_default( dl_dci->mcs = (uint32_t *)malloc(sizeof(uint32_t) * dl_dci->n_mcs); dl_dci->mcs[0] = mcs; dl_dci->mcs[1] = mcs; - //TODO:Need to fix tpc for retransmissions dl_dci->has_tpc = 1; dl_dci->tpc = 1; dl_dci->has_vrb_format = 1; @@ -395,12 +399,19 @@ schedule_ue_spec_default( dl_dci->rb_shift = 0; dl_dci->n_ndi = 2; dl_dci->ndi = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_ndi); - dl_dci->ndi[0] = 0; - dl_dci->ndi[1] = 0; + dl_dci->ndi[0] = UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]; + dl_dci->ndi[1] = UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]; + dl_dci->n_tbs_size = 2; + dl_dci->tbs_size = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_tbs_size); + dl_dci->tbs_size[0] = dci_tbs; + dl_dci->tbs_size[1] = dci_tbs; dl_dci->n_rv = 2; dl_dci->rv = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_rv); - dl_dci->rv[0] = (round+1) % 4; - dl_dci->rv[1] = (round+1) % 4; + dl_dci->rv[0] = round&3; + dl_dci->rv[1] = round&3; + dl_dci->mcs = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_mcs); + dl_dci->mcs[0] = mcs; + dl_dci->mcs[1] = mcs; if (frame_parms[CC_id]->frame_type == TDD) { dl_dci->has_dai = 1; dl_dci->dai = (UE_list->UE_template[CC_id][UE_id].DAI-1)&3; @@ -417,7 +428,6 @@ schedule_ue_spec_default( dl_dci->n_mcs = 1; dl_dci->mcs = (uint32_t *)malloc(sizeof(uint32_t)); dl_dci->mcs[0] = mcs; - //TODO:Need to fix tpc for retransmissions dl_dci->has_tpc = 1; dl_dci->tpc = 1; dl_dci->has_vrb_format = 1; @@ -426,16 +436,22 @@ schedule_ue_spec_default( dl_dci->format = PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1D; dl_dci->n_ndi = 1; dl_dci->ndi = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_ndi); - dl_dci->ndi[0] = 0; + dl_dci->ndi[0] = UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]; dl_dci->has_rb_bitmap = 1; dl_dci->rb_bitmap = allocate_prbs_sub(nb_rb, UE_list->UE_template[CC_id][UE_id].rballoc_subband); dl_dci->has_rb_shift = 1; dl_dci->rb_shift = 0; dl_dci->has_dai = 1; dl_dci->dai = (UE_list->UE_template[CC_id][UE_id].DAI-1)&3; + dl_dci->n_mcs = 1; + dl_dci->mcs = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_mcs); + dl_dci->mcs[0] = mcs; + dl_dci->n_tbs_size = 1; + dl_dci->tbs_size = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_tbs_size); + dl_dci->tbs_size[0] = dci_tbs; dl_dci->n_rv = 1; dl_dci->rv = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_rv); - dl_dci->rv[0] = (round + 1) % 4; + dl_dci->rv[0] = round&3; if(ue_sched_ctl->dl_pow_off[CC_id] == 2) { ue_sched_ctl->dl_pow_off[CC_id] = 1; @@ -451,7 +467,6 @@ schedule_ue_spec_default( dl_dci->n_mcs = 1; dl_dci->mcs = (uint32_t *)malloc(sizeof(uint32_t)); dl_dci->mcs[0] = mcs; - //TODO:Need to fix tpc for retransmissions dl_dci->has_tpc = 1; dl_dci->tpc = 1; dl_dci->has_vrb_format = 1; @@ -460,16 +475,22 @@ schedule_ue_spec_default( dl_dci->format = PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1D; dl_dci->n_ndi = 1; dl_dci->ndi = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_ndi); - dl_dci->ndi[0] = 0; + dl_dci->ndi[0] = UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]; dl_dci->has_rb_bitmap = 1; dl_dci->rb_bitmap = allocate_prbs_sub(nb_rb, UE_list->UE_template[CC_id][UE_id].rballoc_subband); dl_dci->has_rb_shift = 1; dl_dci->rb_shift = 0; dl_dci->has_dai = 1; dl_dci->dai = (UE_list->UE_template[CC_id][UE_id].DAI-1)&3; + dl_dci->n_mcs = 1; + dl_dci->mcs = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_mcs); + dl_dci->mcs[0] = mcs; + dl_dci->n_tbs_size = 1; + dl_dci->tbs_size = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_tbs_size); + dl_dci->tbs_size[0] = dci_tbs; dl_dci->n_rv = 1; dl_dci->rv = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_rv); - dl_dci->rv[0] = (round + 1) % 4; + dl_dci->rv[0] = round&3; dl_dci->has_dl_power_offset = 1; dl_dci->dl_power_offset = ue_sched_ctl->dl_pow_off[CC_id]; @@ -843,7 +864,7 @@ schedule_ue_spec_default( dl_dci->rb_shift = 0; dl_dci->n_ndi = 1; dl_dci->ndi = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_ndi); - dl_dci->ndi[0] = 1-UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]; + dl_dci->ndi[0] = 1 - UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]; dl_dci->n_rv = 1; dl_dci->rv = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_rv); dl_dci->rv[0] = 0; @@ -873,8 +894,8 @@ schedule_ue_spec_default( dl_dci->rb_shift = 0; dl_dci->n_ndi = 2; dl_dci->ndi = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_ndi); - dl_dci->ndi[0] = 1; - dl_dci->ndi[1] = 1; + dl_dci->ndi[0] = 1 - UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]; + dl_dci->ndi[1] = 1 - UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]; dl_dci->n_rv = 2; dl_dci->rv = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_rv); dl_dci->rv[0] = 0; @@ -907,8 +928,8 @@ schedule_ue_spec_default( dl_dci->rb_shift = 0; dl_dci->n_ndi = 2; dl_dci->ndi = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_ndi); - dl_dci->ndi[0] = 1; - dl_dci->ndi[1] = 1; + dl_dci->ndi[0] = 1 - UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]; + dl_dci->ndi[1] = 1 - UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]; dl_dci->n_rv = 2; dl_dci->rv = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_rv); dl_dci->rv[0] = 0; @@ -941,7 +962,7 @@ schedule_ue_spec_default( dl_dci->rb_shift = 0; dl_dci->n_ndi = 1; dl_dci->ndi = 1; - dl_dci->ndi[0] = 1; + dl_dci->ndi[0] = 1 - UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]; dl_dci->n_rv = 1; dl_dci->rv = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_rv); dl_dci->rv[0] = 0; @@ -981,7 +1002,7 @@ schedule_ue_spec_default( dl_dci->rb_shift = 0; dl_dci->n_ndi = 1; dl_dci->ndi = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_ndi); - dl_dci->ndi[0] = 1; + dl_dci->ndi[0] = 1 - UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]; dl_dci->n_rv = 1; dl_dci->rv = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_rv); dl_dci->rv[0] = round&3; From e8f4e4e01f7b4cef8b284e7bb8bad87bc9899aca Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Wed, 3 Feb 2016 17:44:20 +0000 Subject: [PATCH 085/349] Separated control from data plane in MAC agent scheduler --- cmake_targets/CMakeLists.txt | 1 + .../LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c | 458 +----------------- openair2/LAYER2/MAC/eNB_scheduler.c | 45 +- 3 files changed, 29 insertions(+), 475 deletions(-) diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index 631872f847..b555f67ebc 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -1010,6 +1010,7 @@ set (MAC_SRC ${MAC_DIR}/pre_processor.c ${MAC_DIR}/config.c ${MAC_DIR}/eNB_agent_scheduler_dlsch_ue.c + ${MAC_DIR}/eNB_agent_scheduler_dataplane.c ) set (ENB_APP_SRC diff --git a/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c b/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c index b97c15c9f5..6da07ac558 100644 --- a/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c +++ b/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c @@ -44,6 +44,7 @@ #include "SCHED/defs.h" #include "SCHED/extern.h" +#include "LAYER2/MAC/enb_agent_mac_proto.h" #include "LAYER2/MAC/defs.h" #include "LAYER2/MAC/proto.h" #include "LAYER2/MAC/extern.h" @@ -83,25 +84,19 @@ schedule_ue_spec_default( ) //------------------------------------------------------------------------------ { - //TODO uint8_t CC_id; int UE_id; int N_RBG[MAX_NUM_CCs]; unsigned char aggregation; mac_rlc_status_resp_t rlc_status; - unsigned char header_len_dcch=0, header_len_dcch_tmp=0,header_len_dtch=0,header_len_dtch_tmp=0, ta_len=0; - unsigned char sdu_lcids[11],offset,num_sdus=0; - uint16_t nb_rb,nb_rb_temp,total_nb_available_rb[MAX_NUM_CCs],nb_available_rb; - uint16_t TBS,j,sdu_lengths[11],rnti,padding=0,post_padding=0; - unsigned char dlsch_buffer[MAX_DLSCH_PAYLOAD_BYTES]; + unsigned char header_len_dcch=0, header_len_dcch_tmp=0, header_len_dtch=0, header_len_dtch_tmp=0, ta_len=0; + uint16_t nb_rb, nb_rb_temp, total_nb_available_rb[MAX_NUM_CCs], nb_available_rb; + uint16_t TBS, j, rnti, padding=0, post_padding=0; unsigned char round = 0; unsigned char harq_pid = 0; void *DLSCH_dci = NULL; LTE_eNB_UE_stats *eNB_UE_stats = NULL; uint16_t sdu_length_total = 0; - // uint8_t dl_pow_off[MAX_NUM_CCs][NUMBER_OF_UE_MAX]; - // unsigned char rballoc_sub_UE[MAX_NUM_CCs][NUMBER_OF_UE_MAX][N_RBG_MAX]; - // uint16_t pre_nb_available_rbs[MAX_NUM_CCs][NUMBER_OF_UE_MAX]; int mcs, mcs_tmp; uint16_t min_rb_unit[MAX_NUM_CCs]; eNB_MAC_INST *eNB = &eNB_mac_inst[mod_id]; @@ -241,7 +236,6 @@ schedule_ue_spec_default( sdu_length_total=0; - num_sdus=0; /* DevCheck(((eNB_UE_stats->DL_cqi[0] < MIN_CQI_VALUE) || (eNB_UE_stats->DL_cqi[0] > MAX_CQI_VALUE)), @@ -261,7 +255,7 @@ schedule_ue_spec_default( #endif // store stats - //UE_list->eNB_UE_stats[CC_id][UE_id].dl_cqi= eNB_UE_stats->DL_cqi[0]; + // // initializing the rb allocation indicator for each UE for(j = 0; j < frame_parms[CC_id]->N_RBG; j++) { @@ -1051,445 +1045,3 @@ schedule_ue_spec_default( stop_meas(&eNB->schedule_dlsch); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_SCHEDULE_DLSCH,VCD_FUNCTION_OUT); } - -void apply_scheduling_decisions(mid_t mod_id, - uint32_t frame, - uint32_t subframe, - int *mbsfn_flag, - Protocol__ProgranMessage *dl_scheduling_info) { - - uint8_t CC_id; - int UE_id; - int N_RBG[MAX_NUM_CCs]; - unsigned char aggregation; - mac_rlc_status_resp_t rlc_status; - unsigned char header_len_dcch=0, header_len_dcch_tmp=0,header_len_dtch=0,header_len_dtch_tmp=0, ta_len=0; - unsigned char sdu_lcids[11],offset,num_sdus=0; - uint16_t nb_rb,nb_rb_temp,total_nb_available_rb[MAX_NUM_CCs],nb_available_rb; - uint16_t TBS,j,sdu_lengths[11],rnti,padding=0,post_padding=0; - unsigned char dlsch_buffer[MAX_DLSCH_PAYLOAD_BYTES]; - unsigned char round = 0; - unsigned char harq_pid = 0; - void *DLSCH_dci = NULL; - DCI_PDU *DCI_pdu; - - LTE_eNB_UE_stats *eNB_UE_stats = NULL; - uint16_t sdu_length_total = 0; - int mcs; - uint16_t min_rb_unit[MAX_NUM_CCs]; - short ta_update = 0; - eNB_MAC_INST *eNB = &eNB_mac_inst[mod_id]; - UE_list_t *UE_list = &eNB->UE_list; - LTE_DL_FRAME_PARMS *frame_parms[MAX_NUM_CCs]; - int32_t normalized_rx_power, target_rx_power; - int32_t tpc=1; - static int32_t tpc_accumulated=0; - UE_sched_ctrl *ue_sched_ctl; - - int i; - int size_bits,size_bytes; - - Protocol__PrpDlMacConfig *mac_config = dl_scheduling_info->dl_mac_config_msg; - Protocol__PrpDlData *dl_data; - Protocol__PrpDlDci *dl_dci; - - uint32_t rlc_size, n_lc, lcid; - - // Check if there is any scheduling command for UE data - if (mac_config->n_dl_ue_data > 0) { - - // For each UE-related command - for (i = 0; i < mac_config->n_dl_ue_data; i++) { - - dl_data = mac_config->dl_ue_data[i]; - dl_dci = dl_data->dl_dci; - - CC_id = dl_data->serv_cell_index; - rnti = dl_data->rnti; - UE_id = find_ue(rnti, PHY_vars_eNB_g[mod_id][CC_id]); - - ue_sched_ctl = &UE_list->UE_sched_ctrl[UE_id]; - eNB_UE_stats = mac_xface->get_eNB_UE_stats(mod_id,CC_id,rnti); - - round = dl_dci->rv[0]; - harq_pid = dl_dci->harq_process; - - // Note this code is for a specific DCI format - DLSCH_dci = (void *)UE_list->UE_template[CC_id][UE_id].DLSCH_DCI[harq_pid]; - DCI_pdu = &eNB->common_channels[CC_id].DCI_pdu; - - frame_parms[CC_id] = mac_xface->get_lte_frame_parms(mod_id, CC_id); - - switch (frame_parms[CC_id]->N_RB_DL) { - case 6: - if (frame_parms[CC_id]->frame_type == TDD) { - if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1) { - ((DCI1_1_5MHz_TDD_t*)DLSCH_dci)->harq_pid = harq_pid; - ((DCI1_1_5MHz_TDD_t*)DLSCH_dci)->rv = round; - ((DCI1_1_5MHz_TDD_t*)DLSCH_dci)->dai = dl_dci->dai; - ((DCI1_1_5MHz_TDD_t*)DLSCH_dci)->rballoc = dl_dci->rb_bitmap; - ((DCI1_1_5MHz_TDD_t*)DLSCH_dci)->rah = dl_dci->res_alloc; - ((DCI1_1_5MHz_TDD_t*)DLSCH_dci)->mcs = dl_dci->mcs[0]; - ((DCI1_1_5MHz_TDD_t*)DLSCH_dci)->TPC = dl_dci->tpc; - ((DCI1_1_5MHz_TDD_t*)DLSCH_dci)->ndi = dl_dci->ndi[0]; - size_bytes = sizeof(DCI1_1_5MHz_TDD_t); - size_bits = sizeof_DCI1_1_5MHz_TDD_t; - } else if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_2A) { - //TODO - } else if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1D) { - //TODO - } - } else { - if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1) { - LOG_D(MAC,"[TEST] Setting DCI format 1\n"); - ((DCI1_1_5MHz_FDD_t*)DLSCH_dci)->harq_pid = harq_pid; - ((DCI1_1_5MHz_FDD_t*)DLSCH_dci)->rv = round; - ((DCI1_1_5MHz_FDD_t*)DLSCH_dci)->rballoc = dl_dci->rb_bitmap; - ((DCI1_1_5MHz_FDD_t*)DLSCH_dci)->rah = dl_dci->res_alloc; - ((DCI1_1_5MHz_FDD_t*)DLSCH_dci)->mcs = dl_dci->mcs[0]; - ((DCI1_1_5MHz_FDD_t*)DLSCH_dci)->TPC = dl_dci->tpc; - ((DCI1_1_5MHz_FDD_t*)DLSCH_dci)->ndi = dl_dci->ndi[0]; - size_bytes = sizeof(DCI1_1_5MHz_FDD_t); - size_bits = sizeof_DCI1_1_5MHz_FDD_t; - } else if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_2A) { - //TODO - } else if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1D) { - //TODO - } - } - break; - case 25: - if (frame_parms[CC_id]->frame_type == TDD) { - if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1) { - ((DCI1_5MHz_TDD_t*)DLSCH_dci)->harq_pid = harq_pid; - ((DCI1_5MHz_TDD_t*)DLSCH_dci)->rv = round; - ((DCI1_5MHz_TDD_t*)DLSCH_dci)->dai = dl_dci->dai; - ((DCI1_5MHz_TDD_t*)DLSCH_dci)->rballoc = dl_dci->rb_bitmap; - ((DCI1_5MHz_TDD_t*)DLSCH_dci)->rah = dl_dci->res_alloc; - ((DCI1_5MHz_TDD_t*)DLSCH_dci)->mcs = dl_dci->mcs[0]; - ((DCI1_5MHz_TDD_t*)DLSCH_dci)->TPC = dl_dci->tpc; - ((DCI1_5MHz_TDD_t*)DLSCH_dci)->ndi = dl_dci->ndi[0]; - size_bytes = sizeof(DCI1_5MHz_TDD_t); - size_bits = sizeof_DCI1_5MHz_TDD_t; - } else if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_2A) { - //TODO - } else if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1D) { - //TODO - } - } else { - if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1) { - ((DCI1_5MHz_FDD_t*)DLSCH_dci)->harq_pid = harq_pid; - ((DCI1_5MHz_FDD_t*)DLSCH_dci)->rv = round; - ((DCI1_5MHz_FDD_t*)DLSCH_dci)->rballoc = dl_dci->rb_bitmap; - ((DCI1_5MHz_FDD_t*)DLSCH_dci)->rah = dl_dci->res_alloc; - ((DCI1_5MHz_FDD_t*)DLSCH_dci)->mcs = dl_dci->mcs[0]; - ((DCI1_5MHz_FDD_t*)DLSCH_dci)->TPC = dl_dci->tpc; - ((DCI1_5MHz_FDD_t*)DLSCH_dci)->ndi = dl_dci->ndi[0]; - size_bytes = sizeof(DCI1_5MHz_FDD_t); - size_bits = sizeof_DCI1_5MHz_FDD_t; - } else if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_2A) { - //TODO - } else if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1D) { - //TODO - } - } - break; - case 50: - if (frame_parms[CC_id]->frame_type == TDD) { - if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1) { - ((DCI1_10MHz_TDD_t*)DLSCH_dci)->harq_pid = harq_pid; - ((DCI1_10MHz_TDD_t*)DLSCH_dci)->rv = round; - ((DCI1_10MHz_TDD_t*)DLSCH_dci)->dai = dl_dci->dai; - ((DCI1_10MHz_TDD_t*)DLSCH_dci)->rballoc = dl_dci->rb_bitmap; - ((DCI1_10MHz_TDD_t*)DLSCH_dci)->rah = dl_dci->res_alloc; - ((DCI1_10MHz_TDD_t*)DLSCH_dci)->mcs = dl_dci->mcs[0]; - ((DCI1_10MHz_TDD_t*)DLSCH_dci)->TPC = dl_dci->tpc; - ((DCI1_10MHz_TDD_t*)DLSCH_dci)->ndi = dl_dci->ndi[0]; - size_bytes = sizeof(DCI1_10MHz_TDD_t); - size_bits = sizeof_DCI1_10MHz_TDD_t; - } else if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_2A) { - //TODO - } else if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1D) { - //TODO - } - } else { - if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1) { - ((DCI1_10MHz_FDD_t*)DLSCH_dci)->harq_pid = harq_pid; - ((DCI1_10MHz_FDD_t*)DLSCH_dci)->rv = round; - ((DCI1_10MHz_FDD_t*)DLSCH_dci)->rballoc = dl_dci->rb_bitmap; - ((DCI1_10MHz_FDD_t*)DLSCH_dci)->rah = dl_dci->res_alloc; - ((DCI1_10MHz_FDD_t*)DLSCH_dci)->mcs = dl_dci->mcs[0]; - ((DCI1_10MHz_FDD_t*)DLSCH_dci)->TPC = dl_dci->tpc; - ((DCI1_10MHz_TDD_t*)DLSCH_dci)->ndi = dl_dci->ndi[0]; - size_bytes = sizeof(DCI1_10MHz_FDD_t); - size_bits = sizeof_DCI1_10MHz_FDD_t; - } else if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_2A) { - //TODO - } else if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1D) { - //TODO - } - } - break; - case 100: - if (frame_parms[CC_id]->frame_type == TDD) { - if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1) { - ((DCI1_20MHz_TDD_t*)DLSCH_dci)->harq_pid = harq_pid; - ((DCI1_20MHz_TDD_t*)DLSCH_dci)->rv = round; - ((DCI1_20MHz_TDD_t*)DLSCH_dci)->dai = dl_dci->dai; - ((DCI1_20MHz_TDD_t*)DLSCH_dci)->rballoc = dl_dci->rb_bitmap; - ((DCI1_20MHz_TDD_t*)DLSCH_dci)->rah = dl_dci->res_alloc; - ((DCI1_20MHz_TDD_t*)DLSCH_dci)->mcs = dl_dci->mcs[0]; - ((DCI1_20MHz_TDD_t*)DLSCH_dci)->TPC = dl_dci->tpc; - ((DCI1_20MHz_TDD_t*)DLSCH_dci)->ndi = dl_dci->ndi[0]; - size_bytes = sizeof(DCI1_20MHz_TDD_t); - size_bits = sizeof_DCI1_20MHz_TDD_t; - } else if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_2A) { - //TODO - } else if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1D) { - //TODO - } - } else { - if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1) { - ((DCI1_20MHz_FDD_t*)DLSCH_dci)->harq_pid = harq_pid; - ((DCI1_20MHz_FDD_t*)DLSCH_dci)->rv = round; - ((DCI1_20MHz_FDD_t*)DLSCH_dci)->rballoc = dl_dci->rb_bitmap; - ((DCI1_20MHz_FDD_t*)DLSCH_dci)->rah = dl_dci->res_alloc; - ((DCI1_20MHz_FDD_t*)DLSCH_dci)->mcs = dl_dci->mcs[0]; - ((DCI1_20MHz_FDD_t*)DLSCH_dci)->TPC = dl_dci->tpc; - ((DCI1_20MHz_FDD_t*)DLSCH_dci)->ndi = dl_dci->ndi[0]; - size_bytes = sizeof(DCI1_20MHz_FDD_t); - size_bits = sizeof_DCI1_20MHz_FDD_t; - } else if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_2A) { - //TODO - } else if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1D) { - //TODO - } - } - break; - } - - // If this is a new transmission - if (round == 0) { - // First we have to deal with the creation of the PDU based on the message instructions - rlc_status.bytes_in_buffer = 0; - - TBS = dl_dci->tbs_size[0]; - LOG_D(MAC,"[TEST] The TBS during the creation process is %d\n", TBS); - - if (dl_data->n_ce_bitmap > 0) { - //Check if there is TA command - if (dl_data->ce_bitmap[0] & PROTOCOL__PRP_CE_TYPE__PRPCET_TA) { - ta_len = 2; - LOG_D(MAC, "[TEST] Need to send timing advance\n"); - } else { - ta_len = 0; - LOG_D(MAC, "[TEST] No timing advance\n"); - } - } - - - n_lc = dl_data->n_rlc_pdu; - num_sdus = 0; - sdu_length_total = 0; - // Go through each one of the channel commands and create SDUs - for (i = 0; i < n_lc; i++) { - lcid = dl_data->rlc_pdu[i]->rlc_pdu_tb[0]->logical_channel_id; - LOG_D(MAC, "[TEST] Going through SDU of channel %d\n", lcid); - rlc_size = dl_data->rlc_pdu[i]->rlc_pdu_tb[0]->size; - LOG_D(MAC,"[TEST] [eNB %d] Frame %d, LCID %d, CC_id %d, Requesting %d bytes from RLC (RRC message)\n", - mod_id, frame, lcid, CC_id, rlc_size); - if (rlc_size > 0) { - - rlc_status = mac_rlc_status_ind(mod_id, - rnti, - mod_id, - frame, - ENB_FLAG_YES, - MBMS_FLAG_NO, - lcid, - rlc_size); // transport block set size - - sdu_lengths[i] = 0; - - LOG_D(MAC, "[TEST] RLC can give %d bytes for LCID %d during second call\n", rlc_status.bytes_in_buffer, lcid); - - sdu_lengths[i] += mac_rlc_data_req(mod_id, - rnti, - mod_id, - frame, - ENB_FLAG_YES, - MBMS_FLAG_NO, - lcid, - (char *)&dlsch_buffer[sdu_length_total]); - - LOG_D(MAC, "[TEST] RLC gave %d bytes in LCID %d\n", sdu_lengths[i], lcid); - - LOG_D(MAC,"[eNB %d][LCID %d] CC_id %d Got %d bytes from RLC\n",mod_id, lcid, CC_id, sdu_lengths[i]); - sdu_length_total += sdu_lengths[i]; - LOG_D(MAC, "[TEST] Total sdu size became %d\n", sdu_length_total); - sdu_lcids[i] = lcid; - - UE_list->eNB_UE_stats[CC_id][UE_id].num_pdu_tx[lcid] += 1; - UE_list->eNB_UE_stats[CC_id][UE_id].num_bytes_tx[lcid] += sdu_lengths[i]; - - if (lcid == DCCH || lcid == DCCH1) { - header_len_dcch += 2; - } else if (lcid == DTCH) { - if (sdu_lengths[i] < 128) { - header_len_dtch = 2; - } else { - header_len_dtch = 3; - } - } - - num_sdus++; - } - } // SDU creation end - - - if (((sdu_length_total + header_len_dcch + header_len_dtch) > 0)) { - - header_len_dcch_tmp = header_len_dcch; - header_len_dtch_tmp = header_len_dtch; - - if (header_len_dtch==0) { - header_len_dcch = (header_len_dcch >0) ? (header_len_dcch - 1) : header_len_dcch; // remove length field - } else { - header_len_dtch = (header_len_dtch > 0) ? 1 : header_len_dtch; // remove length field for the last SDU - } - - // there is a payload - if (((sdu_length_total + header_len_dcch + header_len_dtch ) > 0)) { - if ((TBS - header_len_dcch - header_len_dtch - sdu_length_total - ta_len) <= 2 - || (TBS - header_len_dcch - header_len_dtch - sdu_length_total - ta_len) > TBS) { //protect from overflow - padding = (TBS - header_len_dcch - header_len_dtch - sdu_length_total - ta_len); - post_padding = 0; - } else { - padding = 0; - - // adjust the header len - if (header_len_dtch==0) { - header_len_dcch = header_len_dcch_tmp; - } else { - header_len_dtch = header_len_dtch_tmp; - } - - post_padding = TBS - sdu_length_total - header_len_dcch - header_len_dtch - ta_len - 1; // 1 is for the postpadding header - } - } - - - if (ta_len > 0) { - ta_update = ue_sched_ctl->ta_update; - } else { - ta_update = 0; - } - - offset = generate_dlsch_header((unsigned char*)UE_list->DLSCH_pdu[CC_id][0][UE_id].payload[0], - // offset = generate_dlsch_header((unsigned char*)eNB_mac_inst[0].DLSCH_pdu[0][0].payload[0], - num_sdus, //num_sdus - sdu_lengths, // - sdu_lcids, - 255, // no drx - ta_update, // timing advance - NULL, // contention res id - padding, - post_padding); - - LOG_D(MAC, "[TEST]Have to schedule %d SDUs with length %d. TBS is %d, LCID is %d, post padding is %d, padding is %d, header offset is %d, total sdu size is %d\n", num_sdus, sdu_lengths[0], TBS, sdu_lcids[0], post_padding, padding, offset, sdu_length_total); - -#ifdef DEBUG_eNB_SCHEDULER - LOG_T(MAC,"[eNB %d] First 16 bytes of DLSCH : \n"); - - for (i=0; i<16; i++) { - LOG_T(MAC,"%x.",dlsch_buffer[i]); - } - - LOG_T(MAC,"\n"); -#endif - // cycle through SDUs and place in dlsch_buffer - memcpy(&UE_list->DLSCH_pdu[CC_id][0][UE_id].payload[0][offset],dlsch_buffer,sdu_length_total); - // memcpy(&eNB_mac_inst[0].DLSCH_pdu[0][0].payload[0][offset],dcch_buffer,sdu_lengths[0]); - - // fill remainder of DLSCH with random data - for (j=0; j<(TBS-sdu_length_total-offset); j++) { - UE_list->DLSCH_pdu[CC_id][0][UE_id].payload[0][offset+sdu_length_total+j] = (char)(taus()&0xff); - } - - //eNB_mac_inst[0].DLSCH_pdu[0][0].payload[0][offset+sdu_lengths[0]+j] = (char)(taus()&0xff); - if (opt_enabled == 1) { - trace_pdu(1, (uint8_t *)UE_list->DLSCH_pdu[CC_id][0][UE_id].payload[0], - TBS, mod_id, 3, UE_RNTI(mod_id, UE_id), - eNB->subframe,0,0); - LOG_D(OPT,"[eNB %d][DLSCH] CC_id %d Frame %d rnti %x with size %d\n", - mod_id, CC_id, frame, UE_RNTI(mod_id,UE_id), TBS); - } - - // store stats - eNB->eNB_stats[CC_id].dlsch_bytes_tx+=sdu_length_total; - eNB->eNB_stats[CC_id].dlsch_pdus_tx+=1; - - UE_list->eNB_UE_stats[CC_id][UE_id].crnti= rnti; - UE_list->eNB_UE_stats[CC_id][UE_id].rrc_status=mac_eNB_get_rrc_status(mod_id, rnti); - UE_list->eNB_UE_stats[CC_id][UE_id].harq_pid = harq_pid; - UE_list->eNB_UE_stats[CC_id][UE_id].harq_round = round; - - nb_rb = UE_list->UE_template[CC_id][UE_id].nb_rb[harq_pid]; - LOG_D(MAC,"[TEST] %d Number of resource blocks allocated\n", nb_rb); - UE_list->eNB_UE_stats[CC_id][UE_id].rbs_used = nb_rb; - UE_list->eNB_UE_stats[CC_id][UE_id].total_rbs_used += nb_rb; - UE_list->eNB_UE_stats[CC_id][UE_id].dlsch_mcs1=dl_dci->mcs[0]; - UE_list->eNB_UE_stats[CC_id][UE_id].dlsch_mcs2=dl_dci->mcs[0]; - UE_list->eNB_UE_stats[CC_id][UE_id].TBS = TBS; - - UE_list->eNB_UE_stats[CC_id][UE_id].overhead_bytes= TBS- sdu_length_total; - UE_list->eNB_UE_stats[CC_id][UE_id].total_sdu_bytes+= sdu_length_total; - UE_list->eNB_UE_stats[CC_id][UE_id].total_pdu_bytes+= TBS; - UE_list->eNB_UE_stats[CC_id][UE_id].total_num_pdus+=1; - - eNB_UE_stats->dlsch_mcs1 = cqi_to_mcs[eNB_UE_stats->DL_cqi[0]]; - eNB_UE_stats->dlsch_mcs1 = cmin(eNB_UE_stats->dlsch_mcs1, openair_daq_vars.target_ue_dl_mcs); - // TODO - - - } - - - - } else { - // No need to create anything apart of DCI in case of retransmission - - /*TODO: Must add these */ - //eNB_UE_stats->dlsch_trials[round]++; - //UE_list->eNB_UE_stats[CC_id][UE_id].num_retransmission+=1; - //UE_list->eNB_UE_stats[CC_id][UE_id].rbs_used_retx=nb_rb; - //UE_list->eNB_UE_stats[CC_id][UE_id].total_rbs_used_retx+=nb_rb; - //UE_list->eNB_UE_stats[CC_id][UE_id].ncce_used_retx=nCCECC_id]; - //UE_list->eNB_UE_stats[CC_id][UE_id].dlsch_mcs1=eNB_UE_stats->dlsch_mcs1; - //UE_list->eNB_UE_stats[CC_id][UE_id].dlsch_mcs2=eNB_UE_stats->dlsch_mcs1; - } - - //Add DCI based on format - if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1) { - add_ue_spec_dci(DCI_pdu, - DLSCH_dci, - rnti, - size_bytes, - dl_dci->aggr_level,//aggregation - size_bits, - format1, - 0); - } else if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_2A) { - add_ue_spec_dci(DCI_pdu, - DLSCH_dci, - rnti, - size_bytes, - dl_dci->aggr_level,//aggregation - size_bits, - format2A, - 0); - } - } - } -} - diff --git a/openair2/LAYER2/MAC/eNB_scheduler.c b/openair2/LAYER2/MAC/eNB_scheduler.c index caf7457fea..fec058b27e 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler.c +++ b/openair2/LAYER2/MAC/eNB_scheduler.c @@ -62,6 +62,7 @@ //Agent-related headers #include "ENB_APP/enb_agent_extern.h" #include "ENB_APP/enb_agent_mac.h" +#include "LAYER2/MAC/enb_agent_mac_proto.h" #if defined(ENABLE_ITTI) # include "intertask_interface.h" @@ -273,7 +274,7 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, mbsfn_status, msg); - apply_scheduling_decisions(module_idP, + apply_dl_scheduling_decisions(module_idP, frameP, subframeP, mbsfn_status, @@ -322,7 +323,7 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, mbsfn_status, msg); - apply_scheduling_decisions(module_idP, + apply_dl_scheduling_decisions(module_idP, frameP, subframeP, mbsfn_status, @@ -353,7 +354,7 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, mbsfn_status, msg); - apply_scheduling_decisions(module_idP, + apply_dl_scheduling_decisions(module_idP, frameP, subframeP, mbsfn_status, @@ -390,7 +391,7 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, mbsfn_status, msg); - apply_scheduling_decisions(module_idP, + apply_dl_scheduling_decisions(module_idP, frameP, subframeP, mbsfn_status, @@ -419,7 +420,7 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, mbsfn_status, msg); - apply_scheduling_decisions(module_idP, + apply_dl_scheduling_decisions(module_idP, frameP, subframeP, mbsfn_status, @@ -463,7 +464,7 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, mbsfn_status, msg); - apply_scheduling_decisions(module_idP, + apply_dl_scheduling_decisions(module_idP, frameP, subframeP, mbsfn_status, @@ -494,7 +495,7 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, mbsfn_status, msg); - apply_scheduling_decisions(module_idP, + apply_dl_scheduling_decisions(module_idP, frameP, subframeP, mbsfn_status, @@ -531,7 +532,7 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, mbsfn_status, msg); - apply_scheduling_decisions(module_idP, + apply_dl_scheduling_decisions(module_idP, frameP, subframeP, mbsfn_status, @@ -559,7 +560,7 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, mbsfn_status, msg); - apply_scheduling_decisions(module_idP, + apply_dl_scheduling_decisions(module_idP, frameP, subframeP, mbsfn_status, @@ -612,7 +613,7 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, mbsfn_status, msg); - apply_scheduling_decisions(module_idP, + apply_dl_scheduling_decisions(module_idP, frameP, subframeP, mbsfn_status, @@ -637,7 +638,7 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, mbsfn_status, msg); - apply_scheduling_decisions(module_idP, + apply_dl_scheduling_decisions(module_idP, frameP, subframeP, mbsfn_status, @@ -665,7 +666,7 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, mbsfn_status, msg); - apply_scheduling_decisions(module_idP, + apply_dl_scheduling_decisions(module_idP, frameP, subframeP, mbsfn_status, @@ -699,7 +700,7 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, mbsfn_status, msg); - apply_scheduling_decisions(module_idP, + apply_dl_scheduling_decisions(module_idP, frameP, subframeP, mbsfn_status, @@ -723,7 +724,7 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, mbsfn_status, msg); - apply_scheduling_decisions(module_idP, + apply_dl_scheduling_decisions(module_idP, frameP, subframeP, mbsfn_status, @@ -751,7 +752,7 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, mbsfn_status, msg); - apply_scheduling_decisions(module_idP, + apply_dl_scheduling_decisions(module_idP, frameP, subframeP, mbsfn_status, @@ -790,7 +791,7 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, mbsfn_status, msg); - apply_scheduling_decisions(module_idP, + apply_dl_scheduling_decisions(module_idP, frameP, subframeP, mbsfn_status, @@ -818,7 +819,7 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, mbsfn_status, msg); - apply_scheduling_decisions(module_idP, + apply_dl_scheduling_decisions(module_idP, frameP, subframeP, mbsfn_status, @@ -851,7 +852,7 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, mbsfn_status, msg); - apply_scheduling_decisions(module_idP, + apply_dl_scheduling_decisions(module_idP, frameP, subframeP, mbsfn_status, @@ -877,7 +878,7 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, mbsfn_status, msg); - apply_scheduling_decisions(module_idP, + apply_dl_scheduling_decisions(module_idP, frameP, subframeP, mbsfn_status, @@ -903,7 +904,7 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, mbsfn_status, msg); - apply_scheduling_decisions(module_idP, + apply_dl_scheduling_decisions(module_idP, frameP, subframeP, mbsfn_status, @@ -929,7 +930,7 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, mbsfn_status, msg); - apply_scheduling_decisions(module_idP, + apply_dl_scheduling_decisions(module_idP, frameP, subframeP, mbsfn_status, @@ -957,7 +958,7 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, mbsfn_status, msg); - apply_scheduling_decisions(module_idP, + apply_dl_scheduling_decisions(module_idP, frameP, subframeP, mbsfn_status, From db255c130dd97721f70bb4f8ba2e70281b2007f9 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Thu, 4 Feb 2016 11:28:22 +0000 Subject: [PATCH 086/349] Added definitions for the mac agent scheduler --- openair2/ENB_APP/enb_agent_mac_defs.h | 2 + .../MAC/eNB_agent_scheduler_dataplane.c | 544 ++++++++++++++++++ openair2/LAYER2/MAC/enb_agent_mac_proto.h | 71 +++ openair2/LAYER2/MAC/proto.h | 7 - 4 files changed, 617 insertions(+), 7 deletions(-) create mode 100644 openair2/LAYER2/MAC/eNB_agent_scheduler_dataplane.c create mode 100644 openair2/LAYER2/MAC/enb_agent_mac_proto.h diff --git a/openair2/ENB_APP/enb_agent_mac_defs.h b/openair2/ENB_APP/enb_agent_mac_defs.h index c2891e87ca..6e960cdb69 100644 --- a/openair2/ENB_APP/enb_agent_mac_defs.h +++ b/openair2/ENB_APP/enb_agent_mac_defs.h @@ -39,6 +39,8 @@ #define __ENB_AGENT_MAC_PRIMITIVES_H__ #include "enb_agent_defs.h" +#include "progran.pb-c.h" +#include "header.pb-c.h" /* ENB AGENT-MAC Interface */ typedef struct { diff --git a/openair2/LAYER2/MAC/eNB_agent_scheduler_dataplane.c b/openair2/LAYER2/MAC/eNB_agent_scheduler_dataplane.c new file mode 100644 index 0000000000..43d4ad2b51 --- /dev/null +++ b/openair2/LAYER2/MAC/eNB_agent_scheduler_dataplane.c @@ -0,0 +1,544 @@ +/******************************************************************************* + OpenAirInterface + Copyright(c) 1999 - 2014 Eurecom + + OpenAirInterface is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + + OpenAirInterface is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with OpenAirInterface.The full GNU General Public License is + included in this distribution in the file called "COPYING". If not, + see . + + Contact Information + OpenAirInterface Admin: openair_admin@eurecom.fr + OpenAirInterface Tech : openair_tech@eurecom.fr + OpenAirInterface Dev : openair4g-devel@lists.eurecom.fr + + Address : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE + +*******************************************************************************/ + +/*! \file eNB_agent_scheduler_dataplane.c + * \brief data plane procedures related to eNB scheduling + * \author Xenofon Foukas + * \date 2016 + * \email: x.foukas@sms.ed.ac.uk + * \version 0.1 + * @ingroup _mac + + */ + +#include "assertions.h" +#include "PHY/defs.h" +#include "PHY/extern.h" + +#include "SCHED/defs.h" +#include "SCHED/extern.h" + +#include "LAYER2/MAC/enb_agent_mac_proto.h" +#include "LAYER2/MAC/defs.h" +#include "LAYER2/MAC/proto.h" +#include "LAYER2/MAC/extern.h" + +#include "UTIL/LOG/log.h" +#include "UTIL/LOG/vcd_signal_dumper.h" +#include "UTIL/OPT/opt.h" +#include "OCG.h" +#include "OCG_extern.h" + +#include "RRC/LITE/extern.h" +#include "RRC/L2_INTERFACE/openair_rrc_L2_interface.h" + +#include "header.pb-c.h" +#include "progran.pb-c.h" + +#include "SIMULATION/TOOLS/defs.h" // for taus + + +void apply_dl_scheduling_decisions(mid_t mod_id, + uint32_t frame, + uint32_t subframe, + int *mbsfn_flag, + Protocol__ProgranMessage *dl_scheduling_info) { + + Protocol__PrpDlMacConfig *mac_config = dl_scheduling_info->dl_mac_config_msg; + + // Check if there is anything to schedule for random access + if (mac_config->n_dl_rar > 0) { + /*TODO: call the random access data plane function*/ + } + + // Check if there is anything to schedule for paging/broadcast + if (mac_config->n_dl_broadcast > 0) { + /*TODO: call the broadcast/paging data plane function*/ + } + + // Check if there is anything to schedule for the UEs + if (mac_config->n_dl_ue_data > 0) { + apply_ue_spec_scheduling_decisions(mod_id, frame, subframe, mbsfn_flag, + mac_config->n_dl_ue_data, mac_config->dl_ue_data); + } + +} + + +void apply_ue_spec_scheduling_decisions(mid_t mod_id, + uint32_t frame, + uint32_t subframe, + int *mbsfn_flag, + uint32_t n_dl_ue_data, + const Protocol__PrpDlData **dl_ue_data) { + + uint8_t CC_id; + int UE_id; + int N_RBG[MAX_NUM_CCs]; + unsigned char aggregation; + mac_rlc_status_resp_t rlc_status; + unsigned char header_len_dcch=0, header_len_dcch_tmp=0,header_len_dtch=0,header_len_dtch_tmp=0, ta_len=0; + unsigned char sdu_lcids[11],offset,num_sdus=0; + uint16_t nb_rb,nb_rb_temp,total_nb_available_rb[MAX_NUM_CCs],nb_available_rb; + uint16_t TBS,j,sdu_lengths[11],rnti,padding=0,post_padding=0; + unsigned char dlsch_buffer[MAX_DLSCH_PAYLOAD_BYTES]; + unsigned char round = 0; + unsigned char harq_pid = 0; + + LTE_eNB_UE_stats *eNB_UE_stats = NULL; + uint16_t sdu_length_total = 0; + int mcs; + uint16_t min_rb_unit[MAX_NUM_CCs]; + short ta_update = 0; + eNB_MAC_INST *eNB = &eNB_mac_inst[mod_id]; + UE_list_t *UE_list = &eNB->UE_list; + LTE_DL_FRAME_PARMS *frame_parms[MAX_NUM_CCs]; + int32_t normalized_rx_power, target_rx_power; + int32_t tpc=1; + static int32_t tpc_accumulated=0; + UE_sched_ctrl *ue_sched_ctl; + + int i; + + Protocol__PrpDlData *dl_data; + Protocol__PrpDlDci *dl_dci; + + uint32_t rlc_size, n_lc, lcid; + + + // For each UE-related command + for (i = 0; i < n_dl_ue_data; i++) { + + dl_data = dl_ue_data[i]; + dl_dci = dl_data->dl_dci; + + CC_id = dl_data->serv_cell_index; + frame_parms[CC_id] = mac_xface->get_lte_frame_parms(mod_id, CC_id); + + rnti = dl_data->rnti; + UE_id = find_ue(rnti, PHY_vars_eNB_g[mod_id][CC_id]); + + ue_sched_ctl = &UE_list->UE_sched_ctrl[UE_id]; + eNB_UE_stats = mac_xface->get_eNB_UE_stats(mod_id,CC_id,rnti); + + round = dl_dci->rv[0]; + harq_pid = dl_dci->harq_process; + + // If this is a new transmission + if (round == 0) { + // First we have to deal with the creation of the PDU based on the message instructions + rlc_status.bytes_in_buffer = 0; + + TBS = dl_dci->tbs_size[0]; + LOG_D(MAC,"[TEST] The TBS during the creation process is %d\n", TBS); + + if (dl_data->n_ce_bitmap > 0) { + //Check if there is TA command + if (dl_data->ce_bitmap[0] & PROTOCOL__PRP_CE_TYPE__PRPCET_TA) { + ta_len = 2; + LOG_D(MAC, "[TEST] Need to send timing advance\n"); + } else { + ta_len = 0; + LOG_D(MAC, "[TEST] No timing advance\n"); + } + } + + + n_lc = dl_data->n_rlc_pdu; + num_sdus = 0; + sdu_length_total = 0; + // Go through each one of the channel commands and create SDUs + for (i = 0; i < n_lc; i++) { + lcid = dl_data->rlc_pdu[i]->rlc_pdu_tb[0]->logical_channel_id; + LOG_D(MAC, "[TEST] Going through SDU of channel %d\n", lcid); + rlc_size = dl_data->rlc_pdu[i]->rlc_pdu_tb[0]->size; + LOG_D(MAC,"[TEST] [eNB %d] Frame %d, LCID %d, CC_id %d, Requesting %d bytes from RLC (RRC message)\n", + mod_id, frame, lcid, CC_id, rlc_size); + if (rlc_size > 0) { + + rlc_status = mac_rlc_status_ind(mod_id, + rnti, + mod_id, + frame, + ENB_FLAG_YES, + MBMS_FLAG_NO, + lcid, + rlc_size); // transport block set size + + sdu_lengths[i] = 0; + + LOG_D(MAC, "[TEST] RLC can give %d bytes for LCID %d during second call\n", rlc_status.bytes_in_buffer, lcid); + + sdu_lengths[i] += mac_rlc_data_req(mod_id, + rnti, + mod_id, + frame, + ENB_FLAG_YES, + MBMS_FLAG_NO, + lcid, + (char *)&dlsch_buffer[sdu_length_total]); + + LOG_D(MAC, "[TEST] RLC gave %d bytes in LCID %d\n", sdu_lengths[i], lcid); + + LOG_D(MAC,"[eNB %d][LCID %d] CC_id %d Got %d bytes from RLC\n",mod_id, lcid, CC_id, sdu_lengths[i]); + sdu_length_total += sdu_lengths[i]; + LOG_D(MAC, "[TEST] Total sdu size became %d\n", sdu_length_total); + sdu_lcids[i] = lcid; + + UE_list->eNB_UE_stats[CC_id][UE_id].num_pdu_tx[lcid] += 1; + UE_list->eNB_UE_stats[CC_id][UE_id].num_bytes_tx[lcid] += sdu_lengths[i]; + + if (lcid == DCCH || lcid == DCCH1) { + header_len_dcch += 2; + } else if (lcid == DTCH) { + if (sdu_lengths[i] < 128) { + header_len_dtch = 2; + } else { + header_len_dtch = 3; + } + } + + num_sdus++; + } + } // SDU creation end + + + if (((sdu_length_total + header_len_dcch + header_len_dtch) > 0)) { + + header_len_dcch_tmp = header_len_dcch; + header_len_dtch_tmp = header_len_dtch; + + if (header_len_dtch==0) { + header_len_dcch = (header_len_dcch >0) ? (header_len_dcch - 1) : header_len_dcch; // remove length field + } else { + header_len_dtch = (header_len_dtch > 0) ? 1 : header_len_dtch; // remove length field for the last SDU + } + + // there is a payload + if (((sdu_length_total + header_len_dcch + header_len_dtch ) > 0)) { + if ((TBS - header_len_dcch - header_len_dtch - sdu_length_total - ta_len) <= 2 + || (TBS - header_len_dcch - header_len_dtch - sdu_length_total - ta_len) > TBS) { //protect from overflow + padding = (TBS - header_len_dcch - header_len_dtch - sdu_length_total - ta_len); + post_padding = 0; + } else { + padding = 0; + + // adjust the header len + if (header_len_dtch==0) { + header_len_dcch = header_len_dcch_tmp; + } else { + header_len_dtch = header_len_dtch_tmp; + } + + post_padding = TBS - sdu_length_total - header_len_dcch - header_len_dtch - ta_len - 1; // 1 is for the postpadding header + } + } + + + if (ta_len > 0) { + ta_update = ue_sched_ctl->ta_update; + } else { + ta_update = 0; + } + + offset = generate_dlsch_header((unsigned char*)UE_list->DLSCH_pdu[CC_id][0][UE_id].payload[0], + // offset = generate_dlsch_header((unsigned char*)eNB_mac_inst[0].DLSCH_pdu[0][0].payload[0], + num_sdus, //num_sdus + sdu_lengths, // + sdu_lcids, + 255, // no drx + ta_update, // timing advance + NULL, // contention res id + padding, + post_padding); + + LOG_D(MAC, "[TEST]Have to schedule %d SDUs with length %d. TBS is %d, LCID is %d, post padding is %d, padding is %d, header offset is %d, total sdu size is %d\n", num_sdus, sdu_lengths[0], TBS, sdu_lcids[0], post_padding, padding, offset, sdu_length_total); + +#ifdef DEBUG_eNB_SCHEDULER + LOG_T(MAC,"[eNB %d] First 16 bytes of DLSCH : \n"); + + for (i=0; i<16; i++) { + LOG_T(MAC,"%x.",dlsch_buffer[i]); + } + + LOG_T(MAC,"\n"); +#endif + // cycle through SDUs and place in dlsch_buffer + memcpy(&UE_list->DLSCH_pdu[CC_id][0][UE_id].payload[0][offset],dlsch_buffer,sdu_length_total); + // memcpy(&eNB_mac_inst[0].DLSCH_pdu[0][0].payload[0][offset],dcch_buffer,sdu_lengths[0]); + + // fill remainder of DLSCH with random data + for (j=0; j<(TBS-sdu_length_total-offset); j++) { + UE_list->DLSCH_pdu[CC_id][0][UE_id].payload[0][offset+sdu_length_total+j] = (char)(taus()&0xff); + } + + //eNB_mac_inst[0].DLSCH_pdu[0][0].payload[0][offset+sdu_lengths[0]+j] = (char)(taus()&0xff); + if (opt_enabled == 1) { + trace_pdu(1, (uint8_t *)UE_list->DLSCH_pdu[CC_id][0][UE_id].payload[0], + TBS, mod_id, 3, UE_RNTI(mod_id, UE_id), + eNB->subframe,0,0); + LOG_D(OPT,"[eNB %d][DLSCH] CC_id %d Frame %d rnti %x with size %d\n", + mod_id, CC_id, frame, UE_RNTI(mod_id,UE_id), TBS); + } + + // store stats + eNB->eNB_stats[CC_id].dlsch_bytes_tx+=sdu_length_total; + eNB->eNB_stats[CC_id].dlsch_pdus_tx+=1; + UE_list->eNB_UE_stats[CC_id][UE_id].dl_cqi= eNB_UE_stats->DL_cqi[0]; + + UE_list->eNB_UE_stats[CC_id][UE_id].crnti= rnti; + UE_list->eNB_UE_stats[CC_id][UE_id].rrc_status=mac_eNB_get_rrc_status(mod_id, rnti); + UE_list->eNB_UE_stats[CC_id][UE_id].harq_pid = harq_pid; + UE_list->eNB_UE_stats[CC_id][UE_id].harq_round = round; + + nb_rb = UE_list->UE_template[CC_id][UE_id].nb_rb[harq_pid]; + UE_list->eNB_UE_stats[CC_id][UE_id].rbs_used = nb_rb; + UE_list->eNB_UE_stats[CC_id][UE_id].total_rbs_used += nb_rb; + UE_list->eNB_UE_stats[CC_id][UE_id].dlsch_mcs1=dl_dci->mcs[0]; + UE_list->eNB_UE_stats[CC_id][UE_id].dlsch_mcs2=dl_dci->mcs[0]; + UE_list->eNB_UE_stats[CC_id][UE_id].TBS = TBS; + + UE_list->eNB_UE_stats[CC_id][UE_id].overhead_bytes= TBS- sdu_length_total; + UE_list->eNB_UE_stats[CC_id][UE_id].total_sdu_bytes+= sdu_length_total; + UE_list->eNB_UE_stats[CC_id][UE_id].total_pdu_bytes+= TBS; + UE_list->eNB_UE_stats[CC_id][UE_id].total_num_pdus+=1; + + eNB_UE_stats->dlsch_mcs1 = cqi_to_mcs[eNB_UE_stats->DL_cqi[0]]; + eNB_UE_stats->dlsch_mcs1 = cmin(eNB_UE_stats->dlsch_mcs1, openair_daq_vars.target_ue_dl_mcs); + } + } else { + // No need to create anything apart of DCI in case of retransmission + + /*TODO: Must add these */ + //eNB_UE_stats->dlsch_trials[round]++; + //UE_list->eNB_UE_stats[CC_id][UE_id].num_retransmission+=1; + //UE_list->eNB_UE_stats[CC_id][UE_id].rbs_used_retx=nb_rb; + //UE_list->eNB_UE_stats[CC_id][UE_id].total_rbs_used_retx+=nb_rb; + //UE_list->eNB_UE_stats[CC_id][UE_id].ncce_used_retx=nCCECC_id]; + //UE_list->eNB_UE_stats[CC_id][UE_id].dlsch_mcs1=eNB_UE_stats->dlsch_mcs1; + //UE_list->eNB_UE_stats[CC_id][UE_id].dlsch_mcs2=eNB_UE_stats->dlsch_mcs1; + } + //Fill the proper DCI of OAI + fill_oai_dci(mod_id, CC_id, rnti, dl_dci); + } +} + +void fill_oai_dci(mid_t mod_id, uint32_t CC_id, uint32_t rnti, + const Protocol__PrpDlDci *dl_dci) { + + void *DLSCH_dci = NULL; + DCI_PDU *DCI_pdu; + + unsigned char round = 0; + unsigned char harq_pid = 0; + LTE_DL_FRAME_PARMS *frame_parms[MAX_NUM_CCs]; + int size_bits, size_bytes; + eNB_MAC_INST *eNB = &eNB_mac_inst[mod_id]; + UE_list_t *UE_list = &eNB->UE_list; + + int UE_id = find_ue(rnti, PHY_vars_eNB_g[mod_id][CC_id]); + + harq_pid = dl_dci->harq_process; + round = dl_dci->rv[0]; + + // Note this code is for a specific DCI format + DLSCH_dci = (void *)UE_list->UE_template[CC_id][UE_id].DLSCH_DCI[harq_pid]; + DCI_pdu = &eNB->common_channels[CC_id].DCI_pdu; + + frame_parms[CC_id] = mac_xface->get_lte_frame_parms(mod_id, CC_id); + + switch (frame_parms[CC_id]->N_RB_DL) { + case 6: + if (frame_parms[CC_id]->frame_type == TDD) { + if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1) { + ((DCI1_1_5MHz_TDD_t*)DLSCH_dci)->harq_pid = harq_pid; + ((DCI1_1_5MHz_TDD_t*)DLSCH_dci)->rv = round; + ((DCI1_1_5MHz_TDD_t*)DLSCH_dci)->dai = dl_dci->dai; + ((DCI1_1_5MHz_TDD_t*)DLSCH_dci)->rballoc = dl_dci->rb_bitmap; + ((DCI1_1_5MHz_TDD_t*)DLSCH_dci)->rah = dl_dci->res_alloc; + ((DCI1_1_5MHz_TDD_t*)DLSCH_dci)->mcs = dl_dci->mcs[0]; + ((DCI1_1_5MHz_TDD_t*)DLSCH_dci)->TPC = dl_dci->tpc; + ((DCI1_1_5MHz_TDD_t*)DLSCH_dci)->ndi = dl_dci->ndi[0]; + size_bytes = sizeof(DCI1_1_5MHz_TDD_t); + size_bits = sizeof_DCI1_1_5MHz_TDD_t; + } else if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_2A) { + //TODO + } else if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1D) { + //TODO + } + } else { + if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1) { + LOG_D(MAC,"[TEST] Setting DCI format 1\n"); + ((DCI1_1_5MHz_FDD_t*)DLSCH_dci)->harq_pid = harq_pid; + ((DCI1_1_5MHz_FDD_t*)DLSCH_dci)->rv = round; + ((DCI1_1_5MHz_FDD_t*)DLSCH_dci)->rballoc = dl_dci->rb_bitmap; + ((DCI1_1_5MHz_FDD_t*)DLSCH_dci)->rah = dl_dci->res_alloc; + ((DCI1_1_5MHz_FDD_t*)DLSCH_dci)->mcs = dl_dci->mcs[0]; + ((DCI1_1_5MHz_FDD_t*)DLSCH_dci)->TPC = dl_dci->tpc; + ((DCI1_1_5MHz_FDD_t*)DLSCH_dci)->ndi = dl_dci->ndi[0]; + size_bytes = sizeof(DCI1_1_5MHz_FDD_t); + size_bits = sizeof_DCI1_1_5MHz_FDD_t; + } else if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_2A) { + //TODO + } else if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1D) { + //TODO + } + } + break; + case 25: + if (frame_parms[CC_id]->frame_type == TDD) { + if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1) { + ((DCI1_5MHz_TDD_t*)DLSCH_dci)->harq_pid = harq_pid; + ((DCI1_5MHz_TDD_t*)DLSCH_dci)->rv = round; + ((DCI1_5MHz_TDD_t*)DLSCH_dci)->dai = dl_dci->dai; + ((DCI1_5MHz_TDD_t*)DLSCH_dci)->rballoc = dl_dci->rb_bitmap; + ((DCI1_5MHz_TDD_t*)DLSCH_dci)->rah = dl_dci->res_alloc; + ((DCI1_5MHz_TDD_t*)DLSCH_dci)->mcs = dl_dci->mcs[0]; + ((DCI1_5MHz_TDD_t*)DLSCH_dci)->TPC = dl_dci->tpc; + ((DCI1_5MHz_TDD_t*)DLSCH_dci)->ndi = dl_dci->ndi[0]; + size_bytes = sizeof(DCI1_5MHz_TDD_t); + size_bits = sizeof_DCI1_5MHz_TDD_t; + } else if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_2A) { + //TODO + } else if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1D) { + //TODO + } + } else { + if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1) { + ((DCI1_5MHz_FDD_t*)DLSCH_dci)->harq_pid = harq_pid; + ((DCI1_5MHz_FDD_t*)DLSCH_dci)->rv = round; + ((DCI1_5MHz_FDD_t*)DLSCH_dci)->rballoc = dl_dci->rb_bitmap; + ((DCI1_5MHz_FDD_t*)DLSCH_dci)->rah = dl_dci->res_alloc; + ((DCI1_5MHz_FDD_t*)DLSCH_dci)->mcs = dl_dci->mcs[0]; + ((DCI1_5MHz_FDD_t*)DLSCH_dci)->TPC = dl_dci->tpc; + ((DCI1_5MHz_FDD_t*)DLSCH_dci)->ndi = dl_dci->ndi[0]; + size_bytes = sizeof(DCI1_5MHz_FDD_t); + size_bits = sizeof_DCI1_5MHz_FDD_t; + } else if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_2A) { + //TODO + } else if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1D) { + //TODO + } + } + break; + case 50: + if (frame_parms[CC_id]->frame_type == TDD) { + if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1) { + ((DCI1_10MHz_TDD_t*)DLSCH_dci)->harq_pid = harq_pid; + ((DCI1_10MHz_TDD_t*)DLSCH_dci)->rv = round; + ((DCI1_10MHz_TDD_t*)DLSCH_dci)->dai = dl_dci->dai; + ((DCI1_10MHz_TDD_t*)DLSCH_dci)->rballoc = dl_dci->rb_bitmap; + ((DCI1_10MHz_TDD_t*)DLSCH_dci)->rah = dl_dci->res_alloc; + ((DCI1_10MHz_TDD_t*)DLSCH_dci)->mcs = dl_dci->mcs[0]; + ((DCI1_10MHz_TDD_t*)DLSCH_dci)->TPC = dl_dci->tpc; + ((DCI1_10MHz_TDD_t*)DLSCH_dci)->ndi = dl_dci->ndi[0]; + size_bytes = sizeof(DCI1_10MHz_TDD_t); + size_bits = sizeof_DCI1_10MHz_TDD_t; + } else if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_2A) { + //TODO + } else if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1D) { + //TODO + } + } else { + if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1) { + ((DCI1_10MHz_FDD_t*)DLSCH_dci)->harq_pid = harq_pid; + ((DCI1_10MHz_FDD_t*)DLSCH_dci)->rv = round; + ((DCI1_10MHz_FDD_t*)DLSCH_dci)->rballoc = dl_dci->rb_bitmap; + ((DCI1_10MHz_FDD_t*)DLSCH_dci)->rah = dl_dci->res_alloc; + ((DCI1_10MHz_FDD_t*)DLSCH_dci)->mcs = dl_dci->mcs[0]; + ((DCI1_10MHz_FDD_t*)DLSCH_dci)->TPC = dl_dci->tpc; + ((DCI1_10MHz_TDD_t*)DLSCH_dci)->ndi = dl_dci->ndi[0]; + size_bytes = sizeof(DCI1_10MHz_FDD_t); + size_bits = sizeof_DCI1_10MHz_FDD_t; + } else if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_2A) { + //TODO + } else if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1D) { + //TODO + } + } + break; + case 100: + if (frame_parms[CC_id]->frame_type == TDD) { + if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1) { + ((DCI1_20MHz_TDD_t*)DLSCH_dci)->harq_pid = harq_pid; + ((DCI1_20MHz_TDD_t*)DLSCH_dci)->rv = round; + ((DCI1_20MHz_TDD_t*)DLSCH_dci)->dai = dl_dci->dai; + ((DCI1_20MHz_TDD_t*)DLSCH_dci)->rballoc = dl_dci->rb_bitmap; + ((DCI1_20MHz_TDD_t*)DLSCH_dci)->rah = dl_dci->res_alloc; + ((DCI1_20MHz_TDD_t*)DLSCH_dci)->mcs = dl_dci->mcs[0]; + ((DCI1_20MHz_TDD_t*)DLSCH_dci)->TPC = dl_dci->tpc; + ((DCI1_20MHz_TDD_t*)DLSCH_dci)->ndi = dl_dci->ndi[0]; + size_bytes = sizeof(DCI1_20MHz_TDD_t); + size_bits = sizeof_DCI1_20MHz_TDD_t; + } else if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_2A) { + //TODO + } else if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1D) { + //TODO + } + } else { + if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1) { + ((DCI1_20MHz_FDD_t*)DLSCH_dci)->harq_pid = harq_pid; + ((DCI1_20MHz_FDD_t*)DLSCH_dci)->rv = round; + ((DCI1_20MHz_FDD_t*)DLSCH_dci)->rballoc = dl_dci->rb_bitmap; + ((DCI1_20MHz_FDD_t*)DLSCH_dci)->rah = dl_dci->res_alloc; + ((DCI1_20MHz_FDD_t*)DLSCH_dci)->mcs = dl_dci->mcs[0]; + ((DCI1_20MHz_FDD_t*)DLSCH_dci)->TPC = dl_dci->tpc; + ((DCI1_20MHz_FDD_t*)DLSCH_dci)->ndi = dl_dci->ndi[0]; + size_bytes = sizeof(DCI1_20MHz_FDD_t); + size_bits = sizeof_DCI1_20MHz_FDD_t; + } else if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_2A) { + //TODO + } else if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1D) { + //TODO + } + } + break; + } + + //Add DCI based on format + if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1) { + add_ue_spec_dci(DCI_pdu, + DLSCH_dci, + rnti, + size_bytes, + dl_dci->aggr_level,//aggregation + size_bits, + format1, + 0); + } else if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_2A) { + add_ue_spec_dci(DCI_pdu, + DLSCH_dci, + rnti, + size_bytes, + dl_dci->aggr_level,//aggregation + size_bits, + format2A, + 0); + } +} diff --git a/openair2/LAYER2/MAC/enb_agent_mac_proto.h b/openair2/LAYER2/MAC/enb_agent_mac_proto.h new file mode 100644 index 0000000000..7fcdbc29c3 --- /dev/null +++ b/openair2/LAYER2/MAC/enb_agent_mac_proto.h @@ -0,0 +1,71 @@ +/******************************************************************************* + OpenAirInterface + Copyright(c) 1999 - 2014 Eurecom + + OpenAirInterface is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + + OpenAirInterface is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with OpenAirInterface.The full GNU General Public License is + included in this distribution in the file called "COPYING". If not, + see . + + Contact Information + OpenAirInterface Admin: openair_admin@eurecom.fr + OpenAirInterface Tech : openair_tech@eurecom.fr + OpenAirInterface Dev : openair4g-devel@lists.eurecom.fr + + Address : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE + +*******************************************************************************/ + +/*! \file enb_agent_mac_proto.h + * \brief MAC functions for eNB agent + * \author Xenofon Foukas + * \date 2016 + * \email: x.foukas@sms.ed.ac.uk + * \version 0.1 + * @ingroup _mac + + */ + +#ifndef __LAYER2_MAC_ENB_AGENT_MAC_PROTO_H__ +#define __LAYER2_MAC_ENB_AGENT_MAC_PROTO_H__ + +#include "enb_agent_defs.h" +#include "header.pb-c.h" +#include "progran.pb-c.h" + +/* + * Default scheduler used by the eNB agent + */ +void schedule_ue_spec_default(mid_t mod_id, uint32_t frame, uint32_t subframe, + int *mbsfn_flag, Protocol__ProgranMessage *dl_info); + + +/* + * Data plane function for applying the DL decisions of the scheduler + */ +void apply_dl_scheduling_decisions(mid_t mod_id, uint32_t frame, uint32_t subframe, int *mbsfn_flag, + Protocol__ProgranMessage *dl_scheduling_info); + +/* + * Data plane function for applying the UE specific DL decisions of the scheduler + */ +void apply_ue_spec_scheduling_decisions(mid_t mod_id, uint32_t frame, uint32_t subframe, int *mbsfn_flag, + uint32_t n_dl_ue_data, const Protocol__PrpDlData **dl_ue_data); + +/* + * Data plane function for filling the DCI structure + */ +void fill_oai_dci(mid_t mod_id, uint32_t CC_id, uint32_t rnti, const Protocol__PrpDlDci *dl_dci); + +#endif diff --git a/openair2/LAYER2/MAC/proto.h b/openair2/LAYER2/MAC/proto.h index faf0bf9954..be553c278d 100644 --- a/openair2/LAYER2/MAC/proto.h +++ b/openair2/LAYER2/MAC/proto.h @@ -36,10 +36,6 @@ #ifndef __LAYER2_MAC_PROTO_H__ #define __LAYER2_MAC_PROTO_H__ -#include "enb_agent_defs.h" -#include "header.pb-c.h" -#include "progran.pb-c.h" - /** \addtogroup _mac * @{ */ @@ -133,9 +129,6 @@ void fill_DLSCH_dci(module_id_t module_idP,frame_t frameP,sub_frame_t subframe,i */ void schedule_ue_spec(module_id_t module_idP,frame_t frameP,sub_frame_t subframe,int *mbsfn_flag); -//To be used by the agent -void schedule_ue_spec_default(mid_t mod_id, uint32_t frame, uint32_t subframe, - int *mbsfn_flag, Protocol__ProgranMessage *dl_info); /** \brief Function for UE/PHY to compute PUSCH transmit power in power-control procedure. @param Mod_id Module id of UE From e3aa8400d4f8e962195e197f39df1a28a670e61a Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Thu, 4 Feb 2016 11:28:54 +0000 Subject: [PATCH 087/349] Added support for progran dl_mac_config message destruction --- openair2/ENB_APP/enb_agent_mac.c | 59 +++++++++++++++++++++++++++++++- 1 file changed, 58 insertions(+), 1 deletion(-) diff --git a/openair2/ENB_APP/enb_agent_mac.c b/openair2/ENB_APP/enb_agent_mac.c index 05b2a7a364..df614df60c 100644 --- a/openair2/ENB_APP/enb_agent_mac.c +++ b/openair2/ENB_APP/enb_agent_mac.c @@ -40,6 +40,7 @@ #include "enb_agent_mac_internal.h" #include "LAYER2/MAC/proto.h" +#include "LAYER2/MAC/enb_agent_mac_proto.h" #include "log.h" @@ -1029,7 +1030,63 @@ int enb_agent_mac_create_empty_dl_config(mid_t mod_id, Protocol__ProgranMessage } int enb_agent_mac_destroy_dl_config(Protocol__ProgranMessage *msg) { - //TODO: De-allocate the memory of the message + int i,j, k; + if(msg->msg_case != PROTOCOL__PROGRAN_MESSAGE__MSG_DL_MAC_CONFIG_MSG) + goto error; + + Protocol__PrpDlDci *dl_dci; + + free(msg->dl_mac_config_msg->header); + for (i = 0; i < msg->dl_mac_config_msg->n_dl_ue_data; i++) { + free(msg->dl_mac_config_msg->dl_ue_data[i]->ce_bitmap); + for (j = 0; j < msg->dl_mac_config_msg->dl_ue_data[i]->n_rlc_pdu; j++) { + for (k = 0; k < msg->dl_mac_config_msg->dl_ue_data[i]->rlc_pdu[j]->n_rlc_pdu_tb; k++) { + free(msg->dl_mac_config_msg->dl_ue_data[i]->rlc_pdu[j]->rlc_pdu_tb[k]); + } + free(msg->dl_mac_config_msg->dl_ue_data[i]->rlc_pdu[j]->rlc_pdu_tb); + free(msg->dl_mac_config_msg->dl_ue_data[i]->rlc_pdu[j]); + } + free(msg->dl_mac_config_msg->dl_ue_data[i]->rlc_pdu); + dl_dci = msg->dl_mac_config_msg->dl_ue_data[i]->dl_dci; + free(dl_dci->tbs_size); + free(dl_dci->mcs); + free(dl_dci->ndi); + free(dl_dci->rv); + free(dl_dci); + free(msg->dl_mac_config_msg->dl_ue_data[i]); + } + free(msg->dl_mac_config_msg->dl_ue_data); + + for (i = 0; i < msg->dl_mac_config_msg->n_dl_rar; i++) { + dl_dci = msg->dl_mac_config_msg->dl_rar[i]->rar_dci; + free(dl_dci->tbs_size); + free(dl_dci->mcs); + free(dl_dci->ndi); + free(dl_dci->rv); + free(dl_dci); + free(msg->dl_mac_config_msg->dl_rar[i]); + } + free(msg->dl_mac_config_msg->dl_rar); + + for (i = 0; i < msg->dl_mac_config_msg->n_dl_broadcast; i++) { + dl_dci = msg->dl_mac_config_msg->dl_broadcast[i]->broad_dci; + free(dl_dci->tbs_size); + free(dl_dci->mcs); + free(dl_dci->ndi); + free(dl_dci->rv); + free(dl_dci); + free(msg->dl_mac_config_msg->dl_broadcast[i]); + } + free(msg->dl_mac_config_msg->dl_broadcast); + + for ( i = 0; i < msg->dl_mac_config_msg->n_ofdm_sym; i++) { + free(msg->dl_mac_config_msg->ofdm_sym[i]); + } + free(msg->dl_mac_config_msg->ofdm_sym); + + return 0; + + error: return -1; } From b784e6bd64b4aa6512b5c468c3e255d941e81f46 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Thu, 4 Feb 2016 12:52:01 +0000 Subject: [PATCH 088/349] Refactored code to improve readability in fill_oai_dci function --- .../MAC/eNB_agent_scheduler_dataplane.c | 205 +++++++----------- openair2/LAYER2/MAC/progran_dci_conversions.h | 59 +++++ 2 files changed, 134 insertions(+), 130 deletions(-) create mode 100644 openair2/LAYER2/MAC/progran_dci_conversions.h diff --git a/openair2/LAYER2/MAC/eNB_agent_scheduler_dataplane.c b/openair2/LAYER2/MAC/eNB_agent_scheduler_dataplane.c index 43d4ad2b51..6fe11c59cd 100644 --- a/openair2/LAYER2/MAC/eNB_agent_scheduler_dataplane.c +++ b/openair2/LAYER2/MAC/eNB_agent_scheduler_dataplane.c @@ -48,6 +48,7 @@ #include "LAYER2/MAC/defs.h" #include "LAYER2/MAC/proto.h" #include "LAYER2/MAC/extern.h" +#include "LAYER2/MAC/progran_dci_conversions.h" #include "UTIL/LOG/log.h" #include "UTIL/LOG/vcd_signal_dumper.h" @@ -104,6 +105,7 @@ void apply_ue_spec_scheduling_decisions(mid_t mod_id, unsigned char aggregation; mac_rlc_status_resp_t rlc_status; unsigned char header_len_dcch=0, header_len_dcch_tmp=0,header_len_dtch=0,header_len_dtch_tmp=0, ta_len=0; + unsigned char header_len = 0, header_len_tmp = 0; unsigned char sdu_lcids[11],offset,num_sdus=0; uint16_t nb_rb,nb_rb_temp,total_nb_available_rb[MAX_NUM_CCs],nb_available_rb; uint16_t TBS,j,sdu_lengths[11],rnti,padding=0,post_padding=0; @@ -156,27 +158,18 @@ void apply_ue_spec_scheduling_decisions(mid_t mod_id, rlc_status.bytes_in_buffer = 0; TBS = dl_dci->tbs_size[0]; - LOG_D(MAC,"[TEST] The TBS during the creation process is %d\n", TBS); if (dl_data->n_ce_bitmap > 0) { - //Check if there is TA command - if (dl_data->ce_bitmap[0] & PROTOCOL__PRP_CE_TYPE__PRPCET_TA) { - ta_len = 2; - LOG_D(MAC, "[TEST] Need to send timing advance\n"); - } else { - ta_len = 0; - LOG_D(MAC, "[TEST] No timing advance\n"); - } + //Check if there is TA command and set the length appropriately + ta_len = (dl_data->ce_bitmap[0] & PROTOCOL__PRP_CE_TYPE__PRPCET_TA) ? 2 : 0; } - n_lc = dl_data->n_rlc_pdu; num_sdus = 0; sdu_length_total = 0; // Go through each one of the channel commands and create SDUs for (i = 0; i < n_lc; i++) { lcid = dl_data->rlc_pdu[i]->rlc_pdu_tb[0]->logical_channel_id; - LOG_D(MAC, "[TEST] Going through SDU of channel %d\n", lcid); rlc_size = dl_data->rlc_pdu[i]->rlc_pdu_tb[0]->size; LOG_D(MAC,"[TEST] [eNB %d] Frame %d, LCID %d, CC_id %d, Requesting %d bytes from RLC (RRC message)\n", mod_id, frame, lcid, CC_id, rlc_size); @@ -204,24 +197,17 @@ void apply_ue_spec_scheduling_decisions(mid_t mod_id, lcid, (char *)&dlsch_buffer[sdu_length_total]); - LOG_D(MAC, "[TEST] RLC gave %d bytes in LCID %d\n", sdu_lengths[i], lcid); - LOG_D(MAC,"[eNB %d][LCID %d] CC_id %d Got %d bytes from RLC\n",mod_id, lcid, CC_id, sdu_lengths[i]); sdu_length_total += sdu_lengths[i]; - LOG_D(MAC, "[TEST] Total sdu size became %d\n", sdu_length_total); sdu_lcids[i] = lcid; UE_list->eNB_UE_stats[CC_id][UE_id].num_pdu_tx[lcid] += 1; UE_list->eNB_UE_stats[CC_id][UE_id].num_bytes_tx[lcid] += sdu_lengths[i]; - if (lcid == DCCH || lcid == DCCH1) { - header_len_dcch += 2; - } else if (lcid == DTCH) { - if (sdu_lengths[i] < 128) { - header_len_dtch = 2; - } else { - header_len_dtch = 3; - } + if (sdu_lengths[i] < 128) { + header_len += 2; + } else { + header_len += 3; } num_sdus++; @@ -229,46 +215,34 @@ void apply_ue_spec_scheduling_decisions(mid_t mod_id, } // SDU creation end - if (((sdu_length_total + header_len_dcch + header_len_dtch) > 0)) { + if (((sdu_length_total + header_len) > 0)) { + + header_len_tmp = header_len; - header_len_dcch_tmp = header_len_dcch; - header_len_dtch_tmp = header_len_dtch; - - if (header_len_dtch==0) { - header_len_dcch = (header_len_dcch >0) ? (header_len_dcch - 1) : header_len_dcch; // remove length field + // If we have only a single SDU, header length becomes 1 + if (header_len == 2 || header_len == 3) { + header_len = 1; } else { - header_len_dtch = (header_len_dtch > 0) ? 1 : header_len_dtch; // remove length field for the last SDU + header_len--; } // there is a payload - if (((sdu_length_total + header_len_dcch + header_len_dtch ) > 0)) { - if ((TBS - header_len_dcch - header_len_dtch - sdu_length_total - ta_len) <= 2 - || (TBS - header_len_dcch - header_len_dtch - sdu_length_total - ta_len) > TBS) { //protect from overflow - padding = (TBS - header_len_dcch - header_len_dtch - sdu_length_total - ta_len); + if (((sdu_length_total + header_len) > 0)) { + // If we need a 1 or 2 bit padding or no padding at all + if ((TBS - header_len - sdu_length_total - ta_len) <= 2 + || (TBS - header_len - sdu_length_total - ta_len) > TBS) { //protect from overflow + padding = (TBS - header_len - sdu_length_total - ta_len); post_padding = 0; - } else { + } else { // The last sdu needs to have a length field, since we add padding padding = 0; - - // adjust the header len - if (header_len_dtch==0) { - header_len_dcch = header_len_dcch_tmp; - } else { - header_len_dtch = header_len_dtch_tmp; - } - - post_padding = TBS - sdu_length_total - header_len_dcch - header_len_dtch - ta_len - 1; // 1 is for the postpadding header + header_len = header_len_tmp; + post_padding = TBS - sdu_length_total - header_len - ta_len - 1; // 1 is for the postpadding header } } - - if (ta_len > 0) { - ta_update = ue_sched_ctl->ta_update; - } else { - ta_update = 0; - } + ta_update = (ta_len > 0) ? ue_sched_ctl->ta_update : 0; offset = generate_dlsch_header((unsigned char*)UE_list->DLSCH_pdu[CC_id][0][UE_id].payload[0], - // offset = generate_dlsch_header((unsigned char*)eNB_mac_inst[0].DLSCH_pdu[0][0].payload[0], num_sdus, //num_sdus sdu_lengths, // sdu_lcids, @@ -364,6 +338,8 @@ void fill_oai_dci(mid_t mod_id, uint32_t CC_id, uint32_t rnti, int UE_id = find_ue(rnti, PHY_vars_eNB_g[mod_id][CC_id]); + uint32_t format; + harq_pid = dl_dci->harq_process; round = dl_dci->rv[0]; @@ -377,14 +353,7 @@ void fill_oai_dci(mid_t mod_id, uint32_t CC_id, uint32_t rnti, case 6: if (frame_parms[CC_id]->frame_type == TDD) { if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1) { - ((DCI1_1_5MHz_TDD_t*)DLSCH_dci)->harq_pid = harq_pid; - ((DCI1_1_5MHz_TDD_t*)DLSCH_dci)->rv = round; - ((DCI1_1_5MHz_TDD_t*)DLSCH_dci)->dai = dl_dci->dai; - ((DCI1_1_5MHz_TDD_t*)DLSCH_dci)->rballoc = dl_dci->rb_bitmap; - ((DCI1_1_5MHz_TDD_t*)DLSCH_dci)->rah = dl_dci->res_alloc; - ((DCI1_1_5MHz_TDD_t*)DLSCH_dci)->mcs = dl_dci->mcs[0]; - ((DCI1_1_5MHz_TDD_t*)DLSCH_dci)->TPC = dl_dci->tpc; - ((DCI1_1_5MHz_TDD_t*)DLSCH_dci)->ndi = dl_dci->ndi[0]; + FILL_DCI_TDD_1(DCI1_1_5MHz_TDD_t, DLSCH_dci, dl_dci); size_bytes = sizeof(DCI1_1_5MHz_TDD_t); size_bits = sizeof_DCI1_1_5MHz_TDD_t; } else if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_2A) { @@ -394,14 +363,7 @@ void fill_oai_dci(mid_t mod_id, uint32_t CC_id, uint32_t rnti, } } else { if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1) { - LOG_D(MAC,"[TEST] Setting DCI format 1\n"); - ((DCI1_1_5MHz_FDD_t*)DLSCH_dci)->harq_pid = harq_pid; - ((DCI1_1_5MHz_FDD_t*)DLSCH_dci)->rv = round; - ((DCI1_1_5MHz_FDD_t*)DLSCH_dci)->rballoc = dl_dci->rb_bitmap; - ((DCI1_1_5MHz_FDD_t*)DLSCH_dci)->rah = dl_dci->res_alloc; - ((DCI1_1_5MHz_FDD_t*)DLSCH_dci)->mcs = dl_dci->mcs[0]; - ((DCI1_1_5MHz_FDD_t*)DLSCH_dci)->TPC = dl_dci->tpc; - ((DCI1_1_5MHz_FDD_t*)DLSCH_dci)->ndi = dl_dci->ndi[0]; + FILL_DCI_FDD_1(DCI1_1_5MHz_FDD_t, DLSCH_dci, dl_dci); size_bytes = sizeof(DCI1_1_5MHz_FDD_t); size_bits = sizeof_DCI1_1_5MHz_FDD_t; } else if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_2A) { @@ -414,14 +376,7 @@ void fill_oai_dci(mid_t mod_id, uint32_t CC_id, uint32_t rnti, case 25: if (frame_parms[CC_id]->frame_type == TDD) { if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1) { - ((DCI1_5MHz_TDD_t*)DLSCH_dci)->harq_pid = harq_pid; - ((DCI1_5MHz_TDD_t*)DLSCH_dci)->rv = round; - ((DCI1_5MHz_TDD_t*)DLSCH_dci)->dai = dl_dci->dai; - ((DCI1_5MHz_TDD_t*)DLSCH_dci)->rballoc = dl_dci->rb_bitmap; - ((DCI1_5MHz_TDD_t*)DLSCH_dci)->rah = dl_dci->res_alloc; - ((DCI1_5MHz_TDD_t*)DLSCH_dci)->mcs = dl_dci->mcs[0]; - ((DCI1_5MHz_TDD_t*)DLSCH_dci)->TPC = dl_dci->tpc; - ((DCI1_5MHz_TDD_t*)DLSCH_dci)->ndi = dl_dci->ndi[0]; + FILL_DCI_TDD_1(DCI1_5MHz_TDD_t, DLSCH_dci, dl_dci); size_bytes = sizeof(DCI1_5MHz_TDD_t); size_bits = sizeof_DCI1_5MHz_TDD_t; } else if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_2A) { @@ -431,13 +386,7 @@ void fill_oai_dci(mid_t mod_id, uint32_t CC_id, uint32_t rnti, } } else { if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1) { - ((DCI1_5MHz_FDD_t*)DLSCH_dci)->harq_pid = harq_pid; - ((DCI1_5MHz_FDD_t*)DLSCH_dci)->rv = round; - ((DCI1_5MHz_FDD_t*)DLSCH_dci)->rballoc = dl_dci->rb_bitmap; - ((DCI1_5MHz_FDD_t*)DLSCH_dci)->rah = dl_dci->res_alloc; - ((DCI1_5MHz_FDD_t*)DLSCH_dci)->mcs = dl_dci->mcs[0]; - ((DCI1_5MHz_FDD_t*)DLSCH_dci)->TPC = dl_dci->tpc; - ((DCI1_5MHz_FDD_t*)DLSCH_dci)->ndi = dl_dci->ndi[0]; + FILL_DCI_FDD_1(DCI1_5MHz_FDD_t, DLSCH_dci, dl_dci); size_bytes = sizeof(DCI1_5MHz_FDD_t); size_bits = sizeof_DCI1_5MHz_FDD_t; } else if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_2A) { @@ -450,14 +399,7 @@ void fill_oai_dci(mid_t mod_id, uint32_t CC_id, uint32_t rnti, case 50: if (frame_parms[CC_id]->frame_type == TDD) { if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1) { - ((DCI1_10MHz_TDD_t*)DLSCH_dci)->harq_pid = harq_pid; - ((DCI1_10MHz_TDD_t*)DLSCH_dci)->rv = round; - ((DCI1_10MHz_TDD_t*)DLSCH_dci)->dai = dl_dci->dai; - ((DCI1_10MHz_TDD_t*)DLSCH_dci)->rballoc = dl_dci->rb_bitmap; - ((DCI1_10MHz_TDD_t*)DLSCH_dci)->rah = dl_dci->res_alloc; - ((DCI1_10MHz_TDD_t*)DLSCH_dci)->mcs = dl_dci->mcs[0]; - ((DCI1_10MHz_TDD_t*)DLSCH_dci)->TPC = dl_dci->tpc; - ((DCI1_10MHz_TDD_t*)DLSCH_dci)->ndi = dl_dci->ndi[0]; + FILL_DCI_TDD_1(DCI1_10MHz_TDD_t, DLSCH_dci, dl_dci); size_bytes = sizeof(DCI1_10MHz_TDD_t); size_bits = sizeof_DCI1_10MHz_TDD_t; } else if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_2A) { @@ -467,13 +409,7 @@ void fill_oai_dci(mid_t mod_id, uint32_t CC_id, uint32_t rnti, } } else { if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1) { - ((DCI1_10MHz_FDD_t*)DLSCH_dci)->harq_pid = harq_pid; - ((DCI1_10MHz_FDD_t*)DLSCH_dci)->rv = round; - ((DCI1_10MHz_FDD_t*)DLSCH_dci)->rballoc = dl_dci->rb_bitmap; - ((DCI1_10MHz_FDD_t*)DLSCH_dci)->rah = dl_dci->res_alloc; - ((DCI1_10MHz_FDD_t*)DLSCH_dci)->mcs = dl_dci->mcs[0]; - ((DCI1_10MHz_FDD_t*)DLSCH_dci)->TPC = dl_dci->tpc; - ((DCI1_10MHz_TDD_t*)DLSCH_dci)->ndi = dl_dci->ndi[0]; + FILL_DCI_FDD_1(DCI1_10MHz_FDD_t, DLSCH_dci, dl_dci); size_bytes = sizeof(DCI1_10MHz_FDD_t); size_bits = sizeof_DCI1_10MHz_FDD_t; } else if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_2A) { @@ -486,14 +422,7 @@ void fill_oai_dci(mid_t mod_id, uint32_t CC_id, uint32_t rnti, case 100: if (frame_parms[CC_id]->frame_type == TDD) { if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1) { - ((DCI1_20MHz_TDD_t*)DLSCH_dci)->harq_pid = harq_pid; - ((DCI1_20MHz_TDD_t*)DLSCH_dci)->rv = round; - ((DCI1_20MHz_TDD_t*)DLSCH_dci)->dai = dl_dci->dai; - ((DCI1_20MHz_TDD_t*)DLSCH_dci)->rballoc = dl_dci->rb_bitmap; - ((DCI1_20MHz_TDD_t*)DLSCH_dci)->rah = dl_dci->res_alloc; - ((DCI1_20MHz_TDD_t*)DLSCH_dci)->mcs = dl_dci->mcs[0]; - ((DCI1_20MHz_TDD_t*)DLSCH_dci)->TPC = dl_dci->tpc; - ((DCI1_20MHz_TDD_t*)DLSCH_dci)->ndi = dl_dci->ndi[0]; + FILL_DCI_TDD_1(DCI1_20MHz_TDD_t, DLSCH_dci, dl_dci); size_bytes = sizeof(DCI1_20MHz_TDD_t); size_bits = sizeof_DCI1_20MHz_TDD_t; } else if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_2A) { @@ -503,13 +432,7 @@ void fill_oai_dci(mid_t mod_id, uint32_t CC_id, uint32_t rnti, } } else { if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1) { - ((DCI1_20MHz_FDD_t*)DLSCH_dci)->harq_pid = harq_pid; - ((DCI1_20MHz_FDD_t*)DLSCH_dci)->rv = round; - ((DCI1_20MHz_FDD_t*)DLSCH_dci)->rballoc = dl_dci->rb_bitmap; - ((DCI1_20MHz_FDD_t*)DLSCH_dci)->rah = dl_dci->res_alloc; - ((DCI1_20MHz_FDD_t*)DLSCH_dci)->mcs = dl_dci->mcs[0]; - ((DCI1_20MHz_FDD_t*)DLSCH_dci)->TPC = dl_dci->tpc; - ((DCI1_20MHz_FDD_t*)DLSCH_dci)->ndi = dl_dci->ndi[0]; + FILL_DCI_FDD_1(DCI1_20MHz_FDD_t, DLSCH_dci, dl_dci); size_bytes = sizeof(DCI1_20MHz_FDD_t); size_bits = sizeof_DCI1_20MHz_FDD_t; } else if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_2A) { @@ -521,24 +444,46 @@ void fill_oai_dci(mid_t mod_id, uint32_t CC_id, uint32_t rnti, break; } - //Add DCI based on format - if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1) { - add_ue_spec_dci(DCI_pdu, - DLSCH_dci, - rnti, - size_bytes, - dl_dci->aggr_level,//aggregation - size_bits, - format1, - 0); - } else if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_2A) { - add_ue_spec_dci(DCI_pdu, - DLSCH_dci, - rnti, - size_bytes, - dl_dci->aggr_level,//aggregation - size_bits, - format2A, - 0); + //Set format to the proper type + switch(dl_dci->format) { + case PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1: + format = format1; + break; + case PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1A: + format = format1A; + break; + case PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1B: + format = format1B; + break; + case PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1C: + format = format1C; + break; + case PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1D: + format = format1E_2A_M10PRB; + break; + case PROTOCOL__PRP_DCI_FORMAT__PRDCIF_2: + format = format2; + break; + case PROTOCOL__PRP_DCI_FORMAT__PRDCIF_2A: + format = format2A; + break; + case PROTOCOL__PRP_DCI_FORMAT__PRDCIF_2B: + format = format2B; + break; + case PROTOCOL__PRP_DCI_FORMAT__PRDCIF_3: + format = 3; + break; + default: + /*TODO: Need to deal with unsupported DCI type*/ + return; } + + add_ue_spec_dci(DCI_pdu, + DLSCH_dci, + rnti, + size_bytes, + dl_dci->aggr_level, + size_bits, + format, + 0); } diff --git a/openair2/LAYER2/MAC/progran_dci_conversions.h b/openair2/LAYER2/MAC/progran_dci_conversions.h new file mode 100644 index 0000000000..90324fdb30 --- /dev/null +++ b/openair2/LAYER2/MAC/progran_dci_conversions.h @@ -0,0 +1,59 @@ +/******************************************************************************* + OpenAirInterface + Copyright(c) 1999 - 2014 Eurecom + + OpenAirInterface is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + + OpenAirInterface is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with OpenAirInterface.The full GNU General Public License is + included in this distribution in the file called "COPYING". If not, + see . + + Contact Information + OpenAirInterface Admin: openair_admin@eurecom.fr + OpenAirInterface Tech : openair_tech@eurecom.fr + OpenAirInterface Dev : openair4g-devel@lists.eurecom.fr + + Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. + + *******************************************************************************/ + +/*! \file dci_conversions.h + * \brief Conversion helpers from progran messages to OAI formats DCI + * \author Xenofon Foukas + * \date 2016 + * \version 0.1 + */ + +#ifndef LAYER2_MAC_PROGRAN_DCI_CONVERISIONS_H__ +#define LAYER2_MAC_DCI_PROGRAN_CONVERISIONS_H__ + +#define FILL_DCI_FDD_1(TYPE, DCI, PROGRAN_DCI) \ + ((TYPE*)DCI)->harq_pid = PROGRAN_DCI->harq_process; \ + ((TYPE*)DCI)->rv = PROGRAN_DCI->rv[0]; \ + ((TYPE*)DCI)->rballoc = PROGRAN_DCI->rb_bitmap; \ + ((TYPE*)DCI)->rah = PROGRAN_DCI->res_alloc; \ + ((TYPE*)DCI)->mcs = PROGRAN_DCI->mcs[0]; \ + ((TYPE*)DCI)->TPC = PROGRAN_DCI->tpc; \ + ((TYPE*)DCI)->ndi = PROGRAN_DCI->ndi[0]; + +#define FILL_DCI_TDD_1(TYPE, DCI, PROGRAN_DCI) \ + ((TYPE*)DCI)->harq_pid = PROGRAN_DCI->harq_process; \ + ((TYPE*)DCI)->rv = PROGRAN_DCI->rv[0]; \ + ((TYPE*)DCI)->dai = PROGRAN_DCI->dai; \ + ((TYPE*)DCI)->rballoc = PROGRAN_DCI->rb_bitmap; \ + ((TYPE*)DCI)->rah = PROGRAN_DCI->res_alloc; \ + ((TYPE*)DCI)->mcs = PROGRAN_DCI->mcs[0]; \ + ((TYPE*)DCI)->TPC = PROGRAN_DCI->tpc; \ + ((TYPE*)DCI)->ndi = PROGRAN_DCI->ndi[0]; + +#endif From a404bfd96cb853a8dc36ab3ad985b54131a3e1c1 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Thu, 4 Feb 2016 17:32:37 +0000 Subject: [PATCH 089/349] Refactored eNB agent scheduler code to improve readability --- .../MAC/eNB_agent_scheduler_dataplane.c | 6 +- .../LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c | 797 ++++++------------ 2 files changed, 264 insertions(+), 539 deletions(-) diff --git a/openair2/LAYER2/MAC/eNB_agent_scheduler_dataplane.c b/openair2/LAYER2/MAC/eNB_agent_scheduler_dataplane.c index 6fe11c59cd..04efcb44ad 100644 --- a/openair2/LAYER2/MAC/eNB_agent_scheduler_dataplane.c +++ b/openair2/LAYER2/MAC/eNB_agent_scheduler_dataplane.c @@ -104,8 +104,8 @@ void apply_ue_spec_scheduling_decisions(mid_t mod_id, int N_RBG[MAX_NUM_CCs]; unsigned char aggregation; mac_rlc_status_resp_t rlc_status; - unsigned char header_len_dcch=0, header_len_dcch_tmp=0,header_len_dtch=0,header_len_dtch_tmp=0, ta_len=0; - unsigned char header_len = 0, header_len_tmp = 0; + unsigned char ta_len=0; + unsigned char header_len = 0, header_len_tmp = 0; unsigned char sdu_lcids[11],offset,num_sdus=0; uint16_t nb_rb,nb_rb_temp,total_nb_available_rb[MAX_NUM_CCs],nb_available_rb; uint16_t TBS,j,sdu_lengths[11],rnti,padding=0,post_padding=0; @@ -252,8 +252,6 @@ void apply_ue_spec_scheduling_decisions(mid_t mod_id, padding, post_padding); - LOG_D(MAC, "[TEST]Have to schedule %d SDUs with length %d. TBS is %d, LCID is %d, post padding is %d, padding is %d, header offset is %d, total sdu size is %d\n", num_sdus, sdu_lengths[0], TBS, sdu_lcids[0], post_padding, padding, offset, sdu_length_total); - #ifdef DEBUG_eNB_SCHEDULER LOG_T(MAC,"[eNB %d] First 16 bytes of DLSCH : \n"); diff --git a/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c b/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c index 6da07ac558..dd0a9942ac 100644 --- a/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c +++ b/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c @@ -90,6 +90,7 @@ schedule_ue_spec_default( unsigned char aggregation; mac_rlc_status_resp_t rlc_status; unsigned char header_len_dcch=0, header_len_dcch_tmp=0, header_len_dtch=0, header_len_dtch_tmp=0, ta_len=0; + unsigned char header_len = 0, header_len_tmp = 0; uint16_t nb_rb, nb_rb_temp, total_nb_available_rb[MAX_NUM_CCs], nb_available_rb; uint16_t TBS, j, rnti, padding=0, post_padding=0; unsigned char round = 0; @@ -102,7 +103,6 @@ schedule_ue_spec_default( eNB_MAC_INST *eNB = &eNB_mac_inst[mod_id]; UE_list_t *UE_list = &eNB->UE_list; LTE_DL_FRAME_PARMS *frame_parms[MAX_NUM_CCs]; - int continue_flag=0; int32_t normalized_rx_power, target_rx_power; int32_t tpc=1; static int32_t tpc_accumulated=0; @@ -123,6 +123,8 @@ schedule_ue_spec_default( int i; uint32_t data_to_request; uint32_t dci_tbs; + uint8_t ue_has_transmission = 0; + uint32_t ndi; if (UE_list->head==-1) { @@ -172,7 +174,6 @@ schedule_ue_spec_default( continue; for (UE_id=UE_list->head; UE_id>=0; UE_id=UE_list->next[UE_id]) { - continue_flag=0; // reset the flag to allow allocation for the remaining UEs rnti = UE_RNTI(mod_id, UE_id); eNB_UE_stats = mac_xface->get_eNB_UE_stats(mod_id, CC_id, rnti); ue_sched_ctl = &UE_list->UE_sched_ctrl[UE_id]; @@ -180,13 +181,13 @@ schedule_ue_spec_default( if (rnti==NOT_A_RNTI) { LOG_D(MAC,"Cannot find rnti for UE_id %d (num_UEs %d)\n",UE_id,UE_list->num_UEs); // mac_xface->macphy_exit("Cannot find rnti for UE_id"); - continue_flag=1; + continue; } if (eNB_UE_stats==NULL) { LOG_D(MAC,"[eNB] Cannot find eNB_UE_stats\n"); // mac_xface->macphy_exit("[MAC][eNB] Cannot find eNB_UE_stats\n"); - continue_flag=1; + continue; } if ((ue_sched_ctl->pre_nb_available_rbs[CC_id] == 0) || // no RBs allocated @@ -195,7 +196,7 @@ schedule_ue_spec_default( LOG_D(MAC,"[eNB %d] Frame %d : no RB allocated for UE %d on CC_id %d: continue \n", mod_id, frame, UE_id, CC_id); //if(mac_xface->get_transmission_mode(module_idP,rnti)==5) - continue_flag=1; //to next user (there might be rbs availiable for other UEs in TM5 + continue; //to next user (there might be rbs availiable for other UEs in TM5 // else // break; } @@ -210,17 +211,7 @@ schedule_ue_spec_default( set_ul_DAI(mod_id, UE_id, CC_id, frame, subframe,frame_parms); } - if (continue_flag == 1 ) { - add_ue_dlsch_info(mod_id, - CC_id, - UE_id, - subframe, - S_DL_NONE); - continue; - } - // After this point all the UEs will be scheduled - // TODO create a Protocol__PrpDlData struct for the UE dl_data[num_ues_added] = (Protocol__PrpDlData *) malloc(sizeof(Protocol__PrpDlData)); protocol__prp_dl_data__init(dl_data[num_ues_added]); dl_data[num_ues_added]->has_rnti = 1; @@ -232,8 +223,6 @@ schedule_ue_spec_default( nb_available_rb = ue_sched_ctl->pre_nb_available_rbs[CC_id]; harq_pid = ue_sched_ctl->harq_pid[CC_id]; round = ue_sched_ctl->round[CC_id]; - - sdu_length_total=0; @@ -247,16 +236,13 @@ schedule_ue_spec_default( #ifdef EXMIMO - if (mac_xface->get_transmission_mode(mod_id, CC_id, rnti)==5) { + if (mac_xface->get_transmission_mode(mod_id, CC_id, rnti) == 5) { mcs = cqi_to_mcs[eNB_UE_stats->DL_cqi[0]]; - //eNB_UE_stats->dlsch_mcs1 = cmin(eNB_UE_stats->dlsch_mcs1,16); + mcs = cmin(mcs,16); } #endif - // store stats - // - // initializing the rb allocation indicator for each UE for(j = 0; j < frame_parms[CC_id]->N_RBG; j++) { UE_list->UE_template[CC_id][UE_id].rballoc_subband[harq_pid][j] = 0; @@ -295,8 +281,6 @@ schedule_ue_spec_default( CC_id, subframe,UE_id,UE_list->UE_template[CC_id][UE_id].DAI); } - - if (nb_rb <= nb_available_rb) { if(nb_rb == ue_sched_ctl->pre_nb_available_rbs[CC_id]) { @@ -318,7 +302,6 @@ schedule_ue_spec_default( nb_rb_temp = nb_rb_temp - min_rb_unit[CC_id]; } } - j = j + 1; } } @@ -333,171 +316,21 @@ schedule_ue_spec_default( PHY_vars_eNB_g[mod_id][CC_id]->mu_mimo_mode[UE_id].rballoc_sub[j] = UE_list->UE_template[CC_id][UE_id].rballoc_subband[harq_pid][j]; } - switch (mac_xface->get_transmission_mode(mod_id,CC_id,rnti)) { - case 1: - case 2: - default: - dl_dci->has_res_alloc = 1; - dl_dci->res_alloc = 0; - dl_dci->n_mcs = 1; - dl_dci->mcs = (uint32_t *)malloc(sizeof(uint32_t)); - dl_dci->mcs[0] = mcs; - dl_dci->has_tpc = 1; - dl_dci->tpc = 1; - dl_dci->has_vrb_format = 1; - dl_dci->vrb_format = PROTOCOL__PRP_VRB_FORMAT__PRVRBF_LOCALIZED; - dl_dci->has_format = 1; - dl_dci->format = PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1; - dl_dci->has_rb_bitmap = 1; - dl_dci->rb_bitmap = allocate_prbs_sub(nb_rb, UE_list->UE_template[CC_id][UE_id].rballoc_subband); - dl_dci->has_rb_shift = 1; - dl_dci->rb_shift = 0; - dl_dci->n_ndi = UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]; - dl_dci->ndi = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_ndi); - dl_dci->ndi[0] = 1; - dl_dci->n_rv = 1; - dl_dci->rv = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_rv); - dl_dci->rv[0] = round&3; - dl_dci->n_mcs = 1; - dl_dci->mcs = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_mcs); - dl_dci->mcs[0] = mcs; - dl_dci->n_tbs_size = 1; - dl_dci->tbs_size = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_tbs_size); - dl_dci->tbs_size[0] = dci_tbs; - if (frame_parms[CC_id]->frame_type == TDD) { - dl_dci->has_dai = 1; - dl_dci->dai = (UE_list->UE_template[CC_id][UE_id].DAI-1)&3; - LOG_D(MAC,"[eNB %d] Retransmission CC_id %d : harq_pid %d, round %d, dai %d\n", - mod_id, CC_id, harq_pid, round,(UE_list->UE_template[CC_id][UE_id].DAI-1)); - } else { - LOG_D(MAC,"[eNB %d] Retransmission CC_id %d : harq_pid %d, round %d\n", - mod_id, CC_id, harq_pid, round); - } - break; - case 4: - dl_dci->has_res_alloc = 1; - dl_dci->res_alloc = 0; - dl_dci->n_mcs = 2; - dl_dci->mcs = (uint32_t *)malloc(sizeof(uint32_t) * dl_dci->n_mcs); - dl_dci->mcs[0] = mcs; - dl_dci->mcs[1] = mcs; - dl_dci->has_tpc = 1; - dl_dci->tpc = 1; - dl_dci->has_vrb_format = 1; - dl_dci->vrb_format = PROTOCOL__PRP_VRB_FORMAT__PRVRBF_LOCALIZED; - dl_dci->has_format = 1; - dl_dci->format = PROTOCOL__PRP_DCI_FORMAT__PRDCIF_2A; - dl_dci->has_rb_bitmap = 1; - dl_dci->rb_bitmap = allocate_prbs_sub(nb_rb, UE_list->UE_template[CC_id][UE_id].rballoc_subband); - dl_dci->has_rb_shift = 1; - dl_dci->rb_shift = 0; - dl_dci->n_ndi = 2; - dl_dci->ndi = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_ndi); - dl_dci->ndi[0] = UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]; - dl_dci->ndi[1] = UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]; - dl_dci->n_tbs_size = 2; - dl_dci->tbs_size = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_tbs_size); - dl_dci->tbs_size[0] = dci_tbs; - dl_dci->tbs_size[1] = dci_tbs; - dl_dci->n_rv = 2; - dl_dci->rv = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_rv); - dl_dci->rv[0] = round&3; - dl_dci->rv[1] = round&3; - dl_dci->mcs = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_mcs); - dl_dci->mcs[0] = mcs; - dl_dci->mcs[1] = mcs; - if (frame_parms[CC_id]->frame_type == TDD) { - dl_dci->has_dai = 1; - dl_dci->dai = (UE_list->UE_template[CC_id][UE_id].DAI-1)&3; - LOG_D(MAC,"[eNB %d] Retransmission CC_id %d : harq_pid %d, round %d, dai %d\n", - mod_id, CC_id, harq_pid, round,(UE_list->UE_template[CC_id][UE_id].DAI-1)); - } else { - LOG_D(MAC,"[eNB %d] Retransmission CC_id %d : harq_pid %d, round %d\n", - mod_id, CC_id, harq_pid, round); - } - break; - case 5: - dl_dci->has_res_alloc = 1; - dl_dci->res_alloc = 0; - dl_dci->n_mcs = 1; - dl_dci->mcs = (uint32_t *)malloc(sizeof(uint32_t)); - dl_dci->mcs[0] = mcs; - dl_dci->has_tpc = 1; - dl_dci->tpc = 1; - dl_dci->has_vrb_format = 1; - dl_dci->vrb_format = PROTOCOL__PRP_VRB_FORMAT__PRVRBF_LOCALIZED; - dl_dci->has_format = 1; - dl_dci->format = PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1D; - dl_dci->n_ndi = 1; - dl_dci->ndi = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_ndi); - dl_dci->ndi[0] = UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]; - dl_dci->has_rb_bitmap = 1; - dl_dci->rb_bitmap = allocate_prbs_sub(nb_rb, UE_list->UE_template[CC_id][UE_id].rballoc_subband); - dl_dci->has_rb_shift = 1; - dl_dci->rb_shift = 0; - dl_dci->has_dai = 1; - dl_dci->dai = (UE_list->UE_template[CC_id][UE_id].DAI-1)&3; - dl_dci->n_mcs = 1; - dl_dci->mcs = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_mcs); - dl_dci->mcs[0] = mcs; - dl_dci->n_tbs_size = 1; - dl_dci->tbs_size = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_tbs_size); - dl_dci->tbs_size[0] = dci_tbs; - dl_dci->n_rv = 1; - dl_dci->rv = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_rv); - dl_dci->rv[0] = round&3; + for(i=0; ilte_frame_parms.N_RBG; i++) { + rballoc_sub[i] = UE_list->UE_template[CC_id][UE_id].rballoc_subband[harq_pid][i]; + } - if(ue_sched_ctl->dl_pow_off[CC_id] == 2) { - ue_sched_ctl->dl_pow_off[CC_id] = 1; - } - - dl_dci->has_dl_power_offset = 1; - dl_dci->dl_power_offset = ue_sched_ctl->dl_pow_off[CC_id]; - - break; - case 6: - dl_dci->has_res_alloc = 1; - dl_dci->res_alloc = 0; - dl_dci->n_mcs = 1; - dl_dci->mcs = (uint32_t *)malloc(sizeof(uint32_t)); - dl_dci->mcs[0] = mcs; - dl_dci->has_tpc = 1; - dl_dci->tpc = 1; - dl_dci->has_vrb_format = 1; - dl_dci->vrb_format = PROTOCOL__PRP_VRB_FORMAT__PRVRBF_LOCALIZED; - dl_dci->has_format = 1; - dl_dci->format = PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1D; - dl_dci->n_ndi = 1; - dl_dci->ndi = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_ndi); - dl_dci->ndi[0] = UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]; - dl_dci->has_rb_bitmap = 1; - dl_dci->rb_bitmap = allocate_prbs_sub(nb_rb, UE_list->UE_template[CC_id][UE_id].rballoc_subband); - dl_dci->has_rb_shift = 1; - dl_dci->rb_shift = 0; - dl_dci->has_dai = 1; - dl_dci->dai = (UE_list->UE_template[CC_id][UE_id].DAI-1)&3; - dl_dci->n_mcs = 1; - dl_dci->mcs = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_mcs); - dl_dci->mcs[0] = mcs; - dl_dci->n_tbs_size = 1; - dl_dci->tbs_size = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_tbs_size); - dl_dci->tbs_size[0] = dci_tbs; - dl_dci->n_rv = 1; - dl_dci->rv = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_rv); - dl_dci->rv[0] = round&3; - dl_dci->has_dl_power_offset = 1; - dl_dci->dl_power_offset = ue_sched_ctl->dl_pow_off[CC_id]; - - break; - } - num_ues_added += 1; + ndi = UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]; + tpc = 1; + + ue_has_transmission = 1; + num_ues_added++; } else { LOG_D(MAC,"[eNB %d] Frame %d CC_id %d : don't schedule UE %d, its retransmission takes more resources than we have\n", mod_id, frame, CC_id, UE_id); } - + //End of retransmission } else { /* This is a potentially new SDU opportunity */ - rlc_status.bytes_in_buffer = 0; // Now check RLC information to compute number of required RBs // get maximum TBS size for RLC request @@ -505,8 +338,6 @@ schedule_ue_spec_default( TBS = mac_xface->get_TBS_DL(mcs, nb_available_rb); dci_tbs = TBS; - - // check first for RLC data on DCCH // add the length for all the control elements (timing adv, drx, etc) : header + payload @@ -527,154 +358,61 @@ schedule_ue_spec_default( header_len_dcch = 2; // 2 bytes DCCH SDU subheader - // Need to see if we have space for data from this channel - - if ( TBS-ta_len-header_len_dcch > 0 ) { - LOG_D(MAC, "[TEST]Requested %d bytes in DCCH buffer during first call\n", dci_tbs-ta_len-header_len_dcch); - //If we have space, we need to see how much data we can request at most (if any available) - rlc_status = mac_rlc_status_ind(mod_id, - rnti, - mod_id, - frame, - ENB_FLAG_YES, - MBMS_FLAG_NO, - DCCH, - (dci_tbs-ta_len-header_len_dcch)); // transport block set size + // Loop through the UE logical channels (DCCH, DCCH1, DTCH for now) + for (j = 1; j < 4; j++) { + header_len+=3; - //If data are available in the DCCH - if (rlc_status.bytes_in_buffer > 0) { - LOG_D(MAC, "[TEST]Have %d bytes in DCCH buffer during first call\n", rlc_status.bytes_in_buffer); - //Fill in as much as possible - data_to_request = cmin(dci_tbs-ta_len-header_len_dcch, rlc_status.bytes_in_buffer) + 1; - LOG_D(MAC, "[TEST]Will request %d from DCCH\n", data_to_request); - rlc_pdus[channels_added] = (Protocol__PrpRlcPdu *) malloc(sizeof(Protocol__PrpRlcPdu)); - protocol__prp_rlc_pdu__init(rlc_pdus[channels_added]); - rlc_pdus[channels_added]->n_rlc_pdu_tb = 2; - rlc_pdus[channels_added]->rlc_pdu_tb = (Protocol__PrpRlcPduTb **) malloc(sizeof(Protocol__PrpRlcPduTb *) * 2); - rlc_pdus[channels_added]->rlc_pdu_tb[0] = (Protocol__PrpRlcPduTb *) malloc(sizeof(Protocol__PrpRlcPduTb)); - protocol__prp_rlc_pdu_tb__init(rlc_pdus[channels_added]->rlc_pdu_tb[0]); - rlc_pdus[channels_added]->rlc_pdu_tb[0]->has_logical_channel_id = 1; - rlc_pdus[channels_added]->rlc_pdu_tb[0]->logical_channel_id = DCCH; - rlc_pdus[channels_added]->rlc_pdu_tb[0]->has_size = 1; - rlc_pdus[channels_added]->rlc_pdu_tb[0]->size = data_to_request; - rlc_pdus[channels_added]->rlc_pdu_tb[1] = (Protocol__PrpRlcPduTb *) malloc(sizeof(Protocol__PrpRlcPduTb)); - protocol__prp_rlc_pdu_tb__init(rlc_pdus[channels_added]->rlc_pdu_tb[1]); - rlc_pdus[channels_added]->rlc_pdu_tb[1]->has_logical_channel_id = 1; - rlc_pdus[channels_added]->rlc_pdu_tb[1]->logical_channel_id = DCCH; - rlc_pdus[channels_added]->rlc_pdu_tb[1]->has_size = 1; - rlc_pdus[channels_added]->rlc_pdu_tb[1]->size = data_to_request; - dl_data[num_ues_added]->n_rlc_pdu++; - channels_added++; - //Set this to the max value that we might request - sdu_length_total = data_to_request; - } else { - LOG_D(MAC, "[TEST]Nothing here\n"); - header_len_dcch = 0; - sdu_length_total = 0; - } - } + // Need to see if we have space for data from this channel + if (dci_tbs - ta_len - header_len > 0) { + LOG_D(MAC, "[TEST]Requested %d bytes from RLC buffer if channel %d during first call\n", dci_tbs-ta_len-header_len); + //If we have space, we need to see how much data we can request at most (if any available) + rlc_status = mac_rlc_status_ind(mod_id, + rnti, + mod_id, + frame, + ENB_FLAG_YES, + MBMS_FLAG_NO, + j, + (dci_tbs-ta_len-header_len)); // transport block set size - // check for DCCH1 and update header information (assume 2 byte sub-header) - if (dci_tbs-ta_len-header_len_dcch-sdu_length_total-2 > 0 ) { - LOG_D(MAC, "[TEST]Requested %d bytes in DCCH1 buffer during first call\n", dci_tbs-ta_len-header_len_dcch-sdu_length_total-2); - - //If we have space, we need to see how much data we can request at most (if any are available) - rlc_status = mac_rlc_status_ind(mod_id, - rnti, - mod_id, - frame, - ENB_FLAG_YES, - MBMS_FLAG_NO, - DCCH1, - (dci_tbs-ta_len-header_len_dcch-sdu_length_total-2)); // transport block set size less allocations for timing advance and - // DCCH SDU - - // If data are available in DCCH1 - if (rlc_status.bytes_in_buffer > 0) { - //Add this subheader - header_len_dcch += 2; - - //Fill in as much as possible - data_to_request = cmin(dci_tbs-ta_len-header_len_dcch-sdu_length_total, rlc_status.bytes_in_buffer); - - rlc_pdus[channels_added] = (Protocol__PrpRlcPdu *) malloc(sizeof(Protocol__PrpRlcPdu)); - protocol__prp_rlc_pdu__init(rlc_pdus[channels_added]); - rlc_pdus[channels_added]->n_rlc_pdu_tb = 2; - rlc_pdus[channels_added]->rlc_pdu_tb = (Protocol__PrpRlcPduTb **) malloc(sizeof(Protocol__PrpRlcPduTb *) * 2); - rlc_pdus[channels_added]->rlc_pdu_tb[0] = (Protocol__PrpRlcPduTb *) malloc(sizeof(Protocol__PrpRlcPduTb)); - protocol__prp_rlc_pdu_tb__init(rlc_pdus[channels_added]->rlc_pdu_tb[0]); - rlc_pdus[channels_added]->rlc_pdu_tb[0]->has_logical_channel_id = 1; - rlc_pdus[channels_added]->rlc_pdu_tb[0]->logical_channel_id = DCCH1; - rlc_pdus[channels_added]->rlc_pdu_tb[0]->has_size = 1; - rlc_pdus[channels_added]->rlc_pdu_tb[0]->size = data_to_request; - rlc_pdus[channels_added]->rlc_pdu_tb[1] = (Protocol__PrpRlcPduTb *) malloc(sizeof(Protocol__PrpRlcPduTb)); - protocol__prp_rlc_pdu_tb__init(rlc_pdus[channels_added]->rlc_pdu_tb[1]); - rlc_pdus[channels_added]->rlc_pdu_tb[1]->has_logical_channel_id = 1; - rlc_pdus[channels_added]->rlc_pdu_tb[1]->logical_channel_id = DCCH1; - rlc_pdus[channels_added]->rlc_pdu_tb[1]->has_size = 1; - rlc_pdus[channels_added]->rlc_pdu_tb[1]->size = data_to_request; - dl_data[num_ues_added]->n_rlc_pdu++; - channels_added++; - sdu_length_total += data_to_request; - } - } - - // check for DTCH and update header information - // here we should loop over all possible DTCH - - header_len_dtch = 3; // Assume max 3 bytes DTCH SDU subheader - - LOG_D(MAC,"[eNB %d], Frame %d, DTCH->DLSCH, CC_id %d, Checking RLC status (rab %d, tbs %d, len %d)\n", - mod_id, frame, CC_id, DTCH, TBS, - dci_tbs-ta_len-header_len_dcch-sdu_length_total-header_len_dtch); - - if (dci_tbs-ta_len-header_len_dcch-sdu_length_total-header_len_dtch > 0 ) { - - LOG_D(MAC, "[TEST] This is how much we request at most during first call %d\n", dci_tbs-ta_len-header_len_dcch-sdu_length_total-header_len_dtch); - - //If we have space, we need to see how much data we can request at most (if any are available) - rlc_status = mac_rlc_status_ind(mod_id, - rnti, - mod_id, - frame, - ENB_FLAG_YES, - MBMS_FLAG_NO, - DTCH, - dci_tbs-ta_len-header_len_dcch-sdu_length_total-header_len_dtch); - - // If data are available in DTCH - if (rlc_status.bytes_in_buffer > 0) { - LOG_D(MAC, "[TEST] Have %d bytes in buffer DTCH during first call\n", rlc_status.bytes_in_buffer); - //Fill what remains in the TB - data_to_request = cmin(dci_tbs-ta_len-header_len_dcch-sdu_length_total-header_len_dtch, rlc_status.bytes_in_buffer); - LOG_D(MAC, "[TEST]Will request %d \n", data_to_request); - rlc_pdus[channels_added] = (Protocol__PrpRlcPdu *) malloc(sizeof(Protocol__PrpRlcPdu)); - protocol__prp_rlc_pdu__init(rlc_pdus[channels_added]); - rlc_pdus[channels_added]->n_rlc_pdu_tb = 2; - rlc_pdus[channels_added]->rlc_pdu_tb = (Protocol__PrpRlcPduTb **) malloc(sizeof(Protocol__PrpRlcPduTb *) * 2); - rlc_pdus[channels_added]->rlc_pdu_tb[0] = (Protocol__PrpRlcPduTb *) malloc(sizeof(Protocol__PrpRlcPduTb)); - protocol__prp_rlc_pdu_tb__init(rlc_pdus[channels_added]->rlc_pdu_tb[0]); - rlc_pdus[channels_added]->rlc_pdu_tb[0]->has_logical_channel_id = 1; - rlc_pdus[channels_added]->rlc_pdu_tb[0]->logical_channel_id = DTCH; - rlc_pdus[channels_added]->rlc_pdu_tb[0]->has_size = 1; - rlc_pdus[channels_added]->rlc_pdu_tb[0]->size = data_to_request; - rlc_pdus[channels_added]->rlc_pdu_tb[1] = (Protocol__PrpRlcPduTb *) malloc(sizeof(Protocol__PrpRlcPduTb)); - protocol__prp_rlc_pdu_tb__init(rlc_pdus[channels_added]->rlc_pdu_tb[1]); - rlc_pdus[channels_added]->rlc_pdu_tb[1]->has_logical_channel_id = 1; - rlc_pdus[channels_added]->rlc_pdu_tb[1]->logical_channel_id = DTCH; - rlc_pdus[channels_added]->rlc_pdu_tb[1]->has_size = 1; - rlc_pdus[channels_added]->rlc_pdu_tb[1]->size = data_to_request; - dl_data[num_ues_added]->n_rlc_pdu++; - channels_added++; - sdu_length_total += data_to_request; - - if(data_to_request < 128) { - header_len_dtch = 2; - } - } else { - header_len_dtch = 0; - } - } + //If data are available in channel j + if (rlc_status.bytes_in_buffer > 0) { + LOG_D(MAC, "[TEST]Have %d bytes in DCCH buffer during first call\n", rlc_status.bytes_in_buffer); + //Fill in as much as possible + data_to_request = cmin(dci_tbs-ta_len-header_len, rlc_status.bytes_in_buffer); + if (data_to_request < 128) { //The header will be one byte less + header_len--; + } + if (j == 1) { + data_to_request++; //It is not correct but fixes some RLC bug for DCCH + } + LOG_D(MAC, "[TEST]Will request %d from DCCH\n", data_to_request); + rlc_pdus[channels_added] = (Protocol__PrpRlcPdu *) malloc(sizeof(Protocol__PrpRlcPdu)); + protocol__prp_rlc_pdu__init(rlc_pdus[channels_added]); + rlc_pdus[channels_added]->n_rlc_pdu_tb = 2; + rlc_pdus[channels_added]->rlc_pdu_tb = (Protocol__PrpRlcPduTb **) malloc(sizeof(Protocol__PrpRlcPduTb *) * 2); + rlc_pdus[channels_added]->rlc_pdu_tb[0] = (Protocol__PrpRlcPduTb *) malloc(sizeof(Protocol__PrpRlcPduTb)); + protocol__prp_rlc_pdu_tb__init(rlc_pdus[channels_added]->rlc_pdu_tb[0]); + rlc_pdus[channels_added]->rlc_pdu_tb[0]->has_logical_channel_id = 1; + rlc_pdus[channels_added]->rlc_pdu_tb[0]->logical_channel_id = j; + rlc_pdus[channels_added]->rlc_pdu_tb[0]->has_size = 1; + rlc_pdus[channels_added]->rlc_pdu_tb[0]->size = data_to_request; + rlc_pdus[channels_added]->rlc_pdu_tb[1] = (Protocol__PrpRlcPduTb *) malloc(sizeof(Protocol__PrpRlcPduTb)); + protocol__prp_rlc_pdu_tb__init(rlc_pdus[channels_added]->rlc_pdu_tb[1]); + rlc_pdus[channels_added]->rlc_pdu_tb[1]->has_logical_channel_id = 1; + rlc_pdus[channels_added]->rlc_pdu_tb[1]->logical_channel_id = j; + rlc_pdus[channels_added]->rlc_pdu_tb[1]->has_size = 1; + rlc_pdus[channels_added]->rlc_pdu_tb[1]->size = data_to_request; + dl_data[num_ues_added]->n_rlc_pdu++; + channels_added++; + //Set this to the max value that we might request + sdu_length_total = data_to_request; + } else { + //Take back the assumption of a header for this channel + header_len -= 3; + } //End rlc_status.bytes_in_buffer <= 0 + } //end of if dci_tbs - ta_len - header_len > 0 + } // End of iterating the logical channels // Add rlc_pdus to the dl_data message dl_data[num_ues_added]->rlc_pdu = (Protocol__PrpRlcPdu **) malloc(sizeof(Protocol__PrpRlcPdu *) * @@ -688,17 +426,15 @@ schedule_ue_spec_default( // Now compute number of required RBs for total sdu length // Assume RAH format 2 // adjust header lengths - header_len_dcch_tmp = header_len_dcch; - header_len_dtch_tmp = header_len_dtch; + header_len_tmp = header_len; - if (header_len_dtch == 0) { - header_len_dcch = (header_len_dcch > 0) ? (header_len_dcch - 1) : header_len_dcch; // remove length field - } else { - header_len_dtch = (header_len_dtch > 0) ? 1 : header_len_dtch; // remove length field for the last SDU - } + if (header_len == 2 || header_len == 3) { //Only one SDU, remove length field + header_len = 1; + } else { //Remove length field from the last SDU + header_len--; + } mcs_tmp = mcs; - if (mcs_tmp == 0) { nb_rb = 4; // don't let the TBS get too small } else { @@ -711,7 +447,7 @@ schedule_ue_spec_default( TBS = mac_xface->get_TBS_DL(mcs_tmp, nb_rb); LOG_D(MAC,"[TEST]The TBS during rate matching was %d\n", TBS); - while (TBS < (sdu_length_total + header_len_dcch + header_len_dtch + ta_len)) { + while (TBS < (sdu_length_total + header_len + ta_len)) { nb_rb += min_rb_unit[CC_id]; // LOG_D(MAC, "[TEST]Had to increase the number of RBs\n"); if (nb_rb > nb_available_rb) { // if we've gone beyond the maximum number of RBs @@ -724,9 +460,6 @@ schedule_ue_spec_default( TBS = mac_xface->get_TBS_DL(mcs_tmp, nb_rb); } - LOG_D(MAC,"[TEST] After the first pass the resource blocks became %d\n", nb_rb); - LOG_D(MAC,"[TEST] After the first pass the MCS was %d\n", mcs_tmp); - if(nb_rb == ue_sched_ctl->pre_nb_available_rbs[CC_id]) { LOG_D(MAC, "[TEST]We had the exact number of rbs. Time to fill the rballoc subband\n"); for(j = 0; j < frame_parms[CC_id]->N_RBG; j++) { // for indicating the rballoc for each sub-band @@ -747,13 +480,9 @@ schedule_ue_spec_default( nb_rb_temp = nb_rb_temp - min_rb_unit[CC_id]; } } - j = j+1; } } - - LOG_D(MAC,"[TEST] After the second pass the resource blocks became %d\n", nb_rb); - LOG_D(MAC,"[TEST] After the second pass the mcs was %d\n", mcs_tmp); PHY_vars_eNB_g[mod_id][CC_id]->mu_mimo_mode[UE_id].pre_nb_available_rbs = nb_rb; PHY_vars_eNB_g[mod_id][CC_id]->mu_mimo_mode[UE_id].dl_pow_off = ue_sched_ctl->dl_pow_off[CC_id]; @@ -763,22 +492,19 @@ schedule_ue_spec_default( } // decrease mcs until TBS falls below required length - while ((TBS > (sdu_length_total + header_len_dcch + header_len_dtch + ta_len)) && (mcs_tmp > 0)) { + while ((TBS > (sdu_length_total + header_len + ta_len)) && (mcs_tmp > 0)) { mcs_tmp--; TBS = mac_xface->get_TBS_DL(mcs_tmp, nb_rb); } // if we have decreased too much or we don't have enough RBs, increase MCS - while ((TBS < (sdu_length_total + header_len_dcch + header_len_dtch + ta_len)) && + while ((TBS < (sdu_length_total + header_len + ta_len)) && ((( ue_sched_ctl->dl_pow_off[CC_id] > 0) && (mcs_tmp < 28)) || ( (ue_sched_ctl->dl_pow_off[CC_id]==0) && (mcs_tmp <= 15)))) { mcs_tmp++; TBS = mac_xface->get_TBS_DL(mcs_tmp, nb_rb); } - LOG_D(MAC,"[TEST] dlsch_mcs and TBS before and after the rate matching = (%d, %d) (%d, %d)\n", mcs, mcs_tmp, dci_tbs, TBS); - dci_tbs = TBS; - mcs = mcs_tmp; aggregation = process_ue_cqi(mod_id,UE_id); @@ -787,12 +513,6 @@ schedule_ue_spec_default( UE_list->UE_template[CC_id][UE_id].nb_rb[harq_pid] = nb_rb; - /*Deactivate here as well*/ - /* add_ue_dlsch_info(mod_id, */ - /* CC_id, */ - /* UE_id, */ - /* subframe, */ - /* S_DL_SCHEDULED); */ if (frame_parms[CC_id]->frame_type == TDD) { UE_list->UE_template[CC_id][UE_id].DAI++; @@ -840,183 +560,10 @@ schedule_ue_spec_default( for(i=0; ilte_frame_parms.N_RBG; i++) { rballoc_sub[i] = UE_list->UE_template[CC_id][UE_id].rballoc_subband[harq_pid][i]; - } - - switch (mac_xface->get_transmission_mode(mod_id, CC_id, rnti)) { - case 1: - case 2: - default: - dl_dci->has_res_alloc = 1; - dl_dci->res_alloc = 0; - dl_dci->has_vrb_format = 1; - dl_dci->vrb_format = PROTOCOL__PRP_VRB_FORMAT__PRVRBF_LOCALIZED; - dl_dci->has_format = 1; - dl_dci->format = PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1; - dl_dci->has_rb_bitmap = 1; - dl_dci->rb_bitmap = allocate_prbs_sub(nb_rb, rballoc_sub); - dl_dci->has_rb_shift = 1; - dl_dci->rb_shift = 0; - dl_dci->n_ndi = 1; - dl_dci->ndi = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_ndi); - dl_dci->ndi[0] = 1 - UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]; - dl_dci->n_rv = 1; - dl_dci->rv = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_rv); - dl_dci->rv[0] = 0; - dl_dci->has_tpc = 1; - dl_dci->tpc = tpc; - dl_dci->n_mcs = 1; - dl_dci->mcs = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_mcs); - dl_dci->mcs[0] = mcs; - dl_dci->n_tbs_size = 1; - dl_dci->tbs_size = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_tbs_size); - dl_dci->tbs_size[0] = dci_tbs; - if (frame_parms[CC_id]->frame_type == TDD) { - dl_dci->has_dai = 1; - dl_dci->dai = (UE_list->UE_template[CC_id][UE_id].DAI-1)&3; - } - break; - case 3: - dl_dci->has_res_alloc = 1; - dl_dci->res_alloc = 0; - dl_dci->has_vrb_format = 1; - dl_dci->vrb_format = PROTOCOL__PRP_VRB_FORMAT__PRVRBF_LOCALIZED; - dl_dci->has_format = 1; - dl_dci->format = PROTOCOL__PRP_DCI_FORMAT__PRDCIF_2A; - dl_dci->has_rb_bitmap = 1; - dl_dci->rb_bitmap = allocate_prbs_sub(nb_rb, rballoc_sub); - dl_dci->has_rb_shift = 1; - dl_dci->rb_shift = 0; - dl_dci->n_ndi = 2; - dl_dci->ndi = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_ndi); - dl_dci->ndi[0] = 1 - UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]; - dl_dci->ndi[1] = 1 - UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]; - dl_dci->n_rv = 2; - dl_dci->rv = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_rv); - dl_dci->rv[0] = 0; - dl_dci->rv[1] = 0; - dl_dci->has_tpc = 1; - dl_dci->tpc = tpc; - dl_dci->n_mcs = 2; - dl_dci->mcs = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_mcs); - dl_dci->mcs[0] = mcs; - dl_dci->mcs[1] = mcs; - dl_dci->n_tbs_size = 2; - dl_dci->tbs_size = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_tbs_size); - dl_dci->tbs_size[0] = dci_tbs; - dl_dci->tbs_size[1] = dci_tbs; - if (frame_parms[CC_id]->frame_type == TDD) { - dl_dci->has_dai = 1; - dl_dci->dai = (UE_list->UE_template[CC_id][UE_id].DAI-1)&3; - } - break; - case 4: - dl_dci->has_res_alloc = 1; - dl_dci->res_alloc = 0; - dl_dci->has_vrb_format = 1; - dl_dci->vrb_format = PROTOCOL__PRP_VRB_FORMAT__PRVRBF_LOCALIZED; - dl_dci->has_format = 1; - dl_dci->format = PROTOCOL__PRP_DCI_FORMAT__PRDCIF_2A; - dl_dci->has_rb_bitmap = 1; - dl_dci->rb_bitmap = allocate_prbs_sub(nb_rb, rballoc_sub); - dl_dci->has_rb_shift = 1; - dl_dci->rb_shift = 0; - dl_dci->n_ndi = 2; - dl_dci->ndi = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_ndi); - dl_dci->ndi[0] = 1 - UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]; - dl_dci->ndi[1] = 1 - UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]; - dl_dci->n_rv = 2; - dl_dci->rv = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_rv); - dl_dci->rv[0] = 0; - dl_dci->rv[1] = 0; - dl_dci->has_tpc = 1; - dl_dci->tpc = tpc; - dl_dci->n_mcs = 2; - dl_dci->mcs = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_mcs); - dl_dci->mcs[0] = mcs; - dl_dci->mcs[1] = mcs; - dl_dci->n_tbs_size = 2; - dl_dci->tbs_size = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_tbs_size); - dl_dci->tbs_size[0] = dci_tbs; - dl_dci->tbs_size[1] = dci_tbs; - if (frame_parms[CC_id]->frame_type == TDD) { - dl_dci->has_dai = 1; - dl_dci->dai = (UE_list->UE_template[CC_id][UE_id].DAI-1)&3; - } - break; - case 5: - dl_dci->has_res_alloc = 1; - dl_dci->res_alloc = 0; - dl_dci->has_vrb_format = 1; - dl_dci->vrb_format = PROTOCOL__PRP_VRB_FORMAT__PRVRBF_LOCALIZED; - dl_dci->has_format = 1; - dl_dci->format = PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1D; - dl_dci->has_rb_bitmap = 1; - dl_dci->rb_bitmap = allocate_prbs_sub(nb_rb, rballoc_sub); - dl_dci->has_rb_shift = 1; - dl_dci->rb_shift = 0; - dl_dci->n_ndi = 1; - dl_dci->ndi = 1; - dl_dci->ndi[0] = 1 - UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]; - dl_dci->n_rv = 1; - dl_dci->rv = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_rv); - dl_dci->rv[0] = 0; - dl_dci->has_tpc = 1; - dl_dci->tpc = tpc; - dl_dci->n_mcs = 1; - dl_dci->mcs = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_mcs); - dl_dci->mcs[0] = mcs; - dl_dci->n_tbs_size = 1; - dl_dci->tbs_size = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_tbs_size); - dl_dci->tbs_size[0] = dci_tbs; - if (frame_parms[CC_id]->frame_type == TDD) { - dl_dci->has_dai = 1; - dl_dci->dai = (UE_list->UE_template[CC_id][UE_id].DAI-1)&3; - } - - if(ue_sched_ctl->dl_pow_off[CC_id] == 2) { - ue_sched_ctl->dl_pow_off[CC_id] = 1; - } - - dl_dci->has_dl_power_offset = 1; - dl_dci->dl_power_offset = ue_sched_ctl->dl_pow_off[CC_id]; - dl_dci->has_precoding_info = 1; - dl_dci->precoding_info = 5; // Is this right?? - - break; - case 6: - dl_dci->has_res_alloc = 1; - dl_dci->res_alloc = 0; - dl_dci->has_vrb_format = 1; - dl_dci->vrb_format = PROTOCOL__PRP_VRB_FORMAT__PRVRBF_LOCALIZED; - dl_dci->has_format = 1; - dl_dci->format = PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1D; - dl_dci->has_rb_bitmap = 1; - dl_dci->rb_bitmap = allocate_prbs_sub(nb_rb, rballoc_sub); - dl_dci->has_rb_shift = 1; - dl_dci->rb_shift = 0; - dl_dci->n_ndi = 1; - dl_dci->ndi = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_ndi); - dl_dci->ndi[0] = 1 - UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]; - dl_dci->n_rv = 1; - dl_dci->rv = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_rv); - dl_dci->rv[0] = round&3; - dl_dci->has_tpc = 1; - dl_dci->tpc = tpc; - dl_dci->n_mcs = 1; - dl_dci->mcs = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_mcs); - dl_dci->mcs[0] = mcs; - if (frame_parms[CC_id]->frame_type == TDD) { - dl_dci->has_dai = 1; - dl_dci->dai = (UE_list->UE_template[CC_id][UE_id].DAI-1)&3; - } - - dl_dci->has_dl_power_offset = 1; - dl_dci->dl_power_offset = ue_sched_ctl->dl_pow_off[CC_id]; - dl_dci->has_precoding_info = 1; - dl_dci->precoding_info = 5; // Is this right?? - break; - } + } + ndi = 1 - UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]; + // Toggle NDI for next time LOG_D(MAC,"CC_id %d Frame %d, subframeP %d: Toggling Format1 NDI for UE %d (rnti %x/%d) oldNDI %d\n", CC_id, frame, subframe, UE_id, @@ -1025,10 +572,190 @@ schedule_ue_spec_default( // Increase the pointer for the number of scheduled UEs num_ues_added++; + ue_has_transmission = 1; } else { // There is no data from RLC or MAC header, so don't schedule + ue_has_transmission = 0; + } + } // End of new scheduling + + // If we has transmission or retransmission + if (ue_has_transmission) { + switch (mac_xface->get_transmission_mode(mod_id, CC_id, rnti)) { + case 1: + case 2: + default: + dl_dci->has_res_alloc = 1; + dl_dci->res_alloc = 0; + dl_dci->has_vrb_format = 1; + dl_dci->vrb_format = PROTOCOL__PRP_VRB_FORMAT__PRVRBF_LOCALIZED; + dl_dci->has_format = 1; + dl_dci->format = PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1; + dl_dci->has_rb_bitmap = 1; + dl_dci->rb_bitmap = allocate_prbs_sub(nb_rb, rballoc_sub); + dl_dci->has_rb_shift = 1; + dl_dci->rb_shift = 0; + dl_dci->n_ndi = 1; + dl_dci->ndi = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_ndi); + dl_dci->ndi[0] = ndi; + dl_dci->n_rv = 1; + dl_dci->rv = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_rv); + dl_dci->rv[0] = round & 3; + dl_dci->has_tpc = 1; + dl_dci->tpc = tpc; + dl_dci->n_mcs = 1; + dl_dci->mcs = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_mcs); + dl_dci->mcs[0] = mcs; + dl_dci->n_tbs_size = 1; + dl_dci->tbs_size = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_tbs_size); + dl_dci->tbs_size[0] = dci_tbs; + if (frame_parms[CC_id]->frame_type == TDD) { + dl_dci->has_dai = 1; + dl_dci->dai = (UE_list->UE_template[CC_id][UE_id].DAI-1)&3; + } + break; + case 3: + dl_dci->has_res_alloc = 1; + dl_dci->res_alloc = 0; + dl_dci->has_vrb_format = 1; + dl_dci->vrb_format = PROTOCOL__PRP_VRB_FORMAT__PRVRBF_LOCALIZED; + dl_dci->has_format = 1; + dl_dci->format = PROTOCOL__PRP_DCI_FORMAT__PRDCIF_2A; + dl_dci->has_rb_bitmap = 1; + dl_dci->rb_bitmap = allocate_prbs_sub(nb_rb, rballoc_sub); + dl_dci->has_rb_shift = 1; + dl_dci->rb_shift = 0; + dl_dci->n_ndi = 2; + dl_dci->ndi = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_ndi); + dl_dci->ndi[0] = ndi; + dl_dci->ndi[1] = ndi; + dl_dci->n_rv = 2; + dl_dci->rv = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_rv); + dl_dci->rv[0] = round & 3; + dl_dci->rv[1] = round & 3; + dl_dci->has_tpc = 1; + dl_dci->tpc = tpc; + dl_dci->n_mcs = 2; + dl_dci->mcs = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_mcs); + dl_dci->mcs[0] = mcs; + dl_dci->mcs[1] = mcs; + dl_dci->n_tbs_size = 2; + dl_dci->tbs_size = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_tbs_size); + dl_dci->tbs_size[0] = dci_tbs; + dl_dci->tbs_size[1] = dci_tbs; + if (frame_parms[CC_id]->frame_type == TDD) { + dl_dci->has_dai = 1; + dl_dci->dai = (UE_list->UE_template[CC_id][UE_id].DAI-1)&3; + } + break; + case 4: + dl_dci->has_res_alloc = 1; + dl_dci->res_alloc = 0; + dl_dci->has_vrb_format = 1; + dl_dci->vrb_format = PROTOCOL__PRP_VRB_FORMAT__PRVRBF_LOCALIZED; + dl_dci->has_format = 1; + dl_dci->format = PROTOCOL__PRP_DCI_FORMAT__PRDCIF_2A; + dl_dci->has_rb_bitmap = 1; + dl_dci->rb_bitmap = allocate_prbs_sub(nb_rb, rballoc_sub); + dl_dci->has_rb_shift = 1; + dl_dci->rb_shift = 0; + dl_dci->n_ndi = 2; + dl_dci->ndi = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_ndi); + dl_dci->ndi[0] = ndi; + dl_dci->ndi[1] = ndi; + dl_dci->n_rv = 2; + dl_dci->rv = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_rv); + dl_dci->rv[0] = round & 3; + dl_dci->rv[1] = round & 3; + dl_dci->has_tpc = 1; + dl_dci->tpc = tpc; + dl_dci->n_mcs = 2; + dl_dci->mcs = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_mcs); + dl_dci->mcs[0] = mcs; + dl_dci->mcs[1] = mcs; + dl_dci->n_tbs_size = 2; + dl_dci->tbs_size = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_tbs_size); + dl_dci->tbs_size[0] = dci_tbs; + dl_dci->tbs_size[1] = dci_tbs; + if (frame_parms[CC_id]->frame_type == TDD) { + dl_dci->has_dai = 1; + dl_dci->dai = (UE_list->UE_template[CC_id][UE_id].DAI-1)&3; + } + break; + case 5: + dl_dci->has_res_alloc = 1; + dl_dci->res_alloc = 0; + dl_dci->has_vrb_format = 1; + dl_dci->vrb_format = PROTOCOL__PRP_VRB_FORMAT__PRVRBF_LOCALIZED; + dl_dci->has_format = 1; + dl_dci->format = PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1D; + dl_dci->has_rb_bitmap = 1; + dl_dci->rb_bitmap = allocate_prbs_sub(nb_rb, rballoc_sub); + dl_dci->has_rb_shift = 1; + dl_dci->rb_shift = 0; + dl_dci->n_ndi = 1; + dl_dci->ndi = 1; + dl_dci->ndi[0] = ndi; + dl_dci->n_rv = 1; + dl_dci->rv = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_rv); + dl_dci->rv[0] = round & 3; + dl_dci->has_tpc = 1; + dl_dci->tpc = tpc; + dl_dci->n_mcs = 1; + dl_dci->mcs = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_mcs); + dl_dci->mcs[0] = mcs; + dl_dci->n_tbs_size = 1; + dl_dci->tbs_size = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_tbs_size); + dl_dci->tbs_size[0] = dci_tbs; + if (frame_parms[CC_id]->frame_type == TDD) { + dl_dci->has_dai = 1; + dl_dci->dai = (UE_list->UE_template[CC_id][UE_id].DAI-1)&3; + } + + if(ue_sched_ctl->dl_pow_off[CC_id] == 2) { + ue_sched_ctl->dl_pow_off[CC_id] = 1; + } + + dl_dci->has_dl_power_offset = 1; + dl_dci->dl_power_offset = ue_sched_ctl->dl_pow_off[CC_id]; + dl_dci->has_precoding_info = 1; + dl_dci->precoding_info = 5; // Is this right?? + + break; + case 6: + dl_dci->has_res_alloc = 1; + dl_dci->res_alloc = 0; + dl_dci->has_vrb_format = 1; + dl_dci->vrb_format = PROTOCOL__PRP_VRB_FORMAT__PRVRBF_LOCALIZED; + dl_dci->has_format = 1; + dl_dci->format = PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1D; + dl_dci->has_rb_bitmap = 1; + dl_dci->rb_bitmap = allocate_prbs_sub(nb_rb, rballoc_sub); + dl_dci->has_rb_shift = 1; + dl_dci->rb_shift = 0; + dl_dci->n_ndi = 1; + dl_dci->ndi = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_ndi); + dl_dci->ndi[0] = ndi; + dl_dci->n_rv = 1; + dl_dci->rv = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_rv); + dl_dci->rv[0] = round & 3; + dl_dci->has_tpc = 1; + dl_dci->tpc = tpc; + dl_dci->n_mcs = 1; + dl_dci->mcs = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_mcs); + dl_dci->mcs[0] = mcs; + if (frame_parms[CC_id]->frame_type == TDD) { + dl_dci->has_dai = 1; + dl_dci->dai = (UE_list->UE_template[CC_id][UE_id].DAI-1)&3; + } + dl_dci->has_dl_power_offset = 1; + dl_dci->dl_power_offset = ue_sched_ctl->dl_pow_off[CC_id]; + dl_dci->has_precoding_info = 1; + dl_dci->precoding_info = 5; // Is this right?? + break; } } + if (frame_parms[CC_id]->frame_type == TDD) { set_ul_DAI(mod_id, UE_id, CC_id, frame, subframe, frame_parms); } From bb874258980e9bb70cbb81b5cf2d676d56f933c7 Mon Sep 17 00:00:00 2001 From: Navid Nikaein Date: Sat, 6 Feb 2016 09:31:33 +0100 Subject: [PATCH 090/349] add eNB agent libs to lte-softmodem --- cmake_targets/CMakeLists.txt | 8 ++++---- openair2/ENB_APP/enb_agent_handler.c | 10 +++++----- openair2/LAYER2/MAC/eNB_scheduler.c | 6 +++--- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index b555f67ebc..8631fe92a5 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -1512,12 +1512,12 @@ add_executable(lte-softmodem target_link_libraries (lte-softmodem -Wl,--start-group - RRC_LIB S1AP_LIB S1AP_ENB GTPV1U SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT UDP SCHED_LIB PHY LFDS L2 ${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} ${ITTI_LIB} ${MIH_LIB} + RRC_LIB S1AP_LIB S1AP_ENB GTPV1U SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT UDP SCHED_LIB PHY LFDS L2 ${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} ${ITTI_LIB} ${MIH_LIB} ${PRPT_MSG_LIB} ${ASYNC_IF_LIB} ${ENB_AGENT_LIB} -Wl,--end-group ) target_link_libraries (lte-softmodem ${LIBXML2_LIBRARIES}) -target_link_libraries (lte-softmodem pthread m ${CONFIG_LIBRARIES} rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${NETTLE_LIBRARIES} sctp ${option_HW_lib} ${XFORMS_LIBRARIES} ) +target_link_libraries (lte-softmodem pthread m ${CONFIG_LIBRARIES} rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${NETTLE_LIBRARIES} sctp ${option_HW_lib} ${XFORMS_LIBRARIES} ${PROTOBUF_LIB}) target_link_libraries (lte-softmodem ${LIBBOOST_LIBRARIES}) # lte-softmodem-nos1 is both eNB and UE implementation @@ -1545,11 +1545,11 @@ add_executable(lte-softmodem-nos1 ) target_link_libraries (lte-softmodem-nos1 -Wl,--start-group - RRC_LIB SECU_CN SECU_OSA UTIL HASHTABLE SCHED_LIB PHY LFDS L2 ${MSC_LIB} ${RAL_LIB} ${ITTI_LIB} ${MIH_LIB} + RRC_LIB SECU_CN SECU_OSA UTIL HASHTABLE SCHED_LIB PHY LFDS L2 ${MSC_LIB} ${RAL_LIB} ${ITTI_LIB} ${MIH_LIB} ${PRPT_MSG_LIB} ${ASYNC_IF_LIB} ${ENB_AGENT_LIB} -Wl,--end-group ) target_link_libraries (lte-softmodem-nos1 ${LIBXML2_LIBRARIES}) -target_link_libraries (lte-softmodem-nos1 pthread m ${CONFIG_LIBRARIES} rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${NETTLE_LIBRARIES} ${option_HW_lib} ${XFORMS_LIBRARIES} ) +target_link_libraries (lte-softmodem-nos1 pthread m ${CONFIG_LIBRARIES} rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${NETTLE_LIBRARIES} ${option_HW_lib} ${XFORMS_LIBRARIES} ${PROTOBUF_LIB}) target_link_libraries (lte-softmodem-nos1 ${LIBBOOST_LIBRARIES}) diff --git a/openair2/ENB_APP/enb_agent_handler.c b/openair2/ENB_APP/enb_agent_handler.c index 3e9752b539..4894683723 100644 --- a/openair2/ENB_APP/enb_agent_handler.c +++ b/openair2/ENB_APP/enb_agent_handler.c @@ -41,7 +41,7 @@ #include "assertions.h" -enb_agent_message_decoded_callback messages_callback[][3] = { +enb_agent_message_decoded_callback agent_messages_callback[][3] = { {enb_agent_hello, 0, 0}, /*PROTOCOL__PROGRAN_MESSAGE__MSG_HELLO_MSG*/ {enb_agent_echo_reply, 0, 0}, /*PROTOCOL__PROGRAN_MESSAGE__MSG_ECHO_REQUEST_MSG*/ {0, 0, 0}, /*PROTOCOL__PROGRAN_MESSAGE__MSG_ECHO_REPLY_MSG*/ //Must add handler when receiving echo reply @@ -85,19 +85,19 @@ Protocol__ProgranMessage* enb_agent_handle_message (mid_t mod_id, goto error; } - if ((decoded_message->msg_case > sizeof(messages_callback) / (3*sizeof(enb_agent_message_decoded_callback))) || + if ((decoded_message->msg_case > sizeof(agent_messages_callback) / (3*sizeof(enb_agent_message_decoded_callback))) || (decoded_message->msg_dir > PROTOCOL__PROGRAN_DIRECTION__UNSUCCESSFUL_OUTCOME)){ err_code= PROTOCOL__PROGRAN_ERR__MSG_NOT_HANDLED; goto error; } - if (messages_callback[decoded_message->msg_case-1][decoded_message->msg_dir-1] == NULL) { + if (agent_messages_callback[decoded_message->msg_case-1][decoded_message->msg_dir-1] == NULL) { err_code= PROTOCOL__PROGRAN_ERR__MSG_NOT_SUPPORTED; goto error; } - err_code = ((*messages_callback[decoded_message->msg_case-1][decoded_message->msg_dir-1])(mod_id, (void *) decoded_message, &reply_message)); + err_code = ((*agent_messages_callback[decoded_message->msg_case-1][decoded_message->msg_dir-1])(mod_id, (void *) decoded_message, &reply_message)); if ( err_code < 0 ){ goto error; } @@ -147,7 +147,7 @@ Protocol__ProgranMessage *enb_agent_handle_timed_task(void *args) { Protocol__ProgranMessage *timed_task, *reply_message; timed_task = timer_args->msg; - err_code = ((*messages_callback[timed_task->msg_case-1][timed_task->msg_dir-1])(timer_args->mod_id, (void *) timed_task, &reply_message)); + err_code = ((*agent_messages_callback[timed_task->msg_case-1][timed_task->msg_dir-1])(timer_args->mod_id, (void *) timed_task, &reply_message)); if ( err_code < 0 ){ goto error; } diff --git a/openair2/LAYER2/MAC/eNB_scheduler.c b/openair2/LAYER2/MAC/eNB_scheduler.c index fec058b27e..54b31b6e64 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler.c +++ b/openair2/LAYER2/MAC/eNB_scheduler.c @@ -60,9 +60,9 @@ #include "pdcp.h" //Agent-related headers -#include "ENB_APP/enb_agent_extern.h" -#include "ENB_APP/enb_agent_mac.h" -#include "LAYER2/MAC/enb_agent_mac_proto.h" +#include "enb_agent_extern.h" +#include "enb_agent_mac.h" +#include "enb_agent_mac_proto.h" #if defined(ENABLE_ITTI) # include "intertask_interface.h" From a0289d74fa610bd73ac2bb79d20da8bc8a685411 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Tue, 9 Feb 2016 13:03:31 +0000 Subject: [PATCH 091/349] Added support for eNB, cell, UE and logical channel configuration messages to the progRAN protocol --- cmake_targets/CMakeLists.txt | 4 + .../ENB_APP/MESSAGES/V2/config_common.proto | 174 ++++++++++++++++++ .../ENB_APP/MESSAGES/V2/config_messages.proto | 88 +++++++++ openair2/ENB_APP/MESSAGES/V2/header.proto | 12 +- openair2/ENB_APP/MESSAGES/V2/progran.proto | 40 +++- 5 files changed, 315 insertions(+), 3 deletions(-) create mode 100644 openair2/ENB_APP/MESSAGES/V2/config_common.proto create mode 100644 openair2/ENB_APP/MESSAGES/V2/config_messages.proto diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index 8631fe92a5..93aa36c727 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -713,6 +713,8 @@ if (ENB_AGENT_SB_IF) ${PRPT_MSG_DIR}/time_common.proto ${PRPT_MSG_DIR}/controller_commands.proto ${PRPT_MSG_DIR}/mac_primitives.proto + ${PRPT_MSG_DIR}/config_messages.proto + ${PRPT_MSG_DIR}/config_common.proto ) set(PRPT_C_DIR ${protobuf_generated_dir}/${PRPTDIR}) @@ -727,6 +729,8 @@ if (ENB_AGENT_SB_IF) ${PRPT_C_DIR}/time_common.pb-c.c ${PRPT_C_DIR}/controller_commands.pb-c.c ${PRPT_C_DIR}/mac_primitives.pb-c.c + ${PRPT_C_DIR}/config_messages.pb-c.c + ${PRPT_C_DIR}/config_common.pb-c.c ) file(GLOB prpt_h ${PRPT_C_DIR}/*.h) diff --git a/openair2/ENB_APP/MESSAGES/V2/config_common.proto b/openair2/ENB_APP/MESSAGES/V2/config_common.proto new file mode 100644 index 0000000000..ab6e8b8c22 --- /dev/null +++ b/openair2/ENB_APP/MESSAGES/V2/config_common.proto @@ -0,0 +1,174 @@ +//'syntax = "proto2";' +package protocol; + +// +// Cell config related structures and enums +// + +message prp_si_config { + optional uint32 sfn = 1; + optional uint32 sib1_length = 2; // The length of SIB1 in bytes + optional uint32 si_window_length = 3; // The scheduling window for all SIs in SF + repeated prp_si_message si_message = 4; // List of SI messages to be sent. + // The index identifies the type of an SI message + // 0 - SIB1 + // 1..31 - SIx + // 32..63 - PCCH +} + +message prp_si_message { + optional uint32 periodicity = 1; // Periodicity of SI msg in radio frames + optional uint32 length = 2; // The length of the SI message in bytes +} + +enum prp_hopping_mode { + PRHM_INTER = 0; + PRHM_INTERINTRA = 1; +} + +enum prp_phich_resource { + PRPR_ONE_SIXTH = 0; + PRPR_HALF = 1; + PRPR_ONE = 2; + PRPR_TWO = 3; +} + +enum prp_phich_duration { + PRPD_NORMAL = 0; + PRPD_EXTENDED = 1; +} + +enum prp_ul_cyclic_prefix_length { + PRUCPL_NORMAL = 0; + PRUCPL_EXTENDED = 1; +} + +enum prp_dl_cyclic_prefix_length { + PRDCPL_NORMAL = 0; + PRDCPL_EXTENDED = 1; +} + +enum prp_duplex_mode { + PRDM_TDD = 0; + PRDM_FDD = 1; +} + +enum prp_qam { + PREQ_MOD_16QAM = 0; + PREQ_MOD_64QAM = 1; +} + +// +// UE config related structures and enums +// + +message prp_drx_config { + optional uint32 on_duration_timer = 1; // Timer in SF. See TS 36.321 + optional uint32 drx_inactivity_timer = 2; // Timer in SF. See TS 36.321 + optional uint32 drx_retransmission_timer = 3; // Timer in SF. See TS 36.321 + optional uint32 long_drx_cycle = 4; // In SF. See TS 36.321 + optional uint32 long_drx_cycle_start_offset = 5;// See TS 36.321 + optional uint32 short_drx_cycle = 6; // In SF + optional uint32 drx_short_cycle_timer = 7; // Timer in subframes. See TS 36.321 +} + +message prp_sps_config { + optional uint32 semi_persistent_sched_interval_UL = 1; // SPS UL scheduling interval in SF + optional uint32 semi_persistent_sched_interval_DL = 2; // SPS DL scheduling interval in SF + optional uint32 num_of_conf_sps_proc = 3; // Number of SPS HARQ processes. See TS 36.321 + repeated uint32 n1_PUCCH_AN_persistent_element = 4;// See TS36.213. Ignored when config is used + // as part of PRPT_SET_UE_CONFIG + optional uint32 implicit_release_after = 5; // number of empty transmissions before release of SPS +} + +message prp_sr_config { + optional uint32 sr_action = 1; // Indicates if SR config should be changed or released + // One of the PRSRA_* enum values + optional uint32 sched_interval = 2; // SR scheduling interval in SF + optional uint32 dsr_trans_max = 3; // See TS 36.213 +} + +message prp_cqi_config { + optional uint32 cqi_action = 1; // Indicats if CQI changed or released. + // One of the PRSRA_* enum values + optional uint32 cqi_sched_interval = 2; // CQI scheduling interval in SF + optional uint32 ri_sched_interval = 3; // RI scheduling interval in SF +} + +message prp_ue_capabilities { + optional uint32 half_duplex = 1; // Boolean value. Only half duplex support. FDD operation + optional uint32 intra_SF_hopping = 2; // Support for intra-subframe hopping. Boolean value + optional uint32 type2_sb_1 = 3; // Support for type 2 hopping with n_sb > 1 + optional uint32 ue_category = 4; + optional uint32 res_alloc_type1 = 5; // Boolean value. UE support for resource allocation type 1 +} + +message prp_scell_config { + optional uint32 carrier_index = 1; // Id of the carrier component + optional uint32 scell_index = 2; // Index of this Scell (RRC SCellIndex) + optional uint32 use_ccs = 3; // Boolean value. Indicates if cross-carrier scheduling + // is used by this SCell + optional uint32 sched_cell_index = 4; // Index of the cell responsible for scheduling + // this SCell if cross-carrier scheduling is enabled + optional uint32 pdsch_start = 5; // Starting OFDM symbol of PDSCH data region for this SCell +} + +enum prp_meas_gap_config_pattern { + PRMGCP_GP1 = 0; + PRMGCP_GP2 = 1; + PRMGCP_OFF = 2; +} + +enum prp_setup_release_action { + PRSRA_SETUP = 0; + PRSRA_RELEASE = 1; +} + +enum prp_ue_transmission_antenna { + PRUTA_NONE = 0; + PRUTA_OPEN_LOOP = 1; + PRUTA_CLOSED_LOOP = 2; +} + +enum prp_aperiodic_cqi_report_mode { + PRACRM_RM12 = 0; + PRACRM_RM20 = 1; + PRACRM_RM22 = 2; + PRACRM_RM30 = 3; + PRACRM_RM31 = 4; + PRACRM_NONE = 5; +} + +enum prp_tdd_ack_nack_feedback_mode { + PRTANFM_BUNDLING = 0; + PRTANFM_MULTIPLEXING = 1; +} + +// +// Logical channel config related structures and enums +// + +message prp_lc_config { + optional uint32 lcid = 1; // The logical channel id + optional uint32 lcg = 2; // The logical channel group (0..3) the LC is mapped to + optional uint32 direction = 3; // The LC direction. One of the PRLCD_* enum values + optional uint32 qos_bearer_type = 4;// GBR or NGBR bearer. One of the PRQBT_* enum values + optional uint32 qci = 5; // The QCI defined in TS 23.203, coded as defined in TS 36.413 + // One less than the actual QCI value + optional uint64 e_RAB_max_bitrate_UL = 6; // In bps (GBR only) + optional uint64 e_RAB_max_bitrate_DL = 7; // In bps (GBR only) + optional uint64 e_RAB_guaranteed_bitrate_UL = 8; // In bps (GBR only) + optional uint64 e_RAB_guranteed_bitrate_DL = 9; // In bps (GBR only) +} + +enum prp_lc_direction { + PRLCD_UL = 0; + PRLCD_DL = 1; + PRLCD_BOTH = 2; +} + +enum prp_qos_bearer_type { + PRQBT_NON_GBR = 0; + PRQBT_GBR = 1; +} + diff --git a/openair2/ENB_APP/MESSAGES/V2/config_messages.proto b/openair2/ENB_APP/MESSAGES/V2/config_messages.proto new file mode 100644 index 0000000000..4e1151a7e8 --- /dev/null +++ b/openair2/ENB_APP/MESSAGES/V2/config_messages.proto @@ -0,0 +1,88 @@ +//'syntax = "proto2";' +package protocol; + +import "config_common.proto"; + +message prp_cell_config { + optional uint32 phy_cell_id = 1; // The PCI of this cell + optional uint32 cell_id = 2; // The PLMN cell id of this cell + optional uint32 pusch_hopping_offset = 3; // PUSCH resources in RBs for hopping + optional uint32 hopping_mode = 4; // One of the PRHM_* enum values + optional uint32 n_sb = 5; // The number of subbands + optional uint32 phich_resource = 6; // The number of REGs used for PHICH + // One of the PRPR_* enum values + optional uint32 phich_duration = 7; // One of the PRPD_* enum values + optional uint32 init_nr_PDCCH_OFDM_sym = 8; // See TS 36.211, section 6.9 + optional prp_si_config si_config = 9; // The SI configuration + optional uint32 dl_bandwidth = 10; // The DL transmission bandwidth in RBs + optional uint32 ul_bandwidth = 11; // The UL transmission bandwidth in RBs + optional uint32 ul_cyclic_prefix_length = 13; // One of the PRUCPL_* enum values + optional uint32 dl_cyclic_prefix_length = 14; // One of the PRDCPL_* enum values + optional uint32 antenna_ports_count = 15; // Number of cell specific antenna ports + optional uint32 duplex_mode = 16; // One of the PRDM_* enum values + optional uint32 subframe_assignment = 17; // DL/UL subframe assignment. TDD only + optional uint32 special_subframe_patterns = 18; // TDD only. See TS 36.211, table 4.2.1 + repeated uint32 mbsfn_subframe_config_rfperiod = 19; // The MBSFN radio frame period (Optional) + repeated uint32 mbsfn_subframe_config_rfoffset = 20; // The radio frame offset (Optional) + repeated uint32 mbsfn_subframe_config_sfalloc = 21; // Bitmap indicating the MBSFN subframes (Optional) + optional uint32 prach_config_index = 22; // See TS 36.211, section 5.7.1 + optional uint32 prach_freq_offset = 23; // See TS 36.211, section 5.7.1 + optional uint32 ra_response_window_size = 24; // The duration of the RA response window in SF + optional uint32 mac_contention_resolution_timer = 25; // Timer for RA + optional uint32 max_HARQ_Msg3Tx = 26; // See TS 36.321 + optional uint32 n1PUCCH_AN = 27; // See TS 36.213, section 10.1 + optional uint32 deltaPUCCH_shift = 28; // See TS 36.211, section 5.4 + optional uint32 nRB_cqi = 29; // See TS 36.211, section 5.4 + optional uint32 srs_subframe_config = 30; // See TS 36.211, table 5.5.3.3-1 and 2 + optional uint32 srs_bw_config = 31; // See TS 36.211, section 5.5.3.2 + optional uint32 srs_mac_up_pts = 32; // Boolean value. See TS 36.211, section 5.5.3.2. TDD only + optional uint32 enable_64QAM = 33; // One of the PREQ_* enum values + optional uint32 carrier_index = 34; // Carrier component index +} + +message prp_ue_config { + optional uint32 rnti = 1; + optional prp_drx_config drx_config = 2; // The DRX configuration (Optional) + optional uint32 time_alignment_timer = 3; // Timer in SF. Control the synchronization + // status of the UE, not the actual advance procedure + // See TS 36.321 + optional uint32 meas_gap_config_pattern = 4; // Measurement gap configuration. + // One of the PRMGCP_* enum values + // See TS 36.133 + optional uint32 meas_gap_config_sf_offset = 5; // Measurement gap offset if applicable + optional prp_sps_config sps_config = 6; // The SPS configuration (Optional) + optional prp_sr_config sr_config = 7; // The SR configuration (Optional) + optional prp_cqi_config cqi_config = 8; // The CQI configuration (Optional) + optional uint32 transmission_mode = 9; // The UE transmission mode + optional uint64 ue_aggregated_max_bitrate_UL = 10; // Aggregated bit-rate of non-gbr bearer + // per UE. See TS 36.413 + optional uint64 ue_aggregated_max_bitrate_DL = 11; // Aggregated bit-rate of non-gbr bearer + // per UE. See TS 36.413 + optional prp_ue_capabilities capabilities = 12; + optional uint32 ue_transmission_antenna = 13; // One of the PRUTA_* enum values + optional uint32 tti_bundling = 14; // Boolean value. See TS 36.321 + optional uint32 max_HARQ_tx = 15; // The max HARQ retransmission for UL + optional uint32 beta_offset_ACK_index = 16; // See TS 36.213 + optional uint32 beta_offset_RI_index = 17; // See TS 36.213 + optional uint32 beta_offset_CQI_index = 18; // See TS 36.213 + optional uint32 ack_nack_simultaneous_trans = 19;// Boolean. See TS 36.213 + optional uint32 simultaneous_ack_nack_cqi = 20; // Boolean. See TS 36.213 + optional uint32 aperiodic_cqi_rep_mode = 21; // One of the PRACRM_* enum values + optional uint32 tdd_ack_nack_feedback = 22; // One of the PRTANFM_* enum values + optional uint32 ack_nack_repetition_factor = 23;// See TS 36.213, section 10.1 + optional uint32 extended_bsr_size = 24; // Boolean for extended BSR size + optional uint32 ca_support = 25; // Boolean. Support for carrier aggregation + optional uint32 cross_carrier_sched_support = 26; // Boolean value + optional uint32 pcell_carrier_index = 27; // Index of primary cell + repeated prp_scell_config scell_config = 28; // Secondary cells configuration + optional uint32 scell_deactivation_timer = 29;// Deactivation timer for secondary cell +} + +message prp_lc_ue_config { + optional uint32 rnti = 1; + repeated prp_lc_config lc_config = 2; // A list of LC configurations for the given UE +} + + + + diff --git a/openair2/ENB_APP/MESSAGES/V2/header.proto b/openair2/ENB_APP/MESSAGES/V2/header.proto index 10a18ddcef..be0341f132 100644 --- a/openair2/ENB_APP/MESSAGES/V2/header.proto +++ b/openair2/ENB_APP/MESSAGES/V2/header.proto @@ -19,10 +19,18 @@ enum prp_type { // Time indication messages PRPT_SF_TRIGGER = 5; - //Asynchronous messages + // Asynchronous messages PRPT_UL_SR_INFO = 6; + // eNB configuration messages + PRPT_GET_ENB_CONFIG_REQUEST = 7; + PRPT_GET_ENB_CONFIG_REPLY = 8; + PRPT_GET_UE_CONFIG_REQUEST = 9; + PRPT_GET_UE_CONFIG_REPLY = 10; + PRPT_GET_LC_CONFIG_REQUEST = 11; + PRPT_GET_LC_CONFIG_REPLY = 12; + //Controller command messages - PRPT_DL_MAC_CONFIG = 7; + PRPT_DL_MAC_CONFIG = 13; } diff --git a/openair2/ENB_APP/MESSAGES/V2/progran.proto b/openair2/ENB_APP/MESSAGES/V2/progran.proto index 5d0ec15518..f1178c0f57 100644 --- a/openair2/ENB_APP/MESSAGES/V2/progran.proto +++ b/openair2/ENB_APP/MESSAGES/V2/progran.proto @@ -4,6 +4,7 @@ package protocol; import "stats_messages.proto"; import "header.proto"; import "time_common.proto"; +import "config_messages.proto"; import "controller_commands.proto"; message progran_message { @@ -16,7 +17,13 @@ message progran_message { prp_stats_reply stats_reply_msg = 5; prp_sf_trigger sf_trigger_msg = 6; prp_ul_sr_info ul_sr_info_msg = 7; - prp_dl_mac_config dl_mac_config_msg = 8; + prp_enb_config_request enb_config_request = 8; + prp_enb_config_reply enb_config_reply = 9; + prp_ue_config_request ue_config_request = 10; + prp_ue_config_reply ue_config_reply = 11; + prp_lc_config_request lc_config_request = 12; + prp_lc_config_reply lc_config_reply = 13; + prp_dl_mac_config dl_mac_config_msg = 14; } } @@ -108,6 +115,37 @@ message prp_ul_sr_info { repeated uint32 rnti = 3; } +// +// eNB configuration messages +// +message prp_enb_config_request { + optional prp_header header = 1; +} + +message prp_enb_config_reply { + optional prp_header header = 1; + optional uint32 eNB_id = 2; // Unique id to distinguish the eNB + repeated prp_cell_config cell_config = 3; +} + +message prp_ue_config_request { + optional prp_header header = 1; +} + +message prp_ue_config_reply { + optional prp_header header = 1; + repeated prp_ue_config ue_config = 2; +} + +message prp_lc_config_request { + optional prp_header header = 1; +} + +message prp_lc_config_reply { + optional prp_header header = 1; + repeated prp_lc_ue_config lc_ue_config = 2; +} + // // Controller command messages // From ff72fbc6bcaf916eb177e0ef40cb3630bdbbfc8e Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Tue, 9 Feb 2016 13:33:48 +0000 Subject: [PATCH 092/349] Integrated progRAN config messages to OAI agent and created stubs for handler and destructor functions --- openair2/ENB_APP/MESSAGES/V2/progran.proto | 12 +++--- openair2/ENB_APP/enb_agent_common.c | 45 ++++++++++++++++++++++ openair2/ENB_APP/enb_agent_common.h | 15 ++++++++ openair2/ENB_APP/enb_agent_handler.c | 16 +++++++- 4 files changed, 80 insertions(+), 8 deletions(-) diff --git a/openair2/ENB_APP/MESSAGES/V2/progran.proto b/openair2/ENB_APP/MESSAGES/V2/progran.proto index f1178c0f57..2bcf9bbc95 100644 --- a/openair2/ENB_APP/MESSAGES/V2/progran.proto +++ b/openair2/ENB_APP/MESSAGES/V2/progran.proto @@ -17,12 +17,12 @@ message progran_message { prp_stats_reply stats_reply_msg = 5; prp_sf_trigger sf_trigger_msg = 6; prp_ul_sr_info ul_sr_info_msg = 7; - prp_enb_config_request enb_config_request = 8; - prp_enb_config_reply enb_config_reply = 9; - prp_ue_config_request ue_config_request = 10; - prp_ue_config_reply ue_config_reply = 11; - prp_lc_config_request lc_config_request = 12; - prp_lc_config_reply lc_config_reply = 13; + prp_enb_config_request enb_config_request_msg = 8; + prp_enb_config_reply enb_config_reply_msg = 9; + prp_ue_config_request ue_config_request_msg = 10; + prp_ue_config_reply ue_config_reply_msg = 11; + prp_lc_config_request lc_config_request_msg = 12; + prp_lc_config_reply lc_config_reply_msg = 13; prp_dl_mac_config dl_mac_config_msg = 14; } } diff --git a/openair2/ENB_APP/enb_agent_common.c b/openair2/ENB_APP/enb_agent_common.c index ab9546036f..7c820bfa5c 100644 --- a/openair2/ENB_APP/enb_agent_common.c +++ b/openair2/ENB_APP/enb_agent_common.c @@ -261,6 +261,51 @@ int enb_agent_destroy_echo_reply(Protocol__ProgranMessage *msg) { return -1; } +int enb_agent_enb_config_reply(mid_t mod_id, const void *params, Protocol__ProgranMessage **msg) { + /* TODO: Create a reply progRAN message with the current eNB configuration */ + return 0; +} + +int enb_agent_destroy_enb_config_reply(Protocol__ProgranMessage *msg) { + /* TODO: Deallocate memory for a dynamically allocated eNB config message */ + return 0; +} + +int enb_agent_ue_config_reply(mid_t mod_id, const void *params, Protocol__ProgranMessage **msg) { + /* TODO: Create a reply progRAN message with the current UE configurations */ + return 0; +} + +int enb_agent_destroy_ue_config_reply(Protocol__ProgranMessage *msg) { + /*TODO: Deallocate memory for a dynamically allocated UE config message */ + return 0; +} + +int enb_agent_lc_config_reply(mid_t mod_id, const void *params, Protocol__ProgranMessage **msg) { + /* TODO: Create a reply progRAN message with the current LC configurations */ + return 0; +} + +int enb_agent_destroy_lc_config_reply(Protocol__ProgranMessage *msg) { + /* TODO: Deallocate memory for a dynamically allocated LC config message */ + return 0; +} + +int enb_agent_destroy_enb_config_request(Protocol__ProgranMessage *msg) { + /* TODO: Deallocate memory for a dynamically allocated eNB config message */ + return 0; +} + +int enb_agent_destroy_ue_config_request(Protocol__ProgranMessage *msg) { + /* TODO: Deallocate memory for a dynamically allocated UE config message */ + return 0; +} + +int enb_agent_destroy_lc_config_request(Protocol__ProgranMessage *msg) { + /* TODO: Deallocate memory for a dynamically allocated LC config message */ + return 0; +} + /* * get generic info from RAN */ diff --git a/openair2/ENB_APP/enb_agent_common.h b/openair2/ENB_APP/enb_agent_common.h index 4762637b66..afa2179ff4 100644 --- a/openair2/ENB_APP/enb_agent_common.h +++ b/openair2/ENB_APP/enb_agent_common.h @@ -91,6 +91,21 @@ int enb_agent_destroy_echo_request(Protocol__ProgranMessage *msg); int enb_agent_echo_reply(mid_t mod_id, const void *params, Protocol__ProgranMessage **msg); int enb_agent_destroy_echo_reply(Protocol__ProgranMessage *msg); +int enb_agent_enb_config_reply(mid_t mod_id, const void *params, Protocol__ProgranMessage **msg); +int enb_agent_destroy_enb_config_reply(Protocol__ProgranMessage *msg); + +int enb_agent_ue_config_reply(mid_t mod_id, const void *params, Protocol__ProgranMessage **msg); +int enb_agent_destroy_ue_config_reply(Protocol__ProgranMessage *msg); + +int enb_agent_lc_config_reply(mid_t mod_id, const void *params, Protocol__ProgranMessage **msg); +int enb_agent_destroy_lc_config_reply(Protocol__ProgranMessage *msg); + +int enb_agent_destroy_enb_config_request(Protocol__ProgranMessage *msg); + +int enb_agent_destroy_ue_config_request(Protocol__ProgranMessage *msg); + +int enb_agent_destroy_lc_config_request(Protocol__ProgranMessage *msg); + Protocol__ProgranMessage* enb_agent_handle_message (mid_t mod_id, uint8_t *data, diff --git a/openair2/ENB_APP/enb_agent_handler.c b/openair2/ENB_APP/enb_agent_handler.c index 4894683723..9815732088 100644 --- a/openair2/ENB_APP/enb_agent_handler.c +++ b/openair2/ENB_APP/enb_agent_handler.c @@ -48,8 +48,14 @@ enb_agent_message_decoded_callback agent_messages_callback[][3] = { {enb_agent_mac_handle_stats, 0, 0}, /*PROTOCOL__PROGRAN_MESSAGE__MSG_STATS_REQUEST_MSG*/ {0, 0, 0}, /*PROTOCOL__PROGRAN_MESSAGE__MSG_STATS_REPLY_MSG*/ {0, 0, 0}, /*PROTOCOK__PROGRAN_MESSAGE__MSG_SF_TRIGGER_MSG*/ - {0, 0, 0}, /*SR_INFO*/ - {0, 0, 0}, /*DL_MAC_CONFIG*/ + {0, 0, 0}, /*PROTOCOL__PROGRAN_MESSAGE__MSG_UL_SR_INFO_MSG*/ + {enb_agent_enb_config_reply, 0, 0}, /*PROTOCOL__PROGRAN_MESSAGE__MSG_ENB_CONFIG_REQUEST_MSG*/ + {0, 0, 0}, /*PROTOCOL__PROGRAN_MESSAGE__MSG_ENB_CONFIG_REPLY_MSG*/ + {enb_agent_ue_config_reply, 0, 0}, /*PROTOCOL__PROGRAN_MESSAGE__MSG_UE_CONFIG_REQUEST_MSG*/ + {0, 0, 0}, /*PROTOCOL__PROGRAN_MESSAGE__MSG_UE_CONFIG_REPLY_MSG*/ + {enb_agent_lc_config_reply, 0, 0}, /*PROTOCOL__PROGRAN_MESSAGE__MSG_LC_CONFIG_REQUEST_MSG*/ + {0, 0, 0}, /*PROTOCOL__PROGRAN_MESSAGE__MSG_LC_CONFIG_REPLY_MSG*/ + {0, 0, 0}, /*PROTOCOL__PROGRAN_MESSAGE__MSG_DL_MAC_CONFIG_MSG*/ }; @@ -61,6 +67,12 @@ enb_agent_message_destruction_callback message_destruction_callback[] = { enb_agent_mac_destroy_stats_reply, enb_agent_mac_destroy_sf_trigger, enb_agent_mac_destroy_sr_info, + enb_agent_destroy_enb_config_request, + enb_agent_destroy_enb_config_reply, + enb_agent_destroy_ue_config_request, + enb_agent_destroy_ue_config_reply, + enb_agent_destroy_lc_config_request, + enb_agent_destroy_lc_config_reply, enb_agent_mac_destroy_dl_config, }; From 8aff18aed5b23c2500c3a5c7cd346cf2a06de131 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Tue, 9 Feb 2016 17:53:49 +0000 Subject: [PATCH 093/349] Fixed bug with toggling the NDI for DL HARQ retransmissions --- openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c b/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c index dd0a9942ac..4d353232a8 100644 --- a/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c +++ b/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c @@ -320,6 +320,7 @@ schedule_ue_spec_default( rballoc_sub[i] = UE_list->UE_template[CC_id][UE_id].rballoc_subband[harq_pid][i]; } + // Keep the old NDI, do not toggle ndi = UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]; tpc = 1; @@ -562,13 +563,12 @@ schedule_ue_spec_default( rballoc_sub[i] = UE_list->UE_template[CC_id][UE_id].rballoc_subband[harq_pid][i]; } - ndi = 1 - UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]; - - // Toggle NDI for next time + // Toggle NDI LOG_D(MAC,"CC_id %d Frame %d, subframeP %d: Toggling Format1 NDI for UE %d (rnti %x/%d) oldNDI %d\n", CC_id, frame, subframe, UE_id, UE_list->UE_template[CC_id][UE_id].rnti,harq_pid, UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]); - UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]=1-UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]; + UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]= 1 - UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]; + ndi = UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]; // Increase the pointer for the number of scheduled UEs num_ues_added++; From a663654418f6c39fac29af7492d2251ef33c280b Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Wed, 10 Feb 2016 13:41:56 +0000 Subject: [PATCH 094/349] Patch to get tx_queue size from RLC for the LCs of a UE --- openair2/ENB_APP/enb_agent_common.c | 7 +++++++ openair2/ENB_APP/enb_agent_common.h | 2 +- openair2/ENB_APP/enb_agent_mac.c | 8 ++++---- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/openair2/ENB_APP/enb_agent_common.c b/openair2/ENB_APP/enb_agent_common.c index 7c820bfa5c..5ddcb39868 100644 --- a/openair2/ENB_APP/enb_agent_common.c +++ b/openair2/ENB_APP/enb_agent_common.c @@ -393,6 +393,13 @@ int get_ue_wcqi (mid_t mod_id, mid_t ue_id) { return ((UE_list_t *)enb_ue[mod_id])->eNB_UE_stats[UE_PCCID(mod_id,ue_id)][ue_id].dl_cqi; } +int get_tx_queue_size(mid_t mod_id, mid_t ue_id, logical_chan_id_t channel_id) +{ + rnti_t rnti = get_ue_crnti(mod_id,ue_id); + uint16_t frame = (uint16_t) get_current_frame(mod_id); + mac_rlc_status_resp_t rlc_status = mac_rlc_status_ind(mod_id,rnti, mod_id,frame,ENB_FLAG_YES,MBMS_FLAG_NO,channel_id,0); + return rlc_status.bytes_in_buffer; +} /* * timer primitives */ diff --git a/openair2/ENB_APP/enb_agent_common.h b/openair2/ENB_APP/enb_agent_common.h index afa2179ff4..784c86bf6a 100644 --- a/openair2/ENB_APP/enb_agent_common.h +++ b/openair2/ENB_APP/enb_agent_common.h @@ -148,7 +148,7 @@ int get_ue_phr (mid_t mod_id, mid_t ue_id); int get_ue_wcqi (mid_t mod_id, mid_t ue_id); - +int get_tx_queue_size(mid_t mod_id, mid_t ue_id, logical_chan_id_t channel_id); diff --git a/openair2/ENB_APP/enb_agent_mac.c b/openair2/ENB_APP/enb_agent_mac.c index df614df60c..4a62c9dcbb 100644 --- a/openair2/ENB_APP/enb_agent_mac.c +++ b/openair2/ENB_APP/enb_agent_mac.c @@ -413,9 +413,9 @@ int enb_agent_mac_stats_reply(mid_t mod_id, /* Check flag for creation of RLC buffer status report */ if (report_config->ue_report_type[i].ue_report_flags & PROTOCOL__PRP_UE_STATS_TYPE__PRUST_RLC_BS) { // TODO: Fill in the actual RLC buffer status reports - ue_report[i]->n_rlc_report = 1; // Set this to the number of LCs for this UE + ue_report[i]->n_rlc_report = 3; // Set this to the number of LCs for this UE Protocol__PrpRlcBsr ** rlc_reports; - rlc_reports = malloc(sizeof(Protocol__PrpRlcBsr) * ue_report[i]->n_rlc_report); + rlc_reports = malloc(sizeof(Protocol__PrpRlcBsr *) * ue_report[i]->n_rlc_report); if (rlc_reports == NULL) goto error; @@ -427,10 +427,10 @@ int enb_agent_mac_stats_reply(mid_t mod_id, goto error; protocol__prp_rlc_bsr__init(rlc_reports[j]); //TODO:Set logical channel id - rlc_reports[j]->lc_id = 1; + rlc_reports[j]->lc_id = j+1; rlc_reports[j]->has_lc_id = 1; //TODO:Set tx queue size in bytes - rlc_reports[j]->tx_queue_size = 10; + rlc_reports[j]->tx_queue_size = get_tx_queue_size(enb_id,i,j+1); rlc_reports[j]->has_tx_queue_size = 1; //TODO:Set tx queue head of line delay in ms rlc_reports[j]->tx_queue_hol_delay = 100; From b64cb5b2501c8ee09c8417d66a935ca8b16722ca Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Wed, 10 Feb 2016 18:07:35 +0000 Subject: [PATCH 095/349] Added rank indication and timing advance indication support --- openair2/ENB_APP/enb_agent_common.c | 25 ++++ openair2/ENB_APP/enb_agent_common.h | 5 + openair2/ENB_APP/enb_agent_mac.c | 194 ++++++++++++++++------------ 3 files changed, 140 insertions(+), 84 deletions(-) diff --git a/openair2/ENB_APP/enb_agent_common.c b/openair2/ENB_APP/enb_agent_common.c index 5ddcb39868..eb08107dff 100644 --- a/openair2/ENB_APP/enb_agent_common.c +++ b/openair2/ENB_APP/enb_agent_common.c @@ -400,6 +400,31 @@ int get_tx_queue_size(mid_t mod_id, mid_t ue_id, logical_chan_id_t channel_id) mac_rlc_status_resp_t rlc_status = mac_rlc_status_ind(mod_id,rnti, mod_id,frame,ENB_FLAG_YES,MBMS_FLAG_NO,channel_id,0); return rlc_status.bytes_in_buffer; } + +int get_MAC_CE_bitmap_TA(mid_t mod_id, mid_t ue_id) +{ + if((((UE_list_t *)enb_ue[mod_id])->UE_sched_ctrl[ue_id].ta_update) > 0) + return 1; + else + return 0; +} + +int get_active_CC(mid_t mod_id, mid_t ue_id) +{ + return ((UE_list_t *)enb_ue[mod_id])->numactiveCCs[ue_id]; +} + +int get_current_RI(mid_t mod_id, mid_t ue_id, int CC_id) +{ + LTE_eNB_UE_stats *eNB_UE_stats = NULL; + + int pCCid = UE_PCCID(mod_id,ue_id); + rnti_t rnti = get_ue_crnti(mod_id,ue_id); + + eNB_UE_stats = mac_xface->get_eNB_UE_stats(mod_id,CC_id,rnti); + return eNB_UE_stats[CC_id].rank; +} + /* * timer primitives */ diff --git a/openair2/ENB_APP/enb_agent_common.h b/openair2/ENB_APP/enb_agent_common.h index 784c86bf6a..37d3829354 100644 --- a/openair2/ENB_APP/enb_agent_common.h +++ b/openair2/ENB_APP/enb_agent_common.h @@ -150,6 +150,11 @@ int get_ue_wcqi (mid_t mod_id, mid_t ue_id); int get_tx_queue_size(mid_t mod_id, mid_t ue_id, logical_chan_id_t channel_id); +int get_MAC_CE_bitmap_TA(mid_t mod_id, mid_t ue_id); + +int get_active_CC(mid_t mod_id, mid_t ue_id); + +int get_current_RI(mid_t mod_id, mid_t ue_id, int CC_id); diff --git a/openair2/ENB_APP/enb_agent_mac.c b/openair2/ENB_APP/enb_agent_mac.c index 4a62c9dcbb..cb5aac1a95 100644 --- a/openair2/ENB_APP/enb_agent_mac.c +++ b/openair2/ENB_APP/enb_agent_mac.c @@ -52,25 +52,25 @@ unsigned int mac_agent_registered[NUM_MAX_ENB]; AGENT_MAC_xface *agent_mac_xface[NUM_MAX_ENB]; int enb_agent_mac_handle_stats(mid_t mod_id, const void *params, Protocol__ProgranMessage **msg){ - + // TODO: Must deal with sanitization of input // TODO: Must check if RNTIs and cell ids of the request actually exist // TODO: Must resolve conflicts among stats requests - + int i; void *buffer; int size; err_code_t err_code; xid_t xid; uint32_t usec_interval, sec_interval; - - //TODO: We do not deal with multiple CCs at the moment and eNB id is 0 + + //TODO: We do not deal with multiple CCs at the moment and eNB id is 0 int cc_id = 0; int enb_id = mod_id; //eNB_MAC_INST *eNB = &eNB_mac_inst[enb_id]; //UE_list_t *eNB_UE_list= &eNB->UE_list; - + report_config_t report_config; uint32_t ue_flags = 0; @@ -96,7 +96,7 @@ int enb_agent_mac_handle_stats(mid_t mod_id, const void *params, Protocol__Progr ue_flags = comp_req->ue_report_flags; c_flags = comp_req->cell_report_flags; //Create a list of all eNB RNTIs and cells - + //Set the number of UEs and create list with their RNTIs stats configs report_config.nr_ue = get_num_ues(mod_id); //eNB_UE_list->num_UEs report_config.ue_report_type = (ue_report_type_t *) malloc(sizeof(ue_report_type_t) * report_config.nr_ue); @@ -129,7 +129,7 @@ int enb_agent_mac_handle_stats(mid_t mod_id, const void *params, Protocol__Progr stats_request_config_t request_config; request_config.report_type = PROTOCOL__PRP_STATS_TYPE__PRST_COMPLETE_STATS; request_config.report_frequency = PROTOCOL__PRP_STATS_REPORT_FREQ__PRSRF_ONCE; - request_config.period = 0; + request_config.period = 0; request_config.config = &report_config; enb_agent_mac_stats_request(enb_id, xid, &request_config, &timer_msg); /* Create a timer */ @@ -137,7 +137,7 @@ int enb_agent_mac_handle_stats(mid_t mod_id, const void *params, Protocol__Progr enb_agent_timer_args_t *timer_args; timer_args = malloc(sizeof(enb_agent_timer_args_t)); memset (timer_args, 0, sizeof(enb_agent_timer_args_t)); - timer_args->mod_id = enb_id; + timer_args->mod_id = enb_id; timer_args->msg = timer_msg; /*Convert subframes to usec time*/ usec_interval = 1000*comp_req->sf; @@ -155,7 +155,7 @@ int enb_agent_mac_handle_stats(mid_t mod_id, const void *params, Protocol__Progr stats_request_config_t request_config; request_config.report_type = PROTOCOL__PRP_STATS_TYPE__PRST_COMPLETE_STATS; request_config.report_frequency = PROTOCOL__PRP_STATS_REPORT_FREQ__PRSRF_ONCE; - request_config.period = 0; + request_config.period = 0; request_config.config = &report_config; enb_agent_enable_cont_mac_stats_update(enb_id, xid, &request_config); } @@ -219,14 +219,14 @@ int enb_agent_mac_handle_stats(mid_t mod_id, const void *params, Protocol__Progr int enb_agent_mac_stats_request(mid_t mod_id, xid_t xid, - const stats_request_config_t *report_config, + const stats_request_config_t *report_config, Protocol__ProgranMessage **msg) { Protocol__PrpHeader *header; int i; - + if (prp_create_header(xid, PROTOCOL__PRP_TYPE__PRPT_STATS_REQUEST, &header) != 0) goto error; - + Protocol__PrpStatsRequest *stats_request_msg; stats_request_msg = malloc(sizeof(Protocol__PrpStatsRequest)); if(stats_request_msg == NULL) @@ -234,10 +234,10 @@ int enb_agent_mac_stats_request(mid_t mod_id, protocol__prp_stats_request__init(stats_request_msg); stats_request_msg->header = header; - + stats_request_msg->type = report_config->report_type; stats_request_msg->has_type = 1; - + switch (report_config->report_type) { case PROTOCOL__PRP_STATS_TYPE__PRST_COMPLETE_STATS: stats_request_msg->body_case = PROTOCOL__PRP_STATS_REQUEST__BODY_COMPLETE_STATS_REQUEST; @@ -311,7 +311,7 @@ int enb_agent_mac_stats_request(mid_t mod_id, (*msg)->msg_dir = PROTOCOL__PROGRAN_DIRECTION__INITIATING_MESSAGE; (*msg)->stats_request_msg = stats_request_msg; return 0; - + error: // TODO: Need to make proper error handling if (header != NULL) @@ -337,7 +337,7 @@ int enb_agent_mac_destroy_stats_request(Protocol__ProgranMessage *msg) { free(msg->stats_request_msg); free(msg); return 0; - + error: //LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); return -1; @@ -345,7 +345,7 @@ int enb_agent_mac_destroy_stats_request(Protocol__ProgranMessage *msg) { int enb_agent_mac_stats_reply(mid_t mod_id, xid_t xid, - const report_config_t *report_config, + const report_config_t *report_config, Protocol__ProgranMessage **msg) { Protocol__PrpHeader *header; int i, j, k; @@ -353,8 +353,8 @@ int enb_agent_mac_stats_reply(mid_t mod_id, int enb_id = mod_id; //eNB_MAC_INST *eNB = &eNB_mac_inst[enb_id]; //UE_list_t *eNB_UE_list= &eNB->UE_list; - - + + if (prp_create_header(xid, PROTOCOL__PRP_TYPE__PRPT_STATS_REPLY, &header) != 0) goto error; @@ -371,7 +371,7 @@ int enb_agent_mac_stats_reply(mid_t mod_id, Protocol__PrpUeStatsReport **ue_report; Protocol__PrpCellStatsReport **cell_report; - + /* Allocate memory for list of UE reports */ if (report_config->nr_ue > 0) { ue_report = malloc(sizeof(Protocol__PrpUeStatsReport *) * report_config->nr_ue); @@ -402,7 +402,7 @@ int enb_agent_mac_stats_reply(mid_t mod_id, } ue_report[i]->bsr = elem; } - + /* Check flag for creation of PRH report */ if (report_config->ue_report_type[i].ue_report_flags & PROTOCOL__PRP_UE_STATS_TYPE__PRUST_PRH) { // TODO: Fill in the actual power headroom value for the RNTI @@ -418,7 +418,7 @@ int enb_agent_mac_stats_reply(mid_t mod_id, rlc_reports = malloc(sizeof(Protocol__PrpRlcBsr *) * ue_report[i]->n_rlc_report); if (rlc_reports == NULL) goto error; - + // Fill the buffer status report for each logical channel of the UE // NN: see LAYER2/openair2_proc.c for rlc status for (j = 0; j < ue_report[i]->n_rlc_report; j++) { @@ -453,13 +453,13 @@ int enb_agent_mac_stats_reply(mid_t mod_id, /* Check flag for creation of MAC CE buffer status report */ if (report_config->ue_report_type[i].ue_report_flags & PROTOCOL__PRP_UE_STATS_TYPE__PRUST_MAC_CE_BS) { // TODO: Fill in the actual MAC CE buffer status report - ue_report[i]->pending_mac_ces = -1; /* Use as bitmap. Set one or more of the + ue_report[i]->pending_mac_ces = (get_MAC_CE_bitmap_TA(enb_id,i) | (0 << 1) | (0 << 2) | (0 << 3)) & 15; /* Use as bitmap. Set one or more of the; /* Use as bitmap. Set one or more of the PROTOCOL__PRP_CE_TYPE__PRPCET_ values found in stats_common.pb-c.h. See prp_ce_type in progRAN specification */ ue_report[i]->has_pending_mac_ces = 1; } - + /* Check flag for creation of DL CQI report */ if (report_config->ue_report_type[i].ue_report_flags & PROTOCOL__PRP_UE_STATS_TYPE__PRUST_DL_CQI) { // TODO: Fill in the actual DL CQI report for the UE based on its configuration @@ -472,7 +472,7 @@ int enb_agent_mac_stats_reply(mid_t mod_id, dl_report->sfn_sn = get_sfn_sf(enb_id); dl_report->has_sfn_sn = 1; //TODO:Set the number of DL CQI reports for this UE. One for each CC - dl_report->n_csi_report = 1; + dl_report->n_csi_report = get_active_CC(enb_id,i); //TODO:Create the actual CSI reports. Protocol__PrpDlCsi **csi_reports; csi_reports = malloc(sizeof(Protocol__PrpDlCsi *)*dl_report->n_csi_report); @@ -484,36 +484,62 @@ int enb_agent_mac_stats_reply(mid_t mod_id, goto error; protocol__prp_dl_csi__init(csi_reports[j]); //TODO: the servCellIndex for this report - csi_reports[j]->serv_cell_index = 0; + csi_reports[j]->serv_cell_index = j; csi_reports[j]->has_serv_cell_index = 1; //TODO: the rank indicator value for this cc - csi_reports[j]->ri = 1; + csi_reports[j]->ri = get_current_RI(enb_id,i,j); csi_reports[j]->has_ri = 1; //TODO: the type of CSI report based on the configuration of the UE //For this example we use type P10, which only needs a wideband value //The full set of types can be found in stats_common.pb-c.h and //in the progRAN specifications - csi_reports[j]->type = PROTOCOL__PRP_CSI_TYPE__PRCSIT_P10; - csi_reports[j]->has_type = 1; - csi_reports[j]->report_case = PROTOCOL__PRP_DL_CSI__REPORT_P10CSI; - Protocol__PrpCsiP10 *csi10; - csi10 = malloc(sizeof(Protocol__PrpCsiP10)); - if (csi10 == NULL) - goto error; - protocol__prp_csi_p10__init(csi10); - //TODO: set the wideband value - // NN: this is also depends on cc_id - csi10->wb_cqi = get_ue_wcqi (enb_id, i); //eNB_UE_list->eNB_UE_stats[UE_PCCID(enb_id,i)][i].dl_cqi; - csi10->has_wb_cqi = 1; - //Add the type of measurements to the csi report in the proper union type - csi_reports[j]->p10csi = csi10; - } + csi_reports[j]->type = PROTOCOL__PRP_CSI_TYPE__PRCSIT_P10; + csi_reports[j]->has_type = 1; + csi_reports[j]->report_case = PROTOCOL__PRP_DL_CSI__REPORT_P10CSI; + if(csi_reports[j]->report_case == PROTOCOL__PRP_DL_CSI__REPORT_P10CSI){ + Protocol__PrpCsiP10 *csi10; + csi10 = malloc(sizeof(Protocol__PrpCsiP10)); + if (csi10 == NULL) + goto error; + protocol__prp_csi_p10__init(csi10); + //TODO: set the wideband value + // NN: this is also depends on cc_id + csi10->wb_cqi = get_ue_wcqi (enb_id, i); //eNB_UE_list->eNB_UE_stats[UE_PCCID(enb_id,i)][i].dl_cqi; + csi10->has_wb_cqi = 1; + //Add the type of measurements to the csi report in the proper union type + csi_reports[j]->p10csi = csi10; + } + else if(csi_reports[j]->report_case == PROTOCOL__PRP_DL_CSI__REPORT_P11CSI){ + + } + else if(csi_reports[j]->report_case == PROTOCOL__PRP_DL_CSI__REPORT_P20CSI){ + + } + else if(csi_reports[j]->report_case == PROTOCOL__PRP_DL_CSI__REPORT_P21CSI){ + + } + else if(csi_reports[j]->report_case == PROTOCOL__PRP_DL_CSI__REPORT_A12CSI){ + + } + else if(csi_reports[j]->report_case == PROTOCOL__PRP_DL_CSI__REPORT_A22CSI){ + + } + else if(csi_reports[j]->report_case == PROTOCOL__PRP_DL_CSI__REPORT_A20CSI){ + + } + else if(csi_reports[j]->report_case == PROTOCOL__PRP_DL_CSI__REPORT_A30CSI){ + + } + else if(csi_reports[j]->report_case == PROTOCOL__PRP_DL_CSI__REPORT_A31CSI){ + + } + } //Add the csi reports to the full DL CQI report dl_report->csi_report = csi_reports; //Add the DL CQI report to the stats report ue_report[i]->dl_cqi_report = dl_report; } - + /* Check flag for creation of paging buffer status report */ if (report_config->ue_report_type[i].ue_report_flags & PROTOCOL__PRP_UE_STATS_TYPE__PRUST_PBS) { //TODO: Fill in the actual paging buffer status report. For this field to be valid, the RNTI @@ -554,7 +580,7 @@ int enb_agent_mac_stats_reply(mid_t mod_id, //Add the paging report to the UE report ue_report[i]->pbr = paging_report; } - + /* Check flag for creation of UL CQI report */ if (report_config->ue_report_type[i].ue_report_flags & PROTOCOL__PRP_UE_STATS_TYPE__PRUST_UL_CQI) { //Fill in the full UL CQI report of the UE @@ -648,7 +674,7 @@ int enb_agent_mac_stats_reply(mid_t mod_id, /* Add list of all cell reports to the message */ stats_reply_msg->cell_report = cell_report; } - + *msg = malloc(sizeof(Protocol__ProgranMessage)); if(*msg == NULL) goto error; @@ -657,7 +683,7 @@ int enb_agent_mac_stats_reply(mid_t mod_id, (*msg)->msg_dir = PROTOCOL__PROGRAN_DIRECTION__SUCCESSFUL_OUTCOME; (*msg)->stats_reply_msg = stats_reply_msg; return 0; - + error: // TODO: Need to make proper error handling if (header != NULL) @@ -676,7 +702,7 @@ int enb_agent_mac_destroy_stats_reply(Protocol__ProgranMessage *msg) { goto error; free(msg->stats_reply_msg->header); int i, j, k; - + Protocol__PrpStatsReply *reply = msg->stats_reply_msg; Protocol__PrpDlCqiReport *dl_report; Protocol__PrpUlCqiReport *ul_report; @@ -737,8 +763,8 @@ int enb_agent_mac_destroy_stats_reply(Protocol__ProgranMessage *msg) { } free(dl_report->csi_report[j]->a31csi->sb_cqi); break; - } - + } + free(dl_report->csi_report[j]); } free(dl_report->csi_report); @@ -773,11 +799,11 @@ int enb_agent_mac_destroy_stats_reply(Protocol__ProgranMessage *msg) { free(reply->cell_report[i]); } free(reply->cell_report); - + free(reply); free(msg); return 0; - + error: //LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); return -1; @@ -796,7 +822,7 @@ int enb_agent_mac_sr_info(mid_t mod_id, const void *params, Protocol__ProgranMes goto error; } protocol__prp_ul_sr_info__init(ul_sr_info_msg); - + ul_sr_info_msg->header = header; ul_sr_info_msg->has_sfn_sf = 1; ul_sr_info_msg->sfn_sf = get_sfn_sf(mod_id); @@ -811,7 +837,7 @@ int enb_agent_mac_sr_info(mid_t mod_id, const void *params, Protocol__ProgranMes for (i = 0; i < ul_sr_info_msg->n_rnti; i++) { ul_sr_info_msg->rnti[i] = 1; } - + *msg = malloc(sizeof(Protocol__ProgranMessage)); if(*msg == NULL) goto error; @@ -820,7 +846,7 @@ int enb_agent_mac_sr_info(mid_t mod_id, const void *params, Protocol__ProgranMes (*msg)->msg_dir = PROTOCOL__PROGRAN_DIRECTION__INITIATING_MESSAGE; (*msg)->ul_sr_info_msg = ul_sr_info_msg; return 0; - + error: // TODO: Need to make proper error handling if (header != NULL) @@ -863,7 +889,7 @@ int enb_agent_mac_sf_trigger(mid_t mod_id, const void *params, Protocol__Progran goto error; } protocol__prp_sf_trigger__init(sf_trigger_msg); - + sf_trigger_msg->header = header; sf_trigger_msg->has_sfn_sf = 1; sf_trigger_msg->sfn_sf = get_sfn_sf(mod_id); @@ -872,7 +898,7 @@ int enb_agent_mac_sf_trigger(mid_t mod_id, const void *params, Protocol__Progran *transmitting UEs */ sf_trigger_msg->n_dl_info = get_num_ues(mod_id); - + Protocol__PrpDlInfo **dl_info = NULL; if (sf_trigger_msg->n_dl_info > 0) { @@ -901,14 +927,14 @@ int enb_agent_mac_sf_trigger(mid_t mod_id, const void *params, Protocol__Progran dl_info[i]->has_serv_cell_index = 1; } } - + sf_trigger_msg->dl_info = dl_info; /*TODO: Fill in the number of UL reception status related info, based on the number of currently *transmitting UEs */ sf_trigger_msg->n_ul_info = get_num_ues(mod_id); - + Protocol__PrpUlInfo **ul_info = NULL; if (sf_trigger_msg->n_ul_info > 0) { @@ -926,7 +952,7 @@ int enb_agent_mac_sf_trigger(mid_t mod_id, const void *params, Protocol__Progran /*TODO: fill in the Tx power control command for this UE (if available)*/ ul_info[i]->tpc = 1; ul_info[i]->has_tpc = 0; - /*TODO: fill in the amount of data in bytes in the MAC SDU received in this subframe for the + /*TODO: fill in the amount of data in bytes in the MAC SDU received in this subframe for the given logical channel*/ ul_info[i]->n_ul_reception = 11; ul_info[i]->ul_reception = malloc(sizeof(uint32_t) * ul_info[i]->n_ul_reception); @@ -941,7 +967,7 @@ int enb_agent_mac_sf_trigger(mid_t mod_id, const void *params, Protocol__Progran ul_info[i]->has_serv_cell_index = 1; } } - + sf_trigger_msg->ul_info = ul_info; *msg = malloc(sizeof(Protocol__ProgranMessage)); @@ -952,7 +978,7 @@ int enb_agent_mac_sf_trigger(mid_t mod_id, const void *params, Protocol__Progran (*msg)->msg_dir = PROTOCOL__PROGRAN_DIRECTION__INITIATING_MESSAGE; (*msg)->sf_trigger_msg = sf_trigger_msg; return 0; - + error: if (header != NULL) free(header); @@ -977,7 +1003,7 @@ int enb_agent_mac_destroy_sf_trigger(Protocol__ProgranMessage *msg) { int i; if(msg->msg_case != PROTOCOL__PROGRAN_MESSAGE__MSG_SF_TRIGGER_MSG) goto error; - + free(msg->sf_trigger_msg->header); for (i = 0; i < msg->sf_trigger_msg->n_dl_info; i++) { free(msg->sf_trigger_msg->dl_info[i]->harq_status); @@ -989,7 +1015,7 @@ int enb_agent_mac_destroy_sf_trigger(Protocol__ProgranMessage *msg) { free(msg->sf_trigger_msg->ul_info); free(msg->sf_trigger_msg); free(msg); - + return 0; error: @@ -1010,11 +1036,11 @@ int enb_agent_mac_create_empty_dl_config(mid_t mod_id, Protocol__ProgranMessage goto error; } protocol__prp_dl_mac_config__init(dl_mac_config_msg); - + dl_mac_config_msg->header = header; dl_mac_config_msg->has_sfn_sf = 1; dl_mac_config_msg->sfn_sf = get_sfn_sf(mod_id); - + *msg = malloc(sizeof(Protocol__ProgranMessage)); if(*msg == NULL) goto error; @@ -1056,7 +1082,7 @@ int enb_agent_mac_destroy_dl_config(Protocol__ProgranMessage *msg) { free(msg->dl_mac_config_msg->dl_ue_data[i]); } free(msg->dl_mac_config_msg->dl_ue_data); - + for (i = 0; i < msg->dl_mac_config_msg->n_dl_rar; i++) { dl_dci = msg->dl_mac_config_msg->dl_rar[i]->rar_dci; free(dl_dci->tbs_size); @@ -1132,7 +1158,7 @@ void enb_agent_send_sf_trigger(mid_t mod_id) { err_code_t err_code; int xid = 0; - + /*TODO: Must use a proper xid*/ err_code = enb_agent_mac_sf_trigger(mod_id, (void *) &xid, &msg); if (err_code < 0) { @@ -1161,20 +1187,20 @@ void enb_agent_send_update_mac_stats(mid_t mod_id) { int size; err_code_t err_code; int priority; - + mac_stats_updates_context_t stats_context = mac_stats_context[mod_id]; if (pthread_mutex_lock(mac_stats_context[mod_id].mutex)) { goto error; } - + /*Create a fresh report with the required flags*/ err_code = enb_agent_mac_handle_stats(mod_id, (void *) mac_stats_context[mod_id].stats_req, ¤t_report); if (err_code < 0) { goto error; } - /*TODO:Check if a previous reports exists and if yes, generate a report + /*TODO:Check if a previous reports exists and if yes, generate a report *that is the diff between the old and the new report, *respecting the thresholds. Otherwise send the new report*/ if (mac_stats_context[mod_id].prev_stats_reply != NULL) { @@ -1186,12 +1212,12 @@ void enb_agent_send_update_mac_stats(mid_t mod_id) { } /*Use the current report for future comparissons*/ mac_stats_context[mod_id].prev_stats_reply = current_report; - - + + if (pthread_mutex_unlock(mac_stats_context[mod_id].mutex)) { goto error; } - + if (msg != NULL){ data=enb_agent_pack_message(msg, &size); /*Send any stats updates using the MAC channel of the eNB*/ @@ -1219,7 +1245,7 @@ int enb_agent_register_mac_xface(mid_t mod_id, AGENT_MAC_xface *xface) { xface->enb_agent_send_update_mac_stats = enb_agent_send_update_mac_stats; xface->enb_agent_schedule_ue_spec = schedule_ue_spec_default; - + mac_agent_registered[mod_id] = 1; agent_mac_xface[mod_id] = xface; @@ -1227,7 +1253,7 @@ int enb_agent_register_mac_xface(mid_t mod_id, AGENT_MAC_xface *xface) { } int enb_agent_unregister_mac_xface(mid_t mod_id, AGENT_MAC_xface *xface) { - + //xface->agent_ctxt = NULL; xface->enb_agent_send_sr_info = NULL; xface->enb_agent_send_sf_trigger = NULL; @@ -1236,7 +1262,7 @@ int enb_agent_unregister_mac_xface(mid_t mod_id, AGENT_MAC_xface *xface) { mac_agent_registered[mod_id] = 0; agent_mac_xface[mod_id] = NULL; - + return 0; } @@ -1246,7 +1272,7 @@ int enb_agent_unregister_mac_xface(mid_t mod_id, AGENT_MAC_xface *xface) { ******************************************************/ err_code_t enb_agent_init_cont_mac_stats_update(mid_t mod_id) { - + /*Initialize the Mac stats update structure*/ /*Initially the continuous update is set to false*/ mac_stats_context[mod_id].cont_update = 0; @@ -1258,9 +1284,9 @@ err_code_t enb_agent_init_cont_mac_stats_update(mid_t mod_id) { goto error; if (pthread_mutex_init(mac_stats_context[mod_id].mutex, NULL)) goto error;; - + return 0; - + error: return -1; } @@ -1272,7 +1298,7 @@ err_code_t enb_agent_destroy_cont_mac_stats_update(mid_t mod_id) { enb_agent_destroy_progran_message(mac_stats_context[mod_id].stats_req); enb_agent_destroy_progran_message(mac_stats_context[mod_id].prev_stats_reply); free(mac_stats_context[mod_id].mutex); - + mac_agent_registered[mod_id] = NULL; return 1; } @@ -1290,15 +1316,15 @@ err_code_t enb_agent_enable_cont_mac_stats_update(mid_t mod_id, enb_agent_mac_stats_request(mod_id, xid, stats_req, &req_msg); mac_stats_context[mod_id].stats_req = req_msg; mac_stats_context[mod_id].prev_stats_reply = NULL; - + mac_stats_context[mod_id].cont_update = 1; mac_stats_context[mod_id].xid = xid; - + if (pthread_mutex_unlock(mac_stats_context[mod_id].mutex)) { goto error; } return 0; - + error: LOG_E(ENB_AGENT, "mac_stats_context for eNB %d is not initialized\n", mod_id); return -1; @@ -1325,5 +1351,5 @@ err_code_t enb_agent_disable_cont_mac_stats_update(mid_t mod_id) { error: LOG_E(ENB_AGENT, "mac_stats_context for eNB %d is not initialized\n", mod_id); return -1; - + } From cb8b6db577e8a9ab222d63c5758907610688eb3c Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Fri, 19 Feb 2016 13:37:52 +0000 Subject: [PATCH 096/349] Fixed bug in periodic reporting, where ue flags were reset --- openair2/ENB_APP/enb_agent_mac.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/openair2/ENB_APP/enb_agent_mac.c b/openair2/ENB_APP/enb_agent_mac.c index cb5aac1a95..c1af558414 100644 --- a/openair2/ENB_APP/enb_agent_mac.c +++ b/openair2/ENB_APP/enb_agent_mac.c @@ -130,6 +130,18 @@ int enb_agent_mac_handle_stats(mid_t mod_id, const void *params, Protocol__Progr request_config.report_type = PROTOCOL__PRP_STATS_TYPE__PRST_COMPLETE_STATS; request_config.report_frequency = PROTOCOL__PRP_STATS_REPORT_FREQ__PRSRF_ONCE; request_config.period = 0; + /* Need to make sure that the ue flags are saved (Bug) */ + if (report_config.nr_ue == 0) { + report_config.nr_ue = 1; + report_config.ue_report_type = (ue_report_type_t *) malloc(sizeof(ue_report_type_t)); + if (report_config.ue_report_type == NULL) { + // TODO: Add appropriate error code + err_code = -100; + goto error; + } + report_config.ue_report_type[0].ue_rnti = 0; // Dummy value + report_config.ue_report_type[0].ue_report_flags = ue_flags; + } request_config.config = &report_config; enb_agent_mac_stats_request(enb_id, xid, &request_config, &timer_msg); /* Create a timer */ From 258a71ffbd70bf79330c6cd1a9df4f15330d17df Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Fri, 19 Feb 2016 13:55:29 +0000 Subject: [PATCH 097/349] Fixed direction of hello message, as a reaction to controller stimulation --- openair2/ENB_APP/enb_agent_common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openair2/ENB_APP/enb_agent_common.c b/openair2/ENB_APP/enb_agent_common.c index eb08107dff..41760733bc 100644 --- a/openair2/ENB_APP/enb_agent_common.c +++ b/openair2/ENB_APP/enb_agent_common.c @@ -123,7 +123,7 @@ int enb_agent_hello(mid_t mod_id, const void *params, Protocol__ProgranMessage * protocol__progran_message__init(*msg); (*msg)->msg_case = PROTOCOL__PROGRAN_MESSAGE__MSG_HELLO_MSG; - (*msg)->msg_dir = PROTOCOL__PROGRAN_DIRECTION__INITIATING_MESSAGE; + (*msg)->msg_dir = PROTOCOL__PROGRAN_DIRECTION__SUCCESSFUL_OUTCOME; (*msg)->has_msg_dir = 1; (*msg)->hello_msg = hello_msg; return 0; From 6fc604d1820fd936a9015ea4ed80f4e6d2b912c0 Mon Sep 17 00:00:00 2001 From: Xiwen JIANG Date: Fri, 19 Feb 2016 18:17:43 +0100 Subject: [PATCH 098/349] conflict resolve for pdcchsim.c --- openair1/SIMULATION/LTE_PHY/pdcchsim.c | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/openair1/SIMULATION/LTE_PHY/pdcchsim.c b/openair1/SIMULATION/LTE_PHY/pdcchsim.c index 23557aada2..3b171ad937 100644 --- a/openair1/SIMULATION/LTE_PHY/pdcchsim.c +++ b/openair1/SIMULATION/LTE_PHY/pdcchsim.c @@ -750,25 +750,6 @@ int main(int argc, char **argv) subframe,NUMBER_OF_OFDM_CARRIERS, PHY_vars_eNB->lte_frame_parms.Ncp,PHY_vars_eNB->lte_frame_parms.samples_per_tti,nsymb); -<<<<<<< HEAD - switch (N_RB_DL) { - case 6: - BW = 1.25; - break; - - case 25: - BW = 5.00; - break; - - case 50: - BW = 10.00; - break; - - case 100: - BW = 20.00; - break; - } - eNB2UE = new_channel_desc_scm(PHY_vars_eNB->lte_frame_parms.nb_antenna_ports_eNB, PHY_vars_UE->lte_frame_parms.nb_antennas_rx, channel_model, From 08e25bf397aad2e1db1ff655d7b185acfbed712a Mon Sep 17 00:00:00 2001 From: MKassem Date: Fri, 19 Feb 2016 14:48:50 +0000 Subject: [PATCH 099/349] Added eNB configuration message Signed-off-by: Xenofon Foukas --- openair2/ENB_APP/enb_agent_common.c | 519 +++++++++++++++++++++++++++- openair2/ENB_APP/enb_agent_common.h | 43 +++ openair2/LAYER2/MAC/extern.h | 2 + 3 files changed, 556 insertions(+), 8 deletions(-) diff --git a/openair2/ENB_APP/enb_agent_common.c b/openair2/ENB_APP/enb_agent_common.c index 41760733bc..38f429f562 100644 --- a/openair2/ENB_APP/enb_agent_common.c +++ b/openair2/ENB_APP/enb_agent_common.c @@ -36,11 +36,13 @@ #include "enb_agent_common.h" +#include "PHY/extern.h" #include "log.h" void * enb[NUM_MAX_ENB]; void * enb_ue[NUM_MAX_ENB]; +void * enb_rrc[NUM_MAX_ENB]; /* * message primitives */ @@ -261,14 +263,33 @@ int enb_agent_destroy_echo_reply(Protocol__ProgranMessage *msg) { return -1; } -int enb_agent_enb_config_reply(mid_t mod_id, const void *params, Protocol__ProgranMessage **msg) { - /* TODO: Create a reply progRAN message with the current eNB configuration */ - return 0; -} int enb_agent_destroy_enb_config_reply(Protocol__ProgranMessage *msg) { - /* TODO: Deallocate memory for a dynamically allocated eNB config message */ - return 0; + if(msg->msg_case != PROTOCOL__PROGRAN_MESSAGE__MSG_ENB_CONFIG_REPLY_MSG) + goto error; + free(msg->enb_config_reply_msg->header); + int i, j; + Protocol__PrpEnbConfigReply *reply = msg->enb_config_reply_msg; + + for(i = 0; i < reply->n_cell_config;i++){ + free(reply->cell_config[i]->mbsfn_subframe_config_rfoffset); + free(reply->cell_config[i]->mbsfn_subframe_config_rfperiod); + free(reply->cell_config[i]->mbsfn_subframe_config_sfalloc); + for(j = 0; j < reply->cell_config[i]->si_config->n_si_message;j++){ + free(reply->cell_config[i]->si_config->si_message[j]); + } + free(reply->cell_config[i]->si_config->si_message); + free(reply->cell_config[i]->si_config); + free(reply->cell_config[i]); + } + free(reply->cell_config); + free(reply); + free(msg); + + return 0; + error: + //LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); + return -1; } int enb_agent_ue_config_reply(mid_t mod_id, const void *params, Protocol__ProgranMessage **msg) { @@ -292,8 +313,16 @@ int enb_agent_destroy_lc_config_reply(Protocol__ProgranMessage *msg) { } int enb_agent_destroy_enb_config_request(Protocol__ProgranMessage *msg) { - /* TODO: Deallocate memory for a dynamically allocated eNB config message */ - return 0; + if(msg->msg_case != PROTOCOL__PROGRAN_MESSAGE__MSG_ENB_CONFIG_REQUEST_MSG) + goto error; + free(msg->enb_config_request_msg->header); + free(msg->enb_config_request_msg); + free(msg); + return 0; + + error: + //LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); + return -1; } int enb_agent_destroy_ue_config_request(Protocol__ProgranMessage *msg) { @@ -316,6 +345,7 @@ void set_enb_vars(mid_t mod_id, ran_name_t ran){ case RAN_LTE_OAI : enb[mod_id] = (void *)&eNB_mac_inst[mod_id]; enb_ue[mod_id] = (void *)&eNB_mac_inst[mod_id].UE_list; + enb_rrc[mod_id] = (void *)&eNB_rrc_inst[mod_id]; break; default : goto error; @@ -425,10 +455,483 @@ int get_current_RI(mid_t mod_id, mid_t ue_id, int CC_id) return eNB_UE_stats[CC_id].rank; } + +/* + * ************************************ + * Get Messages for eNB Configuration Reply + * ************************************ + */ + +int get_hopping_offset(mid_t mod_id, int CC_id) +{ + LTE_DL_FRAME_PARMS *frame_parms; + + frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id); + return frame_parms->pusch_config_common.pusch_HoppingOffset; +} +int get_hopping_mode(mid_t mod_id, int CC_id) +{ + LTE_DL_FRAME_PARMS *frame_parms; + + frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id); + return frame_parms->pusch_config_common.hoppingMode; +} +int get_n_SB(mid_t mod_id, int CC_id) +{ + LTE_DL_FRAME_PARMS *frame_parms; + + frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id); + return frame_parms->pusch_config_common.n_SB; +} +int get_enable64QAM(mid_t mod_id, int CC_id) +{ + LTE_DL_FRAME_PARMS *frame_parms; + + frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id); + return frame_parms->pusch_config_common.enable64QAM; +} +int get_phich_duration(mid_t mod_id, int CC_id) +{ + LTE_DL_FRAME_PARMS *frame_parms; + + frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id); + return frame_parms->phich_config_common.phich_duration; +} +int get_phich_resource(mid_t mod_id, int CC_id) +{ + LTE_DL_FRAME_PARMS *frame_parms; + + frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id); + if(frame_parms->phich_config_common.phich_resource == oneSixth) + return 0; + else if(frame_parms->phich_config_common.phich_resource == half) + return 1; + else if(frame_parms->phich_config_common.phich_resource == one) + return 2; + else if(frame_parms->phich_config_common.phich_resource == two) + return 3; + + return -1; +} +int get_n1pucch_an(mid_t mod_id, int CC_id) +{ + LTE_DL_FRAME_PARMS *frame_parms; + + frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id); + return frame_parms->pucch_config_common.n1PUCCH_AN; +} +int get_nRB_CQI(mid_t mod_id, int CC_id) +{ + LTE_DL_FRAME_PARMS *frame_parms; + + frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id); + return frame_parms->pucch_config_common.nRB_CQI; +} +int get_deltaPUCCH_Shift(mid_t mod_id, int CC_id) +{ + LTE_DL_FRAME_PARMS *frame_parms; + + frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id); + return frame_parms->pucch_config_common.deltaPUCCH_Shift; +} +int get_prach_ConfigIndex(mid_t mod_id, int CC_id) +{ + LTE_DL_FRAME_PARMS *frame_parms; + + frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id); + return frame_parms->prach_config_common.prach_ConfigInfo.prach_ConfigIndex; +} +int get_prach_FreqOffset(mid_t mod_id, int CC_id) +{ + LTE_DL_FRAME_PARMS *frame_parms; + + frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id); + return frame_parms->prach_config_common.prach_ConfigInfo.prach_FreqOffset; +} +int get_maxHARQ_Msg3Tx(mid_t mod_id, int CC_id) +{ + LTE_DL_FRAME_PARMS *frame_parms; + + frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id); + return frame_parms->maxHARQ_Msg3Tx; +} +int get_ul_cyclic_prefix_length(mid_t mod_id, int CC_id) +{ + LTE_DL_FRAME_PARMS *frame_parms; + + frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id); + return frame_parms->Ncp_UL; +} +int get_dl_cyclic_prefix_length(mid_t mod_id, int CC_id) +{ + LTE_DL_FRAME_PARMS *frame_parms; + + frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id); + return frame_parms->Ncp; +} +int get_cell_id(mid_t mod_id, int CC_id) +{ + LTE_DL_FRAME_PARMS *frame_parms; + + frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id); + return frame_parms->Nid_cell; +} +int get_srs_BandwidthConfig(mid_t mod_id, int CC_id) +{ + LTE_DL_FRAME_PARMS *frame_parms; + + frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id); + return frame_parms->soundingrs_ul_config_common.srs_BandwidthConfig; +} +int get_srs_SubframeConfig(mid_t mod_id, int CC_id) +{ + LTE_DL_FRAME_PARMS *frame_parms; + + frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id); + return frame_parms->soundingrs_ul_config_common.srs_SubframeConfig; +} +int get_srs_MaxUpPts(mid_t mod_id, int CC_id) +{ + LTE_DL_FRAME_PARMS *frame_parms; + + frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id); + return frame_parms->soundingrs_ul_config_common.srs_MaxUpPts; +} +int get_N_RB_DL(mid_t mod_id, int CC_id) +{ + LTE_DL_FRAME_PARMS *frame_parms; + + frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id); + return frame_parms->N_RB_DL; +} +int get_N_RB_UL(mid_t mod_id, int CC_id) +{ + LTE_DL_FRAME_PARMS *frame_parms; + + frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id); + return frame_parms->N_RB_UL; +} +int get_subframe_assignment(mid_t mod_id, int CC_id) +{ + LTE_DL_FRAME_PARMS *frame_parms; + + frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id); + return frame_parms->tdd_config; +} +int get_special_subframe_assignment(mid_t mod_id, int CC_id) +{ + LTE_DL_FRAME_PARMS *frame_parms; + + frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id); + return frame_parms->tdd_config_S; +} +int get_ra_ResponseWindowSize(mid_t mod_id, int CC_id) +{ + Enb_properties_array_t *enb_properties; + enb_properties = enb_config_get(); + return enb_properties->properties[mod_id]->rach_raResponseWindowSize[CC_id]; +} +int get_mac_ContentionResolutionTimer(mid_t mod_id, int CC_id) +{ + Enb_properties_array_t *enb_properties; + enb_properties = enb_config_get(); + return enb_properties->properties[mod_id]->rach_macContentionResolutionTimer[CC_id]; +} +int get_duplex_mode(mid_t mod_id, int CC_id) +{ + LTE_DL_FRAME_PARMS *frame_parms; + + frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id); + if(frame_parms->frame_type == 0) + return 1; + else if (frame_parms->frame_type == 1) + return 0; + + return -1; +} +long get_si_window_length(mid_t mod_id, int CC_id) +{ + return ((eNB_RRC_INST *)enb_rrc[mod_id])->carrier[CC_id].sib1->si_WindowLength; +} +int get_sib1_length(mid_t mod_id, int CC_id) +{ + return ((eNB_RRC_INST *)enb_rrc[mod_id])->carrier[CC_id].sizeof_SIB1; +} +int get_num_pdcch_symb(mid_t mod_id, int CC_id) +{ + /*TODO: add these values to some struct in MAC + LTE_UE_PDCCH *lte_ue_pdcch; + lte_ue_pdcch = mac_xface->get_lte_ue_pdcch(mod_id, CC_id, mod_id); + */ + return (PHY_vars_UE_g[mod_id][CC_id]->lte_ue_pdcch_vars[mod_id]->num_pdcch_symbols); +} + /* * timer primitives */ +/* + * ************************************ + * eNB Configuration Request and Reply + * ************************************ + */ + +int enb_agent_enb_config_request(mid_t mod_id, const void* params, Protocol__ProgranMessage **msg) { + + Protocol__PrpHeader *header; + xid_t xid = 1; + if(prp_create_header(xid,PROTOCOL__PRP_TYPE__PRPT_GET_ENB_CONFIG_REQUEST, &header) != 0) + goto error; + + Protocol__PrpEnbConfigRequest *enb_config_request_msg; + enb_config_request_msg = malloc(sizeof(Protocol__PrpEnbConfigRequest)); + + if(enb_config_request_msg == NULL) + goto error; + + protocol__prp_enb_config_request__init(enb_config_request_msg); + enb_config_request_msg->header = header; + + *msg = malloc(sizeof(Protocol__ProgranMessage)); + if(*msg == NULL) + goto error; + + protocol__progran_message__init(*msg); + (*msg)->msg_case = PROTOCOL__PROGRAN_MESSAGE__MSG_ENB_CONFIG_REQUEST_MSG; + (*msg)->msg_dir = PROTOCOL__PROGRAN_DIRECTION__INITIATING_MESSAGE; + (*msg)->enb_config_request_msg = enb_config_request_msg; + return 0; + + error: + // TODO: Need to make proper error handling + if (header != NULL) + free(header); + if (enb_config_request_msg != NULL) + free(enb_config_request_msg); + if(*msg != NULL) + free(*msg); + //LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); + return -1; +} + +int enb_agent_enb_config_reply(mid_t mod_id, const void *params, Protocol__ProgranMessage **msg) { + + xid_t xid; + Protocol__ProgranMessage *input = (Protocol__ProgranMessage *)params; + Protocol__PrpEnbConfigReply *enb_config_req_msg = input->enb_config_request_msg; + xid = (enb_config_req_msg->header)->xid; + + int i, j, k; + int cc_id = 0; + int enb_id = mod_id; + + + Protocol__PrpHeader *header; + if(prp_create_header(xid, PROTOCOL__PRP_TYPE__PRPT_GET_ENB_CONFIG_REPLY, &header) != 0) + goto error; + + Protocol__PrpEnbConfigReply *enb_config_reply_msg; + enb_config_reply_msg = malloc(sizeof(Protocol__PrpEnbConfigReply)); + if(enb_config_reply_msg == NULL) + goto error; + protocol__prp_enb_config_reply__init(enb_config_reply_msg); + enb_config_reply_msg->header = header; + + enb_config_reply_msg->enb_id = mod_id; + + + enb_config_reply_msg->n_cell_config = MAX_NUM_CCs; + + Protocol__PrpCellConfig **cell_conf; + if(enb_config_reply_msg->n_cell_config > 0){ + cell_conf = malloc(sizeof(Protocol__PrpCellConfig *) * enb_config_reply_msg->n_cell_config); + if(cell_conf == NULL) + goto error; + for(i = 0; i < enb_config_reply_msg->n_cell_config; i++){ + cell_conf[i] = malloc(sizeof(Protocol__PrpCellConfig)); + protocol__prp_cell_config__init(cell_conf[i]); + //TODO: Fill in with actual value, the PCI of this cell + cell_conf[i]->phy_cell_id = 1; + cell_conf[i]->has_phy_cell_id = 1; + //TODO: Fill in with actual value, the PLMN cell id of this cell + cell_conf[i]->cell_id = get_cell_id(enb_id,i); + cell_conf[i]->has_cell_id = 1; + //TODO: Fill in with actual value, PUSCH resources in RBs for hopping + cell_conf[i]->pusch_hopping_offset = get_hopping_offset(enb_id,i); + cell_conf[i]->has_pusch_hopping_offset = 1; + //TODO: Fill in with actual value + cell_conf[i]->hopping_mode = get_hopping_mode(enb_id,i); + cell_conf[i]->has_hopping_mode = 1; + //TODO: Fill in with actual value, the number of subbands + cell_conf[i]->n_sb = get_n_SB(enb_id,i); + cell_conf[i]->has_n_sb = 1; + //TODO: Fill in with actual value, The number of resource element groups used for PHICH. One of PRPR_ + cell_conf[i]->phich_resource = get_phich_resource(enb_id,i); + cell_conf[i]->has_phich_resource = 1; + //TODO: Fill in with actual value, one of the PRPD_ values + cell_conf[i]->phich_duration = get_phich_duration(enb_id,i); + cell_conf[i]->has_phich_duration = 1; + //TODO: Fill in with actual value, See TS 36.211, section 6.9 + cell_conf[i]->init_nr_pdcch_ofdm_sym = get_num_pdcch_symb(enb_id,i); + cell_conf[i]->has_init_nr_pdcch_ofdm_sym = 1; + //TODO: Fill in with actual value + Protocol__PrpSiConfig *si_config; + si_config = malloc(sizeof(Protocol__PrpSiConfig)); + if(si_config == NULL) + goto error; + protocol__prp_si_config__init(si_config); + //TODO: Fill in with actual value, Frame number to apply the SI configuration + si_config->sfn = 1; + si_config->has_sfn = 1; + //TODO: Fill in with actual value, the length of SIB1 in bytes + si_config->sib1_length = get_sib1_length(enb_id,i); + si_config->has_sib1_length = 1; + //TODO: Fill in with actual value, Scheduling window for all SIs in SF + si_config->si_window_length = (uint32_t) get_si_window_length(enb_id,i); + si_config->has_si_window_length = 1; + //TODO: Fill in with actual value, the number of SI messages + si_config->n_si_message=1; + Protocol__PrpSiMessage **si_message; + si_message = malloc(sizeof(Protocol__PrpSiMessage *) * si_config->n_si_message); + if(si_message == NULL) + goto error; + for(j = 0; j < si_config->n_si_message; j++){ + si_message[j] = malloc(sizeof(Protocol__PrpSiMessage)); + if(si_message[j] == NULL) + goto error; + protocol__prp_si_message__init(si_message[j]); + //TODO: Fill in with actual value, Periodicity of SI msg in radio frames + si_message[j]->periodicity = 1; //SIPeriod + si_message[j]->has_periodicity = 1; + //TODO: Fill in with actual value, rhe length of the SI message in bytes + si_message[j]->length = 10; + si_message[j]->has_length = 1; + } + if(si_config->n_si_message > 0){ + si_config->si_message = si_message; + } + cell_conf[i]->si_config = si_config; + + //TODO: Fill in with actual value, the DL transmission bandwidth in RBs + cell_conf[i]->dl_bandwidth = get_N_RB_DL(enb_id,i); + cell_conf[i]->has_dl_bandwidth = 1; + //TODO: Fill in with actual value, the UL transmission bandwidth in RBs + cell_conf[i]->ul_bandwidth = get_N_RB_UL(enb_id,i); + cell_conf[i]->has_ul_bandwidth = 1; + //TODO: Fill in with actual value, one of PRUCPL values + cell_conf[i]->ul_cyclic_prefix_length = get_ul_cyclic_prefix_length(enb_id,i); + cell_conf[i]->has_ul_cyclic_prefix_length = 1; + //TODO: Fill in with actual value, one of PRUCPL values + cell_conf[i]->dl_cyclic_prefix_length = get_dl_cyclic_prefix_length(enb_id,i); + cell_conf[i]->has_dl_cyclic_prefix_length = 1; + //TODO: Fill in with actual value, number of cell specific antenna ports + cell_conf[i]->antenna_ports_count = 1; + cell_conf[i]->has_antenna_ports_count = 1; + //TODO: Fill in with actual value, one of PRDM values + cell_conf[i]->duplex_mode = get_duplex_mode(enb_id,i); + cell_conf[i]->has_duplex_mode = 1; + //TODO: Fill in with actual value, DL/UL subframe assignment. TDD only + cell_conf[i]->subframe_assignment = get_subframe_assignment(enb_id,i); + cell_conf[i]->has_subframe_assignment = 1; + //TODO: Fill in with actual value, TDD only. See TS 36.211, table 4.2.1 + cell_conf[i]->special_subframe_patterns = get_special_subframe_assignment(enb_id,i); + cell_conf[i]->has_special_subframe_patterns = 1; + //TODO: Fill in with actual value, The MBSFN radio frame period + cell_conf[i]->n_mbsfn_subframe_config_rfperiod = 5; + uint32_t *elem_rfperiod; + elem_rfperiod = (uint32_t *) malloc(sizeof(uint32_t) *cell_conf[i]->n_mbsfn_subframe_config_rfperiod); + if(elem_rfperiod == NULL) + goto error; + for(j = 0; j < cell_conf[i]->n_mbsfn_subframe_config_rfperiod; j++){ + elem_rfperiod[j] = 1; + } + cell_conf[i]->mbsfn_subframe_config_rfperiod = elem_rfperiod; + + //TODO: Fill in with actual value, The MBSFN radio frame offset + cell_conf[i]->n_mbsfn_subframe_config_rfoffset = 5; + uint32_t *elem_rfoffset; + elem_rfoffset = (uint32_t *) malloc(sizeof(uint32_t) *cell_conf[i]->n_mbsfn_subframe_config_rfoffset); + if(elem_rfoffset == NULL) + goto error; + for(j = 0; j < cell_conf[i]->n_mbsfn_subframe_config_rfoffset; j++){ + elem_rfoffset[j] = 1; + } + cell_conf[i]->mbsfn_subframe_config_rfoffset = elem_rfoffset; + + //TODO: Fill in with actual value, Bitmap indicating the MBSFN subframes + cell_conf[i]->n_mbsfn_subframe_config_sfalloc = 5; + uint32_t *elem_sfalloc; + elem_sfalloc = (uint32_t *) malloc(sizeof(uint32_t) *cell_conf[i]->n_mbsfn_subframe_config_sfalloc); + if(elem_sfalloc == NULL) + goto error; + for(j = 0; j < cell_conf[i]->n_mbsfn_subframe_config_sfalloc; j++){ + elem_sfalloc[j] = 1; + } + cell_conf[i]->mbsfn_subframe_config_sfalloc = elem_sfalloc; + + //TODO: Fill in with actual value, See TS 36.211, section 5.7.1 + cell_conf[i]->prach_config_index = get_prach_ConfigIndex(enb_id,i); + cell_conf[i]->has_prach_config_index = 1; + //TODO: Fill in with actual value, See TS 36.211, section 5.7.1 + cell_conf[i]->prach_freq_offset = get_prach_FreqOffset(enb_id,i); + cell_conf[i]->has_prach_freq_offset = 1; + //TODO: Fill in with actual value, Duration of RA response window in SF + cell_conf[i]->ra_response_window_size = get_ra_ResponseWindowSize(enb_id,i); + cell_conf[i]->has_ra_response_window_size = 1; + //TODO: Fill in with actual value, Timer used for RA + cell_conf[i]->mac_contention_resolution_timer = get_mac_ContentionResolutionTimer(enb_id,i); + cell_conf[i]->has_mac_contention_resolution_timer = 1; + //TODO: Fill in with actual value, See TS 36.321 + cell_conf[i]->max_harq_msg3tx = get_maxHARQ_Msg3Tx(enb_id,i); + cell_conf[i]->has_max_harq_msg3tx = 1; + //TODO: Fill in with actual value, See TS 36.213, section 10.1 + cell_conf[i]->n1pucch_an = get_n1pucch_an(enb_id,i); + cell_conf[i]->has_n1pucch_an = 1; + //TODO: Fill in with actual value, See TS 36.211, section 5.4 + cell_conf[i]->deltapucch_shift = get_deltaPUCCH_Shift(enb_id,i); + cell_conf[i]->has_deltapucch_shift = 1; + //TODO: Fill in with actual value, See TS 36.211, section 5.4 + cell_conf[i]->nrb_cqi = get_nRB_CQI(enb_id,i); + cell_conf[i]->has_nrb_cqi = 1; + //TODO: Fill in with actual value, See TS 36.211, table 5.5.3.3-1 and 2 + cell_conf[i]->srs_subframe_config = get_srs_SubframeConfig(enb_id,i); + cell_conf[i]->has_srs_subframe_config = 1; + //TODO: Fill in with actual value, See TS 36.211, section 5.5.3.2 + cell_conf[i]->srs_bw_config = get_srs_BandwidthConfig(enb_id,i); + cell_conf[i]->has_srs_bw_config = 1; + //TODO: Fill in with actual value, Boolean value. See TS 36.211, section 5.5.3.2. TDD only + cell_conf[i]->srs_mac_up_pts = get_srs_MaxUpPts(enb_id,i); + cell_conf[i]->has_srs_mac_up_pts = 1; + //TODO: Fill in with actual value, One of the PREQ_ values + cell_conf[i]->enable_64qam = get_enable64QAM(enb_id,i); + cell_conf[i]->has_enable_64qam = 1; + //TODO: Fill in with actual value, Carrier component index + cell_conf[i]->carrier_index = i; + cell_conf[i]->has_carrier_index = 1; + } + enb_config_reply_msg->cell_config=cell_conf; + } + *msg = malloc(sizeof(Protocol__ProgranMessage)); + if(*msg == NULL) + goto error; + protocol__progran_message__init(*msg); + (*msg)->msg_case = PROTOCOL__PROGRAN_MESSAGE__MSG_ENB_CONFIG_REPLY_MSG; + (*msg)->msg_dir = PROTOCOL__PROGRAN_DIRECTION__SUCCESSFUL_OUTCOME; + (*msg)->enb_config_reply_msg = enb_config_reply_msg; + return 0; + + error: + // TODO: Need to make proper error handling + if (header != NULL) + free(header); + if (enb_config_reply_msg != NULL) + free(enb_config_reply_msg); + if(*msg != NULL) + free(*msg); + //LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); + return -1; +} + //struct enb_agent_map agent_map; enb_agent_timer_instance_t timer_instance; diff --git a/openair2/ENB_APP/enb_agent_common.h b/openair2/ENB_APP/enb_agent_common.h index 37d3829354..07d743ecb4 100644 --- a/openair2/ENB_APP/enb_agent_common.h +++ b/openair2/ENB_APP/enb_agent_common.h @@ -47,6 +47,7 @@ #include "stats_common.pb-c.h" # include "enb_agent_defs.h" +#include "enb_config.h" #include "LAYER2/MAC/extern.h" #include "LAYER2/RLC/rlc.h" @@ -100,6 +101,7 @@ int enb_agent_destroy_ue_config_reply(Protocol__ProgranMessage *msg); int enb_agent_lc_config_reply(mid_t mod_id, const void *params, Protocol__ProgranMessage **msg); int enb_agent_destroy_lc_config_reply(Protocol__ProgranMessage *msg); +int enb_agent_enb_config_request(mid_t mod_id, const void* params, Protocol__ProgranMessage **msg); int enb_agent_destroy_enb_config_request(Protocol__ProgranMessage *msg); int enb_agent_destroy_ue_config_request(Protocol__ProgranMessage *msg); @@ -156,6 +158,47 @@ int get_active_CC(mid_t mod_id, mid_t ue_id); int get_current_RI(mid_t mod_id, mid_t ue_id, int CC_id); +int get_n1pucch_an(mid_t mod_id, int CC_id); + +int get_nRB_CQI(mid_t mod_id, int CC_id); + +int get_deltaPUCCH_Shift(mid_t mod_id, int CC_id); + +int get_prach_ConfigIndex(mid_t mod_id, int CC_id); + +int get_prach_FreqOffset(mid_t mod_id, int CC_id); + +int get_maxHARQ_Msg3Tx(mid_t mod_id, int CC_id); + +int get_ul_cyclic_prefix_length(mid_t mod_id, int CC_id); + +int get_dl_cyclic_prefix_length(mid_t mod_id, int CC_id); + +int get_cell_id(mid_t mod_id, int CC_id); + +int get_srs_BandwidthConfig(mid_t mod_id, int CC_id); + +int get_srs_SubframeConfig(mid_t mod_id, int CC_id); + +int get_srs_MaxUpPts(mid_t mod_id, int CC_id); + +int get_N_RB_DL(mid_t mod_id, int CC_id); + +int get_N_RB_UL(mid_t mod_id, int CC_id); + +int get_subframe_assignment(mid_t mod_id, int CC_id); + +int get_special_subframe_assignment(mid_t mod_id, int CC_id); + +int get_ra_ResponseWindowSize(mid_t mod_id, int CC_id); + +int get_mac_ContentionResolutionTimer(mid_t mod_id, int CC_id); + +int get_duplex_mode(mid_t mod_id, int CC_id); + +long get_si_window_length(mid_t mod_id, int CC_id); + +int get_num_pdcch_symb(mid_t mod_id, int CC_id); /******************* diff --git a/openair2/LAYER2/MAC/extern.h b/openair2/LAYER2/MAC/extern.h index ca847acf4c..2810235255 100644 --- a/openair2/LAYER2/MAC/extern.h +++ b/openair2/LAYER2/MAC/extern.h @@ -50,12 +50,14 @@ //#include "SIMULATION/simulation_defs.h" #endif //PHY_EMUL #include "PHY_INTERFACE/defs.h" +#include "RRC/LITE/defs.h" extern const uint32_t BSR_TABLE[BSR_TABLE_SIZE]; //extern uint32_t EBSR_Level[63]; extern UE_MAC_INST *UE_mac_inst; extern eNB_MAC_INST *eNB_mac_inst; +extern eNB_RRC_INST *eNB_rrc_inst; extern MAC_RLC_XFACE *Mac_rlc_xface; extern uint8_t Is_rrc_registered; From 93cf1b1df723f770e1e6fd094ff95db6bc26aad3 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Sun, 21 Feb 2016 21:39:22 +0000 Subject: [PATCH 100/349] Fixed bug in assignment of enb_config_request_message --- openair2/ENB_APP/enb_agent_common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openair2/ENB_APP/enb_agent_common.c b/openair2/ENB_APP/enb_agent_common.c index 38f429f562..a87a6be8e3 100644 --- a/openair2/ENB_APP/enb_agent_common.c +++ b/openair2/ENB_APP/enb_agent_common.c @@ -718,7 +718,7 @@ int enb_agent_enb_config_reply(mid_t mod_id, const void *params, Protocol__Progr xid_t xid; Protocol__ProgranMessage *input = (Protocol__ProgranMessage *)params; - Protocol__PrpEnbConfigReply *enb_config_req_msg = input->enb_config_request_msg; + Protocol__PrpEnbConfigRequest *enb_config_req_msg = input->enb_config_request_msg; xid = (enb_config_req_msg->header)->xid; int i, j, k; From 7b1ee53a4e759890beeb83fa227247c3bb0b9d9f Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Mon, 22 Feb 2016 11:26:52 +0000 Subject: [PATCH 101/349] Implemented UE config message (dummy) --- openair2/ENB_APP/enb_agent_common.c | 179 +++++++++++++++++++++++++++- 1 file changed, 177 insertions(+), 2 deletions(-) diff --git a/openair2/ENB_APP/enb_agent_common.c b/openair2/ENB_APP/enb_agent_common.c index a87a6be8e3..768764b152 100644 --- a/openair2/ENB_APP/enb_agent_common.c +++ b/openair2/ENB_APP/enb_agent_common.c @@ -293,13 +293,188 @@ int enb_agent_destroy_enb_config_reply(Protocol__ProgranMessage *msg) { } int enb_agent_ue_config_reply(mid_t mod_id, const void *params, Protocol__ProgranMessage **msg) { - /* TODO: Create a reply progRAN message with the current UE configurations */ + + xid_t xid; + Protocol__ProgranMessage *input = (Protocol__ProgranMessage *)params; + Protocol__PrpUeConfigRequest *ue_config_request_msg = input->ue_config_request_msg; + xid = (ue_config_request_msg->header)->xid; + + int i; + + Protocol__PrpHeader *header; + if(prp_create_header(xid, PROTOCOL__PRP_TYPE__PRPT_GET_UE_CONFIG_REPLY, &header) != 0) + goto error; + + Protocol__PrpUeConfigReply *ue_config_reply_msg; + ue_config_reply_msg = malloc(sizeof(Protocol__PrpUeConfigReply)); + if(ue_config_reply_msg == NULL) + goto error; + protocol__prp_enb_config_reply__init(ue_config_reply_msg); + ue_config_reply_msg->header = header; + + //TODO: Fill in the actual number of UEs that are currently connected + ue_config_reply_msg->n_ue_config = 1; + + Protocol__PrpUeConfig **ue_config; + if (ue_config_reply_msg->n_ue_config > 0) { + ue_config = malloc(sizeof(Protocol__PrpUeConfig *) * ue_config_reply_msg->n_ue_config); + if (ue_config == NULL) { + goto error; + } + for (i = 0; i < ue_config_reply_msg->n_ue_config; i++) { + ue_config[i] = malloc(sizeof(Protocol__PrpUeConfig *)); + protocol__prp_ue_config__init(ue_config[i]); + //TODO: Set the RNTI of the ue with id i + ue_config[i]->rnti = 1; + ue_config[i]->has_rnti = 1; + //TODO: Set the DRX configuration (optional) + //Not supported for now, so we do not set it + + //TODO: Set the time_alignment_timer + ue_config[i]->time_alignment_timer = 1; + ue_config[i]->has_time_alignment_timer = 1; + //TODO: Set the measurement gap configuration pattern + ue_config[i]->meas_gap_config_pattern = 1; + ue_config[i]->has_meas_gap_config_pattern = 1; + //TODO: Set the measurement gap offset if applicable + ue_config[i]->meas_gap_config_sf_offset = 1; + ue_config[i]->has_meas_gap_config_sf_offset = 1; + //TODO: Set the SPS configuration (Optional) + //Not supported for noe, so we do not set it + + //TODO: Set the SR configuration (Optional) + //We do not set it for now + + //TODO: Set the CQI configuration (Optional) + //We do not set it for now + + //TODO: Set the transmission mode + ue_config[i]->transmission_mode = 1; + ue_config[i]->has_transmission_mode = 1; + + //TODO: Set the aggregated bit-rate of the non-gbr bearer (UL) + ue_config[i]->ue_aggregated_max_bitrate_ul = 1; + ue_config[i]->has_ue_aggregated_max_bitrate_ul = 1; + + //TODO: Set the aggregated bit-rate of the non-gbr bearer (DL) + ue_config[i]->ue_aggregated_max_bitrate_dl = 1; + ue_config[i]->has_ue_aggregated_max_bitrate_dl = 1; + + //TODO: Set the UE capabilities + Protocol__PrpUeCapabilities *capabilities; + capabilities = malloc(sizeof(Protocol__PrpUeCapabilities)); + protocol__prp_ue_capabilities__init(capabilities); + //TODO: Set half duplex (FDD operation) + capabilities->has_half_duplex = 1; + capabilities->half_duplex = 1; + //TODO: Set intra-frame hopping flag + capabilities->has_intra_sf_hopping = 1; + capabilities->intra_sf_hopping = 1; + //TODO: Set support for type 2 hopping with n_sb > 1 + capabilities->has_type2_sb_1 = 1; + capabilities->type2_sb_1 = 1; + //TODO: Set ue category + capabilities->has_ue_category = 1; + capabilities->ue_category = 1; + //TODO: Set UE support for resource allocation type 1 + capabilities->has_res_alloc_type1 = 1; + capabilities->res_alloc_type1 = 1; + //Set the capabilites to the message + ue_config[i]->capabilities = capabilities; + //TODO: Set UE transmission antenna. One of the PRUTA_* values + ue_config[i]->has_ue_transmission_antenna = 1; + ue_config[i]->ue_transmission_antenna = PROTOCOL__PRP_UE_TRANSMISSION_ANTENNA__PRUTA_OPEN_LOOP; + //TODO: Set tti bundling flag (See ts 36.321) + ue_config[i]->has_tti_bundling = 1; + ue_config[i]->tti_bundling = 1; + //TODO: Set the max HARQ retransmission for the UL + ue_config[i]->has_max_harq_tx = 1; + ue_config[i]->max_harq_tx = 1; + //TODO: Fill beta_offset_ack_index (TS 36.213) + ue_config[i]->has_beta_offset_ack_index = 1; + ue_config[i]->beta_offset_ack_index = 1; + //TODO: Fill beta_offset_ri_index (TS 36.213) + ue_config[i]->has_beta_offset_ri_index = 1; + ue_config[i]->beta_offset_ri_index = 1; + //TODO: Fill beta_offset_cqi_index (TS 36.213) + ue_config[i]->has_beta_offset_cqi_index = 1; + ue_config[i]->beta_offset_cqi_index = 1; + //TODO: Fill ack_nack_simultaneous_trans (TS 36.213) + ue_config[i]->has_ack_nack_simultaneous_trans = 1; + ue_config[i]->ack_nack_simultaneous_trans = 1; + //TODO: Fill simultaneous_ack_nack_cqi (TS 36.213) + ue_config[i]->has_simultaneous_ack_nack_cqi = 1; + ue_config[i]->simultaneous_ack_nack_cqi = 1; + //TODO: Set PRACRM_* value regarding aperiodic cqi report mode + ue_config[i]->has_aperiodic_cqi_rep_mode = 1; + ue_config[i]->aperiodic_cqi_rep_mode = PROTOCOL__PRP_APERIODIC_CQI_REPORT_MODE__PRACRM_RM12; + //TODO: Set tdd_ack_nack_feedback + ue_config[i]->has_tdd_ack_nack_feedback = 1; + ue_config[i]->tdd_ack_nack_feedback = 1; + //TODO: Set ack_nack_repetition factor + ue_config[i]->has_ack_nack_repetition_factor = 1; + ue_config[i]->ack_nack_repetition_factor = 1; + //TODO: Set extended BSR size + ue_config[i]->has_extended_bsr_size = 1; + ue_config[i]->extended_bsr_size = 1; + //TODO: Set carrier aggregation support (boolean) + ue_config[i]->has_ca_support = 1; + ue_config[i]->ca_support = 0; + //TODO: Set cross carrier scheduling support (boolean) + ue_config[i]->has_cross_carrier_sched_support = 1; + ue_config[i]->cross_carrier_sched_support = 0; + //TODO: Set index of primary cell + ue_config[i]->has_pcell_carrier_index = 1; + ue_config[i]->pcell_carrier_index = 1; + //TODO: Set secondary cells configuration + // We do not set it for now. No carrier aggregation support + + //TODO: Set deactivation timer for secondary cell + ue_config[i]->has_scell_deactivation_timer = 1; + ue_config[i]->scell_deactivation_timer = 1; + } + ue_config_reply_msg->ue_config = ue_config; + } + *msg = malloc(sizeof(Protocol__ProgranMessage)); + if (*msg == NULL) + goto error; + protocol__progran_message__init(*msg); + (*msg)->msg_case = PROTOCOL__PROGRAN_MESSAGE__MSG_UE_CONFIG_REPLY_MSG; + (*msg)->msg_dir = PROTOCOL__PROGRAN_DIRECTION__SUCCESSFUL_OUTCOME; + (*msg)->ue_config_reply_msg = ue_config_reply_msg; return 0; + + error: + // TODO: Need to make proper error handling + if (header != NULL) + free(header); + if (ue_config_reply_msg != NULL) + free(ue_config_reply_msg); + if(*msg != NULL) + free(*msg); + //LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); + return -1; } int enb_agent_destroy_ue_config_reply(Protocol__ProgranMessage *msg) { - /*TODO: Deallocate memory for a dynamically allocated UE config message */ + if(msg->msg_case != PROTOCOL__PROGRAN_MESSAGE__MSG_UE_CONFIG_REPLY_MSG) + goto error; + free(msg->ue_config_reply_msg->header); + int i, j; + Protocol__PrpUeConfigReply *reply = msg->ue_config_reply_msg; + + for(i = 0; i < reply->n_ue_config;i++){ + free(reply->ue_config[i]->capabilities); + free(reply->ue_config[i]); + } + free(reply->ue_config); + free(reply); + free(msg); + return 0; + error: + //LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); + return -1; } int enb_agent_lc_config_reply(mid_t mod_id, const void *params, Protocol__ProgranMessage **msg) { From b523682af04f4a25e75c4f961c7db7d574135fe9 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Mon, 22 Feb 2016 11:55:46 +0000 Subject: [PATCH 102/349] Added support for UE state change message --- openair2/ENB_APP/MESSAGES/V2/config_common.proto | 6 ++++++ openair2/ENB_APP/MESSAGES/V2/header.proto | 3 +++ openair2/ENB_APP/MESSAGES/V2/progran.proto | 11 +++++++++++ 3 files changed, 20 insertions(+) diff --git a/openair2/ENB_APP/MESSAGES/V2/config_common.proto b/openair2/ENB_APP/MESSAGES/V2/config_common.proto index ab6e8b8c22..f7a4b1ee07 100644 --- a/openair2/ENB_APP/MESSAGES/V2/config_common.proto +++ b/openair2/ENB_APP/MESSAGES/V2/config_common.proto @@ -172,3 +172,9 @@ enum prp_qos_bearer_type { PRQBT_GBR = 1; } +enum prp_ue_state_change_type { + PRUESC_UPDATED = 0; + PRUESC_ACTIVATED = 1; + PRUESC_DEACTIVATED = 2; + PRUESC_MOVED = 3; +} \ No newline at end of file diff --git a/openair2/ENB_APP/MESSAGES/V2/header.proto b/openair2/ENB_APP/MESSAGES/V2/header.proto index be0341f132..8e6adb1fda 100644 --- a/openair2/ENB_APP/MESSAGES/V2/header.proto +++ b/openair2/ENB_APP/MESSAGES/V2/header.proto @@ -32,5 +32,8 @@ enum prp_type { //Controller command messages PRPT_DL_MAC_CONFIG = 13; + + // UE state change messages + PRPT_UE_STATE_CHANGE = 14; } diff --git a/openair2/ENB_APP/MESSAGES/V2/progran.proto b/openair2/ENB_APP/MESSAGES/V2/progran.proto index 2bcf9bbc95..44fffc7ead 100644 --- a/openair2/ENB_APP/MESSAGES/V2/progran.proto +++ b/openair2/ENB_APP/MESSAGES/V2/progran.proto @@ -24,6 +24,7 @@ message progran_message { prp_lc_config_request lc_config_request_msg = 12; prp_lc_config_reply lc_config_reply_msg = 13; prp_dl_mac_config dl_mac_config_msg = 14; + prp_ue_state_change ue_state_change_msg = 15; } } @@ -159,6 +160,16 @@ message prp_dl_mac_config { repeated prp_pdcch_ofdm_sym_count ofdm_sym = 6; // OFDM symbol count for each CC } +// +// UE state change message +// + +message prp_ue_state_change { + optional prp_header header = 1; + optional uint32 type = 2; // One of the PRUESC_* values + optional prp_ue_config config = 3; // Body of the message (based on type) +} + // Extensions of the echo request and reply // messages for carrying a latency value in ms message prp_echo_request_latency { From 1caa45ad4bef2d305484257cf928b662a5fddc10 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Mon, 22 Feb 2016 12:05:17 +0000 Subject: [PATCH 103/349] Integrated UE state messages to agent --- openair2/ENB_APP/enb_agent_common.c | 10 ++++++++++ openair2/ENB_APP/enb_agent_common.h | 2 ++ openair2/ENB_APP/enb_agent_handler.c | 2 ++ 3 files changed, 14 insertions(+) diff --git a/openair2/ENB_APP/enb_agent_common.c b/openair2/ENB_APP/enb_agent_common.c index 768764b152..b30b748424 100644 --- a/openair2/ENB_APP/enb_agent_common.c +++ b/openair2/ENB_APP/enb_agent_common.c @@ -487,6 +487,16 @@ int enb_agent_destroy_lc_config_reply(Protocol__ProgranMessage *msg) { return 0; } +int enb_agent_ue_state_change(mid_t mod_id, uint32_t rnti, uint8_t state_change) { + /* TODO: Create a progRAN message with the state changes requested for the UE with RNTI rnti */ + return 0; +} + +int enb_agent_destroy_ue_state_change(Protocol__ProgranMessage *msg) { + /* TODO: Dealocate memory for a dynamically allocated UE state change message */ + return 0; +} + int enb_agent_destroy_enb_config_request(Protocol__ProgranMessage *msg) { if(msg->msg_case != PROTOCOL__PROGRAN_MESSAGE__MSG_ENB_CONFIG_REQUEST_MSG) goto error; diff --git a/openair2/ENB_APP/enb_agent_common.h b/openair2/ENB_APP/enb_agent_common.h index 07d743ecb4..bb7b20fdb4 100644 --- a/openair2/ENB_APP/enb_agent_common.h +++ b/openair2/ENB_APP/enb_agent_common.h @@ -108,6 +108,8 @@ int enb_agent_destroy_ue_config_request(Protocol__ProgranMessage *msg); int enb_agent_destroy_lc_config_request(Protocol__ProgranMessage *msg); +int enb_agent_ue_state_change(mid_t mod_id, uint32_t rnti, uint8_t state_change); +int enb_agent_destroy_ue_state_change(Protocol__ProgranMessage *msg); Protocol__ProgranMessage* enb_agent_handle_message (mid_t mod_id, uint8_t *data, diff --git a/openair2/ENB_APP/enb_agent_handler.c b/openair2/ENB_APP/enb_agent_handler.c index 9815732088..2162a29314 100644 --- a/openair2/ENB_APP/enb_agent_handler.c +++ b/openair2/ENB_APP/enb_agent_handler.c @@ -56,6 +56,7 @@ enb_agent_message_decoded_callback agent_messages_callback[][3] = { {enb_agent_lc_config_reply, 0, 0}, /*PROTOCOL__PROGRAN_MESSAGE__MSG_LC_CONFIG_REQUEST_MSG*/ {0, 0, 0}, /*PROTOCOL__PROGRAN_MESSAGE__MSG_LC_CONFIG_REPLY_MSG*/ {0, 0, 0}, /*PROTOCOL__PROGRAN_MESSAGE__MSG_DL_MAC_CONFIG_MSG*/ + {0, 0, 0}, /*PROTOCOL__PROGRAN_MESSAGE__MSG_UE_STATE_CHANGE_MSG*/ }; @@ -74,6 +75,7 @@ enb_agent_message_destruction_callback message_destruction_callback[] = { enb_agent_destroy_lc_config_request, enb_agent_destroy_lc_config_reply, enb_agent_mac_destroy_dl_config, + enb_agent_destroy_ue_state_change, }; static const char *enb_agent_direction2String[] = { From 591cb51a2dff0e728a4ca8310b229f3d00ff12fc Mon Sep 17 00:00:00 2001 From: MKassem Date: Mon, 22 Feb 2016 12:03:02 +0000 Subject: [PATCH 104/349] Added sf trigger API functions Signed-off-by: Xenofon Foukas --- openair2/ENB_APP/enb_agent_common.c | 50 +++++++++++++++++++++++++++++ openair2/ENB_APP/enb_agent_common.h | 3 ++ openair2/ENB_APP/enb_agent_mac.c | 18 +++++++---- 3 files changed, 65 insertions(+), 6 deletions(-) diff --git a/openair2/ENB_APP/enb_agent_common.c b/openair2/ENB_APP/enb_agent_common.c index b30b748424..c07dcb243e 100644 --- a/openair2/ENB_APP/enb_agent_common.c +++ b/openair2/ENB_APP/enb_agent_common.c @@ -640,6 +640,56 @@ int get_current_RI(mid_t mod_id, mid_t ue_id, int CC_id) return eNB_UE_stats[CC_id].rank; } +int get_tpc(mid_t mod_id, mid_t ue_id) +{ + LTE_eNB_UE_stats *eNB_UE_stats = NULL; + int32_t normalized_rx_power, target_rx_power; + int tpc = 1; + + int pCCid = UE_PCCID(mod_id,ue_id); + rnti_t rnti = get_ue_crnti(mod_id,ue_id); + + eNB_UE_stats = mac_xface->get_eNB_UE_stats(mod_id, pCCid, rnti); + + normalized_rx_power = eNB_UE_stats->UL_rssi[0]; + + target_rx_power = mac_xface->get_target_pusch_rx_power(mod_id,pCCid); + + if (normalized_rx_power>(target_rx_power+1)) { + tpc = 0; //-1 + } else if (normalized_rx_power<(target_rx_power-1)) { + tpc = 2; //+1 + } else { + tpc = 1; //0 + } + return tpc; +} + +int get_harq(mid_t mod_id,uint8_t CC_id,mid_t ue_id, int frame, uint8_t subframe, int flag_id_status) //flag_id_status = 0 then id, else status +{ + /*TODO: Add int TB in function parameters to get the status of the second TB. This can be done to by editing in + * get_ue_active_harq_pid function in line 272 file: phy_procedures_lte_eNB.c to add + * DLSCH_ptr = PHY_vars_eNB_g[Mod_id][CC_id]->dlsch_eNB[(uint32_t)UE_id][1];*/ + + uint8_t *harq_pid = malloc(sizeof(uint8_t)); + uint8_t *round = malloc(sizeof(uint8_t)); + + uint16_t rnti = get_ue_crnti(mod_id,ue_id); + + mac_xface->get_ue_active_harq_pid(mod_id,CC_id,rnti,frame,subframe,&harq_pid,&round,0); + + if(flag_id_status == 0) + return *harq_pid; + else if(flag_id_status == 1) + { + if(*round > 0) + return 1; + else + return 0; + } + return 150; +} + /* * ************************************ diff --git a/openair2/ENB_APP/enb_agent_common.h b/openair2/ENB_APP/enb_agent_common.h index bb7b20fdb4..f45f68ef9a 100644 --- a/openair2/ENB_APP/enb_agent_common.h +++ b/openair2/ENB_APP/enb_agent_common.h @@ -202,6 +202,9 @@ long get_si_window_length(mid_t mod_id, int CC_id); int get_num_pdcch_symb(mid_t mod_id, int CC_id); +int get_tpc(mid_t mod_id, mid_t ue_id); + +int get_harq(mid_t mod_id,uint8_t CC_id,mid_t ue_id, int frame, uint8_t subframe, int flag_id_status); /******************* * timer primitves diff --git a/openair2/ENB_APP/enb_agent_mac.c b/openair2/ENB_APP/enb_agent_mac.c index c1af558414..a780c0b6c8 100644 --- a/openair2/ENB_APP/enb_agent_mac.c +++ b/openair2/ENB_APP/enb_agent_mac.c @@ -926,16 +926,16 @@ int enb_agent_mac_sf_trigger(mid_t mod_id, const void *params, Protocol__Progran dl_info[i]->rnti = get_ue_crnti(mod_id, i); dl_info[i]->has_rnti = 1; /*TODO: fill in the right id of this round's HARQ process for this UE*/ - dl_info[i]->harq_process_id = 1; + dl_info[i]->harq_process_id = get_harq(mod_id,UE_PCCID(mod_id,i),i,get_current_frame(mod_id),get_current_subframe(mod_id),0); dl_info[i]->has_harq_process_id = 1; /*TODO: fill in the status of the HARQ process (2 TBs)*/ dl_info[i]->n_harq_status = 2; dl_info[i]->harq_status = malloc(sizeof(uint32_t) * dl_info[i]->n_harq_status); for (j = 0; j < dl_info[j]->n_harq_status; j++) { - dl_info[i]->harq_status[j] = PROTOCOL__PRP_HARQ_STATUS__PRHS_ACK; + dl_info[i]->harq_status[j] = get_harq(mod_id,UE_PCCID(mod_id,i),i,get_current_frame(mod_id),get_current_subframe(mod_id),1); } /*TODO: fill in the serving cell index for this UE */ - dl_info[i]->serv_cell_index = 0; + dl_info[i]->serv_cell_index = UE_PCCID(mod_id,i); dl_info[i]->has_serv_cell_index = 1; } } @@ -962,8 +962,14 @@ int enb_agent_mac_sf_trigger(mid_t mod_id, const void *params, Protocol__Progran ul_info[i]->rnti = get_ue_crnti(mod_id, i); ul_info[i]->has_rnti = 1; /*TODO: fill in the Tx power control command for this UE (if available)*/ - ul_info[i]->tpc = 1; - ul_info[i]->has_tpc = 0; + if(get_tpc(mod_id,i) != 1){ + ul_info[i]->tpc = get_tpc(mod_id,i); + ul_info[i]->has_tpc = 1; + } + else{ + ul_info[i]->tpc = get_tpc(mod_id,i); + ul_info[i]->has_tpc = 0; + } /*TODO: fill in the amount of data in bytes in the MAC SDU received in this subframe for the given logical channel*/ ul_info[i]->n_ul_reception = 11; @@ -975,7 +981,7 @@ int enb_agent_mac_sf_trigger(mid_t mod_id, const void *params, Protocol__Progran ul_info[i]->reception_status = PROTOCOL__PRP_RECEPTION_STATUS__PRRS_OK; ul_info[i]->has_reception_status = 1; /*TODO: fill in the serving cell index for this UE */ - ul_info[i]->serv_cell_index = 0; + ul_info[i]->serv_cell_index = UE_PCCID(mod_id,i); ul_info[i]->has_serv_cell_index = 1; } } From e6e117a567b140ea70d13dfc951fbf68056f05f4 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Mon, 22 Feb 2016 13:08:26 +0000 Subject: [PATCH 105/349] Implemented LC config reply message --- .../ENB_APP/MESSAGES/V2/config_common.proto | 2 +- openair2/ENB_APP/enb_agent_common.c | 142 ++++++++++++++++-- 2 files changed, 130 insertions(+), 14 deletions(-) diff --git a/openair2/ENB_APP/MESSAGES/V2/config_common.proto b/openair2/ENB_APP/MESSAGES/V2/config_common.proto index f7a4b1ee07..cf07f423aa 100644 --- a/openair2/ENB_APP/MESSAGES/V2/config_common.proto +++ b/openair2/ENB_APP/MESSAGES/V2/config_common.proto @@ -158,7 +158,7 @@ message prp_lc_config { optional uint64 e_RAB_max_bitrate_UL = 6; // In bps (GBR only) optional uint64 e_RAB_max_bitrate_DL = 7; // In bps (GBR only) optional uint64 e_RAB_guaranteed_bitrate_UL = 8; // In bps (GBR only) - optional uint64 e_RAB_guranteed_bitrate_DL = 9; // In bps (GBR only) + optional uint64 e_RAB_guaranteed_bitrate_DL = 9; // In bps (GBR only) } enum prp_lc_direction { diff --git a/openair2/ENB_APP/enb_agent_common.c b/openair2/ENB_APP/enb_agent_common.c index c07dcb243e..eb19052476 100644 --- a/openair2/ENB_APP/enb_agent_common.c +++ b/openair2/ENB_APP/enb_agent_common.c @@ -322,7 +322,7 @@ int enb_agent_ue_config_reply(mid_t mod_id, const void *params, Protocol__Progra goto error; } for (i = 0; i < ue_config_reply_msg->n_ue_config; i++) { - ue_config[i] = malloc(sizeof(Protocol__PrpUeConfig *)); + ue_config[i] = malloc(sizeof(Protocol__PrpUeConfig)); protocol__prp_ue_config__init(ue_config[i]); //TODO: Set the RNTI of the ue with id i ue_config[i]->rnti = 1; @@ -478,13 +478,129 @@ int enb_agent_destroy_ue_config_reply(Protocol__ProgranMessage *msg) { } int enb_agent_lc_config_reply(mid_t mod_id, const void *params, Protocol__ProgranMessage **msg) { - /* TODO: Create a reply progRAN message with the current LC configurations */ + + xid_t xid; + Protocol__ProgranMessage *input = (Protocol__ProgranMessage *)params; + Protocol__PrpLcConfigRequest *lc_config_request_msg = input->lc_config_request_msg; + xid = (lc_config_request_msg->header)->xid; + + int i, j; + Protocol__PrpHeader *header; + if(prp_create_header(xid, PROTOCOL__PRP_TYPE__PRPT_GET_LC_CONFIG_REPLY, &header) != 0) + goto error; + + Protocol__PrpLcConfigReply *lc_config_reply_msg; + lc_config_reply_msg = malloc(sizeof(Protocol__PrpLcConfigReply)); + if(lc_config_reply_msg == NULL) + goto error; + protocol__prp_lc_config_reply__init(lc_config_reply_msg); + lc_config_reply_msg->header = header; + + //TODO: Fill in the actual number of UEs that we are going to report LC configs about + lc_config_reply_msg->n_lc_ue_config = 1; + + Protocol__PrpLcUeConfig **lc_ue_config; + if (lc_config_reply_msg->n_lc_ue_config > 0) { + lc_ue_config = malloc(sizeof(Protocol__PrpLcUeConfig *) * lc_config_reply_msg->n_lc_ue_config); + if (lc_ue_config == NULL) { + goto error; + } + // Fill the config for each UE + for (i = 0; i < lc_config_reply_msg->n_lc_ue_config; i++) { + lc_ue_config[i] = malloc(sizeof(Protocol__PrpLcUeConfig)); + protocol__prp_lc_ue_config__init(lc_ue_config[i]); + //TODO: Set the RNTI of the UE + lc_ue_config[i]->has_rnti = 1; + lc_ue_config[i]->rnti = 1; + //TODO: Set the number of LC configurations that will be reported for this UE + lc_ue_config[i]->n_lc_config = 3; + Protocol__PrpLcConfig **lc_config; + if (lc_ue_config[i]->n_lc_config > 0) { + lc_config = malloc(sizeof(Protocol__PrpLcConfig *) * lc_ue_config[i]->n_lc_config); + if (lc_config == NULL) { + goto error; + } + for (j = 0; j < lc_ue_config[i]->n_lc_config; j++) { + lc_config[j] = malloc(sizeof(Protocol__PrpLcConfig)); + protocol__prp_lc_config__init(lc_config[j]); + //TODO: Set the LC id + lc_config[j]->has_lcid = 1; + lc_config[j]->lcid = 1; + //TODO: Set the LCG of the channel + lc_config[j]->has_lcg = 1; + lc_config[j]->lcg = 1; + //TODO: Set the LC direction + lc_config[j]->has_direction = 1; + lc_config[j]->direction = PROTOCOL__PRP_LC_DIRECTION__PRLCD_BOTH; + //TODO: Bearer type. One of PRQBT_* values + lc_config[j]->has_qos_bearer_type = 1; + lc_config[j]->qos_bearer_type = PROTOCOL__PRP_QOS_BEARER_TYPE__PRQBT_NON_GBR; + //TODO: Set the QCI defined in TS 23.203, coded as defined in TS 36.413 + // One less than the actual QCI value + lc_config[j]->has_qci = 1; + lc_config[j]->qci = 1; + if (lc_config[j]->direction == PROTOCOL__PRP_QOS_BEARER_TYPE__PRQBT_GBR) { + //TODO: Set the max bitrate (UL) + lc_config[j]->has_e_rab_max_bitrate_ul = 1; + lc_config[j]->e_rab_max_bitrate_ul = 1; + //TODO: Set the max bitrate (DL) + lc_config[j]->has_e_rab_max_bitrate_dl = 1; + lc_config[j]->e_rab_max_bitrate_dl = 1; + //TODO: Set the guaranteed bitrate (UL) + lc_config[j]->has_e_rab_guaranteed_bitrate_ul = 1; + lc_config[j]->e_rab_guaranteed_bitrate_ul = 1; + //TODO: Set the guaranteed bitrate (DL) + lc_config[j]->has_e_rab_guaranteed_bitrate_dl = 1; + lc_config[j]->e_rab_guaranteed_bitrate_dl = 1; + } + } + lc_ue_config[i]->lc_config = lc_config; + } + } // end for UE + lc_config_reply_msg->lc_ue_config = lc_ue_config; + } // lc_config_reply_msg->n_lc_ue_config > 0 + *msg = malloc(sizeof(Protocol__ProgranMessage)); + if (*msg == NULL) + goto error; + protocol__progran_message__init(*msg); + (*msg)->msg_case = PROTOCOL__PROGRAN_MESSAGE__MSG_LC_CONFIG_REPLY_MSG; + (*msg)->msg_dir = PROTOCOL__PROGRAN_DIRECTION__SUCCESSFUL_OUTCOME; + (*msg)->lc_config_reply_msg = lc_config_reply_msg; + return 0; + + error: + // TODO: Need to make proper error handling + if (header != NULL) + free(header); + if (lc_config_reply_msg != NULL) + free(lc_config_reply_msg); + if(*msg != NULL) + free(*msg); + //LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); + return -1; } int enb_agent_destroy_lc_config_reply(Protocol__ProgranMessage *msg) { - /* TODO: Deallocate memory for a dynamically allocated LC config message */ + if(msg->msg_case != PROTOCOL__PROGRAN_MESSAGE__MSG_LC_CONFIG_REPLY_MSG) + goto error; + + int i, j; + free(msg->lc_config_reply_msg->header); + for (i = 0; i < msg->lc_config_reply_msg->n_lc_ue_config; i++) { + for (j = 0; j < msg->lc_config_reply_msg->lc_ue_config[i]->n_lc_config; j++) { + free(msg->lc_config_reply_msg->lc_ue_config[i]->lc_config[j]); + } + free(msg->lc_config_reply_msg->lc_ue_config[i]->lc_config); + free(msg->lc_config_reply_msg->lc_ue_config[i]); + } + free(msg->lc_config_reply_msg->lc_ue_config); + free(msg->lc_config_reply_msg); + free(msg); return 0; + error: + //LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); + return -1; } int enb_agent_ue_state_change(mid_t mod_id, uint32_t rnti, uint8_t state_change) { @@ -498,16 +614,16 @@ int enb_agent_destroy_ue_state_change(Protocol__ProgranMessage *msg) { } int enb_agent_destroy_enb_config_request(Protocol__ProgranMessage *msg) { - if(msg->msg_case != PROTOCOL__PROGRAN_MESSAGE__MSG_ENB_CONFIG_REQUEST_MSG) - goto error; - free(msg->enb_config_request_msg->header); - free(msg->enb_config_request_msg); - free(msg); - return 0; - - error: - //LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); - return -1; + if(msg->msg_case != PROTOCOL__PROGRAN_MESSAGE__MSG_ENB_CONFIG_REQUEST_MSG) + goto error; + free(msg->enb_config_request_msg->header); + free(msg->enb_config_request_msg); + free(msg); + return 0; + + error: + //LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); + return -1; } int enb_agent_destroy_ue_config_request(Protocol__ProgranMessage *msg) { From 991e995027f42b0d2f68bc8fe7d0d6847b36b35d Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Mon, 22 Feb 2016 14:08:11 +0000 Subject: [PATCH 106/349] Changed get_harq function to provide both id and status at once --- openair2/ENB_APP/enb_agent_common.c | 29 ++++++++++++++--------------- openair2/ENB_APP/enb_agent_common.h | 3 ++- openair2/ENB_APP/enb_agent_mac.c | 8 ++++++-- 3 files changed, 22 insertions(+), 18 deletions(-) diff --git a/openair2/ENB_APP/enb_agent_common.c b/openair2/ENB_APP/enb_agent_common.c index eb19052476..51d7161b58 100644 --- a/openair2/ENB_APP/enb_agent_common.c +++ b/openair2/ENB_APP/enb_agent_common.c @@ -781,29 +781,28 @@ int get_tpc(mid_t mod_id, mid_t ue_id) return tpc; } -int get_harq(mid_t mod_id,uint8_t CC_id,mid_t ue_id, int frame, uint8_t subframe, int flag_id_status) //flag_id_status = 0 then id, else status +int get_harq(const mid_t mod_id, const uint8_t CC_id, const mid_t ue_id, const int frame, const uint8_t subframe, int *id, int *status) //flag_id_status = 0 then id, else status { /*TODO: Add int TB in function parameters to get the status of the second TB. This can be done to by editing in * get_ue_active_harq_pid function in line 272 file: phy_procedures_lte_eNB.c to add * DLSCH_ptr = PHY_vars_eNB_g[Mod_id][CC_id]->dlsch_eNB[(uint32_t)UE_id][1];*/ - uint8_t *harq_pid = malloc(sizeof(uint8_t)); - uint8_t *round = malloc(sizeof(uint8_t)); + uint8_t harq_pid; + uint8_t round; + - uint16_t rnti = get_ue_crnti(mod_id,ue_id); + uint16_t rnti = get_ue_crnti(mod_id,ue_id); - mac_xface->get_ue_active_harq_pid(mod_id,CC_id,rnti,frame,subframe,&harq_pid,&round,0); + mac_xface->get_ue_active_harq_pid(mod_id,CC_id,rnti,frame,subframe,&harq_pid,&round,0); - if(flag_id_status == 0) - return *harq_pid; - else if(flag_id_status == 1) - { - if(*round > 0) - return 1; - else - return 0; - } - return 150; + *id = harq_pid; + if (round > 0) { + *status = 1; + } else { + *status = 0; + } + + return 0; } diff --git a/openair2/ENB_APP/enb_agent_common.h b/openair2/ENB_APP/enb_agent_common.h index f45f68ef9a..6a31094417 100644 --- a/openair2/ENB_APP/enb_agent_common.h +++ b/openair2/ENB_APP/enb_agent_common.h @@ -204,7 +204,8 @@ int get_num_pdcch_symb(mid_t mod_id, int CC_id); int get_tpc(mid_t mod_id, mid_t ue_id); -int get_harq(mid_t mod_id,uint8_t CC_id,mid_t ue_id, int frame, uint8_t subframe, int flag_id_status); +int get_harq(const mid_t mod_id, const uint8_t CC_id, const mid_t ue_id, + const int frame, const uint8_t subframe, int *id, int *status); /******************* * timer primitves diff --git a/openair2/ENB_APP/enb_agent_mac.c b/openair2/ENB_APP/enb_agent_mac.c index a780c0b6c8..dfe29bcc3e 100644 --- a/openair2/ENB_APP/enb_agent_mac.c +++ b/openair2/ENB_APP/enb_agent_mac.c @@ -926,13 +926,17 @@ int enb_agent_mac_sf_trigger(mid_t mod_id, const void *params, Protocol__Progran dl_info[i]->rnti = get_ue_crnti(mod_id, i); dl_info[i]->has_rnti = 1; /*TODO: fill in the right id of this round's HARQ process for this UE*/ - dl_info[i]->harq_process_id = get_harq(mod_id,UE_PCCID(mod_id,i),i,get_current_frame(mod_id),get_current_subframe(mod_id),0); + int harq_id; + int harq_status; + get_harq(mod_id,UE_PCCID(mod_id,i),i,get_current_frame(mod_id),get_current_subframe(mod_id),&harq_id, &harq_status); + dl_info[i]->harq_process_id = harq_id; dl_info[i]->has_harq_process_id = 1; /*TODO: fill in the status of the HARQ process (2 TBs)*/ dl_info[i]->n_harq_status = 2; dl_info[i]->harq_status = malloc(sizeof(uint32_t) * dl_info[i]->n_harq_status); for (j = 0; j < dl_info[j]->n_harq_status; j++) { - dl_info[i]->harq_status[j] = get_harq(mod_id,UE_PCCID(mod_id,i),i,get_current_frame(mod_id),get_current_subframe(mod_id),1); + // TODO: This should be different per TB + dl_info[i]->harq_status[j] = harq_status; } /*TODO: fill in the serving cell index for this UE */ dl_info[i]->serv_cell_index = UE_PCCID(mod_id,i); From 465168d2af443989cfa791bd0c6c0a71dc9f3196 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Mon, 22 Feb 2016 14:45:39 +0000 Subject: [PATCH 107/349] Integrated sf triggering to MAC layer and fixed bugs in creation of sf trigger message --- openair2/ENB_APP/enb_agent_mac.c | 8 ++++---- openair2/LAYER2/MAC/eNB_scheduler.c | 10 +++++++++- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/openair2/ENB_APP/enb_agent_mac.c b/openair2/ENB_APP/enb_agent_mac.c index dfe29bcc3e..f31da89d81 100644 --- a/openair2/ENB_APP/enb_agent_mac.c +++ b/openair2/ENB_APP/enb_agent_mac.c @@ -918,7 +918,7 @@ int enb_agent_mac_sf_trigger(mid_t mod_id, const void *params, Protocol__Progran if(dl_info == NULL) goto error; //Fill the status of the current HARQ process for each UE - for(i = 0; i++; i < sf_trigger_msg->n_dl_info) { + for(i = 0; i < sf_trigger_msg->n_dl_info; i++) { dl_info[i] = malloc(sizeof(Protocol__PrpDlInfo)); if(dl_info[i] == NULL) goto error; @@ -934,7 +934,7 @@ int enb_agent_mac_sf_trigger(mid_t mod_id, const void *params, Protocol__Progran /*TODO: fill in the status of the HARQ process (2 TBs)*/ dl_info[i]->n_harq_status = 2; dl_info[i]->harq_status = malloc(sizeof(uint32_t) * dl_info[i]->n_harq_status); - for (j = 0; j < dl_info[j]->n_harq_status; j++) { + for (j = 0; j < dl_info[i]->n_harq_status; j++) { // TODO: This should be different per TB dl_info[i]->harq_status[j] = harq_status; } @@ -958,7 +958,7 @@ int enb_agent_mac_sf_trigger(mid_t mod_id, const void *params, Protocol__Progran if(ul_info == NULL) goto error; //Fill the reception info for each transmitting UE - for(i = 0; i++; i < sf_trigger_msg->n_ul_info) { + for(i = 0; i < sf_trigger_msg->n_ul_info; i++) { ul_info[i] = malloc(sizeof(Protocol__PrpUlInfo)); if(ul_info[i] == NULL) goto error; @@ -978,7 +978,7 @@ int enb_agent_mac_sf_trigger(mid_t mod_id, const void *params, Protocol__Progran given logical channel*/ ul_info[i]->n_ul_reception = 11; ul_info[i]->ul_reception = malloc(sizeof(uint32_t) * ul_info[i]->n_ul_reception); - for (j = 0; j < ul_info[j]->n_ul_reception; j++) { + for (j = 0; j < ul_info[i]->n_ul_reception; j++) { ul_info[i]->ul_reception[j] = 100; } /*TODO: Fill in the reception status for each UEs data*/ diff --git a/openair2/LAYER2/MAC/eNB_scheduler.c b/openair2/LAYER2/MAC/eNB_scheduler.c index 54b31b6e64..a39b9efb54 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler.c +++ b/openair2/LAYER2/MAC/eNB_scheduler.c @@ -71,6 +71,7 @@ #define ENABLE_MAC_PAYLOAD_DEBUG #define DEBUG_eNB_SCHEDULER 1 #define ENABLE_ENB_AGENT_DL_SCHEDULER +//#define DISABLE_SF_TRIGGER //#define DEBUG_HEADER_PARSING 1 //#define DEBUG_PACKET_TRACE 1 @@ -207,7 +208,14 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, } - + +#ifndef DISABLE_SF_TRIGGER + //Send subframe trigger to the controller + if (mac_agent_registered[module_idP]) { + agent_mac_xface[module_idP]->enb_agent_send_sf_trigger(module_idP); + } +#endif + //if (subframeP%5 == 0) //#ifdef EXMIMO PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, module_idP, ENB_FLAG_YES, NOT_A_RNTI, frameP, 0,module_idP); From 95d51446f8a1cab7a7e14773d6ed6756020bec99 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Mon, 22 Feb 2016 15:22:21 +0000 Subject: [PATCH 108/349] Added ue_state_change stub implementation --- openair2/ENB_APP/enb_agent_common.c | 73 +++++++++++++++++++++++++-- openair2/ENB_APP/enb_agent_mac.c | 2 +- openair2/ENB_APP/enb_agent_mac_defs.h | 6 +++ 3 files changed, 77 insertions(+), 4 deletions(-) diff --git a/openair2/ENB_APP/enb_agent_common.c b/openair2/ENB_APP/enb_agent_common.c index 51d7161b58..1e7efe920a 100644 --- a/openair2/ENB_APP/enb_agent_common.c +++ b/openair2/ENB_APP/enb_agent_common.c @@ -604,13 +604,80 @@ int enb_agent_destroy_lc_config_reply(Protocol__ProgranMessage *msg) { } int enb_agent_ue_state_change(mid_t mod_id, uint32_t rnti, uint8_t state_change) { - /* TODO: Create a progRAN message with the state changes requested for the UE with RNTI rnti */ - return 0; + int size; + Protocol__ProgranMessage *msg; + Protocol__PrpHeader *header; + void *data; + int priority; + err_code_t err_code; + + int xid = 0; + + if (prp_create_header(xid, PROTOCOL__PRP_TYPE__PRPT_UE_STATE_CHANGE, &header) != 0) + goto error; + + Protocol__PrpUeStateChange *ue_state_change_msg; + ue_state_change_msg = malloc(sizeof(Protocol__PrpUeStateChange)); + if(ue_state_change_msg == NULL) { + goto error; + } + protocol__prp_ue_state_change__init(ue_state_change_msg); + ue_state_change_msg->has_type = 1; + ue_state_change_msg->type = state_change; + + Protocol__PrpUeConfig *config; + config = malloc(sizeof(Protocol__PrpUeConfig)); + if (config == NULL) { + goto error; + } + protocol__prp_ue_config__init(config); + if (state_change == PROTOCOL__PRP_UE_STATE_CHANGE_TYPE__PRUESC_DEACTIVATED) { + // Simply set the rnti of the UE + config->has_rnti = 1; + config->rnti = rnti; + } else if (state_change == PROTOCOL__PRP_UE_STATE_CHANGE_TYPE__PRUESC_UPDATED + || state_change == PROTOCOL__PRP_UE_STATE_CHANGE_TYPE__PRUESC_ACTIVATED) { + // TODO: Set the whole UE configuration message + + } else if (state_change == PROTOCOL__PRP_UE_STATE_CHANGE_TYPE__PRUESC_MOVED) { + // TODO: Not supported for now. Leave blank + } + + ue_state_change_msg->config = config; + msg = malloc(sizeof(Protocol__ProgranMessage)); + if (msg == NULL) { + goto error; + } + protocol__progran_message__init(msg); + msg->msg_case = PROTOCOL__PROGRAN_MESSAGE__MSG_UE_STATE_CHANGE_MSG; + msg->msg_dir = PROTOCOL__PROGRAN_DIRECTION__INITIATING_MESSAGE; + msg->ue_state_change_msg = ue_state_change_msg; + + data = enb_agent_pack_message(msg, &size); + /*Send sr info using the MAC channel of the eNB*/ + if (enb_agent_msg_send(mod_id, ENB_AGENT_DEFAULT, data, size, priority)) { + err_code = PROTOCOL__PROGRAN_ERR__MSG_ENQUEUING; + goto error; + } + + LOG_D(ENB_AGENT,"sent message with size %d\n", size); + return; + error: + LOG_D(ENB_AGENT, "Could not send UE state message\n"); } int enb_agent_destroy_ue_state_change(Protocol__ProgranMessage *msg) { - /* TODO: Dealocate memory for a dynamically allocated UE state change message */ + if(msg->msg_case != PROTOCOL__PROGRAN_MESSAGE__MSG_UE_STATE_CHANGE_MSG) + goto error; + free(msg->ue_state_change_msg->header); + //TODO: Free the contents of the UE config structure + free(msg->ue_state_change_msg); + free(msg); return 0; + + error: + //LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); + return -1; } int enb_agent_destroy_enb_config_request(Protocol__ProgranMessage *msg) { diff --git a/openair2/ENB_APP/enb_agent_mac.c b/openair2/ENB_APP/enb_agent_mac.c index f31da89d81..5c279958fe 100644 --- a/openair2/ENB_APP/enb_agent_mac.c +++ b/openair2/ENB_APP/enb_agent_mac.c @@ -1266,7 +1266,7 @@ int enb_agent_register_mac_xface(mid_t mod_id, AGENT_MAC_xface *xface) { xface->enb_agent_send_sf_trigger = enb_agent_send_sf_trigger; xface->enb_agent_send_update_mac_stats = enb_agent_send_update_mac_stats; xface->enb_agent_schedule_ue_spec = schedule_ue_spec_default; - + xface->enb_agent_notify_ue_state_change = enb_agent_ue_state_change; mac_agent_registered[mod_id] = 1; agent_mac_xface[mod_id] = xface; diff --git a/openair2/ENB_APP/enb_agent_mac_defs.h b/openair2/ENB_APP/enb_agent_mac_defs.h index 6e960cdb69..657fc94fe4 100644 --- a/openair2/ENB_APP/enb_agent_mac_defs.h +++ b/openair2/ENB_APP/enb_agent_mac_defs.h @@ -62,6 +62,12 @@ typedef struct { void (*enb_agent_schedule_ue_spec)(mid_t mod_id, uint32_t frame, uint32_t subframe, int *mbsfn_flag, Protocol__ProgranMessage *dl_info); + + /// Notify the controller for a state change of a particular UE, by sending the proper + /// UE state change message (ACTIVATION, DEACTIVATION, HANDOVER) + void (*enb_agent_notify_ue_state_change)(mid_t mod_id, uint32_t rnti, + uint32_t state_change); + /*TODO: Fill in with the rest of the MAC layer technology specific callbacks (UL/DL scheduling, RACH info etc)*/ } AGENT_MAC_xface; From 02686ce804ffad77c279d1d7a85ea54399701f34 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Mon, 22 Feb 2016 15:29:10 +0000 Subject: [PATCH 109/349] Added temporary notification for the deactivation of a UE in the MAC --- openair2/LAYER2/MAC/eNB_scheduler.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/openair2/LAYER2/MAC/eNB_scheduler.c b/openair2/LAYER2/MAC/eNB_scheduler.c index a39b9efb54..774feda961 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler.c +++ b/openair2/LAYER2/MAC/eNB_scheduler.c @@ -135,6 +135,12 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, if (mac_xface->get_eNB_UE_stats(module_idP, CC_id, rnti)==NULL) { mac_remove_ue(module_idP, i, frameP, subframeP); + //Inform the controller about the UE deactivation. Should be moved to RRC agent in the future + if (mac_agent_registered[module_idP]) { + agent_mac_xface[module_idP]->enb_agent_notify_ue_state_change(module_idP, + rnti, + PROTOCOL__PRP_UE_STATE_CHANGE_TYPE__PRUESC_DEACTIVATED); + } } i = next_i; } From 71f64675816923d3a8d122e62b76d0a0120908bb Mon Sep 17 00:00:00 2001 From: Xiwen JIANG Date: Mon, 22 Feb 2016 17:28:50 +0100 Subject: [PATCH 110/349] adaption for lte-softmodem compilation --- openair1/PHY/LTE_TRANSPORT/proto.h | 2 +- openair1/PHY/TOOLS/lte_phy_scope.c | 2 +- targets/RT/USER/lte-softmodem.c | 28 ++++++++++++++-------------- targets/RT/USER/lte-ue.c | 2 +- targets/RT/USER/sched_rx_pdsch.c | 4 +++- targets/SIMU/USER/init_lte.c | 10 +++++----- 6 files changed, 25 insertions(+), 23 deletions(-) diff --git a/openair1/PHY/LTE_TRANSPORT/proto.h b/openair1/PHY/LTE_TRANSPORT/proto.h index bed82c0e68..416bff82c4 100644 --- a/openair1/PHY/LTE_TRANSPORT/proto.h +++ b/openair1/PHY/LTE_TRANSPORT/proto.h @@ -56,7 +56,7 @@ void free_eNB_dlsch(LTE_eNB_DLSCH_t *dlsch); void clean_eNb_dlsch(LTE_eNB_DLSCH_t *dlsch, uint8_t abstraction_flag); -/** \fn new_eNB_dlsch(uint8_t Kmimo,uint8_t Mdlharq,uint32_t Nsoft,uint8_t abstraction_flag) +/** \fn new_eNB_dlsch(uint8_t Kmimo,uint8_t Mdlharq,uint32_t Nsoft,uint8_t abstraction_flag, LTE_DL_FRAME_PARMS* frame_parms) \brief This function allocates structures for a particular DLSCH at eNB @returns Pointer to DLSCH to be removed @param Kmimo Kmimo factor from 36-212/36-213 diff --git a/openair1/PHY/TOOLS/lte_phy_scope.c b/openair1/PHY/TOOLS/lte_phy_scope.c index 736e3e5ed7..5efa4eee7b 100644 --- a/openair1/PHY/TOOLS/lte_phy_scope.c +++ b/openair1/PHY/TOOLS/lte_phy_scope.c @@ -491,7 +491,7 @@ void phy_scope_UE(FD_lte_phy_scope_ue *form, LTE_DL_FRAME_PARMS *frame_parms = &phy_vars_ue->lte_frame_parms; int nsymb_ce = frame_parms->ofdm_symbol_size;//*frame_parms->symbols_per_tti; uint8_t nb_antennas_rx = frame_parms->nb_antennas_rx; - uint8_t nb_antennas_tx = frame_parms->nb_antennas_ports_eNB; + uint8_t nb_antennas_tx = frame_parms->nb_antenna_ports_eNB; int16_t **rxsig_t; int16_t **chest_t; int16_t **chest_f; diff --git a/targets/RT/USER/lte-softmodem.c b/targets/RT/USER/lte-softmodem.c index baba632de1..cf1a374dae 100644 --- a/targets/RT/USER/lte-softmodem.c +++ b/targets/RT/USER/lte-softmodem.c @@ -2476,7 +2476,7 @@ static void get_options (int argc, char **argv) frame_parms[CC_id]->N_RB_DL = enb_properties->properties[i]->N_RB_DL[CC_id]; frame_parms[CC_id]->N_RB_UL = enb_properties->properties[i]->N_RB_DL[CC_id]; frame_parms[CC_id]->nb_antennas_tx = enb_properties->properties[i]->nb_antennas_tx[CC_id]; - frame_parms[CC_id]->nb_antennas_tx_eNB = enb_properties->properties[i]->nb_antennas_tx[CC_id]; + frame_parms[CC_id]->nb_antenna_ports_eNB = enb_properties->properties[i]->nb_antennas_tx[CC_id]; frame_parms[CC_id]->nb_antennas_rx = enb_properties->properties[i]->nb_antennas_rx[CC_id]; //} // j } @@ -2594,18 +2594,18 @@ int main( int argc, char **argv ) for (CC_id=0; CC_idframe_type = FDD; - frame_parms[CC_id]->tdd_config = 3; - frame_parms[CC_id]->tdd_config_S = 0; - frame_parms[CC_id]->N_RB_DL = 100; - frame_parms[CC_id]->N_RB_UL = 100; - frame_parms[CC_id]->Ncp = NORMAL; - frame_parms[CC_id]->Ncp_UL = NORMAL; - frame_parms[CC_id]->Nid_cell = Nid_cell; - frame_parms[CC_id]->num_MBSFN_config = 0; - frame_parms[CC_id]->nb_antennas_tx_eNB = 1; - frame_parms[CC_id]->nb_antennas_tx = 1; - frame_parms[CC_id]->nb_antennas_rx = 1; + frame_parms[CC_id]->frame_type = FDD; + frame_parms[CC_id]->tdd_config = 3; + frame_parms[CC_id]->tdd_config_S = 0; + frame_parms[CC_id]->N_RB_DL = 100; + frame_parms[CC_id]->N_RB_UL = 100; + frame_parms[CC_id]->Ncp = NORMAL; + frame_parms[CC_id]->Ncp_UL = NORMAL; + frame_parms[CC_id]->Nid_cell = Nid_cell; + frame_parms[CC_id]->num_MBSFN_config = 0; + frame_parms[CC_id]->nb_antenna_ports_eNB = 1; + frame_parms[CC_id]->nb_antennas_tx = 1; + frame_parms[CC_id]->nb_antennas_rx = 1; } for (CC_id=0; CC_idnb_antennas_tx = 1; frame_parms[CC_id]->nb_antennas_rx = 1; - frame_parms[CC_id]->nb_antennas_tx_eNB = (transmission_mode == 1) ? 1 : 2; //initial value overwritten by initial sync later + frame_parms[CC_id]->nb_antenna_ports_eNB = (transmission_mode == 1 || transmission_mode ==7) ? 1 : 2; //initial value overwritten by initial sync later } frame_parms[CC_id]->mode1_flag = (transmission_mode == 1) ? 1 : 0; diff --git a/targets/RT/USER/lte-ue.c b/targets/RT/USER/lte-ue.c index 6293ad4264..d5bc2c8ee9 100644 --- a/targets/RT/USER/lte-ue.c +++ b/targets/RT/USER/lte-ue.c @@ -1636,7 +1636,7 @@ void *UE_thread(void *arg) UE->lte_frame_parms.phich_config_common.phich_duration, UE->lte_frame_parms.phich_config_common.phich_resource, UE->lte_frame_parms.Nid_cell, - UE->lte_frame_parms.nb_antennas_tx_eNB, + UE->lte_frame_parms.nb_antenna_ports_eNB, freq_offset, UE->lte_ue_common_vars.freq_offset, UE->PHY_measurements.rx_power_avg_dB[0], diff --git a/targets/RT/USER/sched_rx_pdsch.c b/targets/RT/USER/sched_rx_pdsch.c index be1ffbd752..66224bcf92 100644 --- a/targets/RT/USER/sched_rx_pdsch.c +++ b/targets/RT/USER/sched_rx_pdsch.c @@ -156,7 +156,9 @@ static void * rx_pdsch_thread(void *param) get_Qm(UE->dlsch_ue[eNB_id][0]->harq_processes[harq_pid]->mcs), UE->dlsch_ue[eNB_id][0]->harq_processes[harq_pid]->Nl, UE->lte_ue_pdcch_vars[eNB_id]->num_pdcch_symbols, - UE->frame_rx,subframe); + UE->frame_rx, + subframe, + UE->transmission_mode[eNB_id]); if ((UE->transmission_mode[eNB_id] == 5) && (UE->dlsch_ue[eNB_id][0]->harq_processes[harq_pid]->dl_power_off==0) && diff --git a/targets/SIMU/USER/init_lte.c b/targets/SIMU/USER/init_lte.c index bbb99260eb..c031d34bca 100644 --- a/targets/SIMU/USER/init_lte.c +++ b/targets/SIMU/USER/init_lte.c @@ -76,7 +76,7 @@ PHY_VARS_eNB* init_lte_eNB(LTE_DL_FRAME_PARMS *frame_parms, for (i=0; idlsch_eNB[i][j] = new_eNB_dlsch(1,NUMBER_OF_HARQ_PID_MAX,NSOFT,frame_parms->N_RB_DL,abstraction_flag); + PHY_vars_eNB->dlsch_eNB[i][j] = new_eNB_dlsch(1,NUMBER_OF_HARQ_PID_MAX,NSOFT,frame_parms->N_RB_DL,abstraction_flag,frame_parms); if (!PHY_vars_eNB->dlsch_eNB[i][j]) { LOG_E(PHY,"Can't get eNB dlsch structures for UE %d \n", i); @@ -128,11 +128,11 @@ PHY_VARS_eNB* init_lte_eNB(LTE_DL_FRAME_PARMS *frame_parms, exit(-1); } - PHY_vars_eNB->dlsch_eNB_SI = new_eNB_dlsch(1,1,NSOFT,frame_parms->N_RB_DL, abstraction_flag); + PHY_vars_eNB->dlsch_eNB_SI = new_eNB_dlsch(1,1,NSOFT,frame_parms->N_RB_DL, abstraction_flag, frame_parms); LOG_D(PHY,"eNB %d : SI %p\n",eNB_id,PHY_vars_eNB->dlsch_eNB_SI); - PHY_vars_eNB->dlsch_eNB_ra = new_eNB_dlsch(1,1,NSOFT,frame_parms->N_RB_DL, abstraction_flag); + PHY_vars_eNB->dlsch_eNB_ra = new_eNB_dlsch(1,1,NSOFT,frame_parms->N_RB_DL, abstraction_flag, frame_parms); LOG_D(PHY,"eNB %d : RA %p\n",eNB_id,PHY_vars_eNB->dlsch_eNB_ra); - PHY_vars_eNB->dlsch_eNB_MCH = new_eNB_dlsch(1,NUMBER_OF_HARQ_PID_MAX,NSOFT,frame_parms->N_RB_DL, 0); + PHY_vars_eNB->dlsch_eNB_MCH = new_eNB_dlsch(1,NUMBER_OF_HARQ_PID_MAX,NSOFT,frame_parms->N_RB_DL, 0, frame_parms); LOG_D(PHY,"eNB %d : MCH %p\n",eNB_id,PHY_vars_eNB->dlsch_eNB_MCH); @@ -253,7 +253,7 @@ void init_lte_vars(LTE_DL_FRAME_PARMS *frame_parms[MAX_NUM_CCs], (frame_parms[CC_id])->Nid_cell = Nid_cell; (frame_parms[CC_id])->nushift = (Nid_cell%6); (frame_parms[CC_id])->nb_antennas_tx = (transmission_mode == 1) ? 1 : 2; - (frame_parms[CC_id])->nb_antennas_tx_eNB = (transmission_mode == 1) ? 1 : 2; + (frame_parms[CC_id])->nb_antenna_ports_eNB = (transmission_mode == 1 || transmission_mode == 7) ? 1 : 2; (frame_parms[CC_id])->nb_antennas_rx = (transmission_mode == 1) ? 1 : 2; (frame_parms[CC_id])->mode1_flag = (transmission_mode == 1) ? 1 : 0; From 7dd05df4ea724355fa80ea620db2ccba28f8ed0f Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Tue, 23 Feb 2016 10:29:53 +0000 Subject: [PATCH 111/349] Added configuration support for local cache --- openair2/ENB_APP/enb_agent.c | 8 ++++++++ openair2/ENB_APP/enb_agent_defs.h | 1 + openair2/ENB_APP/enb_agent_extern.h | 2 ++ openair2/ENB_APP/enb_config.c | 7 ++++++- openair2/ENB_APP/enb_config.h | 1 + .../CONF/enb.band7.agent.oaisim.local_no_mme.conf | 1 + 6 files changed, 19 insertions(+), 1 deletion(-) diff --git a/openair2/ENB_APP/enb_agent.c b/openair2/ENB_APP/enb_agent.c index c9c42a41d9..7d2029b37f 100644 --- a/openair2/ENB_APP/enb_agent.c +++ b/openair2/ENB_APP/enb_agent.c @@ -52,6 +52,7 @@ enb_agent_instance_t enb_agent[NUM_MAX_ENB]; char in_ip[40]; static uint16_t in_port; +char local_cache[40]; void *send_thread(void *args); void *receive_thread(void *args); @@ -203,6 +204,13 @@ int enb_agent_start(mid_t mod_id, const Enb_properties_array_t* enb_properties){ /* * check the configuration */ + if (enb_properties->properties[mod_id]->enb_agent_cache != NULL) { + strncpy(local_cache, enb_properties->properties[mod_id]->enb_agent_cache, sizeof(local_cache)); + local_cache[sizeof(local_cache) - 1] = 0; + } else { + strcpy(local_cache, DEFAULT_ENB_AGENT_CACHE); + } + if (enb_properties->properties[mod_id]->enb_agent_ipv4_address != NULL) { strncpy(in_ip, enb_properties->properties[mod_id]->enb_agent_ipv4_address, sizeof(in_ip) ); in_ip[sizeof(in_ip) - 1] = 0; // terminate string diff --git a/openair2/ENB_APP/enb_agent_defs.h b/openair2/ENB_APP/enb_agent_defs.h index 020c631ff1..9d1e3f75fc 100644 --- a/openair2/ENB_APP/enb_agent_defs.h +++ b/openair2/ENB_APP/enb_agent_defs.h @@ -47,6 +47,7 @@ #define NUM_MAX_UE 2048 #define DEFAULT_ENB_AGENT_IPv4_ADDRESS "127.0.0.1" #define DEFAULT_ENB_AGENT_PORT 2210 +#define DEFAULT_ENB_AGENT_CACHE "/mnt/tmpfs" typedef enum { diff --git a/openair2/ENB_APP/enb_agent_extern.h b/openair2/ENB_APP/enb_agent_extern.h index 1ef2250483..0dd7cfb90f 100644 --- a/openair2/ENB_APP/enb_agent_extern.h +++ b/openair2/ENB_APP/enb_agent_extern.h @@ -44,6 +44,8 @@ //extern msg_context_t shared_ctxt[NUM_MAX_ENB][ENB_AGENT_MAX]; +extern char local_cache[40]; + extern AGENT_MAC_xface *agent_mac_xface[NUM_MAX_ENB]; extern unsigned int mac_agent_registered[NUM_MAX_ENB]; diff --git a/openair2/ENB_APP/enb_config.c b/openair2/ENB_APP/enb_config.c index d5a70734fd..6983b8c2c6 100755 --- a/openair2/ENB_APP/enb_config.c +++ b/openair2/ENB_APP/enb_config.c @@ -174,6 +174,7 @@ #define ENB_CONFIG_STRING_ENB_AGENT_INTERFACE_NAME "ENB_AGENT_INTERFACE_NAME" #define ENB_CONFIG_STRING_ENB_AGENT_IPV4_ADDRESS "ENB_AGENT_IPV4_ADDRESS" #define ENB_CONFIG_STRING_ENB_AGENT_PORT "ENB_AGENT_PORT" +#define ENB_CONFIG_STRING_ENB_AGENT_CACHE "ENB_AGENT_CACHE" #define ENB_CONFIG_STRING_RRH_GW_CONFIG "rrh_gw_config" #define ENB_CONFIG_STRING_RRH_GW_LOCAL_IF_NAME "local_if_name" @@ -325,6 +326,7 @@ static void enb_config_display(void) printf( "\tInterface name: \t%s:\n",enb_properties.properties[i]->enb_agent_interface_name); printf( "\tInterface IP Address: \t%s:\n",enb_properties.properties[i]->enb_agent_ipv4_address); printf( "\tInterface PORT: \t%d:\n\n",enb_properties.properties[i]->enb_agent_port); + printf( "\tCache directory: \t%s:\n",enb_properties.properties[i]->enb_agent_cache); #endif @@ -641,6 +643,7 @@ const Enb_properties_array_t *enb_config_init(char* lib_config_file_name_pP) char* enb_agent_interface_name = NULL; char* enb_agent_ipv4_address = NULL; libconfig_int enb_agent_port = 0; + char* enb_agent_cache = NULL; libconfig_int otg_ue_id = 0; char* otg_app_type = NULL; char* otg_bg_traffic = NULL; @@ -2363,6 +2366,8 @@ const Enb_properties_array_t *enb_config_init(char* lib_config_file_name_pP) (const char **)&enb_agent_ipv4_address) && config_setting_lookup_int(subsetting, ENB_CONFIG_STRING_ENB_AGENT_PORT, &enb_agent_port) + && config_setting_lookup_string( subsetting, ENB_CONFIG_STRING_ENB_AGENT_CACHE, + (const char **)&enb_agent_cache) ) ) { enb_properties.properties[enb_properties_index]->enb_agent_interface_name = strdup(enb_agent_interface_name); @@ -2374,7 +2379,7 @@ const Enb_properties_array_t *enb_config_init(char* lib_config_file_name_pP) }*/ enb_properties.properties[enb_properties_index]->enb_agent_port = enb_agent_port; - + enb_properties.properties[enb_properties_index]->enb_agent_cache = strdup(enb_agent_cache); } } diff --git a/openair2/ENB_APP/enb_config.h b/openair2/ENB_APP/enb_config.h index 25b6c88479..2e873fdf52 100755 --- a/openair2/ENB_APP/enb_config.h +++ b/openair2/ENB_APP/enb_config.h @@ -224,6 +224,7 @@ typedef struct Enb_properties_s { char *enb_agent_interface_name; in_addr_t enb_agent_ipv4_address; tcp_udp_port_t enb_agent_port; + char *enb_agent_cache; /* Nb of RRH to connect to */ uint8_t nb_rrh_gw; diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.agent.oaisim.local_no_mme.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.agent.oaisim.local_no_mme.conf index 045a2855a0..578a2e3f2c 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.agent.oaisim.local_no_mme.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.agent.oaisim.local_no_mme.conf @@ -123,6 +123,7 @@ eNBs = ENB_AGENT_INTERFACE_NAME = "eth0"; ENB_AGENT_IPV4_ADDRESS = "127.0.0.1/24"; ENB_AGENT_PORT = 2210; + ENB_AGENT_CACHE = "/mnt/tmpfs"; }; log_config : From d8cc6d95e62d5b704891f73f77c67df297a8f59a Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Tue, 23 Feb 2016 10:47:08 +0000 Subject: [PATCH 112/349] Added support for control delegation and dynamic loading of libraries --- cmake_targets/CMakeLists.txt | 13 +++++++++---- .../ENB_APP/MESSAGES/V2/control_delegation.proto | 6 ++++++ openair2/ENB_APP/MESSAGES/V2/header.proto | 3 +++ openair2/ENB_APP/MESSAGES/V2/progran.proto | 13 +++++++++++++ 4 files changed, 31 insertions(+), 4 deletions(-) create mode 100644 openair2/ENB_APP/MESSAGES/V2/control_delegation.proto diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index 49d18c80f8..85a6f35339 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -796,6 +796,7 @@ if (ENB_AGENT_SB_IF) ${PRPT_MSG_DIR}/mac_primitives.proto ${PRPT_MSG_DIR}/config_messages.proto ${PRPT_MSG_DIR}/config_common.proto + ${PRPT_MSG_DIR}/control_delegation.proto ) set(PRPT_C_DIR ${protobuf_generated_dir}/${PRPTDIR}) @@ -812,6 +813,7 @@ if (ENB_AGENT_SB_IF) ${PRPT_C_DIR}/mac_primitives.pb-c.c ${PRPT_C_DIR}/config_messages.pb-c.c ${PRPT_C_DIR}/config_common.pb-c.c + ${PRPT_C_DIR}/control_delegation.pb-c.c ) file(GLOB prpt_h ${PRPT_C_DIR}/*.h) @@ -1109,6 +1111,9 @@ add_library(L2 ${ENB_APP_SRC} ${OPENAIR2_DIR}/RRC/L2_INTERFACE/openair_rrc_L2_interface.c) +#Test for adding a shared library +add_library(alt_sched SHARED ${MAC_DIR}/eNB_agent_scheduler_dlsch_ue_alt.c) + # L3 Libs ########################## @@ -1604,7 +1609,7 @@ target_link_libraries (lte-softmodem target_link_libraries (lte-softmodem ${LIBXML2_LIBRARIES}) -target_link_libraries (lte-softmodem pthread m ${CONFIG_LIBRARIES} rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${NETTLE_LIBRARIES} sctp ${option_HW_lib} ${option_TP_lib} ${XFORMS_LIBRARIES} ${PROTOBUF_LIB}) +target_link_libraries (lte-softmodem pthread m ${CONFIG_LIBRARIES} rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${NETTLE_LIBRARIES} sctp ${option_HW_lib} ${option_TP_lib} ${XFORMS_LIBRARIES} ${PROTOBUF_LIB} ${CMAKE_DL_LIBS}) target_link_libraries (lte-softmodem ${LIBBOOST_LIBRARIES}) target_link_libraries (lte-softmodem ${LIB_LMS_LIBRARIES}) @@ -1638,7 +1643,7 @@ target_link_libraries (lte-softmodem-nos1 -Wl,--end-group ) target_link_libraries (lte-softmodem-nos1 ${LIBXML2_LIBRARIES}) -target_link_libraries (lte-softmodem-nos1 pthread m ${CONFIG_LIBRARIES} rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${NETTLE_LIBRARIES} ${option_HW_lib} ${option_TP_lib} ${XFORMS_LIBRARIES} ${PROTOBUF_LIB}) +target_link_libraries (lte-softmodem-nos1 pthread m ${CONFIG_LIBRARIES} rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${NETTLE_LIBRARIES} ${option_HW_lib} ${option_TP_lib} ${XFORMS_LIBRARIES} ${PROTOBUF_LIB} ${CMAKE_DL_LIBS}) target_link_libraries (lte-softmodem-nos1 ${LIBBOOST_LIBRARIES}) target_link_libraries (lte-softmodem-nos1 ${LIB_LMS_LIBRARIES}) @@ -1770,12 +1775,12 @@ add_executable(oaisim_nos1 target_include_directories(oaisim_nos1 PUBLIC ${OPENAIR_TARGETS}/SIMU/USER) target_link_libraries (oaisim_nos1 -Wl,--start-group - RRC_LIB X2AP_LIB SECU_CN UTIL HASHTABLE SCHED_LIB PHY LFDS ${MSC_LIB} L2 ${RAL_LIB} SIMU SIMU_ETH SECU_OSA ${ITTI_LIB} ${MIH_LIB} ${PRPT_MSG_LIB} ${ASYNC_IF_LIB} ${ENB_AGENT_LIB} + RRC_LIB X2AP_LIB SECU_CN UTIL HASHTABLE SCHED_LIB PHY LFDS ${MSC_LIB} L2 ${RAL_LIB} SIMU SIMU_ETH SECU_OSA ${ITTI_LIB} ${MIH_LIB} ${PRPT_MSG_LIB} ${ASYNC_IF_LIB} ${ENB_AGENT_LIB} -Wl,--end-group ) target_link_libraries (oaisim_nos1 ${LIBXML2_LIBRARIES} ${LAPACK_LIBRARIES}) target_link_libraries (oaisim_nos1 pthread m ${CONFIG_LIBRARIES} rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${NETTLE_LIBRARIES} ${option_HW_lib} ${option_TP_lib} - ${ATLAS_LIBRARIES} ${XFORMS_LIBRARIES} ${OPENPGM_LIBRARIES} ${PROTOBUF_LIB}) + ${ATLAS_LIBRARIES} ${XFORMS_LIBRARIES} ${OPENPGM_LIBRARIES} ${PROTOBUF_LIB} ${CMAKE_DL_LIBS}) #Force link with forms, regardless XFORMS option target_link_libraries (oaisim_nos1 forms) diff --git a/openair2/ENB_APP/MESSAGES/V2/control_delegation.proto b/openair2/ENB_APP/MESSAGES/V2/control_delegation.proto new file mode 100644 index 0000000000..c5ce58d3a2 --- /dev/null +++ b/openair2/ENB_APP/MESSAGES/V2/control_delegation.proto @@ -0,0 +1,6 @@ +//'syntax = "proto2";' +package protocol; + +enum prp_control_delegation_type { + PRCDT_MAC_DL_UE_SCHEDULER = 1; // DL UE scheduler delegation +} \ No newline at end of file diff --git a/openair2/ENB_APP/MESSAGES/V2/header.proto b/openair2/ENB_APP/MESSAGES/V2/header.proto index 8e6adb1fda..6ce9959104 100644 --- a/openair2/ENB_APP/MESSAGES/V2/header.proto +++ b/openair2/ENB_APP/MESSAGES/V2/header.proto @@ -35,5 +35,8 @@ enum prp_type { // UE state change messages PRPT_UE_STATE_CHANGE = 14; + + // Control delegation messages + PRPT_DELEGATE_CONTROL = 15; } diff --git a/openair2/ENB_APP/MESSAGES/V2/progran.proto b/openair2/ENB_APP/MESSAGES/V2/progran.proto index 44fffc7ead..6b7b784629 100644 --- a/openair2/ENB_APP/MESSAGES/V2/progran.proto +++ b/openair2/ENB_APP/MESSAGES/V2/progran.proto @@ -6,6 +6,7 @@ import "header.proto"; import "time_common.proto"; import "config_messages.proto"; import "controller_commands.proto"; +import "control_delegation.proto"; message progran_message { optional progran_direction msg_dir = 100; @@ -25,6 +26,7 @@ message progran_message { prp_lc_config_reply lc_config_reply_msg = 13; prp_dl_mac_config dl_mac_config_msg = 14; prp_ue_state_change ue_state_change_msg = 15; + prp_control_delegation control_delegation_msg = 16; } } @@ -170,6 +172,17 @@ message prp_ue_state_change { optional prp_ue_config config = 3; // Body of the message (based on type) } +// +// Control delegation message +// + +message prp_control_delegation { + optional prp_header header = 1; + optional uint32 delegation_type = 2; // Bitmap of PRCDT_* flags + optional bytes payload = 3; // Byte array of shared lib containing the delegated functions + repeated string name = 4; // The delegated functions names ordered based on bitmap flags +} + // Extensions of the echo request and reply // messages for carrying a latency value in ms message prp_echo_request_latency { From 25e5e3b8378aab8090e650721a0c53ef3d4a9798 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Tue, 23 Feb 2016 11:08:14 +0000 Subject: [PATCH 113/349] Added script to automatically create cache for agent --- cmake_targets/tools/make_agent_cache | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100755 cmake_targets/tools/make_agent_cache diff --git a/cmake_targets/tools/make_agent_cache b/cmake_targets/tools/make_agent_cache new file mode 100755 index 0000000000..d2eab20fc0 --- /dev/null +++ b/cmake_targets/tools/make_agent_cache @@ -0,0 +1,21 @@ +#!/usr/bin/env bash + +CACHE_DIR=/mnt/oai_agent_cache + +if [ ! -d $CACHE_DIR ]; then + echo "Creating cache dir in $CACHE_DIR" + sudo mkdir $CACHE_DIR +fi + +if grep -qs "$CACHE_DIR" /proc/mounts; then + echo "Agent cache is already mounted" +else + echo "Agent cache was not mounted" + echo "Mounting..." + sudo mount -o size=100m -t tmpfs none "$CACHE_DIR" + if [ $? -eq 0 ]; then + echo "Mount success" + else + echo "Something went wrong with the mount" + fi +fi From 46724972062357e8323b03c40cdb13967e4a35d5 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Tue, 23 Feb 2016 12:56:09 +0000 Subject: [PATCH 114/349] Added support for DL UE scheduler control delegation --- openair2/ENB_APP/enb_agent_common.c | 74 +++++++++++++++++++ openair2/ENB_APP/enb_agent_common.h | 3 + openair2/ENB_APP/enb_agent_defs.h | 2 +- openair2/ENB_APP/enb_agent_handler.c | 2 + .../enb.band7.agent.oaisim.local_no_mme.conf | 2 +- 5 files changed, 81 insertions(+), 2 deletions(-) diff --git a/openair2/ENB_APP/enb_agent_common.c b/openair2/ENB_APP/enb_agent_common.c index 1e7efe920a..f4f8c333d0 100644 --- a/openair2/ENB_APP/enb_agent_common.c +++ b/openair2/ENB_APP/enb_agent_common.c @@ -34,8 +34,12 @@ * \version 0.1 */ +#include +#include +#include #include "enb_agent_common.h" +#include "enb_agent_extern.h" #include "PHY/extern.h" #include "log.h" @@ -703,6 +707,76 @@ int enb_agent_destroy_lc_config_request(Protocol__ProgranMessage *msg) { return 0; } +// call this function to start a nanosecond-resolution timer +struct timespec timer_start(){ + struct timespec start_time; + clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &start_time); + return start_time; +} + +// call this function to end a timer, returning nanoseconds elapsed as a long +long timer_end(struct timespec start_time){ + struct timespec end_time; + clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &end_time); + long diffInNanos = end_time.tv_nsec - start_time.tv_nsec; + return diffInNanos; +} + +int enb_agent_control_delegation(mid_t mod_id, const void *params, Protocol__ProgranMessage **msg) { + + Protocol__ProgranMessage *input = (Protocol__ProgranMessage *)params; + Protocol__PrpControlDelegation *control_delegation_msg = input->control_delegation_msg; + + uint32_t delegation_type = control_delegation_msg->delegation_type; + + void *lib; + int i; + + struct timespec vartime = timer_start(); + + //Write the payload lib into a file in the cache and load the lib + char lib_name[120]; + char target[512]; + snprintf(lib_name, sizeof(lib_name), "/delegation_lib_%d.so", control_delegation_msg->header->xid); + strcpy(target, local_cache); + strcat(target, lib_name); + + FILE *f; + f = fopen(target, "wb"); + fwrite(control_delegation_msg->payload.data, control_delegation_msg->payload.len, 1, f); + fclose(f); + lib = dlopen(target, RTLD_NOW); + if (lib == NULL) { + goto error; + } + + i = 0; + //Check functions that need to be delegated + + //DL UE scheduler delegation + if (delegation_type & PROTOCOL__PRP_CONTROL_DELEGATION_TYPE__PRCDT_MAC_DL_UE_SCHEDULER) { + void *loaded_scheduler = dlsym(lib, control_delegation_msg->name[i]); + i++; + if (loaded_scheduler) { + if (mac_agent_registered[mod_id]) { + agent_mac_xface[mod_id]->enb_agent_schedule_ue_spec = loaded_scheduler; + LOG_D(ENB_APP,"Delegated control for DL UE scheduler successfully\n"); + } + } + } + long time_elapsed_nanos = timer_end(vartime); + LOG_I(ENB_AGENT, "DID IT IN %lld\n", time_elapsed_nanos); + *msg = NULL; + return 0; + + error: + return -1; +} + +int enb_agent_destroy_control_delegation(Protocol__ProgranMessage *msg) { + /*TODO: Dealocate memory for a dynamically allocated control delegation message*/ +} + /* * get generic info from RAN */ diff --git a/openair2/ENB_APP/enb_agent_common.h b/openair2/ENB_APP/enb_agent_common.h index 6a31094417..73ce0ec788 100644 --- a/openair2/ENB_APP/enb_agent_common.h +++ b/openair2/ENB_APP/enb_agent_common.h @@ -111,6 +111,9 @@ int enb_agent_destroy_lc_config_request(Protocol__ProgranMessage *msg); int enb_agent_ue_state_change(mid_t mod_id, uint32_t rnti, uint8_t state_change); int enb_agent_destroy_ue_state_change(Protocol__ProgranMessage *msg); +int enb_agent_control_delegation(mid_t mod_id, const void *params, Protocol__ProgranMessage **msg); +int enb_agent_destroy_control_delegation(Protocol__ProgranMessage *msg); + Protocol__ProgranMessage* enb_agent_handle_message (mid_t mod_id, uint8_t *data, uint32_t size); diff --git a/openair2/ENB_APP/enb_agent_defs.h b/openair2/ENB_APP/enb_agent_defs.h index 9d1e3f75fc..8d71aa2db3 100644 --- a/openair2/ENB_APP/enb_agent_defs.h +++ b/openair2/ENB_APP/enb_agent_defs.h @@ -47,7 +47,7 @@ #define NUM_MAX_UE 2048 #define DEFAULT_ENB_AGENT_IPv4_ADDRESS "127.0.0.1" #define DEFAULT_ENB_AGENT_PORT 2210 -#define DEFAULT_ENB_AGENT_CACHE "/mnt/tmpfs" +#define DEFAULT_ENB_AGENT_CACHE "/mnt/oai_agent_cache" typedef enum { diff --git a/openair2/ENB_APP/enb_agent_handler.c b/openair2/ENB_APP/enb_agent_handler.c index 2162a29314..d4e5706b11 100644 --- a/openair2/ENB_APP/enb_agent_handler.c +++ b/openair2/ENB_APP/enb_agent_handler.c @@ -57,6 +57,7 @@ enb_agent_message_decoded_callback agent_messages_callback[][3] = { {0, 0, 0}, /*PROTOCOL__PROGRAN_MESSAGE__MSG_LC_CONFIG_REPLY_MSG*/ {0, 0, 0}, /*PROTOCOL__PROGRAN_MESSAGE__MSG_DL_MAC_CONFIG_MSG*/ {0, 0, 0}, /*PROTOCOL__PROGRAN_MESSAGE__MSG_UE_STATE_CHANGE_MSG*/ + {enb_agent_control_delegation, 0, 0}, /*PROTOCOL__PROGRAN_MESSAGE__MSG_CONTROL_DELEGATION_MSG*/ }; @@ -76,6 +77,7 @@ enb_agent_message_destruction_callback message_destruction_callback[] = { enb_agent_destroy_lc_config_reply, enb_agent_mac_destroy_dl_config, enb_agent_destroy_ue_state_change, + enb_agent_destroy_control_delegation, }; static const char *enb_agent_direction2String[] = { diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.agent.oaisim.local_no_mme.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.agent.oaisim.local_no_mme.conf index 578a2e3f2c..f95cfd9389 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.agent.oaisim.local_no_mme.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.agent.oaisim.local_no_mme.conf @@ -123,7 +123,7 @@ eNBs = ENB_AGENT_INTERFACE_NAME = "eth0"; ENB_AGENT_IPV4_ADDRESS = "127.0.0.1/24"; ENB_AGENT_PORT = 2210; - ENB_AGENT_CACHE = "/mnt/tmpfs"; + ENB_AGENT_CACHE = "/mnt/oai_agent_cache"; }; log_config : From 0ec3cfdf04ab7b63aeb7a787136b86c19499ad67 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Tue, 23 Feb 2016 14:18:49 +0000 Subject: [PATCH 115/349] Added UE and LC config API function calls --- openair2/ENB_APP/enb_agent_common.c | 709 +++++++++++++++++----------- openair2/ENB_APP/enb_agent_common.h | 56 +++ openair2/LAYER2/MAC/extern.h | 2 + 3 files changed, 499 insertions(+), 268 deletions(-) diff --git a/openair2/ENB_APP/enb_agent_common.c b/openair2/ENB_APP/enb_agent_common.c index f4f8c333d0..4a175c244e 100644 --- a/openair2/ENB_APP/enb_agent_common.c +++ b/openair2/ENB_APP/enb_agent_common.c @@ -47,6 +47,7 @@ void * enb[NUM_MAX_ENB]; void * enb_ue[NUM_MAX_ENB]; void * enb_rrc[NUM_MAX_ENB]; +void * enb_ue_rrc[NUM_MAX_ENB]; /* * message primitives */ @@ -296,170 +297,6 @@ int enb_agent_destroy_enb_config_reply(Protocol__ProgranMessage *msg) { return -1; } -int enb_agent_ue_config_reply(mid_t mod_id, const void *params, Protocol__ProgranMessage **msg) { - - xid_t xid; - Protocol__ProgranMessage *input = (Protocol__ProgranMessage *)params; - Protocol__PrpUeConfigRequest *ue_config_request_msg = input->ue_config_request_msg; - xid = (ue_config_request_msg->header)->xid; - - int i; - - Protocol__PrpHeader *header; - if(prp_create_header(xid, PROTOCOL__PRP_TYPE__PRPT_GET_UE_CONFIG_REPLY, &header) != 0) - goto error; - - Protocol__PrpUeConfigReply *ue_config_reply_msg; - ue_config_reply_msg = malloc(sizeof(Protocol__PrpUeConfigReply)); - if(ue_config_reply_msg == NULL) - goto error; - protocol__prp_enb_config_reply__init(ue_config_reply_msg); - ue_config_reply_msg->header = header; - - //TODO: Fill in the actual number of UEs that are currently connected - ue_config_reply_msg->n_ue_config = 1; - - Protocol__PrpUeConfig **ue_config; - if (ue_config_reply_msg->n_ue_config > 0) { - ue_config = malloc(sizeof(Protocol__PrpUeConfig *) * ue_config_reply_msg->n_ue_config); - if (ue_config == NULL) { - goto error; - } - for (i = 0; i < ue_config_reply_msg->n_ue_config; i++) { - ue_config[i] = malloc(sizeof(Protocol__PrpUeConfig)); - protocol__prp_ue_config__init(ue_config[i]); - //TODO: Set the RNTI of the ue with id i - ue_config[i]->rnti = 1; - ue_config[i]->has_rnti = 1; - //TODO: Set the DRX configuration (optional) - //Not supported for now, so we do not set it - - //TODO: Set the time_alignment_timer - ue_config[i]->time_alignment_timer = 1; - ue_config[i]->has_time_alignment_timer = 1; - //TODO: Set the measurement gap configuration pattern - ue_config[i]->meas_gap_config_pattern = 1; - ue_config[i]->has_meas_gap_config_pattern = 1; - //TODO: Set the measurement gap offset if applicable - ue_config[i]->meas_gap_config_sf_offset = 1; - ue_config[i]->has_meas_gap_config_sf_offset = 1; - //TODO: Set the SPS configuration (Optional) - //Not supported for noe, so we do not set it - - //TODO: Set the SR configuration (Optional) - //We do not set it for now - - //TODO: Set the CQI configuration (Optional) - //We do not set it for now - - //TODO: Set the transmission mode - ue_config[i]->transmission_mode = 1; - ue_config[i]->has_transmission_mode = 1; - - //TODO: Set the aggregated bit-rate of the non-gbr bearer (UL) - ue_config[i]->ue_aggregated_max_bitrate_ul = 1; - ue_config[i]->has_ue_aggregated_max_bitrate_ul = 1; - - //TODO: Set the aggregated bit-rate of the non-gbr bearer (DL) - ue_config[i]->ue_aggregated_max_bitrate_dl = 1; - ue_config[i]->has_ue_aggregated_max_bitrate_dl = 1; - - //TODO: Set the UE capabilities - Protocol__PrpUeCapabilities *capabilities; - capabilities = malloc(sizeof(Protocol__PrpUeCapabilities)); - protocol__prp_ue_capabilities__init(capabilities); - //TODO: Set half duplex (FDD operation) - capabilities->has_half_duplex = 1; - capabilities->half_duplex = 1; - //TODO: Set intra-frame hopping flag - capabilities->has_intra_sf_hopping = 1; - capabilities->intra_sf_hopping = 1; - //TODO: Set support for type 2 hopping with n_sb > 1 - capabilities->has_type2_sb_1 = 1; - capabilities->type2_sb_1 = 1; - //TODO: Set ue category - capabilities->has_ue_category = 1; - capabilities->ue_category = 1; - //TODO: Set UE support for resource allocation type 1 - capabilities->has_res_alloc_type1 = 1; - capabilities->res_alloc_type1 = 1; - //Set the capabilites to the message - ue_config[i]->capabilities = capabilities; - //TODO: Set UE transmission antenna. One of the PRUTA_* values - ue_config[i]->has_ue_transmission_antenna = 1; - ue_config[i]->ue_transmission_antenna = PROTOCOL__PRP_UE_TRANSMISSION_ANTENNA__PRUTA_OPEN_LOOP; - //TODO: Set tti bundling flag (See ts 36.321) - ue_config[i]->has_tti_bundling = 1; - ue_config[i]->tti_bundling = 1; - //TODO: Set the max HARQ retransmission for the UL - ue_config[i]->has_max_harq_tx = 1; - ue_config[i]->max_harq_tx = 1; - //TODO: Fill beta_offset_ack_index (TS 36.213) - ue_config[i]->has_beta_offset_ack_index = 1; - ue_config[i]->beta_offset_ack_index = 1; - //TODO: Fill beta_offset_ri_index (TS 36.213) - ue_config[i]->has_beta_offset_ri_index = 1; - ue_config[i]->beta_offset_ri_index = 1; - //TODO: Fill beta_offset_cqi_index (TS 36.213) - ue_config[i]->has_beta_offset_cqi_index = 1; - ue_config[i]->beta_offset_cqi_index = 1; - //TODO: Fill ack_nack_simultaneous_trans (TS 36.213) - ue_config[i]->has_ack_nack_simultaneous_trans = 1; - ue_config[i]->ack_nack_simultaneous_trans = 1; - //TODO: Fill simultaneous_ack_nack_cqi (TS 36.213) - ue_config[i]->has_simultaneous_ack_nack_cqi = 1; - ue_config[i]->simultaneous_ack_nack_cqi = 1; - //TODO: Set PRACRM_* value regarding aperiodic cqi report mode - ue_config[i]->has_aperiodic_cqi_rep_mode = 1; - ue_config[i]->aperiodic_cqi_rep_mode = PROTOCOL__PRP_APERIODIC_CQI_REPORT_MODE__PRACRM_RM12; - //TODO: Set tdd_ack_nack_feedback - ue_config[i]->has_tdd_ack_nack_feedback = 1; - ue_config[i]->tdd_ack_nack_feedback = 1; - //TODO: Set ack_nack_repetition factor - ue_config[i]->has_ack_nack_repetition_factor = 1; - ue_config[i]->ack_nack_repetition_factor = 1; - //TODO: Set extended BSR size - ue_config[i]->has_extended_bsr_size = 1; - ue_config[i]->extended_bsr_size = 1; - //TODO: Set carrier aggregation support (boolean) - ue_config[i]->has_ca_support = 1; - ue_config[i]->ca_support = 0; - //TODO: Set cross carrier scheduling support (boolean) - ue_config[i]->has_cross_carrier_sched_support = 1; - ue_config[i]->cross_carrier_sched_support = 0; - //TODO: Set index of primary cell - ue_config[i]->has_pcell_carrier_index = 1; - ue_config[i]->pcell_carrier_index = 1; - //TODO: Set secondary cells configuration - // We do not set it for now. No carrier aggregation support - - //TODO: Set deactivation timer for secondary cell - ue_config[i]->has_scell_deactivation_timer = 1; - ue_config[i]->scell_deactivation_timer = 1; - } - ue_config_reply_msg->ue_config = ue_config; - } - *msg = malloc(sizeof(Protocol__ProgranMessage)); - if (*msg == NULL) - goto error; - protocol__progran_message__init(*msg); - (*msg)->msg_case = PROTOCOL__PROGRAN_MESSAGE__MSG_UE_CONFIG_REPLY_MSG; - (*msg)->msg_dir = PROTOCOL__PROGRAN_DIRECTION__SUCCESSFUL_OUTCOME; - (*msg)->ue_config_reply_msg = ue_config_reply_msg; - return 0; - - error: - // TODO: Need to make proper error handling - if (header != NULL) - free(header); - if (ue_config_reply_msg != NULL) - free(ue_config_reply_msg); - if(*msg != NULL) - free(*msg); - //LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); - return -1; -} - int enb_agent_destroy_ue_config_reply(Protocol__ProgranMessage *msg) { if(msg->msg_case != PROTOCOL__PROGRAN_MESSAGE__MSG_UE_CONFIG_REPLY_MSG) goto error; @@ -481,110 +318,6 @@ int enb_agent_destroy_ue_config_reply(Protocol__ProgranMessage *msg) { return -1; } -int enb_agent_lc_config_reply(mid_t mod_id, const void *params, Protocol__ProgranMessage **msg) { - - xid_t xid; - Protocol__ProgranMessage *input = (Protocol__ProgranMessage *)params; - Protocol__PrpLcConfigRequest *lc_config_request_msg = input->lc_config_request_msg; - xid = (lc_config_request_msg->header)->xid; - - int i, j; - Protocol__PrpHeader *header; - if(prp_create_header(xid, PROTOCOL__PRP_TYPE__PRPT_GET_LC_CONFIG_REPLY, &header) != 0) - goto error; - - Protocol__PrpLcConfigReply *lc_config_reply_msg; - lc_config_reply_msg = malloc(sizeof(Protocol__PrpLcConfigReply)); - if(lc_config_reply_msg == NULL) - goto error; - protocol__prp_lc_config_reply__init(lc_config_reply_msg); - lc_config_reply_msg->header = header; - - //TODO: Fill in the actual number of UEs that we are going to report LC configs about - lc_config_reply_msg->n_lc_ue_config = 1; - - Protocol__PrpLcUeConfig **lc_ue_config; - if (lc_config_reply_msg->n_lc_ue_config > 0) { - lc_ue_config = malloc(sizeof(Protocol__PrpLcUeConfig *) * lc_config_reply_msg->n_lc_ue_config); - if (lc_ue_config == NULL) { - goto error; - } - // Fill the config for each UE - for (i = 0; i < lc_config_reply_msg->n_lc_ue_config; i++) { - lc_ue_config[i] = malloc(sizeof(Protocol__PrpLcUeConfig)); - protocol__prp_lc_ue_config__init(lc_ue_config[i]); - //TODO: Set the RNTI of the UE - lc_ue_config[i]->has_rnti = 1; - lc_ue_config[i]->rnti = 1; - //TODO: Set the number of LC configurations that will be reported for this UE - lc_ue_config[i]->n_lc_config = 3; - Protocol__PrpLcConfig **lc_config; - if (lc_ue_config[i]->n_lc_config > 0) { - lc_config = malloc(sizeof(Protocol__PrpLcConfig *) * lc_ue_config[i]->n_lc_config); - if (lc_config == NULL) { - goto error; - } - for (j = 0; j < lc_ue_config[i]->n_lc_config; j++) { - lc_config[j] = malloc(sizeof(Protocol__PrpLcConfig)); - protocol__prp_lc_config__init(lc_config[j]); - //TODO: Set the LC id - lc_config[j]->has_lcid = 1; - lc_config[j]->lcid = 1; - //TODO: Set the LCG of the channel - lc_config[j]->has_lcg = 1; - lc_config[j]->lcg = 1; - //TODO: Set the LC direction - lc_config[j]->has_direction = 1; - lc_config[j]->direction = PROTOCOL__PRP_LC_DIRECTION__PRLCD_BOTH; - //TODO: Bearer type. One of PRQBT_* values - lc_config[j]->has_qos_bearer_type = 1; - lc_config[j]->qos_bearer_type = PROTOCOL__PRP_QOS_BEARER_TYPE__PRQBT_NON_GBR; - //TODO: Set the QCI defined in TS 23.203, coded as defined in TS 36.413 - // One less than the actual QCI value - lc_config[j]->has_qci = 1; - lc_config[j]->qci = 1; - if (lc_config[j]->direction == PROTOCOL__PRP_QOS_BEARER_TYPE__PRQBT_GBR) { - //TODO: Set the max bitrate (UL) - lc_config[j]->has_e_rab_max_bitrate_ul = 1; - lc_config[j]->e_rab_max_bitrate_ul = 1; - //TODO: Set the max bitrate (DL) - lc_config[j]->has_e_rab_max_bitrate_dl = 1; - lc_config[j]->e_rab_max_bitrate_dl = 1; - //TODO: Set the guaranteed bitrate (UL) - lc_config[j]->has_e_rab_guaranteed_bitrate_ul = 1; - lc_config[j]->e_rab_guaranteed_bitrate_ul = 1; - //TODO: Set the guaranteed bitrate (DL) - lc_config[j]->has_e_rab_guaranteed_bitrate_dl = 1; - lc_config[j]->e_rab_guaranteed_bitrate_dl = 1; - } - } - lc_ue_config[i]->lc_config = lc_config; - } - } // end for UE - lc_config_reply_msg->lc_ue_config = lc_ue_config; - } // lc_config_reply_msg->n_lc_ue_config > 0 - *msg = malloc(sizeof(Protocol__ProgranMessage)); - if (*msg == NULL) - goto error; - protocol__progran_message__init(*msg); - (*msg)->msg_case = PROTOCOL__PROGRAN_MESSAGE__MSG_LC_CONFIG_REPLY_MSG; - (*msg)->msg_dir = PROTOCOL__PROGRAN_DIRECTION__SUCCESSFUL_OUTCOME; - (*msg)->lc_config_reply_msg = lc_config_reply_msg; - - return 0; - - error: - // TODO: Need to make proper error handling - if (header != NULL) - free(header); - if (lc_config_reply_msg != NULL) - free(lc_config_reply_msg); - if(*msg != NULL) - free(*msg); - //LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); - return -1; -} - int enb_agent_destroy_lc_config_reply(Protocol__ProgranMessage *msg) { if(msg->msg_case != PROTOCOL__PROGRAN_MESSAGE__MSG_LC_CONFIG_REPLY_MSG) goto error; @@ -788,6 +521,7 @@ void set_enb_vars(mid_t mod_id, ran_name_t ran){ enb[mod_id] = (void *)&eNB_mac_inst[mod_id]; enb_ue[mod_id] = (void *)&eNB_mac_inst[mod_id].UE_list; enb_rrc[mod_id] = (void *)&eNB_rrc_inst[mod_id]; + enb_ue_rrc[mod_id] = (void *)&UE_rrc_inst[mod_id]; break; default : goto error; @@ -1157,10 +891,449 @@ int get_num_pdcch_symb(mid_t mod_id, int CC_id) return (PHY_vars_UE_g[mod_id][CC_id]->lte_ue_pdcch_vars[mod_id]->num_pdcch_symbols); } +/* + * ************************************ + * Get Messages for UE Configuration Reply + * ************************************ + */ + +int get_time_alignment_timer(mid_t mod_id, mid_t ue_id) +{ + return (((UE_RRC_INST *)enb_ue_rrc[ue_id])->mac_MainConfig[mod_id]->timeAlignmentTimerDedicated); +} + +int get_meas_gap_config(mid_t mod_id, mid_t ue_id) +{ + if(((UE_RRC_INST *)enb_ue_rrc[ue_id])->measGapConfig[mod_id]->present == MeasGapConfig_PR_NOTHING) + return 2; + else if(((UE_RRC_INST *)enb_ue_rrc[ue_id])->measGapConfig[mod_id]->present == MeasGapConfig_PR_release) + return 0; + else if(((UE_RRC_INST *)enb_ue_rrc[ue_id])->measGapConfig[mod_id]->present == MeasGapConfig_PR_setup) + return 1; + + return -1; +} + +int get_meas_gap_config_offset(mid_t mod_id, mid_t ue_id) +{ + return (((UE_RRC_INST *)enb_ue_rrc[ue_id])->measGapConfig[mod_id]->choice.setup.gapOffset.present); +} + +int get_ue_aggregated_max_bitrate_dl (mid_t mod_id, mid_t ue_id) +{ + return ((UE_list_t *)enb_ue[mod_id])->UE_sched_ctrl[ue_id].ue_AggregatedMaximumBitrateDL; +} + +int get_ue_aggregated_max_bitrate_ul (mid_t mod_id, mid_t ue_id) +{ + return ((UE_list_t *)enb_ue[mod_id])->UE_sched_ctrl[ue_id].ue_AggregatedMaximumBitrateUL; +} + +int get_half_duplex(mid_t ue_id) +{ + int halfduplex = 0; + int bands_to_scan = ((UE_RRC_INST *)enb_ue_rrc[ue_id])->UECap->UE_EUTRA_Capability->rf_Parameters.supportedBandListEUTRA.list.count; + for (int i =0; i < bands_to_scan; i++){ + if(((UE_RRC_INST *)enb_ue_rrc[ue_id])->UECap->UE_EUTRA_Capability->rf_Parameters.supportedBandListEUTRA.list.array[i]->halfDuplex > 0) + halfduplex = 1; + } + return halfduplex; +} + +int get_intra_sf_hopping(mid_t ue_id) +{ + uint8_t temp = 0; + temp = (((UE_RRC_INST *)enb_ue_rrc[ue_id])->UECap->UE_EUTRA_Capability->featureGroupIndicators->buf); + return (temp & ( 1 << (31))); +} + +int get_type2_sb_1(mid_t ue_id) +{ + uint8_t temp = 0; + temp = (((UE_RRC_INST *)enb_ue_rrc[ue_id])->UECap->UE_EUTRA_Capability->featureGroupIndicators->buf); + return (temp & ( 1 << (11))); +} + +int get_ue_category(mid_t ue_id) +{ + return (((UE_RRC_INST *)enb_ue_rrc[ue_id])->UECap->UE_EUTRA_Capability->ue_Category); +} + +int get_res_alloc_type1(mid_t ue_id) +{ + uint8_t temp = 0; + temp = (((UE_RRC_INST *)enb_ue_rrc[ue_id])->UECap->UE_EUTRA_Capability->featureGroupIndicators->buf); + return (temp & ( 1 << (30))); +} + +int get_ue_transmission_mode(mid_t mod_id, mid_t ue_id) +{ + return (((UE_RRC_INST *)enb_ue_rrc[ue_id])->physicalConfigDedicated[mod_id]->antennaInfo->choice.explicitValue.transmissionMode); +} + +int get_tti_bundling(mid_t mod_id, mid_t ue_id) +{ + return (((UE_RRC_INST *)enb_ue_rrc[ue_id])->mac_MainConfig[mod_id]->ul_SCH_Config->ttiBundling); +} + +int get_maxHARQ_TX(mid_t mod_id, mid_t ue_id) +{ + return (((UE_RRC_INST *)enb_ue_rrc[ue_id])->mac_MainConfig[mod_id]->ul_SCH_Config->maxHARQ_Tx); +} + +int get_beta_offset_ack_index(mid_t mod_id, mid_t ue_id) +{ + return (((UE_RRC_INST *)enb_ue_rrc[ue_id])->physicalConfigDedicated[mod_id]->pusch_ConfigDedicated->betaOffset_ACK_Index); +} + +int get_beta_offset_ri_index(mid_t mod_id, mid_t ue_id) +{ + return (((UE_RRC_INST *)enb_ue_rrc[ue_id])->physicalConfigDedicated[mod_id]->pusch_ConfigDedicated->betaOffset_RI_Index); +} + +int get_beta_offset_cqi_index(mid_t mod_id, mid_t ue_id) +{ + return (((UE_RRC_INST *)enb_ue_rrc[ue_id])->physicalConfigDedicated[mod_id]->pusch_ConfigDedicated->betaOffset_CQI_Index); +} + +int get_simultaneous_ack_nack_cqi(mid_t mod_id, mid_t ue_id) +{ + return (((UE_RRC_INST *)enb_ue_rrc[ue_id])->physicalConfigDedicated[mod_id]->cqi_ReportConfig->cqi_ReportPeriodic->choice.setup.simultaneousAckNackAndCQI); +} + +int get_ack_nack_simultaneous_trans(mid_t mod_id,mid_t ue_id) +{ + return (((UE_RRC_INST *)enb_ue_rrc[ue_id])->sib2[mod_id]->radioResourceConfigCommon.soundingRS_UL_ConfigCommon.choice.setup.ackNackSRS_SimultaneousTransmission); +} + +int get_aperiodic_cqi_rep_mode(mid_t mod_id,mid_t ue_id) +{ + return (((UE_RRC_INST *)enb_ue_rrc[ue_id])->physicalConfigDedicated[mod_id]->cqi_ReportConfig->cqi_ReportModeAperiodic); +} + +int get_tdd_ack_nack_feedback(mid_t mod_id, mid_t ue_id) +{ + return (((UE_RRC_INST *)enb_ue_rrc[ue_id])->physicalConfigDedicated[mod_id]->pucch_ConfigDedicated->tdd_AckNackFeedbackMode); +} + +int get_ack_nack_repetition_factor(mid_t mod_id, mid_t ue_id) +{ + return (((UE_RRC_INST *)enb_ue_rrc[ue_id])->physicalConfigDedicated[mod_id]->pucch_ConfigDedicated->ackNackRepetition.choice.setup.repetitionFactor); +} + +int get_extended_bsr_size(mid_t mod_id, mid_t ue_id) +{ + //TODO: need to double check + return (((UE_RRC_INST *)enb_ue_rrc[ue_id])->mac_MainConfig[mod_id]->ext2->mac_MainConfig_v1020->extendedBSR_Sizes_r10); +} + +int get_ue_transmission_antenna(mid_t mod_id, mid_t ue_id) +{ + if(((UE_RRC_INST *)enb_ue_rrc[ue_id])->physicalConfigDedicated[mod_id]->antennaInfo->choice.explicitValue.ue_TransmitAntennaSelection.choice.setup == AntennaInfoDedicated__ue_TransmitAntennaSelection__setup_closedLoop) + return 2; + else if(((UE_RRC_INST *)enb_ue_rrc[ue_id])->physicalConfigDedicated[mod_id]->antennaInfo->choice.explicitValue.ue_TransmitAntennaSelection.choice.setup == AntennaInfoDedicated__ue_TransmitAntennaSelection__setup_openLoop) + return 1; + else + return 0; +} + +int get_lcg(mid_t ue_id, mid_t lc_id) +{ + return &UE_mac_inst[ue_id].logicalChannelConfig[lc_id]->ul_SpecificParameters->logicalChannelGroup; +} + +int get_direction(mid_t ue_id, mid_t lc_id) +{ + /*TODO: fill with the value for the rest of LCID*/ + + if(lc_id == CCCH | lc_id == DCCH) + return 2; + else if(lc_id == DTCH) + return 1; +} + + /* * timer primitives */ +int enb_agent_lc_config_reply(mid_t mod_id, const void *params, Protocol__ProgranMessage **msg) { + + xid_t xid; + Protocol__ProgranMessage *input = (Protocol__ProgranMessage *)params; + Protocol__PrpLcConfigRequest *lc_config_request_msg = input->lc_config_request_msg; + xid = (lc_config_request_msg->header)->xid; + + int i, j; + Protocol__PrpHeader *header; + if(prp_create_header(xid, PROTOCOL__PRP_TYPE__PRPT_GET_LC_CONFIG_REPLY, &header) != 0) + goto error; + + Protocol__PrpLcConfigReply *lc_config_reply_msg; + lc_config_reply_msg = malloc(sizeof(Protocol__PrpLcConfigReply)); + if(lc_config_reply_msg == NULL) + goto error; + protocol__prp_lc_config_reply__init(lc_config_reply_msg); + lc_config_reply_msg->header = header; + + //TODO: Fill in the actual number of UEs that we are going to report LC configs about + lc_config_reply_msg->n_lc_ue_config = get_num_ues(mod_id); + + Protocol__PrpLcUeConfig **lc_ue_config; + if (lc_config_reply_msg->n_lc_ue_config > 0) { + lc_ue_config = malloc(sizeof(Protocol__PrpLcUeConfig *) * lc_config_reply_msg->n_lc_ue_config); + if (lc_ue_config == NULL) { + goto error; + } + // Fill the config for each UE + for (i = 0; i < lc_config_reply_msg->n_lc_ue_config; i++) { + lc_ue_config[i] = malloc(sizeof(Protocol__PrpLcUeConfig)); + protocol__prp_lc_ue_config__init(lc_ue_config[i]); + //TODO: Set the RNTI of the UE + lc_ue_config[i]->has_rnti = 1; + lc_ue_config[i]->rnti = get_ue_crnti(mod_id,i); + //TODO: Set the number of LC configurations that will be reported for this UE + lc_ue_config[i]->n_lc_config = 3; + Protocol__PrpLcConfig **lc_config; + if (lc_ue_config[i]->n_lc_config > 0) { + lc_config = malloc(sizeof(Protocol__PrpLcConfig *) * lc_ue_config[i]->n_lc_config); + if (lc_config == NULL) { + goto error; + } + for (j = 0; j < lc_ue_config[i]->n_lc_config; j++) { + lc_config[j] = malloc(sizeof(Protocol__PrpLcConfig)); + protocol__prp_lc_config__init(lc_config[j]); + //TODO: Set the LC id + lc_config[j]->has_lcid = 1; + lc_config[j]->lcid = j+1; + //TODO: Set the LCG of the channel + lc_config[j]->has_lcg = 1; + lc_config[j]->lcg = get_lcg(i,j+1); + //TODO: Set the LC direction + lc_config[j]->has_direction = 1; + lc_config[j]->direction = get_direction(i,j+1); + //TODO: Bearer type. One of PRQBT_* values + lc_config[j]->has_qos_bearer_type = 1; + lc_config[j]->qos_bearer_type = PROTOCOL__PRP_QOS_BEARER_TYPE__PRQBT_NON_GBR; + //TODO: Set the QCI defined in TS 23.203, coded as defined in TS 36.413 + // One less than the actual QCI value + lc_config[j]->has_qci = 1; + lc_config[j]->qci = 1; + if (lc_config[j]->direction == PROTOCOL__PRP_QOS_BEARER_TYPE__PRQBT_GBR) { + //TODO: Set the max bitrate (UL) + lc_config[j]->has_e_rab_max_bitrate_ul = 1; + lc_config[j]->e_rab_max_bitrate_ul = 1; + //TODO: Set the max bitrate (DL) + lc_config[j]->has_e_rab_max_bitrate_dl = 1; + lc_config[j]->e_rab_max_bitrate_dl = 1; + //TODO: Set the guaranteed bitrate (UL) + lc_config[j]->has_e_rab_guaranteed_bitrate_ul = 1; + lc_config[j]->e_rab_guaranteed_bitrate_ul = 1; + //TODO: Set the guaranteed bitrate (DL) + lc_config[j]->has_e_rab_guaranteed_bitrate_dl = 1; + lc_config[j]->e_rab_guaranteed_bitrate_dl = 1; + } + } + lc_ue_config[i]->lc_config = lc_config; + } + } // end for UE + lc_config_reply_msg->lc_ue_config = lc_ue_config; + } // lc_config_reply_msg->n_lc_ue_config > 0 + *msg = malloc(sizeof(Protocol__ProgranMessage)); + if (*msg == NULL) + goto error; + protocol__progran_message__init(*msg); + (*msg)->msg_case = PROTOCOL__PROGRAN_MESSAGE__MSG_LC_CONFIG_REPLY_MSG; + (*msg)->msg_dir = PROTOCOL__PROGRAN_DIRECTION__SUCCESSFUL_OUTCOME; + (*msg)->lc_config_reply_msg = lc_config_reply_msg; + + return 0; + + error: + // TODO: Need to make proper error handling + if (header != NULL) + free(header); + if (lc_config_reply_msg != NULL) + free(lc_config_reply_msg); + if(*msg != NULL) + free(*msg); + //LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); + return -1; +} + +/* + * ************************************ + * UE Configuration Reply + * ************************************ + */ + +int enb_agent_ue_config_reply(mid_t mod_id, const void *params, Protocol__ProgranMessage **msg) { + + xid_t xid; + Protocol__ProgranMessage *input = (Protocol__ProgranMessage *)params; + Protocol__PrpUeConfigRequest *ue_config_request_msg = input->ue_config_request_msg; + xid = (ue_config_request_msg->header)->xid; + + int i; + + Protocol__PrpHeader *header; + if(prp_create_header(xid, PROTOCOL__PRP_TYPE__PRPT_GET_UE_CONFIG_REPLY, &header) != 0) + goto error; + + Protocol__PrpUeConfigReply *ue_config_reply_msg; + ue_config_reply_msg = malloc(sizeof(Protocol__PrpUeConfigReply)); + if(ue_config_reply_msg == NULL) + goto error; + protocol__prp_ue_config_reply__init(ue_config_reply_msg); + ue_config_reply_msg->header = header; + + //TODO: Fill in the actual number of UEs that are currently connected + ue_config_reply_msg->n_ue_config = get_num_ues(mod_id); + + Protocol__PrpUeConfig **ue_config; + if (ue_config_reply_msg->n_ue_config > 0) { + ue_config = malloc(sizeof(Protocol__PrpUeConfig *) * ue_config_reply_msg->n_ue_config); + if (ue_config == NULL) { + goto error; + } + for (i = 0; i < ue_config_reply_msg->n_ue_config; i++) { + ue_config[i] = malloc(sizeof(Protocol__PrpUeConfig *)); + protocol__prp_ue_config__init(ue_config[i]); + //TODO: Set the RNTI of the ue with id i + ue_config[i]->rnti = get_ue_crnti(mod_id,i); + ue_config[i]->has_rnti = 1; + //TODO: Set the DRX configuration (optional) + //Not supported for now, so we do not set it + + //TODO: Set the time_alignment_timer + ue_config[i]->time_alignment_timer = get_time_alignment_timer(mod_id,i); + ue_config[i]->has_time_alignment_timer = 1; + //TODO: Set the measurement gap configuration pattern + ue_config[i]->meas_gap_config_pattern = get_meas_gap_config(mod_id,i); + ue_config[i]->has_meas_gap_config_pattern = 1; + //TODO: Set the measurement gap offset if applicable + ue_config[i]->meas_gap_config_sf_offset = get_meas_gap_config_offset(mod_id,i); + ue_config[i]->has_meas_gap_config_sf_offset = 1; + //TODO: Set the SPS configuration (Optional) + //Not supported for noe, so we do not set it + + //TODO: Set the SR configuration (Optional) + //We do not set it for now + + //TODO: Set the CQI configuration (Optional) + //We do not set it for now + + //TODO: Set the transmission mode + ue_config[i]->transmission_mode = get_ue_transmission_mode(mod_id,i); + ue_config[i]->has_transmission_mode = 1; + + //TODO: Set the aggregated bit-rate of the non-gbr bearer (UL) + ue_config[i]->ue_aggregated_max_bitrate_ul = get_ue_aggregated_max_bitrate_ul(mod_id,i); + ue_config[i]->has_ue_aggregated_max_bitrate_ul = 1; + + //TODO: Set the aggregated bit-rate of the non-gbr bearer (DL) + ue_config[i]->ue_aggregated_max_bitrate_dl = get_ue_aggregated_max_bitrate_dl(mod_id,i); + ue_config[i]->has_ue_aggregated_max_bitrate_dl = 1; + + //TODO: Set the UE capabilities + Protocol__PrpUeCapabilities *capabilities; + capabilities = malloc(sizeof(Protocol__PrpUeCapabilities)); + protocol__prp_ue_capabilities__init(capabilities); + //TODO: Set half duplex (FDD operation) + capabilities->has_half_duplex = 1; + capabilities->half_duplex = get_half_duplex(i); + //TODO: Set intra-frame hopping flag + capabilities->has_intra_sf_hopping = 1; + capabilities->intra_sf_hopping = get_intra_sf_hopping(i); + //TODO: Set support for type 2 hopping with n_sb > 1 + capabilities->has_type2_sb_1 = 1; + capabilities->type2_sb_1 = get_type2_sb_1(i); + //TODO: Set ue category + capabilities->has_ue_category = 1; + capabilities->ue_category = get_ue_category(i); + //TODO: Set UE support for resource allocation type 1 + capabilities->has_res_alloc_type1 = 1; + capabilities->res_alloc_type1 = get_res_alloc_type1(i); + //Set the capabilites to the message + ue_config[i]->capabilities = capabilities; + //TODO: Set UE transmission antenna. One of the PRUTA_* values + ue_config[i]->has_ue_transmission_antenna = 1; + ue_config[i]->ue_transmission_antenna = get_ue_transmission_antenna(mod_id,i); + //TODO: Set tti bundling flag (See ts 36.321) + ue_config[i]->has_tti_bundling = 1; + ue_config[i]->tti_bundling = get_tti_bundling(mod_id,i); + //TODO: Set the max HARQ retransmission for the UL + ue_config[i]->has_max_harq_tx = 1; + ue_config[i]->max_harq_tx = get_maxHARQ_TX(mod_id,i); + //TODO: Fill beta_offset_ack_index (TS 36.213) + ue_config[i]->has_beta_offset_ack_index = 1; + ue_config[i]->beta_offset_ack_index = get_beta_offset_ack_index(mod_id,i); + //TODO: Fill beta_offset_ri_index (TS 36.213) + ue_config[i]->has_beta_offset_ri_index = 1; + ue_config[i]->beta_offset_ri_index = get_beta_offset_ri_index(mod_id,i); + //TODO: Fill beta_offset_cqi_index (TS 36.213) + ue_config[i]->has_beta_offset_cqi_index = 1; + ue_config[i]->beta_offset_cqi_index = get_beta_offset_cqi_index(mod_id,i); + //TODO: Fill ack_nack_simultaneous_trans (TS 36.213) + ue_config[i]->has_ack_nack_simultaneous_trans = 1; + ue_config[i]->ack_nack_simultaneous_trans = get_ack_nack_simultaneous_trans(mod_id,i); + //TODO: Fill simultaneous_ack_nack_cqi (TS 36.213) + ue_config[i]->has_simultaneous_ack_nack_cqi = 1; + ue_config[i]->simultaneous_ack_nack_cqi = get_simultaneous_ack_nack_cqi(mod_id,i); + //TODO: Set PRACRM_* value regarding aperiodic cqi report mode + ue_config[i]->has_aperiodic_cqi_rep_mode = 1; + ue_config[i]->aperiodic_cqi_rep_mode = get_aperiodic_cqi_rep_mode(mod_id,i); + //TODO: Set tdd_ack_nack_feedback + ue_config[i]->has_tdd_ack_nack_feedback = 1; + ue_config[i]->tdd_ack_nack_feedback = get_tdd_ack_nack_feedback(mod_id,i); + //TODO: Set ack_nack_repetition factor + ue_config[i]->has_ack_nack_repetition_factor = 1; + ue_config[i]->ack_nack_repetition_factor = get_ack_nack_repetition_factor(mod_id,i); + //TODO: Set extended BSR size + ue_config[i]->has_extended_bsr_size = 1; + ue_config[i]->extended_bsr_size = get_extended_bsr_size(mod_id,i); + //TODO: Set carrier aggregation support (boolean) + ue_config[i]->has_ca_support = 0; + ue_config[i]->ca_support = 0; + if(ue_config[i]->has_ca_support){ + //TODO: Set cross carrier scheduling support (boolean) + ue_config[i]->has_cross_carrier_sched_support = 1; + ue_config[i]->cross_carrier_sched_support = 0; + //TODO: Set index of primary cell + ue_config[i]->has_pcell_carrier_index = 1; + ue_config[i]->pcell_carrier_index = 1; + //TODO: Set secondary cells configuration + // We do not set it for now. No carrier aggregation support + + //TODO: Set deactivation timer for secondary cell + ue_config[i]->has_scell_deactivation_timer = 1; + ue_config[i]->scell_deactivation_timer = 1; + } + } + ue_config_reply_msg->ue_config = ue_config; + } + *msg = malloc(sizeof(Protocol__ProgranMessage)); + if (*msg == NULL) + goto error; + protocol__progran_message__init(*msg); + (*msg)->msg_case = PROTOCOL__PROGRAN_MESSAGE__MSG_UE_CONFIG_REPLY_MSG; + (*msg)->msg_dir = PROTOCOL__PROGRAN_DIRECTION__SUCCESSFUL_OUTCOME; + (*msg)->ue_config_reply_msg = ue_config_reply_msg; + return 0; + + error: + // TODO: Need to make proper error handling + if (header != NULL) + free(header); + if (ue_config_reply_msg != NULL) + free(ue_config_reply_msg); + if(*msg != NULL) + free(*msg); + //LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); + return -1; +} + + /* * ************************************ * eNB Configuration Request and Reply diff --git a/openair2/ENB_APP/enb_agent_common.h b/openair2/ENB_APP/enb_agent_common.h index 73ce0ec788..76c68437d0 100644 --- a/openair2/ENB_APP/enb_agent_common.h +++ b/openair2/ENB_APP/enb_agent_common.h @@ -210,6 +210,62 @@ int get_tpc(mid_t mod_id, mid_t ue_id); int get_harq(const mid_t mod_id, const uint8_t CC_id, const mid_t ue_id, const int frame, const uint8_t subframe, int *id, int *status); +/* + * ************************************ + * Get Messages for UE Configuration Reply + * ************************************ + */ + +int get_time_alignment_timer(mid_t mod_id, mid_t ue_id); + +int get_meas_gap_config(mid_t mod_id, mid_t ue_id); + +int get_meas_gap_config_offset(mid_t mod_id, mid_t ue_id); + +int get_ue_aggregated_max_bitrate_dl (mid_t mod_id, mid_t ue_id); + +int get_ue_aggregated_max_bitrate_ul (mid_t mod_id, mid_t ue_id); + +int get_half_duplex(mid_t ue_id); + +int get_intra_sf_hopping(mid_t ue_id); + +int get_type2_sb_1(mid_t ue_id); + +int get_ue_category(mid_t ue_id); + +int get_res_alloc_type1(mid_t ue_id); + +int get_ue_transmission_mode(mid_t mod_id, mid_t ue_id); + +int get_tti_bundling(mid_t mod_id, mid_t ue_id); + +int get_maxHARQ_TX(mid_t mod_id, mid_t ue_id); + +int get_beta_offset_ack_index(mid_t mod_id, mid_t ue_id); + +int get_beta_offset_ri_index(mid_t mod_id, mid_t ue_id); + +int get_beta_offset_cqi_index(mid_t mod_id, mid_t ue_id); + +int get_simultaneous_ack_nack_cqi(mid_t mod_id, mid_t ue_id); + +int get_ack_nack_simultaneous_trans(mid_t mod_id,mid_t ue_id); + +int get_aperiodic_cqi_rep_mode(mid_t mod_id,mid_t ue_id); + +int get_tdd_ack_nack_feedback(mid_t mod_id, mid_t ue_id); + +int get_ack_nack_repetition_factor(mid_t mod_id, mid_t ue_id); + +int get_extended_bsr_size(mid_t mod_id, mid_t ue_id); + +int get_ue_transmission_antenna(mid_t mod_id, mid_t ue_id); + +int get_lcg(mid_t ue_id, mid_t lc_id); + +int get_direction(mid_t ue_id, mid_t lc_id); + /******************* * timer primitves *******************/ diff --git a/openair2/LAYER2/MAC/extern.h b/openair2/LAYER2/MAC/extern.h index 2810235255..c2a3c78741 100644 --- a/openair2/LAYER2/MAC/extern.h +++ b/openair2/LAYER2/MAC/extern.h @@ -58,6 +58,8 @@ extern const uint32_t BSR_TABLE[BSR_TABLE_SIZE]; extern UE_MAC_INST *UE_mac_inst; extern eNB_MAC_INST *eNB_mac_inst; extern eNB_RRC_INST *eNB_rrc_inst; +extern UE_RRC_INST *UE_rrc_inst; +extern UE_MAC_INST *ue_mac_inst; extern MAC_RLC_XFACE *Mac_rlc_xface; extern uint8_t Is_rrc_registered; From e1d1b0baff645e2adc4c1595511127af3517ab53 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Tue, 23 Feb 2016 17:53:43 +0000 Subject: [PATCH 116/349] Added event notification for connection of a new UE --- openair2/ENB_APP/enb_agent.c | 2 +- openair2/ENB_APP/enb_agent_common.c | 428 +++++++++++----------- openair2/LAYER2/MAC/eNB_scheduler_ulsch.c | 8 + 3 files changed, 223 insertions(+), 215 deletions(-) diff --git a/openair2/ENB_APP/enb_agent.c b/openair2/ENB_APP/enb_agent.c index 7d2029b37f..95731d3654 100644 --- a/openair2/ENB_APP/enb_agent.c +++ b/openair2/ENB_APP/enb_agent.c @@ -150,7 +150,7 @@ void *receive_thread(void *args) { // check if there is something to send back to the controller if (msg != NULL){ data=enb_agent_pack_message(msg,&size); - + if (enb_agent_msg_send(d->enb_id, ENB_AGENT_DEFAULT, data, size, priority)) { err_code = PROTOCOL__PROGRAN_ERR__MSG_ENQUEUING; goto error; diff --git a/openair2/ENB_APP/enb_agent_common.c b/openair2/ENB_APP/enb_agent_common.c index 4a175c244e..a31020881e 100644 --- a/openair2/ENB_APP/enb_agent_common.c +++ b/openair2/ENB_APP/enb_agent_common.c @@ -1380,220 +1380,220 @@ int enb_agent_enb_config_request(mid_t mod_id, const void* params, Protocol__Pro int enb_agent_enb_config_reply(mid_t mod_id, const void *params, Protocol__ProgranMessage **msg) { - xid_t xid; - Protocol__ProgranMessage *input = (Protocol__ProgranMessage *)params; - Protocol__PrpEnbConfigRequest *enb_config_req_msg = input->enb_config_request_msg; - xid = (enb_config_req_msg->header)->xid; - - int i, j, k; - int cc_id = 0; - int enb_id = mod_id; - - - Protocol__PrpHeader *header; - if(prp_create_header(xid, PROTOCOL__PRP_TYPE__PRPT_GET_ENB_CONFIG_REPLY, &header) != 0) - goto error; - - Protocol__PrpEnbConfigReply *enb_config_reply_msg; - enb_config_reply_msg = malloc(sizeof(Protocol__PrpEnbConfigReply)); - if(enb_config_reply_msg == NULL) - goto error; - protocol__prp_enb_config_reply__init(enb_config_reply_msg); - enb_config_reply_msg->header = header; - - enb_config_reply_msg->enb_id = mod_id; - - - enb_config_reply_msg->n_cell_config = MAX_NUM_CCs; - - Protocol__PrpCellConfig **cell_conf; - if(enb_config_reply_msg->n_cell_config > 0){ - cell_conf = malloc(sizeof(Protocol__PrpCellConfig *) * enb_config_reply_msg->n_cell_config); - if(cell_conf == NULL) - goto error; - for(i = 0; i < enb_config_reply_msg->n_cell_config; i++){ - cell_conf[i] = malloc(sizeof(Protocol__PrpCellConfig)); - protocol__prp_cell_config__init(cell_conf[i]); - //TODO: Fill in with actual value, the PCI of this cell - cell_conf[i]->phy_cell_id = 1; - cell_conf[i]->has_phy_cell_id = 1; - //TODO: Fill in with actual value, the PLMN cell id of this cell - cell_conf[i]->cell_id = get_cell_id(enb_id,i); - cell_conf[i]->has_cell_id = 1; - //TODO: Fill in with actual value, PUSCH resources in RBs for hopping - cell_conf[i]->pusch_hopping_offset = get_hopping_offset(enb_id,i); - cell_conf[i]->has_pusch_hopping_offset = 1; - //TODO: Fill in with actual value - cell_conf[i]->hopping_mode = get_hopping_mode(enb_id,i); - cell_conf[i]->has_hopping_mode = 1; - //TODO: Fill in with actual value, the number of subbands - cell_conf[i]->n_sb = get_n_SB(enb_id,i); - cell_conf[i]->has_n_sb = 1; - //TODO: Fill in with actual value, The number of resource element groups used for PHICH. One of PRPR_ - cell_conf[i]->phich_resource = get_phich_resource(enb_id,i); - cell_conf[i]->has_phich_resource = 1; - //TODO: Fill in with actual value, one of the PRPD_ values - cell_conf[i]->phich_duration = get_phich_duration(enb_id,i); - cell_conf[i]->has_phich_duration = 1; - //TODO: Fill in with actual value, See TS 36.211, section 6.9 - cell_conf[i]->init_nr_pdcch_ofdm_sym = get_num_pdcch_symb(enb_id,i); - cell_conf[i]->has_init_nr_pdcch_ofdm_sym = 1; - //TODO: Fill in with actual value - Protocol__PrpSiConfig *si_config; - si_config = malloc(sizeof(Protocol__PrpSiConfig)); - if(si_config == NULL) - goto error; - protocol__prp_si_config__init(si_config); - //TODO: Fill in with actual value, Frame number to apply the SI configuration - si_config->sfn = 1; - si_config->has_sfn = 1; - //TODO: Fill in with actual value, the length of SIB1 in bytes - si_config->sib1_length = get_sib1_length(enb_id,i); - si_config->has_sib1_length = 1; - //TODO: Fill in with actual value, Scheduling window for all SIs in SF - si_config->si_window_length = (uint32_t) get_si_window_length(enb_id,i); - si_config->has_si_window_length = 1; - //TODO: Fill in with actual value, the number of SI messages - si_config->n_si_message=1; - Protocol__PrpSiMessage **si_message; - si_message = malloc(sizeof(Protocol__PrpSiMessage *) * si_config->n_si_message); - if(si_message == NULL) - goto error; - for(j = 0; j < si_config->n_si_message; j++){ - si_message[j] = malloc(sizeof(Protocol__PrpSiMessage)); - if(si_message[j] == NULL) - goto error; - protocol__prp_si_message__init(si_message[j]); - //TODO: Fill in with actual value, Periodicity of SI msg in radio frames - si_message[j]->periodicity = 1; //SIPeriod - si_message[j]->has_periodicity = 1; - //TODO: Fill in with actual value, rhe length of the SI message in bytes - si_message[j]->length = 10; - si_message[j]->has_length = 1; - } - if(si_config->n_si_message > 0){ - si_config->si_message = si_message; - } - cell_conf[i]->si_config = si_config; - - //TODO: Fill in with actual value, the DL transmission bandwidth in RBs - cell_conf[i]->dl_bandwidth = get_N_RB_DL(enb_id,i); - cell_conf[i]->has_dl_bandwidth = 1; - //TODO: Fill in with actual value, the UL transmission bandwidth in RBs - cell_conf[i]->ul_bandwidth = get_N_RB_UL(enb_id,i); - cell_conf[i]->has_ul_bandwidth = 1; - //TODO: Fill in with actual value, one of PRUCPL values - cell_conf[i]->ul_cyclic_prefix_length = get_ul_cyclic_prefix_length(enb_id,i); - cell_conf[i]->has_ul_cyclic_prefix_length = 1; - //TODO: Fill in with actual value, one of PRUCPL values - cell_conf[i]->dl_cyclic_prefix_length = get_dl_cyclic_prefix_length(enb_id,i); - cell_conf[i]->has_dl_cyclic_prefix_length = 1; - //TODO: Fill in with actual value, number of cell specific antenna ports - cell_conf[i]->antenna_ports_count = 1; - cell_conf[i]->has_antenna_ports_count = 1; - //TODO: Fill in with actual value, one of PRDM values - cell_conf[i]->duplex_mode = get_duplex_mode(enb_id,i); - cell_conf[i]->has_duplex_mode = 1; - //TODO: Fill in with actual value, DL/UL subframe assignment. TDD only - cell_conf[i]->subframe_assignment = get_subframe_assignment(enb_id,i); - cell_conf[i]->has_subframe_assignment = 1; - //TODO: Fill in with actual value, TDD only. See TS 36.211, table 4.2.1 - cell_conf[i]->special_subframe_patterns = get_special_subframe_assignment(enb_id,i); - cell_conf[i]->has_special_subframe_patterns = 1; - //TODO: Fill in with actual value, The MBSFN radio frame period - cell_conf[i]->n_mbsfn_subframe_config_rfperiod = 5; - uint32_t *elem_rfperiod; - elem_rfperiod = (uint32_t *) malloc(sizeof(uint32_t) *cell_conf[i]->n_mbsfn_subframe_config_rfperiod); - if(elem_rfperiod == NULL) - goto error; - for(j = 0; j < cell_conf[i]->n_mbsfn_subframe_config_rfperiod; j++){ - elem_rfperiod[j] = 1; - } - cell_conf[i]->mbsfn_subframe_config_rfperiod = elem_rfperiod; - - //TODO: Fill in with actual value, The MBSFN radio frame offset - cell_conf[i]->n_mbsfn_subframe_config_rfoffset = 5; - uint32_t *elem_rfoffset; - elem_rfoffset = (uint32_t *) malloc(sizeof(uint32_t) *cell_conf[i]->n_mbsfn_subframe_config_rfoffset); - if(elem_rfoffset == NULL) - goto error; - for(j = 0; j < cell_conf[i]->n_mbsfn_subframe_config_rfoffset; j++){ - elem_rfoffset[j] = 1; - } - cell_conf[i]->mbsfn_subframe_config_rfoffset = elem_rfoffset; - - //TODO: Fill in with actual value, Bitmap indicating the MBSFN subframes - cell_conf[i]->n_mbsfn_subframe_config_sfalloc = 5; - uint32_t *elem_sfalloc; - elem_sfalloc = (uint32_t *) malloc(sizeof(uint32_t) *cell_conf[i]->n_mbsfn_subframe_config_sfalloc); - if(elem_sfalloc == NULL) - goto error; - for(j = 0; j < cell_conf[i]->n_mbsfn_subframe_config_sfalloc; j++){ - elem_sfalloc[j] = 1; - } - cell_conf[i]->mbsfn_subframe_config_sfalloc = elem_sfalloc; - - //TODO: Fill in with actual value, See TS 36.211, section 5.7.1 - cell_conf[i]->prach_config_index = get_prach_ConfigIndex(enb_id,i); - cell_conf[i]->has_prach_config_index = 1; - //TODO: Fill in with actual value, See TS 36.211, section 5.7.1 - cell_conf[i]->prach_freq_offset = get_prach_FreqOffset(enb_id,i); - cell_conf[i]->has_prach_freq_offset = 1; - //TODO: Fill in with actual value, Duration of RA response window in SF - cell_conf[i]->ra_response_window_size = get_ra_ResponseWindowSize(enb_id,i); - cell_conf[i]->has_ra_response_window_size = 1; - //TODO: Fill in with actual value, Timer used for RA - cell_conf[i]->mac_contention_resolution_timer = get_mac_ContentionResolutionTimer(enb_id,i); - cell_conf[i]->has_mac_contention_resolution_timer = 1; - //TODO: Fill in with actual value, See TS 36.321 - cell_conf[i]->max_harq_msg3tx = get_maxHARQ_Msg3Tx(enb_id,i); - cell_conf[i]->has_max_harq_msg3tx = 1; - //TODO: Fill in with actual value, See TS 36.213, section 10.1 - cell_conf[i]->n1pucch_an = get_n1pucch_an(enb_id,i); - cell_conf[i]->has_n1pucch_an = 1; - //TODO: Fill in with actual value, See TS 36.211, section 5.4 - cell_conf[i]->deltapucch_shift = get_deltaPUCCH_Shift(enb_id,i); - cell_conf[i]->has_deltapucch_shift = 1; - //TODO: Fill in with actual value, See TS 36.211, section 5.4 - cell_conf[i]->nrb_cqi = get_nRB_CQI(enb_id,i); - cell_conf[i]->has_nrb_cqi = 1; - //TODO: Fill in with actual value, See TS 36.211, table 5.5.3.3-1 and 2 - cell_conf[i]->srs_subframe_config = get_srs_SubframeConfig(enb_id,i); - cell_conf[i]->has_srs_subframe_config = 1; - //TODO: Fill in with actual value, See TS 36.211, section 5.5.3.2 - cell_conf[i]->srs_bw_config = get_srs_BandwidthConfig(enb_id,i); - cell_conf[i]->has_srs_bw_config = 1; - //TODO: Fill in with actual value, Boolean value. See TS 36.211, section 5.5.3.2. TDD only - cell_conf[i]->srs_mac_up_pts = get_srs_MaxUpPts(enb_id,i); - cell_conf[i]->has_srs_mac_up_pts = 1; - //TODO: Fill in with actual value, One of the PREQ_ values - cell_conf[i]->enable_64qam = get_enable64QAM(enb_id,i); - cell_conf[i]->has_enable_64qam = 1; - //TODO: Fill in with actual value, Carrier component index - cell_conf[i]->carrier_index = i; - cell_conf[i]->has_carrier_index = 1; - } - enb_config_reply_msg->cell_config=cell_conf; - } - *msg = malloc(sizeof(Protocol__ProgranMessage)); - if(*msg == NULL) - goto error; - protocol__progran_message__init(*msg); - (*msg)->msg_case = PROTOCOL__PROGRAN_MESSAGE__MSG_ENB_CONFIG_REPLY_MSG; - (*msg)->msg_dir = PROTOCOL__PROGRAN_DIRECTION__SUCCESSFUL_OUTCOME; - (*msg)->enb_config_reply_msg = enb_config_reply_msg; - return 0; - - error: - // TODO: Need to make proper error handling - if (header != NULL) - free(header); - if (enb_config_reply_msg != NULL) - free(enb_config_reply_msg); - if(*msg != NULL) - free(*msg); - //LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); - return -1; + xid_t xid; + Protocol__ProgranMessage *input = (Protocol__ProgranMessage *)params; + Protocol__PrpEnbConfigRequest *enb_config_req_msg = input->enb_config_request_msg; + xid = (enb_config_req_msg->header)->xid; + + int i, j, k; + int cc_id = 0; + int enb_id = mod_id; + + Protocol__PrpHeader *header; + if(prp_create_header(xid, PROTOCOL__PRP_TYPE__PRPT_GET_ENB_CONFIG_REPLY, &header) != 0) + goto error; + + Protocol__PrpEnbConfigReply *enb_config_reply_msg; + enb_config_reply_msg = malloc(sizeof(Protocol__PrpEnbConfigReply)); + if(enb_config_reply_msg == NULL) + goto error; + protocol__prp_enb_config_reply__init(enb_config_reply_msg); + enb_config_reply_msg->header = header; + + enb_config_reply_msg->enb_id = mod_id; + + + enb_config_reply_msg->n_cell_config = MAX_NUM_CCs; + + Protocol__PrpCellConfig **cell_conf; + if(enb_config_reply_msg->n_cell_config > 0){ + cell_conf = malloc(sizeof(Protocol__PrpCellConfig *) * enb_config_reply_msg->n_cell_config); + if(cell_conf == NULL) + goto error; + for(i = 0; i < enb_config_reply_msg->n_cell_config; i++){ + cell_conf[i] = malloc(sizeof(Protocol__PrpCellConfig)); + protocol__prp_cell_config__init(cell_conf[i]); + //TODO: Fill in with actual value, the PCI of this cell + cell_conf[i]->phy_cell_id = 1; + cell_conf[i]->has_phy_cell_id = 1; + //TODO: Fill in with actual value, the PLMN cell id of this cell + cell_conf[i]->cell_id = get_cell_id(enb_id,i); + cell_conf[i]->has_cell_id = 1; + //TODO: Fill in with actual value, PUSCH resources in RBs for hopping + cell_conf[i]->pusch_hopping_offset = get_hopping_offset(enb_id,i); + cell_conf[i]->has_pusch_hopping_offset = 1; + //TODO: Fill in with actual value + cell_conf[i]->hopping_mode = get_hopping_mode(enb_id,i); + cell_conf[i]->has_hopping_mode = 1; + //TODO: Fill in with actual value, the number of subbands + cell_conf[i]->n_sb = get_n_SB(enb_id,i); + cell_conf[i]->has_n_sb = 1; + //TODO: Fill in with actual value, The number of resource element groups used for PHICH. One of PRPR_ + cell_conf[i]->phich_resource = get_phich_resource(enb_id,i); + cell_conf[i]->has_phich_resource = 1; + //TODO: Fill in with actual value, one of the PRPD_ values + cell_conf[i]->phich_duration = get_phich_duration(enb_id,i); + cell_conf[i]->has_phich_duration = 1; + //TODO: Fill in with actual value, See TS 36.211, section 6.9 + cell_conf[i]->init_nr_pdcch_ofdm_sym = get_num_pdcch_symb(enb_id,i); + cell_conf[i]->has_init_nr_pdcch_ofdm_sym = 1; + //TODO: Fill in with actual value + Protocol__PrpSiConfig *si_config; + si_config = malloc(sizeof(Protocol__PrpSiConfig)); + if(si_config == NULL) + goto error; + protocol__prp_si_config__init(si_config); + //TODO: Fill in with actual value, Frame number to apply the SI configuration + si_config->sfn = 1; + si_config->has_sfn = 1; + //TODO: Fill in with actual value, the length of SIB1 in bytes + si_config->sib1_length = get_sib1_length(enb_id,i); + si_config->has_sib1_length = 1; + //TODO: Fill in with actual value, Scheduling window for all SIs in SF + si_config->si_window_length = (uint32_t) get_si_window_length(enb_id,i); + si_config->has_si_window_length = 1; + //TODO: Fill in with actual value, the number of SI messages + si_config->n_si_message=1; + Protocol__PrpSiMessage **si_message; + si_message = malloc(sizeof(Protocol__PrpSiMessage *) * si_config->n_si_message); + if(si_message == NULL) + goto error; + for(j = 0; j < si_config->n_si_message; j++){ + si_message[j] = malloc(sizeof(Protocol__PrpSiMessage)); + if(si_message[j] == NULL) + goto error; + protocol__prp_si_message__init(si_message[j]); + //TODO: Fill in with actual value, Periodicity of SI msg in radio frames + si_message[j]->periodicity = 1; //SIPeriod + si_message[j]->has_periodicity = 1; + //TODO: Fill in with actual value, rhe length of the SI message in bytes + si_message[j]->length = 10; + si_message[j]->has_length = 1; + } + if(si_config->n_si_message > 0){ + si_config->si_message = si_message; + } + cell_conf[i]->si_config = si_config; + + //TODO: Fill in with actual value, the DL transmission bandwidth in RBs + cell_conf[i]->dl_bandwidth = get_N_RB_DL(enb_id,i); + cell_conf[i]->has_dl_bandwidth = 1; + //TODO: Fill in with actual value, the UL transmission bandwidth in RBs + cell_conf[i]->ul_bandwidth = get_N_RB_UL(enb_id,i); + cell_conf[i]->has_ul_bandwidth = 1; + //TODO: Fill in with actual value, one of PRUCPL values + cell_conf[i]->ul_cyclic_prefix_length = get_ul_cyclic_prefix_length(enb_id,i); + cell_conf[i]->has_ul_cyclic_prefix_length = 1; + //TODO: Fill in with actual value, one of PRUCPL values + cell_conf[i]->dl_cyclic_prefix_length = get_dl_cyclic_prefix_length(enb_id,i); + cell_conf[i]->has_dl_cyclic_prefix_length = 1; + //TODO: Fill in with actual value, number of cell specific antenna ports + cell_conf[i]->antenna_ports_count = 1; + cell_conf[i]->has_antenna_ports_count = 1; + //TODO: Fill in with actual value, one of PRDM values + cell_conf[i]->duplex_mode = get_duplex_mode(enb_id,i); + cell_conf[i]->has_duplex_mode = 1; + //TODO: Fill in with actual value, DL/UL subframe assignment. TDD only + cell_conf[i]->subframe_assignment = get_subframe_assignment(enb_id,i); + cell_conf[i]->has_subframe_assignment = 1; + //TODO: Fill in with actual value, TDD only. See TS 36.211, table 4.2.1 + cell_conf[i]->special_subframe_patterns = get_special_subframe_assignment(enb_id,i); + cell_conf[i]->has_special_subframe_patterns = 1; + //TODO: Fill in with actual value, The MBSFN radio frame period + cell_conf[i]->n_mbsfn_subframe_config_rfperiod = 5; + uint32_t *elem_rfperiod; + elem_rfperiod = (uint32_t *) malloc(sizeof(uint32_t) *cell_conf[i]->n_mbsfn_subframe_config_rfperiod); + if(elem_rfperiod == NULL) + goto error; + for(j = 0; j < cell_conf[i]->n_mbsfn_subframe_config_rfperiod; j++){ + elem_rfperiod[j] = 1; + } + cell_conf[i]->mbsfn_subframe_config_rfperiod = elem_rfperiod; + + //TODO: Fill in with actual value, The MBSFN radio frame offset + cell_conf[i]->n_mbsfn_subframe_config_rfoffset = 5; + uint32_t *elem_rfoffset; + elem_rfoffset = (uint32_t *) malloc(sizeof(uint32_t) *cell_conf[i]->n_mbsfn_subframe_config_rfoffset); + if(elem_rfoffset == NULL) + goto error; + for(j = 0; j < cell_conf[i]->n_mbsfn_subframe_config_rfoffset; j++){ + elem_rfoffset[j] = 1; + } + cell_conf[i]->mbsfn_subframe_config_rfoffset = elem_rfoffset; + + //TODO: Fill in with actual value, Bitmap indicating the MBSFN subframes + cell_conf[i]->n_mbsfn_subframe_config_sfalloc = 5; + uint32_t *elem_sfalloc; + elem_sfalloc = (uint32_t *) malloc(sizeof(uint32_t) *cell_conf[i]->n_mbsfn_subframe_config_sfalloc); + if(elem_sfalloc == NULL) + goto error; + for(j = 0; j < cell_conf[i]->n_mbsfn_subframe_config_sfalloc; j++){ + elem_sfalloc[j] = 1; + } + cell_conf[i]->mbsfn_subframe_config_sfalloc = elem_sfalloc; + + //TODO: Fill in with actual value, See TS 36.211, section 5.7.1 + cell_conf[i]->prach_config_index = get_prach_ConfigIndex(enb_id,i); + cell_conf[i]->has_prach_config_index = 1; + //TODO: Fill in with actual value, See TS 36.211, section 5.7.1 + cell_conf[i]->prach_freq_offset = get_prach_FreqOffset(enb_id,i); + cell_conf[i]->has_prach_freq_offset = 1; + //TODO: Fill in with actual value, Duration of RA response window in SF + cell_conf[i]->ra_response_window_size = get_ra_ResponseWindowSize(enb_id,i); + cell_conf[i]->has_ra_response_window_size = 1; + //TODO: Fill in with actual value, Timer used for RA + cell_conf[i]->mac_contention_resolution_timer = get_mac_ContentionResolutionTimer(enb_id,i); + cell_conf[i]->has_mac_contention_resolution_timer = 1; + //TODO: Fill in with actual value, See TS 36.321 + cell_conf[i]->max_harq_msg3tx = get_maxHARQ_Msg3Tx(enb_id,i); + cell_conf[i]->has_max_harq_msg3tx = 1; + //TODO: Fill in with actual value, See TS 36.213, section 10.1 + cell_conf[i]->n1pucch_an = get_n1pucch_an(enb_id,i); + cell_conf[i]->has_n1pucch_an = 1; + //TODO: Fill in with actual value, See TS 36.211, section 5.4 + cell_conf[i]->deltapucch_shift = get_deltaPUCCH_Shift(enb_id,i); + cell_conf[i]->has_deltapucch_shift = 1; + //TODO: Fill in with actual value, See TS 36.211, section 5.4 + cell_conf[i]->nrb_cqi = get_nRB_CQI(enb_id,i); + cell_conf[i]->has_nrb_cqi = 1; + //TODO: Fill in with actual value, See TS 36.211, table 5.5.3.3-1 and 2 + cell_conf[i]->srs_subframe_config = get_srs_SubframeConfig(enb_id,i); + cell_conf[i]->has_srs_subframe_config = 1; + //TODO: Fill in with actual value, See TS 36.211, section 5.5.3.2 + cell_conf[i]->srs_bw_config = get_srs_BandwidthConfig(enb_id,i); + cell_conf[i]->has_srs_bw_config = 1; + //TODO: Fill in with actual value, Boolean value. See TS 36.211, section 5.5.3.2. TDD only + cell_conf[i]->srs_mac_up_pts = get_srs_MaxUpPts(enb_id,i); + cell_conf[i]->has_srs_mac_up_pts = 1; + //TODO: Fill in with actual value, One of the PREQ_ values + cell_conf[i]->enable_64qam = get_enable64QAM(enb_id,i); + cell_conf[i]->has_enable_64qam = 1; + //TODO: Fill in with actual value, Carrier component index + cell_conf[i]->carrier_index = i; + cell_conf[i]->has_carrier_index = 1; + } + enb_config_reply_msg->cell_config=cell_conf; + } + *msg = malloc(sizeof(Protocol__ProgranMessage)); + if(*msg == NULL) + goto error; + protocol__progran_message__init(*msg); + (*msg)->msg_case = PROTOCOL__PROGRAN_MESSAGE__MSG_ENB_CONFIG_REPLY_MSG; + (*msg)->msg_dir = PROTOCOL__PROGRAN_DIRECTION__SUCCESSFUL_OUTCOME; + (*msg)->enb_config_reply_msg = enb_config_reply_msg; + + return 0; + + error: + // TODO: Need to make proper error handling + if (header != NULL) + free(header); + if (enb_config_reply_msg != NULL) + free(enb_config_reply_msg); + if(*msg != NULL) + free(*msg); + //LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); + return -1; } diff --git a/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c b/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c index 493ff11d33..34ac1caa86 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c @@ -56,6 +56,8 @@ #include "RRC/LITE/extern.h" #include "RRC/L2_INTERFACE/openair_rrc_L2_interface.h" +#include "enb_agent_extern.h" + //#include "LAYER2/MAC/pre_processor.c" #include "pdcp.h" @@ -255,6 +257,12 @@ void rx_sdu( } else LOG_I(MAC,"[eNB %d][RAPROC] CC_id %d Frame %d Added user with rnti %x => UE %d\n", enb_mod_idP,CC_idP,frameP,eNB->common_channels[CC_idP].RA_template[ii].rnti,UE_id); + //WARNING:Inform the controller about the UE activation. Should be moved to RRC agent in the future + if (mac_agent_registered[enb_mod_idP]) { + agent_mac_xface[enb_mod_idP]->enb_agent_notify_ue_state_change(enb_mod_idP, + eNB->common_channels[CC_idP].RA_template[ii].rnti, + PROTOCOL__PRP_UE_STATE_CHANGE_TYPE__PRUESC_ACTIVATED); + } } else { LOG_I(MAC,"[eNB %d][RAPROC] CC_id %d Frame %d CCCH: Received Msg3 from already registered UE %d: length %d, offset %d\n", enb_mod_idP,CC_idP,frameP,UE_id,rx_lengths[i],payload_ptr-sduP); From 00b158829fd7db9b2a3d3fbf999d82937968757f Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Tue, 23 Feb 2016 17:57:22 +0000 Subject: [PATCH 117/349] Fixed bug in UE configuration message --- openair2/ENB_APP/enb_agent_common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openair2/ENB_APP/enb_agent_common.c b/openair2/ENB_APP/enb_agent_common.c index a31020881e..b1633bea38 100644 --- a/openair2/ENB_APP/enb_agent_common.c +++ b/openair2/ENB_APP/enb_agent_common.c @@ -1197,7 +1197,7 @@ int enb_agent_ue_config_reply(mid_t mod_id, const void *params, Protocol__Progra goto error; } for (i = 0; i < ue_config_reply_msg->n_ue_config; i++) { - ue_config[i] = malloc(sizeof(Protocol__PrpUeConfig *)); + ue_config[i] = malloc(sizeof(Protocol__PrpUeConfig)); protocol__prp_ue_config__init(ue_config[i]); //TODO: Set the RNTI of the ue with id i ue_config[i]->rnti = get_ue_crnti(mod_id,i); From a637957c7c3e047bc7aa63b47348a5eea1cb07d8 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Wed, 24 Feb 2016 12:46:22 +0000 Subject: [PATCH 118/349] Moved UE activation notification to RRC --- openair2/LAYER2/MAC/eNB_scheduler_ulsch.c | 8 -------- openair2/RRC/LITE/rrc_eNB.c | 8 ++++++++ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c b/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c index 34ac1caa86..493ff11d33 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c @@ -56,8 +56,6 @@ #include "RRC/LITE/extern.h" #include "RRC/L2_INTERFACE/openair_rrc_L2_interface.h" -#include "enb_agent_extern.h" - //#include "LAYER2/MAC/pre_processor.c" #include "pdcp.h" @@ -257,12 +255,6 @@ void rx_sdu( } else LOG_I(MAC,"[eNB %d][RAPROC] CC_id %d Frame %d Added user with rnti %x => UE %d\n", enb_mod_idP,CC_idP,frameP,eNB->common_channels[CC_idP].RA_template[ii].rnti,UE_id); - //WARNING:Inform the controller about the UE activation. Should be moved to RRC agent in the future - if (mac_agent_registered[enb_mod_idP]) { - agent_mac_xface[enb_mod_idP]->enb_agent_notify_ue_state_change(enb_mod_idP, - eNB->common_channels[CC_idP].RA_template[ii].rnti, - PROTOCOL__PRP_UE_STATE_CHANGE_TYPE__PRUESC_ACTIVATED); - } } else { LOG_I(MAC,"[eNB %d][RAPROC] CC_id %d Frame %d CCCH: Received Msg3 from already registered UE %d: length %d, offset %d\n", enb_mod_idP,CC_idP,frameP,UE_id,rx_lengths[i],payload_ptr-sduP); diff --git a/openair2/RRC/LITE/rrc_eNB.c b/openair2/RRC/LITE/rrc_eNB.c index 1d0b5f2902..4d5d390d0d 100644 --- a/openair2/RRC/LITE/rrc_eNB.c +++ b/openair2/RRC/LITE/rrc_eNB.c @@ -99,6 +99,8 @@ #include "SIMULATION/TOOLS/defs.h" // for taus +#include "enb_agent_extern.h" + //#define XER_PRINT #ifdef PHY_EMUL @@ -4093,6 +4095,12 @@ rrc_eNB_decode_dcch( ue_context_p, &ul_dcch_msg->message.choice.c1.choice.rrcConnectionSetupComplete.criticalExtensions.choice.c1.choice.rrcConnectionSetupComplete_r8); ue_context_p->ue_context.Status = RRC_CONNECTED; + //WARNING:Inform the controller about the UE activation. Should be moved to RRC agent in the future + if (mac_agent_registered[ctxt_pP->eNB_index]) { + agent_mac_xface[ctxt_pP->eNB_index]->enb_agent_notify_ue_state_change(ctxt_pP->eNB_index, + ue_context_p->ue_id_rnti, + PROTOCOL__PRP_UE_STATE_CHANGE_TYPE__PRUESC_ACTIVATED); + } LOG_I(RRC, PROTOCOL_RRC_CTXT_UE_FMT" UE State = RRC_CONNECTED \n", PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP)); } From 906e90727e091bf3055d84166b1477163ce919c3 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Wed, 24 Feb 2016 12:47:24 +0000 Subject: [PATCH 119/349] Fixed LC config reporting based on existing LCs --- openair2/ENB_APP/enb_agent_common.c | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/openair2/ENB_APP/enb_agent_common.c b/openair2/ENB_APP/enb_agent_common.c index b1633bea38..ec4f70abe9 100644 --- a/openair2/ENB_APP/enb_agent_common.c +++ b/openair2/ENB_APP/enb_agent_common.c @@ -43,6 +43,9 @@ #include "PHY/extern.h" #include "log.h" +#include "RRC/LITE/extern.h" +#include "RRC/L2_INTERFACE/openair_rrc_L2_interface.h" + void * enb[NUM_MAX_ENB]; void * enb_ue[NUM_MAX_ENB]; @@ -375,7 +378,8 @@ int enb_agent_ue_state_change(mid_t mod_id, uint32_t rnti, uint8_t state_change) } else if (state_change == PROTOCOL__PRP_UE_STATE_CHANGE_TYPE__PRUESC_UPDATED || state_change == PROTOCOL__PRP_UE_STATE_CHANGE_TYPE__PRUESC_ACTIVATED) { // TODO: Set the whole UE configuration message - + config->has_rnti = 1; + config->rnti = rnti; } else if (state_change == PROTOCOL__PRP_UE_STATE_CHANGE_TYPE__PRUESC_MOVED) { // TODO: Not supported for now. Leave blank } @@ -1039,7 +1043,11 @@ int get_ue_transmission_antenna(mid_t mod_id, mid_t ue_id) int get_lcg(mid_t ue_id, mid_t lc_id) { - return &UE_mac_inst[ue_id].logicalChannelConfig[lc_id]->ul_SpecificParameters->logicalChannelGroup; + if(UE_mac_inst[ue_id].logicalChannelConfig[lc_id] != NULL) { + return *UE_mac_inst[ue_id].logicalChannelConfig[lc_id]->ul_SpecificParameters->logicalChannelGroup; + } else { + return -1; + } } int get_direction(mid_t ue_id, mid_t lc_id) @@ -1093,7 +1101,16 @@ int enb_agent_lc_config_reply(mid_t mod_id, const void *params, Protocol__Progra lc_ue_config[i]->has_rnti = 1; lc_ue_config[i]->rnti = get_ue_crnti(mod_id,i); //TODO: Set the number of LC configurations that will be reported for this UE - lc_ue_config[i]->n_lc_config = 3; + //Set this according to the current state of the UE. This is only a temporary fix + int status = 0; + status = mac_eNB_get_rrc_status(mod_id, get_ue_crnti(mod_id, i)); + if (status < RRC_CONNECTED) { + lc_ue_config[i]->n_lc_config = 0; + } else if (status == RRC_CONNECTED) { + lc_ue_config[i]->n_lc_config = 1; + } else { + lc_ue_config[i]->n_lc_config = 3; + } Protocol__PrpLcConfig **lc_config; if (lc_ue_config[i]->n_lc_config > 0) { lc_config = malloc(sizeof(Protocol__PrpLcConfig *) * lc_ue_config[i]->n_lc_config); From fffb682f7a92c91ecbb6de8071528dfccfbfbc42 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Wed, 24 Feb 2016 14:38:44 +0000 Subject: [PATCH 120/349] Added continuous update support --- openair2/ENB_APP/enb_agent_mac.c | 52 ++++++++++++++++++----------- openair2/LAYER2/MAC/eNB_scheduler.c | 1 + 2 files changed, 34 insertions(+), 19 deletions(-) diff --git a/openair2/ENB_APP/enb_agent_mac.c b/openair2/ENB_APP/enb_agent_mac.c index 5c279958fe..0c68c4b80c 100644 --- a/openair2/ENB_APP/enb_agent_mac.c +++ b/openair2/ENB_APP/enb_agent_mac.c @@ -168,6 +168,18 @@ int enb_agent_mac_handle_stats(mid_t mod_id, const void *params, Protocol__Progr request_config.report_type = PROTOCOL__PRP_STATS_TYPE__PRST_COMPLETE_STATS; request_config.report_frequency = PROTOCOL__PRP_STATS_REPORT_FREQ__PRSRF_ONCE; request_config.period = 0; + /* Need to make sure that the ue flags are saved (Bug) */ + if (report_config.nr_ue == 0) { + report_config.nr_ue = 1; + report_config.ue_report_type = (ue_report_type_t *) malloc(sizeof(ue_report_type_t)); + if (report_config.ue_report_type == NULL) { + // TODO: Add appropriate error code + err_code = -100; + goto error; + } + report_config.ue_report_type[0].ue_rnti = 0; // Dummy value + report_config.ue_report_type[0].ue_report_flags = ue_flags; + } request_config.config = &report_config; enb_agent_enable_cont_mac_stats_update(enb_id, xid, &request_config); } @@ -1204,44 +1216,46 @@ void enb_agent_send_sf_trigger(mid_t mod_id) { void enb_agent_send_update_mac_stats(mid_t mod_id) { - Protocol__ProgranMessage *current_report, *msg; + Protocol__ProgranMessage *current_report = NULL, *msg; void *data; int size; err_code_t err_code; int priority; mac_stats_updates_context_t stats_context = mac_stats_context[mod_id]; - + if (pthread_mutex_lock(mac_stats_context[mod_id].mutex)) { goto error; } - /*Create a fresh report with the required flags*/ - err_code = enb_agent_mac_handle_stats(mod_id, (void *) mac_stats_context[mod_id].stats_req, ¤t_report); - if (err_code < 0) { - goto error; + if (mac_stats_context[mod_id].cont_update == 1) { + + /*Create a fresh report with the required flags*/ + err_code = enb_agent_mac_handle_stats(mod_id, (void *) mac_stats_context[mod_id].stats_req, ¤t_report); + if (err_code < 0) { + goto error; + } } + /* /\*TODO:Check if a previous reports exists and if yes, generate a report */ + /* *that is the diff between the old and the new report, */ + /* *respecting the thresholds. Otherwise send the new report*\/ */ + /* if (mac_stats_context[mod_id].prev_stats_reply != NULL) { */ - /*TODO:Check if a previous reports exists and if yes, generate a report - *that is the diff between the old and the new report, - *respecting the thresholds. Otherwise send the new report*/ - if (mac_stats_context[mod_id].prev_stats_reply != NULL) { + /* msg = enb_agent_generate_diff_mac_stats_report(current_report, mac_stats_context[mod_id].prev_stats_reply); */ - msg = enb_agent_generate_diff_mac_stats_report(current_report, mac_stats_context[mod_id].prev_stats_reply); - - /*Destroy the old stats*/ - enb_agent_destroy_progran_message(mac_stats_context[mod_id].prev_stats_reply); - } - /*Use the current report for future comparissons*/ - mac_stats_context[mod_id].prev_stats_reply = current_report; + /* /\*Destroy the old stats*\/ */ + /* enb_agent_destroy_progran_message(mac_stats_context[mod_id].prev_stats_reply); */ + /* } */ + /* /\*Use the current report for future comparissons*\/ */ + /* mac_stats_context[mod_id].prev_stats_reply = current_report; */ if (pthread_mutex_unlock(mac_stats_context[mod_id].mutex)) { goto error; } - if (msg != NULL){ - data=enb_agent_pack_message(msg, &size); + if (current_report != NULL){ + data=enb_agent_pack_message(current_report, &size); /*Send any stats updates using the MAC channel of the eNB*/ if (enb_agent_msg_send(mod_id, ENB_AGENT_MAC, data, size, priority)) { err_code = PROTOCOL__PROGRAN_ERR__MSG_ENQUEUING; diff --git a/openair2/LAYER2/MAC/eNB_scheduler.c b/openair2/LAYER2/MAC/eNB_scheduler.c index 774feda961..e2423e2c10 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler.c +++ b/openair2/LAYER2/MAC/eNB_scheduler.c @@ -219,6 +219,7 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, //Send subframe trigger to the controller if (mac_agent_registered[module_idP]) { agent_mac_xface[module_idP]->enb_agent_send_sf_trigger(module_idP); + agent_mac_xface[module_idP]->enb_agent_send_update_mac_stats(module_idP); } #endif From f84568e1714edb263d982dc73a628861f4378d0c Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Wed, 24 Feb 2016 14:40:03 +0000 Subject: [PATCH 121/349] Bug fix when checking for the LCG of an LC --- openair2/ENB_APP/enb_agent_common.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/openair2/ENB_APP/enb_agent_common.c b/openair2/ENB_APP/enb_agent_common.c index ec4f70abe9..c567a78b6c 100644 --- a/openair2/ENB_APP/enb_agent_common.c +++ b/openair2/ENB_APP/enb_agent_common.c @@ -1053,8 +1053,7 @@ int get_lcg(mid_t ue_id, mid_t lc_id) int get_direction(mid_t ue_id, mid_t lc_id) { /*TODO: fill with the value for the rest of LCID*/ - - if(lc_id == CCCH | lc_id == DCCH) + if(lc_id == DCCH | lc_id == DCCH1) return 2; else if(lc_id == DTCH) return 1; @@ -1124,8 +1123,11 @@ int enb_agent_lc_config_reply(mid_t mod_id, const void *params, Protocol__Progra lc_config[j]->has_lcid = 1; lc_config[j]->lcid = j+1; //TODO: Set the LCG of the channel - lc_config[j]->has_lcg = 1; - lc_config[j]->lcg = get_lcg(i,j+1); + int lcg = get_lcg(i, j+1); + if (lcg >= 0 && lcg <= 3) { + lc_config[j]->has_lcg = 1; + lc_config[j]->lcg = get_lcg(i,j+1); + } //TODO: Set the LC direction lc_config[j]->has_direction = 1; lc_config[j]->direction = get_direction(i,j+1); From 4c7d1e03819ca7331d16f35b290188c3a0fc021a Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Wed, 24 Feb 2016 17:31:13 +0000 Subject: [PATCH 122/349] Added support for indication of a UE state in both RRC_CONNECTED and RRC_RECONFIGURED STATES --- openair2/RRC/LITE/rrc_eNB.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/openair2/RRC/LITE/rrc_eNB.c b/openair2/RRC/LITE/rrc_eNB.c index 4d5d390d0d..adaf50d62e 100644 --- a/openair2/RRC/LITE/rrc_eNB.c +++ b/openair2/RRC/LITE/rrc_eNB.c @@ -4013,6 +4013,12 @@ rrc_eNB_decode_dcch( LOG_I(RRC, PROTOCOL_RRC_CTXT_UE_FMT" UE State = RRC_RECONFIGURED \n", PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP)); + //WARNING:Inform the controller about the UE activation. Should be moved to RRC agent in the future + if (mac_agent_registered[ctxt_pP->eNB_index]) { + agent_mac_xface[ctxt_pP->eNB_index]->enb_agent_notify_ue_state_change(ctxt_pP->eNB_index, + ue_context_p->ue_id_rnti, + PROTOCOL__PRP_UE_STATE_CHANGE_TYPE__PRUESC_UPDATED); + } } #if defined(ENABLE_USE_MME) @@ -4095,14 +4101,14 @@ rrc_eNB_decode_dcch( ue_context_p, &ul_dcch_msg->message.choice.c1.choice.rrcConnectionSetupComplete.criticalExtensions.choice.c1.choice.rrcConnectionSetupComplete_r8); ue_context_p->ue_context.Status = RRC_CONNECTED; - //WARNING:Inform the controller about the UE activation. Should be moved to RRC agent in the future - if (mac_agent_registered[ctxt_pP->eNB_index]) { - agent_mac_xface[ctxt_pP->eNB_index]->enb_agent_notify_ue_state_change(ctxt_pP->eNB_index, - ue_context_p->ue_id_rnti, - PROTOCOL__PRP_UE_STATE_CHANGE_TYPE__PRUESC_ACTIVATED); - } LOG_I(RRC, PROTOCOL_RRC_CTXT_UE_FMT" UE State = RRC_CONNECTED \n", PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP)); + //WARNING:Inform the controller about the UE activation. Should be moved to RRC agent in the future + if (mac_agent_registered[ctxt_pP->eNB_index]) { + agent_mac_xface[ctxt_pP->eNB_index]->enb_agent_notify_ue_state_change(ctxt_pP->eNB_index, + ue_context_p->ue_id_rnti, + PROTOCOL__PRP_UE_STATE_CHANGE_TYPE__PRUESC_ACTIVATED); + } } } From a5fd6187706a65a94fd3b8a0afa231d3c7f13aaa Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Wed, 24 Feb 2016 17:33:49 +0000 Subject: [PATCH 123/349] Fixed bug of wrong rnti value when finding it using the UE id --- openair2/ENB_APP/enb_agent_common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openair2/ENB_APP/enb_agent_common.c b/openair2/ENB_APP/enb_agent_common.c index c567a78b6c..d971b67fac 100644 --- a/openair2/ENB_APP/enb_agent_common.c +++ b/openair2/ENB_APP/enb_agent_common.c @@ -586,7 +586,7 @@ int get_num_ues (mid_t mod_id){ int get_ue_crnti (mid_t mod_id, mid_t ue_id){ - return ((UE_list_t *)enb_ue[mod_id])->eNB_UE_stats[UE_PCCID(mod_id,ue_id)][ue_id].crnti; + return UE_RNTI(mod_id, ue_id); } int get_ue_bsr (mid_t mod_id, mid_t ue_id, lcid_t lcid) { From 9bbc22f496cdf92b4731de68ad2b57b34403a3e3 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Wed, 24 Feb 2016 18:28:32 +0000 Subject: [PATCH 124/349] Added UE state change message support --- openair2/ENB_APP/enb_agent_common.c | 636 +++++++++++++++++++++------- 1 file changed, 489 insertions(+), 147 deletions(-) diff --git a/openair2/ENB_APP/enb_agent_common.c b/openair2/ENB_APP/enb_agent_common.c index d971b67fac..835c4664d4 100644 --- a/openair2/ENB_APP/enb_agent_common.c +++ b/openair2/ENB_APP/enb_agent_common.c @@ -45,12 +45,11 @@ #include "RRC/LITE/extern.h" #include "RRC/L2_INTERFACE/openair_rrc_L2_interface.h" - +#include "rrc_eNB_UE_context.h" void * enb[NUM_MAX_ENB]; void * enb_ue[NUM_MAX_ENB]; void * enb_rrc[NUM_MAX_ENB]; -void * enb_ue_rrc[NUM_MAX_ENB]; /* * message primitives */ @@ -343,70 +342,6 @@ int enb_agent_destroy_lc_config_reply(Protocol__ProgranMessage *msg) { return -1; } -int enb_agent_ue_state_change(mid_t mod_id, uint32_t rnti, uint8_t state_change) { - int size; - Protocol__ProgranMessage *msg; - Protocol__PrpHeader *header; - void *data; - int priority; - err_code_t err_code; - - int xid = 0; - - if (prp_create_header(xid, PROTOCOL__PRP_TYPE__PRPT_UE_STATE_CHANGE, &header) != 0) - goto error; - - Protocol__PrpUeStateChange *ue_state_change_msg; - ue_state_change_msg = malloc(sizeof(Protocol__PrpUeStateChange)); - if(ue_state_change_msg == NULL) { - goto error; - } - protocol__prp_ue_state_change__init(ue_state_change_msg); - ue_state_change_msg->has_type = 1; - ue_state_change_msg->type = state_change; - - Protocol__PrpUeConfig *config; - config = malloc(sizeof(Protocol__PrpUeConfig)); - if (config == NULL) { - goto error; - } - protocol__prp_ue_config__init(config); - if (state_change == PROTOCOL__PRP_UE_STATE_CHANGE_TYPE__PRUESC_DEACTIVATED) { - // Simply set the rnti of the UE - config->has_rnti = 1; - config->rnti = rnti; - } else if (state_change == PROTOCOL__PRP_UE_STATE_CHANGE_TYPE__PRUESC_UPDATED - || state_change == PROTOCOL__PRP_UE_STATE_CHANGE_TYPE__PRUESC_ACTIVATED) { - // TODO: Set the whole UE configuration message - config->has_rnti = 1; - config->rnti = rnti; - } else if (state_change == PROTOCOL__PRP_UE_STATE_CHANGE_TYPE__PRUESC_MOVED) { - // TODO: Not supported for now. Leave blank - } - - ue_state_change_msg->config = config; - msg = malloc(sizeof(Protocol__ProgranMessage)); - if (msg == NULL) { - goto error; - } - protocol__progran_message__init(msg); - msg->msg_case = PROTOCOL__PROGRAN_MESSAGE__MSG_UE_STATE_CHANGE_MSG; - msg->msg_dir = PROTOCOL__PROGRAN_DIRECTION__INITIATING_MESSAGE; - msg->ue_state_change_msg = ue_state_change_msg; - - data = enb_agent_pack_message(msg, &size); - /*Send sr info using the MAC channel of the eNB*/ - if (enb_agent_msg_send(mod_id, ENB_AGENT_DEFAULT, data, size, priority)) { - err_code = PROTOCOL__PROGRAN_ERR__MSG_ENQUEUING; - goto error; - } - - LOG_D(ENB_AGENT,"sent message with size %d\n", size); - return; - error: - LOG_D(ENB_AGENT, "Could not send UE state message\n"); -} - int enb_agent_destroy_ue_state_change(Protocol__ProgranMessage *msg) { if(msg->msg_case != PROTOCOL__PROGRAN_MESSAGE__MSG_UE_STATE_CHANGE_MSG) goto error; @@ -525,7 +460,6 @@ void set_enb_vars(mid_t mod_id, ran_name_t ran){ enb[mod_id] = (void *)&eNB_mac_inst[mod_id]; enb_ue[mod_id] = (void *)&eNB_mac_inst[mod_id].UE_list; enb_rrc[mod_id] = (void *)&eNB_rrc_inst[mod_id]; - enb_ue_rrc[mod_id] = (void *)&UE_rrc_inst[mod_id]; break; default : goto error; @@ -901,26 +835,60 @@ int get_num_pdcch_symb(mid_t mod_id, int CC_id) * ************************************ */ + int get_time_alignment_timer(mid_t mod_id, mid_t ue_id) { - return (((UE_RRC_INST *)enb_ue_rrc[ue_id])->mac_MainConfig[mod_id]->timeAlignmentTimerDedicated); + struct rrc_eNB_ue_context_s* ue_context_p = NULL; + uint32_t rntiP = get_ue_crnti(mod_id,ue_id); + + LOG_I(ENB_APP,"The value of rntiP is %d\n",rntiP); + ue_context_p = rrc_eNB_get_ue_context(&eNB_rrc_inst[mod_id],rntiP); + if(ue_context_p != NULL) + { + if(ue_context_p->ue_context.mac_MainConfig != NULL) + return ue_context_p->ue_context.mac_MainConfig->timeAlignmentTimerDedicated; + } + else + return -1; } int get_meas_gap_config(mid_t mod_id, mid_t ue_id) { - if(((UE_RRC_INST *)enb_ue_rrc[ue_id])->measGapConfig[mod_id]->present == MeasGapConfig_PR_NOTHING) - return 2; - else if(((UE_RRC_INST *)enb_ue_rrc[ue_id])->measGapConfig[mod_id]->present == MeasGapConfig_PR_release) - return 0; - else if(((UE_RRC_INST *)enb_ue_rrc[ue_id])->measGapConfig[mod_id]->present == MeasGapConfig_PR_setup) - return 1; + struct rrc_eNB_ue_context_s* ue_context_p = NULL; + uint32_t rntiP = get_ue_crnti(mod_id,ue_id); - return -1; + LOG_I(ENB_APP,"The value of rntiP is %d\n",rntiP); + ue_context_p = rrc_eNB_get_ue_context(&eNB_rrc_inst[mod_id],rntiP); + if(ue_context_p != NULL) + { + if(ue_context_p->ue_context.measGapConfig != NULL){ + if(ue_context_p->ue_context.measGapConfig->present == MeasGapConfig_PR_NOTHING) + return 2; + else if (ue_context_p->ue_context.measGapConfig->present == MeasGapConfig_PR_release) + return 0; + else if(ue_context_p->ue_context.measGapConfig->present == MeasGapConfig_PR_setup) + return 1; + } + } + else + return -1; } int get_meas_gap_config_offset(mid_t mod_id, mid_t ue_id) { - return (((UE_RRC_INST *)enb_ue_rrc[ue_id])->measGapConfig[mod_id]->choice.setup.gapOffset.present); + struct rrc_eNB_ue_context_s* ue_context_p = NULL; + uint32_t rntiP = get_ue_crnti(mod_id,ue_id); + + ue_context_p = rrc_eNB_get_ue_context(&eNB_rrc_inst[mod_id],rntiP); + + if(ue_context_p != NULL) + { + if(ue_context_p->ue_context.measGapConfig != NULL){ + return ue_context_p->ue_context.measGapConfig->choice.setup.gapOffset.present; + } + } + else + return -1; } int get_ue_aggregated_max_bitrate_dl (mid_t mod_id, mid_t ue_id) @@ -935,110 +903,250 @@ int get_ue_aggregated_max_bitrate_ul (mid_t mod_id, mid_t ue_id) int get_half_duplex(mid_t ue_id) { - int halfduplex = 0; - int bands_to_scan = ((UE_RRC_INST *)enb_ue_rrc[ue_id])->UECap->UE_EUTRA_Capability->rf_Parameters.supportedBandListEUTRA.list.count; - for (int i =0; i < bands_to_scan; i++){ - if(((UE_RRC_INST *)enb_ue_rrc[ue_id])->UECap->UE_EUTRA_Capability->rf_Parameters.supportedBandListEUTRA.list.array[i]->halfDuplex > 0) - halfduplex = 1; - } - return halfduplex; + //int halfduplex = 0; + //int bands_to_scan = ((UE_RRC_INST *)enb_ue_rrc[ue_id])->UECap->UE_EUTRA_Capability->rf_Parameters.supportedBandListEUTRA.list.count; + //for (int i =0; i < bands_to_scan; i++){ + //if(((UE_RRC_INST *)enb_ue_rrc[ue_id])->UECap->UE_EUTRA_Capability->rf_Parameters.supportedBandListEUTRA.list.array[i]->halfDuplex > 0) + // halfduplex = 1; + //} + //return halfduplex; } int get_intra_sf_hopping(mid_t ue_id) { - uint8_t temp = 0; - temp = (((UE_RRC_INST *)enb_ue_rrc[ue_id])->UECap->UE_EUTRA_Capability->featureGroupIndicators->buf); - return (temp & ( 1 << (31))); + //TODO:Get proper value + //temp = (((UE_RRC_INST *)enb_ue_rrc[ue_id])->UECap->UE_EUTRA_Capability->featureGroupIndicators->buf); + //return (0 & ( 1 << (31))); } int get_type2_sb_1(mid_t ue_id) { - uint8_t temp = 0; - temp = (((UE_RRC_INST *)enb_ue_rrc[ue_id])->UECap->UE_EUTRA_Capability->featureGroupIndicators->buf); - return (temp & ( 1 << (11))); + //TODO:Get proper value + //uint8_t temp = 0; + //temp = (((UE_RRC_INST *)enb_ue_rrc[ue_id])->UECap->UE_EUTRA_Capability->featureGroupIndicators->buf); + //return (temp & ( 1 << (11))); } int get_ue_category(mid_t ue_id) { - return (((UE_RRC_INST *)enb_ue_rrc[ue_id])->UECap->UE_EUTRA_Capability->ue_Category); + //TODO:Get proper value + //return (((UE_RRC_INST *)enb_ue_rrc[ue_id])->UECap->UE_EUTRA_Capability->ue_Category); } int get_res_alloc_type1(mid_t ue_id) { - uint8_t temp = 0; - temp = (((UE_RRC_INST *)enb_ue_rrc[ue_id])->UECap->UE_EUTRA_Capability->featureGroupIndicators->buf); - return (temp & ( 1 << (30))); + //TODO:Get proper value + //uint8_t temp = 0; + //temp = (((UE_RRC_INST *)enb_ue_rrc[ue_id])->UECap->UE_EUTRA_Capability->featureGroupIndicators->buf); + //return (temp & ( 1 << (30))); } int get_ue_transmission_mode(mid_t mod_id, mid_t ue_id) { - return (((UE_RRC_INST *)enb_ue_rrc[ue_id])->physicalConfigDedicated[mod_id]->antennaInfo->choice.explicitValue.transmissionMode); + struct rrc_eNB_ue_context_s* ue_context_p = NULL; + uint32_t rntiP = get_ue_crnti(mod_id,ue_id); + + ue_context_p = rrc_eNB_get_ue_context(&eNB_rrc_inst[mod_id],rntiP); + + if(ue_context_p != NULL) + { + if(ue_context_p->ue_context.physicalConfigDedicated != NULL){ + return ue_context_p->ue_context.physicalConfigDedicated->antennaInfo->choice.explicitValue.transmissionMode; + } + } + else + return -1; } int get_tti_bundling(mid_t mod_id, mid_t ue_id) { - return (((UE_RRC_INST *)enb_ue_rrc[ue_id])->mac_MainConfig[mod_id]->ul_SCH_Config->ttiBundling); + struct rrc_eNB_ue_context_s* ue_context_p = NULL; + uint32_t rntiP = get_ue_crnti(mod_id,ue_id); + + ue_context_p = rrc_eNB_get_ue_context(&eNB_rrc_inst[mod_id],rntiP); + if(ue_context_p != NULL) + { + if(ue_context_p->ue_context.mac_MainConfig != NULL){ + return ue_context_p->ue_context.mac_MainConfig->ul_SCH_Config->ttiBundling; + } + } + else + return -1; } int get_maxHARQ_TX(mid_t mod_id, mid_t ue_id) { - return (((UE_RRC_INST *)enb_ue_rrc[ue_id])->mac_MainConfig[mod_id]->ul_SCH_Config->maxHARQ_Tx); + struct rrc_eNB_ue_context_s* ue_context_p = NULL; + uint32_t rntiP = get_ue_crnti(mod_id,ue_id); + + ue_context_p = rrc_eNB_get_ue_context(&eNB_rrc_inst[mod_id],rntiP); + if(ue_context_p != NULL) + { + if(ue_context_p->ue_context.mac_MainConfig != NULL){ + return ue_context_p->ue_context.mac_MainConfig->ul_SCH_Config->maxHARQ_Tx; + } + } + else + return -1; } int get_beta_offset_ack_index(mid_t mod_id, mid_t ue_id) { - return (((UE_RRC_INST *)enb_ue_rrc[ue_id])->physicalConfigDedicated[mod_id]->pusch_ConfigDedicated->betaOffset_ACK_Index); + struct rrc_eNB_ue_context_s* ue_context_p = NULL; + uint32_t rntiP = get_ue_crnti(mod_id,ue_id); + + ue_context_p = rrc_eNB_get_ue_context(&eNB_rrc_inst[mod_id],rntiP); + if(ue_context_p != NULL) + { + if(ue_context_p->ue_context.physicalConfigDedicated != NULL){ + return ue_context_p->ue_context.physicalConfigDedicated->pusch_ConfigDedicated->betaOffset_ACK_Index; + } + } + else + return -1; } int get_beta_offset_ri_index(mid_t mod_id, mid_t ue_id) { - return (((UE_RRC_INST *)enb_ue_rrc[ue_id])->physicalConfigDedicated[mod_id]->pusch_ConfigDedicated->betaOffset_RI_Index); + struct rrc_eNB_ue_context_s* ue_context_p = NULL; + uint32_t rntiP = get_ue_crnti(mod_id,ue_id); + + ue_context_p = rrc_eNB_get_ue_context(&eNB_rrc_inst[mod_id],rntiP); + if(ue_context_p != NULL) + { + if(ue_context_p->ue_context.physicalConfigDedicated != NULL){ + return ue_context_p->ue_context.physicalConfigDedicated->pusch_ConfigDedicated->betaOffset_RI_Index; + } + } + else + return -1; } int get_beta_offset_cqi_index(mid_t mod_id, mid_t ue_id) { - return (((UE_RRC_INST *)enb_ue_rrc[ue_id])->physicalConfigDedicated[mod_id]->pusch_ConfigDedicated->betaOffset_CQI_Index); + struct rrc_eNB_ue_context_s* ue_context_p = NULL; + uint32_t rntiP = get_ue_crnti(mod_id,ue_id); + + ue_context_p = rrc_eNB_get_ue_context(&eNB_rrc_inst[mod_id],rntiP); + if(ue_context_p != NULL) + { + if(ue_context_p->ue_context.physicalConfigDedicated != NULL){ + return ue_context_p->ue_context.physicalConfigDedicated->pusch_ConfigDedicated->betaOffset_CQI_Index; + } + } + else + return -1; } int get_simultaneous_ack_nack_cqi(mid_t mod_id, mid_t ue_id) { - return (((UE_RRC_INST *)enb_ue_rrc[ue_id])->physicalConfigDedicated[mod_id]->cqi_ReportConfig->cqi_ReportPeriodic->choice.setup.simultaneousAckNackAndCQI); + struct rrc_eNB_ue_context_s* ue_context_p = NULL; + uint32_t rntiP = get_ue_crnti(mod_id,ue_id); + + ue_context_p = rrc_eNB_get_ue_context(&eNB_rrc_inst[mod_id],rntiP); + if(ue_context_p != NULL) { + if(ue_context_p->ue_context.physicalConfigDedicated != NULL){ + if (ue_context_p->ue_context.physicalConfigDedicated->cqi_ReportConfig->cqi_ReportPeriodic != NULL) { + return ue_context_p->ue_context.physicalConfigDedicated->cqi_ReportConfig->cqi_ReportPeriodic->choice.setup.simultaneousAckNackAndCQI; + } + } + } + return -1; } int get_ack_nack_simultaneous_trans(mid_t mod_id,mid_t ue_id) { - return (((UE_RRC_INST *)enb_ue_rrc[ue_id])->sib2[mod_id]->radioResourceConfigCommon.soundingRS_UL_ConfigCommon.choice.setup.ackNackSRS_SimultaneousTransmission); + return (&eNB_rrc_inst[mod_id])->carrier[0].sib2->radioResourceConfigCommon.soundingRS_UL_ConfigCommon.choice.setup.ackNackSRS_SimultaneousTransmission; } int get_aperiodic_cqi_rep_mode(mid_t mod_id,mid_t ue_id) { - return (((UE_RRC_INST *)enb_ue_rrc[ue_id])->physicalConfigDedicated[mod_id]->cqi_ReportConfig->cqi_ReportModeAperiodic); + struct rrc_eNB_ue_context_s* ue_context_p = NULL; + uint32_t rntiP = get_ue_crnti(mod_id,ue_id); + + ue_context_p = rrc_eNB_get_ue_context(&eNB_rrc_inst[mod_id],rntiP); + + if(ue_context_p != NULL) + { + if(ue_context_p->ue_context.physicalConfigDedicated != NULL){ + return ue_context_p->ue_context.physicalConfigDedicated->cqi_ReportConfig->cqi_ReportModeAperiodic; + } + } + else + return -1; } int get_tdd_ack_nack_feedback(mid_t mod_id, mid_t ue_id) { - return (((UE_RRC_INST *)enb_ue_rrc[ue_id])->physicalConfigDedicated[mod_id]->pucch_ConfigDedicated->tdd_AckNackFeedbackMode); + struct rrc_eNB_ue_context_s* ue_context_p = NULL; + uint32_t rntiP = get_ue_crnti(mod_id,ue_id); + + ue_context_p = rrc_eNB_get_ue_context(&eNB_rrc_inst[mod_id],rntiP); + + if(ue_context_p != NULL) + { + if(ue_context_p->ue_context.physicalConfigDedicated != NULL){ + return ue_context_p->ue_context.physicalConfigDedicated->pucch_ConfigDedicated->tdd_AckNackFeedbackMode; + } + } + else + return -1; } int get_ack_nack_repetition_factor(mid_t mod_id, mid_t ue_id) { - return (((UE_RRC_INST *)enb_ue_rrc[ue_id])->physicalConfigDedicated[mod_id]->pucch_ConfigDedicated->ackNackRepetition.choice.setup.repetitionFactor); + struct rrc_eNB_ue_context_s* ue_context_p = NULL; + uint32_t rntiP = get_ue_crnti(mod_id,ue_id); + + ue_context_p = rrc_eNB_get_ue_context(&eNB_rrc_inst[mod_id],rntiP); + if(ue_context_p != NULL) + { + if(ue_context_p->ue_context.physicalConfigDedicated != NULL){ + return ue_context_p->ue_context.physicalConfigDedicated->pucch_ConfigDedicated->ackNackRepetition.choice.setup.repetitionFactor; + } + } + else + return -1; } int get_extended_bsr_size(mid_t mod_id, mid_t ue_id) { //TODO: need to double check - return (((UE_RRC_INST *)enb_ue_rrc[ue_id])->mac_MainConfig[mod_id]->ext2->mac_MainConfig_v1020->extendedBSR_Sizes_r10); + struct rrc_eNB_ue_context_s* ue_context_p = NULL; + uint32_t rntiP = get_ue_crnti(mod_id,ue_id); + + ue_context_p = rrc_eNB_get_ue_context(&eNB_rrc_inst[mod_id],rntiP); + if(ue_context_p != NULL) + { + if(ue_context_p->ue_context.mac_MainConfig != NULL){ + if(ue_context_p->ue_context.mac_MainConfig->ext2 != NULL){ + return ue_context_p->ue_context.mac_MainConfig->ext2->mac_MainConfig_v1020->extendedBSR_Sizes_r10; + } + } + } + return -1; } int get_ue_transmission_antenna(mid_t mod_id, mid_t ue_id) { - if(((UE_RRC_INST *)enb_ue_rrc[ue_id])->physicalConfigDedicated[mod_id]->antennaInfo->choice.explicitValue.ue_TransmitAntennaSelection.choice.setup == AntennaInfoDedicated__ue_TransmitAntennaSelection__setup_closedLoop) - return 2; - else if(((UE_RRC_INST *)enb_ue_rrc[ue_id])->physicalConfigDedicated[mod_id]->antennaInfo->choice.explicitValue.ue_TransmitAntennaSelection.choice.setup == AntennaInfoDedicated__ue_TransmitAntennaSelection__setup_openLoop) - return 1; + struct rrc_eNB_ue_context_s* ue_context_p = NULL; + uint32_t rntiP = get_ue_crnti(mod_id,ue_id); + + ue_context_p = rrc_eNB_get_ue_context(&eNB_rrc_inst[mod_id],rntiP); + + if(ue_context_p != NULL) + { + if(ue_context_p->ue_context.physicalConfigDedicated != NULL){ + if(ue_context_p->ue_context.physicalConfigDedicated->antennaInfo->choice.explicitValue.ue_TransmitAntennaSelection.choice.setup == AntennaInfoDedicated__ue_TransmitAntennaSelection__setup_closedLoop) + return 2; + else if(ue_context_p->ue_context.physicalConfigDedicated->antennaInfo->choice.explicitValue.ue_TransmitAntennaSelection.choice.setup == AntennaInfoDedicated__ue_TransmitAntennaSelection__setup_openLoop) + return 1; + else + return 0; + } + } else - return 0; + return -1; } int get_lcg(mid_t ue_id, mid_t lc_id) @@ -1059,6 +1167,207 @@ int get_direction(mid_t ue_id, mid_t lc_id) return 1; } +int enb_agent_ue_state_change(mid_t mod_id, uint32_t rnti, uint8_t state_change) { + int size; + Protocol__ProgranMessage *msg; + Protocol__PrpHeader *header; + void *data; + int priority; + err_code_t err_code; + + int xid = 0; + + if (prp_create_header(xid, PROTOCOL__PRP_TYPE__PRPT_UE_STATE_CHANGE, &header) != 0) + goto error; + + Protocol__PrpUeStateChange *ue_state_change_msg; + ue_state_change_msg = malloc(sizeof(Protocol__PrpUeStateChange)); + if(ue_state_change_msg == NULL) { + goto error; + } + protocol__prp_ue_state_change__init(ue_state_change_msg); + ue_state_change_msg->has_type = 1; + ue_state_change_msg->type = state_change; + + Protocol__PrpUeConfig *config; + config = malloc(sizeof(Protocol__PrpUeConfig)); + if (config == NULL) { + goto error; + } + protocol__prp_ue_config__init(config); + if (state_change == PROTOCOL__PRP_UE_STATE_CHANGE_TYPE__PRUESC_DEACTIVATED) { + // Simply set the rnti of the UE + config->has_rnti = 1; + config->rnti = rnti; + } else if (state_change == PROTOCOL__PRP_UE_STATE_CHANGE_TYPE__PRUESC_UPDATED + || state_change == PROTOCOL__PRP_UE_STATE_CHANGE_TYPE__PRUESC_ACTIVATED) { + int i =find_UE_id(mod_id,rnti); + config->has_rnti = 1; + config->rnti = rnti; + LOG_I(ENB_APP,"The value of i is %d\n",i); + LOG_I(ENB_APP,"The value of rnto is %d\n",rnti); + //TODO: Set the time_alignment_timer + if(get_time_alignment_timer(mod_id,i) != -1){ + config->time_alignment_timer = get_time_alignment_timer(mod_id,i); + config->has_time_alignment_timer = 1; + } + //TODO: Set the measurement gap configuration pattern + if(get_meas_gap_config(mod_id,i) != -1){ + config->meas_gap_config_pattern = get_meas_gap_config(mod_id,i); + config->has_meas_gap_config_pattern = 1; + } + //TODO: Set the measurement gap offset if applicable + if(get_meas_gap_config_offset(mod_id,i) != -1){ + config->meas_gap_config_sf_offset = get_meas_gap_config_offset(mod_id,i); + config->has_meas_gap_config_sf_offset = 1; + } + //TODO: Set the SPS configuration (Optional) + //Not supported for noe, so we do not set it + + //TODO: Set the SR configuration (Optional) + //We do not set it for now + + //TODO: Set the CQI configuration (Optional) + //We do not set it for now + + //TODO: Set the transmission mode + if(get_ue_transmission_mode(mod_id,i) != -1){ + config->transmission_mode = get_ue_transmission_mode(mod_id,i); + config->has_transmission_mode = 1; + } + + //TODO: Set the aggregated bit-rate of the non-gbr bearer (UL) + config->ue_aggregated_max_bitrate_ul = get_ue_aggregated_max_bitrate_ul(mod_id,i); + config->has_ue_aggregated_max_bitrate_ul = 1; + + //TODO: Set the aggregated bit-rate of the non-gbr bearer (DL) + config->ue_aggregated_max_bitrate_dl = get_ue_aggregated_max_bitrate_dl(mod_id,i); + config->has_ue_aggregated_max_bitrate_dl = 1; + + //TODO: Set the UE capabilities + Protocol__PrpUeCapabilities *c_capabilities; + c_capabilities = malloc(sizeof(Protocol__PrpUeCapabilities)); + protocol__prp_ue_capabilities__init(c_capabilities); + //TODO: Set half duplex (FDD operation) + c_capabilities->has_half_duplex = 1; + c_capabilities->half_duplex = 1;//get_half_duplex(i); + //TODO: Set intra-frame hopping flag + c_capabilities->has_intra_sf_hopping = 1; + c_capabilities->intra_sf_hopping = 1;//get_intra_sf_hopping(i); + //TODO: Set support for type 2 hopping with n_sb > 1 + c_capabilities->has_type2_sb_1 = 1; + c_capabilities->type2_sb_1 = 1;//get_type2_sb_1(i); + //TODO: Set ue category + c_capabilities->has_ue_category = 1; + c_capabilities->ue_category = 1;//get_ue_category(i); + //TODO: Set UE support for resource allocation type 1 + c_capabilities->has_res_alloc_type1 = 1; + c_capabilities->res_alloc_type1 = 1;//get_res_alloc_type1(i); + //Set the capabilites to the message + config->capabilities = c_capabilities; + //TODO: Set UE transmission antenna. One of the PRUTA_* values + if(get_ue_transmission_antenna(mod_id,i) != -1){ + config->has_ue_transmission_antenna = 1; + config->ue_transmission_antenna = get_ue_transmission_antenna(mod_id,i); + } + //TODO: Set tti bundling flag (See ts 36.321) + if(get_tti_bundling(mod_id,i) != -1){ + config->has_tti_bundling = 1; + config->tti_bundling = get_tti_bundling(mod_id,i); + } + //TODO: Set the max HARQ retransmission for the UL + if(get_maxHARQ_TX(mod_id,i) != -1){ + config->has_max_harq_tx = 1; + config->max_harq_tx = get_maxHARQ_TX(mod_id,i); + } + //TODO: Fill beta_offset_ack_index (TS 36.213) + if(get_beta_offset_ack_index(mod_id,i) != -1){ + config->has_beta_offset_ack_index = 1; + config->beta_offset_ack_index = get_beta_offset_ack_index(mod_id,i); + } + //TODO: Fill beta_offset_ri_index (TS 36.213) + if(get_beta_offset_ri_index(mod_id,i) != -1){ + config->has_beta_offset_ri_index = 1; + config->beta_offset_ri_index = get_beta_offset_ri_index(mod_id,i); + } + //TODO: Fill beta_offset_cqi_index (TS 36.213) + if(get_beta_offset_cqi_index(mod_id,i) != -1){ + config->has_beta_offset_cqi_index = 1; + config->beta_offset_cqi_index = get_beta_offset_cqi_index(mod_id,i); + } + //TODO: Fill ack_nack_simultaneous_trans (TS 36.213) + if(get_ack_nack_simultaneous_trans(mod_id,i) != -1){ + config->has_ack_nack_simultaneous_trans = 1; + config->ack_nack_simultaneous_trans = get_ack_nack_simultaneous_trans(mod_id,i); + } + //TODO: Fill simultaneous_ack_nack_cqi (TS 36.213) + if(get_simultaneous_ack_nack_cqi(mod_id,i) != -1){ + config->has_simultaneous_ack_nack_cqi = 1; + config->simultaneous_ack_nack_cqi = get_simultaneous_ack_nack_cqi(mod_id,i); + } + //TODO: Set PRACRM_* value regarding aperiodic cqi report mode + if(get_aperiodic_cqi_rep_mode(mod_id,i) != -1){ + config->has_aperiodic_cqi_rep_mode = 1; + config->aperiodic_cqi_rep_mode = get_aperiodic_cqi_rep_mode(mod_id,i); + } + //TODO: Set tdd_ack_nack_feedback + if(get_tdd_ack_nack_feedback != -1){ + config->has_tdd_ack_nack_feedback = 1; + config->tdd_ack_nack_feedback = get_tdd_ack_nack_feedback(mod_id,i); + } + //TODO: Set ack_nack_repetition factor + if(get_ack_nack_repetition_factor != -1){ + config->has_ack_nack_repetition_factor = 1; + config->ack_nack_repetition_factor = get_ack_nack_repetition_factor(mod_id,i); + } + //TODO: Set extended BSR size + if(get_extended_bsr_size != -1){ + config->has_extended_bsr_size = 1; + config->extended_bsr_size = get_extended_bsr_size(mod_id,i); + } + //TODO: Set carrier aggregation support (boolean) + config->has_ca_support = 0; + config->ca_support = 0; + if(config->has_ca_support){ + //TODO: Set cross carrier scheduling support (boolean) + config->has_cross_carrier_sched_support = 1; + config->cross_carrier_sched_support = 0; + //TODO: Set index of primary cell + config->has_pcell_carrier_index = 1; + config->pcell_carrier_index = 1; + //TODO: Set secondary cells configuration + // We do not set it for now. No carrier aggregation support + + //TODO: Set deactivation timer for secondary cell + config->has_scell_deactivation_timer = 1; + config->scell_deactivation_timer = 1; + } + } else if (state_change == PROTOCOL__PRP_UE_STATE_CHANGE_TYPE__PRUESC_MOVED) { + // TODO: Not supported for now. Leave blank + } + + ue_state_change_msg->config = config; + msg = malloc(sizeof(Protocol__ProgranMessage)); + if (msg == NULL) { + goto error; + } + protocol__progran_message__init(msg); + msg->msg_case = PROTOCOL__PROGRAN_MESSAGE__MSG_UE_STATE_CHANGE_MSG; + msg->msg_dir = PROTOCOL__PROGRAN_DIRECTION__INITIATING_MESSAGE; + msg->ue_state_change_msg = ue_state_change_msg; + + data = enb_agent_pack_message(msg, &size); + /*Send sr info using the MAC channel of the eNB*/ + if (enb_agent_msg_send(mod_id, ENB_AGENT_DEFAULT, data, size, priority)) { + err_code = PROTOCOL__PROGRAN_ERR__MSG_ENQUEUING; + goto error; + } + + LOG_D(ENB_AGENT,"sent message with size %d\n", size); + return; + error: + LOG_D(ENB_AGENT, "Could not send UE state message\n"); +} /* * timer primitives @@ -1225,14 +1534,20 @@ int enb_agent_ue_config_reply(mid_t mod_id, const void *params, Protocol__Progra //Not supported for now, so we do not set it //TODO: Set the time_alignment_timer - ue_config[i]->time_alignment_timer = get_time_alignment_timer(mod_id,i); - ue_config[i]->has_time_alignment_timer = 1; + if(get_time_alignment_timer(mod_id,i) != -1){ + ue_config[i]->time_alignment_timer = get_time_alignment_timer(mod_id,i); + ue_config[i]->has_time_alignment_timer = 1; + } //TODO: Set the measurement gap configuration pattern - ue_config[i]->meas_gap_config_pattern = get_meas_gap_config(mod_id,i); - ue_config[i]->has_meas_gap_config_pattern = 1; + if(get_meas_gap_config(mod_id,i) != -1){ + ue_config[i]->meas_gap_config_pattern = get_meas_gap_config(mod_id,i); + ue_config[i]->has_meas_gap_config_pattern = 1; + } //TODO: Set the measurement gap offset if applicable - ue_config[i]->meas_gap_config_sf_offset = get_meas_gap_config_offset(mod_id,i); - ue_config[i]->has_meas_gap_config_sf_offset = 1; + if(get_meas_gap_config_offset(mod_id,i) != -1){ + ue_config[i]->meas_gap_config_sf_offset = get_meas_gap_config_offset(mod_id,i); + ue_config[i]->has_meas_gap_config_sf_offset = 1; + } //TODO: Set the SPS configuration (Optional) //Not supported for noe, so we do not set it @@ -1243,8 +1558,10 @@ int enb_agent_ue_config_reply(mid_t mod_id, const void *params, Protocol__Progra //We do not set it for now //TODO: Set the transmission mode - ue_config[i]->transmission_mode = get_ue_transmission_mode(mod_id,i); - ue_config[i]->has_transmission_mode = 1; + if(get_ue_transmission_mode(mod_id,i) != -1){ + ue_config[i]->transmission_mode = get_ue_transmission_mode(mod_id,i); + ue_config[i]->has_transmission_mode = 1; + } //TODO: Set the aggregated bit-rate of the non-gbr bearer (UL) ue_config[i]->ue_aggregated_max_bitrate_ul = get_ue_aggregated_max_bitrate_ul(mod_id,i); @@ -1260,57 +1577,81 @@ int enb_agent_ue_config_reply(mid_t mod_id, const void *params, Protocol__Progra protocol__prp_ue_capabilities__init(capabilities); //TODO: Set half duplex (FDD operation) capabilities->has_half_duplex = 1; - capabilities->half_duplex = get_half_duplex(i); + capabilities->half_duplex = 1;//get_half_duplex(i); //TODO: Set intra-frame hopping flag capabilities->has_intra_sf_hopping = 1; - capabilities->intra_sf_hopping = get_intra_sf_hopping(i); + capabilities->intra_sf_hopping = 1;//get_intra_sf_hopping(i); //TODO: Set support for type 2 hopping with n_sb > 1 capabilities->has_type2_sb_1 = 1; - capabilities->type2_sb_1 = get_type2_sb_1(i); + capabilities->type2_sb_1 = 1;//get_type2_sb_1(i); //TODO: Set ue category capabilities->has_ue_category = 1; - capabilities->ue_category = get_ue_category(i); + capabilities->ue_category = 1;//get_ue_category(i); //TODO: Set UE support for resource allocation type 1 capabilities->has_res_alloc_type1 = 1; - capabilities->res_alloc_type1 = get_res_alloc_type1(i); + capabilities->res_alloc_type1 = 1;//get_res_alloc_type1(i); //Set the capabilites to the message ue_config[i]->capabilities = capabilities; //TODO: Set UE transmission antenna. One of the PRUTA_* values - ue_config[i]->has_ue_transmission_antenna = 1; - ue_config[i]->ue_transmission_antenna = get_ue_transmission_antenna(mod_id,i); + if(get_ue_transmission_antenna(mod_id,i) != -1){ + ue_config[i]->has_ue_transmission_antenna = 1; + ue_config[i]->ue_transmission_antenna = get_ue_transmission_antenna(mod_id,i); + } //TODO: Set tti bundling flag (See ts 36.321) - ue_config[i]->has_tti_bundling = 1; - ue_config[i]->tti_bundling = get_tti_bundling(mod_id,i); + if(get_tti_bundling(mod_id,i) != -1){ + ue_config[i]->has_tti_bundling = 1; + ue_config[i]->tti_bundling = get_tti_bundling(mod_id,i); + } //TODO: Set the max HARQ retransmission for the UL - ue_config[i]->has_max_harq_tx = 1; - ue_config[i]->max_harq_tx = get_maxHARQ_TX(mod_id,i); + if(get_maxHARQ_TX(mod_id,i) != -1){ + ue_config[i]->has_max_harq_tx = 1; + ue_config[i]->max_harq_tx = get_maxHARQ_TX(mod_id,i); + } //TODO: Fill beta_offset_ack_index (TS 36.213) - ue_config[i]->has_beta_offset_ack_index = 1; - ue_config[i]->beta_offset_ack_index = get_beta_offset_ack_index(mod_id,i); + if(get_beta_offset_ack_index(mod_id,i) != -1){ + ue_config[i]->has_beta_offset_ack_index = 1; + ue_config[i]->beta_offset_ack_index = get_beta_offset_ack_index(mod_id,i); + } //TODO: Fill beta_offset_ri_index (TS 36.213) - ue_config[i]->has_beta_offset_ri_index = 1; - ue_config[i]->beta_offset_ri_index = get_beta_offset_ri_index(mod_id,i); + if(get_beta_offset_ri_index(mod_id,i) != -1){ + ue_config[i]->has_beta_offset_ri_index = 1; + ue_config[i]->beta_offset_ri_index = get_beta_offset_ri_index(mod_id,i); + } //TODO: Fill beta_offset_cqi_index (TS 36.213) - ue_config[i]->has_beta_offset_cqi_index = 1; - ue_config[i]->beta_offset_cqi_index = get_beta_offset_cqi_index(mod_id,i); + if(get_beta_offset_cqi_index(mod_id,i) != -1){ + ue_config[i]->has_beta_offset_cqi_index = 1; + ue_config[i]->beta_offset_cqi_index = get_beta_offset_cqi_index(mod_id,i); + } //TODO: Fill ack_nack_simultaneous_trans (TS 36.213) - ue_config[i]->has_ack_nack_simultaneous_trans = 1; - ue_config[i]->ack_nack_simultaneous_trans = get_ack_nack_simultaneous_trans(mod_id,i); + if(get_ack_nack_simultaneous_trans(mod_id,i) != -1){ + ue_config[i]->has_ack_nack_simultaneous_trans = 1; + ue_config[i]->ack_nack_simultaneous_trans = get_ack_nack_simultaneous_trans(mod_id,i); + } //TODO: Fill simultaneous_ack_nack_cqi (TS 36.213) - ue_config[i]->has_simultaneous_ack_nack_cqi = 1; - ue_config[i]->simultaneous_ack_nack_cqi = get_simultaneous_ack_nack_cqi(mod_id,i); + if(get_simultaneous_ack_nack_cqi(mod_id,i) != -1){ + ue_config[i]->has_simultaneous_ack_nack_cqi = 1; + ue_config[i]->simultaneous_ack_nack_cqi = get_simultaneous_ack_nack_cqi(mod_id,i); + } //TODO: Set PRACRM_* value regarding aperiodic cqi report mode - ue_config[i]->has_aperiodic_cqi_rep_mode = 1; - ue_config[i]->aperiodic_cqi_rep_mode = get_aperiodic_cqi_rep_mode(mod_id,i); + if(get_aperiodic_cqi_rep_mode(mod_id,i) != -1){ + ue_config[i]->has_aperiodic_cqi_rep_mode = 1; + ue_config[i]->aperiodic_cqi_rep_mode = get_aperiodic_cqi_rep_mode(mod_id,i); + } //TODO: Set tdd_ack_nack_feedback - ue_config[i]->has_tdd_ack_nack_feedback = 1; - ue_config[i]->tdd_ack_nack_feedback = get_tdd_ack_nack_feedback(mod_id,i); + if(get_tdd_ack_nack_feedback != -1){ + ue_config[i]->has_tdd_ack_nack_feedback = 1; + ue_config[i]->tdd_ack_nack_feedback = get_tdd_ack_nack_feedback(mod_id,i); + } //TODO: Set ack_nack_repetition factor - ue_config[i]->has_ack_nack_repetition_factor = 1; - ue_config[i]->ack_nack_repetition_factor = get_ack_nack_repetition_factor(mod_id,i); + if(get_ack_nack_repetition_factor != -1){ + ue_config[i]->has_ack_nack_repetition_factor = 1; + ue_config[i]->ack_nack_repetition_factor = get_ack_nack_repetition_factor(mod_id,i); + } //TODO: Set extended BSR size - ue_config[i]->has_extended_bsr_size = 1; - ue_config[i]->extended_bsr_size = get_extended_bsr_size(mod_id,i); + if(get_extended_bsr_size != -1){ + ue_config[i]->has_extended_bsr_size = 1; + ue_config[i]->extended_bsr_size = get_extended_bsr_size(mod_id,i); + } //TODO: Set carrier aggregation support (boolean) ue_config[i]->has_ca_support = 0; ue_config[i]->ca_support = 0; @@ -1843,3 +2184,4 @@ err_code_t enb_agent_restart_timer(uint32_t *timer_id){ } */ + From 24785b3a61e59ed7d06cbf28dd17a96b7009668a Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Thu, 25 Feb 2016 01:06:04 +0000 Subject: [PATCH 125/349] Fixed bugs in API function calls for UE config --- openair2/ENB_APP/enb_agent_common.c | 232 +++++++++++++++------------- 1 file changed, 121 insertions(+), 111 deletions(-) diff --git a/openair2/ENB_APP/enb_agent_common.c b/openair2/ENB_APP/enb_agent_common.c index 835c4664d4..6122789d6e 100644 --- a/openair2/ENB_APP/enb_agent_common.c +++ b/openair2/ENB_APP/enb_agent_common.c @@ -852,43 +852,46 @@ int get_time_alignment_timer(mid_t mod_id, mid_t ue_id) return -1; } -int get_meas_gap_config(mid_t mod_id, mid_t ue_id) -{ - struct rrc_eNB_ue_context_s* ue_context_p = NULL; - uint32_t rntiP = get_ue_crnti(mod_id,ue_id); +int get_meas_gap_config(mid_t mod_id, mid_t ue_id) { + struct rrc_eNB_ue_context_s* ue_context_p = NULL; + uint32_t rntiP = get_ue_crnti(mod_id,ue_id); - LOG_I(ENB_APP,"The value of rntiP is %d\n",rntiP); - ue_context_p = rrc_eNB_get_ue_context(&eNB_rrc_inst[mod_id],rntiP); - if(ue_context_p != NULL) - { - if(ue_context_p->ue_context.measGapConfig != NULL){ - if(ue_context_p->ue_context.measGapConfig->present == MeasGapConfig_PR_NOTHING) - return 2; - else if (ue_context_p->ue_context.measGapConfig->present == MeasGapConfig_PR_release) - return 0; - else if(ue_context_p->ue_context.measGapConfig->present == MeasGapConfig_PR_setup) - return 1; - } + ue_context_p = rrc_eNB_get_ue_context(&eNB_rrc_inst[mod_id],rntiP); + if(ue_context_p != NULL) { + if(ue_context_p->ue_context.measGapConfig != NULL){ + if(ue_context_p->ue_context.measGapConfig->present == MeasGapConfig_PR_setup) { + if (ue_context_p->ue_context.measGapConfig->choice.setup.gapOffset.present == MeasGapConfig__setup__gapOffset_PR_gp0) { + return PROTOCOL__PRP_MEAS_GAP_CONFIG_PATTERN__PRMGCP_GP1; + } else if (ue_context_p->ue_context.measGapConfig->choice.setup.gapOffset.present == MeasGapConfig__setup__gapOffset_PR_gp1) { + return PROTOCOL__PRP_MEAS_GAP_CONFIG_PATTERN__PRMGCP_GP2; + } else { + return PROTOCOL__PRP_MEAS_GAP_CONFIG_PATTERN__PRMGCP_OFF; } - else - return -1; + } + } + } + return -1; } -int get_meas_gap_config_offset(mid_t mod_id, mid_t ue_id) -{ - struct rrc_eNB_ue_context_s* ue_context_p = NULL; - uint32_t rntiP = get_ue_crnti(mod_id,ue_id); - ue_context_p = rrc_eNB_get_ue_context(&eNB_rrc_inst[mod_id],rntiP); - - if(ue_context_p != NULL) - { - if(ue_context_p->ue_context.measGapConfig != NULL){ - return ue_context_p->ue_context.measGapConfig->choice.setup.gapOffset.present; - } - } - else - return -1; +int get_meas_gap_config_offset(mid_t mod_id, mid_t ue_id) { + struct rrc_eNB_ue_context_s* ue_context_p = NULL; + uint32_t rntiP = get_ue_crnti(mod_id,ue_id); + + ue_context_p = rrc_eNB_get_ue_context(&eNB_rrc_inst[mod_id],rntiP); + + if(ue_context_p != NULL) { + if(ue_context_p->ue_context.measGapConfig != NULL){ + if(ue_context_p->ue_context.measGapConfig->present == MeasGapConfig_PR_setup) { + if (ue_context_p->ue_context.measGapConfig->choice.setup.gapOffset.present == MeasGapConfig__setup__gapOffset_PR_gp0) { + return ue_context_p->ue_context.measGapConfig->choice.setup.gapOffset.choice.gp0; + } else if (ue_context_p->ue_context.measGapConfig->choice.setup.gapOffset.present == MeasGapConfig__setup__gapOffset_PR_gp1) { + return ue_context_p->ue_context.measGapConfig->choice.setup.gapOffset.choice.gp0; + } + } + } + } + return -1; } int get_ue_aggregated_max_bitrate_dl (mid_t mod_id, mid_t ue_id) @@ -974,20 +977,17 @@ int get_tti_bundling(mid_t mod_id, mid_t ue_id) return -1; } -int get_maxHARQ_TX(mid_t mod_id, mid_t ue_id) -{ - struct rrc_eNB_ue_context_s* ue_context_p = NULL; - uint32_t rntiP = get_ue_crnti(mod_id,ue_id); - - ue_context_p = rrc_eNB_get_ue_context(&eNB_rrc_inst[mod_id],rntiP); - if(ue_context_p != NULL) - { - if(ue_context_p->ue_context.mac_MainConfig != NULL){ - return ue_context_p->ue_context.mac_MainConfig->ul_SCH_Config->maxHARQ_Tx; - } - } - else - return -1; +int get_maxHARQ_TX(mid_t mod_id, mid_t ue_id) { + struct rrc_eNB_ue_context_s* ue_context_p = NULL; + uint32_t rntiP = get_ue_crnti(mod_id,ue_id); + + ue_context_p = rrc_eNB_get_ue_context(&eNB_rrc_inst[mod_id],rntiP); + if(ue_context_p != NULL) { + if(ue_context_p->ue_context.mac_MainConfig != NULL){ + return *ue_context_p->ue_context.mac_MainConfig->ul_SCH_Config->maxHARQ_Tx; + } + } + return -1; } int get_beta_offset_ack_index(mid_t mod_id, mid_t ue_id) @@ -1059,21 +1059,18 @@ int get_ack_nack_simultaneous_trans(mid_t mod_id,mid_t ue_id) return (&eNB_rrc_inst[mod_id])->carrier[0].sib2->radioResourceConfigCommon.soundingRS_UL_ConfigCommon.choice.setup.ackNackSRS_SimultaneousTransmission; } -int get_aperiodic_cqi_rep_mode(mid_t mod_id,mid_t ue_id) -{ - struct rrc_eNB_ue_context_s* ue_context_p = NULL; - uint32_t rntiP = get_ue_crnti(mod_id,ue_id); - - ue_context_p = rrc_eNB_get_ue_context(&eNB_rrc_inst[mod_id],rntiP); - - if(ue_context_p != NULL) - { - if(ue_context_p->ue_context.physicalConfigDedicated != NULL){ - return ue_context_p->ue_context.physicalConfigDedicated->cqi_ReportConfig->cqi_ReportModeAperiodic; - } - } - else - return -1; +int get_aperiodic_cqi_rep_mode(mid_t mod_id,mid_t ue_id) { + struct rrc_eNB_ue_context_s* ue_context_p = NULL; + uint32_t rntiP = get_ue_crnti(mod_id,ue_id); + + ue_context_p = rrc_eNB_get_ue_context(&eNB_rrc_inst[mod_id],rntiP); + + if(ue_context_p != NULL) { + if(ue_context_p->ue_context.physicalConfigDedicated != NULL){ + return *ue_context_p->ue_context.physicalConfigDedicated->cqi_ReportConfig->cqi_ReportModeAperiodic; + } + } + return -1; } int get_tdd_ack_nack_feedback(mid_t mod_id, mid_t ue_id) @@ -1109,22 +1106,23 @@ int get_ack_nack_repetition_factor(mid_t mod_id, mid_t ue_id) return -1; } -int get_extended_bsr_size(mid_t mod_id, mid_t ue_id) -{ - //TODO: need to double check - struct rrc_eNB_ue_context_s* ue_context_p = NULL; - uint32_t rntiP = get_ue_crnti(mod_id,ue_id); +int get_extended_bsr_size(mid_t mod_id, mid_t ue_id) { + //TODO: need to double check + struct rrc_eNB_ue_context_s* ue_context_p = NULL; + uint32_t rntiP = get_ue_crnti(mod_id,ue_id); - ue_context_p = rrc_eNB_get_ue_context(&eNB_rrc_inst[mod_id],rntiP); - if(ue_context_p != NULL) - { - if(ue_context_p->ue_context.mac_MainConfig != NULL){ - if(ue_context_p->ue_context.mac_MainConfig->ext2 != NULL){ - return ue_context_p->ue_context.mac_MainConfig->ext2->mac_MainConfig_v1020->extendedBSR_Sizes_r10; - } - } + ue_context_p = rrc_eNB_get_ue_context(&eNB_rrc_inst[mod_id],rntiP); + if(ue_context_p != NULL) { + if(ue_context_p->ue_context.mac_MainConfig != NULL){ + if(ue_context_p->ue_context.mac_MainConfig->ext2 != NULL){ + long val = (*(ue_context_p->ue_context.mac_MainConfig->ext2->mac_MainConfig_v1020->extendedBSR_Sizes_r10)); + if (val > 0) { + return 1; } - return -1; + } + } + } + return -1; } int get_ue_transmission_antenna(mid_t mod_id, mid_t ue_id) @@ -1217,9 +1215,10 @@ int enb_agent_ue_state_change(mid_t mod_id, uint32_t rnti, uint8_t state_change) config->has_meas_gap_config_pattern = 1; } //TODO: Set the measurement gap offset if applicable - if(get_meas_gap_config_offset(mod_id,i) != -1){ - config->meas_gap_config_sf_offset = get_meas_gap_config_offset(mod_id,i); - config->has_meas_gap_config_sf_offset = 1; + if(config->has_meas_gap_config_pattern == 1 && + config->meas_gap_config_pattern != PROTOCOL__PRP_MEAS_GAP_CONFIG_PATTERN__PRMGCP_OFF) { + config->meas_gap_config_sf_offset = get_meas_gap_config_offset(mod_id,i); + config->has_meas_gap_config_sf_offset = 1; } //TODO: Set the SPS configuration (Optional) //Not supported for noe, so we do not set it @@ -1308,20 +1307,25 @@ int enb_agent_ue_state_change(mid_t mod_id, uint32_t rnti, uint8_t state_change) //TODO: Set PRACRM_* value regarding aperiodic cqi report mode if(get_aperiodic_cqi_rep_mode(mod_id,i) != -1){ config->has_aperiodic_cqi_rep_mode = 1; - config->aperiodic_cqi_rep_mode = get_aperiodic_cqi_rep_mode(mod_id,i); + int mode = get_aperiodic_cqi_rep_mode(mod_id,i); + if (mode > 4) { + config->aperiodic_cqi_rep_mode = PROTOCOL__PRP_APERIODIC_CQI_REPORT_MODE__PRACRM_NONE; + } else { + config->aperiodic_cqi_rep_mode = mode; + } } //TODO: Set tdd_ack_nack_feedback - if(get_tdd_ack_nack_feedback != -1){ + if(get_tdd_ack_nack_feedback(mod_id, i) != -1){ config->has_tdd_ack_nack_feedback = 1; config->tdd_ack_nack_feedback = get_tdd_ack_nack_feedback(mod_id,i); } //TODO: Set ack_nack_repetition factor - if(get_ack_nack_repetition_factor != -1){ + if(get_ack_nack_repetition_factor(mod_id, i) != -1){ config->has_ack_nack_repetition_factor = 1; config->ack_nack_repetition_factor = get_ack_nack_repetition_factor(mod_id,i); } //TODO: Set extended BSR size - if(get_extended_bsr_size != -1){ + if(get_extended_bsr_size(mod_id, i) != -1){ config->has_extended_bsr_size = 1; config->extended_bsr_size = get_extended_bsr_size(mod_id,i); } @@ -1544,10 +1548,11 @@ int enb_agent_ue_config_reply(mid_t mod_id, const void *params, Protocol__Progra ue_config[i]->has_meas_gap_config_pattern = 1; } //TODO: Set the measurement gap offset if applicable - if(get_meas_gap_config_offset(mod_id,i) != -1){ - ue_config[i]->meas_gap_config_sf_offset = get_meas_gap_config_offset(mod_id,i); - ue_config[i]->has_meas_gap_config_sf_offset = 1; - } + if(ue_config[i]->has_meas_gap_config_pattern == 1 && + ue_config[i]->meas_gap_config_pattern != PROTOCOL__PRP_MEAS_GAP_CONFIG_PATTERN__PRMGCP_OFF) { + ue_config[i]->meas_gap_config_sf_offset = get_meas_gap_config_offset(mod_id,i); + ue_config[i]->has_meas_gap_config_sf_offset = 1; + } //TODO: Set the SPS configuration (Optional) //Not supported for noe, so we do not set it @@ -1635,39 +1640,44 @@ int enb_agent_ue_config_reply(mid_t mod_id, const void *params, Protocol__Progra //TODO: Set PRACRM_* value regarding aperiodic cqi report mode if(get_aperiodic_cqi_rep_mode(mod_id,i) != -1){ ue_config[i]->has_aperiodic_cqi_rep_mode = 1; - ue_config[i]->aperiodic_cqi_rep_mode = get_aperiodic_cqi_rep_mode(mod_id,i); + int mode = get_aperiodic_cqi_rep_mode(mod_id,i); + if (mode > 4) { + ue_config[i]->aperiodic_cqi_rep_mode = PROTOCOL__PRP_APERIODIC_CQI_REPORT_MODE__PRACRM_NONE; + } else { + ue_config[i]->aperiodic_cqi_rep_mode = mode; } + } //TODO: Set tdd_ack_nack_feedback - if(get_tdd_ack_nack_feedback != -1){ - ue_config[i]->has_tdd_ack_nack_feedback = 1; - ue_config[i]->tdd_ack_nack_feedback = get_tdd_ack_nack_feedback(mod_id,i); - } + if(get_tdd_ack_nack_feedback(mod_id, i) != -1){ + ue_config[i]->has_tdd_ack_nack_feedback = 1; + ue_config[i]->tdd_ack_nack_feedback = get_tdd_ack_nack_feedback(mod_id,i); + } //TODO: Set ack_nack_repetition factor - if(get_ack_nack_repetition_factor != -1){ - ue_config[i]->has_ack_nack_repetition_factor = 1; - ue_config[i]->ack_nack_repetition_factor = get_ack_nack_repetition_factor(mod_id,i); - } + if(get_ack_nack_repetition_factor(mod_id, i) != -1){ + ue_config[i]->has_ack_nack_repetition_factor = 1; + ue_config[i]->ack_nack_repetition_factor = get_ack_nack_repetition_factor(mod_id,i); + } //TODO: Set extended BSR size - if(get_extended_bsr_size != -1){ - ue_config[i]->has_extended_bsr_size = 1; - ue_config[i]->extended_bsr_size = get_extended_bsr_size(mod_id,i); - } + if(get_extended_bsr_size(mod_id, i) != -1){ + ue_config[i]->has_extended_bsr_size = 1; + ue_config[i]->extended_bsr_size = get_extended_bsr_size(mod_id,i); + } //TODO: Set carrier aggregation support (boolean) ue_config[i]->has_ca_support = 0; ue_config[i]->ca_support = 0; if(ue_config[i]->has_ca_support){ - //TODO: Set cross carrier scheduling support (boolean) - ue_config[i]->has_cross_carrier_sched_support = 1; - ue_config[i]->cross_carrier_sched_support = 0; - //TODO: Set index of primary cell - ue_config[i]->has_pcell_carrier_index = 1; - ue_config[i]->pcell_carrier_index = 1; - //TODO: Set secondary cells configuration - // We do not set it for now. No carrier aggregation support - - //TODO: Set deactivation timer for secondary cell - ue_config[i]->has_scell_deactivation_timer = 1; - ue_config[i]->scell_deactivation_timer = 1; + //TODO: Set cross carrier scheduling support (boolean) + ue_config[i]->has_cross_carrier_sched_support = 1; + ue_config[i]->cross_carrier_sched_support = 0; + //TODO: Set index of primary cell + ue_config[i]->has_pcell_carrier_index = 1; + ue_config[i]->pcell_carrier_index = 1; + //TODO: Set secondary cells configuration + // We do not set it for now. No carrier aggregation support + + //TODO: Set deactivation timer for secondary cell + ue_config[i]->has_scell_deactivation_timer = 1; + ue_config[i]->scell_deactivation_timer = 1; } } ue_config_reply_msg->ue_config = ue_config; From 197726ce61c45a2f2acdaed046cf221cb4a7ee09 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Thu, 25 Feb 2016 13:55:19 +0000 Subject: [PATCH 126/349] Fixed memory leaks in sf and mac config messages --- openair2/ENB_APP/enb_agent_mac.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/openair2/ENB_APP/enb_agent_mac.c b/openair2/ENB_APP/enb_agent_mac.c index 0c68c4b80c..7be6e6ba12 100644 --- a/openair2/ENB_APP/enb_agent_mac.c +++ b/openair2/ENB_APP/enb_agent_mac.c @@ -1041,10 +1041,12 @@ int enb_agent_mac_destroy_sf_trigger(Protocol__ProgranMessage *msg) { free(msg->sf_trigger_msg->header); for (i = 0; i < msg->sf_trigger_msg->n_dl_info; i++) { free(msg->sf_trigger_msg->dl_info[i]->harq_status); + free(msg->sf_trigger_msg->dl_info[i]); } free(msg->sf_trigger_msg->dl_info); for (i = 0; i < msg->sf_trigger_msg->n_ul_info; i++) { - free(msg->sf_trigger_msg->ul_info[i]->reception_status); + free(msg->sf_trigger_msg->ul_info[i]->ul_reception); + free(msg->sf_trigger_msg->ul_info[i]); } free(msg->sf_trigger_msg->ul_info); free(msg->sf_trigger_msg); @@ -1143,6 +1145,8 @@ int enb_agent_mac_destroy_dl_config(Protocol__ProgranMessage *msg) { free(msg->dl_mac_config_msg->ofdm_sym[i]); } free(msg->dl_mac_config_msg->ofdm_sym); + free(msg->dl_mac_config_msg); + free(msg); return 0; From f47f596a1ff3ddf4fad0c45873b1683bd4fc96be Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Fri, 26 Feb 2016 13:31:13 +0000 Subject: [PATCH 127/349] Added support for liblfds7 --- cmake_targets/CMakeLists.txt | 26 +- .../liblfds700/build/gcc_and_gnumake/Makefile | 168 +++ .../build/gcc_kbuild_and_gnumake/Kbuild | 76 ++ .../build/gcc_kbuild_and_gnumake/Makefile | 14 + .../liblfds700.def | 69 ++ .../sdk_for_windows_7_and_gnumake/makefile | 114 ++ .../liblfds700.def | 69 ++ .../liblfds700.sln | 46 + .../liblfds700.vcxproj | 705 +++++++++++ .../liblfds700.vcxproj.filters | 279 +++++ .../liblfds700.vcxproj.user | 4 + .../driver_entry.c | 1 + .../liblfds700.def | 69 ++ .../liblfds700.sln | 46 + .../liblfds700.vcxproj | 733 ++++++++++++ .../liblfds700.vcxproj.filters | 279 +++++ .../liblfds700.vcxproj.user | 4 + .../driver_entry.c | 1 + .../liblfds700.def | 69 ++ .../liblfds700.sln | 59 + .../liblfds700.vcxproj | 1054 +++++++++++++++++ .../liblfds700.vcxproj.filters | 279 +++++ .../liblfds700.vcxproj.user | 4 + .../liblfds700/build/wdk_7.1/dirs | 3 + ..._entry_renamed_to_avoid_compiler_warning.c | 23 + .../liblfds700/build/wdk_7.1/liblfds700.def | 69 ++ .../readme_before_win_kernel_build.txt | 32 + ...me_before_win_kernel_dynamic_lib_build.bat | 22 + ...nme_before_win_kernel_static_lib_build.bat | 21 + .../liblfds700/build/wdk_7.1/sources.dynamic | 62 + .../liblfds700/build/wdk_7.1/sources.static | 60 + .../liblfds7.0.0/liblfds700/inc/liblfds700.h | 31 + .../lfds700_btree_addonly_unbalanced.h | 113 ++ .../inc/liblfds700/lfds700_freelist.h | 54 + .../inc/liblfds700/lfds700_hash_addonly.h | 127 ++ ...fds700_list_addonly_ordered_singlylinked.h | 85 ++ ...s700_list_addonly_singlylinked_unordered.h | 90 ++ .../liblfds700/inc/liblfds700/lfds700_misc.h | 192 +++ ...ds700_porting_abstraction_layer_compiler.h | 478 ++++++++ ...rting_abstraction_layer_operating_system.h | 133 +++ ...s700_porting_abstraction_layer_processor.h | 544 +++++++++ .../liblfds700/inc/liblfds700/lfds700_queue.h | 60 + ...ue_bounded_singleconsumer_singleproducer.h | 59 + .../inc/liblfds700/lfds700_ringbuffer.h | 69 ++ .../liblfds700/inc/liblfds700/lfds700_stack.h | 55 + ...lfds700_btree_addonly_unbalanced_cleanup.c | 117 ++ .../lfds700_btree_addonly_unbalanced_get.c | 467 ++++++++ .../lfds700_btree_addonly_unbalanced_init.c | 32 + .../lfds700_btree_addonly_unbalanced_insert.c | 156 +++ ...fds700_btree_addonly_unbalanced_internal.h | 23 + .../lfds700_btree_addonly_unbalanced_query.c | 121 ++ .../lfds700_freelist_cleanup.c | 36 + .../lfds700_freelist/lfds700_freelist_init.c | 27 + .../lfds700_freelist_internal.h | 5 + .../lfds700_freelist/lfds700_freelist_pop.c | 52 + .../lfds700_freelist/lfds700_freelist_push.c | 42 + .../lfds700_freelist/lfds700_freelist_query.c | 123 ++ .../lfds700_hash_addonly_cleanup.c | 61 + .../lfds700_hash_addonly_get.c | 37 + .../lfds700_hash_addonly_init.c | 54 + .../lfds700_hash_addonly_insert.c | 62 + .../lfds700_hash_addonly_internal.h | 5 + .../lfds700_hash_addonly_iterate.c | 58 + .../lfds700_hash_addonly_query.c | 112 ++ ...ist_addonly_ordered_singlylinked_cleanup.c | 37 + ...00_list_addonly_ordered_singlylinked_get.c | 29 + ...0_list_addonly_ordered_singlylinked_init.c | 37 + ...list_addonly_ordered_singlylinked_insert.c | 134 +++ ...st_addonly_ordered_singlylinked_internal.h | 5 + ..._list_addonly_ordered_singlylinked_query.c | 121 ++ ...t_addonly_singlylinked_unordered_cleanup.c | 37 + ..._list_addonly_singlylinked_unordered_get.c | 29 + ...list_addonly_singlylinked_unordered_init.c | 35 + ...st_addonly_singlylinked_unordered_insert.c | 193 +++ ..._addonly_singlylinked_unordered_internal.h | 5 + ...ist_addonly_singlylinked_unordered_query.c | 121 ++ .../src/lfds700_misc/lfds700_misc_cleanup.c | 15 + .../src/lfds700_misc/lfds700_misc_globals.c | 11 + .../src/lfds700_misc/lfds700_misc_init.c | 53 + .../src/lfds700_misc/lfds700_misc_internal.h | 10 + .../src/lfds700_misc/lfds700_misc_prng.c | 144 +++ .../src/lfds700_misc/lfds700_misc_query.c | 48 + .../src/lfds700_queue/lfds700_queue_cleanup.c | 48 + .../src/lfds700_queue/lfds700_queue_dequeue.c | 109 ++ .../src/lfds700_queue/lfds700_queue_enqueue.c | 74 ++ .../src/lfds700_queue/lfds700_queue_init.c | 43 + .../lfds700_queue/lfds700_queue_internal.h | 14 + .../src/lfds700_queue/lfds700_queue_query.c | 126 ++ ...ed_singleconsumer_singleproducer_cleanup.c | 30 + ...ed_singleconsumer_singleproducer_dequeue.c | 42 + ...ed_singleconsumer_singleproducer_enqueue.c | 39 + ...unded_singleconsumer_singleproducer_init.c | 63 + ...d_singleconsumer_singleproducer_internal.h | 5 + ...nded_singleconsumer_singleproducer_query.c | 70 ++ .../lfds700_ringbuffer_cleanup.c | 86 ++ .../lfds700_ringbuffer_init.c | 51 + .../lfds700_ringbuffer_internal.h | 5 + .../lfds700_ringbuffer_query.c | 72 ++ .../lfds700_ringbuffer_read.c | 44 + .../lfds700_ringbuffer_write.c | 78 ++ .../src/lfds700_stack/lfds700_stack_cleanup.c | 36 + .../src/lfds700_stack/lfds700_stack_init.c | 27 + .../lfds700_stack/lfds700_stack_internal.h | 5 + .../src/lfds700_stack/lfds700_stack_pop.c | 52 + .../src/lfds700_stack/lfds700_stack_push.c | 42 + .../src/lfds700_stack/lfds700_stack_query.c | 123 ++ .../liblfds700/src/liblfds700_internal.h | 93 ++ .../test/build/gcc_and_gnumake/Makefile | 129 ++ .../sdk_for_windows_7_and_gnumake/makefile | 106 ++ .../visual_studio_professional_2012/test.sln | 67 ++ .../test.vcxproj | 554 +++++++++ .../test.vcxproj.filters | 216 ++++ .../test.vcxproj.user | 4 + .../LFDS/liblfds7.0.0/test/src/internal.h | 157 +++ .../UTIL/LFDS/liblfds7.0.0/test/src/main.c | 135 +++ .../UTIL/LFDS/liblfds7.0.0/test/src/misc.c | 191 +++ .../test_lfds700_btree_addonly_unbalanced.c | 32 + ...ds700_btree_addonly_unbalanced_alignment.c | 64 + ...tree_addonly_unbalanced_random_adds_fail.c | 319 +++++ ...nbalanced_random_adds_fail_and_overwrite.c | 140 +++ ...addonly_unbalanced_random_adds_overwrite.c | 322 +++++ .../test/src/test_lfds700_freelist.c | 33 + .../src/test_lfds700_freelist_alignment.c | 43 + .../test/src/test_lfds700_freelist_popping.c | 205 ++++ ...est_lfds700_freelist_popping_and_pushing.c | 319 +++++ .../test/src/test_lfds700_freelist_pushing.c | 246 ++++ ...ds700_freelist_rapid_popping_and_pushing.c | 216 ++++ .../test/src/test_lfds700_hash_addonly.c | 33 + .../src/test_lfds700_hash_addonly_alignment.c | 40 + .../src/test_lfds700_hash_addonly_iterate.c | 224 ++++ ...st_lfds700_hash_addonly_random_adds_fail.c | 314 +++++ ...h_addonly_random_adds_fail_and_overwrite.c | 137 +++ ...ds700_hash_addonly_random_adds_overwrite.c | 388 ++++++ ...fds700_list_addonly_ordered_singlylinked.c | 31 + ...t_addonly_ordered_singlylinked_alignment.c | 58 + ...addonly_ordered_singlylinked_new_ordered.c | 278 +++++ ...red_singlylinked_new_ordered_with_cursor.c | 366 ++++++ ...s700_list_addonly_singlylinked_unordered.c | 32 + ...addonly_singlylinked_unordered_alignment.c | 61 + ...addonly_singlylinked_unordered_new_after.c | 254 ++++ ...t_addonly_singlylinked_unordered_new_end.c | 229 ++++ ...addonly_singlylinked_unordered_new_start.c | 229 ++++ ...lfds700_porting_abstraction_layer_atomic.c | 33 + ...700_porting_abstraction_layer_atomic_cas.c | 176 +++ ...00_porting_abstraction_layer_atomic_dcas.c | 177 +++ ...orting_abstraction_layer_atomic_exchange.c | 333 ++++++ .../test/src/test_lfds700_queue.c | 35 + .../test/src/test_lfds700_queue_alignment.c | 55 + ...ue_bounded_singleconsumer_singleproducer.c | 25 + ..._singleconsumer_singleproducer_dequeuing.c | 61 + ..._singleconsumer_singleproducer_enqueuing.c | 59 + ...r_singleproducer_enqueuing_and_dequeuing.c | 260 ++++ .../test/src/test_lfds700_queue_dequeuing.c | 215 ++++ .../test/src/test_lfds700_queue_enqueuing.c | 239 ++++ ...st_lfds700_queue_enqueuing_and_dequeuing.c | 250 ++++ ..._queue_enqueuing_and_dequeuing_with_free.c | 241 ++++ ...uing_with_malloc_and_dequeuing_with_free.c | 208 ++++ ...s700_queue_rapid_enqueuing_and_dequeuing.c | 264 +++++ .../test/src/test_lfds700_ringbuffer.c | 31 + .../src/test_lfds700_ringbuffer_reading.c | 217 ++++ ...t_lfds700_ringbuffer_reading_and_writing.c | 261 ++++ .../src/test_lfds700_ringbuffer_writing.c | 272 +++++ .../test/src/test_lfds700_stack.c | 33 + .../test/src/test_lfds700_stack_alignment.c | 43 + .../test/src/test_lfds700_stack_popping.c | 202 ++++ .../test_lfds700_stack_popping_and_pushing.c | 316 +++++ .../test/src/test_lfds700_stack_pushing.c | 251 ++++ ..._lfds700_stack_rapid_popping_and_pushing.c | 217 ++++ ...g_abstraction_layer_get_logical_core_ids.c | 245 ++++ ...rting_abstraction_layer_operating_system.h | 82 ++ ...t_porting_abstraction_layer_thread_start.c | 336 ++++++ ...st_porting_abstraction_layer_thread_wait.c | 69 ++ .../LFDS/liblfds7.0.0/test/src/util_cmdline.c | 184 +++ .../LFDS/liblfds7.0.0/test/src/util_cmdline.h | 69 ++ .../test/src/util_memory_helpers.c | 75 ++ .../test/src/util_memory_helpers.h | 5 + .../test/src/util_thread_starter.c | 151 +++ .../test/src/util_thread_starter.h | 41 + 178 files changed, 22480 insertions(+), 4 deletions(-) create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/gcc_and_gnumake/Makefile create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/gcc_kbuild_and_gnumake/Kbuild create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/gcc_kbuild_and_gnumake/Makefile create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/sdk_for_windows_7_and_gnumake/liblfds700.def create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/sdk_for_windows_7_and_gnumake/makefile create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2012/liblfds700.def create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2012/liblfds700.sln create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2012/liblfds700.vcxproj create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2012/liblfds700.vcxproj.filters create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2012/liblfds700.vcxproj.user create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2012_and_wdk_8.0/driver_entry.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2012_and_wdk_8.0/liblfds700.def create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2012_and_wdk_8.0/liblfds700.sln create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2012_and_wdk_8.0/liblfds700.vcxproj create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2012_and_wdk_8.0/liblfds700.vcxproj.filters create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2012_and_wdk_8.0/liblfds700.vcxproj.user create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2013_and_wdk_8.1/driver_entry.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2013_and_wdk_8.1/liblfds700.def create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2013_and_wdk_8.1/liblfds700.sln create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2013_and_wdk_8.1/liblfds700.vcxproj create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2013_and_wdk_8.1/liblfds700.vcxproj.filters create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2013_and_wdk_8.1/liblfds700.vcxproj.user create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/wdk_7.1/dirs create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/wdk_7.1/driver_entry_renamed_to_avoid_compiler_warning.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/wdk_7.1/liblfds700.def create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/wdk_7.1/readme_before_win_kernel_build.txt create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/wdk_7.1/runme_before_win_kernel_dynamic_lib_build.bat create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/wdk_7.1/runme_before_win_kernel_static_lib_build.bat create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/wdk_7.1/sources.dynamic create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/wdk_7.1/sources.static create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/inc/liblfds700.h create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/inc/liblfds700/lfds700_btree_addonly_unbalanced.h create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/inc/liblfds700/lfds700_freelist.h create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/inc/liblfds700/lfds700_hash_addonly.h create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/inc/liblfds700/lfds700_list_addonly_ordered_singlylinked.h create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/inc/liblfds700/lfds700_list_addonly_singlylinked_unordered.h create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/inc/liblfds700/lfds700_misc.h create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/inc/liblfds700/lfds700_porting_abstraction_layer_compiler.h create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/inc/liblfds700/lfds700_porting_abstraction_layer_operating_system.h create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/inc/liblfds700/lfds700_porting_abstraction_layer_processor.h create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/inc/liblfds700/lfds700_queue.h create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/inc/liblfds700/lfds700_queue_bounded_singleconsumer_singleproducer.h create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/inc/liblfds700/lfds700_ringbuffer.h create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/inc/liblfds700/lfds700_stack.h create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_btree_addonly_unbalanced/lfds700_btree_addonly_unbalanced_cleanup.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_btree_addonly_unbalanced/lfds700_btree_addonly_unbalanced_get.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_btree_addonly_unbalanced/lfds700_btree_addonly_unbalanced_init.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_btree_addonly_unbalanced/lfds700_btree_addonly_unbalanced_insert.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_btree_addonly_unbalanced/lfds700_btree_addonly_unbalanced_internal.h create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_btree_addonly_unbalanced/lfds700_btree_addonly_unbalanced_query.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_freelist/lfds700_freelist_cleanup.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_freelist/lfds700_freelist_init.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_freelist/lfds700_freelist_internal.h create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_freelist/lfds700_freelist_pop.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_freelist/lfds700_freelist_push.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_freelist/lfds700_freelist_query.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_hash_addonly/lfds700_hash_addonly_cleanup.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_hash_addonly/lfds700_hash_addonly_get.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_hash_addonly/lfds700_hash_addonly_init.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_hash_addonly/lfds700_hash_addonly_insert.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_hash_addonly/lfds700_hash_addonly_internal.h create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_hash_addonly/lfds700_hash_addonly_iterate.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_hash_addonly/lfds700_hash_addonly_query.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_list_addonly_ordered_singlylinked/lfds700_list_addonly_ordered_singlylinked_cleanup.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_list_addonly_ordered_singlylinked/lfds700_list_addonly_ordered_singlylinked_get.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_list_addonly_ordered_singlylinked/lfds700_list_addonly_ordered_singlylinked_init.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_list_addonly_ordered_singlylinked/lfds700_list_addonly_ordered_singlylinked_insert.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_list_addonly_ordered_singlylinked/lfds700_list_addonly_ordered_singlylinked_internal.h create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_list_addonly_ordered_singlylinked/lfds700_list_addonly_ordered_singlylinked_query.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_list_addonly_singlylinked_unordered/lfds700_list_addonly_singlylinked_unordered_cleanup.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_list_addonly_singlylinked_unordered/lfds700_list_addonly_singlylinked_unordered_get.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_list_addonly_singlylinked_unordered/lfds700_list_addonly_singlylinked_unordered_init.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_list_addonly_singlylinked_unordered/lfds700_list_addonly_singlylinked_unordered_insert.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_list_addonly_singlylinked_unordered/lfds700_list_addonly_singlylinked_unordered_internal.h create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_list_addonly_singlylinked_unordered/lfds700_list_addonly_singlylinked_unordered_query.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_misc/lfds700_misc_cleanup.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_misc/lfds700_misc_globals.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_misc/lfds700_misc_init.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_misc/lfds700_misc_internal.h create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_misc/lfds700_misc_prng.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_misc/lfds700_misc_query.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_queue/lfds700_queue_cleanup.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_queue/lfds700_queue_dequeue.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_queue/lfds700_queue_enqueue.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_queue/lfds700_queue_init.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_queue/lfds700_queue_internal.h create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_queue/lfds700_queue_query.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_queue_bounded_singleconsumer_singleproducer/lfds700_queue_bounded_singleconsumer_singleproducer_cleanup.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_queue_bounded_singleconsumer_singleproducer/lfds700_queue_bounded_singleconsumer_singleproducer_dequeue.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_queue_bounded_singleconsumer_singleproducer/lfds700_queue_bounded_singleconsumer_singleproducer_enqueue.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_queue_bounded_singleconsumer_singleproducer/lfds700_queue_bounded_singleconsumer_singleproducer_init.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_queue_bounded_singleconsumer_singleproducer/lfds700_queue_bounded_singleconsumer_singleproducer_internal.h create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_queue_bounded_singleconsumer_singleproducer/lfds700_queue_bounded_singleconsumer_singleproducer_query.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_ringbuffer/lfds700_ringbuffer_cleanup.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_ringbuffer/lfds700_ringbuffer_init.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_ringbuffer/lfds700_ringbuffer_internal.h create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_ringbuffer/lfds700_ringbuffer_query.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_ringbuffer/lfds700_ringbuffer_read.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_ringbuffer/lfds700_ringbuffer_write.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_stack/lfds700_stack_cleanup.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_stack/lfds700_stack_init.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_stack/lfds700_stack_internal.h create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_stack/lfds700_stack_pop.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_stack/lfds700_stack_push.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_stack/lfds700_stack_query.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/liblfds700_internal.h create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/test/build/gcc_and_gnumake/Makefile create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/test/build/sdk_for_windows_7_and_gnumake/makefile create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/test/build/visual_studio_professional_2012/test.sln create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/test/build/visual_studio_professional_2012/test.vcxproj create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/test/build/visual_studio_professional_2012/test.vcxproj.filters create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/test/build/visual_studio_professional_2012/test.vcxproj.user create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/test/src/internal.h create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/test/src/main.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/test/src/misc.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_btree_addonly_unbalanced.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_btree_addonly_unbalanced_alignment.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_btree_addonly_unbalanced_random_adds_fail.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_btree_addonly_unbalanced_random_adds_fail_and_overwrite.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_btree_addonly_unbalanced_random_adds_overwrite.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_freelist.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_freelist_alignment.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_freelist_popping.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_freelist_popping_and_pushing.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_freelist_pushing.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_freelist_rapid_popping_and_pushing.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_hash_addonly.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_hash_addonly_alignment.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_hash_addonly_iterate.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_hash_addonly_random_adds_fail.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_hash_addonly_random_adds_fail_and_overwrite.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_hash_addonly_random_adds_overwrite.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_list_addonly_ordered_singlylinked.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_list_addonly_ordered_singlylinked_alignment.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_list_addonly_ordered_singlylinked_new_ordered.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_list_addonly_ordered_singlylinked_new_ordered_with_cursor.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_list_addonly_singlylinked_unordered.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_list_addonly_singlylinked_unordered_alignment.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_list_addonly_singlylinked_unordered_new_after.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_list_addonly_singlylinked_unordered_new_end.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_list_addonly_singlylinked_unordered_new_start.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_porting_abstraction_layer_atomic.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_porting_abstraction_layer_atomic_cas.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_porting_abstraction_layer_atomic_dcas.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_porting_abstraction_layer_atomic_exchange.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_queue.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_queue_alignment.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_queue_bounded_singleconsumer_singleproducer.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_queue_bounded_singleconsumer_singleproducer_dequeuing.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_queue_bounded_singleconsumer_singleproducer_enqueuing.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_queue_bounded_singleconsumer_singleproducer_enqueuing_and_dequeuing.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_queue_dequeuing.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_queue_enqueuing.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_queue_enqueuing_and_dequeuing.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_queue_enqueuing_and_dequeuing_with_free.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_queue_enqueuing_with_malloc_and_dequeuing_with_free.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_queue_rapid_enqueuing_and_dequeuing.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_ringbuffer.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_ringbuffer_reading.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_ringbuffer_reading_and_writing.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_ringbuffer_writing.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_stack.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_stack_alignment.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_stack_popping.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_stack_popping_and_pushing.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_stack_pushing.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_stack_rapid_popping_and_pushing.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_porting_abstraction_layer_get_logical_core_ids.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_porting_abstraction_layer_operating_system.h create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_porting_abstraction_layer_thread_start.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_porting_abstraction_layer_thread_wait.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/test/src/util_cmdline.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/test/src/util_cmdline.h create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/test/src/util_memory_helpers.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/test/src/util_memory_helpers.h create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/test/src/util_thread_starter.c create mode 100644 openair2/UTIL/LFDS/liblfds7.0.0/test/src/util_thread_starter.h diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index 85a6f35339..e4b027958d 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -757,6 +757,7 @@ include_directories("${OPENAIR_DIR}/targets/ARCH/EXMIMO/DEFS") include_directories("${OPENAIR2_DIR}/ENB_APP") include_directories("${OPENAIR2_DIR}/UTIL/OSA") include_directories("${OPENAIR2_DIR}/UTIL/LFDS/liblfds6.1.1/liblfds611/inc") +include_directories("${OPENAIR2_DIR}/UTIL/LFDS/liblfds7.0.0/liblfds700/inc") include_directories("${OPENAIR2_DIR}/UTIL/MEM") include_directories("${OPENAIR2_DIR}/UTIL/LISTS") include_directories("${OPENAIR2_DIR}/UTIL/FIFO") @@ -1475,6 +1476,23 @@ add_library(LFDS ${lfds}/lfds611_abstraction/lfds611_abstraction_malloc.c ) +set(lfds7 ${OPENAIR2_DIR}/UTIL/LFDS/liblfds7.0.0/liblfds700/src/) +file(GLOB lfds7_queue ${lfds7}/lfds700_queue/*.c) +file(GLOB lfds7_ring ${lfds7}/lfds700_ringbuffer/*.c) +file(GLOB lfds7_qbss ${lfds7}/lfds700_queue_bounded_singleconsumer_singleproducer/*.c) +file(GLOB lfds7_stack ${lfds7}/lfds700_stack/*.c) +file(GLOB lfds7_freelist ${lfds7}/lfds700_freelist/*.c) +file(GLOB lfds7_btree ${lfds7}/lfds700_btree_addonly_unbalanced/*.c) +file(GLOB lfds7_hash ${lfds7}/lfds700_hash_addonly/*.c) +file(GLOB lfds7_ordered_list ${lfds7}/lfds700_list_addonly_ordered_singlylinked/*.c) +file(GLOB lfds7_unordered_list ${lfds7}/lfds700_list_addonly_singlylinked_unordered/*.c) +file(GLOB lfds7_misc ${lfds7}/lfds700_misc/*.c) + +include_directories(${lfds7}) +add_library(LFDS7 + ${lfds7_queue} ${lfds7_ring} ${lfds7_qbss} ${lfds7_stack} ${lfds7_freelist} ${lfds7_btree} ${lfds7_hash} ${lfds7_ordered_list} ${lfds7_unordered_list} ${lfds7_misc} +) + # Simulation library ########################## add_library(SIMU @@ -1604,7 +1622,7 @@ add_executable(lte-softmodem target_link_libraries (lte-softmodem -Wl,--start-group - RRC_LIB S1AP_LIB S1AP_ENB GTPV1U SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT UDP SCHED_LIB PHY LFDS L2 ${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} ${ITTI_LIB} ${MIH_LIB} ${PRPT_MSG_LIB} ${ASYNC_IF_LIB} ${ENB_AGENT_LIB} + RRC_LIB S1AP_LIB S1AP_ENB GTPV1U SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT UDP SCHED_LIB PHY LFDS L2 ${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} ${ITTI_LIB} ${MIH_LIB} ${PRPT_MSG_LIB} ${ASYNC_IF_LIB} ${ENB_AGENT_LIB} LFDS7 -Wl,--end-group ) @@ -1639,7 +1657,7 @@ add_executable(lte-softmodem-nos1 ) target_link_libraries (lte-softmodem-nos1 -Wl,--start-group - RRC_LIB SECU_CN SECU_OSA UTIL HASHTABLE SCHED_LIB PHY LFDS L2 ${MSC_LIB} ${RAL_LIB} ${ITTI_LIB} ${MIH_LIB} ${PRPT_MSG_LIB} ${ASYNC_IF_LIB} ${ENB_AGENT_LIB} + RRC_LIB SECU_CN SECU_OSA UTIL HASHTABLE SCHED_LIB PHY LFDS L2 ${MSC_LIB} ${RAL_LIB} ${ITTI_LIB} ${MIH_LIB} ${PRPT_MSG_LIB} ${ASYNC_IF_LIB} ${ENB_AGENT_LIB} LFDS7 -Wl,--end-group ) target_link_libraries (lte-softmodem-nos1 ${LIBXML2_LIBRARIES}) @@ -1775,7 +1793,7 @@ add_executable(oaisim_nos1 target_include_directories(oaisim_nos1 PUBLIC ${OPENAIR_TARGETS}/SIMU/USER) target_link_libraries (oaisim_nos1 -Wl,--start-group - RRC_LIB X2AP_LIB SECU_CN UTIL HASHTABLE SCHED_LIB PHY LFDS ${MSC_LIB} L2 ${RAL_LIB} SIMU SIMU_ETH SECU_OSA ${ITTI_LIB} ${MIH_LIB} ${PRPT_MSG_LIB} ${ASYNC_IF_LIB} ${ENB_AGENT_LIB} + RRC_LIB X2AP_LIB SECU_CN UTIL HASHTABLE SCHED_LIB PHY LFDS ${MSC_LIB} L2 ${RAL_LIB} SIMU SIMU_ETH SECU_OSA ${ITTI_LIB} ${MIH_LIB} ${PRPT_MSG_LIB} ${ASYNC_IF_LIB} ${ENB_AGENT_LIB} LFDS7 -Wl,--end-group ) target_link_libraries (oaisim_nos1 ${LIBXML2_LIBRARIES} ${LAPACK_LIBRARIES}) @@ -1796,7 +1814,7 @@ foreach(myExe dlsim ulsim pbchsim scansim mbmssim pdcchsim pucchsim prachsim syn ${XFORMS_SOURCE} ) target_link_libraries (${myExe} - -Wl,--start-group SIMU UTIL SCHED_LIB PHY LFDS ${ITTI_LIB} -Wl,--end-group + -Wl,--start-group SIMU UTIL SCHED_LIB PHY LFDS ${ITTI_LIB} LFDS7 -Wl,--end-group pthread m rt ${CONFIG_LIBRARIES} ${ATLAS_LIBRARIES} ${XFORMS_LIBRARIES} ) endforeach(myExe) diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/gcc_and_gnumake/Makefile b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/gcc_and_gnumake/Makefile new file mode 100644 index 0000000000..27e4d91df3 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/gcc_and_gnumake/Makefile @@ -0,0 +1,168 @@ +##### paths ##### +BINDIR := ../../bin +INCDIR := ../../inc +OBJDIR := ../../obj +SRCDIR := ../../src + +##### misc ##### +QUIETLY := 1>/dev/null 2>/dev/null +VERSION_NUMBER := 1 +MINOR_NUMBER := 0 +RELEASE_NUMBER := 0 + +##### sources, objects and libraries ##### +BINNAME := liblfds700 +ARFILENAME := $(BINNAME).a +ARPATHNAME := $(BINDIR)/$(ARFILENAME) +SOBASENAME := $(BINNAME).so +SONAME := $(SOBASENAME).$(VERSION_NUMBER) +SOFILENAME := $(SONAME).$(MINOR_NUMBER).$(RELEASE_NUMBER) +SOPATHNAME := $(BINDIR)/$(SOFILENAME) +INCNAME := $(INCDIR)/$(BINNAME).h +SRCDIRS := lfds700_btree_addonly_unbalanced lfds700_freelist lfds700_hash_addonly lfds700_list_addonly_ordered_singlylinked lfds700_list_addonly_singlylinked_unordered lfds700_misc lfds700_queue lfds700_queue_bounded_singleconsumer_singleproducer lfds700_ringbuffer lfds700_stack +SOURCES := lfds700_hash_addonly_cleanup.c lfds700_hash_addonly_get.c lfds700_hash_addonly_init.c lfds700_hash_addonly_insert.c lfds700_hash_addonly_iterate.c lfds700_hash_addonly_query.c \ + lfds700_list_addonly_ordered_singlylinked_cleanup.c lfds700_list_addonly_ordered_singlylinked_get.c lfds700_list_addonly_ordered_singlylinked_init.c lfds700_list_addonly_ordered_singlylinked_insert.c lfds700_list_addonly_ordered_singlylinked_query.c \ + lfds700_list_addonly_singlylinked_unordered_cleanup.c lfds700_list_addonly_singlylinked_unordered_get.c lfds700_list_addonly_singlylinked_unordered_init.c lfds700_list_addonly_singlylinked_unordered_insert.c lfds700_list_addonly_singlylinked_unordered_query.c \ + lfds700_btree_addonly_unbalanced_cleanup.c lfds700_btree_addonly_unbalanced_get.c lfds700_btree_addonly_unbalanced_init.c lfds700_btree_addonly_unbalanced_insert.c lfds700_btree_addonly_unbalanced_query.c \ + lfds700_freelist_cleanup.c lfds700_freelist_init.c lfds700_freelist_pop.c lfds700_freelist_push.c lfds700_freelist_query.c \ + lfds700_misc_cleanup.c lfds700_misc_globals.c lfds700_misc_init.c lfds700_misc_prng.c lfds700_misc_query.c \ + lfds700_queue_cleanup.c lfds700_queue_dequeue.c lfds700_queue_enqueue.c lfds700_queue_init.c lfds700_queue_query.c \ + lfds700_queue_bounded_singleconsumer_singleproducer_cleanup.c lfds700_queue_bounded_singleconsumer_singleproducer_dequeue.c lfds700_queue_bounded_singleconsumer_singleproducer_enqueue.c lfds700_queue_bounded_singleconsumer_singleproducer_init.c lfds700_queue_bounded_singleconsumer_singleproducer_query.c \ + lfds700_ringbuffer_cleanup.c lfds700_ringbuffer_init.c lfds700_ringbuffer_query.c lfds700_ringbuffer_read.c lfds700_ringbuffer_write.c \ + lfds700_stack_cleanup.c lfds700_stack_init.c lfds700_stack_pop.c lfds700_stack_push.c lfds700_stack_query.c +OBJECTS := $(patsubst %.c,$(OBJDIR)/%.o,$(notdir $(SOURCES))) +SYSLIBS := + +##### default paths fix up ##### +CPATH := $(subst : ,:,$(SRCDIR):$(INCDIR)) + +##### tools ##### +MAKE := make +MFLAGS := + +DG := gcc +DGFLAGS := -MM -std=gnu89 + +CC := gcc +CFBASE := -c -fno-strict-aliasing -std=gnu89 -Wall -Werror -Wno-unknown-pragmas -Wno-unused-but-set-variable -Wno-unused-variable +CFCOV := -O0 -ggdb -DCOVERAGE -fprofile-arcs -ftest-coverage +CFDBG := -O0 -ggdb -D_DEBUG +CFPROF := -O0 -ggdb -DPROF -pg +CFREL := -O2 -DNDEBUG -finline-functions +CFTSAN := -O0 -ggdb -DTSAN -fsanitize=thread -fPIC +CFBARE := -ffreestanding -nodefaultlibs -nostdinc -nostdlib + +AR := ar +AFLAGS := -rcs + +LD := gcc +LFBASE := -pthread -shared -std=gnu89 -Wl,-soname,$(SONAME) -o $(SOPATHNAME) -Wall -Werror +LFCOV := -O0 -fprofile-arcs -ftest-coverage +LFDBG := -O0 -ggdb +LFPROF := -O0 -pg +LFREL := -O2 -s -finline-functions +LFTSAN := -O0 -fsanitize=thread -fPIC +LFBARE := -ffreestanding -nodefaultlibs -nostdinc -nostdlib + +##### CPU variants ##### +GCCARCH := native +CFBASE += -march=$(GCCARCH) + +##### build variants ##### +ifeq ($(findstring so,$(MAKECMDGOALS)),so) + CFBASE += -fPIC +endif + +CFLAGS += $(CFBASE) +LFLAGS += $(LFBASE) + +ifeq ($(MAKECMDGOALS),) + CFLAGS += $(CFDBG) + LFLAGS += $(LFDBG) +endif + +ifeq ($(findstring cov,$(MAKECMDGOALS)),cov) + CFLAGS += $(CFCOV) + LFLAGS += $(LFCOV) + SYSLIBS += -lgcov +endif + +ifeq ($(findstring dbg,$(MAKECMDGOALS)),dbg) + CFLAGS += $(CFDBG) + LFLAGS += $(LFDBG) +endif + +ifeq ($(findstring prof,$(MAKECMDGOALS)),prof) + CFLAGS += $(CFPROF) + LFLAGS += $(LFPROF) +endif + +ifeq ($(findstring rel,$(MAKECMDGOALS)),rel) + CFLAGS += $(CFREL) + LFLAGS += $(LFREL) +endif + +ifeq ($(findstring tsan,$(MAKECMDGOALS)),tsan) + CFLAGS += $(CFTSAN) + LFLAGS += $(LFTSAN) +endif + +ifeq ($(findstring b_,$(MAKECMDGOALS)),b_) + CFLAGS += $(CFBARE) + LFLAGS += $(CFBARE) +endif + +##### search paths ##### +vpath %.c $(patsubst %,$(SRCDIR)/%:,$(SRCDIRS)) + +##### implicit rules ##### +$(OBJDIR)/%.o : %.c + $(DG) $(DGFLAGS) $< >$(OBJDIR)/$*.d + $(CC) $(CFLAGS) -o $@ $< + +##### explicit rules ##### +$(ARPATHNAME) : $(OBJECTS) + $(AR) $(AFLAGS) $(ARPATHNAME) $(OBJECTS) + +$(SOPATHNAME) : $(OBJECTS) + $(LD) $(LFLAGS) $(OBJECTS) -o $(SOPATHNAME) + @ln -fs $(SOFILENAME) $(BINDIR)/$(SONAME) + @ln -fs $(SOFILENAME) $(BINDIR)/$(SOBASENAME) + +##### phony ##### +.PHONY : clean bare_ar_cov bare_ar_dbg bare_ar_prof bare_ar_rel bare_ar_tsan bare_so_cov bare_so_dbg bare_so_prof bare_so_rel bare_so_tsan hosted_ar_cov hosted_ar_dbg hosted_ar_prof hosted_ar_rel hosted_ar_tsan hosted_so_cov hosted_so_dbg hosted_so_prof hosted_so_rel hosted_so_tsan + +clean : + @rm -f $(BINDIR)/* $(OBJDIR)/* + +bare_ar_cov : $(ARPATHNAME) # bare, archive (.a), coverage +bare_ar_dbg : $(ARPATHNAME) # bare, archive (.a), debug +bare_ar_prof : $(ARPATHNAME) # bare, archive (.a), profiling +bare_ar_rel : $(ARPATHNAME) # bare, archive (.a), release +bare_ar_tsan : $(ARPATHNAME) # bare, archive (.a), thread sanitizer + +bare_so_cov : $(SOPATHNAME) # bare, shared (.so), coverage +bare_so_dbg : $(SOPATHNAME) # bare, shared (.so), debug +bare_so_prof : $(SOPATHNAME) # bare, shared (.so), profiling +bare_so_rel : $(SOPATHNAME) # bare, shared (.so), release +bare_so_tsan : $(SOPATHNAME) # bare, shared (.so), thread sanitizer + +hosted_ar_cov : $(ARPATHNAME) # hosted implementation, archive (.a), coverage +hosted_ar_dbg : $(ARPATHNAME) # hosted implementation, archive (.a), debug +hosted_ar_prof : $(ARPATHNAME) # hosted implementation, archive (.a), profiling +hosted_ar_rel : $(ARPATHNAME) # hosted implementation, archive (.a), release +hosted_ar_tsan : $(ARPATHNAME) # hosted implementation, archive (.a), thread sanitizer + +hosted_so_cov : $(SOPATHNAME) # hosted implementation, shared (.so), coverage +hosted_so_dbg : $(SOPATHNAME) # hosted implementation, shared (.so), debug +hosted_so_prof : $(SOPATHNAME) # hosted implementation, shared (.so), profiling +hosted_so_rel : $(SOPATHNAME) # hosted implementation, shared (.so), release +hosted_so_tsan : $(SOPATHNAME) # hosted implementation, shared (.so), thread sanitizer + +##### dependencies ##### +-include $(DEPENDS) + +##### notes ##### +# TRD : we use -std=gnu89 for C++ style comments +# hosted implementation differs from bare simply in that ends up being included + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/gcc_kbuild_and_gnumake/Kbuild b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/gcc_kbuild_and_gnumake/Kbuild new file mode 100644 index 0000000000..1ae6b36240 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/gcc_kbuild_and_gnumake/Kbuild @@ -0,0 +1,76 @@ +lib-y := + +lib-y += ../../src/lfds700_btree_addonly_unbalanced/lfds700_btree_addonly_unbalanced_cleanup.o +lib-y += ../../src/lfds700_btree_addonly_unbalanced/lfds700_btree_addonly_unbalanced_get.o +lib-y += ../../src/lfds700_btree_addonly_unbalanced/lfds700_btree_addonly_unbalanced_init.o +lib-y += ../../src/lfds700_btree_addonly_unbalanced/lfds700_btree_addonly_unbalanced_insert.o +lib-y += ../../src/lfds700_btree_addonly_unbalanced/lfds700_btree_addonly_unbalanced_query.o + +lib-y += ../../src/lfds700_freelist/lfds700_freelist_cleanup.o +lib-y += ../../src/lfds700_freelist/lfds700_freelist_init.o +lib-y += ../../src/lfds700_freelist/lfds700_freelist_pop.o +lib-y += ../../src/lfds700_freelist/lfds700_freelist_push.o +lib-y += ../../src/lfds700_freelist/lfds700_freelist_query.o + +lib-y += ../../src/lfds700_hash_addonly/lfds700_hash_addonly_cleanup.o +lib-y += ../../src/lfds700_hash_addonly/lfds700_hash_addonly_get.o +lib-y += ../../src/lfds700_hash_addonly/lfds700_hash_addonly_init.o +lib-y += ../../src/lfds700_hash_addonly/lfds700_hash_addonly_insert.o +lib-y += ../../src/lfds700_hash_addonly/lfds700_hash_addonly_iterate.o +lib-y += ../../src/lfds700_hash_addonly/lfds700_hash_addonly_query.o + +lib-y += ../../src/lfds700_list_addonly_ordered_singlylinked/lfds700_list_addonly_ordered_singlylinked_cleanup.o +lib-y += ../../src/lfds700_list_addonly_ordered_singlylinked/lfds700_list_addonly_ordered_singlylinked_get.o +lib-y += ../../src/lfds700_list_addonly_ordered_singlylinked/lfds700_list_addonly_ordered_singlylinked_init.o +lib-y += ../../src/lfds700_list_addonly_ordered_singlylinked/lfds700_list_addonly_ordered_singlylinked_insert.o +lib-y += ../../src/lfds700_list_addonly_ordered_singlylinked/lfds700_list_addonly_ordered_singlylinked_query.o + +lib-y += ../../src/lfds700_list_addonly_singlylinked_unordered/lfds700_list_addonly_singlylinked_unordered_cleanup.o +lib-y += ../../src/lfds700_list_addonly_singlylinked_unordered/lfds700_list_addonly_singlylinked_unordered_get.o +lib-y += ../../src/lfds700_list_addonly_singlylinked_unordered/lfds700_list_addonly_singlylinked_unordered_init.o +lib-y += ../../src/lfds700_list_addonly_singlylinked_unordered/lfds700_list_addonly_singlylinked_unordered_insert.o +lib-y += ../../src/lfds700_list_addonly_singlylinked_unordered/lfds700_list_addonly_singlylinked_unordered_query.o + +lib-y += ../../src/lfds700_misc/lfds700_misc_cleanup.o +lib-y += ../../src/lfds700_misc/lfds700_misc_globals.o +lib-y += ../../src/lfds700_misc/lfds700_misc_init.o +lib-y += ../../src/lfds700_misc/lfds700_misc_prng.o +lib-y += ../../src/lfds700_misc/lfds700_misc_query.o + +lib-y += ../../src/lfds700_queue/lfds700_queue_cleanup.o +lib-y += ../../src/lfds700_queue/lfds700_queue_dequeue.o +lib-y += ../../src/lfds700_queue/lfds700_queue_enqueue.o +lib-y += ../../src/lfds700_queue/lfds700_queue_init.o +lib-y += ../../src/lfds700_queue/lfds700_queue_query.o + +lib-y += ../../src/lfds700_queue_bounded_singleconsumer_singleproducer/lfds700_queue_bounded_singleconsumer_singleproducer_cleanup.o +lib-y += ../../src/lfds700_queue_bounded_singleconsumer_singleproducer/lfds700_queue_bounded_singleconsumer_singleproducer_dequeue.o +lib-y += ../../src/lfds700_queue_bounded_singleconsumer_singleproducer/lfds700_queue_bounded_singleconsumer_singleproducer_enqueue.o +lib-y += ../../src/lfds700_queue_bounded_singleconsumer_singleproducer/lfds700_queue_bounded_singleconsumer_singleproducer_init.o +lib-y += ../../src/lfds700_queue_bounded_singleconsumer_singleproducer/lfds700_queue_bounded_singleconsumer_singleproducer_query.o + +lib-y += ../../src/lfds700_ringbuffer/lfds700_ringbuffer_cleanup.o +lib-y += ../../src/lfds700_ringbuffer/lfds700_ringbuffer_init.o +lib-y += ../../src/lfds700_ringbuffer/lfds700_ringbuffer_query.o +lib-y += ../../src/lfds700_ringbuffer/lfds700_ringbuffer_read.o +lib-y += ../../src/lfds700_ringbuffer/lfds700_ringbuffer_write.o + +lib-y += ../../src/lfds700_stack/lfds700_stack_cleanup.o +lib-y += ../../src/lfds700_stack/lfds700_stack_init.o +lib-y += ../../src/lfds700_stack/lfds700_stack_pop.o +lib-y += ../../src/lfds700_stack/lfds700_stack_push.o +lib-y += ../../src/lfds700_stack/lfds700_stack_query.o + +libs-y := ../../bin/ + +ccflags-y := -I$(src)/../../inc +ccflags-y += -I$(src)/../../inc/liblfds700 +ccflags-y += -D_KERNEL_MODE +ccflags-y += -fno-strict-aliasing +ccflags-y += -std=gnu89 +ccflags-y += -Wall +ccflags-y += -Werror +ccflags-y += -Wno-unknown-pragmas +ccflags-y += -Wno-unused-but-set-variable +ccflags-y += -Wno-unused-variable + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/gcc_kbuild_and_gnumake/Makefile b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/gcc_kbuild_and_gnumake/Makefile new file mode 100644 index 0000000000..d6de5f4b5d --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/gcc_kbuild_and_gnumake/Makefile @@ -0,0 +1,14 @@ +default: + $(MAKE) -C /lib/modules/`uname -r`/build M=$(PWD) + +clean: + $(MAKE) -C /lib/modules/`uname -r`/build M=$(PWD) clean + find ../../src/ -name "*.o" -type f -delete + +help: + $(MAKE) -C /lib/modules/`uname -r`/build M=$(PWD) help + +modules: + $(MAKE) -C /lib/modules/`uname -r`/build M=$(PWD) modules + + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/sdk_for_windows_7_and_gnumake/liblfds700.def b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/sdk_for_windows_7_and_gnumake/liblfds700.def new file mode 100644 index 0000000000..583ce35dbd --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/sdk_for_windows_7_and_gnumake/liblfds700.def @@ -0,0 +1,69 @@ +EXPORTS + +lfds700_btree_au_init_valid_on_current_logical_core = lfds700_btree_au_init_valid_on_current_logical_core +lfds700_btree_au_cleanup = lfds700_btree_au_cleanup +lfds700_btree_au_insert = lfds700_btree_au_insert +lfds700_btree_au_get_by_absolute_position_and_then_by_relative_position = lfds700_btree_au_get_by_absolute_position_and_then_by_relative_position +lfds700_btree_au_get_by_absolute_position = lfds700_btree_au_get_by_absolute_position +lfds700_btree_au_get_by_relative_position = lfds700_btree_au_get_by_relative_position +lfds700_btree_au_get_by_key = lfds700_btree_au_get_by_key +lfds700_btree_au_query = lfds700_btree_au_query + +lfds700_freelist_init_valid_on_current_logical_core = lfds700_freelist_init_valid_on_current_logical_core +lfds700_freelist_cleanup = lfds700_freelist_cleanup +lfds700_freelist_push = lfds700_freelist_push +lfds700_freelist_pop = lfds700_freelist_pop +lfds700_freelist_query = lfds700_freelist_query + +lfds700_hash_a_init_valid_on_current_logical_core = lfds700_hash_a_init_valid_on_current_logical_core +lfds700_hash_a_cleanup = lfds700_hash_a_cleanup +lfds700_hash_a_insert = lfds700_hash_a_insert +lfds700_hash_a_get_by_key = lfds700_hash_a_get_by_key +lfds700_hash_a_iterate_init = lfds700_hash_a_iterate_init +lfds700_hash_a_iterate = lfds700_hash_a_iterate +lfds700_hash_a_query = lfds700_hash_a_query + +lfds700_list_aos_init_valid_on_current_logical_core = lfds700_list_aos_init_valid_on_current_logical_core +lfds700_list_aos_cleanup = lfds700_list_aos_cleanup +lfds700_list_aos_insert = lfds700_list_aos_insert +lfds700_list_aos_get_by_key = lfds700_list_aos_get_by_key +lfds700_list_aos_query = lfds700_list_aos_query + +lfds700_list_asu_init_valid_on_current_logical_core = lfds700_list_asu_init_valid_on_current_logical_core +lfds700_list_asu_cleanup = lfds700_list_asu_cleanup +lfds700_list_asu_insert_at_position = lfds700_list_asu_insert_at_position +lfds700_list_asu_insert_at_start = lfds700_list_asu_insert_at_start +lfds700_list_asu_insert_at_end = lfds700_list_asu_insert_at_end +lfds700_list_asu_insert_after_element = lfds700_list_asu_insert_after_element +lfds700_list_asu_get_by_key = lfds700_list_asu_get_by_key +lfds700_list_asu_query = lfds700_list_asu_query + +lfds700_misc_library_init_valid_on_current_logical_core = lfds700_misc_library_init_valid_on_current_logical_core +lfds700_misc_library_cleanup = lfds700_misc_library_cleanup +lfds700_misc_prng_init = lfds700_misc_prng_init +lfds700_misc_query = lfds700_misc_query + +lfds700_queue_init_valid_on_current_logical_core = lfds700_queue_init_valid_on_current_logical_core +lfds700_queue_cleanup = lfds700_queue_cleanup +lfds700_queue_enqueue = lfds700_queue_enqueue +lfds700_queue_dequeue = lfds700_queue_dequeue +lfds700_queue_query = lfds700_queue_query + +lfds700_queue_bss_init_valid_on_current_logical_core = lfds700_queue_bss_init_valid_on_current_logical_core +lfds700_queue_bss_cleanup = lfds700_queue_bss_cleanup +lfds700_queue_bss_enqueue = lfds700_queue_bss_enqueue +lfds700_queue_bss_dequeue = lfds700_queue_bss_dequeue +lfds700_queue_bss_query = lfds700_queue_bss_query + +lfds700_ringbuffer_init_valid_on_current_logical_core = lfds700_ringbuffer_init_valid_on_current_logical_core +lfds700_ringbuffer_cleanup = lfds700_ringbuffer_cleanup +lfds700_ringbuffer_read = lfds700_ringbuffer_read +lfds700_ringbuffer_write = lfds700_ringbuffer_write +lfds700_ringbuffer_query = lfds700_ringbuffer_query + +lfds700_stack_init_valid_on_current_logical_core = lfds700_stack_init_valid_on_current_logical_core +lfds700_stack_cleanup = lfds700_stack_cleanup +lfds700_stack_push = lfds700_stack_push +lfds700_stack_pop = lfds700_stack_pop +lfds700_stack_query = lfds700_stack_query + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/sdk_for_windows_7_and_gnumake/makefile b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/sdk_for_windows_7_and_gnumake/makefile new file mode 100644 index 0000000000..7b257c9277 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/sdk_for_windows_7_and_gnumake/makefile @@ -0,0 +1,114 @@ +##### paths ##### +BINDIR := ..\..\bin +INCDIR := ..\..\inc +OBJDIR := ..\..\obj +SRCDIR := ..\..\src + +##### misc ##### +QUIETLY := 1>nul 2>nul +NULL := +SPACE := $(NULL) # TRD : with a trailing space + +##### sources, objects and libraries ##### +BINNAME := liblfds700 +LIB_BINARY := $(BINDIR)\$(BINNAME).lib +DLL_BINARY := $(BINDIR)\$(BINNAME).dll +SRCDIRS := lfds700_btree_addonly_unbalanced lfds700_freelist lfds700_hash_addonly lfds700_list_addonly_ordered_singlylinked lfds700_list_addonly_singlylinked_unordered lfds700_misc lfds700_queue lfds700_queue_bounded_singleconsumer_singleproducer lfds700_ringbuffer lfds700_stack +SOURCES := lfds700_hash_addonly_cleanup.c lfds700_hash_addonly_get.c lfds700_hash_addonly_init.c lfds700_hash_addonly_insert.c lfds700_hash_addonly_iterate.c lfds700_hash_addonly_query.c \ + lfds700_list_addonly_ordered_singlylinked_cleanup.c lfds700_list_addonly_ordered_singlylinked_get.c lfds700_list_addonly_ordered_singlylinked_init.c lfds700_list_addonly_ordered_singlylinked_insert.c lfds700_list_addonly_ordered_singlylinked_query.c \ + lfds700_list_addonly_singlylinked_unordered_cleanup.c lfds700_list_addonly_singlylinked_unordered_get.c lfds700_list_addonly_singlylinked_unordered_init.c lfds700_list_addonly_singlylinked_unordered_insert.c lfds700_list_addonly_singlylinked_unordered_query.c \ + lfds700_btree_addonly_unbalanced_cleanup.c lfds700_btree_addonly_unbalanced_get.c lfds700_btree_addonly_unbalanced_init.c lfds700_btree_addonly_unbalanced_insert.c lfds700_btree_addonly_unbalanced_query.c \ + lfds700_freelist_cleanup.c lfds700_freelist_init.c lfds700_freelist_pop.c lfds700_freelist_push.c lfds700_freelist_query.c \ + lfds700_misc_cleanup.c lfds700_misc_globals.c lfds700_misc_init.c lfds700_misc_prng.c lfds700_misc_query.c \ + lfds700_queue_cleanup.c lfds700_queue_dequeue.c lfds700_queue_enqueue.c lfds700_queue_init.c lfds700_queue_query.c \ + lfds700_queue_bounded_singleconsumer_singleproducer_cleanup.c lfds700_queue_bounded_singleconsumer_singleproducer_dequeue.c lfds700_queue_bounded_singleconsumer_singleproducer_enqueue.c lfds700_queue_bounded_singleconsumer_singleproducer_init.c lfds700_queue_bounded_singleconsumer_singleproducer_query.c \ + lfds700_ringbuffer_cleanup.c lfds700_ringbuffer_init.c lfds700_ringbuffer_query.c lfds700_ringbuffer_read.c lfds700_ringbuffer_write.c \ + lfds700_stack_cleanup.c lfds700_stack_init.c lfds700_stack_pop.c lfds700_stack_push.c lfds700_stack_query.c +OBJECTS := $(patsubst %.c,$(OBJDIR)/%.obj,$(notdir $(SOURCES))) +SYSLIBS := kernel32.lib + +##### default paths fix up ##### +INCDIRS := $(patsubst %,%;,$(INCDIR)) +INCLUDE += $(subst $(SPACE),,$(INCDIRS)) + +##### tools ##### +MAKE := make +MFLAGS := + +CC := cl +CBASE := /c "-I$(SRCDIR)" "/Fd$(BINDIR)\$(BINNAME).pdb" /D_CRT_SECURE_NO_WARNINGS /DWIN32_LEAN_AND_MEAN /DUNICODE /D_UNICODE /DUNICODE /nologo /W4 /wd 4068 /WX +CFREL := /DNDEBUG /Ox +CFDBG := /D_DEBUG /Gm /Od /Zi + +AR := lib +AFLAGS := /nologo /subsystem:console /verbose /wx + +LD := link +LFBASE := /def:$(BINNAME).def /dll /nodefaultlib /nologo /nxcompat /subsystem:console /wx +LFREL := /incremental:no +LFDBG := /debug "/pdb:$(BINDIR)\$(BINNAME).pdb" + +##### variants ##### +CFLAGS := $(CBASE) $(CFDBG) /MTd +ASFLAGS := $(ASBASE) $(ASDBG) +LFLAGS := $(LFBASE) $(LFDBG) +CLIB := libcmtd.lib + +ifeq ($(MAKECMDGOALS),librel) + CFLAGS := $(CBASE) $(CFREL) /MT + ASFLAGS := $(ASBASE) $(ASREL) + LFLAGS := $(LFBASE) $(LFREL) + CLIB := libcmt.lib +endif + +ifeq ($(MAKECMDGOALS),libdbg) + CFLAGS := $(CBASE) $(CFDBG) /MTd + ASFLAGS := $(ASBASE) $(ASDBG) + LFLAGS := $(LFBASE) $(LFDBG) + CLIB := libcmtd.lib +endif + +ifeq ($(MAKECMDGOALS),dllrel) + CFLAGS := $(CBASE) $(CFREL) /MD + ASFLAGS := $(ASBASE) $(ASREL) + LFLAGS := $(LFBASE) $(LFREL) + CLIB := msvcrt.lib +endif + +ifeq ($(MAKECMDGOALS),dlldbg) + CFLAGS := $(CBASE) $(CFDBG) /MDd + ASFLAGS := $(ASBASE) $(ASDBG) + LFLAGS := $(LFBASE) $(LFDBG) + CLIB := msvcrtd.lib +endif + +##### search paths ##### +vpath %.c $(patsubst %,$(SRCDIR)/%;,$(SRCDIRS)) + +##### implicit rules ##### +$(OBJDIR)/%.obj : %.c + $(CC) $(CFLAGS) "/Fo$@" $< + +##### explicit rules ##### +$(LIB_BINARY) : $(OBJECTS) + $(AR) $(AFLAGS) $(OBJECTS) /out:$(LIB_BINARY) + +$(DLL_BINARY) : $(OBJECTS) + $(LD) $(LFLAGS) $(CLIB) $(SYSLIBS) $(OBJECTS) /out:$(DLL_BINARY) + +##### phony ##### +.PHONY : clean librel libdbg dllrel dlldbg + +clean : + @erase /Q $(BINDIR)\$(BINNAME).* $(OBJDIR)\*.obj $(QUIETLY) + +dlldbg : $(DLL_BINARY) +dllrel : $(DLL_BINARY) + +libdbg : $(LIB_BINARY) +librel : $(LIB_BINARY) + +##### notes ##### +# /wd 4068 : turn off "unknown pragma" warning + + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2012/liblfds700.def b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2012/liblfds700.def new file mode 100644 index 0000000000..583ce35dbd --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2012/liblfds700.def @@ -0,0 +1,69 @@ +EXPORTS + +lfds700_btree_au_init_valid_on_current_logical_core = lfds700_btree_au_init_valid_on_current_logical_core +lfds700_btree_au_cleanup = lfds700_btree_au_cleanup +lfds700_btree_au_insert = lfds700_btree_au_insert +lfds700_btree_au_get_by_absolute_position_and_then_by_relative_position = lfds700_btree_au_get_by_absolute_position_and_then_by_relative_position +lfds700_btree_au_get_by_absolute_position = lfds700_btree_au_get_by_absolute_position +lfds700_btree_au_get_by_relative_position = lfds700_btree_au_get_by_relative_position +lfds700_btree_au_get_by_key = lfds700_btree_au_get_by_key +lfds700_btree_au_query = lfds700_btree_au_query + +lfds700_freelist_init_valid_on_current_logical_core = lfds700_freelist_init_valid_on_current_logical_core +lfds700_freelist_cleanup = lfds700_freelist_cleanup +lfds700_freelist_push = lfds700_freelist_push +lfds700_freelist_pop = lfds700_freelist_pop +lfds700_freelist_query = lfds700_freelist_query + +lfds700_hash_a_init_valid_on_current_logical_core = lfds700_hash_a_init_valid_on_current_logical_core +lfds700_hash_a_cleanup = lfds700_hash_a_cleanup +lfds700_hash_a_insert = lfds700_hash_a_insert +lfds700_hash_a_get_by_key = lfds700_hash_a_get_by_key +lfds700_hash_a_iterate_init = lfds700_hash_a_iterate_init +lfds700_hash_a_iterate = lfds700_hash_a_iterate +lfds700_hash_a_query = lfds700_hash_a_query + +lfds700_list_aos_init_valid_on_current_logical_core = lfds700_list_aos_init_valid_on_current_logical_core +lfds700_list_aos_cleanup = lfds700_list_aos_cleanup +lfds700_list_aos_insert = lfds700_list_aos_insert +lfds700_list_aos_get_by_key = lfds700_list_aos_get_by_key +lfds700_list_aos_query = lfds700_list_aos_query + +lfds700_list_asu_init_valid_on_current_logical_core = lfds700_list_asu_init_valid_on_current_logical_core +lfds700_list_asu_cleanup = lfds700_list_asu_cleanup +lfds700_list_asu_insert_at_position = lfds700_list_asu_insert_at_position +lfds700_list_asu_insert_at_start = lfds700_list_asu_insert_at_start +lfds700_list_asu_insert_at_end = lfds700_list_asu_insert_at_end +lfds700_list_asu_insert_after_element = lfds700_list_asu_insert_after_element +lfds700_list_asu_get_by_key = lfds700_list_asu_get_by_key +lfds700_list_asu_query = lfds700_list_asu_query + +lfds700_misc_library_init_valid_on_current_logical_core = lfds700_misc_library_init_valid_on_current_logical_core +lfds700_misc_library_cleanup = lfds700_misc_library_cleanup +lfds700_misc_prng_init = lfds700_misc_prng_init +lfds700_misc_query = lfds700_misc_query + +lfds700_queue_init_valid_on_current_logical_core = lfds700_queue_init_valid_on_current_logical_core +lfds700_queue_cleanup = lfds700_queue_cleanup +lfds700_queue_enqueue = lfds700_queue_enqueue +lfds700_queue_dequeue = lfds700_queue_dequeue +lfds700_queue_query = lfds700_queue_query + +lfds700_queue_bss_init_valid_on_current_logical_core = lfds700_queue_bss_init_valid_on_current_logical_core +lfds700_queue_bss_cleanup = lfds700_queue_bss_cleanup +lfds700_queue_bss_enqueue = lfds700_queue_bss_enqueue +lfds700_queue_bss_dequeue = lfds700_queue_bss_dequeue +lfds700_queue_bss_query = lfds700_queue_bss_query + +lfds700_ringbuffer_init_valid_on_current_logical_core = lfds700_ringbuffer_init_valid_on_current_logical_core +lfds700_ringbuffer_cleanup = lfds700_ringbuffer_cleanup +lfds700_ringbuffer_read = lfds700_ringbuffer_read +lfds700_ringbuffer_write = lfds700_ringbuffer_write +lfds700_ringbuffer_query = lfds700_ringbuffer_query + +lfds700_stack_init_valid_on_current_logical_core = lfds700_stack_init_valid_on_current_logical_core +lfds700_stack_cleanup = lfds700_stack_cleanup +lfds700_stack_push = lfds700_stack_push +lfds700_stack_pop = lfds700_stack_pop +lfds700_stack_query = lfds700_stack_query + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2012/liblfds700.sln b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2012/liblfds700.sln new file mode 100644 index 0000000000..b52c44e46f --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2012/liblfds700.sln @@ -0,0 +1,46 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2012 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "liblfds700", "liblfds700.vcxproj", "{1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug DLL|Win32 = Debug DLL|Win32 + Debug DLL|x64 = Debug DLL|x64 + Debug LIB|Win32 = Debug LIB|Win32 + Debug LIB|x64 = Debug LIB|x64 + Release DLL|Win32 = Release DLL|Win32 + Release DLL|x64 = Release DLL|x64 + Release LIB|Win32 = Release LIB|Win32 + Release LIB|x64 = Release LIB|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Debug DLL|Win32.ActiveCfg = Debug DLL|Win32 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Debug DLL|Win32.Build.0 = Debug DLL|Win32 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Debug DLL|Win32.Deploy.0 = Debug DLL|Win32 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Debug DLL|x64.ActiveCfg = Debug DLL|x64 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Debug DLL|x64.Build.0 = Debug DLL|x64 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Debug DLL|x64.Deploy.0 = Debug DLL|x64 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Debug LIB|Win32.ActiveCfg = Debug LIB|Win32 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Debug LIB|Win32.Build.0 = Debug LIB|Win32 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Debug LIB|Win32.Deploy.0 = Debug LIB|Win32 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Debug LIB|x64.ActiveCfg = Debug LIB|x64 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Debug LIB|x64.Build.0 = Debug LIB|x64 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Debug LIB|x64.Deploy.0 = Debug LIB|x64 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Release DLL|Win32.ActiveCfg = Release DLL|Win32 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Release DLL|Win32.Build.0 = Release DLL|Win32 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Release DLL|Win32.Deploy.0 = Release DLL|Win32 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Release DLL|x64.ActiveCfg = Release DLL|x64 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Release DLL|x64.Build.0 = Release DLL|x64 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Release DLL|x64.Deploy.0 = Release DLL|x64 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Release LIB|Win32.ActiveCfg = Release LIB|Win32 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Release LIB|Win32.Build.0 = Release LIB|Win32 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Release LIB|Win32.Deploy.0 = Release LIB|Win32 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Release LIB|x64.ActiveCfg = Release LIB|x64 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Release LIB|x64.Build.0 = Release LIB|x64 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Release LIB|x64.Deploy.0 = Release LIB|x64 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2012/liblfds700.vcxproj b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2012/liblfds700.vcxproj new file mode 100644 index 0000000000..3d4bf6364f --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2012/liblfds700.vcxproj @@ -0,0 +1,705 @@ + + + + + Debug DLL + Win32 + + + Debug DLL + x64 + + + Debug LIB + Win32 + + + Debug LIB + x64 + + + Release DLL + Win32 + + + Release DLL + x64 + + + Release LIB + Win32 + + + Release LIB + x64 + + + + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0} + Win32Proj + + + + StaticLibrary + true + v110 + + + DynamicLibrary + true + v110 + + + StaticLibrary + true + v110 + + + DynamicLibrary + true + v110 + + + StaticLibrary + false + v110 + true + + + DynamicLibrary + false + v110 + true + + + StaticLibrary + false + v110 + true + + + DynamicLibrary + false + v110 + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + $(ProjectDir)..\..\bin\$(Platform) $(Configuration)\ + $(ProjectDir)..\..\obj\$(Platform) $(Configuration)\ + + + + + $(ProjectDir)..\..\bin\$(Platform) $(Configuration)\ + $(ProjectDir)..\..\obj\$(Platform) $(Configuration)\ + + + true + $(ProjectDir)..\..\bin\$(Platform) $(Configuration)\ + $(ProjectDir)..\..\obj\$(Platform) $(Configuration)\ + + + + + $(ProjectDir)..\..\bin\$(Platform) $(Configuration)\ + $(ProjectDir)..\..\obj\$(Platform) $(Configuration)\ + + + true + $(ProjectDir)..\..\bin\$(Platform) $(Configuration)\ + $(ProjectDir)..\..\obj\$(Platform) $(Configuration)\ + + + + + $(ProjectDir)..\..\bin\$(Platform) $(Configuration)\ + $(ProjectDir)..\..\obj\$(Platform) $(Configuration)\ + + + true + $(ProjectDir)..\..\bin\$(Platform) $(Configuration)\ + $(ProjectDir)..\..\obj\$(Platform) $(Configuration)\ + + + + + $(ProjectDir)..\..\bin\$(Platform) $(Configuration)\ + $(ProjectDir)..\..\obj\$(Platform) $(Configuration)\ + + + + WIN32;_DEBUG;_LIB;LFDS700_BUILD_TYPE_STRING="Debug";%(PreprocessorDefinitions) + + + MultiThreadedDebug + Level4 + ProgramDatabase + Disabled + false + false + true + true + true + true + false + true + + + + + + + true + false + false + false + true + CompileAsC + true + None + true + false + 4068 + + + MachineX86 + true + Windows + + + true + + + MachineX86 + + + Console + + + false + true + + + + + WIN32;_DEBUG;_LIB;LFDS700_BUILD_TYPE_STRING="Debug";%(PreprocessorDefinitions) + + + MultiThreadedDebug + Level4 + ProgramDatabase + Disabled + false + false + true + true + true + true + false + true + + + + + + + true + false + false + false + true + CompileAsC + true + None + true + false + 4068 + + + MachineX86 + true + Console + kernel32.lib;msvcrtd.lib + + + true + true + liblfds700.def + true + NoErrorReport + true + + + true + + + MachineX86 + + + Console + + + false + true + + + true + + + + + WIN32;_DEBUG;_LIB;LFDS700_BUILD_TYPE_STRING="Debug";%(PreprocessorDefinitions) + + + MultiThreadedDebug + Level4 + ProgramDatabase + Disabled + false + false + true + true + true + true + false + true + + + + + + + true + false + false + false + true + CompileAsC + true + None + true + false + 4068 + false + + + true + Windows + + + true + + + MachineX64 + + + Console + + + false + true + + + + + WIN32;_DEBUG;_LIB;LFDS700_BUILD_TYPE_STRING="Debug";%(PreprocessorDefinitions) + + + MultiThreadedDebug + Level4 + ProgramDatabase + Disabled + false + false + true + true + true + true + false + true + + + + + + + true + false + false + false + true + CompileAsC + true + None + true + false + 4068 + false + + + true + Console + true + true + liblfds700.def + true + false + NoErrorReport + kernel32.lib;msvcrtd.lib + true + + + true + + + MachineX64 + + + Console + + + false + true + + + + + WIN32;NDEBUG;_LIB;LFDS700_BUILD_TYPE_STRING="Release";%(PreprocessorDefinitions) + + + MultiThreaded + Level4 + None + false + false + true + true + AnySuitable + true + Speed + true + false + false + + + + + + + false + + + false + false + CompileAsC + true + None + true + 4068 + true + + + MachineX86 + true + Windows + true + true + + + true + + + MachineX86 + + + Console + true + + + + + WIN32;NDEBUG;_LIB;LFDS700_BUILD_TYPE_STRING="Release";%(PreprocessorDefinitions) + + + MultiThreadedDLL + Level4 + None + false + false + true + true + AnySuitable + true + Speed + true + false + false + + + + + + + false + + + false + false + CompileAsC + true + None + true + 4068 + true + + + MachineX86 + false + Console + true + true + kernel32.lib;msvcrt.lib + + + true + true + liblfds700.def + NoErrorReport + + + true + + + MachineX86 + + + Console + true + + + true + + + + + WIN32;NDEBUG;_LIB;LFDS700_BUILD_TYPE_STRING="Release";%(PreprocessorDefinitions) + + + MultiThreaded + Level4 + None + false + false + true + true + AnySuitable + true + Speed + true + false + false + + + + + + + false + + + false + false + CompileAsC + true + None + true + 4068 + true + + + true + Windows + true + true + + + true + + + MachineX64 + + + Console + true + + + + + WIN32;NDEBUG;_LIB;LFDS700_BUILD_TYPE_STRING="Release";%(PreprocessorDefinitions) + + + MultiThreadedDLL + Level4 + None + false + false + true + true + AnySuitable + true + Speed + true + false + false + + + + + + + false + + + false + false + CompileAsC + true + None + true + 4068 + true + + + false + Console + true + true + true + true + liblfds700.def + NoErrorReport + kernel32.lib;msvcrt.lib + + + true + + + MachineX64 + + + Console + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2012/liblfds700.vcxproj.filters b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2012/liblfds700.vcxproj.filters new file mode 100644 index 0000000000..5ec0bea579 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2012/liblfds700.vcxproj.filters @@ -0,0 +1,279 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav + + + {258be429-7dac-4999-b995-753aa2f0c505} + + + {469abf8e-47d8-4678-bd66-7c7e65c5f52e} + + + {62ee141b-2acb-4555-b016-7be20a57f2bf} + + + {19c73b0f-25e0-4166-9093-427f1dfb4f70} + + + {00eb30fe-e638-4c2b-8ca1-1f09c4a0ed45} + + + {400ae4e9-2281-4549-b918-59d1a27a2d07} + + + {0b1fafc3-817b-4c18-8eb1-121884e3a29b} + + + {bcbadc74-1748-4696-aad7-7fdbe5614624} + + + {c45194af-7b41-4c28-bc0e-1095ec347664} + + + {6250c4d5-ac8e-4c28-93de-0954c5bed1cb} + + + {3ac93721-1d81-49e4-9581-dbc12ace5c0c} + + + + + Header Files + + + Source Files\lfds700_freelist + + + Source Files\lfds700_queue + + + Source Files\lfds700_stack + + + Header Files\liblfds700 + + + Header Files\liblfds700 + + + Header Files\liblfds700 + + + Header Files\liblfds700 + + + Header Files\liblfds700 + + + Header Files\liblfds700 + + + Header Files\liblfds700 + + + Header Files\liblfds700 + + + Header Files\liblfds700 + + + Header Files\liblfds700 + + + Header Files\liblfds700 + + + Header Files\liblfds700 + + + Header Files\liblfds700 + + + Source Files\lfds700_hash_addonly + + + Source Files\lfds700_misc + + + Source Files\lfds700_btree_addonly_unbalanced + + + Source Files\lfds700_ringbuffer + + + Source Files\lfds700_queue_bounded_singleconsumer_singleproducer + + + Source Files\lfds700_list_addonly_ordered_singlylinked + + + Source Files\lfds700_list_addonly_singlylinked_unordered + + + + + Source Files\lfds700_freelist + + + Source Files\lfds700_freelist + + + Source Files\lfds700_freelist + + + Source Files\lfds700_freelist + + + Source Files\lfds700_freelist + + + Source Files\lfds700_queue + + + Source Files\lfds700_queue + + + Source Files\lfds700_queue + + + Source Files\lfds700_queue + + + Source Files\lfds700_queue + + + Source Files\lfds700_stack + + + Source Files\lfds700_stack + + + Source Files\lfds700_stack + + + Source Files\lfds700_stack + + + Source Files\lfds700_stack + + + Source Files\lfds700_hash_addonly + + + Source Files\lfds700_hash_addonly + + + Source Files\lfds700_hash_addonly + + + Source Files\lfds700_hash_addonly + + + Source Files\lfds700_hash_addonly + + + Source Files\lfds700_hash_addonly + + + Source Files\lfds700_misc + + + Source Files\lfds700_misc + + + Source Files\lfds700_misc + + + Source Files\lfds700_misc + + + Source Files\lfds700_misc + + + Source Files\lfds700_btree_addonly_unbalanced + + + Source Files\lfds700_btree_addonly_unbalanced + + + Source Files\lfds700_btree_addonly_unbalanced + + + Source Files\lfds700_btree_addonly_unbalanced + + + Source Files\lfds700_btree_addonly_unbalanced + + + Source Files\lfds700_ringbuffer + + + Source Files\lfds700_ringbuffer + + + Source Files\lfds700_ringbuffer + + + Source Files\lfds700_ringbuffer + + + Source Files\lfds700_ringbuffer + + + Source Files\lfds700_queue_bounded_singleconsumer_singleproducer + + + Source Files\lfds700_queue_bounded_singleconsumer_singleproducer + + + Source Files\lfds700_queue_bounded_singleconsumer_singleproducer + + + Source Files\lfds700_queue_bounded_singleconsumer_singleproducer + + + Source Files\lfds700_queue_bounded_singleconsumer_singleproducer + + + Source Files\lfds700_list_addonly_ordered_singlylinked + + + Source Files\lfds700_list_addonly_ordered_singlylinked + + + Source Files\lfds700_list_addonly_ordered_singlylinked + + + Source Files\lfds700_list_addonly_ordered_singlylinked + + + Source Files\lfds700_list_addonly_ordered_singlylinked + + + Source Files\lfds700_list_addonly_singlylinked_unordered + + + Source Files\lfds700_list_addonly_singlylinked_unordered + + + Source Files\lfds700_list_addonly_singlylinked_unordered + + + Source Files\lfds700_list_addonly_singlylinked_unordered + + + Source Files\lfds700_list_addonly_singlylinked_unordered + + + \ No newline at end of file diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2012/liblfds700.vcxproj.user b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2012/liblfds700.vcxproj.user new file mode 100644 index 0000000000..7cbb3216ad --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2012/liblfds700.vcxproj.user @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2012_and_wdk_8.0/driver_entry.c b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2012_and_wdk_8.0/driver_entry.c new file mode 100644 index 0000000000..9ea5612e54 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2012_and_wdk_8.0/driver_entry.c @@ -0,0 +1 @@ +#include diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2012_and_wdk_8.0/liblfds700.def b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2012_and_wdk_8.0/liblfds700.def new file mode 100644 index 0000000000..583ce35dbd --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2012_and_wdk_8.0/liblfds700.def @@ -0,0 +1,69 @@ +EXPORTS + +lfds700_btree_au_init_valid_on_current_logical_core = lfds700_btree_au_init_valid_on_current_logical_core +lfds700_btree_au_cleanup = lfds700_btree_au_cleanup +lfds700_btree_au_insert = lfds700_btree_au_insert +lfds700_btree_au_get_by_absolute_position_and_then_by_relative_position = lfds700_btree_au_get_by_absolute_position_and_then_by_relative_position +lfds700_btree_au_get_by_absolute_position = lfds700_btree_au_get_by_absolute_position +lfds700_btree_au_get_by_relative_position = lfds700_btree_au_get_by_relative_position +lfds700_btree_au_get_by_key = lfds700_btree_au_get_by_key +lfds700_btree_au_query = lfds700_btree_au_query + +lfds700_freelist_init_valid_on_current_logical_core = lfds700_freelist_init_valid_on_current_logical_core +lfds700_freelist_cleanup = lfds700_freelist_cleanup +lfds700_freelist_push = lfds700_freelist_push +lfds700_freelist_pop = lfds700_freelist_pop +lfds700_freelist_query = lfds700_freelist_query + +lfds700_hash_a_init_valid_on_current_logical_core = lfds700_hash_a_init_valid_on_current_logical_core +lfds700_hash_a_cleanup = lfds700_hash_a_cleanup +lfds700_hash_a_insert = lfds700_hash_a_insert +lfds700_hash_a_get_by_key = lfds700_hash_a_get_by_key +lfds700_hash_a_iterate_init = lfds700_hash_a_iterate_init +lfds700_hash_a_iterate = lfds700_hash_a_iterate +lfds700_hash_a_query = lfds700_hash_a_query + +lfds700_list_aos_init_valid_on_current_logical_core = lfds700_list_aos_init_valid_on_current_logical_core +lfds700_list_aos_cleanup = lfds700_list_aos_cleanup +lfds700_list_aos_insert = lfds700_list_aos_insert +lfds700_list_aos_get_by_key = lfds700_list_aos_get_by_key +lfds700_list_aos_query = lfds700_list_aos_query + +lfds700_list_asu_init_valid_on_current_logical_core = lfds700_list_asu_init_valid_on_current_logical_core +lfds700_list_asu_cleanup = lfds700_list_asu_cleanup +lfds700_list_asu_insert_at_position = lfds700_list_asu_insert_at_position +lfds700_list_asu_insert_at_start = lfds700_list_asu_insert_at_start +lfds700_list_asu_insert_at_end = lfds700_list_asu_insert_at_end +lfds700_list_asu_insert_after_element = lfds700_list_asu_insert_after_element +lfds700_list_asu_get_by_key = lfds700_list_asu_get_by_key +lfds700_list_asu_query = lfds700_list_asu_query + +lfds700_misc_library_init_valid_on_current_logical_core = lfds700_misc_library_init_valid_on_current_logical_core +lfds700_misc_library_cleanup = lfds700_misc_library_cleanup +lfds700_misc_prng_init = lfds700_misc_prng_init +lfds700_misc_query = lfds700_misc_query + +lfds700_queue_init_valid_on_current_logical_core = lfds700_queue_init_valid_on_current_logical_core +lfds700_queue_cleanup = lfds700_queue_cleanup +lfds700_queue_enqueue = lfds700_queue_enqueue +lfds700_queue_dequeue = lfds700_queue_dequeue +lfds700_queue_query = lfds700_queue_query + +lfds700_queue_bss_init_valid_on_current_logical_core = lfds700_queue_bss_init_valid_on_current_logical_core +lfds700_queue_bss_cleanup = lfds700_queue_bss_cleanup +lfds700_queue_bss_enqueue = lfds700_queue_bss_enqueue +lfds700_queue_bss_dequeue = lfds700_queue_bss_dequeue +lfds700_queue_bss_query = lfds700_queue_bss_query + +lfds700_ringbuffer_init_valid_on_current_logical_core = lfds700_ringbuffer_init_valid_on_current_logical_core +lfds700_ringbuffer_cleanup = lfds700_ringbuffer_cleanup +lfds700_ringbuffer_read = lfds700_ringbuffer_read +lfds700_ringbuffer_write = lfds700_ringbuffer_write +lfds700_ringbuffer_query = lfds700_ringbuffer_query + +lfds700_stack_init_valid_on_current_logical_core = lfds700_stack_init_valid_on_current_logical_core +lfds700_stack_cleanup = lfds700_stack_cleanup +lfds700_stack_push = lfds700_stack_push +lfds700_stack_pop = lfds700_stack_pop +lfds700_stack_query = lfds700_stack_query + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2012_and_wdk_8.0/liblfds700.sln b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2012_and_wdk_8.0/liblfds700.sln new file mode 100644 index 0000000000..b52c44e46f --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2012_and_wdk_8.0/liblfds700.sln @@ -0,0 +1,46 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2012 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "liblfds700", "liblfds700.vcxproj", "{1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug DLL|Win32 = Debug DLL|Win32 + Debug DLL|x64 = Debug DLL|x64 + Debug LIB|Win32 = Debug LIB|Win32 + Debug LIB|x64 = Debug LIB|x64 + Release DLL|Win32 = Release DLL|Win32 + Release DLL|x64 = Release DLL|x64 + Release LIB|Win32 = Release LIB|Win32 + Release LIB|x64 = Release LIB|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Debug DLL|Win32.ActiveCfg = Debug DLL|Win32 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Debug DLL|Win32.Build.0 = Debug DLL|Win32 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Debug DLL|Win32.Deploy.0 = Debug DLL|Win32 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Debug DLL|x64.ActiveCfg = Debug DLL|x64 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Debug DLL|x64.Build.0 = Debug DLL|x64 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Debug DLL|x64.Deploy.0 = Debug DLL|x64 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Debug LIB|Win32.ActiveCfg = Debug LIB|Win32 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Debug LIB|Win32.Build.0 = Debug LIB|Win32 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Debug LIB|Win32.Deploy.0 = Debug LIB|Win32 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Debug LIB|x64.ActiveCfg = Debug LIB|x64 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Debug LIB|x64.Build.0 = Debug LIB|x64 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Debug LIB|x64.Deploy.0 = Debug LIB|x64 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Release DLL|Win32.ActiveCfg = Release DLL|Win32 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Release DLL|Win32.Build.0 = Release DLL|Win32 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Release DLL|Win32.Deploy.0 = Release DLL|Win32 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Release DLL|x64.ActiveCfg = Release DLL|x64 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Release DLL|x64.Build.0 = Release DLL|x64 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Release DLL|x64.Deploy.0 = Release DLL|x64 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Release LIB|Win32.ActiveCfg = Release LIB|Win32 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Release LIB|Win32.Build.0 = Release LIB|Win32 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Release LIB|Win32.Deploy.0 = Release LIB|Win32 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Release LIB|x64.ActiveCfg = Release LIB|x64 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Release LIB|x64.Build.0 = Release LIB|x64 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Release LIB|x64.Deploy.0 = Release LIB|x64 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2012_and_wdk_8.0/liblfds700.vcxproj b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2012_and_wdk_8.0/liblfds700.vcxproj new file mode 100644 index 0000000000..f19ead0c18 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2012_and_wdk_8.0/liblfds700.vcxproj @@ -0,0 +1,733 @@ + + + + + Debug DLL + Win32 + + + Debug DLL + x64 + + + Debug LIB + Win32 + + + Debug LIB + x64 + + + Release DLL + Win32 + + + Release DLL + x64 + + + Release LIB + Win32 + + + Release LIB + x64 + + + + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0} + Win32Proj + + + + StaticLibrary + true + WindowsKernelModeDriver8.0 + + + DynamicLibrary + true + WindowsKernelModeDriver8.0 + + + StaticLibrary + true + WindowsKernelModeDriver8.0 + + + DynamicLibrary + true + WindowsKernelModeDriver8.0 + + + StaticLibrary + false + WindowsKernelModeDriver8.0 + true + + + DynamicLibrary + false + WindowsKernelModeDriver8.0 + true + + + StaticLibrary + false + WindowsKernelModeDriver8.0 + true + + + DynamicLibrary + false + WindowsKernelModeDriver8.0 + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + $(ProjectDir)..\..\bin\$(Platform) $(Configuration)\ + $(ProjectDir)..\..\obj\$(Platform) $(Configuration)\ + $(ProjectDir);$(IncludePath); + $(WDKContentRoot)lib\$(DDKSpec)\KM\$(DDKPlatform);$(LibraryPath); + + + + + $(ProjectDir)..\..\bin\$(Platform) $(Configuration)\ + $(ProjectDir)..\..\obj\$(Platform) $(Configuration)\ + $(ProjectDir);$(IncludePath); + $(WDKContentRoot)lib\$(DDKSpec)\KM\$(DDKPlatform);$(LibraryPath); + + + true + $(ProjectDir)..\..\bin\$(Platform) $(Configuration)\ + $(ProjectDir)..\..\obj\$(Platform) $(Configuration)\ + $(ProjectDir);$(IncludePath); + $(WDKContentRoot)lib\$(DDKSpec)\KM\$(DDKPlatform);$(LibraryPath); + + + + + $(ProjectDir)..\..\bin\$(Platform) $(Configuration)\ + $(ProjectDir)..\..\obj\$(Platform) $(Configuration)\ + $(ProjectDir);$(IncludePath); + $(WDKContentRoot)lib\$(DDKSpec)\KM\$(DDKPlatform);$(LibraryPath); + + + true + $(ProjectDir)..\..\bin\$(Platform) $(Configuration)\ + $(ProjectDir)..\..\obj\$(Platform) $(Configuration)\ + $(ProjectDir);$(IncludePath); + $(WDKContentRoot)lib\$(DDKSpec)\KM\$(DDKPlatform);$(LibraryPath); + + + + + $(ProjectDir)..\..\bin\$(Platform) $(Configuration)\ + $(ProjectDir)..\..\obj\$(Platform) $(Configuration)\ + $(ProjectDir);$(IncludePath); + $(WDKContentRoot)lib\$(DDKSpec)\KM\$(DDKPlatform);$(LibraryPath); + + + true + $(ProjectDir)..\..\bin\$(Platform) $(Configuration)\ + $(ProjectDir)..\..\obj\$(Platform) $(Configuration)\ + $(ProjectDir);$(IncludePath); + $(WDKContentRoot)lib\$(DDKSpec)\KM\$(DDKPlatform);$(LibraryPath); + + + + + $(ProjectDir)..\..\bin\$(Platform) $(Configuration)\ + $(ProjectDir)..\..\obj\$(Platform) $(Configuration)\ + $(ProjectDir);$(IncludePath); + $(WDKContentRoot)lib\$(DDKSpec)\KM\$(DDKPlatform);$(LibraryPath); + + + + WIN32;_DEBUG;_LIB;LFDS700_BUILD_TYPE_STRING="Debug";%(PreprocessorDefinitions) + + + MultiThreadedDebug + Level4 + ProgramDatabase + Disabled + false + false + true + true + true + true + false + true + + + + + + + true + false + false + false + true + CompileAsC + true + None + true + false + 4068 + /kernel %(AdditionalOptions) + + + MachineX86 + true + Windows + + + true + + + MachineX86 + + + Native + + + false + true + + + + + WIN32;_DEBUG;_LIB;LFDS700_BUILD_TYPE_STRING="Debug";%(PreprocessorDefinitions) + + + MultiThreadedDebug + Level4 + ProgramDatabase + Disabled + false + false + true + true + true + true + false + true + + + + + + + true + false + false + false + true + CompileAsC + true + None + true + false + 4068 + /kernel %(AdditionalOptions) + + + MachineX86 + true + Native + kernel32.lib;msvcrtd.lib + + + true + true + liblfds700.def + true + NoErrorReport + true + WDM + + + true + + + MachineX86 + + + Console + + + false + true + + + true + + + + + WIN32;_DEBUG;_LIB;LFDS700_BUILD_TYPE_STRING="Debug";%(PreprocessorDefinitions) + + + MultiThreadedDebug + Level4 + ProgramDatabase + Disabled + false + false + true + true + true + true + false + true + + + + + + + true + false + false + false + true + CompileAsC + true + None + true + false + 4068 + false + /kernel %(AdditionalOptions) + + + true + Windows + + + true + + + MachineX64 + + + Native + + + false + true + + + + + WIN32;_DEBUG;_LIB;LFDS700_BUILD_TYPE_STRING="Debug";%(PreprocessorDefinitions) + + + MultiThreadedDebug + Level4 + ProgramDatabase + Disabled + false + false + true + true + true + true + false + true + + + + + + + true + false + false + false + true + CompileAsC + true + None + true + false + 4068 + false + /kernel %(AdditionalOptions) + + + true + Native + true + true + liblfds700.def + true + false + NoErrorReport + kernel32.lib;msvcrtd.lib + true + WDM + + + true + + + MachineX64 + + + Console + + + false + true + + + + + WIN32;NDEBUG;_LIB;LFDS700_BUILD_TYPE_STRING="Release";%(PreprocessorDefinitions) + + + MultiThreaded + Level4 + None + false + false + true + true + AnySuitable + true + Speed + true + false + false + + + + + + + false + + + false + false + CompileAsC + true + None + true + 4068 + true + /kernel %(AdditionalOptions) + + + MachineX86 + true + Windows + true + true + + + true + + + MachineX86 + + + Native + true + + + + + WIN32;NDEBUG;_LIB;LFDS700_BUILD_TYPE_STRING="Release";%(PreprocessorDefinitions) + + + MultiThreadedDLL + Level4 + None + false + false + true + true + AnySuitable + true + Speed + true + false + false + + + + + + + false + + + false + false + CompileAsC + true + None + true + 4068 + true + /kernel %(AdditionalOptions) + + + MachineX86 + false + Native + true + true + kernel32.lib;msvcrt.lib + + + true + true + liblfds700.def + NoErrorReport + WDM + + + true + + + MachineX86 + + + Console + true + + + true + + + + + WIN32;NDEBUG;_LIB;LFDS700_BUILD_TYPE_STRING="Release";%(PreprocessorDefinitions) + + + MultiThreaded + Level4 + None + false + false + true + true + AnySuitable + true + Speed + true + false + false + + + + + + + false + + + false + false + CompileAsC + true + None + true + 4068 + true + /kernel %(AdditionalOptions) + + + true + Windows + true + true + + + true + + + MachineX64 + + + Native + true + + + + + WIN32;NDEBUG;_LIB;LFDS700_BUILD_TYPE_STRING="Release";%(PreprocessorDefinitions) + + + MultiThreadedDLL + Level4 + None + false + false + true + true + AnySuitable + true + Speed + true + false + false + + + + + + + false + + + false + false + CompileAsC + true + None + true + 4068 + true + /kernel %(AdditionalOptions) + + + false + Native + true + true + true + true + liblfds700.def + NoErrorReport + kernel32.lib;msvcrt.lib + WDM + + + true + + + MachineX64 + + + Console + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2012_and_wdk_8.0/liblfds700.vcxproj.filters b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2012_and_wdk_8.0/liblfds700.vcxproj.filters new file mode 100644 index 0000000000..978f8ec1c9 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2012_and_wdk_8.0/liblfds700.vcxproj.filters @@ -0,0 +1,279 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav + + + {258be429-7dac-4999-b995-753aa2f0c505} + + + {469abf8e-47d8-4678-bd66-7c7e65c5f52e} + + + {62ee141b-2acb-4555-b016-7be20a57f2bf} + + + {19c73b0f-25e0-4166-9093-427f1dfb4f70} + + + {00eb30fe-e638-4c2b-8ca1-1f09c4a0ed45} + + + {6250c4d5-ac8e-4c28-93de-0954c5bed1cb} + + + {400ae4e9-2281-4549-b918-59d1a27a2d07} + + + {c45194af-7b41-4c28-bc0e-1095ec347664} + + + {8b3cbb5c-7436-429f-9b72-bae1f4721746} + + + {bcbadc74-1748-4696-aad7-7fdbe5614624} + + + {0b1fafc3-817b-4c18-8eb1-121884e3a29b} + + + + + Header Files + + + Source Files\lfds700_freelist + + + Source Files\lfds700_stack + + + Source Files\lfds700_queue + + + Header Files\liblfds700 + + + Header Files\liblfds700 + + + Header Files\liblfds700 + + + Header Files\liblfds700 + + + Header Files\liblfds700 + + + Header Files\liblfds700 + + + Header Files\liblfds700 + + + Header Files\liblfds700 + + + Header Files\liblfds700 + + + Header Files\liblfds700 + + + Header Files\liblfds700 + + + Header Files\liblfds700 + + + Header Files\liblfds700 + + + Source Files\lfds700_hash_addonly + + + Source Files\lfds700_list_addonly_ordered_singlylinked + + + Source Files\lfds700_btree_addonly_unbalanced + + + Source Files\lfds700_misc + + + Source Files\lfds700_queue_bounded_singleconsumer_singleproducer + + + Source Files\lfds700_list_addonly_singlylinked_unordered + + + Source Files\lfds700_ringbuffer + + + + + Source Files\lfds700_freelist + + + Source Files\lfds700_freelist + + + Source Files\lfds700_freelist + + + Source Files\lfds700_freelist + + + Source Files\lfds700_freelist + + + Source Files\lfds700_stack + + + Source Files\lfds700_stack + + + Source Files\lfds700_stack + + + Source Files\lfds700_stack + + + Source Files\lfds700_stack + + + Source Files\lfds700_queue + + + Source Files\lfds700_queue + + + Source Files\lfds700_queue + + + Source Files\lfds700_queue + + + Source Files\lfds700_queue + + + Source Files\lfds700_hash_addonly + + + Source Files\lfds700_hash_addonly + + + Source Files\lfds700_hash_addonly + + + Source Files\lfds700_hash_addonly + + + Source Files\lfds700_hash_addonly + + + Source Files\lfds700_hash_addonly + + + Source Files\lfds700_list_addonly_ordered_singlylinked + + + Source Files\lfds700_list_addonly_ordered_singlylinked + + + Source Files\lfds700_list_addonly_ordered_singlylinked + + + Source Files\lfds700_list_addonly_ordered_singlylinked + + + Source Files\lfds700_list_addonly_ordered_singlylinked + + + Source Files\lfds700_btree_addonly_unbalanced + + + Source Files\lfds700_btree_addonly_unbalanced + + + Source Files\lfds700_btree_addonly_unbalanced + + + Source Files\lfds700_btree_addonly_unbalanced + + + Source Files\lfds700_btree_addonly_unbalanced + + + Source Files\lfds700_misc + + + Source Files\lfds700_misc + + + Source Files\lfds700_misc + + + Source Files\lfds700_misc + + + Source Files\lfds700_misc + + + Source Files\lfds700_queue_bounded_singleconsumer_singleproducer + + + Source Files\lfds700_queue_bounded_singleconsumer_singleproducer + + + Source Files\lfds700_queue_bounded_singleconsumer_singleproducer + + + Source Files\lfds700_queue_bounded_singleconsumer_singleproducer + + + Source Files\lfds700_queue_bounded_singleconsumer_singleproducer + + + Source Files\lfds700_list_addonly_singlylinked_unordered + + + Source Files\lfds700_list_addonly_singlylinked_unordered + + + Source Files\lfds700_list_addonly_singlylinked_unordered + + + Source Files\lfds700_list_addonly_singlylinked_unordered + + + Source Files\lfds700_list_addonly_singlylinked_unordered + + + Source Files\lfds700_ringbuffer + + + Source Files\lfds700_ringbuffer + + + Source Files\lfds700_ringbuffer + + + Source Files\lfds700_ringbuffer + + + Source Files\lfds700_ringbuffer + + + \ No newline at end of file diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2012_and_wdk_8.0/liblfds700.vcxproj.user b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2012_and_wdk_8.0/liblfds700.vcxproj.user new file mode 100644 index 0000000000..7cbb3216ad --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2012_and_wdk_8.0/liblfds700.vcxproj.user @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2013_and_wdk_8.1/driver_entry.c b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2013_and_wdk_8.1/driver_entry.c new file mode 100644 index 0000000000..9ea5612e54 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2013_and_wdk_8.1/driver_entry.c @@ -0,0 +1 @@ +#include diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2013_and_wdk_8.1/liblfds700.def b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2013_and_wdk_8.1/liblfds700.def new file mode 100644 index 0000000000..583ce35dbd --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2013_and_wdk_8.1/liblfds700.def @@ -0,0 +1,69 @@ +EXPORTS + +lfds700_btree_au_init_valid_on_current_logical_core = lfds700_btree_au_init_valid_on_current_logical_core +lfds700_btree_au_cleanup = lfds700_btree_au_cleanup +lfds700_btree_au_insert = lfds700_btree_au_insert +lfds700_btree_au_get_by_absolute_position_and_then_by_relative_position = lfds700_btree_au_get_by_absolute_position_and_then_by_relative_position +lfds700_btree_au_get_by_absolute_position = lfds700_btree_au_get_by_absolute_position +lfds700_btree_au_get_by_relative_position = lfds700_btree_au_get_by_relative_position +lfds700_btree_au_get_by_key = lfds700_btree_au_get_by_key +lfds700_btree_au_query = lfds700_btree_au_query + +lfds700_freelist_init_valid_on_current_logical_core = lfds700_freelist_init_valid_on_current_logical_core +lfds700_freelist_cleanup = lfds700_freelist_cleanup +lfds700_freelist_push = lfds700_freelist_push +lfds700_freelist_pop = lfds700_freelist_pop +lfds700_freelist_query = lfds700_freelist_query + +lfds700_hash_a_init_valid_on_current_logical_core = lfds700_hash_a_init_valid_on_current_logical_core +lfds700_hash_a_cleanup = lfds700_hash_a_cleanup +lfds700_hash_a_insert = lfds700_hash_a_insert +lfds700_hash_a_get_by_key = lfds700_hash_a_get_by_key +lfds700_hash_a_iterate_init = lfds700_hash_a_iterate_init +lfds700_hash_a_iterate = lfds700_hash_a_iterate +lfds700_hash_a_query = lfds700_hash_a_query + +lfds700_list_aos_init_valid_on_current_logical_core = lfds700_list_aos_init_valid_on_current_logical_core +lfds700_list_aos_cleanup = lfds700_list_aos_cleanup +lfds700_list_aos_insert = lfds700_list_aos_insert +lfds700_list_aos_get_by_key = lfds700_list_aos_get_by_key +lfds700_list_aos_query = lfds700_list_aos_query + +lfds700_list_asu_init_valid_on_current_logical_core = lfds700_list_asu_init_valid_on_current_logical_core +lfds700_list_asu_cleanup = lfds700_list_asu_cleanup +lfds700_list_asu_insert_at_position = lfds700_list_asu_insert_at_position +lfds700_list_asu_insert_at_start = lfds700_list_asu_insert_at_start +lfds700_list_asu_insert_at_end = lfds700_list_asu_insert_at_end +lfds700_list_asu_insert_after_element = lfds700_list_asu_insert_after_element +lfds700_list_asu_get_by_key = lfds700_list_asu_get_by_key +lfds700_list_asu_query = lfds700_list_asu_query + +lfds700_misc_library_init_valid_on_current_logical_core = lfds700_misc_library_init_valid_on_current_logical_core +lfds700_misc_library_cleanup = lfds700_misc_library_cleanup +lfds700_misc_prng_init = lfds700_misc_prng_init +lfds700_misc_query = lfds700_misc_query + +lfds700_queue_init_valid_on_current_logical_core = lfds700_queue_init_valid_on_current_logical_core +lfds700_queue_cleanup = lfds700_queue_cleanup +lfds700_queue_enqueue = lfds700_queue_enqueue +lfds700_queue_dequeue = lfds700_queue_dequeue +lfds700_queue_query = lfds700_queue_query + +lfds700_queue_bss_init_valid_on_current_logical_core = lfds700_queue_bss_init_valid_on_current_logical_core +lfds700_queue_bss_cleanup = lfds700_queue_bss_cleanup +lfds700_queue_bss_enqueue = lfds700_queue_bss_enqueue +lfds700_queue_bss_dequeue = lfds700_queue_bss_dequeue +lfds700_queue_bss_query = lfds700_queue_bss_query + +lfds700_ringbuffer_init_valid_on_current_logical_core = lfds700_ringbuffer_init_valid_on_current_logical_core +lfds700_ringbuffer_cleanup = lfds700_ringbuffer_cleanup +lfds700_ringbuffer_read = lfds700_ringbuffer_read +lfds700_ringbuffer_write = lfds700_ringbuffer_write +lfds700_ringbuffer_query = lfds700_ringbuffer_query + +lfds700_stack_init_valid_on_current_logical_core = lfds700_stack_init_valid_on_current_logical_core +lfds700_stack_cleanup = lfds700_stack_cleanup +lfds700_stack_push = lfds700_stack_push +lfds700_stack_pop = lfds700_stack_pop +lfds700_stack_query = lfds700_stack_query + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2013_and_wdk_8.1/liblfds700.sln b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2013_and_wdk_8.1/liblfds700.sln new file mode 100644 index 0000000000..1cc19a8e23 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2013_and_wdk_8.1/liblfds700.sln @@ -0,0 +1,59 @@ +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2013 +VisualStudioVersion = 12.0.40629.0 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "liblfds700", "liblfds700.vcxproj", "{1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug DLL|ARM = Debug DLL|ARM + Debug DLL|Win32 = Debug DLL|Win32 + Debug DLL|x64 = Debug DLL|x64 + Debug LIB|ARM = Debug LIB|ARM + Debug LIB|Win32 = Debug LIB|Win32 + Debug LIB|x64 = Debug LIB|x64 + Release DLL|ARM = Release DLL|ARM + Release DLL|Win32 = Release DLL|Win32 + Release DLL|x64 = Release DLL|x64 + Release LIB|ARM = Release LIB|ARM + Release LIB|Win32 = Release LIB|Win32 + Release LIB|x64 = Release LIB|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Debug DLL|ARM.ActiveCfg = Debug DLL|ARM + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Debug DLL|ARM.Build.0 = Debug DLL|ARM + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Debug DLL|Win32.ActiveCfg = Debug DLL|Win32 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Debug DLL|Win32.Build.0 = Debug DLL|Win32 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Debug DLL|Win32.Deploy.0 = Debug DLL|Win32 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Debug DLL|x64.ActiveCfg = Debug DLL|x64 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Debug DLL|x64.Build.0 = Debug DLL|x64 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Debug DLL|x64.Deploy.0 = Debug DLL|x64 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Debug LIB|ARM.ActiveCfg = Debug LIB|ARM + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Debug LIB|ARM.Build.0 = Debug LIB|ARM + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Debug LIB|Win32.ActiveCfg = Debug LIB|Win32 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Debug LIB|Win32.Build.0 = Debug LIB|Win32 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Debug LIB|Win32.Deploy.0 = Debug LIB|Win32 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Debug LIB|x64.ActiveCfg = Debug LIB|x64 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Debug LIB|x64.Build.0 = Debug LIB|x64 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Debug LIB|x64.Deploy.0 = Debug LIB|x64 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Release DLL|ARM.ActiveCfg = Release DLL|ARM + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Release DLL|ARM.Build.0 = Release DLL|ARM + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Release DLL|Win32.ActiveCfg = Release DLL|Win32 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Release DLL|Win32.Build.0 = Release DLL|Win32 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Release DLL|Win32.Deploy.0 = Release DLL|Win32 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Release DLL|x64.ActiveCfg = Release DLL|x64 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Release DLL|x64.Build.0 = Release DLL|x64 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Release DLL|x64.Deploy.0 = Release DLL|x64 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Release LIB|ARM.ActiveCfg = Release LIB|ARM + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Release LIB|ARM.Build.0 = Release LIB|ARM + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Release LIB|Win32.ActiveCfg = Release LIB|Win32 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Release LIB|Win32.Build.0 = Release LIB|Win32 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Release LIB|Win32.Deploy.0 = Release LIB|Win32 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Release LIB|x64.ActiveCfg = Release LIB|x64 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Release LIB|x64.Build.0 = Release LIB|x64 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Release LIB|x64.Deploy.0 = Release LIB|x64 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2013_and_wdk_8.1/liblfds700.vcxproj b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2013_and_wdk_8.1/liblfds700.vcxproj new file mode 100644 index 0000000000..e67a540e37 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2013_and_wdk_8.1/liblfds700.vcxproj @@ -0,0 +1,1054 @@ + + + + + Debug DLL + ARM + + + Debug DLL + Win32 + + + Debug DLL + x64 + + + Debug LIB + ARM + + + Debug LIB + Win32 + + + Debug LIB + x64 + + + Release DLL + ARM + + + Release DLL + Win32 + + + Release DLL + x64 + + + Release LIB + ARM + + + Release LIB + Win32 + + + Release LIB + x64 + + + + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0} + Win32Proj + + + + StaticLibrary + true + WindowsKernelModeDriver8.1 + + + StaticLibrary + true + WindowsKernelModeDriver8.1 + + + DynamicLibrary + true + WindowsKernelModeDriver8.1 + + + DynamicLibrary + true + WindowsKernelModeDriver8.1 + + + StaticLibrary + true + WindowsKernelModeDriver8.1 + + + DynamicLibrary + true + WindowsKernelModeDriver8.1 + + + StaticLibrary + false + WindowsKernelModeDriver8.1 + true + + + StaticLibrary + false + WindowsKernelModeDriver8.1 + true + + + DynamicLibrary + false + WindowsKernelModeDriver8.1 + true + + + DynamicLibrary + false + WindowsKernelModeDriver8.1 + true + + + StaticLibrary + false + WindowsKernelModeDriver8.1 + true + + + DynamicLibrary + false + WindowsKernelModeDriver8.1 + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + $(ProjectDir)..\..\bin\$(Platform) $(Configuration)\ + $(ProjectDir)..\..\obj\$(Platform) $(Configuration)\ + $(ProjectDir);$(IncludePath);$(WDKContentRoot)include\km\;$(WDKContentRoot)include\wdf\kmdf\1.11\ + $(VCInstallDir)lib;$(VCInstallDir)atlmfc\lib;$(WindowsSDK_LibraryPath_x86);$(WDKContentRoot)lib\wdf\kmdf\x86\ + + + true + $(ProjectDir)..\..\bin\$(Platform) $(Configuration)\ + $(ProjectDir)..\..\obj\$(Platform) $(Configuration)\ + $(ProjectDir);$(IncludePath) + $(WDKContentRoot)lib\$(DDKSpec)\KM\$(DDKPlatform);$(LibraryPath) + + + + + $(ProjectDir)..\..\bin\$(Platform) $(Configuration)\ + $(ProjectDir)..\..\obj\$(Platform) $(Configuration)\ + $(ProjectDir);$(IncludePath);$(WDKContentRoot)include\km\;$(WDKContentRoot)include\wdf\kmdf\1.11\ + $(VCInstallDir)lib;$(VCInstallDir)atlmfc\lib;$(WindowsSDK_LibraryPath_x86);$(WDKContentRoot)lib\wdf\kmdf\x86\ + + + + $(ProjectDir)..\..\bin\$(Platform) $(Configuration)\ + $(ProjectDir)..\..\obj\$(Platform) $(Configuration)\ + $(ProjectDir);$(IncludePath) + $(WDKContentRoot)lib\$(DDKSpec)\KM\$(DDKPlatform);$(LibraryPath) + $(VC_IncludePath);$(WindowsSDK_IncludePath);$(MSBuildToolsPath);$(MSBuildFrameworkToolsPath);$(MSBuild_ExecutablePath);$(VC_LibraryPath_ARM); + + + true + $(ProjectDir)..\..\bin\$(Platform) $(Configuration)\ + $(ProjectDir)..\..\obj\$(Platform) $(Configuration)\ + $(ProjectDir);$(IncludePath);$(WDKContentRoot)include\km\;$(WDKContentRoot)include\wdf\kmdf\1.11\ + $(VCInstallDir)lib\amd64;$(VCInstallDir)atlmfc\lib\amd64;$(WindowsSDK_LibraryPath_x64);;$(WDKContentRoot)lib\wdf\kmdf\x64\ + + + + + $(ProjectDir)..\..\bin\$(Platform) $(Configuration)\ + $(ProjectDir)..\..\obj\$(Platform) $(Configuration)\ + $(ProjectDir);$(IncludePath);$(WDKContentRoot)include\km\;$(WDKContentRoot)include\wdf\kmdf\1.11\ + $(VCInstallDir)lib\amd64;$(VCInstallDir)atlmfc\lib\amd64;$(WindowsSDK_LibraryPath_x64);;$(WDKContentRoot)lib\wdf\kmdf\x64\ + + + true + $(ProjectDir)..\..\bin\$(Platform) $(Configuration)\ + $(ProjectDir)..\..\obj\$(Platform) $(Configuration)\ + $(ProjectDir);$(IncludePath);$(WDKContentRoot)include\km\;$(WDKContentRoot)include\wdf\kmdf\1.11\ + $(VCInstallDir)lib;$(VCInstallDir)atlmfc\lib;$(WindowsSDK_LibraryPath_x86);$(WDKContentRoot)lib\wdf\kmdf\x86\ + + + true + $(ProjectDir)..\..\bin\$(Platform) $(Configuration)\ + $(ProjectDir)..\..\obj\$(Platform) $(Configuration)\ + $(ProjectDir);$(IncludePath) + $(WDKContentRoot)lib\$(DDKSpec)\KM\$(DDKPlatform);$(LibraryPath) + + + + + $(ProjectDir)..\..\bin\$(Platform) $(Configuration)\ + $(ProjectDir)..\..\obj\$(Platform) $(Configuration)\ + $(ProjectDir);$(IncludePath);$(WDKContentRoot)include\km\;$(WDKContentRoot)include\wdf\kmdf\1.11\ + $(VCInstallDir)lib;$(VCInstallDir)atlmfc\lib;$(WindowsSDK_LibraryPath_x86);$(WDKContentRoot)lib\wdf\kmdf\x86\ + + + + $(ProjectDir)..\..\bin\$(Platform) $(Configuration)\ + $(ProjectDir)..\..\obj\$(Platform) $(Configuration)\ + $(ProjectDir);$(IncludePath) + $(WDKContentRoot)lib\$(DDKSpec)\KM\$(DDKPlatform);$(LibraryPath) + + + true + $(ProjectDir)..\..\bin\$(Platform) $(Configuration)\ + $(ProjectDir)..\..\obj\$(Platform) $(Configuration)\ + $(ProjectDir);$(IncludePath);$(WDKContentRoot)include\km\;$(WDKContentRoot)include\wdf\kmdf\1.11\ + $(VCInstallDir)lib\amd64;$(VCInstallDir)atlmfc\lib\amd64;$(WindowsSDK_LibraryPath_x64);;$(WDKContentRoot)lib\wdf\kmdf\x64\ + + + + + $(ProjectDir)..\..\bin\$(Platform) $(Configuration)\ + $(ProjectDir)..\..\obj\$(Platform) $(Configuration)\ + $(ProjectDir);$(IncludePath);$(WDKContentRoot)include\km\;$(WDKContentRoot)include\wdf\kmdf\1.11\ + $(VCInstallDir)lib\amd64;$(VCInstallDir)atlmfc\lib\amd64;$(WindowsSDK_LibraryPath_x64);;$(WDKContentRoot)lib\wdf\kmdf\x64\ + + + + WIN32;_DEBUG;_LIB;LFDS700_BUILD_TYPE_STRING="Debug";%(PreprocessorDefinitions) + + + MultiThreadedDebug + Level4 + ProgramDatabase + Disabled + false + false + true + true + true + true + false + true + + + + + + + true + false + false + false + true + CompileAsC + true + None + true + false + 4068 + /kernel %(AdditionalOptions) + + + MachineX86 + true + Windows + + + true + + + MachineX86 + + + Native + + + false + true + + + + + WIN32;_DEBUG;_LIB;LFDS700_BUILD_TYPE_STRING="Debug";%(PreprocessorDefinitions) + + + MultiThreadedDebug + Level4 + ProgramDatabase + Disabled + false + false + true + true + true + true + false + true + + + + + + + true + false + false + false + true + CompileAsC + true + None + true + false + 4068 + /kernel %(AdditionalOptions) + + + true + Windows + + + true + + + MachineARM + + + Native + + + false + true + + + + + WIN32;_DEBUG;_LIB;LFDS700_BUILD_TYPE_STRING="Debug";%(PreprocessorDefinitions) + + + MultiThreadedDebug + Level4 + ProgramDatabase + Disabled + false + false + true + true + true + true + false + true + + + + + + + true + false + false + false + true + CompileAsC + true + None + true + false + 4068 + /kernel %(AdditionalOptions) + + + MachineX86 + true + Native + kernel32.lib;msvcrtd.lib + + + true + true + liblfds700.def + true + NoErrorReport + true + WDM + + + true + + + MachineX86 + + + Console + + + false + true + + + true + + + + + WIN32;_DEBUG;_LIB;LFDS700_BUILD_TYPE_STRING="Debug";%(PreprocessorDefinitions) + + + MultiThreadedDebug + Level4 + ProgramDatabase + Disabled + false + false + true + true + true + true + false + true + + + + + + + true + false + false + false + true + CompileAsC + true + None + true + false + 4068 + /kernel %(AdditionalOptions) + + + true + Native + kernel32.lib;msvcrtd.lib + + + true + true + liblfds700.def + true + NoErrorReport + true + WDM + + + + true + + + MachineX86 + + + Console + + + false + true + + + true + + + + + WIN32;_DEBUG;_LIB;LFDS700_BUILD_TYPE_STRING="Debug";%(PreprocessorDefinitions) + + + MultiThreadedDebug + Level4 + ProgramDatabase + Disabled + false + false + true + true + true + true + false + true + + + + + + + true + false + false + false + true + CompileAsC + true + None + true + false + 4068 + false + /kernel %(AdditionalOptions) + + + true + Windows + + + true + + + MachineX64 + + + Native + + + false + true + + + + + WIN32;_DEBUG;_LIB;LFDS700_BUILD_TYPE_STRING="Debug";%(PreprocessorDefinitions) + + + MultiThreadedDebug + Level4 + ProgramDatabase + Disabled + false + false + true + true + true + true + false + true + + + + + + + true + false + false + false + true + CompileAsC + true + None + true + false + 4068 + false + /kernel %(AdditionalOptions) + + + true + Native + true + true + liblfds700.def + true + false + NoErrorReport + kernel32.lib;msvcrtd.lib + true + WDM + + + true + + + MachineX64 + + + Console + + + false + true + + + + + WIN32;NDEBUG;_LIB;LFDS700_BUILD_TYPE_STRING="Release";%(PreprocessorDefinitions) + + + MultiThreaded + Level4 + None + false + false + true + true + AnySuitable + true + Speed + true + false + false + + + + + + + false + + + false + false + CompileAsC + true + None + true + 4068 + true + /kernel %(AdditionalOptions) + + + MachineX86 + true + Windows + true + true + + + true + + + MachineX86 + + + Native + true + + + + + WIN32;NDEBUG;_LIB;LFDS700_BUILD_TYPE_STRING="Release";%(PreprocessorDefinitions) + + + MultiThreaded + Level4 + None + false + false + true + true + AnySuitable + true + Speed + true + false + false + + + + + + + false + + + false + false + CompileAsC + true + None + true + 4068 + true + /kernel %(AdditionalOptions) + + + true + Windows + true + true + + + true + + + MachineARM + + + Native + true + + + + + WIN32;NDEBUG;_LIB;LFDS700_BUILD_TYPE_STRING="Release";%(PreprocessorDefinitions) + + + MultiThreadedDLL + Level4 + None + false + false + true + true + AnySuitable + true + Speed + true + false + false + + + + + + + false + + + false + false + CompileAsC + true + None + true + 4068 + true + /kernel %(AdditionalOptions) + + + MachineX86 + false + Native + true + true + kernel32.lib;msvcrt.lib + + + true + true + liblfds700.def + NoErrorReport + WDM + + + true + + + MachineX86 + + + Console + true + + + true + + + + + WIN32;NDEBUG;_LIB;LFDS700_BUILD_TYPE_STRING="Release";%(PreprocessorDefinitions) + + + MultiThreadedDLL + Level4 + None + false + false + true + true + AnySuitable + true + Speed + true + false + false + + + + + + + false + + + false + false + CompileAsC + true + None + true + 4068 + true + /kernel %(AdditionalOptions) + + + false + Native + true + true + kernel32.lib;msvcrt.lib + + + true + true + liblfds700.def + NoErrorReport + WDM + + + + true + + + MachineX86 + + + Console + true + + + true + + + + + WIN32;NDEBUG;_LIB;LFDS700_BUILD_TYPE_STRING="Release";%(PreprocessorDefinitions) + + + MultiThreaded + Level4 + None + false + false + true + true + AnySuitable + true + Speed + true + false + false + + + + + + + false + + + false + false + CompileAsC + true + None + true + 4068 + true + /kernel %(AdditionalOptions) + + + true + Windows + true + true + + + true + + + MachineX64 + + + Native + true + + + + + WIN32;NDEBUG;_LIB;LFDS700_BUILD_TYPE_STRING="Release";%(PreprocessorDefinitions) + + + MultiThreadedDLL + Level4 + None + false + false + true + true + AnySuitable + true + Speed + true + false + false + + + + + + + false + + + false + false + CompileAsC + true + None + true + 4068 + true + /kernel %(AdditionalOptions) + + + false + Native + true + true + true + true + liblfds700.def + NoErrorReport + kernel32.lib;msvcrt.lib + WDM + + + true + + + MachineX64 + + + Console + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2013_and_wdk_8.1/liblfds700.vcxproj.filters b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2013_and_wdk_8.1/liblfds700.vcxproj.filters new file mode 100644 index 0000000000..978f8ec1c9 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2013_and_wdk_8.1/liblfds700.vcxproj.filters @@ -0,0 +1,279 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav + + + {258be429-7dac-4999-b995-753aa2f0c505} + + + {469abf8e-47d8-4678-bd66-7c7e65c5f52e} + + + {62ee141b-2acb-4555-b016-7be20a57f2bf} + + + {19c73b0f-25e0-4166-9093-427f1dfb4f70} + + + {00eb30fe-e638-4c2b-8ca1-1f09c4a0ed45} + + + {6250c4d5-ac8e-4c28-93de-0954c5bed1cb} + + + {400ae4e9-2281-4549-b918-59d1a27a2d07} + + + {c45194af-7b41-4c28-bc0e-1095ec347664} + + + {8b3cbb5c-7436-429f-9b72-bae1f4721746} + + + {bcbadc74-1748-4696-aad7-7fdbe5614624} + + + {0b1fafc3-817b-4c18-8eb1-121884e3a29b} + + + + + Header Files + + + Source Files\lfds700_freelist + + + Source Files\lfds700_stack + + + Source Files\lfds700_queue + + + Header Files\liblfds700 + + + Header Files\liblfds700 + + + Header Files\liblfds700 + + + Header Files\liblfds700 + + + Header Files\liblfds700 + + + Header Files\liblfds700 + + + Header Files\liblfds700 + + + Header Files\liblfds700 + + + Header Files\liblfds700 + + + Header Files\liblfds700 + + + Header Files\liblfds700 + + + Header Files\liblfds700 + + + Header Files\liblfds700 + + + Source Files\lfds700_hash_addonly + + + Source Files\lfds700_list_addonly_ordered_singlylinked + + + Source Files\lfds700_btree_addonly_unbalanced + + + Source Files\lfds700_misc + + + Source Files\lfds700_queue_bounded_singleconsumer_singleproducer + + + Source Files\lfds700_list_addonly_singlylinked_unordered + + + Source Files\lfds700_ringbuffer + + + + + Source Files\lfds700_freelist + + + Source Files\lfds700_freelist + + + Source Files\lfds700_freelist + + + Source Files\lfds700_freelist + + + Source Files\lfds700_freelist + + + Source Files\lfds700_stack + + + Source Files\lfds700_stack + + + Source Files\lfds700_stack + + + Source Files\lfds700_stack + + + Source Files\lfds700_stack + + + Source Files\lfds700_queue + + + Source Files\lfds700_queue + + + Source Files\lfds700_queue + + + Source Files\lfds700_queue + + + Source Files\lfds700_queue + + + Source Files\lfds700_hash_addonly + + + Source Files\lfds700_hash_addonly + + + Source Files\lfds700_hash_addonly + + + Source Files\lfds700_hash_addonly + + + Source Files\lfds700_hash_addonly + + + Source Files\lfds700_hash_addonly + + + Source Files\lfds700_list_addonly_ordered_singlylinked + + + Source Files\lfds700_list_addonly_ordered_singlylinked + + + Source Files\lfds700_list_addonly_ordered_singlylinked + + + Source Files\lfds700_list_addonly_ordered_singlylinked + + + Source Files\lfds700_list_addonly_ordered_singlylinked + + + Source Files\lfds700_btree_addonly_unbalanced + + + Source Files\lfds700_btree_addonly_unbalanced + + + Source Files\lfds700_btree_addonly_unbalanced + + + Source Files\lfds700_btree_addonly_unbalanced + + + Source Files\lfds700_btree_addonly_unbalanced + + + Source Files\lfds700_misc + + + Source Files\lfds700_misc + + + Source Files\lfds700_misc + + + Source Files\lfds700_misc + + + Source Files\lfds700_misc + + + Source Files\lfds700_queue_bounded_singleconsumer_singleproducer + + + Source Files\lfds700_queue_bounded_singleconsumer_singleproducer + + + Source Files\lfds700_queue_bounded_singleconsumer_singleproducer + + + Source Files\lfds700_queue_bounded_singleconsumer_singleproducer + + + Source Files\lfds700_queue_bounded_singleconsumer_singleproducer + + + Source Files\lfds700_list_addonly_singlylinked_unordered + + + Source Files\lfds700_list_addonly_singlylinked_unordered + + + Source Files\lfds700_list_addonly_singlylinked_unordered + + + Source Files\lfds700_list_addonly_singlylinked_unordered + + + Source Files\lfds700_list_addonly_singlylinked_unordered + + + Source Files\lfds700_ringbuffer + + + Source Files\lfds700_ringbuffer + + + Source Files\lfds700_ringbuffer + + + Source Files\lfds700_ringbuffer + + + Source Files\lfds700_ringbuffer + + + \ No newline at end of file diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2013_and_wdk_8.1/liblfds700.vcxproj.user b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2013_and_wdk_8.1/liblfds700.vcxproj.user new file mode 100644 index 0000000000..7cbb3216ad --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/visual_studio_professional_2013_and_wdk_8.1/liblfds700.vcxproj.user @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/wdk_7.1/dirs b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/wdk_7.1/dirs new file mode 100644 index 0000000000..64e002cc57 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/wdk_7.1/dirs @@ -0,0 +1,3 @@ +DIRS = single_dir_for_windows_kernel + + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/wdk_7.1/driver_entry_renamed_to_avoid_compiler_warning.c b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/wdk_7.1/driver_entry_renamed_to_avoid_compiler_warning.c new file mode 100644 index 0000000000..09d7acb7fc --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/wdk_7.1/driver_entry_renamed_to_avoid_compiler_warning.c @@ -0,0 +1,23 @@ +#include "liblfds700_internal.h" + + + + + +/****************************************************************************/ +DRIVER_INITIALIZE DriverEntry; + + + + + +/****************************************************************************/ +#pragma warning( disable : 4100 ) + +NTSTATUS DriverEntry( struct _DRIVER_OBJECT *DriverObject, PUNICODE_STRING RegistryPath ) +{ + return( STATUS_SUCCESS ); +} + +#pragma warning( default : 4100 ) + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/wdk_7.1/liblfds700.def b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/wdk_7.1/liblfds700.def new file mode 100644 index 0000000000..583ce35dbd --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/wdk_7.1/liblfds700.def @@ -0,0 +1,69 @@ +EXPORTS + +lfds700_btree_au_init_valid_on_current_logical_core = lfds700_btree_au_init_valid_on_current_logical_core +lfds700_btree_au_cleanup = lfds700_btree_au_cleanup +lfds700_btree_au_insert = lfds700_btree_au_insert +lfds700_btree_au_get_by_absolute_position_and_then_by_relative_position = lfds700_btree_au_get_by_absolute_position_and_then_by_relative_position +lfds700_btree_au_get_by_absolute_position = lfds700_btree_au_get_by_absolute_position +lfds700_btree_au_get_by_relative_position = lfds700_btree_au_get_by_relative_position +lfds700_btree_au_get_by_key = lfds700_btree_au_get_by_key +lfds700_btree_au_query = lfds700_btree_au_query + +lfds700_freelist_init_valid_on_current_logical_core = lfds700_freelist_init_valid_on_current_logical_core +lfds700_freelist_cleanup = lfds700_freelist_cleanup +lfds700_freelist_push = lfds700_freelist_push +lfds700_freelist_pop = lfds700_freelist_pop +lfds700_freelist_query = lfds700_freelist_query + +lfds700_hash_a_init_valid_on_current_logical_core = lfds700_hash_a_init_valid_on_current_logical_core +lfds700_hash_a_cleanup = lfds700_hash_a_cleanup +lfds700_hash_a_insert = lfds700_hash_a_insert +lfds700_hash_a_get_by_key = lfds700_hash_a_get_by_key +lfds700_hash_a_iterate_init = lfds700_hash_a_iterate_init +lfds700_hash_a_iterate = lfds700_hash_a_iterate +lfds700_hash_a_query = lfds700_hash_a_query + +lfds700_list_aos_init_valid_on_current_logical_core = lfds700_list_aos_init_valid_on_current_logical_core +lfds700_list_aos_cleanup = lfds700_list_aos_cleanup +lfds700_list_aos_insert = lfds700_list_aos_insert +lfds700_list_aos_get_by_key = lfds700_list_aos_get_by_key +lfds700_list_aos_query = lfds700_list_aos_query + +lfds700_list_asu_init_valid_on_current_logical_core = lfds700_list_asu_init_valid_on_current_logical_core +lfds700_list_asu_cleanup = lfds700_list_asu_cleanup +lfds700_list_asu_insert_at_position = lfds700_list_asu_insert_at_position +lfds700_list_asu_insert_at_start = lfds700_list_asu_insert_at_start +lfds700_list_asu_insert_at_end = lfds700_list_asu_insert_at_end +lfds700_list_asu_insert_after_element = lfds700_list_asu_insert_after_element +lfds700_list_asu_get_by_key = lfds700_list_asu_get_by_key +lfds700_list_asu_query = lfds700_list_asu_query + +lfds700_misc_library_init_valid_on_current_logical_core = lfds700_misc_library_init_valid_on_current_logical_core +lfds700_misc_library_cleanup = lfds700_misc_library_cleanup +lfds700_misc_prng_init = lfds700_misc_prng_init +lfds700_misc_query = lfds700_misc_query + +lfds700_queue_init_valid_on_current_logical_core = lfds700_queue_init_valid_on_current_logical_core +lfds700_queue_cleanup = lfds700_queue_cleanup +lfds700_queue_enqueue = lfds700_queue_enqueue +lfds700_queue_dequeue = lfds700_queue_dequeue +lfds700_queue_query = lfds700_queue_query + +lfds700_queue_bss_init_valid_on_current_logical_core = lfds700_queue_bss_init_valid_on_current_logical_core +lfds700_queue_bss_cleanup = lfds700_queue_bss_cleanup +lfds700_queue_bss_enqueue = lfds700_queue_bss_enqueue +lfds700_queue_bss_dequeue = lfds700_queue_bss_dequeue +lfds700_queue_bss_query = lfds700_queue_bss_query + +lfds700_ringbuffer_init_valid_on_current_logical_core = lfds700_ringbuffer_init_valid_on_current_logical_core +lfds700_ringbuffer_cleanup = lfds700_ringbuffer_cleanup +lfds700_ringbuffer_read = lfds700_ringbuffer_read +lfds700_ringbuffer_write = lfds700_ringbuffer_write +lfds700_ringbuffer_query = lfds700_ringbuffer_query + +lfds700_stack_init_valid_on_current_logical_core = lfds700_stack_init_valid_on_current_logical_core +lfds700_stack_cleanup = lfds700_stack_cleanup +lfds700_stack_push = lfds700_stack_push +lfds700_stack_pop = lfds700_stack_pop +lfds700_stack_query = lfds700_stack_query + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/wdk_7.1/readme_before_win_kernel_build.txt b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/wdk_7.1/readme_before_win_kernel_build.txt new file mode 100644 index 0000000000..1481c8d08a --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/wdk_7.1/readme_before_win_kernel_build.txt @@ -0,0 +1,32 @@ +The Windows kernel build environment is primitive and has a number +of severe limitations; in particular, all source files must be in +one directory and it is not possible to choose the output binary type +(static or dynamic library) from the build command line; rather, +a string has to be modified in a text file used by the build (!) + +To deal with these limitations, it is necessary for a Windows kernel +build to run a batch file prior to building. + +There are two batch files, one for static library builds and the other +for dynamic library builds. + +They are both idempotent; you can run them as often as you like and +switch between them as often as you want. It's all fine; whenever +you run one of them, it will take you from whatever state you were +previously in, into the state you want to be in. + +Both batch files copy all the sources file into a single directory, +"/src/single_dir_for_windows_kernel/". + +The static library batch file will then copy "/sources.static" into +"/src/single_dir_for_windows_kernel/", which will cause a static +library to be built. + +The dynamic library batch file will then copy "/sources.dynamic" into +"/src/single_dir_for_windows_kernel/", which will cause a dynamic +library to be built. It will also copy "src/driver_entry.c" into +"/src/single_dir_for_windows_kernel/", since the linker requires +the DriverEntry function to exist for dynamic libraries, even +though it's not used. + + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/wdk_7.1/runme_before_win_kernel_dynamic_lib_build.bat b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/wdk_7.1/runme_before_win_kernel_dynamic_lib_build.bat new file mode 100644 index 0000000000..ff6fc8a1f3 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/wdk_7.1/runme_before_win_kernel_dynamic_lib_build.bat @@ -0,0 +1,22 @@ +@echo off +rmdir /q /s single_dir_for_windows_kernel 1>nul 2>nul +mkdir single_dir_for_windows_kernel 1>nul 2>nul + +copy /y ..\..\src\lfds700_btree_addonly_unbalanced\* single_dir_for_windows_kernel\ 1>nul 2>nul +copy /y ..\..\src\lfds700_freelist\* single_dir_for_windows_kernel\ 1>nul 2>nul +copy /y ..\..\src\lfds700_hash_addonly\* single_dir_for_windows_kernel\ 1>nul 2>nul +copy /y ..\..\src\lfds700_list_addonly_ordered_singlylinked\* single_dir_for_windows_kernel\ 1>nul 2>nul +copy /y ..\..\src\lfds700_list_addonly_singlylinked_unordered\* single_dir_for_windows_kernel\ 1>nul 2>nul +copy /y ..\..\src\lfds700_misc\* single_dir_for_windows_kernel\ 1>nul 2>nul +copy /y ..\..\src\lfds700_queue\* single_dir_for_windows_kernel\ 1>nul 2>nul +copy /y ..\..\src\lfds700_queue_bounded_singleconsumer_singleproducer\* single_dir_for_windows_kernel\ 1>nul 2>nul +copy /y ..\..\src\lfds700_ringbuffer\* single_dir_for_windows_kernel\ 1>nul 2>nul +copy /y ..\..\src\lfds700_stack\* single_dir_for_windows_kernel\ 1>nul 2>nul + +copy /y ..\..\src\liblfds700_internal.h single_dir_for_windows_kernel\ 1>nul 2>nul +copy /y driver_entry_renamed_to_avoid_compiler_warning.c single_dir_for_windows_kernel\driver_entry.c 1>nul 2>nul +copy /y sources.dynamic single_dir_for_windows_kernel\sources 1>nul 2>nul + +echo Windows kernel dynamic library build directory structure created. +echo (Note the effects of this batch file are idempotent). + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/wdk_7.1/runme_before_win_kernel_static_lib_build.bat b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/wdk_7.1/runme_before_win_kernel_static_lib_build.bat new file mode 100644 index 0000000000..81c35e99c8 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/wdk_7.1/runme_before_win_kernel_static_lib_build.bat @@ -0,0 +1,21 @@ +@echo off +rmdir /q /s single_dir_for_windows_kernel 1>nul 2>nul +mkdir single_dir_for_windows_kernel 1>nul 2>nul + +copy /y ..\..\src\lfds700_btree_addonly_unbalanced\* single_dir_for_windows_kernel\ 1>nul 2>nul +copy /y ..\..\src\lfds700_freelist\* single_dir_for_windows_kernel\ 1>nul 2>nul +copy /y ..\..\src\lfds700_hash_addonly\* single_dir_for_windows_kernel\ 1>nul 2>nul +copy /y ..\..\src\lfds700_list_addonly_ordered_singlylinked\* single_dir_for_windows_kernel\ 1>nul 2>nul +copy /y ..\..\src\lfds700_list_addonly_singlylinked_unordered\* single_dir_for_windows_kernel\ 1>nul 2>nul +copy /y ..\..\src\lfds700_misc\* single_dir_for_windows_kernel\ 1>nul 2>nul +copy /y ..\..\src\lfds700_queue\* single_dir_for_windows_kernel\ 1>nul 2>nul +copy /y ..\..\src\lfds700_queue_bounded_singleconsumer_singleproducer\* single_dir_for_windows_kernel\ 1>nul 2>nul +copy /y ..\..\src\lfds700_ringbuffer\* single_dir_for_windows_kernel\ 1>nul 2>nul +copy /y ..\..\src\lfds700_stack\* single_dir_for_windows_kernel\ 1>nul 2>nul + +copy /y ..\..\src\liblfds700_internal.h single_dir_for_windows_kernel\ 1>nul 2>nul +copy /y sources.static single_dir_for_windows_kernel\sources 1>nul 2>nul + +echo Windows kernel static library build directory structure created. +echo (Note the effects of this batch file are idempotent). + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/wdk_7.1/sources.dynamic b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/wdk_7.1/sources.dynamic new file mode 100644 index 0000000000..b0d241f85f --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/wdk_7.1/sources.dynamic @@ -0,0 +1,62 @@ +MSC_WARNING_LEVEL = /WX /wd4127 /W4 +DLLDEF = ../liblfds700.def +TARGETNAME = liblfds700 +TARGETPATH = ../../../bin/ +TARGETTYPE = EXPORT_DRIVER +UMTYPE = nt +USER_C_FLAGS = /D_KERNEL_MODE + +INCLUDES = ../../../inc/ +SOURCES = lfds700_hash_addonly_cleanup.c \ + lfds700_hash_addonly_get.c \ + lfds700_hash_addonly_init.c \ + lfds700_hash_addonly_insert.c \ + lfds700_hash_addonly_iterate.c \ + lfds700_hash_addonly_query.c \ + lfds700_list_addonly_ordered_singlylinked_cleanup.c \ + lfds700_list_addonly_ordered_singlylinked_get.c \ + lfds700_list_addonly_ordered_singlylinked_init.c \ + lfds700_list_addonly_ordered_singlylinked_insert.c \ + lfds700_list_addonly_ordered_singlylinked_query.c \ + lfds700_list_addonly_singlylinked_unordered_cleanup.c \ + lfds700_list_addonly_singlylinked_unordered_get.c \ + lfds700_list_addonly_singlylinked_unordered_init.c \ + lfds700_list_addonly_singlylinked_unordered_insert.c \ + lfds700_list_addonly_singlylinked_unordered_query.c \ + lfds700_btree_addonly_unbalanced_cleanup.c \ + lfds700_btree_addonly_unbalanced_get.c \ + lfds700_btree_addonly_unbalanced_init.c \ + lfds700_btree_addonly_unbalanced_insert.c \ + lfds700_btree_addonly_unbalanced_query.c \ + lfds700_freelist_cleanup.c \ + lfds700_freelist_init.c \ + lfds700_freelist_pop.c \ + lfds700_freelist_push.c \ + lfds700_freelist_query.c \ + lfds700_misc_cleanup.c \ + lfds700_misc_globals.c \ + lfds700_misc_init.c \ + lfds700_misc_prng.c \ + lfds700_misc_query.c \ + lfds700_queue_cleanup.c \ + lfds700_queue_dequeue.c \ + lfds700_queue_enqueue.c \ + lfds700_queue_init.c \ + lfds700_queue_query.c \ + lfds700_queue_bounded_singleconsumer_singleproducer_cleanup.c \ + lfds700_queue_bounded_singleconsumer_singleproducer_dequeue.c \ + lfds700_queue_bounded_singleconsumer_singleproducer_enqueue.c \ + lfds700_queue_bounded_singleconsumer_singleproducer_init.c \ + lfds700_queue_bounded_singleconsumer_singleproducer_query.c \ + lfds700_ringbuffer_cleanup.c \ + lfds700_ringbuffer_init.c \ + lfds700_ringbuffer_query.c \ + lfds700_ringbuffer_read.c \ + lfds700_ringbuffer_write.c \ + lfds700_stack_cleanup.c \ + lfds700_stack_init.c \ + lfds700_stack_pop.c \ + lfds700_stack_push.c \ + lfds700_stack_query.c \ + driver_entry.c + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/wdk_7.1/sources.static b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/wdk_7.1/sources.static new file mode 100644 index 0000000000..401b381c7d --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/build/wdk_7.1/sources.static @@ -0,0 +1,60 @@ +MSC_WARNING_LEVEL = /WX /wd4127 /W4 +TARGETNAME = liblfds700 +TARGETPATH = ../../../bin/ +TARGETTYPE = DRIVER_LIBRARY +UMTYPE = nt +USER_C_FLAGS = /D_KERNEL_MODE + +INCLUDES = ../../../inc/ +SOURCES = lfds700_hash_addonly_cleanup.c \ + lfds700_hash_addonly_get.c \ + lfds700_hash_addonly_init.c \ + lfds700_hash_addonly_insert.c \ + lfds700_hash_addonly_iterate.c \ + lfds700_hash_addonly_query.c \ + lfds700_list_addonly_ordered_singlylinked_cleanup.c \ + lfds700_list_addonly_ordered_singlylinked_get.c \ + lfds700_list_addonly_ordered_singlylinked_init.c \ + lfds700_list_addonly_ordered_singlylinked_insert.c \ + lfds700_list_addonly_ordered_singlylinked_query.c \ + lfds700_list_addonly_singlylinked_unordered_cleanup.c \ + lfds700_list_addonly_singlylinked_unordered_get.c \ + lfds700_list_addonly_singlylinked_unordered_init.c \ + lfds700_list_addonly_singlylinked_unordered_insert.c \ + lfds700_list_addonly_singlylinked_unordered_query.c \ + lfds700_btree_addonly_unbalanced_cleanup.c \ + lfds700_btree_addonly_unbalanced_get.c \ + lfds700_btree_addonly_unbalanced_init.c \ + lfds700_btree_addonly_unbalanced_insert.c \ + lfds700_btree_addonly_unbalanced_query.c \ + lfds700_freelist_cleanup.c \ + lfds700_freelist_init.c \ + lfds700_freelist_pop.c \ + lfds700_freelist_push.c \ + lfds700_freelist_query.c \ + lfds700_misc_cleanup.c \ + lfds700_misc_globals.c \ + lfds700_misc_init.c \ + lfds700_misc_prng.c \ + lfds700_misc_query.c \ + lfds700_queue_cleanup.c \ + lfds700_queue_dequeue.c \ + lfds700_queue_enqueue.c \ + lfds700_queue_init.c \ + lfds700_queue_query.c \ + lfds700_queue_bounded_singleconsumer_singleproducer_cleanup.c \ + lfds700_queue_bounded_singleconsumer_singleproducer_dequeue.c \ + lfds700_queue_bounded_singleconsumer_singleproducer_enqueue.c \ + lfds700_queue_bounded_singleconsumer_singleproducer_init.c \ + lfds700_queue_bounded_singleconsumer_singleproducer_query.c \ + lfds700_ringbuffer_cleanup.c \ + lfds700_ringbuffer_init.c \ + lfds700_ringbuffer_query.c \ + lfds700_ringbuffer_read.c \ + lfds700_ringbuffer_write.c \ + lfds700_stack_cleanup.c \ + lfds700_stack_init.c \ + lfds700_stack_pop.c \ + lfds700_stack_push.c \ + lfds700_stack_query.c + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/inc/liblfds700.h b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/inc/liblfds700.h new file mode 100644 index 0000000000..fdda50cefb --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/inc/liblfds700.h @@ -0,0 +1,31 @@ +#ifndef LIBLFDS700_H + + /***** defines *****/ + #define LIBLFDS700_H + + /***** pragmas on *****/ + #pragma warning( disable : 4324 ) // TRD : 4324 disables MSVC warnings for structure alignment padding due to alignment specifiers + + #pragma prefast( disable : 28113 28182 28183, "blah" ) + + /***** includes *****/ + #include "liblfds700/lfds700_porting_abstraction_layer_compiler.h" + #include "liblfds700/lfds700_porting_abstraction_layer_operating_system.h" + #include "liblfds700/lfds700_porting_abstraction_layer_processor.h" + + #include "liblfds700/lfds700_misc.h" // TRD : everything after depends on misc + #include "liblfds700/lfds700_btree_addonly_unbalanced.h" // TRD : hash_addonly depends on btree_addonly_unbalanced + #include "liblfds700/lfds700_freelist.h" + #include "liblfds700/lfds700_hash_addonly.h" + #include "liblfds700/lfds700_list_addonly_ordered_singlylinked.h" + #include "liblfds700/lfds700_list_addonly_singlylinked_unordered.h" + #include "liblfds700/lfds700_queue.h" + #include "liblfds700/lfds700_queue_bounded_singleconsumer_singleproducer.h" + #include "liblfds700/lfds700_ringbuffer.h" + #include "liblfds700/lfds700_stack.h" + + /***** pragmas off *****/ + #pragma warning( default : 4324 ) + +#endif + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/inc/liblfds700/lfds700_btree_addonly_unbalanced.h b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/inc/liblfds700/lfds700_btree_addonly_unbalanced.h new file mode 100644 index 0000000000..bdc63a4273 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/inc/liblfds700/lfds700_btree_addonly_unbalanced.h @@ -0,0 +1,113 @@ +/***** defines *****/ +#define LFDS700_BTREE_AU_GET_KEY_FROM_ELEMENT( btree_au_element ) ( (btree_au_element).key ) +#define LFDS700_BTREE_AU_SET_KEY_IN_ELEMENT( btree_au_element, new_key ) ( (btree_au_element).key = (void *) (lfds700_pal_uint_t) (new_key) ) +#define LFDS700_BTREE_AU_GET_VALUE_FROM_ELEMENT( btree_au_element ) ( LFDS700_MISC_BARRIER_LOAD, (btree_au_element).value ) +#define LFDS700_BTREE_AU_SET_VALUE_IN_ELEMENT( btree_au_element, new_value ) { void *local_new_value = (void *) (lfds700_pal_uint_t) (new_value); LFDS700_PAL_ATOMIC_EXCHANGE( &(btree_au_element).value, &local_new_value ); } +#define LFDS700_BTREE_AU_GET_USER_STATE_FROM_STATE( btree_au_state ) ( (btree_au_state).user_state ) + +/***** enums *****/ +enum lfds700_btree_au_absolute_position +{ + LFDS700_BTREE_AU_ABSOLUTE_POSITION_ROOT, + LFDS700_BTREE_AU_ABSOLUTE_POSITION_SMALLEST_IN_TREE, + LFDS700_BTREE_AU_ABSOLUTE_POSITION_LARGEST_IN_TREE +}; + +enum lfds700_btree_au_existing_key +{ + LFDS700_BTREE_AU_EXISTING_KEY_OVERWRITE, + LFDS700_BTREE_AU_EXISTING_KEY_FAIL +}; + +enum lfds700_btree_au_insert_result +{ + LFDS700_BTREE_AU_INSERT_RESULT_FAILURE_EXISTING_KEY, + LFDS700_BTREE_AU_INSERT_RESULT_SUCCESS_OVERWRITE, + LFDS700_BTREE_AU_INSERT_RESULT_SUCCESS +}; + +enum lfds700_btree_au_relative_position +{ + LFDS700_BTREE_AU_RELATIVE_POSITION_UP, + LFDS700_BTREE_AU_RELATIVE_POSITION_LEFT, + LFDS700_BTREE_AU_RELATIVE_POSITION_RIGHT, + LFDS700_BTREE_AU_RELATIVE_POSITION_SMALLEST_ELEMENT_BELOW_CURRENT_ELEMENT, + LFDS700_BTREE_AU_RELATIVE_POSITION_LARGEST_ELEMENT_BELOW_CURRENT_ELEMENT, + LFDS700_BTREE_AU_RELATIVE_POSITION_NEXT_SMALLER_ELEMENT_IN_ENTIRE_TREE, + LFDS700_BTREE_AU_RELATIVE_POSITION_NEXT_LARGER_ELEMENT_IN_ENTIRE_TREE +}; + +enum lfds700_btree_au_query +{ + LFDS700_BTREE_AU_QUERY_GET_POTENTIALLY_INACCURATE_COUNT, + LFDS700_BTREE_AU_QUERY_SINGLETHREADED_VALIDATE +}; + +/***** structs *****/ +struct lfds700_btree_au_element +{ + struct lfds700_btree_au_element LFDS700_PAL_ALIGN(LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES) + *volatile left, + *volatile right, + *volatile up; + + void LFDS700_PAL_ALIGN(LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES) + *volatile value; + + void LFDS700_PAL_ALIGN(LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES) + *key; +}; + +struct lfds700_btree_au_state +{ + struct lfds700_btree_au_element LFDS700_PAL_ALIGN(LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES) + *volatile root; + + int LFDS700_PAL_ALIGN(LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES) + (*key_compare_function)( void const *new_key, void const *existing_key ); + + enum lfds700_btree_au_existing_key + existing_key; + + void + *user_state; +}; + +/***** public prototypes *****/ +void lfds700_btree_au_init_valid_on_current_logical_core( struct lfds700_btree_au_state *baus, + int (*key_compare_function)(void const *new_key, void const *existing_key), + enum lfds700_btree_au_existing_key existing_key, + void *user_state ); + // TRD : used in conjunction with the #define LFDS700_MISC_MAKE_VALID_ON_CURRENT_LOGICAL_CORE_INITS_COMPLETED_BEFORE_NOW_ON_ANY_OTHER_LOGICAL_CORE + +void lfds700_btree_au_cleanup( struct lfds700_btree_au_state *baus, + void (*element_cleanup_callback)(struct lfds700_btree_au_state *baus, struct lfds700_btree_au_element *baue) ); + +enum lfds700_btree_au_insert_result lfds700_btree_au_insert( struct lfds700_btree_au_state *baus, + struct lfds700_btree_au_element *baue, + struct lfds700_btree_au_element **existing_baue, + struct lfds700_misc_prng_state *ps ); + // TRD : if a link collides with an existing key and existing_baue is non-NULL, existing_baue is set to the existing element + +int lfds700_btree_au_get_by_key( struct lfds700_btree_au_state *baus, + void *key, + struct lfds700_btree_au_element **baue ); + +int lfds700_btree_au_get_by_absolute_position_and_then_by_relative_position( struct lfds700_btree_au_state *baus, + struct lfds700_btree_au_element **baue, + enum lfds700_btree_au_absolute_position absolute_position, + enum lfds700_btree_au_relative_position relative_position ); + // TRD : if *baue is NULL, we get the element at position, otherwise we move from *baue according to direction + +int lfds700_btree_au_get_by_absolute_position( struct lfds700_btree_au_state *baus, + struct lfds700_btree_au_element **baue, + enum lfds700_btree_au_absolute_position absolute_position ); + +int lfds700_btree_au_get_by_relative_position( struct lfds700_btree_au_element **baue, + enum lfds700_btree_au_relative_position relative_position ); + +void lfds700_btree_au_query( struct lfds700_btree_au_state *baus, + enum lfds700_btree_au_query query_type, + void *query_input, + void *query_output ); + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/inc/liblfds700/lfds700_freelist.h b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/inc/liblfds700/lfds700_freelist.h new file mode 100644 index 0000000000..6a89386c5d --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/inc/liblfds700/lfds700_freelist.h @@ -0,0 +1,54 @@ +/***** defines *****/ +#define LFDS700_FREELIST_GET_KEY_FROM_ELEMENT( freelist_element ) ( (freelist_element).key ) +#define LFDS700_FREELIST_SET_KEY_IN_ELEMENT( freelist_element, new_key ) ( (freelist_element).key = (void *) (lfds700_pal_uint_t) (new_key) ) +#define LFDS700_FREELIST_GET_VALUE_FROM_ELEMENT( freelist_element ) ( (freelist_element).value ) +#define LFDS700_FREELIST_SET_VALUE_IN_ELEMENT( freelist_element, new_value ) ( (freelist_element).value = (void *) (lfds700_pal_uint_t) (new_value) ) +#define LFDS700_FREELIST_GET_USER_STATE_FROM_STATE( freelist_state ) ( (freelist_state).user_state ) + +/***** enums *****/ +enum lfds700_freelist_query +{ + LFDS700_FREELIST_QUERY_SINGLETHREADED_GET_COUNT, + LFDS700_FREELIST_QUERY_SINGLETHREADED_VALIDATE +}; + +/***** structures *****/ +struct lfds700_freelist_element +{ + struct lfds700_freelist_element + *volatile next; + + void + *key, + *value; +}; + +struct lfds700_freelist_state +{ + struct lfds700_freelist_element LFDS700_PAL_ALIGN(LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES) + *volatile top[PAC_SIZE]; + + void LFDS700_PAL_ALIGN(LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES) + *user_state; +}; + +/***** public prototypes *****/ +void lfds700_freelist_init_valid_on_current_logical_core( struct lfds700_freelist_state *fs, void *user_state ); + // TRD : used in conjunction with the #define LFDS700_MISC_MAKE_VALID_ON_CURRENT_LOGICAL_CORE_INITS_COMPLETED_BEFORE_NOW_ON_ANY_OTHER_LOGICAL_CORE + +void lfds700_freelist_cleanup( struct lfds700_freelist_state *fs, + void (*element_cleanup_callback)(struct lfds700_freelist_state *fs, struct lfds700_freelist_element *fe) ); + +void lfds700_freelist_push( struct lfds700_freelist_state *fs, + struct lfds700_freelist_element *fe, + struct lfds700_misc_prng_state *ps ); + +int lfds700_freelist_pop( struct lfds700_freelist_state *fs, + struct lfds700_freelist_element **fe, + struct lfds700_misc_prng_state *ps ); + +void lfds700_freelist_query( struct lfds700_freelist_state *fs, + enum lfds700_freelist_query query_type, + void *query_input, + void *query_output ); + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/inc/liblfds700/lfds700_hash_addonly.h b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/inc/liblfds700/lfds700_hash_addonly.h new file mode 100644 index 0000000000..f7962db9e0 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/inc/liblfds700/lfds700_hash_addonly.h @@ -0,0 +1,127 @@ +/***** defines *****/ +#define LFDS700_HASH_A_GET_KEY_FROM_ELEMENT( hash_a_element ) ( (hash_a_element).key ) +#define LFDS700_HASH_A_SET_KEY_IN_ELEMENT( hash_a_element, new_key ) ( (hash_a_element).key = (void *) (lfds700_pal_uint_t) (new_key) ) +#define LFDS700_HASH_A_GET_VALUE_FROM_ELEMENT( hash_a_element ) ( LFDS700_MISC_BARRIER_LOAD, (hash_a_element).value ) +#define LFDS700_HASH_A_SET_VALUE_IN_ELEMENT( hash_a_element, new_value ) { void *local_new_value = (void *) (lfds700_pal_uint_t) (new_value); LFDS700_PAL_ATOMIC_EXCHANGE( &(hash_a_element).value, &local_new_value ); } +#define LFDS700_HASH_A_GET_USER_STATE_FROM_STATE( hash_a_state ) ( (hash_a_state).user_state ) + +#define LFDS700_HASH_A_32BIT_HASH_FUNCTION( data, data_length_in_bytes, hash ) { \ + lfds700_pal_uint_t \ + loop; \ + \ + for( loop = 0 ; loop < (data_length_in_bytes) ; loop++ ) \ + { \ + (hash) += *( (char unsigned *) (data) + loop ); \ + (hash) += ((hash) << 10); \ + (hash) ^= ((hash) >> 6); \ + } \ + \ + (hash) += ((hash) << 3); \ + (hash) ^= ((hash) >> 11); \ + (hash) += ((hash) << 15); \ + } + /* TRD : this is the Jenkins one-at-a-time hash + it produces a 32 bit hash + http://en.wikipedia.org/wiki/Jenkins_hash_function + + we ourselves do *not* initialize the value of *hash, so that + our caller has the option to call us multiple times, each + time with for example a different member of a struct, which is + then hashed into the existing, built-up-so-far hash value, and + so build up a quality hash + */ + +/***** enums *****/ +enum lfds700_hash_a_existing_key +{ + LFDS700_HASH_A_EXISTING_KEY_OVERWRITE, + LFDS700_HASH_A_EXISTING_KEY_FAIL +}; + +enum lfds700_hash_a_insert_result +{ + LFDS700_HASH_A_PUT_RESULT_FAILURE_EXISTING_KEY, + LFDS700_HASH_A_PUT_RESULT_SUCCESS_OVERWRITE, + LFDS700_HASH_A_PUT_RESULT_SUCCESS +}; + +enum lfds700_hash_a_query +{ + LFDS700_HASH_A_QUERY_GET_POTENTIALLY_INACCURATE_COUNT, + LFDS700_HASH_A_QUERY_SINGLETHREADED_VALIDATE +}; + +/***** structs *****/ +struct lfds700_hash_a_element +{ + struct lfds700_btree_au_element + baue; + + void + *key; + + void LFDS700_PAL_ALIGN(LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES) + *volatile value; +}; + +struct lfds700_hash_a_iterate +{ + struct lfds700_btree_au_element + *baue; + + struct lfds700_btree_au_state + *baus, + *baus_end; +}; + +struct lfds700_hash_a_state +{ + enum lfds700_hash_a_existing_key + existing_key; + + int + (*key_compare_function)( void const *new_key, void const *existing_key ); + + lfds700_pal_uint_t + array_size; + + struct lfds700_btree_au_state + *baus_array; + + void + (*element_cleanup_callback)( struct lfds700_hash_a_state *has, struct lfds700_hash_a_element *hae ), + (*key_hash_function)( void const *key, lfds700_pal_uint_t *hash ), + *user_state; +}; + +/***** public prototypes *****/ +void lfds700_hash_a_init_valid_on_current_logical_core( struct lfds700_hash_a_state *has, + struct lfds700_btree_au_state *baus_array, + lfds700_pal_uint_t array_size, + int (*key_compare_function)(void const *new_key, void const *existing_key), + void (*key_hash_function)(void const *key, lfds700_pal_uint_t *hash), + enum lfds700_hash_a_existing_key existing_key, + void *user_state ); + // TRD : used in conjunction with the #define LFDS700_MISC_MAKE_VALID_ON_CURRENT_LOGICAL_CORE_INITS_COMPLETED_BEFORE_NOW_ON_ANY_OTHER_LOGICAL_CORE + +void lfds700_hash_a_cleanup( struct lfds700_hash_a_state *has, + void (*element_cleanup_function)(struct lfds700_hash_a_state *has, struct lfds700_hash_a_element *hae) ); + +enum lfds700_hash_a_insert_result lfds700_hash_a_insert( struct lfds700_hash_a_state *has, + struct lfds700_hash_a_element *hae, + struct lfds700_hash_a_element **existing_hae, + struct lfds700_misc_prng_state *ps ); + // TRD : if existing_value is not NULL and the key exists, existing_value is set to the value of the existing key + +int lfds700_hash_a_get_by_key( struct lfds700_hash_a_state *has, + void *key, + struct lfds700_hash_a_element **hae ); + +void lfds700_hash_a_iterate_init( struct lfds700_hash_a_state *has, struct lfds700_hash_a_iterate *hai ); +int lfds700_hash_a_iterate( struct lfds700_hash_a_iterate *hai, struct lfds700_hash_a_element **hae ); + +void lfds700_hash_a_query( struct lfds700_hash_a_state *has, + enum lfds700_hash_a_query query_type, + void *query_input, + void *query_output ); + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/inc/liblfds700/lfds700_list_addonly_ordered_singlylinked.h b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/inc/liblfds700/lfds700_list_addonly_ordered_singlylinked.h new file mode 100644 index 0000000000..dffab0aa6b --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/inc/liblfds700/lfds700_list_addonly_ordered_singlylinked.h @@ -0,0 +1,85 @@ +/***** defines *****/ +#define LFDS700_LIST_AOS_GET_START( list_aos_state ) ( LFDS700_MISC_BARRIER_LOAD, (list_aos_state).start->next ) +#define LFDS700_LIST_AOS_GET_NEXT( list_aos_element ) ( LFDS700_MISC_BARRIER_LOAD, (list_aos_element).next ) +#define LFDS700_LIST_AOS_GET_START_AND_THEN_NEXT( list_aos_state, pointer_to_list_aos_element ) ( (pointer_to_list_aos_element) == NULL ? ( (pointer_to_list_aos_element) = LFDS700_LIST_AOS_GET_START(list_aos_state) ) : ( (pointer_to_list_aos_element) = LFDS700_LIST_AOS_GET_NEXT(*(pointer_to_list_aos_element)) ) ) +#define LFDS700_LIST_AOS_GET_KEY_FROM_ELEMENT( list_aos_element ) ( (list_aos_element).key ) +#define LFDS700_LIST_AOS_SET_KEY_IN_ELEMENT( list_aos_element, new_key ) ( (list_aos_element).key = (void *) (lfds700_pal_uint_t) (new_key) ) +#define LFDS700_LIST_AOS_GET_VALUE_FROM_ELEMENT( list_aos_element ) ( LFDS700_MISC_BARRIER_LOAD, (list_aos_element).value ) +#define LFDS700_LIST_AOS_SET_VALUE_IN_ELEMENT( list_aos_element, new_value ) { void *local_new_value = (void *) (lfds700_pal_uint_t) (new_value); LFDS700_PAL_ATOMIC_EXCHANGE( &(list_aos_element).value, &local_new_value ); } +#define LFDS700_LIST_AOS_GET_USER_STATE_FROM_STATE( list_aos_state ) ( (list_aos_state).user_state ) + +/***** enums *****/ +enum lfds700_list_aos_existing_key +{ + LFDS700_LIST_AOS_EXISTING_KEY_OVERWRITE, + LFDS700_LIST_AOS_EXISTING_KEY_FAIL +}; + +enum lfds700_list_aos_insert_result +{ + LFDS700_LIST_AOS_INSERT_RESULT_FAILURE_EXISTING_KEY, + LFDS700_LIST_AOS_INSERT_RESULT_SUCCESS_OVERWRITE, + LFDS700_LIST_AOS_INSERT_RESULT_SUCCESS +}; + +enum lfds700_list_aos_query +{ + LFDS700_LIST_AOS_QUERY_GET_POTENTIALLY_INACCURATE_COUNT, + LFDS700_LIST_AOS_QUERY_SINGLETHREADED_VALIDATE +}; + +/***** structures *****/ +struct lfds700_list_aos_element +{ + struct lfds700_list_aos_element LFDS700_PAL_ALIGN(LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES) + *volatile next; + + void LFDS700_PAL_ALIGN(LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES) + *volatile value; + + void LFDS700_PAL_ALIGN(LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES) + *key; +}; + +struct lfds700_list_aos_state +{ + struct lfds700_list_aos_element LFDS700_PAL_ALIGN(LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES) + *volatile start; + + struct lfds700_list_aos_element LFDS700_PAL_ALIGN(LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES) + dummy_element; + + int LFDS700_PAL_ALIGN(LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES) + (*key_compare_function)( void const *new_key, void const *existing_key ); + + enum lfds700_list_aos_existing_key + existing_key; + + void + *user_state; +}; + +/***** public prototypes *****/ +void lfds700_list_aos_init_valid_on_current_logical_core( struct lfds700_list_aos_state *laoss, + int (*key_compare_function)(void const *new_key, void const *existing_key), + enum lfds700_list_aos_existing_key existing_key, + void *user_state ); + // TRD : used in conjunction with the #define LFDS700_MISC_MAKE_VALID_ON_CURRENT_LOGICAL_CORE_INITS_COMPLETED_BEFORE_NOW_ON_ANY_OTHER_LOGICAL_CORE + +void lfds700_list_aos_cleanup( struct lfds700_list_aos_state *laoss, + void (*element_cleanup_callback)(struct lfds700_list_aos_state *laoss, struct lfds700_list_aos_element *laose) ); + +enum lfds700_list_aos_insert_result lfds700_list_aos_insert( struct lfds700_list_aos_state *laoss, + struct lfds700_list_aos_element *laose, + struct lfds700_list_aos_element **existing_laose, + struct lfds700_misc_prng_state *ps ); + +int lfds700_list_aos_get_by_key( struct lfds700_list_aos_state *laoss, + void *key, + struct lfds700_list_aos_element **laose ); + +void lfds700_list_aos_query( struct lfds700_list_aos_state *laoss, + enum lfds700_list_aos_query query_type, + void *query_input, + void *query_output ); + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/inc/liblfds700/lfds700_list_addonly_singlylinked_unordered.h b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/inc/liblfds700/lfds700_list_addonly_singlylinked_unordered.h new file mode 100644 index 0000000000..38d21511a1 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/inc/liblfds700/lfds700_list_addonly_singlylinked_unordered.h @@ -0,0 +1,90 @@ +/***** defines *****/ +#define LFDS700_LIST_ASU_GET_START( list_asu_state ) ( LFDS700_MISC_BARRIER_LOAD, (list_asu_state).start->next ) +#define LFDS700_LIST_ASU_GET_NEXT( list_asu_element ) ( LFDS700_MISC_BARRIER_LOAD, (list_asu_element).next ) +#define LFDS700_LIST_ASU_GET_START_AND_THEN_NEXT( list_asu_state, pointer_to_list_asu_element ) ( (pointer_to_list_asu_element) == NULL ? ( (pointer_to_list_asu_element) = LFDS700_LIST_ASU_GET_START(list_asu_state) ) : ( (pointer_to_list_asu_element) = LFDS700_LIST_ASU_GET_NEXT(*(pointer_to_list_asu_element)) ) ) +#define LFDS700_LIST_ASU_GET_KEY_FROM_ELEMENT( list_asu_element ) ( (list_asu_element).key ) +#define LFDS700_LIST_ASU_SET_KEY_IN_ELEMENT( list_asu_element, new_key ) ( (list_asu_element).key = (void *) (lfds700_pal_uint_t) (new_key) ) +#define LFDS700_LIST_ASU_GET_VALUE_FROM_ELEMENT( list_asu_element ) ( LFDS700_MISC_BARRIER_LOAD, (list_asu_element).value ) +#define LFDS700_LIST_ASU_SET_VALUE_IN_ELEMENT( list_asu_element, new_value ) { void *local_new_value = (void *) (lfds700_pal_uint_t) (new_value); LFDS700_PAL_ATOMIC_EXCHANGE( &(list_asu_element).value, &local_new_value ); } +#define LFDS700_LIST_ASU_GET_USER_STATE_FROM_STATE( list_asu_state ) ( (list_asu_state).user_state ) + +/***** enums *****/ +enum lfds700_list_asu_position +{ + LFDS700_LIST_ASU_POSITION_START, + LFDS700_LIST_ASU_POSITION_END, + LFDS700_LIST_ASU_POSITION_AFTER +}; + +enum lfds700_list_asu_query +{ + LFDS700_LIST_ASU_QUERY_GET_POTENTIALLY_INACCURATE_COUNT, + LFDS700_LIST_ASU_QUERY_SINGLETHREADED_VALIDATE +}; + +/***** structures *****/ +struct lfds700_list_asu_element +{ + struct lfds700_list_asu_element LFDS700_PAL_ALIGN(LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES) + *volatile next; + + void LFDS700_PAL_ALIGN(LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES) + *volatile value; + + void LFDS700_PAL_ALIGN(LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES) + *key; +}; + +struct lfds700_list_asu_state +{ + struct lfds700_list_asu_element LFDS700_PAL_ALIGN(LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES) + *volatile end, + *volatile start; + + struct lfds700_list_asu_element LFDS700_PAL_ALIGN(LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES) + dummy_element; + + int LFDS700_PAL_ALIGN(LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES) + (*key_compare_function)( void const *new_key, void const *existing_key ); + + void + *user_state; +}; + +/***** public prototypes *****/ +void lfds700_list_asu_init_valid_on_current_logical_core( struct lfds700_list_asu_state *lasus, + int (*key_compare_function)(void const *new_key, void const *existing_key), + void *user_state ); + // TRD : used in conjunction with the #define LFDS700_MISC_MAKE_VALID_ON_CURRENT_LOGICAL_CORE_INITS_COMPLETED_BEFORE_NOW_ON_ANY_OTHER_LOGICAL_CORE + +void lfds700_list_asu_cleanup( struct lfds700_list_asu_state *lasus, + void (*element_cleanup_callback)(struct lfds700_list_asu_state *lasus, struct lfds700_list_asu_element *lasue) ); + +void lfds700_list_asu_insert_at_position( struct lfds700_list_asu_state *lasus, + struct lfds700_list_asu_element *lasue, + struct lfds700_list_asu_element *lasue_predecessor, + enum lfds700_list_asu_position position, + struct lfds700_misc_prng_state *ps ); + +void lfds700_list_asu_insert_at_start( struct lfds700_list_asu_state *lasus, + struct lfds700_list_asu_element *lasue, + struct lfds700_misc_prng_state *ps ); + +void lfds700_list_asu_insert_at_end( struct lfds700_list_asu_state *lasus, + struct lfds700_list_asu_element *lasue, + struct lfds700_misc_prng_state *ps ); + +void lfds700_list_asu_insert_after_element( struct lfds700_list_asu_state *lasus, + struct lfds700_list_asu_element *lasue, + struct lfds700_list_asu_element *lasue_predecessor, + struct lfds700_misc_prng_state *ps ); + +int lfds700_list_asu_get_by_key( struct lfds700_list_asu_state *lasus, + void *key, + struct lfds700_list_asu_element **lasue ); + +void lfds700_list_asu_query( struct lfds700_list_asu_state *lasus, + enum lfds700_list_asu_query query_type, + void *query_input, + void *query_output ); + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/inc/liblfds700/lfds700_misc.h b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/inc/liblfds700/lfds700_misc.h new file mode 100644 index 0000000000..014f72dac5 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/inc/liblfds700/lfds700_misc.h @@ -0,0 +1,192 @@ +/***** defines *****/ +#define LFDS700_MISC_VERSION_STRING "7.0.0" +#define LFDS700_MISC_VERSION_INTEGER 700 + +#ifndef NULL + #define NULL ( (void *) 0 ) +#endif + +#define POINTER 0 +#define COUNTER 1 +#define PAC_SIZE 2 + +#define LFDS700_MISC_ABSTRACTION_BACKOFF_INITIAL_VALUE 0 +#define LFDS700_MISC_PRNG_MAX ( (lfds700_pal_uint_t) -1 ) +#define LFDS700_MISC_DELIBERATELY_CRASH { char *c = 0; *c = 0; } +#define LFDS700_MISC_PRNG_SEED 0x0a34655d34c092feULL + /* TRD : from an on-line hardware RNG, using atmospheric noise + the URL eblow will generate another 16 random hex digits (e.g. a 64-bit number) and is + the RNG used to generate the number above (0x0a34655d34c092fe) + http://www.random.org/integers/?num=16&min=0&max=15&col=1&base=16&format=plain&rnd=new + + this seed is a fixed seed which is used for the slow, high quality PRNG, + which in turn is used when thread start to generate a single high quality seed + for the fast, low quality PRNG used for the CAS exponential backoff + */ + +#if( LFDS700_PAL_ALIGN_SINGLE_POINTER == 4 ) // TRD : any 32-bit platform + // TRD : PRNG is a 32-bit xorshift, numbers suggested by George Marsaglia, in his paper http://www.jstatsoft.org/v08/i14/paper + #define LFDS700_MISC_PRNG_GENERATE( pointer_to_lfds700_misc_prng_state ) ( (pointer_to_lfds700_misc_prng_state)->prng_state ^= (pointer_to_lfds700_misc_prng_state)->prng_state >> 13, (pointer_to_lfds700_misc_prng_state)->prng_state ^= (pointer_to_lfds700_misc_prng_state)->prng_state << 17, (pointer_to_lfds700_misc_prng_state)->prng_state ^= (pointer_to_lfds700_misc_prng_state)->prng_state >> 5 ) +#endif + +#if( LFDS700_PAL_ALIGN_SINGLE_POINTER == 8 ) // TRD : any 64-bit platform + // TRD : PRNG is 64-bit xorshift (xorshift64*), from Sebastiano Vigna (vigna at acm dot org), http://creativecommons.org/publicdomain/zero/1.0/ + #define LFDS700_MISC_PRNG_GENERATE( pointer_to_lfds700_misc_prng_state ) ( (pointer_to_lfds700_misc_prng_state)->prng_state ^= (pointer_to_lfds700_misc_prng_state)->prng_state >> 12, (pointer_to_lfds700_misc_prng_state)->prng_state ^= (pointer_to_lfds700_misc_prng_state)->prng_state << 25, (pointer_to_lfds700_misc_prng_state)->prng_state ^= (pointer_to_lfds700_misc_prng_state)->prng_state >> 27, (pointer_to_lfds700_misc_prng_state)->prng_state *= 2685821657736338717LL ) +#endif + +#if( !defined LFDS700_PAL_ATOMIC_CAS ) + #define LFDS700_PAL_NO_ATOMIC_CAS + + // TRD : lfds700_pal_atom_t volatile *destination, lfds700_pal_atom_t *compare, lfds700_pal_atom_t new_destination, enum lfds700_misc_cas_strength cas_strength, char unsigned result + + #define LFDS700_PAL_ATOMIC_CAS( pointer_to_destination, pointer_to_compare, new_destination, cas_strength, result ) \ + { \ + LFDS700_PAL_ASSERT( !"LFDS700_PAL_ATOMIC_CAS not implemented for this platform." ); \ + LFDS700_MISC_DELIBERATELY_CRASH; \ + (result) = (char unsigned) 1; \ + } +#endif + +#if( !defined LFDS700_PAL_ATOMIC_DWCAS ) + #define LFDS700_PAL_NO_ATOMIC_DWCAS + + // TRD : lfds700_pal_atom_t volatile (*destination)[2], lfds700_pal_atom_t (*compare)[2], lfds700_pal_atom_t (*new_destination)[2], enum lfds700_misc_cas_strength cas_strength, unsigned char result + + #define LFDS700_PAL_ATOMIC_DWCAS( pointer_to_destination, pointer_to_compare, pointer_to_new_destination, cas_strength, result ) \ + { \ + LFDS700_PAL_ASSERT( !"LFDS700_PAL_ATOMIC_DWCAS not implemented for this platform." ); \ + LFDS700_MISC_DELIBERATELY_CRASH; \ + (result) = (char unsigned) 1; \ + } +#endif + +#if( !defined LFDS700_PAL_ATOMIC_EXCHANGE ) + #define LFDS700_PAL_NO_ATOMIC_EXCHANGE + // TRD : lfds700_pal_atom_t volatile *destination, lfds700_pal_atom_t *exchange + #define LFDS700_PAL_ATOMIC_EXCHANGE( pointer_to_destination, pointer_to_exchange ) \ + { \ + LFDS700_PAL_ASSERT( !"LFDS700_PAL_ATOMIC_EXCHANGE not implemented for this platform." ); \ + LFDS700_MISC_DELIBERATELY_CRASH; \ + } +#endif + +#if( defined LFDS700_PAL_NO_COMPILER_BARRIERS ) + #define LFDS700_MISC_BARRIER_LOAD ( LFDS700_PAL_BARRIER_PROCESSOR_LOAD ) + #define LFDS700_MISC_BARRIER_STORE ( LFDS700_PAL_BARRIER_PROCESSOR_STORE ) + #define LFDS700_MISC_BARRIER_FULL ( LFDS700_PAL_BARRIER_PROCESSOR_FULL ) +#else + #define LFDS700_MISC_BARRIER_LOAD ( LFDS700_PAL_BARRIER_COMPILER_LOAD, LFDS700_PAL_BARRIER_PROCESSOR_LOAD, LFDS700_PAL_BARRIER_COMPILER_LOAD ) + #define LFDS700_MISC_BARRIER_STORE ( LFDS700_PAL_BARRIER_COMPILER_STORE, LFDS700_PAL_BARRIER_PROCESSOR_STORE, LFDS700_PAL_BARRIER_COMPILER_STORE ) + #define LFDS700_MISC_BARRIER_FULL ( LFDS700_PAL_BARRIER_COMPILER_FULL, LFDS700_PAL_BARRIER_PROCESSOR_FULL, LFDS700_PAL_BARRIER_COMPILER_FULL ) +#endif + +#define LFDS700_MISC_MAKE_VALID_ON_CURRENT_LOGICAL_CORE_INITS_COMPLETED_BEFORE_NOW_ON_ANY_OTHER_LOGICAL_CORE LFDS700_MISC_BARRIER_LOAD + +#if( defined LFDS700_PAL_NO_ATOMIC_CAS ) + #define LFDS700_MISC_ATOMIC_SUPPORT_CAS 0 +#else + #define LFDS700_MISC_ATOMIC_SUPPORT_CAS 1 +#endif + +#if( defined LFDS700_PAL_NO_ATOMIC_DWCAS ) + #define LFDS700_MISC_ATOMIC_SUPPORT_DWCAS 0 +#else + #define LFDS700_MISC_ATOMIC_SUPPORT_DWCAS 1 +#endif + +#if( defined LFDS700_PAL_NO_ATOMIC_EXCHANGE ) + #define LFDS700_MISC_ATOMIC_SUPPORT_EXCHANGE 0 +#else + #define LFDS700_MISC_ATOMIC_SUPPORT_EXCHANGE 1 +#endif + +/***** enums *****/ +enum lfds700_misc_cas_strength +{ + // TRD : yes, weak is 1 (one) - blame GCC! + LFDS700_MISC_CAS_STRENGTH_WEAK = 1, + LFDS700_MISC_CAS_STRENGTH_STRONG = 0 +}; + +enum lfds700_misc_validity +{ + LFDS700_MISC_VALIDITY_VALID, + LFDS700_MISC_VALIDITY_INVALID_LOOP, + LFDS700_MISC_VALIDITY_INVALID_MISSING_ELEMENTS, + LFDS700_MISC_VALIDITY_INVALID_ADDITIONAL_ELEMENTS, + LFDS700_MISC_VALIDITY_INVALID_TEST_DATA, + LFDS700_MISC_VALIDITY_INVALID_ORDER +}; + +enum lfds700_misc_flag +{ + LFDS700_MISC_FLAG_LOWERED, + LFDS700_MISC_FLAG_RAISED +}; + +enum lfds700_misc_query +{ + LFDS700_MISC_QUERY_GET_EXPONENTIAL_BACKOFF_TIMESLOT_LENGTH_IN_LOOP_ITERATIONS_FOR_CAS, + LFDS700_MISC_QUERY_SET_EXPONENTIAL_BACKOFF_TIMESLOT_LENGTH_IN_LOOP_ITERATIONS_FOR_CAS, + LFDS700_MISC_QUERY_GET_EXPONENTIAL_BACKOFF_TIMESLOT_LENGTH_IN_LOOP_ITERATIONS_FOR_DWCAS, + LFDS700_MISC_QUERY_SET_EXPONENTIAL_BACKOFF_TIMESLOT_LENGTH_IN_LOOP_ITERATIONS_FOR_DWCAS, + LFDS700_MISC_QUERY_GET_BUILD_AND_VERSION_STRING +}; + +/***** struct *****/ +struct lfds700_misc_globals +{ + lfds700_pal_atom_t + exponential_backoff_timeslot_length_in_loop_iterations_for_cas, + exponential_backoff_timeslot_length_in_loop_iterations_for_dwcas; +}; + +struct lfds700_misc_prng_state +{ + lfds700_pal_uint_t + prng_state; + + // TRD : here to be on the same cache-line as prng_state, and so all are obtained from one cache-line read + lfds700_pal_atom_t + local_copy_of_global_exponential_backoff_timeslot_length_in_loop_iterations_for_cas, + local_copy_of_global_exponential_backoff_timeslot_length_in_loop_iterations_for_dwcas; +}; + +struct lfds700_misc_validation_info +{ + lfds700_pal_uint_t + min_elements, + max_elements; +}; + +/***** externs *****/ +extern struct lfds700_misc_globals + lfds700_misc_globals; + +/***** public prototypes *****/ +void lfds700_misc_library_init_valid_on_current_logical_core( void ); + // TRD : used in conjunction with the #define LFDS700_MISC_MAKE_VALID_ON_CURRENT_LOGICAL_CORE_INITS_COMPLETED_BEFORE_NOW_ON_ANY_OTHER_LOGICAL_CORE +void lfds700_misc_library_cleanup( void ); + +static LFDS700_PAL_INLINE void lfds700_misc_force_store( void ); + +void lfds700_misc_prng_init( struct lfds700_misc_prng_state *ps ); + +void lfds700_misc_query( enum lfds700_misc_query query_type, void *query_input, void *query_output ); + +/***** public in-line functions *****/ +#pragma prefast( disable : 28112, "blah" ) + +static LFDS700_PAL_INLINE void lfds700_misc_force_store() +{ + lfds700_pal_uint_t + exchange = 0; + + lfds700_pal_atom_t volatile LFDS700_PAL_ALIGN(LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES) + destination; + + LFDS700_PAL_ATOMIC_EXCHANGE( &destination, &exchange ); + + return; +} + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/inc/liblfds700/lfds700_porting_abstraction_layer_compiler.h b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/inc/liblfds700/lfds700_porting_abstraction_layer_compiler.h new file mode 100644 index 0000000000..c628ddd03a --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/inc/liblfds700/lfds700_porting_abstraction_layer_compiler.h @@ -0,0 +1,478 @@ +/****************************************************************************/ +#if( defined __GNUC__ ) + // TRD : makes checking GCC versions much tidier + #define LFDS700_PAL_GCC_VERSION ( __GNUC__ * 100 + __GNUC_MINOR__ * 10 + __GNUC_PATCHLEVEL__ ) +#endif + + + + + +/****************************************************************************/ +#if( defined _MSC_VER && _MSC_VER >= 1400 ) + + /* TRD : MSVC 8.0 and greater + + _MSC_VER indicates Microsoft C compiler and version + - __declspec(align) requires 7.1 (1310) + - __nop requires 8.0 (1400) + - _ReadBarrier requires 8.0 (1400) + - _WriteBarrier requires 8.0 (1400) + - _ReadWriteBarrier requires 7.1 (1310) + - _InterlockedCompareExchangePointer requires 8.0 (1400) + - _InterlockedExchange requires 7.1 (1310) + - _InterlockedExchangePointer requires 8.0 (1400) + - _InterlockedCompareExchange64 requires 8.0 (1400) (seems to, docs unclear) + - _InterlockedCompareExchange128 requires 9.0 (1500) + + load/store barriers are mandatory for liblfds, which means the earliest viable version of MSCV is 1400 + strictly we could get away with 1310 and use _ReadWriteBarrier, but the difference between 1310 and 1400 is small, so WTH + + _InterlockedCompareExchange128 is needed on 64-bit platforms to provide DWCAS, but DWCAS is not mandatory, + so we check against the compiler version - remember, any unimplemented atomic will be masked by its dummy define, + so everything will compile - it just means you can't use data structures which require that atomic + */ + + #ifdef LFDS700_PAL_PORTING_ABSTRACTION_LAYER_COMPILER + #error More than one porting abstraction layer matches the current platform in lfds700_porting_abstraction_layer_compiler.h + #endif + + #define LFDS700_PAL_PORTING_ABSTRACTION_LAYER_COMPILER + + #define LFDS700_PAL_COMPILER_STRING "MSVC" + + #define LFDS700_PAL_ALIGN(alignment) __declspec( align(alignment) ) + #define LFDS700_PAL_INLINE __forceinline + + #define LFDS700_PAL_BARRIER_COMPILER_LOAD _ReadBarrier() + #define LFDS700_PAL_BARRIER_COMPILER_STORE _WriteBarrier() + #define LFDS700_PAL_BARRIER_COMPILER_FULL _ReadWriteBarrier() + + /* TRD : there are four processors to consider; + + . ARM32 (32 bit, CAS, DWCAS) (defined _M_ARM) + . Itanium (64 bit, CAS) (defined _M_IA64) + . x64 (64 bit, CAS, DWCAS) (defined _M_X64 || defined _M_AMD64) + . x86 (32 bit, CAS, DWCAS) (defined _M_IX86) + + can't find any indications of 64-bit ARM support yet + + ARM has better intrinsics than the others, as there are no-fence variants + + in theory we also have to deal with 32-bit Windows on a 64-bit platform, + and I presume we'd see the compiler properly indicate this in its macros, + but this would require that we use 32-bit atomics on the 64-bit platforms, + while keeping 64-bit cache line lengths and so on, and this is just so + wierd a thing to do these days that it's not supported + + note that _InterlockedCompareExchangePointer performs CAS on all processors + however, it is documented as being available for x86 when in fact it is not + so we have to #if for processor type and use the length specific intrinsics + */ + + #if( defined _M_ARM ) + #define LFDS700_PAL_BARRIER_PROCESSOR_LOAD __dmb( _ARM_BARRIER_ISH ) + #define LFDS700_PAL_BARRIER_PROCESSOR_STORE __dmb( _ARM_BARRIER_ISHST ) + #define LFDS700_PAL_BARRIER_PROCESSOR_FULL __dmb( _ARM_BARRIER_ISH ) + + #define LFDS700_PAL_ATOMIC_CAS( pointer_to_destination, pointer_to_compare, new_destination, cas_strength, result ) \ + { \ + lfds700_pal_atom_t \ + original_compare; \ + \ + /* LFDS700_PAL_ASSERT( (pointer_to_destination) != NULL ); */ \ + /* LFDS700_PAL_ASSERT( (pointer_to_compare) != NULL ); */ \ + /* TRD : new_destination can be any value in its range */ \ + /* TRD : cas_strength can be any value in its range */ \ + /* TRD : result can be any value in its range */ \ + \ + original_compare = (lfds700_pal_atom_t) *(pointer_to_compare); \ + \ + LFDS700_PAL_BARRIER_COMPILER_FULL; \ + *(lfds700_pal_atom_t *) (pointer_to_compare) = (lfds700_pal_atom_t) _InterlockedCompareExchange_nf( (long volatile *) (pointer_to_destination), (long) (new_destination), (long) *(pointer_to_compare) ); \ + LFDS700_PAL_BARRIER_COMPILER_FULL; \ + \ + result = (char unsigned) ( original_compare == (lfds700_pal_atom_t) *(pointer_to_compare) ); \ + } + + #define LFDS700_PAL_ATOMIC_DWCAS( pointer_to_destination, pointer_to_compare, pointer_to_new_destination, cas_strength, result ) \ + { \ + __int64 \ + original_compare; \ + \ + /* LFDS700_PAL_ASSERT( (pointer_to_destination) != NULL ); */ \ + /* LFDS700_PAL_ASSERT( (pointer_to_compare) != NULL ); */ \ + /* LFDS700_PAL_ASSERT( (pointer_to_new_destination) != NULL ); */ \ + /* TRD : cas_strength can be any value in its range */ \ + /* TRD : result can be any value in its range */ \ + \ + original_compare = *(__int64 *) (pointer_to_compare); \ + \ + LFDS700_PAL_BARRIER_COMPILER_FULL; \ + *(__int64 *) (pointer_to_compare) = _InterlockedCompareExchange64_nf( (__int64 volatile *) (pointer_to_destination), *(__int64 *) (pointer_to_new_destination), *(__int64 *) (pointer_to_compare) ); \ + LFDS700_PAL_BARRIER_COMPILER_FULL; \ + \ + result = (char unsigned) ( *(__int64 *) (pointer_to_compare) == original_compare ); \ + } + + #define LFDS700_PAL_ATOMIC_EXCHANGE( pointer_to_destination, pointer_to_exchange ) \ + { \ + /* LFDS700_PAL_ASSERT( (pointer_to_destination) != NULL ); */ \ + /* LFDS700_PAL_ASSERT( (pointer_to_exchange) != NULL ); */ \ + \ + LFDS700_PAL_BARRIER_COMPILER_FULL; \ + *(lfds700_pal_atom_t *) (pointer_to_exchange) = (lfds700_pal_atom_t) _InterlockedExchange_nf( (int long volatile *) (pointer_to_destination), (int long) *(pointer_to_exchange) ); \ + LFDS700_PAL_BARRIER_COMPILER_FULL; \ + } + #endif + + #if( defined _M_IA64 ) + #define LFDS700_PAL_BARRIER_PROCESSOR_LOAD __mf() + #define LFDS700_PAL_BARRIER_PROCESSOR_STORE __mf() + #define LFDS700_PAL_BARRIER_PROCESSOR_FULL __mf() + + #define LFDS700_PAL_ATOMIC_CAS( pointer_to_destination, pointer_to_compare, new_destination, cas_strength, result ) \ + { \ + lfds700_pal_atom_t \ + original_compare; \ + \ + /* LFDS700_PAL_ASSERT( (pointer_to_destination) != NULL ); */ \ + /* LFDS700_PAL_ASSERT( (pointer_to_compare) != NULL ); */ \ + /* TRD : new_destination can be any value in its range */ \ + /* TRD : cas_strength can be any value in its range */ \ + /* TRD : result can be any value in its range */ \ + \ + original_compare = (lfds700_pal_atom_t) *(pointer_to_compare); \ + \ + LFDS700_PAL_BARRIER_COMPILER_FULL; \ + *(lfds700_pal_atom_t *) (pointer_to_compare) = (lfds700_pal_atom_t) _InterlockedCompareExchange64_acq( (__int64 volatile *) (pointer_to_destination), (__int64) (new_destination), (__int64) *(pointer_to_compare) ); \ + LFDS700_PAL_BARRIER_COMPILER_FULL; \ + \ + result = (char unsigned) ( original_compare == (lfds700_pal_atom_t) *(pointer_to_compare) ); \ + } + + #define LFDS700_PAL_ATOMIC_EXCHANGE( pointer_to_destination, pointer_to_exchange ) \ + { \ + /* LFDS700_PAL_ASSERT( (pointer_to_destination) != NULL ); */ \ + /* LFDS700_PAL_ASSERT( (pointer_to_exchange) != NULL ); */ \ + \ + LFDS700_PAL_BARRIER_COMPILER_FULL; \ + *(lfds700_pal_atom_t *) (pointer_to_exchange) = (lfds700_pal_atom_t) _InterlockedExchange64_acq( (__int64 volatile *) (pointer_to_destination), (__int64) *(pointer_to_exchange) ); \ + LFDS700_PAL_BARRIER_COMPILER_FULL; \ + } + #endif + + #if( defined _M_X64 || defined _M_AMD64 ) + #define LFDS700_PAL_BARRIER_PROCESSOR_LOAD _mm_lfence() + #define LFDS700_PAL_BARRIER_PROCESSOR_STORE _mm_sfence() + #define LFDS700_PAL_BARRIER_PROCESSOR_FULL _mm_mfence() + + #define LFDS700_PAL_ATOMIC_CAS( pointer_to_destination, pointer_to_compare, new_destination, cas_strength, result ) \ + { \ + lfds700_pal_atom_t \ + original_compare; \ + \ + /* LFDS700_PAL_ASSERT( (pointer_to_destination) != NULL ); */ \ + /* LFDS700_PAL_ASSERT( (pointer_to_compare) != NULL ); */ \ + /* TRD : new_destination can be any value in its range */ \ + /* TRD : cas_strength can be any value in its range */ \ + /* TRD : result can be any value in its range */ \ + \ + original_compare = (lfds700_pal_atom_t) *(pointer_to_compare); \ + \ + LFDS700_PAL_BARRIER_COMPILER_FULL; \ + *(lfds700_pal_atom_t *) (pointer_to_compare) = (lfds700_pal_atom_t) _InterlockedCompareExchange64( (__int64 volatile *) (pointer_to_destination), (__int64) (new_destination), (__int64) *(pointer_to_compare) ); \ + LFDS700_PAL_BARRIER_COMPILER_FULL; \ + \ + result = (char unsigned) ( original_compare == (lfds700_pal_atom_t) *(pointer_to_compare) ); \ + } + + #if( _MSC_VER >= 1500 ) + #define LFDS700_PAL_ATOMIC_DWCAS( pointer_to_destination, pointer_to_compare, pointer_to_new_destination, cas_strength, result ) \ + { \ + /* LFDS700_PAL_ASSERT( (pointer_to_new_destination) != NULL ); */ \ + /* LFDS700_PAL_ASSERT( (pointer_to_destination) != NULL ); */ \ + /* LFDS700_PAL_ASSERT( (pointer_to_compare) != NULL ); */ \ + /* TRD : cas_strength can be any value in its range */ \ + /* TRD : result can be any value in its range */ \ + \ + LFDS700_PAL_BARRIER_COMPILER_FULL; \ + result = (char unsigned) _InterlockedCompareExchange128( (__int64 volatile *) (pointer_to_destination), (__int64) (pointer_to_new_destination[1]), (__int64) (pointer_to_new_destination[0]), (__int64 *) (pointer_to_compare) ); \ + LFDS700_PAL_BARRIER_COMPILER_FULL; \ + } + #endif + + #define LFDS700_PAL_ATOMIC_EXCHANGE( pointer_to_destination, pointer_to_exchange ) \ + { \ + /* LFDS700_PAL_ASSERT( (pointer_to_destination) != NULL ); */ \ + /* LFDS700_PAL_ASSERT( (pointer_to_exchange) != NULL ); */ \ + \ + LFDS700_PAL_BARRIER_COMPILER_FULL; \ + *(lfds700_pal_atom_t *) (pointer_to_exchange) = (lfds700_pal_atom_t) _InterlockedExchangePointer( (void * volatile *) (pointer_to_destination), (void *) *(pointer_to_exchange) ); \ + LFDS700_PAL_BARRIER_COMPILER_FULL; \ + } + #endif + + #if( defined _M_IX86 ) + #define LFDS700_PAL_BARRIER_PROCESSOR_LOAD lfds700_misc_force_store() + #define LFDS700_PAL_BARRIER_PROCESSOR_STORE lfds700_misc_force_store() + #define LFDS700_PAL_BARRIER_PROCESSOR_FULL lfds700_misc_force_store() + + #define LFDS700_PAL_ATOMIC_CAS( pointer_to_destination, pointer_to_compare, new_destination, cas_strength, result ) \ + { \ + lfds700_pal_atom_t \ + original_compare; \ + \ + /* LFDS700_PAL_ASSERT( (pointer_to_destination) != NULL ); */ \ + /* LFDS700_PAL_ASSERT( (pointer_to_compare) != NULL ); */ \ + /* TRD : new_destination can be any value in its range */ \ + /* TRD : cas_strength can be any value in its range */ \ + /* TRD : result can be any value in its range */ \ + \ + original_compare = (lfds700_pal_atom_t) *(pointer_to_compare); \ + \ + LFDS700_PAL_BARRIER_COMPILER_FULL; \ + *(lfds700_pal_atom_t *) (pointer_to_compare) = (lfds700_pal_atom_t) _InterlockedCompareExchange( (long volatile *) (pointer_to_destination), (long) (new_destination), (long) *(pointer_to_compare) ); \ + LFDS700_PAL_BARRIER_COMPILER_FULL; \ + \ + result = (char unsigned) ( original_compare == (lfds700_pal_atom_t) *(pointer_to_compare) ); \ + } + + #define LFDS700_PAL_ATOMIC_DWCAS( pointer_to_destination, pointer_to_compare, pointer_to_new_destination, cas_strength, result ) \ + { \ + __int64 \ + original_compare; \ + \ + /* LFDS700_PAL_ASSERT( (pointer_to_destination) != NULL ); */ \ + /* LFDS700_PAL_ASSERT( (pointer_to_compare) != NULL ); */ \ + /* LFDS700_PAL_ASSERT( (pointer_to_new_destination) != NULL ); */ \ + /* TRD : cas_strength can be any value in its range */ \ + /* TRD : result can be any value in its range */ \ + \ + original_compare = *(__int64 *) (pointer_to_compare); \ + \ + LFDS700_PAL_BARRIER_COMPILER_FULL; \ + *(__int64 *) (pointer_to_compare) = _InterlockedCompareExchange64( (__int64 volatile *) (pointer_to_destination), *(__int64 *) (pointer_to_new_destination), *(__int64 *) (pointer_to_compare) ); \ + LFDS700_PAL_BARRIER_COMPILER_FULL; \ + \ + result = (char unsigned) ( *(__int64 *) (pointer_to_compare) == original_compare ); \ + } + + #define LFDS700_PAL_ATOMIC_EXCHANGE( pointer_to_destination, pointer_to_exchange ) \ + { \ + /* LFDS700_PAL_ASSERT( (pointer_to_destination) != NULL ); */ \ + /* LFDS700_PAL_ASSERT( (pointer_to_exchange) != NULL ); */ \ + \ + LFDS700_PAL_BARRIER_COMPILER_FULL; \ + *(lfds700_pal_atom_t *) (pointer_to_exchange) = (lfds700_pal_atom_t) _InterlockedExchange( (int long volatile *) (pointer_to_destination), (int long) *(pointer_to_exchange) ); \ + LFDS700_PAL_BARRIER_COMPILER_FULL; \ + } + #endif + +#endif + + + + + +/****************************************************************************/ +#if( defined __GNUC__ && LFDS700_PAL_GCC_VERSION >= 412 && LFDS700_PAL_GCC_VERSION < 473 ) + + /* TRD : GCC 4.1.2 up to 4.7.3 + + __GNUC__ indicates GCC + LFDS700_PAL_GCC_VERSION indicates which version + - __sync_synchronize requires 4.1.2 + + GCC 4.1.2 introduced the __sync_*() atomic intrinsics + */ + + #ifdef LFDS700_PAL_PORTING_ABSTRACTION_LAYER_COMPILER + #error More than one porting abstraction layer matches the current platform in lfds700_porting_abstraction_layer_compiler.h + #endif + + #define LFDS700_PAL_PORTING_ABSTRACTION_LAYER_COMPILER + + #define LFDS700_PAL_COMPILER_STRING "GCC < 4.7.3" + + #define LFDS700_PAL_ALIGN(alignment) __attribute__( (aligned(alignment)) ) + #define LFDS700_PAL_INLINE inline + + static LFDS700_PAL_INLINE void lfds700_pal_barrier_compiler( void ) + { + __asm__ __volatile__ ( "" : : : "memory" ); + } + + #define LFDS700_PAL_BARRIER_COMPILER_LOAD lfds700_pal_barrier_compiler() + #define LFDS700_PAL_BARRIER_COMPILER_STORE lfds700_pal_barrier_compiler() + #define LFDS700_PAL_BARRIER_COMPILER_FULL lfds700_pal_barrier_compiler() + + #define LFDS700_PAL_BARRIER_PROCESSOR_LOAD __sync_synchronize() + #define LFDS700_PAL_BARRIER_PROCESSOR_STORE __sync_synchronize() + #define LFDS700_PAL_BARRIER_PROCESSOR_FULL __sync_synchronize() + + #define LFDS700_PAL_ATOMIC_CAS( pointer_to_destination, pointer_to_compare, new_destination, cas_strength, result ) \ + { \ + lfds700_pal_atom_t \ + original_compare; \ + \ + /* LFDS700_PAL_ASSERT( (pointer_to_destination) != NULL ); */ \ + /* LFDS700_PAL_ASSERT( (pointer_to_compare) != NULL ); */ \ + /* TRD : new_destination can be any value in its range */ \ + /* TRD : cas_strength can be any value in its range */ \ + /* TRD : result can be any value in its range */ \ + \ + original_compare = (lfds700_pal_atom_t) *(pointer_to_compare); \ + \ + LFDS700_PAL_BARRIER_COMPILER_FULL; \ + *(pointer_to_compare) = __sync_val_compare_and_swap( pointer_to_destination, *(pointer_to_compare), new_destination ); \ + LFDS700_PAL_BARRIER_COMPILER_FULL; \ + \ + result = (unsigned char) ( original_compare == (lfds700_pal_atom_t) *(pointer_to_compare) ); \ + } + + // TRD : ARM and x86 have DWCAS which we can get via GCC intrinsics + #if( defined __arm__ || defined __i686__ || defined __i586__ || defined __i486__ ) + #define LFDS700_PAL_ATOMIC_DWCAS( pointer_to_destination, pointer_to_compare, pointer_to_new_destination, cas_strength, result ) \ + { \ + int long long unsigned \ + original_destination; \ + \ + /* LFDS700_PAL_ASSERT( (pointer_to_destination) != NULL ); */ \ + /* LFDS700_PAL_ASSERT( (pointer_to_compare) != NULL ); */ \ + /* LFDS700_PAL_ASSERT( (pointer_to_new_destination) != NULL ); */ \ + /* TRD : cas_strength can be any value in its range */ \ + /* TRD : result can be any value in its range */ \ + \ + LFDS700_PAL_BARRIER_COMPILER_FULL; \ + original_destination = __sync_val_compare_and_swap( (int long long unsigned volatile *) (pointer_to_destination), *(int long long unsigned *) (pointer_to_compare), *(int long long unsigned *) (pointer_to_new_destination) ); \ + LFDS700_PAL_BARRIER_COMPILER_FULL; \ + \ + result = (char unsigned) ( original_destination == *(int long long unsigned *) (pointer_to_compare) ); \ + \ + *(int long long unsigned *) (pointer_to_compare) = original_destination; \ + } + #endif + + #define LFDS700_PAL_ATOMIC_EXCHANGE( pointer_to_destination, pointer_to_exchange ) \ + { \ + /* LFDS700_PAL_ASSERT( (pointer_to_destination) != NULL ); */ \ + /* LFDS700_PAL_ASSERT( (pointer_to_exchange) != NULL ); */ \ + \ + LFDS700_PAL_BARRIER_COMPILER_FULL; \ + *( (lfds700_pal_atom_t *) pointer_to_exchange) = (lfds700_pal_atom_t) __sync_lock_test_and_set( pointer_to_destination, *(pointer_to_exchange) ); \ + LFDS700_PAL_BARRIER_COMPILER_FULL; \ + } + +#endif + + + + + +/****************************************************************************/ +#if( defined __GNUC__ && LFDS700_PAL_GCC_VERSION >= 473 ) + + /* TRD : GCC 4.7.3 and greater + + __GNUC__ indicates GCC + LFDS700_PAL_GCC_VERSION indicates which version + - __atomic_thread_fence requires 4.7.3 + + GCC 4.7.3 introduced the better __atomic*() atomic intrinsics + */ + + #ifdef LFDS700_PAL_PORTING_ABSTRACTION_LAYER_COMPILER + #error More than one porting abstraction layer matches the current platform in lfds700_porting_abstraction_layer_compiler.h + #endif + + #define LFDS700_PAL_PORTING_ABSTRACTION_LAYER_COMPILER + + #define LFDS700_PAL_COMPILER_STRING "GCC >= 4.7.3" + + #define LFDS700_PAL_ALIGN(alignment) __attribute__( (aligned(alignment)) ) + #define LFDS700_PAL_INLINE inline + + // TRD : GCC >= 4.7.3 compiler barriers are built into the intrinsics + #define LFDS700_PAL_NO_COMPILER_BARRIERS + + #define LFDS700_PAL_BARRIER_PROCESSOR_LOAD __atomic_thread_fence( __ATOMIC_ACQUIRE ) + #define LFDS700_PAL_BARRIER_PROCESSOR_STORE __atomic_thread_fence( __ATOMIC_RELEASE ) + #define LFDS700_PAL_BARRIER_PROCESSOR_FULL __atomic_thread_fence( __ATOMIC_ACQ_REL ) + + #define LFDS700_PAL_ATOMIC_CAS( pointer_to_destination, pointer_to_compare, new_destination, cas_strength, result ) \ + { \ + /* LFDS700_PAL_ASSERT( (pointer_to_destination) != NULL ); */ \ + /* LFDS700_PAL_ASSERT( (pointer_to_compare) != NULL ); */ \ + /* TRD : new_destination can be any value in its range */ \ + /* TRD : cas_strength can be any value in its range */ \ + /* TRD : result can be any value in its range */ \ + \ + result = (char unsigned) __atomic_compare_exchange_n( pointer_to_destination, (void *) (pointer_to_compare), (new_destination), (cas_strength), __ATOMIC_RELAXED, __ATOMIC_RELAXED ); \ + } + + // TRD : ARM and x86 have DWCAS which we can get via GCC intrinsics + #if( defined __arm__ || defined __i686__ || defined __i586__ || defined __i486__ ) + #define LFDS700_PAL_ATOMIC_DWCAS( pointer_to_destination, pointer_to_compare, pointer_to_new_destination, cas_strength, result ) \ + { \ + /* LFDS700_PAL_ASSERT( (pointer_to_destination) != NULL ); */ \ + /* LFDS700_PAL_ASSERT( (pointer_to_compare) != NULL ); */ \ + /* LFDS700_PAL_ASSERT( (pointer_to_new_destination) != NULL ); */ \ + /* TRD : cas_strength can be any value in its range */ \ + /* TRD : result can be any value in its range */ \ + \ + (result) = (char unsigned) __atomic_compare_exchange_n( (int long long unsigned volatile *) (pointer_to_destination), (int long long unsigned *) (pointer_to_compare), *(int long long unsigned *) (pointer_to_new_destination), (cas_strength), __ATOMIC_RELAXED, __ATOMIC_RELAXED ); \ + } + #endif + + #if( defined __x86_64__ ) + /* TRD : __GNUC__ indicates GCC + - __asm__ requires GCC + - __volatile__ requires GCC + __x86_64__ indicates x64 + - cmpxchg16b requires x64 + + On 64 bit platforms, unsigned long long int is 64 bit, so we must manually use cmpxchg16b, + as __sync_val_compare_and_swap() will only emit cmpxchg8b + */ + + // TRD : lfds700_pal_atom_t volatile (*destination)[2], lfds700_pal_atom_t (*compare)[2], lfds700_pal_atom_t (*new_destination)[2], enum lfds700_misc_cas_strength cas_strength, char unsigned result + + #define LFDS700_PAL_ATOMIC_DWCAS( pointer_to_destination, pointer_to_compare, pointer_to_new_destination, cas_strength, result ) \ + { \ + /* LFDS700_PAL_ASSERT( (pointer_to_destination) != NULL ); */ \ + /* LFDS700_PAL_ASSERT( (pointer_to_compare) != NULL ); */ \ + /* LFDS700_PAL_ASSERT( (pointer_to_new_destination) != NULL ); */ \ + /* TRD : cas_strength can be any value in its range */ \ + /* TRD : result can be any value in its range */ \ + \ + (result) = 0; \ + \ + __asm__ __volatile__ \ + ( \ + "lock;" /* make cmpxchg16b atomic */ \ + "cmpxchg16b %0;" /* cmpxchg16b sets ZF on success */ \ + "setz %3;" /* if ZF set, set result to 1 */ \ + \ + /* output */ \ + : "+m" (*pointer_to_destination), "+a" ((pointer_to_compare)[0]), "+d" ((pointer_to_compare)[1]), "=q" (result) \ + \ + /* input */ \ + : "b" ((pointer_to_new_destination)[0]), "c" ((pointer_to_new_destination)[1]) \ + \ + /* clobbered */ \ + : "cc", "memory" \ + ); \ + } + #endif + + #define LFDS700_PAL_ATOMIC_EXCHANGE( pointer_to_destination, pointer_to_exchange ) \ + { \ + /* LFDS700_PAL_ASSERT( (pointer_to_destination) != NULL ); */ \ + /* LFDS700_PAL_ASSERT( (pointer_to_exchange) != NULL ); */ \ + \ + *(pointer_to_exchange) = __atomic_exchange_n( (pointer_to_destination), *(pointer_to_exchange), __ATOMIC_RELAXED ); \ + } + +#endif + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/inc/liblfds700/lfds700_porting_abstraction_layer_operating_system.h b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/inc/liblfds700/lfds700_porting_abstraction_layer_operating_system.h new file mode 100644 index 0000000000..0c1eba628a --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/inc/liblfds700/lfds700_porting_abstraction_layer_operating_system.h @@ -0,0 +1,133 @@ +/****************************************************************************/ +#if( defined _MSC_VER ) + /* TRD : MSVC compiler + + an unfortunately necessary hack for MSVC + MSVC only defines __STDC__ if /Za is given, where /Za turns off MSVC C extensions - + which prevents Windows header files from compiling. + */ + + #define __STDC__ 1 + #define __STDC_HOSTED__ 1 +#endif + + + + + +/****************************************************************************/ +#if( defined _MSC_VER && _MSC_VER >= 1400 && __STDC_HOSTED__ == 1 && !defined _KERNEL_MODE ) + + // TRD : MSVC + + #ifdef LFDS700_PAL_PORTING_ABSTRACTION_LAYER_OPERATING_SYSTEM + #error More than one porting abstraction layer matches the current platform in lfds700_porting_abstraction_layer_operating_system.h + #endif + + #define LFDS700_PAL_PORTING_ABSTRACTION_LAYER_OPERATING_SYSTEM + + #include + + #define LFDS700_PAL_OS_STRING "Windows" + #define LFDS700_PAL_ASSERT( expression ) assert( expression ) + +#endif + + + + + +/****************************************************************************/ +#if( defined _MSC_VER && _MSC_VER >= 1400 && defined __STDC_HOSTED__ && __STDC_HOSTED__ == 1 && defined _WIN32 && defined _KERNEL_MODE ) + + // TRD : MSVC, Windows kernel-mode + + #ifdef LFDS700_PAL_PORTING_ABSTRACTION_LAYER_OPERATING_SYSTEM + #error More than one porting abstraction layer matches the current platform in lfds700_porting_abstraction_layer_operating_system.h + #endif + + #define LFDS700_PAL_PORTING_ABSTRACTION_LAYER_OPERATING_SYSTEM + + #include + #include + + #define LFDS700_PAL_OS_STRING "Windows" + #define LFDS700_PAL_ASSERT( expression ) assert( expression ) + +#endif + + + + + +/****************************************************************************/ +#if( defined __GNUC__ && __STDC_HOSTED__ == 1 && !(defined __linux__ && defined _KERNEL_MODE) ) + + // TRD : GCC, hosted implementation (except for Linux kernel mode) + + #ifdef LFDS700_PAL_PORTING_ABSTRACTION_LAYER_OPERATING_SYSTEM + #error More than one porting abstraction layer matches the current platform in lfds700_porting_abstraction_layer_operating_system.h + #endif + + #define LFDS700_PAL_PORTING_ABSTRACTION_LAYER_OPERATING_SYSTEM + + #include + + #define LFDS700_PAL_OS_STRING "Embedded (hosted)" + #define LFDS700_PAL_ASSERT( expression ) assert( expression ) + +#endif + + + + + +/****************************************************************************/ +#if( defined __GNUC__ && __STDC_HOSTED__ == 0 ) + + // TRD : GCC, freestanding or bare implementation + + #ifdef LFDS700_PAL_PORTING_ABSTRACTION_LAYER_OPERATING_SYSTEM + #error More than one porting abstraction layer matches the current platform in lfds700_porting_abstraction_layer_operating_system.h + #endif + + #define LFDS700_PAL_PORTING_ABSTRACTION_LAYER_OPERATING_SYSTEM + + #define LFDS700_PAL_OS_STRING "Embedded (freestanding/bare)" + #define LFDS700_PAL_ASSERT( expression ) + +#endif + + + + + +/****************************************************************************/ +#if( defined __GNUC__ && defined __linux__ && defined _KERNEL_MODE ) + + // TRD : GCC, Linux kernel-mode + + #ifdef LFDS700_PAL_PORTING_ABSTRACTION_LAYER_OPERATING_SYSTEM + #error More than one porting abstraction layer matches the current platform in lfds700_porting_abstraction_layer_operating_system.h + #endif + + #define LFDS700_PAL_PORTING_ABSTRACTION_LAYER_OPERATING_SYSTEM + + #include + + #define LFDS700_PAL_OS_STRING "Linux" + #define LFDS700_PAL_ASSERT( expression ) BUG_ON( expression ) + +#endif + + + + + +/****************************************************************************/ +#if( !defined LFDS700_PAL_PORTING_ABSTRACTION_LAYER_OPERATING_SYSTEM ) + + #error No matching porting abstraction layer in lfds700_porting_abstraction_layer_operating_system.h + +#endif + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/inc/liblfds700/lfds700_porting_abstraction_layer_processor.h b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/inc/liblfds700/lfds700_porting_abstraction_layer_processor.h new file mode 100644 index 0000000000..1e81c0eae2 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/inc/liblfds700/lfds700_porting_abstraction_layer_processor.h @@ -0,0 +1,544 @@ +/****************************************************************************/ +#if( defined _MSC_VER && _MSC_VER >= 1400 && defined _M_IX86 ) + + /* TRD : MSVC, x86 + x86 is CAS, so isolation is cache-line length + */ + + #ifdef LFDS700_PAL_PORTING_ABSTRACTION_LAYER_PROCESSOR + #error More than one porting abstraction layer matches the current platform in lfds700_porting_abstraction_layer_processor.h + #endif + + #define LFDS700_PAL_PORTING_ABSTRACTION_LAYER_PROCESSOR + + typedef int long unsigned lfds700_pal_atom_t; + typedef int long unsigned lfds700_pal_uint_t; + + #define LFDS700_PAL_PROCESSOR_STRING "x86" + + #define LFDS700_PAL_ALIGN_SINGLE_POINTER 4 + #define LFDS700_PAL_ALIGN_DOUBLE_POINTER 8 + + #define LFDS700_PAL_CACHE_LINE_LENGTH_IN_BYTES 32 + #define LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES 32 + +#endif + + + + + +/****************************************************************************/ +#if( defined _MSC_VER && _MSC_VER >= 1400 && (defined _M_X64 || defined _M_AMD64) ) + + /* TRD : MSVC, x64 + x64 is CAS, so isolation is cache-line length + */ + + #ifdef LFDS700_PAL_PORTING_ABSTRACTION_LAYER_PROCESSOR + #error More than one porting abstraction layer matches the current platform in lfds700_porting_abstraction_layer_processor.h + #endif + + #define LFDS700_PAL_PORTING_ABSTRACTION_LAYER_PROCESSOR + + typedef int long long unsigned lfds700_pal_atom_t; + typedef int long long unsigned lfds700_pal_uint_t; + + #define LFDS700_PAL_PROCESSOR_STRING "x64" + + #define LFDS700_PAL_ALIGN_SINGLE_POINTER 8 + #define LFDS700_PAL_ALIGN_DOUBLE_POINTER 16 + + #define LFDS700_PAL_CACHE_LINE_LENGTH_IN_BYTES 64 + #define LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES 64 + +#endif + + + + + +/****************************************************************************/ +#if( defined _MSC_VER && _MSC_VER >= 1400 && defined _M_IA64 ) + + /* TRD : MSVC, Itanium + IA64 is CAS, so isolation is cache-line length + */ + + #ifdef LFDS700_PAL_PORTING_ABSTRACTION_LAYER_PROCESSOR + #error More than one porting abstraction layer matches the current platform in lfds700_porting_abstraction_layer_processor.h + #endif + + #define LFDS700_PAL_PORTING_ABSTRACTION_LAYER_PROCESSOR + + typedef int long long unsigned lfds700_pal_atom_t; + typedef int long long unsigned lfds700_pal_uint_t; + + #define LFDS700_PAL_PROCESSOR_STRING "IA64" + + #define LFDS700_PAL_ALIGN_SINGLE_POINTER 8 + #define LFDS700_PAL_ALIGN_DOUBLE_POINTER 16 + + #define LFDS700_PAL_CACHE_LINE_LENGTH_IN_BYTES 64 + #define LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES 64 + +#endif + + + + + + /****************************************************************************/ +#if( defined _MSC_VER && _MSC_VER >= 1400 && defined _M_ARM ) + + /* TRD : MSVC, 32-bit ARM + + ARM is LL/SC and uses a reservation granule of 8 to 2048 bytes + so the isolation value used here is worst-case - be sure to set + this correctly, otherwise structures are painfully large + */ + +#ifdef LFDS700_PAL_PORTING_ABSTRACTION_LAYER_PROCESSOR +#error More than one porting abstraction layer matches the current platform in lfds700_porting_abstraction_layer_processor.h +#endif + +#define LFDS700_PAL_PORTING_ABSTRACTION_LAYER_PROCESSOR + + typedef int long unsigned lfds700_pal_atom_t; + typedef int long unsigned lfds700_pal_uint_t; + +#define LFDS700_PAL_PROCESSOR_STRING "ARM (32-bit)" + +#define LFDS700_PAL_ALIGN_SINGLE_POINTER 4 +#define LFDS700_PAL_ALIGN_DOUBLE_POINTER 8 + +#define LFDS700_PAL_CACHE_LINE_LENGTH_IN_BYTES 32 +#define LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES 2048 + +#endif + + + + + +/****************************************************************************/ +#if( defined __GNUC__ && defined __arm__ ) + + /* TRD : GCC, 32-bit ARM + + ARM is LL/SC and uses a reservation granule of 8 to 2048 bytes + so the isolation value used here is worst-case - be sure to set + this correctly, otherwise structures are painfully large + */ + + #ifdef LFDS700_PAL_PORTING_ABSTRACTION_LAYER_PROCESSOR + #error More than one porting abstraction layer matches the current platform in lfds700_porting_abstraction_layer_processor.h + #endif + + #define LFDS700_PAL_PORTING_ABSTRACTION_LAYER_PROCESSOR + + typedef int long unsigned lfds700_pal_atom_t; + typedef int long unsigned lfds700_pal_uint_t; + + #define LFDS700_PAL_PROCESSOR_STRING "ARM (32-bit)" + + #define LFDS700_PAL_ALIGN_SINGLE_POINTER 4 + #define LFDS700_PAL_ALIGN_DOUBLE_POINTER 8 + + #define LFDS700_PAL_CACHE_LINE_LENGTH_IN_BYTES 32 + #define LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES 2048 + +#endif + + + + + +/****************************************************************************/ +#if( defined __GNUC__ && defined __aarch64__ ) + + /* TRD : GCC, 64-bit ARM + + ARM is LL/SC and uses a reservation granule of 8 to 2048 bytes + so the isolation value used here is worst-case - be sure to set + this correctly, otherwise structures are painfully large + */ + + #ifdef LFDS700_PAL_PORTING_ABSTRACTION_LAYER_PROCESSOR + #error More than one porting abstraction layer matches the current platform in lfds700_porting_abstraction_layer_processor.h + #endif + + #define LFDS700_PAL_PORTING_ABSTRACTION_LAYER_PROCESSOR + + typedef int long long unsigned lfds700_pal_atom_t; + typedef int long long unsigned lfds700_pal_uint_t; + + #define LFDS700_PAL_PROCESSOR_STRING "ARM (64-bit)" + + #define LFDS700_PAL_ALIGN_SINGLE_POINTER 8 + #define LFDS700_PAL_ALIGN_DOUBLE_POINTER 16 + + #define LFDS700_PAL_CACHE_LINE_LENGTH_IN_BYTES 64 + #define LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES 2048 + +#endif + + + + + +/****************************************************************************/ +#if( defined __GNUC__ && (defined __i686__ || defined __i586__ || defined __i486__) ) + + /* TRD : GCC, x86 + + x86 is CAS, so isolation is cache-line length + */ + + #ifdef LFDS700_PAL_PORTING_ABSTRACTION_LAYER_PROCESSOR + #error More than one porting abstraction layer matches the current platform in lfds700_porting_abstraction_layer_processor.h + #endif + + #define LFDS700_PAL_PORTING_ABSTRACTION_LAYER_PROCESSOR + + typedef int long unsigned lfds700_pal_atom_t; + typedef int long unsigned lfds700_pal_uint_t; + + #define LFDS700_PAL_PROCESSOR_STRING "x86" + + #define LFDS700_PAL_ALIGN_SINGLE_POINTER 4 + #define LFDS700_PAL_ALIGN_DOUBLE_POINTER 8 + + #define LFDS700_PAL_CACHE_LINE_LENGTH_IN_BYTES 32 + #define LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES 32 + +#endif + + + + + +/****************************************************************************/ +#if( defined __GNUC__ && defined __x86_64__ ) + + /* TRD : GCC, x86 + + x64 is CAS, so isolation is cache-line length + */ + + #ifdef LFDS700_PAL_PORTING_ABSTRACTION_LAYER_PROCESSOR + #error More than one porting abstraction layer matches the current platform in lfds700_porting_abstraction_layer_processor.h + #endif + + #define LFDS700_PAL_PORTING_ABSTRACTION_LAYER_PROCESSOR + + typedef int long long unsigned lfds700_pal_atom_t; + typedef int long long unsigned lfds700_pal_uint_t; + + #define LFDS700_PAL_PROCESSOR_STRING "x64" + + #define LFDS700_PAL_ALIGN_SINGLE_POINTER 8 + #define LFDS700_PAL_ALIGN_DOUBLE_POINTER 16 + + #define LFDS700_PAL_CACHE_LINE_LENGTH_IN_BYTES 64 + #define LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES 64 + +#endif + + + + + +/****************************************************************************/ +#if( defined __GNUC__ && defined __alpha__ ) + + /* TRD : GCC, alpha + + alpha is LL/SC, but there is only one reservation per processor, + so the isolation value used here is cache-line length + */ + + #ifdef LFDS700_PAL_PORTING_ABSTRACTION_LAYER_PROCESSOR + #error More than one porting abstraction layer matches the current platform in lfds700_porting_abstraction_layer_processor.h + #endif + + #define LFDS700_PAL_PORTING_ABSTRACTION_LAYER_PROCESSOR + + typedef int long unsigned lfds700_pal_atom_t; + typedef int long unsigned lfds700_pal_uint_t; + + #define LFDS700_PAL_PROCESSOR_STRING "alpha" + + #define LFDS700_PAL_ALIGN_SINGLE_POINTER 8 + #define LFDS700_PAL_ALIGN_DOUBLE_POINTER 16 + + #define LFDS700_PAL_CACHE_LINE_LENGTH_IN_BYTES 32 + #define LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES 64 + +#endif + + + + + +/****************************************************************************/ +#if( defined __GNUC__ && defined __ia64__ ) + + /* TRD : GCC, Itanium + + Itanium is CAS, so isolation is cache-line length + */ + + #ifdef LFDS700_PAL_PORTING_ABSTRACTION_LAYER_PROCESSOR + #error More than one porting abstraction layer matches the current platform in lfds700_porting_abstraction_layer_processor.h + #endif + + #define LFDS700_PAL_PORTING_ABSTRACTION_LAYER_PROCESSOR + + typedef int long long unsigned lfds700_pal_atom_t; + typedef int long long unsigned lfds700_pal_uint_t; + + #define LFDS700_PAL_PROCESSOR_STRING "IA64" + + #define LFDS700_PAL_ALIGN_SINGLE_POINTER 8 + #define LFDS700_PAL_ALIGN_DOUBLE_POINTER 16 + + #define LFDS700_PAL_CACHE_LINE_LENGTH_IN_BYTES 64 + #define LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES 64 + +#endif + + + + + +/****************************************************************************/ +#if( defined __GNUC__ && defined __mips__ ) + + /* TRD : GCC, MIPS (32-bit) + + MIPS is LL/SC, but there is only one reservation per processor, + so the isolation value used here is cache-line length + */ + + #ifdef LFDS700_PAL_PORTING_ABSTRACTION_LAYER_PROCESSOR + #error More than one porting abstraction layer matches the current platform in lfds700_porting_abstraction_layer_processor.h + #endif + + #define LFDS700_PAL_PORTING_ABSTRACTION_LAYER_PROCESSOR + + typedef int long unsigned lfds700_pal_atom_t; + typedef int long unsigned lfds700_pal_uint_t; + + #define LFDS700_PAL_PROCESSOR_STRING "MIPS (32-bit)" + + #define LFDS700_PAL_ALIGN_SINGLE_POINTER 4 + #define LFDS700_PAL_ALIGN_DOUBLE_POINTER 8 + + #define LFDS700_PAL_CACHE_LINE_LENGTH_IN_BYTES 32 + #define LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES 32 + +#endif + + + + + +/****************************************************************************/ +#if( defined __GNUC__ && defined __mips64 ) + + /* TRD : GCC, MIPS (64-bit) + + MIPS is LL/SC, but there is only one reservation per processor, + so the isolation value used here is cache-line length + */ + + #ifdef LFDS700_PAL_PORTING_ABSTRACTION_LAYER_PROCESSOR + #error More than one porting abstraction layer matches the current platform in lfds700_porting_abstraction_layer_processor.h + #endif + + #define LFDS700_PAL_PORTING_ABSTRACTION_LAYER_PROCESSOR + + typedef int long long unsigned lfds700_pal_atom_t; + typedef int long long unsigned lfds700_pal_uint_t; + + #define LFDS700_PAL_PROCESSOR_STRING "MIPS (64-bit)" + + #define LFDS700_PAL_ALIGN_SINGLE_POINTER 8 + #define LFDS700_PAL_ALIGN_DOUBLE_POINTER 16 + + #define LFDS700_PAL_CACHE_LINE_LENGTH_IN_BYTES 64 + #define LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES 64 + +#endif + + + + + +/****************************************************************************/ +#if( defined __GNUC__ && defined __ppc__ ) + + /* TRD : GCC, POWERPC (32-bit) + + POWERPC is LL/SC and uses a reservation granule but I can't find + canonical documentation for its size - 128 bytes seems to be the + largest value I've found + */ + + #ifdef LFDS700_PAL_PORTING_ABSTRACTION_LAYER_PROCESSOR + #error More than one porting abstraction layer matches the current platform in lfds700_porting_abstraction_layer_processor.h + #endif + + #define LFDS700_PAL_PORTING_ABSTRACTION_LAYER_PROCESSOR + + typedef int long unsigned lfds700_pal_atom_t; + typedef int long unsigned lfds700_pal_uint_t; + + #define LFDS700_PAL_PROCESSOR_STRING "POWERPC (32-bit)" + + #define LFDS700_PAL_ALIGN_SINGLE_POINTER 4 + #define LFDS700_PAL_ALIGN_DOUBLE_POINTER 8 + + #define LFDS700_PAL_CACHE_LINE_LENGTH_IN_BYTES 32 + #define LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES 128 + +#endif + + + + + +/****************************************************************************/ +#if( defined __GNUC__ && defined __ppc64__ ) + + /* TRD : GCC, POWERPC (64-bit) + + POWERPC is LL/SC and uses a reservation granule but I can't find + canonical documentation for its size - 128 bytes seems to be the + largest value I've found + */ + + #ifdef LFDS700_PAL_PORTING_ABSTRACTION_LAYER_PROCESSOR + #error More than one porting abstraction layer matches the current platform in lfds700_porting_abstraction_layer_processor.h + #endif + + #define LFDS700_PAL_PORTING_ABSTRACTION_LAYER_PROCESSOR + + typedef int long long unsigned lfds700_pal_atom_t; + typedef int long long unsigned lfds700_pal_uint_t; + + #define LFDS700_PAL_PROCESSOR_STRING "POWERPC (64-bit)" + + #define LFDS700_PAL_ALIGN_SINGLE_POINTER 8 + #define LFDS700_PAL_ALIGN_DOUBLE_POINTER 16 + + #define LFDS700_PAL_CACHE_LINE_LENGTH_IN_BYTES 64 + #define LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES 128 + +#endif + + + + + +/****************************************************************************/ +#if( defined __GNUC__ && defined __sparc__ && !defined __sparc_v9__ ) + + /* TRD : GCC, SPARC (32-bit) + + SPARC is CAS, so isolation is cache-line length + */ + + #ifdef LFDS700_PAL_PORTING_ABSTRACTION_LAYER_PROCESSOR + #error More than one porting abstraction layer matches the current platform in lfds700_porting_abstraction_layer_processor.h + #endif + + #define LFDS700_PAL_PORTING_ABSTRACTION_LAYER_PROCESSOR + + typedef int long unsigned lfds700_pal_atom_t; + typedef int long unsigned lfds700_pal_uint_t; + + #define LFDS700_PAL_PROCESSOR_STRING "SPARC (32-bit)" + + #define LFDS700_PAL_ALIGN_SINGLE_POINTER 4 + #define LFDS700_PAL_ALIGN_DOUBLE_POINTER 8 + + #define LFDS700_PAL_CACHE_LINE_LENGTH_IN_BYTES 32 + #define LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES 32 + +#endif + + + + + +/****************************************************************************/ +#if( defined __GNUC__ && defined __sparc__ && defined __sparc_v9__ ) + + /* TRD : GCC, SPARC (64-bit) + + SPARC is CAS, so isolation is cache-line length + */ + + #ifdef LFDS700_PAL_PORTING_ABSTRACTION_LAYER_PROCESSOR + #error More than one porting abstraction layer matches the current platform in lfds700_porting_abstraction_layer_processor.h + #endif + + #define LFDS700_PAL_PORTING_ABSTRACTION_LAYER_PROCESSOR + + typedef int long long unsigned lfds700_pal_atom_t; + typedef int long long unsigned lfds700_pal_uint_t; + + #define LFDS700_PAL_PROCESSOR_STRING "SPARC (64-bit)" + + #define LFDS700_PAL_ALIGN_SINGLE_POINTER 8 + #define LFDS700_PAL_ALIGN_DOUBLE_POINTER 16 + + #define LFDS700_PAL_CACHE_LINE_LENGTH_IN_BYTES 64 + #define LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES 64 + +#endif + + + + + +/****************************************************************************/ +#if( defined __GNUC__ && defined __m68k__ ) + + /* TRD : GCC, 680x0 + + 680x0 is CAS, so isolation is cache-line length + */ + + #ifdef LFDS700_PAL_PORTING_ABSTRACTION_LAYER_PROCESSOR + #error More than one porting abstraction layer matches the current platform in lfds700_porting_abstraction_layer_processor.h + #endif + + #define LFDS700_PAL_PORTING_ABSTRACTION_LAYER_PROCESSOR + + typedef int long unsigned lfds700_pal_atom_t; + typedef int long unsigned lfds700_pal_uint_t; + + #define LFDS700_PAL_PROCESSOR_STRING "680x0" + + #define LFDS700_PAL_ALIGN_SINGLE_POINTER 4 + #define LFDS700_PAL_ALIGN_DOUBLE_POINTER 8 + + #define LFDS700_PAL_CACHE_LINE_LENGTH_IN_BYTES 32 + #define LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES 32 + +#endif + + + + + +/****************************************************************************/ +#if( !defined LFDS700_PAL_PORTING_ABSTRACTION_LAYER_PROCESSOR ) + + #error No matching porting abstraction layer in lfds700_porting_abstraction_layer_processor.h + +#endif + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/inc/liblfds700/lfds700_queue.h b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/inc/liblfds700/lfds700_queue.h new file mode 100644 index 0000000000..025b0673e9 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/inc/liblfds700/lfds700_queue.h @@ -0,0 +1,60 @@ +/***** defines *****/ +#define LFDS700_QUEUE_GET_KEY_FROM_ELEMENT( queue_element ) ( (queue_element).key ) +#define LFDS700_QUEUE_SET_KEY_IN_ELEMENT( queue_element, new_key ) ( (queue_element).key = (void *) (lfds700_pal_uint_t) (new_key) ) +#define LFDS700_QUEUE_GET_VALUE_FROM_ELEMENT( queue_element ) ( (queue_element).value ) +#define LFDS700_QUEUE_SET_VALUE_IN_ELEMENT( queue_element, new_value ) ( (queue_element).value = (void *) (lfds700_pal_uint_t) (new_value) ) +#define LFDS700_QUEUE_GET_USER_STATE_FROM_STATE( queue_state ) ( (queue_state).user_state ) + +/***** enums *****/ +enum lfds700_queue_query +{ + LFDS700_QUEUE_QUERY_SINGLETHREADED_GET_COUNT, + LFDS700_QUEUE_QUERY_SINGLETHREADED_VALIDATE +}; + +/***** structures *****/ +struct lfds700_queue_element +{ + struct lfds700_queue_element LFDS700_PAL_ALIGN(LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES) + *volatile next[PAC_SIZE]; + + void LFDS700_PAL_ALIGN(LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES) + *key; + + void + *value; +}; + +struct lfds700_queue_state +{ + struct lfds700_queue_element LFDS700_PAL_ALIGN(LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES) + *volatile enqueue[PAC_SIZE], + *volatile dequeue[PAC_SIZE]; + + void LFDS700_PAL_ALIGN(LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES) + *user_state; +}; + +/***** public prototypes *****/ +void lfds700_queue_init_valid_on_current_logical_core( struct lfds700_queue_state *qs, + struct lfds700_queue_element *qe_dummy, + struct lfds700_misc_prng_state *ps, + void *user_state ); + // TRD : used in conjunction with the #define LFDS700_MISC_MAKE_VALID_ON_CURRENT_LOGICAL_CORE_INITS_COMPLETED_BEFORE_NOW_ON_ANY_OTHER_LOGICAL_CORE + +void lfds700_queue_cleanup( struct lfds700_queue_state *qs, + void (*element_cleanup_callback)(struct lfds700_queue_state *qs, struct lfds700_queue_element *qe, enum lfds700_misc_flag dummy_element_flag) ); + +void lfds700_queue_enqueue( struct lfds700_queue_state *qs, + struct lfds700_queue_element *qe, + struct lfds700_misc_prng_state *ps ); + +int lfds700_queue_dequeue( struct lfds700_queue_state *qs, + struct lfds700_queue_element **qe, + struct lfds700_misc_prng_state *ps ); + +void lfds700_queue_query( struct lfds700_queue_state *qs, + enum lfds700_queue_query query_type, + void *query_input, + void *query_output ); + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/inc/liblfds700/lfds700_queue_bounded_singleconsumer_singleproducer.h b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/inc/liblfds700/lfds700_queue_bounded_singleconsumer_singleproducer.h new file mode 100644 index 0000000000..3b090e1d45 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/inc/liblfds700/lfds700_queue_bounded_singleconsumer_singleproducer.h @@ -0,0 +1,59 @@ +/***** defines *****/ +#define LFDS700_QUEUE_BSS_GET_USER_STATE_FROM_STATE( queue_bss_state ) ( (queue_bss_state).user_state ) + +/***** enums *****/ +enum lfds700_queue_bss_query +{ + LFDS700_QUEUE_BSS_QUERY_GET_POTENTIALLY_INACCURATE_COUNT, + LFDS700_QUEUE_BSS_QUERY_VALIDATE +}; + +/***** structures *****/ +struct lfds700_queue_bss_element +{ + void + *volatile key, + *volatile value; +}; + +struct lfds700_queue_bss_state +{ + lfds700_pal_uint_t + number_elements, + mask; + + lfds700_pal_uint_t volatile + read_index, + write_index; + + struct lfds700_queue_bss_element + *element_array; + + void + *user_state; +}; + +/***** public prototypes *****/ +void lfds700_queue_bss_init_valid_on_current_logical_core( struct lfds700_queue_bss_state *qbsss, + struct lfds700_queue_bss_element *element_array, + lfds700_pal_uint_t number_elements, + void *user_state ); + // TRD : number_elements must be a positive integer power of 2 + // TRD : used in conjunction with the #define LFDS700_MISC_MAKE_VALID_ON_CURRENT_LOGICAL_CORE_INITS_COMPLETED_BEFORE_NOW_ON_ANY_OTHER_LOGICAL_CORE + +void lfds700_queue_bss_cleanup( struct lfds700_queue_bss_state *qbsss, + void (*element_cleanup_callback)(struct lfds700_queue_bss_state *qbsss, void *key, void *value) ); + +int lfds700_queue_bss_enqueue( struct lfds700_queue_bss_state *qbsss, + void *key, + void *value ); + +int lfds700_queue_bss_dequeue( struct lfds700_queue_bss_state *qbsss, + void **key, + void **value ); + +void lfds700_queue_bss_query( struct lfds700_queue_bss_state *qbsss, + enum lfds700_queue_bss_query query_type, + void *query_input, + void *query_output ); + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/inc/liblfds700/lfds700_ringbuffer.h b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/inc/liblfds700/lfds700_ringbuffer.h new file mode 100644 index 0000000000..fbb21d2be4 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/inc/liblfds700/lfds700_ringbuffer.h @@ -0,0 +1,69 @@ +/***** enums *****/ +#define LFDS700_RINGBUFFER_GET_USER_STATE_FROM_STATE( ringbuffer_state ) ( (ringbuffer_state).user_state ) + +/***** enums *****/ +enum lfds700_ringbuffer_query +{ + LFDS700_RINGBUFFER_QUERY_SINGLETHREADED_GET_COUNT, + LFDS700_RINGBUFFER_QUERY_SINGLETHREADED_VALIDATE +}; + +/***** structures *****/ +struct lfds700_ringbuffer_element +{ + struct lfds700_freelist_element LFDS700_PAL_ALIGN(LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES) + fe; + + struct lfds700_queue_element LFDS700_PAL_ALIGN(LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES) + qe; + + struct lfds700_queue_element + *qe_use; // TRD : hack for 7.0.0; we need a new queue with no dummy element + + void + *key, + *value; +}; + +struct lfds700_ringbuffer_state +{ + struct lfds700_freelist_state LFDS700_PAL_ALIGN(LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES) + fs; + + struct lfds700_queue_state LFDS700_PAL_ALIGN(LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES) + qs; + + void + (*element_cleanup_callback)( struct lfds700_ringbuffer_state *rs, void *key, void *value, enum lfds700_misc_flag unread_flag ), + *user_state; +}; + +/***** public prototypes *****/ +void lfds700_ringbuffer_init_valid_on_current_logical_core( struct lfds700_ringbuffer_state *rs, + struct lfds700_ringbuffer_element *re_array_inc_dummy, + lfds700_pal_uint_t number_elements, + struct lfds700_misc_prng_state *ps, + void *user_state ); + // TRD : used in conjunction with the #define LFDS700_MISC_MAKE_VALID_ON_CURRENT_LOGICAL_CORE_INITS_COMPLETED_BEFORE_NOW_ON_ANY_OTHER_LOGICAL_CORE + +void lfds700_ringbuffer_cleanup( struct lfds700_ringbuffer_state *rs, + void (*element_cleanup_callback)(struct lfds700_ringbuffer_state *rs, void *key, void *value, enum lfds700_misc_flag unread_flag) ); + +int lfds700_ringbuffer_read( struct lfds700_ringbuffer_state *rs, + void **key, + void **value, + struct lfds700_misc_prng_state *ps ); + +void lfds700_ringbuffer_write( struct lfds700_ringbuffer_state *rs, + void *key, + void *value, + enum lfds700_misc_flag *overwrite_occurred_flag, + void **overwritten_key, + void **overwritten_value, + struct lfds700_misc_prng_state *ps ); + +void lfds700_ringbuffer_query( struct lfds700_ringbuffer_state *rs, + enum lfds700_ringbuffer_query query_type, + void *query_input, + void *query_output ); + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/inc/liblfds700/lfds700_stack.h b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/inc/liblfds700/lfds700_stack.h new file mode 100644 index 0000000000..3faed80308 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/inc/liblfds700/lfds700_stack.h @@ -0,0 +1,55 @@ +/***** defines *****/ +#define LFDS700_STACK_GET_KEY_FROM_ELEMENT( stack_element ) ( (stack_element).key ) +#define LFDS700_STACK_SET_KEY_IN_ELEMENT( stack_element, new_key ) ( (stack_element).key = (void *) (lfds700_pal_uint_t) (new_key) ) +#define LFDS700_STACK_GET_VALUE_FROM_ELEMENT( stack_element ) ( (stack_element).value ) +#define LFDS700_STACK_SET_VALUE_IN_ELEMENT( stack_element, new_value ) ( (stack_element).value = (void *) (lfds700_pal_uint_t) (new_value) ) +#define LFDS700_STACK_GET_USER_STATE_FROM_STATE( stack_state ) ( (stack_state).user_state ) + +/***** enums *****/ +enum lfds700_stack_query +{ + LFDS700_STACK_QUERY_SINGLETHREADED_GET_COUNT, + LFDS700_STACK_QUERY_SINGLETHREADED_VALIDATE +}; + +/***** structures *****/ +struct lfds700_stack_element +{ + struct lfds700_stack_element + *volatile next; + + void + *key, + *value; +}; + +struct lfds700_stack_state +{ + struct lfds700_stack_element LFDS700_PAL_ALIGN(LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES) + *volatile top[PAC_SIZE]; + + void LFDS700_PAL_ALIGN(LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES) + *user_state; +}; + +/***** public prototypes *****/ +void lfds700_stack_init_valid_on_current_logical_core( struct lfds700_stack_state *ss, void *user_state ); + // TRD : used in conjunction with the #define LFDS700_MISC_MAKE_VALID_ON_CURRENT_LOGICAL_CORE_INITS_COMPLETED_BEFORE_NOW_ON_ANY_OTHER_LOGICAL_CORE + +void lfds700_stack_cleanup( struct lfds700_stack_state *ss, + void (*element_cleanup_callback)(struct lfds700_stack_state *ss, struct lfds700_stack_element *se) ); + +void lfds700_stack_push( struct lfds700_stack_state *ss, + struct lfds700_stack_element *se, + struct lfds700_misc_prng_state *ps ); + +int lfds700_stack_pop( struct lfds700_stack_state *ss, + struct lfds700_stack_element **se, + struct lfds700_misc_prng_state *ps ); + +void lfds700_stack_query( struct lfds700_stack_state *ss, + enum lfds700_stack_query query_type, + void *query_input, + void *query_output ); + + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_btree_addonly_unbalanced/lfds700_btree_addonly_unbalanced_cleanup.c b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_btree_addonly_unbalanced/lfds700_btree_addonly_unbalanced_cleanup.c new file mode 100644 index 0000000000..2927c98628 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_btree_addonly_unbalanced/lfds700_btree_addonly_unbalanced_cleanup.c @@ -0,0 +1,117 @@ +/***** includes *****/ +#include "lfds700_btree_addonly_unbalanced_internal.h" + + + + + +/****************************************************************************/ +void lfds700_btree_au_cleanup( struct lfds700_btree_au_state *baus, + void (*element_cleanup_callback)(struct lfds700_btree_au_state *baus, struct lfds700_btree_au_element *baue) ) +{ + enum lfds700_btree_au_delete_action + delete_action = LFDS700_BTREE_AU_DELETE_SELF; // TRD : to remove compiler warning + + struct lfds700_btree_au_element + *baue; + + struct lfds700_btree_au_element + *temp; + + LFDS700_PAL_ASSERT( baus != NULL ); + // TRD : element_delete_function can be NULL + + /* TRD : we're not lock-free now, so delete at will + but be iterative, so can be used in kernels (where there's little stack) + and be performant, since the user may be + creating/destroying many of these trees + also remember the user may be deallocating user data + so we cannot visit an element twice + + we start at the root and iterate till we go to NULL + if the element has zero children, we delete it and move up to its parent + if the element has one child, we delete it, move its child into its place, and continue from its child + if the element has two children, we move left + + the purpose of this is to minimize walking around the tree + to prevent visiting an element twice + while also minimizing code complexity + */ + + if( element_cleanup_callback == NULL ) + return; + + LFDS700_MISC_BARRIER_LOAD; + + lfds700_btree_au_get_by_absolute_position( baus, &baue, LFDS700_BTREE_AU_ABSOLUTE_POSITION_ROOT ); + + while( baue != NULL ) + { + if( baue->left == NULL and baue->right == NULL ) + delete_action = LFDS700_BTREE_AU_DELETE_SELF; + + if( baue->left != NULL and baue->right == NULL ) + delete_action = LFDS700_BTREE_AU_DELETE_SELF_REPLACE_WITH_LEFT_CHILD; + + if( baue->left == NULL and baue->right != NULL ) + delete_action = LFDS700_BTREE_AU_DELETE_SELF_REPLACE_WITH_RIGHT_CHILD; + + if( baue->left != NULL and baue->right != NULL ) + delete_action = LFDS700_BTREE_AU_DELETE_MOVE_LEFT; + + switch( delete_action ) + { + case LFDS700_BTREE_AU_DELETE_SELF: + // TRD : if we have a parent (we could be root) set his point to us to NULL + if( baue->up != NULL ) + { + if( baue->up->left == baue ) + baue->up->left = NULL; + if( baue->up->right == baue ) + baue->up->right = NULL; + } + + temp = baue; + lfds700_btree_au_get_by_relative_position( &baue, LFDS700_BTREE_AU_RELATIVE_POSITION_UP ); + element_cleanup_callback( baus, temp ); + break; + + case LFDS700_BTREE_AU_DELETE_SELF_REPLACE_WITH_LEFT_CHILD: + baue->left->up = baue->up; + if( baue->up != NULL ) + { + if( baue->up->left == baue ) + baue->up->left = baue->left; + if( baue->up->right == baue ) + baue->up->right = baue->left; + } + + temp = baue; + lfds700_btree_au_get_by_relative_position( &baue, LFDS700_BTREE_AU_RELATIVE_POSITION_LEFT ); + element_cleanup_callback( baus, temp ); + break; + + case LFDS700_BTREE_AU_DELETE_SELF_REPLACE_WITH_RIGHT_CHILD: + baue->right->up = baue->up; + if( baue->up != NULL ) + { + if( baue->up->left == baue ) + baue->up->left = baue->right; + if( baue->up->right == baue ) + baue->up->right = baue->right; + } + + temp = baue; + lfds700_btree_au_get_by_relative_position( &baue, LFDS700_BTREE_AU_RELATIVE_POSITION_RIGHT ); + element_cleanup_callback( baus, temp ); + break; + + case LFDS700_BTREE_AU_DELETE_MOVE_LEFT: + lfds700_btree_au_get_by_relative_position( &baue, LFDS700_BTREE_AU_RELATIVE_POSITION_LEFT ); + break; + } + } + + return; +} + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_btree_addonly_unbalanced/lfds700_btree_addonly_unbalanced_get.c b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_btree_addonly_unbalanced/lfds700_btree_addonly_unbalanced_get.c new file mode 100644 index 0000000000..8a2cdf93e8 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_btree_addonly_unbalanced/lfds700_btree_addonly_unbalanced_get.c @@ -0,0 +1,467 @@ +/***** includes *****/ +#include "lfds700_btree_addonly_unbalanced_internal.h" + +/***** private prototypes *****/ +static void lfds700_btree_au_internal_inorder_walk_from_largest_get_next_smallest_element( struct lfds700_btree_au_element **baue ); +static void lfds700_btree_au_internal_inorder_walk_from_smallest_get_next_largest_element( struct lfds700_btree_au_element **baue ); + + + + + +/****************************************************************************/ +int lfds700_btree_au_get_by_key( struct lfds700_btree_au_state *baus, + void *key, + struct lfds700_btree_au_element **baue ) +{ + int + compare_result = !0, + rv = 1; + + LFDS700_PAL_ASSERT( baus != NULL ); + // TRD : key can be NULL + LFDS700_PAL_ASSERT( baue != NULL ); + + LFDS700_MISC_BARRIER_LOAD; + + *baue = baus->root; + + LFDS700_MISC_BARRIER_LOAD; + + while( *baue != NULL and compare_result != 0 ) + { + compare_result = baus->key_compare_function( key, (*baue)->key ); + + if( compare_result < 0 ) + { + *baue = (*baue)->left; + LFDS700_MISC_BARRIER_LOAD; + } + + if( compare_result > 0 ) + { + *baue = (*baue)->right; + LFDS700_MISC_BARRIER_LOAD; + } + } + + if( *baue == NULL ) + rv = 0; + + return( rv ); +} + + + + + +/****************************************************************************/ +int lfds700_btree_au_get_by_absolute_position( struct lfds700_btree_au_state *baus, struct lfds700_btree_au_element **baue, enum lfds700_btree_au_absolute_position absolute_position ) +{ + int + rv = 1; + + LFDS700_PAL_ASSERT( baus != NULL ); + LFDS700_PAL_ASSERT( baue != NULL ); + // TRD : absolute_position can be any value in its range + + LFDS700_MISC_BARRIER_LOAD; + + *baue = baus->root; + + LFDS700_MISC_BARRIER_LOAD; + + switch( absolute_position ) + { + case LFDS700_BTREE_AU_ABSOLUTE_POSITION_ROOT: + break; + + case LFDS700_BTREE_AU_ABSOLUTE_POSITION_LARGEST_IN_TREE: + if( *baue != NULL ) + while( (*baue)->right != NULL ) + { + *baue = (*baue)->right; + LFDS700_MISC_BARRIER_LOAD; + } + break; + + case LFDS700_BTREE_AU_ABSOLUTE_POSITION_SMALLEST_IN_TREE: + if( *baue != NULL ) + while( (*baue)->left != NULL ) + { + *baue = (*baue)->left; + LFDS700_MISC_BARRIER_LOAD; + } + break; + } + + if( *baue == NULL ) + rv = 0; + + return( rv ); +} + + + + + +/****************************************************************************/ +int lfds700_btree_au_get_by_relative_position( struct lfds700_btree_au_element **baue, enum lfds700_btree_au_relative_position relative_position ) +{ + int + rv = 1; + + LFDS700_PAL_ASSERT( baue != NULL ); + // TRD : relative_position can baue any value in its range + + if( *baue == NULL ) + return( 0 ); + + LFDS700_MISC_BARRIER_LOAD; + + switch( relative_position ) + { + case LFDS700_BTREE_AU_RELATIVE_POSITION_UP: + *baue = (*baue)->up; + // TRD : no load barrier - up already existed, so is known to be safely propagated + break; + + case LFDS700_BTREE_AU_RELATIVE_POSITION_LEFT: + *baue = (*baue)->left; + LFDS700_MISC_BARRIER_LOAD; + break; + + case LFDS700_BTREE_AU_RELATIVE_POSITION_RIGHT: + *baue = (*baue)->right; + LFDS700_MISC_BARRIER_LOAD; + break; + + case LFDS700_BTREE_AU_RELATIVE_POSITION_SMALLEST_ELEMENT_BELOW_CURRENT_ELEMENT: + *baue = (*baue)->left; + if( *baue != NULL ) + { + LFDS700_MISC_BARRIER_LOAD; + while( (*baue)->right != NULL ) + { + *baue = (*baue)->right; + LFDS700_MISC_BARRIER_LOAD; + } + } + break; + + case LFDS700_BTREE_AU_RELATIVE_POSITION_LARGEST_ELEMENT_BELOW_CURRENT_ELEMENT: + *baue = (*baue)->right; + if( *baue != NULL ) + { + LFDS700_MISC_BARRIER_LOAD; + while( (*baue)->left != NULL ) + { + *baue = (*baue)->left; + LFDS700_MISC_BARRIER_LOAD; + } + } + break; + + case LFDS700_BTREE_AU_RELATIVE_POSITION_NEXT_SMALLER_ELEMENT_IN_ENTIRE_TREE: + lfds700_btree_au_internal_inorder_walk_from_largest_get_next_smallest_element( baue ); + break; + + case LFDS700_BTREE_AU_RELATIVE_POSITION_NEXT_LARGER_ELEMENT_IN_ENTIRE_TREE: + lfds700_btree_au_internal_inorder_walk_from_smallest_get_next_largest_element( baue ); + break; + } + + if( *baue == NULL ) + rv = 0; + + return( rv ); +} + + + + + +/****************************************************************************/ +static void lfds700_btree_au_internal_inorder_walk_from_largest_get_next_smallest_element( struct lfds700_btree_au_element **baue ) +{ + enum lfds700_btree_au_move + action = LFDS700_BTREE_AU_MOVE_INVALID; + + enum lfds700_misc_flag + finished_flag = LFDS700_MISC_FLAG_LOWERED, + load_finished_flag = LFDS700_MISC_FLAG_LOWERED; + + struct lfds700_btree_au_element + *left = NULL, + *right = NULL, + *up = NULL, + *up_left = NULL, + *up_right = NULL; + + LFDS700_PAL_ASSERT( baue != NULL ); + + /* TRD : from any given element, the next smallest element is; + 1. if we have a left, it's the largest element on the right branch of our left child + 2. if we don't have a left, and we're on the right of our parent, then it's our parent + 3. if we don't have a left, and we're on the left of our parent or we have no parent, + iterative up the tree until we find the first child who is on the right of its parent; then it's the parent + */ + + /* TRD : we need to ensure the variables we use to decide our action are self-consistent + to do this, we make local copies of them all + then, if they are all not NULL, we can know they cannot change and we can continue + if however any of them are NULL, they could have changed while we were reading + and so our variables could be non-self-consistent + to check for this, we issue another processor read barrier + and then compare our local variables with the values in the tree + if they all match, then we know our variable set is self-consistent + (even though it may now be wrong - but we will discover this when we try the atomic operation) + */ + + LFDS700_MISC_BARRIER_LOAD; + + while( load_finished_flag == LFDS700_MISC_FLAG_LOWERED ) + { + left = (*baue)->left; + right = (*baue)->right; + up = (*baue)->up; + if( up != NULL ) + { + up_left = (*baue)->up->left; + up_right = (*baue)->up->right; + } + + if( left != NULL and right != NULL and (up == NULL or (up != NULL and up_left != NULL and up_right != NULL)) ) + break; + + LFDS700_MISC_BARRIER_LOAD; + + if( left == (*baue)->left and right == (*baue)->right and (up == NULL or (up != NULL and up == (*baue)->up and up_left == (*baue)->up->left and up_right == (*baue)->up->right)) ) + load_finished_flag = LFDS700_MISC_FLAG_RAISED; + } + + if( left != NULL ) + action = LFDS700_BTREE_AU_MOVE_LARGEST_FROM_LEFT_CHILD; + + if( left == NULL and up != NULL and up_right == *baue ) + action = LFDS700_BTREE_AU_MOVE_GET_PARENT; + + if( (left == NULL and up == NULL) or (up != NULL and up_left == *baue and left == NULL) ) + action = LFDS700_BTREE_AU_MOVE_MOVE_UP_TREE; + + switch( action ) + { + case LFDS700_BTREE_AU_MOVE_INVALID: + case LFDS700_BTREE_AU_MOVE_SMALLEST_FROM_RIGHT_CHILD: + // TRD : eliminates a compiler warning + break; + + case LFDS700_BTREE_AU_MOVE_LARGEST_FROM_LEFT_CHILD: + *baue = left; + if( *baue != NULL ) + { + LFDS700_MISC_BARRIER_LOAD; + while( (*baue)->right != NULL ) + { + *baue = (*baue)->right; + LFDS700_MISC_BARRIER_LOAD; + } + } + break; + + case LFDS700_BTREE_AU_MOVE_GET_PARENT: + *baue = up; + break; + + case LFDS700_BTREE_AU_MOVE_MOVE_UP_TREE: + while( finished_flag == LFDS700_MISC_FLAG_LOWERED ) + { + load_finished_flag = LFDS700_MISC_FLAG_LOWERED; + + while( load_finished_flag == LFDS700_MISC_FLAG_LOWERED ) + { + up = (*baue)->up; + if( up != NULL ) + up_left = (*baue)->up->left; + + if( up == NULL or (up != NULL and up_left != NULL) ) + break; + + LFDS700_MISC_BARRIER_LOAD; + + if( up == (*baue)->up and up_left == (*baue)->up->left ) + load_finished_flag = LFDS700_MISC_FLAG_RAISED; + } + + if( *baue != NULL and up != NULL and *baue == up_left ) + *baue = up; + else + finished_flag = LFDS700_MISC_FLAG_RAISED; + } + + *baue = up; + + /* + + while( *baue != NULL and (*baue)->up != NULL and *baue == (*baue)->up->left ) + *baue = (*baue)->up; + + *baue = (*baue)->up; + + */ + break; + } + + return; +} + + + + + +/****************************************************************************/ +static void lfds700_btree_au_internal_inorder_walk_from_smallest_get_next_largest_element( struct lfds700_btree_au_element **baue ) +{ + enum lfds700_btree_au_move + action = LFDS700_BTREE_AU_MOVE_INVALID; + + enum lfds700_misc_flag + finished_flag = LFDS700_MISC_FLAG_LOWERED, + load_finished_flag = LFDS700_MISC_FLAG_LOWERED; + + struct lfds700_btree_au_element + *left = NULL, + *right = NULL, + *up = NULL, + *up_left = NULL, + *up_right = NULL; + + LFDS700_PAL_ASSERT( baue != NULL ); + + /* TRD : from any given element, the next largest element is; + 1. if we have a right, it's the smallest element on the left branch of our right child + 2. if we don't have a right, and we're on the left of our parent, then it's our parent + 3. if we don't have a right, and we're on the right of our parent or we have no parent, + iterate up the tree until we find the first child who is on the left of its parent; then it's the parent + */ + + LFDS700_MISC_BARRIER_LOAD; + + while( load_finished_flag == LFDS700_MISC_FLAG_LOWERED ) + { + left = (*baue)->left; + right = (*baue)->right; + up = (*baue)->up; + if( up != NULL ) + { + up_left = (*baue)->up->left; + up_right = (*baue)->up->right; + } + + if( left != NULL and right != NULL and (up == NULL or (up != NULL and up_left != NULL and up_right != NULL)) ) + break; + + LFDS700_MISC_BARRIER_LOAD; + + if( left == (*baue)->left and right == (*baue)->right and (up == NULL or (up != NULL and up == (*baue)->up and up_left == (*baue)->up->left and up_right == (*baue)->up->right)) ) + load_finished_flag = LFDS700_MISC_FLAG_RAISED; + } + + if( right != NULL ) + action = LFDS700_BTREE_AU_MOVE_SMALLEST_FROM_RIGHT_CHILD; + + if( right == NULL and up != NULL and up_left == *baue ) + action = LFDS700_BTREE_AU_MOVE_GET_PARENT; + + if( (right == NULL and up == NULL) or (up != NULL and up_right == *baue and right == NULL) ) + action = LFDS700_BTREE_AU_MOVE_MOVE_UP_TREE; + + switch( action ) + { + case LFDS700_BTREE_AU_MOVE_INVALID: + case LFDS700_BTREE_AU_MOVE_LARGEST_FROM_LEFT_CHILD: + // TRD : remove compiler warning + break; + + case LFDS700_BTREE_AU_MOVE_SMALLEST_FROM_RIGHT_CHILD: + *baue = right; + if( *baue != NULL ) + { + LFDS700_MISC_BARRIER_LOAD; + while( (*baue)->left != NULL ) + { + *baue = (*baue)->left; + LFDS700_MISC_BARRIER_LOAD; + } + } + break; + + case LFDS700_BTREE_AU_MOVE_GET_PARENT: + *baue = up; + break; + + case LFDS700_BTREE_AU_MOVE_MOVE_UP_TREE: + while( finished_flag == LFDS700_MISC_FLAG_LOWERED ) + { + load_finished_flag = LFDS700_MISC_FLAG_LOWERED; + + while( load_finished_flag == LFDS700_MISC_FLAG_LOWERED ) + { + up = (*baue)->up; + if( up != NULL ) + up_right = (*baue)->up->right; + + if( up == NULL or (up != NULL and up_right != NULL) ) + break; + + LFDS700_MISC_BARRIER_LOAD; + + if( up == (*baue)->up and up_right == (*baue)->up->right ) + load_finished_flag = LFDS700_MISC_FLAG_RAISED; + } + + if( *baue != NULL and up != NULL and *baue == up_right ) + *baue = up; + else + finished_flag = LFDS700_MISC_FLAG_RAISED; + } + + *baue = up; + + /* + + while( *baue != NULL and (*baue)->up != NULL and *baue == (*baue)->up->right ) + *baue = (*baue)->up; + + *baue = (*baue)->up; + + */ + break; + } + + return; +} + + + + + +/****************************************************************************/ +int lfds700_btree_au_get_by_absolute_position_and_then_by_relative_position( struct lfds700_btree_au_state *baus, struct lfds700_btree_au_element **baue, enum lfds700_btree_au_absolute_position absolute_position, enum lfds700_btree_au_relative_position relative_position ) +{ + int + rv; + + LFDS700_PAL_ASSERT( baus != NULL ); + LFDS700_PAL_ASSERT( baue != NULL ); + // TRD: absolute_position can be any value in its range + // TRD: relative_position can be any value in its range + + if( *baue == NULL ) + rv = lfds700_btree_au_get_by_absolute_position( baus, baue, absolute_position ); + else + rv = lfds700_btree_au_get_by_relative_position( baue, relative_position ); + + return( rv ); +} + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_btree_addonly_unbalanced/lfds700_btree_addonly_unbalanced_init.c b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_btree_addonly_unbalanced/lfds700_btree_addonly_unbalanced_init.c new file mode 100644 index 0000000000..7dd0efd6c0 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_btree_addonly_unbalanced/lfds700_btree_addonly_unbalanced_init.c @@ -0,0 +1,32 @@ +/***** includes *****/ +#include "lfds700_btree_addonly_unbalanced_internal.h" + + + + + +/****************************************************************************/ +void lfds700_btree_au_init_valid_on_current_logical_core( struct lfds700_btree_au_state *baus, + int (*key_compare_function)(void const *new_key, void const *existing_key), + enum lfds700_btree_au_existing_key existing_key, + void *user_state ) +{ + LFDS700_PAL_ASSERT( baus != NULL ); + LFDS700_PAL_ASSERT( (lfds700_pal_uint_t) &baus->root % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES == 0 ); + LFDS700_PAL_ASSERT( (lfds700_pal_uint_t) &baus->key_compare_function % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES == 0 ); + LFDS700_PAL_ASSERT( key_compare_function != NULL ); + // TRD : existing_key can be any value in its range + // TRD : user_state can be NULL + + baus->root = NULL; + baus->key_compare_function = key_compare_function; + baus->existing_key = existing_key; + baus->user_state = user_state; + + LFDS700_MISC_BARRIER_STORE; + + lfds700_misc_force_store(); + + return; +} + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_btree_addonly_unbalanced/lfds700_btree_addonly_unbalanced_insert.c b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_btree_addonly_unbalanced/lfds700_btree_addonly_unbalanced_insert.c new file mode 100644 index 0000000000..8808177a4c --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_btree_addonly_unbalanced/lfds700_btree_addonly_unbalanced_insert.c @@ -0,0 +1,156 @@ +/***** includes *****/ +#include "lfds700_btree_addonly_unbalanced_internal.h" + + + + + +/****************************************************************************/ +enum lfds700_btree_au_insert_result lfds700_btree_au_insert( struct lfds700_btree_au_state *baus, + struct lfds700_btree_au_element *baue, + struct lfds700_btree_au_element **existing_baue, + struct lfds700_misc_prng_state *ps ) +{ + char unsigned + result = 0; + + int + compare_result = 0; + + lfds700_pal_uint_t + backoff_iteration = LFDS700_MISC_ABSTRACTION_BACKOFF_INITIAL_VALUE; + + struct lfds700_btree_au_element + *volatile compare = NULL, + *volatile baue_next = NULL, + *volatile baue_parent = NULL, + *volatile baue_temp; + + LFDS700_PAL_ASSERT( baus != NULL ); + LFDS700_PAL_ASSERT( baue != NULL ); + LFDS700_PAL_ASSERT( (lfds700_pal_uint_t) &baue->left % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES == 0 ); + LFDS700_PAL_ASSERT( (lfds700_pal_uint_t) &baue->right % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES == 0 ); + LFDS700_PAL_ASSERT( (lfds700_pal_uint_t) &baue->up % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES == 0 ); + LFDS700_PAL_ASSERT( (lfds700_pal_uint_t) &baue->value % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES == 0 ); + LFDS700_PAL_ASSERT( (lfds700_pal_uint_t) &baue->key % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES == 0 ); + // TRD : existing_baue can be NULL + LFDS700_PAL_ASSERT( ps != NULL ); + + /* TRD : we follow a normal search for the insert node and which side to insert + + the difference is that insertion may fail because someone else inserts + there before we do + + in this case, we resume searching for the insert node from the node + we were attempting to insert upon + + (if we attempted to insert the root node and this failed, i.e. we thought + the tree was empty but then it wasn't, then we start searching from the + new root) + */ + + baue->up = baue->left = baue->right = NULL; + + LFDS700_MISC_BARRIER_LOAD; + + baue_temp = baus->root; + + LFDS700_MISC_BARRIER_LOAD; + + while( result == 0 ) + { + // TRD : first we find where to insert + while( baue_temp != NULL ) + { + compare_result = baus->key_compare_function( baue->key, baue_temp->key ); + + if( compare_result == 0 ) + { + if( existing_baue != NULL ) + *existing_baue = baue_temp; + + switch( baus->existing_key ) + { + case LFDS700_BTREE_AU_EXISTING_KEY_OVERWRITE: + LFDS700_BTREE_AU_SET_VALUE_IN_ELEMENT( *baue_temp, baue->value ); + return( LFDS700_BTREE_AU_INSERT_RESULT_SUCCESS_OVERWRITE ); + break; + + case LFDS700_BTREE_AU_EXISTING_KEY_FAIL: + return( LFDS700_BTREE_AU_INSERT_RESULT_FAILURE_EXISTING_KEY ); + break; + } + } + + if( compare_result < 0 ) + baue_next = baue_temp->left; + + if( compare_result > 0 ) + baue_next = baue_temp->right; + + baue_parent = baue_temp; + baue_temp = baue_next; + if( baue_temp != NULL ) + LFDS700_MISC_BARRIER_LOAD; + } + + /* TRD : second, we actually insert + + at this point baue_temp has come to NULL + and baue_parent is the element to insert at + and result of the last compare indicates + the direction of insertion + + it may be that another tree has already inserted an element with + the same key as ourselves, or other elements which mean our position + is now wrong + + in this case, it is either inserted in the position we're trying + to insert in now, in which case our insert will fail + + or, similarly, other elements will have come in where we are, + and our insert will fail + */ + + if( baue_parent == NULL ) + { + compare = NULL; + baue->up = baus->root; + LFDS700_MISC_BARRIER_STORE; + LFDS700_PAL_ATOMIC_CAS_WITH_BACKOFF( &baus->root, &compare, baue, LFDS700_MISC_CAS_STRENGTH_WEAK, result, backoff_iteration, ps ); + + if( result == 0 ) + baue_temp = baus->root; + } + + if( baue_parent != NULL ) + { + if( compare_result <= 0 ) + { + compare = NULL; + baue->up = baue_parent; + LFDS700_MISC_BARRIER_STORE; + LFDS700_PAL_ATOMIC_CAS_WITH_BACKOFF( &baue_parent->left, &compare, baue, LFDS700_MISC_CAS_STRENGTH_WEAK, result, backoff_iteration, ps ); + } + + if( compare_result > 0 ) + { + compare = NULL; + baue->up = baue_parent; + LFDS700_MISC_BARRIER_STORE; + LFDS700_PAL_ATOMIC_CAS_WITH_BACKOFF( &baue_parent->right, &compare, baue, LFDS700_MISC_CAS_STRENGTH_WEAK, result, backoff_iteration, ps ); + } + + // TRD : if the insert fails, resume searching at the insert node + if( result == 0 ) + baue_temp = baue_parent; + } + } + + // TRD : if we get to here, we added (not failed or overwrite on exist) a new element + if( existing_baue != NULL ) + *existing_baue = NULL; + + return( LFDS700_BTREE_AU_INSERT_RESULT_SUCCESS ); +} + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_btree_addonly_unbalanced/lfds700_btree_addonly_unbalanced_internal.h b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_btree_addonly_unbalanced/lfds700_btree_addonly_unbalanced_internal.h new file mode 100644 index 0000000000..54149bac99 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_btree_addonly_unbalanced/lfds700_btree_addonly_unbalanced_internal.h @@ -0,0 +1,23 @@ +/***** the library-wide header file *****/ +#include "../liblfds700_internal.h" + +/***** enums *****/ +enum lfds700_btree_au_move +{ + LFDS700_BTREE_AU_MOVE_INVALID, + LFDS700_BTREE_AU_MOVE_SMALLEST_FROM_RIGHT_CHILD, + LFDS700_BTREE_AU_MOVE_LARGEST_FROM_LEFT_CHILD, + LFDS700_BTREE_AU_MOVE_GET_PARENT, + LFDS700_BTREE_AU_MOVE_MOVE_UP_TREE +}; + +enum lfds700_btree_au_delete_action +{ + LFDS700_BTREE_AU_DELETE_SELF, + LFDS700_BTREE_AU_DELETE_SELF_REPLACE_WITH_LEFT_CHILD, + LFDS700_BTREE_AU_DELETE_SELF_REPLACE_WITH_RIGHT_CHILD, + LFDS700_BTREE_AU_DELETE_MOVE_LEFT +}; + +/***** private prototypes *****/ + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_btree_addonly_unbalanced/lfds700_btree_addonly_unbalanced_query.c b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_btree_addonly_unbalanced/lfds700_btree_addonly_unbalanced_query.c new file mode 100644 index 0000000000..dce9587929 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_btree_addonly_unbalanced/lfds700_btree_addonly_unbalanced_query.c @@ -0,0 +1,121 @@ +/***** includes *****/ +#include "lfds700_btree_addonly_unbalanced_internal.h" + +/***** private prototypes *****/ +static void lfds700_btree_au_internal_validate( struct lfds700_btree_au_state *abs, struct lfds700_misc_validation_info *vi, enum lfds700_misc_validity *lfds700_btree_au_validity ); + + + + + +/****************************************************************************/ +void lfds700_btree_au_query( struct lfds700_btree_au_state *baus, enum lfds700_btree_au_query query_type, void *query_input, void *query_output ) +{ + LFDS700_PAL_ASSERT( baus != NULL ); + // TRD : query_type can be any value in its range + + LFDS700_MISC_BARRIER_LOAD; + + switch( query_type ) + { + case LFDS700_BTREE_AU_QUERY_GET_POTENTIALLY_INACCURATE_COUNT: + { + struct lfds700_btree_au_element + *baue = NULL; + + LFDS700_PAL_ASSERT( query_input == NULL ); + LFDS700_PAL_ASSERT( query_output != NULL ); + + *(lfds700_pal_uint_t *) query_output = 0; + + while( lfds700_btree_au_get_by_absolute_position_and_then_by_relative_position(baus, &baue, LFDS700_BTREE_AU_ABSOLUTE_POSITION_SMALLEST_IN_TREE, LFDS700_BTREE_AU_RELATIVE_POSITION_NEXT_LARGER_ELEMENT_IN_ENTIRE_TREE) ) + ( *(lfds700_pal_uint_t *) query_output )++; + } + break; + + case LFDS700_BTREE_AU_QUERY_SINGLETHREADED_VALIDATE: + // TRD : query_input can be NULL + LFDS700_PAL_ASSERT( query_output != NULL ); + + lfds700_btree_au_internal_validate( baus, (struct lfds700_misc_validation_info *) query_input, (enum lfds700_misc_validity *) query_output ); + break; + } + + return; +} + + + + + +/****************************************************************************/ +static void lfds700_btree_au_internal_validate( struct lfds700_btree_au_state *baus, struct lfds700_misc_validation_info *vi, enum lfds700_misc_validity *lfds700_btree_au_validity ) +{ + lfds700_pal_uint_t + number_elements_from_query_tree = 0, + number_elements_from_walk = 0; + + struct lfds700_btree_au_element + *baue = NULL, + *baue_prev = NULL; + + LFDS700_PAL_ASSERT( baus!= NULL ); + // TRD : vi can be NULL + LFDS700_PAL_ASSERT( lfds700_btree_au_validity != NULL ); + + *lfds700_btree_au_validity = LFDS700_MISC_VALIDITY_VALID; + + /* TRD : validation is performed by; + + performing an in-order walk + we should see every element is larger than the preceeding element + we count elements as we go along (visited elements, that is) + and check our tally equals the expected count + */ + + LFDS700_MISC_BARRIER_LOAD; + + while( lfds700_btree_au_get_by_absolute_position_and_then_by_relative_position(baus, &baue, LFDS700_BTREE_AU_ABSOLUTE_POSITION_SMALLEST_IN_TREE, LFDS700_BTREE_AU_RELATIVE_POSITION_NEXT_LARGER_ELEMENT_IN_ENTIRE_TREE) ) + { + // TRD : baue_prev should always be smaller than or equal to baue + if( baue_prev != NULL ) + if( baus->key_compare_function(baue_prev->key, baue->key) > 0 ) + { + *lfds700_btree_au_validity = LFDS700_MISC_VALIDITY_INVALID_ORDER; + return; + } + + baue_prev = baue; + number_elements_from_walk++; + } + + if( *lfds700_btree_au_validity == LFDS700_MISC_VALIDITY_VALID ) + { + lfds700_btree_au_query( (struct lfds700_btree_au_state *) baus, LFDS700_BTREE_AU_QUERY_GET_POTENTIALLY_INACCURATE_COUNT, NULL, &number_elements_from_query_tree ); + + if( number_elements_from_walk > number_elements_from_query_tree ) + *lfds700_btree_au_validity = LFDS700_MISC_VALIDITY_INVALID_ADDITIONAL_ELEMENTS; + + if( number_elements_from_walk < number_elements_from_query_tree ) + *lfds700_btree_au_validity = LFDS700_MISC_VALIDITY_INVALID_MISSING_ELEMENTS; + } + + /* TRD : now check for expected number of elements + vi can be NULL, in which case we do not check + we know we don't have a loop from our earlier check + */ + + if( *lfds700_btree_au_validity == LFDS700_MISC_VALIDITY_VALID and vi != NULL ) + { + lfds700_btree_au_query( (struct lfds700_btree_au_state *) baus, LFDS700_BTREE_AU_QUERY_GET_POTENTIALLY_INACCURATE_COUNT, NULL, &number_elements_from_query_tree ); + + if( number_elements_from_query_tree < vi->min_elements ) + *lfds700_btree_au_validity = LFDS700_MISC_VALIDITY_INVALID_MISSING_ELEMENTS; + + if( number_elements_from_query_tree > vi->max_elements ) + *lfds700_btree_au_validity = LFDS700_MISC_VALIDITY_INVALID_ADDITIONAL_ELEMENTS; + } + + return; +} + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_freelist/lfds700_freelist_cleanup.c b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_freelist/lfds700_freelist_cleanup.c new file mode 100644 index 0000000000..f7a088a39a --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_freelist/lfds700_freelist_cleanup.c @@ -0,0 +1,36 @@ +/***** includes *****/ +#include "lfds700_freelist_internal.h" + + + + + +/****************************************************************************/ +void lfds700_freelist_cleanup( struct lfds700_freelist_state *fs, + void (*element_cleanup_callback)(struct lfds700_freelist_state *fs, struct lfds700_freelist_element *fe) ) +{ + struct lfds700_freelist_element + *fe, + *fe_temp; + + LFDS700_PAL_ASSERT( fs != NULL ); + // TRD : element_cleanup_callback can be NULL + + LFDS700_MISC_BARRIER_LOAD; + + if( element_cleanup_callback != NULL ) + { + fe = fs->top[POINTER]; + + while( fe != NULL ) + { + fe_temp = fe; + fe = fe->next; + + element_cleanup_callback( fs, fe_temp ); + } + } + + return; +} + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_freelist/lfds700_freelist_init.c b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_freelist/lfds700_freelist_init.c new file mode 100644 index 0000000000..fcacd1b32f --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_freelist/lfds700_freelist_init.c @@ -0,0 +1,27 @@ +/***** includes *****/ +#include "lfds700_freelist_internal.h" + + + + + +/****************************************************************************/ +void lfds700_freelist_init_valid_on_current_logical_core( struct lfds700_freelist_state *fs, void *user_state ) +{ + LFDS700_PAL_ASSERT( fs != NULL ); + LFDS700_PAL_ASSERT( (lfds700_pal_uint_t) fs->top % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES == 0 ); + LFDS700_PAL_ASSERT( (lfds700_pal_uint_t) &fs->user_state % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES == 0 ); + // TRD : user_state can be NULL + + fs->top[POINTER] = NULL; + fs->top[COUNTER] = 0; + + fs->user_state = user_state; + + LFDS700_MISC_BARRIER_STORE; + + lfds700_misc_force_store(); + + return; +} + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_freelist/lfds700_freelist_internal.h b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_freelist/lfds700_freelist_internal.h new file mode 100644 index 0000000000..7a7d541804 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_freelist/lfds700_freelist_internal.h @@ -0,0 +1,5 @@ +/***** the library wide include file *****/ +#include "../liblfds700_internal.h" + +/***** private prototypes *****/ + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_freelist/lfds700_freelist_pop.c b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_freelist/lfds700_freelist_pop.c new file mode 100644 index 0000000000..c0a3545d91 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_freelist/lfds700_freelist_pop.c @@ -0,0 +1,52 @@ +/***** includes *****/ +#include "lfds700_freelist_internal.h" + + + + + +/****************************************************************************/ +int lfds700_freelist_pop( struct lfds700_freelist_state *fs, struct lfds700_freelist_element **fe, struct lfds700_misc_prng_state *ps ) +{ + char unsigned + result; + + lfds700_pal_uint_t + backoff_iteration = LFDS700_MISC_ABSTRACTION_BACKOFF_INITIAL_VALUE; + + struct lfds700_freelist_element LFDS700_PAL_ALIGN(LFDS700_PAL_ALIGN_DOUBLE_POINTER) + *new_top[PAC_SIZE], + *volatile original_top[PAC_SIZE]; + + LFDS700_PAL_ASSERT( fs != NULL ); + LFDS700_PAL_ASSERT( fe != NULL ); + LFDS700_PAL_ASSERT( ps != NULL ); + + LFDS700_PAL_BARRIER_PROCESSOR_LOAD; + + original_top[COUNTER] = fs->top[COUNTER]; + original_top[POINTER] = fs->top[POINTER]; + + do + { + if( original_top[POINTER] == NULL ) + { + *fe = NULL; + return( 0 ); + } + + new_top[COUNTER] = original_top[COUNTER] + 1; + new_top[POINTER] = original_top[POINTER]->next; + + LFDS700_PAL_ATOMIC_DWCAS_WITH_BACKOFF( &fs->top, original_top, new_top, LFDS700_MISC_CAS_STRENGTH_WEAK, result, backoff_iteration, ps ); + + if( result != 1 ) + LFDS700_PAL_BARRIER_PROCESSOR_LOAD; + } + while( result != 1 ); + + *fe = original_top[POINTER]; + + return( 1 ); +} + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_freelist/lfds700_freelist_push.c b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_freelist/lfds700_freelist_push.c new file mode 100644 index 0000000000..67fe38dadb --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_freelist/lfds700_freelist_push.c @@ -0,0 +1,42 @@ +/***** includes *****/ +#include "lfds700_freelist_internal.h" + + + + + +/****************************************************************************/ +void lfds700_freelist_push( struct lfds700_freelist_state *fs, struct lfds700_freelist_element *fe, struct lfds700_misc_prng_state *ps ) +{ + char unsigned + result; + + lfds700_pal_uint_t + backoff_iteration = LFDS700_MISC_ABSTRACTION_BACKOFF_INITIAL_VALUE; + + struct lfds700_freelist_element LFDS700_PAL_ALIGN(LFDS700_PAL_ALIGN_DOUBLE_POINTER) + *new_top[PAC_SIZE], + *volatile original_top[PAC_SIZE]; + + LFDS700_PAL_ASSERT( fs != NULL ); + LFDS700_PAL_ASSERT( fe != NULL ); + LFDS700_PAL_ASSERT( ps != NULL ); + + new_top[POINTER] = fe; + + original_top[COUNTER] = fs->top[COUNTER]; + original_top[POINTER] = fs->top[POINTER]; + + do + { + new_top[COUNTER] = original_top[COUNTER] + 1; + fe->next = original_top[POINTER]; + + LFDS700_PAL_BARRIER_PROCESSOR_STORE; + LFDS700_PAL_ATOMIC_DWCAS_WITH_BACKOFF( &fs->top, original_top, new_top, LFDS700_MISC_CAS_STRENGTH_WEAK, result, backoff_iteration, ps ); + } + while( result != 1 ); + + return; +} + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_freelist/lfds700_freelist_query.c b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_freelist/lfds700_freelist_query.c new file mode 100644 index 0000000000..43b8bc263d --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_freelist/lfds700_freelist_query.c @@ -0,0 +1,123 @@ +/***** includes *****/ +#include "lfds700_freelist_internal.h" + +/***** private prototypes *****/ +static void lfds700_freelist_internal_freelist_validate( struct lfds700_freelist_state *fs, struct lfds700_misc_validation_info *vi, enum lfds700_misc_validity *lfds700_freelist_validity ); + + + + + +/****************************************************************************/ +void lfds700_freelist_query( struct lfds700_freelist_state *fs, enum lfds700_freelist_query query_type, void *query_input, void *query_output ) +{ + struct lfds700_freelist_element + *fe; + + LFDS700_PAL_ASSERT( fs != NULL ); + // TRD : query_type can be any value in its range + + LFDS700_MISC_BARRIER_LOAD; + + switch( query_type ) + { + case LFDS700_FREELIST_QUERY_SINGLETHREADED_GET_COUNT: + LFDS700_PAL_ASSERT( query_input == NULL ); + LFDS700_PAL_ASSERT( query_output != NULL ); + + *(lfds700_pal_uint_t *) query_output = 0; + + fe = (struct lfds700_freelist_element *) fs->top[POINTER]; + + while( fe != NULL ) + { + ( *(lfds700_pal_uint_t *) query_output )++; + fe = (struct lfds700_freelist_element *) fe->next; + } + break; + + case LFDS700_FREELIST_QUERY_SINGLETHREADED_VALIDATE: + // TRD : query_input can be NULL + LFDS700_PAL_ASSERT( query_output != NULL ); + + lfds700_freelist_internal_freelist_validate( fs, (struct lfds700_misc_validation_info *) query_input, (enum lfds700_misc_validity *) query_output ); + break; + } + + return; +} + + + + + +/****************************************************************************/ +static void lfds700_freelist_internal_freelist_validate( struct lfds700_freelist_state *fs, struct lfds700_misc_validation_info *vi, enum lfds700_misc_validity *lfds700_freelist_validity ) +{ + lfds700_pal_uint_t + number_elements = 0; + + struct lfds700_freelist_element + *fe_slow, + *fe_fast; + + LFDS700_PAL_ASSERT( fs != NULL ); + // TRD : vi can be NULL + LFDS700_PAL_ASSERT( lfds700_freelist_validity != NULL ); + + *lfds700_freelist_validity = LFDS700_MISC_VALIDITY_VALID; + + fe_slow = fe_fast = (struct lfds700_freelist_element *) fs->top[POINTER]; + + /* TRD : first, check for a loop + we have two pointers + both of which start at the top of the freelist + we enter a loop + and on each iteration + we advance one pointer by one element + and the other by two + + we exit the loop when both pointers are NULL + (have reached the end of the freelist) + + or + + if we fast pointer 'sees' the slow pointer + which means we have a loop + */ + + if( fe_slow != NULL ) + do + { + fe_slow = fe_slow->next; + + if( fe_fast != NULL ) + fe_fast = fe_fast->next; + + if( fe_fast != NULL ) + fe_fast = fe_fast->next; + } + while( fe_slow != NULL and fe_fast != fe_slow ); + + if( fe_fast != NULL and fe_slow != NULL and fe_fast == fe_slow ) + *lfds700_freelist_validity = LFDS700_MISC_VALIDITY_INVALID_LOOP; + + /* TRD : now check for expected number of elements + vi can be NULL, in which case we do not check + we know we don't have a loop from our earlier check + */ + + if( *lfds700_freelist_validity == LFDS700_MISC_VALIDITY_VALID and vi != NULL ) + { + lfds700_freelist_query( fs, LFDS700_FREELIST_QUERY_SINGLETHREADED_GET_COUNT, NULL, (void *) &number_elements ); + + if( number_elements < vi->min_elements ) + *lfds700_freelist_validity = LFDS700_MISC_VALIDITY_INVALID_MISSING_ELEMENTS; + + if( number_elements > vi->max_elements ) + *lfds700_freelist_validity = LFDS700_MISC_VALIDITY_INVALID_ADDITIONAL_ELEMENTS; + } + + return; +} + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_hash_addonly/lfds700_hash_addonly_cleanup.c b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_hash_addonly/lfds700_hash_addonly_cleanup.c new file mode 100644 index 0000000000..af88b19179 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_hash_addonly/lfds700_hash_addonly_cleanup.c @@ -0,0 +1,61 @@ +/***** includes *****/ +#include "lfds700_hash_addonly_internal.h" + +/***** private prototypes*****/ +static void btree_au_element_cleanup_function( struct lfds700_btree_au_state *baus, struct lfds700_btree_au_element *baue ); + + + + + +/****************************************************************************/ +void lfds700_hash_a_cleanup( struct lfds700_hash_a_state *has, + void (*element_cleanup_callback)(struct lfds700_hash_a_state *has, struct lfds700_hash_a_element *hae) ) +{ + lfds700_pal_uint_t + loop; + + LFDS700_PAL_ASSERT( has != NULL ); + // TRD : element_cleanup_callback can be NULL + + if( element_cleanup_callback == NULL ) + return; + + LFDS700_MISC_BARRIER_LOAD; + + has->element_cleanup_callback = element_cleanup_callback; + + for( loop = 0 ; loop < has->array_size ; loop++ ) + lfds700_btree_au_cleanup( has->baus_array+loop, btree_au_element_cleanup_function ); + + return; +} + + + + + +/****************************************************************************/ +#pragma warning( disable : 4100 ) + +static void btree_au_element_cleanup_function( struct lfds700_btree_au_state *baus, struct lfds700_btree_au_element *baue ) +{ + struct lfds700_hash_a_state + *has; + + struct lfds700_hash_a_element + *hae; + + LFDS700_PAL_ASSERT( baus != NULL ); + LFDS700_PAL_ASSERT( baue != NULL ); + + hae = (struct lfds700_hash_a_element *) LFDS700_BTREE_AU_GET_VALUE_FROM_ELEMENT( *baue ); + has = (struct lfds700_hash_a_state *) LFDS700_BTREE_AU_GET_USER_STATE_FROM_STATE( *baus ); + + has->element_cleanup_callback( has, hae ); + + return; +} + +#pragma warning( default : 4100 ) + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_hash_addonly/lfds700_hash_addonly_get.c b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_hash_addonly/lfds700_hash_addonly_get.c new file mode 100644 index 0000000000..8d010664ab --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_hash_addonly/lfds700_hash_addonly_get.c @@ -0,0 +1,37 @@ +/***** includes *****/ +#include "lfds700_hash_addonly_internal.h" + + + + + +/****************************************************************************/ +int lfds700_hash_a_get_by_key( struct lfds700_hash_a_state *has, + void *key, + struct lfds700_hash_a_element **hae ) +{ + int + rv; + + lfds700_pal_uint_t + hash = 0; + + struct lfds700_btree_au_element + *baue; + + LFDS700_PAL_ASSERT( has != NULL ); + // TRD : key can be NULL + LFDS700_PAL_ASSERT( hae != NULL ); + + has->key_hash_function( key, &hash ); + + rv = lfds700_btree_au_get_by_key( has->baus_array + (hash % has->array_size), key, &baue ); + + if( rv == 1 ) + *hae = LFDS700_BTREE_AU_GET_VALUE_FROM_ELEMENT( *baue ); + else + *hae = NULL; + + return( rv ); +} + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_hash_addonly/lfds700_hash_addonly_init.c b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_hash_addonly/lfds700_hash_addonly_init.c new file mode 100644 index 0000000000..022024ce27 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_hash_addonly/lfds700_hash_addonly_init.c @@ -0,0 +1,54 @@ +/***** includes *****/ +#include "lfds700_hash_addonly_internal.h" + + + + + +/****************************************************************************/ +void lfds700_hash_a_init_valid_on_current_logical_core( struct lfds700_hash_a_state *has, + struct lfds700_btree_au_state *baus_array, + lfds700_pal_uint_t array_size, + int (*key_compare_function)(void const *new_key, void const *existing_key), + void (*key_hash_function)(void const *key, lfds700_pal_uint_t *hash), + enum lfds700_hash_a_existing_key existing_key, + void *user_state ) +{ + enum lfds700_btree_au_existing_key + btree_au_existing_key = LFDS700_BTREE_AU_EXISTING_KEY_OVERWRITE; // TRD : for compiler warning + + lfds700_pal_uint_t + loop; + + LFDS700_PAL_ASSERT( has != NULL ); + LFDS700_PAL_ASSERT( baus_array != NULL ); + LFDS700_PAL_ASSERT( array_size > 0 ); + LFDS700_PAL_ASSERT( key_compare_function != NULL ); + LFDS700_PAL_ASSERT( key_hash_function != NULL ); + // TRD : existing_key can be any value in its range + // TRD : user_state can be NULL + + has->array_size = array_size; + has->key_compare_function = key_compare_function; + has->key_hash_function = key_hash_function; + has->existing_key = existing_key; + has->baus_array = baus_array; + has->user_state = user_state; + + if( has->existing_key == LFDS700_HASH_A_EXISTING_KEY_OVERWRITE ) + btree_au_existing_key = LFDS700_BTREE_AU_EXISTING_KEY_OVERWRITE; + + if( has->existing_key == LFDS700_HASH_A_EXISTING_KEY_FAIL ) + btree_au_existing_key = LFDS700_BTREE_AU_EXISTING_KEY_FAIL; + + // TRD : since the addonly_hash atomic counts, if that flag is set, the btree_addonly_unbalanceds don't have to + for( loop = 0 ; loop < array_size ; loop++ ) + lfds700_btree_au_init_valid_on_current_logical_core( has->baus_array+loop, key_compare_function, btree_au_existing_key, user_state ); + + LFDS700_MISC_BARRIER_STORE; + + lfds700_misc_force_store(); + + return; +} + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_hash_addonly/lfds700_hash_addonly_insert.c b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_hash_addonly/lfds700_hash_addonly_insert.c new file mode 100644 index 0000000000..25df3e7f93 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_hash_addonly/lfds700_hash_addonly_insert.c @@ -0,0 +1,62 @@ +/***** includes *****/ +#include "lfds700_hash_addonly_internal.h" + + + + + +/****************************************************************************/ +enum lfds700_hash_a_insert_result lfds700_hash_a_insert( struct lfds700_hash_a_state *has, + struct lfds700_hash_a_element *hae, + struct lfds700_hash_a_element **existing_hae, + struct lfds700_misc_prng_state *ps ) +{ + enum lfds700_hash_a_insert_result + apr = LFDS700_HASH_A_PUT_RESULT_SUCCESS; + + enum lfds700_btree_au_insert_result + alr; + + lfds700_pal_uint_t + hash = 0; + + struct lfds700_btree_au_element + *existing_baue; + + LFDS700_PAL_ASSERT( has != NULL ); + LFDS700_PAL_ASSERT( hae != NULL ); + LFDS700_PAL_ASSERT( (lfds700_pal_uint_t) &hae->value % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES == 0 ); + // TRD : existing_hae can be NULL + LFDS700_PAL_ASSERT( ps != NULL ); + + // TRD : alignment checks + LFDS700_PAL_ASSERT( (lfds700_pal_uint_t) &hae->baue % LFDS700_PAL_ALIGN_SINGLE_POINTER == 0 ); + + has->key_hash_function( hae->key, &hash ); + + LFDS700_BTREE_AU_SET_KEY_IN_ELEMENT( hae->baue, hae->key ); + LFDS700_BTREE_AU_SET_VALUE_IN_ELEMENT( hae->baue, hae ); + + alr = lfds700_btree_au_insert( has->baus_array + (hash % has->array_size), &hae->baue, &existing_baue, ps ); + + switch( alr ) + { + case LFDS700_BTREE_AU_INSERT_RESULT_FAILURE_EXISTING_KEY: + if( existing_hae != NULL ) + *existing_hae = LFDS700_BTREE_AU_GET_VALUE_FROM_ELEMENT( *existing_baue ); + + apr = LFDS700_HASH_A_PUT_RESULT_FAILURE_EXISTING_KEY; + break; + + case LFDS700_BTREE_AU_INSERT_RESULT_SUCCESS_OVERWRITE: + apr = LFDS700_HASH_A_PUT_RESULT_SUCCESS_OVERWRITE; + break; + + case LFDS700_BTREE_AU_INSERT_RESULT_SUCCESS: + apr = LFDS700_HASH_A_PUT_RESULT_SUCCESS; + break; + } + + return( apr ); +} + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_hash_addonly/lfds700_hash_addonly_internal.h b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_hash_addonly/lfds700_hash_addonly_internal.h new file mode 100644 index 0000000000..7a7d541804 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_hash_addonly/lfds700_hash_addonly_internal.h @@ -0,0 +1,5 @@ +/***** the library wide include file *****/ +#include "../liblfds700_internal.h" + +/***** private prototypes *****/ + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_hash_addonly/lfds700_hash_addonly_iterate.c b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_hash_addonly/lfds700_hash_addonly_iterate.c new file mode 100644 index 0000000000..3e06be3f90 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_hash_addonly/lfds700_hash_addonly_iterate.c @@ -0,0 +1,58 @@ +/***** includes *****/ +#include "lfds700_hash_addonly_internal.h" + + + + + +/****************************************************************************/ +void lfds700_hash_a_iterate_init( struct lfds700_hash_a_state *has, struct lfds700_hash_a_iterate *hai ) +{ + LFDS700_PAL_ASSERT( has != NULL ); + LFDS700_PAL_ASSERT( hai != NULL ); + + hai->baus = has->baus_array; + hai->baus_end = has->baus_array + has->array_size; + hai->baue = NULL; + + return; +} + + + + + +/****************************************************************************/ +int lfds700_hash_a_iterate( struct lfds700_hash_a_iterate *hai, struct lfds700_hash_a_element **hae ) +{ + enum lfds700_misc_flag + finished_flag = LFDS700_MISC_FLAG_LOWERED; + + int + rv = 0; + + LFDS700_PAL_ASSERT( hai != NULL ); + LFDS700_PAL_ASSERT( hae != NULL ); + + while( finished_flag == LFDS700_MISC_FLAG_LOWERED ) + { + lfds700_btree_au_get_by_absolute_position_and_then_by_relative_position( hai->baus, &hai->baue, LFDS700_BTREE_AU_ABSOLUTE_POSITION_SMALLEST_IN_TREE, LFDS700_BTREE_AU_RELATIVE_POSITION_NEXT_LARGER_ELEMENT_IN_ENTIRE_TREE ); + + if( hai->baue != NULL ) + { + *hae = LFDS700_BTREE_AU_GET_VALUE_FROM_ELEMENT( *hai->baue ); + finished_flag = LFDS700_MISC_FLAG_RAISED; + rv = 1; + } + + if( hai->baue == NULL ) + if( ++hai->baus == hai->baus_end ) + { + *hae = NULL; + finished_flag = LFDS700_MISC_FLAG_RAISED; + } + } + + return( rv ); +} + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_hash_addonly/lfds700_hash_addonly_query.c b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_hash_addonly/lfds700_hash_addonly_query.c new file mode 100644 index 0000000000..9d89a8838d --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_hash_addonly/lfds700_hash_addonly_query.c @@ -0,0 +1,112 @@ +/***** includes *****/ +#include "lfds700_hash_addonly_internal.h" + +/***** private prototypes *****/ +static void lfds700_hash_a_internal_validate( struct lfds700_hash_a_state *has, struct lfds700_misc_validation_info *vi, enum lfds700_misc_validity *lfds700_hash_a_validity ); + + + + + +/****************************************************************************/ +void lfds700_hash_a_query( struct lfds700_hash_a_state *has, enum lfds700_hash_a_query query_type, void *query_input, void *query_output ) +{ + LFDS700_PAL_ASSERT( has != NULL ); + // TRD : query_type can be any value in its range + + LFDS700_MISC_BARRIER_LOAD; + + switch( query_type ) + { + case LFDS700_HASH_A_QUERY_GET_POTENTIALLY_INACCURATE_COUNT: + { + struct lfds700_hash_a_iterate + ai; + + struct lfds700_hash_a_element + *hae; + + LFDS700_PAL_ASSERT( query_input == NULL ); + LFDS700_PAL_ASSERT( query_output != NULL ); + + *(lfds700_pal_uint_t *) query_output = 0; + + lfds700_hash_a_iterate_init( has, &ai ); + + while( lfds700_hash_a_iterate(&ai, &hae) ) + ( *(lfds700_pal_uint_t *) query_output )++; + } + break; + + case LFDS700_HASH_A_QUERY_SINGLETHREADED_VALIDATE: + // TRD: query_input can be any value in its range + LFDS700_PAL_ASSERT( query_output != NULL ); + + lfds700_hash_a_internal_validate( has, (struct lfds700_misc_validation_info *) query_input, (enum lfds700_misc_validity *) query_output ); + break; + } + + return; +} + + + + + +/****************************************************************************/ +static void lfds700_hash_a_internal_validate( struct lfds700_hash_a_state *has, struct lfds700_misc_validation_info *vi, enum lfds700_misc_validity *lfds700_hash_a_validity ) +{ + lfds700_pal_uint_t + lfds700_hash_a_total_number_elements = 0, + lfds700_btree_au_total_number_elements = 0, + number_elements; + + lfds700_pal_uint_t + loop; + + LFDS700_PAL_ASSERT( has!= NULL ); + // TRD : vi can be NULL + LFDS700_PAL_ASSERT( lfds700_hash_a_validity != NULL ); + + /* TRD : validate every btree_addonly_unbalanced in the addonly_hash + sum elements in each btree_addonly_unbalanced + check matches expected element counts (if vi is provided) + */ + + *lfds700_hash_a_validity = LFDS700_MISC_VALIDITY_VALID; + + for( loop = 0 ; *lfds700_hash_a_validity == LFDS700_MISC_VALIDITY_VALID and loop < has->array_size ; loop++ ) + lfds700_btree_au_query( has->baus_array+loop, LFDS700_BTREE_AU_QUERY_SINGLETHREADED_VALIDATE, NULL, (void *) lfds700_hash_a_validity ); + + if( *lfds700_hash_a_validity == LFDS700_MISC_VALIDITY_VALID ) + { + for( loop = 0 ; loop < has->array_size ; loop++ ) + { + lfds700_btree_au_query( has->baus_array+loop, LFDS700_BTREE_AU_QUERY_GET_POTENTIALLY_INACCURATE_COUNT, NULL, (void *) &number_elements ); + lfds700_btree_au_total_number_elements += number_elements; + } + + // TRD : first, check btree_addonly_unbalanced total vs the addonly_hash total + lfds700_hash_a_query( has, LFDS700_HASH_A_QUERY_GET_POTENTIALLY_INACCURATE_COUNT, NULL, &lfds700_hash_a_total_number_elements ); + + // TRD : the btree_addonly_unbalanceds are assumed to speak the truth + if( lfds700_hash_a_total_number_elements < lfds700_btree_au_total_number_elements ) + *lfds700_hash_a_validity = LFDS700_MISC_VALIDITY_INVALID_ADDITIONAL_ELEMENTS; + + if( lfds700_hash_a_total_number_elements > lfds700_btree_au_total_number_elements ) + *lfds700_hash_a_validity = LFDS700_MISC_VALIDITY_INVALID_MISSING_ELEMENTS; + + // TRD : second, if we're still valid and vi is provided, check the btree_addonly_unbalanced total against vi + if( *lfds700_hash_a_validity == LFDS700_MISC_VALIDITY_VALID and vi != NULL ) + { + if( lfds700_btree_au_total_number_elements < vi->min_elements ) + *lfds700_hash_a_validity = LFDS700_MISC_VALIDITY_INVALID_MISSING_ELEMENTS; + + if( lfds700_btree_au_total_number_elements > vi->max_elements ) + *lfds700_hash_a_validity = LFDS700_MISC_VALIDITY_INVALID_ADDITIONAL_ELEMENTS; + } + } + + return; +} + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_list_addonly_ordered_singlylinked/lfds700_list_addonly_ordered_singlylinked_cleanup.c b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_list_addonly_ordered_singlylinked/lfds700_list_addonly_ordered_singlylinked_cleanup.c new file mode 100644 index 0000000000..580fa9b3ac --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_list_addonly_ordered_singlylinked/lfds700_list_addonly_ordered_singlylinked_cleanup.c @@ -0,0 +1,37 @@ +/***** includes *****/ +#include "lfds700_list_addonly_ordered_singlylinked_internal.h" + + + + + +/****************************************************************************/ +void lfds700_list_aos_cleanup( struct lfds700_list_aos_state *laoss, + void (*element_cleanup_callback)(struct lfds700_list_aos_state *laoss, struct lfds700_list_aos_element *laose) ) +{ + struct lfds700_list_aos_element + *laose, + *temp; + + LFDS700_PAL_ASSERT( laoss != NULL ); + // TRD : element_cleanup_callback can be NULL + + LFDS700_MISC_BARRIER_LOAD; + + if( element_cleanup_callback == NULL ) + return; + + laose = LFDS700_LIST_AOS_GET_START( *laoss ); + + while( laose != NULL ) + { + temp = laose; + + laose = LFDS700_LIST_AOS_GET_NEXT( *laose ); + + element_cleanup_callback( laoss, temp ); + } + + return; +} + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_list_addonly_ordered_singlylinked/lfds700_list_addonly_ordered_singlylinked_get.c b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_list_addonly_ordered_singlylinked/lfds700_list_addonly_ordered_singlylinked_get.c new file mode 100644 index 0000000000..9d4cab5e53 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_list_addonly_ordered_singlylinked/lfds700_list_addonly_ordered_singlylinked_get.c @@ -0,0 +1,29 @@ +/***** includes *****/ +#include "lfds700_list_addonly_ordered_singlylinked_internal.h" + + + + + +/****************************************************************************/ +int lfds700_list_aos_get_by_key( struct lfds700_list_aos_state *laoss, + void *key, + struct lfds700_list_aos_element **laose ) +{ + int + cr = !0, + rv = 1; + + LFDS700_PAL_ASSERT( laoss != NULL ); + LFDS700_PAL_ASSERT( key != NULL ); + LFDS700_PAL_ASSERT( laose != NULL ); + + while( cr != 0 and LFDS700_LIST_AOS_GET_START_AND_THEN_NEXT(*laoss, *laose) ) + cr = laoss->key_compare_function( key, (*laose)->key ); + + if( *laose == NULL ) + rv = 0; + + return( rv ); +} + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_list_addonly_ordered_singlylinked/lfds700_list_addonly_ordered_singlylinked_init.c b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_list_addonly_ordered_singlylinked/lfds700_list_addonly_ordered_singlylinked_init.c new file mode 100644 index 0000000000..4c92835ce5 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_list_addonly_ordered_singlylinked/lfds700_list_addonly_ordered_singlylinked_init.c @@ -0,0 +1,37 @@ +/***** includes *****/ +#include "lfds700_list_addonly_ordered_singlylinked_internal.h" + + + + + +/****************************************************************************/ +void lfds700_list_aos_init_valid_on_current_logical_core( struct lfds700_list_aos_state *laoss, + int (*key_compare_function)(void const *new_key, void const *existing_key), + enum lfds700_list_aos_existing_key existing_key, + void *user_state ) +{ + LFDS700_PAL_ASSERT( laoss != NULL ); + LFDS700_PAL_ASSERT( (lfds700_pal_uint_t) &laoss->start % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES == 0 ); + LFDS700_PAL_ASSERT( (lfds700_pal_uint_t) &laoss->dummy_element % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES == 0 ); + LFDS700_PAL_ASSERT( (lfds700_pal_uint_t) &laoss->key_compare_function % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES == 0 ); + LFDS700_PAL_ASSERT( key_compare_function != NULL ); + // TRD : existing_key can be any value in its range + // TRD : user_state can be NULL + + // TRD : dummy start element - makes code easier when you can always use ->next + laoss->start = &laoss->dummy_element; + + laoss->start->next = NULL; + laoss->start->value = NULL; + laoss->key_compare_function = key_compare_function; + laoss->existing_key = existing_key; + laoss->user_state = user_state; + + LFDS700_MISC_BARRIER_STORE; + + lfds700_misc_force_store(); + + return; +} + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_list_addonly_ordered_singlylinked/lfds700_list_addonly_ordered_singlylinked_insert.c b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_list_addonly_ordered_singlylinked/lfds700_list_addonly_ordered_singlylinked_insert.c new file mode 100644 index 0000000000..9beead4e1d --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_list_addonly_ordered_singlylinked/lfds700_list_addonly_ordered_singlylinked_insert.c @@ -0,0 +1,134 @@ +/***** includes *****/ +#include "lfds700_list_addonly_ordered_singlylinked_internal.h" + + + + + +/****************************************************************************/ +enum lfds700_list_aos_insert_result lfds700_list_aos_insert( struct lfds700_list_aos_state *laoss, + struct lfds700_list_aos_element *laose, + struct lfds700_list_aos_element **existing_laose, + struct lfds700_misc_prng_state *ps ) +{ + char unsigned + result; + + enum lfds700_misc_flag + finished_flag = LFDS700_MISC_FLAG_LOWERED; + + int + compare_result = 0; + + lfds700_pal_uint_t + backoff_iteration = LFDS700_MISC_ABSTRACTION_BACKOFF_INITIAL_VALUE; + + struct lfds700_list_aos_element + *volatile laose_temp = NULL, + *volatile laose_trailing; + + LFDS700_PAL_ASSERT( laoss != NULL ); + LFDS700_PAL_ASSERT( laose != NULL ); + LFDS700_PAL_ASSERT( (lfds700_pal_uint_t) &laose->next % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES == 0 ); + LFDS700_PAL_ASSERT( (lfds700_pal_uint_t) &laose->value % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES == 0 ); + LFDS700_PAL_ASSERT( (lfds700_pal_uint_t) &laose->key % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES == 0 ); + // TRD : existing_laose can be NULL + LFDS700_PAL_ASSERT( ps != NULL ); + + /* TRD : imagine a list, sorted small to large + + we arrive at an element + we obtain its next pointer + we check we are greater than the current element and smaller than the next element + this means we have found the correct location to insert + we try to CAS ourselves in; in the meantime, + someone else has *aready* swapped in an element which is smaller than we are + + e.g. + + the list is { 1, 10 } and we are the value 5 + + we arrive at 1; we check the next element and see it is 10 + so we are larger than the current element and smaller than the next + we are in the correct location to insert and we go to insert... + + in the meantime, someone else with the value 3 comes along + he too finds this is the correct location and inserts before we do + the list is now { 1, 3, 10 } and we are trying to insert now after + 1 and before 3! + + our insert CAS fails, because the next pointer of 1 has changed aready; + but we see we are in the wrong location - we need to move forward an + element + */ + + LFDS700_MISC_BARRIER_LOAD; + + /* TRD : we need to begin with the leading dummy element + as the element to be inserted + may be smaller than all elements in the list + */ + + laose_trailing = laoss->start; + laose_temp = laoss->start->next; + + while( finished_flag == LFDS700_MISC_FLAG_LOWERED ) + { + if( laose_temp == NULL ) + compare_result = -1; + + if( laose_temp != NULL ) + { + LFDS700_MISC_BARRIER_LOAD; + compare_result = laoss->key_compare_function( laose->key, laose_temp->key ); + } + + if( compare_result == 0 ) + { + if( existing_laose != NULL ) + *existing_laose = laose_temp; + + switch( laoss->existing_key ) + { + case LFDS700_LIST_AOS_EXISTING_KEY_OVERWRITE: + LFDS700_LIST_AOS_SET_VALUE_IN_ELEMENT( *laose_temp, laose->value ); + return( LFDS700_LIST_AOS_INSERT_RESULT_SUCCESS_OVERWRITE ); + break; + + case LFDS700_LIST_AOS_EXISTING_KEY_FAIL: + return( LFDS700_LIST_AOS_INSERT_RESULT_FAILURE_EXISTING_KEY ); + break; + } + + finished_flag = LFDS700_MISC_FLAG_RAISED; + } + + if( compare_result < 0 ) + { + laose->next = laose_temp; + LFDS700_MISC_BARRIER_STORE; + LFDS700_PAL_ATOMIC_CAS_WITH_BACKOFF( &laose_trailing->next, &laose->next, laose, LFDS700_MISC_CAS_STRENGTH_WEAK, result, backoff_iteration, ps ); + + if( result == 1 ) + finished_flag = LFDS700_MISC_FLAG_RAISED; + else + // TRD : if we fail to link, someone else has linked and so we need to redetermine our position is correct + laose_temp = laose_trailing->next; + } + + if( compare_result > 0 ) + { + // TRD : move trailing along by one element + laose_trailing = laose_trailing->next; + + /* TRD : set temp as the element after trailing + if the new element we're linking is larger than all elements in the list, + laose_temp will now go to NULL and we'll link at the end + */ + laose_temp = laose_trailing->next; + } + } + + return( LFDS700_LIST_AOS_INSERT_RESULT_SUCCESS ); +} + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_list_addonly_ordered_singlylinked/lfds700_list_addonly_ordered_singlylinked_internal.h b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_list_addonly_ordered_singlylinked/lfds700_list_addonly_ordered_singlylinked_internal.h new file mode 100644 index 0000000000..7a7d541804 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_list_addonly_ordered_singlylinked/lfds700_list_addonly_ordered_singlylinked_internal.h @@ -0,0 +1,5 @@ +/***** the library wide include file *****/ +#include "../liblfds700_internal.h" + +/***** private prototypes *****/ + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_list_addonly_ordered_singlylinked/lfds700_list_addonly_ordered_singlylinked_query.c b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_list_addonly_ordered_singlylinked/lfds700_list_addonly_ordered_singlylinked_query.c new file mode 100644 index 0000000000..a1d990ab79 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_list_addonly_ordered_singlylinked/lfds700_list_addonly_ordered_singlylinked_query.c @@ -0,0 +1,121 @@ +/***** includes *****/ +#include "lfds700_list_addonly_ordered_singlylinked_internal.h" + +/***** private prototypes *****/ +static void lfds700_list_aos_internal_validate( struct lfds700_list_aos_state *laoss, struct lfds700_misc_validation_info *vi, enum lfds700_misc_validity *lfds700_list_aos_validity ); + + + + + +/****************************************************************************/ +void lfds700_list_aos_query( struct lfds700_list_aos_state *laoss, enum lfds700_list_aos_query query_type, void *query_input, void *query_output ) +{ + LFDS700_PAL_ASSERT( laoss != NULL ); + // TRD : query_type can be any value in its range + + LFDS700_MISC_BARRIER_LOAD; + + switch( query_type ) + { + case LFDS700_LIST_AOS_QUERY_GET_POTENTIALLY_INACCURATE_COUNT: + { + struct lfds700_list_aos_element + *laose = NULL; + + LFDS700_PAL_ASSERT( query_input == NULL ); + LFDS700_PAL_ASSERT( query_output != NULL ); + + *(lfds700_pal_uint_t *) query_output = 0; + + while( LFDS700_LIST_AOS_GET_START_AND_THEN_NEXT(*laoss, laose) ) + ( *(lfds700_pal_uint_t *) query_output )++; + } + break; + + case LFDS700_LIST_AOS_QUERY_SINGLETHREADED_VALIDATE: + // TRD : query_input can be NULL + LFDS700_PAL_ASSERT( query_output != NULL ); + + lfds700_list_aos_internal_validate( laoss, (struct lfds700_misc_validation_info *) query_input, (enum lfds700_misc_validity *) query_output ); + break; + } + + return; +} + + + + + + +/****************************************************************************/ +static void lfds700_list_aos_internal_validate( struct lfds700_list_aos_state *laoss, struct lfds700_misc_validation_info *vi, enum lfds700_misc_validity *lfds700_list_aos_validity ) +{ + lfds700_pal_uint_t + number_elements = 0; + + struct lfds700_list_aos_element + *laose_fast, + *laose_slow; + + LFDS700_PAL_ASSERT( laoss!= NULL ); + // TRD : vi can be NULL + LFDS700_PAL_ASSERT( lfds700_list_aos_validity != NULL ); + + *lfds700_list_aos_validity = LFDS700_MISC_VALIDITY_VALID; + + laose_slow = laose_fast = laoss->start->next; + + /* TRD : first, check for a loop + we have two pointers + both of which start at the start of the list + we enter a loop + and on each iteration + we advance one pointer by one element + and the other by two + + we exit the loop when both pointers are NULL + (have reached the end of the queue) + + or + + if we fast pointer 'sees' the slow pointer + which means we have a loop + */ + + if( laose_slow != NULL ) + do + { + laose_slow = laose_slow->next; + + if( laose_fast != NULL ) + laose_fast = laose_fast->next; + + if( laose_fast != NULL ) + laose_fast = laose_fast->next; + } + while( laose_slow != NULL and laose_fast != laose_slow ); + + if( laose_fast != NULL and laose_slow != NULL and laose_fast == laose_slow ) + *lfds700_list_aos_validity = LFDS700_MISC_VALIDITY_INVALID_LOOP; + + /* TRD : now check for expected number of elements + vi can be NULL, in which case we do not check + we know we don't have a loop from our earlier check + */ + + if( *lfds700_list_aos_validity == LFDS700_MISC_VALIDITY_VALID and vi != NULL ) + { + lfds700_list_aos_query( laoss, LFDS700_LIST_AOS_QUERY_GET_POTENTIALLY_INACCURATE_COUNT, NULL, &number_elements ); + + if( number_elements < vi->min_elements ) + *lfds700_list_aos_validity = LFDS700_MISC_VALIDITY_INVALID_MISSING_ELEMENTS; + + if( number_elements > vi->max_elements ) + *lfds700_list_aos_validity = LFDS700_MISC_VALIDITY_INVALID_ADDITIONAL_ELEMENTS; + } + + return; +} + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_list_addonly_singlylinked_unordered/lfds700_list_addonly_singlylinked_unordered_cleanup.c b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_list_addonly_singlylinked_unordered/lfds700_list_addonly_singlylinked_unordered_cleanup.c new file mode 100644 index 0000000000..ef19ce1f86 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_list_addonly_singlylinked_unordered/lfds700_list_addonly_singlylinked_unordered_cleanup.c @@ -0,0 +1,37 @@ +/***** includes *****/ +#include "lfds700_list_addonly_singlylinked_unordered_internal.h" + + + + + +/****************************************************************************/ +void lfds700_list_asu_cleanup( struct lfds700_list_asu_state *lasus, + void (*element_cleanup_callback)(struct lfds700_list_asu_state *lasus, struct lfds700_list_asu_element *lasue) ) +{ + struct lfds700_list_asu_element + *lasue, + *temp; + + LFDS700_PAL_ASSERT( lasus != NULL ); + // TRD : element_cleanup_callback can be NULL + + LFDS700_MISC_BARRIER_LOAD; + + if( element_cleanup_callback == NULL ) + return; + + lasue = LFDS700_LIST_ASU_GET_START( *lasus ); + + while( lasue != NULL ) + { + temp = lasue; + + lasue = LFDS700_LIST_ASU_GET_NEXT( *lasue ); + + element_cleanup_callback( lasus, temp ); + } + + return; +} + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_list_addonly_singlylinked_unordered/lfds700_list_addonly_singlylinked_unordered_get.c b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_list_addonly_singlylinked_unordered/lfds700_list_addonly_singlylinked_unordered_get.c new file mode 100644 index 0000000000..ae99ebfca4 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_list_addonly_singlylinked_unordered/lfds700_list_addonly_singlylinked_unordered_get.c @@ -0,0 +1,29 @@ +/***** includes *****/ +#include "lfds700_list_addonly_singlylinked_unordered_internal.h" + + + + + +/****************************************************************************/ +int lfds700_list_asu_get_by_key( struct lfds700_list_asu_state *lasus, + void *key, + struct lfds700_list_asu_element **lasue ) +{ + int + cr = !0, + rv = 1; + + LFDS700_PAL_ASSERT( lasus != NULL ); + LFDS700_PAL_ASSERT( key != NULL ); + LFDS700_PAL_ASSERT( lasue != NULL ); + + while( cr != 0 and LFDS700_LIST_ASU_GET_START_AND_THEN_NEXT(*lasus, *lasue) ) + cr = lasus->key_compare_function( key, (*lasue)->key ); + + if( *lasue == NULL ) + rv = 0; + + return( rv ); +} + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_list_addonly_singlylinked_unordered/lfds700_list_addonly_singlylinked_unordered_init.c b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_list_addonly_singlylinked_unordered/lfds700_list_addonly_singlylinked_unordered_init.c new file mode 100644 index 0000000000..78b0d8eae6 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_list_addonly_singlylinked_unordered/lfds700_list_addonly_singlylinked_unordered_init.c @@ -0,0 +1,35 @@ +/***** includes *****/ +#include "lfds700_list_addonly_singlylinked_unordered_internal.h" + + + + + +/****************************************************************************/ +void lfds700_list_asu_init_valid_on_current_logical_core( struct lfds700_list_asu_state *lasus, + int (*key_compare_function)(void const *new_key, void const *existing_key), + void *user_state ) +{ + LFDS700_PAL_ASSERT( lasus != NULL ); + LFDS700_PAL_ASSERT( (lfds700_pal_uint_t) &lasus->end % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES == 0 ); + LFDS700_PAL_ASSERT( (lfds700_pal_uint_t) &lasus->start % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES == 0 ); + LFDS700_PAL_ASSERT( (lfds700_pal_uint_t) &lasus->dummy_element % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES == 0 ); + LFDS700_PAL_ASSERT( (lfds700_pal_uint_t) &lasus->key_compare_function % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES == 0 ); + // TRD : key_compare_function can be NULL + // TRD : user_state can be NULL + + // TRD : dummy start element - makes code easier when you can always use ->next + lasus->start = lasus->end = &lasus->dummy_element; + + lasus->start->next = NULL; + lasus->start->value = NULL; + lasus->key_compare_function = key_compare_function; + lasus->user_state = user_state; + + LFDS700_MISC_BARRIER_STORE; + + lfds700_misc_force_store(); + + return; +} + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_list_addonly_singlylinked_unordered/lfds700_list_addonly_singlylinked_unordered_insert.c b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_list_addonly_singlylinked_unordered/lfds700_list_addonly_singlylinked_unordered_insert.c new file mode 100644 index 0000000000..ce2ee825aa --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_list_addonly_singlylinked_unordered/lfds700_list_addonly_singlylinked_unordered_insert.c @@ -0,0 +1,193 @@ +/***** includes *****/ +#include "lfds700_list_addonly_singlylinked_unordered_internal.h" + + + + + +/****************************************************************************/ +void lfds700_list_asu_insert_at_position( struct lfds700_list_asu_state *lasus, + struct lfds700_list_asu_element *lasue, + struct lfds700_list_asu_element *lasue_predecessor, + enum lfds700_list_asu_position position, + struct lfds700_misc_prng_state *ps ) +{ + LFDS700_PAL_ASSERT( lasus != NULL ); + LFDS700_PAL_ASSERT( lasue != NULL ); + LFDS700_PAL_ASSERT( (lfds700_pal_uint_t) &lasue->next % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES == 0 ); + LFDS700_PAL_ASSERT( (lfds700_pal_uint_t) &lasue->value % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES == 0 ); + LFDS700_PAL_ASSERT( (lfds700_pal_uint_t) &lasue->key % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES == 0 ); + // TRD : lasue_predecessor asserted in the switch + // TRD : position can be any value in its range + LFDS700_PAL_ASSERT( ps != NULL ); + + switch( position ) + { + case LFDS700_LIST_ASU_POSITION_START: + lfds700_list_asu_insert_at_start( lasus, lasue, ps ); + break; + + case LFDS700_LIST_ASU_POSITION_END: + lfds700_list_asu_insert_at_end( lasus, lasue, ps ); + break; + + case LFDS700_LIST_ASU_POSITION_AFTER: + lfds700_list_asu_insert_after_element( lasus, lasue, lasue_predecessor, ps ); + break; + } + + return; +} + + + + + +/****************************************************************************/ +void lfds700_list_asu_insert_at_start( struct lfds700_list_asu_state *lasus, + struct lfds700_list_asu_element *lasue, + struct lfds700_misc_prng_state *ps ) +{ + char unsigned + result; + + lfds700_pal_uint_t + backoff_iteration = LFDS700_MISC_ABSTRACTION_BACKOFF_INITIAL_VALUE; + + LFDS700_PAL_ASSERT( lasus != NULL ); + LFDS700_PAL_ASSERT( lasue != NULL ); + LFDS700_PAL_ASSERT( (lfds700_pal_uint_t) &lasue->next % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES == 0 ); + LFDS700_PAL_ASSERT( (lfds700_pal_uint_t) &lasue->value % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES == 0 ); + LFDS700_PAL_ASSERT( (lfds700_pal_uint_t) &lasue->key % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES == 0 ); + LFDS700_PAL_ASSERT( ps != NULL ); + + LFDS700_MISC_BARRIER_LOAD; + + lasue->next = lasus->start->next; + + do + { + LFDS700_MISC_BARRIER_STORE; + LFDS700_PAL_ATOMIC_CAS_WITH_BACKOFF( &lasus->start->next, &lasue->next, lasue, LFDS700_MISC_CAS_STRENGTH_WEAK, result, backoff_iteration, ps ); + } + while( result != 1 ); + + return; +} + + + + + +/****************************************************************************/ +void lfds700_list_asu_insert_at_end( struct lfds700_list_asu_state *lasus, + struct lfds700_list_asu_element *lasue, + struct lfds700_misc_prng_state *ps ) +{ + char unsigned + result; + + enum lfds700_misc_flag + finished_flag = LFDS700_MISC_FLAG_LOWERED; + + lfds700_pal_uint_t + backoff_iteration = LFDS700_MISC_ABSTRACTION_BACKOFF_INITIAL_VALUE; + + struct lfds700_list_asu_element LFDS700_PAL_ALIGN(LFDS700_PAL_ALIGN_SINGLE_POINTER) + *compare; + + struct lfds700_list_asu_element + *volatile lasue_next, + *volatile lasue_end; + + LFDS700_PAL_ASSERT( lasus != NULL ); + LFDS700_PAL_ASSERT( lasue != NULL ); + LFDS700_PAL_ASSERT( (lfds700_pal_uint_t) &lasue->next % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES == 0 ); + LFDS700_PAL_ASSERT( (lfds700_pal_uint_t) &lasue->value % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES == 0 ); + LFDS700_PAL_ASSERT( (lfds700_pal_uint_t) &lasue->key % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES == 0 ); + LFDS700_PAL_ASSERT( ps != NULL ); + + /* TRD : begin by assuming end is correctly pointing to the final element + try to link (comparing for next being NULL) + if we fail, move down list till we find last element + and retry + when successful, update end to ourselves + + note there's a leading dummy element + so lasus->end always points to an element + */ + + LFDS700_MISC_BARRIER_LOAD; + + lasue->next = NULL; + lasue_end = lasus->end; + + while( finished_flag == LFDS700_MISC_FLAG_LOWERED ) + { + compare = NULL; + + LFDS700_MISC_BARRIER_STORE; + LFDS700_PAL_ATOMIC_CAS_WITH_BACKOFF( &lasue_end->next, &compare, lasue, LFDS700_MISC_CAS_STRENGTH_STRONG, result, backoff_iteration, ps ); + + if( result == 1 ) + finished_flag = LFDS700_MISC_FLAG_RAISED; + else + { + lasue_end = compare; + lasue_next = LFDS700_LIST_ASU_GET_NEXT( *lasue_end ); + + while( lasue_next != NULL ) + { + lasue_end = lasue_next; + lasue_next = LFDS700_LIST_ASU_GET_NEXT( *lasue_end ); + } + } + } + + lasus->end = lasue; + + return; +} + + + + + +/****************************************************************************/ +#pragma warning( disable : 4100 ) + +void lfds700_list_asu_insert_after_element( struct lfds700_list_asu_state *lasus, + struct lfds700_list_asu_element *lasue, + struct lfds700_list_asu_element *lasue_predecessor, + struct lfds700_misc_prng_state *ps ) +{ + char unsigned + result; + + lfds700_pal_uint_t + backoff_iteration = LFDS700_MISC_ABSTRACTION_BACKOFF_INITIAL_VALUE; + + LFDS700_PAL_ASSERT( lasus != NULL ); + LFDS700_PAL_ASSERT( lasue != NULL ); + LFDS700_PAL_ASSERT( (lfds700_pal_uint_t) &lasue->next % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES == 0 ); + LFDS700_PAL_ASSERT( (lfds700_pal_uint_t) &lasue->value % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES == 0 ); + LFDS700_PAL_ASSERT( (lfds700_pal_uint_t) &lasue->key % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES == 0 ); + LFDS700_PAL_ASSERT( lasue_predecessor != NULL ); + LFDS700_PAL_ASSERT( ps != NULL ); + + LFDS700_MISC_BARRIER_LOAD; + + lasue->next = lasue_predecessor->next; + + do + { + LFDS700_MISC_BARRIER_STORE; + LFDS700_PAL_ATOMIC_CAS_WITH_BACKOFF( &lasue_predecessor->next, &lasue->next, lasue, LFDS700_MISC_CAS_STRENGTH_WEAK, result, backoff_iteration, ps ); + } + while( result != 1 ); + + return; +} + +#pragma warning( default : 4100 ) + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_list_addonly_singlylinked_unordered/lfds700_list_addonly_singlylinked_unordered_internal.h b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_list_addonly_singlylinked_unordered/lfds700_list_addonly_singlylinked_unordered_internal.h new file mode 100644 index 0000000000..7a7d541804 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_list_addonly_singlylinked_unordered/lfds700_list_addonly_singlylinked_unordered_internal.h @@ -0,0 +1,5 @@ +/***** the library wide include file *****/ +#include "../liblfds700_internal.h" + +/***** private prototypes *****/ + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_list_addonly_singlylinked_unordered/lfds700_list_addonly_singlylinked_unordered_query.c b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_list_addonly_singlylinked_unordered/lfds700_list_addonly_singlylinked_unordered_query.c new file mode 100644 index 0000000000..0adf5a8032 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_list_addonly_singlylinked_unordered/lfds700_list_addonly_singlylinked_unordered_query.c @@ -0,0 +1,121 @@ +/***** includes *****/ +#include "lfds700_list_addonly_singlylinked_unordered_internal.h" + +/***** private prototypes *****/ +static void lfds700_list_asu_internal_validate( struct lfds700_list_asu_state *lasus, struct lfds700_misc_validation_info *vi, enum lfds700_misc_validity *lfds700_list_asu_validity ); + + + + + +/****************************************************************************/ +void lfds700_list_asu_query( struct lfds700_list_asu_state *lasus, enum lfds700_list_asu_query query_type, void *query_input, void *query_output ) +{ + LFDS700_PAL_ASSERT( lasus != NULL ); + // TRD : query_type can be any value in its range + + LFDS700_MISC_BARRIER_LOAD; + + switch( query_type ) + { + case LFDS700_LIST_ASU_QUERY_GET_POTENTIALLY_INACCURATE_COUNT: + { + struct lfds700_list_asu_element + *lasue = NULL; + + LFDS700_PAL_ASSERT( query_input == NULL ); + LFDS700_PAL_ASSERT( query_output != NULL ); + + *(lfds700_pal_uint_t *) query_output = 0; + + while( LFDS700_LIST_ASU_GET_START_AND_THEN_NEXT(*lasus, lasue) ) + ( *(lfds700_pal_uint_t *) query_output )++; + } + break; + + case LFDS700_LIST_ASU_QUERY_SINGLETHREADED_VALIDATE: + // TRD : query_input can be NULL + LFDS700_PAL_ASSERT( query_output != NULL ); + + lfds700_list_asu_internal_validate( lasus, (struct lfds700_misc_validation_info *) query_input, (enum lfds700_misc_validity *) query_output ); + break; + } + + return; +} + + + + + + +/****************************************************************************/ +static void lfds700_list_asu_internal_validate( struct lfds700_list_asu_state *lasus, struct lfds700_misc_validation_info *vi, enum lfds700_misc_validity *lfds700_list_asu_validity ) +{ + lfds700_pal_uint_t + number_elements = 0; + + struct lfds700_list_asu_element + *lasue_fast, + *lasue_slow; + + LFDS700_PAL_ASSERT( lasus!= NULL ); + // TRD : vi can be NULL + LFDS700_PAL_ASSERT( lfds700_list_asu_validity != NULL ); + + *lfds700_list_asu_validity = LFDS700_MISC_VALIDITY_VALID; + + lasue_slow = lasue_fast = lasus->start->next; + + /* TRD : first, check for a loop + we have two pointers + both of which start at the start of the list + we enter a loop + and on each iteration + we advance one pointer by one element + and the other by two + + we exit the loop when both pointers are NULL + (have reached the end of the queue) + + or + + if we fast pointer 'sees' the slow pointer + which means we have a loop + */ + + if( lasue_slow != NULL ) + do + { + lasue_slow = lasue_slow->next; + + if( lasue_fast != NULL ) + lasue_fast = lasue_fast->next; + + if( lasue_fast != NULL ) + lasue_fast = lasue_fast->next; + } + while( lasue_slow != NULL and lasue_fast != lasue_slow ); + + if( lasue_fast != NULL and lasue_slow != NULL and lasue_fast == lasue_slow ) + *lfds700_list_asu_validity = LFDS700_MISC_VALIDITY_INVALID_LOOP; + + /* TRD : now check for expected number of elements + vi can be NULL, in which case we do not check + we know we don't have a loop from our earlier check + */ + + if( *lfds700_list_asu_validity == LFDS700_MISC_VALIDITY_VALID and vi != NULL ) + { + lfds700_list_asu_query( lasus, LFDS700_LIST_ASU_QUERY_GET_POTENTIALLY_INACCURATE_COUNT, NULL, &number_elements ); + + if( number_elements < vi->min_elements ) + *lfds700_list_asu_validity = LFDS700_MISC_VALIDITY_INVALID_MISSING_ELEMENTS; + + if( number_elements > vi->max_elements ) + *lfds700_list_asu_validity = LFDS700_MISC_VALIDITY_INVALID_ADDITIONAL_ELEMENTS; + } + + return; +} + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_misc/lfds700_misc_cleanup.c b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_misc/lfds700_misc_cleanup.c new file mode 100644 index 0000000000..d93c95db0f --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_misc/lfds700_misc_cleanup.c @@ -0,0 +1,15 @@ +/***** includes *****/ +#include "lfds700_misc_internal.h" + + + + + +/****************************************************************************/ +void lfds700_misc_library_cleanup( void ) +{ + // TRD : we do nuuuuuuthin' + + return; +} + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_misc/lfds700_misc_globals.c b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_misc/lfds700_misc_globals.c new file mode 100644 index 0000000000..af2826675a --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_misc/lfds700_misc_globals.c @@ -0,0 +1,11 @@ +/***** includes *****/ +#include "lfds700_misc_internal.h" + + + + + +/****************************************************************************/ +struct lfds700_misc_globals + lfds700_misc_globals; + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_misc/lfds700_misc_init.c b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_misc/lfds700_misc_init.c new file mode 100644 index 0000000000..32685077bf --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_misc/lfds700_misc_init.c @@ -0,0 +1,53 @@ +/***** includes *****/ +#include "lfds700_misc_internal.h" + + + + + +/****************************************************************************/ +void lfds700_misc_library_init_valid_on_current_logical_core() +{ + /* TRD : the PRNG arrangement is that each thread has its own state, for a maximum-speed PRNG, where output + quality is second consideration to performance + + on 64-bit platforms this is xorshift64*, on 32-bit platforms, an unadorned xorshift32 + + the seed for each thread however comes from a single, global, maximum-quality PRNG, where quality of + output is the primary consideration + + for this, I'm using a xorshift1024* + + since the generation from this global PRNG state is not thread safe, but is still quick in + thread start-up terms, I run a little spin-lock around it + + regarding the seed for this high quality PRNG; it is customary to use time(), but this has a number of + drawbacks; + + 1. liblfds would depend on time() (currently it does not depend on a hosted implementation of standard library) + 2. the output from time may only be 32 bit, and even when it isn't, the top 32 bits are currently all zero... + 3. many threads can begin in the same second; I'd need to add in their thread number, + which means I'd need to *get* their thread number... + + as such, I've decided to use a *fixed* 64-bit seed for the high-quality PRNG; this seed is run + through the MurmerHash3 avalanche phase to generate successive 64-bit values, which populate + the 1024 state of xorshift1024* + + if you have access to a high-frequency clock (often 64-bit), you can use this for the seed + (don't use it for the per-thread PRNG, unless you know the clock can be read without a context switch) + + murmurhash3 code from here; http://xorshift.di.unimi.it/murmurhash3.c + */ + + lfds700_misc_prng_internal_big_slow_high_quality_init( LFDS700_MISC_PRNG_SEED ); + + lfds700_misc_globals.exponential_backoff_timeslot_length_in_loop_iterations_for_cas = EXPONENTIAL_BACKOFF_TIMESLOT_LENGTH_IN_INCS_FOR_CAS; + lfds700_misc_globals.exponential_backoff_timeslot_length_in_loop_iterations_for_dwcas = EXPONENTIAL_BACKOFF_TIMESLOT_LENGTH_IN_INCS_FOR_DWCAS; + + LFDS700_MISC_BARRIER_STORE; + + lfds700_misc_force_store(); + + return; +} + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_misc/lfds700_misc_internal.h b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_misc/lfds700_misc_internal.h new file mode 100644 index 0000000000..9ed927efc9 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_misc/lfds700_misc_internal.h @@ -0,0 +1,10 @@ +/***** the library wide include file *****/ +#include "../liblfds700_internal.h" + +/***** defines *****/ +#define EXPONENTIAL_BACKOFF_TIMESLOT_LENGTH_IN_INCS_FOR_CAS 8 +#define EXPONENTIAL_BACKOFF_TIMESLOT_LENGTH_IN_INCS_FOR_DWCAS 16 + +/***** private prototypes *****/ +void lfds700_misc_prng_internal_big_slow_high_quality_init( int long long unsigned seed ); + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_misc/lfds700_misc_prng.c b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_misc/lfds700_misc_prng.c new file mode 100644 index 0000000000..84ae25fe71 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_misc/lfds700_misc_prng.c @@ -0,0 +1,144 @@ +/***** includes *****/ +#include "lfds700_misc_internal.h" + +/***** defines *****/ +#define LFDS700_PRNG_STATE_SIZE 16 + +/***** struct *****/ +struct lfds700_misc_prng_big_slow_high_quality_state +{ + lfds700_pal_atom_t LFDS700_PAL_ALIGN(LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES) + xorshift1024star_spinlock; + + // TRD : must be a 32 bit signed int + int + xorshift1024star_index; + + int long long unsigned + xorshift1024star_state[LFDS700_PRNG_STATE_SIZE]; +}; + +/***** locals *****/ +struct lfds700_misc_prng_big_slow_high_quality_state + pbshqs; + +/***** private prototypes *****/ +static void lfds700_misc_prng_internal_hash_murmurhash3( int long long unsigned *murmurhash3_state ); +static void lfds700_misc_prng_internal_big_slow_high_quality_generate( struct lfds700_misc_prng_big_slow_high_quality_state *ps, lfds700_pal_uint_t *random_value ); + + + + + +/****************************************************************************/ +void lfds700_misc_prng_init( struct lfds700_misc_prng_state *ps ) +{ + LFDS700_PAL_ASSERT( ps != NULL ); + + /* TRD : we use the big, slow, high quality PRNG to generate the initial value + for the small, fast, low qulity PRNG, which is used in exponential backoff + + we need the load barrier to catch any changes to the backoff periods + */ + + lfds700_misc_prng_internal_big_slow_high_quality_generate( &pbshqs, &ps->prng_state ); + + LFDS700_MISC_BARRIER_LOAD; + + ps->local_copy_of_global_exponential_backoff_timeslot_length_in_loop_iterations_for_cas = lfds700_misc_globals.exponential_backoff_timeslot_length_in_loop_iterations_for_cas; + ps->local_copy_of_global_exponential_backoff_timeslot_length_in_loop_iterations_for_dwcas = lfds700_misc_globals.exponential_backoff_timeslot_length_in_loop_iterations_for_dwcas; + + return; +} + + + + + +/****************************************************************************/ +void lfds700_misc_prng_internal_big_slow_high_quality_init( int long long unsigned seed ) +{ + lfds700_pal_uint_t + loop; + + LFDS700_PAL_ASSERT( seed != 0 ); // TRD : a 0 seed causes all zeros in the entropy state, so is forbidden + + pbshqs.xorshift1024star_spinlock = LFDS700_MISC_FLAG_LOWERED; + + for( loop = 0 ; loop < LFDS700_PRNG_STATE_SIZE ; loop++ ) + { + lfds700_misc_prng_internal_hash_murmurhash3( &seed ); + pbshqs.xorshift1024star_state[loop] = seed; + } + + pbshqs.xorshift1024star_index = 0; + + return; +} + + + + + +/****************************************************************************/ +static void lfds700_misc_prng_internal_hash_murmurhash3( int long long unsigned *murmurhash3_state ) +{ + LFDS700_PAL_ASSERT( murmurhash3_state != NULL ); + + *murmurhash3_state ^= *murmurhash3_state >> 33; + *murmurhash3_state *= 0xff51afd7ed558ccdULL; + *murmurhash3_state ^= *murmurhash3_state >> 33; + *murmurhash3_state *= 0xc4ceb9fe1a85ec53ULL; + *murmurhash3_state ^= *murmurhash3_state >> 33; + + return; +} + + + + + +/****************************************************************************/ +static void lfds700_misc_prng_internal_big_slow_high_quality_generate( struct lfds700_misc_prng_big_slow_high_quality_state *ps, lfds700_pal_uint_t *random_value ) +{ + char unsigned + result; + + int long long unsigned + xs_temp_one, + xs_temp_two; + + lfds700_pal_atom_t + compare = LFDS700_MISC_FLAG_LOWERED, + exchange = LFDS700_MISC_FLAG_LOWERED; + + LFDS700_PAL_ASSERT( ps != NULL ); + LFDS700_PAL_ASSERT( random_value != NULL ); + + // TRD : this is single-threaded code, on a per-state basis + do + { + compare = LFDS700_MISC_FLAG_LOWERED; + LFDS700_PAL_ATOMIC_CAS( &ps->xorshift1024star_spinlock, &compare, (lfds700_pal_atom_t) LFDS700_MISC_FLAG_RAISED, LFDS700_MISC_CAS_STRENGTH_STRONG, result ); + } + while( result == 0 ); + + // TRD : xorshift1024* code from here; http://xorshift.di.unimi.it/xorshift1024star.c + + xs_temp_one = ps->xorshift1024star_state[ ps->xorshift1024star_index ]; + ps->xorshift1024star_index = ( ps->xorshift1024star_index + 1 ) & 15; + xs_temp_two = ps->xorshift1024star_state[ ps->xorshift1024star_index ]; + + xs_temp_two ^= xs_temp_two << 31; + xs_temp_two ^= xs_temp_two >> 11; + xs_temp_one ^= xs_temp_one >> 30; + + ps->xorshift1024star_state[ ps->xorshift1024star_index ] = xs_temp_one ^ xs_temp_two; + + *random_value = (lfds700_pal_uint_t) ( ps->xorshift1024star_state[ ps->xorshift1024star_index ] * 1181783497276652981LL ); + + LFDS700_PAL_ATOMIC_EXCHANGE( &ps->xorshift1024star_spinlock, &exchange ); + + return; +} + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_misc/lfds700_misc_query.c b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_misc/lfds700_misc_query.c new file mode 100644 index 0000000000..fd3595d86a --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_misc/lfds700_misc_query.c @@ -0,0 +1,48 @@ +/***** includes *****/ +#include "lfds700_misc_internal.h" + + + + + +/****************************************************************************/ +void lfds700_misc_query( enum lfds700_misc_query query_type, void *query_input, void *query_output ) +{ + // TRD : query type can be any value in its range + // TRD : query_input can be NULL in some cases + // TRD : query_outputput can be NULL in some cases + + switch( query_type ) + { + case LFDS700_MISC_QUERY_GET_EXPONENTIAL_BACKOFF_TIMESLOT_LENGTH_IN_LOOP_ITERATIONS_FOR_CAS: + *(lfds700_pal_atom_t *) query_output = lfds700_misc_globals.exponential_backoff_timeslot_length_in_loop_iterations_for_cas; + break; + + case LFDS700_MISC_QUERY_SET_EXPONENTIAL_BACKOFF_TIMESLOT_LENGTH_IN_LOOP_ITERATIONS_FOR_CAS: + LFDS700_PAL_ATOMIC_EXCHANGE( &lfds700_misc_globals.exponential_backoff_timeslot_length_in_loop_iterations_for_cas, (lfds700_pal_atom_t *) query_input ); + break; + + case LFDS700_MISC_QUERY_GET_EXPONENTIAL_BACKOFF_TIMESLOT_LENGTH_IN_LOOP_ITERATIONS_FOR_DWCAS: + *(lfds700_pal_atom_t *) query_output = lfds700_misc_globals.exponential_backoff_timeslot_length_in_loop_iterations_for_dwcas; + break; + + case LFDS700_MISC_QUERY_SET_EXPONENTIAL_BACKOFF_TIMESLOT_LENGTH_IN_LOOP_ITERATIONS_FOR_DWCAS: + LFDS700_PAL_ATOMIC_EXCHANGE( &lfds700_misc_globals.exponential_backoff_timeslot_length_in_loop_iterations_for_dwcas, (lfds700_pal_atom_t *) query_input ); + break; + + case LFDS700_MISC_QUERY_GET_BUILD_AND_VERSION_STRING: + { + char static const + * const build_and_version_string = "liblfds " LFDS700_MISC_VERSION_STRING " (" BUILD_TYPE_STRING ", " LFDS700_PAL_OS_STRING ", " MODE_TYPE_STRING ", " LFDS700_PAL_PROCESSOR_STRING ", " LFDS700_PAL_COMPILER_STRING ")"; + + LFDS700_PAL_ASSERT( query_input == NULL ); + LFDS700_PAL_ASSERT( query_output != NULL ); + + *(char const **) query_output = build_and_version_string; + } + break; + } + + return; +} + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_queue/lfds700_queue_cleanup.c b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_queue/lfds700_queue_cleanup.c new file mode 100644 index 0000000000..f2da905dbe --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_queue/lfds700_queue_cleanup.c @@ -0,0 +1,48 @@ +/***** includes *****/ +#include "lfds700_queue_internal.h" + + + + + +/****************************************************************************/ +void lfds700_queue_cleanup( struct lfds700_queue_state *qs, + void (*element_cleanup_callback)(struct lfds700_queue_state *qs, struct lfds700_queue_element *qe, enum lfds700_misc_flag dummy_element_flag) ) +{ + struct lfds700_queue_element + *qe; + + void + *value; + + LFDS700_PAL_ASSERT( qs != NULL ); + // TRD : element_cleanup_callback can be NULL + + LFDS700_MISC_BARRIER_LOAD; + + if( element_cleanup_callback != NULL ) + { + while( qs->dequeue[POINTER] != qs->enqueue[POINTER] ) + { + // TRD : trailing dummy element, so the first real value is in the next element + value = qs->dequeue[POINTER]->next[POINTER]->value; + + // TRD : user is given back *an* element, but not the one his user data was in + qe = qs->dequeue[POINTER]; + + // TRD : remove the element from queue + qs->dequeue[POINTER] = qs->dequeue[POINTER]->next[POINTER]; + + // TRD : write value into the qe we're going to give the user + qe->value = value; + + element_cleanup_callback( qs, qe, LFDS700_MISC_FLAG_LOWERED ); + } + + // TRD : and now the final element + element_cleanup_callback( qs, (struct lfds700_queue_element *) qs->dequeue[POINTER], LFDS700_MISC_FLAG_RAISED ); + } + + return; +} + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_queue/lfds700_queue_dequeue.c b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_queue/lfds700_queue_dequeue.c new file mode 100644 index 0000000000..853c585039 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_queue/lfds700_queue_dequeue.c @@ -0,0 +1,109 @@ +/***** includes *****/ +#include "lfds700_queue_internal.h" + + + + + +/****************************************************************************/ +int lfds700_queue_dequeue( struct lfds700_queue_state *qs, + struct lfds700_queue_element **qe, + struct lfds700_misc_prng_state *ps ) +{ + char unsigned + result = 0, + unwanted_result; + + enum lfds700_queue_queue_state + state = LFDS700_QUEUE_QUEUE_STATE_UNKNOWN; + + int + rv = 1, + finished_flag = LFDS700_MISC_FLAG_LOWERED; + + lfds700_pal_uint_t + backoff_iteration = LFDS700_MISC_ABSTRACTION_BACKOFF_INITIAL_VALUE; + + struct lfds700_queue_element LFDS700_PAL_ALIGN(LFDS700_PAL_ALIGN_DOUBLE_POINTER) + *dequeue[PAC_SIZE], + *enqueue[PAC_SIZE], + *next[PAC_SIZE]; + + void + *key = NULL, + *value = NULL; + + LFDS700_PAL_ASSERT( qs != NULL ); + LFDS700_PAL_ASSERT( qe != NULL ); + LFDS700_PAL_ASSERT( ps != NULL ); + + LFDS700_MISC_BARRIER_LOAD; + + do + { + dequeue[COUNTER] = qs->dequeue[COUNTER]; + dequeue[POINTER] = qs->dequeue[POINTER]; + + enqueue[COUNTER] = qs->enqueue[COUNTER]; + enqueue[POINTER] = qs->enqueue[POINTER]; + + next[COUNTER] = qs->dequeue[POINTER]->next[COUNTER]; + next[POINTER] = qs->dequeue[POINTER]->next[POINTER]; + + LFDS700_MISC_BARRIER_LOAD; + + if( dequeue[COUNTER] == qs->dequeue[COUNTER] and dequeue[POINTER] == qs->dequeue[POINTER] ) + { + if( enqueue[POINTER] == dequeue[POINTER] and next[POINTER] == NULL ) + state = LFDS700_QUEUE_QUEUE_STATE_EMPTY; + + if( enqueue[POINTER] == dequeue[POINTER] and next[POINTER] != NULL ) + state = LFDS700_QUEUE_QUEUE_STATE_ENQUEUE_OUT_OF_PLACE; + + if( enqueue[POINTER] != dequeue[POINTER] ) + state = LFDS700_QUEUE_QUEUE_STATE_ATTEMPT_DEQUEUE; + + switch( state ) + { + case LFDS700_QUEUE_QUEUE_STATE_UNKNOWN: + // TRD : eliminates compiler warning + break; + + case LFDS700_QUEUE_QUEUE_STATE_EMPTY: + rv = 0; + *qe = NULL; + finished_flag = LFDS700_MISC_FLAG_RAISED; + break; + + case LFDS700_QUEUE_QUEUE_STATE_ENQUEUE_OUT_OF_PLACE: + next[COUNTER] = enqueue[COUNTER] + 1; + LFDS700_MISC_BARRIER_STORE; + LFDS700_PAL_ATOMIC_DWCAS( qs->enqueue, enqueue, next, LFDS700_MISC_CAS_STRENGTH_WEAK, unwanted_result ); + break; + + case LFDS700_QUEUE_QUEUE_STATE_ATTEMPT_DEQUEUE: + key = next[POINTER]->key; + value = next[POINTER]->value; + + next[COUNTER] = dequeue[COUNTER] + 1; + LFDS700_MISC_BARRIER_STORE; + LFDS700_PAL_ATOMIC_DWCAS_WITH_BACKOFF( qs->dequeue, dequeue, next, LFDS700_MISC_CAS_STRENGTH_WEAK, result, backoff_iteration, ps ); + + if( result == 1 ) + finished_flag = LFDS700_MISC_FLAG_RAISED; + break; + } + } + } + while( finished_flag == LFDS700_MISC_FLAG_LOWERED ); + + if( result == 1 ) + { + *qe = dequeue[POINTER]; + (*qe)->key = key; + (*qe)->value = value; + } + + return( rv ); +} + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_queue/lfds700_queue_enqueue.c b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_queue/lfds700_queue_enqueue.c new file mode 100644 index 0000000000..07df84d851 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_queue/lfds700_queue_enqueue.c @@ -0,0 +1,74 @@ +/***** includes *****/ +#include "lfds700_queue_internal.h" + + + + + +/****************************************************************************/ +void lfds700_queue_enqueue( struct lfds700_queue_state *qs, + struct lfds700_queue_element *qe, + struct lfds700_misc_prng_state *ps ) +{ + char unsigned + result = 0, + unwanted_result; + + lfds700_pal_uint_t + backoff_iteration = LFDS700_MISC_ABSTRACTION_BACKOFF_INITIAL_VALUE; + + struct lfds700_queue_element LFDS700_PAL_ALIGN(LFDS700_PAL_ALIGN_DOUBLE_POINTER) + *volatile enqueue[PAC_SIZE], + *new_enqueue[PAC_SIZE], + *volatile next[PAC_SIZE]; + + LFDS700_PAL_ASSERT( qs != NULL ); + LFDS700_PAL_ASSERT( qe != NULL ); + LFDS700_PAL_ASSERT( (lfds700_pal_uint_t) qe->next % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES == 0 ); + LFDS700_PAL_ASSERT( (lfds700_pal_uint_t) &qe->key % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES == 0 ); + LFDS700_PAL_ASSERT( ps != NULL ); + + qe->next[COUNTER] = (struct lfds700_queue_element *) LFDS700_MISC_PRNG_GENERATE( ps ); + qe->next[POINTER] = NULL; + + new_enqueue[POINTER] = qe; + + LFDS700_MISC_BARRIER_LOAD; + + do + { + enqueue[COUNTER] = qs->enqueue[COUNTER]; + enqueue[POINTER] = qs->enqueue[POINTER]; + + next[COUNTER] = qs->enqueue[POINTER]->next[COUNTER]; + next[POINTER] = qs->enqueue[POINTER]->next[POINTER]; + + LFDS700_MISC_BARRIER_LOAD; + + if( qs->enqueue[COUNTER] == enqueue[COUNTER] and qs->enqueue[POINTER] == enqueue[POINTER] ) + { + if( next[POINTER] == NULL ) + { + new_enqueue[COUNTER] = next[COUNTER] + 1; + LFDS700_MISC_BARRIER_STORE; + LFDS700_PAL_ATOMIC_DWCAS_WITH_BACKOFF( enqueue[POINTER]->next, next, new_enqueue, LFDS700_MISC_CAS_STRENGTH_WEAK, result, backoff_iteration, ps ); + } + else + { + next[COUNTER] = enqueue[COUNTER] + 1; + LFDS700_MISC_BARRIER_STORE; + // TRD : strictly, this is a weak CAS, but we do an extra iteration of the main loop on a fake failure, so we set it to be strong + LFDS700_PAL_ATOMIC_DWCAS( qs->enqueue, enqueue, next, LFDS700_MISC_CAS_STRENGTH_STRONG, unwanted_result ); + } + } + } + while( result != 1 ); + + new_enqueue[COUNTER] = enqueue[COUNTER] + 1; + LFDS700_MISC_BARRIER_STORE; + // TRD : move enqueue along; only a weak CAS as the dequeue will solve this if its out of place + LFDS700_PAL_ATOMIC_DWCAS( qs->enqueue, enqueue, new_enqueue, LFDS700_MISC_CAS_STRENGTH_WEAK, unwanted_result ); + + return; +} + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_queue/lfds700_queue_init.c b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_queue/lfds700_queue_init.c new file mode 100644 index 0000000000..15f4e64d8d --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_queue/lfds700_queue_init.c @@ -0,0 +1,43 @@ +/***** includes *****/ +#include "lfds700_queue_internal.h" + + + + + +/****************************************************************************/ +void lfds700_queue_init_valid_on_current_logical_core( struct lfds700_queue_state *qs, struct lfds700_queue_element *qe_dummy, struct lfds700_misc_prng_state *ps, void *user_state ) +{ + LFDS700_PAL_ASSERT( qs != NULL ); + LFDS700_PAL_ASSERT( (lfds700_pal_uint_t) &qs->enqueue % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES == 0 ); + LFDS700_PAL_ASSERT( (lfds700_pal_uint_t) &qs->dequeue % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES == 0 ); + LFDS700_PAL_ASSERT( (lfds700_pal_uint_t) &qs->user_state % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES == 0 ); + LFDS700_PAL_ASSERT( qe_dummy != NULL ); + LFDS700_PAL_ASSERT( (lfds700_pal_uint_t) qe_dummy->next % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES == 0 ); + LFDS700_PAL_ASSERT( (lfds700_pal_uint_t) &qe_dummy->key % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES == 0 ); + LFDS700_PAL_ASSERT( ps != NULL ); + // TRD : user_state can be UNLL + + /* TRD : qe_dummy is a dummy element, needed for init + the qs->enqueue and qs->dequeue counters do not need to be initialized + but it does no harm to do so, and stops a valgrind complaint + */ + + qs->enqueue[POINTER] = qe_dummy; + qs->enqueue[COUNTER] = (struct lfds700_queue_element *) 0; + qs->dequeue[POINTER] = qe_dummy; + qs->dequeue[COUNTER] = (struct lfds700_queue_element *) 0; + + qe_dummy->next[POINTER] = NULL; + qe_dummy->next[COUNTER] = (struct lfds700_queue_element *) LFDS700_MISC_PRNG_GENERATE( ps ); + qe_dummy->value = NULL; + + qs->user_state = user_state; + + LFDS700_MISC_BARRIER_STORE; + + lfds700_misc_force_store(); + + return; +} + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_queue/lfds700_queue_internal.h b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_queue/lfds700_queue_internal.h new file mode 100644 index 0000000000..81c9b69f48 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_queue/lfds700_queue_internal.h @@ -0,0 +1,14 @@ +/***** the library wide include file *****/ +#include "../liblfds700_internal.h" + +/***** enums *****/ +enum lfds700_queue_queue_state +{ + LFDS700_QUEUE_QUEUE_STATE_UNKNOWN, + LFDS700_QUEUE_QUEUE_STATE_EMPTY, + LFDS700_QUEUE_QUEUE_STATE_ENQUEUE_OUT_OF_PLACE, + LFDS700_QUEUE_QUEUE_STATE_ATTEMPT_DEQUEUE +}; + +/***** private prototypes *****/ + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_queue/lfds700_queue_query.c b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_queue/lfds700_queue_query.c new file mode 100644 index 0000000000..15b4307ff2 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_queue/lfds700_queue_query.c @@ -0,0 +1,126 @@ +/***** includes *****/ +#include "lfds700_queue_internal.h" + +/***** private prototypes *****/ +static void lfds700_queue_internal_validate( struct lfds700_queue_state *qs, struct lfds700_misc_validation_info *vi, enum lfds700_misc_validity *lfds700_queue_validity ); + + + + + +/****************************************************************************/ +void lfds700_queue_query( struct lfds700_queue_state *qs, enum lfds700_queue_query query_type, void *query_input, void *query_output ) +{ + struct lfds700_queue_element + *qe; + + LFDS700_MISC_BARRIER_LOAD; + + LFDS700_PAL_ASSERT( qs != NULL ); + // TRD : query_type can be any value in its range + + switch( query_type ) + { + case LFDS700_QUEUE_QUERY_SINGLETHREADED_GET_COUNT: + LFDS700_PAL_ASSERT( query_input == NULL ); + LFDS700_PAL_ASSERT( query_output != NULL ); + + *(lfds700_pal_uint_t *) query_output = 0; + + qe = (struct lfds700_queue_element *) qs->dequeue[POINTER]; + + while( qe != NULL ) + { + ( *(lfds700_pal_uint_t *) query_output )++; + qe = (struct lfds700_queue_element *) qe->next[POINTER]; + } + + // TRD : remember there is a dummy element in the queue + ( *(lfds700_pal_uint_t *) query_output )--; + break; + + case LFDS700_QUEUE_QUERY_SINGLETHREADED_VALIDATE: + // TRD : query_input can be NULL + LFDS700_PAL_ASSERT( query_output != NULL ); + + lfds700_queue_internal_validate( qs, (struct lfds700_misc_validation_info *) query_input, (enum lfds700_misc_validity *) query_output ); + break; + } + + return; +} + + + + + +/****************************************************************************/ +static void lfds700_queue_internal_validate( struct lfds700_queue_state *qs, struct lfds700_misc_validation_info *vi, enum lfds700_misc_validity *lfds700_queue_validity ) +{ + lfds700_pal_uint_t + number_elements = 0; + + struct lfds700_queue_element + *qe_fast, + *qe_slow; + + LFDS700_PAL_ASSERT( qs != NULL ); + // TRD : vi can be NULL + LFDS700_PAL_ASSERT( lfds700_queue_validity != NULL ); + + *lfds700_queue_validity = LFDS700_MISC_VALIDITY_VALID; + + qe_slow = qe_fast = (struct lfds700_queue_element *) qs->dequeue[POINTER]; + + /* TRD : first, check for a loop + we have two pointers + both of which start at the dequeue end of the queue + we enter a loop + and on each iteration + we advance one pointer by one element + and the other by two + + we exit the loop when both pointers are NULL + (have reached the end of the queue) + + or + + if we fast pointer 'sees' the slow pointer + which means we have a loop + */ + + if( qe_slow != NULL ) + do + { + qe_slow = qe_slow->next[POINTER]; + + if( qe_fast != NULL ) + qe_fast = qe_fast->next[POINTER]; + + if( qe_fast != NULL ) + qe_fast = qe_fast->next[POINTER]; + } + while( qe_slow != NULL and qe_fast != qe_slow ); + + if( qe_fast != NULL and qe_slow != NULL and qe_fast == qe_slow ) + *lfds700_queue_validity = LFDS700_MISC_VALIDITY_INVALID_LOOP; + + /* TRD : now check for expected number of elements + vi can be NULL, in which case we do not check + we know we don't have a loop from our earlier check + */ + + if( *lfds700_queue_validity == LFDS700_MISC_VALIDITY_VALID and vi != NULL ) + { + lfds700_queue_query( qs, LFDS700_QUEUE_QUERY_SINGLETHREADED_GET_COUNT, NULL, (void *) &number_elements ); + + if( number_elements < vi->min_elements ) + *lfds700_queue_validity = LFDS700_MISC_VALIDITY_INVALID_MISSING_ELEMENTS; + + if( number_elements > vi->max_elements ) + *lfds700_queue_validity = LFDS700_MISC_VALIDITY_INVALID_ADDITIONAL_ELEMENTS; + } + + return; +} + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_queue_bounded_singleconsumer_singleproducer/lfds700_queue_bounded_singleconsumer_singleproducer_cleanup.c b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_queue_bounded_singleconsumer_singleproducer/lfds700_queue_bounded_singleconsumer_singleproducer_cleanup.c new file mode 100644 index 0000000000..2b157bd973 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_queue_bounded_singleconsumer_singleproducer/lfds700_queue_bounded_singleconsumer_singleproducer_cleanup.c @@ -0,0 +1,30 @@ +/***** includes *****/ +#include "lfds700_queue_bounded_singleconsumer_singleproducer_internal.h" + + + + + +/****************************************************************************/ +void lfds700_queue_bss_cleanup( struct lfds700_queue_bss_state *qbsss, + void (*element_cleanup_callback)(struct lfds700_queue_bss_state *qbsss, void *key, void *value) ) +{ + int long long unsigned + loop; + + struct lfds700_queue_bss_element + *qbsse; + + LFDS700_PAL_ASSERT( qbsss != NULL ); + // TRD : element_cleanup_callback can be NULL + + if( element_cleanup_callback != NULL ) + for( loop = qbsss->read_index ; loop < qbsss->read_index + qbsss->number_elements ; loop++ ) + { + qbsse = qbsss->element_array + (loop % qbsss->number_elements); + element_cleanup_callback( qbsss, qbsse->key, qbsse->value ); + } + + return; +} + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_queue_bounded_singleconsumer_singleproducer/lfds700_queue_bounded_singleconsumer_singleproducer_dequeue.c b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_queue_bounded_singleconsumer_singleproducer/lfds700_queue_bounded_singleconsumer_singleproducer_dequeue.c new file mode 100644 index 0000000000..28f735f610 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_queue_bounded_singleconsumer_singleproducer/lfds700_queue_bounded_singleconsumer_singleproducer_dequeue.c @@ -0,0 +1,42 @@ +/***** includes *****/ +#include "lfds700_queue_bounded_singleconsumer_singleproducer_internal.h" + + + + + +/****************************************************************************/ +int lfds700_queue_bss_dequeue( struct lfds700_queue_bss_state *qbsss, void **key, void **value ) +{ + int + rv = 0; + + struct lfds700_queue_bss_element + *qbsse; + + LFDS700_PAL_ASSERT( qbsss != NULL ); + // TRD : key can be NULL + // TRD : value can be NULL + + LFDS700_MISC_BARRIER_LOAD; + + if( qbsss->read_index != qbsss->write_index ) + { + qbsse = qbsss->element_array + qbsss->read_index; + + if( key != NULL ) + *key = qbsse->key; + + if( value != NULL ) + *value = qbsse->value; + + qbsss->read_index = (qbsss->read_index + 1) & qbsss->mask; + + LFDS700_MISC_BARRIER_STORE; + + rv = 1; + } + + return( rv ); +} + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_queue_bounded_singleconsumer_singleproducer/lfds700_queue_bounded_singleconsumer_singleproducer_enqueue.c b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_queue_bounded_singleconsumer_singleproducer/lfds700_queue_bounded_singleconsumer_singleproducer_enqueue.c new file mode 100644 index 0000000000..c74091a23e --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_queue_bounded_singleconsumer_singleproducer/lfds700_queue_bounded_singleconsumer_singleproducer_enqueue.c @@ -0,0 +1,39 @@ +/***** includes *****/ +#include "lfds700_queue_bounded_singleconsumer_singleproducer_internal.h" + + + + + +/****************************************************************************/ +int lfds700_queue_bss_enqueue( struct lfds700_queue_bss_state *qbsss, void *key, void *value ) +{ + int + rv = 0; + + struct lfds700_queue_bss_element + *qbsse; + + LFDS700_PAL_ASSERT( qbsss != NULL ); + // TRD : key can be NULL + // TRD : value can be NULL + + LFDS700_MISC_BARRIER_LOAD; + + if( ( (qbsss->write_index+1) & qbsss->mask ) != qbsss->read_index ) + { + qbsse = qbsss->element_array + qbsss->write_index; + + qbsse->key = key; + qbsse->value = value; + + LFDS700_MISC_BARRIER_STORE; + + qbsss->write_index = (qbsss->write_index + 1) & qbsss->mask; + + rv = 1; + } + + return( rv ); +} + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_queue_bounded_singleconsumer_singleproducer/lfds700_queue_bounded_singleconsumer_singleproducer_init.c b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_queue_bounded_singleconsumer_singleproducer/lfds700_queue_bounded_singleconsumer_singleproducer_init.c new file mode 100644 index 0000000000..9127fef443 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_queue_bounded_singleconsumer_singleproducer/lfds700_queue_bounded_singleconsumer_singleproducer_init.c @@ -0,0 +1,63 @@ +/***** includes *****/ +#include "lfds700_queue_bounded_singleconsumer_singleproducer_internal.h" + + + + + +/****************************************************************************/ +void lfds700_queue_bss_init_valid_on_current_logical_core( struct lfds700_queue_bss_state *qbsss, + struct lfds700_queue_bss_element *element_array, + lfds700_pal_uint_t number_elements, + void *user_state ) +{ + LFDS700_PAL_ASSERT( qbsss != NULL ); + LFDS700_PAL_ASSERT( element_array != NULL ); + LFDS700_PAL_ASSERT( number_elements >= 2 ); + LFDS700_PAL_ASSERT( ( number_elements & (number_elements-1) ) == 0 ); // TRD : number_elements must be a positive integer power of 2 + // TRD : user_state can be NULL + + /* TRD : the use of mask and the restriction on a power of two + upon the number of elements bears some remark + + in this queue, there are a fixed number of elements + we have a read index and a write index + when we write, and thre is space to write, we increment the write index + (if no space to write, we just return) + when we read, and there are elements to be read, we after reading increment the read index + (if no elements to read, we just return) + the problem is - how do we handle wrap around? + e.g. when I write, but my write index is now equal to the number of elements + the usual solution is to modulus the write index by the nunmber of elements + problem is modulus is slow + there is a better way + first, we restrict the number of elements to be a power of two + so imagine we have a 64-bit system and we set the number of elements to be 2^64 + this gives us a bit pattern of 1000 0000 0000 0000 (...etc, lots of zeros) + now (just roll with this for a bit) subtract one from this + this gives us a mask (on a two's compliment machine) + 0111 1111 1111 1111 (...etc, lots of ones) + so what we do now, when we increment an index (think of the write index as the example) + we bitwise and it with the mask + now think about thwt happens + all the numbers up to 2^64 will be unchanged - their MSB is never set, and we and with all the other bits + but when we finally hit 2^64 and need to roll over... bingo! + we drop MSB (which we finally have) and have the value 0! + this is exactly what we want + bitwise and is much faster than modulus + */ + + qbsss->number_elements = number_elements; + qbsss->mask = qbsss->number_elements - 1; + qbsss->read_index = 0; + qbsss->write_index = 0; + qbsss->element_array = element_array; + qbsss->user_state = user_state; + + LFDS700_MISC_BARRIER_STORE; + + lfds700_misc_force_store(); + + return; +} + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_queue_bounded_singleconsumer_singleproducer/lfds700_queue_bounded_singleconsumer_singleproducer_internal.h b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_queue_bounded_singleconsumer_singleproducer/lfds700_queue_bounded_singleconsumer_singleproducer_internal.h new file mode 100644 index 0000000000..7a7d541804 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_queue_bounded_singleconsumer_singleproducer/lfds700_queue_bounded_singleconsumer_singleproducer_internal.h @@ -0,0 +1,5 @@ +/***** the library wide include file *****/ +#include "../liblfds700_internal.h" + +/***** private prototypes *****/ + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_queue_bounded_singleconsumer_singleproducer/lfds700_queue_bounded_singleconsumer_singleproducer_query.c b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_queue_bounded_singleconsumer_singleproducer/lfds700_queue_bounded_singleconsumer_singleproducer_query.c new file mode 100644 index 0000000000..aabcae23f3 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_queue_bounded_singleconsumer_singleproducer/lfds700_queue_bounded_singleconsumer_singleproducer_query.c @@ -0,0 +1,70 @@ +/***** includes *****/ +#include "lfds700_queue_bounded_singleconsumer_singleproducer_internal.h" + +/***** private prototypes *****/ +static void lfds700_queue_bss_internal_validate( struct lfds700_queue_bss_state *qbsss, struct lfds700_misc_validation_info *vi, enum lfds700_misc_validity *lfds700_validity ); + + + + + +/****************************************************************************/ +void lfds700_queue_bss_query( struct lfds700_queue_bss_state *qbsss, enum lfds700_queue_bss_query query_type, void *query_input, void *query_output ) +{ + LFDS700_PAL_ASSERT( qbsss != NULL ); + // TRD : query_type can be any value in its range + + switch( query_type ) + { + case LFDS700_QUEUE_BSS_QUERY_GET_POTENTIALLY_INACCURATE_COUNT: + LFDS700_PAL_ASSERT( query_input == NULL ); + LFDS700_PAL_ASSERT( query_output != NULL ); + + LFDS700_MISC_BARRIER_LOAD; + + *(lfds700_pal_uint_t *) query_output = +( qbsss->write_index - qbsss->read_index ); + if( qbsss->read_index > qbsss->write_index ) + *(lfds700_pal_uint_t *) query_output = qbsss->number_elements - *(lfds700_pal_uint_t *) query_output; + break; + + case LFDS700_QUEUE_BSS_QUERY_VALIDATE: + // TRD : query_input can be NULL + LFDS700_PAL_ASSERT( query_output != NULL ); + + lfds700_queue_bss_internal_validate( qbsss, (struct lfds700_misc_validation_info *) query_input, (enum lfds700_misc_validity *) query_output ); + break; + } + + return; +} + + + + + +/****************************************************************************/ +static void lfds700_queue_bss_internal_validate( struct lfds700_queue_bss_state *qbsss, struct lfds700_misc_validation_info *vi, enum lfds700_misc_validity *lfds700_validity ) +{ + LFDS700_PAL_ASSERT( qbsss != NULL ); + // TRD : vi can be NULL + LFDS700_PAL_ASSERT( lfds700_validity != NULL ); + + *lfds700_validity = LFDS700_MISC_VALIDITY_VALID; + + if( vi != NULL ) + { + lfds700_pal_uint_t + number_elements; + + lfds700_queue_bss_query( qbsss, LFDS700_QUEUE_BSS_QUERY_GET_POTENTIALLY_INACCURATE_COUNT, NULL, (void *) &number_elements ); + + if( number_elements < vi->min_elements ) + *lfds700_validity = LFDS700_MISC_VALIDITY_INVALID_MISSING_ELEMENTS; + + if( number_elements > vi->max_elements ) + *lfds700_validity = LFDS700_MISC_VALIDITY_INVALID_ADDITIONAL_ELEMENTS; + } + + return; +} + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_ringbuffer/lfds700_ringbuffer_cleanup.c b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_ringbuffer/lfds700_ringbuffer_cleanup.c new file mode 100644 index 0000000000..447c93041e --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_ringbuffer/lfds700_ringbuffer_cleanup.c @@ -0,0 +1,86 @@ +/***** includes *****/ +#include "lfds700_ringbuffer_internal.h" + +/***** private prototypes *****/ +static void lfds700_ringbuffer_internal_queue_element_cleanup_callback( struct lfds700_queue_state *qs, struct lfds700_queue_element *qe, enum lfds700_misc_flag dummy_element_flag ); +static void lfds700_ringbuffer_internal_freelist_element_cleanup_callback( struct lfds700_freelist_state *fs, struct lfds700_freelist_element *fe ); + + + + + +/****************************************************************************/ +void lfds700_ringbuffer_cleanup( struct lfds700_ringbuffer_state *rs, + void (*element_cleanup_callback)(struct lfds700_ringbuffer_state *rs, void *key, void *value, enum lfds700_misc_flag unread_flag) ) +{ + LFDS700_PAL_ASSERT( rs != NULL ); + // TRD : element_cleanup_callback can be NULL + + if( element_cleanup_callback != NULL ) + { + rs->element_cleanup_callback = element_cleanup_callback; + lfds700_queue_cleanup( &rs->qs, lfds700_ringbuffer_internal_queue_element_cleanup_callback ); + lfds700_freelist_cleanup( &rs->fs, lfds700_ringbuffer_internal_freelist_element_cleanup_callback ); + } + + return; +} + + + + + +/****************************************************************************/ +#pragma warning( disable : 4100 ) + +static void lfds700_ringbuffer_internal_queue_element_cleanup_callback( struct lfds700_queue_state *qs, struct lfds700_queue_element *qe, enum lfds700_misc_flag dummy_element_flag ) +{ + struct lfds700_ringbuffer_element + *re; + + struct lfds700_ringbuffer_state + *rs; + + LFDS700_PAL_ASSERT( qs != NULL ); + LFDS700_PAL_ASSERT( qe != NULL ); + // TRD : dummy_element can be any value in its range + + rs = (struct lfds700_ringbuffer_state *) LFDS700_QUEUE_GET_USER_STATE_FROM_STATE( *qs ); + re = (struct lfds700_ringbuffer_element *) LFDS700_QUEUE_GET_VALUE_FROM_ELEMENT( *qe ); + + if( dummy_element_flag == LFDS700_MISC_FLAG_LOWERED ) + rs->element_cleanup_callback( rs, re->key, re->value, LFDS700_MISC_FLAG_RAISED ); + + return; +} + +#pragma warning( default : 4100 ) + + + + + +/****************************************************************************/ +#pragma warning( disable : 4100 ) + +static void lfds700_ringbuffer_internal_freelist_element_cleanup_callback( struct lfds700_freelist_state *fs, struct lfds700_freelist_element *fe ) +{ + struct lfds700_ringbuffer_element + *re; + + struct lfds700_ringbuffer_state + *rs; + + LFDS700_PAL_ASSERT( fs != NULL ); + LFDS700_PAL_ASSERT( fe != NULL ); + + rs = (struct lfds700_ringbuffer_state *) LFDS700_FREELIST_GET_USER_STATE_FROM_STATE( *fs ); + re = (struct lfds700_ringbuffer_element *) LFDS700_FREELIST_GET_VALUE_FROM_ELEMENT( *fe ); + + rs->element_cleanup_callback( rs, re->key, re->value, LFDS700_MISC_FLAG_LOWERED ); + + return; +} + +#pragma warning( default : 4100 ) + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_ringbuffer/lfds700_ringbuffer_init.c b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_ringbuffer/lfds700_ringbuffer_init.c new file mode 100644 index 0000000000..a6cd1e3616 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_ringbuffer/lfds700_ringbuffer_init.c @@ -0,0 +1,51 @@ +/***** includes *****/ +#include "lfds700_ringbuffer_internal.h" + + + + + +/****************************************************************************/ +void lfds700_ringbuffer_init_valid_on_current_logical_core( struct lfds700_ringbuffer_state *rs, + struct lfds700_ringbuffer_element *re_array_inc_dummy, + lfds700_pal_uint_t number_elements, + struct lfds700_misc_prng_state *ps, + void *user_state ) +{ + lfds700_pal_uint_t + loop; + + LFDS700_PAL_ASSERT( rs != NULL ); + LFDS700_PAL_ASSERT( (lfds700_pal_uint_t) &rs->fs % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES == 0 ); + LFDS700_PAL_ASSERT( (lfds700_pal_uint_t) &rs->qs % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES == 0 ); + LFDS700_PAL_ASSERT( re_array_inc_dummy != NULL ); + LFDS700_PAL_ASSERT( (lfds700_pal_uint_t) &re_array_inc_dummy[0].fe % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES == 0 ); + LFDS700_PAL_ASSERT( (lfds700_pal_uint_t) &re_array_inc_dummy[0].qe % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES == 0 ); + LFDS700_PAL_ASSERT( number_elements >= 2 ); + LFDS700_PAL_ASSERT( ps != NULL ); + // TRD : user_state can be NULL + + rs->user_state = user_state; + + re_array_inc_dummy[0].qe_use = &re_array_inc_dummy[0].qe; + + lfds700_freelist_init_valid_on_current_logical_core( &rs->fs, rs ); + lfds700_queue_init_valid_on_current_logical_core( &rs->qs, &re_array_inc_dummy[0].qe, ps, rs ); + + for( loop = 1 ; loop < number_elements ; loop++ ) + { + LFDS700_PAL_ASSERT( (lfds700_pal_uint_t) &re_array_inc_dummy[loop].fe % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES == 0 ); + LFDS700_PAL_ASSERT( (lfds700_pal_uint_t) &re_array_inc_dummy[loop].qe % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES == 0 ); + + re_array_inc_dummy[loop].qe_use = &re_array_inc_dummy[loop].qe; + LFDS700_FREELIST_SET_VALUE_IN_ELEMENT( re_array_inc_dummy[loop].fe, &re_array_inc_dummy[loop] ); + lfds700_freelist_push( &rs->fs, &re_array_inc_dummy[loop].fe, ps ); + } + + LFDS700_MISC_BARRIER_STORE; + + lfds700_misc_force_store(); + + return; +} + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_ringbuffer/lfds700_ringbuffer_internal.h b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_ringbuffer/lfds700_ringbuffer_internal.h new file mode 100644 index 0000000000..7a7d541804 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_ringbuffer/lfds700_ringbuffer_internal.h @@ -0,0 +1,5 @@ +/***** the library wide include file *****/ +#include "../liblfds700_internal.h" + +/***** private prototypes *****/ + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_ringbuffer/lfds700_ringbuffer_query.c b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_ringbuffer/lfds700_ringbuffer_query.c new file mode 100644 index 0000000000..58b7b3a9cb --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_ringbuffer/lfds700_ringbuffer_query.c @@ -0,0 +1,72 @@ +/***** includes *****/ +#include "lfds700_ringbuffer_internal.h" + +/***** private prototypes *****/ +static void lfds700_ringbuffer_internal_validate( struct lfds700_ringbuffer_state *rs, struct lfds700_misc_validation_info *vi, enum lfds700_misc_validity *lfds700_queue_validity, enum lfds700_misc_validity *lfds700_freelist_validity ); + + + +/****************************************************************************/ +void lfds700_ringbuffer_query( struct lfds700_ringbuffer_state *rs, enum lfds700_ringbuffer_query query_type, void *query_input, void *query_output ) +{ + LFDS700_PAL_ASSERT( rs != NULL ); + // TRD : query_type can be any value in its range + + LFDS700_MISC_BARRIER_LOAD; + + switch( query_type ) + { + case LFDS700_RINGBUFFER_QUERY_SINGLETHREADED_GET_COUNT: + LFDS700_PAL_ASSERT( query_input == NULL ); + LFDS700_PAL_ASSERT( query_output != NULL ); + + lfds700_queue_query( &rs->qs, LFDS700_QUEUE_QUERY_SINGLETHREADED_GET_COUNT, NULL, query_output ); + break; + + case LFDS700_RINGBUFFER_QUERY_SINGLETHREADED_VALIDATE: + // TRD : query_input can be NULL + LFDS700_PAL_ASSERT( query_output != NULL ); + + lfds700_ringbuffer_internal_validate( rs, (struct lfds700_misc_validation_info *) query_input, (enum lfds700_misc_validity *) query_output, ((enum lfds700_misc_validity *) query_output)+1 ); + break; + } + + return; +} + + + + + +/****************************************************************************/ +static void lfds700_ringbuffer_internal_validate( struct lfds700_ringbuffer_state *rs, struct lfds700_misc_validation_info *vi, enum lfds700_misc_validity *lfds700_queue_validity, enum lfds700_misc_validity *lfds700_freelist_validity ) +{ + LFDS700_PAL_ASSERT( rs != NULL ); + // TRD : vi can be NULL + LFDS700_PAL_ASSERT( lfds700_queue_validity != NULL ); + LFDS700_PAL_ASSERT( lfds700_freelist_validity != NULL ); + + if( vi == NULL ) + { + lfds700_queue_query( &rs->qs, LFDS700_QUEUE_QUERY_SINGLETHREADED_VALIDATE, NULL, lfds700_queue_validity ); + lfds700_freelist_query( &rs->fs, LFDS700_FREELIST_QUERY_SINGLETHREADED_VALIDATE, NULL, lfds700_freelist_validity ); + } + + if( vi != NULL ) + { + struct lfds700_misc_validation_info + freelist_vi, + queue_vi; + + queue_vi.min_elements = 0; + freelist_vi.min_elements = 0; + queue_vi.max_elements = vi->max_elements; + freelist_vi.max_elements = vi->max_elements; + + lfds700_queue_query( &rs->qs, LFDS700_QUEUE_QUERY_SINGLETHREADED_VALIDATE, &queue_vi, lfds700_queue_validity ); + lfds700_freelist_query( &rs->fs, LFDS700_FREELIST_QUERY_SINGLETHREADED_VALIDATE, &freelist_vi, lfds700_freelist_validity ); + } + + return; +} + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_ringbuffer/lfds700_ringbuffer_read.c b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_ringbuffer/lfds700_ringbuffer_read.c new file mode 100644 index 0000000000..42dbe189e2 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_ringbuffer/lfds700_ringbuffer_read.c @@ -0,0 +1,44 @@ +/***** includes *****/ +#include "lfds700_ringbuffer_internal.h" + + + + + +/****************************************************************************/ +int lfds700_ringbuffer_read( struct lfds700_ringbuffer_state *rs, + void **key, + void **value, + struct lfds700_misc_prng_state *ps ) +{ + int + rv; + + struct lfds700_queue_element + *qe; + + struct lfds700_ringbuffer_element + *re; + + LFDS700_PAL_ASSERT( rs != NULL ); + // TRD : key can be NULL + // TRD : value can be NULL + LFDS700_PAL_ASSERT( ps != NULL ); + + rv = lfds700_queue_dequeue( &rs->qs, &qe, ps ); + + if( rv == 1 ) + { + re = LFDS700_QUEUE_GET_VALUE_FROM_ELEMENT( *qe ); + re->qe_use = (struct lfds700_queue_element *) qe; + if( key != NULL ) + *key = re->key; + if( value != NULL ) + *value = re->value; + LFDS700_FREELIST_SET_VALUE_IN_ELEMENT( re->fe, re ); + lfds700_freelist_push( &rs->fs, &re->fe, ps ); + } + + return( rv ); +} + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_ringbuffer/lfds700_ringbuffer_write.c b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_ringbuffer/lfds700_ringbuffer_write.c new file mode 100644 index 0000000000..a16a8686c1 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_ringbuffer/lfds700_ringbuffer_write.c @@ -0,0 +1,78 @@ +/***** includes *****/ +#include "lfds700_ringbuffer_internal.h" + + + + + +/****************************************************************************/ +void lfds700_ringbuffer_write( struct lfds700_ringbuffer_state *rs, + void *key, + void *value, + enum lfds700_misc_flag *overwrite_occurred_flag, + void **overwritten_key, + void **overwritten_value, + struct lfds700_misc_prng_state *ps ) +{ + int + rv = 0; + + struct lfds700_freelist_element + *fe; + + struct lfds700_queue_element + *qe; + + struct lfds700_ringbuffer_element + *re = NULL; + + LFDS700_PAL_ASSERT( rs != NULL ); + // TRD : key can be NULL + // TRD : value can be NULL + // TRD : overwrite_occurred_flag can be NULL + // TRD : overwritten_key can be NULL + // TRD : overwritten_value can be NULL + LFDS700_PAL_ASSERT( ps != NULL ); + + if( overwrite_occurred_flag != NULL ) + *overwrite_occurred_flag = LFDS700_MISC_FLAG_LOWERED; + + do + { + rv = lfds700_freelist_pop( &rs->fs, &fe, ps ); + + if( rv == 1 ) + re = LFDS700_FREELIST_GET_VALUE_FROM_ELEMENT( *fe ); + + if( rv == 0 ) + { + // TRD : the queue can return empty as well - remember, we're lock-free; anything could have happened since the previous instruction + rv = lfds700_queue_dequeue( &rs->qs, &qe, ps ); + + if( rv == 1 ) + { + re = LFDS700_QUEUE_GET_VALUE_FROM_ELEMENT( *qe ); + re->qe_use = (struct lfds700_queue_element *) qe; + + if( overwrite_occurred_flag != NULL ) + *overwrite_occurred_flag = LFDS700_MISC_FLAG_RAISED; + + if( overwritten_key != NULL ) + *overwritten_key = re->key; + + if( overwritten_value != NULL ) + *overwritten_value = re->value; + } + } + } + while( rv == 0 ); + + re->key = key; + re->value = value; + + LFDS700_QUEUE_SET_VALUE_IN_ELEMENT( *re->qe_use, re ); + lfds700_queue_enqueue( &rs->qs, re->qe_use, ps ); + + return; +} + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_stack/lfds700_stack_cleanup.c b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_stack/lfds700_stack_cleanup.c new file mode 100644 index 0000000000..efcebf3543 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_stack/lfds700_stack_cleanup.c @@ -0,0 +1,36 @@ +/***** includes *****/ +#include "lfds700_stack_internal.h" + + + + + +/****************************************************************************/ +void lfds700_stack_cleanup( struct lfds700_stack_state *ss, + void (*element_cleanup_callback)(struct lfds700_stack_state *ss, struct lfds700_stack_element *se) ) +{ + struct lfds700_stack_element + *se, + *se_temp; + + LFDS700_PAL_ASSERT( ss != NULL ); + // TRD : element_cleanup_callback can be NULL + + LFDS700_MISC_BARRIER_LOAD; + + if( element_cleanup_callback != NULL ) + { + se = ss->top[POINTER]; + + while( se != NULL ) + { + se_temp = se; + se = se->next; + + element_cleanup_callback( ss, se_temp ); + } + } + + return; +} + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_stack/lfds700_stack_init.c b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_stack/lfds700_stack_init.c new file mode 100644 index 0000000000..745017c029 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_stack/lfds700_stack_init.c @@ -0,0 +1,27 @@ +/***** includes *****/ +#include "lfds700_stack_internal.h" + + + + + +/****************************************************************************/ +void lfds700_stack_init_valid_on_current_logical_core( struct lfds700_stack_state *ss, void *user_state ) +{ + LFDS700_PAL_ASSERT( ss != NULL ); + LFDS700_PAL_ASSERT( (lfds700_pal_uint_t) ss->top % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES == 0 ); + LFDS700_PAL_ASSERT( (lfds700_pal_uint_t) &ss->user_state % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES == 0 ); + // TRD : user_state can be NULL + + ss->top[POINTER] = NULL; + ss->top[COUNTER] = 0; + + ss->user_state = user_state; + + LFDS700_MISC_BARRIER_STORE; + + lfds700_misc_force_store(); + + return; +} + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_stack/lfds700_stack_internal.h b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_stack/lfds700_stack_internal.h new file mode 100644 index 0000000000..7a7d541804 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_stack/lfds700_stack_internal.h @@ -0,0 +1,5 @@ +/***** the library wide include file *****/ +#include "../liblfds700_internal.h" + +/***** private prototypes *****/ + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_stack/lfds700_stack_pop.c b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_stack/lfds700_stack_pop.c new file mode 100644 index 0000000000..3cae2e563e --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_stack/lfds700_stack_pop.c @@ -0,0 +1,52 @@ +/***** includes *****/ +#include "lfds700_stack_internal.h" + + + + + +/****************************************************************************/ +int lfds700_stack_pop( struct lfds700_stack_state *ss, struct lfds700_stack_element **se, struct lfds700_misc_prng_state *ps ) +{ + char unsigned + result; + + lfds700_pal_uint_t + backoff_iteration = LFDS700_MISC_ABSTRACTION_BACKOFF_INITIAL_VALUE; + + struct lfds700_stack_element LFDS700_PAL_ALIGN(LFDS700_PAL_ALIGN_DOUBLE_POINTER) + *new_top[PAC_SIZE], + *volatile original_top[PAC_SIZE]; + + LFDS700_PAL_ASSERT( ss != NULL ); + LFDS700_PAL_ASSERT( se != NULL ); + LFDS700_PAL_ASSERT( ps != NULL ); + + LFDS700_PAL_BARRIER_PROCESSOR_LOAD; + + original_top[COUNTER] = ss->top[COUNTER]; + original_top[POINTER] = ss->top[POINTER]; + + do + { + if( original_top[POINTER] == NULL ) + { + *se = NULL; + return( 0 ); + } + + new_top[COUNTER] = original_top[COUNTER] + 1; + new_top[POINTER] = original_top[POINTER]->next; + + LFDS700_PAL_ATOMIC_DWCAS_WITH_BACKOFF( &ss->top, original_top, new_top, LFDS700_MISC_CAS_STRENGTH_WEAK, result, backoff_iteration, ps ); + + if( result != 1 ) + LFDS700_PAL_BARRIER_PROCESSOR_LOAD; + } + while( result != 1 ); + + *se = original_top[POINTER]; + + return( 1 ); +} + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_stack/lfds700_stack_push.c b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_stack/lfds700_stack_push.c new file mode 100644 index 0000000000..ff84c5ed55 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_stack/lfds700_stack_push.c @@ -0,0 +1,42 @@ +/***** includes *****/ +#include "lfds700_stack_internal.h" + + + + + +/****************************************************************************/ +void lfds700_stack_push( struct lfds700_stack_state *ss, struct lfds700_stack_element *se, struct lfds700_misc_prng_state *ps ) +{ + char unsigned + result; + + lfds700_pal_uint_t + backoff_iteration = LFDS700_MISC_ABSTRACTION_BACKOFF_INITIAL_VALUE; + + struct lfds700_stack_element LFDS700_PAL_ALIGN(LFDS700_PAL_ALIGN_DOUBLE_POINTER) + *new_top[PAC_SIZE], + *volatile original_top[PAC_SIZE]; + + LFDS700_PAL_ASSERT( ss != NULL ); + LFDS700_PAL_ASSERT( se != NULL ); + LFDS700_PAL_ASSERT( ps != NULL ); + + new_top[POINTER] = se; + + original_top[COUNTER] = ss->top[COUNTER]; + original_top[POINTER] = ss->top[POINTER]; + + do + { + new_top[COUNTER] = original_top[COUNTER] + 1; + se->next = original_top[POINTER]; + + LFDS700_PAL_BARRIER_PROCESSOR_STORE; + LFDS700_PAL_ATOMIC_DWCAS_WITH_BACKOFF( &ss->top, original_top, new_top, LFDS700_MISC_CAS_STRENGTH_WEAK, result, backoff_iteration, ps ); + } + while( result != 1 ); + + return; +} + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_stack/lfds700_stack_query.c b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_stack/lfds700_stack_query.c new file mode 100644 index 0000000000..b9abdf9f2d --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/lfds700_stack/lfds700_stack_query.c @@ -0,0 +1,123 @@ +/***** includes *****/ +#include "lfds700_stack_internal.h" + +/***** private prototypes *****/ +static void lfds700_stack_internal_stack_validate( struct lfds700_stack_state *ss, struct lfds700_misc_validation_info *vi, enum lfds700_misc_validity *lfds700_stack_validity ); + + + + + +/****************************************************************************/ +void lfds700_stack_query( struct lfds700_stack_state *ss, enum lfds700_stack_query query_type, void *query_input, void *query_output ) +{ + struct lfds700_stack_element + *se; + + LFDS700_MISC_BARRIER_LOAD; + + LFDS700_PAL_ASSERT( ss != NULL ); + // TRD : query_type can be any value in its range + + switch( query_type ) + { + case LFDS700_STACK_QUERY_SINGLETHREADED_GET_COUNT: + LFDS700_PAL_ASSERT( query_input == NULL ); + LFDS700_PAL_ASSERT( query_output != NULL ); + + *(lfds700_pal_uint_t *) query_output = 0; + + se = (struct lfds700_stack_element *) ss->top[POINTER]; + + while( se != NULL ) + { + ( *(lfds700_pal_uint_t *) query_output )++; + se = (struct lfds700_stack_element *) se->next; + } + break; + + case LFDS700_STACK_QUERY_SINGLETHREADED_VALIDATE: + // TRD : query_input can be NULL + LFDS700_PAL_ASSERT( query_output != NULL ); + + lfds700_stack_internal_stack_validate( ss, (struct lfds700_misc_validation_info *) query_input, (enum lfds700_misc_validity *) query_output ); + break; + } + + return; +} + + + + + +/****************************************************************************/ +static void lfds700_stack_internal_stack_validate( struct lfds700_stack_state *ss, struct lfds700_misc_validation_info *vi, enum lfds700_misc_validity *lfds700_stack_validity ) +{ + lfds700_pal_uint_t + number_elements = 0; + + struct lfds700_stack_element + *se_fast, + *se_slow; + + LFDS700_PAL_ASSERT( ss != NULL ); + // TRD : vi can be NULL + LFDS700_PAL_ASSERT( lfds700_stack_validity != NULL ); + + *lfds700_stack_validity = LFDS700_MISC_VALIDITY_VALID; + + se_slow = se_fast = (struct lfds700_stack_element *) ss->top[POINTER]; + + /* TRD : first, check for a loop + we have two pointers + both of which start at the top of the stack + we enter a loop + and on each iteration + we advance one pointer by one element + and the other by two + + we exit the loop when both pointers are NULL + (have reached the end of the stack) + + or + + if we fast pointer 'sees' the slow pointer + which means we have a loop + */ + + if( se_slow != NULL ) + do + { + se_slow = se_slow->next; + + if( se_fast != NULL ) + se_fast = se_fast->next; + + if( se_fast != NULL ) + se_fast = se_fast->next; + } + while( se_slow != NULL and se_fast != se_slow ); + + if( se_fast != NULL and se_slow != NULL and se_fast == se_slow ) + *lfds700_stack_validity = LFDS700_MISC_VALIDITY_INVALID_LOOP; + + /* TRD : now check for expected number of elements + vi can be NULL, in which case we do not check + we know we don't have a loop from our earlier check + */ + + if( *lfds700_stack_validity == LFDS700_MISC_VALIDITY_VALID and vi != NULL ) + { + lfds700_stack_query( ss, LFDS700_STACK_QUERY_SINGLETHREADED_GET_COUNT, NULL, (void *) &number_elements ); + + if( number_elements < vi->min_elements ) + *lfds700_stack_validity = LFDS700_MISC_VALIDITY_INVALID_MISSING_ELEMENTS; + + if( number_elements > vi->max_elements ) + *lfds700_stack_validity = LFDS700_MISC_VALIDITY_INVALID_ADDITIONAL_ELEMENTS; + } + + return; +} + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/liblfds700_internal.h b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/liblfds700_internal.h new file mode 100644 index 0000000000..fdd8c363eb --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/liblfds700/src/liblfds700_internal.h @@ -0,0 +1,93 @@ +/***** public prototypes *****/ +#include "../inc/liblfds700.h" + +/***** defines *****/ +#define and && +#define or || + +#define NO_FLAGS 0x0 + +#define LFDS700_ABSTRACTION_BACKOFF_LIMIT (0x1 << 10) + +#if( defined _KERNEL_MODE ) + #define MODE_TYPE_STRING "kernel-mode" +#endif + +#if( !defined _KERNEL_MODE ) + #define MODE_TYPE_STRING "user-mode" +#endif + +#if( defined NDEBUG && !defined COVERAGE && !defined TSAN ) + #define BUILD_TYPE_STRING "release" +#endif + +#if( !defined NDEBUG && !defined COVERAGE && !defined TSAN ) + #define BUILD_TYPE_STRING "debug" +#endif + +#if( !defined NDEBUG && defined COVERAGE && !defined TSAN ) + #define BUILD_TYPE_STRING "coverage" +#endif + +#if( !defined NDEBUG && !defined COVERAGE && defined TSAN ) + #define BUILD_TYPE_STRING "threadsanitizer" +#endif + +// TRD : lfds700_pal_atom_t volatile *destination, lfds700_pal_atom_t *compare, lfds700_pal_atom_t new_destination, enum lfds700_misc_cas_strength cas_strength, char unsigned result, lfds700_pal_uint_t *backoff_iteration +#define LFDS700_PAL_ATOMIC_CAS_WITH_BACKOFF( pointer_to_destination, pointer_to_compare, new_destination, cas_strength, result, backoff_iteration, ps ) \ +{ \ + LFDS700_PAL_ATOMIC_CAS( pointer_to_destination, pointer_to_compare, new_destination, cas_strength, result ); \ + \ + if( result == 0 ) \ + { \ + lfds700_pal_uint_t \ + endloop; \ + \ + lfds700_pal_uint_t volatile \ + loop; \ + \ + if( (backoff_iteration) == LFDS700_ABSTRACTION_BACKOFF_LIMIT ) \ + (backoff_iteration) = LFDS700_MISC_ABSTRACTION_BACKOFF_INITIAL_VALUE; \ + \ + if( (backoff_iteration) == LFDS700_MISC_ABSTRACTION_BACKOFF_INITIAL_VALUE ) \ + (backoff_iteration) = 1; \ + else \ + { \ + endloop = ( LFDS700_MISC_PRNG_GENERATE(ps) % (backoff_iteration) ) * ps->local_copy_of_global_exponential_backoff_timeslot_length_in_loop_iterations_for_cas; \ + for( loop = 0 ; loop < endloop ; loop++ ); \ + } \ + \ + (backoff_iteration) <<= 1; \ + } \ +} + +// TRD : lfds700_pal_atom_t volatile (*destination)[2], lfds700_pal_atom_t (*compare)[2], lfds700_pal_atom_t (*new_destination)[2], enum lfds700_misc_cas_strength cas_strength, char unsigned result, lfds700_pal_uint_t *backoff_iteration +#define LFDS700_PAL_ATOMIC_DWCAS_WITH_BACKOFF( pointer_to_destination, pointer_to_compare, pointer_to_new_destination, cas_strength, result, backoff_iteration, ps ) \ +{ \ + LFDS700_PAL_ATOMIC_DWCAS( pointer_to_destination, pointer_to_compare, pointer_to_new_destination, cas_strength, result ); \ + \ + if( result == 0 ) \ + { \ + lfds700_pal_uint_t \ + endloop; \ + \ + lfds700_pal_uint_t volatile \ + loop; \ + \ + if( (backoff_iteration) == LFDS700_ABSTRACTION_BACKOFF_LIMIT ) \ + (backoff_iteration) = LFDS700_MISC_ABSTRACTION_BACKOFF_INITIAL_VALUE; \ + \ + if( (backoff_iteration) == LFDS700_MISC_ABSTRACTION_BACKOFF_INITIAL_VALUE ) \ + (backoff_iteration) = 1; \ + else \ + { \ + endloop = ( LFDS700_MISC_PRNG_GENERATE(ps) % (backoff_iteration) ) * ps->local_copy_of_global_exponential_backoff_timeslot_length_in_loop_iterations_for_dwcas; \ + for( loop = 0 ; loop < endloop ; loop++ ); \ + } \ + \ + (backoff_iteration) <<= 1; \ + } \ +} + +/***** library-wide prototypes *****/ + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/build/gcc_and_gnumake/Makefile b/openair2/UTIL/LFDS/liblfds7.0.0/test/build/gcc_and_gnumake/Makefile new file mode 100644 index 0000000000..489e5b19e5 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/test/build/gcc_and_gnumake/Makefile @@ -0,0 +1,129 @@ +##### paths ##### +BINDIR := ../../bin +OBJDIR := ../../obj +SRCDIR := ../../src +LIBINCDIRS := ../../../liblfds700/inc/ +LIBBINDIRS := ../../../liblfds700/bin/ + +##### misc ##### +QUIETLY := 1>nul 2>nul + +##### sources, objects and libraries ##### +BINNAME := test +BINARY := $(BINDIR)/$(BINNAME) +SRCDIRS := . +SOURCES := main.c misc.c \ + test_lfds700_btree_addonly_unbalanced.c test_lfds700_btree_addonly_unbalanced_alignment.c test_lfds700_btree_addonly_unbalanced_random_adds_fail.c test_lfds700_btree_addonly_unbalanced_random_adds_fail_and_overwrite.c test_lfds700_btree_addonly_unbalanced_random_adds_overwrite.c \ + test_lfds700_freelist.c test_lfds700_freelist_alignment.c test_lfds700_freelist_popping.c test_lfds700_freelist_popping_and_pushing.c test_lfds700_freelist_pushing.c test_lfds700_freelist_rapid_popping_and_pushing.c \ + test_lfds700_hash_addonly.c test_lfds700_hash_addonly_alignment.c test_lfds700_hash_addonly_iterate.c test_lfds700_hash_addonly_random_adds_fail.c test_lfds700_hash_addonly_random_adds_fail_and_overwrite.c test_lfds700_hash_addonly_random_adds_overwrite.c \ + test_lfds700_list_addonly_ordered_singlylinked.c test_lfds700_list_addonly_ordered_singlylinked_alignment.c test_lfds700_list_addonly_ordered_singlylinked_new_ordered.c test_lfds700_list_addonly_ordered_singlylinked_new_ordered_with_cursor.c \ + test_lfds700_list_addonly_singlylinked_unordered.c test_lfds700_list_addonly_singlylinked_unordered_alignment.c test_lfds700_list_addonly_singlylinked_unordered_new_after.c test_lfds700_list_addonly_singlylinked_unordered_new_end.c test_lfds700_list_addonly_singlylinked_unordered_new_start.c \ + test_lfds700_porting_abstraction_layer_atomic.c test_lfds700_porting_abstraction_layer_atomic_cas.c test_lfds700_porting_abstraction_layer_atomic_dcas.c test_lfds700_porting_abstraction_layer_atomic_exchange.c \ + test_lfds700_queue.c test_lfds700_queue_alignment.c test_lfds700_queue_dequeuing.c test_lfds700_queue_enqueuing.c test_lfds700_queue_enqueuing_and_dequeuing.c test_lfds700_queue_enqueuing_and_dequeuing_with_free.c test_lfds700_queue_enqueuing_with_malloc_and_dequeuing_with_free.c test_lfds700_queue_rapid_enqueuing_and_dequeuing.c \ + test_lfds700_queue_bounded_singleconsumer_singleproducer.c test_lfds700_queue_bounded_singleconsumer_singleproducer_dequeuing.c test_lfds700_queue_bounded_singleconsumer_singleproducer_enqueuing.c test_lfds700_queue_bounded_singleconsumer_singleproducer_enqueuing_and_dequeuing.c \ + test_lfds700_ringbuffer.c test_lfds700_ringbuffer_reading.c test_lfds700_ringbuffer_reading_and_writing.c test_lfds700_ringbuffer_writing.c \ + test_lfds700_stack.c test_lfds700_stack_alignment.c test_lfds700_stack_popping.c test_lfds700_stack_popping_and_pushing.c test_lfds700_stack_pushing.c test_lfds700_stack_rapid_popping_and_pushing.c \ + test_porting_abstraction_layer_get_logical_core_ids.c test_porting_abstraction_layer_thread_start.c test_porting_abstraction_layer_thread_wait.c \ + util_cmdline.c util_memory_helpers.c util_thread_starter.c +OBJECTS := $(patsubst %.c,$(OBJDIR)/%.o,$(notdir $(SOURCES))) +SYSLIBS := -lm -lpthread -lrt +USRLIBS := -llfds700 + +##### default paths ##### +CPATH += $(LIBINCDIRS) +LIBRARY_PATH += $(LIBBINDIRS) +export CPATH +export LIBRARY_PATH + +##### tools ##### +MAKE := make +MFLAGS := + +DG := gcc +DGFLAGS := -MM -std=gnu89 + +CC := gcc +CFBASE := -c -pthread -std=gnu89 -Wall -Wno-unknown-pragmas +CFCOV := -O0 -ggdb -DCOVERAGE -fprofile-arcs -ftest-coverage +CFDBG := -O0 -ggdb -D_DEBUG +CFPROF := -O0 -ggdb -DPROF -pg +CFREL := -O2 -DNDEBUG -finline-functions -Wno-strict-aliasing +CFTSAN := -O0 -ggdb -DTSAN -fsanitize=thread -fPIE + +LD := gcc +LFBASE := -pthread -std=gnu89 -Wall -Werror +LFCOV := -O0 -fprofile-arcs -ftest-coverage +LFDBG := -O0 -ggdb +LFPROF := -O0 -pg +LFREL := -O2 -s -finline-functions +LFTSAN := -O0 -fsanitize=thread -pie + +PROF := gprof +PFBASE := -b -p -Q $(BINARY) gmon.out + +##### variants and libnuma check ##### +CFLAGS += $(CFBASE) +LFLAGS += $(LFBASE) + +ifeq ($(MAKECMDGOALS),) + CFLAGS += $(CFDBG) + LFLAGS += $(LFDBG) +endif + +ifeq ($(MAKECMDGOALS),cov) + CFLAGS += $(CFCOV) + LFLAGS += $(LFCOV) + SYSLIBS += -lgcov +endif + +ifeq ($(MAKECMDGOALS),dbg) + CFLAGS += $(CFDBG) + LFLAGS += $(LFDBG) +endif + +ifeq ($(MAKECMDGOALS),prof) + CFLAGS += $(CFPROF) + LFLAGS += $(LFPROF) +endif + +ifeq ($(MAKECMDGOALS),rel) + CFLAGS += $(CFREL) + LFLAGS += $(LFREL) +endif + +ifeq ($(MAKECMDGOALS),tsan) + CFLAGS += $(CFTSAN) + LFLAGS += $(LFTSAN) +endif + +##### search paths ##### +vpath %.c $(patsubst %,$(SRCDIR)/%:,$(SRCDIRS)) + +##### implicit rules ##### +$(OBJDIR)/%.o : %.c + $(DG) $(DGFLAGS) $< >$(OBJDIR)/$*.d + $(CC) $(CFLAGS) -o $@ $< + +##### explicit rules ##### +$(BINARY) : $(OBJECTS) + $(LD) -o $(BINARY) $(LFLAGS) $(OBJECTS) $(USRLIBS) $(SYSLIBS) + chmod +x $(BINARY) + +##### phony ##### +.PHONY : clean cov dbg prof rel tsan + +clean : + @rm -f $(BINDIR)/$(BINNAME) $(OBJDIR)/*.o $(OBJDIR)/*.d $(OBJDIR)/*.gcno + +cov : $(BINARY) +dbg : $(BINARY) +prof : $(BINARY) +rel : $(BINARY) +tsan : $(BINARY) + +genprof : + @$(PROF) $(PFBASE) + +##### dependencies ##### +-include $(DEPENDS) + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/build/sdk_for_windows_7_and_gnumake/makefile b/openair2/UTIL/LFDS/liblfds7.0.0/test/build/sdk_for_windows_7_and_gnumake/makefile new file mode 100644 index 0000000000..c54d16635b --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/test/build/sdk_for_windows_7_and_gnumake/makefile @@ -0,0 +1,106 @@ +##### paths ##### +BINDIR := ..\..\bin +OBJDIR := ..\..\obj +SRCDIR := ..\..\src + +##### misc ##### +QUIETLY := 1>nul 2>nul +NULL := +SPACE := $(NULL) # TRD : necessary trailing space after the close bracket + +##### sources, objects and libraries ##### +BINNAME := test +BINARY := $(BINDIR)\$(BINNAME).exe +SRCDIRS := . +SOURCES := main.c misc.c \ + test_lfds700_btree_addonly_unbalanced.c test_lfds700_btree_addonly_unbalanced_alignment.c test_lfds700_btree_addonly_unbalanced_random_adds_fail.c test_lfds700_btree_addonly_unbalanced_random_adds_fail_and_overwrite.c test_lfds700_btree_addonly_unbalanced_random_adds_overwrite.c \ + test_lfds700_freelist.c test_lfds700_freelist_alignment.c test_lfds700_freelist_popping.c test_lfds700_freelist_popping_and_pushing.c test_lfds700_freelist_pushing.c test_lfds700_freelist_rapid_popping_and_pushing.c \ + test_lfds700_hash_addonly.c test_lfds700_hash_addonly_alignment.c test_lfds700_hash_addonly_iterate.c test_lfds700_hash_addonly_random_adds_fail.c test_lfds700_hash_addonly_random_adds_fail_and_overwrite.c test_lfds700_hash_addonly_random_adds_overwrite.c \ + test_lfds700_list_addonly_ordered_singlylinked.c test_lfds700_list_addonly_ordered_singlylinked_alignment.c test_lfds700_list_addonly_ordered_singlylinked_new_ordered.c test_lfds700_list_addonly_ordered_singlylinked_new_ordered_with_cursor.c \ + test_lfds700_list_addonly_singlylinked_unordered.c test_lfds700_list_addonly_singlylinked_unordered_alignment.c test_lfds700_list_addonly_singlylinked_unordered_new_after.c test_lfds700_list_addonly_singlylinked_unordered_new_end.c test_lfds700_list_addonly_singlylinked_unordered_new_start.c \ + test_lfds700_porting_abstraction_layer_atomic.c test_lfds700_porting_abstraction_layer_atomic_cas.c test_lfds700_porting_abstraction_layer_atomic_dcas.c test_lfds700_porting_abstraction_layer_atomic_exchange.c \ + test_lfds700_queue.c test_lfds700_queue_alignment.c test_lfds700_queue_dequeuing.c test_lfds700_queue_enqueuing.c test_lfds700_queue_enqueuing_and_dequeuing.c test_lfds700_queue_enqueuing_and_dequeuing_with_free.c test_lfds700_queue_enqueuing_with_malloc_and_dequeuing_with_free.c test_lfds700_queue_rapid_enqueuing_and_dequeuing.c \ + test_lfds700_queue_bounded_singleconsumer_singleproducer.c test_lfds700_queue_bounded_singleconsumer_singleproducer_dequeuing.c test_lfds700_queue_bounded_singleconsumer_singleproducer_enqueuing.c test_lfds700_queue_bounded_singleconsumer_singleproducer_enqueuing_and_dequeuing.c \ + test_lfds700_ringbuffer.c test_lfds700_ringbuffer_reading.c test_lfds700_ringbuffer_reading_and_writing.c test_lfds700_ringbuffer_writing.c \ + test_lfds700_stack.c test_lfds700_stack_alignment.c test_lfds700_stack_popping.c test_lfds700_stack_popping_and_pushing.c test_lfds700_stack_pushing.c test_lfds700_stack_rapid_popping_and_pushing.c \ + test_porting_abstraction_layer_get_logical_core_ids.c test_porting_abstraction_layer_thread_start.c test_porting_abstraction_layer_thread_wait.c \ + util_cmdline.c util_memory_helpers.c util_thread_starter.c +OBJECTS := $(patsubst %.c,$(OBJDIR)/%.obj,$(notdir $(SOURCES))) +RESFILE := $(patsubst %.rc,$(OBJDIR)/%.res,$(notdir $(RCFILE))) +SYSLIBS := kernel32.lib +EXTLIBS := +USRLIBS := ../../../liblfds700/bin/liblfds700.lib + +##### default paths fix up ##### +INCLUDE += ;../../../../liblfds700/inc/ +LIB += ;../../../../liblfds700/bin/ + +##### tools ##### +MAKE := make +MFLAGS := + +CC := cl +CFBASE := /c /D_CRT_SECURE_NO_WARNINGS /DWIN32_LEAN_AND_MEAN /DUNICODE /D_UNICODE /DUNICODE "/Fd$(BINDIR)\$(BINNAME).pdb" /nologo /W4 /WX +CFREL := /DNDEBUG /Ox +CFDBG := /D_DEBUG /Od /Gm /Zi + +LD := link +LFBASE := /nologo /subsystem:console /nodefaultlib /nxcompat /wx +LFREL := /incremental:no +LFDBG := /debug "/pdb:$(BINDIR)\$(BINNAME).pdb" + +##### variants ##### +CFLAGS := $(CFBASE) $(CFDBG) /MTd +LFLAGS := $(LFBASE) $(LFDBG) +CLIB := libcmtd.lib + +ifeq ($(MAKECMDGOALS),librel) + CFLAGS := $(CFBASE) $(CFREL) /MT + LFLAGS := $(LFBASE) $(LFREL) + CLIB := libcmt.lib +endif + +ifeq ($(MAKECMDGOALS),libdbg) + CFLAGS := $(CFBASE) $(CFDBG) /MTd + LFLAGS := $(LFBASE) $(LFDBG) + CLIB := libcmtd.lib +endif + +ifeq ($(MAKECMDGOALS),dllrel) + CFLAGS := $(CFBASE) $(CFREL) /MD + LFLAGS := $(LFBASE) $(LFREL) + CLIB := msvcrt.lib +endif + +ifeq ($(MAKECMDGOALS),dlldbg) + CFLAGS := $(CFBASE) $(CFDBG) /MDd + LFLAGS := $(LFBASE) $(LFDBG) + CLIB := msvcrtd.lib +endif + +##### search paths ##### +vpath %.c $(patsubst %,$(SRCDIR)/%;,$(SRCDIRS)) + +##### implicit rules ##### +$(OBJDIR)/%.obj : %.c + $(CC) $(CFLAGS) "/Fo$@" $< + +##### explicit rules ##### +$(BINARY) : $(OBJECTS) $(USRLIBS) + $(LD) $(LFLAGS) $(CLIB) $(SYSLIBS) $(EXTLIBS) $(USRLIBS) $(OBJECTS) /out:$(BINARY) + +##### phony ##### +.PHONY : clean librel libdbg dllrel dlldbg + +clean : + @erase /Q $(OBJDIR)\*.obj $(OBJDIR)\*.res $(BINDIR)\$(BINNAME).* $(QUIETLY) + +dlldbg : $(BINARY) +dllrel : $(BINARY) + +libdbg : $(BINARY) +librel : $(BINARY) + +##### notes ##### +# TRD : we fix up the default paths because cl and link require an extra argument per additional path, which is ugly as hell + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/build/visual_studio_professional_2012/test.sln b/openair2/UTIL/LFDS/liblfds7.0.0/test/build/visual_studio_professional_2012/test.sln new file mode 100644 index 0000000000..cc8727482f --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/test/build/visual_studio_professional_2012/test.sln @@ -0,0 +1,67 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2012 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test", "test.vcxproj", "{A6BA3A68-A1D4-4C07-A0D5-7EAE73272A43}" + ProjectSection(ProjectDependencies) = postProject + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0} = {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "liblfds700", "..\..\..\liblfds700\build\visual_studio_professional_2012\liblfds700.vcxproj", "{1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug DLL|Win32 = Debug DLL|Win32 + Debug DLL|x64 = Debug DLL|x64 + Debug LIB|Win32 = Debug LIB|Win32 + Debug LIB|x64 = Debug LIB|x64 + Release DLL|Win32 = Release DLL|Win32 + Release DLL|x64 = Release DLL|x64 + Release LIB|Win32 = Release LIB|Win32 + Release LIB|x64 = Release LIB|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {A6BA3A68-A1D4-4C07-A0D5-7EAE73272A43}.Debug DLL|Win32.ActiveCfg = Debug DLL|Win32 + {A6BA3A68-A1D4-4C07-A0D5-7EAE73272A43}.Debug DLL|Win32.Build.0 = Debug DLL|Win32 + {A6BA3A68-A1D4-4C07-A0D5-7EAE73272A43}.Debug DLL|Win32.Deploy.0 = Debug DLL|Win32 + {A6BA3A68-A1D4-4C07-A0D5-7EAE73272A43}.Debug DLL|x64.ActiveCfg = Debug DLL|x64 + {A6BA3A68-A1D4-4C07-A0D5-7EAE73272A43}.Debug DLL|x64.Build.0 = Debug DLL|x64 + {A6BA3A68-A1D4-4C07-A0D5-7EAE73272A43}.Debug DLL|x64.Deploy.0 = Debug DLL|x64 + {A6BA3A68-A1D4-4C07-A0D5-7EAE73272A43}.Debug LIB|Win32.ActiveCfg = Debug LIB|Win32 + {A6BA3A68-A1D4-4C07-A0D5-7EAE73272A43}.Debug LIB|Win32.Build.0 = Debug LIB|Win32 + {A6BA3A68-A1D4-4C07-A0D5-7EAE73272A43}.Debug LIB|Win32.Deploy.0 = Debug LIB|Win32 + {A6BA3A68-A1D4-4C07-A0D5-7EAE73272A43}.Debug LIB|x64.ActiveCfg = Debug LIB|x64 + {A6BA3A68-A1D4-4C07-A0D5-7EAE73272A43}.Debug LIB|x64.Build.0 = Debug LIB|x64 + {A6BA3A68-A1D4-4C07-A0D5-7EAE73272A43}.Debug LIB|x64.Deploy.0 = Debug LIB|x64 + {A6BA3A68-A1D4-4C07-A0D5-7EAE73272A43}.Release DLL|Win32.ActiveCfg = Release DLL|Win32 + {A6BA3A68-A1D4-4C07-A0D5-7EAE73272A43}.Release DLL|Win32.Build.0 = Release DLL|Win32 + {A6BA3A68-A1D4-4C07-A0D5-7EAE73272A43}.Release DLL|Win32.Deploy.0 = Release DLL|Win32 + {A6BA3A68-A1D4-4C07-A0D5-7EAE73272A43}.Release DLL|x64.ActiveCfg = Release DLL|x64 + {A6BA3A68-A1D4-4C07-A0D5-7EAE73272A43}.Release DLL|x64.Build.0 = Release DLL|x64 + {A6BA3A68-A1D4-4C07-A0D5-7EAE73272A43}.Release DLL|x64.Deploy.0 = Release DLL|x64 + {A6BA3A68-A1D4-4C07-A0D5-7EAE73272A43}.Release LIB|Win32.ActiveCfg = Release LIB|Win32 + {A6BA3A68-A1D4-4C07-A0D5-7EAE73272A43}.Release LIB|Win32.Build.0 = Release LIB|Win32 + {A6BA3A68-A1D4-4C07-A0D5-7EAE73272A43}.Release LIB|Win32.Deploy.0 = Release LIB|Win32 + {A6BA3A68-A1D4-4C07-A0D5-7EAE73272A43}.Release LIB|x64.ActiveCfg = Release LIB|x64 + {A6BA3A68-A1D4-4C07-A0D5-7EAE73272A43}.Release LIB|x64.Build.0 = Release LIB|x64 + {A6BA3A68-A1D4-4C07-A0D5-7EAE73272A43}.Release LIB|x64.Deploy.0 = Release LIB|x64 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Debug DLL|Win32.ActiveCfg = Debug DLL|Win32 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Debug DLL|Win32.Build.0 = Debug DLL|Win32 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Debug DLL|x64.ActiveCfg = Debug DLL|x64 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Debug DLL|x64.Build.0 = Debug DLL|x64 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Debug LIB|Win32.ActiveCfg = Debug LIB|Win32 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Debug LIB|Win32.Build.0 = Debug LIB|Win32 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Debug LIB|x64.ActiveCfg = Debug LIB|x64 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Debug LIB|x64.Build.0 = Debug LIB|x64 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Release DLL|Win32.ActiveCfg = Release DLL|Win32 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Release DLL|Win32.Build.0 = Release DLL|Win32 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Release DLL|x64.ActiveCfg = Release DLL|x64 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Release DLL|x64.Build.0 = Release DLL|x64 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Release LIB|Win32.ActiveCfg = Release LIB|Win32 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Release LIB|Win32.Build.0 = Release LIB|Win32 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Release LIB|x64.ActiveCfg = Release LIB|x64 + {1E5D7D09-94F2-455D-AE5E-6C7F4C96BCE0}.Release LIB|x64.Build.0 = Release LIB|x64 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/build/visual_studio_professional_2012/test.vcxproj b/openair2/UTIL/LFDS/liblfds7.0.0/test/build/visual_studio_professional_2012/test.vcxproj new file mode 100644 index 0000000000..3fbf8d78ee --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/test/build/visual_studio_professional_2012/test.vcxproj @@ -0,0 +1,554 @@ + + + + + Debug DLL + Win32 + + + Debug DLL + x64 + + + Debug LIB + Win32 + + + Debug LIB + x64 + + + Release DLL + Win32 + + + Release DLL + x64 + + + Release LIB + Win32 + + + Release LIB + x64 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {1e5d7d09-94f2-455d-ae5e-6c7f4c96bce0} + + + + {A6BA3A68-A1D4-4C07-A0D5-7EAE73272A43} + Win32Proj + + + + Application + true + v110 + + + Application + true + v110 + + + Application + true + v110 + + + Application + true + v110 + + + Application + false + v110 + + + Application + false + v110 + + + Application + false + v110 + + + Application + false + v110 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + false + $(ProjectDir)..\..\bin\$(Platform) $(Configuration)\ + $(ProjectDir)..\..\obj\$(Platform) $(Configuration)\ + + + false + $(ProjectDir)..\..\bin\$(Platform) $(Configuration)\ + $(ProjectDir)..\..\obj\$(Platform) $(Configuration)\ + + + false + $(ProjectDir)..\..\bin\$(Platform) $(Configuration)\ + $(ProjectDir)..\..\obj\$(Platform) $(Configuration)\ + + + false + $(ProjectDir)..\..\bin\$(Platform) $(Configuration)\ + $(ProjectDir)..\..\obj\$(Platform) $(Configuration)\ + + + false + $(ProjectDir)..\..\bin\$(Platform) $(Configuration)\ + $(ProjectDir)..\..\obj\$(Platform) $(Configuration)\ + + + false + $(ProjectDir)..\..\bin\$(Platform) $(Configuration)\ + $(ProjectDir)..\..\obj\$(Platform) $(Configuration)\ + + + false + $(ProjectDir)..\..\bin\$(Platform) $(Configuration)\ + $(ProjectDir)..\..\obj\$(Platform) $(Configuration)\ + + + false + $(ProjectDir)..\..\bin\$(Platform) $(Configuration)\ + $(ProjectDir)..\..\obj\$(Platform) $(Configuration)\ + + + + WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + MultiThreadedDebug + Level4 + ProgramDatabase + Disabled + false + false + true + true + true + true + true + false + false + false + false + NoExtensions + false + false + false + true + CompileAsC + None + ..\liblfds700\inc;%(AdditionalIncludeDirectories) + true + + + MachineX86 + true + Console + true + + + + + kernel32.lib;%(AdditionalDependencies) + + + + + WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + MultiThreadedDebug + Level4 + ProgramDatabase + Disabled + false + false + true + true + true + true + true + false + false + false + false + NoExtensions + false + false + false + true + CompileAsC + None + ..\liblfds700\inc;%(AdditionalIncludeDirectories) + true + + + MachineX86 + true + Console + true + + + + + kernel32.lib;%(AdditionalDependencies) + + + + + WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + MultiThreadedDebug + Level4 + ProgramDatabase + Disabled + false + false + true + true + true + true + true + false + false + false + false + NotSet + false + false + false + true + CompileAsC + None + true + false + + + true + Console + true + + + kernel32.lib;%(AdditionalDependencies) + + + + + WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + MultiThreadedDebug + Level4 + ProgramDatabase + Disabled + false + false + true + true + true + true + true + false + false + false + false + NotSet + false + false + false + true + CompileAsC + None + true + false + + + true + Console + true + + + kernel32.lib;%(AdditionalDependencies) + + + true + + + + + WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + MultiThreaded + Level4 + None + false + false + false + false + CompileAsC + true + + + true + AnySuitable + true + Speed + true + true + true + true + false + true + true + false + false + false + None + + + MachineX86 + false + Console + true + true + true + true + NoErrorReport + kernel32.lib;%(AdditionalDependencies) + UseLinkTimeCodeGeneration + + + + + WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + MultiThreaded + Level4 + None + false + false + false + false + CompileAsC + true + + + true + AnySuitable + true + Speed + true + true + true + true + false + true + true + false + false + false + None + + + MachineX86 + false + Console + true + true + true + true + NoErrorReport + kernel32.lib;%(AdditionalDependencies) + UseLinkTimeCodeGeneration + + + + + WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + MultiThreaded + Level4 + None + false + false + false + false + CompileAsC + true + + + true + AnySuitable + true + Speed + true + true + true + true + false + true + true + false + false + false + None + + + false + Console + true + true + true + true + NoErrorReport + kernel32.lib;%(AdditionalDependencies) + UseLinkTimeCodeGeneration + + + + + WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + MultiThreaded + Level4 + None + false + false + false + false + CompileAsC + true + + + true + AnySuitable + true + Speed + true + true + true + true + false + true + true + false + false + false + None + + + false + Console + true + true + true + true + NoErrorReport + kernel32.lib;%(AdditionalDependencies) + UseLinkTimeCodeGeneration + + + + + + \ No newline at end of file diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/build/visual_studio_professional_2012/test.vcxproj.filters b/openair2/UTIL/LFDS/liblfds7.0.0/test/build/visual_studio_professional_2012/test.vcxproj.filters new file mode 100644 index 0000000000..69da4b9836 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/test/build/visual_studio_professional_2012/test.vcxproj.filters @@ -0,0 +1,216 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + \ No newline at end of file diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/build/visual_studio_professional_2012/test.vcxproj.user b/openair2/UTIL/LFDS/liblfds7.0.0/test/build/visual_studio_professional_2012/test.vcxproj.user new file mode 100644 index 0000000000..7cbb3216ad --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/test/build/visual_studio_professional_2012/test.vcxproj.user @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/internal.h b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/internal.h new file mode 100644 index 0000000000..14bf02c74c --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/internal.h @@ -0,0 +1,157 @@ +/***** includes *****/ +#define _GNU_SOURCE +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "../../liblfds700/inc/liblfds700.h" +#include "test_porting_abstraction_layer_operating_system.h" + +/***** defines *****/ +#define and && +#define or || + +#define NO_FLAGS 0x0 + +#define BITS_PER_BYTE 8 + +#define TEST_DURATION_IN_SECONDS 5 +#define TIME_LOOP_COUNT 10000 +#define REDUCED_TIME_LOOP_COUNT 1000 +#define NUMBER_OF_NANOSECONDS_IN_ONE_SECOND 1000000000LLU +#define ONE_MEGABYTE_IN_BYTES (1024 * 1024) +#define DEFAULT_TEST_MEMORY_IN_MEGABYTES 512U +#define TEST_PAL_DEFAULT_NUMA_NODE_ID 0 +#define LFDS700_TEST_VERSION_STRING "7.0.0" +#define LFDS700_TEST_VERSION_INTEGER 700 + +#if( defined _KERNEL_MODE ) + #define MODE_TYPE_STRING "kernel-mode" +#endif + +#if( !defined _KERNEL_MODE ) + #define MODE_TYPE_STRING "user-mode" +#endif + +#if( defined NDEBUG && !defined COVERAGE && !defined TSAN ) + #define BUILD_TYPE_STRING "release" +#endif + +#if( !defined NDEBUG && !defined COVERAGE && !defined TSAN ) + #define BUILD_TYPE_STRING "debug" +#endif + +#if( !defined NDEBUG && defined COVERAGE && !defined TSAN ) + #define BUILD_TYPE_STRING "coverage" +#endif + +#if( !defined NDEBUG && !defined COVERAGE && defined TSAN ) + #define BUILD_TYPE_STRING "threadsanitizer" +#endif + +/***** enums *****/ +enum flag +{ + LOWERED, + RAISED +}; + +/***** structs *****/ +struct test_pal_logical_processor +{ + lfds700_pal_uint_t + logical_processor_number, + windows_logical_processor_group_number; + + struct lfds700_list_asu_element + lasue; +}; + +/***** prototypes *****/ +int main( int argc, char **argv ); + +void internal_display_test_name( char *format_string, ... ); +void internal_display_test_result( lfds700_pal_uint_t number_name_dvs_pairs, ... ); +void internal_display_data_structure_validity( enum lfds700_misc_validity dvs ); +void internal_show_version( void ); +void internal_logical_core_id_element_cleanup_callback( struct lfds700_list_asu_state *lasus, struct lfds700_list_asu_element *lasue ); + +int test_pal_thread_start( test_pal_thread_state_t *thread_state, struct test_pal_logical_processor *lp, test_pal_thread_return_t (TEST_PAL_CALLING_CONVENTION *thread_function)(void *thread_user_state), void *thread_user_state ); +void test_pal_thread_wait( test_pal_thread_state_t thread_state ); +void test_pal_get_logical_core_ids( struct lfds700_list_asu_state *lasus ); + +void test_lfds700_pal_atomic( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ); + void test_lfds700_pal_atomic_cas( struct lfds700_list_asu_state *list_of_logical_processors ); + void test_lfds700_pal_atomic_dwcas( struct lfds700_list_asu_state *list_of_logical_processors ); + void test_lfds700_pal_atomic_exchange( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ); + +void test_lfds700_hash_a( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ); + void test_lfds700_hash_a_alignment( void ); + void test_lfds700_hash_a_fail_and_overwrite_on_existing_key( void ); + void test_lfds700_hash_a_random_adds_fail_on_existing( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ); + void test_lfds700_hash_a_random_adds_overwrite_on_existing( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ); + void test_lfds700_hash_a_iterate( void ); + +void test_lfds700_list_aos( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ); + void test_lfds700_list_aos_alignment( void ); + void test_lfds700_list_aos_new_ordered( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ); + void test_lfds700_list_aos_new_ordered_with_cursor( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ); + +void test_lfds700_list_asu( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ); + void test_lfds700_list_asu_alignment( void ); + void test_lfds700_list_asu_new_start( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ); + void test_lfds700_list_asu_new_end( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ); + void test_lfds700_list_asu_new_after( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ); + +void test_lfds700_btree_au( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ); + void test_lfds700_btree_au_alignment( void ); + void test_lfds700_btree_au_fail_and_overwrite_on_existing_key( void ); + void test_lfds700_btree_au_random_adds_fail_on_existing( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ); + void test_lfds700_btree_au_random_adds_overwrite_on_existing( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ); + +void test_lfds700_freelist( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ); + void test_lfds700_freelist_alignment( void ); + void test_lfds700_freelist_popping( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ); + void test_lfds700_freelist_pushing( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ); + void test_lfds700_freelist_popping_and_pushing( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ); + void test_lfds700_freelist_rapid_popping_and_pushing( struct lfds700_list_asu_state *list_of_logical_processors ); + void test_lfds700_freelist_pushing_array( void ); + +void test_lfds700_queue( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ); + void test_lfds700_queue_alignment( void ); + void test_lfds700_queue_enqueuing( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ); + void test_lfds700_queue_dequeuing( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ); + void test_lfds700_queue_enqueuing_and_dequeuing( struct lfds700_list_asu_state *list_of_logical_processors ); + void test_lfds700_queue_rapid_enqueuing_and_dequeuing( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ); + void test_lfds700_queue_enqueuing_and_dequeuing_with_free( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ); + void test_lfds700_queue_enqueuing_with_malloc_and_dequeuing_with_free( struct lfds700_list_asu_state *list_of_logical_processors ); + +void test_lfds700_queue_bss( struct lfds700_list_asu_state *list_of_logical_processors ); + void test_lfds700_queue_bss_enqueuing( void ); + void test_lfds700_queue_bss_dequeuing( void ); + void test_lfds700_queue_bss_enqueuing_and_dequeuing( struct lfds700_list_asu_state *list_of_logical_processors ); + +void test_lfds700_ringbuffer( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ); + void test_lfds700_ringbuffer_reading( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ); + void test_lfds700_ringbuffer_reading_and_writing( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ); + void test_lfds700_ringbuffer_writing( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ); + +void test_lfds700_stack( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ); + void test_lfds700_stack_alignment( void ); + void test_lfds700_stack_pushing( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ); + void test_lfds700_stack_popping( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ); + void test_lfds700_stack_popping_and_pushing( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ); + void test_lfds700_stack_rapid_popping_and_pushing( struct lfds700_list_asu_state *list_of_logical_processors ); + void test_lfds700_stack_pushing_array( void ); + +/***** late includes *****/ +#include "util_cmdline.h" +#include "util_memory_helpers.h" +#include "util_thread_starter.h" + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/main.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/main.c new file mode 100644 index 0000000000..fa6afc8747 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/main.c @@ -0,0 +1,135 @@ +/***** includes *****/ +#include "internal.h" + + + + + +/****************************************************************************/ +int main( int argc, char **argv ) +{ + enum flag + run_flag = LOWERED, + show_error_flag = LOWERED, + show_help_flag = LOWERED, + show_version_flag = LOWERED; + + int + rv; + + lfds700_pal_uint_t + loop, + iterations = 1, + memory_in_megabytes = DEFAULT_TEST_MEMORY_IN_MEGABYTES; + + struct lfds700_list_asu_state + list_of_logical_processors; + + struct util_cmdline_state + cs; + + union util_cmdline_arg_data + *arg_data; + + assert( argc >= 1 ); + assert( argv != NULL ); + + lfds700_misc_library_init_valid_on_current_logical_core(); + + util_cmdline_init( &cs ); + + util_cmdline_add_arg( &cs, 'h', LIBCOMMON_CMDLINE_ARG_TYPE_FLAG ); + util_cmdline_add_arg( &cs, 'i', LIBCOMMON_CMDLINE_ARG_TYPE_INTEGER ); + util_cmdline_add_arg( &cs, 'm', LIBCOMMON_CMDLINE_ARG_TYPE_INTEGER ); + util_cmdline_add_arg( &cs, 'r', LIBCOMMON_CMDLINE_ARG_TYPE_FLAG ); + util_cmdline_add_arg( &cs, 'v', LIBCOMMON_CMDLINE_ARG_TYPE_FLAG ); + + rv = util_cmdline_process_args( &cs, argc, argv ); + + if( rv == 0 ) + show_error_flag = RAISED; + + if( rv == 1 ) + { + util_cmdline_get_arg_data( &cs, 'h', &arg_data ); + if( arg_data != NULL ) + show_help_flag = RAISED; + + util_cmdline_get_arg_data( &cs, 'i', &arg_data ); + if( arg_data != NULL ) + iterations = (lfds700_pal_uint_t) arg_data->integer.integer; + + util_cmdline_get_arg_data( &cs, 'm', &arg_data ); + if( arg_data != NULL ) + memory_in_megabytes = (lfds700_pal_uint_t) arg_data->integer.integer; + + util_cmdline_get_arg_data( &cs, 'r', &arg_data ); + if( arg_data != NULL ) + run_flag = RAISED; + + util_cmdline_get_arg_data( &cs, 'v', &arg_data ); + if( arg_data != NULL ) + show_version_flag = RAISED; + } + + util_cmdline_cleanup( &cs ); + + if( argc == 1 or (run_flag == LOWERED and show_version_flag == LOWERED) ) + show_help_flag = RAISED; + + if( show_error_flag == RAISED ) + { + printf( "\nInvalid arguments. Sorry - it's a simple parser, so no clues.\n" + "-h or run with no args to see the help text.\n" ); + + return( EXIT_SUCCESS ); + } + + if( show_help_flag == RAISED ) + { + printf( "test -h -i [n] -m [n] -r -v\n" + " -h : help\n" + " -i [n] : number of iterations (default : 1)\n" + " -m [n] : memory for tests, in mb (default : %u)\n" + " -r : run (causes test to run; present so no args gives help)\n" + " -v : version\n", DEFAULT_TEST_MEMORY_IN_MEGABYTES ); + + return( EXIT_SUCCESS ); + } + + if( show_version_flag == RAISED ) + { + internal_show_version(); + return( EXIT_SUCCESS ); + } + + if( run_flag == RAISED ) + { + test_pal_get_logical_core_ids( &list_of_logical_processors ); + + for( loop = 0 ; loop < (lfds700_pal_uint_t) iterations ; loop++ ) + { + printf( "\n" + "Test Iteration %02llu\n" + "=================\n", (int long long unsigned) (loop+1) ); + + test_lfds700_pal_atomic( &list_of_logical_processors, memory_in_megabytes ); + test_lfds700_btree_au( &list_of_logical_processors, memory_in_megabytes ); + test_lfds700_freelist( &list_of_logical_processors, memory_in_megabytes ); + test_lfds700_hash_a( &list_of_logical_processors, memory_in_megabytes ); + test_lfds700_list_aos( &list_of_logical_processors, memory_in_megabytes ); + test_lfds700_list_asu( &list_of_logical_processors, memory_in_megabytes ); + test_lfds700_queue( &list_of_logical_processors, memory_in_megabytes ); + test_lfds700_queue_bss( &list_of_logical_processors ); + test_lfds700_ringbuffer( &list_of_logical_processors, memory_in_megabytes ); + test_lfds700_stack( &list_of_logical_processors, memory_in_megabytes ); + } + + lfds700_list_asu_cleanup( &list_of_logical_processors, internal_logical_core_id_element_cleanup_callback ); + } + + lfds700_misc_library_cleanup(); + + return( EXIT_SUCCESS ); +} + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/misc.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/misc.c new file mode 100644 index 0000000000..4fa794f68d --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/misc.c @@ -0,0 +1,191 @@ +/***** includes *****/ +#include "internal.h" + + + + + +/****************************************************************************/ +void internal_display_test_name( char *format_string, ... ) +{ + va_list + va; + + assert( format_string != NULL ); + + va_start( va, format_string ); + + vprintf( format_string, va ); + + printf( "..." ); + + va_end( va ); + + fflush( stdout ); + + return; +} + + + + + +/****************************************************************************/ +void internal_display_test_result( lfds700_pal_uint_t number_name_dvs_pairs, ... ) +{ + char + *name; + + enum flag + passed_flag = RAISED; + + enum lfds700_misc_validity + dvs; + + lfds700_pal_uint_t + loop; + + va_list + va; + + // TRD : number_name_dvs_pairs can be any value in its range + + va_start( va, number_name_dvs_pairs ); + + for( loop = 0 ; loop < number_name_dvs_pairs ; loop++ ) + { + name = va_arg( va, char * ); + dvs = va_arg( va, enum lfds700_misc_validity ); + + if( dvs != LFDS700_MISC_VALIDITY_VALID ) + { + passed_flag = LOWERED; + break; + } + } + + va_end( va ); + + if( passed_flag == RAISED ) + puts( "passed" ); + + if( passed_flag == LOWERED ) + { + printf( "failed (" ); + + va_start( va, number_name_dvs_pairs ); + + for( loop = 0 ; loop < number_name_dvs_pairs ; loop++ ) + { + name = va_arg( va, char * ); + dvs = va_arg( va, enum lfds700_misc_validity ); + + printf( "%s ", name ); + internal_display_data_structure_validity( dvs ); + + if( loop+1 < number_name_dvs_pairs ) + printf( ", " ); + } + + va_end( va ); + + printf( ")\n" ); + + /* TRD : quick hack + the whole test programme needs rewriting + and for now I just want to make it so we + exit with failure upon any test failing + */ + + exit( EXIT_FAILURE ); + } + + return; +} + + + + + +/****************************************************************************/ +void internal_display_data_structure_validity( enum lfds700_misc_validity dvs ) +{ + char + *string = NULL; + + switch( dvs ) + { + case LFDS700_MISC_VALIDITY_VALID: + string = "valid"; + break; + + case LFDS700_MISC_VALIDITY_INVALID_LOOP: + string = "invalid - loop detected"; + break; + + case LFDS700_MISC_VALIDITY_INVALID_ORDER: + string = "invalid - invalid order detected"; + break; + + case LFDS700_MISC_VALIDITY_INVALID_MISSING_ELEMENTS: + string = "invalid - missing elements"; + break; + + case LFDS700_MISC_VALIDITY_INVALID_ADDITIONAL_ELEMENTS: + string = "invalid - additional elements"; + break; + + case LFDS700_MISC_VALIDITY_INVALID_TEST_DATA: + string = "invalid - invalid test data"; + break; + } + + printf( "%s", string ); + + return; +} + + + + + +/****************************************************************************/ +void internal_show_version() +{ + char const + *version_and_build_string; + + printf( "test %s (%s, %s) (" __DATE__ " " __TIME__ ")\n", LFDS700_TEST_VERSION_STRING, BUILD_TYPE_STRING, MODE_TYPE_STRING ); + + lfds700_misc_query( LFDS700_MISC_QUERY_GET_BUILD_AND_VERSION_STRING, NULL, (void **) &version_and_build_string ); + + printf( "%s\n", version_and_build_string ); + + return; +} + + + + + +/****************************************************************************/ +#pragma warning( disable : 4100 ) + +void internal_logical_core_id_element_cleanup_callback( struct lfds700_list_asu_state *lasus, struct lfds700_list_asu_element *lasue ) +{ + struct test_pal_logical_processor + *lp; + + assert( lasus != NULL ); + assert( lasue != NULL ); + + lp = LFDS700_LIST_ASU_GET_VALUE_FROM_ELEMENT( *lasue ); + + util_aligned_free( lp ); + + return; +} + +#pragma warning( default : 4100 ) + + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_btree_addonly_unbalanced.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_btree_addonly_unbalanced.c new file mode 100644 index 0000000000..55b94ca5bb --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_btree_addonly_unbalanced.c @@ -0,0 +1,32 @@ +/***** includes *****/ +#include "internal.h" + + + + + +/****************************************************************************/ +#pragma warning( disable : 4127 ) // TRD : disables MSVC warning for condition expressions being const + +void test_lfds700_btree_au( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ) +{ + assert( list_of_logical_processors != NULL ); + // TRD : memory_in_megabytes can be any value in its range + + if( LFDS700_MISC_ATOMIC_SUPPORT_CAS and LFDS700_MISC_ATOMIC_SUPPORT_EXCHANGE ) + { + printf( "\n" + "Binary Tree (add-only, unbalanced) Tests\n" + "========================================\n" ); + + test_lfds700_btree_au_alignment(); + test_lfds700_btree_au_fail_and_overwrite_on_existing_key(); + test_lfds700_btree_au_random_adds_fail_on_existing( list_of_logical_processors, memory_in_megabytes ); + test_lfds700_btree_au_random_adds_overwrite_on_existing( list_of_logical_processors, memory_in_megabytes ); + } + + return; +} + +#pragma warning( default : 4127 ) + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_btree_addonly_unbalanced_alignment.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_btree_addonly_unbalanced_alignment.c new file mode 100644 index 0000000000..ecdaf29adb --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_btree_addonly_unbalanced_alignment.c @@ -0,0 +1,64 @@ +/***** includes *****/ +#include "internal.h" + + + + + +/****************************************************************************/ +#pragma warning( disable : 4127 ) // TRD : disables MSVC warning for condition expressions being const + +void test_lfds700_btree_au_alignment() +{ + enum lfds700_misc_validity + dvs = LFDS700_MISC_VALIDITY_VALID; + + /* TRD : these are compile time checks + but we do them here because this is a test programme + and it should indicate issues to users when it is *run*, + not when it is compiled, because a compile error normally + indicates a problem with the code itself and so is misleading + */ + + internal_display_test_name( "Alignment" ); + + + + // TRD : struct lfds700_btree_au_element + if( offsetof(struct lfds700_btree_au_element,up) % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES != 0 ) + dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; + + if( offsetof(struct lfds700_btree_au_element,left) % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES != 0 ) + dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; + + if( offsetof(struct lfds700_btree_au_element,right) % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES != 0 ) + dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; + + if( offsetof(struct lfds700_btree_au_element,key) % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES != 0 ) + dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; + + if( offsetof(struct lfds700_btree_au_element,value) % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES != 0 ) + dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; + + if( offsetof(struct lfds700_btree_au_element,key) % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES != 0 ) + dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; + + + + // TRD : struct lfds700_btree_au_state + if( offsetof(struct lfds700_btree_au_state,root) % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES != 0 ) + dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; + + if( offsetof(struct lfds700_btree_au_state,key_compare_function) % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES != 0 ) + dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; + + + + // TRD : print the test result + internal_display_test_result( 1, "btree_au", dvs ); + + return; +} + +#pragma warning( default : 4127 ) + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_btree_addonly_unbalanced_random_adds_fail.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_btree_addonly_unbalanced_random_adds_fail.c new file mode 100644 index 0000000000..ae043a0669 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_btree_addonly_unbalanced_random_adds_fail.c @@ -0,0 +1,319 @@ +/***** includes *****/ +#include "internal.h" + +/***** structs *****/ +struct test_element +{ + struct lfds700_btree_au_element + baue; + + lfds700_pal_uint_t + key; +}; + +struct test_state +{ + lfds700_pal_uint_t + insert_fail_count, + number_elements; + + struct lfds700_btree_au_state + *baus; + + struct test_element + *element_array; +}; + +/***** private prototypes *****/ +static int key_compare_function( void const *new_value, void const *value_in_tree ); +static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_adding( void *util_thread_starter_thread_state ); + + + + + +/****************************************************************************/ +void test_lfds700_btree_au_random_adds_fail_on_existing( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ) +{ + enum lfds700_misc_validity + dvs = LFDS700_MISC_VALIDITY_VALID; + + lfds700_pal_uint_t + actual_sum_insert_failure_count, + expected_sum_insert_failure_count, + index = 0, + *key_count_array, + loop, + number_elements, + number_logical_processors, + random_value, + subloop; + + struct lfds700_list_asu_element + *lasue; + + struct lfds700_btree_au_element + *baue = NULL; + + struct lfds700_btree_au_state + baus; + + struct lfds700_misc_prng_state + ps; + + struct lfds700_misc_validation_info + vi; + + struct test_pal_logical_processor + *lp; + + struct util_thread_starter_state + *tts; + + struct test_state + *ts; + + test_pal_thread_state_t + *thread_handles; + + void + *key; + + assert( list_of_logical_processors != NULL ); + // TRD : memory_in_megabytes can be any value in its range + + /* TRD : we create a single btree_au + we generate 10k elements per thread (one per logical processor) in an array + we set a random number in each element, which is the key + random numbers are generated are from 0 to 5000, so we must have some duplicates + (we don't use value, so we always pass in a NULL for that when we insert) + + each thread loops, adds those elements into the btree, and counts the total number of insert fails + (we don't count on a per value basis because of the performance hit - we'll be TLBing all the time) + this test has the btree_au set to fail on add, so duplicates should be eliminated + + we then merge the per-thread arrays + + we should find in the tree one of every value, and the sum of the counts of each value (beyond the + first value, which was inserted) in the merged arrays should equal the sum of the insert fails from + each thread + + we check the count of unique values in the merged array and use that when calling the btree_au validation function + + we in-order walk and check that what we have in the tree matches what we have in the merged array + and then check the fail counts + */ + + internal_display_test_name( "Random adds and walking (fail on existing key)" ); + + lfds700_misc_prng_init( &ps ); + + lfds700_list_asu_query( list_of_logical_processors, LFDS700_LIST_ASU_QUERY_GET_POTENTIALLY_INACCURATE_COUNT, NULL, (void **) &number_logical_processors ); + + lfds700_btree_au_init_valid_on_current_logical_core( &baus, key_compare_function, LFDS700_BTREE_AU_EXISTING_KEY_FAIL, NULL ); + + ts = util_malloc_wrapper( sizeof(struct test_state) * number_logical_processors ); + number_elements = ( memory_in_megabytes * ONE_MEGABYTE_IN_BYTES ) / ( sizeof(struct test_element) * number_logical_processors ); + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + { + (ts+loop)->baus = &baus; + (ts+loop)->element_array = util_aligned_malloc( sizeof(struct test_element) * number_elements, LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES ); + (ts+loop)->number_elements = number_elements; + (ts+loop)->insert_fail_count = 0; + + for( subloop = 0 ; subloop < number_elements ; subloop++ ) + { + random_value = LFDS700_MISC_PRNG_GENERATE( &ps ); + ((ts+loop)->element_array+subloop)->key = (lfds700_pal_uint_t) floor( (number_elements/2) * ((double) random_value / (double) LFDS700_MISC_PRNG_MAX) ); + } + } + + thread_handles = util_malloc_wrapper( sizeof(test_pal_thread_state_t) * number_logical_processors ); + + util_thread_starter_new( &tts, number_logical_processors ); + + LFDS700_MISC_BARRIER_STORE; + + lfds700_misc_force_store(); + + loop = 0; + lasue = NULL; + + while( LFDS700_LIST_ASU_GET_START_AND_THEN_NEXT(*list_of_logical_processors, lasue) ) + { + lp = LFDS700_LIST_ASU_GET_VALUE_FROM_ELEMENT( *lasue ); + util_thread_starter_start( tts, &thread_handles[loop], loop, lp, thread_adding, ts+loop ); + loop++; + } + + util_thread_starter_run( tts ); + + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + test_pal_thread_wait( thread_handles[loop] ); + + util_thread_starter_delete( tts ); + + free( thread_handles ); + + LFDS700_MISC_BARRIER_LOAD; + + /* TRD : now for validation + make an array equal to number_elements, set all to 0 + iterate over every per-thread array, counting the number of each value into this array + so we can know how many elements ought to have failed to be inserted + as well as being able to work out the actual number of elements which should be present in the btree, for the btree validation call + */ + + key_count_array = util_malloc_wrapper( sizeof(lfds700_pal_uint_t) * number_elements ); + for( loop = 0 ; loop < number_elements ; loop++ ) + *(key_count_array+loop) = 0; + + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + for( subloop = 0 ; subloop < number_elements ; subloop++ ) + ( *(key_count_array+( (ts+loop)->element_array+subloop)->key) )++; + + // TRD : first, btree validation function + vi.min_elements = number_elements; + + for( loop = 0 ; loop < number_elements ; loop++ ) + if( *(key_count_array+loop) == 0 ) + vi.min_elements--; + + vi.max_elements = vi.min_elements; + + lfds700_btree_au_query( &baus, LFDS700_BTREE_AU_QUERY_SINGLETHREADED_VALIDATE, (void *) &vi, (void *) &dvs ); + + /* TRD : now check the sum of per-thread insert failures + is what it should be, which is the sum of key_count_array, + but with every count minus one (for the single succesful insert) + and where elements of 0 are ignored (i.e. do not have -1 applied) + */ + + expected_sum_insert_failure_count = 0; + + for( loop = 0 ; loop < number_elements ; loop++ ) + if( *(key_count_array+loop) != 0 ) + expected_sum_insert_failure_count += *(key_count_array+loop) - 1; + + actual_sum_insert_failure_count = 0; + + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + actual_sum_insert_failure_count += (ts+loop)->insert_fail_count; + + if( expected_sum_insert_failure_count != actual_sum_insert_failure_count ) + dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; + + /* TRD : now compared the combined array and an in-order walk of the tree + ignoring array elements with the value 0, we should find an exact match + */ + + if( dvs == LFDS700_MISC_VALIDITY_VALID ) + { + // TRD : in-order walk over btree_au and check key_count_array matches + while( dvs == LFDS700_MISC_VALIDITY_VALID and lfds700_btree_au_get_by_absolute_position_and_then_by_relative_position(&baus, &baue, LFDS700_BTREE_AU_ABSOLUTE_POSITION_SMALLEST_IN_TREE, LFDS700_BTREE_AU_RELATIVE_POSITION_NEXT_LARGER_ELEMENT_IN_ENTIRE_TREE) ) + { + key = LFDS700_BTREE_AU_GET_KEY_FROM_ELEMENT( *baue ); + + while( *(key_count_array+index) == 0 ) + index++; + + if( index++ != (lfds700_pal_uint_t) key ) + dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; + } + } + + // TRD : cleanup + free( key_count_array ); + + lfds700_btree_au_cleanup( &baus, NULL ); + + // TRD : cleanup + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + util_aligned_free( (ts+loop)->element_array ); + + free( ts ); + + // TRD : print the test result + internal_display_test_result( 1, "btree_au", dvs ); + + return; +} + + + + + +/****************************************************************************/ +#pragma warning( disable : 4100 ) + +static int key_compare_function( void const *new_key, void const *key_in_tree ) +{ + int + cr = 0; + + // TRD : key_new can be any value in its range + // TRD : key_in_tree can be any value in its range + + if( (lfds700_pal_uint_t) new_key < (lfds700_pal_uint_t) key_in_tree ) + cr = -1; + + if( (lfds700_pal_uint_t) new_key > (lfds700_pal_uint_t) key_in_tree ) + cr = 1; + + return( cr ); +} + +#pragma warning( default : 4100 ) + + + + + +/****************************************************************************/ +static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_adding( void *util_thread_starter_thread_state ) +{ + enum lfds700_btree_au_insert_result + alr; + + lfds700_pal_uint_t + index = 0; + + struct test_state + *ts; + + struct lfds700_misc_prng_state + ps; + + struct util_thread_starter_thread_state + *tsts; + + LFDS700_MISC_MAKE_VALID_ON_CURRENT_LOGICAL_CORE_INITS_COMPLETED_BEFORE_NOW_ON_ANY_OTHER_LOGICAL_CORE; + + assert( util_thread_starter_thread_state != NULL ); + + tsts = (struct util_thread_starter_thread_state *) util_thread_starter_thread_state; + ts = (struct test_state *) tsts->thread_user_state; + + lfds700_misc_prng_init( &ps ); + + util_thread_starter_ready_and_wait( tsts ); + + while( index < ts->number_elements ) + { + LFDS700_BTREE_AU_SET_KEY_IN_ELEMENT( (ts->element_array+index)->baue, (ts->element_array+index)->key ); + LFDS700_BTREE_AU_SET_VALUE_IN_ELEMENT( (ts->element_array+index)->baue, 0 ); + alr = lfds700_btree_au_insert( ts->baus, &(ts->element_array+index)->baue, NULL, &ps ); + + if( alr == LFDS700_BTREE_AU_INSERT_RESULT_FAILURE_EXISTING_KEY ) + ts->insert_fail_count++; + + index++; + } + + LFDS700_MISC_BARRIER_STORE; + + lfds700_misc_force_store(); + + return( (test_pal_thread_return_t) EXIT_SUCCESS ); +} + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_btree_addonly_unbalanced_random_adds_fail_and_overwrite.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_btree_addonly_unbalanced_random_adds_fail_and_overwrite.c new file mode 100644 index 0000000000..4c638c8600 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_btree_addonly_unbalanced_random_adds_fail_and_overwrite.c @@ -0,0 +1,140 @@ +/***** includes *****/ +#include "internal.h" + +/***** private prototypes *****/ +static int key_compare_function( void const *new_value, void const *value_in_tree ); + + + + + +/****************************************************************************/ +void test_lfds700_btree_au_fail_and_overwrite_on_existing_key() +{ + enum lfds700_btree_au_insert_result + alr; + + enum lfds700_misc_validity + dvs = LFDS700_MISC_VALIDITY_VALID; + + struct lfds700_btree_au_element + baue_one, + baue_two, + *existing_baue; + + struct lfds700_btree_au_state + baus; + + struct lfds700_misc_prng_state + ps; + + void + *value; + + /* TRD : the random_adds tests with fail and overwrite don't (can't, not in a performant manner) + test that the fail and/or overwrite of user data has *actually* happened - they use the + return value from the link function call, rather than empirically observing the final + state of the tree + + as such, we now have a couple of single threaded tests where we check that the user data + value really is being modified (or not modified, as the case may be) + */ + + internal_display_test_name( "Fail and overwrite on existing key" ); + + lfds700_misc_prng_init( &ps ); + + /* TRD : so, we make a tree which is fail on existing + add one element, with a known user data + we then try to add the same key again, with a different user data + the call should fail, and then we get the element by its key + and check its user data is unchanged + (and confirm the failed link returned the correct existing_baue) + that's the first test done + */ + + lfds700_btree_au_init_valid_on_current_logical_core( &baus, key_compare_function, LFDS700_BTREE_AU_EXISTING_KEY_FAIL, NULL ); + + LFDS700_BTREE_AU_SET_KEY_IN_ELEMENT( baue_one, 0 ); + LFDS700_BTREE_AU_SET_VALUE_IN_ELEMENT( baue_one, 1 ); + alr = lfds700_btree_au_insert( &baus, &baue_one, NULL, &ps ); + + if( alr != LFDS700_BTREE_AU_INSERT_RESULT_SUCCESS ) + dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; + + LFDS700_BTREE_AU_SET_KEY_IN_ELEMENT( baue_two, 0 ); + LFDS700_BTREE_AU_SET_VALUE_IN_ELEMENT( baue_two, 2 ); + alr = lfds700_btree_au_insert( &baus, &baue_two, &existing_baue, &ps ); + + if( alr != LFDS700_BTREE_AU_INSERT_RESULT_FAILURE_EXISTING_KEY ) + dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; + + if( existing_baue != &baue_one ) + dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; + + value = LFDS700_BTREE_AU_GET_VALUE_FROM_ELEMENT( *existing_baue ); + + if( (void *) (lfds700_pal_uint_t) value != (void *) (lfds700_pal_uint_t) 1 ) + dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; + + lfds700_btree_au_cleanup( &baus, NULL ); + + /* TRD : second test, make a tree which is overwrite on existing + add one element, with a known user data + we then try to add the same key again, with a different user data + the call should succeed, and then we get the element by its key + and check its user data is changed + (and confirm the failed link returned the correct existing_baue) + that's the secondtest done + */ + + lfds700_btree_au_init_valid_on_current_logical_core( &baus, key_compare_function, LFDS700_BTREE_AU_EXISTING_KEY_OVERWRITE, NULL ); + + LFDS700_BTREE_AU_SET_KEY_IN_ELEMENT( baue_one, 0 ); + LFDS700_BTREE_AU_SET_VALUE_IN_ELEMENT( baue_one, 1 ); + alr = lfds700_btree_au_insert( &baus, &baue_one, NULL, &ps ); + + if( alr != LFDS700_BTREE_AU_INSERT_RESULT_SUCCESS ) + dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; + + LFDS700_BTREE_AU_SET_KEY_IN_ELEMENT( baue_two, 0 ); + LFDS700_BTREE_AU_SET_VALUE_IN_ELEMENT( baue_two, 2 ); + alr = lfds700_btree_au_insert( &baus, &baue_two, NULL, &ps ); + + if( alr != LFDS700_BTREE_AU_INSERT_RESULT_SUCCESS_OVERWRITE ) + dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; + + lfds700_btree_au_cleanup( &baus, NULL ); + + // TRD : print the test result + internal_display_test_result( 1, "btree_au", dvs ); + + return; +} + + + + + +/****************************************************************************/ +#pragma warning( disable : 4100 ) + +static int key_compare_function( void const *new_key, void const *key_in_tree ) +{ + int + cr = 0; + + // TRD : key_new can be any value in its range + // TRD : key_in_tree can be any value in its range + + if( (lfds700_pal_uint_t) new_key < (lfds700_pal_uint_t) key_in_tree ) + cr = -1; + + if( (lfds700_pal_uint_t) new_key > (lfds700_pal_uint_t) key_in_tree ) + cr = 1; + + return( cr ); +} + +#pragma warning( default : 4100 ) + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_btree_addonly_unbalanced_random_adds_overwrite.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_btree_addonly_unbalanced_random_adds_overwrite.c new file mode 100644 index 0000000000..c9b162128b --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_btree_addonly_unbalanced_random_adds_overwrite.c @@ -0,0 +1,322 @@ +/***** includes *****/ +#include "internal.h" + +/***** structs *****/ +struct test_element +{ + struct lfds700_btree_au_element + baue; + + lfds700_pal_uint_t + key; +}; + +struct test_state +{ + lfds700_pal_uint_t + insert_existing_count, + number_elements; + + struct lfds700_btree_au_state + *baus; + + struct test_element + *element_array; +}; + +/***** private prototypes *****/ +static int key_compare_function( void const *new_value, void const *value_in_tree ); +static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_adding( void *util_thread_starter_thread_state ); + + + + + +/****************************************************************************/ +void test_lfds700_btree_au_random_adds_overwrite_on_existing( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ) +{ + enum lfds700_misc_validity + dvs = LFDS700_MISC_VALIDITY_VALID; + + lfds700_pal_uint_t + actual_sum_insert_existing_count, + expected_sum_insert_existing_count, + index = 0, + *key_count_array, + loop, + number_elements, + number_logical_processors, + random_value, + subloop; + + struct lfds700_list_asu_element + *lasue; + + struct lfds700_btree_au_element + *baue = NULL; + + struct lfds700_btree_au_state + baus; + + struct lfds700_misc_prng_state + ps; + + struct lfds700_misc_validation_info + vi; + + struct test_pal_logical_processor + *lp; + + struct util_thread_starter_state + *tts; + + struct test_state + *ts; + + test_pal_thread_state_t + *thread_handles; + + void + *key; + + assert( list_of_logical_processors != NULL ); + // TRD : memory_in_megabytes can be any value in its range + + /* TRD : we create a single btree_au + we generate 10k elements per thread (one per logical processor) in an array + we set a random number in each element, which is the key + random numbers are generated are from 0 to 5000, so we must have some duplicates + (we don't use value, so we always pass in a NULL for that when we insert) + + each thread loops, adds those elements into the btree, and counts the total number of insert fails + (we don't count on a per value basis because of the performance hit - we'll be TLBing all the time) + this test has the btree_au set to overwrite on add, so duplicates should be eliminated + + we then merge the per-thread arrays + + we should find in the tree one of every value, and the sum of the counts of each value (beyond the + first value, which was inserted) in the merged arrays should equal the sum of the existing_baues returned + from each thread when they inserted and found an existing element + + we check the count of unique values in the merged array and use that when calling the btree_au validation function + + we in-order walk and check that what we have in the tree matches what we have in the merged array + and then check the fail counts + */ + + internal_display_test_name( "Random adds and walking (overwrite on existing key)" ); + + lfds700_misc_prng_init( &ps ); + + lfds700_list_asu_query( list_of_logical_processors, LFDS700_LIST_ASU_QUERY_GET_POTENTIALLY_INACCURATE_COUNT, NULL, (void **) &number_logical_processors ); + + lfds700_btree_au_init_valid_on_current_logical_core( &baus, key_compare_function, LFDS700_BTREE_AU_EXISTING_KEY_OVERWRITE, NULL ); + + ts = util_malloc_wrapper( sizeof(struct test_state) * number_logical_processors ); + number_elements = ( memory_in_megabytes * ONE_MEGABYTE_IN_BYTES ) / ( sizeof(struct test_element) * number_logical_processors ); + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + { + (ts+loop)->baus = &baus; + (ts+loop)->element_array = util_aligned_malloc( sizeof(struct test_element) * number_elements, LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES ); + (ts+loop)->number_elements = number_elements; + (ts+loop)->insert_existing_count = 0; + + for( subloop = 0 ; subloop < number_elements ; subloop++ ) + { + random_value = LFDS700_MISC_PRNG_GENERATE( &ps ); + ((ts+loop)->element_array+subloop)->key = (lfds700_pal_uint_t) floor( (number_elements/2) * ((double) random_value / (double) LFDS700_MISC_PRNG_MAX) ); + } + } + + thread_handles = util_malloc_wrapper( sizeof(test_pal_thread_state_t) * number_logical_processors ); + + util_thread_starter_new( &tts, number_logical_processors ); + + LFDS700_MISC_BARRIER_STORE; + + lfds700_misc_force_store(); + + loop = 0; + lasue = NULL; + + while( LFDS700_LIST_ASU_GET_START_AND_THEN_NEXT(*list_of_logical_processors, lasue) ) + { + lp = LFDS700_LIST_ASU_GET_VALUE_FROM_ELEMENT( *lasue ); + util_thread_starter_start( tts, &thread_handles[loop], loop, lp, thread_adding, ts+loop ); + loop++; + } + + util_thread_starter_run( tts ); + + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + test_pal_thread_wait( thread_handles[loop] ); + + util_thread_starter_delete( tts ); + + free( thread_handles ); + + LFDS700_MISC_BARRIER_LOAD; + + /* TRD : now for validation + make an array equal to number_elements, set all to 0 + iterate over every per-thread array, counting the number of each value into this array + so we can know how many elements ought to have failed to be inserted + as well as being able to work out the actual number of elements which should be present in the btree, for the btree validation call + */ + + key_count_array = util_malloc_wrapper( sizeof(lfds700_pal_uint_t) * number_elements ); + for( loop = 0 ; loop < number_elements ; loop++ ) + *(key_count_array+loop) = 0; + + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + for( subloop = 0 ; subloop < number_elements ; subloop++ ) + ( *(key_count_array+( (ts+loop)->element_array+subloop)->key) )++; + + // TRD : first, btree validation function + vi.min_elements = number_elements; + + for( loop = 0 ; loop < number_elements ; loop++ ) + if( *(key_count_array+loop) == 0 ) + vi.min_elements--; + + vi.max_elements = vi.min_elements; + + lfds700_btree_au_query( &baus, LFDS700_BTREE_AU_QUERY_SINGLETHREADED_VALIDATE, (void *) &vi, (void *) &dvs ); + + /* TRD : now check the sum of per-thread insert failures + is what it should be, which is the sum of key_count_array, + but with every count minus one (for the single succesful insert) + and where elements of 0 are ignored (i.e. do not have -1 applied) + */ + + expected_sum_insert_existing_count = 0; + + for( loop = 0 ; loop < number_elements ; loop++ ) + if( *(key_count_array+loop) != 0 ) + expected_sum_insert_existing_count += *(key_count_array+loop) - 1; + + actual_sum_insert_existing_count = 0; + + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + actual_sum_insert_existing_count += (ts+loop)->insert_existing_count; + + if( expected_sum_insert_existing_count != actual_sum_insert_existing_count ) + dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; + + /* TRD : now compared the combined array and an in-order walk of the tree + ignoring array elements with the value 0, we should find an exact match + */ + + if( dvs == LFDS700_MISC_VALIDITY_VALID ) + { + // TRD : in-order walk over btree_au and check key_count_array matches + while( dvs == LFDS700_MISC_VALIDITY_VALID and lfds700_btree_au_get_by_absolute_position_and_then_by_relative_position(&baus, &baue, LFDS700_BTREE_AU_ABSOLUTE_POSITION_SMALLEST_IN_TREE, LFDS700_BTREE_AU_RELATIVE_POSITION_NEXT_LARGER_ELEMENT_IN_ENTIRE_TREE) ) + { + key = LFDS700_BTREE_AU_GET_KEY_FROM_ELEMENT( *baue ); + + while( *(key_count_array+index) == 0 ) + index++; + + if( index++ != (lfds700_pal_uint_t) key ) + dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; + } + } + + // TRD : cleanup + free( key_count_array ); + + lfds700_btree_au_cleanup( &baus, NULL ); + + // TRD : cleanup + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + util_aligned_free( (ts+loop)->element_array ); + + free( ts ); + + // TRD : print the test result + internal_display_test_result( 1, "btree_au", dvs ); + + return; +} + + + + + +/****************************************************************************/ +#pragma warning( disable : 4100 ) + +static int key_compare_function( void const *new_key, void const *key_in_tree ) +{ + int + cr = 0; + + // TRD : key_new can be any value in its range + // TRD : key_in_tree can be any value in its range + + if( (lfds700_pal_uint_t) new_key < (lfds700_pal_uint_t) key_in_tree ) + cr = -1; + + if( (lfds700_pal_uint_t) new_key > (lfds700_pal_uint_t) key_in_tree ) + cr = 1; + + return( cr ); +} + +#pragma warning( default : 4100 ) + + + + + +/****************************************************************************/ +static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_adding( void *util_thread_starter_thread_state ) +{ + enum lfds700_btree_au_insert_result + alr; + + lfds700_pal_uint_t + index = 0; + + struct test_state + *ts; + + struct lfds700_btree_au_element + *existing_baue; + + struct lfds700_misc_prng_state + ps; + + struct util_thread_starter_thread_state + *tsts; + + LFDS700_MISC_MAKE_VALID_ON_CURRENT_LOGICAL_CORE_INITS_COMPLETED_BEFORE_NOW_ON_ANY_OTHER_LOGICAL_CORE; + + assert( util_thread_starter_thread_state != NULL ); + + tsts = (struct util_thread_starter_thread_state *) util_thread_starter_thread_state; + ts = (struct test_state *) tsts->thread_user_state; + + lfds700_misc_prng_init( &ps ); + + util_thread_starter_ready_and_wait( tsts ); + + while( index < ts->number_elements ) + { + LFDS700_BTREE_AU_SET_KEY_IN_ELEMENT( (ts->element_array+index)->baue, (ts->element_array+index)->key ); + LFDS700_BTREE_AU_SET_VALUE_IN_ELEMENT( (ts->element_array+index)->baue, 0 ); + alr = lfds700_btree_au_insert( ts->baus, &(ts->element_array+index)->baue, &existing_baue, &ps ); + + if( alr == LFDS700_BTREE_AU_INSERT_RESULT_SUCCESS_OVERWRITE ) + ts->insert_existing_count++; + + index++; + } + + LFDS700_MISC_BARRIER_STORE; + + lfds700_misc_force_store(); + + return( (test_pal_thread_return_t) EXIT_SUCCESS ); +} + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_freelist.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_freelist.c new file mode 100644 index 0000000000..1968ae7167 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_freelist.c @@ -0,0 +1,33 @@ +/***** includes *****/ +#include "internal.h" + + + + + +/****************************************************************************/ +#pragma warning( disable : 4127 ) // TRD : disables MSVC warning for condition expressions being const + +void test_lfds700_freelist( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ) +{ + assert( list_of_logical_processors != NULL ); + // TRD : memory_in_megabytes can be any value in its range + + if( LFDS700_MISC_ATOMIC_SUPPORT_DWCAS ) + { + printf( "\n" + "Freelist Tests\n" + "==============\n" ); + + test_lfds700_freelist_alignment(); + test_lfds700_freelist_popping( list_of_logical_processors, memory_in_megabytes ); + test_lfds700_freelist_pushing( list_of_logical_processors, memory_in_megabytes ); + test_lfds700_freelist_popping_and_pushing( list_of_logical_processors, memory_in_megabytes ); + test_lfds700_freelist_rapid_popping_and_pushing( list_of_logical_processors ); + } + + return; +} + +#pragma warning( default : 4127 ) + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_freelist_alignment.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_freelist_alignment.c new file mode 100644 index 0000000000..885ecbf8c4 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_freelist_alignment.c @@ -0,0 +1,43 @@ +/***** includes *****/ +#include "internal.h" + + + + + +/****************************************************************************/ +#pragma warning( disable : 4127 ) // TRD : disables MSVC warning for condition expressions being const + +void test_lfds700_freelist_alignment() +{ + enum lfds700_misc_validity + dvs = LFDS700_MISC_VALIDITY_VALID; + + /* TRD : these are compile time checks + but we do them here because this is a test programme + and it should indicate issues to users when it is *run*, + not when it is compiled, because a compile error normally + indicates a problem with the code itself and so is misleading + */ + + internal_display_test_name( "Alignment" ); + + + + // TRD : struct lfds700_freelist_state + if( offsetof(struct lfds700_freelist_state,top) % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES != 0 ) + dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; + + if( offsetof(struct lfds700_freelist_state,user_state) % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES != 0 ) + dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; + + + + // TRD : print the test result + internal_display_test_result( 1, "freelist", dvs ); + + return; +} + +#pragma warning( default : 4127 ) + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_freelist_popping.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_freelist_popping.c new file mode 100644 index 0000000000..6dcbd0847a --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_freelist_popping.c @@ -0,0 +1,205 @@ +/***** includes *****/ +#include "internal.h" + +/***** structs *****/ +struct test_state +{ + struct lfds700_freelist_state + *fs; +}; + +struct test_element +{ + struct lfds700_freelist_element + fe; + + enum flag + popped_flag; +}; + +/***** private prototypes *****/ +static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_popping( void *util_thread_starter_thread_state ); + + + + + +/****************************************************************************/ +void test_lfds700_freelist_popping( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ) +{ + enum lfds700_misc_validity + dvs = LFDS700_MISC_VALIDITY_VALID; + + lfds700_pal_uint_t + loop, + number_elements, + number_logical_processors; + + struct lfds700_list_asu_element + *lasue; + + struct lfds700_freelist_state + fs; + + struct lfds700_misc_prng_state + ps; + + struct lfds700_misc_validation_info + vi = { 0, 0 }; + + struct test_pal_logical_processor + *lp; + + struct util_thread_starter_state + *tts; + + struct test_element + *te_array; + + struct test_state + *ts; + + test_pal_thread_state_t + *thread_handles; + + assert( list_of_logical_processors != NULL ); + // TRD : memory_in_megabytes can be any value in its range + + /* TRD : we create a freelist with 1,000,000 elements + + the creation function runs in a single thread and creates + and pushes those elements onto the freelist + + each element contains a void pointer to the container test element + + we then run one thread per CPU + where each thread loops, popping as quickly as possible + each test element has a flag which indicates it has been popped + + the threads run till the source freelist is empty + + we then check the test elements + every element should have been popped + + then tidy up + + we have no extra code for CAS/GC as we're only popping + */ + + internal_display_test_name( "Popping" ); + + lfds700_list_asu_query( list_of_logical_processors, LFDS700_LIST_ASU_QUERY_GET_POTENTIALLY_INACCURATE_COUNT, NULL, (void **) &number_logical_processors ); + + lfds700_misc_prng_init( &ps ); + + lfds700_freelist_init_valid_on_current_logical_core( &fs, NULL ); + + number_elements = ( memory_in_megabytes * ONE_MEGABYTE_IN_BYTES ) / sizeof(struct test_element); + + te_array = util_aligned_malloc( sizeof(struct test_element) * number_elements, LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES ); + + for( loop = 0 ; loop < number_elements ; loop++ ) + { + (te_array+loop)->popped_flag = LOWERED; + LFDS700_FREELIST_SET_VALUE_IN_ELEMENT( (te_array+loop)->fe, te_array+loop ); + lfds700_freelist_push( &fs, &(te_array+loop)->fe, &ps ); + } + + ts = util_aligned_malloc( sizeof(struct test_state) * number_logical_processors, LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES ); + + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + (ts+loop)->fs = &fs; + + thread_handles = util_malloc_wrapper( sizeof(test_pal_thread_state_t) * number_logical_processors ); + + util_thread_starter_new( &tts, number_logical_processors ); + + LFDS700_MISC_BARRIER_STORE; + + lfds700_misc_force_store(); + + loop = 0; + lasue = NULL; + + while( LFDS700_LIST_ASU_GET_START_AND_THEN_NEXT(*list_of_logical_processors, lasue) ) + { + lp = LFDS700_LIST_ASU_GET_VALUE_FROM_ELEMENT( *lasue ); + util_thread_starter_start( tts, &thread_handles[loop], loop, lp, thread_popping, ts+loop ); + loop++; + } + + util_thread_starter_run( tts ); + + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + test_pal_thread_wait( thread_handles[loop] ); + + util_thread_starter_delete( tts ); + + free( thread_handles ); + + LFDS700_MISC_BARRIER_LOAD; + + lfds700_freelist_query( &fs, LFDS700_FREELIST_QUERY_SINGLETHREADED_VALIDATE, &vi, &dvs ); + + // TRD : now we check each element has popped_flag set to RAISED + for( loop = 0 ; loop < number_elements ; loop++ ) + if( (te_array+loop)->popped_flag == LOWERED ) + dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; + + // TRD : cleanup + lfds700_freelist_cleanup( &fs, NULL ); + util_aligned_free( ts ); + util_aligned_free( te_array ); + + // TRD : print the test result + internal_display_test_result( 1, "freelist", dvs ); + + return; +} + + + + + +/****************************************************************************/ +static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_popping( void *util_thread_starter_thread_state ) +{ + struct lfds700_freelist_element + *fe; + + struct lfds700_misc_prng_state + ps; + + struct test_element + *te; + + struct test_state + *ts; + + struct util_thread_starter_thread_state + *tsts; + + LFDS700_MISC_MAKE_VALID_ON_CURRENT_LOGICAL_CORE_INITS_COMPLETED_BEFORE_NOW_ON_ANY_OTHER_LOGICAL_CORE; + + assert( util_thread_starter_thread_state != NULL ); + + tsts = (struct util_thread_starter_thread_state *) util_thread_starter_thread_state; + ts = (struct test_state *) tsts->thread_user_state; + + lfds700_misc_prng_init( &ps ); + + util_thread_starter_ready_and_wait( tsts ); + + while( lfds700_freelist_pop(ts->fs, &fe, &ps) ) + { + te = LFDS700_FREELIST_GET_VALUE_FROM_ELEMENT( *fe ); + te->popped_flag = RAISED; + } + + LFDS700_MISC_BARRIER_STORE; + + lfds700_misc_force_store(); + + return( (test_pal_thread_return_t) EXIT_SUCCESS ); +} + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_freelist_popping_and_pushing.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_freelist_popping_and_pushing.c new file mode 100644 index 0000000000..8c411151d3 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_freelist_popping_and_pushing.c @@ -0,0 +1,319 @@ +/***** includes *****/ +#include "internal.h" + +/***** structs *****/ +struct test_element; + +struct test_state +{ + struct lfds700_freelist_state + fs_thread_local, + *fs; + + lfds700_pal_uint_t + number_elements; + + struct test_element + *fs_thread_local_te_array; +}; + +struct test_element +{ + struct lfds700_freelist_element + fe, + thread_local_fe; + + lfds700_pal_uint_t + datum; +}; + +/***** private prototypes *****/ +static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_popping_and_pushing_start_popping( void *util_thread_starter_thread_state ); +static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_popping_and_pushing_start_pushing( void *util_thread_starter_thread_state ); + + + + + +/****************************************************************************/ +void test_lfds700_freelist_popping_and_pushing( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ) +{ + enum lfds700_misc_validity + dvs; + + lfds700_pal_uint_t + loop, + number_elements, + number_logical_processors, + subloop; + + struct lfds700_list_asu_element + *lasue; + + struct lfds700_freelist_state + fs; + + struct lfds700_misc_prng_state + ps; + + struct lfds700_misc_validation_info + vi; + + struct test_pal_logical_processor + *lp; + + struct util_thread_starter_state + *tts; + + struct test_element + *te_array; + + struct test_state + *ts; + + test_pal_thread_state_t + *thread_handles; + + assert( list_of_logical_processors != NULL ); + // TRD : memory_in_megabytes can be any value in its range + + /* TRD : we have two threads per CPU + the threads loop for ten seconds + the first thread pushes 10000 elements then pops 10000 elements + the second thread pops 10000 elements then pushes 10000 elements + all pushes and pops go onto the single main freelist + with a per-thread local freelist to store the pops + + after time is up, all threads push what they have remaining onto + the main freelist + + we then validate the main freelist + */ + + internal_display_test_name( "Popping and pushing (%d seconds)", TEST_DURATION_IN_SECONDS ); + + lfds700_list_asu_query( list_of_logical_processors, LFDS700_LIST_ASU_QUERY_GET_POTENTIALLY_INACCURATE_COUNT, NULL, (void **) &number_logical_processors ); + + lfds700_misc_prng_init( &ps ); + + number_elements = ( memory_in_megabytes * ONE_MEGABYTE_IN_BYTES ) / ( sizeof(struct test_element) * number_logical_processors * 2 ); + + lfds700_freelist_init_valid_on_current_logical_core( &fs, NULL ); + + // TRD : we allocate half the total elements here, and half again later, which is why *2 above, but not here + te_array = util_aligned_malloc( sizeof(struct test_element) * number_elements * number_logical_processors, LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES ); + + // TRD : initial elements in the main freelist so the popping threads can start immediately + for( loop = 0 ; loop < number_elements * number_logical_processors ; loop++ ) + { + (te_array+loop)->datum = loop; + LFDS700_FREELIST_SET_VALUE_IN_ELEMENT( (te_array+loop)->fe, te_array+loop ); + lfds700_freelist_push( &fs, &(te_array+loop)->fe, &ps ); + } + + ts = util_aligned_malloc( sizeof(struct test_state) * number_logical_processors * 2, LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES ); + + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + { + // TRD : first set of threads (poppers) + (ts+loop)->fs = &fs; + (ts+loop)->number_elements = number_elements; + lfds700_freelist_init_valid_on_current_logical_core( &(ts+loop)->fs_thread_local, NULL ); + + // TRD : second set of threads (pushers - who need elements in their per-thread freelists) + (ts+loop+number_logical_processors)->fs = &fs; + (ts+loop+number_logical_processors)->number_elements = number_elements; + lfds700_freelist_init_valid_on_current_logical_core( &(ts+loop+number_logical_processors)->fs_thread_local, NULL ); + + // TRD : fill the pushing thread freelists + (ts+loop+number_logical_processors)->fs_thread_local_te_array = util_aligned_malloc( sizeof(struct test_element) * number_elements, LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES ); + + for( subloop = 0 ; subloop < number_elements ; subloop++ ) + { + ((ts+loop+number_logical_processors)->fs_thread_local_te_array+subloop)->datum = loop; + LFDS700_FREELIST_SET_VALUE_IN_ELEMENT( ((ts+loop+number_logical_processors)->fs_thread_local_te_array+subloop)->thread_local_fe, (ts+loop+number_logical_processors)->fs_thread_local_te_array+subloop ); + lfds700_freelist_push( &(ts+loop+number_logical_processors)->fs_thread_local, &((ts+loop+number_logical_processors)->fs_thread_local_te_array+subloop)->thread_local_fe, &ps ); + } + } + + thread_handles = util_malloc_wrapper( sizeof(test_pal_thread_state_t) * number_logical_processors * 2 ); + + util_thread_starter_new( &tts, number_logical_processors * 2 ); + + LFDS700_MISC_BARRIER_STORE; + + lfds700_misc_force_store(); + + loop = 0; + lasue = NULL; + + while( LFDS700_LIST_ASU_GET_START_AND_THEN_NEXT(*list_of_logical_processors, lasue) ) + { + lp = LFDS700_LIST_ASU_GET_VALUE_FROM_ELEMENT( *lasue ); + util_thread_starter_start( tts, &thread_handles[loop], loop, lp, thread_popping_and_pushing_start_popping, ts+loop ); + util_thread_starter_start( tts, &thread_handles[loop+number_logical_processors], loop+number_logical_processors, lp, thread_popping_and_pushing_start_pushing, ts+loop+number_logical_processors ); + loop++; + } + + util_thread_starter_run( tts ); + + for( loop = 0 ; loop < number_logical_processors * 2 ; loop++ ) + test_pal_thread_wait( thread_handles[loop] ); + + util_thread_starter_delete( tts ); + + free( thread_handles ); + + LFDS700_MISC_BARRIER_LOAD; + + vi.min_elements = vi.max_elements = number_elements * number_logical_processors * 2; + + lfds700_freelist_query( &fs, LFDS700_FREELIST_QUERY_SINGLETHREADED_VALIDATE, (void *) &vi, (void *) &dvs ); + + lfds700_freelist_cleanup( &fs, NULL ); + + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + { + lfds700_freelist_cleanup( &(ts+loop)->fs_thread_local, NULL ); + lfds700_freelist_cleanup( &(ts+loop+number_logical_processors)->fs_thread_local, NULL ); + util_aligned_free( (ts+loop+number_logical_processors)->fs_thread_local_te_array ); + } + + util_aligned_free( ts ); + + util_aligned_free( te_array ); + + // TRD : print the test result + internal_display_test_result( 1, "freelist", dvs ); + + return; +} + + + + + + +/****************************************************************************/ +static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_popping_and_pushing_start_popping( void *util_thread_starter_thread_state ) +{ + lfds700_pal_uint_t + count; + + struct lfds700_freelist_element + *fe; + + struct lfds700_misc_prng_state + ps; + + struct util_thread_starter_thread_state + *tsts; + + struct test_state + *ts; + + time_t + start_time; + + LFDS700_MISC_MAKE_VALID_ON_CURRENT_LOGICAL_CORE_INITS_COMPLETED_BEFORE_NOW_ON_ANY_OTHER_LOGICAL_CORE; + + assert( util_thread_starter_thread_state != NULL ); + + tsts = (struct util_thread_starter_thread_state *) util_thread_starter_thread_state; + ts = (struct test_state *) tsts->thread_user_state; + + lfds700_misc_prng_init( &ps ); + + util_thread_starter_ready_and_wait( tsts ); + + start_time = time( NULL ); + + while( time(NULL) < start_time + TEST_DURATION_IN_SECONDS ) + { + count = 0; + + while( count < ts->number_elements ) + if( lfds700_freelist_pop(ts->fs, &fe, &ps) ) + { + // TRD : we do nothing with the test data, so there'ss no GET or SET here + lfds700_freelist_push( &ts->fs_thread_local, fe, &ps ); + count++; + } + + // TRD : return our local freelist to the main freelist + while( lfds700_freelist_pop(&ts->fs_thread_local, &fe, &ps) ) + lfds700_freelist_push( ts->fs, fe, &ps ); + } + + LFDS700_MISC_BARRIER_STORE; + + lfds700_misc_force_store(); + + return( (test_pal_thread_return_t) EXIT_SUCCESS ); +} + + + + + +/****************************************************************************/ +static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_popping_and_pushing_start_pushing( void *util_thread_starter_thread_state ) +{ + lfds700_pal_uint_t + count; + + struct lfds700_freelist_element + *fe; + + struct lfds700_misc_prng_state + ps; + + struct test_state + *ts; + + struct util_thread_starter_thread_state + *tsts; + + time_t + start_time; + + LFDS700_MISC_MAKE_VALID_ON_CURRENT_LOGICAL_CORE_INITS_COMPLETED_BEFORE_NOW_ON_ANY_OTHER_LOGICAL_CORE; + + assert( util_thread_starter_thread_state != NULL ); + + tsts = (struct util_thread_starter_thread_state *) util_thread_starter_thread_state; + ts = (struct test_state *) tsts->thread_user_state; + + lfds700_misc_prng_init( &ps ); + + util_thread_starter_ready_and_wait( tsts ); + + start_time = time( NULL ); + + while( time(NULL) < start_time + TEST_DURATION_IN_SECONDS ) + { + // TRD : return our local freelist to the main freelist + while( lfds700_freelist_pop(&ts->fs_thread_local, &fe, &ps) ) + lfds700_freelist_push( ts->fs, fe, &ps ); + + count = 0; + + while( count < ts->number_elements ) + if( lfds700_freelist_pop(ts->fs, &fe, &ps) ) + { + lfds700_freelist_push( &ts->fs_thread_local, fe, &ps ); + count++; + } + } + + // TRD : now push whatever we have in our local freelist + while( lfds700_freelist_pop(&ts->fs_thread_local, &fe, &ps) ) + lfds700_freelist_push( ts->fs, fe, &ps ); + + LFDS700_MISC_BARRIER_STORE; + + lfds700_misc_force_store(); + + return( (test_pal_thread_return_t) EXIT_SUCCESS ); +} + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_freelist_pushing.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_freelist_pushing.c new file mode 100644 index 0000000000..0e756c5e2d --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_freelist_pushing.c @@ -0,0 +1,246 @@ +/***** includes *****/ +#include "internal.h" + +/***** structs *****/ +struct test_state +{ + lfds700_pal_uint_t + number_elements, + thread_number; + + struct lfds700_freelist_state + *fs; + + struct test_element + *te_array; +}; + +struct test_element +{ + struct lfds700_freelist_element + fe; + + lfds700_pal_uint_t + datum, + thread_number; +}; + +/***** private prototypes *****/ +static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_pushing( void *util_thread_starter_thread_state ); + + + + + +/****************************************************************************/ +void test_lfds700_freelist_pushing( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ) +{ + enum lfds700_misc_validity + dvs = LFDS700_MISC_VALIDITY_VALID; + + lfds700_pal_uint_t + loop, + number_elements, + number_logical_processors, + *per_thread_counters; + + struct lfds700_list_asu_element + *lasue; + + struct lfds700_freelist_element + *fe; + + struct lfds700_freelist_state + fs; + + struct lfds700_misc_prng_state + ps; + + struct lfds700_misc_validation_info + vi; + + struct test_pal_logical_processor + *lp; + + struct util_thread_starter_state + *tts; + + struct test_element + *te, + *first_te = NULL; + + struct test_state + *ts; + + test_pal_thread_state_t + *thread_handles; + + assert( list_of_logical_processors != NULL ); + // TRD : memory_in_megabytes can be any value in its range + + /* TRD : we create an empty freelist + + we then create one thread per CPU, where each thread + pushes 100,000 elements each as quickly as possible to the freelist + + the data pushed is a counter and a thread ID + + the threads exit when the freelist is full + + we then validate the freelist; + + checking that the counts increment on a per unique ID basis + and that the number of elements we pop equals 100,000 per thread + (since each element has an incrementing counter which is + unique on a per unique ID basis, we can know we didn't lose + any elements) + */ + + internal_display_test_name( "Pushing" ); + + lfds700_list_asu_query( list_of_logical_processors, LFDS700_LIST_ASU_QUERY_GET_POTENTIALLY_INACCURATE_COUNT, NULL, (void **) &number_logical_processors ); + + lfds700_misc_prng_init( &ps ); + + number_elements = ( memory_in_megabytes * ONE_MEGABYTE_IN_BYTES ) / ( sizeof(struct test_element) * number_logical_processors ); + + // TRD : the main freelist + lfds700_freelist_init_valid_on_current_logical_core( &fs, NULL ); + + ts = util_malloc_wrapper( sizeof(struct test_state) * number_logical_processors ); + + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + { + (ts+loop)->fs = &fs; + (ts+loop)->thread_number = loop; + (ts+loop)->number_elements = number_elements; + } + + thread_handles = util_malloc_wrapper( sizeof(test_pal_thread_state_t) * number_logical_processors ); + + util_thread_starter_new( &tts, number_logical_processors ); + + LFDS700_MISC_BARRIER_STORE; + + lfds700_misc_force_store(); + + loop = 0; + lasue = NULL; + + while( LFDS700_LIST_ASU_GET_START_AND_THEN_NEXT(*list_of_logical_processors, lasue) ) + { + lp = LFDS700_LIST_ASU_GET_VALUE_FROM_ELEMENT( *lasue ); + util_thread_starter_start( tts, &thread_handles[loop], loop, lp, thread_pushing, ts+loop ); + loop++; + } + + util_thread_starter_run( tts ); + + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + test_pal_thread_wait( thread_handles[loop] ); + + util_thread_starter_delete( tts ); + + free( thread_handles ); + + LFDS700_MISC_BARRIER_LOAD; + + per_thread_counters = util_malloc_wrapper( sizeof(lfds700_pal_uint_t) * number_logical_processors ); + + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + *(per_thread_counters+loop) = number_elements - 1; + + vi.min_elements = vi.max_elements = number_elements * number_logical_processors; + + lfds700_freelist_query( &fs, LFDS700_STACK_QUERY_SINGLETHREADED_VALIDATE, &vi, &dvs ); + + while( dvs == LFDS700_MISC_VALIDITY_VALID and lfds700_freelist_pop(&fs, &fe, &ps) ) + { + te = LFDS700_FREELIST_GET_VALUE_FROM_ELEMENT( *fe ); + + if( first_te == NULL ) + first_te = te; + + if( te->thread_number >= number_logical_processors ) + { + dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; + break; + } + + if( te->datum > per_thread_counters[te->thread_number] ) + dvs = LFDS700_MISC_VALIDITY_INVALID_ADDITIONAL_ELEMENTS; + + if( te->datum < per_thread_counters[te->thread_number] ) + dvs = LFDS700_MISC_VALIDITY_INVALID_MISSING_ELEMENTS; + + if( te->datum == per_thread_counters[te->thread_number] ) + per_thread_counters[te->thread_number]--; + } + + // TRD : clean up + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + util_aligned_free( (ts+loop)->te_array ); + + free( per_thread_counters ); + + free( ts ); + + lfds700_freelist_cleanup( &fs, NULL ); + + // TRD : print the test result + internal_display_test_result( 1, "freelist", dvs ); + + return; +} + + + + + +/****************************************************************************/ +static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_pushing( void *util_thread_starter_thread_state ) +{ + lfds700_pal_uint_t + loop; + + struct lfds700_misc_prng_state + ps; + + struct test_state + *ts; + + struct util_thread_starter_thread_state + *tsts; + + LFDS700_MISC_BARRIER_LOAD; + + assert( util_thread_starter_thread_state != NULL ); + + tsts = (struct util_thread_starter_thread_state *) util_thread_starter_thread_state; + ts = (struct test_state *) tsts->thread_user_state; + + lfds700_misc_prng_init( &ps ); + + ts->te_array = util_aligned_malloc( sizeof(struct test_element) * ts->number_elements, LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES ); + + for( loop = 0 ; loop < ts->number_elements ; loop++ ) + { + (ts->te_array+loop)->thread_number = ts->thread_number; + (ts->te_array+loop)->datum = loop; + } + + util_thread_starter_ready_and_wait( tsts ); + + for( loop = 0 ; loop < ts->number_elements ; loop++ ) + { + LFDS700_FREELIST_SET_VALUE_IN_ELEMENT( (ts->te_array+loop)->fe, ts->te_array+loop ); + lfds700_freelist_push( ts->fs, &(ts->te_array+loop)->fe, &ps ); + } + + LFDS700_MISC_BARRIER_STORE; + + lfds700_misc_force_store(); + + return( (test_pal_thread_return_t) EXIT_SUCCESS ); +} + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_freelist_rapid_popping_and_pushing.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_freelist_rapid_popping_and_pushing.c new file mode 100644 index 0000000000..15a0f9fd69 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_freelist_rapid_popping_and_pushing.c @@ -0,0 +1,216 @@ +/***** includes *****/ +#include "internal.h" + +/***** structs *****/ +struct test_state +{ + struct lfds700_freelist_state + *fs; +}; + +struct test_element +{ + struct lfds700_freelist_element + fe; + + lfds700_pal_uint_t + datum; +}; + +/***** private prototypes *****/ +static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_rapid_popping_and_pushing( void *util_thread_starter_thread_state ); + + + + + +/****************************************************************************/ +void test_lfds700_freelist_rapid_popping_and_pushing( struct lfds700_list_asu_state *list_of_logical_processors ) +{ + enum lfds700_misc_validity + dvs = LFDS700_MISC_VALIDITY_VALID; + + lfds700_pal_uint_t + loop, + number_logical_processors; + + struct lfds700_list_asu_element + *lasue; + + struct lfds700_freelist_state + fs; + + struct lfds700_misc_prng_state + ps; + + struct lfds700_misc_validation_info + vi = { 0, 0 }; + + struct test_pal_logical_processor + *lp; + + struct util_thread_starter_state + *tts; + + struct test_element + *te_array; + + struct test_state + *ts; + + test_pal_thread_state_t + *thread_handles; + + assert( list_of_logical_processors != NULL ); + + /* TRD : in these tests there is a fundamental antagonism between + how much checking/memory clean up that we do and the + likelyhood of collisions between threads in their lock-free + operations + + the lock-free operations are very quick; if we do anything + much at all between operations, we greatly reduce the chance + of threads colliding + + so we have some tests which do enough checking/clean up that + they can tell the freelist is valid and don't leak memory + and here, this test now is one of those which does minimal + checking - in fact, the nature of the test is that you can't + do any real checking - but goes very quickly + + what we do is create a small freelist and then run one thread + per CPU, where each thread simply pushes and then immediately + pops + + the test runs for ten seconds + + after the test is done, the only check we do is to traverse + the freelist, checking for loops and ensuring the number of + elements is correct + */ + + internal_display_test_name( "Rapid popping and pushing (10 seconds)" ); + + lfds700_list_asu_query( list_of_logical_processors, LFDS700_LIST_ASU_QUERY_GET_POTENTIALLY_INACCURATE_COUNT, NULL, (void **) &number_logical_processors ); + + lfds700_misc_prng_init( &ps ); + + lfds700_freelist_init_valid_on_current_logical_core( &fs, NULL ); + + ts = util_malloc_wrapper( sizeof(struct test_state) * number_logical_processors ); + + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + (ts+loop)->fs = &fs; + + thread_handles = util_malloc_wrapper( sizeof(test_pal_thread_state_t) * number_logical_processors ); + + // TRD : we need one element per thread + te_array = util_aligned_malloc( sizeof(struct test_element) * number_logical_processors, LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES ); + + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + { + LFDS700_FREELIST_SET_VALUE_IN_ELEMENT( (te_array+loop)->fe, te_array+loop ); + lfds700_freelist_push( &fs, &(te_array+loop)->fe, &ps ); + } + + util_thread_starter_new( &tts, number_logical_processors ); + + LFDS700_MISC_BARRIER_STORE; + + lfds700_misc_force_store(); + + loop = 0; + lasue = NULL; + + while( LFDS700_LIST_ASU_GET_START_AND_THEN_NEXT(*list_of_logical_processors, lasue) ) + { + lp = LFDS700_LIST_ASU_GET_VALUE_FROM_ELEMENT( *lasue ); + util_thread_starter_start( tts, &thread_handles[loop], loop, lp, thread_rapid_popping_and_pushing, ts+loop ); + loop++; + } + + util_thread_starter_run( tts ); + + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + test_pal_thread_wait( thread_handles[loop] ); + + util_thread_starter_delete( tts ); + + free( thread_handles ); + + LFDS700_MISC_BARRIER_LOAD; + + vi.min_elements = vi.max_elements = number_logical_processors; + + lfds700_freelist_query( &fs, LFDS700_STACK_QUERY_SINGLETHREADED_VALIDATE, &vi, &dvs ); + + lfds700_freelist_cleanup( &fs, NULL ); + + util_aligned_free( te_array ); + + free( ts ); + + // TRD : print the test result + internal_display_test_result( 1, "freelist", dvs ); + + return; +} + + + + + +/****************************************************************************/ +static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_rapid_popping_and_pushing( void *util_thread_starter_thread_state ) +{ + lfds700_pal_uint_t + time_loop = 0; + + struct lfds700_freelist_element + *fe; + + struct lfds700_misc_prng_state + ps; + + struct test_state + *ts; + + struct util_thread_starter_thread_state + *tsts; + + time_t + current_time, + start_time; + + LFDS700_MISC_MAKE_VALID_ON_CURRENT_LOGICAL_CORE_INITS_COMPLETED_BEFORE_NOW_ON_ANY_OTHER_LOGICAL_CORE; + + assert( util_thread_starter_thread_state != NULL ); + + tsts = (struct util_thread_starter_thread_state *) util_thread_starter_thread_state; + ts = (struct test_state *) tsts->thread_user_state; + + lfds700_misc_prng_init( &ps ); + + util_thread_starter_ready_and_wait( tsts ); + + current_time = start_time = time( NULL ); + + while( current_time < start_time + TEST_DURATION_IN_SECONDS ) + { + lfds700_freelist_pop( ts->fs, &fe, &ps ); + lfds700_freelist_push( ts->fs, fe, &ps ); + + if( time_loop++ == TIME_LOOP_COUNT ) + { + time_loop = 0; + time( ¤t_time ); + } + } + + LFDS700_MISC_BARRIER_STORE; + + lfds700_misc_force_store(); + + return( (test_pal_thread_return_t) EXIT_SUCCESS ); +} + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_hash_addonly.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_hash_addonly.c new file mode 100644 index 0000000000..eeb98727c5 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_hash_addonly.c @@ -0,0 +1,33 @@ +/***** includes *****/ +#include "internal.h" + + + + + +/****************************************************************************/ +#pragma warning( disable : 4127 ) // TRD : disables MSVC warning for condition expressions being const + +void test_lfds700_hash_a( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ) +{ + assert( list_of_logical_processors != NULL ); + // TRD : memory_in_megabytes can be any value in its range + + if( LFDS700_MISC_ATOMIC_SUPPORT_CAS ) + { + printf( "\n" + "Hash (add-only) Tests\n" + "=====================\n" ); + + test_lfds700_hash_a_alignment(); + test_lfds700_hash_a_fail_and_overwrite_on_existing_key(); + test_lfds700_hash_a_random_adds_fail_on_existing( list_of_logical_processors, memory_in_megabytes ); + test_lfds700_hash_a_random_adds_overwrite_on_existing( list_of_logical_processors, memory_in_megabytes ); + test_lfds700_hash_a_iterate(); + } + + return; +} + +#pragma warning( default : 4127 ) + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_hash_addonly_alignment.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_hash_addonly_alignment.c new file mode 100644 index 0000000000..2d0a0a5b8e --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_hash_addonly_alignment.c @@ -0,0 +1,40 @@ +/***** includes *****/ +#include "internal.h" + + + + + +/****************************************************************************/ +#pragma warning( disable : 4127 ) // TRD : disables MSVC warning for condition expressions being const + +void test_lfds700_hash_a_alignment() +{ + enum lfds700_misc_validity + dvs = LFDS700_MISC_VALIDITY_VALID; + + /* TRD : these are compile time checks + but we do them here because this is a test programme + and it should indicate issues to users when it is *run*, + not when it is compiled, because a compile error normally + indicates a problem with the code itself and so is misleading + */ + + internal_display_test_name( "Alignment" ); + + + + // TRD : struct lfds700_hash_a_element + if( offsetof(struct lfds700_hash_a_element,value) % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES != 0 ) + dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; + + + + // TRD : print the test result + internal_display_test_result( 1, "freelist", dvs ); + + return; +} + +#pragma warning( default : 4127 ) + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_hash_addonly_iterate.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_hash_addonly_iterate.c new file mode 100644 index 0000000000..cf4899e31b --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_hash_addonly_iterate.c @@ -0,0 +1,224 @@ +/***** includes *****/ +#include "internal.h" + +/***** structs *****/ +struct test_element +{ + struct lfds700_btree_au_element + baue; + + lfds700_pal_uint_t + datum; +}; + +struct test_state +{ + enum lfds700_misc_flag + error_flag; + + struct lfds700_hash_a_state + *has; + + struct test_element + *element_array; +}; + +/***** private prototypes *****/ +static int key_compare_function( void const *new_key, void const *existing_key ); +static void key_hash_function( void const *key, lfds700_pal_uint_t *hash ); + + + + + +/****************************************************************************/ +void test_lfds700_hash_a_iterate( void ) +{ + enum lfds700_misc_validity + dvs = LFDS700_MISC_VALIDITY_VALID; + + lfds700_pal_uint_t + *counter_array, + loop; + + struct lfds700_hash_a_element + *hae; + + struct lfds700_hash_a_iterate + hai; + + struct lfds700_hash_a_state + has; + + struct lfds700_hash_a_element + *element_array; + + struct lfds700_btree_au_state + *baus; + + struct lfds700_misc_prng_state + ps; + + void + *value; + + /* TRD : single-threaded test + we create a single hash_a + we populate with 1000 elements + where key and value is the number of the element (e.g. 0 to 999) + we then allocate 1000 counters, init to 0 + we then iterate + we increment each element as we see it in the iterate + if any are missing or seen more than once, problemo! + + we do this once with a table of 10, to ensure each table has (or almost certainly has) something in + and then a second tiem with a table of 10000, to ensure some empty tables exist + */ + + internal_display_test_name( "Iterate" ); + + lfds700_misc_prng_init( &ps ); + + element_array = util_aligned_malloc( sizeof(struct lfds700_hash_a_element) * 1000, LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES ); + + counter_array = util_malloc_wrapper( sizeof(lfds700_pal_uint_t) * 1000 ); + + // TRD : first time around + baus = util_aligned_malloc( sizeof(struct lfds700_btree_au_state) * 10, LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES ); + + lfds700_hash_a_init_valid_on_current_logical_core( &has, baus, 10, key_compare_function, key_hash_function, LFDS700_HASH_A_EXISTING_KEY_FAIL, NULL ); + + for( loop = 0 ; loop < 1000 ; loop++ ) + { + LFDS700_HASH_A_SET_KEY_IN_ELEMENT( *(element_array+loop), loop ); + LFDS700_HASH_A_SET_VALUE_IN_ELEMENT( *(element_array+loop), loop ); + lfds700_hash_a_insert( &has, element_array+loop, NULL, &ps ); + } + + for( loop = 0 ; loop < 1000 ; loop++ ) + *(counter_array+loop) = 0; + + lfds700_hash_a_iterate_init( &has, &hai ); + + while( dvs == LFDS700_MISC_VALIDITY_VALID and lfds700_hash_a_iterate(&hai, &hae) ) + { + value = LFDS700_HASH_A_GET_VALUE_FROM_ELEMENT( *hae ); + ( *(counter_array + (lfds700_pal_uint_t) value) )++; + } + + if( dvs == LFDS700_MISC_VALIDITY_VALID ) + for( loop = 0 ; loop < 1000 ; loop++ ) + { + if( *(counter_array+loop) > 1 ) + dvs = LFDS700_MISC_VALIDITY_INVALID_ADDITIONAL_ELEMENTS; + + if( *(counter_array+loop) == 0 ) + dvs = LFDS700_MISC_VALIDITY_INVALID_MISSING_ELEMENTS; + } + + lfds700_hash_a_cleanup( &has, NULL ); + + util_aligned_free( baus ); + + // TRD : second time around + if( dvs == LFDS700_MISC_VALIDITY_VALID ) + { + baus = util_aligned_malloc( sizeof(struct lfds700_btree_au_state) * 10000, LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES ); + + lfds700_hash_a_init_valid_on_current_logical_core( &has, baus, 10000, key_compare_function, key_hash_function, LFDS700_HASH_A_EXISTING_KEY_FAIL, NULL ); + + for( loop = 0 ; loop < 1000 ; loop++ ) + { + LFDS700_HASH_A_SET_KEY_IN_ELEMENT( *(element_array+loop), loop ); + LFDS700_HASH_A_SET_VALUE_IN_ELEMENT( *(element_array+loop), loop ); + lfds700_hash_a_insert( &has, element_array+loop, NULL, &ps ); + } + + for( loop = 0 ; loop < 1000 ; loop++ ) + *(counter_array+loop) = 0; + + lfds700_hash_a_iterate_init( &has, &hai ); + + while( dvs == LFDS700_MISC_VALIDITY_VALID and lfds700_hash_a_iterate(&hai, &hae) ) + { + value = LFDS700_HASH_A_GET_VALUE_FROM_ELEMENT( *hae ); + ( *(counter_array + (lfds700_pal_uint_t) value ) )++; + } + + if( dvs == LFDS700_MISC_VALIDITY_VALID ) + for( loop = 0 ; loop < 1000 ; loop++ ) + { + if( *(counter_array+loop) > 1 ) + dvs = LFDS700_MISC_VALIDITY_INVALID_ADDITIONAL_ELEMENTS; + + if( *(counter_array+loop) == 0 ) + dvs = LFDS700_MISC_VALIDITY_INVALID_MISSING_ELEMENTS; + } + + lfds700_hash_a_cleanup( &has, NULL ); + + util_aligned_free( baus ); + } + + // TRD : cleanup + util_aligned_free( element_array ); + free( counter_array ); + + // TRD : print the test result + internal_display_test_result( 1, "hash_a", dvs ); + + return; +} + + + + + +/****************************************************************************/ +#pragma warning( disable : 4100 ) + +static int key_compare_function( void const *new_key, void const *existing_key ) +{ + int + cr = 0; + + // TRD : new_key can be NULL (i.e. 0) + // TRD : existing_key can be NULL (i.e. 0) + + if( (lfds700_pal_uint_t) new_key < (lfds700_pal_uint_t) existing_key ) + cr = -1; + + if( (lfds700_pal_uint_t) new_key > (lfds700_pal_uint_t) existing_key ) + cr = 1; + + return( cr ); +} + +#pragma warning( default : 4100 ) + + + + + +/****************************************************************************/ +#pragma warning( disable : 4100 ) + +static void key_hash_function( void const *key, lfds700_pal_uint_t *hash ) +{ + // TRD : key can be NULL + assert( hash != NULL ); + + *hash = 0; + + /* TRD : this function iterates over the user data + and we are using the void pointer AS user data + so here we need to pass in the addy of value + */ + + LFDS700_HASH_A_32BIT_HASH_FUNCTION( (void *) &key, sizeof(lfds700_pal_uint_t), *hash ); + + return; +} + +#pragma warning( default : 4100 ) + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_hash_addonly_random_adds_fail.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_hash_addonly_random_adds_fail.c new file mode 100644 index 0000000000..5d36e47a31 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_hash_addonly_random_adds_fail.c @@ -0,0 +1,314 @@ +/***** includes *****/ +#include "internal.h" + +/***** structs *****/ +struct test_element +{ + struct lfds700_hash_a_element + hae; + + lfds700_pal_uint_t + datum, + key; +}; + +struct test_state +{ + enum flag + error_flag; + + lfds700_pal_uint_t + number_elements_per_thread; + + struct lfds700_hash_a_state + *has; + + struct test_element + *element_array; +}; + +/***** private prototypes *****/ +static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_adding( void *util_thread_starter_thread_state ); +static int key_compare_function( void const *new_key, void const *existing_key ); +static void key_hash_function( void const *key, lfds700_pal_uint_t *hash ); + + + + + +/****************************************************************************/ +void test_lfds700_hash_a_random_adds_fail_on_existing( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ) +{ + enum lfds700_misc_validity + dvs = LFDS700_MISC_VALIDITY_VALID; + + lfds700_pal_uint_t + loop, + number_elements_per_thread, + number_elements_total, + number_logical_processors, + offset, + temp, + value; + + struct lfds700_hash_a_element + *hae; + + struct lfds700_hash_a_state + has; + + struct lfds700_list_asu_element + *lasue = NULL; + + struct lfds700_btree_au_state + *baus; + + struct lfds700_misc_prng_state + ps; + + struct lfds700_misc_validation_info + vi; + + struct test_pal_logical_processor + *lp; + + struct util_thread_starter_state + *tts; + + struct test_element + *element_array; + + struct test_state + *ts; + + test_pal_thread_state_t + *thread_handles; + + assert( list_of_logical_processors != NULL ); + // TRD : memory_in_megabytes can be any value in its range + + /* TRD : we create a single hash_a + we generate 100k elements per thread (with one thread per logical processor) in an array + each element is unique + we randomly sort the elements + then each thread loops, adds those elements into the hash_a + we check that each datum inserts okay - failure will occur on non-unique data, i.e. two identical keys + we should have no failures + we then call the hash_a validation function + then using the hash_a get() we check all the elements we added are present + */ + + internal_display_test_name( "Random adds and get (fail on existing key)" ); + + lfds700_misc_prng_init( &ps ); + + lfds700_list_asu_query( list_of_logical_processors, LFDS700_LIST_ASU_QUERY_GET_POTENTIALLY_INACCURATE_COUNT, NULL, (void **) &number_logical_processors ); + + baus = util_aligned_malloc( sizeof(struct lfds700_btree_au_state) * 1000, LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES ); + + lfds700_hash_a_init_valid_on_current_logical_core( &has, baus, 1000, key_compare_function, key_hash_function, LFDS700_HASH_A_EXISTING_KEY_FAIL, NULL ); + + number_elements_per_thread = ( memory_in_megabytes * ONE_MEGABYTE_IN_BYTES ) / ( sizeof(struct test_element) * number_logical_processors ); + number_elements_total = number_elements_per_thread * number_logical_processors; + + // TRD : created an ordered list of unique numbers + element_array = util_aligned_malloc( sizeof(struct test_element) * number_elements_total, LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES ); + + for( loop = 0 ; loop < number_elements_total ; loop++ ) + { + (element_array+loop)->key = loop; + // TRD : + number_elements just to make it different to the key + (element_array+loop)->datum = loop + number_elements_total; + } + + for( loop = 0 ; loop < number_elements_total ; loop++ ) + { + offset = LFDS700_MISC_PRNG_GENERATE( &ps ); + offset %= number_elements_total; + temp = (element_array + offset)->key; + (element_array + offset)->key = (element_array + loop)->key; + (element_array + loop)->key = temp; + } + + ts = util_malloc_wrapper( sizeof(struct test_state) * number_logical_processors ); + + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + { + (ts+loop)->has = &has; + (ts+loop)->element_array = element_array + number_elements_per_thread*loop; + (ts+loop)->error_flag = LOWERED; + (ts+loop)->number_elements_per_thread = number_elements_per_thread; + } + + thread_handles = util_malloc_wrapper( sizeof(test_pal_thread_state_t) * number_logical_processors ); + + util_thread_starter_new( &tts, number_logical_processors ); + + LFDS700_MISC_BARRIER_STORE; + + lfds700_misc_force_store(); + + loop = 0; + + while( LFDS700_LIST_ASU_GET_START_AND_THEN_NEXT(*list_of_logical_processors, lasue) ) + { + lp = LFDS700_LIST_ASU_GET_VALUE_FROM_ELEMENT( *lasue ); + util_thread_starter_start( tts, &thread_handles[loop], loop, lp, thread_adding, ts+loop ); + loop++; + } + + util_thread_starter_run( tts ); + + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + test_pal_thread_wait( thread_handles[loop] ); + + util_thread_starter_delete( tts ); + + free( thread_handles ); + + LFDS700_MISC_BARRIER_LOAD; + + // TRD : now for validation + vi.min_elements = vi.max_elements = number_elements_total; + lfds700_hash_a_query( &has, LFDS700_HASH_A_QUERY_SINGLETHREADED_VALIDATE, (void *) &vi, (void *) &dvs ); + + /* TRD : now we attempt to lfds700_hash_a_get_by_key() for every element in number_array + any failure to find is an error + we also check we've obtained the correct element + */ + + for( loop = 0 ; dvs == LFDS700_MISC_VALIDITY_VALID and loop < number_elements_total ; loop++ ) + if( 0 == lfds700_hash_a_get_by_key(&has, (void *) (ts->element_array+loop)->key, &hae) ) + dvs = LFDS700_MISC_VALIDITY_INVALID_MISSING_ELEMENTS; + else + { + value = (lfds700_pal_uint_t) LFDS700_HASH_A_GET_VALUE_FROM_ELEMENT( *hae ); + if( (ts->element_array+loop)->datum != value ) + dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; + } + + // TRD : just check error_flags weren't raised + if( dvs == LFDS700_MISC_VALIDITY_VALID ) + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + if( (ts+loop)->error_flag == RAISED ) + dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; + + // TRD : cleanup + lfds700_hash_a_cleanup( &has, NULL ); + + util_aligned_free( baus ); + + free( ts ); + + util_aligned_free( element_array ); + + // TRD : print the test result + internal_display_test_result( 1, "hash_a", dvs ); + + return; +} + + + + + +/****************************************************************************/ +static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_adding( void *util_thread_starter_thread_state ) +{ + enum lfds700_hash_a_insert_result + apr; + + lfds700_pal_uint_t + index = 0; + + struct test_state + *ts; + + struct lfds700_misc_prng_state + ps; + + struct util_thread_starter_thread_state + *tsts; + + LFDS700_MISC_MAKE_VALID_ON_CURRENT_LOGICAL_CORE_INITS_COMPLETED_BEFORE_NOW_ON_ANY_OTHER_LOGICAL_CORE; + + assert( util_thread_starter_thread_state != NULL ); + + tsts = (struct util_thread_starter_thread_state *) util_thread_starter_thread_state; + ts = (struct test_state *) tsts->thread_user_state; + + lfds700_misc_prng_init( &ps ); + + util_thread_starter_ready_and_wait( tsts ); + + while( index < ts->number_elements_per_thread ) + { + LFDS700_HASH_A_SET_KEY_IN_ELEMENT( (ts->element_array+index)->hae, (ts->element_array+index)->key ); + LFDS700_HASH_A_SET_VALUE_IN_ELEMENT( (ts->element_array+index)->hae, (ts->element_array+index)->datum ); + apr = lfds700_hash_a_insert( ts->has, &(ts->element_array+index)->hae, NULL, &ps ); + + if( apr == LFDS700_HASH_A_PUT_RESULT_FAILURE_EXISTING_KEY ) + ts->error_flag = RAISED; + + index++; + } + + LFDS700_MISC_BARRIER_STORE; + + lfds700_misc_force_store(); + + return( (test_pal_thread_return_t) EXIT_SUCCESS ); +} + + + + + +/****************************************************************************/ +#pragma warning( disable : 4100 ) + +static int key_compare_function( void const *new_key, void const *existing_key ) +{ + int + cr = 0; + + // TRD : new_key can be NULL (i.e. 0) + // TRD : existing_key can be NULL (i.e. 0) + + if( (lfds700_pal_uint_t) new_key < (lfds700_pal_uint_t) existing_key ) + cr = -1; + + if( (lfds700_pal_uint_t) new_key > (lfds700_pal_uint_t) existing_key ) + cr = 1; + + return( cr ); +} + +#pragma warning( default : 4100 ) + + + + + +/****************************************************************************/ +#pragma warning( disable : 4100 ) + +static void key_hash_function( void const *key, lfds700_pal_uint_t *hash ) +{ + // TRD : key can be NULL + assert( hash != NULL ); + + *hash = 0; + + /* TRD : this function iterates over the user data + and we are using the void pointer *as* key data + so here we need to pass in the addy of key + */ + + LFDS700_HASH_A_32BIT_HASH_FUNCTION( (void *) &key, sizeof(lfds700_pal_uint_t), *hash ); + + return; +} + +#pragma warning( default : 4100 ) + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_hash_addonly_random_adds_fail_and_overwrite.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_hash_addonly_random_adds_fail_and_overwrite.c new file mode 100644 index 0000000000..cc18900273 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_hash_addonly_random_adds_fail_and_overwrite.c @@ -0,0 +1,137 @@ +/***** includes *****/ +#include "internal.h" + +/***** private prototypes *****/ +static int key_compare_function( void const *new_value, void const *value_in_tree ); +static void key_hash_function( void const *key, lfds700_pal_uint_t *hash ); + + + + + +/****************************************************************************/ +void test_lfds700_hash_a_fail_and_overwrite_on_existing_key() +{ + enum lfds700_hash_a_insert_result + apr; + + enum lfds700_misc_validity + dvs = LFDS700_MISC_VALIDITY_VALID; + + struct lfds700_hash_a_element + hae_one, + hae_two; + + struct lfds700_hash_a_state + has; + + struct lfds700_btree_au_state + *baus; + + struct lfds700_misc_prng_state + ps; + + internal_display_test_name( "Fail and overwrite on existing key" ); + + lfds700_misc_prng_init( &ps ); + + baus = util_aligned_malloc( sizeof(struct lfds700_btree_au_state) * 10, LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES ); + + // TRD : fail on overwrite + lfds700_hash_a_init_valid_on_current_logical_core( &has, baus, 10, key_compare_function, key_hash_function, LFDS700_HASH_A_EXISTING_KEY_FAIL, NULL ); + + LFDS700_HASH_A_SET_KEY_IN_ELEMENT( hae_one, 1 ); + LFDS700_HASH_A_SET_VALUE_IN_ELEMENT( hae_one, 0 ); + apr = lfds700_hash_a_insert( &has, &hae_one, NULL, &ps ); + + if( apr != LFDS700_HASH_A_PUT_RESULT_SUCCESS ) + dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; + + LFDS700_HASH_A_SET_KEY_IN_ELEMENT( hae_two, 1 ); + LFDS700_HASH_A_SET_VALUE_IN_ELEMENT( hae_two, 1 ); + apr = lfds700_hash_a_insert( &has, &hae_two, NULL, &ps ); + + if( apr != LFDS700_HASH_A_PUT_RESULT_FAILURE_EXISTING_KEY ) + dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; + + lfds700_hash_a_cleanup( &has, NULL ); + + // TRD : success on overwrite + lfds700_hash_a_init_valid_on_current_logical_core( &has, baus, 10, key_compare_function, key_hash_function, LFDS700_HASH_A_EXISTING_KEY_OVERWRITE, NULL ); + + LFDS700_HASH_A_SET_KEY_IN_ELEMENT( hae_one, 1 ); + LFDS700_HASH_A_SET_VALUE_IN_ELEMENT( hae_one, 1 ); + apr = lfds700_hash_a_insert( &has, &hae_one, NULL, &ps ); + + if( apr != LFDS700_HASH_A_PUT_RESULT_SUCCESS ) + dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; + + LFDS700_HASH_A_SET_KEY_IN_ELEMENT( hae_two, 1 ); + LFDS700_HASH_A_SET_VALUE_IN_ELEMENT( hae_two, 1 ); + apr = lfds700_hash_a_insert( &has, &hae_two, NULL, &ps ); + + if( apr != LFDS700_HASH_A_PUT_RESULT_SUCCESS_OVERWRITE ) + dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; + + lfds700_hash_a_cleanup( &has, NULL ); + + util_aligned_free( baus ); + + // TRD : print the test result + internal_display_test_result( 1, "hash_a", dvs ); + + return; +} + + + + + +/****************************************************************************/ +#pragma warning( disable : 4100 ) + +static int key_compare_function( void const *new_key, void const *key_in_tree ) +{ + int + cr = 0; + + // TRD : key_new can be any value in its range + // TRD : key_in_tree can be any value in its range + + if( (lfds700_pal_uint_t) new_key < (lfds700_pal_uint_t) key_in_tree ) + cr = -1; + + if( (lfds700_pal_uint_t) new_key > (lfds700_pal_uint_t) key_in_tree ) + cr = 1; + + return( cr ); +} + +#pragma warning( default : 4100 ) + + + + + +/****************************************************************************/ +#pragma warning( disable : 4100 ) + +static void key_hash_function( void const *key, lfds700_pal_uint_t *hash ) +{ + // TRD : key can be NULL + assert( hash != NULL ); + + *hash = 0; + + /* TRD : this function iterates over the user data + and we are using the void pointer *as* key data + so here we need to pass in the addy of key + */ + + LFDS700_HASH_A_32BIT_HASH_FUNCTION( (void *) &key, sizeof(lfds700_pal_uint_t), *hash ); + + return; +} + +#pragma warning( default : 4100 ) + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_hash_addonly_random_adds_overwrite.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_hash_addonly_random_adds_overwrite.c new file mode 100644 index 0000000000..29c5fae865 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_hash_addonly_random_adds_overwrite.c @@ -0,0 +1,388 @@ +/***** includes *****/ +#include "internal.h" + +/***** structs *****/ +struct test_element +{ + struct lfds700_hash_a_element + hae; + + lfds700_pal_uint_t + key; +}; + +struct test_state +{ + lfds700_pal_uint_t + number_elements_per_thread, + overwrite_count; + + struct lfds700_hash_a_state + *has; + + struct test_element + *element_array; +}; + +/***** private prototypes *****/ +static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_adding( void *util_thread_starter_thread_state ); +static int key_compare_function( void const *new_key, void const *existing_key ); +static void key_hash_function( void const *key, lfds700_pal_uint_t *hash ); +static int qsort_and_bsearch_key_compare_function( void const *e1, void const *e2 ); + + + + + +/****************************************************************************/ +void test_lfds700_hash_a_random_adds_overwrite_on_existing( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ) +{ + enum lfds700_misc_validity + dvs = LFDS700_MISC_VALIDITY_VALID; + + int + rv; + + lfds700_pal_uint_t + actual_sum_overwrite_existing_count, + expected_sum_overwrite_existing_count, + *key_count_array, + loop, + number_elements_per_thread, + number_elements_total, + number_logical_processors, + random_value; + + struct lfds700_hash_a_iterate + hai; + + struct lfds700_hash_a_element + *hae; + + struct lfds700_hash_a_state + has; + + struct lfds700_list_asu_element + *lasue = NULL; + + struct lfds700_btree_au_state + *baus; + + struct lfds700_misc_prng_state + ps; + + struct lfds700_misc_validation_info + vi; + + struct test_pal_logical_processor + *lp; + + struct util_thread_starter_state + *tts; + + struct test_element + *element_array; + + struct test_state + *ts; + + test_pal_thread_state_t + *thread_handles; + + void + *key_pointer, + *key; + + assert( list_of_logical_processors != NULL ); + // TRD : memory_in_megabytes can be any value in its range + + /* TRD : we create a single hash_a + we generate n elements per thread + each element contains a key value, which is set to a random value + (we don't use value, so it's just set to 0) + the threads then run, putting + the threads count their number of overwrite hits + once the threads are done, then we + count the number of each key + from this we figure out the min/max element for hash_a validation, so we call validation + we check the sum of overwrites for each thread is what it should be + then using the hash_a get() we check all the elements we expect are present + and then we iterate over the hash_a + checking we see each key once + */ + + internal_display_test_name( "Random adds, get and iterate (overwrite on existing key)" ); + + lfds700_misc_prng_init( &ps ); + + lfds700_list_asu_query( list_of_logical_processors, LFDS700_LIST_ASU_QUERY_GET_POTENTIALLY_INACCURATE_COUNT, NULL, (void **) &number_logical_processors ); + + baus = util_aligned_malloc( sizeof(struct lfds700_btree_au_state) * 1000, LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES ); + + lfds700_hash_a_init_valid_on_current_logical_core( &has, baus, 1000, key_compare_function, key_hash_function, LFDS700_HASH_A_EXISTING_KEY_OVERWRITE, NULL ); + + // TRD : we divide by 2 beccause we have to allocate a second array of this size later + number_elements_per_thread = ( memory_in_megabytes * ONE_MEGABYTE_IN_BYTES ) / ( sizeof(struct test_element) * number_logical_processors ) / 2; + number_elements_total = number_elements_per_thread * number_logical_processors; + + // TRD : created an ordered list of unique numbers + element_array = util_aligned_malloc( sizeof(struct test_element) * number_elements_total, LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES ); + + for( loop = 0 ; loop < number_elements_total ; loop++ ) + { + random_value = LFDS700_MISC_PRNG_GENERATE( &ps ); + (element_array+loop)->key = (lfds700_pal_uint_t) floor( (number_elements_total/2) * ((double) random_value / (double) LFDS700_MISC_PRNG_MAX) ); + } + + ts = util_malloc_wrapper( sizeof(struct test_state) * number_logical_processors ); + + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + { + (ts+loop)->has = &has; + (ts+loop)->element_array = element_array + number_elements_per_thread*loop; + (ts+loop)->overwrite_count = 0; + (ts+loop)->number_elements_per_thread = number_elements_per_thread; + } + + thread_handles = util_malloc_wrapper( sizeof(test_pal_thread_state_t) * number_logical_processors ); + + util_thread_starter_new( &tts, number_logical_processors ); + + LFDS700_MISC_BARRIER_STORE; + + lfds700_misc_force_store(); + + loop = 0; + + while( LFDS700_LIST_ASU_GET_START_AND_THEN_NEXT(*list_of_logical_processors, lasue) ) + { + lp = LFDS700_LIST_ASU_GET_VALUE_FROM_ELEMENT( *lasue ); + util_thread_starter_start( tts, &thread_handles[loop], loop, lp, thread_adding, ts+loop ); + loop++; + } + + util_thread_starter_run( tts ); + + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + test_pal_thread_wait( thread_handles[loop] ); + + util_thread_starter_delete( tts ); + + free( thread_handles ); + + LFDS700_MISC_BARRIER_LOAD; + + // TRD : now for validation + key_count_array = util_malloc_wrapper( sizeof(lfds700_pal_uint_t) * number_elements_total ); + for( loop = 0 ; loop < number_elements_total ; loop++ ) + *(key_count_array+loop) = 0; + + for( loop = 0 ; loop < number_elements_total ; loop++ ) + ( *(key_count_array + (element_array+loop)->key) )++; + + vi.min_elements = number_elements_total; + + for( loop = 0 ; loop < number_elements_total ; loop++ ) + if( *(key_count_array+loop) == 0 ) + vi.min_elements--; + + vi.max_elements = vi.min_elements; + + lfds700_hash_a_query( &has, LFDS700_HASH_A_QUERY_SINGLETHREADED_VALIDATE, (void *) &vi, (void *) &dvs ); + + expected_sum_overwrite_existing_count = 0; + + for( loop = 0 ; loop < number_elements_total ; loop++ ) + if( *(key_count_array+loop) != 0 ) + expected_sum_overwrite_existing_count += *(key_count_array+loop) - 1; + + actual_sum_overwrite_existing_count = 0; + + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + actual_sum_overwrite_existing_count += (ts+loop)->overwrite_count; + + if( expected_sum_overwrite_existing_count != actual_sum_overwrite_existing_count ) + dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; + + // TRD : now loop over the expected array and check we can get() every element + for( loop = 0 ; loop < number_elements_total ; loop++ ) + if( *(key_count_array+loop) > 0 ) + { + rv = lfds700_hash_a_get_by_key( &has, (void *) loop, &hae ); + + if( rv != 1 ) + dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; + } + + /* TRD : now iterate, checking we find every element and no others + to do this in a timely manner, we need to qsort() the key values + and use bsearch() to check for items in the array + */ + + for( loop = 0 ; loop < number_elements_total ; loop++ ) + if( *(key_count_array+loop) != 0 ) + *(key_count_array+loop) = loop; + else + *(key_count_array+loop) = 0; + + qsort( key_count_array, number_elements_total, sizeof(lfds700_pal_uint_t), qsort_and_bsearch_key_compare_function ); + + lfds700_hash_a_iterate_init( &has, &hai ); + + while( dvs == LFDS700_MISC_VALIDITY_VALID and lfds700_hash_a_iterate(&hai, &hae) ) + { + key = LFDS700_HASH_A_GET_KEY_FROM_ELEMENT( *hae ); + + key_pointer = bsearch( &key, key_count_array, number_elements_total, sizeof(lfds700_pal_uint_t), qsort_and_bsearch_key_compare_function ); + + if( key_pointer == NULL ) + dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; + } + + // TRD : cleanup + lfds700_hash_a_cleanup( &has, NULL ); + + util_aligned_free( baus ); + + free( ts ); + + util_aligned_free( element_array ); + + free( key_count_array ); + + // TRD : print the test result + internal_display_test_result( 1, "hash_a", dvs ); + + return; +} + + + + + +/****************************************************************************/ +static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_adding( void *util_thread_starter_thread_state ) +{ + enum lfds700_hash_a_insert_result + apr; + + lfds700_pal_uint_t + index = 0; + + struct test_state + *ts; + + struct lfds700_misc_prng_state + ps; + + struct util_thread_starter_thread_state + *tsts; + + LFDS700_MISC_MAKE_VALID_ON_CURRENT_LOGICAL_CORE_INITS_COMPLETED_BEFORE_NOW_ON_ANY_OTHER_LOGICAL_CORE; + + assert( util_thread_starter_thread_state != NULL ); + + tsts = (struct util_thread_starter_thread_state *) util_thread_starter_thread_state; + ts = (struct test_state *) tsts->thread_user_state; + + lfds700_misc_prng_init( &ps ); + + util_thread_starter_ready_and_wait( tsts ); + + while( index < ts->number_elements_per_thread ) + { + LFDS700_HASH_A_SET_KEY_IN_ELEMENT( (ts->element_array+index)->hae, (ts->element_array+index)->key ); + LFDS700_HASH_A_SET_VALUE_IN_ELEMENT( (ts->element_array+index)->hae, 0 ); + apr = lfds700_hash_a_insert( ts->has, &(ts->element_array+index)->hae, NULL, &ps ); + + if( apr == LFDS700_HASH_A_PUT_RESULT_SUCCESS_OVERWRITE ) + ts->overwrite_count++; + + index++; + } + + LFDS700_MISC_BARRIER_STORE; + + lfds700_misc_force_store(); + + return( (test_pal_thread_return_t) EXIT_SUCCESS ); +} + + + + + +/****************************************************************************/ +#pragma warning( disable : 4100 ) + +static int key_compare_function( void const *new_key, void const *existing_key ) +{ + int + cr = 0; + + // TRD : new_key can be NULL (i.e. 0) + // TRD : existing_key can be NULL (i.e. 0) + + if( (lfds700_pal_uint_t) new_key < (lfds700_pal_uint_t) existing_key ) + cr = -1; + + if( (lfds700_pal_uint_t) new_key > (lfds700_pal_uint_t) existing_key ) + cr = 1; + + return( cr ); +} + +#pragma warning( default : 4100 ) + + + + + +/****************************************************************************/ +#pragma warning( disable : 4100 ) + +static void key_hash_function( void const *key, lfds700_pal_uint_t *hash ) +{ + // TRD : key can be NULL + assert( hash != NULL ); + + *hash = 0; + + /* TRD : this function iterates over the user data + and we are using the void pointer *as* key data + so here we need to pass in the addy of key + */ + + LFDS700_HASH_A_32BIT_HASH_FUNCTION( (void *) &key, sizeof(lfds700_pal_uint_t), *hash ); + + return; +} + +#pragma warning( default : 4100 ) + + + + + +/****************************************************************************/ +static int qsort_and_bsearch_key_compare_function( void const *e1, void const *e2 ) +{ + int + cr = 0; + + lfds700_pal_uint_t + s1, + s2; + + s1 = *(lfds700_pal_uint_t *) e1; + s2 = *(lfds700_pal_uint_t *) e2; + + if( s1 > s2 ) + cr = 1; + + if( s1 < s2 ) + cr = -1; + + return( cr ); +} + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_list_addonly_ordered_singlylinked.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_list_addonly_ordered_singlylinked.c new file mode 100644 index 0000000000..5720aa2428 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_list_addonly_ordered_singlylinked.c @@ -0,0 +1,31 @@ +/***** includes *****/ +#include "internal.h" + + + + + +/****************************************************************************/ +#pragma warning( disable : 4127 ) // TRD : disables MSVC warning for condition expressions being const + +void test_lfds700_list_aos( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ) +{ + assert( list_of_logical_processors != NULL ); + // TRD : memory_in_megabytes can be any value in its range + + if( LFDS700_MISC_ATOMIC_SUPPORT_CAS ) + { + printf( "\n" + "List (add-only, ordered, singly-linked) Tests\n" + "=============================================\n" ); + + test_lfds700_list_aos_alignment(); + test_lfds700_list_aos_new_ordered( list_of_logical_processors, memory_in_megabytes ); + test_lfds700_list_aos_new_ordered_with_cursor( list_of_logical_processors, memory_in_megabytes ); + } + + return; +} + +#pragma warning( default : 4127 ) + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_list_addonly_ordered_singlylinked_alignment.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_list_addonly_ordered_singlylinked_alignment.c new file mode 100644 index 0000000000..7726346366 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_list_addonly_ordered_singlylinked_alignment.c @@ -0,0 +1,58 @@ +/***** includes *****/ +#include "internal.h" + + + + + +/****************************************************************************/ +#pragma warning( disable : 4127 ) // TRD : disables MSVC warning for condition expressions being const + +void test_lfds700_list_aos_alignment() +{ + enum lfds700_misc_validity + dvs = LFDS700_MISC_VALIDITY_VALID; + + /* TRD : these are compile time checks + but we do them here because this is a test programme + and it should indicate issues to users when it is *run*, + not when it is compiled, because a compile error normally + indicates a problem with the code itself and so is misleading + */ + + internal_display_test_name( "Alignment" ); + + + + // TRD : struct lfds700_list_aos_element + if( offsetof(struct lfds700_list_aos_element,next) % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES != 0 ) + dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; + + if( offsetof(struct lfds700_list_aos_element,value) % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES != 0 ) + dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; + + if( offsetof(struct lfds700_list_aos_element,key) % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES != 0 ) + dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; + + + + // TRD : struct lfds700_list_asu_state + if( offsetof(struct lfds700_list_aos_state,start) % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES != 0 ) + dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; + + if( offsetof(struct lfds700_list_aos_state,dummy_element) % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES != 0 ) + dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; + + if( offsetof(struct lfds700_list_aos_state,key_compare_function) % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES != 0 ) + dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; + + + + // TRD : print the test result + internal_display_test_result( 1, "list_aos", dvs ); + + return; +} + +#pragma warning( default : 4127 ) + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_list_addonly_ordered_singlylinked_new_ordered.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_list_addonly_ordered_singlylinked_new_ordered.c new file mode 100644 index 0000000000..3a392b33bd --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_list_addonly_ordered_singlylinked_new_ordered.c @@ -0,0 +1,278 @@ +/***** includes *****/ +#include "internal.h" + +/***** structs *****/ +struct test_element +{ + struct lfds700_list_aos_element + laose; + + lfds700_pal_uint_t + element_number, + thread_number; +}; + +struct test_state +{ + lfds700_pal_uint_t + number_elements_per_thread; + + struct lfds700_list_aos_state + *laoss; + + struct test_element + *element_array; +}; + +/***** private prototypes *****/ +static int new_ordered_compare_function( void const *value_new, void const *value_in_list ); +static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION new_ordered_thread( void *util_thread_starter_thread_state ); + + + + + +/****************************************************************************/ +void test_lfds700_list_aos_new_ordered( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ) +{ + enum lfds700_misc_validity + dvs = LFDS700_MISC_VALIDITY_VALID; + + lfds700_pal_uint_t + loop, + expected_element_number, + number_elements_per_thread, + number_elements_total, + number_logical_processors, + offset, + temp; + + struct lfds700_list_aos_element + *laose = NULL; + + struct lfds700_list_asu_element + *lasue = NULL; + + struct lfds700_list_aos_state + laoss; + + struct lfds700_misc_prng_state + ps; + + struct lfds700_misc_validation_info + vi; + + struct test_pal_logical_processor + *lp; + + struct test_element + *element_array, + *element; + + struct test_state + *ts; + + struct util_thread_starter_state + *tts; + + test_pal_thread_state_t + *thread_handles; + + assert( list_of_logical_processors != NULL ); + // TRD : memory_in_megabytes can be any value in its range + + /* TRD : run one thread per logical processor + we have a single array of 10k elements per thread + this is set to be randomly ordered (but with contigious numbers from 0 to n) + we give 10k to each thread (a pointer into the array at the correct point) + which then loops through that array + calling lfds700_list_aos_insert_element_by_position( LFDS700_LIST_AOS_POSITION_ORDERED ) + verification should show list is sorted + */ + + internal_display_test_name( "New ordered" ); + + lfds700_misc_prng_init( &ps ); + + lfds700_list_asu_query( list_of_logical_processors, LFDS700_LIST_ASU_QUERY_GET_POTENTIALLY_INACCURATE_COUNT, NULL, (void **) &number_logical_processors ); + + lfds700_list_aos_init_valid_on_current_logical_core( &laoss, new_ordered_compare_function, LFDS700_LIST_AOS_INSERT_RESULT_FAILURE_EXISTING_KEY, NULL ); + + /* TRD : create randomly ordered number array with unique elements + + unique isn't necessary - the list will sort anyway - but + it permits slightly better validation + */ + + number_elements_per_thread = ( memory_in_megabytes * ONE_MEGABYTE_IN_BYTES ) / ( sizeof(struct test_element) * number_logical_processors ); + + // TRD : or the test takes a looooooong time... + if( number_elements_per_thread > 10000 ) + number_elements_per_thread = 10000; + + number_elements_total = number_elements_per_thread * number_logical_processors; + + element_array = util_aligned_malloc( sizeof(struct test_element) * number_elements_total, LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES ); + + for( loop = 0 ; loop < number_elements_total ; loop++ ) + (element_array+loop)->element_number = loop; + + for( loop = 0 ; loop < number_elements_total ; loop++ ) + { + offset = LFDS700_MISC_PRNG_GENERATE( &ps ); + offset %= number_elements_total; + temp = (element_array + offset)->element_number; + (element_array + offset)->element_number = (element_array + loop)->element_number; + (element_array + loop)->element_number = temp; + } + + ts = util_malloc_wrapper( sizeof(struct test_state) * number_logical_processors ); + + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + { + (ts+loop)->laoss = &laoss; + (ts+loop)->element_array = element_array + (loop*number_elements_per_thread); + (ts+loop)->number_elements_per_thread = number_elements_per_thread; + } + + thread_handles = util_malloc_wrapper( sizeof(test_pal_thread_state_t) * number_logical_processors ); + + util_thread_starter_new( &tts, number_logical_processors ); + + LFDS700_MISC_BARRIER_STORE; + + lfds700_misc_force_store(); + + loop = 0; + + while( LFDS700_LIST_ASU_GET_START_AND_THEN_NEXT(*list_of_logical_processors, lasue) ) + { + lp = LFDS700_LIST_ASU_GET_VALUE_FROM_ELEMENT( *lasue ); + util_thread_starter_start( tts, &thread_handles[loop], loop, lp, new_ordered_thread, ts+loop ); + loop++; + } + + util_thread_starter_run( tts ); + + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + test_pal_thread_wait( thread_handles[loop] ); + + util_thread_starter_delete( tts ); + + free( thread_handles ); + + free( ts ); + + /* TRD : validate the resultant list + iterate over the list + we expect to find the list is sorted, + which means that element_number will + increment from zero + */ + + LFDS700_MISC_BARRIER_LOAD; + + vi.min_elements = vi.max_elements = number_elements_total; + + lfds700_list_aos_query( &laoss, LFDS700_LIST_AOS_QUERY_SINGLETHREADED_VALIDATE, &vi, &dvs ); + + if( dvs == LFDS700_MISC_VALIDITY_VALID ) + { + expected_element_number = 0; + + // TRD : traverse the list and check combined_data_array matches + while( dvs == LFDS700_MISC_VALIDITY_VALID and LFDS700_LIST_AOS_GET_START_AND_THEN_NEXT(laoss, laose) ) + { + element = LFDS700_LIST_AOS_GET_VALUE_FROM_ELEMENT( *laose ); + + if( element->element_number != expected_element_number++ ) + dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; + } + } + + lfds700_list_aos_cleanup( &laoss, NULL ); + + util_aligned_free( element_array ); + + internal_display_test_result( 1, "list_aos", dvs ); + + return; +} + + + + + +/****************************************************************************/ +#pragma warning( disable : 4100 ) + +static int new_ordered_compare_function( void const *value_new, void const *value_in_list ) +{ + int + cr = 0; + + struct test_element + *e1, + *e2; + + // TRD : value_new can be any value in its range + // TRD : value_in_list can be any value in its range + + e1 = (struct test_element *) value_new; + e2 = (struct test_element *) value_in_list; + + if( e1->element_number < e2->element_number ) + cr = -1; + + if( e1->element_number > e2->element_number ) + cr = 1; + + return( cr ); +} + +#pragma warning( default : 4100 ) + + + + + +/****************************************************************************/ +static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION new_ordered_thread( void *util_thread_starter_thread_state ) +{ + lfds700_pal_uint_t + loop; + + struct lfds700_misc_prng_state + ps; + + struct test_state + *ts; + + struct util_thread_starter_thread_state + *tsts; + + LFDS700_MISC_MAKE_VALID_ON_CURRENT_LOGICAL_CORE_INITS_COMPLETED_BEFORE_NOW_ON_ANY_OTHER_LOGICAL_CORE; + + assert( util_thread_starter_thread_state != NULL ); + + tsts = (struct util_thread_starter_thread_state *) util_thread_starter_thread_state; + ts = (struct test_state *) tsts->thread_user_state; + + lfds700_misc_prng_init( &ps ); + + util_thread_starter_ready_and_wait( tsts ); + + for( loop = 0 ; loop < ts->number_elements_per_thread ; loop++ ) + { + LFDS700_LIST_AOS_SET_KEY_IN_ELEMENT( (ts->element_array+loop)->laose, ts->element_array+loop ); + LFDS700_LIST_AOS_SET_VALUE_IN_ELEMENT( (ts->element_array+loop)->laose, ts->element_array+loop ); + lfds700_list_aos_insert( ts->laoss, &(ts->element_array+loop)->laose, NULL, &ps ); + } + + LFDS700_MISC_BARRIER_STORE; + + lfds700_misc_force_store(); + + return( (test_pal_thread_return_t) EXIT_SUCCESS ); +} + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_list_addonly_ordered_singlylinked_new_ordered_with_cursor.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_list_addonly_ordered_singlylinked_new_ordered_with_cursor.c new file mode 100644 index 0000000000..42e0ebc7a5 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_list_addonly_ordered_singlylinked_new_ordered_with_cursor.c @@ -0,0 +1,366 @@ +/***** includes *****/ +#include "internal.h" + +/***** structs *****/ +struct test_element +{ + struct lfds700_list_aos_element + laose; + + lfds700_pal_uint_t + element_number, + thread_number; +}; + +struct test_state +{ + enum flag + error_flag; + + lfds700_pal_uint_t + number_elements_per_thread; + + struct lfds700_list_aos_state + *laoss; + + struct test_element + *element_array; +}; + +/***** private prototypes *****/ +static int new_ordered_with_cursor_compare_function( void const *value_new, void const *value_in_list ); +static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION new_ordered_with_cursor_insert_thread( void *util_thread_starter_thread_state ); +static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION new_ordered_with_cursor_cursor_thread( void *util_thread_starter_thread_state ); + + + + + +/****************************************************************************/ +void test_lfds700_list_aos_new_ordered_with_cursor( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ) +{ + enum lfds700_misc_validity + dvs = LFDS700_MISC_VALIDITY_VALID; + + lfds700_pal_uint_t + loop, + number_elements_per_thread, + number_elements_total, + number_logical_processors, + offset, + temp; + + struct lfds700_list_aos_state + laoss; + + struct lfds700_list_asu_element + *lasue = NULL; + + struct lfds700_misc_prng_state + ps; + + struct lfds700_misc_validation_info + vi; + + struct test_pal_logical_processor + *lp; + + struct util_thread_starter_state + *tts; + + struct test_element + *element_array; + + struct test_state + *ts; + + test_pal_thread_state_t + *thread_handles; + + assert( list_of_logical_processors != NULL ); + // TRD : memory_in_megabytes can be any value in its range + + /* TRD : run two threads per logical processor + + the test runs for 10 seconds + + the first thread loops over a pre-set list of random numbers + continually adding them using ordered insert + + the second thread keeps iterating over the list, checking that + each element is larger than its predecessor + */ + + internal_display_test_name( "New ordered with cursor (%d seconds)", TEST_DURATION_IN_SECONDS ); + + lfds700_misc_prng_init( &ps ); + + lfds700_list_asu_query( list_of_logical_processors, LFDS700_LIST_ASU_QUERY_GET_POTENTIALLY_INACCURATE_COUNT, NULL, (void **) &number_logical_processors ); + + lfds700_list_aos_init_valid_on_current_logical_core( &laoss, new_ordered_with_cursor_compare_function, LFDS700_LIST_AOS_INSERT_RESULT_FAILURE_EXISTING_KEY, NULL ); + + /* TRD : create randomly ordered number array with unique elements + + unique isn't necessary - the list will sort anyway - but + it permits slightly better validation + */ + + number_elements_per_thread = ( memory_in_megabytes * ONE_MEGABYTE_IN_BYTES ) / ( sizeof(struct test_element) * number_logical_processors ); + + // TRD : or the test takes a looooooong time... + if( number_elements_per_thread > 1000 ) + number_elements_per_thread = 1000; + + number_elements_total = number_elements_per_thread * number_logical_processors; + + element_array = util_aligned_malloc( sizeof(struct test_element) * number_elements_total, LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES ); + + for( loop = 0 ; loop < number_elements_total ; loop++ ) + (element_array+loop)->element_number = loop; + + for( loop = 0 ; loop < number_elements_total ; loop++ ) + { + offset = LFDS700_MISC_PRNG_GENERATE( &ps ); + offset %= number_elements_total; + temp = (element_array + offset)->element_number; + (element_array + offset)->element_number = (element_array + loop)->element_number; + (element_array + loop)->element_number = temp; + } + + ts = util_malloc_wrapper( sizeof(struct test_state) * number_logical_processors * 2 ); + + // TRD : the insert threads + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + { + (ts+loop)->laoss = &laoss; + (ts+loop)->element_array = element_array + number_elements_per_thread*loop; + (ts+loop)->error_flag = LOWERED; + (ts+loop)->number_elements_per_thread = number_elements_per_thread; + } + + // TRD : the cursor threads + for( loop = number_logical_processors ; loop < number_logical_processors * 2 ; loop++ ) + { + (ts+loop)->laoss = &laoss; + (ts+loop)->element_array = NULL; + (ts+loop)->error_flag = LOWERED; + } + + thread_handles = util_malloc_wrapper( sizeof(test_pal_thread_state_t) * number_logical_processors * 2 ); + + util_thread_starter_new( &tts, number_logical_processors * 2 ); + + LFDS700_MISC_BARRIER_STORE; + + lfds700_misc_force_store(); + + loop = 0; + + while( LFDS700_LIST_ASU_GET_START_AND_THEN_NEXT(*list_of_logical_processors, lasue) ) + { + lp = LFDS700_LIST_ASU_GET_VALUE_FROM_ELEMENT( *lasue ); + util_thread_starter_start( tts, &thread_handles[loop], loop, lp, new_ordered_with_cursor_insert_thread, ts+loop ); + util_thread_starter_start( tts, &thread_handles[loop+number_logical_processors], loop+number_logical_processors, lp, new_ordered_with_cursor_cursor_thread, ts+loop+number_logical_processors ); + loop++; + } + + util_thread_starter_run( tts ); + + for( loop = 0 ; loop < number_logical_processors * 2 ; loop++ ) + test_pal_thread_wait( thread_handles[loop] ); + + util_thread_starter_delete( tts ); + + free( thread_handles ); + + /* TRD : validate the resultant list + + the cursor threads were checking for orderedness + if that failed, they raise their error_flag + so validate the list, then check error_flags + */ + + LFDS700_MISC_BARRIER_LOAD; + + vi.min_elements = vi.max_elements = number_elements_total; + + lfds700_list_aos_query( &laoss, LFDS700_LIST_AOS_QUERY_SINGLETHREADED_VALIDATE, &vi, &dvs ); + + if( dvs == LFDS700_MISC_VALIDITY_VALID ) + for( loop = number_logical_processors ; loop < number_logical_processors * 2 ; loop++ ) + if( (ts+loop)->error_flag == RAISED ) + dvs = LFDS700_MISC_VALIDITY_INVALID_ORDER; + + lfds700_list_aos_cleanup( &laoss, NULL ); + + util_aligned_free( element_array ); + + free( ts ); + + internal_display_test_result( 1, "list_aos", dvs ); + + return; +} + + + + + +/****************************************************************************/ +#pragma warning( disable : 4100 ) + +static int new_ordered_with_cursor_compare_function( void const *value_new, void const *value_in_list ) +{ + int + cr = 0; + + struct test_element + *e1, + *e2; + + // TRD : value_new can be any value in its range + // TRD : value_in_list can be any value in its range + + e1 = (struct test_element *) value_new; + e2 = (struct test_element *) value_in_list; + + if( e1->element_number < e2->element_number ) + cr = -1; + + if( e1->element_number > e2->element_number ) + cr = 1; + + return( cr ); +} + +#pragma warning( default : 4100 ) + + + + + +/****************************************************************************/ +static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION new_ordered_with_cursor_insert_thread( void *util_thread_starter_thread_state ) +{ + lfds700_pal_uint_t + loop; + + struct lfds700_misc_prng_state + ps; + + struct test_state + *ts; + + struct util_thread_starter_thread_state + *tsts; + + LFDS700_MISC_BARRIER_LOAD; + + assert( util_thread_starter_thread_state != NULL ); + + tsts = (struct util_thread_starter_thread_state *) util_thread_starter_thread_state; + ts = (struct test_state *) tsts->thread_user_state; + + lfds700_misc_prng_init( &ps ); + + util_thread_starter_ready_and_wait( tsts ); + + for( loop = 0 ; loop < ts->number_elements_per_thread ; loop++ ) + { + LFDS700_LIST_AOS_SET_KEY_IN_ELEMENT( (ts->element_array+loop)->laose, ts->element_array+loop ); + LFDS700_LIST_AOS_SET_VALUE_IN_ELEMENT( (ts->element_array+loop)->laose, ts->element_array+loop ); + lfds700_list_aos_insert( ts->laoss, &(ts->element_array+loop)->laose, NULL, &ps ); + } + + LFDS700_MISC_BARRIER_STORE; + + lfds700_misc_force_store(); + + return( (test_pal_thread_return_t) EXIT_SUCCESS ); +} + + + + + +/****************************************************************************/ +static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION new_ordered_with_cursor_cursor_thread( void *util_thread_starter_thread_state ) +{ + lfds700_pal_uint_t + prev_element_number; + + lfds700_pal_uint_t + time_loop = 0; + + struct lfds700_list_aos_element + *laose; + + struct test_element + *element; + + struct test_state + *ts; + + struct util_thread_starter_thread_state + *tsts; + + time_t + current_time, + start_time; + + LFDS700_MISC_MAKE_VALID_ON_CURRENT_LOGICAL_CORE_INITS_COMPLETED_BEFORE_NOW_ON_ANY_OTHER_LOGICAL_CORE; + + assert( util_thread_starter_thread_state != NULL ); + + tsts = (struct util_thread_starter_thread_state *) util_thread_starter_thread_state; + ts = (struct test_state *) tsts->thread_user_state; + + util_thread_starter_ready_and_wait( tsts ); + + current_time = start_time = time( NULL ); + + while( current_time < start_time + TEST_DURATION_IN_SECONDS ) + { + prev_element_number = 0; + + laose = LFDS700_LIST_AOS_GET_START( *ts->laoss ); + + // TRD : we may get start before any element has been added to the list + if( laose == NULL ) + continue; + + element = LFDS700_LIST_AOS_GET_VALUE_FROM_ELEMENT( *laose ); + + if( element->element_number < prev_element_number ) + ts->error_flag = RAISED; + + prev_element_number = element->element_number; + + laose = LFDS700_LIST_AOS_GET_NEXT( *laose ); + + while( laose != NULL ) + { + element = LFDS700_LIST_AOS_GET_VALUE_FROM_ELEMENT( *laose ); + + if( element->element_number <= prev_element_number ) + ts->error_flag = RAISED; + + prev_element_number = element->element_number; + + laose = LFDS700_LIST_AOS_GET_NEXT( *laose ); + } + + if( time_loop++ == REDUCED_TIME_LOOP_COUNT ) + { + time_loop = 0; + time( ¤t_time ); + } + } + + LFDS700_MISC_BARRIER_STORE; + + lfds700_misc_force_store(); + + return( (test_pal_thread_return_t) EXIT_SUCCESS ); +} + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_list_addonly_singlylinked_unordered.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_list_addonly_singlylinked_unordered.c new file mode 100644 index 0000000000..37c37f2529 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_list_addonly_singlylinked_unordered.c @@ -0,0 +1,32 @@ +/***** includes *****/ +#include "internal.h" + + + + + +/****************************************************************************/ +#pragma warning( disable : 4127 ) // TRD : disables MSVC warning for condition expressions being const + +void test_lfds700_list_asu( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ) +{ + assert( list_of_logical_processors != NULL ); + // TRD : memory_in_megabytes can be any value in its range + + if( LFDS700_MISC_ATOMIC_SUPPORT_CAS ) + { + printf( "\n" + "List (add-only, singly-linked, unordered) Tests\n" + "===============================================\n" ); + + test_lfds700_list_asu_alignment(); + test_lfds700_list_asu_new_start( list_of_logical_processors, memory_in_megabytes ); + test_lfds700_list_asu_new_end( list_of_logical_processors, memory_in_megabytes ); + test_lfds700_list_asu_new_after( list_of_logical_processors, memory_in_megabytes ); + } + + return; +} + +#pragma warning( default : 4127 ) + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_list_addonly_singlylinked_unordered_alignment.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_list_addonly_singlylinked_unordered_alignment.c new file mode 100644 index 0000000000..43f451d4bf --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_list_addonly_singlylinked_unordered_alignment.c @@ -0,0 +1,61 @@ +/***** includes *****/ +#include "internal.h" + + + + + +/****************************************************************************/ +#pragma warning( disable : 4127 ) // TRD : disables MSVC warning for condition expressions being const + +void test_lfds700_list_asu_alignment() +{ + enum lfds700_misc_validity + dvs = LFDS700_MISC_VALIDITY_VALID; + + /* TRD : these are compile time checks + but we do them here because this is a test programme + and it should indicate issues to users when it is *run*, + not when it is compiled, because a compile error normally + indicates a problem with the code itself and so is misleading + */ + + internal_display_test_name( "Alignment" ); + + + + // TRD : struct lfds700_list_asu_element + if( offsetof(struct lfds700_list_asu_element,next) % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES != 0 ) + dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; + + if( offsetof(struct lfds700_list_asu_element,value) % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES != 0 ) + dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; + + if( offsetof(struct lfds700_list_asu_element,key) % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES != 0 ) + dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; + + + + // TRD : struct lfds700_list_asu_state + if( offsetof(struct lfds700_list_asu_state,end) % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES != 0 ) + dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; + + if( offsetof(struct lfds700_list_asu_state,start) % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES != 0 ) + dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; + + if( offsetof(struct lfds700_list_asu_state,dummy_element) % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES != 0 ) + dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; + + if( offsetof(struct lfds700_list_asu_state,key_compare_function) % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES != 0 ) + dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; + + + + // TRD : print the test result + internal_display_test_result( 1, "list_asu", dvs ); + + return; +} + +#pragma warning( default : 4127 ) + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_list_addonly_singlylinked_unordered_new_after.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_list_addonly_singlylinked_unordered_new_after.c new file mode 100644 index 0000000000..5dcd6954aa --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_list_addonly_singlylinked_unordered_new_after.c @@ -0,0 +1,254 @@ +/***** includes *****/ +#include "internal.h" + +/***** structs *****/ +struct test_element +{ + struct lfds700_list_asu_element + lasue; + + lfds700_pal_uint_t + element_number, + thread_number; +}; + +struct test_state +{ + lfds700_pal_uint_t + number_elements; + + struct lfds700_list_asu_state + *lasus; + + struct test_element + *element_array; + + struct lfds700_list_asu_element + *first_element; +}; + +/***** private prototypes *****/ +static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION new_after_thread( void *util_thread_starter_thread_state ); + + + + + +/****************************************************************************/ +void test_lfds700_list_asu_new_after( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ) +{ + enum lfds700_misc_validity + dvs = LFDS700_MISC_VALIDITY_VALID; + + lfds700_pal_uint_t + loop, + number_elements, + number_logical_processors, + *per_thread_counters, + subloop; + + struct lfds700_list_asu_element + *lasue, + first_element; + + struct lfds700_list_asu_state + lasus; + + struct lfds700_misc_prng_state + ps; + + struct lfds700_misc_validation_info + vi; + + struct test_pal_logical_processor + *lp; + + struct util_thread_starter_state + *tts; + + struct test_element + *element_array, + *element; + + struct test_state + *ts; + + test_pal_thread_state_t + *thread_handles; + + assert( list_of_logical_processors != NULL ); + // TRD : memory_in_megabytes can be any value in its range + + /* TRD : run one thread per logical processor + run for 250k elements + we put a single first element into the list and + each thread loops, calling lfds700_list_asu_new_element_by_position( LFDS700_LIST_ASU_POSITION_AFTER ), + inserting after the single first element + data element contain s thread_number and element_number + verification should show element_number decreasing on a per thread basis + */ + + internal_display_test_name( "New after" ); + + lfds700_list_asu_query( list_of_logical_processors, LFDS700_LIST_ASU_QUERY_GET_POTENTIALLY_INACCURATE_COUNT, NULL, (void **) &number_logical_processors ); + + lfds700_misc_prng_init( &ps ); + + lfds700_list_asu_init_valid_on_current_logical_core( &lasus, NULL, NULL ); + + LFDS700_LIST_ASU_SET_KEY_IN_ELEMENT( first_element, NULL ); + LFDS700_LIST_ASU_SET_VALUE_IN_ELEMENT( first_element, NULL ); + lfds700_list_asu_insert_at_position( &lasus, &first_element, NULL, LFDS700_LIST_ASU_POSITION_START, &ps ); + + number_elements = ( memory_in_megabytes * ONE_MEGABYTE_IN_BYTES ) / ( sizeof(struct test_element) * number_logical_processors ); + + element_array = util_aligned_malloc( sizeof(struct test_element) * number_logical_processors * number_elements, LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES ); + + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + for( subloop = 0 ; subloop < number_elements ; subloop++ ) + { + (element_array+(loop*number_elements)+subloop)->thread_number = loop; + (element_array+(loop*number_elements)+subloop)->element_number = subloop; + } + + ts = util_malloc_wrapper( sizeof(struct test_state) * number_logical_processors ); + + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + {\ + (ts+loop)->lasus = &lasus; + (ts+loop)->element_array = element_array + (loop*number_elements); + (ts+loop)->first_element = &first_element; + (ts+loop)->number_elements = number_elements; + } + + thread_handles = util_malloc_wrapper( sizeof(test_pal_thread_state_t) * number_logical_processors ); + + util_thread_starter_new( &tts, number_logical_processors ); + + LFDS700_MISC_BARRIER_STORE; + + lfds700_misc_force_store(); + + loop = 0; + lasue = NULL; + + while( LFDS700_LIST_ASU_GET_START_AND_THEN_NEXT(*list_of_logical_processors, lasue) ) + { + lp = LFDS700_LIST_ASU_GET_VALUE_FROM_ELEMENT( *lasue ); + util_thread_starter_start( tts, &thread_handles[loop], loop, lp, new_after_thread, ts+loop ); + loop++; + } + + util_thread_starter_run( tts ); + + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + test_pal_thread_wait( thread_handles[loop] ); + + util_thread_starter_delete( tts ); + + free( thread_handles ); + + free( ts ); + + /* TRD : validate the resultant list + iterate over each element + we expect to find element numbers increment on a per thread basis + */ + + LFDS700_MISC_BARRIER_LOAD; + + vi.min_elements = vi.max_elements = number_elements * number_logical_processors + 1; + + lfds700_list_asu_query( &lasus, LFDS700_LIST_ASU_QUERY_SINGLETHREADED_VALIDATE, &vi, &dvs ); + + per_thread_counters = util_malloc_wrapper( sizeof(lfds700_pal_uint_t) * number_logical_processors ); + + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + *(per_thread_counters+loop) = number_elements - 1; + + /* TRD : we have a leading element, after which all inserts occurred + we need to get past that element for validation + this is why we're not using lfds700_list_asu_get_start_and_then_next() + */ + + lasue = LFDS700_LIST_ASU_GET_START( lasus ); + + lasue = LFDS700_LIST_ASU_GET_NEXT( *lasue ); + + while( dvs == LFDS700_MISC_VALIDITY_VALID and lasue != NULL ) + { + element = LFDS700_LIST_ASU_GET_VALUE_FROM_ELEMENT( *lasue ); + + if( element->thread_number >= number_logical_processors ) + { + dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; + break; + } + + if( element->element_number < per_thread_counters[element->thread_number] ) + dvs = LFDS700_MISC_VALIDITY_INVALID_MISSING_ELEMENTS; + + if( element->element_number > per_thread_counters[element->thread_number] ) + dvs = LFDS700_MISC_VALIDITY_INVALID_ADDITIONAL_ELEMENTS; + + if( element->element_number == per_thread_counters[element->thread_number] ) + per_thread_counters[element->thread_number]--; + + lasue = LFDS700_LIST_ASU_GET_NEXT( *lasue ); + } + + free( per_thread_counters ); + + lfds700_list_asu_cleanup( &lasus, NULL ); + + util_aligned_free( element_array ); + + internal_display_test_result( 1, "list_asu", dvs ); + + return; +} + + + + + +/****************************************************************************/ +static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION new_after_thread( void *util_thread_starter_thread_state ) +{ + lfds700_pal_uint_t + loop; + + struct lfds700_misc_prng_state + ps; + + struct test_state + *ts; + + struct util_thread_starter_thread_state + *tsts; + + LFDS700_MISC_MAKE_VALID_ON_CURRENT_LOGICAL_CORE_INITS_COMPLETED_BEFORE_NOW_ON_ANY_OTHER_LOGICAL_CORE; + + assert( util_thread_starter_thread_state != NULL ); + + tsts = (struct util_thread_starter_thread_state *) util_thread_starter_thread_state; + ts = (struct test_state *) tsts->thread_user_state; + + lfds700_misc_prng_init( &ps ); + + util_thread_starter_ready_and_wait( tsts ); + + for( loop = 0 ; loop < ts->number_elements ; loop++ ) + { + LFDS700_LIST_ASU_SET_KEY_IN_ELEMENT( (ts->element_array+loop)->lasue, ts->element_array+loop ); + LFDS700_LIST_ASU_SET_VALUE_IN_ELEMENT( (ts->element_array+loop)->lasue, ts->element_array+loop ); + lfds700_list_asu_insert_at_position( ts->lasus, &(ts->element_array+loop)->lasue, ts->first_element, LFDS700_LIST_ASU_POSITION_AFTER, &ps ); + } + + LFDS700_MISC_BARRIER_STORE; + + lfds700_misc_force_store(); + + return( (test_pal_thread_return_t) EXIT_SUCCESS ); +} + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_list_addonly_singlylinked_unordered_new_end.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_list_addonly_singlylinked_unordered_new_end.c new file mode 100644 index 0000000000..c6c66d007c --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_list_addonly_singlylinked_unordered_new_end.c @@ -0,0 +1,229 @@ +/***** includes *****/ +#include "internal.h" + +/***** structs *****/ +struct test_element +{ + struct lfds700_list_asu_element + lasue; + + lfds700_pal_uint_t + element_number, + thread_number; +}; + +struct test_state +{ + lfds700_pal_uint_t + number_elements; + + struct lfds700_list_asu_state + *lasus; + + struct test_element + *element_array; +}; + +/***** private prototypes *****/ +static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION new_end_thread( void *util_thread_starter_thread_state ); + + + + + +/****************************************************************************/ +void test_lfds700_list_asu_new_end( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ) +{ + enum lfds700_misc_validity + dvs = LFDS700_MISC_VALIDITY_VALID; + + lfds700_pal_uint_t + loop, + number_elements, + number_logical_processors, + *per_thread_counters, + subloop; + + struct lfds700_list_asu_element + *lasue = NULL; + + struct lfds700_list_asu_state + lasus; + + struct lfds700_misc_validation_info + vi; + + struct test_pal_logical_processor + *lp; + + struct util_thread_starter_state + *tts; + + struct test_element + *element_array, + *element; + + struct test_state + *ts; + + test_pal_thread_state_t + *thread_handles; + + assert( list_of_logical_processors != NULL ); + // TRD : memory_in_megabytes can be any value in its range + + /* TRD : run one thread per logical processor + run for 250k elements + each thread loops, calling lfds700_list_asu_new_element_by_position( LFDS700_LIST_ASU_POSITION_END ) + data element contain a thread_number and element_number + verification should show element_number increasing on a per thread basis + */ + + internal_display_test_name( "New end" ); + + lfds700_list_asu_query( list_of_logical_processors, LFDS700_LIST_ASU_QUERY_GET_POTENTIALLY_INACCURATE_COUNT, NULL, (void **) &number_logical_processors ); + + lfds700_list_asu_init_valid_on_current_logical_core( &lasus, NULL, NULL ); + + number_elements = ( memory_in_megabytes * ONE_MEGABYTE_IN_BYTES ) / ( sizeof(struct test_element) * number_logical_processors ); + + element_array = util_aligned_malloc( sizeof(struct test_element) * number_logical_processors * number_elements, LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES ); + + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + for( subloop = 0 ; subloop < number_elements ; subloop++ ) + { + (element_array+(loop*number_elements)+subloop)->thread_number = loop; + (element_array+(loop*number_elements)+subloop)->element_number = subloop; + } + + ts = util_malloc_wrapper( sizeof(struct test_state) * number_logical_processors ); + + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + { + (ts+loop)->lasus = &lasus; + (ts+loop)->element_array = element_array + (loop*number_elements); + (ts+loop)->number_elements = number_elements; + } + + thread_handles = util_malloc_wrapper( sizeof(test_pal_thread_state_t) * number_logical_processors ); + + util_thread_starter_new( &tts, number_logical_processors ); + + LFDS700_MISC_BARRIER_STORE; + + lfds700_misc_force_store(); + + loop = 0; + lasue = NULL; + + while( LFDS700_LIST_ASU_GET_START_AND_THEN_NEXT(*list_of_logical_processors, lasue) ) + { + lp = LFDS700_LIST_ASU_GET_VALUE_FROM_ELEMENT( *lasue ); + util_thread_starter_start( tts, &thread_handles[loop], loop, lp, new_end_thread, ts+loop ); + loop++; + } + + util_thread_starter_run( tts ); + + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + test_pal_thread_wait( thread_handles[loop] ); + + util_thread_starter_delete( tts ); + + free( thread_handles ); + + free( ts ); + + /* TRD : validate the resultant list + iterate over each element + we expect to find element numbers increment on a per thread basis + */ + + LFDS700_MISC_BARRIER_LOAD; + + vi.min_elements = vi.max_elements = number_elements * number_logical_processors; + + lfds700_list_asu_query( &lasus, LFDS700_LIST_ASU_QUERY_SINGLETHREADED_VALIDATE, &vi, &dvs ); + + per_thread_counters = util_malloc_wrapper( sizeof(lfds700_pal_uint_t) * number_logical_processors ); + + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + *(per_thread_counters+loop) = 0; + + lasue = NULL; + + while( dvs == LFDS700_MISC_VALIDITY_VALID and LFDS700_LIST_ASU_GET_START_AND_THEN_NEXT(lasus, lasue) ) + { + element = LFDS700_LIST_ASU_GET_VALUE_FROM_ELEMENT( *lasue ); + + if( element->thread_number >= number_logical_processors ) + { + dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; + break; + } + + if( element->element_number > per_thread_counters[element->thread_number] ) + dvs = LFDS700_MISC_VALIDITY_INVALID_MISSING_ELEMENTS; + + if( element->element_number < per_thread_counters[element->thread_number] ) + dvs = LFDS700_MISC_VALIDITY_INVALID_ADDITIONAL_ELEMENTS; + + if( element->element_number == per_thread_counters[element->thread_number] ) + per_thread_counters[element->thread_number]++; + } + + free( per_thread_counters ); + + lfds700_list_asu_cleanup( &lasus, NULL ); + + util_aligned_free( element_array ); + + internal_display_test_result( 1, "list_asu", dvs ); + + return; +} + + + + + +/****************************************************************************/ +static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION new_end_thread( void *util_thread_starter_thread_state ) +{ + lfds700_pal_uint_t + loop; + + struct lfds700_misc_prng_state + ps; + + struct test_state + *ts; + + struct util_thread_starter_thread_state + *tsts; + + LFDS700_MISC_MAKE_VALID_ON_CURRENT_LOGICAL_CORE_INITS_COMPLETED_BEFORE_NOW_ON_ANY_OTHER_LOGICAL_CORE; + + assert( util_thread_starter_thread_state != NULL ); + + tsts = (struct util_thread_starter_thread_state *) util_thread_starter_thread_state; + ts = (struct test_state *) tsts->thread_user_state; + + lfds700_misc_prng_init( &ps ); + + util_thread_starter_ready_and_wait( tsts ); + + for( loop = 0 ; loop < ts->number_elements ; loop++ ) + { + LFDS700_LIST_ASU_SET_KEY_IN_ELEMENT( (ts->element_array+loop)->lasue, ts->element_array+loop ); + LFDS700_LIST_ASU_SET_VALUE_IN_ELEMENT( (ts->element_array+loop)->lasue, ts->element_array+loop ); + lfds700_list_asu_insert_at_position( ts->lasus, &(ts->element_array+loop)->lasue, NULL, LFDS700_LIST_ASU_POSITION_END, &ps ); + } + + LFDS700_MISC_BARRIER_STORE; + + lfds700_misc_force_store(); + + return( (test_pal_thread_return_t) EXIT_SUCCESS ); +} + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_list_addonly_singlylinked_unordered_new_start.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_list_addonly_singlylinked_unordered_new_start.c new file mode 100644 index 0000000000..f4244e2a12 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_list_addonly_singlylinked_unordered_new_start.c @@ -0,0 +1,229 @@ +/***** includes *****/ +#include "internal.h" + +/***** structs *****/ +struct test_element +{ + struct lfds700_list_asu_element + lasue; + + lfds700_pal_uint_t + element_number, + thread_number; +}; + +struct test_state +{ + lfds700_pal_uint_t + number_elements; + + struct lfds700_list_asu_state + *lasus; + + struct test_element + *element_array; +}; + +/***** private prototypes *****/ +static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION new_start_thread( void *util_thread_starter_thread_state ); + + + + + +/****************************************************************************/ +void test_lfds700_list_asu_new_start( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ) +{ + enum lfds700_misc_validity + dvs = LFDS700_MISC_VALIDITY_VALID; + + lfds700_pal_uint_t + loop, + number_elements, + number_logical_processors, + *per_thread_counters, + subloop; + + struct lfds700_list_asu_element + *lasue = NULL; + + struct lfds700_list_asu_state + lasus; + + struct lfds700_misc_validation_info + vi; + + struct test_element + *element_array, + *element; + + struct test_state + *ts; + + struct test_pal_logical_processor + *lp; + + struct util_thread_starter_state + *tts; + + test_pal_thread_state_t + *thread_handles; + + assert( list_of_logical_processors != NULL ); + // TRD : memory_in_megabytes can be any value in its range + + /* TRD : run one thread per logical processor + run for 250k elements + each thread loops, calling lfds700_list_asu_new_element_by_position( LFDS700_LIST_ASU_POSITION_START ) + data element contain s thread_number and element_number + verification should show element_number decreasing on a per thread basis + */ + + internal_display_test_name( "New start" ); + + lfds700_list_asu_query( list_of_logical_processors, LFDS700_LIST_ASU_QUERY_GET_POTENTIALLY_INACCURATE_COUNT, NULL, (void **) &number_logical_processors ); + + lfds700_list_asu_init_valid_on_current_logical_core( &lasus, NULL, NULL ); + + number_elements = ( memory_in_megabytes * ONE_MEGABYTE_IN_BYTES ) / ( sizeof(struct test_element) * number_logical_processors ); + + element_array = util_aligned_malloc( sizeof(struct test_element) * number_logical_processors * number_elements, LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES ); + + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + for( subloop = 0 ; subloop < number_elements ; subloop++ ) + { + (element_array+(loop*number_elements)+subloop)->thread_number = loop; + (element_array+(loop*number_elements)+subloop)->element_number = subloop; + } + + ts = util_malloc_wrapper( sizeof(struct test_state) * number_logical_processors ); + + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + { + (ts+loop)->lasus = &lasus; + (ts+loop)->element_array = element_array + (loop*number_elements); + (ts+loop)->number_elements = number_elements; + } + + thread_handles = util_malloc_wrapper( sizeof(test_pal_thread_state_t) * number_logical_processors ); + + util_thread_starter_new( &tts, number_logical_processors ); + + LFDS700_MISC_BARRIER_STORE; + + lfds700_misc_force_store(); + + loop = 0; + lasue = NULL; + + while( LFDS700_LIST_ASU_GET_START_AND_THEN_NEXT(*list_of_logical_processors, lasue) ) + { + lp = LFDS700_LIST_ASU_GET_VALUE_FROM_ELEMENT( *lasue ); + util_thread_starter_start( tts, &thread_handles[loop], loop, lp, new_start_thread, ts+loop ); + loop++; + } + + util_thread_starter_run( tts ); + + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + test_pal_thread_wait( thread_handles[loop] ); + + util_thread_starter_delete( tts ); + + free( thread_handles ); + + free( ts ); + + LFDS700_MISC_BARRIER_LOAD; + + /* TRD : validate the resultant list + iterate over each element + we expect to find element numbers increment on a per thread basis + */ + + vi.min_elements = vi.max_elements = number_elements * number_logical_processors; + + lfds700_list_asu_query( &lasus, LFDS700_LIST_ASU_QUERY_SINGLETHREADED_VALIDATE, &vi, &dvs ); + + per_thread_counters = util_malloc_wrapper( sizeof(lfds700_pal_uint_t) * number_logical_processors ); + + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + *(per_thread_counters+loop) = number_elements - 1; + + lasue = NULL; + + while( dvs == LFDS700_MISC_VALIDITY_VALID and LFDS700_LIST_ASU_GET_START_AND_THEN_NEXT(lasus, lasue) ) + { + element = LFDS700_LIST_ASU_GET_VALUE_FROM_ELEMENT( *lasue ); + + if( element->thread_number >= number_logical_processors ) + { + dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; + break; + } + + if( element->element_number < per_thread_counters[element->thread_number] ) + dvs = LFDS700_MISC_VALIDITY_INVALID_MISSING_ELEMENTS; + + if( element->element_number > per_thread_counters[element->thread_number] ) + dvs = LFDS700_MISC_VALIDITY_INVALID_ADDITIONAL_ELEMENTS; + + if( element->element_number == per_thread_counters[element->thread_number] ) + per_thread_counters[element->thread_number]--; + } + + free( per_thread_counters ); + + lfds700_list_asu_cleanup( &lasus, NULL ); + + util_aligned_free( element_array ); + + internal_display_test_result( 1, "list_asu", dvs ); + + return; +} + + + + + +/****************************************************************************/ +static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION new_start_thread( void *util_thread_starter_thread_state ) +{ + lfds700_pal_uint_t + loop; + + struct lfds700_misc_prng_state + ps; + + struct test_state + *ts; + + struct util_thread_starter_thread_state + *tsts; + + LFDS700_MISC_MAKE_VALID_ON_CURRENT_LOGICAL_CORE_INITS_COMPLETED_BEFORE_NOW_ON_ANY_OTHER_LOGICAL_CORE; + + assert( util_thread_starter_thread_state != NULL ); + + tsts = (struct util_thread_starter_thread_state *) util_thread_starter_thread_state; + ts = (struct test_state *) tsts->thread_user_state; + + lfds700_misc_prng_init( &ps ); + + util_thread_starter_ready_and_wait( tsts ); + + for( loop = 0 ; loop < ts->number_elements ; loop++ ) + { + LFDS700_LIST_ASU_SET_KEY_IN_ELEMENT( (ts->element_array+loop)->lasue, ts->element_array+loop ); + LFDS700_LIST_ASU_SET_VALUE_IN_ELEMENT( (ts->element_array+loop)->lasue, ts->element_array+loop ); + lfds700_list_asu_insert_at_position( ts->lasus, &(ts->element_array+loop)->lasue, NULL, LFDS700_LIST_ASU_POSITION_START, &ps ); + } + + LFDS700_MISC_BARRIER_STORE; + + lfds700_misc_force_store(); + + return( (test_pal_thread_return_t) EXIT_SUCCESS ); +} + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_porting_abstraction_layer_atomic.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_porting_abstraction_layer_atomic.c new file mode 100644 index 0000000000..2f733909a7 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_porting_abstraction_layer_atomic.c @@ -0,0 +1,33 @@ +/***** includes *****/ +#include "internal.h" + + + + + +/****************************************************************************/ +#pragma warning( disable : 4127 ) // TRD : disables MSVC warning for condition expressions being const + +void test_lfds700_pal_atomic( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ) +{ + assert( list_of_logical_processors != NULL ); + // TRD : memory_in_megabytes can be any value in its range + + printf( "\n" + "Abstraction Atomic Tests\n" + "========================\n" ); + + if( LFDS700_MISC_ATOMIC_SUPPORT_CAS ) + test_lfds700_pal_atomic_cas( list_of_logical_processors ); + + if( LFDS700_MISC_ATOMIC_SUPPORT_DWCAS ) + test_lfds700_pal_atomic_dwcas( list_of_logical_processors ); + + if( LFDS700_MISC_ATOMIC_SUPPORT_EXCHANGE ) + test_lfds700_pal_atomic_exchange( list_of_logical_processors, memory_in_megabytes ); + + return; +} + +#pragma warning( default : 4127 ) + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_porting_abstraction_layer_atomic_cas.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_porting_abstraction_layer_atomic_cas.c new file mode 100644 index 0000000000..543528d99c --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_porting_abstraction_layer_atomic_cas.c @@ -0,0 +1,176 @@ +/***** includes *****/ +#include "internal.h" + +/***** structs *****/ +struct test_lfds700_pal_atomic_cas_state +{ + lfds700_pal_uint_t + local_counter; + + lfds700_pal_atom_t volatile + *shared_counter; +}; + +/***** private prototyps *****/ +static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_cas( void *util_thread_starter_thread_state ); + + + + + +/****************************************************************************/ +void test_lfds700_pal_atomic_cas( struct lfds700_list_asu_state *list_of_logical_processors ) +{ + lfds700_pal_atom_t volatile LFDS700_PAL_ALIGN(LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES) + shared_counter; + + lfds700_pal_uint_t + local_total = 0; + + lfds700_pal_uint_t + loop, + number_logical_processors; + + struct lfds700_list_asu_element + *lasue; + + struct test_pal_logical_processor + *lp; + + struct util_thread_starter_state + *tts; + + struct test_lfds700_pal_atomic_cas_state + *atcs; + + test_pal_thread_state_t + *thread_handles; + + assert( list_of_logical_processors != NULL ); + + /* TRD : here we test pal_cas + + we run one thread per CPU + we use pal_cas() to increment a shared counter + every time a thread successfully increments the counter, + it increments a thread local counter + the threads run for ten seconds + after the threads finish, we total the local counters + they should equal the shared counter + */ + + internal_display_test_name( "Atomic CAS" ); + + lfds700_list_asu_query( list_of_logical_processors, LFDS700_LIST_ASU_QUERY_GET_POTENTIALLY_INACCURATE_COUNT, NULL, (void **) &number_logical_processors ); + + shared_counter = 0; + + atcs = util_malloc_wrapper( sizeof(struct test_lfds700_pal_atomic_cas_state) * number_logical_processors ); + + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + { + (atcs+loop)->shared_counter = &shared_counter; + (atcs+loop)->local_counter = 0; + } + + thread_handles = util_malloc_wrapper( sizeof(test_pal_thread_state_t) * number_logical_processors ); + + util_thread_starter_new( &tts, number_logical_processors ); + + LFDS700_MISC_BARRIER_STORE; + + lfds700_misc_force_store(); + + loop = 0; + lasue = NULL; + + while( LFDS700_LIST_ASU_GET_START_AND_THEN_NEXT(*list_of_logical_processors, lasue) ) + { + lp = LFDS700_LIST_ASU_GET_VALUE_FROM_ELEMENT( *lasue ); + util_thread_starter_start( tts, &thread_handles[loop], loop, lp, thread_cas, atcs+loop ); + loop++; + } + + util_thread_starter_run( tts ); + + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + test_pal_thread_wait( thread_handles[loop] ); + + util_thread_starter_delete( tts ); + + free( thread_handles ); + + // TRD : results + LFDS700_MISC_BARRIER_LOAD; + + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + local_total += (atcs+loop)->local_counter; + + if( local_total == shared_counter ) + puts( "passed" ); + + if( local_total != shared_counter ) + { + puts( "failed" ); + exit( EXIT_FAILURE ); + } + + // TRD : cleanup + free( atcs ); + + return; +} + + + + + +/****************************************************************************/ +static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_cas( void *util_thread_starter_thread_state ) +{ + char unsigned + result; + + lfds700_pal_uint_t + loop = 0; + + lfds700_pal_atom_t LFDS700_PAL_ALIGN(LFDS700_PAL_ALIGN_SINGLE_POINTER) + exchange, + compare; + + struct test_lfds700_pal_atomic_cas_state + *atcs; + + struct util_thread_starter_thread_state + *tsts; + + LFDS700_MISC_BARRIER_LOAD; + + assert( util_thread_starter_thread_state != NULL ); + + tsts = (struct util_thread_starter_thread_state *) util_thread_starter_thread_state; + atcs = (struct test_lfds700_pal_atomic_cas_state *) tsts->thread_user_state; + + util_thread_starter_ready_and_wait( tsts ); + + while( loop++ < 10000000 ) + { + compare = *atcs->shared_counter; + + do + { + exchange = compare + 1; + LFDS700_PAL_ATOMIC_CAS( atcs->shared_counter, &compare, exchange, LFDS700_MISC_CAS_STRENGTH_WEAK, result ); + } + while( result == 0 ); + + atcs->local_counter++; + } + + LFDS700_MISC_BARRIER_STORE; + + lfds700_misc_force_store(); + + return( (test_pal_thread_return_t) EXIT_SUCCESS ); +} + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_porting_abstraction_layer_atomic_dcas.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_porting_abstraction_layer_atomic_dcas.c new file mode 100644 index 0000000000..4973e73770 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_porting_abstraction_layer_atomic_dcas.c @@ -0,0 +1,177 @@ +/***** includes *****/ +#include "internal.h" + +/***** structs *****/ +struct test_lfds700_pal_atomic_dwcas_state +{ + lfds700_pal_uint_t + local_counter; + + lfds700_pal_atom_t volatile + (*shared_counter)[2]; +}; + +/***** private prototyps *****/ +static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_dwcas( void *util_thread_starter_thread_state ); + + + + + +/****************************************************************************/ +void test_lfds700_pal_atomic_dwcas( struct lfds700_list_asu_state *list_of_logical_processors ) +{ + lfds700_pal_uint_t + local_total = 0, + loop, + number_logical_processors; + + lfds700_pal_atom_t volatile LFDS700_PAL_ALIGN(LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES) + shared_counter[2] = { 0, 0 }; + + struct lfds700_list_asu_element + *lasue; + + struct test_pal_logical_processor + *lp; + + struct util_thread_starter_state + *tts; + + struct test_lfds700_pal_atomic_dwcas_state + *atds; + + test_pal_thread_state_t + *thread_handles; + + assert( list_of_logical_processors != NULL ); + + /* TRD : here we test pal_dwcas + + we run one thread per CPU + we use pal_dwcas() to increment a shared counter + every time a thread successfully increments the counter, + it increments a thread local counter + the threads run for ten seconds + after the threads finish, we total the local counters + they should equal the shared counter + */ + + internal_display_test_name( "Atomic DWCAS" ); + + lfds700_list_asu_query( list_of_logical_processors, LFDS700_LIST_ASU_QUERY_GET_POTENTIALLY_INACCURATE_COUNT, NULL, (void **) &number_logical_processors ); + + atds = util_malloc_wrapper( sizeof(struct test_lfds700_pal_atomic_dwcas_state) * number_logical_processors ); + + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + { + (atds+loop)->shared_counter = &shared_counter; + (atds+loop)->local_counter = 0; + } + + thread_handles = util_malloc_wrapper( sizeof(test_pal_thread_state_t) * number_logical_processors ); + + util_thread_starter_new( &tts, number_logical_processors ); + + LFDS700_MISC_BARRIER_STORE; + + lfds700_misc_force_store(); + + loop = 0; + lasue = NULL; + + while( LFDS700_LIST_ASU_GET_START_AND_THEN_NEXT(*list_of_logical_processors, lasue) ) + { + lp = LFDS700_LIST_ASU_GET_VALUE_FROM_ELEMENT( *lasue ); + util_thread_starter_start( tts, &thread_handles[loop], loop, lp, thread_dwcas, atds+loop ); + loop++; + } + + util_thread_starter_run( tts ); + + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + test_pal_thread_wait( thread_handles[loop] ); + + util_thread_starter_delete( tts ); + + free( thread_handles ); + + // TRD : results + LFDS700_MISC_BARRIER_LOAD; + + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + local_total += (atds+loop)->local_counter; + + if( local_total == shared_counter[0] ) + puts( "passed" ); + + if( local_total != shared_counter[0] ) + { + printf( "%llu != %llu\n", (int long long unsigned) local_total, (int long long unsigned) shared_counter[0] ); + puts( "failed" ); + exit( EXIT_FAILURE ); + } + + // TRD : cleanup + free( atds ); + + return; +} + +#pragma warning( disable : 4702 ) + + + + + +/****************************************************************************/ +static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_dwcas( void *util_thread_starter_thread_state ) +{ + char unsigned + result; + + lfds700_pal_uint_t + loop = 0; + + lfds700_pal_atom_t LFDS700_PAL_ALIGN(LFDS700_PAL_ALIGN_DOUBLE_POINTER) + exchange[2], + compare[2]; + + struct test_lfds700_pal_atomic_dwcas_state + *atds; + + struct util_thread_starter_thread_state + *tsts; + + assert( util_thread_starter_thread_state != NULL ); + + tsts = (struct util_thread_starter_thread_state *) util_thread_starter_thread_state; + atds = (struct test_lfds700_pal_atomic_dwcas_state *) tsts->thread_user_state; + + LFDS700_MISC_BARRIER_LOAD; + + util_thread_starter_ready_and_wait( tsts ); + + while( loop++ < 10000000 ) + { + compare[0] = (*atds->shared_counter)[0]; + compare[1] = (*atds->shared_counter)[1]; + + do + { + exchange[0] = compare[0] + 1; + exchange[1] = compare[1]; + LFDS700_PAL_ATOMIC_DWCAS( atds->shared_counter, compare, exchange, LFDS700_MISC_CAS_STRENGTH_WEAK, result ); + } + while( result == 0 ); + + atds->local_counter++; + } + + LFDS700_MISC_BARRIER_STORE; + + lfds700_misc_force_store(); + + return( (test_pal_thread_return_t) EXIT_SUCCESS ); +} + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_porting_abstraction_layer_atomic_exchange.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_porting_abstraction_layer_atomic_exchange.c new file mode 100644 index 0000000000..ba6366e524 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_porting_abstraction_layer_atomic_exchange.c @@ -0,0 +1,333 @@ +/***** includes *****/ +#include "internal.h" + +/***** structs *****/ +struct test_state +{ + lfds700_pal_uint_t + counter, + *counter_array, + number_elements, + number_logical_processors; + + lfds700_pal_uint_t volatile + *shared_exchange; +}; + +/***** private prototyps *****/ +static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_exchange( void *util_thread_starter_thread_state ); +static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_atomic_exchange( void *util_thread_starter_thread_state ); + + + + + +/****************************************************************************/ +void test_lfds700_pal_atomic_exchange( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ) +{ + enum flag + atomic_exchange_success_flag = RAISED, + exchange_success_flag = RAISED; + + lfds700_pal_uint_t + loop, + *merged_counter_arrays, + number_elements, + number_logical_processors, + subloop; + + lfds700_pal_uint_t volatile LFDS700_PAL_ALIGN(LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES) + exchange; + + struct lfds700_list_asu_element + *lasue; + + struct test_state + *ts; + + struct test_pal_logical_processor + *lp; + + struct util_thread_starter_state + *tts; + + test_pal_thread_state_t + *thread_handles; + + assert( list_of_logical_processors != NULL ); + // TRD : memory_in_megabytes can be any value in its range + + /* TRD : here we test pal_atomic_exchange + + we have one thread per logical core + there is one variable which every thread will exchange to/from + we know the number of logical cores + the threads have a counter each, which begins with their logical core number plus one + (plus one because the exchange counter begins with 0 already in place) + (e.g. thread 0 begins with its counter at 1, thread 1 begins with its counter at 2, etc) + + there is an array per thread of 1 million elements, each a counter, set to 0 + + when running, each thread increments its counter by the number of threads + the threads busy loop, exchanging + every time aa thread pulls a number off the central, shared exchange variable, + it increments the counter for that variable in its thread-local counter array + + (we're not using a global array, because we'd have to be atomic in our increments, + which is a slow-down we don't want) + + at the end, we merge all the counter arrays and if the frequency for a counter is a value + other than 1, the exchange was not atomic + + we perform the test twice, once with pal_atomic_exchange, once with a non-atomic exchange + + we expect the atomic to pass and the non-atomic to fail + */ + + internal_display_test_name( "Atomic exchange" ); + + lfds700_list_asu_query( list_of_logical_processors, LFDS700_LIST_ASU_QUERY_GET_POTENTIALLY_INACCURATE_COUNT, NULL, (void **) &number_logical_processors ); + + number_elements = ( memory_in_megabytes * ONE_MEGABYTE_IN_BYTES ) / ( sizeof(lfds700_pal_uint_t) * (number_logical_processors + 1) ); + + merged_counter_arrays = util_malloc_wrapper( sizeof(lfds700_pal_uint_t) * number_elements ); + + for( loop = 0 ; loop < number_elements ; loop++ ) + *(merged_counter_arrays+loop) = 0; + + ts = util_malloc_wrapper( sizeof(struct test_state) * number_logical_processors ); + + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + { + (ts+loop)->counter = loop + 1; + (ts+loop)->counter_array = util_malloc_wrapper( sizeof(lfds700_pal_uint_t) * number_elements ); + for( subloop = 0 ; subloop < number_elements ; subloop++ ) + *((ts+loop)->counter_array+subloop) = 0; + (ts+loop)->number_logical_processors = number_logical_processors; + (ts+loop)->shared_exchange = &exchange; + (ts+loop)->number_elements = number_elements; + } + + exchange = 0; + + thread_handles = util_malloc_wrapper( sizeof(test_pal_thread_state_t) * number_logical_processors ); + + // TRD : non-atomic + util_thread_starter_new( &tts, number_logical_processors ); + + LFDS700_MISC_BARRIER_STORE; + + lfds700_misc_force_store(); + + loop = 0; + lasue = NULL; + + while( LFDS700_LIST_ASU_GET_START_AND_THEN_NEXT(*list_of_logical_processors, lasue) ) + { + lp = LFDS700_LIST_ASU_GET_VALUE_FROM_ELEMENT( *lasue ); + util_thread_starter_start( tts, &thread_handles[loop], loop, lp, thread_exchange, ts+loop ); + loop++; + } + + util_thread_starter_run( tts ); + + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + test_pal_thread_wait( thread_handles[loop] ); + + util_thread_starter_delete( tts ); + + LFDS700_MISC_BARRIER_LOAD; + + for( loop = 0 ; loop < number_elements ; loop++ ) + for( subloop = 0 ; subloop < number_logical_processors ; subloop++ ) + *(merged_counter_arrays+loop) += *( (ts+subloop)->counter_array+loop ); + + /* TRD : the worker threads exit when their per-thread counter exceeds 1,000,000 + as such the final number_logical_processors numbers are not read + we could change the threads to exit when the number they read exceeds 1,000,000 + but then we'd need an if() in their work-loop, + and we need to go as fast as possible + */ + + for( loop = 0 ; loop < number_elements - number_logical_processors ; loop++ ) + if( *(merged_counter_arrays+loop) != 1 ) + exchange_success_flag = LOWERED; + + // TRD : now for atomic exchange - we need to re-init the data structures + + for( loop = 0 ; loop < number_elements ; loop++ ) + *(merged_counter_arrays+loop) = 0; + + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + for( subloop = 0 ; subloop < number_elements ; subloop++ ) + *((ts+loop)->counter_array+subloop) = 0; + + exchange = 0; + + util_thread_starter_new( &tts, number_logical_processors ); + + LFDS700_MISC_BARRIER_STORE; + + lfds700_misc_force_store(); + + loop = 0; + lasue = NULL; + + while( LFDS700_LIST_ASU_GET_START_AND_THEN_NEXT(*list_of_logical_processors, lasue) ) + { + lp = LFDS700_LIST_ASU_GET_VALUE_FROM_ELEMENT( *lasue ); + util_thread_starter_start( tts, &thread_handles[loop], loop, lp, thread_atomic_exchange, ts+loop ); + loop++; + } + + util_thread_starter_run( tts ); + + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + test_pal_thread_wait( thread_handles[loop] ); + + for( loop = 0 ; loop < number_elements ; loop++ ) + for( subloop = 0 ; subloop < number_logical_processors ; subloop++ ) + *(merged_counter_arrays+loop) += *( (ts+subloop)->counter_array+loop ); + + for( loop = 0 ; loop < number_elements - number_logical_processors ; loop++ ) + if( *(merged_counter_arrays+loop) != 1 ) + atomic_exchange_success_flag = LOWERED; + + // TRD : cleanup + free( merged_counter_arrays ); + + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + free( (ts+loop)->counter_array ); + + util_thread_starter_delete( tts ); + free( thread_handles ); + free( ts ); + + /* TRD : results + + on a single core, atomic and non-atomic exchange should both work + + if we find our non-atomic test passes, then we can't really say anything + about whether or not the atomic test is really working + */ + + LFDS700_MISC_BARRIER_LOAD; + + if( number_logical_processors == 1 ) + { + if( exchange_success_flag == RAISED and atomic_exchange_success_flag == RAISED ) + puts( "passed" ); + + if( exchange_success_flag != RAISED or atomic_exchange_success_flag != RAISED ) + puts( "failed (atomic and non-atomic both failed)" ); + } + + if( number_logical_processors >= 2 ) + { + if( atomic_exchange_success_flag == RAISED and exchange_success_flag == LOWERED ) + puts( "passed" ); + + if( atomic_exchange_success_flag == RAISED and exchange_success_flag == RAISED ) + puts( "indeterminate (atomic and non-atomic both passed)" ); + + if( atomic_exchange_success_flag == LOWERED ) + { + puts( "failed (atomic failed)" ); + exit( EXIT_FAILURE ); + } + } + + return; +} + + + + + +/****************************************************************************/ +static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_exchange( void *util_thread_starter_thread_state ) +{ + lfds700_pal_uint_t + local_counter, + exchange; + + struct test_state + *ts; + + struct util_thread_starter_thread_state + *tsts; + + LFDS700_MISC_BARRIER_LOAD; + + assert( util_thread_starter_thread_state != NULL ); + + tsts = (struct util_thread_starter_thread_state *) util_thread_starter_thread_state; + ts = (struct test_state *) tsts->thread_user_state; + + util_thread_starter_ready_and_wait( tsts ); + + local_counter = ts->counter; + + while( local_counter < ts->number_elements ) + { + exchange = *ts->shared_exchange; + *ts->shared_exchange = local_counter; + + ( *(ts->counter_array + exchange) )++; + + local_counter += ts->number_logical_processors; + } + + LFDS700_MISC_BARRIER_STORE; + + lfds700_misc_force_store(); + + return( (test_pal_thread_return_t) EXIT_SUCCESS ); +} + + + + + +/****************************************************************************/ +static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_atomic_exchange( void *util_thread_starter_thread_state ) +{ + lfds700_pal_uint_t + local_counter, + exchange; + + struct test_state + *ts; + + struct util_thread_starter_thread_state + *tsts; + + LFDS700_MISC_BARRIER_LOAD; + + assert( util_thread_starter_thread_state != NULL ); + + tsts = (struct util_thread_starter_thread_state *) util_thread_starter_thread_state; + ts = (struct test_state *) tsts->thread_user_state; + + util_thread_starter_ready_and_wait( tsts ); + + local_counter = ts->counter; + + while( local_counter < ts->number_elements ) + { + exchange = local_counter; + + LFDS700_PAL_ATOMIC_EXCHANGE( ts->shared_exchange, &exchange ); + + ( *(ts->counter_array + exchange) )++; + + local_counter += ts->number_logical_processors; + } + + LFDS700_MISC_BARRIER_STORE; + + lfds700_misc_force_store(); + + return( (test_pal_thread_return_t) EXIT_SUCCESS ); +} + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_queue.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_queue.c new file mode 100644 index 0000000000..8e41b01b5d --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_queue.c @@ -0,0 +1,35 @@ +/***** includes *****/ +#include "internal.h" + + + + + +/****************************************************************************/ +#pragma warning( disable : 4127 ) // TRD : disables MSVC warning for condition expressions being const + +void test_lfds700_queue( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ) +{ + assert( list_of_logical_processors != NULL ); + // TRD : memory_in_megabytes can be any value in its range + + if( LFDS700_MISC_ATOMIC_SUPPORT_DWCAS ) + { + printf( "\n" + "Queue Tests\n" + "===========\n" ); + + test_lfds700_queue_alignment(); + test_lfds700_queue_enqueuing( list_of_logical_processors, memory_in_megabytes ); + test_lfds700_queue_dequeuing( list_of_logical_processors, memory_in_megabytes ); + test_lfds700_queue_enqueuing_and_dequeuing( list_of_logical_processors ); + test_lfds700_queue_rapid_enqueuing_and_dequeuing( list_of_logical_processors, memory_in_megabytes ); + test_lfds700_queue_enqueuing_and_dequeuing_with_free( list_of_logical_processors, memory_in_megabytes ); + test_lfds700_queue_enqueuing_with_malloc_and_dequeuing_with_free( list_of_logical_processors ); + } + + return; +} + +#pragma warning( default : 4127 ) + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_queue_alignment.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_queue_alignment.c new file mode 100644 index 0000000000..6f723825ea --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_queue_alignment.c @@ -0,0 +1,55 @@ +/***** includes *****/ +#include "internal.h" + + + + + +/****************************************************************************/ +#pragma warning( disable : 4127 ) // TRD : disables MSVC warning for condition expressions being const + +void test_lfds700_queue_alignment() +{ + enum lfds700_misc_validity + dvs = LFDS700_MISC_VALIDITY_VALID; + + /* TRD : these are compile time checks + but we do them here because this is a test programme + and it should indicate issues to users when it is *run*, + not when it is compiled, because a compile error normally + indicates a problem with the code itself and so is misleading + */ + + internal_display_test_name( "Alignment" ); + + + + // TRD : struct lfds700_queue_element + if( offsetof(struct lfds700_queue_element,next) % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES != 0 ) + dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; + + if( offsetof(struct lfds700_queue_element,key) % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES != 0 ) + dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; + + + + // TRD : struct lfds700_queue_state + if( offsetof(struct lfds700_queue_state,enqueue) % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES != 0 ) + dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; + + if( offsetof(struct lfds700_queue_state,dequeue) % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES != 0 ) + dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; + + if( offsetof(struct lfds700_queue_state,user_state) % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES != 0 ) + dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; + + + + // TRD : print the test result + internal_display_test_result( 1, "queue", dvs ); + + return; +} + +#pragma warning( default : 4127 ) + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_queue_bounded_singleconsumer_singleproducer.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_queue_bounded_singleconsumer_singleproducer.c new file mode 100644 index 0000000000..4c660ab3e1 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_queue_bounded_singleconsumer_singleproducer.c @@ -0,0 +1,25 @@ +/***** includes *****/ +#include "internal.h" + + + + + +/****************************************************************************/ +void test_lfds700_queue_bss( struct lfds700_list_asu_state *list_of_logical_processors ) +{ + assert( list_of_logical_processors != NULL ); + // TRD : memory_in_megabytes can be any value in its range + + printf( "\n" + "Queue (bounded, single consumer, single producer) Tests\n" + "=======================================================\n" ); + + // TRD : no alignment checks are required for queue_bss + test_lfds700_queue_bss_enqueuing(); + test_lfds700_queue_bss_dequeuing(); + test_lfds700_queue_bss_enqueuing_and_dequeuing( list_of_logical_processors ); + + return; +} + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_queue_bounded_singleconsumer_singleproducer_dequeuing.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_queue_bounded_singleconsumer_singleproducer_dequeuing.c new file mode 100644 index 0000000000..971555c443 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_queue_bounded_singleconsumer_singleproducer_dequeuing.c @@ -0,0 +1,61 @@ +/***** includes *****/ +#include "internal.h" + + + + + +/****************************************************************************/ +void test_lfds700_queue_bss_dequeuing() +{ + enum lfds700_misc_validity + dvs = LFDS700_MISC_VALIDITY_VALID; + + lfds700_pal_uint_t + loop; + + struct lfds700_queue_bss_element + element_array[128]; + + struct lfds700_queue_bss_state + qs; + + struct lfds700_misc_validation_info + vi; + + void + *value; + + /* TRD : create an empty queue + enqueue 128 elements + then dequeue the elements, in the same thread - we're API testing + it's a single producer queue, so we just do this in our current thread + since we're enqueuing and dequeuing in the same thread, + + */ + + internal_display_test_name( "Dequeuing" ); + + lfds700_queue_bss_init_valid_on_current_logical_core( &qs, element_array, 128, NULL ); + + for( loop = 0 ; loop < 127 ; loop++ ) + lfds700_queue_bss_enqueue( &qs, NULL, (void *) loop ); + + for( loop = 0 ; loop < 127 ; loop++ ) + { + lfds700_queue_bss_dequeue( &qs, NULL, &value ); + if( (lfds700_pal_uint_t) value != 127 - loop ) + dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; + } + + vi.min_elements = vi.max_elements = 0; + + lfds700_queue_bss_query( &qs, LFDS700_QUEUE_BSS_QUERY_VALIDATE, &vi, &dvs ); + + lfds700_queue_bss_cleanup( &qs, NULL ); + + internal_display_test_result( 1, "queue_bss", dvs ); + + return; +} + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_queue_bounded_singleconsumer_singleproducer_enqueuing.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_queue_bounded_singleconsumer_singleproducer_enqueuing.c new file mode 100644 index 0000000000..807337864a --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_queue_bounded_singleconsumer_singleproducer_enqueuing.c @@ -0,0 +1,59 @@ +/***** includes *****/ +#include "internal.h" + + + + + +/****************************************************************************/ +void test_lfds700_queue_bss_enqueuing() +{ + enum lfds700_misc_validity + dvs = LFDS700_MISC_VALIDITY_VALID; + + int + rv; + + lfds700_pal_uint_t + loop; + + struct lfds700_queue_bss_element + element_array[128]; + + struct lfds700_queue_bss_state + qs; + + struct lfds700_misc_validation_info + vi; + + /* TRD : create an empty queue + enqueue 128 elements + it's a single producer queue, so we just do this in our current thread + it's an API test + */ + + internal_display_test_name( "Enqueuing" ); + + lfds700_queue_bss_init_valid_on_current_logical_core( &qs, element_array, 128, NULL ); + + for( loop = 0 ; loop < 127 ; loop++ ) + if( 1 != lfds700_queue_bss_enqueue(&qs, NULL, (void *) loop) ) + dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; + + // TRD : at this point enqueuing one more should return 0 + rv = lfds700_queue_bss_enqueue( &qs, NULL, (void *) loop ); + + if( rv != 0 ) + dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; + + vi.min_elements = vi.max_elements = 127; + + lfds700_queue_bss_query( &qs, LFDS700_QUEUE_BSS_QUERY_VALIDATE, &vi, &dvs ); + + lfds700_queue_bss_cleanup( &qs, NULL ); + + internal_display_test_result( 1, "queue_bss", dvs ); + + return; +} + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_queue_bounded_singleconsumer_singleproducer_enqueuing_and_dequeuing.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_queue_bounded_singleconsumer_singleproducer_enqueuing_and_dequeuing.c new file mode 100644 index 0000000000..ad218609fd --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_queue_bounded_singleconsumer_singleproducer_enqueuing_and_dequeuing.c @@ -0,0 +1,260 @@ +/***** includes *****/ +#include "internal.h" + +/***** structs *****/ +struct test_state +{ + enum flag + error_flag; + + struct lfds700_queue_bss_state + *qs; +}; + +/***** private prototypes *****/ +static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_enqueuer( void *util_thread_starter_thread_state ); +static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_dequeuer( void *util_thread_starter_thread_state ); + + + + + +/****************************************************************************/ +void test_lfds700_queue_bss_enqueuing_and_dequeuing( struct lfds700_list_asu_state *list_of_logical_processors ) +{ + enum lfds700_misc_validity + dvs = LFDS700_MISC_VALIDITY_VALID; + + lfds700_pal_uint_t + loop, + number_logical_processors, + subloop; + + struct lfds700_list_asu_element + *lasue; + + struct lfds700_queue_bss_element + element_array[4]; + + struct lfds700_queue_bss_state + qs; + + struct test_pal_logical_processor + *lp, + *lp_first; + + struct util_thread_starter_state + *tts; + + struct test_state + *ts; + + test_pal_thread_state_t + *thread_handles; + + assert( list_of_logical_processors != NULL ); + + /* TRD : so, this is the real test + problem is, because we use memory barriers only + and we only support one producer and one consumer + we need to ensure these threads are on different physical cores + if they're on the same core, the code would work even without memory barriers + + problem is, in the test application, we only know the *number* of logical cores + obtaining topology information adds a great deal of complexity to the test app + and makes porting much harder + + so, we know how many logical cores there are; my thought is to partially + permutate over them - we always run the producer on core 0, but we iterate + over the other logical cores, running the test once each time, with the + consumer being run on core 0, then core 1, then core 2, etc + + (we run on core 0 for the single-cpu case; it's redundent, since a single + logical core running both producer and consumer will work, but otherwise + we have to skip the test, which is confusing for the user) + + the test is one thread enqueuing and one thread dequeuing for two seconds + */ + + lfds700_list_asu_query( list_of_logical_processors, LFDS700_LIST_ASU_QUERY_GET_POTENTIALLY_INACCURATE_COUNT, NULL, (void **) &number_logical_processors ); + + internal_display_test_name( "Enqueuing and dequeuing (%d seconds)", number_logical_processors * 2 ); + + ts = util_malloc_wrapper( sizeof(struct test_state) * 2 ); + + for( loop = 0 ; loop < 2 ; loop++ ) + { + (ts+loop)->qs = &qs; + (ts+loop)->error_flag = LOWERED; + } + + thread_handles = util_malloc_wrapper( sizeof(test_pal_thread_state_t) * 2 ); + + /* TRD : producer always on core 0 + iterate over the other cores with consumer + */ + + lasue = LFDS700_LIST_ASU_GET_START( *list_of_logical_processors ); + lp_first = LFDS700_LIST_ASU_GET_VALUE_FROM_ELEMENT( *lasue ); + + while( lasue != NULL ) + { + lp = LFDS700_LIST_ASU_GET_VALUE_FROM_ELEMENT( *lasue ); + + lfds700_queue_bss_init_valid_on_current_logical_core( &qs, element_array, 4, NULL ); + + util_thread_starter_new( &tts, 2 ); + + LFDS700_MISC_BARRIER_STORE; + + lfds700_misc_force_store(); + + util_thread_starter_start( tts, &thread_handles[0], 0, lp_first, thread_enqueuer, ts ); + util_thread_starter_start( tts, &thread_handles[1], 1, lp, thread_dequeuer, ts+1 ); + + util_thread_starter_run( tts ); + + for( subloop = 0 ; subloop < 2 ; subloop++ ) + test_pal_thread_wait( thread_handles[subloop] ); + + util_thread_starter_delete( tts ); + + LFDS700_MISC_BARRIER_LOAD; + + lfds700_queue_bss_cleanup( &qs, NULL ); + + lasue = LFDS700_LIST_ASU_GET_NEXT( *lasue ); + } + + if( (ts+1)->error_flag == RAISED ) + dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; + + free( thread_handles ); + + free( ts ); + + internal_display_test_result( 1, "queue_bss", dvs ); + + return; +} + + + + + +/****************************************************************************/ +static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_enqueuer( void *util_thread_starter_thread_state ) +{ + int + rv; + + lfds700_pal_uint_t + datum = 0, + time_loop = 0; + + struct test_state + *ts; + + struct util_thread_starter_thread_state + *tsts; + + time_t + current_time, + start_time; + + LFDS700_MISC_MAKE_VALID_ON_CURRENT_LOGICAL_CORE_INITS_COMPLETED_BEFORE_NOW_ON_ANY_OTHER_LOGICAL_CORE; + + assert( util_thread_starter_thread_state != NULL ); + + tsts = (struct util_thread_starter_thread_state *) util_thread_starter_thread_state; + ts = (struct test_state *) tsts->thread_user_state; + + util_thread_starter_ready_and_wait( tsts ); + + current_time = start_time = time( NULL ); + + while( current_time < start_time + 2 ) + { + rv = lfds700_queue_bss_enqueue( ts->qs, NULL, (void *) datum ); + + if( rv == 1 ) + if( ++datum == 4 ) + datum = 0; + + if( time_loop++ == TIME_LOOP_COUNT ) + { + time_loop = 0; + time( ¤t_time ); + } + } + + LFDS700_MISC_BARRIER_STORE; + + lfds700_misc_force_store(); + + return( (test_pal_thread_return_t) EXIT_SUCCESS ); +} + + + + + +/****************************************************************************/ +static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_dequeuer( void *util_thread_starter_thread_state ) +{ + int + rv; + + lfds700_pal_uint_t + datum, + expected_datum = 0, + time_loop = 0; + + struct test_state + *ts; + + struct util_thread_starter_thread_state + *tsts; + + time_t + current_time, + start_time; + + LFDS700_MISC_BARRIER_LOAD; + + assert( util_thread_starter_thread_state != NULL ); + + tsts = (struct util_thread_starter_thread_state *) util_thread_starter_thread_state; + ts = (struct test_state *) tsts->thread_user_state; + + util_thread_starter_ready_and_wait( tsts ); + + current_time = start_time = time( NULL ); + + while( current_time < start_time + 2 ) + { + rv = lfds700_queue_bss_dequeue( ts->qs, NULL, (void *) &datum ); + + if( rv == 1 ) + { + if( datum != expected_datum ) + ts->error_flag = RAISED; + + if( ++expected_datum == 4 ) + expected_datum = 0; + } + + if( time_loop++ == TIME_LOOP_COUNT ) + { + time_loop = 0; + time( ¤t_time ); + } + } + + LFDS700_MISC_BARRIER_STORE; + + lfds700_misc_force_store(); + + return( (test_pal_thread_return_t) EXIT_SUCCESS ); +} + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_queue_dequeuing.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_queue_dequeuing.c new file mode 100644 index 0000000000..74f271d320 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_queue_dequeuing.c @@ -0,0 +1,215 @@ +/***** includes *****/ +#include "internal.h" + +/***** structs *****/ +struct test_state +{ + enum flag + error_flag; + + struct lfds700_queue_state + *qs; +}; + +struct test_element +{ + struct lfds700_queue_element + qe; +}; + +/***** private prototypes *****/ +static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_simple_dequeuer( void *util_thread_starter_thread_state ); + + + + + +/****************************************************************************/ +void test_lfds700_queue_dequeuing( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ) +{ + enum lfds700_misc_validity + dvs = LFDS700_MISC_VALIDITY_VALID; + + lfds700_pal_uint_t + loop, + number_elements_with_dummy_element, + number_elements_without_dummy_element, + number_logical_processors; + + struct lfds700_list_asu_element + *lasue; + + struct lfds700_misc_prng_state + ps; + + struct lfds700_queue_state + qs; + + struct lfds700_misc_validation_info + vi = { 0, 0 }; + + struct test_pal_logical_processor + *lp; + + struct util_thread_starter_state + *tts; + + struct test_element + *te_array; + + struct test_state + *ts; + + test_pal_thread_state_t + *thread_handles; + + assert( list_of_logical_processors != NULL ); + // TRD : memory_in_megabytes can be any value in its range + + /* TRD : create a queue, add 1,000,000 elements + + use a single thread to enqueue every element + each elements user data is an incrementing counter + + then run one thread per CPU + where each busy-works dequeuing + + when an element is dequeued, we check (on a per-thread basis) the + value dequeued is greater than the element previously dequeued + + note we have no variation in the test for CAS+GC vs DWCAS + this is because all we do is dequeue + what we actually want to stress test is the queue + not CAS + so it's better to let the dequeue run as fast as possible + */ + + internal_display_test_name( "Dequeuing" ); + + lfds700_list_asu_query( list_of_logical_processors, LFDS700_LIST_ASU_QUERY_GET_POTENTIALLY_INACCURATE_COUNT, NULL, (void **) &number_logical_processors ); + + lfds700_misc_prng_init( &ps ); + + number_elements_with_dummy_element = ( memory_in_megabytes * ONE_MEGABYTE_IN_BYTES ) / sizeof(struct test_element); + number_elements_without_dummy_element = number_elements_with_dummy_element - 1; + + te_array = util_aligned_malloc( sizeof(struct test_element) * number_elements_with_dummy_element, LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES ); + + lfds700_queue_init_valid_on_current_logical_core( &qs, &(te_array + number_elements_without_dummy_element)->qe, &ps, NULL ); + + for( loop = 0 ; loop < number_elements_without_dummy_element ; loop++ ) + { + LFDS700_QUEUE_SET_VALUE_IN_ELEMENT( (te_array+loop)->qe, loop ); + lfds700_queue_enqueue( &qs, &(te_array+loop)->qe, &ps ); + } + + ts = util_malloc_wrapper( sizeof(struct test_state) * number_logical_processors ); + + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + { + (ts+loop)->qs = &qs; + (ts+loop)->error_flag = LOWERED; + } + + thread_handles = util_malloc_wrapper( sizeof(test_pal_thread_state_t) * number_logical_processors ); + + util_thread_starter_new( &tts, number_logical_processors ); + + LFDS700_MISC_BARRIER_STORE; + + lfds700_misc_force_store(); + + loop = 0; + lasue = NULL; + + while( LFDS700_LIST_ASU_GET_START_AND_THEN_NEXT(*list_of_logical_processors, lasue) ) + { + lp = LFDS700_LIST_ASU_GET_VALUE_FROM_ELEMENT( *lasue ); + util_thread_starter_start( tts, &thread_handles[loop], loop, lp, thread_simple_dequeuer, ts+loop ); + loop++; + } + + util_thread_starter_run( tts ); + + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + test_pal_thread_wait( thread_handles[loop] ); + + util_thread_starter_delete( tts ); + + free( thread_handles ); + + LFDS700_MISC_BARRIER_LOAD; + + // TRD : check queue is empty + lfds700_queue_query( &qs, LFDS700_QUEUE_QUERY_SINGLETHREADED_VALIDATE, &vi, &dvs ); + + // TRD : check for raised error flags + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + if( (ts+loop)->error_flag == RAISED ) + dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; + + free( ts ); + + util_aligned_free( te_array ); + + lfds700_queue_cleanup( &qs, NULL ); + + internal_display_test_result( 1, "queue", dvs ); + + return; +} + + + + + +/****************************************************************************/ +static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_simple_dequeuer( void *util_thread_starter_thread_state ) +{ + lfds700_pal_uint_t + *prev_value, + *value; + + struct lfds700_misc_prng_state + ps; + + struct lfds700_queue_element + *qe; + + struct test_state + *ts; + + struct util_thread_starter_thread_state + *tsts; + + LFDS700_MISC_MAKE_VALID_ON_CURRENT_LOGICAL_CORE_INITS_COMPLETED_BEFORE_NOW_ON_ANY_OTHER_LOGICAL_CORE; + + assert( util_thread_starter_thread_state != NULL ); + + tsts = (struct util_thread_starter_thread_state *) util_thread_starter_thread_state; + ts = (struct test_state *) tsts->thread_user_state; + + lfds700_misc_prng_init( &ps ); + + lfds700_queue_dequeue( ts->qs, &qe, &ps ); + prev_value = LFDS700_QUEUE_GET_VALUE_FROM_ELEMENT( *qe ); + + util_thread_starter_ready_and_wait( tsts ); + + while( lfds700_queue_dequeue(ts->qs, &qe, &ps) ) + { + value = LFDS700_QUEUE_GET_VALUE_FROM_ELEMENT( *qe ); + + if( value <= prev_value ) + ts->error_flag = RAISED; + + prev_value = value; + } + + LFDS700_MISC_BARRIER_STORE; + + lfds700_misc_force_store(); + + return( (test_pal_thread_return_t) EXIT_SUCCESS ); +} + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_queue_enqueuing.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_queue_enqueuing.c new file mode 100644 index 0000000000..89ccf30fcb --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_queue_enqueuing.c @@ -0,0 +1,239 @@ +/***** includes *****/ +#include "internal.h" + +/***** structs *****/ +struct test_state +{ + lfds700_pal_uint_t + number_elements, + thread_number; + + struct lfds700_queue_state + *qs; + + struct test_element + *te_array; +}; + +struct test_element +{ + struct lfds700_queue_element + qe; + + lfds700_pal_uint_t + counter, + thread_number; +}; + +/***** private prototypes *****/ +static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_simple_enqueuer( void *util_thread_starter_thread_state ); + + + + + +/****************************************************************************/ +void test_lfds700_queue_enqueuing( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ) +{ + enum lfds700_misc_validity + dvs = LFDS700_MISC_VALIDITY_VALID; + + lfds700_pal_uint_t + *per_thread_counters, + loop, + number_elements, + number_logical_processors; + + struct lfds700_list_asu_element + *lasue; + + struct lfds700_misc_prng_state + ps; + + struct lfds700_queue_element + dummy_qe, + *qe; + + struct lfds700_queue_state + qs; + + struct lfds700_misc_validation_info + vi; + + struct test_pal_logical_processor + *lp; + + struct util_thread_starter_state + *tts; + + struct test_element + *te; + + struct test_state + *ts; + + test_pal_thread_state_t + *thread_handles; + + assert( list_of_logical_processors != NULL ); + // TRD : memory_in_megabytes can be any value in its range + + /* TRD : create an empty queue + then run one thread per CPU + where each thread busy-works, enqueuing elements from a freelist (one local freelist per thread) + until 100000 elements are enqueued, per thread + each element's void pointer of user data is a struct containing thread number and element number + where element_number is a thread-local counter starting at 0 + + when we're done, we check that all the elements are present + and increment on a per-thread basis + */ + + internal_display_test_name( "Enqueuing" ); + + lfds700_list_asu_query( list_of_logical_processors, LFDS700_LIST_ASU_QUERY_GET_POTENTIALLY_INACCURATE_COUNT, NULL, (void **) &number_logical_processors ); + + lfds700_misc_prng_init( &ps ); + + number_elements = ( memory_in_megabytes * ONE_MEGABYTE_IN_BYTES ) / ( sizeof(struct test_element) * number_logical_processors ); + + lfds700_queue_init_valid_on_current_logical_core( &qs, &dummy_qe, &ps, NULL ); + + ts = util_malloc_wrapper( sizeof(struct test_state) * number_logical_processors ); + + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + { + (ts+loop)->qs = &qs; + (ts+loop)->thread_number = loop; + (ts+loop)->number_elements = number_elements; + } + + thread_handles = util_malloc_wrapper( sizeof(test_pal_thread_state_t) * number_logical_processors ); + + util_thread_starter_new( &tts, number_logical_processors ); + + LFDS700_MISC_BARRIER_STORE; + + lfds700_misc_force_store(); + + loop = 0; + lasue = NULL; + + while( LFDS700_LIST_ASU_GET_START_AND_THEN_NEXT(*list_of_logical_processors, lasue) ) + { + lp = LFDS700_LIST_ASU_GET_VALUE_FROM_ELEMENT( *lasue ); + util_thread_starter_start( tts, &thread_handles[loop], loop, lp, thread_simple_enqueuer, ts+loop ); + loop++; + } + + util_thread_starter_run( tts ); + + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + test_pal_thread_wait( thread_handles[loop] ); + + util_thread_starter_delete( tts ); + + free( thread_handles ); + + LFDS700_MISC_BARRIER_LOAD; + + /* TRD : first, validate the queue + + then dequeue + we expect to find element numbers increment on a per thread basis + */ + + vi.min_elements = vi.max_elements = number_elements * number_logical_processors; + + lfds700_queue_query( &qs, LFDS700_QUEUE_QUERY_SINGLETHREADED_VALIDATE, &vi, &dvs ); + + per_thread_counters = util_malloc_wrapper( sizeof(lfds700_pal_uint_t) * number_logical_processors ); + + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + *(per_thread_counters+loop) = 0; + + while( dvs == LFDS700_MISC_VALIDITY_VALID and lfds700_queue_dequeue(&qs, &qe, &ps) ) + { + te = LFDS700_QUEUE_GET_VALUE_FROM_ELEMENT( *qe ); + + if( te->thread_number >= number_logical_processors ) + { + dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; + break; + } + + if( te->counter > per_thread_counters[te->thread_number] ) + dvs = LFDS700_MISC_VALIDITY_INVALID_MISSING_ELEMENTS; + + if( te->counter < per_thread_counters[te->thread_number] ) + dvs = LFDS700_MISC_VALIDITY_INVALID_ADDITIONAL_ELEMENTS; + + if( te->counter == per_thread_counters[te->thread_number] ) + per_thread_counters[te->thread_number]++; + } + + free( per_thread_counters ); + + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + util_aligned_free( (ts+loop)->te_array ); + + free( ts ); + + lfds700_queue_cleanup( &qs, NULL ); + + internal_display_test_result( 1, "queue", dvs ); + + return; +} + + + + + +/****************************************************************************/ +static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_simple_enqueuer( void *util_thread_starter_thread_state ) +{ + lfds700_pal_uint_t + loop; + + struct lfds700_misc_prng_state + ps; + + struct test_state + *ts; + + struct util_thread_starter_thread_state + *tsts; + + LFDS700_MISC_MAKE_VALID_ON_CURRENT_LOGICAL_CORE_INITS_COMPLETED_BEFORE_NOW_ON_ANY_OTHER_LOGICAL_CORE; + + assert( util_thread_starter_thread_state != NULL ); + + tsts = (struct util_thread_starter_thread_state *) util_thread_starter_thread_state; + ts = (struct test_state *) tsts->thread_user_state; + + lfds700_misc_prng_init( &ps ); + + ts->te_array = util_aligned_malloc( sizeof(struct test_element) * ts->number_elements, LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES ); + + for( loop = 0 ; loop < ts->number_elements ; loop++ ) + { + (ts->te_array+loop)->thread_number = ts->thread_number; + (ts->te_array+loop)->counter = loop; + } + + util_thread_starter_ready_and_wait( tsts ); + + for( loop = 0 ; loop < ts->number_elements ; loop++ ) + { + LFDS700_QUEUE_SET_VALUE_IN_ELEMENT( (ts->te_array+loop)->qe, ts->te_array+loop ); + lfds700_queue_enqueue( ts->qs, &(ts->te_array+loop)->qe, &ps ); + } + + LFDS700_MISC_BARRIER_STORE; + + lfds700_misc_force_store(); + + return( (test_pal_thread_return_t) EXIT_SUCCESS ); +} + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_queue_enqueuing_and_dequeuing.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_queue_enqueuing_and_dequeuing.c new file mode 100644 index 0000000000..1469635fd4 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_queue_enqueuing_and_dequeuing.c @@ -0,0 +1,250 @@ +/***** includes *****/ +#include "internal.h" + +/***** structs *****/ +struct test_state +{ + enum flag + error_flag; + + lfds700_pal_uint_t + counter, + number_logical_processors, + *per_thread_counters, + thread_number; + + struct lfds700_queue_state + *qs; +}; + +struct test_element +{ + struct lfds700_queue_element + qe, + *qe_use; + + lfds700_pal_uint_t + counter, + thread_number; +}; + +/***** private prototypes *****/ +static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_enqueuer_and_dequeuer( void *util_thread_starter_thread_state ); + + + + + +/****************************************************************************/ +void test_lfds700_queue_enqueuing_and_dequeuing( struct lfds700_list_asu_state *list_of_logical_processors ) +{ + enum lfds700_misc_validity + dvs = LFDS700_MISC_VALIDITY_VALID; + + lfds700_pal_uint_t + loop, + number_logical_processors, + subloop; + + struct lfds700_list_asu_element + *lasue; + + struct lfds700_misc_prng_state + ps; + + struct lfds700_queue_state + qs; + + struct lfds700_misc_validation_info + vi; + + struct test_pal_logical_processor + *lp; + + struct util_thread_starter_state + *tts; + + struct test_element + *te_array; + + struct test_state + *ts; + + test_pal_thread_state_t + *thread_handles; + + assert( list_of_logical_processors != NULL ); + // TRD : qt can be any value in its range + + /* TRD : create a queue with one element per thread + each thread constly dequeues and enqueues from that one queue + where when enqueuing sets in the element + its thread number and counter + and when dequeuing, checks the thread number and counter + against previously seen counter for that thread + where it should always see a higher number + */ + + internal_display_test_name( "Enqueuing and dequeuing (%d seconds)", TEST_DURATION_IN_SECONDS ); + + lfds700_list_asu_query( list_of_logical_processors, LFDS700_LIST_ASU_QUERY_GET_POTENTIALLY_INACCURATE_COUNT, NULL, (void **) &number_logical_processors ); + + lfds700_misc_prng_init( &ps ); + + te_array = util_aligned_malloc( sizeof(struct test_element) * (number_logical_processors+1), LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES ); + + lfds700_queue_init_valid_on_current_logical_core( &qs, &(te_array+number_logical_processors)->qe, &ps, NULL ); + + // TRD : we assume the test will iterate at least once (or we'll have a false negative) + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + { + (te_array+loop)->thread_number = loop; + (te_array+loop)->counter = 0; + LFDS700_QUEUE_SET_VALUE_IN_ELEMENT( (te_array+loop)->qe, te_array+loop ); + lfds700_queue_enqueue( &qs, &(te_array+loop)->qe, &ps ); + } + + ts = util_malloc_wrapper( sizeof(struct test_state) * number_logical_processors ); + + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + { + (ts+loop)->qs = &qs; + (ts+loop)->thread_number = loop; + (ts+loop)->counter = 0; + (ts+loop)->error_flag = LOWERED; + (ts+loop)->per_thread_counters = util_malloc_wrapper( sizeof(lfds700_pal_uint_t) * number_logical_processors ); + (ts+loop)->number_logical_processors = number_logical_processors; + + for( subloop = 0 ; subloop < number_logical_processors ; subloop++ ) + *((ts+loop)->per_thread_counters+subloop) = 0; + } + + thread_handles = util_malloc_wrapper( sizeof(test_pal_thread_state_t) * number_logical_processors ); + + util_thread_starter_new( &tts, number_logical_processors ); + + LFDS700_MISC_BARRIER_STORE; + + lfds700_misc_force_store(); + + loop = 0; + lasue = NULL; + + while( LFDS700_LIST_ASU_GET_START_AND_THEN_NEXT(*list_of_logical_processors, lasue) ) + { + lp = LFDS700_LIST_ASU_GET_VALUE_FROM_ELEMENT( *lasue ); + util_thread_starter_start( tts, &thread_handles[loop], loop, lp, thread_enqueuer_and_dequeuer, ts+loop ); + loop++; + } + + util_thread_starter_run( tts ); + + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + test_pal_thread_wait( thread_handles[loop] ); + + util_thread_starter_delete( tts ); + + free( thread_handles ); + + LFDS700_MISC_BARRIER_LOAD; + + vi.min_elements = vi.max_elements = number_logical_processors; + + lfds700_queue_query( &qs, LFDS700_QUEUE_QUERY_SINGLETHREADED_VALIDATE, &vi, &dvs ); + + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + if( (ts+loop)->error_flag == RAISED ) + dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; + + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + free( (ts+loop)->per_thread_counters ); + + util_aligned_free( te_array ); + + free( ts ); + + lfds700_queue_cleanup( &qs, NULL ); + + internal_display_test_result( 1, "queue", dvs ); + + return; +} + + + + + +/****************************************************************************/ +static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_enqueuer_and_dequeuer( void *util_thread_starter_thread_state ) +{ + lfds700_pal_uint_t + time_loop = 0; + + struct lfds700_misc_prng_state + ps; + + struct lfds700_queue_element + *qe; + + struct test_element + *te; + + struct test_state + *ts; + + struct util_thread_starter_thread_state + *tsts; + + time_t + current_time, + start_time; + + LFDS700_MISC_MAKE_VALID_ON_CURRENT_LOGICAL_CORE_INITS_COMPLETED_BEFORE_NOW_ON_ANY_OTHER_LOGICAL_CORE; + + assert( util_thread_starter_thread_state != NULL ); + + tsts = (struct util_thread_starter_thread_state *) util_thread_starter_thread_state; + ts = (struct test_state *) tsts->thread_user_state; + + lfds700_misc_prng_init( &ps ); + + util_thread_starter_ready_and_wait( tsts ); + + current_time = start_time = time( NULL ); + + while( current_time < start_time + TEST_DURATION_IN_SECONDS ) + { + lfds700_queue_dequeue( ts->qs, &qe, &ps ); + te = LFDS700_QUEUE_GET_VALUE_FROM_ELEMENT( *qe ); + + if( te->thread_number >= ts->number_logical_processors ) + ts->error_flag = RAISED; + else + { + if( te->counter < ts->per_thread_counters[te->thread_number] ) + ts->error_flag = RAISED; + + if( te->counter >= ts->per_thread_counters[te->thread_number] ) + ts->per_thread_counters[te->thread_number] = te->counter+1; + } + + te->thread_number = ts->thread_number; + te->counter = ++ts->counter; + + LFDS700_QUEUE_SET_VALUE_IN_ELEMENT( *qe, te ); + lfds700_queue_enqueue( ts->qs, qe, &ps ); + + if( time_loop++ == TIME_LOOP_COUNT ) + { + time_loop = 0; + time( ¤t_time ); + } + } + + LFDS700_MISC_BARRIER_STORE; + + lfds700_misc_force_store(); + + return( (test_pal_thread_return_t) EXIT_SUCCESS ); +} + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_queue_enqueuing_and_dequeuing_with_free.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_queue_enqueuing_and_dequeuing_with_free.c new file mode 100644 index 0000000000..21be07052d --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_queue_enqueuing_and_dequeuing_with_free.c @@ -0,0 +1,241 @@ +/***** includes *****/ +#include "internal.h" + +/***** structs *****/ +struct test_state +{ + lfds700_pal_uint_t + number_of_elements_per_thread; + + struct lfds700_queue_state + *qs; +}; + +/***** private prototypes *****/ +static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_enqueue_dequeuer_with_free( void *util_thread_starter_thread_state ); +static void queue_element_cleanup_callback( struct lfds700_queue_state *qs, struct lfds700_queue_element *qe, enum lfds700_misc_flag dummy_element_flag ); + + + + + +/****************************************************************************/ +void test_lfds700_queue_enqueuing_and_dequeuing_with_free( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ) +{ + enum lfds700_misc_validity + dvs = LFDS700_MISC_VALIDITY_VALID; + + lfds700_pal_uint_t + loop, + number_elements, + number_logical_processors, + number_of_elements_per_thread; + + struct lfds700_list_asu_element + *lasue; + + struct lfds700_misc_prng_state + ps; + + struct lfds700_queue_element + *qe; + + struct lfds700_queue_state + qs; + + struct lfds700_misc_validation_info + vi; + + struct test_pal_logical_processor + *lp; + + struct test_state + *ts; + + struct util_thread_starter_state + *tts; + + test_pal_thread_state_t + *thread_handles; + + assert( list_of_logical_processors != NULL ); + // TRD : memory_in_megabytes can be any value in its range + + /* TRD : the M&Q queue supports free()ing queue elements after they've been dequeued + we need to test this + we spawn one thread per logical core + there's one master queue which all threads work on + we create one freelist per thread + and allocate as many queue elements as we can (no payload) + - but note each allocate is its own malloc() + each freelist receives an equal share (i.e. we get the mallocs out of the way) + each thread enqueues as rapidly as possible + and dequeues as rapidly as possible + (i.e. each thread loops, doing an enqueue and a dequeue) + when the dequeue is done, the element is free()ed + */ + + internal_display_test_name( "Enqueuing and dequeuing with free" ); + + lfds700_list_asu_query( list_of_logical_processors, LFDS700_LIST_ASU_QUERY_GET_POTENTIALLY_INACCURATE_COUNT, NULL, (void **) &number_logical_processors ); + + lfds700_misc_prng_init( &ps ); + + number_elements = ( memory_in_megabytes * ONE_MEGABYTE_IN_BYTES ) / ( sizeof(struct lfds700_freelist_element) + sizeof(struct lfds700_queue_element) ); + number_of_elements_per_thread = number_elements / number_logical_processors; + qe = util_aligned_malloc( sizeof(struct lfds700_queue_element), (lfds700_pal_uint_t) LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES ); + lfds700_queue_init_valid_on_current_logical_core( &qs, qe, &ps, NULL ); + + ts = util_malloc_wrapper( sizeof(struct test_state) * number_logical_processors ); + + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + { + (ts+loop)->qs = &qs; + (ts+loop)->number_of_elements_per_thread = number_of_elements_per_thread; + } + + thread_handles = util_malloc_wrapper( sizeof(test_pal_thread_state_t) * number_logical_processors ); + + util_thread_starter_new( &tts, number_logical_processors ); + + LFDS700_MISC_BARRIER_STORE; + + lfds700_misc_force_store(); + + loop = 0; + lasue = NULL; + + while( LFDS700_LIST_ASU_GET_START_AND_THEN_NEXT(*list_of_logical_processors, lasue) ) + { + lp = LFDS700_LIST_ASU_GET_VALUE_FROM_ELEMENT( *lasue ); + util_thread_starter_start( tts, &thread_handles[loop], loop, lp, thread_enqueue_dequeuer_with_free, ts+loop ); + loop++; + } + + util_thread_starter_run( tts ); + + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + test_pal_thread_wait( thread_handles[loop] ); + + util_thread_starter_delete( tts ); + + free( thread_handles ); + + LFDS700_MISC_BARRIER_LOAD; + + vi.min_elements = 0; + vi.max_elements = 0; + + lfds700_queue_query( &qs, LFDS700_QUEUE_QUERY_SINGLETHREADED_VALIDATE, &vi, &dvs ); + + lfds700_queue_cleanup( &qs, queue_element_cleanup_callback ); + + free( ts ); + + internal_display_test_result( 1, "queue", dvs ); + + return; +} + + + + + +/****************************************************************************/ +static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_enqueue_dequeuer_with_free( void *util_thread_starter_thread_state ) +{ + enum flag + finished_flag = LOWERED; + + lfds700_pal_uint_t + loop; + + struct lfds700_misc_prng_state + ps; + + struct lfds700_freelist_element + *fe, + *fe_array; + + struct lfds700_freelist_state + fs; + + struct lfds700_queue_element + *qe; + + struct test_state + *ts; + + struct util_thread_starter_thread_state + *tsts; + + LFDS700_MISC_MAKE_VALID_ON_CURRENT_LOGICAL_CORE_INITS_COMPLETED_BEFORE_NOW_ON_ANY_OTHER_LOGICAL_CORE; + + assert( util_thread_starter_thread_state != NULL ); + + tsts = (struct util_thread_starter_thread_state *) util_thread_starter_thread_state; + ts = (struct test_state *) tsts->thread_user_state; + + lfds700_misc_prng_init( &ps ); + + lfds700_freelist_init_valid_on_current_logical_core( &fs, NULL ); + + fe_array = util_malloc_wrapper( sizeof(struct lfds700_freelist_element) * ts->number_of_elements_per_thread ); + + for( loop = 0 ; loop < ts->number_of_elements_per_thread ; loop++ ) + { + qe = util_aligned_malloc( sizeof(struct lfds700_queue_element), LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES ); + LFDS700_FREELIST_SET_VALUE_IN_ELEMENT( fe_array[loop], qe ); + lfds700_freelist_push( &fs, &fe_array[loop], &ps ); + } + + util_thread_starter_ready_and_wait( tsts ); + + while( finished_flag == LOWERED ) + { + loop = 0; + while( loop++ < 1000 and lfds700_freelist_pop(&fs, &fe, &ps) ) + { + qe = LFDS700_FREELIST_GET_VALUE_FROM_ELEMENT( *fe ); + lfds700_queue_enqueue( ts->qs, qe, &ps ); + } + + if( loop < 1000 ) + finished_flag = RAISED; + + loop = 0; + while( loop++ < 1000 and lfds700_queue_dequeue(ts->qs, &qe, &ps) ) + util_aligned_free( qe ); + } + + LFDS700_MISC_BARRIER_STORE; + + lfds700_misc_force_store(); + + lfds700_freelist_cleanup( &fs, NULL ); + + free( fe_array ); + + return( (test_pal_thread_return_t) EXIT_SUCCESS ); +} + + + + + +/****************************************************************************/ +#pragma warning( disable : 4100 ) + +static void queue_element_cleanup_callback( struct lfds700_queue_state *qs, struct lfds700_queue_element *qe, enum lfds700_misc_flag dummy_element_flag ) +{ + assert( qs != NULL ); + assert( qe != NULL ); + // TRD : dummy_element_flag can be any value in its range + + util_aligned_free( qe ); + + return; +} + +#pragma warning( default : 4100 ) + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_queue_enqueuing_with_malloc_and_dequeuing_with_free.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_queue_enqueuing_with_malloc_and_dequeuing_with_free.c new file mode 100644 index 0000000000..0f0fa7f081 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_queue_enqueuing_with_malloc_and_dequeuing_with_free.c @@ -0,0 +1,208 @@ +/***** includes *****/ +#include "internal.h" + +/***** structs *****/ +struct test_state +{ + struct lfds700_queue_state + *qs; +}; + +/***** private prototypes *****/ +static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_enqueuer_with_malloc_and_dequeuer_with_free( void *util_thread_starter_thread_state ); +static void queue_element_cleanup_callback( struct lfds700_queue_state *qs, struct lfds700_queue_element *qe, enum lfds700_misc_flag dummy_element_flag ); + + + + + +/****************************************************************************/ +void test_lfds700_queue_enqueuing_with_malloc_and_dequeuing_with_free( struct lfds700_list_asu_state *list_of_logical_processors ) +{ + enum lfds700_misc_validity + dvs = LFDS700_MISC_VALIDITY_VALID; + + lfds700_pal_uint_t + loop, + number_logical_processors; + + struct lfds700_list_asu_element + *lasue; + + struct lfds700_misc_prng_state + ps; + + struct lfds700_queue_element + *qe; + + struct lfds700_queue_state + qs; + + struct lfds700_misc_validation_info + vi; + + struct test_pal_logical_processor + *lp; + + struct util_thread_starter_state + *tts; + + struct test_state + *ts; + + test_pal_thread_state_t + *thread_handles; + + assert( list_of_logical_processors != NULL ); + // TRD : qt can be any value in its range + + /* TRD : one thread per logical core + each thread loops for ten seconds + mallocs and enqueues 1k elements, then dequeues and frees 1k elements + */ + + internal_display_test_name( "Enqueuing with malloc dequeuing with free (%d seconds)", TEST_DURATION_IN_SECONDS ); + + lfds700_list_asu_query( list_of_logical_processors, LFDS700_LIST_ASU_QUERY_GET_POTENTIALLY_INACCURATE_COUNT, NULL, (void **) &number_logical_processors ); + + lfds700_misc_prng_init( &ps ); + + qe = util_aligned_malloc( sizeof(struct lfds700_queue_element), LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES ); + + lfds700_queue_init_valid_on_current_logical_core( &qs, qe, &ps, NULL ); + + ts = util_malloc_wrapper( sizeof(struct test_state) * number_logical_processors ); + + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + (ts+loop)->qs = &qs; + + thread_handles = util_malloc_wrapper( sizeof(test_pal_thread_state_t) * number_logical_processors ); + + util_thread_starter_new( &tts, number_logical_processors ); + + LFDS700_MISC_BARRIER_STORE; + + lfds700_misc_force_store(); + + loop = 0; + lasue = NULL; + + while( LFDS700_LIST_ASU_GET_START_AND_THEN_NEXT(*list_of_logical_processors, lasue) ) + { + lp = LFDS700_LIST_ASU_GET_VALUE_FROM_ELEMENT( *lasue ); + util_thread_starter_start( tts, &thread_handles[loop], loop, lp, thread_enqueuer_with_malloc_and_dequeuer_with_free, ts+loop ); + loop++; + } + + util_thread_starter_run( tts ); + + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + test_pal_thread_wait( thread_handles[loop] ); + + util_thread_starter_delete( tts ); + + free( thread_handles ); + + LFDS700_MISC_BARRIER_LOAD; + + vi.min_elements = vi.max_elements = 0; + + lfds700_queue_query( &qs, LFDS700_QUEUE_QUERY_SINGLETHREADED_VALIDATE, &vi, &dvs ); + + free( ts ); + + lfds700_queue_cleanup( &qs, queue_element_cleanup_callback ); + + internal_display_test_result( 1, "queue", dvs ); + + return; +} + + + + + +/****************************************************************************/ +static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_enqueuer_with_malloc_and_dequeuer_with_free( void *util_thread_starter_thread_state ) +{ + lfds700_pal_uint_t + loop, + time_loop = 0; + + struct lfds700_misc_prng_state + ps; + + struct lfds700_queue_element + *qe; + + struct test_state + *ts; + + struct util_thread_starter_thread_state + *tsts; + + time_t + current_time, + start_time; + + LFDS700_MISC_MAKE_VALID_ON_CURRENT_LOGICAL_CORE_INITS_COMPLETED_BEFORE_NOW_ON_ANY_OTHER_LOGICAL_CORE; + + assert( util_thread_starter_thread_state != NULL ); + + tsts = (struct util_thread_starter_thread_state *) util_thread_starter_thread_state; + ts = (struct test_state *) tsts->thread_user_state; + + lfds700_misc_prng_init( &ps ); + + util_thread_starter_ready_and_wait( tsts ); + + current_time = start_time = time( NULL ); + + while( current_time < start_time + TEST_DURATION_IN_SECONDS ) + { + for( loop = 0 ; loop < 1000 ; loop++ ) + { + qe = util_aligned_malloc( sizeof(struct lfds700_queue_element), LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES ); + lfds700_queue_enqueue( ts->qs, qe, &ps ); + } + + for( loop = 0 ; loop < 1000 ; loop++ ) + { + lfds700_queue_dequeue( ts->qs, &qe, &ps ); + util_aligned_free( qe ); + } + + if( time_loop++ == REDUCED_TIME_LOOP_COUNT ) + { + time_loop = 0; + time( ¤t_time ); + } + } + + LFDS700_MISC_BARRIER_STORE; + + lfds700_misc_force_store(); + + return( (test_pal_thread_return_t) EXIT_SUCCESS ); +} + + + + + +/****************************************************************************/ +#pragma warning( disable : 4100 ) + +static void queue_element_cleanup_callback( struct lfds700_queue_state *qs, struct lfds700_queue_element *qe, enum lfds700_misc_flag dummy_element_flag ) +{ + assert( qs != NULL ); + assert( qe != NULL ); + // TRD : dummy_element_flag can be any value in its range + + util_aligned_free( qe ); + + return; +} + +#pragma warning( default : 4100 ) + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_queue_rapid_enqueuing_and_dequeuing.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_queue_rapid_enqueuing_and_dequeuing.c new file mode 100644 index 0000000000..ec3963a336 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_queue_rapid_enqueuing_and_dequeuing.c @@ -0,0 +1,264 @@ +/***** includes *****/ +#include "internal.h" + +/***** structs *****/ +struct test_state +{ + lfds700_pal_uint_t + counter, + thread_number; + + struct lfds700_queue_state + *qs; +}; + +struct test_element +{ + struct lfds700_queue_element + qe, + *qe_use; + + lfds700_pal_uint_t + counter, + thread_number; +}; + +/***** private prototypes *****/ +static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_rapid_enqueuer_and_dequeuer( void *util_thread_starter_thread_state ); + + + + + +/****************************************************************************/ +void test_lfds700_queue_rapid_enqueuing_and_dequeuing( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ) +{ + enum lfds700_misc_validity + dvs = LFDS700_MISC_VALIDITY_VALID; + + lfds700_pal_uint_t + loop, + number_elements_with_dummy_element, + number_elements_without_dummy_element, + number_logical_processors, + *per_thread_counters; + + struct lfds700_list_asu_element + *lasue; + + struct lfds700_misc_prng_state + ps; + + struct lfds700_queue_element + *qe; + + struct lfds700_misc_validation_info + vi; + + struct lfds700_queue_state + qs; + + struct test_pal_logical_processor + *lp; + + struct util_thread_starter_state + *tts; + + struct test_element + *te_array, + *te; + + struct test_state + *ts; + + test_pal_thread_state_t + *thread_handles; + + assert( list_of_logical_processors != NULL ); + // TRD : memory_in_megabytes can be any value in its range + + /* TRD : we create a single queue with 50,000 elements + we don't want too many elements, so we ensure plenty of element re-use + each thread simply loops dequeuing and enqueuing + where the user data indicates thread number and an increment counter + vertification is that the counter increments on a per-thread basis + */ + + internal_display_test_name( "Rapid enqueuing and dequeuing (%d seconds)", TEST_DURATION_IN_SECONDS ); + + lfds700_list_asu_query( list_of_logical_processors, LFDS700_LIST_ASU_QUERY_GET_POTENTIALLY_INACCURATE_COUNT, NULL, (void **) &number_logical_processors ); + + lfds700_misc_prng_init( &ps ); + + number_elements_with_dummy_element = ( memory_in_megabytes * ONE_MEGABYTE_IN_BYTES ) / sizeof(struct test_element); + + if( number_elements_with_dummy_element > (10000 * number_logical_processors) + 1 ) + number_elements_with_dummy_element = (10000 * number_logical_processors) + 1; + + number_elements_without_dummy_element = number_elements_with_dummy_element - 1; + + vi.min_elements = number_elements_without_dummy_element; + vi.max_elements = number_elements_without_dummy_element; + + te_array = util_aligned_malloc( sizeof(struct test_element) * number_elements_with_dummy_element, LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES ); + + lfds700_queue_init_valid_on_current_logical_core( &qs, &(te_array+number_elements_without_dummy_element)->qe, &ps, NULL ); + + // TRD : we assume the test will iterate at least once (or we'll have a false negative) + for( loop = 0 ; loop < number_elements_without_dummy_element ; loop++ ) + { + (te_array+loop)->thread_number = loop; + (te_array+loop)->counter = 0; + LFDS700_QUEUE_SET_VALUE_IN_ELEMENT( (te_array+loop)->qe, te_array+loop ); + lfds700_queue_enqueue( &qs, &(te_array+loop)->qe, &ps ); + } + + ts = util_malloc_wrapper( sizeof(struct test_state) * number_logical_processors ); + + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + { + (ts+loop)->qs = &qs; + (ts+loop)->thread_number = loop; + (ts+loop)->counter = 0; + } + + thread_handles = util_malloc_wrapper( sizeof(test_pal_thread_state_t) * number_logical_processors ); + + util_thread_starter_new( &tts, number_logical_processors ); + + LFDS700_MISC_BARRIER_STORE; + + lfds700_misc_force_store(); + + loop = 0; + lasue = NULL; + + while( LFDS700_LIST_ASU_GET_START_AND_THEN_NEXT(*list_of_logical_processors, lasue) ) + { + lp = LFDS700_LIST_ASU_GET_VALUE_FROM_ELEMENT( *lasue ); + util_thread_starter_start( tts, &thread_handles[loop], loop, lp, thread_rapid_enqueuer_and_dequeuer, ts+loop ); + loop++; + } + + util_thread_starter_run( tts ); + + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + test_pal_thread_wait( thread_handles[loop] ); + + util_thread_starter_delete( tts ); + + free( thread_handles ); + + LFDS700_MISC_BARRIER_LOAD; + + lfds700_queue_query( &qs, LFDS700_QUEUE_QUERY_SINGLETHREADED_VALIDATE, &vi, &dvs ); + + // TRD : now check results + per_thread_counters = util_malloc_wrapper( sizeof(lfds700_pal_uint_t) * number_logical_processors ); + + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + *(per_thread_counters+loop) = 0; + + while( dvs == LFDS700_MISC_VALIDITY_VALID and lfds700_queue_dequeue(&qs, &qe, &ps) ) + { + te = LFDS700_QUEUE_GET_VALUE_FROM_ELEMENT( *qe ); + + if( te->thread_number >= number_logical_processors ) + { + dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; + break; + } + + if( per_thread_counters[te->thread_number] == 0 ) + per_thread_counters[te->thread_number] = te->counter; + + if( te->counter > per_thread_counters[te->thread_number] ) + dvs = LFDS700_MISC_VALIDITY_INVALID_MISSING_ELEMENTS; + + if( te->counter < per_thread_counters[te->thread_number] ) + dvs = LFDS700_MISC_VALIDITY_INVALID_ADDITIONAL_ELEMENTS; + + if( te->counter == per_thread_counters[te->thread_number] ) + per_thread_counters[te->thread_number]++; + } + + free( per_thread_counters ); + + lfds700_queue_cleanup( &qs, NULL ); + + util_aligned_free( te_array ); + + free( ts ); + + internal_display_test_result( 1, "queue", dvs ); + + return; +} + + + + + +/****************************************************************************/ +static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_rapid_enqueuer_and_dequeuer( void *util_thread_starter_thread_state ) +{ + lfds700_pal_uint_t + time_loop = 0; + + struct lfds700_misc_prng_state + ps; + + struct lfds700_queue_element + *qe; + + struct test_element + *te; + + struct test_state + *ts; + + struct util_thread_starter_thread_state + *tsts; + + time_t + current_time, + start_time; + + LFDS700_MISC_MAKE_VALID_ON_CURRENT_LOGICAL_CORE_INITS_COMPLETED_BEFORE_NOW_ON_ANY_OTHER_LOGICAL_CORE; + + assert( util_thread_starter_thread_state != NULL ); + + tsts = (struct util_thread_starter_thread_state *) util_thread_starter_thread_state; + ts = (struct test_state *) tsts->thread_user_state; + + lfds700_misc_prng_init( &ps ); + + util_thread_starter_ready_and_wait( tsts ); + + current_time = start_time = time( NULL ); + + while( current_time < start_time + TEST_DURATION_IN_SECONDS ) + { + lfds700_queue_dequeue( ts->qs, &qe, &ps ); + te = LFDS700_QUEUE_GET_VALUE_FROM_ELEMENT( *qe ); + + te->thread_number = ts->thread_number; + te->counter = ts->counter++; + + LFDS700_QUEUE_SET_VALUE_IN_ELEMENT( *qe, te ); + lfds700_queue_enqueue( ts->qs, qe, &ps ); + + if( time_loop++ == TIME_LOOP_COUNT ) + { + time_loop = 0; + time( ¤t_time ); + } + } + + LFDS700_MISC_BARRIER_STORE; + + lfds700_misc_force_store(); + + return( (test_pal_thread_return_t) EXIT_SUCCESS ); +} + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_ringbuffer.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_ringbuffer.c new file mode 100644 index 0000000000..0a7de0761b --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_ringbuffer.c @@ -0,0 +1,31 @@ +/***** includes *****/ +#include "internal.h" + + + + + +/****************************************************************************/ +#pragma warning( disable : 4127 ) // TRD : disables MSVC warning for condition expressions being const + +void test_lfds700_ringbuffer( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ) +{ + assert( list_of_logical_processors != NULL ); + // TRD : memory_in_megabytes can be any value in its range + + if( LFDS700_MISC_ATOMIC_SUPPORT_DWCAS ) + { + printf( "\n" + "Ringbuffer Tests\n" + "================\n" ); + + test_lfds700_ringbuffer_reading( list_of_logical_processors, memory_in_megabytes ); + test_lfds700_ringbuffer_reading_and_writing( list_of_logical_processors, memory_in_megabytes ); + test_lfds700_ringbuffer_writing( list_of_logical_processors, memory_in_megabytes ); + } + + return; +} + +#pragma warning( default : 4127 ) + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_ringbuffer_reading.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_ringbuffer_reading.c new file mode 100644 index 0000000000..00d378992e --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_ringbuffer_reading.c @@ -0,0 +1,217 @@ +/***** includes *****/ +#include "internal.h" + +/***** structs *****/ +struct test_state +{ + enum flag + error_flag; + + lfds700_pal_uint_t + read_count; + + struct lfds700_ringbuffer_state + *rs; +}; + +/***** private prototypes *****/ +static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_simple_reader( void *util_thread_starter_thread_state ); + + + + + +/****************************************************************************/ +void test_lfds700_ringbuffer_reading( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ) +{ + enum lfds700_misc_validity + dvs[2] = { LFDS700_MISC_VALIDITY_VALID, LFDS700_MISC_VALIDITY_VALID }; + + lfds700_pal_uint_t + loop, + number_elements_with_dummy_element, + number_elements_without_dummy_element, + number_logical_processors, + total_read = 0; + + struct lfds700_list_asu_element + *lasue; + + struct lfds700_misc_prng_state + ps; + + struct lfds700_ringbuffer_element + *re_array; + + struct lfds700_ringbuffer_state + rs; + + struct lfds700_misc_validation_info + vi; + + struct test_pal_logical_processor + *lp; + + struct util_thread_starter_state + *tts; + + struct test_state + *ts; + + test_pal_thread_state_t + *thread_handles; + + assert( list_of_logical_processors != NULL ); + // TRD : memory_in_megabytes can be any value in its range + + /* TRD : we create a single ringbuffer + with 1,000,000 elements + we populate the ringbuffer, where the + user data is an incrementing counter + + we create one thread per CPU + where each thread busy-works, + reading until the ringbuffer is empty + + each thread keep track of the number of reads it manages + and that each user data it reads is greater than the + previous user data that was read + */ + + internal_display_test_name( "Reading" ); + + lfds700_list_asu_query( list_of_logical_processors, LFDS700_LIST_ASU_QUERY_GET_POTENTIALLY_INACCURATE_COUNT, NULL, (void **) &number_logical_processors ); + + lfds700_misc_prng_init( &ps ); + + number_elements_with_dummy_element = ( memory_in_megabytes * ONE_MEGABYTE_IN_BYTES ) / sizeof(struct lfds700_ringbuffer_element); + number_elements_without_dummy_element = number_elements_with_dummy_element - 1; + + vi.min_elements = 0; + vi.max_elements = number_elements_without_dummy_element; + + re_array = util_aligned_malloc( sizeof(struct lfds700_ringbuffer_element) * number_elements_with_dummy_element, LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES ); + + lfds700_ringbuffer_init_valid_on_current_logical_core( &rs, re_array, number_elements_with_dummy_element, &ps, NULL ); + + // TRD : init the ringbuffer contents for the test + for( loop = 0 ; loop < number_elements_without_dummy_element ; loop++ ) + lfds700_ringbuffer_write( &rs, NULL, (void *) (size_t) loop, NULL, NULL, NULL, &ps ); + + ts = util_malloc_wrapper( sizeof(struct test_state) * number_logical_processors ); + + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + { + (ts+loop)->rs = &rs; + (ts+loop)->read_count = 0; + (ts+loop)->error_flag = LOWERED; + } + + thread_handles = util_malloc_wrapper( sizeof(test_pal_thread_state_t) * number_logical_processors ); + + util_thread_starter_new( &tts, number_logical_processors ); + + LFDS700_MISC_BARRIER_STORE; + + lfds700_misc_force_store(); + + loop = 0; + lasue = NULL; + + while( LFDS700_LIST_ASU_GET_START_AND_THEN_NEXT(*list_of_logical_processors, lasue) ) + { + lp = LFDS700_LIST_ASU_GET_VALUE_FROM_ELEMENT( *lasue ); + util_thread_starter_start( tts, &thread_handles[loop], loop, lp, thread_simple_reader, ts+loop ); + loop++; + } + + util_thread_starter_run( tts ); + + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + test_pal_thread_wait( thread_handles[loop] ); + + util_thread_starter_delete( tts ); + + free( thread_handles ); + + LFDS700_MISC_BARRIER_LOAD; + + lfds700_ringbuffer_query( &rs, LFDS700_RINGBUFFER_QUERY_SINGLETHREADED_VALIDATE, (void *) &vi, (void *) dvs ); + + // TRD : check for raised error flags + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + if( (ts+loop)->error_flag == RAISED ) + dvs[0] = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; + + // TRD : check thread reads total to 1,000,000 + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + total_read += (ts+loop)->read_count; + + if( total_read < number_elements_without_dummy_element ) + dvs[0] = LFDS700_MISC_VALIDITY_INVALID_MISSING_ELEMENTS; + + if( total_read > number_elements_without_dummy_element ) + dvs[0] = LFDS700_MISC_VALIDITY_INVALID_ADDITIONAL_ELEMENTS; + + free( ts ); + + lfds700_ringbuffer_cleanup( &rs, NULL ); + + util_aligned_free( re_array ); + + internal_display_test_result( 2, "queue", dvs[0], "freelist", dvs[1] ); + + return; +} + + + + + +/****************************************************************************/ +static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_simple_reader( void *util_thread_starter_thread_state ) +{ + lfds700_pal_uint_t + *prev_value, + *value; + + struct lfds700_misc_prng_state + ps; + + struct test_state + *ts; + + struct util_thread_starter_thread_state + *tsts; + + LFDS700_MISC_MAKE_VALID_ON_CURRENT_LOGICAL_CORE_INITS_COMPLETED_BEFORE_NOW_ON_ANY_OTHER_LOGICAL_CORE; + + assert( util_thread_starter_thread_state != NULL ); + + tsts = (struct util_thread_starter_thread_state *) util_thread_starter_thread_state; + ts = (struct test_state *) tsts->thread_user_state; + + lfds700_misc_prng_init( &ps ); + + lfds700_ringbuffer_read( ts->rs, NULL, (void **) &prev_value, &ps ); + ts->read_count++; + + util_thread_starter_ready_and_wait( tsts ); + + while( lfds700_ringbuffer_read(ts->rs, NULL, (void **) &value, &ps) ) + { + if( value <= prev_value ) + ts->error_flag = RAISED; + + prev_value = value; + + ts->read_count++; + } + + LFDS700_MISC_BARRIER_STORE; + + lfds700_misc_force_store(); + + return( (test_pal_thread_return_t) EXIT_SUCCESS ); +} + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_ringbuffer_reading_and_writing.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_ringbuffer_reading_and_writing.c new file mode 100644 index 0000000000..152c331892 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_ringbuffer_reading_and_writing.c @@ -0,0 +1,261 @@ +/***** includes *****/ +#include "internal.h" + +/***** structs *****/ +struct test_state +{ + enum flag + error_flag; + + lfds700_pal_uint_t + counter, + number_logical_processors, + *per_thread_counters, + thread_number; + + struct lfds700_ringbuffer_state + *rs; +}; + +struct test_element +{ + lfds700_pal_uint_t + datum, + thread_number; +}; + +/***** private prototypes *****/ +static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_reader_writer( void *util_thread_starter_thread_state ); + + + + + +/****************************************************************************/ +void test_lfds700_ringbuffer_reading_and_writing( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ) +{ + enum lfds700_misc_validity + dvs[2] = { LFDS700_MISC_VALIDITY_VALID, LFDS700_MISC_VALIDITY_VALID }; + + lfds700_pal_uint_t + loop, + number_elements_with_dummy_element, + number_elements_without_dummy_element, + number_logical_processors, + subloop; + + test_pal_thread_state_t + *thread_handles; + + struct lfds700_list_asu_element + *lasue; + + struct lfds700_misc_prng_state + ps; + + struct lfds700_ringbuffer_element + *re_array; + + struct lfds700_ringbuffer_state + rs; + + struct lfds700_misc_validation_info + vi; + + struct test_pal_logical_processor + *lp; + + struct util_thread_starter_state + *tts; + + struct test_element + *te_array; + + struct test_state + *ts; + + assert( list_of_logical_processors != NULL ); + // TRD : memory_in_megabytes can be any value in its range + + /* TRD : we create a single ringbuffer + with 100,000 elements + the ringbuffers starts empty + + we create one thread per CPU + where each thread busy-works writing + and then immediately reading + for ten seconds + + the user data in each written element is a combination + of the thread number and the counter + + while a thread runs, it keeps track of the + counters for the other threads and throws an error + if it sees the number stay the same or decrease + */ + + internal_display_test_name( "Reading and writing (%d seconds)", TEST_DURATION_IN_SECONDS ); + + lfds700_list_asu_query( list_of_logical_processors, LFDS700_LIST_ASU_QUERY_GET_POTENTIALLY_INACCURATE_COUNT, NULL, (void **) &number_logical_processors ); + + lfds700_misc_prng_init( &ps ); + + number_elements_with_dummy_element = ( memory_in_megabytes * ONE_MEGABYTE_IN_BYTES ) / ( sizeof(struct test_element) + sizeof(struct lfds700_ringbuffer_element) ); + number_elements_without_dummy_element = number_elements_with_dummy_element - 1; + + vi.min_elements = 0; + vi.max_elements = number_elements_without_dummy_element; + + re_array = util_aligned_malloc( sizeof(struct lfds700_ringbuffer_element) * number_elements_with_dummy_element, LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES ); + + lfds700_ringbuffer_init_valid_on_current_logical_core( &rs, re_array, number_elements_with_dummy_element, &ps, NULL ); + + te_array = util_malloc_wrapper( sizeof(struct test_element) * number_elements_without_dummy_element ); + + // TRD : populate the ringbuffer + for( loop = 0 ; loop < number_elements_without_dummy_element ; loop++ ) + { + te_array[loop].thread_number = 0; + te_array[loop].datum = (lfds700_pal_uint_t) -1 ; + lfds700_ringbuffer_write( &rs, NULL, &te_array[loop], NULL, NULL, NULL, &ps ); + } + + ts = util_malloc_wrapper( sizeof(struct test_state) * number_logical_processors ); + + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + { + (ts+loop)->rs = &rs; + (ts+loop)->thread_number = loop; + (ts+loop)->counter = 0; + (ts+loop)->number_logical_processors = number_logical_processors; + (ts+loop)->error_flag = LOWERED; + (ts+loop)->per_thread_counters = util_malloc_wrapper( sizeof(lfds700_pal_uint_t) * number_logical_processors ); + + for( subloop = 0 ; subloop < number_logical_processors ; subloop++ ) + *((ts+loop)->per_thread_counters+subloop) = 0; + } + + thread_handles = util_malloc_wrapper( sizeof(test_pal_thread_state_t) * number_logical_processors ); + + util_thread_starter_new( &tts, number_logical_processors ); + + LFDS700_MISC_BARRIER_STORE; + + lfds700_misc_force_store(); + + loop = 0; + lasue = NULL; + + while( LFDS700_LIST_ASU_GET_START_AND_THEN_NEXT(*list_of_logical_processors, lasue) ) + { + lp = LFDS700_LIST_ASU_GET_VALUE_FROM_ELEMENT( *lasue ); + util_thread_starter_start( tts, &thread_handles[loop], loop, lp, thread_reader_writer, ts+loop ); + loop++; + } + + util_thread_starter_run( tts ); + + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + test_pal_thread_wait( thread_handles[loop] ); + + util_thread_starter_delete( tts ); + + free( thread_handles ); + + LFDS700_MISC_BARRIER_LOAD; + + lfds700_ringbuffer_query( &rs, LFDS700_RINGBUFFER_QUERY_SINGLETHREADED_VALIDATE, (void *) &vi, (void *) dvs ); + + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + if( (ts+loop)->error_flag == RAISED ) + dvs[0] = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; + + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + free( (ts+loop)->per_thread_counters ); + + free( ts ); + + lfds700_ringbuffer_cleanup( &rs, NULL ); + + util_aligned_free( re_array ); + + free( te_array ); + + internal_display_test_result( 2, "queue", dvs[0], "freelist", dvs[1] ); + + return; +} + + + + + +/****************************************************************************/ +static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_reader_writer( void *util_thread_starter_thread_state ) +{ + lfds700_pal_uint_t + time_loop = 0; + + struct lfds700_misc_prng_state + ps; + + struct test_element + *te; + + struct test_state + *ts; + + struct util_thread_starter_thread_state + *tsts; + + time_t + current_time, + start_time; + + LFDS700_MISC_MAKE_VALID_ON_CURRENT_LOGICAL_CORE_INITS_COMPLETED_BEFORE_NOW_ON_ANY_OTHER_LOGICAL_CORE; + + assert( util_thread_starter_thread_state != NULL ); + + tsts = (struct util_thread_starter_thread_state *) util_thread_starter_thread_state; + ts = (struct test_state *) tsts->thread_user_state; + + lfds700_misc_prng_init( &ps ); + + util_thread_starter_ready_and_wait( tsts ); + + current_time = start_time = time( NULL ); + + while( current_time < start_time + TEST_DURATION_IN_SECONDS ) + { + lfds700_ringbuffer_read( ts->rs, NULL, (void **) &te, &ps ); + + if( te->thread_number >= ts->number_logical_processors ) + ts->error_flag = RAISED; + else + { + if( te->datum < ts->per_thread_counters[te->thread_number] ) + ts->error_flag = RAISED; + + if( te->datum >= ts->per_thread_counters[te->thread_number] ) + ts->per_thread_counters[te->thread_number] = te->datum+1; + } + + te->thread_number = ts->thread_number; + te->datum = ts->counter++; + + lfds700_ringbuffer_write( ts->rs, NULL, te, NULL, NULL, NULL, &ps ); + + if( time_loop++ == TIME_LOOP_COUNT ) + { + time_loop = 0; + time( ¤t_time ); + } + } + + LFDS700_MISC_BARRIER_STORE; + + lfds700_misc_force_store(); + + return( (test_pal_thread_return_t) EXIT_SUCCESS ); +} + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_ringbuffer_writing.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_ringbuffer_writing.c new file mode 100644 index 0000000000..702aabc58d --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_ringbuffer_writing.c @@ -0,0 +1,272 @@ +/***** includes *****/ +#include "internal.h" + +/***** structs *****/ +struct test_element +{ + lfds700_pal_uint_t + thread_number, + datum; +}; + +struct test_state +{ + lfds700_pal_uint_t + thread_number, + write_count; + + struct test_element + te; + + struct lfds700_ringbuffer_state + *rs; +}; + +/***** private prototypes *****/ +static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_simple_writer( void *util_thread_starter_thread_state ); + + + + + +/****************************************************************************/ +void test_lfds700_ringbuffer_writing( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ) +{ + enum lfds700_misc_validity + dvs[2] = { LFDS700_MISC_VALIDITY_VALID, LFDS700_MISC_VALIDITY_VALID }; + + lfds700_pal_uint_t + loop, + number_elements_with_dummy_element, + number_elements_without_dummy_element, + number_logical_processors, + *per_thread_counters; + + test_pal_thread_state_t + *thread_handles; + + struct lfds700_list_asu_element + *lasue; + + struct lfds700_misc_prng_state + ps; + + struct lfds700_ringbuffer_element + *re_array; + + struct lfds700_ringbuffer_state + rs; + + struct lfds700_misc_validation_info + vi; + + struct test_pal_logical_processor + *lp; + + struct util_thread_starter_state + *tts; + + struct test_element + *te, + *te_array; + + struct test_state + *ts; + + assert( list_of_logical_processors != NULL ); + // TRD : memory_in_megabytes can be any value in its range + + /* TRD : we create a single ringbuffer + with n elements + we create n test elements + which are thread_number/counter pairs + init them to safe values + and fully populate the ringbuffer + + we create one thread per CPU + where each thread busy-works writing + for ten seconds; each thread has one extra element + which it uses for the first write and after that + it uses the element it picks up from overwriting + + the user data in each written element is a combination + of the thread number and the counter + + after the threads are complete, we validate by + checking the user data counters increment on a per thread + basis + */ + + internal_display_test_name( "Writing (%d seconds)", TEST_DURATION_IN_SECONDS ); + + lfds700_list_asu_query( list_of_logical_processors, LFDS700_LIST_ASU_QUERY_GET_POTENTIALLY_INACCURATE_COUNT, NULL, (void **) &number_logical_processors ); + + lfds700_misc_prng_init( &ps ); + + number_elements_with_dummy_element = ( memory_in_megabytes * ONE_MEGABYTE_IN_BYTES ) / ( sizeof(struct test_element) + sizeof(struct lfds700_ringbuffer_element) ); + number_elements_without_dummy_element = number_elements_with_dummy_element - 1; + + vi.min_elements = number_elements_without_dummy_element; + vi.max_elements = number_elements_without_dummy_element; + + re_array = util_aligned_malloc( sizeof(struct lfds700_ringbuffer_element) * number_elements_with_dummy_element, LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES ); + + lfds700_ringbuffer_init_valid_on_current_logical_core( &rs, re_array, number_elements_with_dummy_element, &ps, NULL ); + + te_array = util_malloc_wrapper( sizeof(struct lfds700_ringbuffer_element) * number_elements_without_dummy_element ); + + // TRD : init the test elements and write them into the ringbuffer + for( loop = 0 ; loop < number_elements_without_dummy_element ; loop++ ) + { + te_array[loop].thread_number = 0; + te_array[loop].datum = 0; + lfds700_ringbuffer_write( &rs, NULL, &te_array[loop], NULL, NULL, NULL, &ps ); + } + + ts = util_malloc_wrapper( sizeof(struct test_state) * number_logical_processors ); + + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + { + (ts+loop)->rs = &rs; + (ts+loop)->thread_number = loop; + (ts+loop)->write_count = 0; + } + + thread_handles = util_malloc_wrapper( sizeof(test_pal_thread_state_t) * number_logical_processors ); + + util_thread_starter_new( &tts, number_logical_processors ); + + LFDS700_MISC_BARRIER_STORE; + + lfds700_misc_force_store(); + + loop = 0; + lasue = NULL; + + while( LFDS700_LIST_ASU_GET_START_AND_THEN_NEXT(*list_of_logical_processors, lasue) ) + { + lp = LFDS700_LIST_ASU_GET_VALUE_FROM_ELEMENT( *lasue ); + util_thread_starter_start( tts, &thread_handles[loop], loop, lp, thread_simple_writer, ts+loop ); + loop++; + } + + util_thread_starter_run( tts ); + + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + test_pal_thread_wait( thread_handles[loop] ); + + util_thread_starter_delete( tts ); + + free( thread_handles ); + + LFDS700_MISC_BARRIER_LOAD; + + // TRD : now check results + per_thread_counters = util_malloc_wrapper( sizeof(lfds700_pal_uint_t) * number_logical_processors ); + + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + *(per_thread_counters+loop) = 0; + + lfds700_ringbuffer_query( &rs, LFDS700_RINGBUFFER_QUERY_SINGLETHREADED_VALIDATE, &vi, dvs ); + + while( dvs[0] == LFDS700_MISC_VALIDITY_VALID and dvs[1] == LFDS700_MISC_VALIDITY_VALID and lfds700_ringbuffer_read(&rs, NULL, (void **) &te, &ps) ) + { + if( te->thread_number >= number_logical_processors ) + { + dvs[0] = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; + break; + } + + if( per_thread_counters[te->thread_number] == 0 ) + per_thread_counters[te->thread_number] = te->datum; + + if( te->datum < per_thread_counters[te->thread_number] ) + dvs[0] = LFDS700_MISC_VALIDITY_INVALID_ADDITIONAL_ELEMENTS; + + if( te->datum >= per_thread_counters[te->thread_number] ) + per_thread_counters[te->thread_number] = te->datum+1; + } + + free( per_thread_counters ); + + lfds700_ringbuffer_cleanup( &rs, NULL ); + + free( ts ); + + util_aligned_free( re_array ); + + free( te_array ); + + internal_display_test_result( 2, "queue", dvs[0], "freelist", dvs[1] ); + + return; +} + + + + + +/****************************************************************************/ +static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_simple_writer( void *util_thread_starter_thread_state ) +{ + enum lfds700_misc_flag + overwrite_occurred_flag; + + lfds700_pal_uint_t + time_loop = 0; + + struct lfds700_misc_prng_state + ps; + + struct test_element + *te; + + struct test_state + *ts; + + struct util_thread_starter_thread_state + *tsts; + + time_t + current_time, + start_time; + + LFDS700_MISC_MAKE_VALID_ON_CURRENT_LOGICAL_CORE_INITS_COMPLETED_BEFORE_NOW_ON_ANY_OTHER_LOGICAL_CORE; + + assert( util_thread_starter_thread_state != NULL ); + + tsts = (struct util_thread_starter_thread_state *) util_thread_starter_thread_state; + ts = (struct test_state *) tsts->thread_user_state; + + lfds700_misc_prng_init( &ps ); + + ts->te.thread_number = 0; + ts->te.datum = 0; + + lfds700_ringbuffer_write( ts->rs, NULL, &ts->te, &overwrite_occurred_flag, NULL, (void **) &te, &ps ); + + util_thread_starter_ready_and_wait( tsts ); + + current_time = start_time = time( NULL ); + + while( current_time < start_time + TEST_DURATION_IN_SECONDS ) + { + te->thread_number = ts->thread_number; + te->datum = ts->write_count++; + + lfds700_ringbuffer_write( ts->rs, NULL, te, &overwrite_occurred_flag, NULL, (void **) &te, &ps ); + + if( time_loop++ == TIME_LOOP_COUNT ) + { + time_loop = 0; + time( ¤t_time ); + } + } + + LFDS700_MISC_BARRIER_STORE; + + lfds700_misc_force_store(); + + return( (test_pal_thread_return_t) EXIT_SUCCESS ); +} + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_stack.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_stack.c new file mode 100644 index 0000000000..af3a37512a --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_stack.c @@ -0,0 +1,33 @@ +/***** includes *****/ +#include "internal.h" + + + + + +/****************************************************************************/ +#pragma warning( disable : 4127 ) // TRD : disables MSVC warning for condition expressions being const + +void test_lfds700_stack( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ) +{ + assert( list_of_logical_processors != NULL ); + // TRD : memory_in_megabytes can be any value in its range + + if( LFDS700_MISC_ATOMIC_SUPPORT_DWCAS ) + { + printf( "\n" + "Stack Tests\n" + "===========\n" ); + + test_lfds700_stack_alignment(); + test_lfds700_stack_popping( list_of_logical_processors, memory_in_megabytes ); + test_lfds700_stack_pushing( list_of_logical_processors, memory_in_megabytes ); + test_lfds700_stack_popping_and_pushing( list_of_logical_processors, memory_in_megabytes ); + test_lfds700_stack_rapid_popping_and_pushing( list_of_logical_processors ); + } + + return; +} + +#pragma warning( default : 4127 ) + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_stack_alignment.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_stack_alignment.c new file mode 100644 index 0000000000..7add41bd48 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_stack_alignment.c @@ -0,0 +1,43 @@ +/***** includes *****/ +#include "internal.h" + + + + + +/****************************************************************************/ +#pragma warning( disable : 4127 ) // TRD : disables MSVC warning for condition expressions being const + +void test_lfds700_stack_alignment() +{ + enum lfds700_misc_validity + dvs = LFDS700_MISC_VALIDITY_VALID; + + /* TRD : these are compile time checks + but we do them here because this is a test programme + and it should indicate issues to users when it is *run*, + not when it is compiled, because a compile error normally + indicates a problem with the code itself and so is misleading + */ + + internal_display_test_name( "Alignment" ); + + + + // TRD : struct lfds700_stack_state + if( offsetof(struct lfds700_stack_state,top) % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES != 0 ) + dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; + + if( offsetof(struct lfds700_stack_state,user_state) % LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES != 0 ) + dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; + + + + // TRD : print the test result + internal_display_test_result( 1, "stack", dvs ); + + return; +} + +#pragma warning( default : 4127 ) + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_stack_popping.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_stack_popping.c new file mode 100644 index 0000000000..461730604c --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_stack_popping.c @@ -0,0 +1,202 @@ +/***** includes *****/ +#include "internal.h" + +/***** structs *****/ +struct test_state +{ + struct lfds700_stack_state + *ss; +}; + +struct test_element +{ + struct lfds700_stack_element + se; + + enum flag + popped_flag; +}; + +/***** private prototypes *****/ +static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_popping( void *util_thread_starter_thread_state ); + + + + + +/****************************************************************************/ +void test_lfds700_stack_popping( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ) +{ + enum lfds700_misc_validity + dvs = LFDS700_MISC_VALIDITY_VALID; + + lfds700_pal_uint_t + loop, + number_elements, + number_logical_processors; + + struct lfds700_misc_prng_state + ps; + + struct lfds700_list_asu_element + *lasue; + + struct lfds700_stack_state + ss; + + struct lfds700_misc_validation_info + vi = { 0, 0 }; + + struct test_pal_logical_processor + *lp; + + struct util_thread_starter_state + *tts; + + struct test_element + *te_array; + + struct test_state + *ts; + + test_pal_thread_state_t + *thread_handles; + + assert( list_of_logical_processors != NULL ); + // TRD : memory_in_megabytes can be any value in its range + + /* TRD : we create a stack + + we then populate the stack with 1,000,000 elements + each void pointer of data points to the containing test element + + we then run one thread per CPU + where each thread loops, popping as quickly as possible + upon popping, a flag is set in the containing test element + + the threads run till the source stack is empty + + we then check the poppged flag, all should be raised + + then tidy up + + no CAS+GC code, as we only pop + */ + + internal_display_test_name( "Popping" ); + + lfds700_list_asu_query( list_of_logical_processors, LFDS700_LIST_ASU_QUERY_GET_POTENTIALLY_INACCURATE_COUNT, NULL, (void **) &number_logical_processors ); + + lfds700_misc_prng_init( &ps ); + + lfds700_stack_init_valid_on_current_logical_core( &ss, NULL ); + + number_elements = ( memory_in_megabytes * ONE_MEGABYTE_IN_BYTES ) / sizeof(struct test_element) ; + + te_array = util_aligned_malloc( sizeof(struct test_element) * number_elements, LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES ); + + for( loop = 0 ; loop < number_elements ; loop++ ) + { + (te_array+loop)->popped_flag = LOWERED; + LFDS700_STACK_SET_VALUE_IN_ELEMENT( (te_array+loop)->se, te_array+loop ); + lfds700_stack_push( &ss, &(te_array+loop)->se, &ps ); + } + + ts = util_aligned_malloc( sizeof(struct test_state) * number_logical_processors, LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES ); + + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + (ts+loop)->ss = &ss; + + thread_handles = util_malloc_wrapper( sizeof(test_pal_thread_state_t) * number_logical_processors ); + + util_thread_starter_new( &tts, number_logical_processors ); + + LFDS700_MISC_BARRIER_STORE; + + lfds700_misc_force_store(); + + loop = 0; + lasue = NULL; + + while( LFDS700_LIST_ASU_GET_START_AND_THEN_NEXT(*list_of_logical_processors, lasue) ) + { + lp = LFDS700_LIST_ASU_GET_VALUE_FROM_ELEMENT( *lasue ); + util_thread_starter_start( tts, &thread_handles[loop], loop, lp, thread_popping, ts+loop ); + loop++; + } + + util_thread_starter_run( tts ); + + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + test_pal_thread_wait( thread_handles[loop] ); + + util_thread_starter_delete( tts ); + + free( thread_handles ); + + LFDS700_MISC_BARRIER_LOAD; + + lfds700_stack_query( &ss, LFDS700_STACK_QUERY_SINGLETHREADED_VALIDATE, &vi, (void *) &dvs ); + + // TRD : now we check each element has popped_flag set to RAISED + for( loop = 0 ; loop < number_elements ; loop++ ) + if( (te_array+loop)->popped_flag == LOWERED ) + dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; + + // TRD : cleanup + lfds700_stack_cleanup( &ss, NULL ); + util_aligned_free( te_array ); + util_aligned_free( ts ); + + // TRD : print the test result + internal_display_test_result( 1, "stack", dvs ); + + return; +} + + + + + +/****************************************************************************/ +static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_popping( void *util_thread_starter_thread_state ) +{ + struct lfds700_misc_prng_state + ps; + + struct lfds700_stack_element + *se; + + struct test_element + *te; + + struct test_state + *ts; + + struct util_thread_starter_thread_state + *tsts; + + LFDS700_MISC_MAKE_VALID_ON_CURRENT_LOGICAL_CORE_INITS_COMPLETED_BEFORE_NOW_ON_ANY_OTHER_LOGICAL_CORE; + + assert( util_thread_starter_thread_state != NULL ); + + tsts = (struct util_thread_starter_thread_state *) util_thread_starter_thread_state; + ts = (struct test_state *) tsts->thread_user_state; + + lfds700_misc_prng_init( &ps ); + + util_thread_starter_ready_and_wait( tsts ); + + while( lfds700_stack_pop(ts->ss, &se, &ps) ) + { + te = LFDS700_STACK_GET_VALUE_FROM_ELEMENT( *se ); + te->popped_flag = RAISED; + } + + LFDS700_MISC_BARRIER_STORE; + + lfds700_misc_force_store(); + + return( (test_pal_thread_return_t) EXIT_SUCCESS ); +} + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_stack_popping_and_pushing.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_stack_popping_and_pushing.c new file mode 100644 index 0000000000..03c3254c77 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_stack_popping_and_pushing.c @@ -0,0 +1,316 @@ +/***** includes *****/ +#include "internal.h" + +/***** structs *****/ +struct test_element; + +struct test_state +{ + lfds700_pal_uint_t + number_elements; + + struct lfds700_stack_state + *ss, + ss_thread_local; + + struct test_element + *ss_thread_local_te_array; +}; + +struct test_element +{ + struct lfds700_stack_element + se, + thread_local_se; + + lfds700_pal_uint_t + datum; +}; + +/***** private prototypes *****/ +static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_popping_and_pushing_start_popping( void *util_thread_starter_thread_state ); +static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_popping_and_pushing_start_pushing( void *util_thread_starter_thread_state ); + + + + + +/****************************************************************************/ +void test_lfds700_stack_popping_and_pushing( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ) +{ + enum lfds700_misc_validity + dvs = LFDS700_MISC_VALIDITY_VALID; + + lfds700_pal_uint_t + loop, + number_elements, + number_logical_processors, + subloop; + + struct lfds700_list_asu_element + *lasue; + + struct lfds700_misc_prng_state + ps; + + struct lfds700_stack_state + ss; + + struct lfds700_misc_validation_info + vi; + + struct test_pal_logical_processor + *lp; + + struct util_thread_starter_state + *tts; + + struct test_element + *te_array; + + struct test_state + *ts; + + test_pal_thread_state_t + *thread_handles; + + assert( list_of_logical_processors != NULL ); + // TRD : memory_in_megabytes can be any value in its range + + /* TRD : we have two threads per CPU + the threads loop for ten seconds + the first thread pushes 10000 elements then pops 10000 elements + the second thread pops 10000 elements then pushes 10000 elements + all pushes and pops go onto the single main stack + + after time is up, all threads push what they have remaining onto + the main stack + + we then validate the main stack + */ + + internal_display_test_name( "Popping and pushing (%d seconds)", TEST_DURATION_IN_SECONDS ); + + lfds700_list_asu_query( list_of_logical_processors, LFDS700_LIST_ASU_QUERY_GET_POTENTIALLY_INACCURATE_COUNT, NULL, (void **) &number_logical_processors ); + + lfds700_misc_prng_init( &ps ); + + number_elements = ( memory_in_megabytes * ONE_MEGABYTE_IN_BYTES ) / ( sizeof(struct test_element) * number_logical_processors * 2 ); + + lfds700_stack_init_valid_on_current_logical_core( &ss, NULL ); + + te_array = util_aligned_malloc( sizeof(struct test_element) * number_elements * number_logical_processors, LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES ); + + // TRD : some initial elements so the pushing threads can start immediately + for( loop = 0 ; loop < number_elements * number_logical_processors ; loop++ ) + { + (te_array+loop)->datum = loop; + LFDS700_STACK_SET_VALUE_IN_ELEMENT( (te_array+loop)->se, te_array+loop ); + lfds700_stack_push( &ss, &(te_array+loop)->se, &ps ); + } + + ts = util_aligned_malloc( sizeof(struct test_state) * number_logical_processors * 2, LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES ); + + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + { + // TRD : first set of threads + (ts+loop)->ss = &ss; + (ts+loop)->number_elements = number_elements; + lfds700_stack_init_valid_on_current_logical_core( &(ts+loop)->ss_thread_local, NULL ); + + // TRD : second set of threads + (ts+loop+number_logical_processors)->ss = &ss; + (ts+loop+number_logical_processors)->number_elements = number_elements; + lfds700_stack_init_valid_on_current_logical_core( &(ts+loop+number_logical_processors)->ss_thread_local, NULL ); + + // TRD : fill the pushing thread stacks + (ts+loop+number_logical_processors)->ss_thread_local_te_array = util_aligned_malloc( sizeof(struct test_element) * number_elements, LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES ); + + for( subloop = 0 ; subloop < number_elements ; subloop++ ) + { + ((ts+loop+number_logical_processors)->ss_thread_local_te_array+subloop)->datum = loop; + LFDS700_STACK_SET_VALUE_IN_ELEMENT( ((ts+loop+number_logical_processors)->ss_thread_local_te_array+subloop)->thread_local_se, (ts+loop+number_logical_processors)->ss_thread_local_te_array+subloop ); + lfds700_stack_push( &(ts+loop+number_logical_processors)->ss_thread_local, &((ts+loop+number_logical_processors)->ss_thread_local_te_array+subloop)->thread_local_se, &ps ); + } + } + + thread_handles = util_malloc_wrapper( sizeof(test_pal_thread_state_t) * number_logical_processors * 2 ); + + util_thread_starter_new( &tts, number_logical_processors * 2 ); + + LFDS700_MISC_BARRIER_STORE; + + lfds700_misc_force_store(); + + loop = 0; + lasue = NULL; + + while( LFDS700_LIST_ASU_GET_START_AND_THEN_NEXT(*list_of_logical_processors, lasue) ) + { + lp = LFDS700_LIST_ASU_GET_VALUE_FROM_ELEMENT( *lasue ); + util_thread_starter_start( tts, &thread_handles[loop], loop, lp, thread_popping_and_pushing_start_popping, ts+loop ); + util_thread_starter_start( tts, &thread_handles[loop+number_logical_processors], loop+number_logical_processors, lp, thread_popping_and_pushing_start_pushing, ts+loop+number_logical_processors ); + loop++; + } + + util_thread_starter_run( tts ); + + for( loop = 0 ; loop < number_logical_processors * 2 ; loop++ ) + test_pal_thread_wait( thread_handles[loop] ); + + util_thread_starter_delete( tts ); + + free( thread_handles ); + + LFDS700_MISC_BARRIER_LOAD; + + vi.min_elements = vi.max_elements = number_elements * number_logical_processors * 2; + + lfds700_stack_query( &ss, LFDS700_STACK_QUERY_SINGLETHREADED_VALIDATE, &vi, &dvs ); + + lfds700_stack_cleanup( &ss, NULL ); + + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + { + lfds700_stack_cleanup( &(ts+loop)->ss_thread_local, NULL ); + lfds700_stack_cleanup( &(ts+loop+number_logical_processors)->ss_thread_local, NULL ); + util_aligned_free( (ts+loop+number_logical_processors)->ss_thread_local_te_array ); + } + + util_aligned_free( ts ); + + util_aligned_free( te_array ); + + // TRD : print the test result + internal_display_test_result( 1, "stack", dvs ); + + return; +} + + + + + + +/****************************************************************************/ +static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_popping_and_pushing_start_popping( void *util_thread_starter_thread_state ) +{ + lfds700_pal_uint_t + count; + + struct lfds700_misc_prng_state + ps; + + struct lfds700_stack_element + *se; + + struct test_state + *ts; + + struct util_thread_starter_thread_state + *tsts; + + time_t + start_time; + + LFDS700_MISC_MAKE_VALID_ON_CURRENT_LOGICAL_CORE_INITS_COMPLETED_BEFORE_NOW_ON_ANY_OTHER_LOGICAL_CORE; + + assert( util_thread_starter_thread_state != NULL ); + + tsts = (struct util_thread_starter_thread_state *) util_thread_starter_thread_state; + ts = (struct test_state *) tsts->thread_user_state; + + lfds700_misc_prng_init( &ps ); + + util_thread_starter_ready_and_wait( tsts ); + + start_time = time( NULL ); + + while( time(NULL) < start_time + TEST_DURATION_IN_SECONDS ) + { + count = 0; + + while( count < ts->number_elements ) + if( lfds700_stack_pop(ts->ss, &se, &ps) ) + { + lfds700_stack_push( &ts->ss_thread_local, se, &ps ); + count++; + } + + // TRD : return our local stack to the main stack + while( lfds700_stack_pop(&ts->ss_thread_local, &se, &ps) ) + lfds700_stack_push( ts->ss, se, &ps ); + } + + LFDS700_MISC_BARRIER_STORE; + + lfds700_misc_force_store(); + + return( (test_pal_thread_return_t) EXIT_SUCCESS ); +} + + + + + +/****************************************************************************/ +static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_popping_and_pushing_start_pushing( void *util_thread_starter_thread_state ) +{ + lfds700_pal_uint_t + count; + + struct lfds700_misc_prng_state + ps; + + struct lfds700_stack_element + *se; + + struct test_state + *ts; + + struct util_thread_starter_thread_state + *tsts; + + time_t + start_time; + + LFDS700_MISC_MAKE_VALID_ON_CURRENT_LOGICAL_CORE_INITS_COMPLETED_BEFORE_NOW_ON_ANY_OTHER_LOGICAL_CORE; + + assert( util_thread_starter_thread_state != NULL ); + + tsts = (struct util_thread_starter_thread_state *) util_thread_starter_thread_state; + ts = (struct test_state *) tsts->thread_user_state; + + lfds700_misc_prng_init( &ps ); + + util_thread_starter_ready_and_wait( tsts ); + + start_time = time( NULL ); + + while( time(NULL) < start_time + TEST_DURATION_IN_SECONDS ) + { + // TRD : return our local stack to the main stack + while( lfds700_stack_pop(&ts->ss_thread_local, &se, &ps) ) + lfds700_stack_push( ts->ss, se, &ps ); + + count = 0; + + while( count < ts->number_elements ) + if( lfds700_stack_pop(ts->ss, &se, &ps) ) + { + lfds700_stack_push( &ts->ss_thread_local, se, &ps ); + count++; + } + } + + // TRD : now push whatever we have in our local stack + while( lfds700_stack_pop(&ts->ss_thread_local, &se, &ps) ) + lfds700_stack_push( ts->ss, se, &ps ); + + LFDS700_MISC_BARRIER_STORE; + + lfds700_misc_force_store(); + + return( (test_pal_thread_return_t) EXIT_SUCCESS ); +} + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_stack_pushing.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_stack_pushing.c new file mode 100644 index 0000000000..bdf2b9b640 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_stack_pushing.c @@ -0,0 +1,251 @@ +/***** includes *****/ +#include "internal.h" + +/***** structs *****/ +struct test_state +{ + lfds700_pal_uint_t + number_elements, + thread_number; + + struct lfds700_stack_state + *ss; + + struct test_element + *te_array; +}; + +struct test_element +{ + struct lfds700_stack_element + se; + + lfds700_pal_uint_t + datum, + thread_number; +}; + +/***** private prototypes *****/ +static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_pushing( void *util_thread_starter_thread_state ); + + + + + +/****************************************************************************/ +void test_lfds700_stack_pushing( struct lfds700_list_asu_state *list_of_logical_processors, lfds700_pal_uint_t memory_in_megabytes ) +{ + enum lfds700_misc_validity + dvs = LFDS700_MISC_VALIDITY_VALID; + + lfds700_pal_uint_t + loop, + number_elements, + number_logical_processors, + *per_thread_counters; + + struct lfds700_list_asu_element + *lasue; + + struct lfds700_misc_prng_state + ps; + + struct lfds700_stack_element + *se; + + struct lfds700_stack_state + ss; + + struct lfds700_misc_validation_info + vi; + + struct test_pal_logical_processor + *lp; + + struct util_thread_starter_state + *tts; + + struct test_element + *te, + *first_te = NULL; + + struct test_state + *ts; + + test_pal_thread_state_t + *thread_handles; + + assert( list_of_logical_processors != NULL ); + // TRD : memory_in_megabytes can be any value in its range + + /* TRD : we create an empty stack + + we then create one thread per CPU, where each thread + pushes 100,000 elements each as quickly as possible to the stack + (the threads themselves alloc these elements, to obtain NUMA closeness) + + the data pushed is a counter and a thread ID + + the threads exit when the stack is full + + we then validate the stack; + + checking that the counts increment on a per unique ID basis + and that the number of elements we pop equals 100,000 per thread + (since each element has an incrementing counter which is + unique on a per unique ID basis, we can know we didn't lose + any elements) + + there's no CAS+GC code, as we only push + */ + + internal_display_test_name( "Pushing" ); + + lfds700_list_asu_query( list_of_logical_processors, LFDS700_LIST_ASU_QUERY_GET_POTENTIALLY_INACCURATE_COUNT, NULL, (void **) &number_logical_processors ); + + lfds700_misc_prng_init( &ps ); + + number_elements = ( memory_in_megabytes * ONE_MEGABYTE_IN_BYTES ) / ( sizeof(struct test_element) * number_logical_processors ); + + ts = util_malloc_wrapper( sizeof(struct test_state) * number_logical_processors ); + + // TRD : the main stack + lfds700_stack_init_valid_on_current_logical_core( &ss, NULL ); + + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + { + (ts+loop)->ss = &ss; + (ts+loop)->thread_number = loop; + (ts+loop)->number_elements = number_elements; + } + + thread_handles = util_malloc_wrapper( sizeof(test_pal_thread_state_t) * number_logical_processors ); + + util_thread_starter_new( &tts, number_logical_processors ); + + LFDS700_MISC_BARRIER_STORE; + + lfds700_misc_force_store(); + + loop = 0; + lasue = NULL; + + while( LFDS700_LIST_ASU_GET_START_AND_THEN_NEXT(*list_of_logical_processors, lasue) ) + { + lp = LFDS700_LIST_ASU_GET_VALUE_FROM_ELEMENT( *lasue ); + util_thread_starter_start( tts, &thread_handles[loop], loop, lp, thread_pushing, ts+loop ); + loop++; + } + + util_thread_starter_run( tts ); + + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + test_pal_thread_wait( thread_handles[loop] ); + + util_thread_starter_delete( tts ); + + free( thread_handles ); + + LFDS700_MISC_BARRIER_LOAD; + + // TRD : the stack is now fully pushed; time to verify + per_thread_counters = util_malloc_wrapper( sizeof(lfds700_pal_uint_t) * number_logical_processors ); + + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + *(per_thread_counters+loop) = number_elements - 1; + + vi.min_elements = vi.max_elements = number_elements * number_logical_processors; + + lfds700_stack_query( &ss, LFDS700_STACK_QUERY_SINGLETHREADED_VALIDATE, &vi, &dvs ); + + while( dvs == LFDS700_MISC_VALIDITY_VALID and lfds700_stack_pop(&ss, &se, &ps) ) + { + te = LFDS700_STACK_GET_VALUE_FROM_ELEMENT( *se ); + + if( first_te == NULL ) + first_te = te; + + if( te->thread_number >= number_logical_processors ) + { + dvs = LFDS700_MISC_VALIDITY_INVALID_TEST_DATA; + break; + } + + if( te->datum > per_thread_counters[te->thread_number] ) + dvs = LFDS700_MISC_VALIDITY_INVALID_ADDITIONAL_ELEMENTS; + + if( te->datum < per_thread_counters[te->thread_number] ) + dvs = LFDS700_MISC_VALIDITY_INVALID_MISSING_ELEMENTS; + + if( te->datum == per_thread_counters[te->thread_number] ) + per_thread_counters[te->thread_number]--; + } + + // TRD : clean up + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + util_aligned_free( (ts+loop)->te_array ); + + free( per_thread_counters ); + + free( ts ); + + lfds700_stack_cleanup( &ss, NULL ); + + // TRD : print the test result + internal_display_test_result( 1, "stack", dvs ); + + return; +} + + + + + +/****************************************************************************/ +static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_pushing( void *util_thread_starter_thread_state ) +{ + lfds700_pal_uint_t + loop; + + struct lfds700_misc_prng_state + ps; + + struct test_state + *ts; + + struct util_thread_starter_thread_state + *tsts; + + LFDS700_MISC_MAKE_VALID_ON_CURRENT_LOGICAL_CORE_INITS_COMPLETED_BEFORE_NOW_ON_ANY_OTHER_LOGICAL_CORE; + + assert( util_thread_starter_thread_state != NULL ); + + tsts = (struct util_thread_starter_thread_state *) util_thread_starter_thread_state; + ts = (struct test_state *) tsts->thread_user_state; + + lfds700_misc_prng_init( &ps ); + + // TRD : alloc local 100,000 elements + ts->te_array = util_aligned_malloc( sizeof(struct test_element) * ts->number_elements, LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES ); + + for( loop = 0 ; loop < ts->number_elements ; loop++ ) + { + (ts->te_array+loop)->thread_number = ts->thread_number; + (ts->te_array+loop)->datum = loop; + } + + util_thread_starter_ready_and_wait( tsts ); + + for( loop = 0 ; loop < ts->number_elements ; loop++ ) + { + LFDS700_STACK_SET_VALUE_IN_ELEMENT( (ts->te_array+loop)->se, ts->te_array+loop ); + lfds700_stack_push( ts->ss, &(ts->te_array+loop)->se, &ps ); + } + + LFDS700_MISC_BARRIER_STORE; + + lfds700_misc_force_store(); + + return( (test_pal_thread_return_t) EXIT_SUCCESS ); +} + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_stack_rapid_popping_and_pushing.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_stack_rapid_popping_and_pushing.c new file mode 100644 index 0000000000..d771457c86 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_lfds700_stack_rapid_popping_and_pushing.c @@ -0,0 +1,217 @@ +/***** includes *****/ +#include "internal.h" + +/***** structs *****/ +struct test_state +{ + struct lfds700_stack_state + *ss; +}; + +struct test_element +{ + struct lfds700_stack_element + se; + + lfds700_pal_uint_t + datum; +}; + +/***** private prototypes *****/ +static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_rapid_popping_and_pushing( void *util_thread_starter_thread_state ); + + + + + +/****************************************************************************/ +void test_lfds700_stack_rapid_popping_and_pushing( struct lfds700_list_asu_state *list_of_logical_processors ) +{ + enum lfds700_misc_validity + dvs = LFDS700_MISC_VALIDITY_VALID; + + lfds700_pal_uint_t + loop, + number_logical_processors; + + struct lfds700_misc_prng_state + ps; + + struct lfds700_list_asu_element + *lasue; + + struct lfds700_stack_state + ss; + + struct lfds700_misc_validation_info + vi = { 0, 0 }; + + struct test_pal_logical_processor + *lp; + + struct util_thread_starter_state + *tts; + + struct test_element + *te_array; + + struct test_state + *ts; + + test_pal_thread_state_t + *thread_handles; + + assert( list_of_logical_processors != NULL ); + // TRD : st can be any value in its range + + /* TRD : in these tests there is a fundamental antagonism between + how much checking/memory clean up that we do and the + likelyhood of collisions between threads in their lock-free + operations + + the lock-free operations are very quick; if we do anything + much at all between operations, we greatly reduce the chance + of threads colliding + + so we have some tests which do enough checking/clean up that + they can tell the stack is valid and don't leak memory + and here, this test now is one of those which does minimal + checking - in fact, the nature of the test is that you can't + do any real checking - but goes very quickly + + what we do is create a small stack and then run one thread + per CPU, where each thread simply pushes and then immediately + pops + + the test runs for ten seconds + + after the test is done, the only check we do is to traverse + the stack, checking for loops and ensuring the number of + elements is correct + */ + + internal_display_test_name( "Rapid popping and pushing (%d seconds)", TEST_DURATION_IN_SECONDS ); + + lfds700_list_asu_query( list_of_logical_processors, LFDS700_LIST_ASU_QUERY_GET_POTENTIALLY_INACCURATE_COUNT, NULL, (void **) &number_logical_processors ); + + lfds700_misc_prng_init( &ps ); + + ts = util_malloc_wrapper( sizeof(struct test_state) * number_logical_processors ); + + lfds700_stack_init_valid_on_current_logical_core( &ss, NULL ); + + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + (ts+loop)->ss = &ss; + + thread_handles = util_malloc_wrapper( sizeof(test_pal_thread_state_t) * number_logical_processors ); + + // TRD : we need one element per thread + te_array = util_aligned_malloc( sizeof(struct test_element) * number_logical_processors, LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES ); + + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + { + LFDS700_STACK_SET_VALUE_IN_ELEMENT( (te_array+loop)->se, te_array+loop ); + lfds700_stack_push( &ss, &(te_array+loop)->se, &ps ); + } + + util_thread_starter_new( &tts, number_logical_processors ); + + LFDS700_MISC_BARRIER_STORE; + + lfds700_misc_force_store(); + + loop = 0; + lasue = NULL; + + while( LFDS700_LIST_ASU_GET_START_AND_THEN_NEXT(*list_of_logical_processors, lasue) ) + { + lp = LFDS700_LIST_ASU_GET_VALUE_FROM_ELEMENT( *lasue ); + util_thread_starter_start( tts, &thread_handles[loop], loop, lp, thread_rapid_popping_and_pushing, ts+loop ); + loop++; + } + + util_thread_starter_run( tts ); + + for( loop = 0 ; loop < number_logical_processors ; loop++ ) + test_pal_thread_wait( thread_handles[loop] ); + + util_thread_starter_delete( tts ); + + free( thread_handles ); + + LFDS700_MISC_BARRIER_LOAD; + + vi.min_elements = vi.max_elements = number_logical_processors; + + lfds700_stack_query( &ss, LFDS700_STACK_QUERY_SINGLETHREADED_VALIDATE, &vi, &dvs ); + + lfds700_stack_cleanup( &ss, NULL ); + + util_aligned_free( te_array ); + + free( ts ); + + // TRD : print the test result + internal_display_test_result( 1, "stack", dvs ); + + return; +} + + + + + +/****************************************************************************/ +static test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION thread_rapid_popping_and_pushing( void *util_thread_starter_thread_state ) +{ + lfds700_pal_uint_t + time_loop = 0; + + struct lfds700_misc_prng_state + ps; + + struct lfds700_stack_element + *se; + + struct test_state + *ts; + + struct util_thread_starter_thread_state + *tsts; + + time_t + current_time, + start_time; + + LFDS700_MISC_MAKE_VALID_ON_CURRENT_LOGICAL_CORE_INITS_COMPLETED_BEFORE_NOW_ON_ANY_OTHER_LOGICAL_CORE; + + assert( util_thread_starter_thread_state != NULL ); + + tsts = (struct util_thread_starter_thread_state *) util_thread_starter_thread_state; + ts = (struct test_state *) tsts->thread_user_state; + + lfds700_misc_prng_init( &ps ); + + util_thread_starter_ready_and_wait( tsts ); + + current_time = start_time = time( NULL ); + + while( current_time < start_time + TEST_DURATION_IN_SECONDS ) + { + lfds700_stack_pop( ts->ss, &se, &ps ); + lfds700_stack_push( ts->ss, se, &ps ); + + if( time_loop++ == TIME_LOOP_COUNT ) + { + time_loop = 0; + time( ¤t_time ); + } + } + + LFDS700_MISC_BARRIER_STORE; + + lfds700_misc_force_store(); + + return( (test_pal_thread_return_t) EXIT_SUCCESS ); +} + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_porting_abstraction_layer_get_logical_core_ids.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_porting_abstraction_layer_get_logical_core_ids.c new file mode 100644 index 0000000000..eb62c5b4cc --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_porting_abstraction_layer_get_logical_core_ids.c @@ -0,0 +1,245 @@ +/***** includes *****/ +#include "internal.h" + + + + + +/****************************************************************************/ +#if( defined _WIN32 && !defined _KERNEL_MODE && NTDDI_VERSION >= NTDDI_WIN7 ) + + /* TRD : _WIN32 indicates 64-bit or 32-bit Windows + !_KERNEL_MODE indicates Windows user-mode + NTDDI_VERSION indicates Windows version + - GetLogicalProcessorInformationEx requires Windows 7 + */ + + #ifdef TEST_PAL_GET_LOGICAL_CORE_IDS + #error More than one porting abstraction layer matches current platform in test_porting_abstraction_layer_get_logical_core_ids.c + #endif + + #define TEST_PAL_GET_LOGICAL_CORE_IDS + + void test_pal_get_logical_core_ids( struct lfds700_list_asu_state *lasus ) + { + BOOL + rv; + + DWORD + loop, + number_slpie, + slpie_length = 0; + + lfds700_pal_uint_t + bitmask, + logical_processor_number, + windows_logical_processor_group_number; + + struct lfds700_misc_prng_state + ps; + + struct test_pal_logical_processor + *lp; + + SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX + *slpie = NULL; + + assert( lasus != NULL ); + + lfds700_misc_prng_init( &ps ); + + lfds700_list_asu_init_valid_on_current_logical_core( lasus, NULL, NULL ); + + rv = GetLogicalProcessorInformationEx( RelationGroup, slpie, &slpie_length ); + slpie = malloc( slpie_length ); + rv = GetLogicalProcessorInformationEx( RelationGroup, slpie, &slpie_length ); + number_slpie = slpie_length / sizeof(SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX); + + for( loop = 0 ; loop < number_slpie ; loop++ ) + if( (slpie+loop)->Relationship == RelationGroup ) + for( windows_logical_processor_group_number = 0 ; windows_logical_processor_group_number < (slpie+loop)->Group.ActiveGroupCount ; windows_logical_processor_group_number++ ) + for( logical_processor_number = 0 ; logical_processor_number < sizeof(KAFFINITY) * BITS_PER_BYTE ; logical_processor_number++ ) + { + bitmask = (lfds700_pal_uint_t) 1 << logical_processor_number; + + // TRD : if we've found a processor for this group, add it to the list + if( (slpie+loop)->Group.GroupInfo[windows_logical_processor_group_number].ActiveProcessorMask & bitmask ) + { + lp = util_aligned_malloc( sizeof(struct test_pal_logical_processor), LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES ); + + lp->logical_processor_number = logical_processor_number; + lp->windows_logical_processor_group_number = windows_logical_processor_group_number; + + LFDS700_LIST_ASU_SET_VALUE_IN_ELEMENT( lp->lasue, lp ); + lfds700_list_asu_insert_at_start( lasus, &lp->lasue, &ps ); + } + } + + free( slpie ); + + return; + } + +#endif + + + + + +/****************************************************************************/ +#if( defined _WIN32 && !defined _KERNEL_MODE && NTDDI_VERSION >= NTDDI_WINXP && NTDDI_VERSION < NTDDI_WIN7 ) + + /* TRD : _WIN32 indicates 64-bit or 32-bit Windows + !_KERNEL_MODE indicates Windows user-mode + NTDDI_VERSION indicates Windows version + - GetLogicalProcessorInformation requires XP SP3 + */ + + #ifdef TEST_PAL_GET_LOGICAL_CORE_IDS + #error More than one porting abstraction layer matches current platform in test_porting_abstraction_layer_get_logical_core_ids.c + #endif + + #define TEST_PAL_GET_LOGICAL_CORE_IDS + + void test_pal_get_logical_core_ids( struct lfds700_list_asu_state *lasus ) + { + DWORD + slpi_length = 0; + + lfds700_pal_uint_t + number_slpi, + loop; + + struct lfds700_misc_prng_state + ps; + + struct test_pal_logical_processor + *lp; + + SYSTEM_LOGICAL_PROCESSOR_INFORMATION + *slpi = NULL; + + ULONG_PTR + mask; + + assert( lasus != NULL ); + + lfds700_misc_prng_init( &ps ); + + lfds700_list_asu_init_valid_on_current_logical_core( lasus, NULL, NULL ); + + *number_logical_processors = 0; + + GetLogicalProcessorInformation( slpi, &slpi_length ); + slpi = malloc( slpi_length ); + GetLogicalProcessorInformation( slpi, &slpi_length ); + number_slpi = slpi_length / sizeof(SYSTEM_LOGICAL_PROCESSOR_INFORMATION); + + for( loop = 0 ; loop < number_slpi ; loop++ ) + if( (slpi+loop)->Relationship == RelationProcessorCore ) + for( logical_processor_number = 0 ; logical_processor_number < sizeof(ULONG_PTR) * BITS_PER_BYTE ; logical_processor_number++ ) + { + bitmask = 1 << logical_processor_number; + + if( (slpi+loop)->ProcessorMask & bitmask ) + { + lp = util_aligned_malloc( sizeof(struct test_pal_logical_processor), LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES ); + + lp->logical_processor_number = logical_processor_number; + lp->windows_logical_processor_group_number = 0; + + LFDS700_LIST_ASU_SET_VALUE_IN_ELEMENT( lp->lasue, lp ); + lfds700_list_asu_insert_at_start( lasus, &lp->lasue, &ps ); + } + + free( slpi ); + + return; + } + +#endif + + + + + +/****************************************************************************/ +#if( defined __linux__ ) + + /* TRD : __linux__ indicates Linux + __STDC__ indicates Standard Library + __STDC_HOSTED__ indicates Standard Library hosted implementation + - fopen requires a Standard Library hosted environment + - setbuf requires a Standard Library hosted environment + - fgets requires a Standard Library hosted environment + - sscanf requires a Standard Library hosted environment + - fclose requires a Standard Library hosted environment + */ + + #ifdef TEST_PAL_GET_LOGICAL_CORE_IDS + #error More than one porting abstraction layer matches current platform in test_porting_abstraction_layer_get_logical_core_ids.c + #endif + + #define TEST_PAL_GET_LOGICAL_CORE_IDS + + void test_pal_get_logical_core_ids( struct lfds700_list_asu_state *lasus ) + { + char + diskbuffer[BUFSIZ], + string[1024]; + + FILE + *diskfile; + + int long long unsigned + logical_processor_number; + + struct lfds700_misc_prng_state + ps; + + struct test_pal_logical_processor + *lp; + + assert( lasus != NULL ); + + lfds700_misc_prng_init( &ps ); + + lfds700_list_asu_init_valid_on_current_logical_core( lasus, NULL, NULL ); + + diskfile = fopen( "/proc/cpuinfo", "r" ); + + if( diskfile != NULL ) + { + setbuf( diskfile, diskbuffer ); + + while( NULL != fgets(string, 1024, diskfile) ) + if( 1 == sscanf(string, "processor : %llu", &logical_processor_number) ) + { + lp = util_aligned_malloc( sizeof(struct test_pal_logical_processor), LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES ); + + lp->logical_processor_number = (lfds700_pal_uint_t) logical_processor_number; + lp->windows_logical_processor_group_number = 0; + + LFDS700_LIST_ASU_SET_VALUE_IN_ELEMENT( lp->lasue, lp ); + lfds700_list_asu_insert_at_start( lasus, &lp->lasue, &ps ); + } + + fclose( diskfile ); + } + + return; + } + +#endif + + + + + +/****************************************************************************/ +#if( !defined TEST_PAL_GET_LOGICAL_CORE_IDS ) + + #error test_pal_get_logical_core_ids() not implemented for this platform. + +#endif + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_porting_abstraction_layer_operating_system.h b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_porting_abstraction_layer_operating_system.h new file mode 100644 index 0000000000..1c0ab03eee --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_porting_abstraction_layer_operating_system.h @@ -0,0 +1,82 @@ +/****************************************************************************/ +#if( defined _MSC_VER ) + /* TRD : MSVC compiler + + an unfortunately necessary hack for MSVC + MSVC only defines __STDC__ if /Za is given, where /Za turns off MSVC C extensions - + which prevents Windows header files from compiling. + */ + + #define __STDC__ 1 + #define __STDC_HOSTED__ 1 +#endif + +#if( defined __linux__ ) + #define _GNU_SOURCE + #include +#endif + + + + + +/****************************************************************************/ +#if( defined _MSC_VER && _MSC_VER >= 1310 && NTDDI_VERSION >= NTDDI_WINXP && defined _WIN32 ) + + #ifdef TEST_PAL_PORTING_ABSTRACTION_LAYER + #error More than one porting abstraction layer matches current platform. + #endif + + #define TEST_PAL_PORTING_ABSTRACTION_LAYER + + #define TEST_PAL_OS_STRING "Windows" + + #include + + typedef HANDLE test_pal_thread_state_t; + typedef DWORD test_pal_thread_return_t; + + #define TEST_PAL_CALLING_CONVENTION WINAPI + +#endif + + + + + +/****************************************************************************/ +#if( defined __GNUC__ && defined __linux__ && _POSIX_THREADS > 0 ) + + #ifdef TEST_PAL_PORTING_ABSTRACTION_LAYER + #error More than one porting abstraction layer matches current platform. + #endif + + #define TEST_PAL_PORTING_ABSTRACTION_LAYER + + #define TEST_PAL_OS_STRING "Linux" + + #define _GNU_SOURCE + + #include + #include + #include + #include + + typedef pthread_t test_pal_thread_state_t; + typedef void * test_pal_thread_return_t; + + #define TEST_PAL_CALLING_CONVENTION + +#endif + + + + + +/****************************************************************************/ +#if( !defined TEST_PAL_PORTING_ABSTRACTION_LAYER ) + + #error No matching porting abstraction layer in test_porting_abstraction_layer_operating_system.h + +#endif + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_porting_abstraction_layer_thread_start.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_porting_abstraction_layer_thread_start.c new file mode 100644 index 0000000000..83a09814aa --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_porting_abstraction_layer_thread_start.c @@ -0,0 +1,336 @@ +/***** includes *****/ +#include "internal.h" + + + + + +/****************************************************************************/ +#if( defined _WIN32 && !defined _KERNEL_MODE && NTDDI_VERSION >= NTDDI_WIN7 ) + + /* TRD : _WIN32 indicates 32-bit or 64-bit Windows + !_KERNEL_MODE indicates Windows user-mode + NTDDI_VERSION indicates Windows version + - GetCurrentProcess requires XP + - InitializeProcThreadAttributeList requires Windows 7 + - CreateRemoteThreadEx requires Windows 7 + */ + + #ifdef TEST_PAL_THREAD_START + #error More than one porting abstraction layer matches the current platform in test_porting_abstraction_layer_thread_start.c + #endif + + #define TEST_PAL_THREAD_START + + int test_pal_thread_start( test_pal_thread_state_t *thread_state, + struct test_pal_logical_processor *lp, + test_pal_thread_return_t (TEST_PAL_CALLING_CONVENTION *thread_function)(void *thread_user_state), + void *thread_user_state ) + { + BOOL + brv; + + DWORD + thread_id; + + GROUP_AFFINITY + ga; + + int + rv = 0; + + LPPROC_THREAD_ATTRIBUTE_LIST + attribute_list; + + SIZE_T + attribute_list_length; + + assert( thread_state != NULL ); + assert( lp != NULL ); + assert( thread_function != NULL ); + // TRD : thread_user_state can be NULL + + /* TRD : here we're using CreateRemoteThreadEx() to start a thread in our own process + we do this because as a function, it allows us to specify processor and processor group affinity in the create call + */ + + brv = InitializeProcThreadAttributeList( NULL, 1, 0, &attribute_list_length ); + attribute_list = malloc( attribute_list_length ); + brv = InitializeProcThreadAttributeList( attribute_list, 1, 0, &attribute_list_length ); + + ga.Mask = ( (KAFFINITY) 1 << lp->logical_processor_number ); + ga.Group = (WORD) lp->windows_logical_processor_group_number; + memset( ga.Reserved, 0, sizeof(WORD) * 3 ); + + brv = UpdateProcThreadAttribute( attribute_list, 0, PROC_THREAD_ATTRIBUTE_GROUP_AFFINITY, &ga, sizeof(GROUP_AFFINITY), NULL, NULL ); + *thread_state = CreateRemoteThreadEx( GetCurrentProcess(), NULL, 0, thread_function, thread_user_state, NO_FLAGS, attribute_list, &thread_id ); + + DeleteProcThreadAttributeList( attribute_list ); + free( attribute_list ); + + if( *thread_state != NULL ) + rv = 1; + + return( rv ); + } + +#endif + + + + + +/****************************************************************************/ +#if( defined _WIN32 && !defined _KERNEL_MODE && NTDDI_VERSION >= NTDDI_WINXP && NTDDI_VERSION < NTDDI_WIN7 ) + + /* TRD : _WIN32 indicates 64-bit or 32-bit Windows + NTDDI_VERSION indicates Windows version + - CreateThread requires XP + - SetThreadAffinityMask requires XP + - ResumeThread requires XP + */ + + #ifdef TEST_PAL_THREAD_START + #error More than one porting abstraction layer matches the current platform in test_porting_abstraction_layer_thread_start.c + #endif + + #define TEST_PAL_THREAD_START + + int test_pal_thread_start( test_pal_thread_state_t *thread_state, + struct test_pal_logical_processor *lp, + test_pal_thread_return_t (TEST_PAL_CALLING_CONVENTION *thread_function)(void *thread_user_state), + void *thread_user_state ) + { + int + rv = 0; + + DWORD + thread_id; + + DWORD_PTR + affinity_mask, + result; + + assert( thread_state != NULL ); + assert( lp != NULL ); + assert( thread_function != NULL ); + // TRD : thread_user_state can be NULL + + /* TRD : Vista and earlier do not support processor groups + as such, there is a single implicit processor group + also, there's no support for actually starting a thread in its correct NUMA node / logical processor + so we make the best of it; we start suspended, set the affinity, and then resume + the thread itself internally is expected to be making allocs from the correct NUMA node + */ + + *thread_state = CreateThread( NULL, 0, thread_function, thread_user_state, CREATE_SUSPENDED, &thread_id ); + + affinity_mask = (DWORD_PTR) (1 << lp->logical_processor_number); + + SetThreadAffinityMask( *thread_state, affinity_mask ); + + ResumeThread( *thread_state ); + + if( *thread_state != NULL ) + rv = 1; + + return( rv ); + } + +#endif + + + + + +/****************************************************************************/ +#if( defined __linux__ && _POSIX_THREADS > 0 ) + + /* TRD : __linux__ indicates Linux + - gettid requires Linux + - sched_setaffinity requires Linux + _POSIX_THREADS indicates POSIX threads + - pthread_create requires POSIX + */ + + #ifdef TEST_PAL_THREAD_START + #error More than one porting abstraction layer matches the current platform in test_porting_abstraction_layer_thread_start.c + #endif + + #define TEST_PAL_THREAD_START + + /***** structs *****/ + struct test_pal_internal_thread_state + { + struct test_pal_logical_processor + lp; + + test_pal_thread_return_t + (TEST_PAL_CALLING_CONVENTION *thread_function)( void *thread_user_state ); + + void + *thread_user_state; + }; + + /***** prototypes *****/ + test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION test_pal_internal_thread_function( void *thread_user_state ); + + /****************************************************************************/ + int test_pal_thread_start( test_pal_thread_state_t *thread_state, + struct test_pal_logical_processor *lp, + test_pal_thread_return_t (TEST_PAL_CALLING_CONVENTION *thread_function)(void *thread_user_state), + void *thread_user_state ) + { + int + rv; + + struct test_pal_internal_thread_state + *its; + + /* TRD : this implementation works on Linux only as it uses sched_setaffinity(), which is Linux specific + although I cannot currently test, I believe this function also works on Android + + this implementation exists because the pthreads function for setting thread affinity, + pthread_attr_setaffinity_np(), works on Linux, but not Android + */ + + assert( thread_state != NULL ); + assert( lp != NULL ); + assert( thread_function != NULL ); + // TRD : thread_user_state can be NULL + + its = malloc( sizeof(struct test_pal_internal_thread_state) ); + + its->lp = *lp; + its->thread_function = thread_function; + its->thread_user_state = thread_user_state; + + rv = pthread_create( thread_state, NULL, test_pal_internal_thread_function, its ); + + if( rv == 0 ) + rv = 1; + + return( rv ); + } + + /****************************************************************************/ + test_pal_thread_return_t TEST_PAL_CALLING_CONVENTION test_pal_internal_thread_function( void *thread_user_state ) + { + cpu_set_t + cpuset; + + pid_t + tid; + + struct test_pal_internal_thread_state + *its; + + test_pal_thread_return_t + rv; + + assert( thread_user_state != NULL ); + + /* TRD : the APIs under Linux/POSIX for setting thread affinity are in a mess + pthreads offers pthread_attr_setaffinity_np(), which glibc supports, + but which is not supported by Android + Linux offers sched_setaffinity(), but this needs a *thread pid*, + and the only API to get a thread pid is gettid(), which works for + and only for *the calling thread* + + so we come to this - a wrapper thread function, which is the function used + when starting a thread; this calls gettid() and then sched_setaffinity(), + and then calls into the actual thread function + + generally shaking my head in disbelief at this point + */ + + assert( thread_user_state != NULL ); + + its = (struct test_pal_internal_thread_state *) thread_user_state; + + CPU_ZERO( &cpuset ); + CPU_SET( its->lp.logical_processor_number, &cpuset ); + + tid = syscall( SYS_gettid ); + + sched_setaffinity( tid, sizeof(cpu_set_t), &cpuset ); + + rv = its->thread_function( its->thread_user_state ); + + free( its ); + + return( rv ); + } + +#endif + + + + + +/****************************************************************************/ +#if( !defined __linux__ && _POSIX_THREADS > 0 ) + + /* TRD : !__linux__ indicates not Linux + _POSIX_THREADS indicates POSIX threads + - pthread_attr_init requires POSIX + - pthread_attr_setaffinity_np requires POSIX + - pthread_create requires POSIX + - pthread_attr_destroy requires POSIX + */ + + #ifdef TEST_PAL_THREAD_START + #error More than one porting abstraction layer matches the current platform in test_porting_abstraction_layer_thread_start.c + #endif + + #define TEST_PAL_THREAD_START + + int test_pal_thread_start( test_pal_thread_state_t *thread_state, + struct test_pal_logical_processor *lp, + test_pal_thread_return_t (TEST_PAL_CALLING_CONVENTION *thread_function)(void *thread_user_state), + void *thread_user_state ) + { + int + rv = 0, + rv_create; + + cpu_set_t + cpuset; + + pthread_attr_t + attr; + + assert( thread_state != NULL ); + assert( lp != NULL ); + assert( thread_function != NULL ); + // TRD : thread_user_state can be NULL + + pthread_attr_init( &attr ); + + CPU_ZERO( &cpuset ); + CPU_SET( lp->logical_processor_number, &cpuset ); + pthread_attr_setaffinity_np( &attr, sizeof(cpuset), &cpuset ); + + rv_create = pthread_create( thread_state, &attr, thread_function, thread_user_state ); + + if( rv_create == 0 ) + rv = 1; + + pthread_attr_destroy( &attr ); + + return( rv ); + } + +#endif + + + + + +/****************************************************************************/ +#if( !defined TEST_PAL_THREAD_START ) + + #error test_pal_thread_start() not implemented for this platform. + +#endif + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_porting_abstraction_layer_thread_wait.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_porting_abstraction_layer_thread_wait.c new file mode 100644 index 0000000000..bd4a8c01f7 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/test_porting_abstraction_layer_thread_wait.c @@ -0,0 +1,69 @@ +/***** includes *****/ +#include "internal.h" + + + + + +/****************************************************************************/ +#if( defined _WIN32 && NTDDI_VERSION >= NTDDI_WINXP ) + + /* TRD : _WIN32 indicates 32-bit or 64-bit Windows + NTDDI_VERSION indicates Windows version + - WaitForSingleObject requires XP + */ + + #ifdef TEST_PAL_THREAD_WAIT + #error More than one porting abstraction layer matches current platform in test_porting_abstraction_layer_thread_wait.c + #endif + + #define TEST_PAL_THREAD_WAIT + + void test_pal_thread_wait( test_pal_thread_state_t thread_state ) + { + WaitForSingleObject( thread_state, INFINITE ); + + return; + } + +#endif + + + + + +/****************************************************************************/ +#if( _POSIX_THREADS > 0 ) + + /* TRD : POSIX threads + + _POSIX_THREADS indicates POSIX threads + - pthread_join requires POSIX + */ + + #ifdef TEST_PAL_THREAD_WAIT + #error More than one porting abstraction layer matches current platform in test_porting_abstraction_layer_thread_wait.c + #endif + + #define TEST_PAL_THREAD_WAIT + + void test_pal_thread_wait( test_pal_thread_state_t thread_state ) + { + pthread_join( thread_state, NULL ); + + return; + } + +#endif + + + + + +/****************************************************************************/ +#if( !defined TEST_PAL_THREAD_WAIT ) + + #error test_pal_thread_wait() not implemented for this platform. + +#endif + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/util_cmdline.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/util_cmdline.c new file mode 100644 index 0000000000..9173d607c9 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/util_cmdline.c @@ -0,0 +1,184 @@ +/***** includes *****/ +#include "internal.h" + + + + + +/****************************************************************************/ +void util_cmdline_init( struct util_cmdline_state *cs ) +{ + lfds700_pal_uint_t + loop; + + assert( cs != NULL ); + + for( loop = 0 ; loop < NUMBER_OF_LOWERCASE_LETTERS_IN_LATIN_ALPHABET ; loop++ ) + { + cs->args[loop].arg_type = LIBCOMMON_CMDLINE_ARG_TYPE_UNSET; + cs->args[loop].processed_flag = LOWERED; + } + + return; +} + + + + + +/****************************************************************************/ +#pragma warning( disable : 4100 ) + +void util_cmdline_cleanup( struct util_cmdline_state *cs ) +{ + assert( cs != NULL ); + + return; +} + +#pragma warning( default : 4100 ) + + + + + +/****************************************************************************/ +void util_cmdline_add_arg( struct util_cmdline_state *cs, char arg_letter, enum util_cmdline_arg_type arg_type ) +{ + lfds700_pal_uint_t + index; + + assert( cs != NULL ); + assert( arg_letter >= 'a' and arg_letter <= 'z' ); + // TRD : arg_type can be any value in its range + + index = arg_letter - 'a'; + + cs->args[index].arg_type = arg_type; + + if( arg_type == LIBCOMMON_CMDLINE_ARG_TYPE_FLAG ) + cs->args[index].arg_data.flag.flag = LOWERED; + + return; +} + + + + + +/****************************************************************************/ +int util_cmdline_process_args( struct util_cmdline_state *cs, int argc, char **argv ) +{ + char + *arg; + + int + arg_letter, + cc, + loop, + rv = 1; + + lfds700_pal_uint_t + index; + + assert( cs != NULL ); + assert( argc >= 1 ); + assert( argv != NULL ); + + for( loop = 1 ; loop < argc ; loop++ ) + { + arg = *(argv+loop); + + switch( *arg ) + { + case '-': + arg_letter = tolower( *(arg+1) ); + + if( arg_letter >= 'a' and arg_letter <= 'z' ) + { + index = arg_letter - 'a'; + + switch( cs->args[index].arg_type ) + { + case LIBCOMMON_CMDLINE_ARG_TYPE_INTEGER_RANGE: + if( loop+1 >= argc ) + rv = 0; + + if( loop+1 < argc ) + { + cc = sscanf( *(argv+loop+1), "%llu-%llu", &cs->args[index].arg_data.integer_range.integer_start, &cs->args[index].arg_data.integer_range.integer_end ); + + if( cc != 2 ) + rv = 0; + + if( cc == 2 ) + { + cs->args[index].processed_flag = RAISED; + loop++; + } + } + break; + + case LIBCOMMON_CMDLINE_ARG_TYPE_INTEGER: + if( loop+1 >= argc ) + rv = 0; + + if( loop+1 < argc ) + { + cc = sscanf( *(argv+loop+1), "%llu", &cs->args[index].arg_data.integer.integer ); + + if( cc != 1 ) + rv = 0; + + if( cc == 1 ) + { + cs->args[index].processed_flag = RAISED; + loop++; + } + } + break; + + case LIBCOMMON_CMDLINE_ARG_TYPE_FLAG: + cs->args[index].arg_data.flag.flag = RAISED; + cs->args[index].processed_flag = RAISED; + break; + + case LIBCOMMON_CMDLINE_ARG_TYPE_UNSET: + break; + } + } + break; + + default: + rv = 0; + break; + } + } + + return( rv ); +} + + + + + +/****************************************************************************/ +void util_cmdline_get_arg_data( struct util_cmdline_state *cs, char arg_letter, union util_cmdline_arg_data **arg_data ) +{ + lfds700_pal_uint_t + index; + + assert( cs != NULL ); + assert( arg_letter >= 'a' and arg_letter <= 'z' ); + assert( arg_data != NULL ); + + index = arg_letter - 'a'; + + if( cs->args[index].processed_flag == RAISED ) + *arg_data = &cs->args[index].arg_data; + else + *arg_data = NULL; + + return; +} + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/util_cmdline.h b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/util_cmdline.h new file mode 100644 index 0000000000..a19b073499 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/util_cmdline.h @@ -0,0 +1,69 @@ +/***** defines *****/ +#define NUMBER_OF_LOWERCASE_LETTERS_IN_LATIN_ALPHABET 26 + +/***** enums *****/ +enum util_cmdline_arg_type +{ + LIBCOMMON_CMDLINE_ARG_TYPE_INTEGER_RANGE, + LIBCOMMON_CMDLINE_ARG_TYPE_INTEGER, + LIBCOMMON_CMDLINE_ARG_TYPE_FLAG, + LIBCOMMON_CMDLINE_ARG_TYPE_UNSET +}; + +/***** structs *****/ +struct util_cmdline_arg_integer_range +{ + int long long unsigned + integer_start, + integer_end; +}; + +struct util_cmdline_arg_integer +{ + int long long unsigned + integer; +}; + +struct util_cmdline_arg_flag +{ + enum flag + flag; +}; + +union util_cmdline_arg_data +{ + struct util_cmdline_arg_integer_range + integer_range; + + struct util_cmdline_arg_integer + integer; + + struct util_cmdline_arg_flag + flag; +}; + +struct util_cmdline_arg_letter_and_data +{ + enum util_cmdline_arg_type + arg_type; + + enum flag + processed_flag; + + union util_cmdline_arg_data + arg_data; +}; + +struct util_cmdline_state +{ + struct util_cmdline_arg_letter_and_data + args[NUMBER_OF_LOWERCASE_LETTERS_IN_LATIN_ALPHABET]; +}; + +/***** public protoypes *****/ +void util_cmdline_init( struct util_cmdline_state *cs ); +void util_cmdline_cleanup( struct util_cmdline_state *cs ); +void util_cmdline_add_arg( struct util_cmdline_state *cs, char arg_letter, enum util_cmdline_arg_type arg_type ); +int util_cmdline_process_args( struct util_cmdline_state *cs, int argc, char **argv ); +void util_cmdline_get_arg_data( struct util_cmdline_state *cs, char arg_letter, union util_cmdline_arg_data **arg_data ); + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/util_memory_helpers.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/util_memory_helpers.c new file mode 100644 index 0000000000..3d4c0e79f4 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/util_memory_helpers.c @@ -0,0 +1,75 @@ +/***** includes *****/ +#include "internal.h" + + + + + +/****************************************************************************/ +void *util_aligned_malloc( lfds700_pal_uint_t size, lfds700_pal_uint_t align_in_bytes ) +{ + lfds700_pal_uint_t + offset; + + void + *memory, + *original_memory; + + // TRD : size can be any value in its range + // TRD : align_in_bytes can be any value in its range + + /* TRD : helper function to provide aligned allocations + no porting required + */ + + original_memory = memory = util_malloc_wrapper( size + sizeof(void *) + align_in_bytes ); + + if( memory != NULL ) + { + memory = (void **) memory + 1; + offset = align_in_bytes - (lfds700_pal_uint_t) memory % align_in_bytes; + memory = (char unsigned *) memory + offset; + *( (void **) memory - 1 ) = original_memory; + } + + return( memory ); +} + + + + + +/****************************************************************************/ +void util_aligned_free( void *memory ) +{ + assert( memory != NULL ); + + // TRD : the "void *" stored above memory points to the root of the allocation + free( *( (void **) memory - 1 ) ); + + return; +} + + + + + +/****************************************************************************/ +void *util_malloc_wrapper( lfds700_pal_uint_t size ) +{ + void + *memory; + + // TRD : size can be any value in its range + + memory = malloc( size ); + + if( memory == NULL ) + { + puts( "malloc() failed, exiting." ); + exit( EXIT_FAILURE ); + } + + return( memory ); +} + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/util_memory_helpers.h b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/util_memory_helpers.h new file mode 100644 index 0000000000..8341a1f2e3 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/util_memory_helpers.h @@ -0,0 +1,5 @@ +/***** public prototypes *****/ +void *util_aligned_malloc( lfds700_pal_uint_t size, lfds700_pal_uint_t align_in_bytes ); +void util_aligned_free( void *memory ); +void *util_malloc_wrapper( lfds700_pal_uint_t size ); + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/util_thread_starter.c b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/util_thread_starter.c new file mode 100644 index 0000000000..c008fa2c5d --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/util_thread_starter.c @@ -0,0 +1,151 @@ +/***** includes *****/ +#include "internal.h" + + + + + +/****************************************************************************/ +void util_thread_starter_new( struct util_thread_starter_state **tts, lfds700_pal_uint_t number_threads ) +{ + lfds700_pal_uint_t + loop; + + assert( tts != NULL ); + // TRD : number_threads cam be any value in its range + + *tts = util_malloc_wrapper( sizeof(struct util_thread_starter_state) ); + + (*tts)->tsts = util_malloc_wrapper( sizeof(struct util_thread_starter_thread_state) * number_threads ); + (*tts)->thread_start_flag = LOWERED; + (*tts)->number_thread_states = number_threads; + + for( loop = 0 ; loop < number_threads ; loop++ ) + { + ((*tts)->tsts+loop)->thread_ready_flag = LOWERED; + ((*tts)->tsts+loop)->thread_start_flag = &(*tts)->thread_start_flag; + } + + LFDS700_MISC_BARRIER_STORE; + + lfds700_misc_force_store(); + + return; +} + + + + + +/****************************************************************************/ +void util_thread_starter_start( struct util_thread_starter_state *tts, + test_pal_thread_state_t *thread_state, + lfds700_pal_uint_t thread_number, + struct test_pal_logical_processor *lp, + test_pal_thread_return_t (TEST_PAL_CALLING_CONVENTION *thread_function)( void *thread_user_state ), + void *thread_user_state ) +{ + assert( tts != NULL ); + assert( thread_state != NULL ); + assert( lp != NULL ); + assert( thread_function != NULL ); + // TRD : thread_user_state can be NULL + + (tts->tsts+thread_number)->thread_user_state = thread_user_state; + + util_thread_start_wrapper( thread_state, lp, thread_function, tts->tsts+thread_number ); + + // TRD : wait for the thread to indicate it is ready and waiting + while( (tts->tsts+thread_number)->thread_ready_flag == LOWERED ); + + return; +} + + + + + +/****************************************************************************/ +void util_thread_starter_ready_and_wait( struct util_thread_starter_thread_state *tsts ) +{ + assert( tsts != NULL ); + + tsts->thread_ready_flag = RAISED; + + LFDS700_MISC_BARRIER_FULL; + + // TRD : threads here are all looping, so we don't need to force a store + + while( *tsts->thread_start_flag == LOWERED ) + LFDS700_MISC_BARRIER_LOAD; + + return; +} + + + + + +/****************************************************************************/ +void util_thread_starter_run( struct util_thread_starter_state *tts ) +{ + assert( tts != NULL ); + + /* TRD : all threads at this point are ready to go + as we wait for their ready flag immediately after their spawn + */ + + tts->thread_start_flag = RAISED; + + LFDS700_MISC_BARRIER_STORE; + + lfds700_misc_force_store(); + + return; +} + + + + + +/****************************************************************************/ +void util_thread_starter_delete( struct util_thread_starter_state *tts ) +{ + assert( tts != NULL ); + + free( tts->tsts ); + + free( tts ); + + return; +} + + + + + +/****************************************************************************/ +void util_thread_start_wrapper( test_pal_thread_state_t *thread_state, + struct test_pal_logical_processor *lp, + test_pal_thread_return_t (TEST_PAL_CALLING_CONVENTION *thread_function)(void *thread_user_state), + void *thread_user_state ) +{ + int + rv; + + assert( thread_state != NULL ); + assert( lp != NULL ); + assert( thread_function != NULL ); + // TRD : thread_user_state can be NULL + + rv = test_pal_thread_start( thread_state, lp, thread_function, thread_user_state ); + + if( rv == 0 ) + { + puts( "test_pal_thread_start() failed." ); + exit( EXIT_FAILURE ); + } + + return; +} + diff --git a/openair2/UTIL/LFDS/liblfds7.0.0/test/src/util_thread_starter.h b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/util_thread_starter.h new file mode 100644 index 0000000000..5587edf1c0 --- /dev/null +++ b/openair2/UTIL/LFDS/liblfds7.0.0/test/src/util_thread_starter.h @@ -0,0 +1,41 @@ +/***** structs *****/ +struct util_thread_starter_thread_state +{ + // TRD : must be volatile or the compiler optimizes it away into a single load + enum flag volatile + thread_ready_flag, + *thread_start_flag; + + void + *thread_user_state; +}; + +struct util_thread_starter_state +{ + enum flag volatile + thread_start_flag; + + lfds700_pal_uint_t + number_thread_states; + + struct util_thread_starter_thread_state + *tsts; +}; + +/***** prototypes *****/ +void util_thread_starter_new( struct util_thread_starter_state **tts, lfds700_pal_uint_t number_threads ); +void util_thread_starter_start( struct util_thread_starter_state *tts, + test_pal_thread_state_t *thread_state, + lfds700_pal_uint_t thread_number, + struct test_pal_logical_processor *lp, + test_pal_thread_return_t (TEST_PAL_CALLING_CONVENTION *thread_function)( void *thread_user_state ), + void *thread_user_state ); +void util_thread_starter_ready_and_wait( struct util_thread_starter_thread_state *tsts ); +void util_thread_starter_run( struct util_thread_starter_state *tts ); +void util_thread_starter_delete( struct util_thread_starter_state *tts ); + +void util_thread_start_wrapper( test_pal_thread_state_t *thread_state, + struct test_pal_logical_processor *lp, + test_pal_thread_return_t (TEST_PAL_CALLING_CONVENTION *thread_function)(void *thread_user_state), + void *thread_user_state ); + From a8d646b10894d99ce7d28ea55328e9824741a1e9 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Fri, 26 Feb 2016 17:30:54 +0000 Subject: [PATCH 128/349] Added agent support for remote scheduler --- cmake_targets/CMakeLists.txt | 5 +- openair2/ENB_APP/enb_agent.c | 5 + openair2/ENB_APP/enb_agent_handler.c | 7 +- openair2/ENB_APP/enb_agent_mac.c | 62 ++++++++ openair2/ENB_APP/enb_agent_mac.h | 8 + openair2/ENB_APP/enb_agent_mac_defs.h | 8 +- .../MAC/eNB_agent_scheduler_dataplane.c | 2 +- .../LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c | 14 +- .../MAC/eNB_agent_scheduler_dlsch_ue_remote.c | 142 ++++++++++++++++++ .../MAC/eNB_agent_scheduler_dlsch_ue_remote.h | 76 ++++++++++ openair2/LAYER2/MAC/eNB_scheduler.c | 74 ++++----- openair2/LAYER2/MAC/enb_agent_mac_proto.h | 5 +- 12 files changed, 343 insertions(+), 65 deletions(-) create mode 100644 openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue_remote.c create mode 100644 openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue_remote.h diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index e4b027958d..18eaf0f8b6 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -1099,7 +1099,8 @@ set (MAC_SRC ${MAC_DIR}/config.c ${MAC_DIR}/eNB_agent_scheduler_dlsch_ue.c ${MAC_DIR}/eNB_agent_scheduler_dataplane.c - ) + ${MAC_DIR}/eNB_agent_scheduler_dlsch_ue_remote.c + ) set (ENB_APP_SRC ${OPENAIR2_DIR}/ENB_APP/enb_app.c @@ -1113,7 +1114,7 @@ add_library(L2 ${OPENAIR2_DIR}/RRC/L2_INTERFACE/openair_rrc_L2_interface.c) #Test for adding a shared library -add_library(alt_sched SHARED ${MAC_DIR}/eNB_agent_scheduler_dlsch_ue_alt.c) +#add_library(alt_sched SHARED ${MAC_DIR}/eNB_agent_scheduler_dlsch_ue_alt.c) # L3 Libs ########################## diff --git a/openair2/ENB_APP/enb_agent.c b/openair2/ENB_APP/enb_agent.c index 95731d3654..a21e2f8e16 100644 --- a/openair2/ENB_APP/enb_agent.c +++ b/openair2/ENB_APP/enb_agent.c @@ -276,6 +276,11 @@ int enb_agent_start(mid_t mod_id, const Enb_properties_array_t* enb_properties){ */ enb_agent_init_timer(); + + /* + * Initialize the mac agent + */ + enb_agent_init_mac_agent(mod_id); /* * start the enb agent task for tx and interaction with the underlying network function diff --git a/openair2/ENB_APP/enb_agent_handler.c b/openair2/ENB_APP/enb_agent_handler.c index d4e5706b11..721b3678f8 100644 --- a/openair2/ENB_APP/enb_agent_handler.c +++ b/openair2/ENB_APP/enb_agent_handler.c @@ -55,7 +55,7 @@ enb_agent_message_decoded_callback agent_messages_callback[][3] = { {0, 0, 0}, /*PROTOCOL__PROGRAN_MESSAGE__MSG_UE_CONFIG_REPLY_MSG*/ {enb_agent_lc_config_reply, 0, 0}, /*PROTOCOL__PROGRAN_MESSAGE__MSG_LC_CONFIG_REQUEST_MSG*/ {0, 0, 0}, /*PROTOCOL__PROGRAN_MESSAGE__MSG_LC_CONFIG_REPLY_MSG*/ - {0, 0, 0}, /*PROTOCOL__PROGRAN_MESSAGE__MSG_DL_MAC_CONFIG_MSG*/ + {enb_agent_mac_handle_dl_mac_config, 0, 0}, /*PROTOCOL__PROGRAN_MESSAGE__MSG_DL_MAC_CONFIG_MSG*/ {0, 0, 0}, /*PROTOCOL__PROGRAN_MESSAGE__MSG_UE_STATE_CHANGE_MSG*/ {enb_agent_control_delegation, 0, 0}, /*PROTOCOL__PROGRAN_MESSAGE__MSG_CONTROL_DELEGATION_MSG*/ @@ -116,10 +116,9 @@ Protocol__ProgranMessage* enb_agent_handle_message (mid_t mod_id, err_code = ((*agent_messages_callback[decoded_message->msg_case-1][decoded_message->msg_dir-1])(mod_id, (void *) decoded_message, &reply_message)); if ( err_code < 0 ){ goto error; + } else if (err_code == 1) { //If err_code > 1, we do not want to dispose the message yet + protocol__progran_message__free_unpacked(decoded_message, NULL); } - - protocol__progran_message__free_unpacked(decoded_message, NULL); - return reply_message; error: diff --git a/openair2/ENB_APP/enb_agent_mac.c b/openair2/ENB_APP/enb_agent_mac.c index 7be6e6ba12..fa190bbf29 100644 --- a/openair2/ENB_APP/enb_agent_mac.c +++ b/openair2/ENB_APP/enb_agent_mac.c @@ -42,6 +42,8 @@ #include "LAYER2/MAC/proto.h" #include "LAYER2/MAC/enb_agent_mac_proto.h" +#include "liblfds700.h" + #include "log.h" @@ -51,6 +53,13 @@ unsigned int mac_agent_registered[NUM_MAX_ENB]; /*Array containing the Agent-MAC interfaces*/ AGENT_MAC_xface *agent_mac_xface[NUM_MAX_ENB]; +/* Ringbuffer related structs used for maintaining the dl mac config messages */ +//message_queue_t *dl_mac_config_queue; +struct lfds700_misc_prng_state ps[NUM_MAX_ENB]; +struct lfds700_ringbuffer_element *dl_mac_config_array[NUM_MAX_ENB]; +struct lfds700_ringbuffer_state ringbuffer_state[NUM_MAX_ENB]; + + int enb_agent_mac_handle_stats(mid_t mod_id, const void *params, Protocol__ProgranMessage **msg){ // TODO: Must deal with sanitization of input @@ -1154,6 +1163,56 @@ int enb_agent_mac_destroy_dl_config(Protocol__ProgranMessage *msg) { return -1; } +void enb_agent_get_pending_dl_mac_config(mid_t mod_id, Protocol__ProgranMessage **msg) { + + struct lfds700_misc_prng_state ls; + + LFDS700_MISC_MAKE_VALID_ON_CURRENT_LOGICAL_CORE_INITS_COMPLETED_BEFORE_NOW_ON_ANY_OTHER_LOGICAL_CORE; + lfds700_misc_prng_init(&ls); + + if (lfds700_ringbuffer_read(&ringbuffer_state[mod_id], NULL, (void **) msg, &ls) == 0) { + *msg = NULL; + } +} + +int enb_agent_mac_handle_dl_mac_config(mid_t mod_id, const void *params, Protocol__ProgranMessage **msg) { + + struct lfds700_misc_prng_state ls; + enum lfds700_misc_flag overwrite_occurred_flag; + Protocol__ProgranMessage *overwritten_dl_config; + + LFDS700_MISC_MAKE_VALID_ON_CURRENT_LOGICAL_CORE_INITS_COMPLETED_BEFORE_NOW_ON_ANY_OTHER_LOGICAL_CORE; + lfds700_misc_prng_init(&ls); + + lfds700_ringbuffer_write( &ringbuffer_state[mod_id], + NULL, + (void *) params, + &overwrite_occurred_flag, + NULL, + (void **)&overwritten_dl_config, + &ls); + + if (overwrite_occurred_flag == LFDS700_MISC_FLAG_RAISED) { + // Delete unmanaged dl_config + enb_agent_mac_destroy_dl_config(overwritten_dl_config); + } + *msg = NULL; + return 2; + + error: + *msg = NULL; + return -1; +} + +void enb_agent_init_mac_agent(mid_t mod_id) { + lfds700_misc_library_init_valid_on_current_logical_core(); + lfds700_misc_prng_init(&ps[mod_id]); + int num_elements = RINGBUFFER_SIZE + 1; + //Allow RINGBUFFER_SIZE messages to be stored in the ringbuffer at any time + dl_mac_config_array[mod_id] = malloc( sizeof(struct lfds700_ringbuffer_element) * num_elements); + lfds700_ringbuffer_init_valid_on_current_logical_core( &ringbuffer_state[mod_id], dl_mac_config_array[mod_id], num_elements, &ps[mod_id], NULL ); +} + /*********************************************** * eNB agent - technology mac API implementation ***********************************************/ @@ -1284,6 +1343,7 @@ int enb_agent_register_mac_xface(mid_t mod_id, AGENT_MAC_xface *xface) { xface->enb_agent_send_sf_trigger = enb_agent_send_sf_trigger; xface->enb_agent_send_update_mac_stats = enb_agent_send_update_mac_stats; xface->enb_agent_schedule_ue_spec = schedule_ue_spec_default; + xface->enb_agent_get_pending_dl_mac_config = enb_agent_get_pending_dl_mac_config; xface->enb_agent_notify_ue_state_change = enb_agent_ue_state_change; mac_agent_registered[mod_id] = 1; @@ -1299,6 +1359,8 @@ int enb_agent_unregister_mac_xface(mid_t mod_id, AGENT_MAC_xface *xface) { xface->enb_agent_send_sf_trigger = NULL; xface->enb_agent_send_update_mac_stats = NULL; xface->enb_agent_schedule_ue_spec = NULL; + xface->enb_agent_get_pending_dl_mac_config = NULL; + xface->enb_agent_notify_ue_state_change = NULL; mac_agent_registered[mod_id] = 0; agent_mac_xface[mod_id] = NULL; diff --git a/openair2/ENB_APP/enb_agent_mac.h b/openair2/ENB_APP/enb_agent_mac.h index 221d76e57f..2a8f4c3a40 100644 --- a/openair2/ENB_APP/enb_agent_mac.h +++ b/openair2/ENB_APP/enb_agent_mac.h @@ -76,6 +76,9 @@ typedef struct stats_request_config_s{ report_config_t *config; } stats_request_config_t; +/* Initialization function for the agent structures etc */ +void enb_agent_init_mac_agent(mid_t mod_id); + int enb_agent_mac_handle_stats(mid_t mod_id, const void *params, Protocol__ProgranMessage **msg); int enb_agent_mac_stats_request(mid_t mod_id, xid_t xid, const stats_request_config_t *report_config, Protocol__ProgranMessage **msg); @@ -98,6 +101,8 @@ int enb_agent_mac_create_empty_dl_config(mid_t mod_id, Protocol__ProgranMessage int enb_agent_mac_destroy_dl_config(Protocol__ProgranMessage *msg); +int enb_agent_mac_handle_dl_mac_config(mid_t mod_id, const void *params, Protocol__ProgranMessage **msg); + /********************************** * eNB agent - technology mac API @@ -113,6 +118,9 @@ void enb_agent_send_sf_trigger(mid_t mod_id); /// based on the stats request configuration void enb_agent_send_update_mac_stats(mid_t mod_id); +/// Provide to the scheduler a pending dl_mac_config message +void enb_agent_get_pending_dl_mac_config(mid_t mod_id, Protocol__ProgranMessage **msg); + /*Register technology specific interface callbacks*/ int enb_agent_register_mac_xface(mid_t mod_id, AGENT_MAC_xface *xface); diff --git a/openair2/ENB_APP/enb_agent_mac_defs.h b/openair2/ENB_APP/enb_agent_mac_defs.h index 657fc94fe4..c5a3204f0c 100644 --- a/openair2/ENB_APP/enb_agent_mac_defs.h +++ b/openair2/ENB_APP/enb_agent_mac_defs.h @@ -42,6 +42,8 @@ #include "progran.pb-c.h" #include "header.pb-c.h" +#define RINGBUFFER_SIZE 100 + /* ENB AGENT-MAC Interface */ typedef struct { //msg_context_t *agent_ctxt; @@ -56,11 +58,15 @@ typedef struct { /// based on the stats request configuration void (*enb_agent_send_update_mac_stats)(mid_t mod_id); + /// Provide to the scheduler a pending dl_mac_config message + void (*enb_agent_get_pending_dl_mac_config)(mid_t mod_id, + Protocol__ProgranMessage **msg); + /// Run the UE DL scheduler and fill the Protocol__ProgranMessage. Assumes that /// dl_info is already initialized as prp_dl_mac_config and fills the /// prp_dl_data part of it void (*enb_agent_schedule_ue_spec)(mid_t mod_id, uint32_t frame, uint32_t subframe, - int *mbsfn_flag, Protocol__ProgranMessage *dl_info); + int *mbsfn_flag, Protocol__ProgranMessage **dl_info); /// Notify the controller for a state change of a particular UE, by sending the proper diff --git a/openair2/LAYER2/MAC/eNB_agent_scheduler_dataplane.c b/openair2/LAYER2/MAC/eNB_agent_scheduler_dataplane.c index 04efcb44ad..a1bd039dff 100644 --- a/openair2/LAYER2/MAC/eNB_agent_scheduler_dataplane.c +++ b/openair2/LAYER2/MAC/eNB_agent_scheduler_dataplane.c @@ -69,7 +69,7 @@ void apply_dl_scheduling_decisions(mid_t mod_id, uint32_t frame, uint32_t subframe, int *mbsfn_flag, - Protocol__ProgranMessage *dl_scheduling_info) { + const Protocol__ProgranMessage *dl_scheduling_info) { Protocol__PrpDlMacConfig *mac_config = dl_scheduling_info->dl_mac_config_msg; diff --git a/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c b/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c index 4d353232a8..5031867394 100644 --- a/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c +++ b/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c @@ -64,6 +64,7 @@ #include "header.pb-c.h" #include "progran.pb-c.h" +#include "enb_agent_mac.h" #include "SIMULATION/TOOLS/defs.h" // for taus @@ -80,7 +81,7 @@ schedule_ue_spec_default( uint32_t frame, uint32_t subframe, int *mbsfn_flag, - Protocol__ProgranMessage *dl_info + Protocol__ProgranMessage **dl_info ) //------------------------------------------------------------------------------ { @@ -126,11 +127,12 @@ schedule_ue_spec_default( uint8_t ue_has_transmission = 0; uint32_t ndi; - + enb_agent_mac_create_empty_dl_config(mod_id, dl_info); + if (UE_list->head==-1) { return; } - + start_meas(&eNB->schedule_dlsch); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_SCHEDULE_DLSCH,VCD_FUNCTION_IN); @@ -763,10 +765,10 @@ schedule_ue_spec_default( } // CC_id loop // Add all the dl_data elements to the progran message - dl_info->dl_mac_config_msg->n_dl_ue_data = num_ues_added; - dl_info->dl_mac_config_msg->dl_ue_data = (Protocol__PrpDlData **) malloc(sizeof(Protocol__PrpDlData *) * num_ues_added); + (*dl_info)->dl_mac_config_msg->n_dl_ue_data = num_ues_added; + (*dl_info)->dl_mac_config_msg->dl_ue_data = (Protocol__PrpDlData **) malloc(sizeof(Protocol__PrpDlData *) * num_ues_added); for (i = 0; i < num_ues_added; i++) { - dl_info->dl_mac_config_msg->dl_ue_data[i] = dl_data[i]; + (*dl_info)->dl_mac_config_msg->dl_ue_data[i] = dl_data[i]; } stop_meas(&eNB->schedule_dlsch); diff --git a/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue_remote.c b/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue_remote.c new file mode 100644 index 0000000000..1818a64087 --- /dev/null +++ b/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue_remote.c @@ -0,0 +1,142 @@ +/******************************************************************************* + OpenAirInterface + Copyright(c) 1999 - 2014 Eurecom + + OpenAirInterface is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + + OpenAirInterface is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with OpenAirInterface.The full GNU General Public License is + included in this distribution in the file called "COPYING". If not, + see . + + Contact Information + OpenAirInterface Admin: openair_admin@eurecom.fr + OpenAirInterface Tech : openair_tech@eurecom.fr + OpenAirInterface Dev : openair4g-devel@lists.eurecom.fr + + Address : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE + +*******************************************************************************/ + +/*! \file eNB_agent_scheduler_dlsch_ue_remote.c + * \brief procedures related to remote scheduling in the DLSCH transport channel + * \author Xenofon Foukas + * \date 2016 + * \email: x.foukas@sms.ed.ac.uk + * \version 0.1 + * @ingroup _mac + + */ + +#include "eNB_agent_scheduler_dlsch_ue_remote.h" + +struct DlMacConfigHead queue_head; + +int queue_initialized = 0; + +void schedule_ue_spec_remote(mid_t mod_id, uint32_t frame, uint32_t subframe, + int *mbsfn_flag, Protocol__ProgranMessage **dl_info) { + + if (queue_initialized) { + TAILQ_INIT(&queue_head); + queue_initialized = 1; + } + + dl_mac_config_element_t *dl_config_elem; + + int diff; + + // First we check to see if we have a scheduling decision for this sfn_sf already in our queue + while(queue_head.tqh_first != NULL) { + dl_config_elem = queue_head.tqh_first; + diff = get_sf_difference(mod_id, dl_config_elem->dl_info->dl_mac_config_msg->sfn_sf); + // Check if this decision is for now, for a later or a previous subframe + if ( diff == 0) { // Now + TAILQ_REMOVE(&queue_head, queue_head.tqh_first, configs); + *dl_info = dl_config_elem->dl_info; + free(dl_config_elem); + return; + } else if (diff < 0) { //previous subframe , delete message and free memory + TAILQ_REMOVE(&queue_head, queue_head.tqh_first, configs); + enb_agent_mac_destroy_dl_config(dl_config_elem->dl_info); + free(dl_config_elem); + } else { // next subframe, nothing to do now + enb_agent_create_empty_dl_config(mod_id, dl_info); + return; + } + } + + //Done with the local cache. Now we need to check if something new arrived + enb_agent_get_pending_dl_mac_config(mod_id, dl_info); + while (*dl_info != NULL) { + + diff = get_sf_difference(mod_id, (*dl_info)->dl_mac_config_msg->sfn_sf); + if (diff == 0) { // Got a command for this sfn_sf + return; + } else if (diff < 0) { + enb_agent_mac_destroy_dl_config(*dl_info); + } else { // Intended for future subframe. Store it in local cache + dl_mac_config_element_t *e = malloc(sizeof(dl_mac_config_element_t)); + TAILQ_INSERT_TAIL(&queue_head, e, configs); + enb_agent_create_empty_dl_config(mod_id, dl_info); + // No need to look for another. Messages arrive ordered + return; + } + enb_agent_get_pending_dl_mac_config(mod_id, dl_info); + } + + // We found no pending command, so we will simply pass an empty one + enb_agent_create_empty_dl_config(mod_id, dl_info); +} + +int get_sf_difference(mid_t mod_id, uint16_t sfn_sf) { + int diff_in_subframes; + + uint16_t current_frame = get_current_system_frame_num(mod_id); + uint16_t current_subframe = get_current_subframe(mod_id); + uint16_t current_sfn_sf = get_sfn_sf(mod_id); + + if (sfn_sf == current_sfn_sf) { + return 0; + } + + uint16_t frame_mask = !((1<<4) - 1); + uint16_t frame = (sfn_sf & frame_mask) >> 4; + + uint16_t sf_mask = !(((1<<12) - 1) << 4); + uint16_t subframe = (sfn_sf & sf_mask); + + if (frame == current_frame) { + return subframe - current_subframe; + } else if (frame > current_frame) { + diff_in_subframes = 9 - current_subframe; + diff_in_subframes += subframe; + diff_in_subframes += (frame-2) * 10; + if (diff_in_subframes > SCHED_AHEAD_SUBFRAMES) { + return -1; + } else { + return 1; + } + } else { //frame < current_frame + diff_in_subframes = 9 - current_subframe; + diff_in_subframes += subframe; + if (frame > 0) { + diff_in_subframes += (frame - 1) * 10; + } + diff_in_subframes += (1023 - current_frame) * 10; + if (diff_in_subframes > SCHED_AHEAD_SUBFRAMES) { + return -1; + } else { + return 1; + } + } +} diff --git a/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue_remote.h b/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue_remote.h new file mode 100644 index 0000000000..2b8ec3ec19 --- /dev/null +++ b/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue_remote.h @@ -0,0 +1,76 @@ +/******************************************************************************* + OpenAirInterface + Copyright(c) 1999 - 2014 Eurecom + + OpenAirInterface is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + + OpenAirInterface is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with OpenAirInterface.The full GNU General Public License is + included in this distribution in the file called "COPYING". If not, + see . + + Contact Information + OpenAirInterface Admin: openair_admin@eurecom.fr + OpenAirInterface Tech : openair_tech@eurecom.fr + OpenAirInterface Dev : openair4g-devel@lists.eurecom.fr + + Address : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE + +*******************************************************************************/ + +/*! \file eNB_agent_scheduler_dlsch_ue_remote.h + * \brief Local stub for remote scheduler used by the controller + * \author Xenofon Foukas + * \date 2016 + * \email: x.foukas@sms.ed.ac.uk + * \version 0.1 + * @ingroup _mac + + */ + +#ifndef __LAYER2_MAC_ENB_AGENT_SCHEDULER_DLSCH_UE_REMOTE_H__ +#define __LAYER2_MAC_ENB_AGENT_SCHEDULER_DLSCH_UE_REMOTE_H___ + +#include "progran.pb-c.h" +#include "header.pb-c.h" + +#include "ENB_APP/enb_agent_defs.h" +#include "enb_agent_mac.h" + +#include + +// Maximum value of schedule ahead of time +// Required to identify if a dl_command is for the future or not +#define SCHED_AHEAD_SUBFRAMES 10 + +typedef struct dl_mac_config_element_s { + Protocol__ProgranMessage *dl_info; + TAILQ_ENTRY(dl_mac_config_element_s) configs; +} dl_mac_config_element_t; + +TAILQ_HEAD(DlMacConfigHead, dl_mac_config_element_s); + +/* + * Default scheduler used by the eNB agent + */ +void schedule_ue_spec_remote(mid_t mod_id, uint32_t frame, uint32_t subframe, + int *mbsfn_flag, Protocol__ProgranMessage **dl_info); + + +// Find the difference in subframes from the given subframe +// negative for older value +// 0 for equal +// positive for future value +// Based on +int get_sf_difference(mid_t mod_id, uint16_t sfn_sf); + +#endif diff --git a/openair2/LAYER2/MAC/eNB_scheduler.c b/openair2/LAYER2/MAC/eNB_scheduler.c index e2423e2c10..9a172cb377 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler.c +++ b/openair2/LAYER2/MAC/eNB_scheduler.c @@ -281,13 +281,12 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); #else if (mac_agent_registered[module_idP]) { - enb_agent_mac_create_empty_dl_config(module_idP, &msg); agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( module_idP, frameP, subframeP, mbsfn_status, - msg); + &msg); apply_dl_scheduling_decisions(module_idP, frameP, @@ -330,13 +329,12 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); #else if (mac_agent_registered[module_idP]) { - enb_agent_mac_create_empty_dl_config(module_idP, &msg); agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( module_idP, frameP, subframeP, mbsfn_status, - msg); + &msg); apply_dl_scheduling_decisions(module_idP, frameP, @@ -361,13 +359,12 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); #else if (mac_agent_registered[module_idP]) { - enb_agent_mac_create_empty_dl_config(module_idP, &msg); agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( module_idP, frameP, subframeP, mbsfn_status, - msg); + &msg); apply_dl_scheduling_decisions(module_idP, frameP, @@ -398,13 +395,12 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); #else if (mac_agent_registered[module_idP]) { - enb_agent_mac_create_empty_dl_config(module_idP, &msg); agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( module_idP, frameP, subframeP, mbsfn_status, - msg); + &msg); apply_dl_scheduling_decisions(module_idP, frameP, @@ -427,13 +423,12 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); #else if (mac_agent_registered[module_idP]) { - enb_agent_mac_create_empty_dl_config(module_idP, &msg); agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( module_idP, frameP, subframeP, mbsfn_status, - msg); + &msg); apply_dl_scheduling_decisions(module_idP, frameP, @@ -471,13 +466,12 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); #else if (mac_agent_registered[module_idP]) { - enb_agent_mac_create_empty_dl_config(module_idP, &msg); agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( module_idP, frameP, subframeP, mbsfn_status, - msg); + &msg); apply_dl_scheduling_decisions(module_idP, frameP, @@ -502,13 +496,12 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, fill_DLSCH_dci(module_idP, frameP, subframeP, mbsfn_status); #else if (mac_agent_registered[module_idP]) { - enb_agent_mac_create_empty_dl_config(module_idP, &msg); agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( module_idP, frameP, subframeP, mbsfn_status, - msg); + &msg); apply_dl_scheduling_decisions(module_idP, frameP, @@ -539,13 +532,12 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); #else if (mac_agent_registered[module_idP]) { - enb_agent_mac_create_empty_dl_config(module_idP, &msg); agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( module_idP, frameP, subframeP, mbsfn_status, - msg); + &msg); apply_dl_scheduling_decisions(module_idP, frameP, @@ -567,13 +559,12 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); #else if (mac_agent_registered[module_idP]) { - enb_agent_mac_create_empty_dl_config(module_idP, &msg); agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( module_idP, frameP, subframeP, mbsfn_status, - msg); + &msg); apply_dl_scheduling_decisions(module_idP, frameP, @@ -620,13 +611,12 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); #else if (mac_agent_registered[module_idP]) { - enb_agent_mac_create_empty_dl_config(module_idP, &msg); agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( module_idP, frameP, subframeP, mbsfn_status, - msg); + &msg); apply_dl_scheduling_decisions(module_idP, frameP, @@ -645,13 +635,12 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); #else if (mac_agent_registered[module_idP]) { - enb_agent_mac_create_empty_dl_config(module_idP, &msg); agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( module_idP, frameP, subframeP, mbsfn_status, - msg); + &msg); apply_dl_scheduling_decisions(module_idP, frameP, @@ -673,13 +662,12 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); #else if (mac_agent_registered[module_idP]) { - enb_agent_mac_create_empty_dl_config(module_idP, &msg); agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( module_idP, frameP, subframeP, mbsfn_status, - msg); + &msg); apply_dl_scheduling_decisions(module_idP, frameP, @@ -707,13 +695,12 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); #else if (mac_agent_registered[module_idP]) { - enb_agent_mac_create_empty_dl_config(module_idP, &msg); agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( module_idP, frameP, subframeP, mbsfn_status, - msg); + &msg); apply_dl_scheduling_decisions(module_idP, frameP, @@ -731,13 +718,12 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); #else if (mac_agent_registered[module_idP]) { - enb_agent_mac_create_empty_dl_config(module_idP, &msg); agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( module_idP, frameP, subframeP, mbsfn_status, - msg); + &msg); apply_dl_scheduling_decisions(module_idP, frameP, @@ -759,13 +745,12 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); #else if (mac_agent_registered[module_idP]) { - enb_agent_mac_create_empty_dl_config(module_idP, &msg); agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( module_idP, frameP, subframeP, mbsfn_status, - msg); + &msg); apply_dl_scheduling_decisions(module_idP, frameP, @@ -798,13 +783,12 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); #else if (mac_agent_registered[module_idP]) { - enb_agent_mac_create_empty_dl_config(module_idP, &msg); agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( module_idP, frameP, subframeP, mbsfn_status, - msg); + &msg); apply_dl_scheduling_decisions(module_idP, frameP, @@ -826,13 +810,12 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); #else if (mac_agent_registered[module_idP]) { - enb_agent_mac_create_empty_dl_config(module_idP, &msg); agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( module_idP, frameP, subframeP, mbsfn_status, - msg); + &msg); apply_dl_scheduling_decisions(module_idP, frameP, @@ -859,13 +842,12 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); #else if (mac_agent_registered[module_idP]) { - enb_agent_mac_create_empty_dl_config(module_idP, &msg); agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( module_idP, frameP, subframeP, mbsfn_status, - msg); + &msg); apply_dl_scheduling_decisions(module_idP, frameP, @@ -885,13 +867,12 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); #else if (mac_agent_registered[module_idP]) { - enb_agent_mac_create_empty_dl_config(module_idP, &msg); agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( module_idP, frameP, subframeP, mbsfn_status, - msg); + &msg); apply_dl_scheduling_decisions(module_idP, frameP, @@ -911,13 +892,12 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); #else if (mac_agent_registered[module_idP]) { - enb_agent_mac_create_empty_dl_config(module_idP, &msg); agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( module_idP, frameP, subframeP, mbsfn_status, - msg); + &msg); apply_dl_scheduling_decisions(module_idP, frameP, @@ -937,13 +917,12 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); #else if (mac_agent_registered[module_idP]) { - enb_agent_mac_create_empty_dl_config(module_idP, &msg); agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( module_idP, frameP, subframeP, mbsfn_status, - msg); + &msg); apply_dl_scheduling_decisions(module_idP, frameP, @@ -965,19 +944,18 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); #else if (mac_agent_registered[module_idP]) { - enb_agent_mac_create_empty_dl_config(module_idP, &msg); agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( module_idP, frameP, subframeP, mbsfn_status, - msg); + &msg); apply_dl_scheduling_decisions(module_idP, - frameP, - subframeP, - mbsfn_status, - msg); + frameP, + subframeP, + mbsfn_status, + msg); enb_agent_mac_destroy_dl_config(msg); } #endif diff --git a/openair2/LAYER2/MAC/enb_agent_mac_proto.h b/openair2/LAYER2/MAC/enb_agent_mac_proto.h index 7fcdbc29c3..f453fa2fa3 100644 --- a/openair2/LAYER2/MAC/enb_agent_mac_proto.h +++ b/openair2/LAYER2/MAC/enb_agent_mac_proto.h @@ -48,14 +48,13 @@ * Default scheduler used by the eNB agent */ void schedule_ue_spec_default(mid_t mod_id, uint32_t frame, uint32_t subframe, - int *mbsfn_flag, Protocol__ProgranMessage *dl_info); - + int *mbsfn_flag, Protocol__ProgranMessage **dl_info); /* * Data plane function for applying the DL decisions of the scheduler */ void apply_dl_scheduling_decisions(mid_t mod_id, uint32_t frame, uint32_t subframe, int *mbsfn_flag, - Protocol__ProgranMessage *dl_scheduling_info); + const Protocol__ProgranMessage *dl_scheduling_info); /* * Data plane function for applying the UE specific DL decisions of the scheduler From c7c9da4296f2e2282cb3c9b214efa42d3ac9bfa0 Mon Sep 17 00:00:00 2001 From: Xiwen JIANG Date: Mon, 29 Feb 2016 14:53:15 +0100 Subject: [PATCH 129/349] cosmetic changes to enable multiple antenna transmission --- cmake_targets/CMakeLists.txt | 2 +- openair2/ENB_APP/enb_config.c | 8 ++++---- targets/RT/USER/lte-softmodem.c | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index a94da4b2b8..5a679cdf4a 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -119,7 +119,7 @@ endmacro(add_list_string_option) #################################################### # compilation flags ############################################# -set(CMAKE_BUILD_TYPE "Debug") +#set(CMAKE_BUILD_TYPE "Debug") if (CMAKE_BUILD_TYPE STREQUAL "") set(CMAKE_BUILD_TYPE "RelWithDebInfo") endif() diff --git a/openair2/ENB_APP/enb_config.c b/openair2/ENB_APP/enb_config.c index b437c7e264..0aa980a8a3 100755 --- a/openair2/ENB_APP/enb_config.c +++ b/openair2/ENB_APP/enb_config.c @@ -938,16 +938,16 @@ const Enb_properties_array_t *enb_config_init(char* lib_config_file_name_pP) enb_properties.properties[enb_properties_index]->nb_antennas_tx[j] = nb_antennas_tx; - if ((nb_antennas_tx <1) || (nb_antennas_tx > 4)) + if ((nb_antennas_tx <1) || (nb_antennas_tx > 64)) AssertError (0, parse_errors ++, - "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for nb_antennas_tx choice: 1..4 !\n", + "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for nb_antennas_tx choice: 1..64 !\n", lib_config_file_name_pP, i, nb_antennas_tx); enb_properties.properties[enb_properties_index]->nb_antennas_rx[j] = nb_antennas_rx; - if ((nb_antennas_rx <1) || (nb_antennas_rx > 4)) + if ((nb_antennas_rx <1) || (nb_antennas_rx > 64)) AssertError (0, parse_errors ++, - "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for nb_antennas_rx choice: 1..4 !\n", + "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for nb_antennas_rx choice: 1..64 !\n", lib_config_file_name_pP, i, nb_antennas_rx); enb_properties.properties[enb_properties_index]->tx_gain[j] = tx_gain; diff --git a/targets/RT/USER/lte-softmodem.c b/targets/RT/USER/lte-softmodem.c index cf1a374dae..72d32fbdef 100644 --- a/targets/RT/USER/lte-softmodem.c +++ b/targets/RT/USER/lte-softmodem.c @@ -2393,8 +2393,8 @@ static void get_options (int argc, char **argv) case 'x': transmission_mode = atoi(optarg); - if (transmission_mode > 2) { - printf("Transmission mode > 2 (%d) not supported for the moment\n",transmission_mode); + if (transmission_mode > 2 && transmission_mode != 7) { + printf("Transmission mode %d not supported for the moment\n",transmission_mode); exit(-1); } break; @@ -2476,7 +2476,7 @@ static void get_options (int argc, char **argv) frame_parms[CC_id]->N_RB_DL = enb_properties->properties[i]->N_RB_DL[CC_id]; frame_parms[CC_id]->N_RB_UL = enb_properties->properties[i]->N_RB_DL[CC_id]; frame_parms[CC_id]->nb_antennas_tx = enb_properties->properties[i]->nb_antennas_tx[CC_id]; - frame_parms[CC_id]->nb_antenna_ports_eNB = enb_properties->properties[i]->nb_antennas_tx[CC_id]; + frame_parms[CC_id]->nb_antenna_ports_eNB = 1;//enb_properties->properties[i]->nb_antenna_ports_eNB[CC_id]; frame_parms[CC_id]->nb_antennas_rx = enb_properties->properties[i]->nb_antennas_rx[CC_id]; //} // j } From f02e6ca52634768748762084ca35a4a41799e75a Mon Sep 17 00:00:00 2001 From: Xiwen JIANG Date: Mon, 29 Feb 2016 17:15:26 +0100 Subject: [PATCH 130/349] add beamforming function --- openair1/PHY/LTE_TRANSPORT/beamforming.c | 211 +++++++++++++++++++++++ 1 file changed, 211 insertions(+) create mode 100644 openair1/PHY/LTE_TRANSPORT/beamforming.c diff --git a/openair1/PHY/LTE_TRANSPORT/beamforming.c b/openair1/PHY/LTE_TRANSPORT/beamforming.c new file mode 100644 index 0000000000..7a2b75d74e --- /dev/null +++ b/openair1/PHY/LTE_TRANSPORT/beamforming.c @@ -0,0 +1,211 @@ +/******************************************************************************* + OpenAirInterface + Copyright(c) 1999 - 2014 Eurecom + + OpenAirInterface is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + + OpenAirInterface is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with OpenAirInterface.The full GNU General Public License is + included in this distribution in the file called "COPYING". If not, + see . + + Contact Information + OpenAirInterface Admin: openair_admin@eurecom.fr + OpenAirInterface Tech : openair_tech@eurecom.fr + OpenAirInterface Dev : openair4g-devel@eurecom.fr + +Address : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE + + *******************************************************************************/ + +/*! \file PHY/LTE_TRANSPORT/beamforming.c + * \brief + * \author R. Knopp, F. Kaltenberger, X. JIANG + * \date 2015 + * \version 0.1 + * \company Eurecom + * \email: knopp@eurecom.fr,florian.kaltenberger@eurecom.fr,xiwen.jiang@eurecom.fr + * \note + * \warning + */ +#include "PHY/defs.h" +#include "PHY/extern.h" +#include "PHY/CODING/defs.h" +#include "PHY/CODING/extern.h" +#include "PHY/CODING/lte_interleaver_inline.h" +#include "PHY/LTE_TRANSPORT/defs.h" +#include "defs.h" +#include "UTIL/LOG/vcd_signal_dumper.h" + + +// ue_spec_beamforming: perform beamforming for data in transmission_mode TM7-TM10 +int ue_spec_beamforming(int32_t **txdataF, + int32_t **txdataF_BF, + LTE_DL_FRAME_PARMS *frame_parms, + int32_t ***ue_spec_bf_weights, + int slot, + int symbol) +{ + uint8_t p,aa; + uint16_t re=0; + int slot_offset_F; + + slot_offset_F = slot*(frame_parms->ofdm_symbol_size)*((frame_parms->Ncp==1) ? 6 : 7); + + // clear txdata_BF[aa][re] for each call of spec_spec_beamforming + for(aa=0;aanb_antennas_tx;aa++) + memset(txdataF_BF[aa],0,4*(frame_parms->ofdm_symbol_size)); + + for (re=0;reofdm_symbol_size;re++) { + if (txdataF[5][slot_offset_F+symbol*frame_parms->ofdm_symbol_size+re]!=0) { //that means this RE is actually using TM7 + for (aa=0;aanb_antennas_tx;aa++) { + ((int16_t*)&txdataF_BF[aa][re])[0] = (int16_t)((((int16_t*)&txdataF[5][slot_offset_F+symbol*frame_parms->ofdm_symbol_size+re])[0] + *((int16_t*)&ue_spec_bf_weights[0][aa][re])[0])>>15); + ((int16_t*)&txdataF_BF[aa][re])[0] -= (int16_t)((((int16_t*)&txdataF[5][slot_offset_F+symbol*frame_parms->ofdm_symbol_size+re])[1] + *((int16_t*)&ue_spec_bf_weights[0][aa][re])[1])>>15); + ((int16_t*)&txdataF_BF[aa][re])[1] = (int16_t)((((int16_t*)&txdataF[5][slot_offset_F+symbol*frame_parms->ofdm_symbol_size+re])[0] + *((int16_t*)&ue_spec_bf_weights[0][aa][re])[1])>>15); + ((int16_t*)&txdataF_BF[aa][re])[1] += (int16_t)((((int16_t*)&txdataF[5][slot_offset_F+symbol*frame_parms->ofdm_symbol_size+re])[1] + *((int16_t*)&ue_spec_bf_weights[0][aa][re])[0])>>15); + +/* printf("beamforming.c:txdataF[5][%d]=%d+j%d, ue_bf_weights[0][%d][%d]=%d+j%d,txdata_BF[%d][%d]=%d+j%d\n", + slot_offset_F+symbol*frame_parms->ofdm_symbol_size+re, + ((int16_t*)&txdataF[5][slot_offset_F+symbol*frame_parms->ofdm_symbol_size+re])[0], + ((int16_t*)&txdataF[5][slot_offset_F+symbol*frame_parms->ofdm_symbol_size+re])[1], + aa,re, + ((int16_t*)&ue_spec_bf_weights[0][aa][re])[0],((int16_t*)&ue_spec_bf_weights[0][aa][re])[1], + aa,re, + ((int16_t*)&txdataF_BF[aa][re])[0], + ((int16_t*)&txdataF_BF[aa][re])[1]); */ + } + } + + if (txdataF[7][re+symbol*frame_parms->ofdm_symbol_size]!=0) { //that means this RE is actually using TM8-10 + for (p=0;p<8;p++) { + if (txdataF[p+7][slot_offset_F+symbol*frame_parms->ofdm_symbol_size+re]!=0) { //that means this RE is actually allocated + for (aa=0;aanb_antennas_tx;aa++) { + ((int16_t*)&txdataF_BF[aa][re])[0] = (int16_t)((((int16_t*)&txdataF[p+7][slot_offset_F+symbol*frame_parms->ofdm_symbol_size+re])[0] + *((int16_t*)&ue_spec_bf_weights[p][aa][re])[0])>>15); + ((int16_t*)&txdataF_BF[aa][re])[0] -= (int16_t)((((int16_t*)&txdataF[p+7][slot_offset_F+symbol*frame_parms->ofdm_symbol_size+re])[1] + *((int16_t*)&ue_spec_bf_weights[p][aa][re])[1])>>15); + ((int16_t*)&txdataF_BF[aa][re])[1] = (int16_t)((((int16_t*)&txdataF[p+7][slot_offset_F+symbol*frame_parms->ofdm_symbol_size+re])[0] + *((int16_t*)&ue_spec_bf_weights[p][aa][re])[1])>>15); + ((int16_t*)&txdataF_BF[aa][re])[1] += (int16_t)((((int16_t*)&txdataF[p+7][slot_offset_F+symbol*frame_parms->ofdm_symbol_size+re])[1] + *((int16_t*)&ue_spec_bf_weights[p][aa][re])[0])>>15); + } + } + } + } + } +} + +// cell_spec_beamforming: performed for all common data +int cell_spec_beamforming(int32_t **txdataF, + int32_t **txdataF_BF, + LTE_DL_FRAME_PARMS *frame_parms, + int32_t ***cell_spec_bf_weights, + int slot, + int symbol) +{ + uint8_t p,aa; + uint16_t re=0; + int slot_offset_F; + + slot_offset_F = slot*(frame_parms->ofdm_symbol_size)*((frame_parms->Ncp==1) ? 6 : 7); + + // clear txdata_BF[aa][re] for each call of cell_spec_beamforming + for(aa=0;aanb_antennas_tx;aa++) + memset(txdataF_BF[aa],0,4*(frame_parms->ofdm_symbol_size)); + + for (re=0;reofdm_symbol_size;re++) { + for (p=0;pnb_antenna_ports_eNB;p++) { + if (txdataF[p][slot_offset_F+symbol*frame_parms->ofdm_symbol_size+re]!=0) { //that means this RE is actually allocated + for (aa=0;aanb_antennas_tx;aa++) { + //printf("cell_spec_beamforming():txdata_BF[%d][%d]=%d+j%d\n",aa,re,((int16_t*)&txdataF_BF[aa][re])[0],((int16_t*)&txdataF_BF[aa][re])[1]); + + ((int16_t*)&txdataF_BF[aa][re])[0] = (int16_t)((((int16_t*)&txdataF[p][slot_offset_F+symbol*frame_parms->ofdm_symbol_size+re])[0] + *((int16_t*)&cell_spec_bf_weights[p][aa][re])[0])>>15); + ((int16_t*)&txdataF_BF[aa][re])[0] -= (int16_t)((((int16_t*)&txdataF[p][slot_offset_F+symbol*frame_parms->ofdm_symbol_size+re])[1] + *((int16_t*)&cell_spec_bf_weights[p][aa][re])[1])>>15); + ((int16_t*)&txdataF_BF[aa][re])[1] = (int16_t)((((int16_t*)&txdataF[p][slot_offset_F+symbol*frame_parms->ofdm_symbol_size+re])[0] + *((int16_t*)&cell_spec_bf_weights[p][aa][re])[1])>>15); + ((int16_t*)&txdataF_BF[aa][re])[1] += (int16_t)((((int16_t*)&txdataF[p][slot_offset_F+symbol*frame_parms->ofdm_symbol_size+re])[1] + *((int16_t*)&cell_spec_bf_weights[p][aa][re])[0])>>15); + // printf("beamforming.c:txdata[%d][%d]=%d+j%d, cell_bf_weights[%d][%d][%d]=%d+j%d,txdata_BF[%d][%d]=%d+j%d\n", + // p,slot_offset_F+symbol*frame_parms->ofdm_symbol_size+re, + // ((int16_t*)&txdataF[p][slot_offset_F+symbol*frame_parms->ofdm_symbol_size+re])[0], + // ((int16_t*)&txdataF[p][slot_offset_F+symbol*frame_parms->ofdm_symbol_size+re])[1], + // p,aa,re, + // ((int16_t*)&cell_spec_bf_weights[p][aa][re])[0],((int16_t*)&cell_spec_bf_weights[p][aa][re])[1], + // aa,re, + // ((int16_t*)&txdataF_BF[aa][re])[0], + // ((int16_t*)&txdataF_BF[aa][re])[1]); + } + } + } + } +} +/* +int ue_spec_beamforming(int32_t **txdataF, + int32_t **txdataF_BF, + LTE_DL_FRAME_PARMS *frame_parms, + LTE_eNB_DLSCH_t *dlsch0, + LTE_eNB_DLSCH_t *dlsch1, + int symbol) +{ + uint8_t p,aa; + uint16_t re=0; + + uint8_t harq_pid = dlsch0->current_harq_pid; + LTE_DL_eNB_HARQ_t *dlsch0_harq = dlsch0->harq_processes[harq_pid]; + LTE_DL_eNB_HARQ_t *dlsch1_harq; //= dlsch1->harq_processes[harq_pid]; + MIMO_mode_t mimo_mode = dlsch0_harq->mimo_mode; + int first_layer0 = dlsch0_harq->first_layer; + int Nlayers0 = dlsch0_harq->Nlayers; + + // Fill these in later for TM8-10 + int Nlayers1; + int first_layer1; + + if (dlsch1_harq) { + Nlayers1 = dlsch1_harq->Nlayers; + first_layer1 = dlsch1_harq->first_layer; + } + + //temp + if(mimo_mode==TM7){ + first_layer0 = 5; + Nlayers0=1; + } + + for (re=0;renb_antennas_tx;aa++) { + txdataF_BF[aa][re] += txdataF[p][re]*dlsch0->uespec_bf_weights[p][aa][re]; + } + } + } + + if(dlsch1_harq) { + for (p=first_layer1;pnb_antennas_tx;aa++) { + txdataF_BF[aa][re] += txdataF[p][re]*dlsch1->uespec_bf_weights[p][aa][re]; + } + } + } + } + + } +} */ From ea13be85b9ad0bccd55a0e8a4e6d9f7cfb885155 Mon Sep 17 00:00:00 2001 From: Xiwen JIANG Date: Mon, 29 Feb 2016 17:49:33 +0100 Subject: [PATCH 131/349] enable n_tx=8 in dlsim.c --- openair1/SIMULATION/LTE_PHY/dlsim.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/openair1/SIMULATION/LTE_PHY/dlsim.c b/openair1/SIMULATION/LTE_PHY/dlsim.c index 7b38162784..6e2cafe8f9 100644 --- a/openair1/SIMULATION/LTE_PHY/dlsim.c +++ b/openair1/SIMULATION/LTE_PHY/dlsim.c @@ -601,10 +601,10 @@ int main(int argc, char **argv) } } - //if (transmission_mode==7 && (n_tx_phy!=1 && n_tx_phy!=2 && n_tx_phy!=4 && n_tx_phy!=8 && n_tx_phy!=16 && n_tx_phy!=64 && n_tx_phy!=128)) { - if (transmission_mode==7 && (n_tx_phy!=1 && n_tx_phy!=2 && n_tx_phy!=4 && n_tx_phy!=16 && n_tx_phy!=64)) { + if (transmission_mode==7 && (n_tx_phy!=1 && n_tx_phy!=2 && n_tx_phy!=4 && n_tx_phy!=8 && n_tx_phy!=16 && n_tx_phy!=64 && n_tx_phy!=128)) { + // if (transmission_mode==7 && (n_tx_phy!=1 && n_tx_phy!=2 && n_tx_phy!=4 && n_tx_phy!=16 && n_tx_phy!=64)) { msg("Physical number of antennas not supported for TM7.\n"); - exit(-1); + exit(-1); } break; @@ -715,7 +715,7 @@ int main(int argc, char **argv) for(re=0;reofdm_symbol_size;re++) { if (n_tx_phy==1 || n_tx_phy==2) cell_spec_bf_weights[aa][re] = 0x00007fff; - else if (n_tx_phy==4) + else if (n_tx_phy==4 || n_tx_phy==8) cell_spec_bf_weights[aa][re] = 0x00007fff>>1; else if (n_tx_phy==16) cell_spec_bf_weights[aa][re] = 0x00007fff>>2; From e3e30fbf07dd9747e29b66125bf70f6d8419736c Mon Sep 17 00:00:00 2001 From: Xiwen JIANG Date: Mon, 29 Feb 2016 18:16:12 +0100 Subject: [PATCH 132/349] add tm7 eNB config file --- .../CONF/enb.band38.tm7.exmimo2.conf | 169 ++++++++++++++++++ 1 file changed, 169 insertions(+) create mode 100644 targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band38.tm7.exmimo2.conf diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band38.tm7.exmimo2.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band38.tm7.exmimo2.conf new file mode 100644 index 0000000000..deff3db9dd --- /dev/null +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band38.tm7.exmimo2.conf @@ -0,0 +1,169 @@ +Active_eNBs = ( "eNB_Eurecom_LTEBox"); +# Asn1_verbosity, choice in: none, info, annoying +Asn1_verbosity = "none"; + +eNBs = +( + { + ////////// Identification parameters: + eNB_ID = 0xe00; + + cell_type = "CELL_MACRO_ENB"; + + eNB_name = "eNB_Eurecom_LTEBox"; + + // Tracking area code, 0x0000 and 0xfffe are reserved values + tracking_area_code = "1"; + + mobile_country_code = "208"; + + mobile_network_code = "93"; + + ////////// Physical parameters: + + component_carriers = ( + { + frame_type = "TDD"; + tdd_config = 3; + tdd_config_s = 0; + prefix_type = "NORMAL"; + eutra_band = 38; + downlink_frequency = 2580000000L; + uplink_frequency_offset = 0; //-120000000; + Nid_cell = 0; + N_RB_DL = 25; + Nid_cell_mbsfn = 0; + nb_antennas_tx = 4; + nb_antennas_rx = 4; + tx_gain = 10; //25; + rx_gain = 10; //20; + prach_root = 0; + prach_config_index = 0; + prach_high_speed = "DISABLE"; + prach_zero_correlation = 1; + prach_freq_offset = 2; + pucch_delta_shift = 1; + pucch_nRB_CQI = 1; + pucch_nCS_AN = 0; + pucch_n1_AN = 32; + pdsch_referenceSignalPower = -26; + pdsch_p_b = 0; + pusch_n_SB = 1; + pusch_enable64QAM = "DISABLE"; + pusch_hoppingMode = "interSubFrame"; + pusch_hoppingOffset = 0; + pusch_groupHoppingEnabled = "ENABLE"; + pusch_groupAssignment = 0; + pusch_sequenceHoppingEnabled = "DISABLE"; + pusch_nDMRS1 = 0; + phich_duration = "NORMAL"; + phich_resource = "ONESIXTH"; + srs_enable = "DISABLE"; + /* srs_BandwidthConfig =; + srs_SubframeConfig =; + srs_ackNackST =; + srs_MaxUpPts =;*/ + + pusch_p0_Nominal = -85; + pusch_alpha = "AL1"; + pucch_p0_Nominal = -108; + msg3_delta_Preamble = 6; + pucch_deltaF_Format1 = "deltaF2"; + pucch_deltaF_Format1b = "deltaF3"; + pucch_deltaF_Format2 = "deltaF0"; + pucch_deltaF_Format2a = "deltaF0"; + pucch_deltaF_Format2b = "deltaF0"; + + rach_numberOfRA_Preambles = 64; + rach_preamblesGroupAConfig = "DISABLE"; + /* + rach_sizeOfRA_PreamblesGroupA = ; + rach_messageSizeGroupA = ; + rach_messagePowerOffsetGroupB = ; + */ + rach_powerRampingStep = 2; + rach_preambleInitialReceivedTargetPower = -100; + rach_preambleTransMax = 10; + rach_raResponseWindowSize = 10; + rach_macContentionResolutionTimer = 48; + rach_maxHARQ_Msg3Tx = 4; + + pcch_default_PagingCycle = 128; + pcch_nB = "oneT"; + bcch_modificationPeriodCoeff = 2; + ue_TimersAndConstants_t300 = 1000; + ue_TimersAndConstants_t301 = 1000; + ue_TimersAndConstants_t310 = 1000; + ue_TimersAndConstants_t311 = 10000; + ue_TimersAndConstants_n310 = 20; + ue_TimersAndConstants_n311 = 1; + } + ); + + + srb1_parameters : + { + # timer_poll_retransmit = (ms) [5, 10, 15, 20,... 250, 300, 350, ... 500] + timer_poll_retransmit = 80; + + # timer_reordering = (ms) [0,5, ... 100, 110, 120, ... ,200] + timer_reordering = 35; + + # timer_reordering = (ms) [0,5, ... 250, 300, 350, ... ,500] + timer_status_prohibit = 0; + + # poll_pdu = [4, 8, 16, 32 , 64, 128, 256, infinity(>10000)] + poll_pdu = 4; + + # poll_byte = (kB) [25,50,75,100,125,250,375,500,750,1000,1250,1500,2000,3000,infinity(>10000)] + poll_byte = 99999; + + # max_retx_threshold = [1, 2, 3, 4 , 6, 8, 16, 32] + max_retx_threshold = 4; + } + + # ------- SCTP definitions + SCTP : + { + # Number of streams to use in input/output + SCTP_INSTREAMS = 2; + SCTP_OUTSTREAMS = 2; + }; + + ////////// MME parameters: + mme_ip_address = ( { ipv4 = "192.168.12.70"; + ipv6 = "192:168:30::17"; + active = "yes"; + preference = "ipv4"; + } + ); + + NETWORK_INTERFACES : + { + ENB_INTERFACE_NAME_FOR_S1_MME = "eth0"; + ENB_IPV4_ADDRESS_FOR_S1_MME = "192.168.12.212/24"; + + ENB_INTERFACE_NAME_FOR_S1U = "eth0"; + ENB_IPV4_ADDRESS_FOR_S1U = "192.168.12.212/24"; + ENB_PORT_FOR_S1U = 2152; # Spec 2152 + }; + + log_config : + { + global_log_level ="info"; + global_log_verbosity ="medium"; + hw_log_level ="debug"; + hw_log_verbosity ="medium"; + phy_log_level ="info"; + phy_log_verbosity ="medium"; + mac_log_level ="info"; + mac_log_verbosity ="high"; + rlc_log_level ="info"; + rlc_log_verbosity ="medium"; + pdcp_log_level ="info"; + pdcp_log_verbosity ="medium"; + rrc_log_level ="debug"; + rrc_log_verbosity ="medium"; + }; + } +); From 4a04aeb2aada32731ad5ee138efe2cbbe32e38ef Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Tue, 1 Mar 2016 13:08:29 +0000 Subject: [PATCH 133/349] Fixed bug in decoding frame and subframe number from sfn_sf field --- .../LAYER2/MAC/eNB_agent_scheduler_dlsch_ue_remote.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue_remote.c b/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue_remote.c index 1818a64087..7f4ce23f9e 100644 --- a/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue_remote.c +++ b/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue_remote.c @@ -109,17 +109,17 @@ int get_sf_difference(mid_t mod_id, uint16_t sfn_sf) { return 0; } - uint16_t frame_mask = !((1<<4) - 1); - uint16_t frame = (sfn_sf & frame_mask) >> 4; + uint16_t frame_mask = ((1<<12) - 1); + uint16_t frame = (sfn_sf & (frame_mask << 4)) >> 4; - uint16_t sf_mask = !(((1<<12) - 1) << 4); + uint16_t sf_mask = ((1<<4) - 1); uint16_t subframe = (sfn_sf & sf_mask); if (frame == current_frame) { return subframe - current_subframe; } else if (frame > current_frame) { diff_in_subframes = 9 - current_subframe; - diff_in_subframes += subframe; + diff_in_subframes += (subframe + 1); diff_in_subframes += (frame-2) * 10; if (diff_in_subframes > SCHED_AHEAD_SUBFRAMES) { return -1; @@ -128,7 +128,7 @@ int get_sf_difference(mid_t mod_id, uint16_t sfn_sf) { } } else { //frame < current_frame diff_in_subframes = 9 - current_subframe; - diff_in_subframes += subframe; + diff_in_subframes += (subframe + 1); if (frame > 0) { diff_in_subframes += (frame - 1) * 10; } From bbd125a778e6cabc562779bb2c9d64d0e65941bc Mon Sep 17 00:00:00 2001 From: Xiwen JIANG Date: Tue, 1 Mar 2016 15:40:43 +0100 Subject: [PATCH 134/349] bug fixed for ULSIM --- openair1/SIMULATION/LTE_PHY/ulsim.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/openair1/SIMULATION/LTE_PHY/ulsim.c b/openair1/SIMULATION/LTE_PHY/ulsim.c index 8ba3434f48..47e41f3e85 100644 --- a/openair1/SIMULATION/LTE_PHY/ulsim.c +++ b/openair1/SIMULATION/LTE_PHY/ulsim.c @@ -28,7 +28,7 @@ *******************************************************************************/ /*! \file ulsim.c - \brief Top-level DL simulator + \brief Top-level UL simulator \author R. Knopp \date 2011 - 2014 \version 0.1 @@ -468,6 +468,7 @@ int main(int argc, char **argv) } lte_param_init(1, + 1, n_rx, 1, extended_prefix_flag, From 71b76934293a7f54a89b33dcc5266d44c2e9cde1 Mon Sep 17 00:00:00 2001 From: Xiwen JIANG Date: Tue, 1 Mar 2016 15:41:07 +0100 Subject: [PATCH 135/349] change back 'p' and 'q' options for dlsim --- openair1/SIMULATION/LTE_PHY/dlsim.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/openair1/SIMULATION/LTE_PHY/dlsim.c b/openair1/SIMULATION/LTE_PHY/dlsim.c index 6e2cafe8f9..ba7d02b340 100644 --- a/openair1/SIMULATION/LTE_PHY/dlsim.c +++ b/openair1/SIMULATION/LTE_PHY/dlsim.c @@ -447,7 +447,7 @@ int main(int argc, char **argv) n_ch_rlz= atof(optarg); break; - case 'q': + case 'p': extended_prefix_flag=1; break; @@ -554,7 +554,7 @@ int main(int argc, char **argv) print_perf=1; break; - case 'p': + case 'q': n_tx_port=atoi(optarg); if ((n_tx_port==0) || ((n_tx_port>2))) { @@ -647,7 +647,7 @@ int main(int argc, char **argv) printf("-g [A:M] Use 3GPP 25.814 SCM-A/B/C/D('A','B','C','D') or 36-101 EPA('E'), EVA ('F'),ETU('G') models (ignores delay spread and Ricean factor), Rayghleigh8 ('H'), Rayleigh1('I'), Rayleigh1_corr('J'), Rayleigh1_anticorr ('K'), Rice8('L'), Rice1('M')\n"); printf("-F forgetting factor (0 new channel every trial, 1 channel constant\n"); printf("-x Transmission mode (1,2,6,7 for the moment)\n"); - printf("-p Number of TX antennas ports used in eNB\n"); + printf("-q Number of TX antennas ports used in eNB\n"); printf("-y Number of physical TX antennas used in eNB\n"); printf("-z Number of RX antennas used in UE\n"); printf("-t MCS of interfering UE\n"); From ad74bb0247033fd0293c2f7efe6937ab947c9b97 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Thu, 3 Mar 2016 15:05:54 +0000 Subject: [PATCH 136/349] Fixed enums issue and update time advance API function --- openair2/ENB_APP/enb_agent_common.c | 82 +++++++++++++++++++++++++---- openair2/ENB_APP/enb_agent_common.h | 2 +- openair2/ENB_APP/enb_agent_mac.c | 7 ++- 3 files changed, 78 insertions(+), 13 deletions(-) diff --git a/openair2/ENB_APP/enb_agent_common.c b/openair2/ENB_APP/enb_agent_common.c index 6122789d6e..f890ba829c 100644 --- a/openair2/ENB_APP/enb_agent_common.c +++ b/openair2/ENB_APP/enb_agent_common.c @@ -545,14 +545,43 @@ int get_tx_queue_size(mid_t mod_id, mid_t ue_id, logical_chan_id_t channel_id) return rlc_status.bytes_in_buffer; } -int get_MAC_CE_bitmap_TA(mid_t mod_id, mid_t ue_id) +int get_MAC_CE_bitmap_TA(mid_t mod_id, mid_t ue_id,int CC_id) { - if((((UE_list_t *)enb_ue[mod_id])->UE_sched_ctrl[ue_id].ta_update) > 0) + rnti_t rnti = get_ue_crnti(mod_id,ue_id); + LTE_eNB_UE_stats *eNB_UE_stats = mac_xface->get_eNB_UE_stats(mod_id,CC_id,rnti); + + int32_t time_advance; + switch (PHY_vars_eNB_g[mod_id][CC_id]->lte_frame_parms.N_RB_DL) { + case 6: + time_advance = eNB_UE_stats->timing_advance_update; + break; + + case 15: + time_advance = eNB_UE_stats->timing_advance_update/2; + break; + + case 25: + time_advance = eNB_UE_stats->timing_advance_update/4; + break; + + case 50: + time_advance = eNB_UE_stats->timing_advance_update/8; + break; + + case 75: + time_advance = eNB_UE_stats->timing_advance_update/12; + break; + + case 100: + time_advance = eNB_UE_stats->timing_advance_update/16; + break; + } + + if(time_advance > 0) return 1; else return 0; } - int get_active_CC(mid_t mod_id, mid_t ue_id) { return ((UE_list_t *)enb_ue[mod_id])->numactiveCCs[ue_id]; @@ -1793,16 +1822,32 @@ int enb_agent_enb_config_reply(mid_t mod_id, const void *params, Protocol__Progr cell_conf[i]->pusch_hopping_offset = get_hopping_offset(enb_id,i); cell_conf[i]->has_pusch_hopping_offset = 1; //TODO: Fill in with actual value - cell_conf[i]->hopping_mode = get_hopping_mode(enb_id,i); + if(get_hopping_mode(enb_id,i) == 0){ + cell_conf[i]->hopping_mode = PROTOCOL__PRP_HOPPING_MODE__PRHM_INTER; + }else if(get_hopping_mode(enb_id,i) == 1){ + cell_conf[i]->hopping_mode = PROTOCOL__PRP_HOPPING_MODE__PRHM_INTERINTRA; + } cell_conf[i]->has_hopping_mode = 1; //TODO: Fill in with actual value, the number of subbands cell_conf[i]->n_sb = get_n_SB(enb_id,i); cell_conf[i]->has_n_sb = 1; //TODO: Fill in with actual value, The number of resource element groups used for PHICH. One of PRPR_ - cell_conf[i]->phich_resource = get_phich_resource(enb_id,i); + if(get_phich_resource(enb_id,i) == 0){ + cell_conf[i]->phich_resource = PROTOCOL__PRP_PHICH_RESOURCE__PRPR_ONE_SIXTH; //0 + }else if (get_phich_resource(enb_id,i) == 1){ + cell_conf[i]->phich_resource = PROTOCOL__PRP_PHICH_RESOURCE__PRPR_HALF; //1 + }else if (get_phich_resource(enb_id,i) == 2){ + cell_conf[i]->phich_resource = PROTOCOL__PRP_PHICH_RESOURCE__PRPR_ONE; // 2 + }else if (get_phich_resource(enb_id,i) == 3){ + cell_conf[i]->phich_resource = PROTOCOL__PRP_PHICH_RESOURCE__PRPR_TWO;//3 + } cell_conf[i]->has_phich_resource = 1; //TODO: Fill in with actual value, one of the PRPD_ values - cell_conf[i]->phich_duration = get_phich_duration(enb_id,i); + if(get_phich_duration(enb_id,i) == 0){ + cell_conf[i]->phich_duration = PROTOCOL__PRP_PHICH_DURATION__PRPD_NORMAL; + }else if(get_phich_duration(enb_id,i) == 1){ + cell_conf[i]->phich_duration = PROTOCOL__PRP_PHICH_DURATION__PRPD_EXTENDED; + } cell_conf[i]->has_phich_duration = 1; //TODO: Fill in with actual value, See TS 36.211, section 6.9 cell_conf[i]->init_nr_pdcch_ofdm_sym = get_num_pdcch_symb(enb_id,i); @@ -1852,16 +1897,29 @@ int enb_agent_enb_config_reply(mid_t mod_id, const void *params, Protocol__Progr cell_conf[i]->ul_bandwidth = get_N_RB_UL(enb_id,i); cell_conf[i]->has_ul_bandwidth = 1; //TODO: Fill in with actual value, one of PRUCPL values - cell_conf[i]->ul_cyclic_prefix_length = get_ul_cyclic_prefix_length(enb_id,i); + if(get_ul_cyclic_prefix_length(enb_id,i) == 0){ + cell_conf[i]->ul_cyclic_prefix_length = PROTOCOL__PRP_UL_CYCLIC_PREFIX_LENGTH__PRUCPL_NORMAL; + }else if(get_ul_cyclic_prefix_length(enb_id,i) == 1){ + cell_conf[i]->ul_cyclic_prefix_length = PROTOCOL__PRP_UL_CYCLIC_PREFIX_LENGTH__PRUCPL_EXTENDED; + } cell_conf[i]->has_ul_cyclic_prefix_length = 1; //TODO: Fill in with actual value, one of PRUCPL values - cell_conf[i]->dl_cyclic_prefix_length = get_dl_cyclic_prefix_length(enb_id,i); + if(get_ul_cyclic_prefix_length(enb_id,i) == 0){ + cell_conf[i]->ul_cyclic_prefix_length = PROTOCOL__PRP_DL_CYCLIC_PREFIX_LENGTH__PRDCPL_NORMAL; + }else if(get_ul_cyclic_prefix_length(enb_id,i) == 1){ + cell_conf[i]->ul_cyclic_prefix_length = PROTOCOL__PRP_DL_CYCLIC_PREFIX_LENGTH__PRDCPL_EXTENDED; + } + cell_conf[i]->has_dl_cyclic_prefix_length = 1; //TODO: Fill in with actual value, number of cell specific antenna ports cell_conf[i]->antenna_ports_count = 1; cell_conf[i]->has_antenna_ports_count = 1; //TODO: Fill in with actual value, one of PRDM values - cell_conf[i]->duplex_mode = get_duplex_mode(enb_id,i); + if(get_duplex_mode(enb_id,i) == 1){ + cell_conf[i]->duplex_mode = PROTOCOL__PRP_DUPLEX_MODE__PRDM_FDD; + }else if(get_duplex_mode(enb_id,i) == 0){ + cell_conf[i]->duplex_mode = PROTOCOL__PRP_DUPLEX_MODE__PRDM_TDD; + } cell_conf[i]->has_duplex_mode = 1; //TODO: Fill in with actual value, DL/UL subframe assignment. TDD only cell_conf[i]->subframe_assignment = get_subframe_assignment(enb_id,i); @@ -1936,7 +1994,11 @@ int enb_agent_enb_config_reply(mid_t mod_id, const void *params, Protocol__Progr cell_conf[i]->srs_mac_up_pts = get_srs_MaxUpPts(enb_id,i); cell_conf[i]->has_srs_mac_up_pts = 1; //TODO: Fill in with actual value, One of the PREQ_ values - cell_conf[i]->enable_64qam = get_enable64QAM(enb_id,i); + if(get_enable64QAM(enb_id,i) == 0){ + cell_conf[i]->enable_64qam = PROTOCOL__PRP_QAM__PREQ_MOD_16QAM; + }else if(get_enable64QAM(enb_id,i) == 1){ + cell_conf[i]->enable_64qam = PROTOCOL__PRP_QAM__PREQ_MOD_64QAM; + } cell_conf[i]->has_enable_64qam = 1; //TODO: Fill in with actual value, Carrier component index cell_conf[i]->carrier_index = i; diff --git a/openair2/ENB_APP/enb_agent_common.h b/openair2/ENB_APP/enb_agent_common.h index 76c68437d0..e8fbf3afb8 100644 --- a/openair2/ENB_APP/enb_agent_common.h +++ b/openair2/ENB_APP/enb_agent_common.h @@ -157,7 +157,7 @@ int get_ue_wcqi (mid_t mod_id, mid_t ue_id); int get_tx_queue_size(mid_t mod_id, mid_t ue_id, logical_chan_id_t channel_id); -int get_MAC_CE_bitmap_TA(mid_t mod_id, mid_t ue_id); +int get_MAC_CE_bitmap_TA(mid_t mod_id, mid_t ue_id, int CC_id); int get_active_CC(mid_t mod_id, mid_t ue_id); diff --git a/openair2/ENB_APP/enb_agent_mac.c b/openair2/ENB_APP/enb_agent_mac.c index fa190bbf29..0957bd94f2 100644 --- a/openair2/ENB_APP/enb_agent_mac.c +++ b/openair2/ENB_APP/enb_agent_mac.c @@ -486,7 +486,7 @@ int enb_agent_mac_stats_reply(mid_t mod_id, /* Check flag for creation of MAC CE buffer status report */ if (report_config->ue_report_type[i].ue_report_flags & PROTOCOL__PRP_UE_STATS_TYPE__PRUST_MAC_CE_BS) { // TODO: Fill in the actual MAC CE buffer status report - ue_report[i]->pending_mac_ces = (get_MAC_CE_bitmap_TA(enb_id,i) | (0 << 1) | (0 << 2) | (0 << 3)) & 15; /* Use as bitmap. Set one or more of the; /* Use as bitmap. Set one or more of the + ue_report[i]->pending_mac_ces = (get_MAC_CE_bitmap_TA(enb_id,i,0) | (0 << 1) | (0 << 2) | (0 << 3)) & 15; /* Use as bitmap. Set one or more of the; /* Use as bitmap. Set one or more of the PROTOCOL__PRP_CE_TYPE__PRPCET_ values found in stats_common.pb-c.h. See prp_ce_type in progRAN specification */ @@ -957,7 +957,10 @@ int enb_agent_mac_sf_trigger(mid_t mod_id, const void *params, Protocol__Progran dl_info[i]->harq_status = malloc(sizeof(uint32_t) * dl_info[i]->n_harq_status); for (j = 0; j < dl_info[i]->n_harq_status; j++) { // TODO: This should be different per TB - dl_info[i]->harq_status[j] = harq_status; + if(harq_status == 0) + dl_info[i]->harq_status[j] = PROTOCOL__PRP_HARQ_STATUS__PRHS_ACK; + else if (harq_status == 1) + dl_info[i]->harq_status[j] = PROTOCOL__PRP_HARQ_STATUS__PRHS_NACK; } /*TODO: fill in the serving cell index for this UE */ dl_info[i]->serv_cell_index = UE_PCCID(mod_id,i); From a576127c49fe2711e5c20697aa66bbde5b268922 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Thu, 3 Mar 2016 15:17:19 +0000 Subject: [PATCH 137/349] Added temporary values in protocol for PUCCH power control --- openair2/ENB_APP/MESSAGES/V2/stats_common.proto | 2 ++ 1 file changed, 2 insertions(+) diff --git a/openair2/ENB_APP/MESSAGES/V2/stats_common.proto b/openair2/ENB_APP/MESSAGES/V2/stats_common.proto index 77df92a68b..3aaa018184 100644 --- a/openair2/ENB_APP/MESSAGES/V2/stats_common.proto +++ b/openair2/ENB_APP/MESSAGES/V2/stats_common.proto @@ -154,6 +154,7 @@ message prp_ul_cqi { optional prp_ul_cqi_type type = 1; repeated uint32 sinr = 2; optional uint32 serv_cell_index = 3; + optional int32 p0_pucch_dbm = 4; } // Full UL CQI report for a specific UE @@ -172,5 +173,6 @@ message prp_noise_interference_report { optional uint32 sfn_sf = 1; optional uint32 rip = 2; optional uint32 tnp = 3; + optional int32 p0_nominal_pucch = 4; } From d153208fc09116022c898abb998ebc4b7a070be2 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Thu, 3 Mar 2016 17:39:10 +0000 Subject: [PATCH 138/349] Added p0_PUCCH support in the agent --- .../ENB_APP/MESSAGES/V2/stats_common.proto | 6 ++++- openair2/ENB_APP/enb_agent_common.c | 20 ++++++++++++++ openair2/ENB_APP/enb_agent_common.h | 4 +++ openair2/ENB_APP/enb_agent_mac.c | 26 +++++++++++++++++++ 4 files changed, 55 insertions(+), 1 deletion(-) diff --git a/openair2/ENB_APP/MESSAGES/V2/stats_common.proto b/openair2/ENB_APP/MESSAGES/V2/stats_common.proto index 3aaa018184..50d66a620c 100644 --- a/openair2/ENB_APP/MESSAGES/V2/stats_common.proto +++ b/openair2/ENB_APP/MESSAGES/V2/stats_common.proto @@ -154,15 +154,19 @@ message prp_ul_cqi { optional prp_ul_cqi_type type = 1; repeated uint32 sinr = 2; optional uint32 serv_cell_index = 3; - optional int32 p0_pucch_dbm = 4; } // Full UL CQI report for a specific UE message prp_ul_cqi_report { optional uint32 sfn_sn = 1; repeated prp_ul_cqi cqi_meas = 2; + repeated prp_pucch_dbm pucch_dbm = 3; } +message prp_pucch_dbm { + optional int32 p0_pucch_dbm = 1; + optional uint32 serv_cell_index = 2; +} // // Cell related statistics diff --git a/openair2/ENB_APP/enb_agent_common.c b/openair2/ENB_APP/enb_agent_common.c index f890ba829c..64b51238f1 100644 --- a/openair2/ENB_APP/enb_agent_common.c +++ b/openair2/ENB_APP/enb_agent_common.c @@ -647,6 +647,26 @@ int get_harq(const mid_t mod_id, const uint8_t CC_id, const mid_t ue_id, const i return 0; } +int get_p0_pucch_dbm(mid_t mod_id, mid_t ue_id, int CC_id) +{ + LTE_eNB_UE_stats *eNB_UE_stats = NULL; + uint32_t rnti = get_ue_crnti(mod_id,ue_id); + + eNB_UE_stats = mac_xface->get_eNB_UE_stats(mod_id, CC_id, rnti); + if(eNB_UE_stats->Po_PUCCH_update == 1) + { + return eNB_UE_stats->Po_PUCCH_dBm; + } + else + return -1; +} + +int get_p0_nominal_pucch(mid_t mod_id, int CC_id) +{ + int32_t pucch_rx_received = mac_xface->get_target_pucch_rx_power(mod_id, CC_id); + return pucch_rx_received; +} + /* * ************************************ diff --git a/openair2/ENB_APP/enb_agent_common.h b/openair2/ENB_APP/enb_agent_common.h index e8fbf3afb8..1c4d478aab 100644 --- a/openair2/ENB_APP/enb_agent_common.h +++ b/openair2/ENB_APP/enb_agent_common.h @@ -210,6 +210,10 @@ int get_tpc(mid_t mod_id, mid_t ue_id); int get_harq(const mid_t mod_id, const uint8_t CC_id, const mid_t ue_id, const int frame, const uint8_t subframe, int *id, int *status); +int get_p0_pucch_dbm(mid_t mod_id, mid_t ue_id, int CC_id); + +int get_p0_nominal_pucch(mid_t mod_id, int CC_id); + /* * ************************************ * Get Messages for UE Configuration Reply diff --git a/openair2/ENB_APP/enb_agent_mac.c b/openair2/ENB_APP/enb_agent_mac.c index 0957bd94f2..29347b152b 100644 --- a/openair2/ENB_APP/enb_agent_mac.c +++ b/openair2/ENB_APP/enb_agent_mac.c @@ -657,8 +657,27 @@ int enb_agent_mac_stats_reply(mid_t mod_id, //TODO: Set the servCellIndex for this report ul_report[j]->serv_cell_index = 0; ul_report[j]->has_serv_cell_index = 1; + + /*if(get_p0_pucch_dbm(enb_id,i) != -1){ + ul_report[j]->p0_pucch_dbm = get_p0_pucch_dbm(enb_id,i); + ul_report[j]->has_p0_pucch_dbm = 1; + }*/ //Set the list of UL reports of this UE to the full UL report full_ul_report->cqi_meas = ul_report; + full_ul_report->n_pucch_dbm = MAX_NUM_CCs; + full_ul_report->pucch_dbm = malloc(sizeof(Protocol__PrpPucchDbm *) * full_ul_report->n_pucch_dbm); + + for (j = 0; j < MAX_NUM_CCs; j++) { + full_ul_report->pucch_dbm[j] = malloc(sizeof(Protocol__PrpPucchDbm)); + protocol__prp_pucch_dbm__init(full_ul_report->pucch_dbm[j]); + full_ul_report->pucch_dbm[j]->has_serv_cell_index = 1; + full_ul_report->pucch_dbm[j]->serv_cell_index = j; + if(get_p0_pucch_dbm(enb_id,i, j) != -1){ + full_ul_report->pucch_dbm[j]->p0_pucch_dbm = get_p0_pucch_dbm(enb_id,i,j); + full_ul_report->pucch_dbm[j]->has_p0_pucch_dbm = 1; + } + } + //Add full UL CQI report to the UE report ue_report[i]->ul_cqi_report = full_ul_report; } @@ -701,6 +720,9 @@ int enb_agent_mac_stats_reply(mid_t mod_id, // Thermal noise power in dbm ni_report->tnp = 0; ni_report->has_tnp = 1; + + ni_report->p0_nominal_pucch = get_p0_nominal_pucch(enb_id, 0); + ni_report->has_p0_nominal_pucch = 1; cell_report[i]->noise_inter_report = ni_report; } } @@ -822,6 +844,10 @@ int enb_agent_mac_destroy_stats_reply(Protocol__ProgranMessage *msg) { } free(ul_report->cqi_meas); } + for (j = 0; j < ul_report->n_pucch_dbm; j++) { + free(ul_report->pucch_dbm[j]); + } + free(ul_report->pucch_dbm); free(reply->ue_report[i]); } free(reply->ue_report); From d24f532396029e8bc690e42842f4b04082981f29 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Thu, 3 Mar 2016 19:49:51 +0000 Subject: [PATCH 139/349] Fixed bug in de-allocation of p0_pucch report --- openair2/ENB_APP/enb_agent_mac.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/openair2/ENB_APP/enb_agent_mac.c b/openair2/ENB_APP/enb_agent_mac.c index 29347b152b..197144d628 100644 --- a/openair2/ENB_APP/enb_agent_mac.c +++ b/openair2/ENB_APP/enb_agent_mac.c @@ -657,13 +657,10 @@ int enb_agent_mac_stats_reply(mid_t mod_id, //TODO: Set the servCellIndex for this report ul_report[j]->serv_cell_index = 0; ul_report[j]->has_serv_cell_index = 1; - - /*if(get_p0_pucch_dbm(enb_id,i) != -1){ - ul_report[j]->p0_pucch_dbm = get_p0_pucch_dbm(enb_id,i); - ul_report[j]->has_p0_pucch_dbm = 1; - }*/ + //Set the list of UL reports of this UE to the full UL report full_ul_report->cqi_meas = ul_report; + full_ul_report->n_pucch_dbm = MAX_NUM_CCs; full_ul_report->pucch_dbm = malloc(sizeof(Protocol__PrpPucchDbm *) * full_ul_report->n_pucch_dbm); @@ -843,11 +840,11 @@ int enb_agent_mac_destroy_stats_reply(Protocol__ProgranMessage *msg) { free(ul_report->cqi_meas[j]); } free(ul_report->cqi_meas); + for (j = 0; j < ul_report->n_pucch_dbm; j++) { + free(ul_report->pucch_dbm[j]); + } + free(ul_report->pucch_dbm); } - for (j = 0; j < ul_report->n_pucch_dbm; j++) { - free(ul_report->pucch_dbm[j]); - } - free(ul_report->pucch_dbm); free(reply->ue_report[i]); } free(reply->ue_report); From 47d3d7732225f8d14270d2e94d6681fdf2e25183 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Fri, 4 Mar 2016 10:04:29 +0000 Subject: [PATCH 140/349] Added updates in the dataplane based on dl_mac_config message --- .../LAYER2/MAC/eNB_agent_scheduler_dataplane.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/openair2/LAYER2/MAC/eNB_agent_scheduler_dataplane.c b/openair2/LAYER2/MAC/eNB_agent_scheduler_dataplane.c index a1bd039dff..6f84014070 100644 --- a/openair2/LAYER2/MAC/eNB_agent_scheduler_dataplane.c +++ b/openair2/LAYER2/MAC/eNB_agent_scheduler_dataplane.c @@ -163,6 +163,12 @@ void apply_ue_spec_scheduling_decisions(mid_t mod_id, //Check if there is TA command and set the length appropriately ta_len = (dl_data->ce_bitmap[0] & PROTOCOL__PRP_CE_TYPE__PRPCET_TA) ? 2 : 0; } + + if (ta_len > 0) { + // Reset the measurement + ue_sched_ctl->ta_timer = 20; + eNB_UE_stats->timing_advance_update = 0; + } n_lc = dl_data->n_rlc_pdu; num_sdus = 0; @@ -333,6 +339,7 @@ void fill_oai_dci(mid_t mod_id, uint32_t CC_id, uint32_t rnti, int size_bits, size_bytes; eNB_MAC_INST *eNB = &eNB_mac_inst[mod_id]; UE_list_t *UE_list = &eNB->UE_list; + LTE_eNB_UE_stats *eNB_UE_stats = NULL; int UE_id = find_ue(rnti, PHY_vars_eNB_g[mod_id][CC_id]); @@ -346,6 +353,15 @@ void fill_oai_dci(mid_t mod_id, uint32_t CC_id, uint32_t rnti, DCI_pdu = &eNB->common_channels[CC_id].DCI_pdu; frame_parms[CC_id] = mac_xface->get_lte_frame_parms(mod_id, CC_id); + + if (dl_dci->has_tpc == 1) { + // Check if tpc has been set and reset measurement */ + if ((dl_dci->tpc == 0) || (dl_dci->tpc == 2)) { + eNB_UE_stats = mac_xface->get_eNB_UE_stats(mod_id, CC_id, rnti); + eNB_UE_stats->Po_PUCCH_update = 0; + } + } + switch (frame_parms[CC_id]->N_RB_DL) { case 6: From 06b55e3fba77b9c3bcccd2fff347c599bf04155d Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Fri, 4 Mar 2016 10:19:34 +0000 Subject: [PATCH 141/349] Fixed bug in creation of ul_cqi_report --- openair2/ENB_APP/enb_agent_mac.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/openair2/ENB_APP/enb_agent_mac.c b/openair2/ENB_APP/enb_agent_mac.c index 197144d628..630231560f 100644 --- a/openair2/ENB_APP/enb_agent_mac.c +++ b/openair2/ENB_APP/enb_agent_mac.c @@ -633,7 +633,7 @@ int enb_agent_mac_stats_reply(mid_t mod_id, if(ul_report == NULL) goto error; //Fill each UL report of the UE for each of the configured report types - for(j = 0; j++; j < full_ul_report->n_cqi_meas) { + for(j = 0; j < full_ul_report->n_cqi_meas; j++) { ul_report[j] = malloc(sizeof(Protocol__PrpUlCqi)); if(ul_report[j] == NULL) goto error; @@ -665,14 +665,14 @@ int enb_agent_mac_stats_reply(mid_t mod_id, full_ul_report->pucch_dbm = malloc(sizeof(Protocol__PrpPucchDbm *) * full_ul_report->n_pucch_dbm); for (j = 0; j < MAX_NUM_CCs; j++) { - full_ul_report->pucch_dbm[j] = malloc(sizeof(Protocol__PrpPucchDbm)); - protocol__prp_pucch_dbm__init(full_ul_report->pucch_dbm[j]); - full_ul_report->pucch_dbm[j]->has_serv_cell_index = 1; - full_ul_report->pucch_dbm[j]->serv_cell_index = j; - if(get_p0_pucch_dbm(enb_id,i, j) != -1){ - full_ul_report->pucch_dbm[j]->p0_pucch_dbm = get_p0_pucch_dbm(enb_id,i,j); - full_ul_report->pucch_dbm[j]->has_p0_pucch_dbm = 1; - } + full_ul_report->pucch_dbm[j] = malloc(sizeof(Protocol__PrpPucchDbm)); + protocol__prp_pucch_dbm__init(full_ul_report->pucch_dbm[j]); + full_ul_report->pucch_dbm[j]->has_serv_cell_index = 1; + full_ul_report->pucch_dbm[j]->serv_cell_index = j; + if(get_p0_pucch_dbm(enb_id,i, j) != -1){ + full_ul_report->pucch_dbm[j]->p0_pucch_dbm = get_p0_pucch_dbm(enb_id,i,j); + full_ul_report->pucch_dbm[j]->has_p0_pucch_dbm = 1; + } } //Add full UL CQI report to the UE report From 93b7cf05e868dac0135664ac03d62914babab5c6 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Fri, 4 Mar 2016 10:54:11 +0000 Subject: [PATCH 142/349] Fixed linking error with creation of empty dl_mac_config --- openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue_remote.c | 6 +++--- openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue_remote.h | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue_remote.c b/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue_remote.c index 7f4ce23f9e..4fffeea132 100644 --- a/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue_remote.c +++ b/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue_remote.c @@ -70,7 +70,7 @@ void schedule_ue_spec_remote(mid_t mod_id, uint32_t frame, uint32_t subframe, enb_agent_mac_destroy_dl_config(dl_config_elem->dl_info); free(dl_config_elem); } else { // next subframe, nothing to do now - enb_agent_create_empty_dl_config(mod_id, dl_info); + enb_agent_mac_create_empty_dl_config(mod_id, dl_info); return; } } @@ -87,7 +87,7 @@ void schedule_ue_spec_remote(mid_t mod_id, uint32_t frame, uint32_t subframe, } else { // Intended for future subframe. Store it in local cache dl_mac_config_element_t *e = malloc(sizeof(dl_mac_config_element_t)); TAILQ_INSERT_TAIL(&queue_head, e, configs); - enb_agent_create_empty_dl_config(mod_id, dl_info); + enb_agent_mac_create_empty_dl_config(mod_id, dl_info); // No need to look for another. Messages arrive ordered return; } @@ -95,7 +95,7 @@ void schedule_ue_spec_remote(mid_t mod_id, uint32_t frame, uint32_t subframe, } // We found no pending command, so we will simply pass an empty one - enb_agent_create_empty_dl_config(mod_id, dl_info); + enb_agent_mac_create_empty_dl_config(mod_id, dl_info); } int get_sf_difference(mid_t mod_id, uint16_t sfn_sf) { diff --git a/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue_remote.h b/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue_remote.h index 2b8ec3ec19..e507f5d8a8 100644 --- a/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue_remote.h +++ b/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue_remote.h @@ -45,6 +45,7 @@ #include "ENB_APP/enb_agent_defs.h" #include "enb_agent_mac.h" +#include "LAYER2/MAC/enb_agent_mac_proto.h" #include From 26bdf501092cebe4cee227b4f51c49672c4a2f8f Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Fri, 4 Mar 2016 15:46:31 +0000 Subject: [PATCH 143/349] Added bugfixes for remote scheduling --- openair1/SCHED/phy_procedures_lte_eNb.c | 4 +- openair2/ENB_APP/enb_agent_common.c | 126 +++++++++--------- openair2/ENB_APP/enb_agent_mac.c | 2 + .../MAC/eNB_agent_scheduler_dlsch_ue_remote.c | 38 ++++-- 4 files changed, 94 insertions(+), 76 deletions(-) diff --git a/openair1/SCHED/phy_procedures_lte_eNb.c b/openair1/SCHED/phy_procedures_lte_eNb.c index 60cd0ec0f7..211c64e373 100755 --- a/openair1/SCHED/phy_procedures_lte_eNb.c +++ b/openair1/SCHED/phy_procedures_lte_eNb.c @@ -153,8 +153,8 @@ void remove_harq_pid_from_freelist(LTE_eNB_DLSCH_t *DLSCH_ptr, int harq_pid) * to be refined in case things don't work properly */ if (harq_pid != DLSCH_ptr->harq_pid_freelist[DLSCH_ptr->head_freelist]) { - LOG_E(PHY, "%s:%d: critical error, get in touch with the authors\n", __FILE__, __LINE__); - abort(); + //LOG_E(PHY, "%s:%d: critical error, get in touch with the authors\n", __FILE__, __LINE__); + //abort(); } DLSCH_ptr->head_freelist = (DLSCH_ptr->head_freelist + 1) % 10; } diff --git a/openair2/ENB_APP/enb_agent_common.c b/openair2/ENB_APP/enb_agent_common.c index 64b51238f1..646470d13f 100644 --- a/openair2/ENB_APP/enb_agent_common.c +++ b/openair2/ENB_APP/enb_agent_common.c @@ -272,31 +272,33 @@ int enb_agent_destroy_echo_reply(Protocol__ProgranMessage *msg) { int enb_agent_destroy_enb_config_reply(Protocol__ProgranMessage *msg) { - if(msg->msg_case != PROTOCOL__PROGRAN_MESSAGE__MSG_ENB_CONFIG_REPLY_MSG) - goto error; - free(msg->enb_config_reply_msg->header); - int i, j; - Protocol__PrpEnbConfigReply *reply = msg->enb_config_reply_msg; - - for(i = 0; i < reply->n_cell_config;i++){ - free(reply->cell_config[i]->mbsfn_subframe_config_rfoffset); - free(reply->cell_config[i]->mbsfn_subframe_config_rfperiod); - free(reply->cell_config[i]->mbsfn_subframe_config_sfalloc); - for(j = 0; j < reply->cell_config[i]->si_config->n_si_message;j++){ - free(reply->cell_config[i]->si_config->si_message[j]); - } - free(reply->cell_config[i]->si_config->si_message); - free(reply->cell_config[i]->si_config); - free(reply->cell_config[i]); - } - free(reply->cell_config); - free(reply); - free(msg); - - return 0; - error: - //LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); - return -1; + if(msg->msg_case != PROTOCOL__PROGRAN_MESSAGE__MSG_ENB_CONFIG_REPLY_MSG) + goto error; + free(msg->enb_config_reply_msg->header); + int i, j; + Protocol__PrpEnbConfigReply *reply = msg->enb_config_reply_msg; + + for(i = 0; i < reply->n_cell_config;i++){ + free(reply->cell_config[i]->mbsfn_subframe_config_rfoffset); + free(reply->cell_config[i]->mbsfn_subframe_config_rfperiod); + free(reply->cell_config[i]->mbsfn_subframe_config_sfalloc); + if (reply->cell_config[i]->si_config != NULL) { + for(j = 0; j < reply->cell_config[i]->si_config->n_si_message;j++){ + free(reply->cell_config[i]->si_config->si_message[j]); + } + free(reply->cell_config[i]->si_config->si_message); + free(reply->cell_config[i]->si_config); + } + free(reply->cell_config[i]); + } + free(reply->cell_config); + free(reply); + free(msg); + + return 0; + error: + //LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); + return -1; } int enb_agent_destroy_ue_config_reply(Protocol__ProgranMessage *msg) { @@ -507,7 +509,7 @@ uint16_t get_sfn_sf (mid_t mod_id) { frame = (frame_t) get_current_system_frame_num(mod_id); subframe = (sub_frame_t) get_current_subframe(mod_id); frame_mask = ((1<<12) - 1); - sf_mask = ((1<<4) -1); + sf_mask = ((1<<4) - 1); sfn_sf = (subframe & sf_mask) | ((frame & frame_mask) << 4); return sfn_sf; @@ -1873,42 +1875,42 @@ int enb_agent_enb_config_reply(mid_t mod_id, const void *params, Protocol__Progr cell_conf[i]->init_nr_pdcch_ofdm_sym = get_num_pdcch_symb(enb_id,i); cell_conf[i]->has_init_nr_pdcch_ofdm_sym = 1; //TODO: Fill in with actual value - Protocol__PrpSiConfig *si_config; - si_config = malloc(sizeof(Protocol__PrpSiConfig)); - if(si_config == NULL) - goto error; - protocol__prp_si_config__init(si_config); - //TODO: Fill in with actual value, Frame number to apply the SI configuration - si_config->sfn = 1; - si_config->has_sfn = 1; - //TODO: Fill in with actual value, the length of SIB1 in bytes - si_config->sib1_length = get_sib1_length(enb_id,i); - si_config->has_sib1_length = 1; - //TODO: Fill in with actual value, Scheduling window for all SIs in SF - si_config->si_window_length = (uint32_t) get_si_window_length(enb_id,i); - si_config->has_si_window_length = 1; - //TODO: Fill in with actual value, the number of SI messages - si_config->n_si_message=1; - Protocol__PrpSiMessage **si_message; - si_message = malloc(sizeof(Protocol__PrpSiMessage *) * si_config->n_si_message); - if(si_message == NULL) - goto error; - for(j = 0; j < si_config->n_si_message; j++){ - si_message[j] = malloc(sizeof(Protocol__PrpSiMessage)); - if(si_message[j] == NULL) - goto error; - protocol__prp_si_message__init(si_message[j]); - //TODO: Fill in with actual value, Periodicity of SI msg in radio frames - si_message[j]->periodicity = 1; //SIPeriod - si_message[j]->has_periodicity = 1; - //TODO: Fill in with actual value, rhe length of the SI message in bytes - si_message[j]->length = 10; - si_message[j]->has_length = 1; - } - if(si_config->n_si_message > 0){ - si_config->si_message = si_message; - } - cell_conf[i]->si_config = si_config; + /* Protocol__PrpSiConfig *si_config; */ + /* si_config = malloc(sizeof(Protocol__PrpSiConfig)); */ + /* if(si_config == NULL) */ + /* goto error; */ + /* protocol__prp_si_config__init(si_config); */ + /* //TODO: Fill in with actual value, Frame number to apply the SI configuration */ + /* si_config->sfn = 1; */ + /* si_config->has_sfn = 1; */ + /* //TODO: Fill in with actual value, the length of SIB1 in bytes */ + /* si_config->sib1_length = get_sib1_length(enb_id,i); */ + /* si_config->has_sib1_length = 1; */ + /* //TODO: Fill in with actual value, Scheduling window for all SIs in SF */ + /* si_config->si_window_length = (uint32_t) get_si_window_length(enb_id,i); */ + /* si_config->has_si_window_length = 1; */ + /* //TODO: Fill in with actual value, the number of SI messages */ + /* si_config->n_si_message=1; */ + /* Protocol__PrpSiMessage **si_message; */ + /* si_message = malloc(sizeof(Protocol__PrpSiMessage *) * si_config->n_si_message); */ + /* if(si_message == NULL) */ + /* goto error; */ + /* for(j = 0; j < si_config->n_si_message; j++){ */ + /* si_message[j] = malloc(sizeof(Protocol__PrpSiMessage)); */ + /* if(si_message[j] == NULL) */ + /* goto error; */ + /* protocol__prp_si_message__init(si_message[j]); */ + /* //TODO: Fill in with actual value, Periodicity of SI msg in radio frames */ + /* si_message[j]->periodicity = 1; //SIPeriod */ + /* si_message[j]->has_periodicity = 1; */ + /* //TODO: Fill in with actual value, rhe length of the SI message in bytes */ + /* si_message[j]->length = 10; */ + /* si_message[j]->has_length = 1; */ + /* } */ + /* if(si_config->n_si_message > 0){ */ + /* si_config->si_message = si_message; */ + /* } */ + /* cell_conf[i]->si_config = si_config; */ //TODO: Fill in with actual value, the DL transmission bandwidth in RBs cell_conf[i]->dl_bandwidth = get_N_RB_DL(enb_id,i); diff --git a/openair2/ENB_APP/enb_agent_mac.c b/openair2/ENB_APP/enb_agent_mac.c index 630231560f..f00012f158 100644 --- a/openair2/ENB_APP/enb_agent_mac.c +++ b/openair2/ENB_APP/enb_agent_mac.c @@ -41,6 +41,7 @@ #include "LAYER2/MAC/proto.h" #include "LAYER2/MAC/enb_agent_mac_proto.h" +#include "LAYER2/MAC/eNB_agent_scheduler_dlsch_ue_remote.h" #include "liblfds700.h" @@ -1369,6 +1370,7 @@ int enb_agent_register_mac_xface(mid_t mod_id, AGENT_MAC_xface *xface) { xface->enb_agent_send_sf_trigger = enb_agent_send_sf_trigger; xface->enb_agent_send_update_mac_stats = enb_agent_send_update_mac_stats; xface->enb_agent_schedule_ue_spec = schedule_ue_spec_default; + //xface->enb_agent_schedule_ue_spec = schedule_ue_spec_remote; xface->enb_agent_get_pending_dl_mac_config = enb_agent_get_pending_dl_mac_config; xface->enb_agent_notify_ue_state_change = enb_agent_ue_state_change; diff --git a/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue_remote.c b/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue_remote.c index 4fffeea132..c4f40faff7 100644 --- a/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue_remote.c +++ b/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue_remote.c @@ -46,7 +46,7 @@ int queue_initialized = 0; void schedule_ue_spec_remote(mid_t mod_id, uint32_t frame, uint32_t subframe, int *mbsfn_flag, Protocol__ProgranMessage **dl_info) { - if (queue_initialized) { + if (!queue_initialized) { TAILQ_INIT(&queue_head); queue_initialized = 1; } @@ -54,22 +54,26 @@ void schedule_ue_spec_remote(mid_t mod_id, uint32_t frame, uint32_t subframe, dl_mac_config_element_t *dl_config_elem; int diff; - + LOG_D(MAC, "Current frame and subframe %d, %d\n", frame, subframe); // First we check to see if we have a scheduling decision for this sfn_sf already in our queue while(queue_head.tqh_first != NULL) { dl_config_elem = queue_head.tqh_first; + diff = get_sf_difference(mod_id, dl_config_elem->dl_info->dl_mac_config_msg->sfn_sf); // Check if this decision is for now, for a later or a previous subframe if ( diff == 0) { // Now + LOG_D(MAC, "Found a decision for this subframe in the queue. Let's use it!\n"); TAILQ_REMOVE(&queue_head, queue_head.tqh_first, configs); *dl_info = dl_config_elem->dl_info; free(dl_config_elem); return; } else if (diff < 0) { //previous subframe , delete message and free memory + LOG_D(MAC, "Found a decision for a previous subframe in the queue. Let's get rid of it\n"); TAILQ_REMOVE(&queue_head, queue_head.tqh_first, configs); enb_agent_mac_destroy_dl_config(dl_config_elem->dl_info); free(dl_config_elem); } else { // next subframe, nothing to do now + LOG_D(MAC, "Found a decision for a future subframe in the queue. Nothing to do now\n"); enb_agent_mac_create_empty_dl_config(mod_id, dl_info); return; } @@ -81,17 +85,22 @@ void schedule_ue_spec_remote(mid_t mod_id, uint32_t frame, uint32_t subframe, diff = get_sf_difference(mod_id, (*dl_info)->dl_mac_config_msg->sfn_sf); if (diff == 0) { // Got a command for this sfn_sf + LOG_D(MAC, "Found a decision for this subframe pending. Let's use it\n"); return; } else if (diff < 0) { + LOG_D(MAC, "Found a decision for a previous subframe. Let's get rid of it\n"); enb_agent_mac_destroy_dl_config(*dl_info); + *dl_info = NULL; + enb_agent_get_pending_dl_mac_config(mod_id, dl_info); } else { // Intended for future subframe. Store it in local cache + LOG_D(MAC, "Found a decision for a future subframe in the queue. Let's store it in the cache\n"); dl_mac_config_element_t *e = malloc(sizeof(dl_mac_config_element_t)); + e->dl_info = *dl_info; TAILQ_INSERT_TAIL(&queue_head, e, configs); enb_agent_mac_create_empty_dl_config(mod_id, dl_info); // No need to look for another. Messages arrive ordered return; } - enb_agent_get_pending_dl_mac_config(mod_id, dl_info); } // We found no pending command, so we will simply pass an empty one @@ -114,25 +123,30 @@ int get_sf_difference(mid_t mod_id, uint16_t sfn_sf) { uint16_t sf_mask = ((1<<4) - 1); uint16_t subframe = (sfn_sf & sf_mask); + + LOG_D(MAC, "Target frame and subframe %d, %d\n", frame, subframe); if (frame == current_frame) { return subframe - current_subframe; } else if (frame > current_frame) { - diff_in_subframes = 9 - current_subframe; - diff_in_subframes += (subframe + 1); - diff_in_subframes += (frame-2) * 10; + diff_in_subframes = ((frame*10)+subframe) - ((current_frame*10)+current_subframe); + + // diff_in_subframes = 9 - current_subframe; + //diff_in_subframes += (subframe + 1); + //diff_in_subframes += (frame-2) * 10; if (diff_in_subframes > SCHED_AHEAD_SUBFRAMES) { return -1; } else { return 1; } } else { //frame < current_frame - diff_in_subframes = 9 - current_subframe; - diff_in_subframes += (subframe + 1); - if (frame > 0) { - diff_in_subframes += (frame - 1) * 10; - } - diff_in_subframes += (1023 - current_frame) * 10; + //diff_in_subframes = 9 - current_subframe; + //diff_in_subframes += (subframe + 1); + //if (frame > 0) { + // diff_in_subframes += (frame - 1) * 10; + //} + //diff_in_subframes += (1023 - current_frame) * 10; + diff_in_subframes = 10240 - ((current_frame*10)+current_subframe) + ((frame*10)+subframe); if (diff_in_subframes > SCHED_AHEAD_SUBFRAMES) { return -1; } else { From fc569650ce84d3aa0349ef1459d6f646125dbcb3 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Mon, 7 Mar 2016 10:02:40 +0000 Subject: [PATCH 144/349] Fixed problem with sfn_sf recoding in remote scheduler --- openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue_remote.c | 8 ++++---- openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue_remote.h | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue_remote.c b/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue_remote.c index c4f40faff7..db90bb1754 100644 --- a/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue_remote.c +++ b/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue_remote.c @@ -54,7 +54,7 @@ void schedule_ue_spec_remote(mid_t mod_id, uint32_t frame, uint32_t subframe, dl_mac_config_element_t *dl_config_elem; int diff; - LOG_D(MAC, "Current frame and subframe %d, %d\n", frame, subframe); + LOG_D(MAC, "[TEST] Current frame and subframe %d, %d\n", frame, subframe); // First we check to see if we have a scheduling decision for this sfn_sf already in our queue while(queue_head.tqh_first != NULL) { dl_config_elem = queue_head.tqh_first; @@ -107,12 +107,12 @@ void schedule_ue_spec_remote(mid_t mod_id, uint32_t frame, uint32_t subframe, enb_agent_mac_create_empty_dl_config(mod_id, dl_info); } -int get_sf_difference(mid_t mod_id, uint16_t sfn_sf) { +int get_sf_difference(mid_t mod_id, uint32_t sfn_sf) { int diff_in_subframes; uint16_t current_frame = get_current_system_frame_num(mod_id); uint16_t current_subframe = get_current_subframe(mod_id); - uint16_t current_sfn_sf = get_sfn_sf(mod_id); + uint32_t current_sfn_sf = get_sfn_sf(mod_id); if (sfn_sf == current_sfn_sf) { return 0; @@ -124,7 +124,7 @@ int get_sf_difference(mid_t mod_id, uint16_t sfn_sf) { uint16_t sf_mask = ((1<<4) - 1); uint16_t subframe = (sfn_sf & sf_mask); - LOG_D(MAC, "Target frame and subframe %d, %d\n", frame, subframe); + LOG_D(MAC, "[TEST] Target frame and subframe %d, %d\n", frame, subframe); if (frame == current_frame) { return subframe - current_subframe; diff --git a/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue_remote.h b/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue_remote.h index e507f5d8a8..c636ec0d95 100644 --- a/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue_remote.h +++ b/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue_remote.h @@ -72,6 +72,6 @@ void schedule_ue_spec_remote(mid_t mod_id, uint32_t frame, uint32_t subframe, // 0 for equal // positive for future value // Based on -int get_sf_difference(mid_t mod_id, uint16_t sfn_sf); +int get_sf_difference(mid_t mod_id, uint32_t sfn_sf); #endif From 0dc76931c61b38bebf8cd60a022e6076ae1beb93 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Mon, 7 Mar 2016 12:37:46 +0000 Subject: [PATCH 145/349] Fixed bug in HARQ status reporting --- openair2/ENB_APP/enb_agent_mac.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/openair2/ENB_APP/enb_agent_mac.c b/openair2/ENB_APP/enb_agent_mac.c index f00012f158..5ba6c0b665 100644 --- a/openair2/ENB_APP/enb_agent_mac.c +++ b/openair2/ENB_APP/enb_agent_mac.c @@ -982,9 +982,9 @@ int enb_agent_mac_sf_trigger(mid_t mod_id, const void *params, Protocol__Progran for (j = 0; j < dl_info[i]->n_harq_status; j++) { // TODO: This should be different per TB if(harq_status == 0) - dl_info[i]->harq_status[j] = PROTOCOL__PRP_HARQ_STATUS__PRHS_ACK; - else if (harq_status == 1) dl_info[i]->harq_status[j] = PROTOCOL__PRP_HARQ_STATUS__PRHS_NACK; + else if (harq_status == 1) + dl_info[i]->harq_status[j] = PROTOCOL__PRP_HARQ_STATUS__PRHS_ACK; } /*TODO: fill in the serving cell index for this UE */ dl_info[i]->serv_cell_index = UE_PCCID(mod_id,i); @@ -1369,8 +1369,8 @@ int enb_agent_register_mac_xface(mid_t mod_id, AGENT_MAC_xface *xface) { xface->enb_agent_send_sr_info = enb_agent_send_sr_info; xface->enb_agent_send_sf_trigger = enb_agent_send_sf_trigger; xface->enb_agent_send_update_mac_stats = enb_agent_send_update_mac_stats; - xface->enb_agent_schedule_ue_spec = schedule_ue_spec_default; - //xface->enb_agent_schedule_ue_spec = schedule_ue_spec_remote; + //xface->enb_agent_schedule_ue_spec = schedule_ue_spec_default; + xface->enb_agent_schedule_ue_spec = schedule_ue_spec_remote; xface->enb_agent_get_pending_dl_mac_config = enb_agent_get_pending_dl_mac_config; xface->enb_agent_notify_ue_state_change = enb_agent_ue_state_change; From 2a5a389f7d80707d886c4783ff4e3c3a016047e8 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Mon, 7 Mar 2016 16:27:32 +0000 Subject: [PATCH 146/349] Improved stability and eNB goodput of remote scheduling --- openair1/SCHED/phy_procedures_lte_eNb.c | 4 ++-- openair2/ENB_APP/enb_agent_mac.c | 8 ++++---- openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue_remote.c | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/openair1/SCHED/phy_procedures_lte_eNb.c b/openair1/SCHED/phy_procedures_lte_eNb.c index 211c64e373..60cd0ec0f7 100755 --- a/openair1/SCHED/phy_procedures_lte_eNb.c +++ b/openair1/SCHED/phy_procedures_lte_eNb.c @@ -153,8 +153,8 @@ void remove_harq_pid_from_freelist(LTE_eNB_DLSCH_t *DLSCH_ptr, int harq_pid) * to be refined in case things don't work properly */ if (harq_pid != DLSCH_ptr->harq_pid_freelist[DLSCH_ptr->head_freelist]) { - //LOG_E(PHY, "%s:%d: critical error, get in touch with the authors\n", __FILE__, __LINE__); - //abort(); + LOG_E(PHY, "%s:%d: critical error, get in touch with the authors\n", __FILE__, __LINE__); + abort(); } DLSCH_ptr->head_freelist = (DLSCH_ptr->head_freelist + 1) % 10; } diff --git a/openair2/ENB_APP/enb_agent_mac.c b/openair2/ENB_APP/enb_agent_mac.c index 5ba6c0b665..ff8638ca4d 100644 --- a/openair2/ENB_APP/enb_agent_mac.c +++ b/openair2/ENB_APP/enb_agent_mac.c @@ -981,10 +981,10 @@ int enb_agent_mac_sf_trigger(mid_t mod_id, const void *params, Protocol__Progran dl_info[i]->harq_status = malloc(sizeof(uint32_t) * dl_info[i]->n_harq_status); for (j = 0; j < dl_info[i]->n_harq_status; j++) { // TODO: This should be different per TB - if(harq_status == 0) - dl_info[i]->harq_status[j] = PROTOCOL__PRP_HARQ_STATUS__PRHS_NACK; - else if (harq_status == 1) - dl_info[i]->harq_status[j] = PROTOCOL__PRP_HARQ_STATUS__PRHS_ACK; + if(harq_status == 0) + dl_info[i]->harq_status[j] = PROTOCOL__PRP_HARQ_STATUS__PRHS_ACK; + else if (harq_status == 1) + dl_info[i]->harq_status[j] = PROTOCOL__PRP_HARQ_STATUS__PRHS_NACK; } /*TODO: fill in the serving cell index for this UE */ dl_info[i]->serv_cell_index = UE_PCCID(mod_id,i); diff --git a/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue_remote.c b/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue_remote.c index db90bb1754..90181f0e44 100644 --- a/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue_remote.c +++ b/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue_remote.c @@ -50,7 +50,7 @@ void schedule_ue_spec_remote(mid_t mod_id, uint32_t frame, uint32_t subframe, TAILQ_INIT(&queue_head); queue_initialized = 1; } - + dl_mac_config_element_t *dl_config_elem; int diff; From ff5b5854468560c676174f5e265681fd42aee283 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Tue, 8 Mar 2016 12:58:44 +0000 Subject: [PATCH 147/349] Added check for ignoring empty mac dl config messages --- openair2/ENB_APP/enb_agent_mac.c | 4 ++-- openair2/LAYER2/MAC/eNB_agent_scheduler_dataplane.c | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/openair2/ENB_APP/enb_agent_mac.c b/openair2/ENB_APP/enb_agent_mac.c index ff8638ca4d..296da7f1d2 100644 --- a/openair2/ENB_APP/enb_agent_mac.c +++ b/openair2/ENB_APP/enb_agent_mac.c @@ -1369,8 +1369,8 @@ int enb_agent_register_mac_xface(mid_t mod_id, AGENT_MAC_xface *xface) { xface->enb_agent_send_sr_info = enb_agent_send_sr_info; xface->enb_agent_send_sf_trigger = enb_agent_send_sf_trigger; xface->enb_agent_send_update_mac_stats = enb_agent_send_update_mac_stats; - //xface->enb_agent_schedule_ue_spec = schedule_ue_spec_default; - xface->enb_agent_schedule_ue_spec = schedule_ue_spec_remote; + xface->enb_agent_schedule_ue_spec = schedule_ue_spec_default; + //xface->enb_agent_schedule_ue_spec = schedule_ue_spec_remote; xface->enb_agent_get_pending_dl_mac_config = enb_agent_get_pending_dl_mac_config; xface->enb_agent_notify_ue_state_change = enb_agent_ue_state_change; diff --git a/openair2/LAYER2/MAC/eNB_agent_scheduler_dataplane.c b/openair2/LAYER2/MAC/eNB_agent_scheduler_dataplane.c index 6f84014070..dc1ab3da0e 100644 --- a/openair2/LAYER2/MAC/eNB_agent_scheduler_dataplane.c +++ b/openair2/LAYER2/MAC/eNB_agent_scheduler_dataplane.c @@ -247,6 +247,11 @@ void apply_ue_spec_scheduling_decisions(mid_t mod_id, } ta_update = (ta_len > 0) ? ue_sched_ctl->ta_update : 0; + + // If there is nothing to schedule, just leave + if ((sdu_length_total + ta_len) < 0) { + return; + } offset = generate_dlsch_header((unsigned char*)UE_list->DLSCH_pdu[CC_id][0][UE_id].payload[0], num_sdus, //num_sdus From 8b283444487ec4aa000f8d9a7c3cf2e89fd74bc6 Mon Sep 17 00:00:00 2001 From: Mohamed Kassem Date: Tue, 8 Mar 2016 18:15:52 +0000 Subject: [PATCH 148/349] Temporary fix for bug in reporting number of initial pdcch symbols of cell and band5 configuration file for agent --- openair2/ENB_APP/enb_agent_common.c | 11 +- .../enb.band5.agent.usrpb210.epc.remote.conf | 175 ++++++++++++++++++ 2 files changed, 181 insertions(+), 5 deletions(-) create mode 100644 targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band5.agent.usrpb210.epc.remote.conf diff --git a/openair2/ENB_APP/enb_agent_common.c b/openair2/ENB_APP/enb_agent_common.c index 646470d13f..18412bc502 100644 --- a/openair2/ENB_APP/enb_agent_common.c +++ b/openair2/ENB_APP/enb_agent_common.c @@ -873,11 +873,9 @@ int get_sib1_length(mid_t mod_id, int CC_id) } int get_num_pdcch_symb(mid_t mod_id, int CC_id) { - /*TODO: add these values to some struct in MAC - LTE_UE_PDCCH *lte_ue_pdcch; - lte_ue_pdcch = mac_xface->get_lte_ue_pdcch(mod_id, CC_id, mod_id); - */ - return (PHY_vars_UE_g[mod_id][CC_id]->lte_ue_pdcch_vars[mod_id]->num_pdcch_symbols); + /* TODO: This should return the number of PDCCH symbols initially used by the cell CC_id */ + return 0; + //(PHY_vars_UE_g[mod_id][CC_id]->lte_ue_pdcch_vars[mod_id]->num_pdcch_symbols); } /* @@ -1200,6 +1198,9 @@ int get_ue_transmission_antenna(mid_t mod_id, mid_t ue_id) int get_lcg(mid_t ue_id, mid_t lc_id) { + if (UE_mac_inst == NULL) { + return -1; + } if(UE_mac_inst[ue_id].logicalChannelConfig[lc_id] != NULL) { return *UE_mac_inst[ue_id].logicalChannelConfig[lc_id]->ul_SpecificParameters->logicalChannelGroup; } else { diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band5.agent.usrpb210.epc.remote.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band5.agent.usrpb210.epc.remote.conf new file mode 100644 index 0000000000..f8c5016de5 --- /dev/null +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band5.agent.usrpb210.epc.remote.conf @@ -0,0 +1,175 @@ +Active_eNBs = ( "eNB_Eurecom_LTEBox"); +# Asn1_verbosity, choice in: none, info, annoying +Asn1_verbosity = "none"; + +eNBs = +( + { + ////////// Identification parameters: + eNB_ID = 0xe00; + + cell_type = "CELL_MACRO_ENB"; + + eNB_name = "eNB_Eurecom_LTEBox"; + + // Tracking area code, 0x0000 and 0xfffe are reserved values + tracking_area_code = "1"; + + mobile_country_code = "208"; + mobile_network_code = "95"; + + ////////// Physical parameters: + + component_carriers = ( + { + frame_type = "FDD"; + tdd_config = 3; + tdd_config_s = 0; + prefix_type = "NORMAL"; + eutra_band = 7; + downlink_frequency = 2660000000L; + uplink_frequency_offset = -120000000; + Nid_cell = 0; + N_RB_DL = 25; + Nid_cell_mbsfn = 0; + nb_antennas_tx = 1; + nb_antennas_rx = 1; + tx_gain = 90; + rx_gain = 125; + prach_root = 0; + prach_config_index = 0; + prach_high_speed = "DISABLE"; + prach_zero_correlation = 1; + prach_freq_offset = 2; + pucch_delta_shift = 1; + pucch_nRB_CQI = 1; + pucch_nCS_AN = 0; + pucch_n1_AN = 32; + pdsch_referenceSignalPower = -26; + pdsch_p_b = 0; + pusch_n_SB = 1; + pusch_enable64QAM = "DISABLE"; + pusch_hoppingMode = "interSubFrame"; + pusch_hoppingOffset = 0; + pusch_groupHoppingEnabled = "ENABLE"; + pusch_groupAssignment = 0; + pusch_sequenceHoppingEnabled = "DISABLE"; + pusch_nDMRS1 = 1; + phich_duration = "NORMAL"; + phich_resource = "ONESIXTH"; + srs_enable = "DISABLE"; + /* srs_BandwidthConfig =; + srs_SubframeConfig =; + srs_ackNackST =; + srs_MaxUpPts =;*/ + + pusch_p0_Nominal = -90; + pusch_alpha = "AL1"; + pucch_p0_Nominal = -108; + msg3_delta_Preamble = 6; + pucch_deltaF_Format1 = "deltaF2"; + pucch_deltaF_Format1b = "deltaF3"; + pucch_deltaF_Format2 = "deltaF0"; + pucch_deltaF_Format2a = "deltaF0"; + pucch_deltaF_Format2b = "deltaF0"; + + rach_numberOfRA_Preambles = 64; + rach_preamblesGroupAConfig = "DISABLE"; + /* + rach_sizeOfRA_PreamblesGroupA = ; + rach_messageSizeGroupA = ; + rach_messagePowerOffsetGroupB = ; + */ + rach_powerRampingStep = 4; + rach_preambleInitialReceivedTargetPower = -108; + rach_preambleTransMax = 10; + rach_raResponseWindowSize = 10; + rach_macContentionResolutionTimer = 48; + rach_maxHARQ_Msg3Tx = 4; + + pcch_default_PagingCycle = 128; + pcch_nB = "oneT"; + bcch_modificationPeriodCoeff = 2; + ue_TimersAndConstants_t300 = 1000; + ue_TimersAndConstants_t301 = 1000; + ue_TimersAndConstants_t310 = 1000; + ue_TimersAndConstants_t311 = 10000; + ue_TimersAndConstants_n310 = 20; + ue_TimersAndConstants_n311 = 1; + } + ); + + + srb1_parameters : + { + # timer_poll_retransmit = (ms) [5, 10, 15, 20,... 250, 300, 350, ... 500] + timer_poll_retransmit = 80; + + # timer_reordering = (ms) [0,5, ... 100, 110, 120, ... ,200] + timer_reordering = 35; + + # timer_reordering = (ms) [0,5, ... 250, 300, 350, ... ,500] + timer_status_prohibit = 0; + + # poll_pdu = [4, 8, 16, 32 , 64, 128, 256, infinity(>10000)] + poll_pdu = 4; + + # poll_byte = (kB) [25,50,75,100,125,250,375,500,750,1000,1250,1500,2000,3000,infinity(>10000)] + poll_byte = 99999; + + # max_retx_threshold = [1, 2, 3, 4 , 6, 8, 16, 32] + max_retx_threshold = 4; + } + + # ------- SCTP definitions + SCTP : + { + # Number of streams to use in input/output + SCTP_INSTREAMS = 2; + SCTP_OUTSTREAMS = 2; + }; + + ////////// MME parameters: + mme_ip_address = ( {ipv4 = "192.168.100.103"; + ipv6="192:168:30::17"; + active="yes"; + preference="ipv4";}); + + NETWORK_INTERFACES : + { + ENB_INTERFACE_NAME_FOR_S1_MME = "eth0:1"; + ENB_IPV4_ADDRESS_FOR_S1_MME = "192.168.100.102/24"; + + ENB_INTERFACE_NAME_FOR_S1U = "eth0:1"; + ENB_IPV4_ADDRESS_FOR_S1U = "192.168.100.102/24"; + ENB_PORT_FOR_S1U = 2152; # Spec 2152 + }; + + NETWORK_CONTROLLER : + { + ENB_AGENT_INTERFACE_NAME = "eth1"; + ENB_AGENT_IPV4_ADDRESS = "10.0.0.5/30"; + ENB_AGENT_PORT = 2210; + ENB_AGENT_CACHE = "/mnt/oai_agent_cache"; + }; + + log_config : + { + global_log_level ="info"; + global_log_verbosity ="medium"; + hw_log_level ="info"; + hw_log_verbosity ="medium"; + phy_log_level ="info"; + phy_log_verbosity ="medium"; + mac_log_level ="debug"; + mac_log_verbosity ="high"; + rlc_log_level ="info"; + rlc_log_verbosity ="medium"; + pdcp_log_level ="info"; + pdcp_log_verbosity ="medium"; + rrc_log_level ="info"; + rrc_log_verbosity ="medium"; + }; + + } +); From 34db5f2003120719f56c5f45626b64433fc9d184 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Wed, 9 Mar 2016 12:19:16 +0000 Subject: [PATCH 149/349] Moved agent async interface to lock-free implementation using lock-free ringbuffer --- cmake_targets/CMakeLists.txt | 1 + openair2/ENB_APP/enb_agent.c | 36 +++--- openair2/ENB_APP/enb_agent_async.c | 6 +- openair2/UTIL/ASYNC_IF/link_manager.c | 14 ++- openair2/UTIL/ASYNC_IF/link_manager.h | 3 +- openair2/UTIL/ASYNC_IF/ringbuffer_queue.c | 143 ++++++++++++++++++++++ openair2/UTIL/ASYNC_IF/ringbuffer_queue.h | 60 +++++++++ 7 files changed, 237 insertions(+), 26 deletions(-) create mode 100644 openair2/UTIL/ASYNC_IF/ringbuffer_queue.c create mode 100644 openair2/UTIL/ASYNC_IF/ringbuffer_queue.h diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index 18eaf0f8b6..ea0cabe88f 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -832,6 +832,7 @@ if (ENB_AGENT_SB_IF) ${OPENAIR2_DIR}/UTIL/ASYNC_IF/socket_link.c ${OPENAIR2_DIR}/UTIL/ASYNC_IF/link_manager.c ${OPENAIR2_DIR}/UTIL/ASYNC_IF/message_queue.c + ${OPENAIR2_DIR}/UTIL/ASYNC_IF/ringbuffer_queue.c ) set(ASYNC_IF_LIB ASYNC_IF) include_directories(${OPENAIR2_DIR}/UTIL/ASYNC_IF) diff --git a/openair2/ENB_APP/enb_agent.c b/openair2/ENB_APP/enb_agent.c index a21e2f8e16..81d856fa97 100644 --- a/openair2/ENB_APP/enb_agent.c +++ b/openair2/ENB_APP/enb_agent.c @@ -135,32 +135,34 @@ void *receive_thread(void *args) { Protocol__ProgranMessage *msg; while (1) { - if (enb_agent_msg_recv(d->enb_id, ENB_AGENT_DEFAULT, &data, &size, &priority)) { - err_code = PROTOCOL__PROGRAN_ERR__MSG_DEQUEUING; - goto error; - } + //if (enb_agent_msg_recv(d->enb_id, ENB_AGENT_DEFAULT, &data, &size, &priority)) { + // err_code = PROTOCOL__PROGRAN_ERR__MSG_DEQUEUING; + // goto error; + //} - LOG_D(ENB_AGENT,"received message with size %d\n", size); + while (enb_agent_msg_recv(d->enb_id, ENB_AGENT_DEFAULT, &data, &size, &priority) == 0) { + + LOG_D(ENB_AGENT,"received message with size %d\n", size); - msg=enb_agent_handle_message(d->enb_id, data, size); + msg=enb_agent_handle_message(d->enb_id, data, size); - free(data); + free(data); - // check if there is something to send back to the controller - if (msg != NULL){ - data=enb_agent_pack_message(msg,&size); + // check if there is something to send back to the controller + if (msg != NULL){ + data=enb_agent_pack_message(msg,&size); - if (enb_agent_msg_send(d->enb_id, ENB_AGENT_DEFAULT, data, size, priority)) { - err_code = PROTOCOL__PROGRAN_ERR__MSG_ENQUEUING; - goto error; - } + if (enb_agent_msg_send(d->enb_id, ENB_AGENT_DEFAULT, data, size, priority)) { + err_code = PROTOCOL__PROGRAN_ERR__MSG_ENQUEUING; + goto error; + } - LOG_D(ENB_AGENT,"sent message with size %d\n", size); + LOG_D(ENB_AGENT,"sent message with size %d\n", size); + } } - } - + return NULL; error: diff --git a/openair2/ENB_APP/enb_agent_async.c b/openair2/ENB_APP/enb_agent_async.c index d6389ea65f..a626566a8d 100644 --- a/openair2/ENB_APP/enb_agent_async.c +++ b/openair2/ENB_APP/enb_agent_async.c @@ -60,10 +60,10 @@ enb_agent_async_channel_t * enb_agent_async_channel_info(mid_t mod_id, char *dst /* * create a message queue */ - - channel->send_queue = new_message_queue(); + // Set size of queues statically for now + channel->send_queue = new_message_queue(500); if (channel->send_queue == NULL) goto error; - channel->receive_queue = new_message_queue(); + channel->receive_queue = new_message_queue(500); if (channel->receive_queue == NULL) goto error; /* diff --git a/openair2/UTIL/ASYNC_IF/link_manager.c b/openair2/UTIL/ASYNC_IF/link_manager.c index 9b31fc043b..a528577fd8 100644 --- a/openair2/UTIL/ASYNC_IF/link_manager.c +++ b/openair2/UTIL/ASYNC_IF/link_manager.c @@ -53,11 +53,15 @@ static void *link_manager_sender_thread(void *_manager) LOG_D(MAC, "starting link manager sender thread\n"); while (manager->run) { - if (message_get(manager->send_queue, &data, &size, &priority)) - goto error; - if (link_send_packet(manager->socket_link, data, size)) - goto error; - free(data); + while (message_get(manager->send_queue, &data, &size, &priority) == 0) { + link_send_packet(manager->socket_link, data, size); + free(data); + } + // if (message_get(manager->send_queue, &data, &size, &priority)) + // goto error; + //if (link_send_packet(manager->socket_link, data, size)) + // goto error; + //free(data); } LOG_D(MAC, "link manager sender thread quits\n"); diff --git a/openair2/UTIL/ASYNC_IF/link_manager.h b/openair2/UTIL/ASYNC_IF/link_manager.h index 3e24b8679a..4f0628c0ee 100644 --- a/openair2/UTIL/ASYNC_IF/link_manager.h +++ b/openair2/UTIL/ASYNC_IF/link_manager.h @@ -38,7 +38,8 @@ #ifndef LINK_MANAGER_H #define LINK_MANAGER_H -#include "message_queue.h" +//#include "message_queue.h" +#include "ringbuffer_queue.h" #include "socket_link.h" #include diff --git a/openair2/UTIL/ASYNC_IF/ringbuffer_queue.c b/openair2/UTIL/ASYNC_IF/ringbuffer_queue.c new file mode 100644 index 0000000000..0d63e41431 --- /dev/null +++ b/openair2/UTIL/ASYNC_IF/ringbuffer_queue.c @@ -0,0 +1,143 @@ +/******************************************************************************* + OpenAirInterface + Copyright(c) 1999 - 2015 Eurecom + + OpenAirInterface is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + + OpenAirInterface is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with OpenAirInterface.The full GNU General Public License is + included in this distribution in the file called "COPYING". If not, + see . + + Contact Information + OpenAirInterface Admin: openair_admin@eurecom.fr + OpenAirInterface Tech : openair_tech@eurecom.fr + OpenAirInterface Dev : openair4g-devel@eurecom.fr + + Address : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE + +*******************************************************************************/ +/*! \file ringbuffer_queue.c + * \brief Lock-free ringbuffer used for async message passing of agent + * \author Xenofon Foukas + * \date March 2016 + * \version 1.0 + * \email: x.foukas@sms.ed.ac.uk + * @ingroup _mac + */ + +#include "ringbuffer_queue.h" +#include "log.h" + +message_queue_t * new_message_queue(int size) { + + message_queue_t *ret = NULL; + + ret = calloc(1, sizeof(message_queue_t)); + if (ret == NULL) + goto error; + + lfds700_misc_library_init_valid_on_current_logical_core(); + lfds700_misc_prng_init(&(ret->ps)); + ret->ringbuffer_array = malloc(sizeof(struct lfds700_ringbuffer_element) * size); + lfds700_ringbuffer_init_valid_on_current_logical_core(&(ret->ringbuffer_state), + ret->ringbuffer_array, + size, + &(ret->ps), + NULL); + + return ret; + + error: + LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); + if (ret != NULL) { + free(ret->ringbuffer_array); + memset(ret, 0, sizeof(message_queue_t)); + free(ret); + } + return NULL; +} + +int message_put(message_queue_t *queue, void *data, int size, int priority) { + + struct lfds700_misc_prng_state ls; + enum lfds700_misc_flag overwrite_occurred_flag; + message_t *overwritten_msg; + message_t *m = NULL; + + LFDS700_MISC_MAKE_VALID_ON_CURRENT_LOGICAL_CORE_INITS_COMPLETED_BEFORE_NOW_ON_ANY_OTHER_LOGICAL_CORE; + lfds700_misc_prng_init(&ls); + + m = calloc(1, sizeof(message_t)); + if (m == NULL) + goto error; + + m->data = data; + m->size = size; + m->priority = priority; + + lfds700_ringbuffer_write(&(queue->ringbuffer_state), + NULL, + (void *) m, + &overwrite_occurred_flag, + NULL, + (void **) &overwritten_msg, + &ls); + + if (overwrite_occurred_flag == LFDS700_MISC_FLAG_RAISED) { + free(overwritten_msg->data); + free(overwritten_msg); + } + + return 0; + + error: + free(m); + LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); + return -1; +} + +int message_get(message_queue_t *queue, void **data, int *size, int *priority) { + message_t *m; + struct lfds700_misc_prng_state ls; + + LFDS700_MISC_MAKE_VALID_ON_CURRENT_LOGICAL_CORE_INITS_COMPLETED_BEFORE_NOW_ON_ANY_OTHER_LOGICAL_CORE; + lfds700_misc_prng_init(&ls); + + if (lfds700_ringbuffer_read(&(queue->ringbuffer_state), NULL, (void **) &m, &ls) == 0) { + return -1; + } + + *data = m->data; + *size = m->size; + *priority = m->priority; + free(m); + return 0; +} + +message_queue_t destroy_message_queue(message_queue_t *queue) { + struct lfds700_misc_prng_state ls; + + message_t *m; + + LFDS700_MISC_MAKE_VALID_ON_CURRENT_LOGICAL_CORE_INITS_COMPLETED_BEFORE_NOW_ON_ANY_OTHER_LOGICAL_CORE; + lfds700_misc_prng_init(&ls); + + while (lfds700_ringbuffer_read(&(queue->ringbuffer_state), NULL, (void **) &m, &ls) != 0) { + free(m->data); + memset(m, 0, sizeof(message_t)); + free(m); + } + free(queue->ringbuffer_array); + memset(queue, 0, sizeof(message_queue_t)); + free(queue); +} diff --git a/openair2/UTIL/ASYNC_IF/ringbuffer_queue.h b/openair2/UTIL/ASYNC_IF/ringbuffer_queue.h new file mode 100644 index 0000000000..756a35ae4a --- /dev/null +++ b/openair2/UTIL/ASYNC_IF/ringbuffer_queue.h @@ -0,0 +1,60 @@ +/******************************************************************************* + OpenAirInterface + Copyright(c) 1999 - 2015 Eurecom + + OpenAirInterface is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + + OpenAirInterface is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with OpenAirInterface.The full GNU General Public License is + included in this distribution in the file called "COPYING". If not, + see . + + Contact Information + OpenAirInterface Admin: openair_admin@eurecom.fr + OpenAirInterface Tech : openair_tech@eurecom.fr + OpenAirInterface Dev : openair4g-devel@eurecom.fr + + Address : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE + +*******************************************************************************/ +/*! \file ringbuffer_queue.h + * \brief Lock-free ringbuffer used for async message passing of agent + * \author Xenofon Foukas + * \date March 2016 + * \version 1.0 + * \email: x.foukas@sms.ed.ac.uk + * @ingroup _mac + */ + +#ifndef RINGBUFFER_QUEUE_H +#define RINGBUFFER_QUEUE_H + +#include "liblfds700.h" + +typedef struct message_s { + void *data; + int size; + int priority; +} message_t; + +typedef struct { + struct lfds700_misc_prng_state ps; + struct lfds700_ringbuffer_element *ringbuffer_array; + struct lfds700_ringbuffer_state ringbuffer_state; +} message_queue_t; + +message_queue_t * new_message_queue(int size); +int message_put(message_queue_t *queue, void *data, int size, int priority); +int message_get(message_queue_t *queue, void **data, int *size, int *priority); +message_queue_t destroy_message_queue(message_queue_t *queue); + +#endif /* RINGBUFFER_QUEUE_H */ From 3a1f3df882b5769a2239935688377b5aea4e9d7b Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Wed, 9 Mar 2016 13:13:03 +0000 Subject: [PATCH 150/349] Added OAI priority to send and receive thread of agent --- openair2/UTIL/ASYNC_IF/link_manager.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/openair2/UTIL/ASYNC_IF/link_manager.c b/openair2/UTIL/ASYNC_IF/link_manager.c index a528577fd8..0ab2ecc2b2 100644 --- a/openair2/UTIL/ASYNC_IF/link_manager.c +++ b/openair2/UTIL/ASYNC_IF/link_manager.c @@ -122,6 +122,16 @@ link_manager_t *create_link_manager( if (pthread_attr_init(&attr)) goto error; + // Make the async interface threads real-time + //#ifndef LOWLATENCY + struct sched_param sched_param_recv_thread; + struct sched_param sched_param_send_thread; + + sched_param_recv_thread.sched_priority = sched_get_priority_max(SCHED_RR) - 1; + pthread_attr_setschedparam(&attr, &sched_param_recv_thread); + pthread_attr_setschedpolicy(&attr, SCHED_RR); + //#endif + if (pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED)) goto error; From e88c4d97cf71f403536645f8ae961bcb8df563bf Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Thu, 10 Mar 2016 10:57:44 +0000 Subject: [PATCH 151/349] Code cleanups for control delegation and API --- openair2/ENB_APP/enb_agent_common.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/openair2/ENB_APP/enb_agent_common.c b/openair2/ENB_APP/enb_agent_common.c index 18412bc502..1b38ff9020 100644 --- a/openair2/ENB_APP/enb_agent_common.c +++ b/openair2/ENB_APP/enb_agent_common.c @@ -439,7 +439,6 @@ int enb_agent_control_delegation(mid_t mod_id, const void *params, Protocol__Pro } } long time_elapsed_nanos = timer_end(vartime); - LOG_I(ENB_AGENT, "DID IT IN %lld\n", time_elapsed_nanos); *msg = NULL; return 0; @@ -890,7 +889,6 @@ int get_time_alignment_timer(mid_t mod_id, mid_t ue_id) struct rrc_eNB_ue_context_s* ue_context_p = NULL; uint32_t rntiP = get_ue_crnti(mod_id,ue_id); - LOG_I(ENB_APP,"The value of rntiP is %d\n",rntiP); ue_context_p = rrc_eNB_get_ue_context(&eNB_rrc_inst[mod_id],rntiP); if(ue_context_p != NULL) { @@ -1254,8 +1252,6 @@ int enb_agent_ue_state_change(mid_t mod_id, uint32_t rnti, uint8_t state_change) int i =find_UE_id(mod_id,rnti); config->has_rnti = 1; config->rnti = rnti; - LOG_I(ENB_APP,"The value of i is %d\n",i); - LOG_I(ENB_APP,"The value of rnto is %d\n",rnti); //TODO: Set the time_alignment_timer if(get_time_alignment_timer(mod_id,i) != -1){ config->time_alignment_timer = get_time_alignment_timer(mod_id,i); From 3251cf792c99514c3747811e85dba3c0ac74793d Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Thu, 10 Mar 2016 14:12:47 +0000 Subject: [PATCH 152/349] Added shared libs for control delegation --- cmake_targets/CMakeLists.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index ea0cabe88f..3ab5289365 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -1115,7 +1115,8 @@ add_library(L2 ${OPENAIR2_DIR}/RRC/L2_INTERFACE/openair_rrc_L2_interface.c) #Test for adding a shared library -#add_library(alt_sched SHARED ${MAC_DIR}/eNB_agent_scheduler_dlsch_ue_alt.c) +add_library(default_sched SHARED ${MAC_DIR}/eNB_agent_scheduler_dlsch_ue.c) +add_library(remote_sched SHARED ${MAC_DIR}/eNB_agent_scheduler_dlsch_ue_remote.c) # L3 Libs ########################## From 43b63be53ac578b34339d9d7d2f14e29dee72493 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Mon, 14 Mar 2016 11:42:04 +0000 Subject: [PATCH 153/349] Added nb_rb and oldNDI in template to be used for retransmissions --- .../MAC/eNB_agent_scheduler_dataplane.c | 29 ++++++++++++++----- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/openair2/LAYER2/MAC/eNB_agent_scheduler_dataplane.c b/openair2/LAYER2/MAC/eNB_agent_scheduler_dataplane.c index dc1ab3da0e..e74d078fda 100644 --- a/openair2/LAYER2/MAC/eNB_agent_scheduler_dataplane.c +++ b/openair2/LAYER2/MAC/eNB_agent_scheduler_dataplane.c @@ -300,33 +300,46 @@ void apply_ue_spec_scheduling_decisions(mid_t mod_id, UE_list->eNB_UE_stats[CC_id][UE_id].harq_pid = harq_pid; UE_list->eNB_UE_stats[CC_id][UE_id].harq_round = round; - nb_rb = UE_list->UE_template[CC_id][UE_id].nb_rb[harq_pid]; + //nb_rb = UE_list->UE_template[CC_id][UE_id].nb_rb[harq_pid]; + //Find the number of resource blocks and set them to the template for retransmissions + nb_rb = get_min_rb_unit(mod_id, CC_id); + uint16_t stats_tbs = mac_xface->get_TBS_DL(dl_dci->mcs[0], nb_rb); + + while (stats_tbs < TBS) { + nb_rb += get_min_rb_unit(mod_id, CC_id); + stats_tbs = mac_xface->get_TBS_DL(dl_dci->mcs[0], nb_rb); + } + + UE_list->UE_template[CC_id][UE_id].nb_rb[dl_dci->harq_process] = nb_rb; + UE_list->eNB_UE_stats[CC_id][UE_id].rbs_used = nb_rb; UE_list->eNB_UE_stats[CC_id][UE_id].total_rbs_used += nb_rb; UE_list->eNB_UE_stats[CC_id][UE_id].dlsch_mcs1=dl_dci->mcs[0]; UE_list->eNB_UE_stats[CC_id][UE_id].dlsch_mcs2=dl_dci->mcs[0]; UE_list->eNB_UE_stats[CC_id][UE_id].TBS = TBS; - UE_list->eNB_UE_stats[CC_id][UE_id].overhead_bytes= TBS- sdu_length_total; + UE_list->eNB_UE_stats[CC_id][UE_id].overhead_bytes= TBS - sdu_length_total; UE_list->eNB_UE_stats[CC_id][UE_id].total_sdu_bytes+= sdu_length_total; UE_list->eNB_UE_stats[CC_id][UE_id].total_pdu_bytes+= TBS; UE_list->eNB_UE_stats[CC_id][UE_id].total_num_pdus+=1; - eNB_UE_stats->dlsch_mcs1 = cqi_to_mcs[eNB_UE_stats->DL_cqi[0]]; - eNB_UE_stats->dlsch_mcs1 = cmin(eNB_UE_stats->dlsch_mcs1, openair_daq_vars.target_ue_dl_mcs); + //eNB_UE_stats->dlsch_mcs1 = cqi_to_mcs[eNB_UE_stats->DL_cqi[0]]; + //eNB_UE_stats->dlsch_mcs1 = cmin(eNB_UE_stats->dlsch_mcs1, openair_daq_vars.target_ue_dl_mcs); } } else { // No need to create anything apart of DCI in case of retransmission /*TODO: Must add these */ - //eNB_UE_stats->dlsch_trials[round]++; + // eNB_UE_stats->dlsch_trials[round]++; //UE_list->eNB_UE_stats[CC_id][UE_id].num_retransmission+=1; //UE_list->eNB_UE_stats[CC_id][UE_id].rbs_used_retx=nb_rb; //UE_list->eNB_UE_stats[CC_id][UE_id].total_rbs_used_retx+=nb_rb; //UE_list->eNB_UE_stats[CC_id][UE_id].ncce_used_retx=nCCECC_id]; - //UE_list->eNB_UE_stats[CC_id][UE_id].dlsch_mcs1=eNB_UE_stats->dlsch_mcs1; - //UE_list->eNB_UE_stats[CC_id][UE_id].dlsch_mcs2=eNB_UE_stats->dlsch_mcs1; } + + UE_list->UE_template[CC_id][UE_id].oldNDI[dl_dci->harq_process] = dl_dci->ndi[0]; + eNB_UE_stats->dlsch_mcs1 = dl_dci->mcs[0]; + //Fill the proper DCI of OAI fill_oai_dci(mod_id, CC_id, rnti, dl_dci); } @@ -496,7 +509,7 @@ void fill_oai_dci(mid_t mod_id, uint32_t CC_id, uint32_t rnti, /*TODO: Need to deal with unsupported DCI type*/ return; } - + add_ue_spec_dci(DCI_pdu, DLSCH_dci, rnti, From c2971d517672c635f9ca9f1c95ee59f9a55be753 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Tue, 15 Mar 2016 17:25:44 +0000 Subject: [PATCH 154/349] Added tcp_nodelay option in agent async interface --- openair2/UTIL/ASYNC_IF/socket_link.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/openair2/UTIL/ASYNC_IF/socket_link.c b/openair2/UTIL/ASYNC_IF/socket_link.c index 95a92ae3ee..f4bd248f78 100644 --- a/openair2/UTIL/ASYNC_IF/socket_link.c +++ b/openair2/UTIL/ASYNC_IF/socket_link.c @@ -46,6 +46,7 @@ #include #include #include +#include #include #include @@ -56,7 +57,8 @@ socket_link_t *new_link_server(int port) struct sockaddr_in addr; socklen_t addrlen; int socket_server = -1; - + int no_delay; + ret = calloc(1, sizeof(socket_link_t)); if (ret == NULL) { LOG_E(MAC, "%s:%d: out of memory\n", __FILE__, __LINE__); @@ -78,6 +80,12 @@ socket_link_t *new_link_server(int port) goto error; } + no_delay = 1; + if (setsockopt(socket_server, IPPROTO_TCP, TCP_NODELAY, &no_delay, sizeof(no_delay)) == -1) { + LOG_E(MAC, "%s:%d: setsockopt: %s\n", __FILE__, __LINE__, strerror(errno)); + goto error; + } + addr.sin_family = AF_INET; addr.sin_port = htons(port); addr.sin_addr.s_addr = INADDR_ANY; @@ -115,6 +123,7 @@ socket_link_t *new_link_client(char *server, int port) { socket_link_t *ret = NULL; struct sockaddr_in addr; + int no_delay; ret = calloc(1, sizeof(socket_link_t)); if (ret == NULL) { @@ -131,6 +140,12 @@ socket_link_t *new_link_client(char *server, int port) goto error; } + no_delay = 1; + if (setsockopt(ret->socket_fd, SOL_TCP, TCP_NODELAY, &no_delay, sizeof(no_delay)) == -1) { + LOG_E(MAC, "%s:%d: setsockopt: %s\n", __FILE__, __LINE__, strerror(errno)); + goto error; + } + addr.sin_family = AF_INET; addr.sin_port = htons(port); if (inet_aton(server, &addr.sin_addr) == 0) { From ef22a539aa02f602bcd016e86cbe7cf5e6737fb4 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Wed, 16 Mar 2016 11:48:18 +0000 Subject: [PATCH 155/349] Added more checks when applying dci decisions in the dataplane, to reduce RLC request misses --- .../MAC/eNB_agent_scheduler_dataplane.c | 79 +++++++++++-------- 1 file changed, 47 insertions(+), 32 deletions(-) diff --git a/openair2/LAYER2/MAC/eNB_agent_scheduler_dataplane.c b/openair2/LAYER2/MAC/eNB_agent_scheduler_dataplane.c index e74d078fda..59dc70cda7 100644 --- a/openair2/LAYER2/MAC/eNB_agent_scheduler_dataplane.c +++ b/openair2/LAYER2/MAC/eNB_agent_scheduler_dataplane.c @@ -182,41 +182,56 @@ void apply_ue_spec_scheduling_decisions(mid_t mod_id, if (rlc_size > 0) { rlc_status = mac_rlc_status_ind(mod_id, - rnti, - mod_id, - frame, - ENB_FLAG_YES, - MBMS_FLAG_NO, - lcid, - rlc_size); // transport block set size + rnti, + mod_id, + frame, + ENB_FLAG_YES, + MBMS_FLAG_NO, + lcid, + 0); + + if (rlc_status.bytes_in_buffer > 0) { + + rlc_status = mac_rlc_status_ind(mod_id, + rnti, + mod_id, + frame, + ENB_FLAG_YES, + MBMS_FLAG_NO, + lcid, + rlc_size); // transport block set size - sdu_lengths[i] = 0; + sdu_lengths[i] = 0; - LOG_D(MAC, "[TEST] RLC can give %d bytes for LCID %d during second call\n", rlc_status.bytes_in_buffer, lcid); + LOG_D(MAC, "[TEST] RLC can give %d bytes for LCID %d during second call\n", rlc_status.bytes_in_buffer, lcid); - sdu_lengths[i] += mac_rlc_data_req(mod_id, - rnti, - mod_id, - frame, - ENB_FLAG_YES, - MBMS_FLAG_NO, - lcid, - (char *)&dlsch_buffer[sdu_length_total]); - - LOG_D(MAC,"[eNB %d][LCID %d] CC_id %d Got %d bytes from RLC\n",mod_id, lcid, CC_id, sdu_lengths[i]); - sdu_length_total += sdu_lengths[i]; - sdu_lcids[i] = lcid; - - UE_list->eNB_UE_stats[CC_id][UE_id].num_pdu_tx[lcid] += 1; - UE_list->eNB_UE_stats[CC_id][UE_id].num_bytes_tx[lcid] += sdu_lengths[i]; - - if (sdu_lengths[i] < 128) { - header_len += 2; - } else { - header_len += 3; + if (rlc_status.bytes_in_buffer > 0) { + + sdu_lengths[i] += mac_rlc_data_req(mod_id, + rnti, + mod_id, + frame, + ENB_FLAG_YES, + MBMS_FLAG_NO, + lcid, + (char *)&dlsch_buffer[sdu_length_total]); + + LOG_D(MAC,"[eNB %d][LCID %d] CC_id %d Got %d bytes from RLC\n",mod_id, lcid, CC_id, sdu_lengths[i]); + sdu_length_total += sdu_lengths[i]; + sdu_lcids[i] = lcid; + + UE_list->eNB_UE_stats[CC_id][UE_id].num_pdu_tx[lcid] += 1; + UE_list->eNB_UE_stats[CC_id][UE_id].num_bytes_tx[lcid] += sdu_lengths[i]; + + if (sdu_lengths[i] < 128) { + header_len += 2; + } else { + header_len += 3; + } + + num_sdus++; + } } - - num_sdus++; } } // SDU creation end @@ -249,7 +264,7 @@ void apply_ue_spec_scheduling_decisions(mid_t mod_id, ta_update = (ta_len > 0) ? ue_sched_ctl->ta_update : 0; // If there is nothing to schedule, just leave - if ((sdu_length_total + ta_len) < 0) { + if ((sdu_length_total + ta_len) <= 0) { return; } From c77fb6479e537cd9f43c040fab039ed21ee9ebb4 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Wed, 16 Mar 2016 11:49:07 +0000 Subject: [PATCH 156/349] Changed timing of continuous MAC statistics to be reported at the end of the subframe --- openair2/LAYER2/MAC/eNB_scheduler.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/openair2/LAYER2/MAC/eNB_scheduler.c b/openair2/LAYER2/MAC/eNB_scheduler.c index 9a172cb377..06e115b392 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler.c +++ b/openair2/LAYER2/MAC/eNB_scheduler.c @@ -72,6 +72,7 @@ #define DEBUG_eNB_SCHEDULER 1 #define ENABLE_ENB_AGENT_DL_SCHEDULER //#define DISABLE_SF_TRIGGER +//#define DISABLE_CONT_STATS //#define DEBUG_HEADER_PARSING 1 //#define DEBUG_PACKET_TRACE 1 @@ -219,7 +220,6 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, //Send subframe trigger to the controller if (mac_agent_registered[module_idP]) { agent_mac_xface[module_idP]->enb_agent_send_sf_trigger(module_idP); - agent_mac_xface[module_idP]->enb_agent_send_update_mac_stats(module_idP); } #endif @@ -971,6 +971,13 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, for (CC_id=0;CC_idenb_agent_send_update_mac_stats(module_idP); + } +#endif + LOG_D(MAC,"frameP %d, subframeP %d\n",frameP,subframeP); stop_meas(&eNB_mac_inst[module_idP].eNB_scheduler); From 7ab320d9239c28927b41bd985a366be8b568a05b Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Wed, 16 Mar 2016 13:40:46 +0000 Subject: [PATCH 157/349] Prevent timing advance update to be sent without payload --- openair2/LAYER2/MAC/eNB_agent_scheduler_dataplane.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openair2/LAYER2/MAC/eNB_agent_scheduler_dataplane.c b/openair2/LAYER2/MAC/eNB_agent_scheduler_dataplane.c index 59dc70cda7..4642f9be00 100644 --- a/openair2/LAYER2/MAC/eNB_agent_scheduler_dataplane.c +++ b/openair2/LAYER2/MAC/eNB_agent_scheduler_dataplane.c @@ -264,7 +264,7 @@ void apply_ue_spec_scheduling_decisions(mid_t mod_id, ta_update = (ta_len > 0) ? ue_sched_ctl->ta_update : 0; // If there is nothing to schedule, just leave - if ((sdu_length_total + ta_len) <= 0) { + if ((sdu_length_total) <= 0) { return; } From 06c4b91b61ead3637be02c38bccf7babe47af437 Mon Sep 17 00:00:00 2001 From: Xiwen JIANG Date: Thu, 17 Mar 2016 10:28:06 +0100 Subject: [PATCH 158/349] move beamforming function to PHY/MODULATION folder --- cmake_targets/CMakeLists.txt | 2 +- openair1/PHY/LTE_TRANSPORT/proto.h | 35 ------------------- .../beamforming.c | 8 ++--- openair1/PHY/MODULATION/defs.h | 34 ++++++++++++++++++ openair1/SIMULATION/LTE_PHY/dlsim.c | 8 ++--- 5 files changed, 43 insertions(+), 44 deletions(-) rename openair1/PHY/{LTE_TRANSPORT => MODULATION}/beamforming.c (98%) diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index 5a679cdf4a..7981ea1023 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -868,12 +868,12 @@ set(PHY_SRC ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/rar_tools.c ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/print_stats.c ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/initial_sync.c - ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/beamforming.c ${OPENAIR1_DIR}/PHY/MODULATION/ofdm_mod.c ${OPENAIR1_DIR}/PHY/MODULATION/slot_fep.c ${OPENAIR1_DIR}/PHY/MODULATION/slot_fep_mbsfn.c ${OPENAIR1_DIR}/PHY/MODULATION/slot_fep_ul.c ${OPENAIR1_DIR}/PHY/MODULATION/ul_7_5_kHz.c + ${OPENAIR1_DIR}/PHY/MODULATION/beamforming.c ${OPENAIR1_DIR}/PHY/LTE_ESTIMATION/freq_equalization.c ${OPENAIR1_DIR}/PHY/LTE_ESTIMATION/lte_sync_time.c ${OPENAIR1_DIR}/PHY/LTE_ESTIMATION/lte_sync_timefreq.c diff --git a/openair1/PHY/LTE_TRANSPORT/proto.h b/openair1/PHY/LTE_TRANSPORT/proto.h index 416bff82c4..35de21c7b8 100644 --- a/openair1/PHY/LTE_TRANSPORT/proto.h +++ b/openair1/PHY/LTE_TRANSPORT/proto.h @@ -336,41 +336,6 @@ int32_t generate_pbch(LTE_eNB_PBCH *eNB_pbch, int32_t generate_pbch_emul(PHY_VARS_eNB *phy_vars_eNB,uint8_t *pbch_pdu); - -/** \brief This function performs UE specific beamforming especially for - * transmission mode TM7-10 - @param txdataF Table of pointers for frequency-domain TX signals - @param txdataF_BF Table of pointers for frequency-domain TX signals -after beamforming - @param frame_parms Frame descriptor structure - @param ue_spec_bf_weights UE specific beamforming weights applied on -each antenna element and each carrier - @param slot Slot number - @param symbol Symbol index on which to act*/ -int ue_spec_beamforming(int32_t **txdataF, - int32_t **txdataF_BF, - LTE_DL_FRAME_PARMS *frame_parms, - int32_t ***ue_spec_bf_weights, - int slot, - int symbol); - -/** \brief This function performs cell specific beamforming for common - * data - @param txdataF Table of pointers for frequency-domain TX signals - @param txdataF_BF Table of pointers for frequency-domain TX signals - @param frame_parms Frame descriptor structure -after beamforming - @param cell_spec_bf_weights Common beamforming weights applied on each -antenna element and each carrier - @param slot Slot number - @param symbol Symbol index on which to act*/ -int cell_spec_beamforming(int32_t **txdataF, - int32_t **txdataF_BF, - LTE_DL_FRAME_PARMS *frame_parms, - int32_t ***cell_spec_bf_weights, - int slot, - int symbol); - /** \brief This function computes the LLRs for ML (max-logsum approximation) dual-stream QPSK/QPSK reception. @param stream0_in Input from channel compensated (MR combined) stream 0 @param stream1_in Input from channel compensated (MR combined) stream 1 diff --git a/openair1/PHY/LTE_TRANSPORT/beamforming.c b/openair1/PHY/MODULATION/beamforming.c similarity index 98% rename from openair1/PHY/LTE_TRANSPORT/beamforming.c rename to openair1/PHY/MODULATION/beamforming.c index 7a2b75d74e..867ba0d53d 100644 --- a/openair1/PHY/LTE_TRANSPORT/beamforming.c +++ b/openair1/PHY/MODULATION/beamforming.c @@ -27,13 +27,13 @@ Address : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 069 *******************************************************************************/ -/*! \file PHY/LTE_TRANSPORT/beamforming.c +/*! \file PHY/MODULATION/beamforming.c * \brief - * \author R. Knopp, F. Kaltenberger, X. JIANG - * \date 2015 + * \author X. JIANG, F. Kaltenberger, R. KNOPP + * \date 2016 * \version 0.1 * \company Eurecom - * \email: knopp@eurecom.fr,florian.kaltenberger@eurecom.fr,xiwen.jiang@eurecom.fr + * \email: xiwen.jiang@eurecom.fr,florian.kaltenberger@eurecom.fr,raymond.knopp@eurecom.fr * \note * \warning */ diff --git a/openair1/PHY/MODULATION/defs.h b/openair1/PHY/MODULATION/defs.h index 6005d6d49a..fec65b8679 100644 --- a/openair1/PHY/MODULATION/defs.h +++ b/openair1/PHY/MODULATION/defs.h @@ -99,6 +99,40 @@ void remove_625_Hz(PHY_VARS_eNB *phy_vars_eNB,int16_t *prach); void apply_625_Hz(PHY_VARS_UE *phy_vars_ue,int16_t *prach); +/** \brief This function performs UE specific beamforming especially for + * transmission mode TM7-10 + @param txdataF Table of pointers for frequency-domain TX signals + @param txdataF_BF Table of pointers for frequency-domain TX signals +after beamforming + @param frame_parms Frame descriptor structure + @param ue_spec_bf_weights UE specific beamforming weights applied on +each antenna element and each carrier + @param slot Slot number + @param symbol Symbol index on which to act*/ +int ue_spec_beamforming(int32_t **txdataF, + int32_t **txdataF_BF, + LTE_DL_FRAME_PARMS *frame_parms, + int32_t ***ue_spec_bf_weights, + int slot, + int symbol); + +/** \brief This function performs cell specific beamforming for common + * data + @param txdataF Table of pointers for frequency-domain TX signals + @param txdataF_BF Table of pointers for frequency-domain TX signals + @param frame_parms Frame descriptor structure +after beamforming + @param cell_spec_bf_weights Common beamforming weights applied on each +antenna element and each carrier + @param slot Slot number + @param symbol Symbol index on which to act*/ +int cell_spec_beamforming(int32_t **txdataF, + int32_t **txdataF_BF, + LTE_DL_FRAME_PARMS *frame_parms, + int32_t ***cell_spec_bf_weights, + int slot, + int symbol); + #endif /** @}*/ #endif diff --git a/openair1/SIMULATION/LTE_PHY/dlsim.c b/openair1/SIMULATION/LTE_PHY/dlsim.c index ba7d02b340..beb90006ae 100644 --- a/openair1/SIMULATION/LTE_PHY/dlsim.c +++ b/openair1/SIMULATION/LTE_PHY/dlsim.c @@ -134,12 +134,12 @@ void do_OFDM_mod_l(LTE_eNB_COMMON *eNB_common_vars, int eNB_id, uint16_t next_sl //printf("do_OFDM_mod_l, slot=%d, l=%d, NUMBER_OF_OFDM_CARRIERS=%d,OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES=%d\n",next_slot, l,NUMBER_OF_OFDM_CARRIERS,OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES); if (lcell_spec_bf_weights,next_slot,l); + cell_spec_beamforming(txdataF,txdataF_BF,frame_parms,eNB_common_vars->cell_spec_bf_weights[eNB_id],next_slot,l); else if (transmission_mode<7) - cell_spec_beamforming(txdataF,txdataF_BF,frame_parms,eNB_common_vars->cell_spec_bf_weights,next_slot,l); + cell_spec_beamforming(txdataF,txdataF_BF,frame_parms,eNB_common_vars->cell_spec_bf_weights[eNB_id],next_slot,l); else - ue_spec_beamforming(txdataF,txdataF_BF,frame_parms,eNB_common_vars->ue_spec_bf_weights,next_slot,l); + ue_spec_beamforming(txdataF,txdataF_BF,frame_parms,eNB_common_vars->ue_spec_bf_weights[eNB_id],next_slot,l); for (aa=0; aanb_antennas_tx; aa++) { @@ -1026,7 +1026,7 @@ int main(int argc, char **argv) for (re=0;reofdm_symbol_size;re++) { if (n_tx_phy==1 || n_tx_phy==2) ue_spec_bf_weights[aa][re] = 0x00007fff; - else if (n_tx_phy==4) + else if (n_tx_phy==4 || n_tx_phy==8) ue_spec_bf_weights[aa][re] = 0x00007fff>>1; else if (n_tx_phy==16) ue_spec_bf_weights[aa][re] = 0x00007fff>>2; From 74819596477fbe5353463e05877e6ca31a61fe24 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Fri, 18 Mar 2016 19:38:55 +0000 Subject: [PATCH 159/349] Added agent config file for band7 usrbb210 --- .../enb.band5.agent.usrpb210.epc.remote.conf | 171 ++++++++--------- .../enb.band7.agent.usrpb210.epc.remote.conf | 174 ++++++++++++++++++ 2 files changed, 260 insertions(+), 85 deletions(-) create mode 100644 targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.agent.usrpb210.epc.remote.conf diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band5.agent.usrpb210.epc.remote.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band5.agent.usrpb210.epc.remote.conf index f8c5016de5..8936b2eb24 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band5.agent.usrpb210.epc.remote.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band5.agent.usrpb210.epc.remote.conf @@ -3,8 +3,8 @@ Active_eNBs = ( "eNB_Eurecom_LTEBox"); Asn1_verbosity = "none"; eNBs = -( - { +( + { ////////// Identification parameters: eNB_ID = 0xe00; @@ -13,110 +13,111 @@ eNBs = eNB_name = "eNB_Eurecom_LTEBox"; // Tracking area code, 0x0000 and 0xfffe are reserved values - tracking_area_code = "1"; + tracking_area_code = "10"; mobile_country_code = "208"; mobile_network_code = "95"; ////////// Physical parameters: + + component_carriers = ( + { + frame_type = "FDD"; + tdd_config = 3; + tdd_config_s = 0; + prefix_type = "NORMAL"; + eutra_band = 5; + downlink_frequency = 879000000L; + uplink_frequency_offset = -45000000; + Nid_cell = 0; + N_RB_DL = 25; + Nid_cell_mbsfn = 0; + nb_antennas_tx = 1; + nb_antennas_rx = 1; + tx_gain = 90; + rx_gain = 115; + prach_root = 0; + prach_config_index = 0; + prach_high_speed = "DISABLE"; + prach_zero_correlation = 1; + prach_freq_offset = 2; + pucch_delta_shift = 1; + pucch_nRB_CQI = 1; + pucch_nCS_AN = 0; + pucch_n1_AN = 32; + pdsch_referenceSignalPower = -26; + pdsch_p_b = 0; + pusch_n_SB = 1; + pusch_enable64QAM = "DISABLE"; + pusch_hoppingMode = "interSubFrame"; + pusch_hoppingOffset = 0; + pusch_groupHoppingEnabled = "ENABLE"; + pusch_groupAssignment = 0; + pusch_sequenceHoppingEnabled = "DISABLE"; + pusch_nDMRS1 = 1; + phich_duration = "NORMAL"; + phich_resource = "ONESIXTH"; + srs_enable = "DISABLE"; + /* srs_BandwidthConfig =; + srs_SubframeConfig =; + srs_ackNackST =; + srs_MaxUpPts =;*/ - component_carriers = ( - { - frame_type = "FDD"; - tdd_config = 3; - tdd_config_s = 0; - prefix_type = "NORMAL"; - eutra_band = 7; - downlink_frequency = 2660000000L; - uplink_frequency_offset = -120000000; - Nid_cell = 0; - N_RB_DL = 25; - Nid_cell_mbsfn = 0; - nb_antennas_tx = 1; - nb_antennas_rx = 1; - tx_gain = 90; - rx_gain = 125; - prach_root = 0; - prach_config_index = 0; - prach_high_speed = "DISABLE"; - prach_zero_correlation = 1; - prach_freq_offset = 2; - pucch_delta_shift = 1; - pucch_nRB_CQI = 1; - pucch_nCS_AN = 0; - pucch_n1_AN = 32; - pdsch_referenceSignalPower = -26; - pdsch_p_b = 0; - pusch_n_SB = 1; - pusch_enable64QAM = "DISABLE"; - pusch_hoppingMode = "interSubFrame"; - pusch_hoppingOffset = 0; - pusch_groupHoppingEnabled = "ENABLE"; - pusch_groupAssignment = 0; - pusch_sequenceHoppingEnabled = "DISABLE"; - pusch_nDMRS1 = 1; - phich_duration = "NORMAL"; - phich_resource = "ONESIXTH"; - srs_enable = "DISABLE"; - /* srs_BandwidthConfig =; - srs_SubframeConfig =; - srs_ackNackST =; - srs_MaxUpPts =;*/ + pusch_p0_Nominal = -90; + pusch_alpha = "AL1"; + pucch_p0_Nominal = -108; + msg3_delta_Preamble = 6; + pucch_deltaF_Format1 = "deltaF2"; + pucch_deltaF_Format1b = "deltaF3"; + pucch_deltaF_Format2 = "deltaF0"; + pucch_deltaF_Format2a = "deltaF0"; + pucch_deltaF_Format2b = "deltaF0"; + + rach_numberOfRA_Preambles = 64; + rach_preamblesGroupAConfig = "DISABLE"; +/* + rach_sizeOfRA_PreamblesGroupA = ; + rach_messageSizeGroupA = ; + rach_messagePowerOffsetGroupB = ; +*/ + rach_powerRampingStep = 4; + rach_preambleInitialReceivedTargetPower = -108; + rach_preambleTransMax = 10; + rach_raResponseWindowSize = 10; + rach_macContentionResolutionTimer = 48; + rach_maxHARQ_Msg3Tx = 4; - pusch_p0_Nominal = -90; - pusch_alpha = "AL1"; - pucch_p0_Nominal = -108; - msg3_delta_Preamble = 6; - pucch_deltaF_Format1 = "deltaF2"; - pucch_deltaF_Format1b = "deltaF3"; - pucch_deltaF_Format2 = "deltaF0"; - pucch_deltaF_Format2a = "deltaF0"; - pucch_deltaF_Format2b = "deltaF0"; + pcch_default_PagingCycle = 128; + pcch_nB = "oneT"; + bcch_modificationPeriodCoeff = 2; + ue_TimersAndConstants_t300 = 1000; + ue_TimersAndConstants_t301 = 1000; + ue_TimersAndConstants_t310 = 1000; + ue_TimersAndConstants_t311 = 10000; + ue_TimersAndConstants_n310 = 20; + ue_TimersAndConstants_n311 = 1; - rach_numberOfRA_Preambles = 64; - rach_preamblesGroupAConfig = "DISABLE"; - /* - rach_sizeOfRA_PreamblesGroupA = ; - rach_messageSizeGroupA = ; - rach_messagePowerOffsetGroupB = ; - */ - rach_powerRampingStep = 4; - rach_preambleInitialReceivedTargetPower = -108; - rach_preambleTransMax = 10; - rach_raResponseWindowSize = 10; - rach_macContentionResolutionTimer = 48; - rach_maxHARQ_Msg3Tx = 4; - - pcch_default_PagingCycle = 128; - pcch_nB = "oneT"; - bcch_modificationPeriodCoeff = 2; - ue_TimersAndConstants_t300 = 1000; - ue_TimersAndConstants_t301 = 1000; - ue_TimersAndConstants_t310 = 1000; - ue_TimersAndConstants_t311 = 10000; - ue_TimersAndConstants_n310 = 20; - ue_TimersAndConstants_n311 = 1; - } - ); + } + ); srb1_parameters : { - # timer_poll_retransmit = (ms) [5, 10, 15, 20,... 250, 300, 350, ... 500] + # timer_poll_retransmit = (ms) [5, 10, 15, 20,... 250, 300, 350, ... 500] timer_poll_retransmit = 80; - + # timer_reordering = (ms) [0,5, ... 100, 110, 120, ... ,200] timer_reordering = 35; - + # timer_reordering = (ms) [0,5, ... 250, 300, 350, ... ,500] timer_status_prohibit = 0; - + # poll_pdu = [4, 8, 16, 32 , 64, 128, 256, infinity(>10000)] poll_pdu = 4; - + # poll_byte = (kB) [25,50,75,100,125,250,375,500,750,1000,1250,1500,2000,3000,infinity(>10000)] poll_byte = 99999; - + # max_retx_threshold = [1, 2, 3, 4 , 6, 8, 16, 32] max_retx_threshold = 4; } diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.agent.usrpb210.epc.remote.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.agent.usrpb210.epc.remote.conf new file mode 100644 index 0000000000..4f6a3ba101 --- /dev/null +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.agent.usrpb210.epc.remote.conf @@ -0,0 +1,174 @@ +Active_eNBs = ( "eNB_Eurecom_LTEBox"); +# Asn1_verbosity, choice in: none, info, annoying +Asn1_verbosity = "none"; + +eNBs = +( + { + ////////// Identification parameters: + eNB_ID = 0xe00; + + cell_type = "CELL_MACRO_ENB"; + + eNB_name = "eNB_Eurecom_LTEBox"; + + // Tracking area code, 0x0000 and 0xfffe are reserved values + tracking_area_code = "10"; + + mobile_country_code = "208"; + mobile_network_code = "95"; + + ////////// Physical parameters: + + component_carriers = ( + { + frame_type = "FDD"; + tdd_config = 3; + tdd_config_s = 0; + prefix_type = "NORMAL"; + eutra_band = 7; + downlink_frequency = 2660000000L; + uplink_frequency_offset = -120000000; + Nid_cell = 0; + N_RB_DL = 25; + Nid_cell_mbsfn = 0; + nb_antennas_tx = 1; + nb_antennas_rx = 1; + tx_gain = 90; + rx_gain = 125; + prach_root = 0; + prach_config_index = 0; + prach_high_speed = "DISABLE"; + prach_zero_correlation = 1; + prach_freq_offset = 2; + pucch_delta_shift = 1; + pucch_nRB_CQI = 1; + pucch_nCS_AN = 0; + pucch_n1_AN = 32; + pdsch_referenceSignalPower = -26; + pdsch_p_b = 0; + pusch_n_SB = 1; + pusch_enable64QAM = "DISABLE"; + pusch_hoppingMode = "interSubFrame"; + pusch_hoppingOffset = 0; + pusch_groupHoppingEnabled = "ENABLE"; + pusch_groupAssignment = 0; + pusch_sequenceHoppingEnabled = "DISABLE"; + pusch_nDMRS1 = 1; + phich_duration = "NORMAL"; + phich_resource = "ONESIXTH"; + srs_enable = "DISABLE"; + /* srs_BandwidthConfig =; + srs_SubframeConfig =; + srs_ackNackST =; + srs_MaxUpPts =;*/ + + pusch_p0_Nominal = -90; + pusch_alpha = "AL1"; + pucch_p0_Nominal = -108; + msg3_delta_Preamble = 6; + pucch_deltaF_Format1 = "deltaF2"; + pucch_deltaF_Format1b = "deltaF3"; + pucch_deltaF_Format2 = "deltaF0"; + pucch_deltaF_Format2a = "deltaF0"; + pucch_deltaF_Format2b = "deltaF0"; + + rach_numberOfRA_Preambles = 64; + rach_preamblesGroupAConfig = "DISABLE"; + /* + rach_sizeOfRA_PreamblesGroupA = ; + rach_messageSizeGroupA = ; + rach_messagePowerOffsetGroupB = ; + */ + rach_powerRampingStep = 4; + rach_preambleInitialReceivedTargetPower = -108; + rach_preambleTransMax = 10; + rach_raResponseWindowSize = 10; + rach_macContentionResolutionTimer = 48; + rach_maxHARQ_Msg3Tx = 4; + + pcch_default_PagingCycle = 128; + pcch_nB = "oneT"; + bcch_modificationPeriodCoeff = 2; + ue_TimersAndConstants_t300 = 1000; + ue_TimersAndConstants_t301 = 1000; + ue_TimersAndConstants_t310 = 1000; + ue_TimersAndConstants_t311 = 10000; + ue_TimersAndConstants_n310 = 20; + ue_TimersAndConstants_n311 = 1; + } + ); + + srb1_parameters : + { + # timer_poll_retransmit = (ms) [5, 10, 15, 20,... 250, 300, 350, ... 500] + timer_poll_retransmit = 80; + + # timer_reordering = (ms) [0,5, ... 100, 110, 120, ... ,200] + timer_reordering = 35; + + # timer_reordering = (ms) [0,5, ... 250, 300, 350, ... ,500] + timer_status_prohibit = 0; + + # poll_pdu = [4, 8, 16, 32 , 64, 128, 256, infinity(>10000)] + poll_pdu = 4; + + # poll_byte = (kB) [25,50,75,100,125,250,375,500,750,1000,1250,1500,2000,3000,infinity(>10000)] + poll_byte = 99999; + + # max_retx_threshold = [1, 2, 3, 4 , 6, 8, 16, 32] + max_retx_threshold = 4; + } + + # ------- SCTP definitions + SCTP : + { + # Number of streams to use in input/output + SCTP_INSTREAMS = 2; + SCTP_OUTSTREAMS = 2; + }; + + ////////// MME parameters: + mme_ip_address = ( {ipv4 = "192.168.100.103"; + ipv6="192:168:30::17"; + active="yes"; + preference="ipv4";}); + + NETWORK_INTERFACES : + { + ENB_INTERFACE_NAME_FOR_S1_MME = "eth0:1"; + ENB_IPV4_ADDRESS_FOR_S1_MME = "192.168.100.102/24"; + + ENB_INTERFACE_NAME_FOR_S1U = "eth0:1"; + ENB_IPV4_ADDRESS_FOR_S1U = "192.168.100.102/24"; + ENB_PORT_FOR_S1U = 2152; # Spec 2152 + }; + + NETWORK_CONTROLLER : + { + ENB_AGENT_INTERFACE_NAME = "eth1"; + ENB_AGENT_IPV4_ADDRESS = "10.0.0.5/30"; + ENB_AGENT_PORT = 2210; + ENB_AGENT_CACHE = "/mnt/oai_agent_cache"; + }; + + log_config : + { + global_log_level ="info"; + global_log_verbosity ="medium"; + hw_log_level ="info"; + hw_log_verbosity ="medium"; + phy_log_level ="info"; + phy_log_verbosity ="medium"; + mac_log_level ="debug"; + mac_log_verbosity ="high"; + rlc_log_level ="info"; + rlc_log_verbosity ="medium"; + pdcp_log_level ="info"; + pdcp_log_verbosity ="medium"; + rrc_log_level ="info"; + rrc_log_verbosity ="medium"; + }; + + } +); From aa50fcf02a8125ad66b25645970fd4fdd3f67c17 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Fri, 18 Mar 2016 19:42:38 +0000 Subject: [PATCH 160/349] Fixed HARQ reporting to agent and changed sf trigger to report the upcoming subframe --- openair1/SCHED/phy_procedures_lte_eNb.c | 14 +++++++++++++ openair2/ENB_APP/enb_agent.c | 7 +++++++ openair2/ENB_APP/enb_agent_common.c | 26 +++++++++++++++++++++++++ openair2/ENB_APP/enb_agent_common.h | 2 ++ openair2/ENB_APP/enb_agent_mac.c | 26 +++++++++++++++++++++---- openair2/LAYER2/MAC/eNB_scheduler.c | 14 +++++++------ 6 files changed, 79 insertions(+), 10 deletions(-) diff --git a/openair1/SCHED/phy_procedures_lte_eNb.c b/openair1/SCHED/phy_procedures_lte_eNb.c index 375c0dcd1f..d843ebbaab 100755 --- a/openair1/SCHED/phy_procedures_lte_eNb.c +++ b/openair1/SCHED/phy_procedures_lte_eNb.c @@ -67,6 +67,12 @@ # endif #endif + +//Agent-related headers +#include "ENB_APP/enb_agent_extern.h" +#include "ENB_APP/enb_agent_mac.h" +#include "LAYER2/MAC/enb_agent_mac_proto.h" + //#define DIAG_PHY #define NS_PER_SLOT 500000 @@ -1411,6 +1417,7 @@ void phy_procedures_eNB_TX(unsigned char sched_subframe,PHY_VARS_eNB *phy_vars_e #endif #endif + if (abstraction_flag == 0) { start_meas(&phy_vars_eNB->dlsch_encoding_stats); @@ -1603,6 +1610,13 @@ void phy_procedures_eNB_TX(unsigned char sched_subframe,PHY_VARS_eNB *phy_vars_e phy_vars_eNB->dlsch_eNB_ra->active = 0; } +#ifndef DISABLE_SF_TRIGGER + //Send subframe trigger to the controller + if (mac_agent_registered[phy_vars_eNB->Mod_id]) { + agent_mac_xface[phy_vars_eNB->Mod_id]->enb_agent_send_sf_trigger(phy_vars_eNB->Mod_id); + } +#endif + // Now scan UE specific DLSCH for (UE_id=0; UE_idnum_UEs; diff --git a/openair2/ENB_APP/enb_agent_common.h b/openair2/ENB_APP/enb_agent_common.h index 1c4d478aab..9b483ce4a0 100644 --- a/openair2/ENB_APP/enb_agent_common.h +++ b/openair2/ENB_APP/enb_agent_common.h @@ -145,6 +145,8 @@ unsigned int get_current_subframe(mid_t mod_id); Bits 0-3 subframe, rest for frame. Required by progRAN protocol*/ uint16_t get_sfn_sf (mid_t mod_id); +uint16_t get_future_sfn_sf(mid_t mod_id, int ahead_of_time); + int get_num_ues(mid_t mod_id); int get_ue_crnti (mid_t mod_id, mid_t ue_id); diff --git a/openair2/ENB_APP/enb_agent_mac.c b/openair2/ENB_APP/enb_agent_mac.c index 296da7f1d2..fb9ae7322f 100644 --- a/openair2/ENB_APP/enb_agent_mac.c +++ b/openair2/ENB_APP/enb_agent_mac.c @@ -947,9 +947,27 @@ int enb_agent_mac_sf_trigger(mid_t mod_id, const void *params, Protocol__Progran } protocol__prp_sf_trigger__init(sf_trigger_msg); + frame_t frame; + sub_frame_t subframe; + + int ahead_of_time = 1; + + frame = (frame_t) get_current_system_frame_num(mod_id); + subframe = (sub_frame_t) get_current_subframe(mod_id); + + subframe = ((subframe + ahead_of_time) % 10); + + int full_frames_ahead = ((ahead_of_time / 10) % 10); + + frame = frame + full_frames_ahead; + + if (subframe < get_current_subframe(mod_id)) { + frame++; + } + sf_trigger_msg->header = header; sf_trigger_msg->has_sfn_sf = 1; - sf_trigger_msg->sfn_sf = get_sfn_sf(mod_id); + sf_trigger_msg->sfn_sf = get_future_sfn_sf(mod_id, 1); /*TODO: Fill in the number of dl HARQ related info, based on the number of currently *transmitting UEs @@ -973,7 +991,7 @@ int enb_agent_mac_sf_trigger(mid_t mod_id, const void *params, Protocol__Progran /*TODO: fill in the right id of this round's HARQ process for this UE*/ int harq_id; int harq_status; - get_harq(mod_id,UE_PCCID(mod_id,i),i,get_current_frame(mod_id),get_current_subframe(mod_id),&harq_id, &harq_status); + get_harq(mod_id, UE_PCCID(mod_id,i), i, frame, subframe, &harq_id, &harq_status); dl_info[i]->harq_process_id = harq_id; dl_info[i]->has_harq_process_id = 1; /*TODO: fill in the status of the HARQ process (2 TBs)*/ @@ -1369,8 +1387,8 @@ int enb_agent_register_mac_xface(mid_t mod_id, AGENT_MAC_xface *xface) { xface->enb_agent_send_sr_info = enb_agent_send_sr_info; xface->enb_agent_send_sf_trigger = enb_agent_send_sf_trigger; xface->enb_agent_send_update_mac_stats = enb_agent_send_update_mac_stats; - xface->enb_agent_schedule_ue_spec = schedule_ue_spec_default; - //xface->enb_agent_schedule_ue_spec = schedule_ue_spec_remote; + //xface->enb_agent_schedule_ue_spec = schedule_ue_spec_default; + xface->enb_agent_schedule_ue_spec = schedule_ue_spec_remote; xface->enb_agent_get_pending_dl_mac_config = enb_agent_get_pending_dl_mac_config; xface->enb_agent_notify_ue_state_change = enb_agent_ue_state_change; diff --git a/openair2/LAYER2/MAC/eNB_scheduler.c b/openair2/LAYER2/MAC/eNB_scheduler.c index 06e115b392..3285b2b6dd 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler.c +++ b/openair2/LAYER2/MAC/eNB_scheduler.c @@ -216,12 +216,12 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, } -#ifndef DISABLE_SF_TRIGGER - //Send subframe trigger to the controller - if (mac_agent_registered[module_idP]) { - agent_mac_xface[module_idP]->enb_agent_send_sf_trigger(module_idP); - } -#endif +/* #ifndef DISABLE_SF_TRIGGER */ +/* //Send subframe trigger to the controller */ +/* if (mac_agent_registered[module_idP]) { */ +/* agent_mac_xface[module_idP]->enb_agent_send_sf_trigger(module_idP); */ +/* } */ +/* #endif */ //if (subframeP%5 == 0) //#ifdef EXMIMO @@ -971,6 +971,7 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, for (CC_id=0;CC_id Date: Mon, 21 Mar 2016 16:52:03 +0100 Subject: [PATCH 161/349] bug fixed in beamforming.c --- openair1/PHY/MODULATION/beamforming.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/openair1/PHY/MODULATION/beamforming.c b/openair1/PHY/MODULATION/beamforming.c index 867ba0d53d..157b8eb368 100644 --- a/openair1/PHY/MODULATION/beamforming.c +++ b/openair1/PHY/MODULATION/beamforming.c @@ -61,7 +61,7 @@ int ue_spec_beamforming(int32_t **txdataF, slot_offset_F = slot*(frame_parms->ofdm_symbol_size)*((frame_parms->Ncp==1) ? 6 : 7); - // clear txdata_BF[aa][re] for each call of spec_spec_beamforming + // clear txdata_BF[aa][re] for each call of ue_spec_beamforming for(aa=0;aanb_antennas_tx;aa++) memset(txdataF_BF[aa],0,4*(frame_parms->ofdm_symbol_size)); @@ -89,7 +89,7 @@ int ue_spec_beamforming(int32_t **txdataF, } } - if (txdataF[7][re+symbol*frame_parms->ofdm_symbol_size]!=0) { //that means this RE is actually using TM8-10 + if (txdataF[7][slot_offset_F+symbol*frame_parms->ofdm_symbol_size+re]!=0) { //that means this RE is actually using TM8-10 for (p=0;p<8;p++) { if (txdataF[p+7][slot_offset_F+symbol*frame_parms->ofdm_symbol_size+re]!=0) { //that means this RE is actually allocated for (aa=0;aanb_antennas_tx;aa++) { @@ -130,7 +130,6 @@ int cell_spec_beamforming(int32_t **txdataF, for (p=0;pnb_antenna_ports_eNB;p++) { if (txdataF[p][slot_offset_F+symbol*frame_parms->ofdm_symbol_size+re]!=0) { //that means this RE is actually allocated for (aa=0;aanb_antennas_tx;aa++) { - //printf("cell_spec_beamforming():txdata_BF[%d][%d]=%d+j%d\n",aa,re,((int16_t*)&txdataF_BF[aa][re])[0],((int16_t*)&txdataF_BF[aa][re])[1]); ((int16_t*)&txdataF_BF[aa][re])[0] = (int16_t)((((int16_t*)&txdataF[p][slot_offset_F+symbol*frame_parms->ofdm_symbol_size+re])[0] *((int16_t*)&cell_spec_bf_weights[p][aa][re])[0])>>15); @@ -154,6 +153,10 @@ int cell_spec_beamforming(int32_t **txdataF, } } } + + + + /* int ue_spec_beamforming(int32_t **txdataF, int32_t **txdataF_BF, From 9fca33136d955aa74f2d4e7556fa7e3261ef18e9 Mon Sep 17 00:00:00 2001 From: Xiwen JIANG Date: Mon, 21 Mar 2016 16:53:35 +0100 Subject: [PATCH 162/349] move symbol level ifft including beamforming into ofdm_mod.c --- openair1/PHY/MODULATION/ofdm_mod.c | 55 +++++++++++++++++++++++++++++ openair1/SIMULATION/LTE_PHY/dlsim.c | 54 ---------------------------- 2 files changed, 55 insertions(+), 54 deletions(-) diff --git a/openair1/PHY/MODULATION/ofdm_mod.c b/openair1/PHY/MODULATION/ofdm_mod.c index 3dd76c0fbb..e8344a1972 100755 --- a/openair1/PHY/MODULATION/ofdm_mod.c +++ b/openair1/PHY/MODULATION/ofdm_mod.c @@ -276,4 +276,59 @@ void do_OFDM_mod(mod_sym_t **txdataF, int32_t **txdata, uint32_t frame,uint16_t } +// OFDM modulation for each symbol +void do_OFDM_mod_l(LTE_eNB_COMMON *eNB_common_vars, int eNB_id, uint16_t next_slot, LTE_DL_FRAME_PARMS *frame_parms, uint8_t num_pdcch_symbols, unsigned char transmission_mode) +{ + + int aa, l, slot_offset, slot_offset_F; + mod_sym_t **txdataF = eNB_common_vars->txdataF[eNB_id]; + mod_sym_t **txdataF_BF = eNB_common_vars->txdataF_BF[eNB_id]; + int32_t **txdata = eNB_common_vars->txdata[eNB_id]; + + //slot_offset_F = (next_slot)*(frame_parms->ofdm_symbol_size)*((frame_parms->Ncp==1) ? 6 : 7); + slot_offset = (next_slot)*(frame_parms->samples_per_tti>>1); + + // printf("Thread %d starting ... aa %d (%llu)\n",omp_get_thread_num(),aa,rdtsc()); + for (l=0; lsymbols_per_tti>>1; l++) { + + //printf("do_OFDM_mod_l, slot=%d, l=%d, NUMBER_OF_OFDM_CARRIERS=%d,OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES=%d\n",next_slot, l,NUMBER_OF_OFDM_CARRIERS,OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES); + if (lcell_spec_bf_weights[eNB_id],next_slot,l); + else + if (transmission_mode<7) + cell_spec_beamforming(txdataF,txdataF_BF,frame_parms,eNB_common_vars->cell_spec_bf_weights[eNB_id],next_slot,l); + else + ue_spec_beamforming(txdataF,txdataF_BF,frame_parms,eNB_common_vars->ue_spec_bf_weights[eNB_id],next_slot,l); + + for (aa=0; aanb_antennas_tx; aa++) { + + if (frame_parms->Ncp == 1) + PHY_ofdm_mod(txdataF_BF[aa], // input + &txdata[aa][slot_offset+l*OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES], // output + frame_parms->ofdm_symbol_size, + 1, // number of symbols + frame_parms->nb_prefix_samples, // number of prefix samples + CYCLIC_PREFIX); + else { + if (l==0) { + PHY_ofdm_mod(txdataF_BF[aa], // input + &txdata[aa][slot_offset], // output + frame_parms->ofdm_symbol_size, + 1, // number of symbols + frame_parms->nb_prefix_samples0, // number of prefix samples + CYCLIC_PREFIX); + + } else { + PHY_ofdm_mod(txdataF_BF[aa], // input + &txdata[aa][slot_offset+OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES0+(l-1)*OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES], // output + frame_parms->ofdm_symbol_size, + 1, // number of symbols + frame_parms->nb_prefix_samples, // number of prefix samples + CYCLIC_PREFIX); + } + } + } + } + +} /** @} */ diff --git a/openair1/SIMULATION/LTE_PHY/dlsim.c b/openair1/SIMULATION/LTE_PHY/dlsim.c index beb90006ae..81a27f4a53 100644 --- a/openair1/SIMULATION/LTE_PHY/dlsim.c +++ b/openair1/SIMULATION/LTE_PHY/dlsim.c @@ -118,60 +118,6 @@ uint64_t DLSCH_alloc_pdu_1[2]; #define CCCH_RB_ALLOC computeRIV(PHY_vars_eNB->lte_frame_parms.N_RB_UL,0,2) //#define DLSCH_RB_ALLOC 0x1fbf // igore DC component,RB13 //#define DLSCH_RB_ALLOC 0x0001 -void do_OFDM_mod_l(LTE_eNB_COMMON *eNB_common_vars, int eNB_id, uint16_t next_slot, LTE_DL_FRAME_PARMS *frame_parms, uint8_t num_pdcch_symbols, unsigned char transmission_mode) -{ - - int aa, l, slot_offset, slot_offset_F; - mod_sym_t **txdataF = eNB_common_vars->txdataF[eNB_id]; - mod_sym_t **txdataF_BF = eNB_common_vars->txdataF_BF[eNB_id]; - int32_t **txdata = eNB_common_vars->txdata[eNB_id]; - - //slot_offset_F = (next_slot)*(frame_parms->ofdm_symbol_size)*((frame_parms->Ncp==1) ? 6 : 7); - slot_offset = (next_slot)*(frame_parms->samples_per_tti>>1); - - // printf("Thread %d starting ... aa %d (%llu)\n",omp_get_thread_num(),aa,rdtsc()); - for (l=0; lsymbols_per_tti>>1; l++) { - - //printf("do_OFDM_mod_l, slot=%d, l=%d, NUMBER_OF_OFDM_CARRIERS=%d,OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES=%d\n",next_slot, l,NUMBER_OF_OFDM_CARRIERS,OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES); - if (lcell_spec_bf_weights[eNB_id],next_slot,l); - else - if (transmission_mode<7) - cell_spec_beamforming(txdataF,txdataF_BF,frame_parms,eNB_common_vars->cell_spec_bf_weights[eNB_id],next_slot,l); - else - ue_spec_beamforming(txdataF,txdataF_BF,frame_parms,eNB_common_vars->ue_spec_bf_weights[eNB_id],next_slot,l); - - for (aa=0; aanb_antennas_tx; aa++) { - - if (frame_parms->Ncp == 1) - PHY_ofdm_mod(txdataF_BF[aa], // input - &txdata[aa][slot_offset+l*OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES], // output - frame_parms->ofdm_symbol_size, - 1, // number of symbols - frame_parms->nb_prefix_samples, // number of prefix samples - CYCLIC_PREFIX); - else { - if (l==0) { - PHY_ofdm_mod(txdataF_BF[aa], // input - &txdata[aa][slot_offset], // output - frame_parms->ofdm_symbol_size, - 1, // number of symbols - frame_parms->nb_prefix_samples0, // number of prefix samples - CYCLIC_PREFIX); - - } else { - PHY_ofdm_mod(txdataF_BF[aa], // input - &txdata[aa][slot_offset+OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES0+(l-1)*OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES], // output - frame_parms->ofdm_symbol_size, - 1, // number of symbols - frame_parms->nb_prefix_samples, // number of prefix samples - CYCLIC_PREFIX); - } - } - } - } - -} int main(int argc, char **argv) { From 9fcca73f538bf710d25f93ea9e03758d821a4b8e Mon Sep 17 00:00:00 2001 From: Xiwen JIANG Date: Mon, 21 Mar 2016 16:55:26 +0100 Subject: [PATCH 163/349] lte softmodem adaption for massive antennas (not complete) --- openair1/PHY/INIT/lte_init.c | 2 +- openair1/PHY/impl_defs_lte.h | 5 +++++ openair1/SCHED/phy_procedures_lte_eNb.c | 23 +++++++++++++++-------- targets/RT/USER/lte-softmodem.c | 4 ++-- 4 files changed, 23 insertions(+), 11 deletions(-) diff --git a/openair1/PHY/INIT/lte_init.c b/openair1/PHY/INIT/lte_init.c index e604d599a1..672a3a51ef 100644 --- a/openair1/PHY/INIT/lte_init.c +++ b/openair1/PHY/INIT/lte_init.c @@ -1305,7 +1305,7 @@ int phy_init_lte_eNB(PHY_VARS_eNB *phy_vars_eNB, for (i=0; i<2; i++) { // 2 is the total number of cell specific antenna ports eNB_common_vars->cell_spec_bf_weights[eNB_id][i] = (int32_t **)malloc16_clear(frame_parms->nb_antennas_tx*sizeof(int32_t*)); for (j=0; jnb_antennas_tx; j++) { - eNB_common_vars->cell_spec_bf_weights[eNB_id][i][j] = (int32_t*)malloc16_clear(OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES*sizeof(int32_t)); + eNB_common_vars->cell_spec_bf_weights[eNB_id][i][j] = (int32_t *)malloc16_clear(OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES*sizeof(int32_t)); #ifdef DEBUG_PUY msg("[openair][LTE_PHY][INIT] lte_eNB_common_vars->cell_spec_bf_weights[%d][%d][%d] = %p (%d bytes)\n", eNB_id,i,j,eNB_common_vars->cell_spec_bf_weights[eNB_id][i][j], diff --git a/openair1/PHY/impl_defs_lte.h b/openair1/PHY/impl_defs_lte.h index 134a92e15d..864d2d5d19 100644 --- a/openair1/PHY/impl_defs_lte.h +++ b/openair1/PHY/impl_defs_lte.h @@ -645,6 +645,11 @@ typedef struct { /// - third index: tx antenna [0..nb_antennas_tx[ /// - fourth index: sample [0..] int32_t **ue_spec_bf_weights[3][8]; + /// \brief Holds the tdd reciprocity calibration coefficients + /// - first index: eNB id [0..2] (hard coded) + /// - second index: tx antenna [0..nb_antennas_tx[ + /// - third index: frenquency [0..] + int32_t **tdd_calib_coeffs[3]; } LTE_eNB_COMMON; typedef struct { diff --git a/openair1/SCHED/phy_procedures_lte_eNb.c b/openair1/SCHED/phy_procedures_lte_eNb.c index 082f0c0568..dece28f78e 100755 --- a/openair1/SCHED/phy_procedures_lte_eNb.c +++ b/openair1/SCHED/phy_procedures_lte_eNb.c @@ -2520,14 +2520,21 @@ void phy_procedures_eNB_TX(unsigned char sched_subframe,PHY_VARS_eNB *phy_vars_e if (abstraction_flag==0) { start_meas(&phy_vars_eNB->ofdm_mod_stats); - do_OFDM_mod(phy_vars_eNB->lte_eNB_common_vars.txdataF[0], - phy_vars_eNB->lte_eNB_common_vars.txdata[0], - phy_vars_eNB->proc[sched_subframe].frame_tx,subframe<<1, - &phy_vars_eNB->lte_frame_parms); - do_OFDM_mod(phy_vars_eNB->lte_eNB_common_vars.txdataF[0], - phy_vars_eNB->lte_eNB_common_vars.txdata[0], - phy_vars_eNB->proc[sched_subframe].frame_tx,1+(subframe<<1), - &phy_vars_eNB->lte_frame_parms); + + do_OFDM_mod_l(phy_vars_eNB->lte_eNB_common_vars, + 0, + subframe<<1, + &phy_vars_eNB->lte_frame_parms, + num_pdcch_symbols, + eNB->transmission_mode[(uint8_t)UE_id]); + + do_OFDM_mod_l(phy_vars_eNB->lte_eNB_common_vars, + 0, + 1+(subframe<<1), + &phy_vars_eNB->lte_frame_parms, + num_pdcch_symbols, + eNB->transmission_mode[(uint8_t)UE_id]); + stop_meas(&phy_vars_eNB->ofdm_mod_stats); } diff --git a/targets/RT/USER/lte-softmodem.c b/targets/RT/USER/lte-softmodem.c index 72d32fbdef..0fe4e2342c 100644 --- a/targets/RT/USER/lte-softmodem.c +++ b/targets/RT/USER/lte-softmodem.c @@ -2755,7 +2755,7 @@ int main( int argc, char **argv ) frame_parms[CC_id]->nb_antenna_ports_eNB = (transmission_mode == 1 || transmission_mode ==7) ? 1 : 2; //initial value overwritten by initial sync later } - frame_parms[CC_id]->mode1_flag = (transmission_mode == 1) ? 1 : 0; + frame_parms[CC_id]->mode1_flag = (transmission_mode == 1 || transmission_mode ==7) ? 1 : 0; frame_parms[CC_id]->phich_config_common.phich_resource = oneSixth; frame_parms[CC_id]->phich_config_common.phich_duration = normal; // UL RS Config @@ -3188,7 +3188,7 @@ int main( int argc, char **argv ) openair_daq_vars.timing_advance = 160; #endif if (setup_ue_buffers(UE,&openair0_cfg[0],rf_map)!=0) { - printf("Error setting up eNB buffer\n"); + printf("Error setting up UE buffer\n"); exit(-1); } From 3c7f2ff3cef9b9081fe90f079b99333c3d3fe2af Mon Sep 17 00:00:00 2001 From: Xiwen JIANG Date: Fri, 25 Mar 2016 09:19:34 +0100 Subject: [PATCH 164/349] fill dci for TM7 --- openair1/SCHED/phy_mac_stub.c | 2 +- openair1/SIMULATION/LTE_PHY/dlsim.c | 2 +- openair2/LAYER2/MAC/eNB_scheduler_dlsch.c | 3 +++ 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/openair1/SCHED/phy_mac_stub.c b/openair1/SCHED/phy_mac_stub.c index 9bcba1072c..62ca6ea8d0 100644 --- a/openair1/SCHED/phy_mac_stub.c +++ b/openair1/SCHED/phy_mac_stub.c @@ -226,7 +226,7 @@ void fill_dci(DCI_PDU *DCI_pdu, uint8_t sched_subframe, PHY_VARS_eNB *phy_vars_e DCI_pdu->dci_alloc[0].format = format1; DCI_pdu->dci_alloc[0].ra_flag = 0; - if (transmission_mode<3) { + if (transmission_mode<3 || transmission_mode == 7) { //user 1 switch (phy_vars_eNB->lte_frame_parms.N_RB_DL) { case 25: diff --git a/openair1/SIMULATION/LTE_PHY/dlsim.c b/openair1/SIMULATION/LTE_PHY/dlsim.c index cd2c89f3c2..206ea63ae0 100644 --- a/openair1/SIMULATION/LTE_PHY/dlsim.c +++ b/openair1/SIMULATION/LTE_PHY/dlsim.c @@ -1151,7 +1151,7 @@ int main(int argc, char **argv) P_RNTI, PHY_vars_eNB->eNB_UE_stats[0].DL_pmi_single); - if(transmission_mode==7) + if (transmission_mode == 7) PHY_vars_eNB->dlsch_eNB[0][0]->harq_processes[0]->mimo_mode = TM7; //Xiwen: to check about harq_pid num_dci++; diff --git a/openair2/LAYER2/MAC/eNB_scheduler_dlsch.c b/openair2/LAYER2/MAC/eNB_scheduler_dlsch.c index 2a52d8779a..ca05786371 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler_dlsch.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_dlsch.c @@ -653,6 +653,7 @@ schedule_ue_spec( switch (mac_xface->get_transmission_mode(module_idP,CC_id,rnti)) { case 1: case 2: + case 7: default: switch (frame_parms[CC_id]->N_RB_DL) { case 6: @@ -1545,6 +1546,8 @@ fill_DLSCH_dci( case 1: case 2: + + case 7: LOG_D(MAC,"[eNB %d] CC_id %d Adding UE %d spec DCI for %d PRBS \n",module_idP, CC_id, UE_id, nb_rb); if (PHY_vars_eNB_g[module_idP][CC_id]->lte_frame_parms.frame_type == TDD) { From 7236e3ca177e11858df555a708e26f86efd90921 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Wed, 6 Apr 2016 13:34:37 +0100 Subject: [PATCH 165/349] Bugfixes to improve stability --- openair2/ENB_APP/enb_agent_common.c | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/openair2/ENB_APP/enb_agent_common.c b/openair2/ENB_APP/enb_agent_common.c index 2be189a2cd..f06599e258 100644 --- a/openair2/ENB_APP/enb_agent_common.c +++ b/openair2/ENB_APP/enb_agent_common.c @@ -561,7 +561,6 @@ int get_ue_phr (mid_t mod_id, mid_t ue_id) { } int get_ue_wcqi (mid_t mod_id, mid_t ue_id) { - return ((UE_list_t *)enb_ue[mod_id])->eNB_UE_stats[UE_PCCID(mod_id,ue_id)][ue_id].dl_cqi; } int get_tx_queue_size(mid_t mod_id, mid_t ue_id, logical_chan_id_t channel_id) @@ -576,6 +575,10 @@ int get_MAC_CE_bitmap_TA(mid_t mod_id, mid_t ue_id,int CC_id) { rnti_t rnti = get_ue_crnti(mod_id,ue_id); LTE_eNB_UE_stats *eNB_UE_stats = mac_xface->get_eNB_UE_stats(mod_id,CC_id,rnti); + + if (eNB_UE_stats == NULL) { + return 0; + } int32_t time_advance; switch (PHY_vars_eNB_g[mod_id][CC_id]->lte_frame_parms.N_RB_DL) { @@ -622,6 +625,11 @@ int get_current_RI(mid_t mod_id, mid_t ue_id, int CC_id) rnti_t rnti = get_ue_crnti(mod_id,ue_id); eNB_UE_stats = mac_xface->get_eNB_UE_stats(mod_id,CC_id,rnti); + + if (eNB_UE_stats == NULL) { + return 0; + } + return eNB_UE_stats[CC_id].rank; } @@ -636,10 +644,16 @@ int get_tpc(mid_t mod_id, mid_t ue_id) eNB_UE_stats = mac_xface->get_eNB_UE_stats(mod_id, pCCid, rnti); - normalized_rx_power = eNB_UE_stats->UL_rssi[0]; - target_rx_power = mac_xface->get_target_pusch_rx_power(mod_id,pCCid); + if (eNB_UE_stats == NULL) { + normalized_rx_power = target_rx_power; + } else if (eNB_UE_stats->UL_rssi != NULL) { + normalized_rx_power = eNB_UE_stats->UL_rssi[0]; + } else { + normalized_rx_power = target_rx_power; + } + if (normalized_rx_power>(target_rx_power+1)) { tpc = 0; //-1 } else if (normalized_rx_power<(target_rx_power-1)) { @@ -680,6 +694,11 @@ int get_p0_pucch_dbm(mid_t mod_id, mid_t ue_id, int CC_id) uint32_t rnti = get_ue_crnti(mod_id,ue_id); eNB_UE_stats = mac_xface->get_eNB_UE_stats(mod_id, CC_id, rnti); + + if (eNB_UE_stats == NULL) { + return -1; + } + if(eNB_UE_stats->Po_PUCCH_update == 1) { return eNB_UE_stats->Po_PUCCH_dBm; From 6b15195ac58e33fb4aab6d28bc4548e59944873a Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Thu, 7 Apr 2016 09:28:35 +0100 Subject: [PATCH 166/349] Added statistics for total and missed scheduling deadlines of remote scheduler --- openair2/LAYER2/MAC/defs.h | 7 +++++++ .../MAC/eNB_agent_scheduler_dlsch_ue_remote.c | 14 ++++++++++++++ openair2/LAYER2/openair2_proc.c | 6 ++++-- 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/openair2/LAYER2/MAC/defs.h b/openair2/LAYER2/MAC/defs.h index cd2d593726..7c0561121d 100644 --- a/openair2/LAYER2/MAC/defs.h +++ b/openair2/LAYER2/MAC/defs.h @@ -462,6 +462,13 @@ typedef struct { // uint32_t total_ulsch_pdus_rx; + + /// MAC agent-related stats + /// total number of scheduling decisions + int sched_decisions; + /// missed deadlines + int missed_deadlines; + } eNB_STATS; /*! \brief eNB statistics for the connected UEs*/ typedef struct { diff --git a/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue_remote.c b/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue_remote.c index 90181f0e44..ad8b130584 100644 --- a/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue_remote.c +++ b/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue_remote.c @@ -39,6 +39,9 @@ #include "eNB_agent_scheduler_dlsch_ue_remote.h" +#include "LAYER2/MAC/defs.h" +#include "LAYER2/MAC/extern.h" + struct DlMacConfigHead queue_head; int queue_initialized = 0; @@ -46,10 +49,15 @@ int queue_initialized = 0; void schedule_ue_spec_remote(mid_t mod_id, uint32_t frame, uint32_t subframe, int *mbsfn_flag, Protocol__ProgranMessage **dl_info) { + + eNB_MAC_INST *eNB; + if (!queue_initialized) { TAILQ_INIT(&queue_head); queue_initialized = 1; } + + eNB = &eNB_mac_inst[mod_id]; dl_mac_config_element_t *dl_config_elem; @@ -66,12 +74,15 @@ void schedule_ue_spec_remote(mid_t mod_id, uint32_t frame, uint32_t subframe, TAILQ_REMOVE(&queue_head, queue_head.tqh_first, configs); *dl_info = dl_config_elem->dl_info; free(dl_config_elem); + eNB->eNB_stats[mod_id].sched_decisions++; return; } else if (diff < 0) { //previous subframe , delete message and free memory LOG_D(MAC, "Found a decision for a previous subframe in the queue. Let's get rid of it\n"); TAILQ_REMOVE(&queue_head, queue_head.tqh_first, configs); enb_agent_mac_destroy_dl_config(dl_config_elem->dl_info); free(dl_config_elem); + eNB->eNB_stats[mod_id].sched_decisions++; + eNB->eNB_stats[mod_id].missed_deadlines++; } else { // next subframe, nothing to do now LOG_D(MAC, "Found a decision for a future subframe in the queue. Nothing to do now\n"); enb_agent_mac_create_empty_dl_config(mod_id, dl_info); @@ -86,12 +97,15 @@ void schedule_ue_spec_remote(mid_t mod_id, uint32_t frame, uint32_t subframe, diff = get_sf_difference(mod_id, (*dl_info)->dl_mac_config_msg->sfn_sf); if (diff == 0) { // Got a command for this sfn_sf LOG_D(MAC, "Found a decision for this subframe pending. Let's use it\n"); + eNB->eNB_stats[mod_id].sched_decisions++; return; } else if (diff < 0) { LOG_D(MAC, "Found a decision for a previous subframe. Let's get rid of it\n"); enb_agent_mac_destroy_dl_config(*dl_info); *dl_info = NULL; enb_agent_get_pending_dl_mac_config(mod_id, dl_info); + eNB->eNB_stats[mod_id].sched_decisions++; + eNB->eNB_stats[mod_id].missed_deadlines++; } else { // Intended for future subframe. Store it in local cache LOG_D(MAC, "Found a decision for a future subframe in the queue. Let's store it in the cache\n"); dl_mac_config_element_t *e = malloc(sizeof(dl_mac_config_element_t)); diff --git a/openair2/LAYER2/openair2_proc.c b/openair2/LAYER2/openair2_proc.c index e09adaea8c..4556bafeec 100644 --- a/openair2/LAYER2/openair2_proc.c +++ b/openair2/LAYER2/openair2_proc.c @@ -122,11 +122,13 @@ int dump_eNB_l2_stats(char *buffer, int length) for (CC_id=0 ; CC_id < MAX_NUM_CCs; CC_id++) { eNB->eNB_stats[CC_id].dlsch_bitrate= 0; - len += sprintf(&buffer[len],"eNB %d CC %d Frame %d: Active UEs %d, Available PRBs %d, nCCE %d \n", + len += sprintf(&buffer[len],"eNB %d CC %d Frame %d: Active UEs %d, Available PRBs %d, nCCE %d, Scheduling decisions %d, Missed Deadlines %d \n", eNB_id, CC_id, eNB->frame, eNB->eNB_stats[CC_id].num_dlactive_UEs, eNB->eNB_stats[CC_id].available_prbs, - eNB->eNB_stats[CC_id].available_ncces); + eNB->eNB_stats[CC_id].available_ncces, + eNB->eNB_stats[CC_id].sched_decisions, + eNB->eNB_stats[CC_id].missed_deadlines); len += sprintf(&buffer[len],"BCCH , NB_TX_MAC = %d, transmitted bytes (TTI %d, total %d) MCS (TTI %d)\n", eNB->eNB_stats[CC_id].total_num_bcch_pdu, From 9c9d3f45801e37bede099320330d2a619d363dff Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Tue, 12 Apr 2016 12:56:13 +0100 Subject: [PATCH 167/349] Added build support for packages required for the agent-enabled eNB --- cmake_targets/CMakeLists.txt | 14 ++++++++++--- cmake_targets/tools/build_helper | 36 +++++++++++++++++++++++++++++++- 2 files changed, 46 insertions(+), 4 deletions(-) diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index 1224768142..2db18176b4 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -911,6 +911,7 @@ if (ENB_AGENT_SB_IF) add_library(ENB_AGENT ${OPENAIR2_DIR}/ENB_APP/enb_agent_handler.c ${OPENAIR2_DIR}/ENB_APP/enb_agent_common.c + ${OPENAIR2_DIR}/ENB_APP/enb_agent_common_internal.c ${OPENAIR2_DIR}/ENB_APP/enb_agent_mac.c ${OPENAIR2_DIR}/ENB_APP/enb_agent.c ${OPENAIR2_DIR}/ENB_APP/enb_agent_task_manager.c @@ -923,6 +924,13 @@ if (ENB_AGENT_SB_IF) set(PROTOBUF_LIB "protobuf-c") + FIND_PATH(LIBYAML_INCLUDE_DIR NAMES yaml.h) + FIND_LIBRARY(LIBYAML_LIBRARIES NAMES yaml libyaml) + + INCLUDE(FindPackageHandleStandardArgs) + FIND_PACKAGE_HANDLE_STANDARD_ARGS(Yaml DEFAULT_MSG LIBYAML_LIBRARIES LIBYAML_INCLUDE_DIR) + MARK_AS_ADVANCED(LIBYAML_INCLUDE_DIR LIBYAML_LIBRARIES) + #set(PROTOBUF_LIB "protobuf") #for Cpp endif() @@ -1703,7 +1711,7 @@ target_link_libraries (lte-softmodem target_link_libraries (lte-softmodem ${LIBXML2_LIBRARIES}) -target_link_libraries (lte-softmodem pthread m ${CONFIG_LIBRARIES} rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${NETTLE_LIBRARIES} sctp ${option_HW_lib} ${option_TP_lib} ${XFORMS_LIBRARIES} ${PROTOBUF_LIB} ${CMAKE_DL_LIBS}) +target_link_libraries (lte-softmodem pthread m ${CONFIG_LIBRARIES} rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${NETTLE_LIBRARIES} sctp ${option_HW_lib} ${option_TP_lib} ${XFORMS_LIBRARIES} ${PROTOBUF_LIB} ${CMAKE_DL_LIBS} ${LIBYAML_LIBRARIES}) target_link_libraries (lte-softmodem ${LIBBOOST_LIBRARIES}) target_link_libraries (lte-softmodem ${LIB_LMS_LIBRARIES}) @@ -1737,7 +1745,7 @@ target_link_libraries (lte-softmodem-nos1 -Wl,--end-group ) target_link_libraries (lte-softmodem-nos1 ${LIBXML2_LIBRARIES}) -target_link_libraries (lte-softmodem-nos1 pthread m ${CONFIG_LIBRARIES} rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${NETTLE_LIBRARIES} ${option_HW_lib} ${option_TP_lib} ${XFORMS_LIBRARIES} ${PROTOBUF_LIB} ${CMAKE_DL_LIBS}) +target_link_libraries (lte-softmodem-nos1 pthread m ${CONFIG_LIBRARIES} rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${NETTLE_LIBRARIES} ${option_HW_lib} ${option_TP_lib} ${XFORMS_LIBRARIES} ${PROTOBUF_LIB} ${CMAKE_DL_LIBS} ${LIBYAML_LIBRARIES}) target_link_libraries (lte-softmodem-nos1 ${LIBBOOST_LIBRARIES}) target_link_libraries (lte-softmodem-nos1 ${LIB_LMS_LIBRARIES}) @@ -1874,7 +1882,7 @@ target_link_libraries (oaisim_nos1 target_link_libraries (oaisim_nos1 ${LIBXML2_LIBRARIES} ${LAPACK_LIBRARIES}) target_link_libraries (oaisim_nos1 pthread m ${CONFIG_LIBRARIES} rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${NETTLE_LIBRARIES} ${option_HW_lib} ${option_TP_lib} - ${ATLAS_LIBRARIES} ${XFORMS_LIBRARIES} ${OPENPGM_LIBRARIES} ${PROTOBUF_LIB} ${CMAKE_DL_LIBS}) + ${ATLAS_LIBRARIES} ${XFORMS_LIBRARIES} ${OPENPGM_LIBRARIES} ${PROTOBUF_LIB} ${CMAKE_DL_LIBS} ${LIBYAML_LIBRARIES}) #Force link with forms, regardless XFORMS option target_link_libraries (oaisim_nos1 forms) diff --git a/cmake_targets/tools/build_helper b/cmake_targets/tools/build_helper index 294c5006a5..498dfbe7a9 100755 --- a/cmake_targets/tools/build_helper +++ b/cmake_targets/tools/build_helper @@ -146,6 +146,37 @@ install_nettle_from_source() { rm -rf /tmp/nettle-2.5.tar.gz /tmp/nettle-2.5 } + +install_protobuf_from_source(){ + cd /tmp + echo "Downloading protobuf" + rm -rf /tmp/protobuf-2.6.1.tar.gz* /tmp/protobuf-2.6.1 + wget https://github.com/google/protobuf/releases/download/v2.6.1/protobuf-2.6.1.tar.gz + tar -xzvf protobuf-2.6.1.tar.gz + cd protobuf-2.6.1/ + ./configure + echo "Compiling protobuf" + make -j`nproc` + $SUDO make install + rm -rf /tmp/protobuf-2.6.1.tar.gz /tmp/protobuf-2.6.1 + $SUDO ldconfig +} + +install_protobuf_c_from_source(){ + cd /tmp + echo "Downloading protobuf-c" + rm -rf /tmp/protobuf-c + git clone https://github.com/protobuf-c/protobuf-c.git + cd protobuf-c + ./autogen.sh + ./configure + echo "Compiling protobuf-c" + make -j`nproc` + $SUDO make install + rm -rf /tmp/protobuf-c + $SUDO ldconfig +} + install_gnutls_from_source(){ cd /tmp echo "Downloading gnutls archive" @@ -271,7 +302,8 @@ check_install_oai_software() { python-numpy \ sshpass \ libxslt1-dev \ - android-tools-adb + android-tools-adb \ + libyaml-dev $SUDO update-alternatives --set liblapack.so /usr/lib/atlas-base/atlas/liblapack.so if [ `lsb_release -rs` = '12.04' ] ; then @@ -285,6 +317,8 @@ check_install_oai_software() { install_asn1c_from_source $SUDO rm -fr /opt/ssh $SUDO git clone https://gist.github.com/2190472.git /opt/ssh + install_protobuf_from_source + install_protobuf_c_from_source } install_asn1c_from_source(){ From dd2e208361bd0d2a7280567ec0b1d7629d7da0d3 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Tue, 12 Apr 2016 12:56:55 +0100 Subject: [PATCH 168/349] Added protocol support for agent policy reconfiguration --- openair2/ENB_APP/MESSAGES/V2/header.proto | 1 + openair2/ENB_APP/MESSAGES/V2/progran.proto | 12 +++++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/openair2/ENB_APP/MESSAGES/V2/header.proto b/openair2/ENB_APP/MESSAGES/V2/header.proto index 6ce9959104..44ad93e16b 100644 --- a/openair2/ENB_APP/MESSAGES/V2/header.proto +++ b/openair2/ENB_APP/MESSAGES/V2/header.proto @@ -38,5 +38,6 @@ enum prp_type { // Control delegation messages PRPT_DELEGATE_CONTROL = 15; + PRPT_RECONFIGURE_AGENT = 16; } diff --git a/openair2/ENB_APP/MESSAGES/V2/progran.proto b/openair2/ENB_APP/MESSAGES/V2/progran.proto index 6b7b784629..235aba4363 100644 --- a/openair2/ENB_APP/MESSAGES/V2/progran.proto +++ b/openair2/ENB_APP/MESSAGES/V2/progran.proto @@ -27,6 +27,7 @@ message progran_message { prp_dl_mac_config dl_mac_config_msg = 14; prp_ue_state_change ue_state_change_msg = 15; prp_control_delegation control_delegation_msg = 16; + prp_agent_reconfiguration agent_reconfiguration_msg = 17; } } @@ -180,7 +181,16 @@ message prp_control_delegation { optional prp_header header = 1; optional uint32 delegation_type = 2; // Bitmap of PRCDT_* flags optional bytes payload = 3; // Byte array of shared lib containing the delegated functions - repeated string name = 4; // The delegated functions names ordered based on bitmap flags + optional string name = 4; // The delegated functions names ordered based on bitmap flags +} + +// +// Agent reconfiguration message +// + +message prp_agent_reconfiguration { + optional prp_header header = 1; + optional string policy = 2; // The policy changes using YAML syntax in string format } // Extensions of the echo request and reply From a47f3654f8c347838b46de3e01d5a4dad9d46af5 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Tue, 12 Apr 2016 13:00:20 +0100 Subject: [PATCH 169/349] Added basic support for policy reconfiguration using yaml parser --- openair2/ENB_APP/enb_agent_common.c | 37 +- openair2/ENB_APP/enb_agent_common.h | 3 + openair2/ENB_APP/enb_agent_common_internal.c | 400 ++++++++++++++++++ openair2/ENB_APP/enb_agent_common_internal.h | 64 +++ openair2/ENB_APP/enb_agent_handler.c | 3 +- openair2/ENB_APP/enb_agent_mac.c | 4 + openair2/ENB_APP/enb_agent_mac_defs.h | 2 + openair2/ENB_APP/enb_agent_mac_internal.c | 235 ++++++++++ openair2/ENB_APP/enb_agent_mac_internal.h | 15 +- .../MAC/eNB_agent_scheduler_dlsch_ue_remote.c | 18 + 10 files changed, 758 insertions(+), 23 deletions(-) create mode 100644 openair2/ENB_APP/enb_agent_common_internal.c create mode 100644 openair2/ENB_APP/enb_agent_common_internal.h diff --git a/openair2/ENB_APP/enb_agent_common.c b/openair2/ENB_APP/enb_agent_common.c index f06599e258..e21c180cec 100644 --- a/openair2/ENB_APP/enb_agent_common.c +++ b/openair2/ENB_APP/enb_agent_common.c @@ -35,10 +35,10 @@ */ #include -#include #include #include "enb_agent_common.h" +#include "enb_agent_common_internal.h" #include "enb_agent_extern.h" #include "PHY/extern.h" #include "log.h" @@ -403,7 +403,6 @@ int enb_agent_control_delegation(mid_t mod_id, const void *params, Protocol__Pro uint32_t delegation_type = control_delegation_msg->delegation_type; - void *lib; int i; struct timespec vartime = timer_start(); @@ -411,7 +410,7 @@ int enb_agent_control_delegation(mid_t mod_id, const void *params, Protocol__Pro //Write the payload lib into a file in the cache and load the lib char lib_name[120]; char target[512]; - snprintf(lib_name, sizeof(lib_name), "/delegation_lib_%d.so", control_delegation_msg->header->xid); + snprintf(lib_name, sizeof(lib_name), "/%s.so", control_delegation_msg->name); strcpy(target, local_cache); strcat(target, lib_name); @@ -419,25 +418,7 @@ int enb_agent_control_delegation(mid_t mod_id, const void *params, Protocol__Pro f = fopen(target, "wb"); fwrite(control_delegation_msg->payload.data, control_delegation_msg->payload.len, 1, f); fclose(f); - lib = dlopen(target, RTLD_NOW); - if (lib == NULL) { - goto error; - } - i = 0; - //Check functions that need to be delegated - - //DL UE scheduler delegation - if (delegation_type & PROTOCOL__PRP_CONTROL_DELEGATION_TYPE__PRCDT_MAC_DL_UE_SCHEDULER) { - void *loaded_scheduler = dlsym(lib, control_delegation_msg->name[i]); - i++; - if (loaded_scheduler) { - if (mac_agent_registered[mod_id]) { - agent_mac_xface[mod_id]->enb_agent_schedule_ue_spec = loaded_scheduler; - LOG_D(ENB_APP,"Delegated control for DL UE scheduler successfully\n"); - } - } - } long time_elapsed_nanos = timer_end(vartime); *msg = NULL; return 0; @@ -450,6 +431,20 @@ int enb_agent_destroy_control_delegation(Protocol__ProgranMessage *msg) { /*TODO: Dealocate memory for a dynamically allocated control delegation message*/ } +int enb_agent_reconfiguration(mid_t mod_id, const void *params, Protocol__ProgranMessage **msg) { + Protocol__ProgranMessage *input = (Protocol__ProgranMessage *)params; + Protocol__PrpAgentReconfiguration *agent_reconfiguration_msg = input->agent_reconfiguration_msg; + + apply_reconfiguration_policy(mod_id, agent_reconfiguration_msg->policy, strlen(agent_reconfiguration_msg->policy)); + + *msg = NULL; + return 0; +} + +int enb_agent_destroy_agent_reconfiguration(Protocol__ProgranMessage *msg) { + /*TODO: Dealocate memory for a dynamically allocated agent reconfiguration message*/ +} + /* * get generic info from RAN */ diff --git a/openair2/ENB_APP/enb_agent_common.h b/openair2/ENB_APP/enb_agent_common.h index 9b483ce4a0..18c9129989 100644 --- a/openair2/ENB_APP/enb_agent_common.h +++ b/openair2/ENB_APP/enb_agent_common.h @@ -114,6 +114,9 @@ int enb_agent_destroy_ue_state_change(Protocol__ProgranMessage *msg); int enb_agent_control_delegation(mid_t mod_id, const void *params, Protocol__ProgranMessage **msg); int enb_agent_destroy_control_delegation(Protocol__ProgranMessage *msg); +int enb_agent_reconfiguration(mid_t mod_id, const void *params, Protocol__ProgranMessage **msg); +int enb_agent_destroy_agent_reconfiguration(Protocol__ProgranMessage *msg); + Protocol__ProgranMessage* enb_agent_handle_message (mid_t mod_id, uint8_t *data, uint32_t size); diff --git a/openair2/ENB_APP/enb_agent_common_internal.c b/openair2/ENB_APP/enb_agent_common_internal.c new file mode 100644 index 0000000000..ca61a96609 --- /dev/null +++ b/openair2/ENB_APP/enb_agent_common_internal.c @@ -0,0 +1,400 @@ +/******************************************************************************* + OpenAirInterface + Copyright(c) 1999 - 2014 Eurecom + + OpenAirInterface is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + + OpenAirInterface is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with OpenAirInterface.The full GNU General Public License is + included in this distribution in the file called "COPYING". If not, + see . + + Contact Information + OpenAirInterface Admin: openair_admin@eurecom.fr + OpenAirInterface Tech : openair_tech@eurecom.fr + OpenAirInterface Dev : openair4g-devel@lists.eurecom.fr + + Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. + + *******************************************************************************/ + +/*! \file enb_agent_common_internal.c + * \brief internal functions for common message primitves and utilities + * \author Xenofon Foukas + * \date 2016 + * \version 0.1 + */ + +#include +#include + +#include "enb_agent_common_internal.h" +#include "enb_agent_mac_internal.h" + +int apply_reconfiguration_policy(mid_t mod_id, const char *policy, size_t policy_length) { + + yaml_parser_t parser; + yaml_event_t event; + + int done = 0; + int mapping_started = 0; + + LOG_I(ENB_APP, "Time to apply a new policy \n"); + + yaml_parser_initialize(&parser); + + yaml_parser_set_input_string(&parser, policy, strlen(policy)); + + while (!done) { + if (!yaml_parser_parse(&parser, &event)) + goto error; + + switch (event.type) { + case YAML_STREAM_START_EVENT: + case YAML_STREAM_END_EVENT: + case YAML_DOCUMENT_START_EVENT: + case YAML_DOCUMENT_END_EVENT: + break; + case YAML_MAPPING_START_EVENT: + mapping_started = 1; + break; + case YAML_MAPPING_END_EVENT: + mapping_started = 0; + break; + case YAML_SCALAR_EVENT: + // Check the system name and call the proper handler + if (strcmp(event.data.scalar.value, "mac") == 0) { + LOG_D(ENB_APP, "This is intended for the mac system\n"); + // Call the mac handler + if (parse_mac_config(mod_id, &parser) == -1) { + goto error; + } + } else if (strcmp(event.data.scalar.value, "rlc") == 0) { + // Call the RLC handler + LOG_D(ENB_APP, "This is intended for the rlc system\n"); + // TODO : Just skip it for now + if (skip_system_section(&parser) == -1) { + goto error; + } + } else if (strcmp(event.data.scalar.value, "pdcp") == 0) { + // Call the PDCP handler + LOG_D(ENB_APP, "This is intended for the pdcp system\n"); + // TODO : Just skip it for now + if (skip_system_section(&parser) == -1) { + goto error; + } + } else if (strcmp(event.data.scalar.value, "rrc") == 0) { + // Call the RRC handler + LOG_D(ENB_APP, "This is intended for the rrc system\n"); + // TODO : Just skip it for now + if (skip_system_section(&parser) == -1) { + goto error; + } + } else { + goto error; + } + break; + default: + // We are not expecting to find any other type of event at this level + // of the hierarchy + yaml_event_delete(&event); + goto error; + } + + done = (event.type == YAML_STREAM_END_EVENT); + + yaml_event_delete(&event); + } + + return 0; + + error: + yaml_parser_delete(&parser); + return -1; + +} + +int skip_system_section(yaml_parser_t *parser) { + yaml_event_t event; + + int done = 0; + + int sequence_started = 0; + int mapping_started = 0; + + while (!done) { + if (!yaml_parser_parse(parser, &event)) + goto error; + + switch (event.type) { + + case YAML_SEQUENCE_START_EVENT: + LOG_D(ENB_APP, "A sequence just started as expected\n"); + sequence_started = 1; + break; + case YAML_SEQUENCE_END_EVENT: + LOG_D(ENB_APP, "A sequence ended\n"); + sequence_started = 0; + break; + case YAML_MAPPING_START_EVENT: + if (!sequence_started) { + goto error; + } + LOG_D(ENB_APP, "A mapping started\n"); + mapping_started = 1; + break; + case YAML_MAPPING_END_EVENT: + if (!mapping_started) { + goto error; + } + LOG_D(ENB_APP, "A mapping ended\n"); + mapping_started = 0; + break; + case YAML_SCALAR_EVENT: + if (!mapping_started) { + goto error; + } + // Entered a subsystem section. Let's skip it + if (skip_subsystem_section(parser) == -1) { + goto error; + } + } + + done = (event.type == YAML_SEQUENCE_END_EVENT); + + yaml_event_delete(&event); + + } + + return 0; + + error: + yaml_event_delete(&event); + return -1; +} + +int skip_subsystem_section(yaml_parser_t *parser) { + + yaml_event_t event; + + int done = 0; + int mapping_started = 0; + + while (!done) { + if (!yaml_parser_parse(parser, &event)) + goto error; + + switch (event.type) { + case YAML_MAPPING_START_EVENT: + LOG_D(ENB_APP, "The mapping of the subsystem started\n"); + mapping_started = 1; + break; + case YAML_MAPPING_END_EVENT: + LOG_D(ENB_APP, "The mapping of the subsystem ended\n"); + mapping_started = 0; + break; + case YAML_SCALAR_EVENT: + if (!mapping_started) { + goto error; + } + // Check what key needs to be set + if (strcmp(event.data.scalar.value, "behavior") == 0) { + LOG_D(ENB_APP, "Skipping the behavior attribute\n"); + yaml_event_delete(&event); + if (!yaml_parser_parse(parser, &event)) { + goto error; + } + if (event.type == YAML_SCALAR_EVENT) { + break; + } else { + goto error; + } + } else if (strcmp(event.data.scalar.value, "parameters") == 0) { + LOG_D(ENB_APP, "Skipping the parameters for this subsystem\n"); + if (skip_subsystem_parameters_config(parser) == -1) { + goto error; + } + } + break; + default: + goto error; + } + + done = (event.type == YAML_MAPPING_END_EVENT); + yaml_event_delete(&event); + } + + return 0; + + error: + yaml_event_delete(&event); + return -1; +} + +int skip_subsystem_parameters_config(yaml_parser_t *parser) { + yaml_event_t event; + + void *param; + + int done = 0; + int mapping_started = 0; + + while (!done) { + + if (!yaml_parser_parse(parser, &event)) + goto error; + + switch (event.type) { + // We are expecting a mapping of parameters + case YAML_MAPPING_START_EVENT: + LOG_D(ENB_APP, "The mapping of the parameters started\n"); + mapping_started = 1; + break; + case YAML_MAPPING_END_EVENT: + LOG_D(ENB_APP, "The mapping of the parameters ended\n"); + mapping_started = 0; + break; + case YAML_SCALAR_EVENT: + if (!mapping_started) { + goto error; + } + // Check what key needs to be set + LOG_D(ENB_APP, "Skipping parameter %s\n", event.data.scalar.value); + if (skip_parameter_modification(parser) == -1 ) { + goto error; + } + break; + default: + goto error; + } + + done = (event.type == YAML_MAPPING_END_EVENT); + yaml_event_delete(&event); + } + + return 0; + + error: + yaml_event_delete(&event); + return -1; +} + + +int skip_parameter_modification(yaml_parser_t *parser) { + yaml_event_t event; + + int done = 0; + int is_array = 0; + int i = 0; + + while (!done) { + if (!yaml_parser_parse(parser, &event)) { + goto error; + } + + // Expecting either a scalar or a sequence + switch (event.type) { + case YAML_SEQUENCE_START_EVENT: + is_array = 1; + break; + case YAML_SCALAR_EVENT: + if ((strcmp(event.data.scalar.tag, YAML_INT_TAG) == 0) || + (strcmp(event.data.scalar.tag, YAML_FLOAT_TAG) == 0) || + (strcmp(event.data.scalar.tag, YAML_STR_TAG) == 0) || + (strcmp(event.data.scalar.tag, YAML_BOOL_TAG) == 0)) { + // Do nothing + } else { + // No other type is supported at the moment, so it should be considered an error + // if we reach here + goto error; + } + if (is_array) { + i++; + } else { + done = 1; + } + break; + case YAML_SEQUENCE_END_EVENT: + done = 1; + break; + default: + goto error; + } + yaml_event_delete(&event); + } + + return 0; + + error: + yaml_event_delete(&event); + return -1; +} + +int apply_parameter_modification(void *parameter, yaml_parser_t *parser) { + yaml_event_t event; + + int done = 0; + int is_array = 0; + int i = 0; + + char *endptr; + + while (!done) { + if (!yaml_parser_parse(parser, &event)) { + goto error; + } + + // Expecting either a scalar or a sequence + switch (event.type) { + case YAML_SEQUENCE_START_EVENT: + is_array = 1; + break; + case YAML_SCALAR_EVENT: + if (strcmp(event.data.scalar.tag, YAML_INT_TAG) == 0) { + ((int *) parameter)[i] = strtol(event.data.scalar.value, &endptr, 10); + } else if (strcmp(event.data.scalar.tag, YAML_FLOAT_TAG) == 0) { + ((float *) parameter)[i] = strtof(event.data.scalar.value, &endptr); + } else if (strcmp(event.data.scalar.tag, YAML_STR_TAG) == 0) { + strncpy(&((char *) parameter)[i], event.data.scalar.value, event.data.scalar.length); + } else if (strcmp(event.data.scalar.tag, YAML_BOOL_TAG) == 0) { + if (strcmp(event.data.scalar.value, "true") == 0) { + ((int *) parameter)[i] = 1; + } else { + ((int *) parameter)[i] = 0; + } + } else { + // No other type is supported at the moment, so it should be considered an error + // if we reach here + goto error; + } + if (is_array) { + i++; + } else { + done = 1; + } + break; + case YAML_SEQUENCE_END_EVENT: + done = 1; + break; + default: + goto error; + } + yaml_event_delete(&event); + } + + return 0; + + error: + yaml_event_delete(&event); + return -1; + +} diff --git a/openair2/ENB_APP/enb_agent_common_internal.h b/openair2/ENB_APP/enb_agent_common_internal.h new file mode 100644 index 0000000000..30fd51c5c8 --- /dev/null +++ b/openair2/ENB_APP/enb_agent_common_internal.h @@ -0,0 +1,64 @@ +/******************************************************************************* + OpenAirInterface + Copyright(c) 1999 - 2014 Eurecom + + OpenAirInterface is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + + OpenAirInterface is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with OpenAirInterface.The full GNU General Public License is + included in this distribution in the file called "COPYING". If not, + see . + + Contact Information + OpenAirInterface Admin: openair_admin@eurecom.fr + OpenAirInterface Tech : openair_tech@eurecom.fr + OpenAirInterface Dev : openair4g-devel@lists.eurecom.fr + + Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. + + *******************************************************************************/ + +/*! \file enb_agent_common_internal.h + * \brief internal agent functions for common message primitves and utilities + * \author Xenofon Foukas + * \date 2016 + * \version 0.1 + */ + +#ifndef ENB_AGENT_COMMON_INTERNAL_H_ +#define ENB_AGENT_COMMON_INTERNAL_H_ + +#include + +#include "enb_agent_defs.h" + +int apply_reconfiguration_policy(mid_t mod_id, const char *policy, size_t policy_length); + +int apply_parameter_modification(void *parameter, yaml_parser_t *parser); + +// This can be used when parsing for a specific system that is not yet implmeneted +// in order to skip its configuration, without affecting the rest +int skip_system_section(yaml_parser_t *parser); + +// This can be used when parsing for a specific subsystem that is not yet implmeneted +// in order to skip its configuration, without affecting the rest +int skip_subsystem_section(yaml_parser_t *parser); + +// This can be used when parsing for the parameters of a specific subsystem +//that is not yet implmeneted in order to skip its configuration, without affecting the rest +int skip_subsystem_parameters_config(yaml_parser_t *parser); + +// This can be used when configuring the parameters of a specific subsystem +//that is not yet implmeneted in order to skip its configuration, without affecting the rest +int skip_parameter_modification(yaml_parser_t *parser); + +#endif diff --git a/openair2/ENB_APP/enb_agent_handler.c b/openair2/ENB_APP/enb_agent_handler.c index 721b3678f8..da53343818 100644 --- a/openair2/ENB_APP/enb_agent_handler.c +++ b/openair2/ENB_APP/enb_agent_handler.c @@ -58,7 +58,7 @@ enb_agent_message_decoded_callback agent_messages_callback[][3] = { {enb_agent_mac_handle_dl_mac_config, 0, 0}, /*PROTOCOL__PROGRAN_MESSAGE__MSG_DL_MAC_CONFIG_MSG*/ {0, 0, 0}, /*PROTOCOL__PROGRAN_MESSAGE__MSG_UE_STATE_CHANGE_MSG*/ {enb_agent_control_delegation, 0, 0}, /*PROTOCOL__PROGRAN_MESSAGE__MSG_CONTROL_DELEGATION_MSG*/ - + {enb_agent_reconfiguration, 0, 0}, /*PROTOCOL__PROGRAN_MESSAGE__MSG_AGENT_RECONFIGURATION_MSG*/ }; enb_agent_message_destruction_callback message_destruction_callback[] = { @@ -78,6 +78,7 @@ enb_agent_message_destruction_callback message_destruction_callback[] = { enb_agent_mac_destroy_dl_config, enb_agent_destroy_ue_state_change, enb_agent_destroy_control_delegation, + enb_agent_destroy_agent_reconfiguration, }; static const char *enb_agent_direction2String[] = { diff --git a/openair2/ENB_APP/enb_agent_mac.c b/openair2/ENB_APP/enb_agent_mac.c index fb9ae7322f..744768135e 100644 --- a/openair2/ENB_APP/enb_agent_mac.c +++ b/openair2/ENB_APP/enb_agent_mac.c @@ -1391,6 +1391,8 @@ int enb_agent_register_mac_xface(mid_t mod_id, AGENT_MAC_xface *xface) { xface->enb_agent_schedule_ue_spec = schedule_ue_spec_remote; xface->enb_agent_get_pending_dl_mac_config = enb_agent_get_pending_dl_mac_config; xface->enb_agent_notify_ue_state_change = enb_agent_ue_state_change; + + xface->dl_scheduler_loaded_lib = NULL; mac_agent_registered[mod_id] = 1; agent_mac_xface[mod_id] = xface; @@ -1408,6 +1410,8 @@ int enb_agent_unregister_mac_xface(mid_t mod_id, AGENT_MAC_xface *xface) { xface->enb_agent_get_pending_dl_mac_config = NULL; xface->enb_agent_notify_ue_state_change = NULL; + xface->dl_scheduler_loaded_lib = NULL; + mac_agent_registered[mod_id] = 0; agent_mac_xface[mod_id] = NULL; diff --git a/openair2/ENB_APP/enb_agent_mac_defs.h b/openair2/ENB_APP/enb_agent_mac_defs.h index c5a3204f0c..1511ee7262 100644 --- a/openair2/ENB_APP/enb_agent_mac_defs.h +++ b/openair2/ENB_APP/enb_agent_mac_defs.h @@ -74,6 +74,8 @@ typedef struct { void (*enb_agent_notify_ue_state_change)(mid_t mod_id, uint32_t rnti, uint32_t state_change); + + void *dl_scheduler_loaded_lib; /*TODO: Fill in with the rest of the MAC layer technology specific callbacks (UL/DL scheduling, RACH info etc)*/ } AGENT_MAC_xface; diff --git a/openair2/ENB_APP/enb_agent_mac_internal.c b/openair2/ENB_APP/enb_agent_mac_internal.c index c3cc584bcd..aa7482bd90 100644 --- a/openair2/ENB_APP/enb_agent_mac_internal.c +++ b/openair2/ENB_APP/enb_agent_mac_internal.c @@ -34,6 +34,9 @@ * \version 0.1 */ +#include +#include + #include "enb_agent_mac_internal.h" Protocol__ProgranMessage * enb_agent_generate_diff_mac_stats_report(Protocol__ProgranMessage *new_message, @@ -558,3 +561,235 @@ Protocol__PrpNoiseInterferenceReport * copy_noise_inter_report(Protocol__PrpNois error: return NULL; } + + +int parse_mac_config(mid_t mod_id, yaml_parser_t *parser) { + + yaml_event_t event; + + int done = 0; + + int sequence_started = 0; + int mapping_started = 0; + + while (!done) { + + if (!yaml_parser_parse(parser, &event)) + goto error; + + switch (event.type) { + case YAML_SEQUENCE_START_EVENT: + LOG_I(ENB_APP, "A sequence just started as expected\n"); + sequence_started = 1; + break; + case YAML_SEQUENCE_END_EVENT: + LOG_I(ENB_APP, "A sequence ended\n"); + sequence_started = 0; + break; + case YAML_MAPPING_START_EVENT: + if (!sequence_started) { + goto error; + } + LOG_I(ENB_APP, "A mapping started\n"); + mapping_started = 1; + break; + case YAML_MAPPING_END_EVENT: + if (!mapping_started) { + goto error; + } + LOG_I(ENB_APP, "A mapping ended\n"); + mapping_started = 0; + break; + case YAML_SCALAR_EVENT: + if (!mapping_started) { + goto error; + } + // Check the types of subsystems offered and handle their values accordingly + if (strcmp(event.data.scalar.value, "dl_scheduler") == 0) { + LOG_I(ENB_APP, "This is for the dl_scheduler subsystem\n"); + // Call the proper handler + if (parse_dl_scheduler_config(mod_id, parser) == -1) { + LOG_I(ENB_APP, "An error occured\n"); + goto error; + } + } else if (strcmp(event.data.scalar.value, "ul_scheduler") == 0) { + // Call the proper handler + LOG_I(ENB_APP, "This is for the ul_scheduler subsystem\n"); + goto error; + // TODO + } else if (strcmp(event.data.scalar.value, "ra_scheduler") == 0) { + // Call the proper handler + // TODO + } else if (strcmp(event.data.scalar.value, "page_scheduler") == 0) { + // Call the proper handler + // TODO + } else { + // Unknown subsystem + goto error; + } + break; + default: // We expect nothing else at this level of the hierarchy + goto error; + } + + done = (event.type == YAML_SEQUENCE_END_EVENT); + + yaml_event_delete(&event); + + } + + return 0; + + error: + yaml_event_delete(&event); + return -1; + +} + +int parse_dl_scheduler_config(mid_t mod_id, yaml_parser_t *parser) { + + yaml_event_t event; + + int done = 0; + int mapping_started = 0; + + while (!done) { + + if (!yaml_parser_parse(parser, &event)) + goto error; + + switch (event.type) { + // We are expecting a mapping (behavior and parameters) + case YAML_MAPPING_START_EVENT: + LOG_D(ENB_APP, "The mapping of the subsystem started\n"); + mapping_started = 1; + break; + case YAML_MAPPING_END_EVENT: + LOG_D(ENB_APP, "The mapping of the subsystem ended\n"); + mapping_started = 0; + break; + case YAML_SCALAR_EVENT: + if (!mapping_started) { + goto error; + } + // Check what key needs to be set + if (strcmp(event.data.scalar.value, "behavior") == 0) { + LOG_D(ENB_APP, "Time to set the behavior attribute\n"); + yaml_event_delete(&event); + if (!yaml_parser_parse(parser, &event)) { + goto error; + } + if (event.type == YAML_SCALAR_EVENT) { + if (load_dl_scheduler_function(mod_id, event.data.scalar.value) == -1) { + goto error; + } + } else { + goto error; + } + } else if (strcmp(event.data.scalar.value, "parameters") == 0) { + LOG_D(ENB_APP, "Now it is time to set the parameters for this subsystem\n"); + if (parse_dl_scheduler_parameters(mod_id, parser) == -1) { + goto error; + } + } + break; + default: + goto error; + } + + done = (event.type == YAML_MAPPING_END_EVENT); + yaml_event_delete(&event); + } + + return 0; + + error: + yaml_event_delete(&event); + return -1; +} + +int parse_dl_scheduler_parameters(mid_t mod_id, yaml_parser_t *parser) { + yaml_event_t event; + + void *param; + + int done = 0; + int mapping_started = 0; + + while (!done) { + + if (!yaml_parser_parse(parser, &event)) + goto error; + + switch (event.type) { + // We are expecting a mapping of parameters + case YAML_MAPPING_START_EVENT: + LOG_D(ENB_APP, "The mapping of the parameters started\n"); + mapping_started = 1; + break; + case YAML_MAPPING_END_EVENT: + LOG_D(ENB_APP, "The mapping of the parameters ended\n"); + mapping_started = 0; + break; + case YAML_SCALAR_EVENT: + if (!mapping_started) { + goto error; + } + // Check what key needs to be set + if (mac_agent_registered[mod_id]) { + LOG_D(ENB_APP, "Setting parameter %s\n", event.data.scalar.value); + param = dlsym(agent_mac_xface[mod_id]->dl_scheduler_loaded_lib, + event.data.scalar.value); + if (param == NULL) { + goto error; + } + apply_parameter_modification(param, parser); + } else { + goto error; + } + break; + default: + goto error; + } + + done = (event.type == YAML_MAPPING_END_EVENT); + yaml_event_delete(&event); + } + + return 0; + + error: + yaml_event_delete(&event); + return -1; +} + +int load_dl_scheduler_function(mid_t mod_id, const char *function_name) { + void *lib; + + char lib_name[120]; + char target[512]; + sprintf(lib_name, sizeof(lib_name), "/%s.so", function_name); + strcpy(target, local_cache); + strcat(target, lib_name); + + lib = dlopen(target, RTLD_NOW); + if (lib == NULL) { + goto error; + } + + void *loaded_scheduler = dlsym(lib, function_name); + if (loaded_scheduler) { + if (mac_agent_registered[mod_id]) { + agent_mac_xface[mod_id]->enb_agent_schedule_ue_spec = loaded_scheduler; + dlclose(agent_mac_xface[mod_id]->dl_scheduler_loaded_lib); + agent_mac_xface[mod_id]->dl_scheduler_loaded_lib = lib; + LOG_D(ENB_APP, "Delegated control for DL UE scheduler succesfully\n"); + } + } + + return 0; + + error: + return -1; + +} diff --git a/openair2/ENB_APP/enb_agent_mac_internal.h b/openair2/ENB_APP/enb_agent_mac_internal.h index 394d3e7730..4a76f0ed38 100644 --- a/openair2/ENB_APP/enb_agent_mac_internal.h +++ b/openair2/ENB_APP/enb_agent_mac_internal.h @@ -39,9 +39,11 @@ #include +#include + #include "enb_agent_mac.h" #include "enb_agent_common.h" - +#include "enb_agent_defs.h" /*This will be used for producing continuous status updates for the MAC *Needs to be thread-safe @@ -98,4 +100,15 @@ int compare_ue_stats_reports(Protocol__PrpUeStatsReport *rep1, int compare_cell_stats_reports(Protocol__PrpCellStatsReport *rep1, Protocol__PrpCellStatsReport *rep2); + +/* Functions for parsing the MAC agent policy reconfiguration command */ + +int parse_mac_config(mid_t mod_id, yaml_parser_t *parser); + +int parse_dl_scheduler_config(mid_t mod_id, yaml_parser_t *parser); + +int parse_dl_scheduler_parameters(mid_t mod_id, yaml_parser_t *parser); + +int load_dl_scheduler_function(mid_t mod_id, const char *function_name); + #endif /*ENB_AGENT_MAC_INTERNAL_H_*/ diff --git a/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue_remote.c b/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue_remote.c index ad8b130584..d8d2373332 100644 --- a/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue_remote.c +++ b/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue_remote.c @@ -37,6 +37,8 @@ */ +#include "enb_agent_common_internal.h" + #include "eNB_agent_scheduler_dlsch_ue_remote.h" #include "LAYER2/MAC/defs.h" @@ -46,9 +48,25 @@ struct DlMacConfigHead queue_head; int queue_initialized = 0; +//uint32_t skip_subframe = 1; +//uint32_t period = 10; +//uint32_t sched [] = {1, 2, 3}; + void schedule_ue_spec_remote(mid_t mod_id, uint32_t frame, uint32_t subframe, int *mbsfn_flag, Protocol__ProgranMessage **dl_info) { + + //if ((subframe == skip_subframe) && (frame % period == 0)) { + // LOG_I(MAC, "Will skip subframe %d %d\n", subframe, frame); + // for (int i = 0; i < 3; i++) { + // LOG_I(MAC, "%d\n", sched[i]); + // } + //} + + /* if (frame == 500 && subframe == 1) { */ + /* char policy[] = "rrc: \n - ul_scheduler: \n behavior : tester_function\n parameters:\n period: !!int 3\nmac: \n - dl_scheduler: \n parameters: \n period : !!int 40\n skip_subframe : !!int 3\n sched : [!!int 4, !!int 5, !!int 6]"; */ + /* apply_reconfiguration_policy(mod_id, policy, strlen(policy)); */ + /* } */ eNB_MAC_INST *eNB; From 345a9382f282cda9dd68a4e2d2a865f4e60ad15f Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Thu, 14 Apr 2016 14:50:22 +0100 Subject: [PATCH 170/349] Fixed bug of local agent scheduler that did not allow the retransmission in HARQ processes --- openair2/LAYER2/MAC/defs.h | 6 ++++ .../MAC/eNB_agent_scheduler_dataplane.c | 2 -- .../LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c | 33 ++++++++++--------- 3 files changed, 24 insertions(+), 17 deletions(-) diff --git a/openair2/LAYER2/MAC/defs.h b/openair2/LAYER2/MAC/defs.h index 7c0561121d..60c095fa14 100644 --- a/openair2/LAYER2/MAC/defs.h +++ b/openair2/LAYER2/MAC/defs.h @@ -609,6 +609,12 @@ typedef struct { /// Flag to indicate UE has been configured (ACK from RRCConnectionSetup received) boolean_t configured; + /// MCS from last scheduling + uint8_t mcs[8]; + + /// TPC from last scheduling + uint8_t oldTPC[8]; + // PHY interface info /// DCI format for DLSCH diff --git a/openair2/LAYER2/MAC/eNB_agent_scheduler_dataplane.c b/openair2/LAYER2/MAC/eNB_agent_scheduler_dataplane.c index 4642f9be00..b2a66bfe2d 100644 --- a/openair2/LAYER2/MAC/eNB_agent_scheduler_dataplane.c +++ b/openair2/LAYER2/MAC/eNB_agent_scheduler_dataplane.c @@ -324,8 +324,6 @@ void apply_ue_spec_scheduling_decisions(mid_t mod_id, nb_rb += get_min_rb_unit(mod_id, CC_id); stats_tbs = mac_xface->get_TBS_DL(dl_dci->mcs[0], nb_rb); } - - UE_list->UE_template[CC_id][UE_id].nb_rb[dl_dci->harq_process] = nb_rb; UE_list->eNB_UE_stats[CC_id][UE_id].rbs_used = nb_rb; UE_list->eNB_UE_stats[CC_id][UE_id].total_rbs_used += nb_rb; diff --git a/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c b/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c index 5031867394..79716af854 100644 --- a/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c +++ b/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c @@ -137,7 +137,7 @@ schedule_ue_spec_default( VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_SCHEDULE_DLSCH,VCD_FUNCTION_IN); //weight = get_ue_weight(module_idP,UE_id); - aggregation = 1; // set to the maximum aggregation level + aggregation = 2; // set to the maximum aggregation level for (CC_id=0; CC_idN_RBG; j++) { UE_list->UE_template[CC_id][UE_id].rballoc_subband[harq_pid][j] = 0; + rballoc_sub[j] = 0; } LOG_D(MAC,"[eNB %d] Frame %d: Scheduling UE %d on CC_id %d (rnti %x, harq_pid %d, round %d, rb %d, cqi %d, mcs %d, rrc %d)\n", @@ -269,13 +270,6 @@ schedule_ue_spec_default( if (round > 0) { - mcs = UE_list->eNB_UE_stats[CC_id][UE_id].dlsch_mcs1; - - // get freq_allocation - nb_rb = UE_list->UE_template[CC_id][UE_id].nb_rb[harq_pid]; - - dci_tbs = mac_xface->get_TBS_DL(mcs, nb_rb); - if (frame_parms[CC_id]->frame_type == TDD) { UE_list->UE_template[CC_id][UE_id].DAI++; update_ul_dci(mod_id, CC_id, rnti, UE_list->UE_template[CC_id][UE_id].DAI); @@ -283,6 +277,13 @@ schedule_ue_spec_default( CC_id, subframe,UE_id,UE_list->UE_template[CC_id][UE_id].DAI); } + mcs = UE_list->UE_template[CC_id][UE_id].mcs[harq_pid]; + + // get freq_allocation + nb_rb = UE_list->UE_template[CC_id][UE_id].nb_rb[harq_pid]; + + dci_tbs = mac_xface->get_TBS_DL(mcs, nb_rb); + if (nb_rb <= nb_available_rb) { if(nb_rb == ue_sched_ctl->pre_nb_available_rbs[CC_id]) { @@ -296,6 +297,7 @@ schedule_ue_spec_default( while((nb_rb_temp > 0) && (j < frame_parms[CC_id]->N_RBG)) { if(ue_sched_ctl->rballoc_sub_UE[CC_id][j] == 1) { UE_list->UE_template[CC_id][UE_id].rballoc_subband[harq_pid][j] = ue_sched_ctl->rballoc_sub_UE[CC_id][j]; + if((j == frame_parms[CC_id]->N_RBG-1) && ((frame_parms[CC_id]->N_RB_DL == 25)|| (frame_parms[CC_id]->N_RB_DL == 50))) { @@ -316,21 +318,20 @@ schedule_ue_spec_default( for(j=0; jN_RBG; j++) { PHY_vars_eNB_g[mod_id][CC_id]->mu_mimo_mode[UE_id].rballoc_sub[j] = UE_list->UE_template[CC_id][UE_id].rballoc_subband[harq_pid][j]; + rballoc_sub[j] = UE_list->UE_template[CC_id][UE_id].rballoc_subband[harq_pid][j]; } - for(i=0; ilte_frame_parms.N_RBG; i++) { - rballoc_sub[i] = UE_list->UE_template[CC_id][UE_id].rballoc_subband[harq_pid][i]; - } - // Keep the old NDI, do not toggle ndi = UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]; - tpc = 1; - + tpc = UE_list->UE_template[CC_id][UE_id].oldTPC[harq_pid]; + UE_list->UE_template[CC_id][UE_id].mcs[harq_pid] = mcs; + ue_has_transmission = 1; num_ues_added++; } else { LOG_D(MAC,"[eNB %d] Frame %d CC_id %d : don't schedule UE %d, its retransmission takes more resources than we have\n", mod_id, frame, CC_id, UE_id); + ue_has_transmission = 0; } //End of retransmission } else { /* This is a potentially new SDU opportunity */ @@ -516,7 +517,6 @@ schedule_ue_spec_default( UE_list->UE_template[CC_id][UE_id].nb_rb[harq_pid] = nb_rb; - if (frame_parms[CC_id]->frame_type == TDD) { UE_list->UE_template[CC_id][UE_id].DAI++; // printf("DAI update: subframeP %d: UE %d, DAI %d\n",subframeP,UE_id,UE_list->UE_template[CC_id][UE_id].DAI); @@ -572,6 +572,9 @@ schedule_ue_spec_default( UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]= 1 - UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]; ndi = UE_list->UE_template[CC_id][UE_id].oldNDI[harq_pid]; + UE_list->UE_template[CC_id][UE_id].mcs[harq_pid] = mcs; + UE_list->UE_template[CC_id][UE_id].oldTPC[harq_pid] = tpc; + // Increase the pointer for the number of scheduled UEs num_ues_added++; ue_has_transmission = 1; From d4fd08785de065bada51f123b379bb2ccd7ba1a7 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Thu, 14 Apr 2016 14:51:00 +0100 Subject: [PATCH 171/349] Modified eNB conf file for USRP to use 50 rbs --- .../CONF/enb.band5.agent.usrpb210.epc.remote.conf | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band5.agent.usrpb210.epc.remote.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band5.agent.usrpb210.epc.remote.conf index 8936b2eb24..59aec03872 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band5.agent.usrpb210.epc.remote.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band5.agent.usrpb210.epc.remote.conf @@ -30,7 +30,7 @@ eNBs = downlink_frequency = 879000000L; uplink_frequency_offset = -45000000; Nid_cell = 0; - N_RB_DL = 25; + N_RB_DL = 50; Nid_cell_mbsfn = 0; nb_antennas_tx = 1; nb_antennas_rx = 1; @@ -131,24 +131,24 @@ eNBs = }; ////////// MME parameters: - mme_ip_address = ( {ipv4 = "192.168.100.103"; + mme_ip_address = ( {ipv4 = "192.168.100.102"; ipv6="192:168:30::17"; active="yes"; preference="ipv4";}); NETWORK_INTERFACES : { - ENB_INTERFACE_NAME_FOR_S1_MME = "eth0:1"; - ENB_IPV4_ADDRESS_FOR_S1_MME = "192.168.100.102/24"; + ENB_INTERFACE_NAME_FOR_S1_MME = "eth2:1"; + ENB_IPV4_ADDRESS_FOR_S1_MME = "192.168.100.103/24"; - ENB_INTERFACE_NAME_FOR_S1U = "eth0:1"; - ENB_IPV4_ADDRESS_FOR_S1U = "192.168.100.102/24"; + ENB_INTERFACE_NAME_FOR_S1U = "eth2:1"; + ENB_IPV4_ADDRESS_FOR_S1U = "192.168.100.103/24"; ENB_PORT_FOR_S1U = 2152; # Spec 2152 }; NETWORK_CONTROLLER : { - ENB_AGENT_INTERFACE_NAME = "eth1"; + ENB_AGENT_INTERFACE_NAME = "eth0"; ENB_AGENT_IPV4_ADDRESS = "10.0.0.5/30"; ENB_AGENT_PORT = 2210; ENB_AGENT_CACHE = "/mnt/oai_agent_cache"; From 673ef5fa7a8748bc2553834f2b1ed3c1bc41c3b2 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Thu, 14 Apr 2016 15:13:15 +0100 Subject: [PATCH 172/349] Modified active harq reporting mechanism to support long schedule ahead of time values --- openair1/SCHED/defs.h | 5 + openair1/SCHED/phy_procedures_lte_eNb.c | 109 +++++++++++++++------- openair2/ENB_APP/enb_agent_common.c | 3 +- openair2/LAYER2/MAC/eNB_scheduler_RA.c | 2 +- openair2/LAYER2/MAC/eNB_scheduler_ulsch.c | 2 +- openair2/LAYER2/MAC/pre_processor.c | 4 +- 6 files changed, 84 insertions(+), 41 deletions(-) diff --git a/openair1/SCHED/defs.h b/openair1/SCHED/defs.h index 8692a31f12..72830f35cb 100644 --- a/openair1/SCHED/defs.h +++ b/openair1/SCHED/defs.h @@ -81,6 +81,11 @@ enum openair_SYNCH_STATUS { openair_SCHED_EXIT }; +enum openair_HARQ_TYPE { + openair_harq_DL = 0, + openair_harq_UL, + openair_harq_RA +}; #define DAQ_AGC_ON 1 #define DAQ_AGC_OFF 0 diff --git a/openair1/SCHED/phy_procedures_lte_eNb.c b/openair1/SCHED/phy_procedures_lte_eNb.c index 15cd98881d..ba180e781f 100755 --- a/openair1/SCHED/phy_procedures_lte_eNb.c +++ b/openair1/SCHED/phy_procedures_lte_eNb.c @@ -29,11 +29,11 @@ /*! \file phy_procedures_lte_eNB.c * \brief Implementation of eNB procedures from 36.213 LTE specifications - * \author R. Knopp, F. Kaltenberger, N. Nikaein + * \author R. Knopp, F. Kaltenberger, N. Nikaein, X. Foukas * \date 2011 * \version 0.1 * \company Eurecom - * \email: knopp@eurecom.fr,florian.kaltenberger@eurecom.fr,navid.nikaein@eurecom.fr + * \email: knopp@eurecom.fr,florian.kaltenberger@eurecom.fr,navid.nikaein@eurecom.fr, x.foukas@sms.ed.ac.uk * \note * \warning */ @@ -141,26 +141,23 @@ uint8_t is_SR_subframe(PHY_VARS_eNB *phy_vars_eNB,uint8_t UE_id,uint8_t sched_su void put_harq_pid_in_freelist(LTE_eNB_DLSCH_t *DLSCH_ptr, int harq_pid) { - DLSCH_ptr->harq_pid_freelist[DLSCH_ptr->tail_freelist] = harq_pid; - DLSCH_ptr->tail_freelist = (DLSCH_ptr->tail_freelist + 1) % 10; + if (harq_pid >=0 && harq_pid < 8) { + DLSCH_ptr->harq_pid_freelist[harq_pid] = 1; + } else { + LOG_E(PHY, "%s:%d: critical error, get in touch with the authors\n", __FILE__, __LINE__); + abort(); + } } void remove_harq_pid_from_freelist(LTE_eNB_DLSCH_t *DLSCH_ptr, int harq_pid) { - if (DLSCH_ptr->head_freelist == DLSCH_ptr->tail_freelist) { - LOG_E(PHY, "%s:%d: you cannot read this!\n", __FILE__, __LINE__); - abort(); - } - /* basic check, in case several threads deal with the free list at the same time - * in normal situations it should not happen, that's also why we don't use any - * locking mechanism to protect the free list - * to be refined in case things don't work properly - */ - if (harq_pid != DLSCH_ptr->harq_pid_freelist[DLSCH_ptr->head_freelist]) { + + if (harq_pid >=0 && harq_pid < 8) { + DLSCH_ptr->harq_pid_freelist[harq_pid] = 0; + } else { LOG_E(PHY, "%s:%d: critical error, get in touch with the authors\n", __FILE__, __LINE__); abort(); } - DLSCH_ptr->head_freelist = (DLSCH_ptr->head_freelist + 1) % 10; } int32_t add_ue(int16_t rnti, PHY_VARS_eNB *phy_vars_eNB) @@ -257,12 +254,17 @@ int8_t find_next_ue_index(PHY_VARS_eNB *phy_vars_eNB) return(-1); } -int get_ue_active_harq_pid(const uint8_t Mod_id,const uint8_t CC_id,const uint16_t rnti, const int frame, const uint8_t subframe,uint8_t *harq_pid,uint8_t *round,const uint8_t ul_flag) +int prev_frame = -1; +int prev_subframe = -1; +int prev_harq_pid = 0; +int prev_harq_round = 0; + +int get_ue_active_harq_pid(const uint8_t Mod_id,const uint8_t CC_id,const uint16_t rnti, const int frame, const uint8_t subframe,uint8_t *harq_pid,uint8_t *round,const uint8_t harq_flag) { LTE_eNB_DLSCH_t *DLSCH_ptr; LTE_eNB_ULSCH_t *ULSCH_ptr; uint8_t ulsch_subframe,ulsch_frame; - uint8_t i; + uint8_t i, j; int8_t UE_id = find_ue(rnti,PHY_vars_eNB_g[Mod_id][CC_id]); int sf1=(10*frame)+subframe,sf2,sfdiff,sfdiff_max=7; @@ -272,39 +274,74 @@ int get_ue_active_harq_pid(const uint8_t Mod_id,const uint8_t CC_id,const uint16 return(-1); } - if (ul_flag == 0) {// this is a DL request + if ((harq_flag == openair_harq_DL) || (harq_flag == openair_harq_RA)) {// this is a DL request + DLSCH_ptr = PHY_vars_eNB_g[Mod_id][CC_id]->dlsch_eNB[(uint32_t)UE_id][0]; + if (harq_flag == openair_harq_RA) { + if (DLSCH_ptr->harq_processes[0] != NULL) { + *harq_pid = 0; + *round = DLSCH_ptr->harq_processes[0]->round; + return 0; + } else { + return -1; + } + } + + if (prev_frame == frame && prev_subframe == subframe) { + *harq_pid = prev_harq_pid; + *round = prev_harq_round; + return (0); + } + // set to no available process first *harq_pid = -1; - for (i=0; iMdlharq; i++) { - if (DLSCH_ptr->harq_processes[i]!=NULL) { - if (DLSCH_ptr->harq_processes[i]->status == ACTIVE) { - sf2 = (DLSCH_ptr->harq_processes[i]->frame*10) + DLSCH_ptr->harq_processes[i]->subframe; - if (sf2<=sf1) - sfdiff = sf1-sf2; - else // this happens when wrapping around 1024 frame barrier - sfdiff = 10240 + sf1-sf2; - LOG_D(PHY,"process %d is active, round %d (waiting %d)\n",i,DLSCH_ptr->harq_processes[i]->round,sfdiff); + j = prev_harq_pid; - if (sfdiff>sfdiff_max) { // this is an active process that is waiting longer than the others (and longer than 7 ms) - sfdiff_max = sfdiff; - *harq_pid = i; - *round = DLSCH_ptr->harq_processes[i]->round; + for (i = 0; i < 8; i++) { + j = (j + 1) % 8; + if (DLSCH_ptr->harq_processes[j] != NULL) { + if (DLSCH_ptr->harq_processes[j]->status == ACTIVE) { + sf2 = (DLSCH_ptr->harq_processes[j]->frame*10) + DLSCH_ptr->harq_processes[j]->subframe; + if (sf2<=sf1) { + sfdiff = sf1-sf2; + } else { // this happens when wrapping around 1024 frame barrier + sfdiff = 10240 + sf1-sf2; + } + LOG_D(PHY,"process %d is active, round %d (waiting %d)\n",i,DLSCH_ptr->harq_processes[j]->round,sfdiff); + if (sfdiff > sfdiff_max) { + prev_harq_pid = j; + prev_harq_round = DLSCH_ptr->harq_processes[j]->round; + prev_frame = frame; + prev_subframe = subframe; + *harq_pid = j; + *round = DLSCH_ptr->harq_processes[j]->round; + LOG_D(PHY,"process %d, %d is the allocated process\n", *harq_pid, *round); + return 0; + } + } else { // Send from the freelist + if (DLSCH_ptr->harq_pid_freelist[j] == 1) { + *harq_pid = j; + *round = 0; + prev_harq_pid = *harq_pid; + prev_harq_round = *round; + prev_frame = frame; + prev_subframe = subframe; + LOG_D(PHY,"process %d is first free process\n", *harq_pid); + return 0; } } - } else { // a process is not defined + } else { LOG_E(PHY,"[eNB %d] DLSCH process %d for rnti %x (UE_id %d) not allocated\n",Mod_id,i,rnti,UE_id); return(-1); } } - /* if no active harq pid, get the oldest in the freelist, if any */ - if (*harq_pid == 255 && DLSCH_ptr->head_freelist != DLSCH_ptr->tail_freelist) { - *harq_pid = DLSCH_ptr->harq_pid_freelist[DLSCH_ptr->head_freelist]; + if (*harq_pid == 255) { *round = 0; - LOG_D(PHY,"process %d is first free process\n", *harq_pid); + LOG_I(PHY, "TEST, no process found\n"); + return -1; } LOG_D(PHY,"get_ue_active_harq_pid DL => Frame %d, Subframe %d : harq_pid %d\n", diff --git a/openair2/ENB_APP/enb_agent_common.c b/openair2/ENB_APP/enb_agent_common.c index e21c180cec..e3c2bcfcb5 100644 --- a/openair2/ENB_APP/enb_agent_common.c +++ b/openair2/ENB_APP/enb_agent_common.c @@ -43,6 +43,7 @@ #include "PHY/extern.h" #include "log.h" +#include "SCHED/defs.h" #include "RRC/LITE/extern.h" #include "RRC/L2_INTERFACE/openair_rrc_L2_interface.h" #include "rrc_eNB_UE_context.h" @@ -671,7 +672,7 @@ int get_harq(const mid_t mod_id, const uint8_t CC_id, const mid_t ue_id, const i uint16_t rnti = get_ue_crnti(mod_id,ue_id); - mac_xface->get_ue_active_harq_pid(mod_id,CC_id,rnti,frame,subframe,&harq_pid,&round,0); + mac_xface->get_ue_active_harq_pid(mod_id,CC_id,rnti,frame,subframe,&harq_pid,&round,openair_harq_DL); *id = harq_pid; if (round > 0) { diff --git a/openair2/LAYER2/MAC/eNB_scheduler_RA.c b/openair2/LAYER2/MAC/eNB_scheduler_RA.c index 8cb6b91301..a4b7339677 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler_RA.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_RA.c @@ -661,7 +661,7 @@ void schedule_RA(module_id_t module_idP,frame_t frameP, sub_frame_t subframeP,un LOG_I(MAC,"[eNB %d][RAPROC] CC_id %d Frame %d, subframeP %d: Checking if Msg4 was acknowledged: \n", module_idP,CC_id,frameP,subframeP); // Get candidate harq_pid from PHY - mac_xface->get_ue_active_harq_pid(module_idP,CC_id,RA_template->rnti,frameP,subframeP,&harq_pid,&round,0); + mac_xface->get_ue_active_harq_pid(module_idP,CC_id,RA_template->rnti,frameP,subframeP,&harq_pid,&round,openair_harq_RA); if (round>0) { //RA_template->wait_ack_Msg4++; diff --git a/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c b/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c index e6033d5057..17a8cec5db 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c @@ -753,7 +753,7 @@ void schedule_ulsch_rnti(module_id_t module_idP, DCI_pdu = &eNB->common_channels[CC_id].DCI_pdu; UE_template = &UE_list->UE_template[CC_id][UE_id]; - if (mac_xface->get_ue_active_harq_pid(module_idP,CC_id,rnti,frameP,subframeP,&harq_pid,&round,1) == -1 ) { + if (mac_xface->get_ue_active_harq_pid(module_idP,CC_id,rnti,frameP,subframeP,&harq_pid,&round,openair_harq_UL) == -1 ) { LOG_W(MAC,"[eNB %d] Scheduler Frame %d, subframeP %d: candidate harq_pid from PHY for UE %d CC %d RNTI %x\n", module_idP,frameP,subframeP, UE_id, CC_id, rnti); // NN --> RK: Don't schedule UE if we cannot get harq pid diff --git a/openair2/LAYER2/MAC/pre_processor.c b/openair2/LAYER2/MAC/pre_processor.c index c744d1d90a..64ae2d9453 100644 --- a/openair2/LAYER2/MAC/pre_processor.c +++ b/openair2/LAYER2/MAC/pre_processor.c @@ -760,7 +760,7 @@ void dlsch_scheduler_pre_processor_reset (int module_idP, frameP,subframeP, &ue_sched_ctl->harq_pid[CC_id], &ue_sched_ctl->round[CC_id], - 0); + openair_harq_DL); if (ue_sched_ctl->ta_timer == 0) { // WE SHOULD PROTECT the eNB_UE_stats with a mutex here ... @@ -1020,7 +1020,7 @@ void ulsch_scheduler_pre_processor(module_id_t module_idP, // This is the actual CC_id in the list CC_id = UE_list->ordered_ULCCids[n][UE_id]; - mac_xface->get_ue_active_harq_pid(module_idP,CC_id,rnti,frameP,subframeP,&harq_pid,&round,1); + mac_xface->get_ue_active_harq_pid(module_idP,CC_id,rnti,frameP,subframeP,&harq_pid,&round,openair_harq_UL); if(round>0) { nb_allocated_rbs[CC_id][UE_id] = UE_list->UE_template[CC_id][UE_id].nb_rb_ul[harq_pid]; From bad4b7940a3ee92c281c9e87951ab17c3e4da1c1 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Fri, 15 Apr 2016 12:17:36 +0100 Subject: [PATCH 173/349] Fixed bug when delegating control when delegated lib was previously NULL --- openair2/ENB_APP/enb_agent_mac_internal.c | 24 ++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/openair2/ENB_APP/enb_agent_mac_internal.c b/openair2/ENB_APP/enb_agent_mac_internal.c index aa7482bd90..4d5ba34610 100644 --- a/openair2/ENB_APP/enb_agent_mac_internal.c +++ b/openair2/ENB_APP/enb_agent_mac_internal.c @@ -579,25 +579,25 @@ int parse_mac_config(mid_t mod_id, yaml_parser_t *parser) { switch (event.type) { case YAML_SEQUENCE_START_EVENT: - LOG_I(ENB_APP, "A sequence just started as expected\n"); + LOG_D(ENB_APP, "A sequence just started as expected\n"); sequence_started = 1; break; case YAML_SEQUENCE_END_EVENT: - LOG_I(ENB_APP, "A sequence ended\n"); + LOG_D(ENB_APP, "A sequence ended\n"); sequence_started = 0; break; case YAML_MAPPING_START_EVENT: if (!sequence_started) { goto error; } - LOG_I(ENB_APP, "A mapping started\n"); + LOG_D(ENB_APP, "A mapping started\n"); mapping_started = 1; break; case YAML_MAPPING_END_EVENT: if (!mapping_started) { goto error; } - LOG_I(ENB_APP, "A mapping ended\n"); + LOG_D(ENB_APP, "A mapping ended\n"); mapping_started = 0; break; case YAML_SCALAR_EVENT: @@ -606,15 +606,15 @@ int parse_mac_config(mid_t mod_id, yaml_parser_t *parser) { } // Check the types of subsystems offered and handle their values accordingly if (strcmp(event.data.scalar.value, "dl_scheduler") == 0) { - LOG_I(ENB_APP, "This is for the dl_scheduler subsystem\n"); + LOG_D(ENB_APP, "This is for the dl_scheduler subsystem\n"); // Call the proper handler if (parse_dl_scheduler_config(mod_id, parser) == -1) { - LOG_I(ENB_APP, "An error occured\n"); + LOG_D(ENB_APP, "An error occured\n"); goto error; } } else if (strcmp(event.data.scalar.value, "ul_scheduler") == 0) { // Call the proper handler - LOG_I(ENB_APP, "This is for the ul_scheduler subsystem\n"); + LOG_D(ENB_APP, "This is for the ul_scheduler subsystem\n"); goto error; // TODO } else if (strcmp(event.data.scalar.value, "ra_scheduler") == 0) { @@ -674,7 +674,7 @@ int parse_dl_scheduler_config(mid_t mod_id, yaml_parser_t *parser) { } // Check what key needs to be set if (strcmp(event.data.scalar.value, "behavior") == 0) { - LOG_D(ENB_APP, "Time to set the behavior attribute\n"); + LOG_I(ENB_APP, "Time to set the behavior attribute\n"); yaml_event_delete(&event); if (!yaml_parser_parse(parser, &event)) { goto error; @@ -682,7 +682,7 @@ int parse_dl_scheduler_config(mid_t mod_id, yaml_parser_t *parser) { if (event.type == YAML_SCALAR_EVENT) { if (load_dl_scheduler_function(mod_id, event.data.scalar.value) == -1) { goto error; - } + } } else { goto error; } @@ -768,7 +768,7 @@ int load_dl_scheduler_function(mid_t mod_id, const char *function_name) { char lib_name[120]; char target[512]; - sprintf(lib_name, sizeof(lib_name), "/%s.so", function_name); + snprintf(lib_name, sizeof(lib_name), "/%s.so", function_name); strcpy(target, local_cache); strcat(target, lib_name); @@ -781,7 +781,9 @@ int load_dl_scheduler_function(mid_t mod_id, const char *function_name) { if (loaded_scheduler) { if (mac_agent_registered[mod_id]) { agent_mac_xface[mod_id]->enb_agent_schedule_ue_spec = loaded_scheduler; - dlclose(agent_mac_xface[mod_id]->dl_scheduler_loaded_lib); + if (agent_mac_xface[mod_id]->dl_scheduler_loaded_lib != NULL) { + dlclose(agent_mac_xface[mod_id]->dl_scheduler_loaded_lib); + } agent_mac_xface[mod_id]->dl_scheduler_loaded_lib = lib; LOG_D(ENB_APP, "Delegated control for DL UE scheduler succesfully\n"); } From bcea7d591761b476ec7ceff829486bf0cfbc2c00 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Mon, 18 Apr 2016 13:05:36 +0100 Subject: [PATCH 174/349] Fixed local scheduler bug when scheduling multiple UEs --- openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c b/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c index 79716af854..655c60cc70 100644 --- a/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c +++ b/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c @@ -213,6 +213,8 @@ schedule_ue_spec_default( set_ul_DAI(mod_id, UE_id, CC_id, frame, subframe,frame_parms); } + channels_added = 0; + // After this point all the UEs will be scheduled dl_data[num_ues_added] = (Protocol__PrpDlData *) malloc(sizeof(Protocol__PrpDlData)); protocol__prp_dl_data__init(dl_data[num_ues_added]); From 59ba6f9e7bc7725c502e6808a021d89742ec9704 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Wed, 20 Apr 2016 13:41:49 +0100 Subject: [PATCH 175/349] Made config changes for remote scheduler and eNB --- .../LAYER2/MAC/eNB_agent_scheduler_dlsch_ue_remote.h | 2 +- .../CONF/enb.band5.agent.usrpb210.epc.remote.conf | 2 +- .../CONF/enb.band7.agent.usrpb210.epc.remote.conf | 12 ++++++------ 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue_remote.h b/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue_remote.h index c636ec0d95..7d2c2cbc6f 100644 --- a/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue_remote.h +++ b/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue_remote.h @@ -51,7 +51,7 @@ // Maximum value of schedule ahead of time // Required to identify if a dl_command is for the future or not -#define SCHED_AHEAD_SUBFRAMES 10 +#define SCHED_AHEAD_SUBFRAMES 20 typedef struct dl_mac_config_element_s { Protocol__ProgranMessage *dl_info; diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band5.agent.usrpb210.epc.remote.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band5.agent.usrpb210.epc.remote.conf index 59aec03872..e8bb16f2c8 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band5.agent.usrpb210.epc.remote.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band5.agent.usrpb210.epc.remote.conf @@ -30,7 +30,7 @@ eNBs = downlink_frequency = 879000000L; uplink_frequency_offset = -45000000; Nid_cell = 0; - N_RB_DL = 50; + N_RB_DL = 25; Nid_cell_mbsfn = 0; nb_antennas_tx = 1; nb_antennas_rx = 1; diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.agent.usrpb210.epc.remote.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.agent.usrpb210.epc.remote.conf index 4f6a3ba101..6e4764be2d 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.agent.usrpb210.epc.remote.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.agent.usrpb210.epc.remote.conf @@ -129,24 +129,24 @@ eNBs = }; ////////// MME parameters: - mme_ip_address = ( {ipv4 = "192.168.100.103"; + mme_ip_address = ( {ipv4 = "192.168.100.102"; ipv6="192:168:30::17"; active="yes"; preference="ipv4";}); NETWORK_INTERFACES : { - ENB_INTERFACE_NAME_FOR_S1_MME = "eth0:1"; - ENB_IPV4_ADDRESS_FOR_S1_MME = "192.168.100.102/24"; + ENB_INTERFACE_NAME_FOR_S1_MME = "eth2:1"; + ENB_IPV4_ADDRESS_FOR_S1_MME = "192.168.100.103/24"; - ENB_INTERFACE_NAME_FOR_S1U = "eth0:1"; - ENB_IPV4_ADDRESS_FOR_S1U = "192.168.100.102/24"; + ENB_INTERFACE_NAME_FOR_S1U = "eth2:1"; + ENB_IPV4_ADDRESS_FOR_S1U = "192.168.100.103/24"; ENB_PORT_FOR_S1U = 2152; # Spec 2152 }; NETWORK_CONTROLLER : { - ENB_AGENT_INTERFACE_NAME = "eth1"; + ENB_AGENT_INTERFACE_NAME = "eth0"; ENB_AGENT_IPV4_ADDRESS = "10.0.0.5/30"; ENB_AGENT_PORT = 2210; ENB_AGENT_CACHE = "/mnt/oai_agent_cache"; From 104ed9ade1634286bb981810dd38599b72b14d64 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Mon, 25 Apr 2016 17:09:53 +0100 Subject: [PATCH 176/349] Added fixes for multiple eNBs and simulation mode --- openair2/ENB_APP/enb_agent_common.c | 17 ++++----- openair2/RRC/LITE/rrc_eNB.c | 15 +++++--- openair2/UTIL/OTG/otg_tx.c | 5 ++- targets/SIMU/USER/oaisim.c | 5 +-- targets/SIMU/USER/oaisim_functions.c | 55 ++++++++++++++-------------- 5 files changed, 50 insertions(+), 47 deletions(-) diff --git a/openair2/ENB_APP/enb_agent_common.c b/openair2/ENB_APP/enb_agent_common.c index e3c2bcfcb5..1e477c6c3c 100644 --- a/openair2/ENB_APP/enb_agent_common.c +++ b/openair2/ENB_APP/enb_agent_common.c @@ -1418,6 +1418,9 @@ int enb_agent_ue_state_change(mid_t mod_id, uint32_t rnti, uint8_t state_change) config->has_extended_bsr_size = 1; config->extended_bsr_size = get_extended_bsr_size(mod_id,i); } + //TODO: Set index of primary cell + config->has_pcell_carrier_index = 1; + config->pcell_carrier_index = UE_PCCID(mod_id, i); //TODO: Set carrier aggregation support (boolean) config->has_ca_support = 0; config->ca_support = 0; @@ -1425,9 +1428,6 @@ int enb_agent_ue_state_change(mid_t mod_id, uint32_t rnti, uint8_t state_change) //TODO: Set cross carrier scheduling support (boolean) config->has_cross_carrier_sched_support = 1; config->cross_carrier_sched_support = 0; - //TODO: Set index of primary cell - config->has_pcell_carrier_index = 1; - config->pcell_carrier_index = 1; //TODO: Set secondary cells configuration // We do not set it for now. No carrier aggregation support @@ -1754,16 +1754,15 @@ int enb_agent_ue_config_reply(mid_t mod_id, const void *params, Protocol__Progra //TODO: Set carrier aggregation support (boolean) ue_config[i]->has_ca_support = 0; ue_config[i]->ca_support = 0; + //TODO: Set index of primary cell + ue_config[i]->has_pcell_carrier_index = 1; + ue_config[i]->pcell_carrier_index = UE_PCCID(mod_id, i); if(ue_config[i]->has_ca_support){ //TODO: Set cross carrier scheduling support (boolean) ue_config[i]->has_cross_carrier_sched_support = 1; ue_config[i]->cross_carrier_sched_support = 0; - //TODO: Set index of primary cell - ue_config[i]->has_pcell_carrier_index = 1; - ue_config[i]->pcell_carrier_index = 1; //TODO: Set secondary cells configuration // We do not set it for now. No carrier aggregation support - //TODO: Set deactivation timer for secondary cell ue_config[i]->has_scell_deactivation_timer = 1; ue_config[i]->scell_deactivation_timer = 1; @@ -1874,9 +1873,9 @@ int enb_agent_enb_config_reply(mid_t mod_id, const void *params, Protocol__Progr protocol__prp_cell_config__init(cell_conf[i]); //TODO: Fill in with actual value, the PCI of this cell cell_conf[i]->phy_cell_id = 1; - cell_conf[i]->has_phy_cell_id = 1; + cell_conf[i]->has_phy_cell_id = get_cell_id(enb_id,i); //TODO: Fill in with actual value, the PLMN cell id of this cell - cell_conf[i]->cell_id = get_cell_id(enb_id,i); + cell_conf[i]->cell_id = i; cell_conf[i]->has_cell_id = 1; //TODO: Fill in with actual value, PUSCH resources in RBs for hopping cell_conf[i]->pusch_hopping_offset = get_hopping_offset(enb_id,i); diff --git a/openair2/RRC/LITE/rrc_eNB.c b/openair2/RRC/LITE/rrc_eNB.c index ed8d4cd850..4c0bb3f5c8 100644 --- a/openair2/RRC/LITE/rrc_eNB.c +++ b/openair2/RRC/LITE/rrc_eNB.c @@ -644,6 +644,9 @@ void rrc_eNB_emulation_notify_ue_module_id( // find enb_module_id for (enb_module_id = 0; enb_module_id < NUMBER_OF_eNB_MAX; enb_module_id++) { + if(enb_module_id>1){ /*FIX LATER*/ + return; + } for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) { if (eNB_rrc_inst[enb_module_id].carrier[CC_id].sib1 != NULL) { if ( @@ -652,7 +655,6 @@ void rrc_eNB_emulation_notify_ue_module_id( (eNB_rrc_inst[enb_module_id].carrier[CC_id].sib1->cellAccessRelatedInfo.cellIdentity.buf[2] == cell_identity_byte2P) && (eNB_rrc_inst[enb_module_id].carrier[CC_id].sib1->cellAccessRelatedInfo.cellIdentity.buf[3] == cell_identity_byte3P) ) { - oai_emulation.info.eNB_ue_module_id_to_rnti[enb_module_id][ue_module_idP] = rntiP; ue_context_p = rrc_eNB_get_ue_context( &eNB_rrc_inst[enb_module_id], rntiP @@ -662,10 +664,11 @@ void rrc_eNB_emulation_notify_ue_module_id( oai_emulation.info.eNB_ue_local_uid_to_ue_module_id[enb_module_id][ue_context_p->local_uid] = ue_module_idP; } - return; + //return; } } } + oai_emulation.info.eNB_ue_module_id_to_rnti[enb_module_id][ue_module_idP] = rntiP; } AssertFatal(enb_module_id == NUMBER_OF_eNB_MAX, @@ -4026,8 +4029,8 @@ rrc_eNB_decode_dcch( PROTOCOL_RRC_CTXT_UE_FMT" UE State = RRC_RECONFIGURED \n", PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP)); //WARNING:Inform the controller about the UE activation. Should be moved to RRC agent in the future - if (mac_agent_registered[ctxt_pP->eNB_index]) { - agent_mac_xface[ctxt_pP->eNB_index]->enb_agent_notify_ue_state_change(ctxt_pP->eNB_index, + if (mac_agent_registered[ctxt_pP->module_id]) { + agent_mac_xface[ctxt_pP->eNB_index]->enb_agent_notify_ue_state_change(ctxt_pP->module_id, ue_context_p->ue_id_rnti, PROTOCOL__PRP_UE_STATE_CHANGE_TYPE__PRUESC_UPDATED); } @@ -4116,8 +4119,8 @@ rrc_eNB_decode_dcch( LOG_I(RRC, PROTOCOL_RRC_CTXT_UE_FMT" UE State = RRC_CONNECTED \n", PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP)); //WARNING:Inform the controller about the UE activation. Should be moved to RRC agent in the future - if (mac_agent_registered[ctxt_pP->eNB_index]) { - agent_mac_xface[ctxt_pP->eNB_index]->enb_agent_notify_ue_state_change(ctxt_pP->eNB_index, + if (mac_agent_registered[ctxt_pP->module_id]) { + agent_mac_xface[ctxt_pP->eNB_index]->enb_agent_notify_ue_state_change(ctxt_pP->module_id, ue_context_p->ue_id_rnti, PROTOCOL__PRP_UE_STATE_CHANGE_TYPE__PRUESC_ACTIVATED); } diff --git a/openair2/UTIL/OTG/otg_tx.c b/openair2/UTIL/OTG/otg_tx.c index e70bccbc73..ea5fad63dc 100644 --- a/openair2/UTIL/OTG/otg_tx.c +++ b/openair2/UTIL/OTG/otg_tx.c @@ -270,13 +270,14 @@ unsigned char *packet_gen( char *header=NULL; int header_size = 0; - + //LOG_I(OTG,"Src: %d - Dest: %d - before exit\n",src_instance,dst_instance); // check if the app is configured if (app >= g_otg->application_idx[src_instance][dst_instance]) { + //LOG_I(OTG,"Src: %d - Dest: %d - no packet to generate - no application\n",src_instance,dst_instance); return NULL; } - LOG_T(OTG,"[src %d] [dst %d ][APP %d] current time %d\n",src_instance, dst_instance, app, ctime); + //LOG_I(OTG,"[src %d] [dst %d ][APP %d] current time %d\n",src_instance, dst_instance, app, ctime); *pkt_size=0; init_packet_gen(src_instance, dst_instance,ctime); diff --git a/targets/SIMU/USER/oaisim.c b/targets/SIMU/USER/oaisim.c index 995516b6e8..c574527f62 100644 --- a/targets/SIMU/USER/oaisim.c +++ b/targets/SIMU/USER/oaisim.c @@ -498,7 +498,6 @@ l2l1_task (void *args_p) xargv[0] = xname; fl_initialize (&xargc, xargv, NULL, 0, 0); eNB_inst = 0; - for (UE_inst = 0; UE_inst < NB_UE_INST; UE_inst++) { for (CC_id=0;CC_id>1, 0); pdcp_run (&ctxt); #endif @@ -857,7 +856,7 @@ l2l1_task (void *args_p) CC_id++) { phy_procedures_UE_lte ( PHY_vars_UE_g[UE_inst][CC_id], - 0, abstraction_flag, + 0, abstraction_flag, normal_txrx, no_relay, NULL); } diff --git a/targets/SIMU/USER/oaisim_functions.c b/targets/SIMU/USER/oaisim_functions.c index 72153c3ee7..9a072ea2c4 100644 --- a/targets/SIMU/USER/oaisim_functions.c +++ b/targets/SIMU/USER/oaisim_functions.c @@ -1326,13 +1326,11 @@ void update_otg_eNB(module_id_t enb_module_idP, unsigned int ctime) // generate traffic if the ue is rrc reconfigured state //if ((rrc_state=mac_eNB_get_rrc_status(enb_module_idP, dst_id)) > 2 /*RRC_CONNECTED*/ ) { if (mac_eNB_get_rrc_status(enb_module_idP, oai_emulation.info.eNB_ue_module_id_to_rnti[enb_module_idP][dst_id]) > 2 ){ - if_times += 1; for (app_id=0; app_idotg_pkt).sdu_buffer = (uint8_t*) packet_gen(enb_module_idP, dst_id + NB_eNB_INST, app_id, ctime, &((otg_pkt->otg_pkt).sdu_buffer_size)); if ((otg_pkt->otg_pkt).sdu_buffer != NULL) { @@ -1459,6 +1457,7 @@ void update_otg_UE(module_id_t ue_mod_idP, unsigned int ctime) { #if defined(USER_MODE) && defined(OAI_EMU) + int app_id; if (oai_emulation.info.otg_enabled ==1 ) { module_id_t dst_id, src_id; //dst_id = eNB_index module_id_t module_id = ue_mod_idP+NB_eNB_INST; @@ -1468,31 +1467,33 @@ void update_otg_UE(module_id_t ue_mod_idP, unsigned int ctime) for (dst_id=0; dst_id 2 /*RRC_CONNECTED*/) { - Packet_otg_elt_t *otg_pkt = malloc (sizeof(Packet_otg_elt_t)); - - if (otg_pkt!=NULL) - memset(otg_pkt,0,sizeof(Packet_otg_elt_t)); - else { - LOG_E(OTG,"not enough memory\n"); - exit(-1); - }// Manage to add this packet to the tail of your list - - (otg_pkt->otg_pkt).sdu_buffer = (uint8_t*) packet_gen(src_id, dst_id, 0, ctime, &((otg_pkt->otg_pkt).sdu_buffer_size)); - - if ((otg_pkt->otg_pkt).sdu_buffer != NULL) { - (otg_pkt->otg_pkt).rb_id = DTCH-2; - (otg_pkt->otg_pkt).module_id = module_id; - (otg_pkt->otg_pkt).dst_id = dst_id; - (otg_pkt->otg_pkt).is_ue = 1; - //Adding the packet to the OTG-PDCP buffer - (otg_pkt->otg_pkt).mode = PDCP_TRANSMISSION_MODE_DATA; - pkt_list_add_tail_eurecom(otg_pkt, &(otg_pdcp_buffer[module_id])); - LOG_I(EMU, "[UE %d] ADD pkt to OTG buffer with size %d for dst %d on rb_id %d \n", - (otg_pkt->otg_pkt).module_id, otg_pkt->otg_pkt.sdu_buffer_size, (otg_pkt->otg_pkt).dst_id,(otg_pkt->otg_pkt).rb_id); - } else { - free(otg_pkt); - otg_pkt=NULL; - } + for (app_id=0; app_idotg_pkt).sdu_buffer = (uint8_t*) packet_gen(src_id, dst_id, app_id, ctime, &((otg_pkt->otg_pkt).sdu_buffer_size)); + + if ((otg_pkt->otg_pkt).sdu_buffer != NULL) { + (otg_pkt->otg_pkt).rb_id = DTCH-2; + (otg_pkt->otg_pkt).module_id = module_id; + (otg_pkt->otg_pkt).dst_id = dst_id; + (otg_pkt->otg_pkt).is_ue = 1; + //Adding the packet to the OTG-PDCP buffer + (otg_pkt->otg_pkt).mode = PDCP_TRANSMISSION_MODE_DATA; + pkt_list_add_tail_eurecom(otg_pkt, &(otg_pdcp_buffer[module_id])); + LOG_I(EMU, "[UE %d] ADD pkt to OTG buffer with size %d for dst %d on rb_id %d \n", + (otg_pkt->otg_pkt).module_id, otg_pkt->otg_pkt.sdu_buffer_size, (otg_pkt->otg_pkt).dst_id,(otg_pkt->otg_pkt).rb_id); + } else { + free(otg_pkt); + otg_pkt=NULL; + } + } } } } From 07d30b2288fdb6e296231e77c2acdf61135a81f5 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Sat, 23 Apr 2016 10:21:42 +0100 Subject: [PATCH 177/349] Fixed bug in the number of eNBs for the simulations --- openair2/ENB_APP/enb_app.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openair2/ENB_APP/enb_app.c b/openair2/ENB_APP/enb_app.c index 63f071c743..dc21448aef 100644 --- a/openair2/ENB_APP/enb_app.c +++ b/openair2/ENB_APP/enb_app.c @@ -294,7 +294,7 @@ void *eNB_app_task(void *args_p) itti_mark_task_ready (TASK_ENB_APP); -# if defined(ENABLE_USE_MME) + # if defined(ENABLE_ITTI) # if defined(OAI_EMU) enb_nb = oai_emulation.info.nb_enb_local; enb_id_start = oai_emulation.info.first_enb_local; @@ -304,7 +304,7 @@ void *eNB_app_task(void *args_p) "Last eNB index is greater or equal to maximum eNB index (%d/%d)!", enb_id_end, NUMBER_OF_eNB_MAX); # endif -# endif + # endif enb_properties_p = enb_config_get(); From b9c92931440fd8c13c597c056b2eadbaefa92af6 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Sat, 23 Apr 2016 01:32:03 +0100 Subject: [PATCH 178/349] Added support for multiple eNBs --- openair2/ENB_APP/enb_agent.c | 28 +- openair2/ENB_APP/enb_agent_common.c | 7 +- .../CONF/enb.band7.agent.oaisim.2.enb.conf | 302 ++++++++++++++++++ 3 files changed, 325 insertions(+), 12 deletions(-) create mode 100644 targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.agent.oaisim.2.enb.conf diff --git a/openair2/ENB_APP/enb_agent.c b/openair2/ENB_APP/enb_agent.c index 675272a2f4..6a9bcad878 100644 --- a/openair2/ENB_APP/enb_agent.c +++ b/openair2/ENB_APP/enb_agent.c @@ -59,13 +59,15 @@ void *receive_thread(void *args); pthread_t new_thread(void *(*f)(void *), void *b); Protocol__ProgranMessage *enb_agent_timeout(void* args); + +int agent_task_created = 0; /* * enb agent task mainly wakes up the tx thread for periodic and oneshot messages to the controller * and can interact with other itti tasks */ void *enb_agent_task(void *args){ - enb_agent_instance_t *d = (enb_agent_instance_t *) args; + //enb_agent_instance_t *d = (enb_agent_instance_t *) args; Protocol__ProgranMessage *msg; void *data; int size; @@ -76,7 +78,7 @@ void *enb_agent_task(void *args){ const char *msg_name = NULL; instance_t instance; int result; - + struct enb_agent_timer_element_s * elem = NULL; itti_mark_task_ready(TASK_ENB_AGENT); @@ -100,7 +102,8 @@ void *enb_agent_task(void *args){ msg = enb_agent_process_timeout(msg_p->ittiMsg.timer_has_expired.timer_id, msg_p->ittiMsg.timer_has_expired.arg); if (msg != NULL){ data=enb_agent_pack_message(msg,&size); - if (enb_agent_msg_send(d->enb_id, ENB_AGENT_DEFAULT, data, size, priority)) { + elem = get_timer_entry(msg_p->ittiMsg.timer_has_expired.timer_id); + if (enb_agent_msg_send(elem->agent_id, ENB_AGENT_DEFAULT, data, size, priority)) { err_code = PROTOCOL__PROGRAN_ERR__MSG_ENQUEUING; goto error; } @@ -203,6 +206,7 @@ pthread_t new_thread(void *(*f)(void *), void *b) { return t; } +int channel_container_init = 0; int enb_agent_start(mid_t mod_id, const Enb_properties_array_t* enb_properties){ int channel_id; @@ -240,8 +244,10 @@ int enb_agent_start(mid_t mod_id, const Enb_properties_array_t* enb_properties){ /* * Initialize the channel container */ - enb_agent_init_channel_container(); - + if (!channel_container_init) { + enb_agent_init_channel_container(); + channel_container_init = 1; + } /*Create the async channel info*/ enb_agent_instance_t *channel_info = enb_agent_async_channel_info(mod_id, in_ip, in_port); @@ -294,12 +300,14 @@ int enb_agent_start(mid_t mod_id, const Enb_properties_array_t* enb_properties){ /* * start the enb agent task for tx and interaction with the underlying network function */ + if (!agent_task_created) { + if (itti_create_task (TASK_ENB_AGENT, enb_agent_task, (void *) &enb_agent[mod_id]) < 0) { + LOG_E(ENB_AGENT, "Create task for eNB Agent failed\n"); + return -1; + } + agent_task_created = 1; + } - if (itti_create_task (TASK_ENB_AGENT, enb_agent_task, (void *) &enb_agent[mod_id]) < 0) { - LOG_E(ENB_AGENT, "Create task for eNB Agent failed\n"); - return -1; - } - LOG_I(ENB_AGENT,"client ends\n"); return 0; diff --git a/openair2/ENB_APP/enb_agent_common.c b/openair2/ENB_APP/enb_agent_common.c index 1e477c6c3c..1f4508f750 100644 --- a/openair2/ENB_APP/enb_agent_common.c +++ b/openair2/ENB_APP/enb_agent_common.c @@ -2090,11 +2090,14 @@ int enb_agent_enb_config_reply(mid_t mod_id, const void *params, Protocol__Progr //struct enb_agent_map agent_map; enb_agent_timer_instance_t timer_instance; +int agent_timer_init = 0; err_code_t enb_agent_init_timer(void){ LOG_I(ENB_AGENT, "init RB tree\n"); - - RB_INIT(&timer_instance.enb_agent_head); + if (!agent_timer_init) { + RB_INIT(&timer_instance.enb_agent_head); + agent_timer_init = 1; + } /* struct enb_agent_timer_element_s e; diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.agent.oaisim.2.enb.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.agent.oaisim.2.enb.conf new file mode 100644 index 0000000000..c792961a18 --- /dev/null +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.agent.oaisim.2.enb.conf @@ -0,0 +1,302 @@ +Active_eNBs = ( "eNB_Eurecom_LTEBox1", "eNB_Eurecom_LTEBox"); +# Asn1_verbosity, choice in: none, info, annoying +Asn1_verbosity = "none"; + +eNBs = +( + { + ////////// Identification parameters: + eNB_ID = 0x00; + + cell_type = "CELL_MACRO_ENB"; + + eNB_name = "eNB_Eurecom_LTEBox"; + + // Tracking area code, 0x0000 and 0xfffe are reserved values + tracking_area_code = "1"; + + mobile_country_code = "208"; + + mobile_network_code = "10"; + + ////////// Physical parameters: + + component_carriers = ( + { + frame_type = "FDD"; + tdd_config = 3; + tdd_config_s = 0; + prefix_type = "NORMAL"; + eutra_band = 7; + downlink_frequency = 2680000000L; + uplink_frequency_offset = -120000000; + Nid_cell = 0; + N_RB_DL = 50; + Nid_cell_mbsfn = 0; + nb_antennas_tx = 1; + nb_antennas_rx = 1; + tx_gain = 25; + rx_gain = 20; + prach_root = 0; + prach_config_index = 0; + prach_high_speed = "DISABLE"; + prach_zero_correlation = 1; + prach_freq_offset = 2; + pucch_delta_shift = 1; + pucch_nRB_CQI = 1; + pucch_nCS_AN = 0; + pucch_n1_AN = 32; + pdsch_referenceSignalPower = 0; + pdsch_p_b = 0; + pusch_n_SB = 1; + pusch_enable64QAM = "DISABLE"; + pusch_hoppingMode = "interSubFrame"; + pusch_hoppingOffset = 0; + pusch_groupHoppingEnabled = "ENABLE"; + pusch_groupAssignment = 0; + pusch_sequenceHoppingEnabled = "DISABLE"; + pusch_nDMRS1 = 0; + phich_duration = "NORMAL"; + phich_resource = "ONESIXTH"; + srs_enable = "DISABLE"; + /* srs_BandwidthConfig =; + srs_SubframeConfig =; + srs_ackNackST =; + srs_MaxUpPts =;*/ + + pusch_p0_Nominal = -108; + pusch_alpha = "AL1"; + pucch_p0_Nominal = -108; + msg3_delta_Preamble = 6; + pucch_deltaF_Format1 = "deltaF2"; + pucch_deltaF_Format1b = "deltaF3"; + pucch_deltaF_Format2 = "deltaF0"; + pucch_deltaF_Format2a = "deltaF0"; + pucch_deltaF_Format2b = "deltaF0"; + + rach_numberOfRA_Preambles = 64; + rach_preamblesGroupAConfig = "DISABLE"; + /* + rach_sizeOfRA_PreamblesGroupA = ; + rach_messageSizeGroupA = ; + rach_messagePowerOffsetGroupB = ; + */ + rach_powerRampingStep = 2; + rach_preambleInitialReceivedTargetPower = -100; + rach_preambleTransMax = 10; + rach_raResponseWindowSize = 10; + rach_macContentionResolutionTimer = 48; + rach_maxHARQ_Msg3Tx = 4; + + pcch_default_PagingCycle = 128; + pcch_nB = "oneT"; + bcch_modificationPeriodCoeff = 2; + ue_TimersAndConstants_t300 = 1000; + ue_TimersAndConstants_t301 = 1000; + ue_TimersAndConstants_t310 = 1000; + ue_TimersAndConstants_t311 = 10000; + ue_TimersAndConstants_n310 = 20; + ue_TimersAndConstants_n311 = 1; + } + ); + + ////////// MME parameters: + mme_ip_address = ( { ipv4 = "192.168.100.102"; + ipv6 = "0::0"; + active = "yes"; + preference = "ipv4"; + } + ); + + NETWORK_INTERFACES : + { + ENB_INTERFACE_NAME_FOR_S1_MME = "eth2:1"; + ENB_IPV4_ADDRESS_FOR_S1_MME = "192.168.100.103/24"; + + ENB_INTERFACE_NAME_FOR_S1U = "eth2:1"; + ENB_IPV4_ADDRESS_FOR_S1U = "192.168.100.103/24"; + ENB_PORT_FOR_S1U = 2153; # Spec 2152 + }; + + NETWORK_CONTROLLER : + { + ENB_AGENT_INTERFACE_NAME = "eth0"; + ENB_AGENT_IPV4_ADDRESS = "10.0.0.5/30"; + ENB_AGENT_PORT = 2210; + ENB_AGENT_CACHE = "/mnt/oai_agent_cache"; + }; + + log_config : + { + global_log_level ="trace"; + global_log_verbosity ="medium"; + hw_log_level ="info"; + hw_log_verbosity ="medium"; + phy_log_level ="trace"; + phy_log_verbosity ="medium"; + mac_log_level ="trace"; + mac_log_verbosity ="medium"; + rlc_log_level ="trace"; + rlc_log_verbosity ="medium"; + pdcp_log_level ="trace"; + pdcp_log_verbosity ="medium"; + rrc_log_level ="trace"; + rrc_log_verbosity ="medium"; + gtpu_log_level ="debug"; + gtpu_log_verbosity ="medium"; + udp_log_level ="debug"; + udp_log_verbosity ="medium"; + osa_log_level ="debug"; + osa_log_verbosity ="low"; + }; + + }, + + { + ////////// Identification parameters: + eNB_ID = 0x01; + + cell_type = "CELL_MACRO_ENB"; + + eNB_name = "eNB_Eurecom_LTEBox1"; + + // Tracking area code, 0x0000 and 0xfffe are reserved values + tracking_area_code = "1"; + + mobile_country_code = "208"; + + mobile_network_code = "10"; + + ////////// Physical parameters: + + component_carriers = ( + { + frame_type = "FDD"; + tdd_config = 3; + tdd_config_s = 0; + prefix_type = "NORMAL"; + eutra_band = 7; + downlink_frequency = 2680000000L; + uplink_frequency_offset = -120000000; + Nid_cell = 10; + N_RB_DL = 25; + Nid_cell_mbsfn = 0; + nb_antennas_tx = 1; + nb_antennas_rx = 1; + tx_gain = 25; + rx_gain = 20; + prach_root = 0; + prach_config_index = 0; + prach_high_speed = "DISABLE"; + prach_zero_correlation = 1; + prach_freq_offset = 2; + pucch_delta_shift = 1; + pucch_nRB_CQI = 1; + pucch_nCS_AN = 0; + pucch_n1_AN = 32; + pdsch_referenceSignalPower = 0; + pdsch_p_b = 0; + pusch_n_SB = 1; + pusch_enable64QAM = "DISABLE"; + pusch_hoppingMode = "interSubFrame"; + pusch_hoppingOffset = 0; + pusch_groupHoppingEnabled = "ENABLE"; + pusch_groupAssignment = 0; + pusch_sequenceHoppingEnabled = "DISABLE"; + pusch_nDMRS1 = 0; + phich_duration = "NORMAL"; + phich_resource = "ONESIXTH"; + srs_enable = "DISABLE"; + /* srs_BandwidthConfig =; + srs_SubframeConfig =; + srs_ackNackST =; + srs_MaxUpPts =;*/ + + pusch_p0_Nominal = -108; + pusch_alpha = "AL1"; + pucch_p0_Nominal = -108; + msg3_delta_Preamble = 6; + pucch_deltaF_Format1 = "deltaF2"; + pucch_deltaF_Format1b = "deltaF3"; + pucch_deltaF_Format2 = "deltaF0"; + pucch_deltaF_Format2a = "deltaF0"; + pucch_deltaF_Format2b = "deltaF0"; + + rach_numberOfRA_Preambles = 64; + rach_preamblesGroupAConfig = "DISABLE"; + /* + rach_sizeOfRA_PreamblesGroupA = ; + rach_messageSizeGroupA = ; + rach_messagePowerOffsetGroupB = ; + */ + rach_powerRampingStep = 2; + rach_preambleInitialReceivedTargetPower = -100; + rach_preambleTransMax = 10; + rach_raResponseWindowSize = 10; + rach_macContentionResolutionTimer = 48; + rach_maxHARQ_Msg3Tx = 4; + + pcch_default_PagingCycle = 128; + pcch_nB = "oneT"; + bcch_modificationPeriodCoeff = 2; + ue_TimersAndConstants_t300 = 1000; + ue_TimersAndConstants_t301 = 1000; + ue_TimersAndConstants_t310 = 1000; + ue_TimersAndConstants_t311 = 10000; + ue_TimersAndConstants_n310 = 20; + ue_TimersAndConstants_n311 = 1; + } + ); + + ////////// MME parameters: + mme_ip_address = ( { ipv4 = "192.168.100.102"; + ipv6 = "0::0"; + active = "yes"; + preference = "ipv4"; + } + ); + + NETWORK_INTERFACES : + { + ENB_INTERFACE_NAME_FOR_S1_MME = "eth2:2"; + ENB_IPV4_ADDRESS_FOR_S1_MME = "192.168.100.104/24"; + + ENB_INTERFACE_NAME_FOR_S1U = "eth2:2"; + ENB_IPV4_ADDRESS_FOR_S1U = "192.168.100.104/24"; + ENB_PORT_FOR_S1U = 2153; # Spec 2152 + }; + + NETWORK_CONTROLLER : + { + ENB_AGENT_INTERFACE_NAME = "eth0"; + ENB_AGENT_IPV4_ADDRESS = "10.0.0.5/30"; + ENB_AGENT_PORT = 2210; + ENB_AGENT_CACHE = "/mnt/oai_agent_cache"; + }; + + log_config : + { + global_log_level ="trace"; + global_log_verbosity ="medium"; + hw_log_level ="info"; + hw_log_verbosity ="medium"; + phy_log_level ="trace"; + phy_log_verbosity ="medium"; + mac_log_level ="trace"; + mac_log_verbosity ="medium"; + rlc_log_level ="trace"; + rlc_log_verbosity ="medium"; + pdcp_log_level ="trace"; + pdcp_log_verbosity ="medium"; + rrc_log_level ="trace"; + rrc_log_verbosity ="medium"; + gtpu_log_level ="debug"; + gtpu_log_verbosity ="medium"; + udp_log_level ="debug"; + udp_log_verbosity ="medium"; + osa_log_level ="debug"; + osa_log_verbosity ="low"; + }; + + } +); From b6e7f7ec513496d5448ecbd8011fe577f59cc032 Mon Sep 17 00:00:00 2001 From: Xiwen JIANG Date: Mon, 30 May 2016 17:58:31 +0200 Subject: [PATCH 179/349] tx_eNB -> ant_ports in oaisim --- targets/SIMU/USER/oaisim_functions.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/targets/SIMU/USER/oaisim_functions.c b/targets/SIMU/USER/oaisim_functions.c index 72153c3ee7..f7e6b97d37 100644 --- a/targets/SIMU/USER/oaisim_functions.c +++ b/targets/SIMU/USER/oaisim_functions.c @@ -934,12 +934,12 @@ void init_openair1(void) PHY_vars_eNB_g[eNB_id][CC_id]->pusch_config_dedicated[UE_id].betaOffset_ACK_Index = beta_ACK; PHY_vars_eNB_g[eNB_id][CC_id]->pusch_config_dedicated[UE_id].betaOffset_RI_Index = beta_RI; PHY_vars_eNB_g[eNB_id][CC_id]->pusch_config_dedicated[UE_id].betaOffset_CQI_Index = beta_CQI; - PHY_vars_eNB_g[eNB_id][CC_id]->lte_frame_parms.pdsch_config_common.p_b = (frame_parms[CC_id]->nb_antennas_tx_eNB>1) ? 1 : 0; // rho_A = rho_B + PHY_vars_eNB_g[eNB_id][CC_id]->lte_frame_parms.pdsch_config_common.p_b = (frame_parms[CC_id]->nb_antenna_ports_eNB>1) ? 1 : 0; // rho_A = rho_B PHY_vars_UE_g[UE_id][CC_id]->pusch_config_dedicated[eNB_id].betaOffset_ACK_Index = beta_ACK; PHY_vars_UE_g[UE_id][CC_id]->pusch_config_dedicated[eNB_id].betaOffset_RI_Index = beta_RI; PHY_vars_UE_g[UE_id][CC_id]->pusch_config_dedicated[eNB_id].betaOffset_CQI_Index = beta_CQI; - PHY_vars_UE_g[UE_id][CC_id]->lte_frame_parms.pdsch_config_common.p_b = (frame_parms[CC_id]->nb_antennas_tx_eNB>1) ? 1 : 0; // rho_A = rho_B + PHY_vars_UE_g[UE_id][CC_id]->lte_frame_parms.pdsch_config_common.p_b = (frame_parms[CC_id]->nb_antenna_ports_eNB>1) ? 1 : 0; // rho_A = rho_B } } } From d621de7fb3f41a3083fd435833fce1b702a4f68a Mon Sep 17 00:00:00 2001 From: Xiwen JIANG Date: Mon, 30 May 2016 18:38:52 +0200 Subject: [PATCH 180/349] enable TM7 in oaisim --- targets/SIMU/USER/oaisim_functions.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/targets/SIMU/USER/oaisim_functions.c b/targets/SIMU/USER/oaisim_functions.c index f7e6b97d37..1b29da3740 100644 --- a/targets/SIMU/USER/oaisim_functions.c +++ b/targets/SIMU/USER/oaisim_functions.c @@ -685,7 +685,7 @@ void get_simulation_options(int argc, char *argv[]) oai_emulation.info.transmission_mode[0] = atoi (optarg); if ((oai_emulation.info.transmission_mode[0] != 1) && (oai_emulation.info.transmission_mode[0] != 2) && (oai_emulation.info.transmission_mode[0] != 3) - && (oai_emulation.info.transmission_mode[0] != 5) && (oai_emulation.info.transmission_mode[0] != 6)) { + && (oai_emulation.info.transmission_mode[0] != 5) && (oai_emulation.info.transmission_mode[0] != 6) && (oai_emulation.info.transmission_mode[0] !=7)) { printf("Unsupported transmission mode %d\n",oai_emulation.info.transmission_mode[0]); exit(-1); } From 7ca6a84e200665d53e627ac600528e6b457c4be3 Mon Sep 17 00:00:00 2001 From: Xiwen JIANG Date: Tue, 31 May 2016 17:37:19 +0200 Subject: [PATCH 181/349] bug fixed for oarf_get_frame --- targets/ARCH/EXMIMO/USERSPACE/OCTAVE/oarf_get_frame.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/targets/ARCH/EXMIMO/USERSPACE/OCTAVE/oarf_get_frame.cc b/targets/ARCH/EXMIMO/USERSPACE/OCTAVE/oarf_get_frame.cc index 708910b4f7..e53dccd5db 100644 --- a/targets/ARCH/EXMIMO/USERSPACE/OCTAVE/oarf_get_frame.cc +++ b/targets/ARCH/EXMIMO/USERSPACE/OCTAVE/oarf_get_frame.cc @@ -192,14 +192,14 @@ DEFUN_DLD (oarf_get_frame, args, nargout,"Get frame") for (j=0; j Date: Tue, 31 May 2016 17:38:01 +0200 Subject: [PATCH 182/349] add exmimo octave api env to TDD rec proj --- targets/PROJECTS/TDDREC/s_init_params.m | 1 + 1 file changed, 1 insertion(+) diff --git a/targets/PROJECTS/TDDREC/s_init_params.m b/targets/PROJECTS/TDDREC/s_init_params.m index 9683ed2d17..be51524755 100644 --- a/targets/PROJECTS/TDDREC/s_init_params.m +++ b/targets/PROJECTS/TDDREC/s_init_params.m @@ -1,6 +1,7 @@ clear all close all addpath([getenv('OPENAIR_TARGETS') '/ARCH/EXMIMO/USERSPACE/OCTAVE']); +addpath([getenv('OPENAIR_DIR') '/cmake_targets/lte_build_oai/build']); %% -------- ExpressMIMO2 configuration -------- limeparms; From b1f64b22a6ea43368140076abd67664ef93e024e Mon Sep 17 00:00:00 2001 From: Xiwen JIANG Date: Tue, 31 May 2016 19:13:45 +0200 Subject: [PATCH 183/349] bug fixed for oarf_get_frame --- targets/ARCH/EXMIMO/USERSPACE/OCTAVE/oarf_get_frame.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/targets/ARCH/EXMIMO/USERSPACE/OCTAVE/oarf_get_frame.cc b/targets/ARCH/EXMIMO/USERSPACE/OCTAVE/oarf_get_frame.cc index e53dccd5db..170f782a04 100644 --- a/targets/ARCH/EXMIMO/USERSPACE/OCTAVE/oarf_get_frame.cc +++ b/targets/ARCH/EXMIMO/USERSPACE/OCTAVE/oarf_get_frame.cc @@ -178,7 +178,7 @@ DEFUN_DLD (oarf_get_frame, args, nargout,"Get frame") printf("Info : Only resampling_factor of channel 0 is taken into account for copying received frame for all the other chains\n"); - ComplexMatrix dx (FRAME_LENGTH_COMPLEX_SAMPLES*4, numant*openair0_num_detected_cards); + ComplexMatrix dx (FRAME_LENGTH_COMPLEX_SAMPLES*4, MAX_ANTENNAS*openair0_num_detected_cards); /* // set the tx buffer to 0x00010001 to put switch in rx mode for (aa=0; aa Date: Wed, 15 Jun 2016 17:54:13 +0200 Subject: [PATCH 184/349] merge ue_spec beamforming and cell_spec beamforming to beam_precoding --- openair1/PHY/INIT/lte_init.c | 22 ++- openair1/PHY/LTE_TRANSPORT/dlsch_modulation.c | 2 +- openair1/PHY/MODULATION/beamforming.c | 185 +++++------------- openair1/PHY/MODULATION/defs.h | 35 +--- openair1/PHY/MODULATION/ofdm_mod.c | 13 +- openair1/PHY/impl_defs_lte.h | 15 +- openair1/SCHED/phy_procedures_lte_eNb.c | 19 +- openair1/SIMULATION/LTE_PHY/dlsim.c | 10 +- .../CONF/enb.band7.tm1.exmimo2.conf | 8 +- 9 files changed, 109 insertions(+), 200 deletions(-) diff --git a/openair1/PHY/INIT/lte_init.c b/openair1/PHY/INIT/lte_init.c index c13373647d..f5e9fdae10 100644 --- a/openair1/PHY/INIT/lte_init.c +++ b/openair1/PHY/INIT/lte_init.c @@ -1235,7 +1235,7 @@ int phy_init_lte_eNB(PHY_VARS_eNB *phy_vars_eNB, LTE_eNB_PUSCH** const eNB_pusch_vars = phy_vars_eNB->lte_eNB_pusch_vars; LTE_eNB_SRS* const eNB_srs_vars = phy_vars_eNB->lte_eNB_srs_vars; LTE_eNB_PRACH* const eNB_prach_vars = &phy_vars_eNB->lte_eNB_prach_vars; - int i, j, eNB_id, UE_id; + int i, j, re, eNB_id, UE_id; phy_vars_eNB->total_dlsch_bitrate = 0; phy_vars_eNB->total_transmitted_bits = 0; @@ -1302,7 +1302,7 @@ int phy_init_lte_eNB(PHY_VARS_eNB *phy_vars_eNB, #endif } - for (i=0; i<2; i++) { // 2 is the total number of cell specific antenna ports + /*for (i=0; i<2; i++) { // 2 is the total number of cell specific antenna ports eNB_common_vars->cell_spec_bf_weights[eNB_id][i] = (int32_t **)malloc16_clear(frame_parms->nb_antennas_tx*sizeof(int32_t*)); for (j=0; jnb_antennas_tx; j++) { eNB_common_vars->cell_spec_bf_weights[eNB_id][i][j] = (int32_t *)malloc16_clear(OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES*sizeof(int32_t)); @@ -1310,11 +1310,25 @@ int phy_init_lte_eNB(PHY_VARS_eNB *phy_vars_eNB, msg("[openair][LTE_PHY][INIT] lte_eNB_common_vars->cell_spec_bf_weights[%d][%d][%d] = %p (%d bytes)\n", eNB_id,i,j,eNB_common_vars->cell_spec_bf_weights[eNB_id][i][j], OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES*sizeof(int32_t)); +#endif + } + } */ + + for (i=0; i<15; i++) { // 15 is the total number of antenna ports + eNB_common_vars->beam_weights[eNB_id][i] = (int32_t **)malloc16_clear(frame_parms->nb_antennas_tx*sizeof(int32_t*)); + for (j=0; jnb_antennas_tx; j++) { + eNB_common_vars->beam_weights[eNB_id][i][j] = (int32_t *)malloc16_clear(OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES*sizeof(int32_t)); + for (re=0; rebeam_weights[eNB_id][i][j][re] = 0x00007fff; +#ifdef DEBUG_PUY + msg("[openair][LTE_PHY][INIT] lte_eNB_common_vars->beam_weights[%d][%d][%d] = %p (%d bytes)\n", + eNB_id,i,j,eNB_common_vars->beam_weights[eNB_id][i][j], + OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES*sizeof(int32_t)); #endif } } - for (i=0; i<8; i++) { //antenna port 5 for TM7, antenna port 7-15 for TM8-10 + /*for (i=0; i<8; i++) { //antenna port 5 for TM7, antenna port 7-15 for TM8-10 eNB_common_vars->ue_spec_bf_weights[eNB_id][i] = (int32_t **)malloc16_clear(frame_parms->nb_antennas_tx*sizeof(int32_t*)); for (j=0; jnb_antennas_tx; j++) { eNB_common_vars->ue_spec_bf_weights[eNB_id][i][j] = (int32_t*)malloc16_clear(OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES*sizeof(int32_t)); @@ -1324,7 +1338,7 @@ int phy_init_lte_eNB(PHY_VARS_eNB *phy_vars_eNB, OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES*sizeof(int32_t)); #endif } - } + } */ // RX vars eNB_common_vars->rxdata[eNB_id] = (int32_t**)malloc16(frame_parms->nb_antennas_rx*sizeof(int32_t*) ); diff --git a/openair1/PHY/LTE_TRANSPORT/dlsch_modulation.c b/openair1/PHY/LTE_TRANSPORT/dlsch_modulation.c index a59667c3f6..f50b0a7567 100644 --- a/openair1/PHY/LTE_TRANSPORT/dlsch_modulation.c +++ b/openair1/PHY/LTE_TRANSPORT/dlsch_modulation.c @@ -1446,7 +1446,7 @@ int dlsch_modulation(PHY_VARS_eNB* phy_vars_eNB, // mapping ue specific beamforming weights from UE specified DLSCH structure to common space for (aa=0;aanb_antennas_tx;aa++){ - memcpy(phy_vars_eNB->lte_eNB_common_vars.ue_spec_bf_weights[0][0][aa],dlsch0->ue_spec_bf_weights[0][aa],frame_parms->ofdm_symbol_size*sizeof(int32_t)); + memcpy(phy_vars_eNB->lte_eNB_common_vars.beam_weights[0][5][aa],dlsch0->ue_spec_bf_weights[0][aa],frame_parms->ofdm_symbol_size*sizeof(int32_t)); } } diff --git a/openair1/PHY/MODULATION/beamforming.c b/openair1/PHY/MODULATION/beamforming.c index 157b8eb368..e37ab0e430 100644 --- a/openair1/PHY/MODULATION/beamforming.c +++ b/openair1/PHY/MODULATION/beamforming.c @@ -46,14 +46,12 @@ Address : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 069 #include "defs.h" #include "UTIL/LOG/vcd_signal_dumper.h" - -// ue_spec_beamforming: perform beamforming for data in transmission_mode TM7-TM10 -int ue_spec_beamforming(int32_t **txdataF, - int32_t **txdataF_BF, - LTE_DL_FRAME_PARMS *frame_parms, - int32_t ***ue_spec_bf_weights, - int slot, - int symbol) +int beam_precoding(int32_t **txdataF, + int32_t **txdataF_BF, + LTE_DL_FRAME_PARMS *frame_parms, + int32_t ***beam_weights, + int slot, + int symbol) { uint8_t p,aa; uint16_t re=0; @@ -66,41 +64,54 @@ int ue_spec_beamforming(int32_t **txdataF, memset(txdataF_BF[aa],0,4*(frame_parms->ofdm_symbol_size)); for (re=0;reofdm_symbol_size;re++) { + for (p=0; p<2; p++) { + if (txdataF[p][slot_offset_F+symbol*frame_parms->ofdm_symbol_size+re]!=0) { + for (aa=0;aanb_antennas_tx;aa++) { + ((int16_t*)&txdataF_BF[aa][re])[0] = (int16_t)((((int16_t*)&txdataF[p][slot_offset_F+symbol*frame_parms->ofdm_symbol_size+re])[0]*((int16_t*)&beam_weights[p][aa][re])[0])>>15); + ((int16_t*)&txdataF_BF[aa][re])[0] -= (int16_t)((((int16_t*)&txdataF[p][slot_offset_F+symbol*frame_parms->ofdm_symbol_size+re])[1]*((int16_t*)&beam_weights[p][aa][re])[1])>>15); + ((int16_t*)&txdataF_BF[aa][re])[1] = (int16_t)((((int16_t*)&txdataF[p][slot_offset_F+symbol*frame_parms->ofdm_symbol_size+re])[0]*((int16_t*)&beam_weights[p][aa][re])[1])>>15); + ((int16_t*)&txdataF_BF[aa][re])[1] += (int16_t)((((int16_t*)&txdataF[p][slot_offset_F+symbol*frame_parms->ofdm_symbol_size+re])[1]*((int16_t*)&beam_weights[0][aa][re])[0])>>15); + + //printf("beamforming.c:txdata[%d][%d]=%d+j%d, beam_weights[%d][%d][%d]=%d+j%d,txdata_BF[%d][%d]=%d+j%d\n", + // p,slot_offset_F+symbol*frame_parms->ofdm_symbol_size+re, + // ((int16_t*)&txdataF[p][slot_offset_F+symbol*frame_parms->ofdm_symbol_size+re])[0], + // ((int16_t*)&txdataF[p][slot_offset_F+symbol*frame_parms->ofdm_symbol_size+re])[1], + // p,aa,re, + // ((int16_t*)&beam_weights[p][aa][re])[0],((int16_t*)&beam_weights[p][aa][re])[1], + // aa,re, + // ((int16_t*)&txdataF_BF[aa][re])[0], + // ((int16_t*)&txdataF_BF[aa][re])[1]); + } + + } + } if (txdataF[5][slot_offset_F+symbol*frame_parms->ofdm_symbol_size+re]!=0) { //that means this RE is actually using TM7 for (aa=0;aanb_antennas_tx;aa++) { - ((int16_t*)&txdataF_BF[aa][re])[0] = (int16_t)((((int16_t*)&txdataF[5][slot_offset_F+symbol*frame_parms->ofdm_symbol_size+re])[0] - *((int16_t*)&ue_spec_bf_weights[0][aa][re])[0])>>15); - ((int16_t*)&txdataF_BF[aa][re])[0] -= (int16_t)((((int16_t*)&txdataF[5][slot_offset_F+symbol*frame_parms->ofdm_symbol_size+re])[1] - *((int16_t*)&ue_spec_bf_weights[0][aa][re])[1])>>15); - ((int16_t*)&txdataF_BF[aa][re])[1] = (int16_t)((((int16_t*)&txdataF[5][slot_offset_F+symbol*frame_parms->ofdm_symbol_size+re])[0] - *((int16_t*)&ue_spec_bf_weights[0][aa][re])[1])>>15); - ((int16_t*)&txdataF_BF[aa][re])[1] += (int16_t)((((int16_t*)&txdataF[5][slot_offset_F+symbol*frame_parms->ofdm_symbol_size+re])[1] - *((int16_t*)&ue_spec_bf_weights[0][aa][re])[0])>>15); + ((int16_t*)&txdataF_BF[aa][re])[0] = (int16_t)((((int16_t*)&txdataF[5][slot_offset_F+symbol*frame_parms->ofdm_symbol_size+re])[0]*((int16_t*)&beam_weights[5][aa][re])[0])>>15); + ((int16_t*)&txdataF_BF[aa][re])[0] -= (int16_t)((((int16_t*)&txdataF[5][slot_offset_F+symbol*frame_parms->ofdm_symbol_size+re])[1]*((int16_t*)&beam_weights[5][aa][re])[1])>>15); + ((int16_t*)&txdataF_BF[aa][re])[1] = (int16_t)((((int16_t*)&txdataF[5][slot_offset_F+symbol*frame_parms->ofdm_symbol_size+re])[0]*((int16_t*)&beam_weights[5][aa][re])[1])>>15); + ((int16_t*)&txdataF_BF[aa][re])[1] += (int16_t)((((int16_t*)&txdataF[5][slot_offset_F+symbol*frame_parms->ofdm_symbol_size+re])[1]*((int16_t*)&beam_weights[5][aa][re])[0])>>15); + // printf("beamforming.c:txdata[%d][%d]=%d+j%d, beam_weights[%d][%d][%d]=%d+j%d,txdata_BF[%d][%d]=%d+j%d\n", + // p,slot_offset_F+symbol*frame_parms->ofdm_symbol_size+re, + // ((int16_t*)&txdataF[p][slot_offset_F+symbol*frame_parms->ofdm_symbol_size+re])[0], + // ((int16_t*)&txdataF[p][slot_offset_F+symbol*frame_parms->ofdm_symbol_size+re])[1], + // p,aa,re, + // ((int16_t*)&beam_weights[p][aa][re])[0],((int16_t*)&beam_weights[p][aa][re])[1], + // aa,re, + // ((int16_t*)&txdataF_BF[aa][re])[0], + // ((int16_t*)&txdataF_BF[aa][re])[1]); -/* printf("beamforming.c:txdataF[5][%d]=%d+j%d, ue_bf_weights[0][%d][%d]=%d+j%d,txdata_BF[%d][%d]=%d+j%d\n", - slot_offset_F+symbol*frame_parms->ofdm_symbol_size+re, - ((int16_t*)&txdataF[5][slot_offset_F+symbol*frame_parms->ofdm_symbol_size+re])[0], - ((int16_t*)&txdataF[5][slot_offset_F+symbol*frame_parms->ofdm_symbol_size+re])[1], - aa,re, - ((int16_t*)&ue_spec_bf_weights[0][aa][re])[0],((int16_t*)&ue_spec_bf_weights[0][aa][re])[1], - aa,re, - ((int16_t*)&txdataF_BF[aa][re])[0], - ((int16_t*)&txdataF_BF[aa][re])[1]); */ } } if (txdataF[7][slot_offset_F+symbol*frame_parms->ofdm_symbol_size+re]!=0) { //that means this RE is actually using TM8-10 - for (p=0;p<8;p++) { - if (txdataF[p+7][slot_offset_F+symbol*frame_parms->ofdm_symbol_size+re]!=0) { //that means this RE is actually allocated + for (p=7;p<15;p++) { + if (txdataF[p][slot_offset_F+symbol*frame_parms->ofdm_symbol_size+re]!=0) { //that means this RE is actually allocated for (aa=0;aanb_antennas_tx;aa++) { - ((int16_t*)&txdataF_BF[aa][re])[0] = (int16_t)((((int16_t*)&txdataF[p+7][slot_offset_F+symbol*frame_parms->ofdm_symbol_size+re])[0] - *((int16_t*)&ue_spec_bf_weights[p][aa][re])[0])>>15); - ((int16_t*)&txdataF_BF[aa][re])[0] -= (int16_t)((((int16_t*)&txdataF[p+7][slot_offset_F+symbol*frame_parms->ofdm_symbol_size+re])[1] - *((int16_t*)&ue_spec_bf_weights[p][aa][re])[1])>>15); - ((int16_t*)&txdataF_BF[aa][re])[1] = (int16_t)((((int16_t*)&txdataF[p+7][slot_offset_F+symbol*frame_parms->ofdm_symbol_size+re])[0] - *((int16_t*)&ue_spec_bf_weights[p][aa][re])[1])>>15); - ((int16_t*)&txdataF_BF[aa][re])[1] += (int16_t)((((int16_t*)&txdataF[p+7][slot_offset_F+symbol*frame_parms->ofdm_symbol_size+re])[1] - *((int16_t*)&ue_spec_bf_weights[p][aa][re])[0])>>15); + ((int16_t*)&txdataF_BF[aa][re])[0] = (int16_t)((((int16_t*)&txdataF[p][slot_offset_F+symbol*frame_parms->ofdm_symbol_size+re])[0]*((int16_t*)&beam_weights[p][aa][re])[0])>>15); + ((int16_t*)&txdataF_BF[aa][re])[0] -= (int16_t)((((int16_t*)&txdataF[p][slot_offset_F+symbol*frame_parms->ofdm_symbol_size+re])[1]*((int16_t*)&beam_weights[p][aa][re])[1])>>15); + ((int16_t*)&txdataF_BF[aa][re])[1] = (int16_t)((((int16_t*)&txdataF[p][slot_offset_F+symbol*frame_parms->ofdm_symbol_size+re])[0]*((int16_t*)&beam_weights[p][aa][re])[1])>>15); + ((int16_t*)&txdataF_BF[aa][re])[1] += (int16_t)((((int16_t*)&txdataF[p][slot_offset_F+symbol*frame_parms->ofdm_symbol_size+re])[1]*((int16_t*)&beam_weights[p][aa][re])[0])>>15); } } } @@ -108,107 +119,3 @@ int ue_spec_beamforming(int32_t **txdataF, } } -// cell_spec_beamforming: performed for all common data -int cell_spec_beamforming(int32_t **txdataF, - int32_t **txdataF_BF, - LTE_DL_FRAME_PARMS *frame_parms, - int32_t ***cell_spec_bf_weights, - int slot, - int symbol) -{ - uint8_t p,aa; - uint16_t re=0; - int slot_offset_F; - - slot_offset_F = slot*(frame_parms->ofdm_symbol_size)*((frame_parms->Ncp==1) ? 6 : 7); - - // clear txdata_BF[aa][re] for each call of cell_spec_beamforming - for(aa=0;aanb_antennas_tx;aa++) - memset(txdataF_BF[aa],0,4*(frame_parms->ofdm_symbol_size)); - - for (re=0;reofdm_symbol_size;re++) { - for (p=0;pnb_antenna_ports_eNB;p++) { - if (txdataF[p][slot_offset_F+symbol*frame_parms->ofdm_symbol_size+re]!=0) { //that means this RE is actually allocated - for (aa=0;aanb_antennas_tx;aa++) { - - ((int16_t*)&txdataF_BF[aa][re])[0] = (int16_t)((((int16_t*)&txdataF[p][slot_offset_F+symbol*frame_parms->ofdm_symbol_size+re])[0] - *((int16_t*)&cell_spec_bf_weights[p][aa][re])[0])>>15); - ((int16_t*)&txdataF_BF[aa][re])[0] -= (int16_t)((((int16_t*)&txdataF[p][slot_offset_F+symbol*frame_parms->ofdm_symbol_size+re])[1] - *((int16_t*)&cell_spec_bf_weights[p][aa][re])[1])>>15); - ((int16_t*)&txdataF_BF[aa][re])[1] = (int16_t)((((int16_t*)&txdataF[p][slot_offset_F+symbol*frame_parms->ofdm_symbol_size+re])[0] - *((int16_t*)&cell_spec_bf_weights[p][aa][re])[1])>>15); - ((int16_t*)&txdataF_BF[aa][re])[1] += (int16_t)((((int16_t*)&txdataF[p][slot_offset_F+symbol*frame_parms->ofdm_symbol_size+re])[1] - *((int16_t*)&cell_spec_bf_weights[p][aa][re])[0])>>15); - // printf("beamforming.c:txdata[%d][%d]=%d+j%d, cell_bf_weights[%d][%d][%d]=%d+j%d,txdata_BF[%d][%d]=%d+j%d\n", - // p,slot_offset_F+symbol*frame_parms->ofdm_symbol_size+re, - // ((int16_t*)&txdataF[p][slot_offset_F+symbol*frame_parms->ofdm_symbol_size+re])[0], - // ((int16_t*)&txdataF[p][slot_offset_F+symbol*frame_parms->ofdm_symbol_size+re])[1], - // p,aa,re, - // ((int16_t*)&cell_spec_bf_weights[p][aa][re])[0],((int16_t*)&cell_spec_bf_weights[p][aa][re])[1], - // aa,re, - // ((int16_t*)&txdataF_BF[aa][re])[0], - // ((int16_t*)&txdataF_BF[aa][re])[1]); - } - } - } - } -} - - - - -/* -int ue_spec_beamforming(int32_t **txdataF, - int32_t **txdataF_BF, - LTE_DL_FRAME_PARMS *frame_parms, - LTE_eNB_DLSCH_t *dlsch0, - LTE_eNB_DLSCH_t *dlsch1, - int symbol) -{ - uint8_t p,aa; - uint16_t re=0; - - uint8_t harq_pid = dlsch0->current_harq_pid; - LTE_DL_eNB_HARQ_t *dlsch0_harq = dlsch0->harq_processes[harq_pid]; - LTE_DL_eNB_HARQ_t *dlsch1_harq; //= dlsch1->harq_processes[harq_pid]; - MIMO_mode_t mimo_mode = dlsch0_harq->mimo_mode; - int first_layer0 = dlsch0_harq->first_layer; - int Nlayers0 = dlsch0_harq->Nlayers; - - // Fill these in later for TM8-10 - int Nlayers1; - int first_layer1; - - if (dlsch1_harq) { - Nlayers1 = dlsch1_harq->Nlayers; - first_layer1 = dlsch1_harq->first_layer; - } - - //temp - if(mimo_mode==TM7){ - first_layer0 = 5; - Nlayers0=1; - } - - for (re=0;renb_antennas_tx;aa++) { - txdataF_BF[aa][re] += txdataF[p][re]*dlsch0->uespec_bf_weights[p][aa][re]; - } - } - } - - if(dlsch1_harq) { - for (p=first_layer1;pnb_antennas_tx;aa++) { - txdataF_BF[aa][re] += txdataF[p][re]*dlsch1->uespec_bf_weights[p][aa][re]; - } - } - } - } - - } -} */ diff --git a/openair1/PHY/MODULATION/defs.h b/openair1/PHY/MODULATION/defs.h index fec65b8679..88c4e2a2d8 100644 --- a/openair1/PHY/MODULATION/defs.h +++ b/openair1/PHY/MODULATION/defs.h @@ -89,6 +89,8 @@ void normal_prefix_mod(int32_t *txdataF,int32_t *txdata,uint8_t nsymb,LTE_DL_FRA void do_OFDM_mod(mod_sym_t **txdataF, int32_t **txdata, uint32_t frame,uint16_t next_slot, LTE_DL_FRAME_PARMS *frame_parms); +void do_OFDM_mod_l(LTE_eNB_COMMON *eNB_common_vars, int eNB_id, uint16_t next_slot, LTE_DL_FRAME_PARMS *frame_parms, uint8_t num_pdcch_symbols); + void remove_7_5_kHz(PHY_VARS_eNB *phy_vars_eNB,uint8_t subframe); void apply_7_5_kHz(PHY_VARS_UE *phy_vars_ue,int32_t*txdata,uint8_t subframe); @@ -99,39 +101,22 @@ void remove_625_Hz(PHY_VARS_eNB *phy_vars_eNB,int16_t *prach); void apply_625_Hz(PHY_VARS_UE *phy_vars_ue,int16_t *prach); -/** \brief This function performs UE specific beamforming especially for - * transmission mode TM7-10 - @param txdataF Table of pointers for frequency-domain TX signals - @param txdataF_BF Table of pointers for frequency-domain TX signals -after beamforming - @param frame_parms Frame descriptor structure - @param ue_spec_bf_weights UE specific beamforming weights applied on -each antenna element and each carrier - @param slot Slot number - @param symbol Symbol index on which to act*/ -int ue_spec_beamforming(int32_t **txdataF, - int32_t **txdataF_BF, - LTE_DL_FRAME_PARMS *frame_parms, - int32_t ***ue_spec_bf_weights, - int slot, - int symbol); - -/** \brief This function performs cell specific beamforming for common +/** \brief This function performs beamforming precoding for common * data @param txdataF Table of pointers for frequency-domain TX signals @param txdataF_BF Table of pointers for frequency-domain TX signals @param frame_parms Frame descriptor structure after beamforming - @param cell_spec_bf_weights Common beamforming weights applied on each + @param beam_weights Beamforming weights applied on each antenna element and each carrier @param slot Slot number @param symbol Symbol index on which to act*/ -int cell_spec_beamforming(int32_t **txdataF, - int32_t **txdataF_BF, - LTE_DL_FRAME_PARMS *frame_parms, - int32_t ***cell_spec_bf_weights, - int slot, - int symbol); +int beam_precoding(int32_t **txdataF, + int32_t **txdataF_BF, + LTE_DL_FRAME_PARMS *frame_parms, + int32_t ***beam_weights, + int slot, + int symbol); #endif /** @}*/ diff --git a/openair1/PHY/MODULATION/ofdm_mod.c b/openair1/PHY/MODULATION/ofdm_mod.c index e8344a1972..375c16c103 100755 --- a/openair1/PHY/MODULATION/ofdm_mod.c +++ b/openair1/PHY/MODULATION/ofdm_mod.c @@ -277,10 +277,11 @@ void do_OFDM_mod(mod_sym_t **txdataF, int32_t **txdata, uint32_t frame,uint16_t } // OFDM modulation for each symbol -void do_OFDM_mod_l(LTE_eNB_COMMON *eNB_common_vars, int eNB_id, uint16_t next_slot, LTE_DL_FRAME_PARMS *frame_parms, uint8_t num_pdcch_symbols, unsigned char transmission_mode) +void do_OFDM_mod_l(LTE_eNB_COMMON *eNB_common_vars, int eNB_id, uint16_t next_slot, LTE_DL_FRAME_PARMS *frame_parms, uint8_t num_pdcch_symbols) { int aa, l, slot_offset, slot_offset_F; + int8_t UE_id=0; mod_sym_t **txdataF = eNB_common_vars->txdataF[eNB_id]; mod_sym_t **txdataF_BF = eNB_common_vars->txdataF_BF[eNB_id]; int32_t **txdata = eNB_common_vars->txdata[eNB_id]; @@ -292,13 +293,8 @@ void do_OFDM_mod_l(LTE_eNB_COMMON *eNB_common_vars, int eNB_id, uint16_t next_sl for (l=0; lsymbols_per_tti>>1; l++) { //printf("do_OFDM_mod_l, slot=%d, l=%d, NUMBER_OF_OFDM_CARRIERS=%d,OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES=%d\n",next_slot, l,NUMBER_OF_OFDM_CARRIERS,OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES); - if (lcell_spec_bf_weights[eNB_id],next_slot,l); - else - if (transmission_mode<7) - cell_spec_beamforming(txdataF,txdataF_BF,frame_parms,eNB_common_vars->cell_spec_bf_weights[eNB_id],next_slot,l); - else - ue_spec_beamforming(txdataF,txdataF_BF,frame_parms,eNB_common_vars->ue_spec_bf_weights[eNB_id],next_slot,l); + + beam_precoding(txdataF,txdataF_BF,frame_parms,eNB_common_vars->beam_weights[eNB_id],next_slot,l); for (aa=0; aanb_antennas_tx; aa++) { @@ -331,4 +327,3 @@ void do_OFDM_mod_l(LTE_eNB_COMMON *eNB_common_vars, int eNB_id, uint16_t next_sl } } -/** @} */ diff --git a/openair1/PHY/impl_defs_lte.h b/openair1/PHY/impl_defs_lte.h index 864d2d5d19..7a6130cef8 100644 --- a/openair1/PHY/impl_defs_lte.h +++ b/openair1/PHY/impl_defs_lte.h @@ -638,17 +638,24 @@ typedef struct { /// - second index: cell specific eNB antenna port index, up to 2 logical antenna ports are supported /// - third index: tx antenna [0..nb_antennas_tx[ /// - fourth index: sample [0..] - int32_t **cell_spec_bf_weights[3][2]; + // int32_t **cell_spec_bf_weights[3][2]; /// \brief Holds the ue specific beamforming weights /// - first index: eNB id [0..2] (hard coded) /// - second index: ue specific eNB antenna port index, port5->index0, port7-15->index0-7 /// - third index: tx antenna [0..nb_antennas_tx[ /// - fourth index: sample [0..] - int32_t **ue_spec_bf_weights[3][8]; + // int32_t **ue_spec_bf_weights[3][8]; + /// \brief Holds the ue specific beamforming weights + /// - first index: eNB id [0..2] (hard coded) + /// - second index: eNB antenna port index + /// - third index: tx antenna [0..nb_antennas_tx[ + /// - fourth index: sample [0..] + int32_t **beam_weights[3][15]; /// \brief Holds the tdd reciprocity calibration coefficients /// - first index: eNB id [0..2] (hard coded) - /// - second index: tx antenna [0..nb_antennas_tx[ - /// - third index: frenquency [0..] + /// - second index: ue specific eNB antenna port index, port5->index0, port7-15->index0-7 + /// - third index: tx antenna [0..nb_antennas_tx[ + /// - forth index: frenquency [0..] int32_t **tdd_calib_coeffs[3]; } LTE_eNB_COMMON; diff --git a/openair1/SCHED/phy_procedures_lte_eNb.c b/openair1/SCHED/phy_procedures_lte_eNb.c index bb6eb704e0..d2a350a4b8 100755 --- a/openair1/SCHED/phy_procedures_lte_eNb.c +++ b/openair1/SCHED/phy_procedures_lte_eNb.c @@ -1610,7 +1610,7 @@ void phy_procedures_eNB_TX(unsigned char sched_subframe,PHY_VARS_eNB *phy_vars_e phy_vars_eNB->dlsch_eNB_ra->active = 0; } - // Now scan UE specific DLSCH + // Now scan UE specific DLSCH for (UE_id=0; UE_iddlsch_eNB[(uint8_t)UE_id][0])&& @@ -1779,6 +1779,7 @@ void phy_procedures_eNB_TX(unsigned char sched_subframe,PHY_VARS_eNB *phy_vars_e phy_vars_eNB->dlsch_eNB[(uint8_t)UE_id][0]->active = 0; //mac_xface->macphy_exit("first dlsch transmitted\n"); + } else if ((phy_vars_eNB->dlsch_eNB[(uint8_t)UE_id][0])&& @@ -1791,6 +1792,7 @@ void phy_procedures_eNB_TX(unsigned char sched_subframe,PHY_VARS_eNB *phy_vars_e //LOG_D(PHY,"[eNB %d] DCI: Clearing subframe_tx for subframe %d, UE %d\n",phy_vars_eNB->Mod_id,subframe,UE_id); #endif } + } @@ -1811,30 +1813,31 @@ void phy_procedures_eNB_TX(unsigned char sched_subframe,PHY_VARS_eNB *phy_vars_e } - #ifdef EMOS phy_procedures_emos_eNB_TX(subframe, phy_vars_eNB); #endif + //cell-specific beamforming + #if !(defined(EXMIMO) || defined(OAI_USRP) || defined (CPRIGW)) if (abstraction_flag==0) { start_meas(&phy_vars_eNB->ofdm_mod_stats); - do_OFDM_mod_l(phy_vars_eNB->lte_eNB_common_vars, + //do_OFDM_mod (without l) ? + + do_OFDM_mod_l(&phy_vars_eNB->lte_eNB_common_vars, 0, subframe<<1, &phy_vars_eNB->lte_frame_parms, - num_pdcch_symbols, - phy_vars_eNB->transmission_mode[(uint8_t)UE_id]); + num_pdcch_symbols); - do_OFDM_mod_l(phy_vars_eNB->lte_eNB_common_vars, + do_OFDM_mod_l(&phy_vars_eNB->lte_eNB_common_vars, 0, 1+(subframe<<1), &phy_vars_eNB->lte_frame_parms, - num_pdcch_symbols, - phy_vars_eNB->transmission_mode[(uint8_t)UE_id]); + num_pdcch_symbols); stop_meas(&phy_vars_eNB->ofdm_mod_stats); } diff --git a/openair1/SIMULATION/LTE_PHY/dlsim.c b/openair1/SIMULATION/LTE_PHY/dlsim.c index f5c2446e86..19a0437bdf 100644 --- a/openair1/SIMULATION/LTE_PHY/dlsim.c +++ b/openair1/SIMULATION/LTE_PHY/dlsim.c @@ -643,7 +643,7 @@ int main(int argc, char **argv) frame_parms = &PHY_vars_eNB->lte_frame_parms; - cell_spec_bf_weights = PHY_vars_eNB->lte_eNB_common_vars.cell_spec_bf_weights[0][0]; + cell_spec_bf_weights = PHY_vars_eNB->lte_eNB_common_vars.beam_weights[0][0]; for(aa=0;aaofdm_symbol_size;re++) { if (n_tx_phy==1 || n_tx_phy==2) @@ -655,7 +655,7 @@ int main(int argc, char **argv) else if (n_tx_phy==64) cell_spec_bf_weights[aa][re] = 0x00007fff>>4; } - } + } if (transmission_mode==7){ lte_gold_ue_spec_port5(PHY_vars_eNB->lte_gold_uespec_port5_table[0],Nid_cell,n_rnti); @@ -2813,15 +2813,13 @@ PMI_FEEDBACK: eNB_id, (subframe*2), &PHY_vars_eNB->lte_frame_parms, - num_pdcch_symbols, - transmission_mode); + num_pdcch_symbols); do_OFDM_mod_l(&PHY_vars_eNB->lte_eNB_common_vars, eNB_id, (subframe*2)+1, &PHY_vars_eNB->lte_frame_parms, - num_pdcch_symbols, - transmission_mode); + num_pdcch_symbols); stop_meas(&PHY_vars_eNB->ofdm_mod_stats); stop_meas(&PHY_vars_eNB->phy_proc_tx); diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.exmimo2.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.exmimo2.conf index 3ce32398f7..c0974d8703 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.exmimo2.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.exmimo2.conf @@ -154,13 +154,13 @@ eNBs = global_log_verbosity ="medium"; hw_log_level ="info"; hw_log_verbosity ="medium"; - phy_log_level ="warn"; + phy_log_level ="debug"; phy_log_verbosity ="medium"; - mac_log_level ="warn"; + mac_log_level ="debug"; mac_log_verbosity ="medium"; - rlc_log_level ="warn"; + rlc_log_level ="info"; rlc_log_verbosity ="medium"; - pdcp_log_level ="warn"; + pdcp_log_level ="info"; pdcp_log_verbosity ="medium"; rrc_log_level ="info"; rrc_log_verbosity ="medium"; From 81047e94af2092a83afcd9896c8ea9eb62b80ba2 Mon Sep 17 00:00:00 2001 From: Xiwen JIANG Date: Fri, 17 Jun 2016 16:41:21 +0200 Subject: [PATCH 185/349] cosmetic changes --- openair1/PHY/LTE_TRANSPORT/dlsch_coding.c | 1 - openair1/PHY/LTE_TRANSPORT/dlsch_modulation.c | 14 +++++++------- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/openair1/PHY/LTE_TRANSPORT/dlsch_coding.c b/openair1/PHY/LTE_TRANSPORT/dlsch_coding.c index eb13b52015..3f5fe2de84 100644 --- a/openair1/PHY/LTE_TRANSPORT/dlsch_coding.c +++ b/openair1/PHY/LTE_TRANSPORT/dlsch_coding.c @@ -204,7 +204,6 @@ LTE_eNB_DLSCH_t *new_eNB_dlsch(unsigned char Kmimo,unsigned char Mdlharq,uint32_ for (i=0; i<4; i++) { dlsch->ue_spec_bf_weights[i] = (int32_t **)malloc16(nb_antennas_tx*sizeof(int32_t*)); - dlsch->ue_spec_bf_weights[i] = (int32_t **)malloc16(nb_antennas_tx*sizeof(int32_t*)); for (aa=0; aaue_spec_bf_weights[i][aa] = (int32_t *)malloc16(OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES*sizeof(int32_t)); diff --git a/openair1/PHY/LTE_TRANSPORT/dlsch_modulation.c b/openair1/PHY/LTE_TRANSPORT/dlsch_modulation.c index f50b0a7567..1cba160c1f 100644 --- a/openair1/PHY/LTE_TRANSPORT/dlsch_modulation.c +++ b/openair1/PHY/LTE_TRANSPORT/dlsch_modulation.c @@ -46,7 +46,7 @@ Address : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 069 #include "defs.h" #include "UTIL/LOG/vcd_signal_dumper.h" -//#define DEBUG_DLSCH_MODULATION +#define DEBUG_DLSCH_MODULATION //#define is_not_pilot(pilots,re,nushift,use2ndpilots) ((pilots==0) || ((re!=nushift) && (re!=nushift+6)&&((re!=nushift+3)||(use2ndpilots==1))&&((re!=nushift+9)||(use2ndpilots==1)))?1:0) @@ -387,8 +387,8 @@ break; *jj=*jj+1; - ((int16_t *)&txdataF[aa][tti_offset])[0]=qam_table_s0[qam64_table_offset_re];//(int16_t)(((int32_t)amp*qam64_table[qam64_table_offset_re])>>15); - ((int16_t *)&txdataF[aa][tti_offset])[1]=qam_table_s0[qam64_table_offset_im];//(int16_t)(((int32_t)amp*qam64_table[qam64_table_offset_im])>>15); + ((int16_t *)&txdataF[0][tti_offset])[0]=qam_table_s0[qam64_table_offset_re];//(int16_t)(((int32_t)amp*qam64_table[qam64_table_offset_re])>>15); + ((int16_t *)&txdataF[0][tti_offset])[1]=qam_table_s0[qam64_table_offset_im];//(int16_t)(((int32_t)amp*qam64_table[qam64_table_offset_im])>>15); break; @@ -1457,7 +1457,7 @@ int dlsch_modulation(PHY_VARS_eNB* phy_vars_eNB, symbol_offset = (uint32_t)frame_parms->ofdm_symbol_size*(l+(subframe_offset*nsymb)); //memset(&txdataF[aa][symbol_offset],0,frame_parms->ofdm_symbol_size<<2); - //printf("symbol_offset %d,subframe offset %d : pilots %d\n",symbol_offset,subframe_offset,pilots); + // printf("symbol_offset %d,subframe offset %d : pilots %d\n",symbol_offset,subframe_offset,pilots); for (rb=0; rbN_RB_DL; rb++) { if (rb < 32) @@ -1618,7 +1618,7 @@ int dlsch_modulation(PHY_VARS_eNB* phy_vars_eNB, qam_table_s1 = NULL; if (rb_alloc_ind > 0) { - // printf("Allocated rb %d/symbol %d, skip_half %d, subframe_offset %d, symbol_offset %d, re_offset %d, jj %d\n",rb,l,skip_half,subframe_offset,symbol_offset,re_offset,jj); + //printf("Allocated rb %d/symbol %d, skip_half %d, subframe_offset %d, symbol_offset %d, re_offset %d, jj %d\n",rb,l,skip_half,subframe_offset,symbol_offset,re_offset,jj); allocate_REs_in_RB(phy_vars_eNB, txdataF, &jj, @@ -1660,7 +1660,7 @@ int dlsch_modulation(PHY_VARS_eNB* phy_vars_eNB, #ifdef DEBUG_DLSCH_MODULATION - msg("generate_dlsch : jj = %d,re_allocated = %d (G %d)\n",jj,re_allocated,get_G(frame_parms,dlsch0_harq->nb_rb,dlsch0_harq->rb_alloc,mod_order0,Nl0,2,0,subframe_offset)); + msg("generate_dlsch : jj = %d,re_allocated = %d (G %d)\n",jj,re_allocated,get_G(frame_parms,dlsch0_harq->nb_rb,dlsch0_harq->rb_alloc,mod_order0,Nl0,2,0,subframe_offset,1/*transmission mode*/)); #endif VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_MODULATION, VCD_FUNCTION_OUT); @@ -1759,7 +1759,7 @@ int mch_modulation(mod_sym_t **txdataF, #ifdef DEBUG_DLSCH_MODULATION - msg("generate_dlsch(MCH) : jj = %d,re_allocated = %d (G %d)\n",jj,re_allocated,get_G(frame_parms,dlsch->harq_processes[0]->nb_rb,dlsch->harq_processes[0]->rb_alloc,mod_order,1,2,0,subframe_offset)); + msg("generate_dlsch(MCH) : jj = %d,re_allocated = %d (G %d)\n",jj,re_allocated,get_G(frame_parms,dlsch->harq_processes[0]->nb_rb,dlsch->harq_processes[0]->rb_alloc,mod_order,1,2,0,subframe_offset,1/*transmission mode*/)); #endif return (re_allocated); From 5a40c9a8c74cf0530a508278ff9e5eb0676c5264 Mon Sep 17 00:00:00 2001 From: Xiwen JIANG Date: Fri, 17 Jun 2016 16:42:40 +0200 Subject: [PATCH 186/349] bug fixed for dlsch_modulation input --- openair1/SCHED/phy_procedures_lte_eNb.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openair1/SCHED/phy_procedures_lte_eNb.c b/openair1/SCHED/phy_procedures_lte_eNb.c index d2a350a4b8..e03ffa2120 100755 --- a/openair1/SCHED/phy_procedures_lte_eNb.c +++ b/openair1/SCHED/phy_procedures_lte_eNb.c @@ -1436,7 +1436,7 @@ void phy_procedures_eNB_TX(unsigned char sched_subframe,PHY_VARS_eNB *phy_vars_e 1, num_pdcch_symbols,phy_vars_eNB->proc[sched_subframe].frame_tx, subframe, - (phy_vars_eNB->transmission_mode[(uint8_t)UE_id]<7?0:phy_vars_eNB->transmission_mode[(uint8_t)UE_id])), + 0), 0, subframe<<1); @@ -1444,7 +1444,7 @@ void phy_procedures_eNB_TX(unsigned char sched_subframe,PHY_VARS_eNB *phy_vars_e start_meas(&phy_vars_eNB->dlsch_modulation_stats); // for (sect_id=0;sect_idlte_eNB_common_vars.txdataF[0], AMP, subframe, From a04682d47a54d0f0d5890f29599306d1ed341bf4 Mon Sep 17 00:00:00 2001 From: Xiwen JIANG Date: Fri, 17 Jun 2016 16:44:30 +0200 Subject: [PATCH 187/349] oaisim takes tx and rx antenna number from config file and transmission mode from the command line --- targets/SIMU/USER/init_lte.c | 8 ++++---- targets/SIMU/USER/init_lte.h | 1 + targets/SIMU/USER/oaisim_functions.c | 5 +++-- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/targets/SIMU/USER/init_lte.c b/targets/SIMU/USER/init_lte.c index 3b2bc34391..3463da77d8 100644 --- a/targets/SIMU/USER/init_lte.c +++ b/targets/SIMU/USER/init_lte.c @@ -229,7 +229,7 @@ void init_lte_vars(LTE_DL_FRAME_PARMS *frame_parms[MAX_NUM_CCs], uint8_t N_RB_DL, uint16_t Nid_cell, uint8_t cooperation_flag,uint8_t transmission_mode,uint8_t abstraction_flag, - int nb_antennas_rx, uint8_t eMBMS_active_state) + int nb_antennas_rx, int nb_antennas_tx, uint8_t eMBMS_active_state) { uint8_t eNB_id,UE_id,RN_id,CC_id; @@ -252,10 +252,10 @@ void init_lte_vars(LTE_DL_FRAME_PARMS *frame_parms[MAX_NUM_CCs], (frame_parms[CC_id])->Ncp = extended_prefix_flag; (frame_parms[CC_id])->Nid_cell = Nid_cell; (frame_parms[CC_id])->nushift = (Nid_cell%6); - (frame_parms[CC_id])->nb_antennas_tx = (transmission_mode == 1) ? 1 : 2; + (frame_parms[CC_id])->nb_antennas_tx = nb_antennas_tx; + (frame_parms[CC_id])->nb_antennas_rx = nb_antennas_rx; (frame_parms[CC_id])->nb_antenna_ports_eNB = (transmission_mode == 1 || transmission_mode == 7) ? 1 : 2; - (frame_parms[CC_id])->nb_antennas_rx = (transmission_mode == 1) ? 1 : 2; - (frame_parms[CC_id])->mode1_flag = (transmission_mode == 1) ? 1 : 0; + (frame_parms[CC_id])->mode1_flag = (frame_parms[CC_id])->nb_antenna_ports_eNB==1 ? 1 : 0; init_frame_parms(frame_parms[CC_id],1); diff --git a/targets/SIMU/USER/init_lte.h b/targets/SIMU/USER/init_lte.h index b00f1f8a3c..269863085d 100644 --- a/targets/SIMU/USER/init_lte.h +++ b/targets/SIMU/USER/init_lte.h @@ -57,4 +57,5 @@ void init_lte_vars(LTE_DL_FRAME_PARMS *frame_parms[MAX_NUM_CCs], uint8_t transmission_mode, uint8_t abstraction_flag, int nb_antennas_rx, + int nb_antennas_tx, uint8_t eMBMS_active_state); diff --git a/targets/SIMU/USER/oaisim_functions.c b/targets/SIMU/USER/oaisim_functions.c index 1b29da3740..326813181a 100644 --- a/targets/SIMU/USER/oaisim_functions.c +++ b/targets/SIMU/USER/oaisim_functions.c @@ -174,10 +174,11 @@ extern time_stats_t ul_chan_stats; extern int xforms; +const Enb_properties_array_t *enb_properties; + void get_simulation_options(int argc, char *argv[]) { int option; - const Enb_properties_array_t *enb_properties; char *conf_config_file_name = NULL; enum long_option_e { @@ -925,7 +926,7 @@ void init_openair1(void) // change the nb_connected_eNB for (CC_id=0; CC_idproperties[0]->nb_antennas_tx[CC_id],enb_properties->properties[0]->nb_antennas_tx[CC_id], oai_emulation.info.eMBMS_active_state); } for (eNB_id=0; eNB_id Date: Thu, 31 Mar 2016 11:34:32 +0200 Subject: [PATCH 188/349] transmission mode is now taken into account in RRC signalling small bugfix in dlsch_demodulation shunted out TM3-7 specific DCI generation in scheduler to enable basic operation. more work needed. --- .../PHY/LTE_TRANSPORT/dlsch_demodulation.c | 1 - openair2/LAYER2/MAC/eNB_scheduler_dlsch.c | 31 +++++-------------- openair2/RRC/LITE/MESSAGES/asn1_msg.c | 2 +- openair2/RRC/LITE/rrc_eNB.c | 2 +- .../CONF/enb.band7.exmimo2.conf | 2 +- 5 files changed, 11 insertions(+), 27 deletions(-) diff --git a/openair1/PHY/LTE_TRANSPORT/dlsch_demodulation.c b/openair1/PHY/LTE_TRANSPORT/dlsch_demodulation.c index f578c6f3e4..aeca578ef5 100644 --- a/openair1/PHY/LTE_TRANSPORT/dlsch_demodulation.c +++ b/openair1/PHY/LTE_TRANSPORT/dlsch_demodulation.c @@ -829,7 +829,6 @@ int rx_pdsch(PHY_VARS_UE *phy_vars_ue, return(-1); break; } - return(0); } diff --git a/openair2/LAYER2/MAC/eNB_scheduler_dlsch.c b/openair2/LAYER2/MAC/eNB_scheduler_dlsch.c index 58078082c0..2708f3bbb3 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler_dlsch.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_dlsch.c @@ -738,7 +738,8 @@ schedule_ue_spec( } break; - + /* + // this code is disabled for now - needs to be done properly case 4: // if (nb_rb>10) { ((DCI2_5MHz_2A_TDD_t*)DLSCH_dci)->ndi1 = 0; @@ -776,6 +777,7 @@ schedule_ue_spec( ((DCI1E_5MHz_2A_M10PRB_TDD_t*)DLSCH_dci)->dai = (UE_list->UE_template[CC_id][UE_id].DAI-1)&3; ((DCI1E_5MHz_2A_M10PRB_TDD_t*)DLSCH_dci)->dl_power_off = 1;//dl_pow_off[UE_id]; break; + */ } add_ue_dlsch_info(module_idP, @@ -1403,8 +1405,9 @@ schedule_ue_spec( break; + /* + // disabled for now as this needs to be done properly case 4: - // if (nb_rb>10) { ((DCI2_5MHz_2A_TDD_t*)DLSCH_dci)->mcs1 = mcs; ((DCI2_5MHz_2A_TDD_t*)DLSCH_dci)->harq_pid = harq_pid; ((DCI2_5MHz_2A_TDD_t*)DLSCH_dci)->ndi1 = 1; @@ -1412,15 +1415,6 @@ schedule_ue_spec( ((DCI2_5MHz_2A_TDD_t*)DLSCH_dci)->dai = (UE_list->UE_template[CC_id][UE_id].DAI-1)&3; ((DCI2_5MHz_2A_TDD_t*)DLSCH_dci)->TPC = tpc; - //} - /* else { - ((DCI2_5MHz_2A_L10PRB_TDD_t*)DLSCH_dci)->mcs1 = eNB_UE_stats->DL_cqi[0]; - ((DCI2_5MHz_2A_L10PRB_TDD_t*)DLSCH_dci)->harq_pid = harq_pid; - ((DCI2_5MHz_2A_L10PRB_TDD_t*)DLSCH_dci)->ndi1 = 1; - ((DCI2_5MHz_2A_L10PRB_TDD_t*)DLSCH_dci)->rv1 = round&3; - ((DCI2_5MHz_2A_L10PRB_TDD_t*)DLSCH_dci)->tpmi = 5; - ((DCI2_5MHz_2A_L10PRB_TDD_t*)DLSCH_dci)->dai = (UE_list->UE_template[CC_id][UE_id].DAI-1)&3; - }*/ break; case 5: @@ -1451,6 +1445,7 @@ schedule_ue_spec( ((DCI1E_5MHz_2A_M10PRB_TDD_t*)DLSCH_dci)->TPC = tpc; break; + */ } // Toggle NDI for next time @@ -1732,9 +1727,9 @@ fill_DLSCH_dci( break; + /* case 4: - //if (nb_rb>10) { // DCI format 2_2A ((DCI2_5MHz_2A_TDD_t*)DLSCH_dci)->rballoc = allocate_prbs_sub(nb_rb,rballoc_sub); ((DCI2_5MHz_2A_TDD_t*)DLSCH_dci)->rah = 0; @@ -1746,17 +1741,6 @@ fill_DLSCH_dci( sizeof_DCI2_5MHz_2A_TDD_t, format2, 0); - /*} - else { - ((DCI2_5MHz_2A_L10PRB_TDD_t*)DLSCH_dci)->rballoc = allocate_prbs_sub(nb_rb,rballoc_sub); - add_ue_spec_dci(DCI_pdu, - DLSCH_dci, - rnti, - sizeof(DCI2_5MHz_2A_L10PRB_TDD_t), - 2,//aggregation, - sizeof_DCI2_5MHz_2A_L10PRB_TDD_t, - format2_2A_L10PRB); - }*/ break; case 5: @@ -1786,6 +1770,7 @@ fill_DLSCH_dci( format1E_2A_M10PRB, 0); break; + */ } } diff --git a/openair2/RRC/LITE/MESSAGES/asn1_msg.c b/openair2/RRC/LITE/MESSAGES/asn1_msg.c index ff0adf713b..83fd5d357d 100644 --- a/openair2/RRC/LITE/MESSAGES/asn1_msg.c +++ b/openair2/RRC/LITE/MESSAGES/asn1_msg.c @@ -107,7 +107,7 @@ int errno; # endif #endif -//#define XER_PRINT +#define XER_PRINT extern Enb_properties_array_t enb_properties; typedef struct xer_sprint_string_s { diff --git a/openair2/RRC/LITE/rrc_eNB.c b/openair2/RRC/LITE/rrc_eNB.c index 42e28f752f..c53df65046 100644 --- a/openair2/RRC/LITE/rrc_eNB.c +++ b/openair2/RRC/LITE/rrc_eNB.c @@ -3289,7 +3289,7 @@ rrc_eNB_generate_RRCConnectionSetup( do_RRCConnectionSetup(ctxt_pP, ue_context_pP, (uint8_t*) eNB_rrc_inst[ctxt_pP->module_id].carrier[CC_id].Srb0.Tx_buffer.Payload, - (mac_xface->lte_frame_parms->nb_antennas_tx==2)?2:1, + mac_xface->get_transmission_mode(ctxt_pP->module_id,CC_id,ue_context_pP->ue_id_rnti), rrc_eNB_get_next_transaction_identifier(ctxt_pP->module_id), mac_xface->lte_frame_parms, SRB_configList, diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.exmimo2.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.exmimo2.conf index bc9d15195c..6493c01167 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.exmimo2.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.exmimo2.conf @@ -47,7 +47,7 @@ eNBs = pucch_nCS_AN = 0; pucch_n1_AN = 32; pdsch_referenceSignalPower = -24; - pdsch_p_b = 0; + pdsch_p_b = 1; pusch_n_SB = 1; pusch_enable64QAM = "DISABLE"; pusch_hoppingMode = "interSubFrame"; From 61a6b0612960c135c9988b1a81f2a5be8b0795ca Mon Sep 17 00:00:00 2001 From: Xiwen JIANG Date: Wed, 22 Jun 2016 11:09:24 +0200 Subject: [PATCH 189/349] distinguish beamforming mode in rx_pdsch for SI, RA and data --- openair1/PHY/LTE_TRANSPORT/dlsch_demodulation.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/openair1/PHY/LTE_TRANSPORT/dlsch_demodulation.c b/openair1/PHY/LTE_TRANSPORT/dlsch_demodulation.c index aeca578ef5..831744bc09 100644 --- a/openair1/PHY/LTE_TRANSPORT/dlsch_demodulation.c +++ b/openair1/PHY/LTE_TRANSPORT/dlsch_demodulation.c @@ -100,7 +100,7 @@ int rx_pdsch(PHY_VARS_UE *phy_vars_ue, int avgs, rb; LTE_DL_UE_HARQ_t *dlsch0_harq,*dlsch1_harq = 0; - uint8_t beamforming_mode = phy_vars_ue->transmission_mode[eNB_id]<7?0:phy_vars_ue->transmission_mode[eNB_id]; + uint8_t beamforming_mode; uint32_t *rballoc; switch (type) { @@ -108,12 +108,14 @@ int rx_pdsch(PHY_VARS_UE *phy_vars_ue, lte_ue_pdsch_vars = &phy_vars_ue->lte_ue_pdsch_vars_SI[eNB_id]; dlsch_ue = &phy_vars_ue->dlsch_ue_SI[eNB_id]; dlsch0_harq = dlsch_ue[0]->harq_processes[harq_pid]; + beamforming_mode = 0; break; case RA_PDSCH: lte_ue_pdsch_vars = &phy_vars_ue->lte_ue_pdsch_vars_ra[eNB_id]; dlsch_ue = &phy_vars_ue->dlsch_ue_ra[eNB_id]; dlsch0_harq = dlsch_ue[0]->harq_processes[harq_pid]; + beamforming_mode = 0; break; case PDSCH: @@ -121,6 +123,7 @@ int rx_pdsch(PHY_VARS_UE *phy_vars_ue, dlsch_ue = phy_vars_ue->dlsch_ue[eNB_id]; dlsch0_harq = dlsch_ue[0]->harq_processes[harq_pid]; dlsch1_harq = dlsch_ue[1]->harq_processes[harq_pid]; + beamforming_mode = phy_vars_ue->transmission_mode[eNB_id]<7?0:phy_vars_ue->transmission_mode[eNB_id]; break; default: @@ -204,7 +207,7 @@ int rx_pdsch(PHY_VARS_UE *phy_vars_ue, phy_vars_ue->high_speed_flag, frame_parms); } - } else if (beamforming_mode==0) {// if n_tx>1 + } else if (beamforming_mode==0) { //else if nb_antennas_ports_eNB==1 && beamforming_mode == 0 nb_rb = dlsch_extract_rbs_single(lte_ue_common_vars->rxdataF, lte_ue_common_vars->dl_ch_estimates[eNB_id], lte_ue_pdsch_vars[eNB_id]->rxdataF_ext, @@ -243,7 +246,7 @@ int rx_pdsch(PHY_VARS_UE *phy_vars_ue, phy_vars_ue->high_speed_flag, frame_parms); } - } else if (beamforming_mode==7) { //else n_tx>1 + } else if (beamforming_mode==7) { //else if beamforming_mode == 7 nb_rb = dlsch_extract_rbs_TM7(lte_ue_common_vars->rxdataF, lte_ue_pdsch_vars[eNB_id]->dl_bf_ch_estimates, lte_ue_pdsch_vars[eNB_id]->rxdataF_ext, From 4fa0810cdd9c8ddddd1585021279d140459f0e9a Mon Sep 17 00:00:00 2001 From: Xiwen JIANG Date: Fri, 24 Jun 2016 12:20:38 +0200 Subject: [PATCH 190/349] add tm7 case into asn1 message --- openair2/RRC/LITE/MESSAGES/asn1_msg.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/openair2/RRC/LITE/MESSAGES/asn1_msg.c b/openair2/RRC/LITE/MESSAGES/asn1_msg.c index 83fd5d357d..aa7dcba62f 100644 --- a/openair2/RRC/LITE/MESSAGES/asn1_msg.c +++ b/openair2/RRC/LITE/MESSAGES/asn1_msg.c @@ -1602,6 +1602,7 @@ do_RRCConnectionSetup( // AntennaInfoDedicated__transmissionMode_tm2); switch (transmission_mode) { + default: case 1: physicalConfigDedicated2->antennaInfo->choice.explicitValue.transmissionMode= AntennaInfoDedicated__transmissionMode_tm1; break; @@ -1634,6 +1635,10 @@ do_RRCConnectionSetup( case 6: physicalConfigDedicated2->antennaInfo->choice.explicitValue.transmissionMode= AntennaInfoDedicated__transmissionMode_tm6; break; + + case 7: + physicalConfigDedicated2->antennaInfo->choice.explicitValue.transmissionMode= AntennaInfoDedicated__transmissionMode_tm7; + break; } From 6a8a551ef33f8def8c37ab9f955e1e290cea0dd0 Mon Sep 17 00:00:00 2001 From: Xiwen JIANG Date: Fri, 24 Jun 2016 12:32:57 +0200 Subject: [PATCH 191/349] add beamforming_mode into generate eNB and UE dlsch parameters from DCI --- openair1/PHY/LTE_TRANSPORT/dci_tools.c | 23 +++++++++--- openair1/PHY/LTE_TRANSPORT/proto.h | 6 ++-- openair1/SCHED/phy_procedures_lte_eNb.c | 9 +++-- openair1/SCHED/phy_procedures_lte_ue.c | 16 +++++---- openair1/SIMULATION/LTE_PHY/dlsim.c | 48 +++++++++++++++---------- 5 files changed, 68 insertions(+), 34 deletions(-) diff --git a/openair1/PHY/LTE_TRANSPORT/dci_tools.c b/openair1/PHY/LTE_TRANSPORT/dci_tools.c index f1bf0da14f..a01b31ee90 100644 --- a/openair1/PHY/LTE_TRANSPORT/dci_tools.c +++ b/openair1/PHY/LTE_TRANSPORT/dci_tools.c @@ -872,7 +872,8 @@ int generate_eNB_dlsch_params_from_dci(int frame, uint16_t si_rnti, uint16_t ra_rnti, uint16_t p_rnti, - uint16_t DL_pmi_single) + uint16_t DL_pmi_single, + uint8_t beamforming_mode) { uint8_t harq_pid = UINT8_MAX; @@ -1244,7 +1245,13 @@ int generate_eNB_dlsch_params_from_dci(int frame, dlsch0_harq->Nl = 1; // dlsch[0]->layer_index = 0; - dlsch0_harq->mimo_mode = (frame_parms->mode1_flag == 1) ? SISO : ALAMOUTI; + if (beamforming_mode == 0) + dlsch0_harq->mimo_mode = (frame_parms->mode1_flag == 1) ? SISO : ALAMOUTI; + else if (beamforming_mode == 7) + dlsch0_harq->mimo_mode = TM7; + else + LOG_E(PHY,"Invalid beamforming mode %dL\n", beamforming_mode); + dlsch0_harq->dl_power_off = 1; /* if (dlsch[0]->harq_processes[harq_pid]->first_tx == 1) { @@ -3854,7 +3861,8 @@ int generate_ue_dlsch_params_from_dci(int frame, PDSCH_CONFIG_DEDICATED *pdsch_config_dedicated, uint16_t si_rnti, uint16_t ra_rnti, - uint16_t p_rnti) + uint16_t p_rnti, + uint8_t beamforming_mode) { uint8_t harq_pid=0; @@ -4171,6 +4179,7 @@ int generate_ue_dlsch_params_from_dci(int frame, dlsch0_harq->rvidx = rv; dlsch0_harq->Nl = 1; // dlsch[0]->layer_index = 0; + dlsch0_harq->mimo_mode = frame_parms->mode1_flag == 1 ?SISO : ALAMOUTI; dlsch0_harq->dl_power_off = 1; //no power offset @@ -4521,7 +4530,13 @@ int generate_ue_dlsch_params_from_dci(int frame, dlsch[0]->rnti = rnti; - dlsch0_harq->mimo_mode = (frame_parms->mode1_flag == 1) ? SISO : ALAMOUTI; + if (beamforming_mode == 0) + dlsch0_harq->mimo_mode = (frame_parms->mode1_flag == 1) ? SISO : ALAMOUTI; + else if (beamforming_mode == 7) + dlsch0_harq->mimo_mode = TM7; + else + LOG_E(PHY,"Not supported beamforming mode %d\n",beamforming_mode); + dlsch0 = dlsch[0]; diff --git a/openair1/PHY/LTE_TRANSPORT/proto.h b/openair1/PHY/LTE_TRANSPORT/proto.h index 35de21c7b8..7535a26470 100644 --- a/openair1/PHY/LTE_TRANSPORT/proto.h +++ b/openair1/PHY/LTE_TRANSPORT/proto.h @@ -1424,7 +1424,8 @@ int generate_ue_dlsch_params_from_dci(int frame, PDSCH_CONFIG_DEDICATED *pdsch_config_dedicated, uint16_t si_rnti, uint16_t ra_rnti, - uint16_t p_rnti); + uint16_t p_rnti, + uint8_t beamforming_mode); int32_t generate_eNB_dlsch_params_from_dci(int frame, uint8_t subframe, @@ -1437,7 +1438,8 @@ int32_t generate_eNB_dlsch_params_from_dci(int frame, uint16_t si_rnti, uint16_t ra_rnti, uint16_t p_rnti, - uint16_t DL_pmi_single); + uint16_t DL_pmi_single, + uint8_t beamforming_mode); int32_t generate_eNB_ulsch_params_from_rar(uint8_t *rar_pdu, frame_t frame, diff --git a/openair1/SCHED/phy_procedures_lte_eNb.c b/openair1/SCHED/phy_procedures_lte_eNb.c index e03ffa2120..e9ee770545 100755 --- a/openair1/SCHED/phy_procedures_lte_eNb.c +++ b/openair1/SCHED/phy_procedures_lte_eNb.c @@ -1094,7 +1094,8 @@ void phy_procedures_eNB_TX(unsigned char sched_subframe,PHY_VARS_eNB *phy_vars_e SI_RNTI, 0, P_RNTI, - phy_vars_eNB->eNB_UE_stats[0].DL_pmi_single); + phy_vars_eNB->eNB_UE_stats[0].DL_pmi_single, + 0); phy_vars_eNB->dlsch_eNB_SI->nCCE[subframe] = DCI_pdu->dci_alloc[i].firstCCE; @@ -1129,7 +1130,8 @@ void phy_procedures_eNB_TX(unsigned char sched_subframe,PHY_VARS_eNB *phy_vars_e SI_RNTI, DCI_pdu->dci_alloc[i].rnti, P_RNTI, - phy_vars_eNB->eNB_UE_stats[0].DL_pmi_single); + phy_vars_eNB->eNB_UE_stats[0].DL_pmi_single, + 0); // mac_xface->macphy_exit("Transmitted RAR, exiting\n"); @@ -1187,7 +1189,8 @@ void phy_procedures_eNB_TX(unsigned char sched_subframe,PHY_VARS_eNB *phy_vars_e SI_RNTI, 0, P_RNTI, - phy_vars_eNB->eNB_UE_stats[(uint8_t)UE_id].DL_pmi_single); + phy_vars_eNB->eNB_UE_stats[(uint8_t)UE_id].DL_pmi_single, + phy_vars_eNB->transmission_mode[(uint8_t)UE_id]>7?0:phy_vars_eNB->transmission_mode[(uint8_t)UE_id]); LOG_D(PHY,"[eNB %"PRIu8"][PDSCH %"PRIx16"/%"PRIu8"] Frame %d subframe %d: Generated dlsch params\n", phy_vars_eNB->Mod_id,DCI_pdu->dci_alloc[i].rnti,phy_vars_eNB->dlsch_eNB[(uint8_t)UE_id][0]->current_harq_pid,phy_vars_eNB->proc[sched_subframe].frame_tx,subframe); diff --git a/openair1/SCHED/phy_procedures_lte_ue.c b/openair1/SCHED/phy_procedures_lte_ue.c index 0ad6505149..d87a8479f5 100755 --- a/openair1/SCHED/phy_procedures_lte_ue.c +++ b/openair1/SCHED/phy_procedures_lte_ue.c @@ -132,7 +132,7 @@ void dump_dlsch(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t subframe,uint8_t phy_vars_ue->lte_ue_pdcch_vars[eNB_id]->num_pdcch_symbols, phy_vars_ue->frame_rx, subframe, - phy_vars_ue->transmission_mode[eNB_id]); + phy_vars_ue->transmission_mode[eNB_id]); write_output("rxsigF0.m","rxsF0", phy_vars_ue->lte_ue_common_vars.rxdataF[0],2*nsymb*phy_vars_ue->lte_frame_parms.ofdm_symbol_size,2,1); write_output("rxsigF0_ext.m","rxsF0_ext", phy_vars_ue->lte_ue_pdsch_vars[0]->rxdataF_ext[0],2*nsymb*phy_vars_ue->lte_frame_parms.ofdm_symbol_size,1,1); @@ -2143,7 +2143,8 @@ int lte_ue_pdcch_procedures(uint8_t eNB_id,PHY_VARS_UE *phy_vars_ue,uint8_t abst phy_vars_ue->pdsch_config_dedicated, SI_RNTI, 0, - P_RNTI)==0)) { + P_RNTI, + phy_vars_ue->transmission_mode[eNB_id]>7?0:phy_vars_ue->transmission_mode[eNB_id])==0)) { #ifdef DIAG_PHY @@ -2211,7 +2212,8 @@ int lte_ue_pdcch_procedures(uint8_t eNB_id,PHY_VARS_UE *phy_vars_ue,uint8_t abst phy_vars_ue->pdsch_config_dedicated, SI_RNTI, 0, - P_RNTI)==0) { + P_RNTI, + 0)==0) { phy_vars_ue->dlsch_SI_received[eNB_id]++; @@ -2255,7 +2257,8 @@ int lte_ue_pdcch_procedures(uint8_t eNB_id,PHY_VARS_UE *phy_vars_ue,uint8_t abst phy_vars_ue->pdsch_config_dedicated, SI_RNTI, phy_vars_ue->prach_resources[eNB_id]->ra_RNTI, - P_RNTI)==0) { + P_RNTI, + 0)==0) { phy_vars_ue->dlsch_ra_received[eNB_id]++; @@ -2790,7 +2793,7 @@ int phy_procedures_UE_RX(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstrac phy_vars_ue->lte_ue_pdcch_vars[eNB_id]->num_pdcch_symbols, frame_rx, subframe_prev, - phy_vars_ue->transmission_mode[eNB_id]); + 0); #ifdef DEBUG_PHY_PROC LOG_D(PHY,"Decoding DLSCH_SI : rb_alloc %x : nb_rb %d G %d TBS %d, num_pdcch_sym %d\n",phy_vars_ue->dlsch_ue_SI[eNB_id]->harq_processes[0]->rb_alloc_even[0], @@ -2853,8 +2856,7 @@ int phy_procedures_UE_RX(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstrac phy_vars_ue->dlsch_ue_SI[eNB_id]->harq_processes[0]->rb_alloc_even[2], phy_vars_ue->dlsch_ue_SI[eNB_id]->harq_processes[0]->rb_alloc_even[3]); #endif - - // dump_dlsch_SI(phy_vars_ue,eNB_id,subframe_prev); + // dump_dlsch_SI(phy_vars_ue,eNB_id,subframe_prev); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_RX, VCD_FUNCTION_OUT); stop_meas(&phy_vars_ue->phy_proc_rx); return(-1); diff --git a/openair1/SIMULATION/LTE_PHY/dlsim.c b/openair1/SIMULATION/LTE_PHY/dlsim.c index 19a0437bdf..6e78ad1a56 100644 --- a/openair1/SIMULATION/LTE_PHY/dlsim.c +++ b/openair1/SIMULATION/LTE_PHY/dlsim.c @@ -1149,10 +1149,11 @@ int main(int argc, char **argv) SI_RNTI, 0, P_RNTI, - PHY_vars_eNB->eNB_UE_stats[0].DL_pmi_single); + PHY_vars_eNB->eNB_UE_stats[0].DL_pmi_single, + transmission_mode<7?0:transmission_mode); - if (transmission_mode == 7) - PHY_vars_eNB->dlsch_eNB[0][0]->harq_processes[0]->mimo_mode = TM7; //Xiwen: to check about harq_pid + /*if (transmission_mode == 7) + PHY_vars_eNB->dlsch_eNB[0][0]->harq_processes[0]->mimo_mode = TM7; //Xiwen: to check about harq_pid*/ num_dci++; num_ue_spec_dci++; @@ -1292,7 +1293,8 @@ int main(int argc, char **argv) SI_RNTI, 0, P_RNTI, - PHY_vars_eNB->eNB_UE_stats[0].DL_pmi_single); + PHY_vars_eNB->eNB_UE_stats[0].DL_pmi_single, + 0); num_common_dci++; num_dci++; @@ -1459,7 +1461,8 @@ int main(int argc, char **argv) SI_RNTI, 0, P_RNTI, - PHY_vars_eNB->eNB_UE_stats[0].DL_pmi_single); + PHY_vars_eNB->eNB_UE_stats[0].DL_pmi_single, + 0); num_dci++; num_ue_spec_dci++; @@ -1599,7 +1602,8 @@ int main(int argc, char **argv) SI_RNTI, 0, P_RNTI, - PHY_vars_eNB->eNB_UE_stats[0].DL_pmi_single); + PHY_vars_eNB->eNB_UE_stats[0].DL_pmi_single, + 0); num_common_dci++; num_dci++; @@ -1767,7 +1771,8 @@ int main(int argc, char **argv) SI_RNTI, 0, P_RNTI, - PHY_vars_eNB->eNB_UE_stats[0].DL_pmi_single); + PHY_vars_eNB->eNB_UE_stats[0].DL_pmi_single, + 0); num_dci++; num_ue_spec_dci++; @@ -1907,7 +1912,8 @@ int main(int argc, char **argv) SI_RNTI, 0, P_RNTI, - PHY_vars_eNB->eNB_UE_stats[0].DL_pmi_single); + PHY_vars_eNB->eNB_UE_stats[0].DL_pmi_single, + 0); num_common_dci++; num_dci++; @@ -1936,7 +1942,8 @@ int main(int argc, char **argv) SI_RNTI, 0, P_RNTI, - PHY_vars_eNB->eNB_UE_stats[k].DL_pmi_single); + PHY_vars_eNB->eNB_UE_stats[k].DL_pmi_single, + 0); dump_dci(&PHY_vars_eNB->lte_frame_parms,&dci_alloc[num_dci]); num_ue_spec_dci++; @@ -3226,7 +3233,8 @@ PMI_FEEDBACK: PHY_vars_UE->pdsch_config_dedicated, SI_RNTI, 0, - P_RNTI)==0)) { + P_RNTI==0, + transmission_mode<7?0:transmission_mode))) { //dump_dci(&PHY_vars_UE->lte_frame_parms,&dci_alloc_rx[i]); coded_bits_per_codeword = get_G(&PHY_vars_eNB->lte_frame_parms, PHY_vars_UE->dlsch_ue[0][0]->harq_processes[PHY_vars_UE->dlsch_ue[0][0]->current_harq_pid]->nb_rb, @@ -3237,8 +3245,8 @@ PMI_FEEDBACK: 0, subframe, (transmission_mode<7?0:transmission_mode)); - if (transmission_mode==7 && common_flag==0) - PHY_vars_UE->dlsch_ue[0][0]->harq_processes[0]->mimo_mode = TM7; + /*if (transmission_mode==7 && common_flag==0) + PHY_vars_UE->dlsch_ue[0][0]->harq_processes[0]->mimo_mode = TM7; */ /* rate = (double)dlsch_tbs25[get_I_TBS(PHY_vars_UE->dlsch_ue[0][0]->harq_processes[PHY_vars_UE->dlsch_ue[0][0]->current_harq_pid]->mcs)][PHY_vars_UE->dlsch_ue[0][0]->nb_rb-1]/(coded_bits_per_codeword); @@ -3289,9 +3297,10 @@ PMI_FEEDBACK: PHY_vars_UE->pdsch_config_dedicated, SI_RNTI, 0, - P_RNTI); - if(transmission_mode==7 && common_flag==0) - PHY_vars_UE->dlsch_ue[0][0]->harq_processes[0]->mimo_mode = TM7; + P_RNTI, + transmission_mode<7?0:transmission_mode); + /*if(transmission_mode==7 && common_flag==0) + PHY_vars_UE->dlsch_ue[0][0]->harq_processes[0]->mimo_mode = TM7;*/ break; case 3: @@ -3306,7 +3315,8 @@ PMI_FEEDBACK: PHY_vars_UE->pdsch_config_dedicated, SI_RNTI, 0, - P_RNTI); + P_RNTI, + 0); // printf("Rate: TM3 (after) round %d (%d) first_tx %d\n",round,PHY_vars_UE->dlsch_ue[0][0]->harq_processes[0]->round,PHY_vars_UE->dlsch_ue[0][0]->harq_processes[0]->first_tx); break; @@ -3321,7 +3331,8 @@ PMI_FEEDBACK: PHY_vars_UE->pdsch_config_dedicated, SI_RNTI, 0, - P_RNTI); + P_RNTI, + 0); break; case 5: @@ -3336,7 +3347,8 @@ PMI_FEEDBACK: PHY_vars_UE->pdsch_config_dedicated, SI_RNTI, 0, - P_RNTI); + P_RNTI, + 0); break; } From 7d7cbc57f84fd19dd0e35f90880648a52c9ccd8f Mon Sep 17 00:00:00 2001 From: Xiwen JIANG Date: Fri, 24 Jun 2016 18:09:06 +0200 Subject: [PATCH 192/349] set transmission mode in phy_config_dedicated_[UE|eNB] after RRCConnectionReconfiguration(eNB) and RRCConnectionReconfigurationComplete(UE) --- openair1/PHY/INIT/lte_init.c | 62 ++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) diff --git a/openair1/PHY/INIT/lte_init.c b/openair1/PHY/INIT/lte_init.c index f5e9fdae10..c1f8c89b55 100644 --- a/openair1/PHY/INIT/lte_init.c +++ b/openair1/PHY/INIT/lte_init.c @@ -663,6 +663,39 @@ void phy_config_dedicated_eNB(uint8_t Mod_id, if (physicalConfigDedicated) { phy_vars_eNB->physicalConfigDedicated[UE_id] = physicalConfigDedicated; LOG_I(PHY,"phy_config_dedicated_eNB: physicalConfigDedicated=%p\n",physicalConfigDedicated); + + if (physicalConfigDedicated->antennaInfo) { + switch(physicalConfigDedicated->antennaInfo->choice.explicitValue.transmissionMode) { + case AntennaInfoDedicated__transmissionMode_tm1: + phy_vars_eNB->transmission_mode[UE_id] = 1; + break; + case AntennaInfoDedicated__transmissionMode_tm2: + phy_vars_eNB->transmission_mode[UE_id] = 2; + break; + case AntennaInfoDedicated__transmissionMode_tm3: + phy_vars_eNB->transmission_mode[UE_id] = 3; + break; + case AntennaInfoDedicated__transmissionMode_tm4: + phy_vars_eNB->transmission_mode[UE_id] = 4; + break; + case AntennaInfoDedicated__transmissionMode_tm5: + phy_vars_eNB->transmission_mode[UE_id] = 5; + break; + case AntennaInfoDedicated__transmissionMode_tm6: + phy_vars_eNB->transmission_mode[UE_id] = 6; + break; + case AntennaInfoDedicated__transmissionMode_tm7: + phy_vars_eNB->transmission_mode[UE_id] = 7; + lte_gold_ue_spec_port5(phy_vars_eNB->lte_gold_uespec_port5_table[0],phy_vars_eNB->lte_frame_parms.Nid_cell,rnti); + break; + default: + LOG_E(PHY,"Unknown transmission mode!\n"); + break; + } + } else { + LOG_D(PHY,"[eNB %d] Frame %d: Received NULL radioResourceConfigDedicated->antennaInfo from eNB %d\n",Mod_id, phy_vars_eNB->proc[8].frame_tx,UE_id); + } + } else { LOG_E(PHY,"[eNB %d] Frame %d: Received NULL radioResourceConfigDedicated from eNB %d\n",Mod_id, phy_vars_eNB->proc[8].frame_tx,UE_id); return; @@ -825,6 +858,35 @@ void phy_config_dedicated_ue(uint8_t Mod_id,int CC_id,uint8_t CH_index, phy_vars_ue->transmission_mode[CH_index] = 1+(physicalConfigDedicated->antennaInfo->choice.explicitValue.transmissionMode); LOG_D(PHY,"Transmission Mode %d\n",phy_vars_ue->transmission_mode[CH_index]); LOG_D(PHY,"\n"); + switch(physicalConfigDedicated->antennaInfo->choice.explicitValue.transmissionMode) { + case AntennaInfoDedicated__transmissionMode_tm1: + phy_vars_ue->transmission_mode[CH_index] = 1; + break; + case AntennaInfoDedicated__transmissionMode_tm2: + phy_vars_ue->transmission_mode[CH_index] = 2; + break; + case AntennaInfoDedicated__transmissionMode_tm3: + phy_vars_ue->transmission_mode[CH_index] = 3; + break; + case AntennaInfoDedicated__transmissionMode_tm4: + phy_vars_ue->transmission_mode[CH_index] = 4; + break; + case AntennaInfoDedicated__transmissionMode_tm5: + phy_vars_ue->transmission_mode[CH_index] = 5; + break; + case AntennaInfoDedicated__transmissionMode_tm6: + phy_vars_ue->transmission_mode[CH_index] = 6; + break; + case AntennaInfoDedicated__transmissionMode_tm7: + phy_vars_ue->transmission_mode[CH_index] = 7; + lte_gold_ue_spec_port5(phy_vars_ue->lte_gold_uespec_port5_table, phy_vars_ue->lte_frame_parms.Nid_cell, phy_vars_ue->lte_ue_pdcch_vars[CH_index]->crnti); + break; + default: + LOG_E(PHY,"Unknown transmission mode!\n"); + break; + } + } else { + LOG_D(PHY,"[UE %d] Frame %d: Received NULL physicalConfigDedicated->antennaInfo from eNB %d\n",Mod_id, phy_vars_ue->frame_rx,CH_index); } if (physicalConfigDedicated->schedulingRequestConfig) { From 95808aec1062d66d124955407d36f79e6579f8ba Mon Sep 17 00:00:00 2001 From: Xiwen JIANG Date: Fri, 24 Jun 2016 18:11:21 +0200 Subject: [PATCH 193/349] add ue_TransmissionMode in RrcConfigurationReq --- openair2/RRC/LITE/rrc_eNB.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/openair2/RRC/LITE/rrc_eNB.c b/openair2/RRC/LITE/rrc_eNB.c index c53df65046..6b591e0c35 100644 --- a/openair2/RRC/LITE/rrc_eNB.c +++ b/openair2/RRC/LITE/rrc_eNB.c @@ -99,7 +99,7 @@ #include "SIMULATION/TOOLS/defs.h" // for taus -//#define XER_PRINT +#define XER_PRINT #ifdef PHY_EMUL extern EMULATION_VARS *Emul_vars; @@ -3289,7 +3289,8 @@ rrc_eNB_generate_RRCConnectionSetup( do_RRCConnectionSetup(ctxt_pP, ue_context_pP, (uint8_t*) eNB_rrc_inst[ctxt_pP->module_id].carrier[CC_id].Srb0.Tx_buffer.Payload, - mac_xface->get_transmission_mode(ctxt_pP->module_id,CC_id,ue_context_pP->ue_id_rnti), + //mac_xface->get_transmission_mode(ctxt_pP->module_id,CC_id,ue_context_pP->ue_id_rnti), + (mac_xface->lte_frame_parms->nb_antenna_ports_eNB==2)?2:1, //at this point we do not have the UE capability information, so it can only be TM1 or TM2 rrc_eNB_get_next_transaction_identifier(ctxt_pP->module_id), mac_xface->lte_frame_parms, SRB_configList, From 224498cf3bfd631bd16bb7fd6217a7516a6ec888 Mon Sep 17 00:00:00 2001 From: Xiwen JIANG Date: Fri, 24 Jun 2016 18:13:02 +0200 Subject: [PATCH 194/349] add ue_TransmissionMode in RrcConfigurationReq --- openair2/COMMON/rrc_messages_types.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openair2/COMMON/rrc_messages_types.h b/openair2/COMMON/rrc_messages_types.h index 816b936895..ffe194265f 100644 --- a/openair2/COMMON/rrc_messages_types.h +++ b/openair2/COMMON/rrc_messages_types.h @@ -179,7 +179,7 @@ typedef struct RrcConfigurationReq_s { long ue_TimersAndConstants_t311[MAX_NUM_CCs]; long ue_TimersAndConstants_n310[MAX_NUM_CCs]; long ue_TimersAndConstants_n311[MAX_NUM_CCs]; - + long ue_TransmissionMode[MAX_NUM_CCs]; } RrcConfigurationReq; // UE: NAS -> RRC messages From 71c047d1aefbcea25f6a33b749da7573bc8db239 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Wed, 29 Jun 2016 12:32:19 +0300 Subject: [PATCH 195/349] Revert to single eNodeB for simulation --- openair2/RRC/LITE/rrc_eNB.c | 4619 +++++++++++++++++++++++++++++++++++ 1 file changed, 4619 insertions(+) create mode 100644 openair2/RRC/LITE/rrc_eNB.c diff --git a/openair2/RRC/LITE/rrc_eNB.c b/openair2/RRC/LITE/rrc_eNB.c new file mode 100644 index 0000000000..804bc8aa21 --- /dev/null +++ b/openair2/RRC/LITE/rrc_eNB.c @@ -0,0 +1,4619 @@ +/******************************************************************************* + OpenAirInterface + Copyright(c) 1999 - 2014 Eurecom + + OpenAirInterface is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + + OpenAirInterface is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with OpenAirInterface.The full GNU General Public License is + included in this distribution in the file called "COPYING". If not, + see . + + Contact Information + OpenAirInterface Admin: openair_admin@eurecom.fr + OpenAirInterface Tech : openair_tech@eurecom.fr + OpenAirInterface Dev : openair4g-devel@lists.eurecom.fr + + Address : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE + +*******************************************************************************/ + +/*! \file rrc_eNB.c + * \brief rrc procedures for eNB + * \author Navid Nikaein and Raymond Knopp + * \date 2011 - 2014 + * \version 1.0 + * \company Eurecom + * \email: navid.nikaein@eurecom.fr and raymond.knopp@eurecom.fr + */ +#define RRC_ENB +#define RRC_ENB_C + +#include "defs.h" +#include "extern.h" +#include "assertions.h" +#include "asn1_conversions.h" +#include "RRC/L2_INTERFACE/openair_rrc_L2_interface.h" +#include "LAYER2/RLC/rlc.h" +#include "LAYER2/MAC/proto.h" +#include "UTIL/LOG/log.h" +#include "COMMON/mac_rrc_primitives.h" +#include "RRC/LITE/MESSAGES/asn1_msg.h" +#include "RRCConnectionRequest.h" +#include "RRCConnectionReestablishmentRequest.h" +//#include "ReestablishmentCause.h" +#include "UL-CCCH-Message.h" +#include "DL-CCCH-Message.h" +#include "UL-DCCH-Message.h" +#include "DL-DCCH-Message.h" +#include "TDD-Config.h" +#include "HandoverCommand.h" +#include "rlc.h" +#include "SIMULATION/ETH_TRANSPORT/extern.h" +#include "rrc_eNB_UE_context.h" +#include "platform_types.h" +#include "msc.h" + +#include "T.h" + +//#ifdef Rel10 +#include "MeasResults.h" +//#endif + +#ifdef USER_MODE +# include "RRC/NAS/nas_config.h" +# include "RRC/NAS/rb_config.h" +# include "OCG.h" +# include "OCG_extern.h" +#endif + +#if defined(ENABLE_SECURITY) +# include "UTIL/OSA/osa_defs.h" +#endif + +#if defined(ENABLE_USE_MME) +# include "rrc_eNB_S1AP.h" +# include "rrc_eNB_GTPV1U.h" +# if defined(ENABLE_ITTI) +# else +# include "../../S1AP/s1ap_eNB.h" +# endif +#endif + +#include "pdcp.h" + +#if defined(ENABLE_ITTI) +# include "intertask_interface.h" +#endif + +#if ENABLE_RAL +# include "rrc_eNB_ral.h" +#endif + +#include "SIMULATION/TOOLS/defs.h" // for taus + +#include "enb_agent_extern.h" + +//#define XER_PRINT + +#ifdef PHY_EMUL +extern EMULATION_VARS *Emul_vars; +#endif +extern eNB_MAC_INST *eNB_mac_inst; +extern UE_MAC_INST *UE_mac_inst; +#ifdef BIGPHYSAREA +extern void* bigphys_malloc(int); +#endif + +extern uint16_t two_tier_hexagonal_cellIds[7]; + +/* TS 36.331: RRC-TransactionIdentifier ::= INTEGER (0..3) */ +static const uint8_t RRC_TRANSACTION_IDENTIFIER_NUMBER = 4; + +mui_t rrc_eNB_mui = 0; + +//----------------------------------------------------------------------------- +static void +init_SI( + const protocol_ctxt_t* const ctxt_pP, + const int CC_id +#if defined(ENABLE_ITTI) + , + RrcConfigurationReq * configuration +#endif +) +//----------------------------------------------------------------------------- +{ + uint8_t SIwindowsize = 1; + uint16_t SIperiod = 8; +#ifdef Rel10 + int i; +#endif + /* + uint32_t mib=0; + int i; + int N_RB_DL,phich_resource; + + do_MIB(enb_mod_idP, mac_xface->lte_frame_parms,0x321,&mib); + + for (i=0;i<1024;i+=4) + do_MIB(enb_mod_idP, mac_xface->lte_frame_parms,i,&mib); + + N_RB_DL=6; + while (N_RB_DL != 0) { + phich_resource = 1; + while (phich_resource != 0) { + for (i=0;i<2;i++) { + mac_xface->lte_frame_parms->N_RB_DL = N_RB_DL; + mac_xface->lte_frame_parms->phich_config_common.phich_duration=i; + mac_xface->lte_frame_parms->phich_config_common.phich_resource = phich_resource; + do_MIB(enb_mod_idP, mac_xface->lte_frame_parms,0,&mib); + } + if (phich_resource == 1) + phich_resource = 3; + else if (phich_resource == 3) + phich_resource = 6; + else if (phich_resource == 6) + phich_resource = 12; + else if (phich_resource == 12) + phich_resource = 0; + } + if (N_RB_DL == 6) + N_RB_DL = 15; + else if (N_RB_DL == 15) + N_RB_DL = 25; + else if (N_RB_DL == 25) + N_RB_DL = 50; + else if (N_RB_DL == 50) + N_RB_DL = 75; + else if (N_RB_DL == 75) + N_RB_DL = 100; + else if (N_RB_DL == 100) + N_RB_DL = 0; + } + exit(-1); + */ + + eNB_rrc_inst[ctxt_pP->module_id].carrier[CC_id].sizeof_SIB1 = 0; + eNB_rrc_inst[ctxt_pP->module_id].carrier[CC_id].sizeof_SIB23 = 0; + eNB_rrc_inst[ctxt_pP->module_id].carrier[CC_id].SIB1 = (uint8_t*) malloc16(32); + + /* + printf ("before SIB1 init : Nid_cell %d\n", mac_xface->lte_frame_parms->Nid_cell); + printf ("before SIB1 init : frame_type %d,tdd_config %d\n", + mac_xface->lte_frame_parms->frame_type, + mac_xface->lte_frame_parms->tdd_config); + */ + + if (eNB_rrc_inst[ctxt_pP->module_id].carrier[CC_id].SIB1) + eNB_rrc_inst[ctxt_pP->module_id].carrier[CC_id].sizeof_SIB1 = do_SIB1( + ctxt_pP->module_id, + CC_id, + mac_xface->lte_frame_parms, + (uint8_t*)eNB_rrc_inst[ctxt_pP->module_id].carrier[CC_id].SIB1, + &eNB_rrc_inst[ctxt_pP->module_id].carrier[CC_id].siblock1, + &eNB_rrc_inst[ctxt_pP->module_id].carrier[CC_id].sib1 +#if defined(ENABLE_ITTI) + , configuration +#endif + ); + else { + LOG_E(RRC, PROTOCOL_RRC_CTXT_FMT" init_SI: FATAL, no memory for SIB1 allocated\n", + PROTOCOL_RRC_CTXT_ARGS(ctxt_pP)); + mac_xface->macphy_exit("[RRC][init_SI] FATAL, no memory for SIB1 allocated"); + } + + /* + printf ("after SIB1 init : Nid_cell %d\n", mac_xface->lte_frame_parms->Nid_cell); + printf ("after SIB1 init : frame_type %d,tdd_config %d\n", + mac_xface->lte_frame_parms->frame_type, + mac_xface->lte_frame_parms->tdd_config); + */ + if (eNB_rrc_inst[ctxt_pP->module_id].carrier[CC_id].sizeof_SIB1 == 255) { + mac_xface->macphy_exit("[RRC][init_SI] FATAL, eNB_rrc_inst[enb_mod_idP].carrier[CC_id].sizeof_SIB1 == 255"); + } + + eNB_rrc_inst[ctxt_pP->module_id].carrier[CC_id].SIB23 = (uint8_t*) malloc16(64); + + if (eNB_rrc_inst[ctxt_pP->module_id].carrier[CC_id].SIB23) { + eNB_rrc_inst[ctxt_pP->module_id].carrier[CC_id].sizeof_SIB23 = do_SIB23( + ctxt_pP->module_id, + CC_id, + mac_xface->lte_frame_parms, + eNB_rrc_inst[ctxt_pP->module_id].carrier[CC_id].SIB23, + &eNB_rrc_inst[ctxt_pP->module_id].carrier[CC_id].systemInformation, + &eNB_rrc_inst[ctxt_pP->module_id].carrier[CC_id].sib2, + &eNB_rrc_inst[ctxt_pP->module_id].carrier[CC_id].sib3 +#ifdef Rel10 + , &eNB_rrc_inst[ctxt_pP->module_id].carrier[CC_id].sib13, + eNB_rrc_inst[ctxt_pP->module_id].carrier[CC_id].MBMS_flag +#endif +#if defined(ENABLE_ITTI) + , configuration +#endif + ); + + /* + eNB_rrc_inst[ctxt_pP->module_id].sizeof_SIB23 = do_SIB2_AT4(ctxt_pP->module_id, + eNB_rrc_inst[ctxt_pP->module_id].SIB23, + &eNB_rrc_inst[ctxt_pP->module_id].systemInformation, + &eNB_rrc_inst[ctxt_pP->module_id].sib2, + #if defined(ENABLE_ITTI) + , configuration + #endif + ); + */ + if (eNB_rrc_inst[ctxt_pP->module_id].carrier[CC_id].sizeof_SIB23 == 255) { + mac_xface->macphy_exit("[RRC][init_SI] FATAL, eNB_rrc_inst[mod].carrier[CC_id].sizeof_SIB23 == 255"); + } + + LOG_T(RRC, PROTOCOL_RRC_CTXT_FMT" SIB2/3 Contents (partial)\n", + PROTOCOL_RRC_CTXT_ARGS(ctxt_pP)); + LOG_T(RRC, PROTOCOL_RRC_CTXT_FMT" pusch_config_common.n_SB = %ld\n", + PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), + eNB_rrc_inst[ctxt_pP->module_id].carrier[CC_id].sib2->radioResourceConfigCommon.pusch_ConfigCommon. + pusch_ConfigBasic.n_SB); + LOG_T(RRC, PROTOCOL_RRC_CTXT_FMT" pusch_config_common.hoppingMode = %ld\n", + PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), + eNB_rrc_inst[ctxt_pP->module_id].carrier[CC_id].sib2->radioResourceConfigCommon.pusch_ConfigCommon. + pusch_ConfigBasic.hoppingMode); + LOG_T(RRC, PROTOCOL_RRC_CTXT_FMT" pusch_config_common.pusch_HoppingOffset = %ld\n", + PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), + eNB_rrc_inst[ctxt_pP->module_id].carrier[CC_id].sib2->radioResourceConfigCommon.pusch_ConfigCommon. + pusch_ConfigBasic.pusch_HoppingOffset); + LOG_T(RRC, PROTOCOL_RRC_CTXT_FMT" pusch_config_common.enable64QAM = %d\n", + PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), + (int)eNB_rrc_inst[ctxt_pP->module_id].carrier[CC_id].sib2->radioResourceConfigCommon.pusch_ConfigCommon. + pusch_ConfigBasic.enable64QAM); + LOG_T(RRC, PROTOCOL_RRC_CTXT_FMT" pusch_config_common.groupHoppingEnabled = %d\n", + PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), + (int)eNB_rrc_inst[ctxt_pP->module_id].carrier[CC_id].sib2->radioResourceConfigCommon.pusch_ConfigCommon. + ul_ReferenceSignalsPUSCH.groupHoppingEnabled); + LOG_T(RRC, PROTOCOL_RRC_CTXT_FMT" pusch_config_common.groupAssignmentPUSCH = %ld\n", + PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), + eNB_rrc_inst[ctxt_pP->module_id].carrier[CC_id].sib2->radioResourceConfigCommon.pusch_ConfigCommon. + ul_ReferenceSignalsPUSCH.groupAssignmentPUSCH); + LOG_T(RRC, PROTOCOL_RRC_CTXT_FMT" pusch_config_common.sequenceHoppingEnabled = %d\n", + PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), + (int)eNB_rrc_inst[ctxt_pP->module_id].carrier[CC_id].sib2->radioResourceConfigCommon.pusch_ConfigCommon. + ul_ReferenceSignalsPUSCH.sequenceHoppingEnabled); + LOG_T(RRC, PROTOCOL_RRC_CTXT_FMT" pusch_config_common.cyclicShift = %ld\n", + PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), + eNB_rrc_inst[ctxt_pP->module_id].carrier[CC_id].sib2->radioResourceConfigCommon.pusch_ConfigCommon. + ul_ReferenceSignalsPUSCH.cyclicShift); + +#ifdef Rel10 + + if (eNB_rrc_inst[ctxt_pP->module_id].carrier[CC_id].MBMS_flag > 0) { + for (i = 0; i < eNB_rrc_inst[ctxt_pP->module_id].carrier[CC_id].sib2->mbsfn_SubframeConfigList->list.count; i++) { + // SIB 2 + // LOG_D(RRC, "[eNB %d] mbsfn_SubframeConfigList.list.count = %ld\n", enb_mod_idP, eNB_rrc_inst[enb_mod_idP].sib2->mbsfn_SubframeConfigList->list.count); + LOG_D(RRC, PROTOCOL_RRC_CTXT_FMT" SIB13 contents for MBSFN subframe allocation %d/%d(partial)\n", + PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), + i, + eNB_rrc_inst[ctxt_pP->module_id].carrier[CC_id].sib2->mbsfn_SubframeConfigList->list.count); + LOG_D(RRC, PROTOCOL_RRC_CTXT_FMT" mbsfn_Subframe_pattern is = %x\n", + PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), + eNB_rrc_inst[ctxt_pP->module_id].carrier[CC_id].sib2->mbsfn_SubframeConfigList->list.array[i]->subframeAllocation.choice.oneFrame.buf[0] >> 0); + LOG_D(RRC, PROTOCOL_RRC_CTXT_FMT" radioframe_allocation_period = %ld (just index number, not the real value)\n", + PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), + eNB_rrc_inst[ctxt_pP->module_id].carrier[CC_id].sib2->mbsfn_SubframeConfigList->list.array[i]->radioframeAllocationPeriod); // need to display the real value, using array of char (like in dumping SIB2) + LOG_D(RRC, PROTOCOL_RRC_CTXT_FMT" radioframe_allocation_offset = %ld\n", + PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), + eNB_rrc_inst[ctxt_pP->module_id].carrier[CC_id].sib2->mbsfn_SubframeConfigList->list.array[i]->radioframeAllocationOffset); + } + + // SIB13 + for (i = 0; i < eNB_rrc_inst[ctxt_pP->module_id].carrier[CC_id].sib13->mbsfn_AreaInfoList_r9.list.count; i++) { + LOG_D(RRC, PROTOCOL_RRC_CTXT_FMT" SIB13 contents for MBSFN sync area %d/2 (partial)\n", + PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), + i, + eNB_rrc_inst[ctxt_pP->module_id].carrier[CC_id].sib13->mbsfn_AreaInfoList_r9.list.count); + LOG_D(RRC, PROTOCOL_RRC_CTXT_FMT" MCCH Repetition Period: %d (just index number, not real value)\n", + PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), + eNB_rrc_inst[ctxt_pP->module_id].carrier[CC_id].sib13->mbsfn_AreaInfoList_r9.list.array[i]->mcch_Config_r9.mcch_RepetitionPeriod_r9); + LOG_D(RRC, PROTOCOL_RRC_CTXT_FMT" MCCH Offset: %d\n", + PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), + eNB_rrc_inst[ctxt_pP->module_id].carrier[CC_id].sib13->mbsfn_AreaInfoList_r9.list.array[i]->mcch_Config_r9.mcch_Offset_r9); + } + } + +#endif + + LOG_D(RRC, + PROTOCOL_RRC_CTXT_FMT" RRC_UE --- MAC_CONFIG_REQ (SIB1.tdd & SIB2 params) ---> MAC_UE\n", + PROTOCOL_RRC_CTXT_ARGS(ctxt_pP)); + rrc_mac_config_req(ctxt_pP->module_id, CC_id, ENB_FLAG_YES, 0, 0, + (RadioResourceConfigCommonSIB_t *) & + eNB_rrc_inst[ctxt_pP->module_id].carrier[CC_id].sib2->radioResourceConfigCommon, + (struct PhysicalConfigDedicated *)NULL, +#ifdef Rel10 + (SCellToAddMod_r10_t *)NULL, + //(struct PhysicalConfigDedicatedSCell_r10 *)NULL, +#endif + (MeasObjectToAddMod_t **) NULL, + (MAC_MainConfig_t *) NULL, 0, + (struct LogicalChannelConfig *)NULL, + (MeasGapConfig_t *) NULL, + eNB_rrc_inst[ctxt_pP->module_id].carrier[CC_id].sib1->tdd_Config, + NULL, + &SIwindowsize, &SIperiod, + eNB_rrc_inst[ctxt_pP->module_id].carrier[CC_id].sib2->freqInfo.ul_CarrierFreq, + eNB_rrc_inst[ctxt_pP->module_id].carrier[CC_id].sib2->freqInfo.ul_Bandwidth, + &eNB_rrc_inst[ctxt_pP->module_id].carrier[CC_id].sib2->freqInfo.additionalSpectrumEmission, + (MBSFN_SubframeConfigList_t*) eNB_rrc_inst[ctxt_pP->module_id].carrier[CC_id].sib2->mbsfn_SubframeConfigList +#ifdef Rel10 + , + eNB_rrc_inst[ctxt_pP->module_id].carrier[CC_id].MBMS_flag, + (MBSFN_AreaInfoList_r9_t*) & eNB_rrc_inst[ctxt_pP->module_id].carrier[CC_id].sib13->mbsfn_AreaInfoList_r9, + (PMCH_InfoList_r9_t *) NULL +#endif +#ifdef CBA + , 0, //eNB_rrc_inst[ctxt_pP->module_id].num_active_cba_groups, + 0 //eNB_rrc_inst[ctxt_pP->module_id].cba_rnti[0] +#endif + ); + } else { + LOG_E(RRC, PROTOCOL_RRC_CTXT_FMT" init_SI: FATAL, no memory for SIB2/3 allocated\n", + PROTOCOL_RRC_CTXT_ARGS(ctxt_pP)); + mac_xface->macphy_exit("[RRC][init_SI] FATAL, no memory for SIB2/3 allocated"); + } +} + +#ifdef Rel10 +/*------------------------------------------------------------------------------*/ +static void +init_MCCH( + module_id_t enb_mod_idP, + int CC_id +) +//----------------------------------------------------------------------------- +{ + + int sync_area = 0; + // initialize RRC_eNB_INST MCCH entry + eNB_rrc_inst[enb_mod_idP].carrier[CC_id].MCCH_MESSAGE = + malloc(eNB_rrc_inst[enb_mod_idP].carrier[CC_id].num_mbsfn_sync_area * sizeof(uint8_t*)); + + for (sync_area = 0; sync_area < eNB_rrc_inst[enb_mod_idP].carrier[CC_id].num_mbsfn_sync_area; sync_area++) { + + eNB_rrc_inst[enb_mod_idP].carrier[CC_id].sizeof_MCCH_MESSAGE[sync_area] = 0; + eNB_rrc_inst[enb_mod_idP].carrier[CC_id].MCCH_MESSAGE[sync_area] = (uint8_t *) malloc16(32); + + if (eNB_rrc_inst[enb_mod_idP].carrier[CC_id].MCCH_MESSAGE[sync_area] == NULL) { + LOG_E(RRC, "[eNB %d][MAIN] init_MCCH: FATAL, no memory for MCCH MESSAGE allocated \n", enb_mod_idP); + mac_xface->macphy_exit("[RRC][init_MCCH] not enough memory\n"); + } else { + eNB_rrc_inst[enb_mod_idP].carrier[CC_id].sizeof_MCCH_MESSAGE[sync_area] = do_MBSFNAreaConfig(enb_mod_idP, + mac_xface->lte_frame_parms, + sync_area, + (uint8_t *)eNB_rrc_inst[enb_mod_idP].carrier[CC_id].MCCH_MESSAGE[sync_area], + &eNB_rrc_inst[enb_mod_idP].carrier[CC_id].mcch, + &eNB_rrc_inst[enb_mod_idP].carrier[CC_id].mcch_message); + + LOG_I(RRC, "mcch message pointer %p for sync area %d \n", + eNB_rrc_inst[enb_mod_idP].carrier[CC_id].MCCH_MESSAGE[sync_area], + sync_area); + LOG_D(RRC, "[eNB %d] MCCH_MESSAGE contents for Sync Area %d (partial)\n", enb_mod_idP, sync_area); + LOG_D(RRC, "[eNB %d] CommonSF_AllocPeriod_r9 %d\n", enb_mod_idP, + eNB_rrc_inst[enb_mod_idP].carrier[CC_id].mcch_message->commonSF_AllocPeriod_r9); + LOG_D(RRC, + "[eNB %d] CommonSF_Alloc_r9.list.count (number of MBSFN Subframe Pattern) %d\n", + enb_mod_idP, eNB_rrc_inst[enb_mod_idP].carrier[CC_id].mcch_message->commonSF_Alloc_r9.list.count); + LOG_D(RRC, "[eNB %d] MBSFN Subframe Pattern: %02x (in hex)\n", + enb_mod_idP, + eNB_rrc_inst[enb_mod_idP].carrier[CC_id].mcch_message->commonSF_Alloc_r9.list.array[0]->subframeAllocation. + choice.oneFrame.buf[0]); + + if (eNB_rrc_inst[enb_mod_idP].carrier[CC_id].sizeof_MCCH_MESSAGE[sync_area] == 255) { + mac_xface->macphy_exit("[RRC][init_MCCH] eNB_rrc_inst[enb_mod_idP].carrier[CC_id].sizeof_MCCH_MESSAGE[sync_area] == 255"); + } else { + eNB_rrc_inst[enb_mod_idP].carrier[CC_id].MCCH_MESS[sync_area].Active = 1; + } + } + } + + //Set the eNB_rrc_inst[enb_mod_idP].MCCH_MESS.Active to 1 (allow to transfer MCCH message RRC->MAC in function mac_rrc_data_req) + + // ??Configure MCCH logical channel + // call mac_config_req with appropriate structure from ASN.1 description + + // LOG_I(RRC, "DUY: serviceID is %d\n",eNB_rrc_inst[enb_mod_idP].mcch_message->pmch_InfoList_r9.list.array[0]->mbms_SessionInfoList_r9.list.array[0]->tmgi_r9.serviceId_r9.buf[2]); + // LOG_I(RRC, "DUY: session ID is %d\n",eNB_rrc_inst[enb_mod_idP].mcch_message->pmch_InfoList_r9.list.array[0]->mbms_SessionInfoList_r9.list.array[0]->sessionId_r9->buf[0]); + rrc_mac_config_req(enb_mod_idP, CC_id, ENB_FLAG_YES, 0, 0, + (RadioResourceConfigCommonSIB_t *) NULL, + (struct PhysicalConfigDedicated *)NULL, +#ifdef Rel10 + (SCellToAddMod_r10_t *)NULL, + //(struct PhysicalConfigDedicatedSCell_r10 *)NULL, +#endif + (MeasObjectToAddMod_t **) NULL, + (MAC_MainConfig_t *) NULL, + 0, + (struct LogicalChannelConfig *)NULL, + (MeasGapConfig_t *) NULL, + (TDD_Config_t *) NULL, + NULL, (uint8_t *) NULL, (uint16_t *) NULL, NULL, NULL, NULL, (MBSFN_SubframeConfigList_t *) NULL +# ifdef Rel10 + , + 0, + (MBSFN_AreaInfoList_r9_t *) NULL, + (PMCH_InfoList_r9_t *) & (eNB_rrc_inst[enb_mod_idP].carrier[CC_id].mcch_message->pmch_InfoList_r9) +# endif +# ifdef CBA + , 0, 0 +# endif + ); + + //LOG_I(RRC,"DUY: lcid after rrc_mac_config_req is %02d\n",eNB_rrc_inst[enb_mod_idP].mcch_message->pmch_InfoList_r9.list.array[0]->mbms_SessionInfoList_r9.list.array[0]->logicalChannelIdentity_r9); + +} + +//----------------------------------------------------------------------------- +static void init_MBMS( + module_id_t enb_mod_idP, + int CC_id, + frame_t frameP +) +//----------------------------------------------------------------------------- +{ + // init the configuration for MTCH + protocol_ctxt_t ctxt; + + if (eNB_rrc_inst[enb_mod_idP].carrier[CC_id].MBMS_flag > 0) { + PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, enb_mod_idP, ENB_FLAG_YES, NOT_A_RNTI, frameP, 0,enb_mod_idP); + + LOG_D(RRC, "[eNB %d] Frame %d : Radio Bearer config request for MBMS\n", enb_mod_idP, frameP); //check the lcid + // Configuring PDCP and RLC for MBMS Radio Bearer + + rrc_pdcp_config_asn1_req(&ctxt, + (SRB_ToAddModList_t *)NULL, // SRB_ToAddModList + (DRB_ToAddModList_t *)NULL, // DRB_ToAddModList + (DRB_ToReleaseList_t *)NULL, + 0, // security mode + NULL, // key rrc encryption + NULL, // key rrc integrity + NULL // key encryption +# ifdef Rel10 + , &(eNB_rrc_inst[enb_mod_idP].carrier[CC_id].mcch_message->pmch_InfoList_r9) +# endif + ); + + rrc_rlc_config_asn1_req(&ctxt, + NULL, // SRB_ToAddModList + NULL, // DRB_ToAddModList + NULL, // DRB_ToReleaseList + &(eNB_rrc_inst[enb_mod_idP].carrier[CC_id].mcch_message->pmch_InfoList_r9)); + + //rrc_mac_config_req(); + } +} +#endif + +//----------------------------------------------------------------------------- +uint8_t +rrc_eNB_get_next_transaction_identifier( + module_id_t enb_mod_idP +) +//----------------------------------------------------------------------------- +{ + static uint8_t rrc_transaction_identifier[NUMBER_OF_eNB_MAX]; + rrc_transaction_identifier[enb_mod_idP] = (rrc_transaction_identifier[enb_mod_idP] + 1) % RRC_TRANSACTION_IDENTIFIER_NUMBER; + return rrc_transaction_identifier[enb_mod_idP]; +} +/*------------------------------------------------------------------------------*/ +/* Functions to handle UE index in eNB UE list */ + + +////----------------------------------------------------------------------------- +//static module_id_t +//rrc_eNB_get_UE_index( +// module_id_t enb_mod_idP, +// uint64_t UE_identity +//) +////----------------------------------------------------------------------------- +//{ +// +// boolean_t reg = FALSE; +// module_id_t i; +// +// AssertFatal(enb_mod_idP < NB_eNB_INST, "eNB index invalid (%d/%d)!", enb_mod_idP, NB_eNB_INST); +// +// for (i = 0; i < NUMBER_OF_UE_MAX; i++) { +// if (eNB_rrc_inst[enb_mod_idP].Info.UE_list[i] == UE_identity) { +// // UE_identity already registered +// reg = TRUE; +// break; +// } +// } +// +// if (reg == FALSE) { +// return (UE_MODULE_INVALID); +// } else +// return (i); +//} + + +//----------------------------------------------------------------------------- +// return the ue context if there is already an UE with ue_identityP, NULL otherwise +static struct rrc_eNB_ue_context_s* +rrc_eNB_ue_context_random_exist( + const protocol_ctxt_t* const ctxt_pP, + const uint64_t ue_identityP +) +//----------------------------------------------------------------------------- +{ + struct rrc_eNB_ue_context_s* ue_context_p = NULL; + RB_FOREACH(ue_context_p, rrc_ue_tree_s, &(eNB_rrc_inst[ctxt_pP->module_id].rrc_ue_head)) { + if (ue_context_p->ue_context.random_ue_identity == ue_identityP) + return ue_context_p; + } + return NULL; +} +//----------------------------------------------------------------------------- +// return the ue context if there is already an UE with the same S-TMSI(MMEC+M-TMSI), NULL otherwise +static struct rrc_eNB_ue_context_s* +rrc_eNB_ue_context_stmsi_exist( + const protocol_ctxt_t* const ctxt_pP, + const mme_code_t mme_codeP, + const m_tmsi_t m_tmsiP +) +//----------------------------------------------------------------------------- +{ + struct rrc_eNB_ue_context_s* ue_context_p = NULL; + RB_FOREACH(ue_context_p, rrc_ue_tree_s, &(eNB_rrc_inst[ctxt_pP->module_id].rrc_ue_head)) { + LOG_I(RRC,"checking for UE S-TMSI %x, mme %x (%p): rnti %x", + m_tmsiP, mme_codeP, ue_context_p, + ue_context_p->ue_context.rnti); + if (ue_context_p->ue_context.Initialue_identity_s_TMSI.presence == TRUE) { + printf("S-TMSI %x, MME %x\n", + ue_context_p->ue_context.Initialue_identity_s_TMSI.m_tmsi, + ue_context_p->ue_context.Initialue_identity_s_TMSI.mme_code); + if (ue_context_p->ue_context.Initialue_identity_s_TMSI.m_tmsi == m_tmsiP) + if (ue_context_p->ue_context.Initialue_identity_s_TMSI.mme_code == mme_codeP) + return ue_context_p; + } + else + printf("\n"); + + } + return NULL; +} + +//----------------------------------------------------------------------------- +// return a new ue context structure if ue_identityP, ctxt_pP->rnti not found in collection +static struct rrc_eNB_ue_context_s* +rrc_eNB_get_next_free_ue_context( + const protocol_ctxt_t* const ctxt_pP, + const uint64_t ue_identityP +) +//----------------------------------------------------------------------------- +{ + struct rrc_eNB_ue_context_s* ue_context_p = NULL; + ue_context_p = rrc_eNB_get_ue_context( + &eNB_rrc_inst[ctxt_pP->module_id], + ctxt_pP->rnti); + + if (ue_context_p == NULL) { + RB_FOREACH(ue_context_p, rrc_ue_tree_s, &(eNB_rrc_inst[ctxt_pP->module_id].rrc_ue_head)) { + if (ue_context_p->ue_context.random_ue_identity == ue_identityP) { + LOG_D(RRC, + PROTOCOL_RRC_CTXT_UE_FMT" Cannot create new UE context, already exist rand UE id 0x%x, uid %u\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), + ue_identityP, + ue_context_p->local_uid); + return NULL; + } + } + ue_context_p = rrc_eNB_allocate_new_UE_context(&eNB_rrc_inst[ctxt_pP->module_id]); + + if (ue_context_p == NULL) { + LOG_E(RRC, + PROTOCOL_RRC_CTXT_UE_FMT" Cannot create new UE context, no memory\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP)); + return NULL; + } + + ue_context_p->ue_id_rnti = ctxt_pP->rnti; // here ue_id_rnti is just a key, may be something else + ue_context_p->ue_context.rnti = ctxt_pP->rnti; // yes duplicate, 1 may be removed + ue_context_p->ue_context.random_ue_identity = ue_identityP; + RB_INSERT(rrc_ue_tree_s, &eNB_rrc_inst[ctxt_pP->module_id].rrc_ue_head, ue_context_p); + LOG_D(RRC, + PROTOCOL_RRC_CTXT_UE_FMT" Created new UE context uid %u\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), + ue_context_p->local_uid); + return ue_context_p; + + } else { + LOG_E(RRC, + PROTOCOL_RRC_CTXT_UE_FMT" Cannot create new UE context, already exist\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP)); + return NULL; + } +} + +#if !defined(ENABLE_USE_MME) +void rrc_eNB_emulation_notify_ue_module_id( + const module_id_t ue_module_idP, + const rnti_t rntiP, + const uint8_t cell_identity_byte0P, + const uint8_t cell_identity_byte1P, + const uint8_t cell_identity_byte2P, + const uint8_t cell_identity_byte3P) +{ + module_id_t enb_module_id; + struct rrc_eNB_ue_context_s* ue_context_p = NULL; + int CC_id; + + // find enb_module_id + for (enb_module_id = 0; enb_module_id < NUMBER_OF_eNB_MAX; enb_module_id++) { + if(enb_module_id>0){ /*FIX LATER*/ + return; + } + for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) { + if (eNB_rrc_inst[enb_module_id].carrier[CC_id].sib1 != NULL) { + if ( + (eNB_rrc_inst[enb_module_id].carrier[CC_id].sib1->cellAccessRelatedInfo.cellIdentity.buf[0] == cell_identity_byte0P) && + (eNB_rrc_inst[enb_module_id].carrier[CC_id].sib1->cellAccessRelatedInfo.cellIdentity.buf[1] == cell_identity_byte1P) && + (eNB_rrc_inst[enb_module_id].carrier[CC_id].sib1->cellAccessRelatedInfo.cellIdentity.buf[2] == cell_identity_byte2P) && + (eNB_rrc_inst[enb_module_id].carrier[CC_id].sib1->cellAccessRelatedInfo.cellIdentity.buf[3] == cell_identity_byte3P) + ) { + ue_context_p = rrc_eNB_get_ue_context( + &eNB_rrc_inst[enb_module_id], + rntiP + ); + + if (NULL != ue_context_p) { + oai_emulation.info.eNB_ue_local_uid_to_ue_module_id[enb_module_id][ue_context_p->local_uid] = ue_module_idP; + } + + //return; + } + } + } + oai_emulation.info.eNB_ue_module_id_to_rnti[enb_module_id][ue_module_idP] = rntiP; + } + + AssertFatal(enb_module_id == NUMBER_OF_eNB_MAX, + "Cell identity not found for ue module id %u rnti %x", + ue_module_idP, rntiP); +} +#endif + +//----------------------------------------------------------------------------- +void +rrc_eNB_free_mem_UE_context( + const protocol_ctxt_t* const ctxt_pP, + struct rrc_eNB_ue_context_s* const ue_context_pP +) +//----------------------------------------------------------------------------- +{ + int i; + LOG_T(RRC, + PROTOCOL_RRC_CTXT_UE_FMT" Clearing UE context 0x%x (free internal structs)\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), + ue_context_pP); +#ifdef Rel10 + ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_SCellToAddMod_r10, &ue_context_pP->ue_context.sCell_config[0]); + ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_SCellToAddMod_r10, &ue_context_pP->ue_context.sCell_config[1]); +#endif + + if (ue_context_pP->ue_context.SRB_configList) { + ASN_STRUCT_FREE(asn_DEF_SRB_ToAddModList, ue_context_pP->ue_context.SRB_configList); + ue_context_pP->ue_context.SRB_configList = NULL; + } + + if (ue_context_pP->ue_context.DRB_configList) { + ASN_STRUCT_FREE(asn_DEF_DRB_ToAddModList, ue_context_pP->ue_context.DRB_configList); + ue_context_pP->ue_context.DRB_configList = NULL; + } + + memset(ue_context_pP->ue_context.DRB_active, 0, sizeof(ue_context_pP->ue_context.DRB_active)); + + if (ue_context_pP->ue_context.physicalConfigDedicated) { + ASN_STRUCT_FREE(asn_DEF_PhysicalConfigDedicated, ue_context_pP->ue_context.physicalConfigDedicated); + ue_context_pP->ue_context.physicalConfigDedicated = NULL; + } + + if (ue_context_pP->ue_context.sps_Config) { + ASN_STRUCT_FREE(asn_DEF_SPS_Config, ue_context_pP->ue_context.sps_Config); + ue_context_pP->ue_context.sps_Config = NULL; + } + + for (i=0; i < MAX_MEAS_OBJ; i++) { + if (ue_context_pP->ue_context.MeasObj[i] != NULL) { + ASN_STRUCT_FREE(asn_DEF_MeasObjectToAddMod, ue_context_pP->ue_context.MeasObj[i]); + ue_context_pP->ue_context.MeasObj[i] = NULL; + } + } + + for (i=0; i < MAX_MEAS_CONFIG; i++) { + if (ue_context_pP->ue_context.ReportConfig[i] != NULL) { + ASN_STRUCT_FREE(asn_DEF_ReportConfigToAddMod, ue_context_pP->ue_context.ReportConfig[i]); + ue_context_pP->ue_context.ReportConfig[i] = NULL; + } + } + + if (ue_context_pP->ue_context.QuantityConfig) { + ASN_STRUCT_FREE(asn_DEF_QuantityConfig, ue_context_pP->ue_context.QuantityConfig); + ue_context_pP->ue_context.QuantityConfig = NULL; + } + + if (ue_context_pP->ue_context.mac_MainConfig) { + ASN_STRUCT_FREE(asn_DEF_MAC_MainConfig, ue_context_pP->ue_context.mac_MainConfig); + ue_context_pP->ue_context.mac_MainConfig = NULL; + } + + if (ue_context_pP->ue_context.measGapConfig) { + ASN_STRUCT_FREE(asn_DEF_MeasGapConfig, ue_context_pP->ue_context.measGapConfig); + ue_context_pP->ue_context.measGapConfig = NULL; + } + + //SRB_INFO SI; + //SRB_INFO Srb0; + //SRB_INFO_TABLE_ENTRY Srb1; + //SRB_INFO_TABLE_ENTRY Srb2; + if (ue_context_pP->ue_context.measConfig) { + ASN_STRUCT_FREE(asn_DEF_MeasConfig, ue_context_pP->ue_context.measConfig); + ue_context_pP->ue_context.measConfig = NULL; + } + + if (ue_context_pP->ue_context.measConfig) { + ASN_STRUCT_FREE(asn_DEF_MeasConfig, ue_context_pP->ue_context.measConfig); + ue_context_pP->ue_context.measConfig = NULL; + } + + //HANDOVER_INFO *handover_info; +#if defined(ENABLE_SECURITY) + //uint8_t kenb[32]; +#endif + //e_SecurityAlgorithmConfig__cipheringAlgorithm ciphering_algorithm; + //e_SecurityAlgorithmConfig__integrityProtAlgorithm integrity_algorithm; + //uint8_t Status; + //rnti_t rnti; + //uint64_t random_ue_identity; +#if defined(ENABLE_ITTI) + //UE_S_TMSI Initialue_identity_s_TMSI; + //EstablishmentCause_t establishment_cause; + //ReestablishmentCause_t reestablishment_cause; + //uint16_t ue_initial_id; + //uint32_t eNB_ue_s1ap_id :24; + //security_capabilities_t security_capabilities; + //uint8_t nb_of_e_rabs; + //e_rab_param_t e_rab[S1AP_MAX_E_RAB]; + //uint32_t enb_gtp_teid[S1AP_MAX_E_RAB]; + //transport_layer_addr_t enb_gtp_addrs[S1AP_MAX_E_RAB]; + //rb_id_t enb_gtp_ebi[S1AP_MAX_E_RAB]; +#endif +} + +//----------------------------------------------------------------------------- +// should be called when UE is lost by eNB +void +rrc_eNB_free_UE(const module_id_t enb_mod_idP,const struct rrc_eNB_ue_context_s* const ue_context_pP) +//----------------------------------------------------------------------------- +{ + + + protocol_ctxt_t ctxt; +#if !defined(ENABLE_USE_MME) + module_id_t ue_module_id; + /* avoid gcc warnings */ + (void)ue_module_id; +#endif + rnti_t rnti = ue_context_pP->ue_context.rnti; + + + AssertFatal(enb_mod_idP < NB_eNB_INST, "eNB inst invalid (%d/%d) for UE %x!", enb_mod_idP, NB_eNB_INST, rnti); + /* ue_context_p = rrc_eNB_get_ue_context( + &eNB_rrc_inst[enb_mod_idP], + rntiP + ); + */ + if (NULL != ue_context_pP) { + PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, enb_mod_idP, ENB_FLAG_YES, rnti, 0, 0,enb_mod_idP); + LOG_W(RRC, "[eNB %d] Removing UE RNTI %x\n", enb_mod_idP, rnti); + +#if defined(ENABLE_USE_MME) + rrc_eNB_send_S1AP_UE_CONTEXT_RELEASE_REQ(enb_mod_idP, ue_context_pP, S1AP_CAUSE_RADIO_NETWORK, 21); // send cause 21: connection with ue lost + /* From 3GPP 36300v10 p129 : 19.2.2.2.2 S1 UE Context Release Request (eNB triggered) + * If the E-UTRAN internal reason is a radio link failure detected in the eNB, the eNB shall wait a sufficient time before + * triggering the S1 UE Context Release Request procedure + * in order to allow the UE to perform the NAS recovery + * procedure, see TS 23.401 [17]. + */ +#else +#if defined(OAI_EMU) + AssertFatal(ue_context_pP->local_uid < NUMBER_OF_UE_MAX, "local_uid invalid (%d<%d) for UE %x!", ue_context_pP->local_uid, NUMBER_OF_UE_MAX, rnti); + ue_module_id = oai_emulation.info.eNB_ue_local_uid_to_ue_module_id[enb_mod_idP][ue_context_pP->local_uid]; + AssertFatal(ue_module_id < NUMBER_OF_UE_MAX, "ue_module_id invalid (%d<%d) for UE %x!", ue_module_id, NUMBER_OF_UE_MAX, rnti); + oai_emulation.info.eNB_ue_local_uid_to_ue_module_id[enb_mod_idP][ue_context_pP->local_uid] = -1; + oai_emulation.info.eNB_ue_module_id_to_rnti[enb_mod_idP][ue_module_id] = NOT_A_RNTI; +#endif +#endif + + rrc_mac_remove_ue(enb_mod_idP,rnti); + rrc_rlc_remove_ue(&ctxt); + pdcp_remove_UE(&ctxt); + + rrc_eNB_remove_ue_context( + &ctxt, + &eNB_rrc_inst[enb_mod_idP], + (struct rrc_eNB_ue_context_s*) ue_context_pP); + } +} + +//----------------------------------------------------------------------------- +void +rrc_eNB_process_RRCConnectionSetupComplete( + const protocol_ctxt_t* const ctxt_pP, + rrc_eNB_ue_context_t* const ue_context_pP, + RRCConnectionSetupComplete_r8_IEs_t * rrcConnectionSetupComplete +) +//----------------------------------------------------------------------------- +{ + LOG_I(RRC, + PROTOCOL_RRC_CTXT_UE_FMT" [RAPROC] Logical Channel UL-DCCH, " "processing RRCConnectionSetupComplete from UE\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP)); + + T(T_ENB_RRC_CONNECTION_SETUP_COMPLETE, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), + T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); + +#if defined(ENABLE_USE_MME) + + if (EPC_MODE_ENABLED == 1) { + // Forward message to S1AP layer + rrc_eNB_send_S1AP_NAS_FIRST_REQ( + ctxt_pP, + ue_context_pP, + rrcConnectionSetupComplete); + } else +#endif + { + // RRC loop back (no S1AP), send SecurityModeCommand to UE + rrc_eNB_generate_SecurityModeCommand( + ctxt_pP, + ue_context_pP); + // rrc_eNB_generate_UECapabilityEnquiry(enb_mod_idP,frameP,ue_mod_idP); + } +} + +//----------------------------------------------------------------------------- +void +rrc_eNB_generate_SecurityModeCommand( + const protocol_ctxt_t* const ctxt_pP, + rrc_eNB_ue_context_t* const ue_context_pP +) +//----------------------------------------------------------------------------- +{ + uint8_t buffer[100]; + uint8_t size; + + T(T_ENB_RRC_SECURITY_MODE_COMMAND, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), + T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); + + size = do_SecurityModeCommand( + ctxt_pP, + buffer, + rrc_eNB_get_next_transaction_identifier(ctxt_pP->module_id), + ue_context_pP->ue_context.ciphering_algorithm, + ue_context_pP->ue_context.integrity_algorithm); + +#ifdef RRC_MSG_PRINT + uint16_t i=0; + LOG_F(RRC,"[MSG] RRC Security Mode Command\n"); + + for (i = 0; i < size; i++) { + LOG_F(RRC,"%02x ", ((uint8_t*)buffer)[i]); + } + + LOG_F(RRC,"\n"); +#endif + + LOG_I(RRC, + PROTOCOL_RRC_CTXT_UE_FMT" Logical Channel DL-DCCH, Generate SecurityModeCommand (bytes %d)\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), + size); + + LOG_D(RRC, + PROTOCOL_RRC_CTXT_UE_FMT" --- PDCP_DATA_REQ/%d Bytes (securityModeCommand to UE MUI %d) --->[PDCP][RB %02d]\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), + size, + rrc_eNB_mui, + DCCH); + + MSC_LOG_TX_MESSAGE( + MSC_RRC_ENB, + MSC_RRC_UE, + buffer, + size, + MSC_AS_TIME_FMT" securityModeCommand UE %x MUI %d size %u", + MSC_AS_TIME_ARGS(ctxt_pP), + ue_context_pP->ue_context.rnti, + rrc_eNB_mui, + size); + + rrc_data_req( + ctxt_pP, + DCCH, + rrc_eNB_mui++, + SDU_CONFIRM_NO, + size, + buffer, + PDCP_TRANSMISSION_MODE_CONTROL); + +} + +//----------------------------------------------------------------------------- +void +rrc_eNB_generate_UECapabilityEnquiry( + const protocol_ctxt_t* const ctxt_pP, + rrc_eNB_ue_context_t* const ue_context_pP +) +//----------------------------------------------------------------------------- +{ + + uint8_t buffer[100]; + uint8_t size; + + T(T_ENB_RRC_UE_CAPABILITY_ENQUIRY, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), + T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); + + size = do_UECapabilityEnquiry( + ctxt_pP, + buffer, + rrc_eNB_get_next_transaction_identifier(ctxt_pP->module_id)); + + LOG_I(RRC, + PROTOCOL_RRC_CTXT_UE_FMT" Logical Channel DL-DCCH, Generate UECapabilityEnquiry (bytes %d)\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), + size); + + LOG_D(RRC, + PROTOCOL_RRC_CTXT_UE_FMT" --- PDCP_DATA_REQ/%d Bytes (UECapabilityEnquiry MUI %d) --->[PDCP][RB %02d]\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), + size, + rrc_eNB_mui, + DCCH); + + MSC_LOG_TX_MESSAGE( + MSC_RRC_ENB, + MSC_RRC_UE, + buffer, + size, + MSC_AS_TIME_FMT" rrcUECapabilityEnquiry UE %x MUI %d size %u", + MSC_AS_TIME_ARGS(ctxt_pP), + ue_context_pP->ue_context.rnti, + rrc_eNB_mui, + size); + + rrc_data_req( + ctxt_pP, + DCCH, + rrc_eNB_mui++, + SDU_CONFIRM_NO, + size, + buffer, + PDCP_TRANSMISSION_MODE_CONTROL); + +} + +//----------------------------------------------------------------------------- +void +rrc_eNB_generate_RRCConnectionReject( + const protocol_ctxt_t* const ctxt_pP, + rrc_eNB_ue_context_t* const ue_context_pP, + const int CC_id +) +//----------------------------------------------------------------------------- +{ +#ifdef RRC_MSG_PRINT + int cnt; +#endif + + T(T_ENB_RRC_CONNECTION_REJECT, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), + T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); + + eNB_rrc_inst[ctxt_pP->module_id].carrier[CC_id].Srb0.Tx_buffer.payload_size = + do_RRCConnectionReject(ctxt_pP->module_id, + (uint8_t*) eNB_rrc_inst[ctxt_pP->module_id].carrier[CC_id].Srb0.Tx_buffer.Payload); + +#ifdef RRC_MSG_PRINT + LOG_F(RRC,"[MSG] RRCConnectionReject\n"); + + for (cnt = 0; cnt < eNB_rrc_inst[ctxt_pP->module_id].carrier[CC_id].Srb0.Tx_buffer.payload_size; cnt++) { + LOG_F(RRC,"%02x ", ((uint8_t*)eNB_rrc_inst[ctxt_pP->module_id].Srb0.Tx_buffer.Payload)[cnt]); + } + + LOG_F(RRC,"\n"); +#endif + + MSC_LOG_TX_MESSAGE( + MSC_RRC_ENB, + MSC_RRC_UE, + eNB_rrc_inst[ctxt_pP->module_id].carrier[CC_id].Srb0.Tx_buffer.Header, + eNB_rrc_inst[ctxt_pP->module_id].carrier[CC_id].Srb0.Tx_buffer.payload_size, + MSC_AS_TIME_FMT" RRCConnectionReject UE %x size %u", + MSC_AS_TIME_ARGS(ctxt_pP), + ue_context_pP == NULL ? -1 : ue_context_pP->ue_context.rnti, + eNB_rrc_inst[ctxt_pP->module_id].carrier[CC_id].Srb0.Tx_buffer.payload_size); + + LOG_I(RRC, + PROTOCOL_RRC_CTXT_UE_FMT" [RAPROC] Logical Channel DL-CCCH, Generating RRCConnectionReject (bytes %d)\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), + eNB_rrc_inst[ctxt_pP->module_id].carrier[CC_id].Srb0.Tx_buffer.payload_size); +} + +//----------------------------------------------------------------------------- +void +rrc_eNB_generate_RRCConnectionReestablishmentReject( + const protocol_ctxt_t* const ctxt_pP, + rrc_eNB_ue_context_t* const ue_context_pP, + const int CC_id +) +//----------------------------------------------------------------------------- +{ +#ifdef RRC_MSG_PRINT + int cnt; +#endif + + T(T_ENB_RRC_CONNECTION_REESTABLISHMENT_REJECT, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), + T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); + + eNB_rrc_inst[ctxt_pP->module_id].carrier[CC_id].Srb0.Tx_buffer.payload_size = + do_RRCConnectionReestablishmentReject(ctxt_pP->module_id, + (uint8_t*) eNB_rrc_inst[ctxt_pP->module_id].carrier[CC_id].Srb0.Tx_buffer.Payload); + +#ifdef RRC_MSG_PRINT + LOG_F(RRC,"[MSG] RRCConnectionReestablishmentReject\n"); + + for (cnt = 0; cnt < eNB_rrc_inst[ctxt_pP->module_id].carrier[CC_id].Srb0.Tx_buffer.payload_size; cnt++) { + LOG_F(RRC,"%02x ", ((uint8_t*)eNB_rrc_inst[ctxt_pP->module_id].Srb0.Tx_buffer.Payload)[cnt]); + } + + LOG_F(RRC,"\n"); +#endif + + MSC_LOG_TX_MESSAGE( + MSC_RRC_ENB, + MSC_RRC_UE, + eNB_rrc_inst[ctxt_pP->module_id].carrier[CC_id].Srb0.Tx_buffer.Header, + eNB_rrc_inst[ctxt_pP->module_id].carrier[CC_id].Srb0.Tx_buffer.payload_size, + MSC_AS_TIME_FMT" RRCConnectionReestablishmentReject UE %x size %u", + MSC_AS_TIME_ARGS(ctxt_pP), + ue_context_pP == NULL ? -1 : ue_context_pP->ue_context.rnti, + eNB_rrc_inst[ctxt_pP->module_id].carrier[CC_id].Srb0.Tx_buffer.payload_size); + + LOG_I(RRC, + PROTOCOL_RRC_CTXT_UE_FMT" [RAPROC] Logical Channel DL-CCCH, Generating RRCConnectionReestablishmentReject (bytes %d)\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), + eNB_rrc_inst[ctxt_pP->module_id].carrier[CC_id].Srb0.Tx_buffer.payload_size); +} + +//----------------------------------------------------------------------------- +void +rrc_eNB_generate_RRCConnectionRelease( + const protocol_ctxt_t* const ctxt_pP, + rrc_eNB_ue_context_t* const ue_context_pP +) +//----------------------------------------------------------------------------- +{ + + uint8_t buffer[RRC_BUF_SIZE]; + uint16_t size; + + T(T_ENB_RRC_CONNECTION_RELEASE, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), + T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); + + memset(buffer, 0, RRC_BUF_SIZE); + + size = do_RRCConnectionRelease(ctxt_pP->module_id, buffer,rrc_eNB_get_next_transaction_identifier(ctxt_pP->module_id)); + // set release timer + ue_context_pP->ue_context.ue_release_timer=1; + + LOG_I(RRC, + PROTOCOL_RRC_CTXT_UE_FMT" Logical Channel DL-DCCH, Generate RRCConnectionRelease (bytes %d)\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), + size); + + LOG_D(RRC, + PROTOCOL_RRC_CTXT_UE_FMT" --- PDCP_DATA_REQ/%d Bytes (rrcConnectionRelease MUI %d) --->[PDCP][RB %u]\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), + size, + rrc_eNB_mui, + DCCH); + + MSC_LOG_TX_MESSAGE( + MSC_RRC_ENB, + MSC_RRC_UE, + buffer, + size, + MSC_AS_TIME_FMT" rrcConnectionRelease UE %x MUI %d size %u", + MSC_AS_TIME_ARGS(ctxt_pP), + ue_context_pP->ue_context.rnti, + rrc_eNB_mui, + size); + + rrc_data_req( + ctxt_pP, + DCCH, + rrc_eNB_mui++, + SDU_CONFIRM_NO, + size, + buffer, + PDCP_TRANSMISSION_MODE_CONTROL); +} + +//----------------------------------------------------------------------------- +void +rrc_eNB_generate_defaultRRCConnectionReconfiguration( + const protocol_ctxt_t* const ctxt_pP, + rrc_eNB_ue_context_t* const ue_context_pP, + const uint8_t ho_state +) +//----------------------------------------------------------------------------- +{ + uint8_t buffer[RRC_BUF_SIZE]; + uint16_t size; + int i; + + // configure SRB1/SRB2, PhysicalConfigDedicated, MAC_MainConfig for UE + //eNB_RRC_INST* rrc_inst = &eNB_rrc_inst[ctxt_pP->module_id]; + //struct PhysicalConfigDedicated** physicalConfigDedicated = &ue_context_pP->ue_context.physicalConfigDedicated; + + struct SRB_ToAddMod *SRB2_config = NULL; + struct SRB_ToAddMod__rlc_Config *SRB2_rlc_config = NULL; + struct SRB_ToAddMod__logicalChannelConfig *SRB2_lchan_config = NULL; + struct LogicalChannelConfig__ul_SpecificParameters + *SRB2_ul_SpecificParameters = NULL; + SRB_ToAddModList_t* SRB_configList = ue_context_pP->ue_context.SRB_configList; + SRB_ToAddModList_t *SRB_configList2 = NULL; + + struct DRB_ToAddMod *DRB_config = NULL; + struct RLC_Config *DRB_rlc_config = NULL; + struct PDCP_Config *DRB_pdcp_config = NULL; + struct PDCP_Config__rlc_AM *PDCP_rlc_AM = NULL; + struct PDCP_Config__rlc_UM *PDCP_rlc_UM = NULL; + struct LogicalChannelConfig *DRB_lchan_config = NULL; + struct LogicalChannelConfig__ul_SpecificParameters + *DRB_ul_SpecificParameters = NULL; + DRB_ToAddModList_t** DRB_configList = &ue_context_pP->ue_context.DRB_configList; + + MAC_MainConfig_t *mac_MainConfig = NULL; + MeasObjectToAddModList_t *MeasObj_list = NULL; + MeasObjectToAddMod_t *MeasObj = NULL; + ReportConfigToAddModList_t *ReportConfig_list = NULL; + ReportConfigToAddMod_t *ReportConfig_per, *ReportConfig_A1, + *ReportConfig_A2, *ReportConfig_A3, *ReportConfig_A4, *ReportConfig_A5; + MeasIdToAddModList_t *MeasId_list = NULL; + MeasIdToAddMod_t *MeasId0, *MeasId1, *MeasId2, *MeasId3, *MeasId4, *MeasId5; +#if Rel10 + long *sr_ProhibitTimer_r9 = NULL; + // uint8_t sCellIndexToAdd = rrc_find_free_SCell_index(enb_mod_idP, ue_mod_idP, 1); + //uint8_t sCellIndexToAdd = 0; +#endif + + long *logicalchannelgroup, *logicalchannelgroup_drb; + long *maxHARQ_Tx, *periodicBSR_Timer; + + RSRP_Range_t *rsrp = NULL; + struct MeasConfig__speedStatePars *Sparams = NULL; + QuantityConfig_t *quantityConfig = NULL; + CellsToAddMod_t *CellToAdd = NULL; + CellsToAddModList_t *CellsToAddModList = NULL; + struct RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList *dedicatedInfoNASList = NULL; + DedicatedInfoNAS_t *dedicatedInfoNas = NULL; + /* for no gcc warnings */ + (void)dedicatedInfoNas; + + C_RNTI_t *cba_RNTI = NULL; +#ifdef CBA + //struct PUSCH_CBAConfigDedicated_vlola *pusch_CBAConfigDedicated_vlola; + uint8_t *cba_RNTI_buf; + cba_RNTI = CALLOC(1, sizeof(C_RNTI_t)); + cba_RNTI_buf = CALLOC(1, 2 * sizeof(uint8_t)); + cba_RNTI->buf = cba_RNTI_buf; + cba_RNTI->size = 2; + cba_RNTI->bits_unused = 0; + + // associate UEs to the CBa groups as a function of their UE id + if (rrc_inst->num_active_cba_groups) { + cba_RNTI->buf[0] = rrc_inst->cba_rnti[ue_mod_idP % rrc_inst->num_active_cba_groups] & 0xff; + cba_RNTI->buf[1] = 0xff; + LOG_D(RRC, + "[eNB %d] Frame %d: cba_RNTI = %x in group %d is attribued to UE %d\n", + enb_mod_idP, frameP, + rrc_inst->cba_rnti[ue_mod_idP % rrc_inst->num_active_cba_groups], + ue_mod_idP % rrc_inst->num_active_cba_groups, ue_mod_idP); + } else { + cba_RNTI->buf[0] = 0x0; + cba_RNTI->buf[1] = 0x0; + LOG_D(RRC, "[eNB %d] Frame %d: no cba_RNTI is configured for UE %d\n", enb_mod_idP, frameP, ue_mod_idP); + } + +#endif + + T(T_ENB_RRC_CONNECTION_RECONFIGURATION, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), + T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); + + // Configure SRB2 + /// SRB2 + SRB2_config = CALLOC(1, sizeof(*SRB2_config)); + SRB_configList2 = CALLOC(1, sizeof(*SRB_configList2)); + memset(SRB_configList2, 0, sizeof(*SRB_configList2)); + + SRB2_config->srb_Identity = 2; + SRB2_rlc_config = CALLOC(1, sizeof(*SRB2_rlc_config)); + SRB2_config->rlc_Config = SRB2_rlc_config; + + SRB2_rlc_config->present = SRB_ToAddMod__rlc_Config_PR_explicitValue; + SRB2_rlc_config->choice.explicitValue.present = RLC_Config_PR_am; + SRB2_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.t_PollRetransmit = T_PollRetransmit_ms15; + SRB2_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.pollPDU = PollPDU_p8; + SRB2_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.pollByte = PollByte_kB1000; + SRB2_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.maxRetxThreshold = UL_AM_RLC__maxRetxThreshold_t32; + SRB2_rlc_config->choice.explicitValue.choice.am.dl_AM_RLC.t_Reordering = T_Reordering_ms35; + SRB2_rlc_config->choice.explicitValue.choice.am.dl_AM_RLC.t_StatusProhibit = T_StatusProhibit_ms10; + + SRB2_lchan_config = CALLOC(1, sizeof(*SRB2_lchan_config)); + SRB2_config->logicalChannelConfig = SRB2_lchan_config; + + SRB2_lchan_config->present = SRB_ToAddMod__logicalChannelConfig_PR_explicitValue; + + SRB2_ul_SpecificParameters = CALLOC(1, sizeof(*SRB2_ul_SpecificParameters)); + + SRB2_ul_SpecificParameters->priority = 1; + SRB2_ul_SpecificParameters->prioritisedBitRate = + LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_infinity; + SRB2_ul_SpecificParameters->bucketSizeDuration = + LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms50; + + // LCG for CCCH and DCCH is 0 as defined in 36331 + logicalchannelgroup = CALLOC(1, sizeof(long)); + *logicalchannelgroup = 0; + + SRB2_ul_SpecificParameters->logicalChannelGroup = logicalchannelgroup; + + SRB2_lchan_config->choice.explicitValue.ul_SpecificParameters = SRB2_ul_SpecificParameters; + ASN_SEQUENCE_ADD(&SRB_configList->list, SRB2_config); + ASN_SEQUENCE_ADD(&SRB_configList2->list, SRB2_config); + + // Configure DRB + //*DRB_configList = CALLOC(1, sizeof(*DRB_configList)); + *DRB_configList = CALLOC(1, sizeof(**DRB_configList)); + /// DRB + DRB_config = CALLOC(1, sizeof(*DRB_config)); + + DRB_config->eps_BearerIdentity = CALLOC(1, sizeof(long)); + *(DRB_config->eps_BearerIdentity) = 5L; // LW set to first value, allowed value 5..15, value : x+4 + // DRB_config->drb_Identity = (DRB_Identity_t) 1; //allowed values 1..32 + // NN: this is the 1st DRB for this ue, so set it to 1 + // NN: this is the 1st DRB for this ue, so set it to 1 + DRB_config->drb_Identity = (DRB_Identity_t) 1; // (ue_mod_idP+1); //allowed values 1..32, value: x + DRB_config->logicalChannelIdentity = CALLOC(1, sizeof(long)); + *(DRB_config->logicalChannelIdentity) = (long)3; // value : x+2 + DRB_rlc_config = CALLOC(1, sizeof(*DRB_rlc_config)); + DRB_config->rlc_Config = DRB_rlc_config; + +#ifdef RRC_DEFAULT_RAB_IS_AM + DRB_rlc_config->present = RLC_Config_PR_am; + DRB_rlc_config->choice.am.ul_AM_RLC.t_PollRetransmit = T_PollRetransmit_ms50; + DRB_rlc_config->choice.am.ul_AM_RLC.pollPDU = PollPDU_p16; + DRB_rlc_config->choice.am.ul_AM_RLC.pollByte = PollByte_kBinfinity; + DRB_rlc_config->choice.am.ul_AM_RLC.maxRetxThreshold = UL_AM_RLC__maxRetxThreshold_t8; + DRB_rlc_config->choice.am.dl_AM_RLC.t_Reordering = T_Reordering_ms35; + DRB_rlc_config->choice.am.dl_AM_RLC.t_StatusProhibit = T_StatusProhibit_ms25; +#else + DRB_rlc_config->present = RLC_Config_PR_um_Bi_Directional; + DRB_rlc_config->choice.um_Bi_Directional.ul_UM_RLC.sn_FieldLength = SN_FieldLength_size10; + DRB_rlc_config->choice.um_Bi_Directional.dl_UM_RLC.sn_FieldLength = SN_FieldLength_size10; +#ifdef CBA + DRB_rlc_config->choice.um_Bi_Directional.dl_UM_RLC.t_Reordering = T_Reordering_ms5;//T_Reordering_ms25; +#else + DRB_rlc_config->choice.um_Bi_Directional.dl_UM_RLC.t_Reordering = T_Reordering_ms35; +#endif +#endif + + DRB_pdcp_config = CALLOC(1, sizeof(*DRB_pdcp_config)); + DRB_config->pdcp_Config = DRB_pdcp_config; + DRB_pdcp_config->discardTimer = CALLOC(1, sizeof(long)); + *DRB_pdcp_config->discardTimer = PDCP_Config__discardTimer_infinity; + DRB_pdcp_config->rlc_AM = NULL; + DRB_pdcp_config->rlc_UM = NULL; + + /* avoid gcc warnings */ + (void)PDCP_rlc_AM; + (void)PDCP_rlc_UM; + +#ifdef RRC_DEFAULT_RAB_IS_AM // EXMIMO_IOT + PDCP_rlc_AM = CALLOC(1, sizeof(*PDCP_rlc_AM)); + DRB_pdcp_config->rlc_AM = PDCP_rlc_AM; + PDCP_rlc_AM->statusReportRequired = FALSE; +#else + PDCP_rlc_UM = CALLOC(1, sizeof(*PDCP_rlc_UM)); + DRB_pdcp_config->rlc_UM = PDCP_rlc_UM; + PDCP_rlc_UM->pdcp_SN_Size = PDCP_Config__rlc_UM__pdcp_SN_Size_len12bits; +#endif + DRB_pdcp_config->headerCompression.present = PDCP_Config__headerCompression_PR_notUsed; + + DRB_lchan_config = CALLOC(1, sizeof(*DRB_lchan_config)); + DRB_config->logicalChannelConfig = DRB_lchan_config; + DRB_ul_SpecificParameters = CALLOC(1, sizeof(*DRB_ul_SpecificParameters)); + DRB_lchan_config->ul_SpecificParameters = DRB_ul_SpecificParameters; + + DRB_ul_SpecificParameters->priority = 2; // lower priority than srb1, srb2 + DRB_ul_SpecificParameters->prioritisedBitRate = + LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_infinity; + DRB_ul_SpecificParameters->bucketSizeDuration = + LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms50; + + // LCG for DTCH can take the value from 1 to 3 as defined in 36331: normally controlled by upper layers (like RRM) + logicalchannelgroup_drb = CALLOC(1, sizeof(long)); + *logicalchannelgroup_drb = 1; + DRB_ul_SpecificParameters->logicalChannelGroup = logicalchannelgroup_drb; + + ASN_SEQUENCE_ADD(&(*DRB_configList)->list, DRB_config); + + mac_MainConfig = CALLOC(1, sizeof(*mac_MainConfig)); + ue_context_pP->ue_context.mac_MainConfig = mac_MainConfig; + + mac_MainConfig->ul_SCH_Config = CALLOC(1, sizeof(*mac_MainConfig->ul_SCH_Config)); + + maxHARQ_Tx = CALLOC(1, sizeof(long)); + *maxHARQ_Tx = MAC_MainConfig__ul_SCH_Config__maxHARQ_Tx_n5; + mac_MainConfig->ul_SCH_Config->maxHARQ_Tx = maxHARQ_Tx; + periodicBSR_Timer = CALLOC(1, sizeof(long)); + *periodicBSR_Timer = MAC_MainConfig__ul_SCH_Config__periodicBSR_Timer_sf64; + mac_MainConfig->ul_SCH_Config->periodicBSR_Timer = periodicBSR_Timer; + mac_MainConfig->ul_SCH_Config->retxBSR_Timer = MAC_MainConfig__ul_SCH_Config__retxBSR_Timer_sf320; + mac_MainConfig->ul_SCH_Config->ttiBundling = 0; // FALSE + + mac_MainConfig->timeAlignmentTimerDedicated = TimeAlignmentTimer_infinity; + + mac_MainConfig->drx_Config = NULL; + + mac_MainConfig->phr_Config = CALLOC(1, sizeof(*mac_MainConfig->phr_Config)); + + mac_MainConfig->phr_Config->present = MAC_MainConfig__phr_Config_PR_setup; + mac_MainConfig->phr_Config->choice.setup.periodicPHR_Timer = MAC_MainConfig__phr_Config__setup__periodicPHR_Timer_sf20; // sf20 = 20 subframes + + mac_MainConfig->phr_Config->choice.setup.prohibitPHR_Timer = MAC_MainConfig__phr_Config__setup__prohibitPHR_Timer_sf20; // sf20 = 20 subframes + + mac_MainConfig->phr_Config->choice.setup.dl_PathlossChange = MAC_MainConfig__phr_Config__setup__dl_PathlossChange_dB1; // Value dB1 =1 dB, dB3 = 3 dB + +#ifdef Rel10 + sr_ProhibitTimer_r9 = CALLOC(1, sizeof(long)); + *sr_ProhibitTimer_r9 = 0; // SR tx on PUCCH, Value in number of SR period(s). Value 0 = no timer for SR, Value 2= 2*SR + mac_MainConfig->ext1 = CALLOC(1, sizeof(struct MAC_MainConfig__ext1)); + mac_MainConfig->ext1->sr_ProhibitTimer_r9 = sr_ProhibitTimer_r9; + //sps_RA_ConfigList_rlola = NULL; +#endif + + // Measurement ID list + MeasId_list = CALLOC(1, sizeof(*MeasId_list)); + memset((void *)MeasId_list, 0, sizeof(*MeasId_list)); + + MeasId0 = CALLOC(1, sizeof(*MeasId0)); + MeasId0->measId = 1; + MeasId0->measObjectId = 1; + MeasId0->reportConfigId = 1; + ASN_SEQUENCE_ADD(&MeasId_list->list, MeasId0); + + MeasId1 = CALLOC(1, sizeof(*MeasId1)); + MeasId1->measId = 2; + MeasId1->measObjectId = 1; + MeasId1->reportConfigId = 2; + ASN_SEQUENCE_ADD(&MeasId_list->list, MeasId1); + + MeasId2 = CALLOC(1, sizeof(*MeasId2)); + MeasId2->measId = 3; + MeasId2->measObjectId = 1; + MeasId2->reportConfigId = 3; + ASN_SEQUENCE_ADD(&MeasId_list->list, MeasId2); + + MeasId3 = CALLOC(1, sizeof(*MeasId3)); + MeasId3->measId = 4; + MeasId3->measObjectId = 1; + MeasId3->reportConfigId = 4; + ASN_SEQUENCE_ADD(&MeasId_list->list, MeasId3); + + MeasId4 = CALLOC(1, sizeof(*MeasId4)); + MeasId4->measId = 5; + MeasId4->measObjectId = 1; + MeasId4->reportConfigId = 5; + ASN_SEQUENCE_ADD(&MeasId_list->list, MeasId4); + + MeasId5 = CALLOC(1, sizeof(*MeasId5)); + MeasId5->measId = 6; + MeasId5->measObjectId = 1; + MeasId5->reportConfigId = 6; + ASN_SEQUENCE_ADD(&MeasId_list->list, MeasId5); + + // rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->measIdToAddModList = MeasId_list; + + // Add one EUTRA Measurement Object + MeasObj_list = CALLOC(1, sizeof(*MeasObj_list)); + memset((void *)MeasObj_list, 0, sizeof(*MeasObj_list)); + + // Configure MeasObject + + MeasObj = CALLOC(1, sizeof(*MeasObj)); + memset((void *)MeasObj, 0, sizeof(*MeasObj)); + + MeasObj->measObjectId = 1; + MeasObj->measObject.present = MeasObjectToAddMod__measObject_PR_measObjectEUTRA; + MeasObj->measObject.choice.measObjectEUTRA.carrierFreq = 3350; //band 7, 2.68GHz + //MeasObj->measObject.choice.measObjectEUTRA.carrierFreq = 36090; //band 33, 1.909GHz + MeasObj->measObject.choice.measObjectEUTRA.allowedMeasBandwidth = AllowedMeasBandwidth_mbw25; + MeasObj->measObject.choice.measObjectEUTRA.presenceAntennaPort1 = 1; + MeasObj->measObject.choice.measObjectEUTRA.neighCellConfig.buf = CALLOC(1, sizeof(uint8_t)); + MeasObj->measObject.choice.measObjectEUTRA.neighCellConfig.buf[0] = 0; + MeasObj->measObject.choice.measObjectEUTRA.neighCellConfig.size = 1; + MeasObj->measObject.choice.measObjectEUTRA.neighCellConfig.bits_unused = 6; + MeasObj->measObject.choice.measObjectEUTRA.offsetFreq = NULL; // Default is 15 or 0dB + + MeasObj->measObject.choice.measObjectEUTRA.cellsToAddModList = + (CellsToAddModList_t *) CALLOC(1, sizeof(*CellsToAddModList)); + + CellsToAddModList = MeasObj->measObject.choice.measObjectEUTRA.cellsToAddModList; + + // Add adjacent cell lists (6 per eNB) + for (i = 0; i < 6; i++) { + CellToAdd = (CellsToAddMod_t *) CALLOC(1, sizeof(*CellToAdd)); + CellToAdd->cellIndex = i + 1; + CellToAdd->physCellId = get_adjacent_cell_id(ctxt_pP->module_id, i); + CellToAdd->cellIndividualOffset = Q_OffsetRange_dB0; + + ASN_SEQUENCE_ADD(&CellsToAddModList->list, CellToAdd); + } + + ASN_SEQUENCE_ADD(&MeasObj_list->list, MeasObj); + // rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->measObjectToAddModList = MeasObj_list; + + // Report Configurations for periodical, A1-A5 events + ReportConfig_list = CALLOC(1, sizeof(*ReportConfig_list)); + + ReportConfig_per = CALLOC(1, sizeof(*ReportConfig_per)); + + ReportConfig_A1 = CALLOC(1, sizeof(*ReportConfig_A1)); + + ReportConfig_A2 = CALLOC(1, sizeof(*ReportConfig_A2)); + + ReportConfig_A3 = CALLOC(1, sizeof(*ReportConfig_A3)); + + ReportConfig_A4 = CALLOC(1, sizeof(*ReportConfig_A4)); + + ReportConfig_A5 = CALLOC(1, sizeof(*ReportConfig_A5)); + + ReportConfig_per->reportConfigId = 1; + ReportConfig_per->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA; + ReportConfig_per->reportConfig.choice.reportConfigEUTRA.triggerType.present = + ReportConfigEUTRA__triggerType_PR_periodical; + ReportConfig_per->reportConfig.choice.reportConfigEUTRA.triggerType.choice.periodical.purpose = + ReportConfigEUTRA__triggerType__periodical__purpose_reportStrongestCells; + ReportConfig_per->reportConfig.choice.reportConfigEUTRA.triggerQuantity = ReportConfigEUTRA__triggerQuantity_rsrp; + ReportConfig_per->reportConfig.choice.reportConfigEUTRA.reportQuantity = ReportConfigEUTRA__reportQuantity_both; + ReportConfig_per->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2; + ReportConfig_per->reportConfig.choice.reportConfigEUTRA.reportInterval = ReportInterval_ms120; + ReportConfig_per->reportConfig.choice.reportConfigEUTRA.reportAmount = ReportConfigEUTRA__reportAmount_infinity; + + ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_per); + + ReportConfig_A1->reportConfigId = 2; + ReportConfig_A1->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA; + ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.triggerType.present = + ReportConfigEUTRA__triggerType_PR_event; + ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.present = + ReportConfigEUTRA__triggerType__event__eventId_PR_eventA1; + ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.eventA1. + a1_Threshold.present = ThresholdEUTRA_PR_threshold_RSRP; + ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.eventA1. + a1_Threshold.choice.threshold_RSRP = 10; + + ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.triggerQuantity = ReportConfigEUTRA__triggerQuantity_rsrp; + ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.reportQuantity = ReportConfigEUTRA__reportQuantity_both; + ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2; + ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.reportInterval = ReportInterval_ms120; + ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.reportAmount = ReportConfigEUTRA__reportAmount_infinity; + + ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_A1); + + if (ho_state == 1 /*HO_MEASURMENT */ ) { + LOG_I(RRC, "[eNB %d] frame %d: requesting A2, A3, A4, A5, and A6 event reporting\n", + ctxt_pP->module_id, ctxt_pP->frame); + ReportConfig_A2->reportConfigId = 3; + ReportConfig_A2->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA; + ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.triggerType.present = + ReportConfigEUTRA__triggerType_PR_event; + ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.present = + ReportConfigEUTRA__triggerType__event__eventId_PR_eventA2; + ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice. + eventA2.a2_Threshold.present = ThresholdEUTRA_PR_threshold_RSRP; + ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice. + eventA2.a2_Threshold.choice.threshold_RSRP = 10; + + ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.triggerQuantity = + ReportConfigEUTRA__triggerQuantity_rsrp; + ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.reportQuantity = ReportConfigEUTRA__reportQuantity_both; + ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2; + ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.reportInterval = ReportInterval_ms120; + ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.reportAmount = ReportConfigEUTRA__reportAmount_infinity; + + ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_A2); + + ReportConfig_A3->reportConfigId = 4; + ReportConfig_A3->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA; + ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerType.present = + ReportConfigEUTRA__triggerType_PR_event; + ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.present = + ReportConfigEUTRA__triggerType__event__eventId_PR_eventA3; + + ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.eventA3.a3_Offset = 1; //10; + ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice. + eventA3.reportOnLeave = 1; + + ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerQuantity = + ReportConfigEUTRA__triggerQuantity_rsrp; + ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.reportQuantity = ReportConfigEUTRA__reportQuantity_both; + ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2; + ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.reportInterval = ReportInterval_ms120; + ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.reportAmount = ReportConfigEUTRA__reportAmount_infinity; + + ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.hysteresis = 0.5; // FIXME ...hysteresis is of type long! + ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.timeToTrigger = + TimeToTrigger_ms40; + ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_A3); + + ReportConfig_A4->reportConfigId = 5; + ReportConfig_A4->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA; + ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.triggerType.present = + ReportConfigEUTRA__triggerType_PR_event; + ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.present = + ReportConfigEUTRA__triggerType__event__eventId_PR_eventA4; + ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice. + eventA4.a4_Threshold.present = ThresholdEUTRA_PR_threshold_RSRP; + ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice. + eventA4.a4_Threshold.choice.threshold_RSRP = 10; + + ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.triggerQuantity = + ReportConfigEUTRA__triggerQuantity_rsrp; + ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.reportQuantity = ReportConfigEUTRA__reportQuantity_both; + ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2; + ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.reportInterval = ReportInterval_ms120; + ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.reportAmount = ReportConfigEUTRA__reportAmount_infinity; + + ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_A4); + + ReportConfig_A5->reportConfigId = 6; + ReportConfig_A5->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA; + ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerType.present = + ReportConfigEUTRA__triggerType_PR_event; + ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.present = + ReportConfigEUTRA__triggerType__event__eventId_PR_eventA5; + ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice. + eventA5.a5_Threshold1.present = ThresholdEUTRA_PR_threshold_RSRP; + ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice. + eventA5.a5_Threshold2.present = ThresholdEUTRA_PR_threshold_RSRP; + ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice. + eventA5.a5_Threshold1.choice.threshold_RSRP = 10; + ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice. + eventA5.a5_Threshold2.choice.threshold_RSRP = 10; + + ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerQuantity = + ReportConfigEUTRA__triggerQuantity_rsrp; + ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.reportQuantity = ReportConfigEUTRA__reportQuantity_both; + ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2; + ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.reportInterval = ReportInterval_ms120; + ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.reportAmount = ReportConfigEUTRA__reportAmount_infinity; + + ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_A5); + // rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->reportConfigToAddModList = ReportConfig_list; + + rsrp = CALLOC(1, sizeof(RSRP_Range_t)); + *rsrp = 20; + + Sparams = CALLOC(1, sizeof(*Sparams)); + Sparams->present = MeasConfig__speedStatePars_PR_setup; + Sparams->choice.setup.timeToTrigger_SF.sf_High = SpeedStateScaleFactors__sf_Medium_oDot75; + Sparams->choice.setup.timeToTrigger_SF.sf_Medium = SpeedStateScaleFactors__sf_High_oDot5; + Sparams->choice.setup.mobilityStateParameters.n_CellChangeHigh = 10; + Sparams->choice.setup.mobilityStateParameters.n_CellChangeMedium = 5; + Sparams->choice.setup.mobilityStateParameters.t_Evaluation = MobilityStateParameters__t_Evaluation_s60; + Sparams->choice.setup.mobilityStateParameters.t_HystNormal = MobilityStateParameters__t_HystNormal_s120; + + quantityConfig = CALLOC(1, sizeof(*quantityConfig)); + memset((void *)quantityConfig, 0, sizeof(*quantityConfig)); + quantityConfig->quantityConfigEUTRA = CALLOC(1, sizeof(struct QuantityConfigEUTRA)); + memset((void *)quantityConfig->quantityConfigEUTRA, 0, sizeof(*quantityConfig->quantityConfigEUTRA)); + quantityConfig->quantityConfigCDMA2000 = NULL; + quantityConfig->quantityConfigGERAN = NULL; + quantityConfig->quantityConfigUTRA = NULL; + quantityConfig->quantityConfigEUTRA->filterCoefficientRSRP = + CALLOC(1, sizeof(*(quantityConfig->quantityConfigEUTRA->filterCoefficientRSRP))); + quantityConfig->quantityConfigEUTRA->filterCoefficientRSRQ = + CALLOC(1, sizeof(*(quantityConfig->quantityConfigEUTRA->filterCoefficientRSRQ))); + *quantityConfig->quantityConfigEUTRA->filterCoefficientRSRP = FilterCoefficient_fc4; + *quantityConfig->quantityConfigEUTRA->filterCoefficientRSRQ = FilterCoefficient_fc4; + + LOG_I(RRC, + "[eNB %d] Frame %d: potential handover preparation: store the information in an intermediate structure in case of failure\n", + ctxt_pP->module_id, ctxt_pP->frame); + // store the information in an intermediate structure for Hanodver management + //rrc_inst->handover_info.as_config.sourceRadioResourceConfig.srb_ToAddModList = CALLOC(1,sizeof()); + ue_context_pP->ue_context.handover_info = CALLOC(1, sizeof(*(ue_context_pP->ue_context.handover_info))); + //memcpy((void *)rrc_inst->handover_info[ue_mod_idP]->as_config.sourceRadioResourceConfig.srb_ToAddModList,(void *)SRB_list,sizeof(SRB_ToAddModList_t)); + ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.srb_ToAddModList = SRB_configList2; + //memcpy((void *)rrc_inst->handover_info[ue_mod_idP]->as_config.sourceRadioResourceConfig.drb_ToAddModList,(void *)DRB_list,sizeof(DRB_ToAddModList_t)); + ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.drb_ToAddModList = *DRB_configList; + ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.drb_ToReleaseList = NULL; + ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.mac_MainConfig = + CALLOC(1, sizeof(*ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.mac_MainConfig)); + memcpy((void*)ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.mac_MainConfig, + (void *)mac_MainConfig, sizeof(MAC_MainConfig_t)); + ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.physicalConfigDedicated = + CALLOC(1, sizeof(PhysicalConfigDedicated_t)); + memcpy((void*)ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.physicalConfigDedicated, + (void*)ue_context_pP->ue_context.physicalConfigDedicated, sizeof(PhysicalConfigDedicated_t)); + ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.sps_Config = NULL; + //memcpy((void *)rrc_inst->handover_info[ue_mod_idP]->as_config.sourceRadioResourceConfig.sps_Config,(void *)rrc_inst->sps_Config[ue_mod_idP],sizeof(SPS_Config_t)); + + } + +#if defined(ENABLE_ITTI) + /* Initialize NAS list */ + dedicatedInfoNASList = CALLOC(1, sizeof(struct RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList)); + + /* Add all NAS PDUs to the list */ + for (i = 0; i < ue_context_pP->ue_context.nb_of_e_rabs; i++) { + if (ue_context_pP->ue_context.e_rab[i].param.nas_pdu.buffer != NULL) { + dedicatedInfoNas = CALLOC(1, sizeof(DedicatedInfoNAS_t)); + memset(dedicatedInfoNas, 0, sizeof(OCTET_STRING_t)); + OCTET_STRING_fromBuf(dedicatedInfoNas, (char*)ue_context_pP->ue_context.e_rab[i].param.nas_pdu.buffer, + ue_context_pP->ue_context.e_rab[i].param.nas_pdu.length); + ASN_SEQUENCE_ADD(&dedicatedInfoNASList->list, dedicatedInfoNas); + } + + /* TODO parameters yet to process ... */ + { + // ue_context_pP->ue_context.e_rab[i].param.qos; + // ue_context_pP->ue_context.e_rab[i].param.sgw_addr; + // ue_context_pP->ue_context.e_rab[i].param.gtp_teid; + } + + /* TODO should test if e RAB are Ok before! */ + ue_context_pP->ue_context.e_rab[i].status = E_RAB_STATUS_DONE; + } + + /* If list is empty free the list and reset the address */ + if (dedicatedInfoNASList->list.count == 0) { + free(dedicatedInfoNASList); + dedicatedInfoNASList = NULL; + } + +#endif + + memset(buffer, 0, RRC_BUF_SIZE); + + size = do_RRCConnectionReconfiguration(ctxt_pP, + buffer, + rrc_eNB_get_next_transaction_identifier(ctxt_pP->module_id), //Transaction_id, + (SRB_ToAddModList_t*)NULL, /// NN: do not reconfig srb1: SRB_configList2, + (DRB_ToAddModList_t*)*DRB_configList, + (DRB_ToReleaseList_t*)NULL, // DRB2_list, + (struct SPS_Config*)NULL, // *sps_Config, +#ifdef EXMIMO_IOT + NULL, NULL, NULL, NULL,NULL, +#else + (struct PhysicalConfigDedicated*)*physicalConfigDedicated, + (MeasObjectToAddModList_t*)MeasObj_list, + (ReportConfigToAddModList_t*)ReportConfig_list, + (QuantityConfig_t*)quantityConfig, + (MeasIdToAddModList_t*)MeasId_list, +#endif + (MAC_MainConfig_t*)mac_MainConfig, + (MeasGapConfig_t*)NULL, + (MobilityControlInfo_t*)NULL, + (struct MeasConfig__speedStatePars*)Sparams, + (RSRP_Range_t*)rsrp, + (C_RNTI_t*)cba_RNTI, + (struct RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList*)dedicatedInfoNASList +#ifdef Rel10 + , (SCellToAddMod_r10_t*)NULL +#endif + ); + +#ifdef RRC_MSG_PRINT + LOG_F(RRC,"[MSG] RRC Connection Reconfiguration\n"); + + for (i = 0; i < size; i++) { + LOG_F(RRC,"%02x ", ((uint8_t*)buffer)[i]); + } + + LOG_F(RRC,"\n"); + //////////////////////////////////////// +#endif + +#if defined(ENABLE_ITTI) + + /* Free all NAS PDUs */ + for (i = 0; i < ue_context_pP->ue_context.nb_of_e_rabs; i++) { + if (ue_context_pP->ue_context.e_rab[i].param.nas_pdu.buffer != NULL) { + /* Free the NAS PDU buffer and invalidate it */ + free(ue_context_pP->ue_context.e_rab[i].param.nas_pdu.buffer); + ue_context_pP->ue_context.e_rab[i].param.nas_pdu.buffer = NULL; + } + } + +#endif + + LOG_I(RRC, + "[eNB %d] Frame %d, Logical Channel DL-DCCH, Generate RRCConnectionReconfiguration (bytes %d, UE id %x)\n", + ctxt_pP->module_id, ctxt_pP->frame, size, ue_context_pP->ue_context.rnti); + + LOG_D(RRC, + "[FRAME %05d][RRC_eNB][MOD %u][][--- PDCP_DATA_REQ/%d Bytes (rrcConnectionReconfiguration to UE %x MUI %d) --->][PDCP][MOD %u][RB %u]\n", + ctxt_pP->frame, ctxt_pP->module_id, size, ue_context_pP->ue_context.rnti, rrc_eNB_mui, ctxt_pP->module_id, DCCH); + + MSC_LOG_TX_MESSAGE( + MSC_RRC_ENB, + MSC_RRC_UE, + buffer, + size, + MSC_AS_TIME_FMT" rrcConnectionReconfiguration UE %x MUI %d size %u", + MSC_AS_TIME_ARGS(ctxt_pP), + ue_context_pP->ue_context.rnti, + rrc_eNB_mui, + size); + + rrc_data_req( + ctxt_pP, + DCCH, + rrc_eNB_mui++, + SDU_CONFIRM_NO, + size, + buffer, + PDCP_TRANSMISSION_MODE_CONTROL); +} + + + +//----------------------------------------------------------------------------- +int +rrc_eNB_generate_RRCConnectionReconfiguration_SCell( + const protocol_ctxt_t* const ctxt_pP, + rrc_eNB_ue_context_t* const ue_context_pP, + uint32_t dl_CarrierFreq_r10 +) +//----------------------------------------------------------------------------- +{ + + uint8_t size; + uint8_t buffer[100]; + +#ifdef Rel10 + uint8_t sCellIndexToAdd = 0; //one SCell so far + + // uint8_t sCellIndexToAdd; + // sCellIndexToAdd = rrc_find_free_SCell_index(enb_mod_idP, ue_mod_idP, 1); + // if (eNB_rrc_inst[enb_mod_idP].sCell_config[ue_mod_idP][sCellIndexToAdd] ) { + if (ue_context_pP->ue_context.sCell_config != NULL) { + ue_context_pP->ue_context.sCell_config[sCellIndexToAdd].cellIdentification_r10->dl_CarrierFreq_r10 = dl_CarrierFreq_r10; + } else { + LOG_E(RRC,"Scell not configured!\n"); + return(-1); + } + +#endif + size = do_RRCConnectionReconfiguration(ctxt_pP, + buffer, + rrc_eNB_get_next_transaction_identifier(ctxt_pP->module_id),//Transaction_id, + (SRB_ToAddModList_t*)NULL, + (DRB_ToAddModList_t*)NULL, + (DRB_ToReleaseList_t*)NULL, + (struct SPS_Config*)NULL, + (struct PhysicalConfigDedicated*)NULL, + (MeasObjectToAddModList_t*)NULL, + (ReportConfigToAddModList_t*)NULL, + (QuantityConfig_t*)NULL, + (MeasIdToAddModList_t*)NULL, + (MAC_MainConfig_t*)NULL, + (MeasGapConfig_t*)NULL, + (MobilityControlInfo_t*)NULL, + (struct MeasConfig__speedStatePars*)NULL, + (RSRP_Range_t*)NULL, + (C_RNTI_t*)NULL, + (struct RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList*)NULL + +#ifdef Rel10 + , ue_context_pP->ue_context.sCell_config +#endif + ); + LOG_I(RRC,"[eNB %d] Frame %d, Logical Channel DL-DCCH, Generate RRCConnectionReconfiguration (bytes %d, UE id %x)\n", + ctxt_pP->module_id,ctxt_pP->frame, size, ue_context_pP->ue_context.rnti); + + MSC_LOG_TX_MESSAGE( + MSC_RRC_ENB, + MSC_RRC_UE, + buffer, + size, + MSC_AS_TIME_FMT" rrcConnectionReconfiguration UE %x MUI %d size %u", + MSC_AS_TIME_ARGS(ctxt_pP), + ue_context_pP->ue_context.rnti, + rrc_eNB_mui, + size); + + rrc_data_req( + ctxt_pP, + DCCH, + rrc_eNB_mui++, + SDU_CONFIRM_NO, + size, + buffer, + PDCP_TRANSMISSION_MODE_CONTROL); + return(0); +} + + +//----------------------------------------------------------------------------- +void +rrc_eNB_process_MeasurementReport( + const protocol_ctxt_t* const ctxt_pP, + rrc_eNB_ue_context_t* const ue_context_pP, + const MeasResults_t* const measResults2 +) +//----------------------------------------------------------------------------- +{ + T(T_ENB_RRC_MEASUREMENT_REPORT, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), + T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); + + + LOG_I(RRC, "[eNB %d] Frame %d: Process Measurement Report From UE %x (Measurement Id %d)\n", + ctxt_pP->module_id, ctxt_pP->frame, ctxt_pP->rnti, (int)measResults2->measId); + + if (measResults2->measResultNeighCells->choice.measResultListEUTRA.list.count > 0) { + LOG_I(RRC, "Physical Cell Id %d\n", + (int)measResults2->measResultNeighCells->choice.measResultListEUTRA.list.array[0]->physCellId); + LOG_I(RRC, "RSRP of Target %d\n", + (int)*(measResults2->measResultNeighCells->choice.measResultListEUTRA.list.array[0]-> + measResult.rsrpResult)); + LOG_I(RRC, "RSRQ of Target %d\n", + (int)*(measResults2->measResultNeighCells->choice.measResultListEUTRA.list.array[0]-> + measResult.rsrqResult)); + } + +#ifdef Rel10 + LOG_I(RRC, "RSRP of Source %d\n", measResults2->measResultPCell.rsrpResult); + LOG_I(RRC, "RSRQ of Source %d\n", measResults2->measResultPCell.rsrqResult); +#else + LOG_I(RRC, "RSRP of Source %d\n", measResults2->measResultServCell.rsrpResult); + LOG_I(RRC, "RSRQ of Source %d\n", measResults2->measResultServCell.rsrqResult); +#endif + + if (ue_context_pP->ue_context.handover_info->ho_prepare != 0xF0) { + rrc_eNB_generate_HandoverPreparationInformation(ctxt_pP, + ue_context_pP, + measResults2->measResultNeighCells->choice. + measResultListEUTRA.list.array[0]->physCellId); + } else { + LOG_D(RRC, "[eNB %d] Frame %d: Ignoring MeasReport from UE %x as Handover is in progress... \n", ctxt_pP->module_id, ctxt_pP->frame, + ctxt_pP->rnti); + } + + //Look for IP address of the target eNB + //Send Handover Request -> target eNB + //Wait for Handover Acknowledgement <- target eNB + //Send Handover Command + + //x2delay(); + // handover_request_x2(ue_mod_idP,enb_mod_idP,measResults2->measResultNeighCells->choice.measResultListEUTRA.list.array[0]->physCellId); + + // uint8_t buffer[100]; + // int size=rrc_eNB_generate_Handover_Command_TeNB(0,0,buffer); + // + // send_check_message((char*)buffer,size); + //send_handover_command(); + +} + +//----------------------------------------------------------------------------- +void +rrc_eNB_generate_HandoverPreparationInformation( + const protocol_ctxt_t* const ctxt_pP, + rrc_eNB_ue_context_t* const ue_context_pP, + PhysCellId_t targetPhyId +) +//----------------------------------------------------------------------------- +{ + struct rrc_eNB_ue_context_s* ue_context_target_p = NULL; + //uint8_t UE_id_target = -1; + uint8_t mod_id_target = get_adjacent_cell_mod_id(targetPhyId); + HANDOVER_INFO *handoverInfo = CALLOC(1, sizeof(*handoverInfo)); + /* + uint8_t buffer[100]; + uint8_t size; + struct PhysicalConfigDedicated **physicalConfigDedicated = &eNB_rrc_inst[enb_mod_idP].physicalConfigDedicated[ue_mod_idP]; + RadioResourceConfigDedicated_t *radioResourceConfigDedicated = CALLOC(1,sizeof(RadioResourceConfigDedicated_t)); + */ + + T(T_ENB_RRC_HANDOVER_PREPARATION_INFORMATION, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), + T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); + + handoverInfo->as_config.antennaInfoCommon.antennaPortsCount = 0; //Not used 0- but check value + handoverInfo->as_config.sourceDl_CarrierFreq = 36090; //Verify! + + memcpy((void *)&handoverInfo->as_config.sourceMasterInformationBlock, + (void*)&eNB_rrc_inst[ctxt_pP->module_id].carrier[0] /* CROUX TBC */.mib, sizeof(MasterInformationBlock_t)); + memcpy((void *)&handoverInfo->as_config.sourceMeasConfig, + (void*)ue_context_pP->ue_context.measConfig, sizeof(MeasConfig_t)); + + // FIXME handoverInfo not used... + free( handoverInfo ); + handoverInfo = 0; + + //to be configured + memset((void*)&ue_context_pP->ue_context.handover_info->as_config.sourceSecurityAlgorithmConfig, + 0, sizeof(SecurityAlgorithmConfig_t)); + + memcpy((void*)&ue_context_pP->ue_context.handover_info->as_config.sourceSystemInformationBlockType1, + (void*)&eNB_rrc_inst[ctxt_pP->module_id].carrier[0] /* CROUX TBC */.SIB1, sizeof(SystemInformationBlockType1_t)); + memcpy((void*)&ue_context_pP->ue_context.handover_info->as_config.sourceSystemInformationBlockType2, + (void*)&eNB_rrc_inst[ctxt_pP->module_id].carrier[0] /* CROUX TBC */.SIB23, sizeof(SystemInformationBlockType2_t)); + ue_context_pP->ue_context.handover_info->as_context.reestablishmentInfo = + CALLOC(1, sizeof(ReestablishmentInfo_t)); + ue_context_pP->ue_context.handover_info->as_context.reestablishmentInfo->sourcePhysCellId = + eNB_rrc_inst[ctxt_pP->module_id].carrier[0] /* CROUX TBC */.physCellId; + ue_context_pP->ue_context.handover_info->as_context.reestablishmentInfo->targetCellShortMAC_I.buf = NULL; // Check values later + ue_context_pP->ue_context.handover_info->as_context.reestablishmentInfo->targetCellShortMAC_I.size = 0; + ue_context_pP->ue_context.handover_info->as_context.reestablishmentInfo->targetCellShortMAC_I.bits_unused = 0; + ue_context_pP->ue_context.handover_info->as_context.reestablishmentInfo->additionalReestabInfoList = NULL; + ue_context_pP->ue_context.handover_info->ho_prepare = 0xFF; //0xF0; + ue_context_pP->ue_context.handover_info->ho_complete = 0; + + if (mod_id_target != 0xFF) { + //UE_id_target = rrc_find_free_ue_index(modid_target); + ue_context_target_p = + rrc_eNB_get_ue_context( + &eNB_rrc_inst[mod_id_target], + ue_context_pP->ue_context.rnti); + + /*UE_id_target = rrc_eNB_get_next_free_UE_index( + mod_id_target, + eNB_rrc_inst[ctxt_pP->module_id].Info.UE_list[ue_mod_idP]); //this should return a new index*/ + + if (ue_context_target_p == NULL) { // if not already in target cell + ue_context_target_p = rrc_eNB_allocate_new_UE_context(&eNB_rrc_inst[ctxt_pP->module_id]); + ue_context_target_p->ue_id_rnti = ue_context_pP->ue_context.rnti; // LG: should not be the same + ue_context_target_p->ue_context.rnti = ue_context_target_p->ue_id_rnti; // idem + LOG_N(RRC, + "[eNB %d] Frame %d : Emulate sending HandoverPreparationInformation msg from eNB source %d to eNB target %d: source UE_id %x target UE_id %x source_modId: %d target_modId: %d\n", + ctxt_pP->module_id, + ctxt_pP->frame, + eNB_rrc_inst[ctxt_pP->module_id].carrier[0] /* CROUX TBC */.physCellId, + targetPhyId, + ue_context_pP->ue_context.rnti, + ue_context_target_p->ue_id_rnti, + ctxt_pP->module_id, + mod_id_target); + ue_context_target_p->ue_context.handover_info = + CALLOC(1, sizeof(*(ue_context_target_p->ue_context.handover_info))); + memcpy((void*)&ue_context_target_p->ue_context.handover_info->as_context, + (void*)&ue_context_pP->ue_context.handover_info->as_context, + sizeof(AS_Context_t)); + memcpy((void*)&ue_context_target_p->ue_context.handover_info->as_config, + (void*)&ue_context_pP->ue_context.handover_info->as_config, + sizeof(AS_Config_t)); + ue_context_target_p->ue_context.handover_info->ho_prepare = 0x00;// 0xFF; + ue_context_target_p->ue_context.handover_info->ho_complete = 0; + ue_context_pP->ue_context.handover_info->modid_t = mod_id_target; + ue_context_pP->ue_context.handover_info->ueid_s = ue_context_pP->ue_context.rnti; + ue_context_pP->ue_context.handover_info->modid_s = ctxt_pP->module_id; + ue_context_target_p->ue_context.handover_info->modid_t = mod_id_target; + ue_context_target_p->ue_context.handover_info->modid_s = ctxt_pP->module_id; + ue_context_target_p->ue_context.handover_info->ueid_t = ue_context_target_p->ue_context.rnti; + + } else { + LOG_E(RRC, "\nError in obtaining free UE id in target eNB %l for handover \n", targetPhyId); + } + + } else { + LOG_E(RRC, "\nError in obtaining Module ID of target eNB for handover \n"); + } +} + +//----------------------------------------------------------------------------- +void +rrc_eNB_process_handoverPreparationInformation( + const protocol_ctxt_t* const ctxt_pP, + rrc_eNB_ue_context_t* const ue_context_pP +) +//----------------------------------------------------------------------------- +{ + T(T_ENB_RRC_HANDOVER_PREPARATION_INFORMATION, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), + T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); + + + LOG_I(RRC, + "[eNB %d] Frame %d : Logical Channel UL-DCCH, processing RRCHandoverPreparationInformation, sending RRCConnectionReconfiguration to UE %d \n", + ctxt_pP->module_id, ctxt_pP->frame, ue_context_pP->ue_context.rnti); + rrc_eNB_generate_RRCConnectionReconfiguration_handover( + ctxt_pP, + ue_context_pP, + NULL, + 0); +} + + +//----------------------------------------------------------------------------- +void +check_handovers( + protocol_ctxt_t* const ctxt_pP +) +//----------------------------------------------------------------------------- +{ + int result; + struct rrc_eNB_ue_context_s* ue_context_p; + RB_FOREACH(ue_context_p, rrc_ue_tree_s, &eNB_rrc_inst[ctxt_pP->module_id].rrc_ue_head) { + ctxt_pP->rnti = ue_context_p->ue_id_rnti; + + if (ue_context_p->ue_context.handover_info != NULL) { + if (ue_context_p->ue_context.handover_info->ho_prepare == 0xFF) { + LOG_D(RRC, + "[eNB %d] Frame %d: Incoming handover detected for new UE_idx %d (source eNB %d->target eNB %d) \n", + ctxt_pP->module_id, + ctxt_pP->frame, + ctxt_pP->rnti, + ctxt_pP->module_id, + ue_context_p->ue_context.handover_info->modid_t); + // source eNB generates rrcconnectionreconfiguration to prepare the HO + rrc_eNB_process_handoverPreparationInformation( + ctxt_pP, + ue_context_p); + ue_context_p->ue_context.handover_info->ho_prepare = 0xF1; + } + + if (ue_context_p->ue_context.handover_info->ho_complete == 0xF1) { + LOG_D(RRC, + "[eNB %d] Frame %d: handover Command received for new UE_id %x current eNB %d target eNB: %d \n", + ctxt_pP->module_id, + ctxt_pP->frame, + ctxt_pP->rnti, + ctxt_pP->module_id, + ue_context_p->ue_context.handover_info->modid_t); + //rrc_eNB_process_handoverPreparationInformation(enb_mod_idP,frameP,i); + result = pdcp_data_req(ctxt_pP, + SRB_FLAG_YES, + DCCH, + rrc_eNB_mui++, + SDU_CONFIRM_NO, + ue_context_p->ue_context.handover_info->size, + ue_context_p->ue_context.handover_info->buf, + PDCP_TRANSMISSION_MODE_CONTROL); + AssertFatal(result == TRUE, "PDCP data request failed!\n"); + ue_context_p->ue_context.handover_info->ho_complete = 0xF2; + } + } + } +} + +// 5.3.5.4 RRCConnectionReconfiguration including the mobilityControlInfo to prepare the UE handover +//----------------------------------------------------------------------------- +void +rrc_eNB_generate_RRCConnectionReconfiguration_handover( + const protocol_ctxt_t* const ctxt_pP, + rrc_eNB_ue_context_t* const ue_context_pP, + uint8_t* const nas_pdu, + const uint32_t nas_length +) +//----------------------------------------------------------------------------- +{ + T(T_ENB_RRC_CONNECTION_RECONFIGURATION, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), + T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); + + + uint8_t buffer[RRC_BUF_SIZE]; + uint16_t size; + int i; + uint8_t rv[2]; + uint16_t Idx; + // configure SRB1/SRB2, PhysicalConfigDedicated, MAC_MainConfig for UE + eNB_RRC_INST* rrc_inst = &eNB_rrc_inst[ctxt_pP->module_id]; + struct PhysicalConfigDedicated** physicalConfigDedicated = &ue_context_pP->ue_context.physicalConfigDedicated; + + struct SRB_ToAddMod *SRB2_config; + struct SRB_ToAddMod__rlc_Config *SRB2_rlc_config; + struct SRB_ToAddMod__logicalChannelConfig *SRB2_lchan_config; + struct LogicalChannelConfig__ul_SpecificParameters *SRB2_ul_SpecificParameters; + LogicalChannelConfig_t *SRB1_logicalChannelConfig = NULL; + SRB_ToAddModList_t* SRB_configList = ue_context_pP->ue_context.SRB_configList; // not used in this context: may be removed + SRB_ToAddModList_t *SRB_configList2; + + struct DRB_ToAddMod *DRB_config; + struct RLC_Config *DRB_rlc_config; + struct PDCP_Config *DRB_pdcp_config; + struct PDCP_Config__rlc_UM *PDCP_rlc_UM; + struct LogicalChannelConfig *DRB_lchan_config; + struct LogicalChannelConfig__ul_SpecificParameters *DRB_ul_SpecificParameters; + DRB_ToAddModList_t *DRB_configList2; + + MAC_MainConfig_t *mac_MainConfig; + MeasObjectToAddModList_t *MeasObj_list; + MeasObjectToAddMod_t *MeasObj; + ReportConfigToAddModList_t *ReportConfig_list; + ReportConfigToAddMod_t *ReportConfig_per, *ReportConfig_A1, + *ReportConfig_A2, *ReportConfig_A3, *ReportConfig_A4, *ReportConfig_A5; + MeasIdToAddModList_t *MeasId_list; + MeasIdToAddMod_t *MeasId0, *MeasId1, *MeasId2, *MeasId3, *MeasId4, *MeasId5; + QuantityConfig_t *quantityConfig; + MobilityControlInfo_t *mobilityInfo; + // HandoverCommand_t handoverCommand; + //uint8_t sourceModId = + // get_adjacent_cell_mod_id(ue_context_pP->ue_context.handover_info->as_context.reestablishmentInfo->sourcePhysCellId); +#if Rel10 + long *sr_ProhibitTimer_r9; +#endif + + long *logicalchannelgroup, *logicalchannelgroup_drb; + long *maxHARQ_Tx, *periodicBSR_Timer; + + // RSRP_Range_t *rsrp; + struct MeasConfig__speedStatePars *Sparams; + CellsToAddMod_t *CellToAdd; + CellsToAddModList_t *CellsToAddModList; + // srb 1: for HO + struct SRB_ToAddMod *SRB1_config; + struct SRB_ToAddMod__rlc_Config *SRB1_rlc_config; + struct SRB_ToAddMod__logicalChannelConfig *SRB1_lchan_config; + struct LogicalChannelConfig__ul_SpecificParameters *SRB1_ul_SpecificParameters; + // phy config dedicated + PhysicalConfigDedicated_t *physicalConfigDedicated2; + struct RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList *dedicatedInfoNASList; + protocol_ctxt_t ctxt; + + LOG_D(RRC, "[eNB %d] Frame %d: handover preparation: get the newSourceUEIdentity (C-RNTI): ", + ctxt_pP->module_id, ctxt_pP->frame); + + for (i = 0; i < 2; i++) { + rv[i] = taus() & 0xff; + LOG_D(RRC, " %x.", rv[i]); + } + + LOG_D(RRC, "[eNB %d] Frame %d : handover reparation: add target eNB SRB1 and PHYConfigDedicated reconfiguration\n", + ctxt_pP->module_id, ctxt_pP->frame); + // 1st: reconfigure SRB + SRB_configList2 = CALLOC(1, sizeof(*SRB_configList)); + SRB1_config = CALLOC(1, sizeof(*SRB1_config)); + SRB1_config->srb_Identity = 1; + SRB1_rlc_config = CALLOC(1, sizeof(*SRB1_rlc_config)); + SRB1_config->rlc_Config = SRB1_rlc_config; + + SRB1_rlc_config->present = SRB_ToAddMod__rlc_Config_PR_explicitValue; + SRB1_rlc_config->choice.explicitValue.present = RLC_Config_PR_am; + SRB1_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.t_PollRetransmit = T_PollRetransmit_ms15; + SRB1_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.pollPDU = PollPDU_p8; + SRB1_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.pollByte = PollByte_kB1000; + SRB1_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.maxRetxThreshold = UL_AM_RLC__maxRetxThreshold_t16; + SRB1_rlc_config->choice.explicitValue.choice.am.dl_AM_RLC.t_Reordering = T_Reordering_ms35; + SRB1_rlc_config->choice.explicitValue.choice.am.dl_AM_RLC.t_StatusProhibit = T_StatusProhibit_ms10; + + SRB1_lchan_config = CALLOC(1, sizeof(*SRB1_lchan_config)); + SRB1_config->logicalChannelConfig = SRB1_lchan_config; + + SRB1_lchan_config->present = SRB_ToAddMod__logicalChannelConfig_PR_explicitValue; + SRB1_ul_SpecificParameters = CALLOC(1, sizeof(*SRB1_ul_SpecificParameters)); + + SRB1_lchan_config->choice.explicitValue.ul_SpecificParameters = SRB1_ul_SpecificParameters; + + SRB1_ul_SpecificParameters->priority = 1; + + //assign_enum(&SRB1_ul_SpecificParameters->prioritisedBitRate,LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_infinity); + SRB1_ul_SpecificParameters->prioritisedBitRate = + LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_infinity; + + //assign_enum(&SRB1_ul_SpecificParameters->bucketSizeDuration,LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms50); + SRB1_ul_SpecificParameters->bucketSizeDuration = + LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms50; + + logicalchannelgroup = CALLOC(1, sizeof(long)); + *logicalchannelgroup = 0; + SRB1_ul_SpecificParameters->logicalChannelGroup = logicalchannelgroup; + + ASN_SEQUENCE_ADD(&SRB_configList2->list, SRB1_config); + + //2nd: now reconfigure phy config dedicated + physicalConfigDedicated2 = CALLOC(1, sizeof(*physicalConfigDedicated2)); + *physicalConfigDedicated = physicalConfigDedicated2; + + physicalConfigDedicated2->pdsch_ConfigDedicated = + CALLOC(1, sizeof(*physicalConfigDedicated2->pdsch_ConfigDedicated)); + physicalConfigDedicated2->pucch_ConfigDedicated = + CALLOC(1, sizeof(*physicalConfigDedicated2->pucch_ConfigDedicated)); + physicalConfigDedicated2->pusch_ConfigDedicated = + CALLOC(1, sizeof(*physicalConfigDedicated2->pusch_ConfigDedicated)); + physicalConfigDedicated2->uplinkPowerControlDedicated = + CALLOC(1, sizeof(*physicalConfigDedicated2->uplinkPowerControlDedicated)); + physicalConfigDedicated2->tpc_PDCCH_ConfigPUCCH = + CALLOC(1, sizeof(*physicalConfigDedicated2->tpc_PDCCH_ConfigPUCCH)); + physicalConfigDedicated2->tpc_PDCCH_ConfigPUSCH = + CALLOC(1, sizeof(*physicalConfigDedicated2->tpc_PDCCH_ConfigPUSCH)); + physicalConfigDedicated2->cqi_ReportConfig = NULL; //CALLOC(1,sizeof(*physicalConfigDedicated2->cqi_ReportConfig)); + physicalConfigDedicated2->soundingRS_UL_ConfigDedicated = NULL; //CALLOC(1,sizeof(*physicalConfigDedicated2->soundingRS_UL_ConfigDedicated)); + physicalConfigDedicated2->antennaInfo = CALLOC(1, sizeof(*physicalConfigDedicated2->antennaInfo)); + physicalConfigDedicated2->schedulingRequestConfig = + CALLOC(1, sizeof(*physicalConfigDedicated2->schedulingRequestConfig)); + // PDSCH + //assign_enum(&physicalConfigDedicated2->pdsch_ConfigDedicated->p_a, + // PDSCH_ConfigDedicated__p_a_dB0); + physicalConfigDedicated2->pdsch_ConfigDedicated->p_a = PDSCH_ConfigDedicated__p_a_dB0; + + // PUCCH + physicalConfigDedicated2->pucch_ConfigDedicated->ackNackRepetition.present = + PUCCH_ConfigDedicated__ackNackRepetition_PR_release; + physicalConfigDedicated2->pucch_ConfigDedicated->ackNackRepetition.choice.release = 0; + physicalConfigDedicated2->pucch_ConfigDedicated->tdd_AckNackFeedbackMode = NULL; //PUCCH_ConfigDedicated__tdd_AckNackFeedbackMode_multiplexing; + + // Pusch_config_dedicated + physicalConfigDedicated2->pusch_ConfigDedicated->betaOffset_ACK_Index = 0; // 2.00 + physicalConfigDedicated2->pusch_ConfigDedicated->betaOffset_RI_Index = 0; // 1.25 + physicalConfigDedicated2->pusch_ConfigDedicated->betaOffset_CQI_Index = 8; // 2.25 + + // UplinkPowerControlDedicated + physicalConfigDedicated2->uplinkPowerControlDedicated->p0_UE_PUSCH = 0; // 0 dB + //assign_enum(&physicalConfigDedicated2->uplinkPowerControlDedicated->deltaMCS_Enabled, + // UplinkPowerControlDedicated__deltaMCS_Enabled_en1); + physicalConfigDedicated2->uplinkPowerControlDedicated->deltaMCS_Enabled = + UplinkPowerControlDedicated__deltaMCS_Enabled_en1; + physicalConfigDedicated2->uplinkPowerControlDedicated->accumulationEnabled = 1; // should be TRUE in order to have 0dB power offset + physicalConfigDedicated2->uplinkPowerControlDedicated->p0_UE_PUCCH = 0; // 0 dB + physicalConfigDedicated2->uplinkPowerControlDedicated->pSRS_Offset = 0; // 0 dB + physicalConfigDedicated2->uplinkPowerControlDedicated->filterCoefficient = + CALLOC(1, sizeof(*physicalConfigDedicated2->uplinkPowerControlDedicated->filterCoefficient)); + // assign_enum(physicalConfigDedicated2->uplinkPowerControlDedicated->filterCoefficient,FilterCoefficient_fc4); // fc4 dB + *physicalConfigDedicated2->uplinkPowerControlDedicated->filterCoefficient = FilterCoefficient_fc4; // fc4 dB + + // TPC-PDCCH-Config + physicalConfigDedicated2->tpc_PDCCH_ConfigPUCCH->present = TPC_PDCCH_Config_PR_setup; + physicalConfigDedicated2->tpc_PDCCH_ConfigPUCCH->choice.setup.tpc_Index.present = TPC_Index_PR_indexOfFormat3; + physicalConfigDedicated2->tpc_PDCCH_ConfigPUCCH->choice.setup.tpc_Index.choice.indexOfFormat3 = 1; + physicalConfigDedicated2->tpc_PDCCH_ConfigPUCCH->choice.setup.tpc_RNTI.buf = CALLOC(1, 2); + physicalConfigDedicated2->tpc_PDCCH_ConfigPUCCH->choice.setup.tpc_RNTI.size = 2; + physicalConfigDedicated2->tpc_PDCCH_ConfigPUCCH->choice.setup.tpc_RNTI.buf[0] = 0x12; + physicalConfigDedicated2->tpc_PDCCH_ConfigPUCCH->choice.setup.tpc_RNTI.buf[1] = 0x34 + ue_context_pP->local_uid; + physicalConfigDedicated2->tpc_PDCCH_ConfigPUCCH->choice.setup.tpc_RNTI.bits_unused = 0; + + physicalConfigDedicated2->tpc_PDCCH_ConfigPUSCH->present = TPC_PDCCH_Config_PR_setup; + physicalConfigDedicated2->tpc_PDCCH_ConfigPUSCH->choice.setup.tpc_Index.present = TPC_Index_PR_indexOfFormat3; + physicalConfigDedicated2->tpc_PDCCH_ConfigPUSCH->choice.setup.tpc_Index.choice.indexOfFormat3 = 1; + physicalConfigDedicated2->tpc_PDCCH_ConfigPUSCH->choice.setup.tpc_RNTI.buf = CALLOC(1, 2); + physicalConfigDedicated2->tpc_PDCCH_ConfigPUSCH->choice.setup.tpc_RNTI.size = 2; + physicalConfigDedicated2->tpc_PDCCH_ConfigPUSCH->choice.setup.tpc_RNTI.buf[0] = 0x22; + physicalConfigDedicated2->tpc_PDCCH_ConfigPUSCH->choice.setup.tpc_RNTI.buf[1] = 0x34 + ue_context_pP->local_uid; + physicalConfigDedicated2->tpc_PDCCH_ConfigPUSCH->choice.setup.tpc_RNTI.bits_unused = 0; + + // CQI ReportConfig + /* + physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportModeAperiodic=CALLOC(1,sizeof(*physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportModeAperiodic)); + assign_enum(physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportModeAperiodic, + CQI_ReportConfig__cqi_ReportModeAperiodic_rm30); // HLC CQI, no PMI + physicalConfigDedicated2->cqi_ReportConfig->nomPDSCH_RS_EPRE_Offset = 0; // 0 dB + physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic=CALLOC(1,sizeof(*physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic)); + physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic->present = CQI_ReportPeriodic_PR_setup; + physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic->choice.setup.cqi_PUCCH_ResourceIndex = 0; // n2_pucch + physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic->choice.setup.cqi_pmi_ConfigIndex = 0; // Icqi/pmi + physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic->choice.setup.cqi_FormatIndicatorPeriodic.present = CQI_ReportPeriodic__setup__cqi_FormatIndicatorPeriodic_PR_subbandCQI; // subband CQI + physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic->choice.setup.cqi_FormatIndicatorPeriodic.choice.subbandCQI.k=4; + + physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic->choice.setup.ri_ConfigIndex=NULL; + physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic->choice.setup.simultaneousAckNackAndCQI=0; + */ + + //soundingRS-UL-ConfigDedicated + /* + physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->present = SoundingRS_UL_ConfigDedicated_PR_setup; + assign_enum(&physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->choice.setup.srs_Bandwidth, + SoundingRS_UL_ConfigDedicated__setup__srs_Bandwidth_bw0); + assign_enum(&physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->choice.setup.srs_HoppingBandwidth, + SoundingRS_UL_ConfigDedicated__setup__srs_HoppingBandwidth_hbw0); + physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->choice.setup.freqDomainPosition=0; + physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->choice.setup.duration=1; + physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->choice.setup.srs_ConfigIndex=1; + physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->choice.setup.transmissionComb=0; + assign_enum(&physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->choice.setup.cyclicShift, + SoundingRS_UL_ConfigDedicated__setup__cyclicShift_cs0); + */ + + //AntennaInfoDedicated + physicalConfigDedicated2->antennaInfo = CALLOC(1, sizeof(*physicalConfigDedicated2->antennaInfo)); + physicalConfigDedicated2->antennaInfo->present = PhysicalConfigDedicated__antennaInfo_PR_explicitValue; + //assign_enum(&physicalConfigDedicated2->antennaInfo->choice.explicitValue.transmissionMode, + // AntennaInfoDedicated__transmissionMode_tm2); + /* + switch (transmission_mode){ + case 1: + physicalConfigDedicated2->antennaInfo->choice.explicitValue.transmissionMode= AntennaInfoDedicated__transmissionMode_tm1; + break; + case 2: + physicalConfigDedicated2->antennaInfo->choice.explicitValue.transmissionMode= AntennaInfoDedicated__transmissionMode_tm2; + break; + case 4: + physicalConfigDedicated2->antennaInfo->choice.explicitValue.transmissionMode= AntennaInfoDedicated__transmissionMode_tm4; + break; + case 5: + physicalConfigDedicated2->antennaInfo->choice.explicitValue.transmissionMode= AntennaInfoDedicated__transmissionMode_tm5; + break; + case 6: + physicalConfigDedicated2->antennaInfo->choice.explicitValue.transmissionMode= AntennaInfoDedicated__transmissionMode_tm6; + break; + } + */ + physicalConfigDedicated2->antennaInfo->choice.explicitValue.ue_TransmitAntennaSelection.present = + AntennaInfoDedicated__ue_TransmitAntennaSelection_PR_release; + physicalConfigDedicated2->antennaInfo->choice.explicitValue.ue_TransmitAntennaSelection.choice.release = 0; + + // SchedulingRequestConfig + physicalConfigDedicated2->schedulingRequestConfig->present = SchedulingRequestConfig_PR_setup; + physicalConfigDedicated2->schedulingRequestConfig->choice.setup.sr_PUCCH_ResourceIndex = ue_context_pP->local_uid; + + if (mac_xface->lte_frame_parms->frame_type == 0) { // FDD + physicalConfigDedicated2->schedulingRequestConfig->choice.setup.sr_ConfigIndex = 5 + (ue_context_pP->local_uid % + 10); // Isr = 5 (every 10 subframes, offset=2+UE_id mod3) + } else { + switch (mac_xface->lte_frame_parms->tdd_config) { + case 1: + physicalConfigDedicated2->schedulingRequestConfig->choice.setup.sr_ConfigIndex = 7 + (ue_context_pP->local_uid & 1) + (( + ue_context_pP->local_uid & 3) >> 1) * 5; // Isr = 5 (every 10 subframes, offset=2 for UE0, 3 for UE1, 7 for UE2, 8 for UE3 , 2 for UE4 etc..) + break; + + case 3: + physicalConfigDedicated2->schedulingRequestConfig->choice.setup.sr_ConfigIndex = 7 + (ue_context_pP->local_uid % + 3); // Isr = 5 (every 10 subframes, offset=2 for UE0, 3 for UE1, 3 for UE2, 2 for UE3 , etc..) + break; + + case 4: + physicalConfigDedicated2->schedulingRequestConfig->choice.setup.sr_ConfigIndex = 7 + (ue_context_pP->local_uid & + 1); // Isr = 5 (every 10 subframes, offset=2 for UE0, 3 for UE1, 3 for UE2, 2 for UE3 , etc..) + break; + + default: + physicalConfigDedicated2->schedulingRequestConfig->choice.setup.sr_ConfigIndex = 7; // Isr = 5 (every 10 subframes, offset=2 for all UE0 etc..) + break; + } + } + + // assign_enum(&physicalConfigDedicated2->schedulingRequestConfig->choice.setup.dsr_TransMax, + //SchedulingRequestConfig__setup__dsr_TransMax_n4); + // assign_enum(&physicalConfigDedicated2->schedulingRequestConfig->choice.setup.dsr_TransMax = SchedulingRequestConfig__setup__dsr_TransMax_n4; + physicalConfigDedicated2->schedulingRequestConfig->choice.setup.dsr_TransMax = + SchedulingRequestConfig__setup__dsr_TransMax_n4; + + LOG_D(RRC, + "handover_config [FRAME %05d][RRC_eNB][MOD %02d][][--- MAC_CONFIG_REQ (SRB1 UE %x) --->][MAC_eNB][MOD %02d][]\n", + ctxt_pP->frame, ctxt_pP->module_id, ue_context_pP->ue_context.rnti, ctxt_pP->module_id); + rrc_mac_config_req( + ctxt_pP->module_id, + ue_context_pP->ue_context.primaryCC_id, + ENB_FLAG_YES, + ue_context_pP->ue_context.rnti, + 0, + (RadioResourceConfigCommonSIB_t*) NULL, + ue_context_pP->ue_context.physicalConfigDedicated, +#ifdef Rel10 + (SCellToAddMod_r10_t *)NULL, + //(struct PhysicalConfigDedicatedSCell_r10 *)NULL, +#endif + (MeasObjectToAddMod_t **) NULL, + ue_context_pP->ue_context.mac_MainConfig, + 1, + SRB1_logicalChannelConfig, + ue_context_pP->ue_context.measGapConfig, + (TDD_Config_t*) NULL, + (MobilityControlInfo_t*) NULL, + (uint8_t*) NULL, + (uint16_t*) NULL, + NULL, + NULL, + NULL, + (MBSFN_SubframeConfigList_t *) NULL +#ifdef Rel10 + , 0, (MBSFN_AreaInfoList_r9_t *) NULL, (PMCH_InfoList_r9_t *) NULL +#endif +#ifdef CBA + , eNB_rrc_inst[ctxt_pP->module_id].num_active_cba_groups, eNB_rrc_inst[ctxt_pP->module_id].cba_rnti[0] +#endif + ); + + // Configure target eNB SRB2 + /// SRB2 + SRB2_config = CALLOC(1, sizeof(*SRB2_config)); + SRB_configList2 = CALLOC(1, sizeof(*SRB_configList2)); + memset(SRB_configList2, 0, sizeof(*SRB_configList2)); + + SRB2_config->srb_Identity = 2; + SRB2_rlc_config = CALLOC(1, sizeof(*SRB2_rlc_config)); + SRB2_config->rlc_Config = SRB2_rlc_config; + + SRB2_rlc_config->present = SRB_ToAddMod__rlc_Config_PR_explicitValue; + SRB2_rlc_config->choice.explicitValue.present = RLC_Config_PR_am; + SRB2_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.t_PollRetransmit = T_PollRetransmit_ms15; + SRB2_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.pollPDU = PollPDU_p8; + SRB2_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.pollByte = PollByte_kB1000; + SRB2_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.maxRetxThreshold = UL_AM_RLC__maxRetxThreshold_t32; + SRB2_rlc_config->choice.explicitValue.choice.am.dl_AM_RLC.t_Reordering = T_Reordering_ms35; + SRB2_rlc_config->choice.explicitValue.choice.am.dl_AM_RLC.t_StatusProhibit = T_StatusProhibit_ms10; + + SRB2_lchan_config = CALLOC(1, sizeof(*SRB2_lchan_config)); + SRB2_config->logicalChannelConfig = SRB2_lchan_config; + + SRB2_lchan_config->present = SRB_ToAddMod__logicalChannelConfig_PR_explicitValue; + + SRB2_ul_SpecificParameters = CALLOC(1, sizeof(*SRB2_ul_SpecificParameters)); + + SRB2_ul_SpecificParameters->priority = 1; + SRB2_ul_SpecificParameters->prioritisedBitRate = + LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_infinity; + SRB2_ul_SpecificParameters->bucketSizeDuration = + LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms50; + + // LCG for CCCH and DCCH is 0 as defined in 36331 + logicalchannelgroup = CALLOC(1, sizeof(long)); + *logicalchannelgroup = 0; + + SRB2_ul_SpecificParameters->logicalChannelGroup = logicalchannelgroup; + SRB2_lchan_config->choice.explicitValue.ul_SpecificParameters = SRB2_ul_SpecificParameters; + ASN_SEQUENCE_ADD(&SRB_configList->list, SRB2_config); + ASN_SEQUENCE_ADD(&SRB_configList2->list, SRB2_config); + + // Configure target eNB DRB + DRB_configList2 = CALLOC(1, sizeof(*DRB_configList2)); + /// DRB + DRB_config = CALLOC(1, sizeof(*DRB_config)); + + //DRB_config->drb_Identity = (DRB_Identity_t) 1; //allowed values 1..32 + // NN: this is the 1st DRB for this ue, so set it to 1 + DRB_config->drb_Identity = (DRB_Identity_t) 1; // (ue_mod_idP+1); //allowed values 1..32 + DRB_config->logicalChannelIdentity = CALLOC(1, sizeof(long)); + *(DRB_config->logicalChannelIdentity) = (long)3; + DRB_rlc_config = CALLOC(1, sizeof(*DRB_rlc_config)); + DRB_config->rlc_Config = DRB_rlc_config; + DRB_rlc_config->present = RLC_Config_PR_um_Bi_Directional; + DRB_rlc_config->choice.um_Bi_Directional.ul_UM_RLC.sn_FieldLength = SN_FieldLength_size10; + DRB_rlc_config->choice.um_Bi_Directional.dl_UM_RLC.sn_FieldLength = SN_FieldLength_size10; + DRB_rlc_config->choice.um_Bi_Directional.dl_UM_RLC.t_Reordering = T_Reordering_ms35; + + DRB_pdcp_config = CALLOC(1, sizeof(*DRB_pdcp_config)); + DRB_config->pdcp_Config = DRB_pdcp_config; + DRB_pdcp_config->discardTimer = NULL; + DRB_pdcp_config->rlc_AM = NULL; + PDCP_rlc_UM = CALLOC(1, sizeof(*PDCP_rlc_UM)); + DRB_pdcp_config->rlc_UM = PDCP_rlc_UM; + PDCP_rlc_UM->pdcp_SN_Size = PDCP_Config__rlc_UM__pdcp_SN_Size_len12bits; + DRB_pdcp_config->headerCompression.present = PDCP_Config__headerCompression_PR_notUsed; + + DRB_lchan_config = CALLOC(1, sizeof(*DRB_lchan_config)); + DRB_config->logicalChannelConfig = DRB_lchan_config; + DRB_ul_SpecificParameters = CALLOC(1, sizeof(*DRB_ul_SpecificParameters)); + DRB_lchan_config->ul_SpecificParameters = DRB_ul_SpecificParameters; + + DRB_ul_SpecificParameters->priority = 2; // lower priority than srb1, srb2 + DRB_ul_SpecificParameters->prioritisedBitRate = + LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_infinity; + DRB_ul_SpecificParameters->bucketSizeDuration = + LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms50; + + // LCG for DTCH can take the value from 1 to 3 as defined in 36331: normally controlled by upper layers (like RRM) + logicalchannelgroup_drb = CALLOC(1, sizeof(long)); + *logicalchannelgroup_drb = 1; + DRB_ul_SpecificParameters->logicalChannelGroup = logicalchannelgroup_drb; + + ASN_SEQUENCE_ADD(&DRB_configList2->list, DRB_config); + + mac_MainConfig = CALLOC(1, sizeof(*mac_MainConfig)); + ue_context_pP->ue_context.mac_MainConfig = mac_MainConfig; + + mac_MainConfig->ul_SCH_Config = CALLOC(1, sizeof(*mac_MainConfig->ul_SCH_Config)); + + maxHARQ_Tx = CALLOC(1, sizeof(long)); + *maxHARQ_Tx = MAC_MainConfig__ul_SCH_Config__maxHARQ_Tx_n5; + mac_MainConfig->ul_SCH_Config->maxHARQ_Tx = maxHARQ_Tx; + + periodicBSR_Timer = CALLOC(1, sizeof(long)); + *periodicBSR_Timer = MAC_MainConfig__ul_SCH_Config__periodicBSR_Timer_sf64; + mac_MainConfig->ul_SCH_Config->periodicBSR_Timer = periodicBSR_Timer; + + mac_MainConfig->ul_SCH_Config->retxBSR_Timer = MAC_MainConfig__ul_SCH_Config__retxBSR_Timer_sf320; + + mac_MainConfig->ul_SCH_Config->ttiBundling = 0; // FALSE + + mac_MainConfig->drx_Config = NULL; + + mac_MainConfig->phr_Config = CALLOC(1, sizeof(*mac_MainConfig->phr_Config)); + + mac_MainConfig->phr_Config->present = MAC_MainConfig__phr_Config_PR_setup; + mac_MainConfig->phr_Config->choice.setup.periodicPHR_Timer = MAC_MainConfig__phr_Config__setup__periodicPHR_Timer_sf20; // sf20 = 20 subframes + + mac_MainConfig->phr_Config->choice.setup.prohibitPHR_Timer = MAC_MainConfig__phr_Config__setup__prohibitPHR_Timer_sf20; // sf20 = 20 subframes + + mac_MainConfig->phr_Config->choice.setup.dl_PathlossChange = MAC_MainConfig__phr_Config__setup__dl_PathlossChange_dB1; // Value dB1 =1 dB, dB3 = 3 dB + +#ifdef Rel10 + sr_ProhibitTimer_r9 = CALLOC(1, sizeof(long)); + *sr_ProhibitTimer_r9 = 0; // SR tx on PUCCH, Value in number of SR period(s). Value 0 = no timer for SR, Value 2= 2*SR + mac_MainConfig->ext1 = CALLOC(1, sizeof(struct MAC_MainConfig__ext1)); + mac_MainConfig->ext1->sr_ProhibitTimer_r9 = sr_ProhibitTimer_r9; + //sps_RA_ConfigList_rlola = NULL; +#endif + // Measurement ID list + MeasId_list = CALLOC(1, sizeof(*MeasId_list)); + memset((void *)MeasId_list, 0, sizeof(*MeasId_list)); + + MeasId0 = CALLOC(1, sizeof(*MeasId0)); + MeasId0->measId = 1; + MeasId0->measObjectId = 1; + MeasId0->reportConfigId = 1; + ASN_SEQUENCE_ADD(&MeasId_list->list, MeasId0); + + MeasId1 = CALLOC(1, sizeof(*MeasId1)); + MeasId1->measId = 2; + MeasId1->measObjectId = 1; + MeasId1->reportConfigId = 2; + ASN_SEQUENCE_ADD(&MeasId_list->list, MeasId1); + + MeasId2 = CALLOC(1, sizeof(*MeasId2)); + MeasId2->measId = 3; + MeasId2->measObjectId = 1; + MeasId2->reportConfigId = 3; + ASN_SEQUENCE_ADD(&MeasId_list->list, MeasId2); + + MeasId3 = CALLOC(1, sizeof(*MeasId3)); + MeasId3->measId = 4; + MeasId3->measObjectId = 1; + MeasId3->reportConfigId = 4; + ASN_SEQUENCE_ADD(&MeasId_list->list, MeasId3); + + MeasId4 = CALLOC(1, sizeof(*MeasId4)); + MeasId4->measId = 5; + MeasId4->measObjectId = 1; + MeasId4->reportConfigId = 5; + ASN_SEQUENCE_ADD(&MeasId_list->list, MeasId4); + + MeasId5 = CALLOC(1, sizeof(*MeasId5)); + MeasId5->measId = 6; + MeasId5->measObjectId = 1; + MeasId5->reportConfigId = 6; + ASN_SEQUENCE_ADD(&MeasId_list->list, MeasId5); + + // rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->measIdToAddModList = MeasId_list; + + // Add one EUTRA Measurement Object + MeasObj_list = CALLOC(1, sizeof(*MeasObj_list)); + memset((void *)MeasObj_list, 0, sizeof(*MeasObj_list)); + + // Configure MeasObject + + MeasObj = CALLOC(1, sizeof(*MeasObj)); + memset((void *)MeasObj, 0, sizeof(*MeasObj)); + + MeasObj->measObjectId = 1; + MeasObj->measObject.present = MeasObjectToAddMod__measObject_PR_measObjectEUTRA; + MeasObj->measObject.choice.measObjectEUTRA.carrierFreq = 36090; + MeasObj->measObject.choice.measObjectEUTRA.allowedMeasBandwidth = AllowedMeasBandwidth_mbw25; + MeasObj->measObject.choice.measObjectEUTRA.presenceAntennaPort1 = 1; + MeasObj->measObject.choice.measObjectEUTRA.neighCellConfig.buf = CALLOC(1, sizeof(uint8_t)); + MeasObj->measObject.choice.measObjectEUTRA.neighCellConfig.buf[0] = 0; + MeasObj->measObject.choice.measObjectEUTRA.neighCellConfig.size = 1; + MeasObj->measObject.choice.measObjectEUTRA.neighCellConfig.bits_unused = 6; + MeasObj->measObject.choice.measObjectEUTRA.offsetFreq = NULL; // Default is 15 or 0dB + + MeasObj->measObject.choice.measObjectEUTRA.cellsToAddModList = + (CellsToAddModList_t *) CALLOC(1, sizeof(*CellsToAddModList)); + CellsToAddModList = MeasObj->measObject.choice.measObjectEUTRA.cellsToAddModList; + + // Add adjacent cell lists (6 per eNB) + for (i = 0; i < 6; i++) { + CellToAdd = (CellsToAddMod_t *) CALLOC(1, sizeof(*CellToAdd)); + CellToAdd->cellIndex = i + 1; + CellToAdd->physCellId = get_adjacent_cell_id(ctxt_pP->module_id, i); + CellToAdd->cellIndividualOffset = Q_OffsetRange_dB0; + + ASN_SEQUENCE_ADD(&CellsToAddModList->list, CellToAdd); + } + + ASN_SEQUENCE_ADD(&MeasObj_list->list, MeasObj); + // rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->measObjectToAddModList = MeasObj_list; + + // Report Configurations for periodical, A1-A5 events + ReportConfig_list = CALLOC(1, sizeof(*ReportConfig_list)); + + ReportConfig_per = CALLOC(1, sizeof(*ReportConfig_per)); + + ReportConfig_A1 = CALLOC(1, sizeof(*ReportConfig_A1)); + + ReportConfig_A2 = CALLOC(1, sizeof(*ReportConfig_A2)); + + ReportConfig_A3 = CALLOC(1, sizeof(*ReportConfig_A3)); + + ReportConfig_A4 = CALLOC(1, sizeof(*ReportConfig_A4)); + + ReportConfig_A5 = CALLOC(1, sizeof(*ReportConfig_A5)); + + ReportConfig_per->reportConfigId = 1; + ReportConfig_per->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA; + ReportConfig_per->reportConfig.choice.reportConfigEUTRA.triggerType.present = + ReportConfigEUTRA__triggerType_PR_periodical; + ReportConfig_per->reportConfig.choice.reportConfigEUTRA.triggerType.choice.periodical.purpose = + ReportConfigEUTRA__triggerType__periodical__purpose_reportStrongestCells; + ReportConfig_per->reportConfig.choice.reportConfigEUTRA.triggerQuantity = ReportConfigEUTRA__triggerQuantity_rsrp; + ReportConfig_per->reportConfig.choice.reportConfigEUTRA.reportQuantity = ReportConfigEUTRA__reportQuantity_both; + ReportConfig_per->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2; + ReportConfig_per->reportConfig.choice.reportConfigEUTRA.reportInterval = ReportInterval_ms120; + ReportConfig_per->reportConfig.choice.reportConfigEUTRA.reportAmount = ReportConfigEUTRA__reportAmount_infinity; + + ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_per); + + ReportConfig_A1->reportConfigId = 2; + ReportConfig_A1->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA; + ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.triggerType.present = + ReportConfigEUTRA__triggerType_PR_event; + ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.present = + ReportConfigEUTRA__triggerType__event__eventId_PR_eventA1; + ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.eventA1. + a1_Threshold.present = ThresholdEUTRA_PR_threshold_RSRP; + ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.eventA1. + a1_Threshold.choice.threshold_RSRP = 10; + + ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.triggerQuantity = ReportConfigEUTRA__triggerQuantity_rsrp; + ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.reportQuantity = ReportConfigEUTRA__reportQuantity_both; + ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2; + ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.reportInterval = ReportInterval_ms120; + ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.reportAmount = ReportConfigEUTRA__reportAmount_infinity; + + ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_A1); + + ReportConfig_A2->reportConfigId = 3; + ReportConfig_A2->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA; + ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.triggerType.present = + ReportConfigEUTRA__triggerType_PR_event; + ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.present = + ReportConfigEUTRA__triggerType__event__eventId_PR_eventA2; + ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.eventA2. + a2_Threshold.present = ThresholdEUTRA_PR_threshold_RSRP; + ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.eventA2. + a2_Threshold.choice.threshold_RSRP = 10; + + ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.triggerQuantity = ReportConfigEUTRA__triggerQuantity_rsrp; + ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.reportQuantity = ReportConfigEUTRA__reportQuantity_both; + ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2; + ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.reportInterval = ReportInterval_ms120; + ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.reportAmount = ReportConfigEUTRA__reportAmount_infinity; + + ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_A2); + + ReportConfig_A3->reportConfigId = 4; + ReportConfig_A3->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA; + ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerType.present = + ReportConfigEUTRA__triggerType_PR_event; + ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.present = + ReportConfigEUTRA__triggerType__event__eventId_PR_eventA3; + ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.eventA3.a3_Offset = + 10; + ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice. + eventA3.reportOnLeave = 1; + + ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerQuantity = ReportConfigEUTRA__triggerQuantity_rsrp; + ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.reportQuantity = ReportConfigEUTRA__reportQuantity_both; + ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2; + ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.reportInterval = ReportInterval_ms120; + ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.reportAmount = ReportConfigEUTRA__reportAmount_infinity; + + ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_A3); + + ReportConfig_A4->reportConfigId = 5; + ReportConfig_A4->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA; + ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.triggerType.present = + ReportConfigEUTRA__triggerType_PR_event; + ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.present = + ReportConfigEUTRA__triggerType__event__eventId_PR_eventA4; + ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.eventA4. + a4_Threshold.present = ThresholdEUTRA_PR_threshold_RSRP; + ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.eventA4. + a4_Threshold.choice.threshold_RSRP = 10; + + ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.triggerQuantity = ReportConfigEUTRA__triggerQuantity_rsrp; + ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.reportQuantity = ReportConfigEUTRA__reportQuantity_both; + ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2; + ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.reportInterval = ReportInterval_ms120; + ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.reportAmount = ReportConfigEUTRA__reportAmount_infinity; + + ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_A4); + + ReportConfig_A5->reportConfigId = 6; + ReportConfig_A5->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA; + ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerType.present = + ReportConfigEUTRA__triggerType_PR_event; + ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.present = + ReportConfigEUTRA__triggerType__event__eventId_PR_eventA5; + ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice. + eventA5.a5_Threshold1.present = ThresholdEUTRA_PR_threshold_RSRP; + ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice. + eventA5.a5_Threshold2.present = ThresholdEUTRA_PR_threshold_RSRP; + ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice. + eventA5.a5_Threshold1.choice.threshold_RSRP = 10; + ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice. + eventA5.a5_Threshold2.choice.threshold_RSRP = 10; + + ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerQuantity = ReportConfigEUTRA__triggerQuantity_rsrp; + ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.reportQuantity = ReportConfigEUTRA__reportQuantity_both; + ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2; + ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.reportInterval = ReportInterval_ms120; + ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.reportAmount = ReportConfigEUTRA__reportAmount_infinity; + + ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_A5); + + Sparams = CALLOC(1, sizeof(*Sparams)); + Sparams->present = MeasConfig__speedStatePars_PR_setup; + Sparams->choice.setup.timeToTrigger_SF.sf_High = SpeedStateScaleFactors__sf_Medium_oDot75; + Sparams->choice.setup.timeToTrigger_SF.sf_Medium = SpeedStateScaleFactors__sf_High_oDot5; + Sparams->choice.setup.mobilityStateParameters.n_CellChangeHigh = 10; + Sparams->choice.setup.mobilityStateParameters.n_CellChangeMedium = 5; + Sparams->choice.setup.mobilityStateParameters.t_Evaluation = MobilityStateParameters__t_Evaluation_s60; + Sparams->choice.setup.mobilityStateParameters.t_HystNormal = MobilityStateParameters__t_HystNormal_s120; + + quantityConfig = CALLOC(1, sizeof(*quantityConfig)); + memset((void *)quantityConfig, 0, sizeof(*quantityConfig)); + quantityConfig->quantityConfigEUTRA = CALLOC(1, sizeof(*quantityConfig->quantityConfigEUTRA)); + memset((void *)quantityConfig->quantityConfigEUTRA, 0, sizeof(*quantityConfig->quantityConfigEUTRA)); + quantityConfig->quantityConfigCDMA2000 = NULL; + quantityConfig->quantityConfigGERAN = NULL; + quantityConfig->quantityConfigUTRA = NULL; + quantityConfig->quantityConfigEUTRA->filterCoefficientRSRP = + CALLOC(1, sizeof(*quantityConfig->quantityConfigEUTRA->filterCoefficientRSRP)); + quantityConfig->quantityConfigEUTRA->filterCoefficientRSRQ = + CALLOC(1, sizeof(*quantityConfig->quantityConfigEUTRA->filterCoefficientRSRQ)); + *quantityConfig->quantityConfigEUTRA->filterCoefficientRSRP = FilterCoefficient_fc4; + *quantityConfig->quantityConfigEUTRA->filterCoefficientRSRQ = FilterCoefficient_fc4; + + /* mobilityinfo */ + + mobilityInfo = CALLOC(1, sizeof(*mobilityInfo)); + memset((void *)mobilityInfo, 0, sizeof(*mobilityInfo)); + mobilityInfo->targetPhysCellId = + (PhysCellId_t) two_tier_hexagonal_cellIds[ue_context_pP->ue_context.handover_info->modid_t]; + LOG_D(RRC, "[eNB %d] Frame %d: handover preparation: targetPhysCellId: %d mod_id: %d ue: %x \n", + ctxt_pP->module_id, + ctxt_pP->frame, + mobilityInfo->targetPhysCellId, + ctxt_pP->module_id, + ue_context_pP->ue_context.rnti); + + mobilityInfo->additionalSpectrumEmission = CALLOC(1, sizeof(*mobilityInfo->additionalSpectrumEmission)); + *mobilityInfo->additionalSpectrumEmission = 1; //Check this value! + + mobilityInfo->t304 = MobilityControlInfo__t304_ms50; // need to configure an appropriate value here + + // New UE Identity (C-RNTI) to identify an UE uniquely in a cell + mobilityInfo->newUE_Identity.size = 2; + mobilityInfo->newUE_Identity.bits_unused = 0; + mobilityInfo->newUE_Identity.buf = rv; + mobilityInfo->newUE_Identity.buf[0] = rv[0]; + mobilityInfo->newUE_Identity.buf[1] = rv[1]; + + //memset((void *)&mobilityInfo->radioResourceConfigCommon,(void *)&rrc_inst->sib2->radioResourceConfigCommon,sizeof(RadioResourceConfigCommon_t)); + //memset((void *)&mobilityInfo->radioResourceConfigCommon,0,sizeof(RadioResourceConfigCommon_t)); + + // Configuring radioResourceConfigCommon + mobilityInfo->radioResourceConfigCommon.rach_ConfigCommon = + CALLOC(1, sizeof(*mobilityInfo->radioResourceConfigCommon.rach_ConfigCommon)); + memcpy((void *)mobilityInfo->radioResourceConfigCommon.rach_ConfigCommon, + (void *)&rrc_inst->carrier[0] /* CROUX TBC */.sib2->radioResourceConfigCommon.rach_ConfigCommon, sizeof(RACH_ConfigCommon_t)); + mobilityInfo->radioResourceConfigCommon.prach_Config.prach_ConfigInfo = + CALLOC(1, sizeof(*mobilityInfo->radioResourceConfigCommon.prach_Config.prach_ConfigInfo)); + memcpy((void *)mobilityInfo->radioResourceConfigCommon.prach_Config.prach_ConfigInfo, + (void *)&rrc_inst->carrier[0] /* CROUX TBC */.sib2->radioResourceConfigCommon.prach_Config.prach_ConfigInfo, + sizeof(PRACH_ConfigInfo_t)); + + mobilityInfo->radioResourceConfigCommon.prach_Config.rootSequenceIndex = + rrc_inst->carrier[0] /* CROUX TBC */.sib2->radioResourceConfigCommon.prach_Config.rootSequenceIndex; + mobilityInfo->radioResourceConfigCommon.pdsch_ConfigCommon = + CALLOC(1, sizeof(*mobilityInfo->radioResourceConfigCommon.pdsch_ConfigCommon)); + memcpy((void *)mobilityInfo->radioResourceConfigCommon.pdsch_ConfigCommon, + (void *)&rrc_inst->carrier[0] /* CROUX TBC */.sib2->radioResourceConfigCommon.pdsch_ConfigCommon, sizeof(PDSCH_ConfigCommon_t)); + memcpy((void *)&mobilityInfo->radioResourceConfigCommon.pusch_ConfigCommon, + (void *)&rrc_inst->carrier[0] /* CROUX TBC */.sib2->radioResourceConfigCommon.pusch_ConfigCommon, sizeof(PUSCH_ConfigCommon_t)); + mobilityInfo->radioResourceConfigCommon.phich_Config = NULL; + mobilityInfo->radioResourceConfigCommon.pucch_ConfigCommon = + CALLOC(1, sizeof(*mobilityInfo->radioResourceConfigCommon.pucch_ConfigCommon)); + memcpy((void *)mobilityInfo->radioResourceConfigCommon.pucch_ConfigCommon, + (void *)&rrc_inst->carrier[0] /* CROUX TBC */.sib2->radioResourceConfigCommon.pucch_ConfigCommon, sizeof(PUCCH_ConfigCommon_t)); + mobilityInfo->radioResourceConfigCommon.soundingRS_UL_ConfigCommon = + CALLOC(1, sizeof(*mobilityInfo->radioResourceConfigCommon.soundingRS_UL_ConfigCommon)); + memcpy((void *)mobilityInfo->radioResourceConfigCommon.soundingRS_UL_ConfigCommon, + (void *)&rrc_inst->carrier[0] /* CROUX TBC */.sib2->radioResourceConfigCommon.soundingRS_UL_ConfigCommon, + sizeof(SoundingRS_UL_ConfigCommon_t)); + mobilityInfo->radioResourceConfigCommon.uplinkPowerControlCommon = + CALLOC(1, sizeof(*mobilityInfo->radioResourceConfigCommon.uplinkPowerControlCommon)); + memcpy((void *)mobilityInfo->radioResourceConfigCommon.uplinkPowerControlCommon, + (void *)&rrc_inst->carrier[0] /* CROUX TBC */.sib2->radioResourceConfigCommon.uplinkPowerControlCommon, + sizeof(UplinkPowerControlCommon_t)); + mobilityInfo->radioResourceConfigCommon.antennaInfoCommon = NULL; + mobilityInfo->radioResourceConfigCommon.p_Max = NULL; // CALLOC(1,sizeof(*mobilityInfo->radioResourceConfigCommon.p_Max)); + //memcpy((void *)mobilityInfo->radioResourceConfigCommon.p_Max,(void *)rrc_inst->sib1->p_Max,sizeof(P_Max_t)); + mobilityInfo->radioResourceConfigCommon.tdd_Config = NULL; //CALLOC(1,sizeof(TDD_Config_t)); + //memcpy((void *)mobilityInfo->radioResourceConfigCommon.tdd_Config,(void *)rrc_inst->sib1->tdd_Config,sizeof(TDD_Config_t)); + mobilityInfo->radioResourceConfigCommon.ul_CyclicPrefixLength = + rrc_inst->carrier[0] /* CROUX TBC */.sib2->radioResourceConfigCommon.ul_CyclicPrefixLength; + //End of configuration of radioResourceConfigCommon + + mobilityInfo->carrierFreq = CALLOC(1, sizeof(*mobilityInfo->carrierFreq)); //CALLOC(1,sizeof(CarrierFreqEUTRA_t)); 36090 + mobilityInfo->carrierFreq->dl_CarrierFreq = 36090; + mobilityInfo->carrierFreq->ul_CarrierFreq = NULL; + + mobilityInfo->carrierBandwidth = CALLOC(1, sizeof( + *mobilityInfo->carrierBandwidth)); //CALLOC(1,sizeof(struct CarrierBandwidthEUTRA)); AllowedMeasBandwidth_mbw25 + mobilityInfo->carrierBandwidth->dl_Bandwidth = CarrierBandwidthEUTRA__dl_Bandwidth_n25; + mobilityInfo->carrierBandwidth->ul_Bandwidth = NULL; + mobilityInfo->rach_ConfigDedicated = NULL; + + // store the srb and drb list for ho management, mainly in case of failure + + memcpy(ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.srb_ToAddModList, + (void*)SRB_configList2, + sizeof(SRB_ToAddModList_t)); + memcpy((void*)ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.drb_ToAddModList, + (void*)DRB_configList2, + sizeof(DRB_ToAddModList_t)); + ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.drb_ToReleaseList = NULL; + memcpy((void*)ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.mac_MainConfig, + (void*)mac_MainConfig, + sizeof(MAC_MainConfig_t)); + memcpy((void*)ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.physicalConfigDedicated, + (void*)ue_context_pP->ue_context.physicalConfigDedicated, + sizeof(PhysicalConfigDedicated_t)); + /* memcpy((void *)rrc_inst->handover_info[ue_mod_idP]->as_config.sourceRadioResourceConfig.sps_Config, + (void *)rrc_inst->sps_Config[ue_mod_idP], + sizeof(SPS_Config_t)); + */ + LOG_I(RRC, "[eNB %d] Frame %d: adding new UE\n"); + //Idx = (ue_mod_idP * NB_RB_MAX) + DCCH; + Idx = DCCH; + // SRB1 + ue_context_pP->ue_context.Srb1.Active = 1; + ue_context_pP->ue_context.Srb1.Srb_info.Srb_id = Idx; + memcpy(&ue_context_pP->ue_context.Srb1.Srb_info.Lchan_desc[0], &DCCH_LCHAN_DESC, LCHAN_DESC_SIZE); + memcpy(&ue_context_pP->ue_context.Srb1.Srb_info.Lchan_desc[1], &DCCH_LCHAN_DESC, LCHAN_DESC_SIZE); + + // SRB2 + ue_context_pP->ue_context.Srb2.Active = 1; + ue_context_pP->ue_context.Srb2.Srb_info.Srb_id = Idx; + memcpy(&ue_context_pP->ue_context.Srb2.Srb_info.Lchan_desc[0], &DCCH_LCHAN_DESC, LCHAN_DESC_SIZE); + memcpy(&ue_context_pP->ue_context.Srb2.Srb_info.Lchan_desc[1], &DCCH_LCHAN_DESC, LCHAN_DESC_SIZE); + LOG_I(RRC, "[eNB %d] CALLING RLC CONFIG SRB1 (rbid %d) for UE %x\n", + ctxt_pP->module_id, Idx, ue_context_pP->ue_context.rnti); + + // rrc_pdcp_config_req (enb_mod_idP, frameP, 1, CONFIG_ACTION_ADD, idx, UNDEF_SECURITY_MODE); + // rrc_rlc_config_req(enb_mod_idP,frameP,1,CONFIG_ACTION_ADD,Idx,SIGNALLING_RADIO_BEARER,Rlc_info_am_config); + + rrc_pdcp_config_asn1_req(&ctxt, + ue_context_pP->ue_context.SRB_configList, + (DRB_ToAddModList_t *) NULL, (DRB_ToReleaseList_t *) NULL, 0xff, NULL, NULL, NULL +#ifdef Rel10 + , (PMCH_InfoList_r9_t *) NULL +#endif + ); + + rrc_rlc_config_asn1_req(&ctxt, + ue_context_pP->ue_context.SRB_configList, + (DRB_ToAddModList_t *) NULL, (DRB_ToReleaseList_t *) NULL +#ifdef Rel10 + , (PMCH_InfoList_r9_t *) NULL +#endif + ); + + /* Initialize NAS list */ + dedicatedInfoNASList = NULL; + + // rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->reportConfigToAddModList = ReportConfig_list; + memset(buffer, 0, RRC_BUF_SIZE); + + size = do_RRCConnectionReconfiguration( + ctxt_pP, + buffer, + rrc_eNB_get_next_transaction_identifier(ctxt_pP->module_id), //Transaction_id, + SRB_configList2, + DRB_configList2, + NULL, // DRB2_list, + NULL, //*sps_Config, + ue_context_pP->ue_context.physicalConfigDedicated, + MeasObj_list, + ReportConfig_list, + NULL, //quantityConfig, + MeasId_list, + mac_MainConfig, + NULL, + mobilityInfo, + Sparams, + NULL, + NULL, + dedicatedInfoNASList +#ifdef Rel10 + , NULL // SCellToAddMod_r10_t +#endif + ); + + LOG_I(RRC, + "[eNB %d] Frame %d, Logical Channel DL-DCCH, Generate RRCConnectionReconfiguration for handover (bytes %d, UE rnti %x)\n", + ctxt_pP->module_id, ctxt_pP->frame, size, ue_context_pP->ue_context.rnti); + // to be updated if needed + /*if (eNB_rrc_inst[ctxt_pP->module_id].SRB1_config[ue_mod_idP]->logicalChannelConfig) { + if (eNB_rrc_inst[ctxt_pP->module_id].SRB1_config[ue_mod_idP]->logicalChannelConfig->present == SRB_ToAddMod__logicalChannelConfig_PR_explicitValue) { + SRB1_logicalChannelConfig = &eNB_rrc_inst[ctxt_pP->module_id].SRB1_config[ue_mod_idP]->logicalChannelConfig->choice.explicitValue; + } + else { + SRB1_logicalChannelConfig = &SRB1_logicalChannelConfig_defaultValue; + } + } + else { + SRB1_logicalChannelConfig = &SRB1_logicalChannelConfig_defaultValue; + } + */ + + LOG_D(RRC, + "[FRAME %05d][RRC_eNB][MOD %02d][][--- PDCP_DATA_REQ/%d Bytes (rrcConnectionReconfiguration_handover to UE %x MUI %d) --->][PDCP][MOD %02d][RB %02d]\n", + ctxt_pP->frame, ctxt_pP->module_id, size, ue_context_pP->ue_context.rnti, rrc_eNB_mui, ctxt_pP->module_id, DCCH); + //rrc_rlc_data_req(ctxt_pP->module_id,frameP, 1,(ue_mod_idP*NB_RB_MAX)+DCCH,rrc_eNB_mui++,0,size,(char*)buffer); + //pdcp_data_req (ctxt_pP->module_id, frameP, 1, (ue_mod_idP * NB_RB_MAX) + DCCH,rrc_eNB_mui++, 0, size, (char *) buffer, 1); + rrc_mac_config_req( + ctxt_pP->module_id, + ue_context_pP->ue_context.primaryCC_id, + ENB_FLAG_YES, + ue_context_pP->ue_context.rnti, + 0, + (RadioResourceConfigCommonSIB_t *) NULL, + ue_context_pP->ue_context.physicalConfigDedicated, +#ifdef Rel10 + (SCellToAddMod_r10_t *)NULL, + //(struct PhysicalConfigDedicatedSCell_r10 *)NULL, +#endif + (MeasObjectToAddMod_t **) NULL, + ue_context_pP->ue_context.mac_MainConfig, + 1, + SRB1_logicalChannelConfig, + ue_context_pP->ue_context.measGapConfig, + (TDD_Config_t *) NULL, + (MobilityControlInfo_t *) mobilityInfo, + (uint8_t *) NULL, (uint16_t *) NULL, NULL, NULL, NULL, (MBSFN_SubframeConfigList_t *) NULL +#ifdef Rel10 + , 0, (MBSFN_AreaInfoList_r9_t *) NULL, (PMCH_InfoList_r9_t *) NULL +#endif +#ifdef CBA + , 0, 0 +#endif + ); + + /* + handoverCommand.criticalExtensions.present = HandoverCommand__criticalExtensions_PR_c1; + handoverCommand.criticalExtensions.choice.c1.present = HandoverCommand__criticalExtensions__c1_PR_handoverCommand_r8; + handoverCommand.criticalExtensions.choice.c1.choice.handoverCommand_r8.handoverCommandMessage.buf = buffer; + handoverCommand.criticalExtensions.choice.c1.choice.handoverCommand_r8.handoverCommandMessage.size = size; + */ +//#warning "COMPILATION PROBLEM" +#ifdef PROBLEM_COMPILATION_RESOLVED + + if (sourceModId != 0xFF) { + memcpy(eNB_rrc_inst[sourceModId].handover_info[eNB_rrc_inst[ctxt_pP->module_id].handover_info[ue_mod_idP]->ueid_s]->buf, + (void *)buffer, size); + eNB_rrc_inst[sourceModId].handover_info[eNB_rrc_inst[ctxt_pP->module_id].handover_info[ue_mod_idP]->ueid_s]->size = size; + eNB_rrc_inst[sourceModId].handover_info[eNB_rrc_inst[ctxt_pP->module_id].handover_info[ue_mod_idP]->ueid_s]->ho_complete = + 0xF1; + //eNB_rrc_inst[ctxt_pP->module_id].handover_info[ue_mod_idP]->ho_complete = 0xFF; + LOG_D(RRC, "[eNB %d] Frame %d: setting handover complete to 0xF1 for (%d,%d) and to 0xFF for (%d,%d)\n", + ctxt_pP->module_id, + ctxt_pP->frame, + sourceModId, + eNB_rrc_inst[ctxt_pP->module_id].handover_info[ue_mod_idP]->ueid_s, + ctxt_pP->module_id, + ue_mod_idP); + } else + LOG_W(RRC, + "[eNB %d] Frame %d: rrc_eNB_generate_RRCConnectionReconfiguration_handover: Could not find source eNB mod_id.\n", + ctxt_pP->module_id, ctxt_pP->frame); + +#endif +} + +/* + void ue_rrc_process_rrcConnectionReconfiguration(uint8_t enb_mod_idP,frame_t frameP, + RRCConnectionReconfiguration_t *rrcConnectionReconfiguration, + uint8_t CH_index) { + + if (rrcConnectionReconfiguration->criticalExtensions.present == RRCConnectionReconfiguration__criticalExtensions_PR_c1) + if (rrcConnectionReconfiguration->criticalExtensions.choice.c1.present == RRCConnectionReconfiguration__criticalExtensions__c1_PR_rrcConnectionReconfiguration_r8) { + + if (rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.radioResourceConfigDedicated) { + rrc_ue_process_radioResourceConfigDedicated(enb_mod_idP,frameP,CH_index, + rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.radioResourceConfigDedicated); + + } + + // check other fields for + } + } +*/ + +//----------------------------------------------------------------------------- +void +rrc_eNB_process_RRCConnectionReconfigurationComplete( + const protocol_ctxt_t* const ctxt_pP, + rrc_eNB_ue_context_t* const ue_context_pP, + RRCConnectionReconfigurationComplete_r8_IEs_t* rrcConnectionReconfigurationComplete +) +//----------------------------------------------------------------------------- +{ + int i; +#ifdef PDCP_USE_NETLINK + int oip_ifup = 0; + int dest_ip_offset = 0; + module_id_t ue_module_id = -1; + /* avoid gcc warnings */ + (void)oip_ifup; + (void)dest_ip_offset; + (void)ue_module_id; +#endif + + uint8_t *kRRCenc = NULL; + uint8_t *kRRCint = NULL; + uint8_t *kUPenc = NULL; + + DRB_ToAddModList_t* DRB_configList = ue_context_pP->ue_context.DRB_configList; + //SRB_ToAddModList_t* SRB_configList = ue_context_pP->ue_context.SRB_configList; + + T(T_ENB_RRC_CONNECTION_RECONFIGURATION_COMPLETE, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), + T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); + +#if defined(ENABLE_SECURITY) + + /* Derive the keys from kenb */ + if (DRB_configList != NULL) { + derive_key_up_enc(ue_context_pP->ue_context.ciphering_algorithm, + ue_context_pP->ue_context.kenb, &kUPenc); + } + + derive_key_rrc_enc(ue_context_pP->ue_context.ciphering_algorithm, + ue_context_pP->ue_context.kenb, &kRRCenc); + derive_key_rrc_int(ue_context_pP->ue_context.integrity_algorithm, + ue_context_pP->ue_context.kenb, &kRRCint); + +#endif +#if ENABLE_RAL + { + MessageDef *message_ral_p = NULL; + rrc_ral_connection_reconfiguration_ind_t connection_reconfiguration_ind; + int i; + + message_ral_p = itti_alloc_new_message(TASK_RRC_ENB, RRC_RAL_CONNECTION_RECONFIGURATION_IND); + memset(&connection_reconfiguration_ind, 0, sizeof(rrc_ral_connection_reconfiguration_ind_t)); + connection_reconfiguration_ind.ue_id = ctxt_pP->rnti; + + if (DRB_configList != NULL) { + connection_reconfiguration_ind.num_drb = DRB_configList->list.count; + + for (i = 0; (i < DRB_configList->list.count) && (i < maxDRB); i++) { + connection_reconfiguration_ind.drb_id[i] = DRB_configList->list.array[i]->drb_Identity; + } + } else { + connection_reconfiguration_ind.num_drb = 0; + } + + if (SRB_configList != NULL) { + connection_reconfiguration_ind.num_srb = SRB_configList->list.count; + } else { + connection_reconfiguration_ind.num_srb = 0; + } + + memcpy(&message_ral_p->ittiMsg, (void *)&connection_reconfiguration_ind, + sizeof(rrc_ral_connection_reconfiguration_ind_t)); + LOG_I(RRC, "Sending RRC_RAL_CONNECTION_RECONFIGURATION_IND to RAL\n"); + itti_send_msg_to_task(TASK_RAL_ENB, ctxt_pP->instance, message_ral_p); + } +#endif + // Refresh SRBs/DRBs + MSC_LOG_TX_MESSAGE( + MSC_RRC_ENB, + MSC_PDCP_ENB, + NULL, + 0, + MSC_AS_TIME_FMT" CONFIG_REQ UE %x DRB (security unchanged)", + MSC_AS_TIME_ARGS(ctxt_pP), + ue_context_pP->ue_context.rnti); + + rrc_pdcp_config_asn1_req( + ctxt_pP, + NULL, //LG-RK 14/05/2014 SRB_configList, + DRB_configList, (DRB_ToReleaseList_t *) NULL, + /*eNB_rrc_inst[ctxt_pP->module_id].ciphering_algorithm[ue_mod_idP] | + (eNB_rrc_inst[ctxt_pP->module_id].integrity_algorithm[ue_mod_idP] << 4), + */ + 0xff, // already configured during the securitymodecommand + kRRCenc, + kRRCint, + kUPenc +#ifdef Rel10 + , (PMCH_InfoList_r9_t *) NULL +#endif + ); + // Refresh SRBs/DRBs + rrc_rlc_config_asn1_req( + ctxt_pP, + NULL, //LG-RK 14/05/2014 SRB_configList, + DRB_configList, + (DRB_ToReleaseList_t *) NULL +#ifdef Rel10 + , (PMCH_InfoList_r9_t *) NULL +#endif + ); + + // Loop through DRBs and establish if necessary + + if (DRB_configList != NULL) { + for (i = 0; i < DRB_configList->list.count; i++) { // num max DRB (11-3-8) + if (DRB_configList->list.array[i]) { + LOG_I(RRC, + "[eNB %d] Frame %d : Logical Channel UL-DCCH, Received RRCConnectionReconfigurationComplete from UE rnti %x, reconfiguring DRB %d/LCID %d\n", + ctxt_pP->module_id, + ctxt_pP->frame, + ctxt_pP->rnti, + (int)DRB_configList->list.array[i]->drb_Identity, + (int)*DRB_configList->list.array[i]->logicalChannelIdentity); + // for pre-ci tests + LOG_I(RRC, + "[eNB %d] Frame %d : Logical Channel UL-DCCH, Received RRCConnectionReconfigurationComplete from UE %u, reconfiguring DRB %d/LCID %d\n", + ctxt_pP->module_id, + ctxt_pP->frame, + oai_emulation.info.eNB_ue_local_uid_to_ue_module_id[ctxt_pP->module_id][ue_context_pP->local_uid], + (int)DRB_configList->list.array[i]->drb_Identity, + (int)*DRB_configList->list.array[i]->logicalChannelIdentity); + + if (ue_context_pP->ue_context.DRB_active[i] == 0) { + /* + rrc_pdcp_config_req (ctxt_pP->module_id, frameP, 1, CONFIG_ACTION_ADD, + (ue_mod_idP * NB_RB_MAX) + *DRB_configList->list.array[i]->logicalChannelIdentity,UNDEF_SECURITY_MODE); + rrc_rlc_config_req(ctxt_pP->module_id,frameP,1,CONFIG_ACTION_ADD, + (ue_mod_idP * NB_RB_MAX) + (int)*eNB_rrc_inst[ctxt_pP->module_id].DRB_config[ue_mod_idP][i]->logicalChannelIdentity, + RADIO_ACCESS_BEARER,Rlc_info_um); + */ + ue_context_pP->ue_context.DRB_active[i] = 1; + + LOG_D(RRC, + "[eNB %d] Frame %d: Establish RLC UM Bidirectional, DRB %d Active\n", + ctxt_pP->module_id, ctxt_pP->frame, (int)DRB_configList->list.array[i]->drb_Identity); +#if defined(PDCP_USE_NETLINK) && !defined(LINK_ENB_PDCP_TO_GTPV1U) + // can mean also IPV6 since ether -> ipv6 autoconf +# if !defined(OAI_NW_DRIVER_TYPE_ETHERNET) && !defined(EXMIMO) && !defined(OAI_USRP) && !defined(OAI_BLADERF) && !defined(ETHERNET) + LOG_I(OIP, "[eNB %d] trying to bring up the OAI interface oai%d\n", + ctxt_pP->module_id, + ctxt_pP->module_id); + oip_ifup = nas_config( + ctxt_pP->module_id, // interface index + ctxt_pP->module_id + 1, // thrid octet + ctxt_pP->module_id + 1); // fourth octet + + if (oip_ifup == 0) { // interface is up --> send a config the DRB +# ifdef OAI_EMU + oai_emulation.info.oai_ifup[ctxt_pP->module_id] = 1; + dest_ip_offset = NB_eNB_INST; +# else + dest_ip_offset = 8; +# endif + LOG_I(OIP, + "[eNB %d] Config the oai%d to send/receive pkt on DRB %d to/from the protocol stack\n", + ctxt_pP->module_id, ctxt_pP->module_id, + (ue_context_pP->local_uid * maxDRB) + DRB_configList->list.array[i]->drb_Identity); + ue_module_id = oai_emulation.info.eNB_ue_local_uid_to_ue_module_id[ctxt_pP->module_id][ue_context_pP->local_uid]; + rb_conf_ipv4(0, //add + ue_module_id, //cx + ctxt_pP->module_id, //inst + (ue_module_id * maxDRB) + DRB_configList->list.array[i]->drb_Identity, // RB + 0, //dscp + ipv4_address(ctxt_pP->module_id + 1, ctxt_pP->module_id + 1), //saddr + ipv4_address(ctxt_pP->module_id + 1, dest_ip_offset + ue_module_id + 1)); //daddr + LOG_D(RRC, "[eNB %d] State = Attached (UE rnti %x module id %u)\n", + ctxt_pP->module_id, ue_context_pP->ue_context.rnti, ue_module_id); + } + +# else +# ifdef OAI_EMU + oai_emulation.info.oai_ifup[ctxt_pP->module_id] = 1; +# endif +# endif +#endif + + LOG_D(RRC, + PROTOCOL_RRC_CTXT_UE_FMT" RRC_eNB --- MAC_CONFIG_REQ (DRB) ---> MAC_eNB\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP)); + + if (DRB_configList->list.array[i]->logicalChannelIdentity) { + DRB2LCHAN[i] = (uint8_t) * DRB_configList->list.array[i]->logicalChannelIdentity; + } + + rrc_mac_config_req( + ctxt_pP->module_id, + ue_context_pP->ue_context.primaryCC_id, + ENB_FLAG_YES, + ue_context_pP->ue_context.rnti, + 0, + (RadioResourceConfigCommonSIB_t *) NULL, + ue_context_pP->ue_context.physicalConfigDedicated, +#ifdef Rel10 + (SCellToAddMod_r10_t *)NULL, + //(struct PhysicalConfigDedicatedSCell_r10 *)NULL, +#endif + (MeasObjectToAddMod_t **) NULL, + ue_context_pP->ue_context.mac_MainConfig, + DRB2LCHAN[i], + DRB_configList->list.array[i]->logicalChannelConfig, + ue_context_pP->ue_context.measGapConfig, + (TDD_Config_t *) NULL, + NULL, + (uint8_t *) NULL, + (uint16_t *) NULL, NULL, NULL, NULL, (MBSFN_SubframeConfigList_t *) NULL +#ifdef Rel10 + , 0, (MBSFN_AreaInfoList_r9_t *) NULL, (PMCH_InfoList_r9_t *) NULL +#endif +#ifdef CBA + , eNB_rrc_inst[ctxt_pP->module_id].num_active_cba_groups, eNB_rrc_inst[ctxt_pP->module_id].cba_rnti[0] +#endif + ); + + } else { // remove LCHAN from MAC/PHY + + if (ue_context_pP->ue_context.DRB_active[i] == 1) { + // DRB has just been removed so remove RLC + PDCP for DRB + /* rrc_pdcp_config_req (ctxt_pP->module_id, frameP, 1, CONFIG_ACTION_REMOVE, + (ue_mod_idP * NB_RB_MAX) + DRB2LCHAN[i],UNDEF_SECURITY_MODE); + */ + rrc_rlc_config_req( + ctxt_pP, + SRB_FLAG_NO, + MBMS_FLAG_NO, + CONFIG_ACTION_REMOVE, + DRB2LCHAN[i], + Rlc_info_um); + } + + ue_context_pP->ue_context.DRB_active[i] = 0; + LOG_D(RRC, + PROTOCOL_RRC_CTXT_UE_FMT" RRC_eNB --- MAC_CONFIG_REQ (DRB) ---> MAC_eNB\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP)); + rrc_mac_config_req(ctxt_pP->module_id, + ue_context_pP->ue_context.primaryCC_id, + ENB_FLAG_YES, + ue_context_pP->ue_context.rnti, + 0, + (RadioResourceConfigCommonSIB_t *) NULL, + ue_context_pP->ue_context.physicalConfigDedicated, +#ifdef Rel10 + (SCellToAddMod_r10_t *)NULL, + //(struct PhysicalConfigDedicatedSCell_r10 *)NULL, +#endif + (MeasObjectToAddMod_t **) NULL, + ue_context_pP->ue_context.mac_MainConfig, + DRB2LCHAN[i], + (LogicalChannelConfig_t *) NULL, + (MeasGapConfig_t *) NULL, + (TDD_Config_t *) NULL, + NULL, (uint8_t *) NULL, (uint16_t *) NULL, NULL, NULL, NULL, NULL +#ifdef Rel10 + , 0, (MBSFN_AreaInfoList_r9_t *) NULL, (PMCH_InfoList_r9_t *) NULL +#endif +#ifdef CBA + , 0, 0 +#endif + ); + } + } + } + } +} + +//----------------------------------------------------------------------------- +void +rrc_eNB_generate_RRCConnectionSetup( + const protocol_ctxt_t* const ctxt_pP, + rrc_eNB_ue_context_t* const ue_context_pP, + const int CC_id +) +//----------------------------------------------------------------------------- +{ + + LogicalChannelConfig_t *SRB1_logicalChannelConfig; //,*SRB2_logicalChannelConfig; + SRB_ToAddModList_t **SRB_configList; + SRB_ToAddMod_t *SRB1_config; + int cnt; + + T(T_ENB_RRC_CONNECTION_SETUP, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), + T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); + + SRB_configList = &ue_context_pP->ue_context.SRB_configList; + eNB_rrc_inst[ctxt_pP->module_id].carrier[CC_id].Srb0.Tx_buffer.payload_size = + do_RRCConnectionSetup(ctxt_pP, + ue_context_pP, + (uint8_t*) eNB_rrc_inst[ctxt_pP->module_id].carrier[CC_id].Srb0.Tx_buffer.Payload, + (mac_xface->lte_frame_parms->nb_antennas_tx==2)?2:1, + rrc_eNB_get_next_transaction_identifier(ctxt_pP->module_id), + mac_xface->lte_frame_parms, + SRB_configList, + &ue_context_pP->ue_context.physicalConfigDedicated); + +#ifdef RRC_MSG_PRINT + LOG_F(RRC,"[MSG] RRC Connection Setup\n"); + + for (cnt = 0; cnt < eNB_rrc_inst[ctxt_pP->module_id].carrier[CC_id].Srb0.Tx_buffer.payload_size; cnt++) { + LOG_F(RRC,"%02x ", ((uint8_t*)eNB_rrc_inst[ctxt_pP->module_id].Srb0.Tx_buffer.Payload)[cnt]); + } + + LOG_F(RRC,"\n"); + ////////////////////////////////// +#endif + + // configure SRB1/SRB2, PhysicalConfigDedicated, MAC_MainConfig for UE + + if (*SRB_configList != NULL) { + for (cnt = 0; cnt < (*SRB_configList)->list.count; cnt++) { + if ((*SRB_configList)->list.array[cnt]->srb_Identity == 1) { + SRB1_config = (*SRB_configList)->list.array[cnt]; + + if (SRB1_config->logicalChannelConfig) { + if (SRB1_config->logicalChannelConfig->present == + SRB_ToAddMod__logicalChannelConfig_PR_explicitValue) { + SRB1_logicalChannelConfig = &SRB1_config->logicalChannelConfig->choice.explicitValue; + } else { + SRB1_logicalChannelConfig = &SRB1_logicalChannelConfig_defaultValue; + } + } else { + SRB1_logicalChannelConfig = &SRB1_logicalChannelConfig_defaultValue; + } + + LOG_D(RRC, + PROTOCOL_RRC_CTXT_UE_FMT" RRC_eNB --- MAC_CONFIG_REQ (SRB1) ---> MAC_eNB\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP)); + rrc_mac_config_req( + ctxt_pP->module_id, + ue_context_pP->ue_context.primaryCC_id, + ENB_FLAG_YES, + ue_context_pP->ue_context.rnti, + 0, + (RadioResourceConfigCommonSIB_t *) NULL, + ue_context_pP->ue_context.physicalConfigDedicated, +#ifdef Rel10 + (SCellToAddMod_r10_t *)NULL, + //(struct PhysicalConfigDedicatedSCell_r10 *)NULL, +#endif + (MeasObjectToAddMod_t **) NULL, + ue_context_pP->ue_context.mac_MainConfig, + 1, + SRB1_logicalChannelConfig, + ue_context_pP->ue_context.measGapConfig, + (TDD_Config_t *) NULL, + NULL, + (uint8_t *) NULL, + (uint16_t *) NULL, NULL, NULL, NULL, (MBSFN_SubframeConfigList_t *) NULL +#ifdef Rel10 + , 0, (MBSFN_AreaInfoList_r9_t *) NULL, (PMCH_InfoList_r9_t *) NULL +#endif +#ifdef CBA + , 0, 0 +#endif + ); + break; + } + } + } + + MSC_LOG_TX_MESSAGE( + MSC_RRC_ENB, + MSC_RRC_UE, + eNB_rrc_inst[ctxt_pP->module_id].carrier[CC_id].Srb0.Tx_buffer.Header, // LG WARNING + eNB_rrc_inst[ctxt_pP->module_id].carrier[CC_id].Srb0.Tx_buffer.payload_size, + MSC_AS_TIME_FMT" RRCConnectionSetup UE %x size %u", + MSC_AS_TIME_ARGS(ctxt_pP), + ue_context_pP->ue_context.rnti, + eNB_rrc_inst[ctxt_pP->module_id].carrier[CC_id].Srb0.Tx_buffer.payload_size); + + + LOG_I(RRC, + PROTOCOL_RRC_CTXT_UE_FMT" [RAPROC] Logical Channel DL-CCCH, Generating RRCConnectionSetup (bytes %d)\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), + eNB_rrc_inst[ctxt_pP->module_id].carrier[CC_id].Srb0.Tx_buffer.payload_size); + +} + +#if defined(ENABLE_ITTI) +char +//----------------------------------------------------------------------------- +openair_rrc_eNB_init( + const module_id_t enb_mod_idP +) +//----------------------------------------------------------------------------- +{ + /* Dummy function, initialization will be done through ITTI messaging */ + return 0; +} +#endif + +#if defined(ENABLE_ITTI) +//----------------------------------------------------------------------------- +char +openair_rrc_eNB_configuration( + const module_id_t enb_mod_idP, + RrcConfigurationReq* configuration +) +#else +char +openair_rrc_eNB_init( + const module_id_t enb_mod_idP +) +#endif +//----------------------------------------------------------------------------- +{ + protocol_ctxt_t ctxt; + int CC_id; + + PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, enb_mod_idP, ENB_FLAG_YES, NOT_A_RNTI, 0, 0,enb_mod_idP); + LOG_I(RRC, + PROTOCOL_RRC_CTXT_FMT" Init...\n", + PROTOCOL_RRC_CTXT_ARGS(&ctxt)); + + AssertFatal(eNB_rrc_inst != NULL, "eNB_rrc_inst not initialized!"); + AssertFatal(NUMBER_OF_UE_MAX < (module_id_t)0xFFFFFFFFFFFFFFFF, " variable overflow"); + + // for (j = 0; j < NUMBER_OF_UE_MAX; j++) + // eNB_rrc_inst[ctxt.module_id].Info.UE[j].Status = RRC_IDLE; //CH_READY; + // + //#if defined(ENABLE_USE_MME) + // // Connect eNB to MME + // if (EPC_MODE_ENABLED <= 0) + //#endif + // { + // /* Init security parameters */ + // for (j = 0; j < NUMBER_OF_UE_MAX; j++) { + // eNB_rrc_inst[ctxt.module_id].ciphering_algorithm[j] = SecurityAlgorithmConfig__cipheringAlgorithm_eea0; + // eNB_rrc_inst[ctxt.module_id].integrity_algorithm[j] = SecurityAlgorithmConfig__integrityProtAlgorithm_eia2; + // rrc_eNB_init_security(enb_mod_idP, j); + // } + // } + eNB_rrc_inst[ctxt.module_id].Nb_ue = 0; + + for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) { + eNB_rrc_inst[ctxt.module_id].carrier[CC_id].Srb0.Active = 0; + } + + uid_linear_allocator_init(&eNB_rrc_inst[ctxt.module_id].uid_allocator); + RB_INIT(&eNB_rrc_inst[ctxt.module_id].rrc_ue_head); + // for (j = 0; j < (NUMBER_OF_UE_MAX + 1); j++) { + // eNB_rrc_inst[enb_mod_idP].Srb2[j].Active = 0; + // } + + + eNB_rrc_inst[ctxt.module_id].initial_id2_s1ap_ids = hashtable_create (NUMBER_OF_UE_MAX * 2, NULL, NULL); + eNB_rrc_inst[ctxt.module_id].s1ap_id2_s1ap_ids = hashtable_create (NUMBER_OF_UE_MAX * 2, NULL, NULL); + + + /// System Information INIT + + LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" Checking release \n", + PROTOCOL_RRC_CTXT_ARGS(&ctxt)); +#ifdef Rel10 + + // This has to come from some top-level configuration + // only CC_id 0 is logged + LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" Rel10 RRC detected, MBMS flag %d\n", + PROTOCOL_RRC_CTXT_ARGS(&ctxt), + eNB_rrc_inst[ctxt.module_id].carrier[0].MBMS_flag); + +#else + LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" Rel8 RRC\n", PROTOCOL_RRC_CTXT_ARGS(&ctxt)); +#endif +#ifdef CBA + + for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) { + for (j = 0; j < NUM_MAX_CBA_GROUP; j++) { + eNB_rrc_inst[ctxt.module_id].carrier[CC_id].cba_rnti[j] = CBA_OFFSET + j; + } + + if (eNB_rrc_inst[ctxt.module_id].carrier[CC_id].num_active_cba_groups > NUM_MAX_CBA_GROUP) { + eNB_rrc_inst[ctxt.module_id].carrier[CC_id].num_active_cba_groups = NUM_MAX_CBA_GROUP; + } + + LOG_D(RRC, + PROTOCOL_RRC_CTXT_FMT" Initialization of 4 cba_RNTI values (%x %x %x %x) num active groups %d\n", + PROTOCOL_RRC_CTXT_ARGS(&ctxt), + enb_mod_idP, eNB_rrc_inst[ctxt.module_id].carrier[CC_id].cba_rnti[0], + eNB_rrc_inst[ctxt.module_id].carrier[CC_id].cba_rnti[1], + eNB_rrc_inst[ctxt.module_id].carrier[CC_id].cba_rnti[2], + eNB_rrc_inst[ctxt.module_id].carrier[CC_id].cba_rnti[3], + eNB_rrc_inst[ctxt.module_id].carrier[CC_id].num_active_cba_groups); + } + +#endif + + for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) { + init_SI(&ctxt, + CC_id +#if defined(ENABLE_ITTI) + , configuration +#endif + ); + } + +#ifdef Rel10 + + for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) { + switch (eNB_rrc_inst[ctxt.module_id].carrier[CC_id].MBMS_flag) { + case 1: + case 2: + case 3: + LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" Configuring 1 MBSFN sync area\n", PROTOCOL_RRC_CTXT_ARGS(&ctxt)); + eNB_rrc_inst[ctxt.module_id].carrier[CC_id].num_mbsfn_sync_area = 1; + break; + + case 4: + LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" Configuring 2 MBSFN sync area\n", PROTOCOL_RRC_CTXT_ARGS(&ctxt)); + eNB_rrc_inst[ctxt.module_id].carrier[CC_id].num_mbsfn_sync_area = 2; + break; + + default: + eNB_rrc_inst[ctxt.module_id].carrier[CC_id].num_mbsfn_sync_area = 0; + break; + } + + // if we are here the eNB_rrc_inst[enb_mod_idP].MBMS_flag > 0, + /// MCCH INIT + if (eNB_rrc_inst[ctxt.module_id].carrier[CC_id].MBMS_flag > 0) { + init_MCCH(ctxt.module_id, CC_id); + /// MTCH data bearer init + init_MBMS(ctxt.module_id, CC_id, 0); + } + } + +#endif + +#ifdef NO_RRM //init ch SRB0, SRB1 & BDTCH + openair_rrc_on(&ctxt); +#else + eNB_rrc_inst[ctxt.module_id].Last_scan_req = 0; + send_msg(&S_rrc, msg_rrc_phy_synch_to_MR_ind(ctxt.module_id, eNB_rrc_inst[ctxt.module_id].Mac_id)); +#endif + + return 0; + +} + +/*------------------------------------------------------------------------------*/ +int +rrc_eNB_decode_ccch( + protocol_ctxt_t* const ctxt_pP, + const SRB_INFO* const Srb_info, + const int CC_id +) +//----------------------------------------------------------------------------- +{ + module_id_t Idx; + asn_dec_rval_t dec_rval; + UL_CCCH_Message_t *ul_ccch_msg = NULL; + RRCConnectionRequest_r8_IEs_t* rrcConnectionRequest = NULL; + RRCConnectionReestablishmentRequest_r8_IEs_t* rrcConnectionReestablishmentRequest = NULL; + int i, rval; + struct rrc_eNB_ue_context_s* ue_context_p = NULL; + uint64_t random_value = 0; + int stmsi_received = 0; + + T(T_ENB_RRC_UL_CCCH_DATA_IN, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), + T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); + + //memset(ul_ccch_msg,0,sizeof(UL_CCCH_Message_t)); + + LOG_D(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Decoding UL CCCH %x.%x.%x.%x.%x.%x (%p)\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), + ((uint8_t*) Srb_info->Rx_buffer.Payload)[0], + ((uint8_t *) Srb_info->Rx_buffer.Payload)[1], + ((uint8_t *) Srb_info->Rx_buffer.Payload)[2], + ((uint8_t *) Srb_info->Rx_buffer.Payload)[3], + ((uint8_t *) Srb_info->Rx_buffer.Payload)[4], + ((uint8_t *) Srb_info->Rx_buffer.Payload)[5], (uint8_t *) Srb_info->Rx_buffer.Payload); + dec_rval = uper_decode( + NULL, + &asn_DEF_UL_CCCH_Message, + (void**)&ul_ccch_msg, + (uint8_t*) Srb_info->Rx_buffer.Payload, + 100, + 0, + 0); + +#if defined(ENABLE_ITTI) +# if defined(DISABLE_ITTI_XER_PRINT) + { + MessageDef *message_p; + + message_p = itti_alloc_new_message(TASK_RRC_ENB, RRC_UL_CCCH_MESSAGE); + memcpy(&message_p->ittiMsg, (void *)ul_ccch_msg, sizeof(RrcUlCcchMessage)); + + itti_send_msg_to_task(TASK_UNKNOWN, ctxt_pP->instance, message_p); + } +# else + { + char message_string[10000]; + size_t message_string_size; + + if ((message_string_size = + xer_sprint(message_string, sizeof(message_string), &asn_DEF_UL_CCCH_Message, (void *)ul_ccch_msg)) > 0) { + MessageDef *msg_p; + + msg_p = itti_alloc_new_message_sized(TASK_RRC_ENB, RRC_UL_CCCH, message_string_size + sizeof(IttiMsgText)); + msg_p->ittiMsg.rrc_ul_ccch.size = message_string_size; + memcpy(&msg_p->ittiMsg.rrc_ul_ccch.text, message_string, message_string_size); + + itti_send_msg_to_task(TASK_UNKNOWN, ctxt_pP->instance, msg_p); + } + } +# endif +#endif + + for (i = 0; i < 8; i++) { + LOG_T(RRC, "%x.", ((uint8_t *) & ul_ccch_msg)[i]); + } + + if (dec_rval.consumed == 0) { + LOG_E(RRC, + PROTOCOL_RRC_CTXT_UE_FMT" FATAL Error in receiving CCCH\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP)); + return -1; + } + + if (ul_ccch_msg->message.present == UL_CCCH_MessageType_PR_c1) { + + switch (ul_ccch_msg->message.choice.c1.present) { + + case UL_CCCH_MessageType__c1_PR_NOTHING: + LOG_I(RRC, + PROTOCOL_RRC_CTXT_FMT" Received PR_NOTHING on UL-CCCH-Message\n", + PROTOCOL_RRC_CTXT_ARGS(ctxt_pP)); + break; + + case UL_CCCH_MessageType__c1_PR_rrcConnectionReestablishmentRequest: + T(T_ENB_RRC_CONNECTION_REESTABLISHMENT_REQUEST, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), + T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); + +#ifdef RRC_MSG_PRINT + LOG_F(RRC,"[MSG] RRC Connection Reestablishement Request\n"); + + for (i = 0; i < Srb_info->Rx_buffer.payload_size; i++) { + LOG_F(RRC,"%02x ", ((uint8_t*)Srb_info->Rx_buffer.Payload)[i]); + } + + LOG_F(RRC,"\n"); +#endif + LOG_D(RRC, + PROTOCOL_RRC_CTXT_UE_FMT"MAC_eNB--- MAC_DATA_IND (rrcConnectionReestablishmentRequest on SRB0) --> RRC_eNB\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP)); + rrcConnectionReestablishmentRequest = + &ul_ccch_msg->message.choice.c1.choice.rrcConnectionReestablishmentRequest.criticalExtensions.choice.rrcConnectionReestablishmentRequest_r8; + LOG_I(RRC, + PROTOCOL_RRC_CTXT_UE_FMT" RRCConnectionReestablishmentRequest cause %s\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), + ((rrcConnectionReestablishmentRequest->reestablishmentCause == ReestablishmentCause_otherFailure) ? "Other Failure" : + (rrcConnectionReestablishmentRequest->reestablishmentCause == ReestablishmentCause_handoverFailure) ? "Handover Failure" : + "reconfigurationFailure")); + /*{ + uint64_t c_rnti = 0; + + memcpy(((uint8_t *) & c_rnti) + 3, rrcConnectionReestablishmentRequest.UE_identity.c_RNTI.buf, + rrcConnectionReestablishmentRequest.UE_identity.c_RNTI.size); + ue_mod_id = rrc_eNB_get_UE_index(enb_mod_idP, c_rnti); + } + + if ((eNB_rrc_inst[enb_mod_idP].phyCellId == rrcConnectionReestablishmentRequest.UE_identity.physCellId) && + (ue_mod_id != UE_INDEX_INVALID)){ + rrc_eNB_generate_RRCConnectionReestablishment(enb_mod_idP, frameP, ue_mod_id); + }else { + rrc_eNB_generate_RRCConnectionReestablishmentReject(enb_mod_idP, frameP, ue_mod_id); + } + */ + /* reject all reestablishment attempts for the moment */ + rrc_eNB_generate_RRCConnectionReestablishmentReject(ctxt_pP, + rrc_eNB_get_ue_context(&eNB_rrc_inst[ctxt_pP->module_id], ctxt_pP->rnti), + CC_id); + break; + + case UL_CCCH_MessageType__c1_PR_rrcConnectionRequest: + T(T_ENB_RRC_CONNECTION_REQUEST, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), + T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); + +#ifdef RRC_MSG_PRINT + LOG_F(RRC,"[MSG] RRC Connection Request\n"); + + for (i = 0; i < Srb_info->Rx_buffer.payload_size; i++) { + LOG_F(RRC,"%02x ", ((uint8_t*)Srb_info->Rx_buffer.Payload)[i]); + } + + LOG_F(RRC,"\n"); +#endif + LOG_D(RRC, + PROTOCOL_RRC_CTXT_UE_FMT"MAC_eNB --- MAC_DATA_IND (rrcConnectionRequest on SRB0) --> RRC_eNB\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP)); + ue_context_p = rrc_eNB_get_ue_context( + &eNB_rrc_inst[ctxt_pP->module_id], + ctxt_pP->rnti); + + if (ue_context_p != NULL) { + // erase content + rrc_eNB_free_mem_UE_context(ctxt_pP, ue_context_p); + + MSC_LOG_RX_DISCARDED_MESSAGE( + MSC_RRC_ENB, + MSC_RRC_UE, + Srb_info->Rx_buffer.Payload, + dec_rval.consumed, + MSC_AS_TIME_FMT" RRCConnectionRequest UE %x size %u (UE already in context)", + MSC_AS_TIME_ARGS(ctxt_pP), + ue_context_p->ue_context.rnti, + dec_rval.consumed); + } else { + rrcConnectionRequest = &ul_ccch_msg->message.choice.c1.choice.rrcConnectionRequest.criticalExtensions.choice.rrcConnectionRequest_r8; + { + if (InitialUE_Identity_PR_randomValue == rrcConnectionRequest->ue_Identity.present) { + AssertFatal(rrcConnectionRequest->ue_Identity.choice.randomValue.size == 5, + "wrong InitialUE-Identity randomValue size, expected 5, provided %d", + rrcConnectionRequest->ue_Identity.choice.randomValue.size); + memcpy(((uint8_t*) & random_value) + 3, + rrcConnectionRequest->ue_Identity.choice.randomValue.buf, + rrcConnectionRequest->ue_Identity.choice.randomValue.size); + /* if there is already a registered UE (with another RNTI) with this random_value, + * the current one must be removed from MAC/PHY (zombie UE) + */ + if ((ue_context_p = rrc_eNB_ue_context_random_exist(ctxt_pP, random_value))) { +//#warning "TODO: random_exist: remove UE from MAC/PHY (how?)" + // AssertFatal(0 == 1, "TODO: remove UE from MAC/PHY (how?)"); + ue_context_p = NULL; + } else { + ue_context_p = rrc_eNB_get_next_free_ue_context(ctxt_pP, random_value); + } + } else if (InitialUE_Identity_PR_s_TMSI == rrcConnectionRequest->ue_Identity.present) { + /* Save s-TMSI */ + S_TMSI_t s_TMSI = rrcConnectionRequest->ue_Identity.choice.s_TMSI; + mme_code_t mme_code = BIT_STRING_to_uint8(&s_TMSI.mmec); + m_tmsi_t m_tmsi = BIT_STRING_to_uint32(&s_TMSI.m_TMSI); + random_value = (((uint64_t)mme_code) << 32) | m_tmsi; + if ((ue_context_p = rrc_eNB_ue_context_stmsi_exist(ctxt_pP, mme_code, m_tmsi))) { + + //#warning "TODO: stmsi_exist: remove UE from MAC/PHY (how?)" + LOG_I(RRC," S-TMSI exists, ue_context_p %p\n",ue_context_p); + stmsi_received=1; + ue_context_p->ue_context.rnti = ctxt_pP->rnti; + // AssertFatal(0 == 1, "TODO: remove UE from MAC/PHY (how?)"); + // ue_context_p = NULL; + } else { + ue_context_p = rrc_eNB_get_next_free_ue_context(ctxt_pP, NOT_A_RANDOM_UE_IDENTITY); + ue_context_p->ue_context.Initialue_identity_s_TMSI.presence = TRUE; + ue_context_p->ue_context.Initialue_identity_s_TMSI.mme_code = mme_code; + ue_context_p->ue_context.Initialue_identity_s_TMSI.m_tmsi = m_tmsi; + } + + MSC_LOG_RX_MESSAGE( + MSC_RRC_ENB, + MSC_RRC_UE, + Srb_info->Rx_buffer.Payload, + dec_rval.consumed, + MSC_AS_TIME_FMT" RRCConnectionRequest UE %x size %u (s-TMSI mmec %u m_TMSI %u random UE id (0x%" PRIx64 ")", + MSC_AS_TIME_ARGS(ctxt_pP), + ue_context_p->ue_context.rnti, + dec_rval.consumed, + ue_context_p->ue_context.Initialue_identity_s_TMSI.mme_code, + ue_context_p->ue_context.Initialue_identity_s_TMSI.m_tmsi, + ue_context_p->ue_context.random_ue_identity); + } else { + LOG_E(RRC, + PROTOCOL_RRC_CTXT_UE_FMT" RRCConnectionRequest without random UE identity or S-TMSI not supported, let's reject the UE\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP)); + rrc_eNB_generate_RRCConnectionReject(ctxt_pP, + rrc_eNB_get_ue_context(&eNB_rrc_inst[ctxt_pP->module_id], ctxt_pP->rnti), + CC_id); + break; + } + + } + LOG_D(RRC, + PROTOCOL_RRC_CTXT_UE_FMT" UE context: %X\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), + ue_context_p); + + if (ue_context_p != NULL) { + + +#if defined(ENABLE_ITTI) + ue_context_p->ue_context.establishment_cause = rrcConnectionRequest->establishmentCause; + if (stmsi_received==0) + LOG_I(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Accept new connection from UE random UE identity (0x%" PRIx64 ") MME code %u TMSI %u cause %u\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), + ue_context_p->ue_context.random_ue_identity, + ue_context_p->ue_context.Initialue_identity_s_TMSI.mme_code, + ue_context_p->ue_context.Initialue_identity_s_TMSI.m_tmsi, + ue_context_p->ue_context.establishment_cause); + else + LOG_I(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Accept new connection from UE MME code %u TMSI %u cause %u\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), + ue_context_p->ue_context.Initialue_identity_s_TMSI.mme_code, + ue_context_p->ue_context.Initialue_identity_s_TMSI.m_tmsi, + ue_context_p->ue_context.establishment_cause); +#else + LOG_I(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Accept new connection for UE random UE identity (0x%" PRIx64 ")\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), + ue_context_p->ue_context.random_ue_identity); +#endif + if (stmsi_received == 0) + eNB_rrc_inst[ctxt_pP->module_id].Nb_ue++; + + } else { + // no context available + LOG_I(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Can't create new context for UE random UE identity (0x%" PRIx64 ")\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), + random_value); + return -1; + } + } + +#ifndef NO_RRM + send_msg(&S_rrc, msg_rrc_MR_attach_ind(ctxt_pP->module_id, Mac_id)); +#else + + ue_context_p->ue_context.primaryCC_id = CC_id; + + //LG COMMENT Idx = (ue_mod_idP * NB_RB_MAX) + DCCH; + Idx = DCCH; + // SRB1 + ue_context_p->ue_context.Srb1.Active = 1; + ue_context_p->ue_context.Srb1.Srb_info.Srb_id = Idx; + memcpy(&ue_context_p->ue_context.Srb1.Srb_info.Lchan_desc[0], + &DCCH_LCHAN_DESC, + LCHAN_DESC_SIZE); + memcpy(&ue_context_p->ue_context.Srb1.Srb_info.Lchan_desc[1], + &DCCH_LCHAN_DESC, + LCHAN_DESC_SIZE); + + // SRB2 + ue_context_p->ue_context.Srb2.Active = 1; + ue_context_p->ue_context.Srb2.Srb_info.Srb_id = Idx; + memcpy(&ue_context_p->ue_context.Srb2.Srb_info.Lchan_desc[0], + &DCCH_LCHAN_DESC, + LCHAN_DESC_SIZE); + memcpy(&ue_context_p->ue_context.Srb2.Srb_info.Lchan_desc[1], + &DCCH_LCHAN_DESC, + LCHAN_DESC_SIZE); + + rrc_eNB_generate_RRCConnectionSetup(ctxt_pP, ue_context_p, CC_id); + LOG_I(RRC, PROTOCOL_RRC_CTXT_UE_FMT"CALLING RLC CONFIG SRB1 (rbid %d)\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), + Idx); + + MSC_LOG_TX_MESSAGE( + MSC_RRC_ENB, + MSC_PDCP_ENB, + NULL, + 0, + MSC_AS_TIME_FMT" CONFIG_REQ UE %x SRB", + MSC_AS_TIME_ARGS(ctxt_pP), + ue_context_p->ue_context.rnti); + + rrc_pdcp_config_asn1_req(ctxt_pP, + ue_context_p->ue_context.SRB_configList, + (DRB_ToAddModList_t *) NULL, + (DRB_ToReleaseList_t*) NULL, + 0xff, + NULL, + NULL, + NULL +# ifdef Rel10 + , (PMCH_InfoList_r9_t *) NULL +# endif + ); + + rrc_rlc_config_asn1_req(ctxt_pP, + ue_context_p->ue_context.SRB_configList, + (DRB_ToAddModList_t*) NULL, + (DRB_ToReleaseList_t*) NULL +# ifdef Rel10 + , (PMCH_InfoList_r9_t *) NULL +# endif + ); +#endif //NO_RRM + + break; + + default: + LOG_E(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Unknown message\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP)); + rval = -1; + break; + } + + rval = 0; + } else { + LOG_E(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Unknown error \n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP)); + rval = -1; + } + + return rval; +} + +//----------------------------------------------------------------------------- +int +rrc_eNB_decode_dcch( + const protocol_ctxt_t* const ctxt_pP, + const rb_id_t Srb_id, + const uint8_t* const Rx_sdu, + const sdu_size_t sdu_sizeP +) +//----------------------------------------------------------------------------- +{ + + asn_dec_rval_t dec_rval; + //UL_DCCH_Message_t uldcchmsg; + UL_DCCH_Message_t *ul_dcch_msg = NULL; //&uldcchmsg; + UE_EUTRA_Capability_t *UE_EUTRA_Capability = NULL; + int i; + struct rrc_eNB_ue_context_s* ue_context_p = NULL; + + T(T_ENB_RRC_UL_DCCH_DATA_IN, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), + T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); + + if ((Srb_id != 1) && (Srb_id != 2)) { + LOG_E(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Received message on SRB%d, should not have ...\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), + Srb_id); + } + + //memset(ul_dcch_msg,0,sizeof(UL_DCCH_Message_t)); + + LOG_D(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Decoding UL-DCCH Message\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP)); + dec_rval = uper_decode( + NULL, + &asn_DEF_UL_DCCH_Message, + (void**)&ul_dcch_msg, + Rx_sdu, + sdu_sizeP, + 0, + 0); + +#if defined(ENABLE_ITTI) +# if defined(DISABLE_ITTI_XER_PRINT) + { + MessageDef *message_p; + + message_p = itti_alloc_new_message(TASK_RRC_ENB, RRC_UL_DCCH_MESSAGE); + memcpy(&message_p->ittiMsg, (void *)ul_dcch_msg, sizeof(RrcUlDcchMessage)); + + itti_send_msg_to_task(TASK_UNKNOWN, ctxt_pP->instance, message_p); + } +# else + { + char message_string[10000]; + size_t message_string_size; + + if ((message_string_size = + xer_sprint(message_string, sizeof(message_string), &asn_DEF_UL_DCCH_Message, (void *)ul_dcch_msg)) >= 0) { + MessageDef *msg_p; + + msg_p = itti_alloc_new_message_sized(TASK_RRC_ENB, RRC_UL_DCCH, message_string_size + sizeof(IttiMsgText)); + msg_p->ittiMsg.rrc_ul_dcch.size = message_string_size; + memcpy(&msg_p->ittiMsg.rrc_ul_dcch.text, message_string, message_string_size); + + itti_send_msg_to_task(TASK_UNKNOWN, ctxt_pP->instance, msg_p); + } + } +# endif +#endif + + { + for (i = 0; i < sdu_sizeP; i++) { + LOG_T(RRC, "%x.", Rx_sdu[i]); + } + + LOG_T(RRC, "\n"); + } + + if ((dec_rval.code != RC_OK) && (dec_rval.consumed == 0)) { + LOG_E(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Failed to decode UL-DCCH (%d bytes)\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), + dec_rval.consumed); + return -1; + } + + ue_context_p = rrc_eNB_get_ue_context( + &eNB_rrc_inst[ctxt_pP->module_id], + ctxt_pP->rnti); + + if (ul_dcch_msg->message.present == UL_DCCH_MessageType_PR_c1) { + + switch (ul_dcch_msg->message.choice.c1.present) { + case UL_DCCH_MessageType__c1_PR_NOTHING: /* No components present */ + break; + + case UL_DCCH_MessageType__c1_PR_csfbParametersRequestCDMA2000: + break; + + case UL_DCCH_MessageType__c1_PR_measurementReport: + LOG_D(RRC, + PROTOCOL_RRC_CTXT_UE_FMT" RLC RB %02d --- RLC_DATA_IND " + "%d bytes (measurementReport) ---> RRC_eNB\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), + DCCH, + sdu_sizeP); + rrc_eNB_process_MeasurementReport( + ctxt_pP, + ue_context_p, + &ul_dcch_msg->message.choice.c1.choice.measurementReport. + criticalExtensions.choice.c1.choice.measurementReport_r8.measResults); + break; + + case UL_DCCH_MessageType__c1_PR_rrcConnectionReconfigurationComplete: +#ifdef RRC_MSG_PRINT + LOG_F(RRC,"[MSG] RRC Connection Reconfiguration Complete\n"); + + for (i = 0; i < sdu_sizeP; i++) { + LOG_F(RRC,"%02x ", ((uint8_t*)Rx_sdu)[i]); + } + + LOG_F(RRC,"\n"); +#endif + MSC_LOG_RX_MESSAGE( + MSC_RRC_ENB, + MSC_RRC_UE, + Rx_sdu, + sdu_sizeP, + MSC_AS_TIME_FMT" RRCConnectionReconfigurationComplete UE %x size %u", + MSC_AS_TIME_ARGS(ctxt_pP), + ue_context_p->ue_context.rnti, + sdu_sizeP); + + LOG_D(RRC, + PROTOCOL_RRC_CTXT_UE_FMT" RLC RB %02d --- RLC_DATA_IND %d bytes " + "(RRCConnectionReconfigurationComplete) ---> RRC_eNB]\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), + DCCH, + sdu_sizeP); + + if (ul_dcch_msg->message.choice.c1.choice.rrcConnectionReconfigurationComplete.criticalExtensions. + present == + RRCConnectionReconfigurationComplete__criticalExtensions_PR_rrcConnectionReconfigurationComplete_r8) { + rrc_eNB_process_RRCConnectionReconfigurationComplete( + ctxt_pP, + ue_context_p, + &ul_dcch_msg->message.choice.c1.choice. + rrcConnectionReconfigurationComplete. + criticalExtensions.choice. + rrcConnectionReconfigurationComplete_r8); + ue_context_p->ue_context.Status = RRC_RECONFIGURED; + LOG_I(RRC, + PROTOCOL_RRC_CTXT_UE_FMT" UE State = RRC_RECONFIGURED \n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP)); + //WARNING:Inform the controller about the UE activation. Should be moved to RRC agent in the future + if (mac_agent_registered[ctxt_pP->module_id]) { + agent_mac_xface[ctxt_pP->eNB_index]->enb_agent_notify_ue_state_change(ctxt_pP->module_id, + ue_context_p->ue_id_rnti, + PROTOCOL__PRP_UE_STATE_CHANGE_TYPE__PRUESC_UPDATED); + } + } + +#if defined(ENABLE_USE_MME) +# if defined(ENABLE_ITTI) + + if (EPC_MODE_ENABLED == 1) { + rrc_eNB_send_S1AP_INITIAL_CONTEXT_SETUP_RESP( + ctxt_pP, + ue_context_p); + } + +# endif +#endif + break; + + case UL_DCCH_MessageType__c1_PR_rrcConnectionReestablishmentComplete: + T(T_ENB_RRC_CONNECTION_REESTABLISHMENT_COMPLETE, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), + T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); + +#ifdef RRC_MSG_PRINT + LOG_F(RRC,"[MSG] RRC Connection Reestablishment Complete\n"); + + for (i = 0; i < sdu_sizeP; i++) { + LOG_F(RRC,"%02x ", ((uint8_t*)Rx_sdu)[i]); + } + + LOG_F(RRC,"\n"); +#endif + + MSC_LOG_RX_MESSAGE( + MSC_RRC_ENB, + MSC_RRC_UE, + Rx_sdu, + sdu_sizeP, + MSC_AS_TIME_FMT" rrcConnectionReestablishmentComplete UE %x size %u", + MSC_AS_TIME_ARGS(ctxt_pP), + ue_context_p->ue_context.rnti, + sdu_sizeP); + + LOG_I(RRC, + PROTOCOL_RRC_CTXT_UE_FMT" RLC RB %02d --- RLC_DATA_IND %d bytes " + "(rrcConnectionReestablishmentComplete) ---> RRC_eNB\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), + DCCH, + sdu_sizeP); + break; + + case UL_DCCH_MessageType__c1_PR_rrcConnectionSetupComplete: +#ifdef RRC_MSG_PRINT + LOG_F(RRC,"[MSG] RRC Connection SetupComplete\n"); + + for (i = 0; i < sdu_sizeP; i++) { + LOG_F(RRC,"%02x ", ((uint8_t*)Rx_sdu)[i]); + } + + LOG_F(RRC,"\n"); +#endif + + MSC_LOG_RX_MESSAGE( + MSC_RRC_ENB, + MSC_RRC_UE, + Rx_sdu, + sdu_sizeP, + MSC_AS_TIME_FMT" RRCConnectionSetupComplete UE %x size %u", + MSC_AS_TIME_ARGS(ctxt_pP), + ue_context_p->ue_context.rnti, + sdu_sizeP); + + LOG_D(RRC, + PROTOCOL_RRC_CTXT_UE_FMT" RLC RB %02d --- RLC_DATA_IND %d bytes " + "(RRCConnectionSetupComplete) ---> RRC_eNB\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), + DCCH, + sdu_sizeP); + + if (ul_dcch_msg->message.choice.c1.choice.rrcConnectionSetupComplete.criticalExtensions.present == + RRCConnectionSetupComplete__criticalExtensions_PR_c1) { + if (ul_dcch_msg->message.choice.c1.choice.rrcConnectionSetupComplete.criticalExtensions.choice.c1. + present == + RRCConnectionSetupComplete__criticalExtensions__c1_PR_rrcConnectionSetupComplete_r8) { + rrc_eNB_process_RRCConnectionSetupComplete( + ctxt_pP, + ue_context_p, + &ul_dcch_msg->message.choice.c1.choice.rrcConnectionSetupComplete.criticalExtensions.choice.c1.choice.rrcConnectionSetupComplete_r8); + ue_context_p->ue_context.Status = RRC_CONNECTED; + LOG_I(RRC, PROTOCOL_RRC_CTXT_UE_FMT" UE State = RRC_CONNECTED \n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP)); + //WARNING:Inform the controller about the UE activation. Should be moved to RRC agent in the future + if (mac_agent_registered[ctxt_pP->module_id]) { + agent_mac_xface[ctxt_pP->eNB_index]->enb_agent_notify_ue_state_change(ctxt_pP->module_id, + ue_context_p->ue_id_rnti, + PROTOCOL__PRP_UE_STATE_CHANGE_TYPE__PRUESC_ACTIVATED); + } + } + } + + break; + + case UL_DCCH_MessageType__c1_PR_securityModeComplete: + T(T_ENB_RRC_SECURITY_MODE_COMPLETE, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), + T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); + +#ifdef RRC_MSG_PRINT + LOG_F(RRC,"[MSG] RRC Security Mode Complete\n"); + + for (i = 0; i < sdu_sizeP; i++) { + LOG_F(RRC,"%02x ", ((uint8_t*)Rx_sdu)[i]); + } + + LOG_F(RRC,"\n"); +#endif + + MSC_LOG_RX_MESSAGE( + MSC_RRC_ENB, + MSC_RRC_UE, + Rx_sdu, + sdu_sizeP, + MSC_AS_TIME_FMT" securityModeComplete UE %x size %u", + MSC_AS_TIME_ARGS(ctxt_pP), + ue_context_p->ue_context.rnti, + sdu_sizeP); + + LOG_I(RRC, + PROTOCOL_RRC_CTXT_UE_FMT" received securityModeComplete on UL-DCCH %d from UE\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), + DCCH); + LOG_D(RRC, + PROTOCOL_RRC_CTXT_UE_FMT" RLC RB %02d --- RLC_DATA_IND %d bytes " + "(securityModeComplete) ---> RRC_eNB\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), + DCCH, + sdu_sizeP); +#ifdef XER_PRINT + xer_fprint(stdout, &asn_DEF_UL_DCCH_Message, (void *)ul_dcch_msg); +#endif + // confirm with PDCP about the security mode for DCCH + //rrc_pdcp_config_req (enb_mod_idP, frameP, 1,CONFIG_ACTION_SET_SECURITY_MODE, (ue_mod_idP * NB_RB_MAX) + DCCH, 0x77); + // continue the procedure + rrc_eNB_generate_UECapabilityEnquiry( + ctxt_pP, + ue_context_p); + break; + + case UL_DCCH_MessageType__c1_PR_securityModeFailure: + T(T_ENB_RRC_SECURITY_MODE_FAILURE, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), + T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); + +#ifdef RRC_MSG_PRINT + LOG_F(RRC,"[MSG] RRC Security Mode Failure\n"); + + for (i = 0; i < sdu_sizeP; i++) { + LOG_F(RRC,"%02x ", ((uint8_t*)Rx_sdu)[i]); + } + + LOG_F(RRC,"\n"); +#endif + + MSC_LOG_RX_MESSAGE( + MSC_RRC_ENB, + MSC_RRC_UE, + Rx_sdu, + sdu_sizeP, + MSC_AS_TIME_FMT" securityModeFailure UE %x size %u", + MSC_AS_TIME_ARGS(ctxt_pP), + ue_context_p->ue_context.rnti, + sdu_sizeP); + + LOG_W(RRC, + PROTOCOL_RRC_CTXT_UE_FMT" RLC RB %02d --- RLC_DATA_IND %d bytes " + "(securityModeFailure) ---> RRC_eNB\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), + DCCH, + sdu_sizeP); +#ifdef XER_PRINT + xer_fprint(stdout, &asn_DEF_UL_DCCH_Message, (void *)ul_dcch_msg); +#endif + // cancel the security mode in PDCP + + // followup with the remaining procedure +//#warning "LG Removed rrc_eNB_generate_UECapabilityEnquiry after receiving securityModeFailure" + rrc_eNB_generate_UECapabilityEnquiry(ctxt_pP, ue_context_p); + break; + + case UL_DCCH_MessageType__c1_PR_ueCapabilityInformation: + T(T_ENB_RRC_UE_CAPABILITY_INFORMATION, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), + T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); + +#ifdef RRC_MSG_PRINT + LOG_F(RRC,"[MSG] RRC UECapablility Information \n"); + + for (i = 0; i < sdu_sizeP; i++) { + LOG_F(RRC,"%02x ", ((uint8_t*)Rx_sdu)[i]); + } + + LOG_F(RRC,"\n"); +#endif + + MSC_LOG_RX_MESSAGE( + MSC_RRC_ENB, + MSC_RRC_UE, + Rx_sdu, + sdu_sizeP, + MSC_AS_TIME_FMT" ueCapabilityInformation UE %x size %u", + MSC_AS_TIME_ARGS(ctxt_pP), + ue_context_p->ue_context.rnti, + sdu_sizeP); + + LOG_I(RRC, + PROTOCOL_RRC_CTXT_UE_FMT" received ueCapabilityInformation on UL-DCCH %d from UE\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), + DCCH); + LOG_D(RRC, + PROTOCOL_RRC_CTXT_UE_FMT" RLC RB %02d --- RLC_DATA_IND %d bytes " + "(UECapabilityInformation) ---> RRC_eNB\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), + DCCH, + sdu_sizeP); +#ifdef XER_PRINT + xer_fprint(stdout, &asn_DEF_UL_DCCH_Message, (void *)ul_dcch_msg); +#endif + dec_rval = uper_decode(NULL, + &asn_DEF_UE_EUTRA_Capability, + (void **)&UE_EUTRA_Capability, + ul_dcch_msg->message.choice.c1.choice.ueCapabilityInformation.criticalExtensions. + choice.c1.choice.ueCapabilityInformation_r8.ue_CapabilityRAT_ContainerList.list. + array[0]->ueCapabilityRAT_Container.buf, + ul_dcch_msg->message.choice.c1.choice.ueCapabilityInformation.criticalExtensions. + choice.c1.choice.ueCapabilityInformation_r8.ue_CapabilityRAT_ContainerList.list. + array[0]->ueCapabilityRAT_Container.size, 0, 0); + //#ifdef XER_PRINT + xer_fprint(stdout, &asn_DEF_UE_EUTRA_Capability, (void *)UE_EUTRA_Capability); + //#endif + +#if defined(ENABLE_USE_MME) + + if (EPC_MODE_ENABLED == 1) { + rrc_eNB_send_S1AP_UE_CAPABILITIES_IND(ctxt_pP, + ue_context_p, + ul_dcch_msg); + } + +#endif + + rrc_eNB_generate_defaultRRCConnectionReconfiguration(ctxt_pP, + ue_context_p, + eNB_rrc_inst[ctxt_pP->module_id].HO_flag); + break; + + case UL_DCCH_MessageType__c1_PR_ulHandoverPreparationTransfer: + T(T_ENB_RRC_UL_HANDOVER_PREPARATION_TRANSFER, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), + T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); + + break; + + case UL_DCCH_MessageType__c1_PR_ulInformationTransfer: + T(T_ENB_RRC_UL_INFORMATION_TRANSFER, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), + T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); + +#ifdef RRC_MSG_PRINT + LOG_F(RRC,"[MSG] RRC UL Information Transfer \n"); + + for (i = 0; i < sdu_sizeP; i++) { + LOG_F(RRC,"%02x ", ((uint8_t*)Rx_sdu)[i]); + } + + LOG_F(RRC,"\n"); +#endif + + + MSC_LOG_RX_MESSAGE( + MSC_RRC_ENB, + MSC_RRC_UE, + Rx_sdu, + sdu_sizeP, + MSC_AS_TIME_FMT" ulInformationTransfer UE %x size %u", + MSC_AS_TIME_ARGS(ctxt_pP), + ue_context_p->ue_context.rnti, + sdu_sizeP); + +#if defined(ENABLE_USE_MME) + + if (EPC_MODE_ENABLED == 1) { + rrc_eNB_send_S1AP_UPLINK_NAS(ctxt_pP, + ue_context_p, + ul_dcch_msg); + } + +#endif + break; + + case UL_DCCH_MessageType__c1_PR_counterCheckResponse: + T(T_ENB_RRC_COUNTER_CHECK_RESPONSE, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), + T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); + + break; + +#ifdef Rel10 + + case UL_DCCH_MessageType__c1_PR_ueInformationResponse_r9: + T(T_ENB_RRC_UE_INFORMATION_RESPONSE_R9, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), + T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); + + break; + + case UL_DCCH_MessageType__c1_PR_proximityIndication_r9: + T(T_ENB_RRC_PROXIMITY_INDICATION_R9, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), + T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); + + break; + + case UL_DCCH_MessageType__c1_PR_rnReconfigurationComplete_r10: + T(T_ENB_RRC_RECONFIGURATION_COMPLETE_R10, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), + T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); + + break; + + case UL_DCCH_MessageType__c1_PR_mbmsCountingResponse_r10: + T(T_ENB_RRC_MBMS_COUNTING_RESPONSE_R10, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), + T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); + + break; + + case UL_DCCH_MessageType__c1_PR_interFreqRSTDMeasurementIndication_r10: + T(T_ENB_RRC_INTER_FREQ_RSTD_MEASUREMENT_INDICATION, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), + T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); + + break; +#endif + + default: + T(T_ENB_RRC_UNKNOW_MESSAGE, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), + T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); + + LOG_E(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Unknown message %s:%u\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), + __FILE__, __LINE__); + return -1; + } + + return 0; + } else { + LOG_E(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Unknown error %s:%u\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), + __FILE__, __LINE__); + return -1; + } + +} + +#if defined(ENABLE_ITTI) +//----------------------------------------------------------------------------- +void* +rrc_enb_task( + void* args_p +) +//----------------------------------------------------------------------------- +{ + MessageDef *msg_p; + const char *msg_name_p; + instance_t instance; + int result; + SRB_INFO *srb_info_p; + int CC_id; + + protocol_ctxt_t ctxt; + itti_mark_task_ready(TASK_RRC_ENB); + + while (1) { + // Wait for a message + itti_receive_msg(TASK_RRC_ENB, &msg_p); + + msg_name_p = ITTI_MSG_NAME(msg_p); + instance = ITTI_MSG_INSTANCE(msg_p); + + switch (ITTI_MSG_ID(msg_p)) { + case TERMINATE_MESSAGE: + itti_exit_task(); + break; + + case MESSAGE_TEST: + LOG_I(RRC, "[eNB %d] Received %s\n", instance, msg_name_p); + break; + + /* Messages from MAC */ + case RRC_MAC_CCCH_DATA_IND: + PROTOCOL_CTXT_SET_BY_INSTANCE(&ctxt, + instance, + ENB_FLAG_YES, + RRC_MAC_CCCH_DATA_IND(msg_p).rnti, + msg_p->ittiMsgHeader.lte_time.frame, + msg_p->ittiMsgHeader.lte_time.slot); + LOG_I(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Received %s\n", + PROTOCOL_RRC_CTXT_UE_ARGS(&ctxt), + msg_name_p); + + CC_id = RRC_MAC_CCCH_DATA_IND(msg_p).CC_id; + srb_info_p = &eNB_rrc_inst[instance].carrier[CC_id].Srb0; + + memcpy(srb_info_p->Rx_buffer.Payload, + RRC_MAC_CCCH_DATA_IND(msg_p).sdu, + RRC_MAC_CCCH_DATA_IND(msg_p).sdu_size); + srb_info_p->Rx_buffer.payload_size = RRC_MAC_CCCH_DATA_IND(msg_p).sdu_size; + rrc_eNB_decode_ccch(&ctxt, srb_info_p, CC_id); + break; + + /* Messages from PDCP */ + case RRC_DCCH_DATA_IND: + PROTOCOL_CTXT_SET_BY_INSTANCE(&ctxt, + instance, + ENB_FLAG_YES, + RRC_DCCH_DATA_IND(msg_p).rnti, + msg_p->ittiMsgHeader.lte_time.frame, + msg_p->ittiMsgHeader.lte_time.slot); + LOG_I(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Received on DCCH %d %s\n", + PROTOCOL_RRC_CTXT_UE_ARGS(&ctxt), + RRC_DCCH_DATA_IND(msg_p).dcch_index, + msg_name_p); + rrc_eNB_decode_dcch(&ctxt, + RRC_DCCH_DATA_IND(msg_p).dcch_index, + RRC_DCCH_DATA_IND(msg_p).sdu_p, + RRC_DCCH_DATA_IND(msg_p).sdu_size); + + // Message buffer has been processed, free it now. + result = itti_free(ITTI_MSG_ORIGIN_ID(msg_p), RRC_DCCH_DATA_IND(msg_p).sdu_p); + AssertFatal(result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result); + break; + +# if defined(ENABLE_USE_MME) + + /* Messages from S1AP */ + case S1AP_DOWNLINK_NAS: + rrc_eNB_process_S1AP_DOWNLINK_NAS(msg_p, msg_name_p, instance, &rrc_eNB_mui); + break; + + case S1AP_INITIAL_CONTEXT_SETUP_REQ: + rrc_eNB_process_S1AP_INITIAL_CONTEXT_SETUP_REQ(msg_p, msg_name_p, instance); + break; + + case S1AP_UE_CTXT_MODIFICATION_REQ: + rrc_eNB_process_S1AP_UE_CTXT_MODIFICATION_REQ(msg_p, msg_name_p, instance); + break; + + case S1AP_PAGING_IND: + LOG_E(RRC, "[eNB %d] Received not yet implemented message %s\n", instance, msg_name_p); + break; + + case S1AP_UE_CONTEXT_RELEASE_REQ: + rrc_eNB_process_S1AP_UE_CONTEXT_RELEASE_REQ(msg_p, msg_name_p, instance); + break; + + case S1AP_UE_CONTEXT_RELEASE_COMMAND: + rrc_eNB_process_S1AP_UE_CONTEXT_RELEASE_COMMAND(msg_p, msg_name_p, instance); + break; + + case GTPV1U_ENB_DELETE_TUNNEL_RESP: + /* Nothing to do. Apparently everything is done in S1AP processing */ + //LOG_I(RRC, "[eNB %d] Received message %s, not processed because procedure not synched\n", + //instance, msg_name_p); + break; + +# endif + + /* Messages from eNB app */ + case RRC_CONFIGURATION_REQ: + LOG_I(RRC, "[eNB %d] Received %s\n", instance, msg_name_p); + openair_rrc_eNB_configuration(ENB_INSTANCE_TO_MODULE_ID(instance), &RRC_CONFIGURATION_REQ(msg_p)); + break; + +# if ENABLE_RAL + + case RRC_RAL_CONFIGURE_THRESHOLD_REQ: + rrc_enb_ral_handle_configure_threshold_request(instance, msg_p); + break; + + //SPECTRA: Add the RRC connection reconfiguration with Second cell configuration + case RRC_RAL_CONNECTION_RECONFIGURATION_REQ: + // ue_mod_id = 0; /* TODO force ue_mod_id to first UE, NAS UE not virtualized yet */ +//#warning "TODO GET RIGHT RNTI" + PROTOCOL_CTXT_SET_BY_INSTANCE(&ctxt, + instance, + ENB_FLAG_YES, + NOT_A_RNTI, // TO DO GET RIGHT RNTI + msg_p->ittiMsgHeader.lte_time.frame, + msg_p->ittiMsgHeader.lte_time.slot); + LOG_I(RRC, "[eNB %d] Send RRC_RAL_CONNECTION_RECONFIGURATION_REQ to UE %s\n", instance, msg_name_p); + //Method RRC connection reconfiguration command with Second cell configuration + //rrc_eNB_generate_RRCConnectionReconfiguration_SCell(instance, 0/* TODO put frameP number ! */, /*ue_mod_id force ue_mod_id to first UE*/0, 36126); + //rrc_eNB_generate_defaultRRCConnectionReconfiguration(instance, 0/* TODO put frameP number ! */, /*ue_mod_id force ue_mod_id to first UE*/0, + // eNB_rrc_inst[instance].HO_flag); + break; +# endif + + default: + LOG_E(RRC, "[eNB %d] Received unexpected message %s\n", instance, msg_name_p); + break; + } + + result = itti_free(ITTI_MSG_ORIGIN_ID(msg_p), msg_p); + AssertFatal(result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result); + msg_p = NULL; + } +} +#endif + +#ifndef USER_MODE +EXPORT_SYMBOL(Rlc_info_am_config); +#endif From cd8cc1a35c8d07b2782ef79865b12200e75dde0b Mon Sep 17 00:00:00 2001 From: Florian Kaltenberger Date: Fri, 1 Jul 2016 13:19:18 +0200 Subject: [PATCH 196/349] added ue_transmission_mode and nb_antenna_ports to eNB config file transmisison mode gets set with RRCReconfiguration --- openair2/ENB_APP/enb_app.c | 3 ++ openair2/ENB_APP/enb_config.c | 46 ++++++++++++++++++- openair2/ENB_APP/enb_config.h | 7 +-- openair2/RRC/LITE/defs.h | 3 ++ openair2/RRC/LITE/rrc_eNB.c | 19 ++++++-- .../CONF/enb.band7.exmimo2.conf | 9 ++-- .../CONF/enb.band7.tm1.exmimo2.conf | 3 ++ targets/SIMU/USER/init_lte.c | 24 +++++----- targets/SIMU/USER/init_lte.h | 4 +- targets/SIMU/USER/oaisim_functions.c | 19 +++++++- 10 files changed, 109 insertions(+), 28 deletions(-) diff --git a/openair2/ENB_APP/enb_app.c b/openair2/ENB_APP/enb_app.c index 6d95c215db..7ce2a0fa6d 100644 --- a/openair2/ENB_APP/enb_app.c +++ b/openair2/ENB_APP/enb_app.c @@ -187,6 +187,9 @@ static void configure_rrc(uint32_t enb_id, const Enb_properties_array_t *enb_pro RRC_CONFIGURATION_REQ (msg_p).ue_TimersAndConstants_n310[CC_id] = enb_properties->properties[enb_id]->ue_TimersAndConstants_n310[CC_id]; RRC_CONFIGURATION_REQ (msg_p).ue_TimersAndConstants_t311[CC_id] = enb_properties->properties[enb_id]->ue_TimersAndConstants_t311[CC_id]; RRC_CONFIGURATION_REQ (msg_p).ue_TimersAndConstants_n311[CC_id] = enb_properties->properties[enb_id]->ue_TimersAndConstants_n311[CC_id]; + + RRC_CONFIGURATION_REQ (msg_p).ue_TransmissionMode[CC_id] = enb_properties->properties[enb_id]->ue_TransmissionMode[CC_id]; + } itti_send_msg_to_task (TASK_RRC_ENB, ENB_MODULE_ID_TO_INSTANCE(enb_id), msg_p); diff --git a/openair2/ENB_APP/enb_config.c b/openair2/ENB_APP/enb_config.c index d2f5c0dda5..0dad2a10ee 100755 --- a/openair2/ENB_APP/enb_config.c +++ b/openair2/ENB_APP/enb_config.c @@ -84,6 +84,7 @@ #define ENB_CONFIG_STRING_NID_CELL "Nid_cell" #define ENB_CONFIG_STRING_N_RB_DL "N_RB_DL" #define ENB_CONFIG_STRING_CELL_MBSFN "Nid_cell_mbsfn" +#define ENB_CONFIG_STRING_NB_ANT_PORTS "nb_antenna_ports" #define ENB_CONFIG_STRING_NB_ANT_TX "nb_antennas_tx" #define ENB_CONFIG_STRING_NB_ANT_RX "nb_antennas_rx" #define ENB_CONFIG_STRING_TX_GAIN "tx_gain" @@ -145,6 +146,7 @@ #define ENB_CONFIG_STRING_UETIMERS_T311 "ue_TimersAndConstants_t311" #define ENB_CONFIG_STRING_UETIMERS_N310 "ue_TimersAndConstants_n310" #define ENB_CONFIG_STRING_UETIMERS_N311 "ue_TimersAndConstants_n311" +#define ENB_CONFIG_STRING_UE_TRANSMISSION_MODE "ue_TransmissionMode" #define ENB_CONFIG_STRING_SRB1 "srb1_parameters" #define ENB_CONFIG_STRING_SRB1_TIMER_POLL_RETRANSMIT "timer_poll_retransmit" @@ -322,6 +324,7 @@ void enb_config_display(void) printf( "\n\tCell ID for CC %d:\t%"PRId16":\n",j,enb_properties.properties[i]->Nid_cell[j]); printf( "\tN_RB_DL for CC %d:\t%"PRId16":\n",j,enb_properties.properties[i]->N_RB_DL[j]); + printf( "\tnb_antenna_ports for CC %d:\t%d:\n",j,enb_properties.properties[i]->nb_antenna_ports[j]); printf( "\tnb_antennas_tx for CC %d:\t%d:\n",j,enb_properties.properties[i]->nb_antennas_tx[j]); printf( "\tnb_antennas_rx for CC %d:\t%d:\n",j,enb_properties.properties[i]->nb_antennas_rx[j]); @@ -411,6 +414,8 @@ void enb_config_display(void) printf( "\tue_TimersAndConstants_t311 for CC %d:\t%ld:\n",j,enb_properties.properties[i]->ue_TimersAndConstants_t311[j]); printf( "\tue_TimersAndConstants_n311 for CC %d:\t%ld:\n",j,enb_properties.properties[i]->ue_TimersAndConstants_n311[j]); + printf( "\tue_TransmissionMode for CC %d:\t%ld:\n",j,enb_properties.properties[i]->ue_TransmissionMode[j]); + } for (j=0; j < enb_properties.properties[i]->num_otg_elements; j++) { @@ -526,6 +531,7 @@ const Enb_properties_array_t *enb_config_init(char* lib_config_file_name_pP) libconfig_int Nid_cell = 0; libconfig_int Nid_cell_mbsfn = 0; libconfig_int N_RB_DL = 0; + libconfig_int nb_antenna_ports = 0; libconfig_int nb_antennas_tx = 0; libconfig_int nb_antennas_rx = 0; libconfig_int tx_gain = 0; @@ -589,7 +595,7 @@ const Enb_properties_array_t *enb_config_init(char* lib_config_file_name_pP) libconfig_int ue_TimersAndConstants_t311 = 0; libconfig_int ue_TimersAndConstants_n310 = 0; libconfig_int ue_TimersAndConstants_n311 = 0; - + libconfig_int ue_TransmissionMode = 0; libconfig_int srb1_timer_poll_retransmit = 0; @@ -797,6 +803,7 @@ const Enb_properties_array_t *enb_config_init(char* lib_config_file_name_pP) && config_setting_lookup_int(component_carrier, ENB_CONFIG_STRING_NID_CELL, &Nid_cell) && config_setting_lookup_int(component_carrier, ENB_CONFIG_STRING_N_RB_DL, &N_RB_DL) && config_setting_lookup_int(component_carrier, ENB_CONFIG_STRING_CELL_MBSFN, &Nid_cell_mbsfn) + && config_setting_lookup_int(component_carrier, ENB_CONFIG_STRING_NB_ANT_PORTS, &nb_antenna_ports) && config_setting_lookup_int(component_carrier, ENB_CONFIG_STRING_NB_ANT_TX, &nb_antennas_tx) && config_setting_lookup_int(component_carrier, ENB_CONFIG_STRING_NB_ANT_RX, &nb_antennas_rx) && config_setting_lookup_int(component_carrier, ENB_CONFIG_STRING_TX_GAIN, &tx_gain) @@ -852,6 +859,7 @@ const Enb_properties_array_t *enb_config_init(char* lib_config_file_name_pP) && config_setting_lookup_int(component_carrier, ENB_CONFIG_STRING_UETIMERS_T311, &ue_TimersAndConstants_t311) && config_setting_lookup_int(component_carrier, ENB_CONFIG_STRING_UETIMERS_N310, &ue_TimersAndConstants_n310) && config_setting_lookup_int(component_carrier, ENB_CONFIG_STRING_UETIMERS_N311, &ue_TimersAndConstants_n311) + && config_setting_lookup_int(component_carrier, ENB_CONFIG_STRING_UE_TRANSMISSION_MODE, &ue_TransmissionMode) #ifdef Rel10 @@ -968,6 +976,13 @@ const Enb_properties_array_t *enb_config_init(char* lib_config_file_name_pP) enb_properties.properties[enb_properties_index]->nb_antennas_tx[j] = nb_antennas_tx; + if ((nb_antenna_ports <1) || (nb_antenna_ports > 2)) + AssertError (0, parse_errors ++, + "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for nb_antenna_ports choice: 1..2 !\n", + lib_config_file_name_pP, i, nb_antenna_ports); + + enb_properties.properties[enb_properties_index]->nb_antenna_ports[j] = nb_antenna_ports; + if ((nb_antennas_tx <1) || (nb_antennas_tx > 64)) AssertError (0, parse_errors ++, "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for nb_antennas_tx choice: 1..64 !\n", @@ -1832,6 +1847,35 @@ const Enb_properties_array_t *enb_config_init(char* lib_config_file_name_pP) break; } + + switch (ue_TransmissionMode) { + case 1: + enb_properties.properties[enb_properties_index]->ue_TransmissionMode[j] = AntennaInfoDedicated__transmissionMode_tm1; + break; + case 2: + enb_properties.properties[enb_properties_index]->ue_TransmissionMode[j] = AntennaInfoDedicated__transmissionMode_tm2; + break; + case 3: + enb_properties.properties[enb_properties_index]->ue_TransmissionMode[j] = AntennaInfoDedicated__transmissionMode_tm3; + break; + case 4: + enb_properties.properties[enb_properties_index]->ue_TransmissionMode[j] = AntennaInfoDedicated__transmissionMode_tm4; + break; + case 5: + enb_properties.properties[enb_properties_index]->ue_TransmissionMode[j] = AntennaInfoDedicated__transmissionMode_tm5; + break; + case 6: + enb_properties.properties[enb_properties_index]->ue_TransmissionMode[j] = AntennaInfoDedicated__transmissionMode_tm6; + break; + case 7: + enb_properties.properties[enb_properties_index]->ue_TransmissionMode[j] = AntennaInfoDedicated__transmissionMode_tm7; + break; + default: + AssertError (0, parse_errors ++, + "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for ue_TransmissionMode choice: 1,2,3,4,5,6,7", + lib_config_file_name_pP, i, ue_TransmissionMode); + break; + } } } diff --git a/openair2/ENB_APP/enb_config.h b/openair2/ENB_APP/enb_config.h index 5f7f2636a3..4bdaf67514 100755 --- a/openair2/ENB_APP/enb_config.h +++ b/openair2/ENB_APP/enb_config.h @@ -136,9 +136,10 @@ typedef struct Enb_properties_s { int16_t Nid_cell[1+MAX_NUM_CCs];// for testing, change later int16_t N_RB_DL[1+MAX_NUM_CCs];// for testing, change later - int nb_antennas_tx[1+MAX_NUM_CCs]; + int nb_antenna_ports[1+MAX_NUM_CCs]; + int nb_antennas_tx[1+MAX_NUM_CCs]; int nb_antennas_rx[1+MAX_NUM_CCs]; - int tx_gain[1+MAX_NUM_CCs]; + int tx_gain[1+MAX_NUM_CCs]; int rx_gain[1+MAX_NUM_CCs]; long prach_root[1+MAX_NUM_CCs]; long prach_config_index[1+MAX_NUM_CCs]; @@ -198,7 +199,7 @@ typedef struct Enb_properties_s { long ue_TimersAndConstants_t311[1+MAX_NUM_CCs]; long ue_TimersAndConstants_n310[1+MAX_NUM_CCs]; long ue_TimersAndConstants_n311[1+MAX_NUM_CCs]; - + long ue_TransmissionMode[1+MAX_NUM_CCs]; long srb1_timer_poll_retransmit; long srb1_timer_reordering; diff --git a/openair2/RRC/LITE/defs.h b/openair2/RRC/LITE/defs.h index 78240de082..2603cbbb01 100644 --- a/openair2/RRC/LITE/defs.h +++ b/openair2/RRC/LITE/defs.h @@ -430,6 +430,9 @@ typedef struct eNB_RRC_INST_s { /// localization list for aggregated measurements from PHY struct list loc_list; #endif + + //pointer to configuration + RrcConfigurationReq *configuration; } eNB_RRC_INST; #define MAX_UE_CAPABILITY_SIZE 255 diff --git a/openair2/RRC/LITE/rrc_eNB.c b/openair2/RRC/LITE/rrc_eNB.c index 6b591e0c35..90cf172f37 100644 --- a/openair2/RRC/LITE/rrc_eNB.c +++ b/openair2/RRC/LITE/rrc_eNB.c @@ -1133,8 +1133,8 @@ rrc_eNB_generate_defaultRRCConnectionReconfiguration( int i; // configure SRB1/SRB2, PhysicalConfigDedicated, MAC_MainConfig for UE - //eNB_RRC_INST* rrc_inst = &eNB_rrc_inst[ctxt_pP->module_id]; - //struct PhysicalConfigDedicated** physicalConfigDedicated = &ue_context_pP->ue_context.physicalConfigDedicated; + eNB_RRC_INST* rrc_inst = &eNB_rrc_inst[ctxt_pP->module_id]; + struct PhysicalConfigDedicated** physicalConfigDedicated = &ue_context_pP->ue_context.physicalConfigDedicated; struct SRB_ToAddMod *SRB2_config = NULL; struct SRB_ToAddMod__rlc_Config *SRB2_rlc_config = NULL; @@ -1360,6 +1360,14 @@ rrc_eNB_generate_defaultRRCConnectionReconfiguration( //sps_RA_ConfigList_rlola = NULL; #endif + //change the transmission mode for the primary component carrier + //TODO: change TM for secondary CC in SCelltoaddmodlist + if (*physicalConfigDedicated) + if ((*physicalConfigDedicated)->antennaInfo) { + (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.transmissionMode = rrc_inst->configuration->ue_TransmissionMode[0]; + LOG_D(RRC,"Setting transmission mode to %d+1\n",rrc_inst->configuration->ue_TransmissionMode[0]); + } + // Measurement ID list MeasId_list = CALLOC(1, sizeof(*MeasId_list)); memset((void *)MeasId_list, 0, sizeof(*MeasId_list)); @@ -1672,10 +1680,10 @@ rrc_eNB_generate_defaultRRCConnectionReconfiguration( (DRB_ToAddModList_t*)*DRB_configList, (DRB_ToReleaseList_t*)NULL, // DRB2_list, (struct SPS_Config*)NULL, // *sps_Config, -#ifdef EXMIMO_IOT - NULL, NULL, NULL, NULL,NULL, -#else (struct PhysicalConfigDedicated*)*physicalConfigDedicated, +#ifdef EXMIMO_IOT + NULL, NULL, NULL,NULL, +#else (MeasObjectToAddModList_t*)MeasObj_list, (ReportConfigToAddModList_t*)ReportConfig_list, (QuantityConfig_t*)quantityConfig, @@ -3449,6 +3457,7 @@ openair_rrc_lite_eNB_init( eNB_rrc_inst[ctxt.module_id].initial_id2_s1ap_ids = hashtable_create (NUMBER_OF_UE_MAX * 2, NULL, NULL); eNB_rrc_inst[ctxt.module_id].s1ap_id2_s1ap_ids = hashtable_create (NUMBER_OF_UE_MAX * 2, NULL, NULL); + eNB_rrc_inst[ctxt.module_id].configuration = configuration; /// System Information INIT diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.exmimo2.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.exmimo2.conf index 6493c01167..68e5f8b056 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.exmimo2.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.exmimo2.conf @@ -33,6 +33,7 @@ eNBs = Nid_cell = 0; N_RB_DL = 25; Nid_cell_mbsfn = 0; + nb_antenna_ports = 2; nb_antennas_tx = 2; nb_antennas_rx = 2; tx_gain = 25; @@ -97,6 +98,8 @@ eNBs = ue_TimersAndConstants_t311 = 10000; ue_TimersAndConstants_n310 = 20; ue_TimersAndConstants_n311 = 1; + + ue_TransmissionMode = 2; } ); @@ -165,13 +168,13 @@ eNBs = */ log_config : { - global_log_level ="info"; + global_log_level ="debug"; global_log_verbosity ="medium"; hw_log_level ="debug"; hw_log_verbosity ="medium"; - phy_log_level ="info"; + phy_log_level ="debug"; phy_log_verbosity ="medium"; - mac_log_level ="info"; + mac_log_level ="debug"; mac_log_verbosity ="high"; rlc_log_level ="info"; rlc_log_verbosity ="medium"; diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.exmimo2.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.exmimo2.conf index c0974d8703..15cb63a5b7 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.exmimo2.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.exmimo2.conf @@ -33,6 +33,7 @@ eNBs = Nid_cell = 0; N_RB_DL = 25; Nid_cell_mbsfn = 0; + nb_antenna_ports = 1; nb_antennas_tx = 1; nb_antennas_rx = 1; tx_gain = 25; @@ -97,6 +98,8 @@ eNBs = ue_TimersAndConstants_t311 = 10000; ue_TimersAndConstants_n310 = 20; ue_TimersAndConstants_n311 = 1; + + ue_TransmissionMode = 1; } ); diff --git a/targets/SIMU/USER/init_lte.c b/targets/SIMU/USER/init_lte.c index 3463da77d8..5514984a7d 100644 --- a/targets/SIMU/USER/init_lte.c +++ b/targets/SIMU/USER/init_lte.c @@ -53,7 +53,6 @@ PHY_VARS_eNB* init_lte_eNB(LTE_DL_FRAME_PARMS *frame_parms, uint8_t eNB_id, uint8_t Nid_cell, uint8_t cooperation_flag, - uint8_t transmission_mode, uint8_t abstraction_flag) { @@ -72,7 +71,6 @@ PHY_VARS_eNB* init_lte_eNB(LTE_DL_FRAME_PARMS *frame_parms, LOG_I(PHY,"init eNB: number of ue max %d number of enb max %d number of harq pid max %d\n", NUMBER_OF_UE_MAX, NUMBER_OF_eNB_MAX, NUMBER_OF_HARQ_PID_MAX); LOG_I(PHY,"init eNB: N_RB_DL %d\n", frame_parms->N_RB_DL); - LOG_I(PHY,"init eNB: Transmission mode %d\n", transmission_mode); for (i=0; itransmission_mode[i] = transmission_mode; + PHY_vars_eNB->transmission_mode[i] = frame_parms->nb_antenna_ports_eNB==1 ? 1 : 2; #ifdef LOCALIZATION PHY_vars_eNB->ulsch_eNB[1+i]->aggregation_period_ms = 5000; // 5000 milliseconds // could be given as an argument (TBD)) struct timeval ts; @@ -156,8 +154,8 @@ PHY_VARS_eNB* init_lte_eNB(LTE_DL_FRAME_PARMS *frame_parms, PHY_VARS_UE* init_lte_UE(LTE_DL_FRAME_PARMS *frame_parms, uint8_t UE_id, - uint8_t abstraction_flag, - uint8_t transmission_mode) + uint8_t abstraction_flag) + { int i,j; @@ -190,7 +188,7 @@ PHY_VARS_UE* init_lte_UE(LTE_DL_FRAME_PARMS *frame_parms, PHY_vars_UE->dlsch_ue_SI[i] = new_ue_dlsch(1,1,NSOFT,MAX_TURBO_ITERATIONS,frame_parms->N_RB_DL, abstraction_flag); PHY_vars_UE->dlsch_ue_ra[i] = new_ue_dlsch(1,1,NSOFT,MAX_TURBO_ITERATIONS,frame_parms->N_RB_DL, abstraction_flag); - PHY_vars_UE->transmission_mode[i] = transmission_mode; + PHY_vars_UE->transmission_mode[i] = frame_parms->nb_antenna_ports_eNB==1 ? 1 : 2; } PHY_vars_UE->lte_frame_parms.pucch_config_common.deltaPUCCH_Shift = 1; @@ -228,8 +226,12 @@ void init_lte_vars(LTE_DL_FRAME_PARMS *frame_parms[MAX_NUM_CCs], uint8_t extended_prefix_flag, uint8_t N_RB_DL, uint16_t Nid_cell, - uint8_t cooperation_flag,uint8_t transmission_mode,uint8_t abstraction_flag, - int nb_antennas_rx, int nb_antennas_tx, uint8_t eMBMS_active_state) + uint8_t cooperation_flag, + uint8_t nb_antenna_ports, + uint8_t abstraction_flag, + int nb_antennas_rx, + int nb_antennas_tx, + uint8_t eMBMS_active_state) { uint8_t eNB_id,UE_id,RN_id,CC_id; @@ -254,7 +256,7 @@ void init_lte_vars(LTE_DL_FRAME_PARMS *frame_parms[MAX_NUM_CCs], (frame_parms[CC_id])->nushift = (Nid_cell%6); (frame_parms[CC_id])->nb_antennas_tx = nb_antennas_tx; (frame_parms[CC_id])->nb_antennas_rx = nb_antennas_rx; - (frame_parms[CC_id])->nb_antenna_ports_eNB = (transmission_mode == 1 || transmission_mode == 7) ? 1 : 2; + (frame_parms[CC_id])->nb_antenna_ports_eNB = nb_antenna_ports; (frame_parms[CC_id])->mode1_flag = (frame_parms[CC_id])->nb_antenna_ports_eNB==1 ? 1 : 0; init_frame_parms(frame_parms[CC_id],1); @@ -277,7 +279,7 @@ void init_lte_vars(LTE_DL_FRAME_PARMS *frame_parms[MAX_NUM_CCs], PHY_vars_eNB_g[eNB_id] = (PHY_VARS_eNB**) malloc(MAX_NUM_CCs*sizeof(PHY_VARS_eNB*)); for (CC_id=0; CC_idMod_id=eNB_id; PHY_vars_eNB_g[eNB_id][CC_id]->CC_id=CC_id; } @@ -294,7 +296,7 @@ void init_lte_vars(LTE_DL_FRAME_PARMS *frame_parms[MAX_NUM_CCs], (frame_parms[CC_id])->nb_antennas_rx = nb_antennas_rx; - PHY_vars_UE_g[UE_id][CC_id] = init_lte_UE(frame_parms[CC_id], UE_id,abstraction_flag,transmission_mode); + PHY_vars_UE_g[UE_id][CC_id] = init_lte_UE(frame_parms[CC_id], UE_id,abstraction_flag); PHY_vars_UE_g[UE_id][CC_id]->Mod_id=UE_id; PHY_vars_UE_g[UE_id][CC_id]->CC_id=CC_id; } diff --git a/targets/SIMU/USER/init_lte.h b/targets/SIMU/USER/init_lte.h index 269863085d..e033b27e47 100644 --- a/targets/SIMU/USER/init_lte.h +++ b/targets/SIMU/USER/init_lte.h @@ -34,13 +34,11 @@ PHY_VARS_eNB* init_lte_eNB(LTE_DL_FRAME_PARMS *frame_parms, uint8_t eNB_id, uint8_t Nid_cell, uint8_t cooperation_flag, - uint8_t transmission_mode, uint8_t abstraction_flag); PHY_VARS_UE* init_lte_UE(LTE_DL_FRAME_PARMS *frame_parms, uint8_t UE_id, - uint8_t abstraction_flag, - uint8_t transmission_mode); + uint8_t abstraction_flag); PHY_VARS_RN* init_lte_RN(LTE_DL_FRAME_PARMS *frame_parms, uint8_t RN_id, diff --git a/targets/SIMU/USER/oaisim_functions.c b/targets/SIMU/USER/oaisim_functions.c index 326813181a..4ce98cd701 100644 --- a/targets/SIMU/USER/oaisim_functions.c +++ b/targets/SIMU/USER/oaisim_functions.c @@ -683,6 +683,7 @@ void get_simulation_options(int argc, char *argv[]) break; case 'x': + /* oai_emulation.info.transmission_mode[0] = atoi (optarg); if ((oai_emulation.info.transmission_mode[0] != 1) && (oai_emulation.info.transmission_mode[0] != 2) && (oai_emulation.info.transmission_mode[0] != 3) @@ -690,6 +691,9 @@ void get_simulation_options(int argc, char *argv[]) printf("Unsupported transmission mode %d\n",oai_emulation.info.transmission_mode[0]); exit(-1); } + */ + printf("Option -x deprecated. Please set transmission mode in eNB config file\n"); + exit(-1); break; @@ -925,8 +929,19 @@ void init_openair1(void) // change the nb_connected_eNB for (CC_id=0; CC_idproperties[0]->nb_antennas_tx[CC_id],enb_properties->properties[0]->nb_antennas_tx[CC_id], oai_emulation.info.eMBMS_active_state); + init_lte_vars (&frame_parms[CC_id], + oai_emulation.info.frame_type[CC_id], + oai_emulation.info.tdd_config[CC_id], + oai_emulation.info.tdd_config_S[CC_id], + oai_emulation.info.extended_prefix_flag[CC_id], + oai_emulation.info.N_RB_DL[CC_id], + Nid_cell, + cooperation_flag, + enb_properties->properties[0]->nb_antenna_ports[CC_id], + abstraction_flag, + enb_properties->properties[0]->nb_antennas_tx[CC_id], + enb_properties->properties[0]->nb_antennas_tx[CC_id], + oai_emulation.info.eMBMS_active_state); } for (eNB_id=0; eNB_id Date: Fri, 1 Jul 2016 13:20:15 +0200 Subject: [PATCH 197/349] mostly bugfixes --- openair1/PHY/INIT/defs.h | 12 ++ openair1/PHY/INIT/lte_init.c | 4 +- openair1/PHY/LTE_TRANSPORT/defs.h | 4 +- .../PHY/LTE_TRANSPORT/dlsch_demodulation.c | 2 +- openair1/SCHED/phy_procedures_lte_eNb.c | 2 +- openair1/SCHED/phy_procedures_lte_ue.c | 2 +- openair1/SIMULATION/LTE_PHY/dlsim.c | 22 +-- openair2/RRC/LITE/rrc_UE.c | 2 +- .../CONF/enb.band7.tm7.exmimo2.conf | 179 ++++++++++++++++++ 9 files changed, 210 insertions(+), 19 deletions(-) create mode 100644 targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm7.exmimo2.conf diff --git a/openair1/PHY/INIT/defs.h b/openair1/PHY/INIT/defs.h index f08ca678db..58b04e7e01 100644 --- a/openair1/PHY/INIT/defs.h +++ b/openair1/PHY/INIT/defs.h @@ -337,6 +337,18 @@ int init_frame_parms(LTE_DL_FRAME_PARMS *frame_parms,uint8_t osf); void dump_frame_parms(LTE_DL_FRAME_PARMS *frame_parms); #endif +void lte_param_init(unsigned char N_tx_port_eNB, + unsigned char N_tx_phy, + unsigned char N_rx, + unsigned char transmission_mode, + uint8_t extended_prefix_flag, + frame_t frame_type, + uint16_t Nid_cell, + uint8_t tdd_config, + uint8_t N_RB_DL, + uint8_t threequarter_fs, + uint8_t osf, + uint32_t perfect_ce); /** @} */ #endif diff --git a/openair1/PHY/INIT/lte_init.c b/openair1/PHY/INIT/lte_init.c index c1f8c89b55..25a77aa024 100644 --- a/openair1/PHY/INIT/lte_init.c +++ b/openair1/PHY/INIT/lte_init.c @@ -1338,7 +1338,7 @@ int phy_init_lte_eNB(PHY_VARS_eNB *phy_vars_eNB, // TX vars eNB_common_vars->txdata[eNB_id] = (int32_t**)malloc16(frame_parms->nb_antennas_tx*sizeof(int32_t*)); eNB_common_vars->txdataF[eNB_id] = (mod_sym_t **)malloc16(NB_ANTENNA_PORTS_ENB*sizeof(mod_sym_t*)); - eNB_common_vars->txdataF_BF[eNB_id] = (mod_sym_t ***)malloc16(frame_parms->nb_antennas_tx*sizeof(mod_sym_t**)); + eNB_common_vars->txdataF_BF[eNB_id] = (mod_sym_t **)malloc16(frame_parms->nb_antennas_tx*sizeof(mod_sym_t*)); for (i=0; i<14; i++) { eNB_common_vars->txdataF[eNB_id][i] = (mod_sym_t*)malloc16_clear( FRAME_LENGTH_COMPLEX_SAMPLES_NO_PREFIX*sizeof(mod_sym_t) ); @@ -1350,7 +1350,7 @@ int phy_init_lte_eNB(PHY_VARS_eNB *phy_vars_eNB, } for (i=0; inb_antennas_tx; i++) { - eNB_common_vars->txdataF_BF[eNB_id][i] = (mod_sym_t*)malloc16_clear( OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES*sizeof(mod_sym_t*) ); + eNB_common_vars->txdataF_BF[eNB_id][i] = (mod_sym_t*)malloc16_clear( OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES*sizeof(mod_sym_t) ); #ifdef USER_MODE eNB_common_vars->txdata[eNB_id][i] = (int32_t*)malloc16_clear( FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(int32_t) ); #else // USER_MODE diff --git a/openair1/PHY/LTE_TRANSPORT/defs.h b/openair1/PHY/LTE_TRANSPORT/defs.h index ae1d339770..22b70672e8 100644 --- a/openair1/PHY/LTE_TRANSPORT/defs.h +++ b/openair1/PHY/LTE_TRANSPORT/defs.h @@ -239,9 +239,9 @@ typedef struct { typedef struct { /// TX buffers for UE-spec transmission (antenna ports 5 or 7..14, prior to precoding) - uint32_t *txdataF[8]; + int32_t *txdataF[8]; /// beamforming weights for UE-spec transmission (antenna ports 5 or 7..14), for each codeword, maximum 4 layers? - uint32_t **ue_spec_bf_weights[4]; + int32_t **ue_spec_bf_weights[4]; /// Allocated RNTI (0 means DLSCH_t is not currently used) uint16_t rnti; /// Active flag for baseband transmitter processing diff --git a/openair1/PHY/LTE_TRANSPORT/dlsch_demodulation.c b/openair1/PHY/LTE_TRANSPORT/dlsch_demodulation.c index 831744bc09..916883cc23 100644 --- a/openair1/PHY/LTE_TRANSPORT/dlsch_demodulation.c +++ b/openair1/PHY/LTE_TRANSPORT/dlsch_demodulation.c @@ -96,7 +96,7 @@ int rx_pdsch(PHY_VARS_UE *phy_vars_ue, LTE_UE_DLSCH_t **dlsch_ue; unsigned char aatx,aarx; - unsigned short nb_rb; + unsigned short nb_rb=0; int avgs, rb; LTE_DL_UE_HARQ_t *dlsch0_harq,*dlsch1_harq = 0; diff --git a/openair1/SCHED/phy_procedures_lte_eNb.c b/openair1/SCHED/phy_procedures_lte_eNb.c index e9ee770545..f7a978545f 100755 --- a/openair1/SCHED/phy_procedures_lte_eNb.c +++ b/openair1/SCHED/phy_procedures_lte_eNb.c @@ -1190,7 +1190,7 @@ void phy_procedures_eNB_TX(unsigned char sched_subframe,PHY_VARS_eNB *phy_vars_e 0, P_RNTI, phy_vars_eNB->eNB_UE_stats[(uint8_t)UE_id].DL_pmi_single, - phy_vars_eNB->transmission_mode[(uint8_t)UE_id]>7?0:phy_vars_eNB->transmission_mode[(uint8_t)UE_id]); + phy_vars_eNB->transmission_mode[(uint8_t)UE_id]<7?0:phy_vars_eNB->transmission_mode[(uint8_t)UE_id]); LOG_D(PHY,"[eNB %"PRIu8"][PDSCH %"PRIx16"/%"PRIu8"] Frame %d subframe %d: Generated dlsch params\n", phy_vars_eNB->Mod_id,DCI_pdu->dci_alloc[i].rnti,phy_vars_eNB->dlsch_eNB[(uint8_t)UE_id][0]->current_harq_pid,phy_vars_eNB->proc[sched_subframe].frame_tx,subframe); diff --git a/openair1/SCHED/phy_procedures_lte_ue.c b/openair1/SCHED/phy_procedures_lte_ue.c index d87a8479f5..cfaca44a43 100755 --- a/openair1/SCHED/phy_procedures_lte_ue.c +++ b/openair1/SCHED/phy_procedures_lte_ue.c @@ -2144,7 +2144,7 @@ int lte_ue_pdcch_procedures(uint8_t eNB_id,PHY_VARS_UE *phy_vars_ue,uint8_t abst SI_RNTI, 0, P_RNTI, - phy_vars_ue->transmission_mode[eNB_id]>7?0:phy_vars_ue->transmission_mode[eNB_id])==0)) { + (phy_vars_ue->transmission_mode[eNB_id]<7)?0:phy_vars_ue->transmission_mode[eNB_id])==0)) { #ifdef DIAG_PHY diff --git a/openair1/SIMULATION/LTE_PHY/dlsim.c b/openair1/SIMULATION/LTE_PHY/dlsim.c index 6e78ad1a56..7c58488e2d 100644 --- a/openair1/SIMULATION/LTE_PHY/dlsim.c +++ b/openair1/SIMULATION/LTE_PHY/dlsim.c @@ -3359,17 +3359,17 @@ PMI_FEEDBACK: if (dlsch_active == 1) { - if (transmission_mode==7) { - if (PHY_vars_UE->lte_frame_parms.Ncp==0) { - if ((Ns==(2*subframe) && ((l==3) || (l==6))) || - Ns==(1+(2*subframe)) && ((l==2) || (l==5))) { - if (perfect_ce==0) - lte_dl_bf_channel_estimation(PHY_vars_UE,eNB_id,0,Ns,5,l+7*(Ns%2==1)); - } - } else { - msg("Beamforming channel estimation not supported yet for TM7 extented CP.\n"); - } - } + if (transmission_mode==7) { + if (PHY_vars_UE->lte_frame_parms.Ncp==0) { + if ((Ns==(2*subframe) && ((l==3) || (l==6))) || + (Ns==(1+2*subframe) && ((l==2) || (l==5)))) { + if (perfect_ce==0) + lte_dl_bf_channel_estimation(PHY_vars_UE,eNB_id,0,Ns,5,l+7*(Ns%2==1)); + } + } else { + msg("Beamforming channel estimation not supported yet for TM7 extented CP.\n"); + } + } if ((Ns==(1+(2*subframe))) && (l==0)) {// process PDSCH symbols 1,2,3,4,5,(6 Normal Prefix) diff --git a/openair2/RRC/LITE/rrc_UE.c b/openair2/RRC/LITE/rrc_UE.c index 7da26897e8..19d7b9a36e 100644 --- a/openair2/RRC/LITE/rrc_UE.c +++ b/openair2/RRC/LITE/rrc_UE.c @@ -103,7 +103,7 @@ extern UE_MAC_INST *UE_mac_inst; extern void *bigphys_malloc(int); #endif -//#define XER_PRINT +#define XER_PRINT extern int8_t dB_fixed2(uint32_t x,uint32_t y); diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm7.exmimo2.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm7.exmimo2.conf new file mode 100644 index 0000000000..dedf4797bc --- /dev/null +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm7.exmimo2.conf @@ -0,0 +1,179 @@ +Active_eNBs = ( "eNB_Eurecom_LTEBox"); +# Asn1_verbosity, choice in: none, info, annoying +Asn1_verbosity = "none"; + +eNBs = +( + { + ////////// Identification parameters: + eNB_ID = 0xe00; + + cell_type = "CELL_MACRO_ENB"; + + eNB_name = "eNB_Eurecom_LTEBox"; + + // Tracking area code, 0x0000 and 0xfffe are reserved values + tracking_area_code = "1"; + + mobile_country_code = "208"; + + mobile_network_code = "93"; + + ////////// Physical parameters: + + component_carriers = ( + { + frame_type = "FDD"; + tdd_config = 3; + tdd_config_s = 0; + prefix_type = "NORMAL"; + eutra_band = 7; + downlink_frequency = 2680000000L; + uplink_frequency_offset = -120000000; + Nid_cell = 0; + N_RB_DL = 25; + Nid_cell_mbsfn = 0; + nb_antenna_ports = 1; + nb_antennas_tx = 1; + nb_antennas_rx = 1; + tx_gain = 25; + rx_gain = 20; + prach_root = 0; + prach_config_index = 0; + prach_high_speed = "DISABLE"; + prach_zero_correlation = 1; + prach_freq_offset = 2; + pucch_delta_shift = 1; + pucch_nRB_CQI = 1; + pucch_nCS_AN = 0; + pucch_n1_AN = 32; + pdsch_referenceSignalPower = -26; + pdsch_p_b = 0; + pusch_n_SB = 1; + pusch_enable64QAM = "DISABLE"; + pusch_hoppingMode = "interSubFrame"; + pusch_hoppingOffset = 0; + pusch_groupHoppingEnabled = "ENABLE"; + pusch_groupAssignment = 0; + pusch_sequenceHoppingEnabled = "DISABLE"; + pusch_nDMRS1 = 0; + phich_duration = "NORMAL"; + phich_resource = "ONESIXTH"; + srs_enable = "DISABLE"; + /* srs_BandwidthConfig =; + srs_SubframeConfig =; + srs_ackNackST =; + srs_MaxUpPts =;*/ + + pusch_p0_Nominal = -80; /*-85;*/ + pusch_alpha = "AL1"; + pucch_p0_Nominal = -108; /* -108 */ + msg3_delta_Preamble = 6; + pucch_deltaF_Format1 = "deltaF2"; + pucch_deltaF_Format1b = "deltaF3"; + pucch_deltaF_Format2 = "deltaF0"; + pucch_deltaF_Format2a = "deltaF0"; + pucch_deltaF_Format2b = "deltaF0"; + + rach_numberOfRA_Preambles = 64; + rach_preamblesGroupAConfig = "DISABLE"; + /* + rach_sizeOfRA_PreamblesGroupA = ; + rach_messageSizeGroupA = ; + rach_messagePowerOffsetGroupB = ; + */ + rach_powerRampingStep = 2; + rach_preambleInitialReceivedTargetPower = -100; + rach_preambleTransMax = 10; + rach_raResponseWindowSize = 10; + rach_macContentionResolutionTimer = 48; + rach_maxHARQ_Msg3Tx = 4; + + pcch_default_PagingCycle = 128; + pcch_nB = "oneT"; + bcch_modificationPeriodCoeff = 2; + ue_TimersAndConstants_t300 = 1000; + ue_TimersAndConstants_t301 = 1000; + ue_TimersAndConstants_t310 = 1000; + ue_TimersAndConstants_t311 = 10000; + ue_TimersAndConstants_n310 = 20; + ue_TimersAndConstants_n311 = 1; + + ue_TransmissionMode = 7; + } + ); + + + srb1_parameters : + { + # timer_poll_retransmit = (ms) [5, 10, 15, 20,... 250, 300, 350, ... 500] + timer_poll_retransmit = 80; + + # timer_reordering = (ms) [0,5, ... 100, 110, 120, ... ,200] + timer_reordering = 35; + + # timer_reordering = (ms) [0,5, ... 250, 300, 350, ... ,500] + timer_status_prohibit = 0; + + # poll_pdu = [4, 8, 16, 32 , 64, 128, 256, infinity(>10000)] + poll_pdu = 4; + + # poll_byte = (kB) [25,50,75,100,125,250,375,500,750,1000,1250,1500,2000,3000,infinity(>10000)] + poll_byte = 99999; + + # max_retx_threshold = [1, 2, 3, 4 , 6, 8, 16, 32] + max_retx_threshold = 4; + } + + # ------- SCTP definitions + SCTP : + { + # Number of streams to use in input/output + SCTP_INSTREAMS = 2; + SCTP_OUTSTREAMS = 2; + }; + + ////////// MME parameters: + mme_ip_address = ( { ipv4 = "192.168.12.171"; + ipv6 = "192:168:30::17"; + active = "yes"; + preference = "ipv4"; + } + ); + + NETWORK_INTERFACES : + { + ENB_INTERFACE_NAME_FOR_S1_MME = "eth2"; + ENB_IPV4_ADDRESS_FOR_S1_MME = "192.168.12.80/24"; + + ENB_INTERFACE_NAME_FOR_S1U = "eth2"; + ENB_IPV4_ADDRESS_FOR_S1U = "192.168.12.80/24"; + ENB_PORT_FOR_S1U = 2152; # Spec 2152 + }; + + log_config : + { + global_log_level ="debug"; + global_log_verbosity ="medium"; + hw_log_level ="info"; + hw_log_verbosity ="medium"; + phy_log_level ="debug"; + phy_log_verbosity ="medium"; + mac_log_level ="debug"; + mac_log_verbosity ="medium"; + rlc_log_level ="info"; + rlc_log_verbosity ="medium"; + pdcp_log_level ="info"; + pdcp_log_verbosity ="medium"; + rrc_log_level ="info"; + rrc_log_verbosity ="medium"; + gtpu_log_level ="error"; + gtpu_log_verbosity ="medium"; + udp_log_level ="error"; + udp_log_verbosity ="medium"; + osa_log_level ="warn"; + osa_log_verbosity ="low"; + }; + + } +); From 08f73c72d829bb1dad6acbc35447be6b168dedf3 Mon Sep 17 00:00:00 2001 From: Xiwen JIANG Date: Tue, 5 Jul 2016 15:11:12 +0200 Subject: [PATCH 198/349] resolve conflict when merge develop --- openair1/PHY/INIT/lte_init.c | 6 ++--- openair1/PHY/LTE_REFSIG/defs.h | 2 +- openair1/PHY/LTE_REFSIG/lte_dl_ue_spec.c | 8 +++---- openair1/PHY/LTE_REFSIG/lte_dl_uespec.c | 4 ++-- openair1/PHY/LTE_TRANSPORT/dlsch_modulation.c | 2 +- openair1/PHY/LTE_TRANSPORT/pilots_ue_spec.c | 4 ++-- openair1/PHY/LTE_TRANSPORT/proto.h | 3 +-- openair1/PHY/MODULATION/ofdm_mod.c | 4 ++-- openair1/SIMULATION/LTE_PHY/dlsim.c | 22 ++----------------- 9 files changed, 18 insertions(+), 37 deletions(-) diff --git a/openair1/PHY/INIT/lte_init.c b/openair1/PHY/INIT/lte_init.c index 218a6b166c..17622db1ae 100644 --- a/openair1/PHY/INIT/lte_init.c +++ b/openair1/PHY/INIT/lte_init.c @@ -1334,7 +1334,7 @@ int phy_init_lte_eNB(PHY_VARS_eNB *phy_vars_eNB, eNB_common_vars->txdataF_BF[eNB_id] = (int32_t **)malloc16(frame_parms->nb_antennas_tx*sizeof(int32_t*)); for (i=0; i<14; i++) { - eNB_common_vars->txdataF[eNB_id][i] = (mod_sym_t*)malloc16_clear( FRAME_LENGTH_COMPLEX_SAMPLES_NO_PREFIX*sizeof(mod_sym_t) ); + eNB_common_vars->txdataF[eNB_id][i] = (int32_t*)malloc16_clear( FRAME_LENGTH_COMPLEX_SAMPLES_NO_PREFIX*sizeof(int32_t) ); #ifdef DEBUG_PHY msg("[openair][LTE_PHY][INIT] lte_eNB_common_vars->txdataF[%d][%d] = %p (%d bytes)\n", eNB_id,i,eNB_common_vars->txdataF[eNB_id][i], @@ -1343,7 +1343,7 @@ int phy_init_lte_eNB(PHY_VARS_eNB *phy_vars_eNB, } for (i=0; inb_antennas_tx; i++) { - eNB_common_vars->txdataF_BF[eNB_id][i] = (mod_sym_t*)malloc16_clear( OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES*sizeof(mod_sym_t) ); + eNB_common_vars->txdataF_BF[eNB_id][i] = (int32_t*)malloc16_clear( OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES*sizeof(int32_t) ); #ifdef USER_MODE eNB_common_vars->txdata[eNB_id][i] = (int32_t*)malloc16_clear( FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(int32_t) ); #else // USER_MODE @@ -1352,7 +1352,7 @@ int phy_init_lte_eNB(PHY_VARS_eNB *phy_vars_eNB, #ifdef DEBUG_PHY msg("[openair][LTE_PHY][INIT] lte_eNB_common_vars->txdataF_BF[%d][%d][%d] = %p (%d bytes)\n", eNB_id,i,j,eNB_common_vars->txdataF_BF[eNB_id][i][j], - OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES*sizeof(mod_sym_t)); + OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES*sizeof(int32_t)); msg("[openair][LTE_PHY][INIT] lte_eNB_common_vars->txdata[%d][%d] = %p\n",eNB_id,i,eNB_common_vars->txdata[eNB_id][i]); #endif } diff --git a/openair1/PHY/LTE_REFSIG/defs.h b/openair1/PHY/LTE_REFSIG/defs.h index 9377368d7d..e8c3f7c807 100644 --- a/openair1/PHY/LTE_REFSIG/defs.h +++ b/openair1/PHY/LTE_REFSIG/defs.h @@ -139,7 +139,7 @@ int lte_dl_cell_spec_rx(PHY_VARS_UE *phy_vars_ue, @param nRB_PDSCH number of allocated PDSCH RBs */ int lte_dl_ue_spec_rx(PHY_VARS_UE *phy_vars_ue, - mod_sym_t *output, + int32_t *output, unsigned char Ns, unsigned char p, int lprime, diff --git a/openair1/PHY/LTE_REFSIG/lte_dl_ue_spec.c b/openair1/PHY/LTE_REFSIG/lte_dl_ue_spec.c index d029f959ed..a1926ba6b4 100644 --- a/openair1/PHY/LTE_REFSIG/lte_dl_ue_spec.c +++ b/openair1/PHY/LTE_REFSIG/lte_dl_ue_spec.c @@ -55,7 +55,7 @@ int Wbar_NCP[8][4] = {{1,1,1,1},{1,-1,1,-1},{1,1,1,1},{1,-1,1,-1},{1,1,-1,-1},{- /* int lte_dl_ue_spec(PHY_VARS_eNB *phy_vars_eNB, uint8_t UE_id, - mod_sym_t *output, + int32_t *output, short amp, uint8_t Ns, uint8_t lprime, @@ -63,7 +63,7 @@ int lte_dl_ue_spec(PHY_VARS_eNB *phy_vars_eNB, int SS_flag) { - mod_sym_t qpsk[4],nqpsk[4]; + int32_t qpsk[4],nqpsk[4]; int16_t k=0,a; int mprime,ind,ind_dword,ind_qpsk_symb; unsigned nushift,kprime; @@ -133,14 +133,14 @@ int lte_dl_ue_spec(PHY_VARS_eNB *phy_vars_eNB, int lte_dl_ue_spec_rx(PHY_VARS_UE *phy_vars_ue, - mod_sym_t *output, + int32_t *output, unsigned char Ns, unsigned char p, int lprime, int SS_flag, uint16_t nRB_PDSCH) { - mod_sym_t qpsk[4],nqpsk[4],*qpsk_p,*output_p; + int32_t qpsk[4],nqpsk[4],*qpsk_p,*output_p; int w,mprime,ind,l,ind_dword,ind_qpsk_symb,nPRB; short pamp; diff --git a/openair1/PHY/LTE_REFSIG/lte_dl_uespec.c b/openair1/PHY/LTE_REFSIG/lte_dl_uespec.c index 7b788514f5..5f30180883 100644 --- a/openair1/PHY/LTE_REFSIG/lte_dl_uespec.c +++ b/openair1/PHY/LTE_REFSIG/lte_dl_uespec.c @@ -133,14 +133,14 @@ int lte_dl_ue_spec(PHY_VARS_eNB *phy_vars_eNB, int lte_dl_ue_spec_rx(PHY_VARS_UE *phy_vars_ue, - mod_sym_t *output, + int32_t *output, unsigned char Ns, unsigned char p, int lprime, int SS_flag, uint16_t nRB_PDSCH) { - mod_sym_t qpsk[4],nqpsk[4],*qpsk_p,*output_p; + int32_t qpsk[4],nqpsk[4],*qpsk_p,*output_p; int w,mprime,ind,l,ind_dword,ind_qpsk_symb,nPRB; short pamp; diff --git a/openair1/PHY/LTE_TRANSPORT/dlsch_modulation.c b/openair1/PHY/LTE_TRANSPORT/dlsch_modulation.c index 723e3eee90..b96d60a8f6 100644 --- a/openair1/PHY/LTE_TRANSPORT/dlsch_modulation.c +++ b/openair1/PHY/LTE_TRANSPORT/dlsch_modulation.c @@ -232,7 +232,7 @@ int allocate_REs_in_RB(PHY_VARS_eNB *phy_vars_eNB, int s=1; int mprime2 = mprime,ind,ind_dword,ind_qpsk_symb; - mod_sym_t qpsk[4]; + int32_t qpsk[4]; gain_lin_QPSK = (int16_t)((amp*ONE_OVER_SQRT2_Q15)>>15); // if (mimo_mode == LARGE_CDD) gain_lin_QPSK>>=1; diff --git a/openair1/PHY/LTE_TRANSPORT/pilots_ue_spec.c b/openair1/PHY/LTE_TRANSPORT/pilots_ue_spec.c index 4651308dfd..4a9010fca0 100644 --- a/openair1/PHY/LTE_TRANSPORT/pilots_ue_spec.c +++ b/openair1/PHY/LTE_TRANSPORT/pilots_ue_spec.c @@ -42,7 +42,7 @@ void generate_ue_spec_pilots(PHY_VARS_eNB *phy_vars_eNB, uint8_t UE_id, - mod_sym_t **txdataF, + int32_t **txdataF, int16_t amp, uint16_t Ntti, uint8_t beamforming_mode) @@ -127,7 +127,7 @@ void generate_ue_spec_pilots(PHY_VARS_eNB *phy_vars_eNB, } /*int generate_ue_spec_pilots_slot(PHY_VARS_eNB *phy_vars_eNB, - mod_sym_t **txdataF, + int32_t **txdataF, int16_t amp, uint16_t slot, int first_pilot_only) diff --git a/openair1/PHY/LTE_TRANSPORT/proto.h b/openair1/PHY/LTE_TRANSPORT/proto.h index 17338ebb78..d775aea822 100644 --- a/openair1/PHY/LTE_TRANSPORT/proto.h +++ b/openair1/PHY/LTE_TRANSPORT/proto.h @@ -306,10 +306,9 @@ int32_t generate_mbsfn_pilot(PHY_VARS_eNB *phy_vars_eNB, int16_t amp, uint16_t subframe); -<<<<<<< HEAD void generate_ue_spec_pilots(PHY_VARS_eNB *phy_vars_eNB, uint8_t UE_id, - mod_sym_t **txdataF, + int32_t **txdataF, int16_t amp, uint16_t Ntti, uint8_t beamforming_mode); diff --git a/openair1/PHY/MODULATION/ofdm_mod.c b/openair1/PHY/MODULATION/ofdm_mod.c index 23d5ed1269..1f7aeb533a 100755 --- a/openair1/PHY/MODULATION/ofdm_mod.c +++ b/openair1/PHY/MODULATION/ofdm_mod.c @@ -296,8 +296,8 @@ void do_OFDM_mod_l(LTE_eNB_COMMON *eNB_common_vars, int eNB_id, uint16_t next_sl int aa, l, slot_offset, slot_offset_F; int8_t UE_id=0; - mod_sym_t **txdataF = eNB_common_vars->txdataF[eNB_id]; - mod_sym_t **txdataF_BF = eNB_common_vars->txdataF_BF[eNB_id]; + int32_t **txdataF = eNB_common_vars->txdataF[eNB_id]; + int32_t **txdataF_BF = eNB_common_vars->txdataF_BF[eNB_id]; int32_t **txdata = eNB_common_vars->txdata[eNB_id]; //slot_offset_F = (next_slot)*(frame_parms->ofdm_symbol_size)*((frame_parms->Ncp==1) ? 6 : 7); diff --git a/openair1/SIMULATION/LTE_PHY/dlsim.c b/openair1/SIMULATION/LTE_PHY/dlsim.c index 886d02c954..378c79803b 100644 --- a/openair1/SIMULATION/LTE_PHY/dlsim.c +++ b/openair1/SIMULATION/LTE_PHY/dlsim.c @@ -505,11 +505,8 @@ int main(int argc, char **argv) exit(-1); } - if (transmission_mode>1 && transmission_mode<7){ + if (transmission_mode>1 && transmission_mode<7) { n_tx_port = 2; - n_tx_phy = n_tx_port; - } else if (transmission_mode==7){ - n_tx_port = 1; } break; @@ -521,14 +518,10 @@ int main(int argc, char **argv) if(n_tx_phy==1) { msg("n_tx_phy must be >1 for transmission_mode %d\n",transmission_mode); exit(-1); - } else if (n_tx_phy!=n_tx_port) { // to be changed - msg("For transmission mode TM2-TM6, physical antenna number should be the same as antenna port number.\n"); - exit(-1); - } + } } if (transmission_mode==7 && (n_tx_phy!=1 && n_tx_phy!=2 && n_tx_phy!=4 && n_tx_phy!=8 && n_tx_phy!=16 && n_tx_phy!=64 && n_tx_phy!=128)) { - // if (transmission_mode==7 && (n_tx_phy!=1 && n_tx_phy!=2 && n_tx_phy!=4 && n_tx_phy!=16 && n_tx_phy!=64)) { msg("Physical number of antennas not supported for TM7.\n"); exit(-1); } @@ -616,8 +609,6 @@ int main(int argc, char **argv) } else NB_RB = 4; - /*if ((transmission_mode > 1) && (n_tx != 2)) - printf("n_tx must be >1 for transmission_mode %d\n",transmission_mode);*/ if (xforms==1) { fl_initialize (&argc, argv, NULL, 0, 0); @@ -673,15 +664,6 @@ int main(int argc, char **argv) snr1 = snr0+snr_int; printf("SNR0 %f, SNR1 %f\n",snr0,snr1); - /* - txdataF = (int **)malloc16(2*sizeof(int*)); - txdataF[0] = (int *)malloc16(FRAME_LENGTH_BYTES); - txdataF[1] = (int *)malloc16(FRAME_LENGTH_BYTES); - - txdata = (int **)malloc16(2*sizeof(int*)); - txdata[0] = (int *)malloc16(FRAME_LENGTH_BYTES); - txdata[1] = (int *)malloc16(FRAME_LENGTH_BYTES); - */ s_re = malloc(n_tx_phy*sizeof(double*)); s_im = malloc(n_tx_phy*sizeof(double*)); From 35bdc94092db108dec4ec5a07ec76e3d4ce75051 Mon Sep 17 00:00:00 2001 From: Florian Kaltenberger Date: Wed, 6 Jul 2016 10:28:27 +0200 Subject: [PATCH 199/349] fixing a few bugs after merge --- openair1/PHY/INIT/lte_init.c | 6 +++--- openair1/PHY/LTE_REFSIG/defs.h | 2 +- openair1/PHY/LTE_REFSIG/lte_dl_uespec.c | 4 ++-- openair1/PHY/LTE_TRANSPORT/dlsch_modulation.c | 2 +- openair1/PHY/LTE_TRANSPORT/proto.h | 3 +-- openair1/PHY/MODULATION/ofdm_mod.c | 4 ++-- targets/RT/USER/lte-softmodem.c | 4 ++-- 7 files changed, 12 insertions(+), 13 deletions(-) diff --git a/openair1/PHY/INIT/lte_init.c b/openair1/PHY/INIT/lte_init.c index 218a6b166c..17622db1ae 100644 --- a/openair1/PHY/INIT/lte_init.c +++ b/openair1/PHY/INIT/lte_init.c @@ -1334,7 +1334,7 @@ int phy_init_lte_eNB(PHY_VARS_eNB *phy_vars_eNB, eNB_common_vars->txdataF_BF[eNB_id] = (int32_t **)malloc16(frame_parms->nb_antennas_tx*sizeof(int32_t*)); for (i=0; i<14; i++) { - eNB_common_vars->txdataF[eNB_id][i] = (mod_sym_t*)malloc16_clear( FRAME_LENGTH_COMPLEX_SAMPLES_NO_PREFIX*sizeof(mod_sym_t) ); + eNB_common_vars->txdataF[eNB_id][i] = (int32_t*)malloc16_clear( FRAME_LENGTH_COMPLEX_SAMPLES_NO_PREFIX*sizeof(int32_t) ); #ifdef DEBUG_PHY msg("[openair][LTE_PHY][INIT] lte_eNB_common_vars->txdataF[%d][%d] = %p (%d bytes)\n", eNB_id,i,eNB_common_vars->txdataF[eNB_id][i], @@ -1343,7 +1343,7 @@ int phy_init_lte_eNB(PHY_VARS_eNB *phy_vars_eNB, } for (i=0; inb_antennas_tx; i++) { - eNB_common_vars->txdataF_BF[eNB_id][i] = (mod_sym_t*)malloc16_clear( OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES*sizeof(mod_sym_t) ); + eNB_common_vars->txdataF_BF[eNB_id][i] = (int32_t*)malloc16_clear( OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES*sizeof(int32_t) ); #ifdef USER_MODE eNB_common_vars->txdata[eNB_id][i] = (int32_t*)malloc16_clear( FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(int32_t) ); #else // USER_MODE @@ -1352,7 +1352,7 @@ int phy_init_lte_eNB(PHY_VARS_eNB *phy_vars_eNB, #ifdef DEBUG_PHY msg("[openair][LTE_PHY][INIT] lte_eNB_common_vars->txdataF_BF[%d][%d][%d] = %p (%d bytes)\n", eNB_id,i,j,eNB_common_vars->txdataF_BF[eNB_id][i][j], - OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES*sizeof(mod_sym_t)); + OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES*sizeof(int32_t)); msg("[openair][LTE_PHY][INIT] lte_eNB_common_vars->txdata[%d][%d] = %p\n",eNB_id,i,eNB_common_vars->txdata[eNB_id][i]); #endif } diff --git a/openair1/PHY/LTE_REFSIG/defs.h b/openair1/PHY/LTE_REFSIG/defs.h index 9377368d7d..e8c3f7c807 100644 --- a/openair1/PHY/LTE_REFSIG/defs.h +++ b/openair1/PHY/LTE_REFSIG/defs.h @@ -139,7 +139,7 @@ int lte_dl_cell_spec_rx(PHY_VARS_UE *phy_vars_ue, @param nRB_PDSCH number of allocated PDSCH RBs */ int lte_dl_ue_spec_rx(PHY_VARS_UE *phy_vars_ue, - mod_sym_t *output, + int32_t *output, unsigned char Ns, unsigned char p, int lprime, diff --git a/openair1/PHY/LTE_REFSIG/lte_dl_uespec.c b/openair1/PHY/LTE_REFSIG/lte_dl_uespec.c index 7b788514f5..5f30180883 100644 --- a/openair1/PHY/LTE_REFSIG/lte_dl_uespec.c +++ b/openair1/PHY/LTE_REFSIG/lte_dl_uespec.c @@ -133,14 +133,14 @@ int lte_dl_ue_spec(PHY_VARS_eNB *phy_vars_eNB, int lte_dl_ue_spec_rx(PHY_VARS_UE *phy_vars_ue, - mod_sym_t *output, + int32_t *output, unsigned char Ns, unsigned char p, int lprime, int SS_flag, uint16_t nRB_PDSCH) { - mod_sym_t qpsk[4],nqpsk[4],*qpsk_p,*output_p; + int32_t qpsk[4],nqpsk[4],*qpsk_p,*output_p; int w,mprime,ind,l,ind_dword,ind_qpsk_symb,nPRB; short pamp; diff --git a/openair1/PHY/LTE_TRANSPORT/dlsch_modulation.c b/openair1/PHY/LTE_TRANSPORT/dlsch_modulation.c index 723e3eee90..b96d60a8f6 100644 --- a/openair1/PHY/LTE_TRANSPORT/dlsch_modulation.c +++ b/openair1/PHY/LTE_TRANSPORT/dlsch_modulation.c @@ -232,7 +232,7 @@ int allocate_REs_in_RB(PHY_VARS_eNB *phy_vars_eNB, int s=1; int mprime2 = mprime,ind,ind_dword,ind_qpsk_symb; - mod_sym_t qpsk[4]; + int32_t qpsk[4]; gain_lin_QPSK = (int16_t)((amp*ONE_OVER_SQRT2_Q15)>>15); // if (mimo_mode == LARGE_CDD) gain_lin_QPSK>>=1; diff --git a/openair1/PHY/LTE_TRANSPORT/proto.h b/openair1/PHY/LTE_TRANSPORT/proto.h index 17338ebb78..d775aea822 100644 --- a/openair1/PHY/LTE_TRANSPORT/proto.h +++ b/openair1/PHY/LTE_TRANSPORT/proto.h @@ -306,10 +306,9 @@ int32_t generate_mbsfn_pilot(PHY_VARS_eNB *phy_vars_eNB, int16_t amp, uint16_t subframe); -<<<<<<< HEAD void generate_ue_spec_pilots(PHY_VARS_eNB *phy_vars_eNB, uint8_t UE_id, - mod_sym_t **txdataF, + int32_t **txdataF, int16_t amp, uint16_t Ntti, uint8_t beamforming_mode); diff --git a/openair1/PHY/MODULATION/ofdm_mod.c b/openair1/PHY/MODULATION/ofdm_mod.c index 23d5ed1269..1f7aeb533a 100755 --- a/openair1/PHY/MODULATION/ofdm_mod.c +++ b/openair1/PHY/MODULATION/ofdm_mod.c @@ -296,8 +296,8 @@ void do_OFDM_mod_l(LTE_eNB_COMMON *eNB_common_vars, int eNB_id, uint16_t next_sl int aa, l, slot_offset, slot_offset_F; int8_t UE_id=0; - mod_sym_t **txdataF = eNB_common_vars->txdataF[eNB_id]; - mod_sym_t **txdataF_BF = eNB_common_vars->txdataF_BF[eNB_id]; + int32_t **txdataF = eNB_common_vars->txdataF[eNB_id]; + int32_t **txdataF_BF = eNB_common_vars->txdataF_BF[eNB_id]; int32_t **txdata = eNB_common_vars->txdata[eNB_id]; //slot_offset_F = (next_slot)*(frame_parms->ofdm_symbol_size)*((frame_parms->Ncp==1) ? 6 : 7); diff --git a/targets/RT/USER/lte-softmodem.c b/targets/RT/USER/lte-softmodem.c index 38723e6152..8b48148955 100644 --- a/targets/RT/USER/lte-softmodem.c +++ b/targets/RT/USER/lte-softmodem.c @@ -3069,7 +3069,7 @@ int main( int argc, char **argv ) for (CC_id=0; CC_idNid_cell,cooperation_flag,transmission_mode,abstraction_flag); + PHY_vars_eNB_g[0][CC_id] = init_lte_eNB(frame_parms[CC_id],0,frame_parms[CC_id]->Nid_cell,cooperation_flag,abstraction_flag); PHY_vars_eNB_g[0][CC_id]->CC_id = CC_id; if (phy_test==1) From a5b57ddce4b5a8f3538c72a39235e09ca263158f Mon Sep 17 00:00:00 2001 From: Xiwen JIANG Date: Wed, 6 Jul 2016 15:01:58 +0200 Subject: [PATCH 200/349] dci decoding procedure --- openair1/PHY/INIT/lte_init.c | 4 ++-- openair1/PHY/LTE_TRANSPORT/dci.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/openair1/PHY/INIT/lte_init.c b/openair1/PHY/INIT/lte_init.c index 17622db1ae..f667379331 100644 --- a/openair1/PHY/INIT/lte_init.c +++ b/openair1/PHY/INIT/lte_init.c @@ -473,7 +473,7 @@ void phy_config_dedicated_eNB_step2(PHY_VARS_eNB *phy_vars_eNB) if (physicalConfigDedicated->antennaInfo) { phy_vars_eNB->transmission_mode[UE_id] = 1+(physicalConfigDedicated->antennaInfo->choice.explicitValue.transmissionMode); - LOG_D(PHY,"Transmission Mode %d\n",phy_vars_eNB->transmission_mode[UE_id]); + LOG_D(PHY,"eNB:Transmission Mode %d\n",phy_vars_eNB->transmission_mode[UE_id]); LOG_D(PHY,"\n"); } @@ -845,7 +845,7 @@ void phy_config_dedicated_ue(uint8_t Mod_id,int CC_id,uint8_t CH_index, if (physicalConfigDedicated->antennaInfo) { phy_vars_ue->transmission_mode[CH_index] = 1+(physicalConfigDedicated->antennaInfo->choice.explicitValue.transmissionMode); - LOG_D(PHY,"Transmission Mode %d\n",phy_vars_ue->transmission_mode[CH_index]); + LOG_D(PHY,"UE:Transmission Mode %d\n",phy_vars_ue->transmission_mode[CH_index]); LOG_D(PHY,"\n"); switch(physicalConfigDedicated->antennaInfo->choice.explicitValue.transmissionMode) { case AntennaInfoDedicated__transmissionMode_tm1: diff --git a/openair1/PHY/LTE_TRANSPORT/dci.c b/openair1/PHY/LTE_TRANSPORT/dci.c index d7fc7042a5..da2fe77141 100644 --- a/openair1/PHY/LTE_TRANSPORT/dci.c +++ b/openair1/PHY/LTE_TRANSPORT/dci.c @@ -3339,7 +3339,7 @@ uint16_t dci_decoding_procedure(PHY_VARS_UE *phy_vars_ue, // These are for CRNTI based on transmission mode - if (tmode < 3) { + if ((tmode < 3) || (tmode == 7)) { // Now check UE_SPEC format 1 search spaces at aggregation 1 old_dci_cnt=dci_cnt; dci_decoding_procedure0(lte_ue_pdcch_vars,0,subframe, @@ -3684,7 +3684,7 @@ uint16_t dci_decoding_procedure(PHY_VARS_UE *phy_vars_ue, &CCEmap1, &CCEmap2); //#endif - } else if (tmode >=5) { // This is MU-MIMO + } else if ((tmode==5) || (tmode==6)) { // This is MU-MIMO // Now check UE_SPEC format 1E_2A_M10PRB search spaces aggregation 1 #ifdef DEBUG_DCI_DECODING From 4763438131a7ab3ca3ae31bb0147dbf39f0cdcbb Mon Sep 17 00:00:00 2001 From: Xiwen JIANG Date: Fri, 15 Jul 2016 16:48:41 +0200 Subject: [PATCH 201/349] bug fixed for ue_spec_bf_weights initialisation --- .../oaisim_noS1_build_oai/CMakeLists.template | 1 - openair1/PHY/INIT/lte_init.c | 24 ------------- .../lte_dl_bf_channel_estimation.c | 2 +- openair1/PHY/LTE_TRANSPORT/dlsch_coding.c | 8 ----- openair1/PHY/MODULATION/beamforming.c | 22 ++++++------ openair1/SCHED/phy_procedures_lte_ue.c | 11 ++++++ openair1/SIMULATION/LTE_PHY/dlsim.c | 35 ++++++++++++------- targets/SIMU/USER/init_lte.c | 14 +++++++- 8 files changed, 59 insertions(+), 58 deletions(-) diff --git a/cmake_targets/oaisim_noS1_build_oai/CMakeLists.template b/cmake_targets/oaisim_noS1_build_oai/CMakeLists.template index 6d8fc6d26a..20015eb42a 100644 --- a/cmake_targets/oaisim_noS1_build_oai/CMakeLists.template +++ b/cmake_targets/oaisim_noS1_build_oai/CMakeLists.template @@ -1,6 +1,5 @@ cmake_minimum_required(VERSION 2.8) -set ( CMAKE_BUILD_TYPE "RelWithDebInfo" ) set ( ADDR_CONF False ) set ( DEBUG_OMG False ) set ( DISABLE_XER_PRINT False ) diff --git a/openair1/PHY/INIT/lte_init.c b/openair1/PHY/INIT/lte_init.c index f667379331..9780f226bd 100644 --- a/openair1/PHY/INIT/lte_init.c +++ b/openair1/PHY/INIT/lte_init.c @@ -1357,18 +1357,6 @@ int phy_init_lte_eNB(PHY_VARS_eNB *phy_vars_eNB, #endif } - /*for (i=0; i<2; i++) { // 2 is the total number of cell specific antenna ports - eNB_common_vars->cell_spec_bf_weights[eNB_id][i] = (int32_t **)malloc16_clear(frame_parms->nb_antennas_tx*sizeof(int32_t*)); - for (j=0; jnb_antennas_tx; j++) { - eNB_common_vars->cell_spec_bf_weights[eNB_id][i][j] = (int32_t *)malloc16_clear(OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES*sizeof(int32_t)); -#ifdef DEBUG_PUY - msg("[openair][LTE_PHY][INIT] lte_eNB_common_vars->cell_spec_bf_weights[%d][%d][%d] = %p (%d bytes)\n", - eNB_id,i,j,eNB_common_vars->cell_spec_bf_weights[eNB_id][i][j], - OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES*sizeof(int32_t)); -#endif - } - } */ - for (i=0; i<15; i++) { // 15 is the total number of antenna ports eNB_common_vars->beam_weights[eNB_id][i] = (int32_t **)malloc16_clear(frame_parms->nb_antennas_tx*sizeof(int32_t*)); for (j=0; jnb_antennas_tx; j++) { @@ -1383,18 +1371,6 @@ int phy_init_lte_eNB(PHY_VARS_eNB *phy_vars_eNB, } } - /*for (i=0; i<8; i++) { //antenna port 5 for TM7, antenna port 7-15 for TM8-10 - eNB_common_vars->ue_spec_bf_weights[eNB_id][i] = (int32_t **)malloc16_clear(frame_parms->nb_antennas_tx*sizeof(int32_t*)); - for (j=0; jnb_antennas_tx; j++) { - eNB_common_vars->ue_spec_bf_weights[eNB_id][i][j] = (int32_t*)malloc16_clear(OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES*sizeof(int32_t)); -#ifdef DEBUG_PUY - msg("[openair][LTE_PHY][INIT] lte_eNB_common_vars->ue_spec_bf_weights[%d][%d][%d] = %p (%d bytes)\n", - eNB_id,i,j,eNB_common_vars->ue_spec_bf_weights[eNB_id][i][j], - OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES*sizeof(int32_t)); -#endif - } - } */ - // RX vars eNB_common_vars->rxdata[eNB_id] = (int32_t**)malloc16(frame_parms->nb_antennas_rx*sizeof(int32_t*) ); eNB_common_vars->rxdata_7_5kHz[eNB_id] = (int32_t**)malloc16(frame_parms->nb_antennas_rx*sizeof(int32_t*) ); diff --git a/openair1/PHY/LTE_ESTIMATION/lte_dl_bf_channel_estimation.c b/openair1/PHY/LTE_ESTIMATION/lte_dl_bf_channel_estimation.c index 5fecc9c34f..80df031c41 100644 --- a/openair1/PHY/LTE_ESTIMATION/lte_dl_bf_channel_estimation.c +++ b/openair1/PHY/LTE_ESTIMATION/lte_dl_bf_channel_estimation.c @@ -708,7 +708,7 @@ int lte_dl_bf_channel_estimation(PHY_VARS_UE *phy_vars_ue, } } //aarx - //printf("[dlsch bf ch est]: dl_bf_estimates[0][600] %d, %d \n",*(short *)&dl_bf_ch_estimates[0][600],*(short*)&phy_vars_ue->lte_ue_pdsch_vars[eNB_id]->dl_bf_ch_estimates[0][600]); + // printf("[dlsch bf ch est]: dl_bf_estimates[0][600] %d, %d \n",*(short *)&dl_bf_ch_estimates[0][600],*(short*)&phy_vars_ue->lte_ue_pdsch_vars[eNB_id]->dl_bf_ch_estimates[0][600]); return(0); diff --git a/openair1/PHY/LTE_TRANSPORT/dlsch_coding.c b/openair1/PHY/LTE_TRANSPORT/dlsch_coding.c index e79aa11feb..48498a4873 100644 --- a/openair1/PHY/LTE_TRANSPORT/dlsch_coding.c +++ b/openair1/PHY/LTE_TRANSPORT/dlsch_coding.c @@ -204,14 +204,6 @@ LTE_eNB_DLSCH_t *new_eNB_dlsch(unsigned char Kmimo,unsigned char Mdlharq,uint32_ put_harq_pid_in_freelist(dlsch, i); } - for (i=0; i<4; i++) { - dlsch->ue_spec_bf_weights[i] = (int32_t **)malloc16(nb_antennas_tx*sizeof(int32_t*)); - - for (aa=0; aaue_spec_bf_weights[i][aa] = (int32_t *)malloc16(OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES*sizeof(int32_t)); - } - } - if (exit_flag==0) { for (i=0; iharq_processes[i]->round=0; diff --git a/openair1/PHY/MODULATION/beamforming.c b/openair1/PHY/MODULATION/beamforming.c index e37ab0e430..2e38b7cb93 100644 --- a/openair1/PHY/MODULATION/beamforming.c +++ b/openair1/PHY/MODULATION/beamforming.c @@ -91,16 +91,18 @@ int beam_precoding(int32_t **txdataF, ((int16_t*)&txdataF_BF[aa][re])[0] -= (int16_t)((((int16_t*)&txdataF[5][slot_offset_F+symbol*frame_parms->ofdm_symbol_size+re])[1]*((int16_t*)&beam_weights[5][aa][re])[1])>>15); ((int16_t*)&txdataF_BF[aa][re])[1] = (int16_t)((((int16_t*)&txdataF[5][slot_offset_F+symbol*frame_parms->ofdm_symbol_size+re])[0]*((int16_t*)&beam_weights[5][aa][re])[1])>>15); ((int16_t*)&txdataF_BF[aa][re])[1] += (int16_t)((((int16_t*)&txdataF[5][slot_offset_F+symbol*frame_parms->ofdm_symbol_size+re])[1]*((int16_t*)&beam_weights[5][aa][re])[0])>>15); - // printf("beamforming.c:txdata[%d][%d]=%d+j%d, beam_weights[%d][%d][%d]=%d+j%d,txdata_BF[%d][%d]=%d+j%d\n", - // p,slot_offset_F+symbol*frame_parms->ofdm_symbol_size+re, - // ((int16_t*)&txdataF[p][slot_offset_F+symbol*frame_parms->ofdm_symbol_size+re])[0], - // ((int16_t*)&txdataF[p][slot_offset_F+symbol*frame_parms->ofdm_symbol_size+re])[1], - // p,aa,re, - // ((int16_t*)&beam_weights[p][aa][re])[0],((int16_t*)&beam_weights[p][aa][re])[1], - // aa,re, - // ((int16_t*)&txdataF_BF[aa][re])[0], - // ((int16_t*)&txdataF_BF[aa][re])[1]); - +/* + printf("beamforming.c:txdata[5][%d]=%d+j%d, beam_weights[5][%d][%d]=%d+j%d,txdata_BF[%d][%d]=%d+j%d\n", + slot_offset_F+symbol*frame_parms->ofdm_symbol_size+re, + ((int16_t*)&txdataF[5][slot_offset_F+symbol*frame_parms->ofdm_symbol_size+re])[0], + ((int16_t*)&txdataF[5][slot_offset_F+symbol*frame_parms->ofdm_symbol_size+re])[1], + aa,re, + ((int16_t*)&beam_weights[5][aa][re])[0], + ((int16_t*)&beam_weights[5][aa][re])[1], + aa,re, + ((int16_t*)&txdataF_BF[aa][re])[0], + ((int16_t*)&txdataF_BF[aa][re])[1]); +*/ } } diff --git a/openair1/SCHED/phy_procedures_lte_ue.c b/openair1/SCHED/phy_procedures_lte_ue.c index 9241c59508..36a7f525e3 100755 --- a/openair1/SCHED/phy_procedures_lte_ue.c +++ b/openair1/SCHED/phy_procedures_lte_ue.c @@ -2557,10 +2557,21 @@ int phy_procedures_UE_RX(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstrac if ((slot_rx%2)==1) // odd slots phy_vars_ue->dlsch_ue[eNB_id][0]->active = 0; } + } #endif + if (phy_vars_ue->dlsch_ue[eNB_id][0]->active == 1) { + if (phy_vars_ue->transmission_mode[eNB_id]==7) { + if (phy_vars_ue->lte_frame_parms.Ncp==0) { + if (((slot_rx%2)==0 && ((l==3) || (l==6))) || ((slot_rx%2)==1 && ((l==2) || (l==5)))) + lte_dl_bf_channel_estimation(phy_vars_ue,eNB_id,0,slot_rx,5,l+7*(slot_rx%2==1)); + } else { + LOG_E(PHY,"[UE %d]Beamforming channel estimation not supported yet for TM7 extented CP.\n",phy_vars_ue->Mod_id); + } + } + } // process last DLSCH symbols + invoke decoding if (((slot_rx%2)==0) && (l==0)) { // Regular PDSCH diff --git a/openair1/SIMULATION/LTE_PHY/dlsim.c b/openair1/SIMULATION/LTE_PHY/dlsim.c index 378c79803b..dd535064d1 100644 --- a/openair1/SIMULATION/LTE_PHY/dlsim.c +++ b/openair1/SIMULATION/LTE_PHY/dlsim.c @@ -119,7 +119,8 @@ int main(int argc, char **argv) uint8_t extended_prefix_flag=0,transmission_mode=1,n_tx_port=1,n_tx_phy=1,n_rx=1; uint16_t Nid_cell=0; - int32_t **ue_spec_bf_weights, **cell_spec_bf_weights; + int32_t **cell_spec_bf_weights; + int32_t *ue_spec_bf_weights; int eNB_id = 0, eNB_id_i = 1; unsigned char mcs1=0,mcs2=0,mcs_i=0,dual_stream_UE = 0,awgn_flag=0,round,dci_flag=0; @@ -932,23 +933,31 @@ int main(int argc, char **argv) exit(-1); } else { // this initilisation may should be moved to another place - for (j=0; j<4; j++) { // antenna port 5,7-14 + for (j=0; j<4; j++) { + PHY_vars_eNB->dlsch_eNB[k][i]->ue_spec_bf_weights[j] = (int32_t **)malloc16(n_tx_phy*sizeof(int32_t*)); + + for (aa=0; aadlsch_eNB[k][i]->ue_spec_bf_weights[j][aa] = (int32_t *)malloc16(OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES*sizeof(int32_t)); + ue_spec_bf_weights = PHY_vars_eNB->dlsch_eNB[k][i]->ue_spec_bf_weights[j][aa]; + + for (re=0;reofdm_symbol_size;re++) { + if (n_tx_phy==1 || n_tx_phy==2) + ue_spec_bf_weights[re] = 0x00007fff; + else if (n_tx_phy==4 || n_tx_phy==8) + ue_spec_bf_weights[re] = 0x00007fff>>1; + else if (n_tx_phy==16) + ue_spec_bf_weights[re] = 0x00007fff>>2; + else if (n_tx_phy==64) + ue_spec_bf_weights[re] = 0x00007fff>>4; + } + + } + } ue_spec_bf_weights = PHY_vars_eNB->dlsch_eNB[k][i]->ue_spec_bf_weights[j]; for (aa=0; aanb_antennas_tx; aa++) { - for (re=0;reofdm_symbol_size;re++) { - if (n_tx_phy==1 || n_tx_phy==2) - ue_spec_bf_weights[aa][re] = 0x00007fff; - else if (n_tx_phy==4 || n_tx_phy==8) - ue_spec_bf_weights[aa][re] = 0x00007fff>>1; - else if (n_tx_phy==16) - ue_spec_bf_weights[aa][re] = 0x00007fff>>2; - else if (n_tx_phy==64) - ue_spec_bf_weights[aa][re] = 0x00007fff>>4; - } } - } } PHY_vars_eNB->dlsch_eNB[k][i]->rnti = n_rnti+k; diff --git a/targets/SIMU/USER/init_lte.c b/targets/SIMU/USER/init_lte.c index 985cb6036c..512187a52b 100644 --- a/targets/SIMU/USER/init_lte.c +++ b/targets/SIMU/USER/init_lte.c @@ -53,7 +53,7 @@ PHY_VARS_eNB* init_lte_eNB(LTE_DL_FRAME_PARMS *frame_parms, uint8_t abstraction_flag) { - int i,j; + int i,j,layer,aa,re; PHY_VARS_eNB* PHY_vars_eNB = malloc(sizeof(PHY_VARS_eNB)); memset(PHY_vars_eNB,0,sizeof(PHY_VARS_eNB)); PHY_vars_eNB->Mod_id=eNB_id; @@ -79,6 +79,18 @@ PHY_VARS_eNB* init_lte_eNB(LTE_DL_FRAME_PARMS *frame_parms, } else { LOG_D(PHY,"dlsch_eNB[%d][%d] => %p\n",i,j,PHY_vars_eNB->dlsch_eNB[i][j]); PHY_vars_eNB->dlsch_eNB[i][j]->rnti=0; + + for (layer=0; layer<4; layer++) { + PHY_vars_eNB->dlsch_eNB[i][j]->ue_spec_bf_weights[layer] = (int32_t **)malloc16(frame_parms->nb_antennas_tx*sizeof(int32_t*)); + + for (aa=0; aanb_antennas_tx; aa++) { + PHY_vars_eNB->dlsch_eNB[i][j]->ue_spec_bf_weights[layer][aa] = (int32_t *)malloc16(OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES*sizeof(int32_t)); + for (re=0;redlsch_eNB[i][j]->ue_spec_bf_weights[layer][aa][re] = 0x00007fff; + } + } + } + } } From 79e8653f03c1dfadec022922d7a441e2a0d42edd Mon Sep 17 00:00:00 2001 From: Xiwen JIANG Date: Fri, 15 Jul 2016 16:52:08 +0200 Subject: [PATCH 202/349] add read_F.c to openairinterface1/PHY/TOOLS --- openair1/PHY/TOOLS/read_F.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 openair1/PHY/TOOLS/read_F.c diff --git a/openair1/PHY/TOOLS/read_F.c b/openair1/PHY/TOOLS/read_F.c new file mode 100644 index 0000000000..32ade0dfdb --- /dev/null +++ b/openair1/PHY/TOOLS/read_F.c @@ -0,0 +1,24 @@ +#include +#include + +int f_read(char *calibF_fname, int nb_antM, int nb_freq, int16_t (*calibF_mtx)[nb_freq*2]){ + + FILE *calibF_fd; + int i,j,l,calibF_e; + + calibF_fd = fopen(calibF_fname,"r"); + + if (calibF_fd) { + printf("Loading Calibration matrix from %s\n", calibF_fname); + + for(i=0;i Date: Fri, 22 Jul 2016 19:51:24 +0200 Subject: [PATCH 203/349] change the MAX_CARDS to 16 --- targets/ARCH/EXMIMO/DEFS/openair_device.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/targets/ARCH/EXMIMO/DEFS/openair_device.h b/targets/ARCH/EXMIMO/DEFS/openair_device.h index 2be7b7f088..519693461e 100755 --- a/targets/ARCH/EXMIMO/DEFS/openair_device.h +++ b/targets/ARCH/EXMIMO/DEFS/openair_device.h @@ -33,8 +33,8 @@ // Maximum number of concurrently supported cards // -#define MAX_CARDS 8 -#define INIT_ZEROS {0, 0, 0, 0, 0, 0, 0, 0}; +#define MAX_CARDS 16 +#define INIT_ZEROS {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; /** PCIe subsystem configuration Space From 987ffdd8a0b6122efca57a652ee8204e738f786a Mon Sep 17 00:00:00 2001 From: Xiwen JIANG Date: Mon, 25 Jul 2016 14:25:22 +0200 Subject: [PATCH 204/349] add ue spec channel estimation in UE RX procedure (TM7 works for DLSCH) --- .../lte_dl_bf_channel_estimation.c | 70 ++++++++++++++----- openair1/SCHED/phy_procedures_lte_ue.c | 29 +++++--- 2 files changed, 71 insertions(+), 28 deletions(-) diff --git a/openair1/PHY/LTE_ESTIMATION/lte_dl_bf_channel_estimation.c b/openair1/PHY/LTE_ESTIMATION/lte_dl_bf_channel_estimation.c index 80df031c41..4d20cfe522 100644 --- a/openair1/PHY/LTE_ESTIMATION/lte_dl_bf_channel_estimation.c +++ b/openair1/PHY/LTE_ESTIMATION/lte_dl_bf_channel_estimation.c @@ -32,7 +32,7 @@ #include "defs.h" #include "PHY/defs.h" #include "filt16_32.h" -//#define DEBUG_CH +//#define DEBUG_BF_CH int lte_dl_bf_channel_estimation(PHY_VARS_UE *phy_vars_ue, uint8_t eNB_id, @@ -373,19 +373,25 @@ int lte_dl_bf_channel_estimation(PHY_VARS_UE *phy_vars_ue, ch[0] = (short)(((int)pil[0]*rxF[0] - (int)pil[1]*rxF[1])>>15); ch[1] = (short)(((int)pil[0]*rxF[1] + (int)pil[1]*rxF[0])>>15); multadd_real_vector_complex_scalar(fl,ch,dl_bf_ch,16); - //printf("symbol=%d,rxF[%d]=(%d,%d),pil=(%d,%d),ch=(%d,%d)\n",symbol,pil_offset,rxF[0],rxF[1],pil[0],pil[1],ch[0],ch[1]); +#ifdef DEBUG_BF_CH + printf("symbol=%d,rxF[0]=(%d,%d),pil=(%d,%d),ch=(%d,%d)\n",symbol,rxF[0],rxF[1],pil[0],pil[1],ch[0],ch[1]); +#endif pil+=2; ch[0] = (short)(((int)pil[0]*rxF[8] - (int)pil[1]*rxF[9])>>15); ch[1] = (short)(((int)pil[0]*rxF[9] + (int)pil[1]*rxF[8])>>15); multadd_real_vector_complex_scalar(fm,ch,dl_bf_ch,16); - //printf("symbol=%d,rxF[%d]=(%d,%d),pil=(%d,%d),ch=(%d,%d)\n",symbol,pil_offset,rxF[8],rxF[9],pil[0],pil[1],ch[0],ch[1]); +#ifdef DEBUG_BF_CH + printf("symbol=%d,rxF[4]=(%d,%d),pil=(%d,%d),ch=(%d,%d)\n",symbol,rxF[8],rxF[9],pil[0],pil[1],ch[0],ch[1]); +#endif pil+=2; ch[0] = (short)(((int)pil[0]*rxF[16] - (int)pil[1]*rxF[17])>>15); ch[1] = (short)(((int)pil[0]*rxF[17] + (int)pil[1]*rxF[16])>>15); multadd_real_vector_complex_scalar(fr,ch,dl_bf_ch,16); - //printf("symbol=%d,rxF[%d]=(%d,%d),pil=(%d,%d),ch=(%d,%d)\n",symbol,pil_offset,rxF[16],rxF[17],pil[0],pil[1],ch[0],ch[1]); +#ifdef DEBUG_BF_CH + printf("symbol=%d,rxF[8]=(%d,%d),pil=(%d,%d),ch=(%d,%d)\n",symbol,rxF[16],rxF[17],pil[0],pil[1],ch[0],ch[1]); +#endif pil+=2; } @@ -447,13 +453,17 @@ int lte_dl_bf_channel_estimation(PHY_VARS_UE *phy_vars_ue, ch[0] = (short)(((int)pil[0]*rxF[0] - (int)pil[1]*rxF[1])>>15); ch[1] = (short)(((int)pil[0]*rxF[1] + (int)pil[1]*rxF[0])>>15); multadd_real_vector_complex_scalar(fl_dc,ch,dl_bf_ch,16); - //printf("symbol=%d,rxF[%d]=(%d,%d),pil=(%d,%d),ch=(%d,%d)\n",symbol,pil_offset,rxF[0],rxF[1],pil[0],pil[1],ch[0],ch[1]); +#ifdef DEBUG_BF_CH + //printf("symbol=%d,rxF[0]=(%d,%d),pil=(%d,%d),ch=(%d,%d)\n",symbol,rxF[0],rxF[1],pil[0],pil[1],ch[0],ch[1]); +#endif pil+=2;; ch[0] = (short)(((int)pil[0]*rxF[8] - (int)pil[1]*rxF[9])>>15); ch[1] = (short)(((int)pil[0]*rxF[9] + (int)pil[1]*rxF[8])>>15); multadd_real_vector_complex_scalar(fm_dc,ch,dl_bf_ch,16); - //printf("symbol=%d,rxF[%d]=(%d,%d),pil=(%d,%d),ch=(%d,%d)\n",symbol,pil_offset,rxF[8],rxF[9],pil[0],pil[1],ch[0],ch[1]); +#ifdef DEBUG_BF_CH + //printf("symbol=%d,rxF[4]=(%d,%d),pil=(%d,%d),ch=(%d,%d)\n",symbol,rxF[8],rxF[9],pil[0],pil[1],ch[0],ch[1]); +#endif pil+=2;; rxF = (short *)&rxdataF[aarx][symbol*(frame_parms->ofdm_symbol_size)]; @@ -461,13 +471,17 @@ int lte_dl_bf_channel_estimation(PHY_VARS_UE *phy_vars_ue, ch[0] = (short)(((int)pil[0]*rxF[6] - (int)pil[1]*rxF[7])>>15); ch[1] = (short)(((int)pil[0]*rxF[7] + (int)pil[1]*rxF[6])>>15); multadd_real_vector_complex_scalar(fr_dc,ch,dl_bf_ch,16); - //printf("symbol=%d,rxF[%d]=(%d,%d),pil=(%d,%d),ch=(%d,%d)\n",symbol,pil_offset,rxF[6],rxF[7],pil[0],pil[1],ch[0],ch[1]); +#ifdef DEBUG_BF_CH + //printf("symbol=%d,rxF[3]=(%d,%d),pil=(%d,%d),ch=(%d,%d)\n",symbol,rxF[6],rxF[7],pil[0],pil[1],ch[0],ch[1]); +#endif pil+=2;; } else { ch[0] = (short)(((int)pil[0]*rxF[0] - (int)pil[1]*rxF[1])>>15); ch[1] = (short)(((int)pil[0]*rxF[1] + (int)pil[1]*rxF[0])>>15); multadd_real_vector_complex_scalar(fl_dc,ch,dl_bf_ch,16); - //printf("symbol=%d,rxF[%d]=(%d,%d),pil=(%d,%d),ch=(%d,%d)\n",symbol,pil_offset,rxF[0],rxF[1],pil[0],pil[1],ch[0],ch[1]); +#ifdef DEBUG_BF_CH + //printf("symbol=%d,rxF[0]=(%d,%d),pil=(%d,%d),ch=(%d,%d)\n",symbol,rxF[0],rxF[1],pil[0],pil[1],ch[0],ch[1]); +#endif pil+=2;; rxF = (short *)&rxdataF[aarx][symbol*(frame_parms->ofdm_symbol_size)]; @@ -475,13 +489,17 @@ int lte_dl_bf_channel_estimation(PHY_VARS_UE *phy_vars_ue, ch[0] = (short)(((int)pil[0]*rxF[2] - (int)pil[1]*rxF[3])>>15); ch[1] = (short)(((int)pil[0]*rxF[3] + (int)pil[1]*rxF[2])>>15); multadd_real_vector_complex_scalar(fm_dc,ch,dl_bf_ch,16); - //printf("symbol=%d,rxF[%d]=(%d,%d),pil=(%d,%d),ch=(%d,%d)\n",symbol,pil_offset,rxF[2],rxF[3],pil[0],pil[1],ch[0],ch[1]); +#ifdef DEBUG_BF_CH + //printf("symbol=%d,rxF[1]=(%d,%d),pil=(%d,%d),ch=(%d,%d)\n",symbol,rxF[2],rxF[3],pil[0],pil[1],ch[0],ch[1]); +#endif pil+=2;; ch[0] = (short)(((int)pil[0]*rxF[10] - (int)pil[1]*rxF[11])>>15); ch[1] = (short)(((int)pil[0]*rxF[11] + (int)pil[1]*rxF[10])>>15); multadd_real_vector_complex_scalar(fr_dc,ch,dl_bf_ch,16); - //printf("symbol=%d,rxF[%d]=(%d,%d),pil=(%d,%d),ch=(%d,%d)\n",symbol,pil_offset,rxF[10],rxF[11],pil[0],pil[1],ch[0],ch[1]); +#ifdef DEBUG_BF_CH + //printf("symbol=%d,rxF[5]=(%d,%d),pil=(%d,%d),ch=(%d,%d)\n",symbol,rxF[10],rxF[11],pil[0],pil[1],ch[0],ch[1]); +#endif pil+=2;; } } // rballoc==1 @@ -604,19 +622,25 @@ int lte_dl_bf_channel_estimation(PHY_VARS_UE *phy_vars_ue, ch[0] = (short)(((int)pil[0]*rxF[0] - (int)pil[1]*rxF[1])>>15); ch[1] = (short)(((int)pil[0]*rxF[1] + (int)pil[1]*rxF[0])>>15); multadd_real_vector_complex_scalar(fl,ch,dl_bf_ch,16); - //printf("symbol=%d,rxF[%d]=(%d,%d),pil=(%d,%d),ch=(%d,%d)\n",symbol,pil_offset,rxF[0],rxF[1],pil[0],pil[1],ch[0],ch[1]); +#ifdef DEBUG_BF_CH + printf("symbol=%d,rxF[0]=(%d,%d),pil=(%d,%d),ch=(%d,%d)\n",symbol,rxF[0],rxF[1],pil[0],pil[1],ch[0],ch[1]); +#endif pil+=2; ch[0] = (short)(((int)pil[0]*rxF[8] - (int)pil[1]*rxF[9])>>15); ch[1] = (short)(((int)pil[0]*rxF[9] + (int)pil[1]*rxF[8])>>15); multadd_real_vector_complex_scalar(fm,ch,dl_bf_ch,16); - //printf("symbol=%d,rxF[%d]=(%d,%d),pil=(%d,%d),ch=(%d,%d)\n",symbol,pil_offset,rxF[8],rxF[9],pil[0],pil[1],ch[0],ch[1]); +#ifdef DEBUG_BF_CH + printf("symbol=%d,rxF[4]=(%d,%d),pil=(%d,%d),ch=(%d,%d)\n",symbol,rxF[8],rxF[9],pil[0],pil[1],ch[0],ch[1]); +#endif pil+=2; ch[0] = (short)(((int)pil[0]*rxF[16] - (int)pil[1]*rxF[17])>>15); ch[1] = (short)(((int)pil[0]*rxF[17] + (int)pil[1]*rxF[16])>>15); multadd_real_vector_complex_scalar(fr,ch,dl_bf_ch,16); - //printf("symbol=%d,rxF[%d]=(%d,%d),pil=(%d,%d),ch=(%d,%d)\n",symbol,pil_offset,rxF[16],rxF[17],pil[0],pil[1],ch[0],ch[1]); +#ifdef DEBUG_BF_CH + printf("symbol=%d,rxF[8]=(%d,%d),pil=(%d,%d),ch=(%d,%d)\n",symbol,rxF[16],rxF[17],pil[0],pil[1],ch[0],ch[1]); +#endif pil+=2; } @@ -641,7 +665,9 @@ int lte_dl_bf_channel_estimation(PHY_VARS_UE *phy_vars_ue, if (phy_vars_ue->perfect_ce == 0) { dl_bf_ch = (short *)&dl_bf_ch_estimates[aarx][ch_offset]; - //printf("dlsch_bf_ch_est.c:symbol %d, dl_bf_ch (%d,%d)\n",symbol,dl_bf_ch[0],dl_bf_ch[1]); +#ifdef DEBUG_BF_CH + printf("[dlsch_bf_ch_est.c]:symbol %d, dl_bf_ch (%d,%d)\n",symbol,dl_bf_ch[0],dl_bf_ch[1]); +#endif if (phy_vars_ue->high_speed_flag == 0) { multadd_complex_vector_real_scalar(dl_bf_ch, @@ -655,7 +681,9 @@ int lte_dl_bf_channel_estimation(PHY_VARS_UE *phy_vars_ue, // printf("Interpolating %d->0\n",4-phy_vars_ue->lte_frame_parms.Ncp); // dl_bf_ch_prev = (short *)&dl_bf_ch_estimates[aarx][(4-phy_vars_ue->lte_frame_parms.Ncp)*(frame_parms->ofdm_symbol_size)]; dl_bf_ch_prev = (short *)&dl_bf_ch_estimates[aarx][pilot3*(frame_parms->ofdm_symbol_size)]; - +#ifdef DEBUG_BF_CH + printf("[dlsch_bf_ch_est.c] symbol=%d, dl_bf_ch_prev=(%d,%d), dl_bf_ch=(%d,%d)\n", symbol, dl_bf_ch_prev[0], dl_bf_ch_prev[1], dl_bf_ch[0], dl_bf_ch[1]); +#endif // pilot spacing 5 symbols (1/5,2/5,3/5,4/5 combination) multadd_complex_vector_real_scalar(dl_bf_ch_prev,26214,dl_bf_ch_prev+(2*(frame_parms->ofdm_symbol_size)),1,frame_parms->ofdm_symbol_size); multadd_complex_vector_real_scalar(dl_bf_ch,6554,dl_bf_ch_prev+(2*(frame_parms->ofdm_symbol_size)),0,frame_parms->ofdm_symbol_size); @@ -670,6 +698,9 @@ int lte_dl_bf_channel_estimation(PHY_VARS_UE *phy_vars_ue, multadd_complex_vector_real_scalar(dl_bf_ch,26214,dl_bf_ch-(2*(frame_parms->ofdm_symbol_size)),0,frame_parms->ofdm_symbol_size); } else if (symbol == pilot1) { dl_bf_ch_prev = (short *)&dl_bf_ch_estimates[aarx][pilot0*(frame_parms->ofdm_symbol_size)]; +#ifdef DEBUG_BF_CH + printf("[dlsch_bf_ch_est.c] symbol=%d, dl_bf_ch_prev=(%d,%d), dl_bf_ch=(%d,%d)\n", symbol, dl_bf_ch_prev[0], dl_bf_ch_prev[1], dl_bf_ch[0], dl_bf_ch[1]); +#endif // pilot spacing 3 symbols (1/3,2/3 combination) multadd_complex_vector_real_scalar(dl_bf_ch_prev,21845,dl_bf_ch_prev+(2*(frame_parms->ofdm_symbol_size)),1,frame_parms->ofdm_symbol_size); @@ -680,6 +711,9 @@ int lte_dl_bf_channel_estimation(PHY_VARS_UE *phy_vars_ue, } else if (symbol == pilot2) { dl_bf_ch_prev = (short *)&dl_bf_ch_estimates[aarx][pilot1*(frame_parms->ofdm_symbol_size)]; +#ifdef DEBUG_BF_CH + printf("[dlsch_bf_ch_est.c] symbol=%d, dl_bf_ch_prev=(%d,%d), dl_bf_ch=(%d,%d)\n", symbol, dl_bf_ch_prev[0], dl_bf_ch_prev[1], dl_bf_ch[0], dl_bf_ch[1]); +#endif multadd_complex_vector_real_scalar(dl_bf_ch_prev,21845,dl_bf_ch_prev+(2*(frame_parms->ofdm_symbol_size)),1,frame_parms->ofdm_symbol_size); multadd_complex_vector_real_scalar(dl_bf_ch,10923,dl_bf_ch_prev+(2*(frame_parms->ofdm_symbol_size)),0,frame_parms->ofdm_symbol_size); @@ -707,8 +741,10 @@ int lte_dl_bf_channel_estimation(PHY_VARS_UE *phy_vars_ue, } } } //aarx - - // printf("[dlsch bf ch est]: dl_bf_estimates[0][600] %d, %d \n",*(short *)&dl_bf_ch_estimates[0][600],*(short*)&phy_vars_ue->lte_ue_pdsch_vars[eNB_id]->dl_bf_ch_estimates[0][600]); + +#ifdef DEBUG_BF_CH + printf("[dlsch_bf_ch_est.c]: dl_bf_estimates[0][600] %d, %d \n",*(short *)&dl_bf_ch_estimates[0][600],*(short*)&phy_vars_ue->lte_ue_pdsch_vars[eNB_id]->dl_bf_ch_estimates[0][600]); +#endif return(0); diff --git a/openair1/SCHED/phy_procedures_lte_ue.c b/openair1/SCHED/phy_procedures_lte_ue.c index 36a7f525e3..a4c40036aa 100755 --- a/openair1/SCHED/phy_procedures_lte_ue.c +++ b/openair1/SCHED/phy_procedures_lte_ue.c @@ -2562,16 +2562,6 @@ int phy_procedures_UE_RX(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstrac #endif - if (phy_vars_ue->dlsch_ue[eNB_id][0]->active == 1) { - if (phy_vars_ue->transmission_mode[eNB_id]==7) { - if (phy_vars_ue->lte_frame_parms.Ncp==0) { - if (((slot_rx%2)==0 && ((l==3) || (l==6))) || ((slot_rx%2)==1 && ((l==2) || (l==5)))) - lte_dl_bf_channel_estimation(phy_vars_ue,eNB_id,0,slot_rx,5,l+7*(slot_rx%2==1)); - } else { - LOG_E(PHY,"[UE %d]Beamforming channel estimation not supported yet for TM7 extented CP.\n",phy_vars_ue->Mod_id); - } - } - } // process last DLSCH symbols + invoke decoding if (((slot_rx%2)==0) && (l==0)) { // Regular PDSCH @@ -3092,7 +3082,8 @@ int phy_procedures_UE_RX(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstrac } - if ((((slot_rx%2)==0) && ((l==pilot1))) || + if ((((slot_rx%2)==0) && (l==pilot1) && (phy_vars_ue->transmission_mode[eNB_id]<7)) || + (((slot_rx%2)==0) && (l==3) && (phy_vars_ue->transmission_mode[eNB_id]==7)) || ((pmch_flag==1)&&(l==1))) { #ifdef DEBUG_PHY_PROC @@ -3114,6 +3105,22 @@ int phy_procedures_UE_RX(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstrac #endif } + // TM7 UE specific channel estimation +#ifdef DEBUG_PHY_PROC + LOG_D(PHY,"[UE %d] BF: dlsch->active in subframe %d => %d, l=%d\n",phy_vars_ue->Mod_id,subframe_rx,phy_vars_ue->dlsch_ue[eNB_id][0]->active, l); +#endif + if (phy_vars_ue->dlsch_ue[eNB_id][0]->active == 1) { + if (phy_vars_ue->transmission_mode[eNB_id]==7) { + if (phy_vars_ue->lte_frame_parms.Ncp==0) { + if (((slot_rx%2)==0 && ((l==3) || (l==6))) || ((slot_rx%2)==1 && ((l==2) || (l==5)))) + //LOG_D(PHY,"[UE %d] dlsch->active in subframe %d => %d, l=%d\n",phy_vars_ue->Mod_id,subframe_rx,phy_vars_ue->dlsch_ue[eNB_id][0]->active, l); + lte_dl_bf_channel_estimation(phy_vars_ue,eNB_id,0,slot_rx,5,l+7*(slot_rx%2==1)); + } else { + LOG_E(PHY,"[UE %d]Beamforming channel estimation not supported yet for TM7 extented CP.\n",phy_vars_ue->Mod_id); + } + } + } + if (abstraction_flag==0) { if (((slot_rx%2)==1) && (l==0)) { From e3dbfa3dde100d5c7d3a05b866168101e4231743 Mon Sep 17 00:00:00 2001 From: Xiwen JIANG Date: Tue, 26 Jul 2016 11:43:10 +0200 Subject: [PATCH 205/349] some cleanup --- openair1/PHY/impl_defs_lte.h | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/openair1/PHY/impl_defs_lte.h b/openair1/PHY/impl_defs_lte.h index 73974623f7..f61aa2dcc9 100644 --- a/openair1/PHY/impl_defs_lte.h +++ b/openair1/PHY/impl_defs_lte.h @@ -632,19 +632,8 @@ typedef struct { /// - first index: eNB id [0..2] (hard coded) /// - second index: sample [0..samples_per_tti*10[ uint32_t *sync_corr[3]; - /// \brief Holds the cell specific beamforming weights - /// - first index: eNB id [0..2] (hard coded) - /// - second index: cell specific eNB antenna port index, up to 2 logical antenna ports are supported - /// - third index: tx antenna [0..nb_antennas_tx[ - /// - fourth index: sample [0..] - // int32_t **cell_spec_bf_weights[3][2]; - /// \brief Holds the ue specific beamforming weights - /// - first index: eNB id [0..2] (hard coded) - /// - second index: ue specific eNB antenna port index, port5->index0, port7-15->index0-7 - /// - third index: tx antenna [0..nb_antennas_tx[ - /// - fourth index: sample [0..] - // int32_t **ue_spec_bf_weights[3][8]; - /// \brief Holds the ue specific beamforming weights + // int32_t **beam_weights[3][15]; + /// \brief Holds the beamforming weights /// - first index: eNB id [0..2] (hard coded) /// - second index: eNB antenna port index /// - third index: tx antenna [0..nb_antennas_tx[ From fdde582e9208e9c3ab47cfd728f46655cded432c Mon Sep 17 00:00:00 2001 From: Xiwen JIANG Date: Thu, 11 Aug 2016 16:29:43 +0200 Subject: [PATCH 206/349] bug fixed in pbch for nb_antennas_tx>1 --- openair1/PHY/LTE_TRANSPORT/pbch.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/openair1/PHY/LTE_TRANSPORT/pbch.c b/openair1/PHY/LTE_TRANSPORT/pbch.c index cba6a16fa4..3ad974dab6 100755 --- a/openair1/PHY/LTE_TRANSPORT/pbch.c +++ b/openair1/PHY/LTE_TRANSPORT/pbch.c @@ -74,7 +74,7 @@ int allocate_pbch_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms, MIMO_mode_t mimo_mode = (frame_parms->mode1_flag==1)?SISO:ALAMOUTI; - uint32_t tti_offset,aa; + uint32_t tti_offset; uint8_t re; int16_t gain_lin_QPSK; int16_t re_off=re_offset; @@ -99,15 +99,11 @@ int allocate_pbch_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms, *re_allocated = *re_allocated + 1; // printf("%d(%d) : %d,%d => ",tti_offset,*jj,((int16_t*)&txdataF[0][tti_offset])[0],((int16_t*)&txdataF[0][tti_offset])[1]); - for (aa=0; aanb_antennas_tx; aa++) { - ((int16_t*)&txdataF[aa][tti_offset])[0] += (x0[*jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK; //I //b_i - } + ((int16_t*)&txdataF[0][tti_offset])[0] += (x0[*jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK; //I //b_i *jj = *jj + 1; - for (aa=0; aanb_antennas_tx; aa++) { - ((int16_t*)&txdataF[aa][tti_offset])[1] += (x0[*jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK; //Q //b_{i+1} - } + ((int16_t*)&txdataF[0][tti_offset])[1] += (x0[*jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK; //Q //b_{i+1} *jj = *jj + 1; } else if (mimo_mode == ALAMOUTI) { From 9f4a849115c6fa90f96ef4243b8a7deeff843520 Mon Sep 17 00:00:00 2001 From: Florian Kaltenberger Date: Thu, 18 Aug 2016 12:46:02 +0200 Subject: [PATCH 207/349] added prototypes to compute beamforming weights --- cmake_targets/CMakeLists.txt | 1 + openair1/PHY/MODULATION/beamforming.c | 1 - openair1/PHY/MODULATION/compute_bf_weights.c | 54 ++++++++++++++++++++ openair1/PHY/MODULATION/defs.h | 7 +++ openair1/PHY/impl_defs_lte.h | 9 ++++ 5 files changed, 71 insertions(+), 1 deletion(-) create mode 100644 openair1/PHY/MODULATION/compute_bf_weights.c diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index 02a6ac5151..1027718d48 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -976,6 +976,7 @@ set(PHY_SRC ${OPENAIR1_DIR}/PHY/MODULATION/slot_fep_ul.c ${OPENAIR1_DIR}/PHY/MODULATION/ul_7_5_kHz.c ${OPENAIR1_DIR}/PHY/MODULATION/beamforming.c + ${OPENAIR1_DIR}/PHY/MODULATION/compute_bf_weights.c ${OPENAIR1_DIR}/PHY/LTE_ESTIMATION/freq_equalization.c ${OPENAIR1_DIR}/PHY/LTE_ESTIMATION/lte_sync_time.c ${OPENAIR1_DIR}/PHY/LTE_ESTIMATION/lte_sync_timefreq.c diff --git a/openair1/PHY/MODULATION/beamforming.c b/openair1/PHY/MODULATION/beamforming.c index 2e38b7cb93..00bb9e5dca 100644 --- a/openair1/PHY/MODULATION/beamforming.c +++ b/openair1/PHY/MODULATION/beamforming.c @@ -120,4 +120,3 @@ int beam_precoding(int32_t **txdataF, } } } - diff --git a/openair1/PHY/MODULATION/compute_bf_weights.c b/openair1/PHY/MODULATION/compute_bf_weights.c new file mode 100644 index 0000000000..620380737c --- /dev/null +++ b/openair1/PHY/MODULATION/compute_bf_weights.c @@ -0,0 +1,54 @@ +#include +#include +#include "PHY/impl_defs_lte.h" + +int f_read(char *calibF_fname, int nb_ant, int nb_freq, int32_t **tdd_calib_coeffs){ + + FILE *calibF_fd; + int i,j,l,calibF_e; + + calibF_fd = fopen(calibF_fname,"r"); + + if (calibF_fd) { + printf("Loading Calibration matrix from %s\n", calibF_fname); + + for(i=0;irx_vars[a].RX_DMA_BUFFER. From 7b114b08dbdf961a195232033de3db511ee3c032 Mon Sep 17 00:00:00 2001 From: Florian Kaltenberger Date: Thu, 18 Aug 2016 12:48:54 +0200 Subject: [PATCH 208/349] adding functions to compute bf weights to dlsim --- openair1/PHY/LTE_TRANSPORT/defs.h | 2 ++ openair1/PHY/MODULATION/compute_bf_weights.c | 4 ++- openair1/PHY/impl_defs_lte.h | 8 ++---- openair1/SIMULATION/LTE_PHY/dlsim.c | 30 ++++++++++++++++++++ 4 files changed, 38 insertions(+), 6 deletions(-) diff --git a/openair1/PHY/LTE_TRANSPORT/defs.h b/openair1/PHY/LTE_TRANSPORT/defs.h index 8bcf312c3e..e0029be318 100644 --- a/openair1/PHY/LTE_TRANSPORT/defs.h +++ b/openair1/PHY/LTE_TRANSPORT/defs.h @@ -242,6 +242,8 @@ typedef struct { int32_t *txdataF[8]; /// beamforming weights for UE-spec transmission (antenna ports 5 or 7..14), for each codeword, maximum 4 layers? int32_t **ue_spec_bf_weights[4]; + /// dl channel estimates (estimated from ul channel estimates) + int32_t **calib_dl_ch_estimates; /// Allocated RNTI (0 means DLSCH_t is not currently used) uint16_t rnti; /// Active flag for baseband transmitter processing diff --git a/openair1/PHY/MODULATION/compute_bf_weights.c b/openair1/PHY/MODULATION/compute_bf_weights.c index 620380737c..32a91c11f5 100644 --- a/openair1/PHY/MODULATION/compute_bf_weights.c +++ b/openair1/PHY/MODULATION/compute_bf_weights.c @@ -47,8 +47,10 @@ int compute_BF_weights(int32_t **beam_weights, int32_t **calib_dl_ch_estimates, } // temporal test function +/* void main(){ // initialization // compare printf("Hello world!\n"); -} \ No newline at end of file +} +*/ diff --git a/openair1/PHY/impl_defs_lte.h b/openair1/PHY/impl_defs_lte.h index 9cbff7fdb6..9d075dd9bb 100644 --- a/openair1/PHY/impl_defs_lte.h +++ b/openair1/PHY/impl_defs_lte.h @@ -641,18 +641,16 @@ typedef struct { /// - first index: eNB id [0..2] (hard coded) /// - second index: sample [0..samples_per_tti*10[ uint32_t *sync_corr[3]; - // int32_t **beam_weights[3][15]; /// \brief Holds the beamforming weights /// - first index: eNB id [0..2] (hard coded) - /// - second index: eNB antenna port index + /// - second index: eNB antenna port index (hard coded) /// - third index: tx antenna [0..nb_antennas_tx[ /// - fourth index: sample [0..] int32_t **beam_weights[3][15]; /// \brief Holds the tdd reciprocity calibration coefficients /// - first index: eNB id [0..2] (hard coded) - /// - second index: ue specific eNB antenna port index, port5->index0, port7-15->index0-7 - /// - third index: tx antenna [0..nb_antennas_tx[ - /// - forth index: frenquency [0..] + /// - second index: tx antenna [0..nb_antennas_tx[ + /// - third index: frequency [0..] int32_t **tdd_calib_coeffs[3]; } LTE_eNB_COMMON; diff --git a/openair1/SIMULATION/LTE_PHY/dlsim.c b/openair1/SIMULATION/LTE_PHY/dlsim.c index dd535064d1..1a34e59f5a 100644 --- a/openair1/SIMULATION/LTE_PHY/dlsim.c +++ b/openair1/SIMULATION/LTE_PHY/dlsim.c @@ -991,6 +991,9 @@ int main(int argc, char **argv) PHY_vars_eNB->eNB_UE_stats[1].DL_pmi_single = 0; } + //TODO: allocate memory for calibration matrix and calib_dl_ch_estimates in init_lte.c + //for first tests initialze calibration matrix with idendity + //read_calibration_matrix(calib_fname, nb_ant, nb_freq, PHY_vars_eNB->lte_eNB_common_vars.tdd_calib_coeffs[0]); if (input_fd==NULL) { @@ -2142,6 +2145,32 @@ int main(int argc, char **argv) PMI_FEEDBACK: + //make sure dlsim is called with perfect channel estimation option (for freq_channel) + //fill drs_ch_estimates with data from eNB2UE->chF + for(aa=0; aanb_antenna_ports_eNB; aa++) { + for (aarx=0; aarxnb_antennas_rx; aarx++) { + for (i=0; iN_RB_DL*12; i++) { + for (l=0; lsymbols_per_tti; l++) { + ((int16_t *) PHY_vars_eNB->lte_eNB_pusch_vars[0]->drs_ch_estimates[0][(aa<<1)+aarx])[2*i+(l*frame_parms->ofdm_symbol_size)*2]=(int16_t)(eNB2UE[round]->chF[aarx+(aa*frame_parms->nb_antennas_rx)][i].x*AMP); + //printf("x=%d,AMP=%d\n",eNB2UE[round]->chF[aarx+(aa*frame_parms->nb_antennas_rx)][i].x,AMP); + ((int16_t *) PHY_vars_eNB->lte_eNB_pusch_vars[0]->drs_ch_estimates[0][(aa<<1)+aarx])[2*i+1+(l*frame_parms->ofdm_symbol_size)*2]=(int16_t)(eNB2UE[round]->chF[aarx+(aa*frame_parms->nb_antennas_rx)][i].y*AMP); + } + } + } + } + + estimate_DLCSI_from_ULCSI(PHY_vars_eNB->dlsch_eNB[0][0]->calib_dl_ch_estimates, + &PHY_vars_eNB->lte_eNB_pusch_vars[0]->drs_ch_estimates[0][0/*position of second DMRS*/], + PHY_vars_eNB->lte_eNB_common_vars.tdd_calib_coeffs[0], + frame_parms->nb_antennas_tx, + frame_parms->N_RB_DL*12); + + compute_BF_weights(PHY_vars_eNB->dlsch_eNB[0][0]->ue_spec_bf_weights[0], + PHY_vars_eNB->dlsch_eNB[0][0]->calib_dl_ch_estimates, + MRT, + frame_parms->nb_antennas_tx, + frame_parms->N_RB_DL*12); + //printf("Trial %d : Round %d, pmi_feedback %d \n",trials,round,pmi_feedback); for (aa=0; aalte_eNB_common_vars.txdataF[eNB_id][aa][0],0,FRAME_LENGTH_COMPLEX_SAMPLES_NO_PREFIX*sizeof(int32_t)); @@ -3088,6 +3117,7 @@ PMI_FEEDBACK: eNB2UE[round]->chF[aarx+(aa*frame_parms->nb_antennas_rx)][i].y*AMP); if (transmission_mode == 7){ + //this should include the BF weights! Will not work for a random channel if (PHY_vars_UE->high_speed_flag==0) { ((int16_t *)PHY_vars_UE->lte_ue_pdsch_vars[0]->dl_bf_ch_estimates[(aa<<1)+aarx])[2*i]=(int16_t)( eNB2UE[round]->chF[aarx+(aa*frame_parms->nb_antennas_rx)][i].x*AMP); From cc6ca6fc122113ef19e89febcfda89a861220c17 Mon Sep 17 00:00:00 2001 From: Xiwen JIANG Date: Thu, 18 Aug 2016 17:29:03 +0200 Subject: [PATCH 209/349] bug fixed for PSS and SSS generation --- openair1/PHY/LTE_TRANSPORT/pss.c | 4 ++-- openair1/PHY/LTE_TRANSPORT/sss.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/openair1/PHY/LTE_TRANSPORT/pss.c b/openair1/PHY/LTE_TRANSPORT/pss.c index e2a4c549da..f14f7cf326 100644 --- a/openair1/PHY/LTE_TRANSPORT/pss.c +++ b/openair1/PHY/LTE_TRANSPORT/pss.c @@ -80,12 +80,12 @@ int generate_pss(int32_t **txdataF, return(-1); } - a = (frame_parms->nb_antennas_tx == 1) ? amp: (amp*ONE_OVER_SQRT2_Q15)>>15; + a = (frame_parms->nb_antenna_ports_eNB == 1) ? amp: (amp*ONE_OVER_SQRT2_Q15)>>15; //printf("[PSS] amp=%d, a=%d\n",amp,a); Nsymb = (frame_parms->Ncp==NORMAL)?14:12; - for (aa=0; aanb_antennas_tx; aa++) { + for (aa=0; aanb_antenna_ports_eNB; aa++) { // aa = 0; // The PSS occupies the inner 6 RBs, which start at diff --git a/openair1/PHY/LTE_TRANSPORT/sss.c b/openair1/PHY/LTE_TRANSPORT/sss.c index 34d55daaea..bd38db80d5 100644 --- a/openair1/PHY/LTE_TRANSPORT/sss.c +++ b/openair1/PHY/LTE_TRANSPORT/sss.c @@ -67,10 +67,10 @@ int generate_sss(int32_t **txdataF, Nsymb = (frame_parms->Ncp==NORMAL)?14:12; k = frame_parms->ofdm_symbol_size-3*12+5; - a = (frame_parms->nb_antennas_tx == 1) ? amp : (amp*ONE_OVER_SQRT2_Q15)>>15; + a = (frame_parms->nb_antenna_ports_eNB == 1) ? amp : (amp*ONE_OVER_SQRT2_Q15)>>15; for (i=0; i<62; i++) { - for (aa=0; aanb_antennas_tx; aa++) { + for (aa=0; aanb_antenna_ports_eNB; aa++) { ((int16_t*)txdataF[aa])[2*(slot_offset*Nsymb/2*frame_parms->ofdm_symbol_size + symbol*frame_parms->ofdm_symbol_size + k)] = From e10ed0bec865aeb80ca7e8c3a995a9a73941434f Mon Sep 17 00:00:00 2001 From: Xiwen JIANG Date: Thu, 18 Aug 2016 17:30:12 +0200 Subject: [PATCH 210/349] EXMIMO duplex mode always set to FDD --- targets/RT/USER/lte-softmodem.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/targets/RT/USER/lte-softmodem.c b/targets/RT/USER/lte-softmodem.c index 8b48148955..5511b4a15f 100644 --- a/targets/RT/USER/lte-softmodem.c +++ b/targets/RT/USER/lte-softmodem.c @@ -3278,9 +3278,11 @@ int main( int argc, char **argv ) openair0_cfg[card].rx_bw = 1.5e6; } + /* if (frame_parms[0]->frame_type==TDD) openair0_cfg[card].duplex_mode = duplex_mode_TDD; else //FDD + */ openair0_cfg[card].duplex_mode = duplex_mode_FDD; From 0985080287eb84ae08827c3409f2ff22041c99dd Mon Sep 17 00:00:00 2001 From: Xiwen JIANG Date: Thu, 18 Aug 2016 17:34:25 +0200 Subject: [PATCH 211/349] add tm7 tdd config file --- openair1/PHY/INIT/lte_parms.c | 1 + .../GENERIC-LTE-EPC/CONF/enb.band38.tm7.exmimo2.conf | 9 ++++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/openair1/PHY/INIT/lte_parms.c b/openair1/PHY/INIT/lte_parms.c index fa0e731af9..7930549f67 100644 --- a/openair1/PHY/INIT/lte_parms.c +++ b/openair1/PHY/INIT/lte_parms.c @@ -191,6 +191,7 @@ void dump_frame_parms(LTE_DL_FRAME_PARMS *frame_parms) printf("frame_parms->tdd_config=%d\n",frame_parms->tdd_config); printf("frame_parms->tdd_config_S=%d\n",frame_parms->tdd_config_S); printf("frame_parms->mode1_flag=%d\n",frame_parms->mode1_flag); + printf("frame_parms->nb_antenna_ports_eNB=%d\n",frame_parms->nb_antenna_ports_eNB); printf("frame_parms->nb_antennas_tx=%d\n",frame_parms->nb_antennas_tx); printf("frame_parms->nb_antennas_rx=%d\n",frame_parms->nb_antennas_rx); printf("frame_parms->ofdm_symbol_size=%d\n",frame_parms->ofdm_symbol_size); diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band38.tm7.exmimo2.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band38.tm7.exmimo2.conf index deff3db9dd..f9b765d1e0 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band38.tm7.exmimo2.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band38.tm7.exmimo2.conf @@ -33,8 +33,9 @@ eNBs = Nid_cell = 0; N_RB_DL = 25; Nid_cell_mbsfn = 0; - nb_antennas_tx = 4; - nb_antennas_rx = 4; + nb_antenna_ports = 1; + nb_antennas_tx = 1; + nb_antennas_rx = 1; tx_gain = 10; //25; rx_gain = 10; //20; prach_root = 0; @@ -97,6 +98,8 @@ eNBs = ue_TimersAndConstants_t311 = 10000; ue_TimersAndConstants_n310 = 20; ue_TimersAndConstants_n311 = 1; + + ue_TransmissionMode = 7; } ); @@ -152,7 +155,7 @@ eNBs = { global_log_level ="info"; global_log_verbosity ="medium"; - hw_log_level ="debug"; + hw_log_level ="info"; hw_log_verbosity ="medium"; phy_log_level ="info"; phy_log_verbosity ="medium"; From 1cbb2c5caa169c26e8d99942be60f1ea5841ac68 Mon Sep 17 00:00:00 2001 From: Xiwen JIANG Date: Thu, 18 Aug 2016 19:08:51 +0200 Subject: [PATCH 212/349] memory allocation for calibration coefficients and dlsch ue spec bf weight --- openair1/PHY/LTE_TRANSPORT/dlsch_coding.c | 20 +++++++++++++++++++- openair1/SIMULATION/LTE_PHY/dlsim.c | 5 +---- targets/SIMU/USER/init_lte.c | 12 ------------ 3 files changed, 20 insertions(+), 17 deletions(-) diff --git a/openair1/PHY/LTE_TRANSPORT/dlsch_coding.c b/openair1/PHY/LTE_TRANSPORT/dlsch_coding.c index 48498a4873..9d7f5597cf 100644 --- a/openair1/PHY/LTE_TRANSPORT/dlsch_coding.c +++ b/openair1/PHY/LTE_TRANSPORT/dlsch_coding.c @@ -123,7 +123,8 @@ LTE_eNB_DLSCH_t *new_eNB_dlsch(unsigned char Kmimo,unsigned char Mdlharq,uint32_ { LTE_eNB_DLSCH_t *dlsch; - unsigned char exit_flag = 0,i,j,r,aa; + unsigned char exit_flag = 0,i,j,r,aa,layer; + int re; unsigned char bw_scaling =1; uint8_t nb_antennas_tx = frame_parms->nb_antennas_tx; @@ -154,6 +155,23 @@ LTE_eNB_DLSCH_t *new_eNB_dlsch(unsigned char Kmimo,unsigned char Mdlharq,uint32_ dlsch->Mlimit = 4; dlsch->Nsoft = Nsoft; + for (layer=0; layer<4; layer++) { + dlsch->ue_spec_bf_weights[layer] = (int32_t**)malloc16(frame_parms->nb_antennas_tx*sizeof(int32_t*)); + + for (aa=0; aanb_antennas_tx; aa++) { + dlsch->ue_spec_bf_weights[layer][aa] = (int32_t *)malloc16(OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES*sizeof(int32_t)); + for (re=0;reue_spec_bf_weights[layer][aa][re] = 0x00007fff; + } + } + } + + dlsch->calib_dl_ch_estimates = (int32_t**)malloc16(frame_parms->nb_antennas_tx*sizeof(int32_t*)); + for (aa=0; aanb_antennas_tx; aa++) { + dlsch->calib_dl_ch_estimates[aa] = (int32_t *)malloc16(OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES*sizeof(int32_t)); + + } + for (i=0; i<10; i++) dlsch->harq_ids[i] = Mdlharq; diff --git a/openair1/SIMULATION/LTE_PHY/dlsim.c b/openair1/SIMULATION/LTE_PHY/dlsim.c index 1a34e59f5a..294dbf3b44 100644 --- a/openair1/SIMULATION/LTE_PHY/dlsim.c +++ b/openair1/SIMULATION/LTE_PHY/dlsim.c @@ -934,13 +934,10 @@ int main(int argc, char **argv) } else { // this initilisation may should be moved to another place for (j=0; j<4; j++) { - PHY_vars_eNB->dlsch_eNB[k][i]->ue_spec_bf_weights[j] = (int32_t **)malloc16(n_tx_phy*sizeof(int32_t*)); - for (aa=0; aadlsch_eNB[k][i]->ue_spec_bf_weights[j][aa] = (int32_t *)malloc16(OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES*sizeof(int32_t)); ue_spec_bf_weights = PHY_vars_eNB->dlsch_eNB[k][i]->ue_spec_bf_weights[j][aa]; - for (re=0;reofdm_symbol_size;re++) { + for (re=0;re %p\n",i,j,PHY_vars_eNB->dlsch_eNB[i][j]); PHY_vars_eNB->dlsch_eNB[i][j]->rnti=0; - - for (layer=0; layer<4; layer++) { - PHY_vars_eNB->dlsch_eNB[i][j]->ue_spec_bf_weights[layer] = (int32_t **)malloc16(frame_parms->nb_antennas_tx*sizeof(int32_t*)); - - for (aa=0; aanb_antennas_tx; aa++) { - PHY_vars_eNB->dlsch_eNB[i][j]->ue_spec_bf_weights[layer][aa] = (int32_t *)malloc16(OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES*sizeof(int32_t)); - for (re=0;redlsch_eNB[i][j]->ue_spec_bf_weights[layer][aa][re] = 0x00007fff; - } - } - } - } } From bc9c4cfebc0c904a925b02984f0cc8c0c4e3aeaa Mon Sep 17 00:00:00 2001 From: Xiwen JIANG Date: Mon, 22 Aug 2016 10:33:43 +0200 Subject: [PATCH 213/349] do_OFDM_mod_rt to perform on each symbol --- targets/RT/USER/lte-softmodem.c | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/targets/RT/USER/lte-softmodem.c b/targets/RT/USER/lte-softmodem.c index 5511b4a15f..cab7e15b27 100644 --- a/targets/RT/USER/lte-softmodem.c +++ b/targets/RT/USER/lte-softmodem.c @@ -962,7 +962,21 @@ void do_OFDM_mod_rt(int subframe,PHY_VARS_eNB *phy_vars_eNB) ((subframe_select(&phy_vars_eNB->lte_frame_parms,subframe)==SF_S))) { // LOG_D(HW,"Frame %d: Generating slot %d\n",frame,next_slot); + do_OFDM_mod_l(&phy_vars_eNB->lte_eNB_common_vars, + 0, + subframe<<1, + &phy_vars_eNB->lte_frame_parms); + + // if S-subframe generate first slot only + if (subframe_select(&phy_vars_eNB->lte_frame_parms,subframe) == SF_DL) { + do_OFDM_mod_l(&phy_vars_eNB->lte_eNB_common_vars, + 0, + 1+(subframe<<1), + &phy_vars_eNB->lte_frame_parms); + } + +/* for (aa=0; aalte_frame_parms.nb_antennas_tx; aa++) { if (phy_vars_eNB->lte_frame_parms.Ncp == EXTENDED) { PHY_ofdm_mod(&phy_vars_eNB->lte_eNB_common_vars.txdataF[0][aa][slot_offset_F], @@ -989,7 +1003,9 @@ void do_OFDM_mod_rt(int subframe,PHY_VARS_eNB *phy_vars_eNB) 7, &(phy_vars_eNB->lte_frame_parms)); } + } */ + for (aa=0; aalte_frame_parms.nb_antennas_tx; aa++) { // if S-subframe generate first slot only if (subframe_select(&phy_vars_eNB->lte_frame_parms,subframe) == SF_S) len = phy_vars_eNB->lte_frame_parms.samples_per_tti>>1; @@ -1012,9 +1028,13 @@ void do_OFDM_mod_rt(int subframe,PHY_VARS_eNB *phy_vars_eNB) if (tx_offset>=(LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*phy_vars_eNB->lte_frame_parms.samples_per_tti)) tx_offset -= LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*phy_vars_eNB->lte_frame_parms.samples_per_tti; - ((short*)&phy_vars_eNB->lte_eNB_common_vars.txdata[0][aa][tx_offset])[0] = ((short*)dummy_tx_b)[2*i]<lte_eNB_common_vars.txdata[0][aa][tx_offset])[0] = ((short*)dummy_tx_b)[2*i]<lte_eNB_common_vars.txdata[0][aa][tx_offset])[1] = ((short*)dummy_tx_b)[2*i+1]<lte_eNB_common_vars.txdata[0][aa][tx_offset])[1] = ((short*)dummy_tx_b)[2*i+1]<lte_eNB_common_vars.txdata[0][aa][tx_offset])[0] = ((short*)&phy_vars_eNB->lte_eNB_common_vars.txdata[0][aa][tx_offset])[0]<lte_eNB_common_vars.txdata[0][aa][tx_offset])[1] = ((short*)&phy_vars_eNB->lte_eNB_common_vars.txdata[0][aa][tx_offset])[1]<lte_frame_parms,subframe) == SF_S) { From f277acfef5f8ab68765c0fbe81c24e14073ac090 Mon Sep 17 00:00:00 2001 From: Xiwen JIANG Date: Mon, 22 Aug 2016 10:35:11 +0200 Subject: [PATCH 214/349] remove num_pdcch_symb from paramters of dp_OFDM_mod_l --- openair1/PHY/MODULATION/defs.h | 2 +- openair1/PHY/MODULATION/ofdm_mod.c | 14 +++++++++----- openair1/SCHED/phy_procedures_lte_eNb.c | 10 ++-------- openair1/SIMULATION/LTE_PHY/dlsim.c | 6 ++---- 4 files changed, 14 insertions(+), 18 deletions(-) diff --git a/openair1/PHY/MODULATION/defs.h b/openair1/PHY/MODULATION/defs.h index 597d433df8..92d4988f77 100644 --- a/openair1/PHY/MODULATION/defs.h +++ b/openair1/PHY/MODULATION/defs.h @@ -89,7 +89,7 @@ void normal_prefix_mod(int32_t *txdataF,int32_t *txdata,uint8_t nsymb,LTE_DL_FRA void do_OFDM_mod(int32_t **txdataF, int32_t **txdata, uint32_t frame,uint16_t next_slot, LTE_DL_FRAME_PARMS *frame_parms); -void do_OFDM_mod_l(LTE_eNB_COMMON *eNB_common_vars, int eNB_id, uint16_t next_slot, LTE_DL_FRAME_PARMS *frame_parms, uint8_t num_pdcch_symbols); +void do_OFDM_mod_l(LTE_eNB_COMMON *eNB_common_vars, int eNB_id, uint16_t next_slot, LTE_DL_FRAME_PARMS *frame_parms); void remove_7_5_kHz(PHY_VARS_eNB *phy_vars_eNB,uint8_t subframe); diff --git a/openair1/PHY/MODULATION/ofdm_mod.c b/openair1/PHY/MODULATION/ofdm_mod.c index 1f7aeb533a..3139a7bc08 100755 --- a/openair1/PHY/MODULATION/ofdm_mod.c +++ b/openair1/PHY/MODULATION/ofdm_mod.c @@ -291,19 +291,17 @@ void do_OFDM_mod(int32_t **txdataF, int32_t **txdata, uint32_t frame,uint16_t ne } // OFDM modulation for each symbol -void do_OFDM_mod_l(LTE_eNB_COMMON *eNB_common_vars, int eNB_id, uint16_t next_slot, LTE_DL_FRAME_PARMS *frame_parms, uint8_t num_pdcch_symbols) +void do_OFDM_mod_l(LTE_eNB_COMMON *eNB_common_vars, int eNB_id, uint16_t next_slot, LTE_DL_FRAME_PARMS *frame_parms) { - int aa, l, slot_offset, slot_offset_F; - int8_t UE_id=0; + int aa, l, slot_offset; int32_t **txdataF = eNB_common_vars->txdataF[eNB_id]; int32_t **txdataF_BF = eNB_common_vars->txdataF_BF[eNB_id]; int32_t **txdata = eNB_common_vars->txdata[eNB_id]; - //slot_offset_F = (next_slot)*(frame_parms->ofdm_symbol_size)*((frame_parms->Ncp==1) ? 6 : 7); slot_offset = (next_slot)*(frame_parms->samples_per_tti>>1); - // printf("Thread %d starting ... aa %d (%llu)\n",omp_get_thread_num(),aa,rdtsc()); + //printf("Thread %d starting ... aa %d (%llu)\n",omp_get_thread_num(),aa,rdtsc()); for (l=0; lsymbols_per_tti>>1; l++) { //printf("do_OFDM_mod_l, slot=%d, l=%d, NUMBER_OF_OFDM_CARRIERS=%d,OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES=%d\n",next_slot, l,NUMBER_OF_OFDM_CARRIERS,OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES); @@ -312,6 +310,8 @@ void do_OFDM_mod_l(LTE_eNB_COMMON *eNB_common_vars, int eNB_id, uint16_t next_sl for (aa=0; aanb_antennas_tx; aa++) { + //PMCH case not implemented... + if (frame_parms->Ncp == 1) PHY_ofdm_mod(txdataF_BF[aa], // input &txdata[aa][slot_offset+l*OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES], // output @@ -335,6 +335,10 @@ void do_OFDM_mod_l(LTE_eNB_COMMON *eNB_common_vars, int eNB_id, uint16_t next_sl 1, // number of symbols frame_parms->nb_prefix_samples, // number of prefix samples CYCLIC_PREFIX); + + /* printf("txdata[%d][%d]=%d\n",aa, + slot_offset+OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES0+(l-1)*OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES, + &txdata[aa][slot_offset+OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES0+(l-1)*OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES]);*/ } } } diff --git a/openair1/SCHED/phy_procedures_lte_eNb.c b/openair1/SCHED/phy_procedures_lte_eNb.c index 3c2b1bdf17..523e54c448 100755 --- a/openair1/SCHED/phy_procedures_lte_eNb.c +++ b/openair1/SCHED/phy_procedures_lte_eNb.c @@ -1649,27 +1649,21 @@ void phy_procedures_eNB_TX(unsigned char sched_subframe,PHY_VARS_eNB *phy_vars_e phy_procedures_emos_eNB_TX(subframe, phy_vars_eNB); #endif - //cell-specific beamforming - #if !(defined(EXMIMO) || defined(OAI_USRP) || defined (CPRIGW)) if (abstraction_flag==0) { start_meas(&phy_vars_eNB->ofdm_mod_stats); - //do_OFDM_mod (without l) ? - do_OFDM_mod_l(&phy_vars_eNB->lte_eNB_common_vars, 0, subframe<<1, - &phy_vars_eNB->lte_frame_parms, - num_pdcch_symbols); + &phy_vars_eNB->lte_frame_parms); do_OFDM_mod_l(&phy_vars_eNB->lte_eNB_common_vars, 0, 1+(subframe<<1), - &phy_vars_eNB->lte_frame_parms, - num_pdcch_symbols); + &phy_vars_eNB->lte_frame_parms); stop_meas(&phy_vars_eNB->ofdm_mod_stats); } diff --git a/openair1/SIMULATION/LTE_PHY/dlsim.c b/openair1/SIMULATION/LTE_PHY/dlsim.c index 294dbf3b44..0ea247f440 100644 --- a/openair1/SIMULATION/LTE_PHY/dlsim.c +++ b/openair1/SIMULATION/LTE_PHY/dlsim.c @@ -2835,14 +2835,12 @@ PMI_FEEDBACK: do_OFDM_mod_l(&PHY_vars_eNB->lte_eNB_common_vars, eNB_id, (subframe*2), - &PHY_vars_eNB->lte_frame_parms, - num_pdcch_symbols); + &PHY_vars_eNB->lte_frame_parms); do_OFDM_mod_l(&PHY_vars_eNB->lte_eNB_common_vars, eNB_id, (subframe*2)+1, - &PHY_vars_eNB->lte_frame_parms, - num_pdcch_symbols); + &PHY_vars_eNB->lte_frame_parms); stop_meas(&PHY_vars_eNB->ofdm_mod_stats); stop_meas(&PHY_vars_eNB->phy_proc_tx); From fd068005dfec6e15524ca4fd37d2440cb2523159 Mon Sep 17 00:00:00 2001 From: Xiwen JIANG Date: Mon, 22 Aug 2016 10:36:16 +0200 Subject: [PATCH 215/349] cosmetic changes --- openair1/PHY/MODULATION/beamforming.c | 31 ++++++++++--------- .../CONF/enb.band38.tm7.exmimo2.conf | 4 +-- .../CONF/enb.band7.tm7.exmimo2.conf | 6 ++-- 3 files changed, 22 insertions(+), 19 deletions(-) diff --git a/openair1/PHY/MODULATION/beamforming.c b/openair1/PHY/MODULATION/beamforming.c index 00bb9e5dca..3aa7810aec 100644 --- a/openair1/PHY/MODULATION/beamforming.c +++ b/openair1/PHY/MODULATION/beamforming.c @@ -72,15 +72,15 @@ int beam_precoding(int32_t **txdataF, ((int16_t*)&txdataF_BF[aa][re])[1] = (int16_t)((((int16_t*)&txdataF[p][slot_offset_F+symbol*frame_parms->ofdm_symbol_size+re])[0]*((int16_t*)&beam_weights[p][aa][re])[1])>>15); ((int16_t*)&txdataF_BF[aa][re])[1] += (int16_t)((((int16_t*)&txdataF[p][slot_offset_F+symbol*frame_parms->ofdm_symbol_size+re])[1]*((int16_t*)&beam_weights[0][aa][re])[0])>>15); - //printf("beamforming.c:txdata[%d][%d]=%d+j%d, beam_weights[%d][%d][%d]=%d+j%d,txdata_BF[%d][%d]=%d+j%d\n", - // p,slot_offset_F+symbol*frame_parms->ofdm_symbol_size+re, - // ((int16_t*)&txdataF[p][slot_offset_F+symbol*frame_parms->ofdm_symbol_size+re])[0], - // ((int16_t*)&txdataF[p][slot_offset_F+symbol*frame_parms->ofdm_symbol_size+re])[1], - // p,aa,re, - // ((int16_t*)&beam_weights[p][aa][re])[0],((int16_t*)&beam_weights[p][aa][re])[1], - // aa,re, - // ((int16_t*)&txdataF_BF[aa][re])[0], - // ((int16_t*)&txdataF_BF[aa][re])[1]); + /*printf("beamforming.c:txdata[%d][%d]=%d+j%d, beam_weights[%d][%d][%d]=%d+j%d,txdata_BF[%d][%d]=%d+j%d\n", + p,slot_offset_F+symbol*frame_parms->ofdm_symbol_size+re, + ((int16_t*)&txdataF[p][slot_offset_F+symbol*frame_parms->ofdm_symbol_size+re])[0], + ((int16_t*)&txdataF[p][slot_offset_F+symbol*frame_parms->ofdm_symbol_size+re])[1], + p,aa,re, + ((int16_t*)&beam_weights[p][aa][re])[0],((int16_t*)&beam_weights[p][aa][re])[1], + aa,re, + ((int16_t*)&txdataF_BF[aa][re])[0], + ((int16_t*)&txdataF_BF[aa][re])[1]); */ } } @@ -90,9 +90,9 @@ int beam_precoding(int32_t **txdataF, ((int16_t*)&txdataF_BF[aa][re])[0] = (int16_t)((((int16_t*)&txdataF[5][slot_offset_F+symbol*frame_parms->ofdm_symbol_size+re])[0]*((int16_t*)&beam_weights[5][aa][re])[0])>>15); ((int16_t*)&txdataF_BF[aa][re])[0] -= (int16_t)((((int16_t*)&txdataF[5][slot_offset_F+symbol*frame_parms->ofdm_symbol_size+re])[1]*((int16_t*)&beam_weights[5][aa][re])[1])>>15); ((int16_t*)&txdataF_BF[aa][re])[1] = (int16_t)((((int16_t*)&txdataF[5][slot_offset_F+symbol*frame_parms->ofdm_symbol_size+re])[0]*((int16_t*)&beam_weights[5][aa][re])[1])>>15); - ((int16_t*)&txdataF_BF[aa][re])[1] += (int16_t)((((int16_t*)&txdataF[5][slot_offset_F+symbol*frame_parms->ofdm_symbol_size+re])[1]*((int16_t*)&beam_weights[5][aa][re])[0])>>15); -/* - printf("beamforming.c:txdata[5][%d]=%d+j%d, beam_weights[5][%d][%d]=%d+j%d,txdata_BF[%d][%d]=%d+j%d\n", + ((int16_t*)&txdataF_BF[aa][re])[1] += (int16_t)((((int16_t*)&txdataF[5][slot_offset_F+symbol*frame_parms->ofdm_symbol_size+re])[1]*((int16_t*)&beam_weights[5][aa][re])[0])>>15); + + /* printf("beamforming.c:txdata[5][%d]=%d+j%d, beam_weights[5][%d][%d]=%d+j%d,txdata_BF[%d][%d]=%d+j%d\n", slot_offset_F+symbol*frame_parms->ofdm_symbol_size+re, ((int16_t*)&txdataF[5][slot_offset_F+symbol*frame_parms->ofdm_symbol_size+re])[0], ((int16_t*)&txdataF[5][slot_offset_F+symbol*frame_parms->ofdm_symbol_size+re])[1], @@ -101,8 +101,8 @@ int beam_precoding(int32_t **txdataF, ((int16_t*)&beam_weights[5][aa][re])[1], aa,re, ((int16_t*)&txdataF_BF[aa][re])[0], - ((int16_t*)&txdataF_BF[aa][re])[1]); -*/ + ((int16_t*)&txdataF_BF[aa][re])[1]); */ + } } @@ -119,4 +119,7 @@ int beam_precoding(int32_t **txdataF, } } } + +return 0; + } diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band38.tm7.exmimo2.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band38.tm7.exmimo2.conf index f9b765d1e0..6209fbe150 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band38.tm7.exmimo2.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band38.tm7.exmimo2.conf @@ -34,8 +34,8 @@ eNBs = N_RB_DL = 25; Nid_cell_mbsfn = 0; nb_antenna_ports = 1; - nb_antennas_tx = 1; - nb_antennas_rx = 1; + nb_antennas_tx = 3; + nb_antennas_rx = 3; tx_gain = 10; //25; rx_gain = 10; //20; prach_root = 0; diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm7.exmimo2.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm7.exmimo2.conf index dedf4797bc..d26ebbe735 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm7.exmimo2.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm7.exmimo2.conf @@ -34,8 +34,8 @@ eNBs = N_RB_DL = 25; Nid_cell_mbsfn = 0; nb_antenna_ports = 1; - nb_antennas_tx = 1; - nb_antennas_rx = 1; + nb_antennas_tx = 2; + nb_antennas_rx = 2; tx_gain = 25; rx_gain = 20; prach_root = 0; @@ -153,7 +153,7 @@ eNBs = log_config : { - global_log_level ="debug"; + global_log_level ="info"; global_log_verbosity ="medium"; hw_log_level ="info"; hw_log_verbosity ="medium"; From 394c4cab6ad9c9944aae2b8ca9785b7b971cfd71 Mon Sep 17 00:00:00 2001 From: Xiwen JIANG Date: Mon, 22 Aug 2016 20:06:13 +0200 Subject: [PATCH 216/349] antenna number bug fixed --- targets/SIMU/USER/init_lte.c | 3 +-- targets/SIMU/USER/oaisim_functions.c | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/targets/SIMU/USER/init_lte.c b/targets/SIMU/USER/init_lte.c index 4a71b0aad9..e90605dcc8 100644 --- a/targets/SIMU/USER/init_lte.c +++ b/targets/SIMU/USER/init_lte.c @@ -291,8 +291,7 @@ void init_lte_vars(LTE_DL_FRAME_PARMS *frame_parms[MAX_NUM_CCs], for (CC_id=0; CC_idnb_antennas_tx = 1; - (frame_parms[CC_id])->nb_antennas_rx = nb_antennas_rx; - + (frame_parms[CC_id])->nb_antennas_rx = 1; // UE rx number hard coded PHY_vars_UE_g[UE_id][CC_id] = init_lte_UE(frame_parms[CC_id], UE_id,abstraction_flag); PHY_vars_UE_g[UE_id][CC_id]->Mod_id=UE_id; diff --git a/targets/SIMU/USER/oaisim_functions.c b/targets/SIMU/USER/oaisim_functions.c index e96881d2d3..89921d1151 100644 --- a/targets/SIMU/USER/oaisim_functions.c +++ b/targets/SIMU/USER/oaisim_functions.c @@ -971,7 +971,7 @@ void init_openair1(void) cooperation_flag, enb_properties->properties[0]->nb_antenna_ports[CC_id], abstraction_flag, - enb_properties->properties[0]->nb_antennas_tx[CC_id], + enb_properties->properties[0]->nb_antennas_rx[CC_id], enb_properties->properties[0]->nb_antennas_tx[CC_id], oai_emulation.info.eMBMS_active_state); } From fc1e26d07409162521a2d1e4e92317123032d830 Mon Sep 17 00:00:00 2001 From: Xiwen JIANG Date: Tue, 23 Aug 2016 18:21:45 +0200 Subject: [PATCH 217/349] add VCD by function name for beam precoding and do_ofdm_l --- openair1/PHY/MODULATION/ofdm_mod.c | 8 +++++--- openair1/SIMULATION/LTE_PHY/dlsim.c | 4 ---- openair2/UTIL/LOG/vcd_signal_dumper.c | 2 ++ openair2/UTIL/LOG/vcd_signal_dumper.h | 2 ++ targets/RT/USER/lte-softmodem.c | 7 ++++++- 5 files changed, 15 insertions(+), 8 deletions(-) diff --git a/openair1/PHY/MODULATION/ofdm_mod.c b/openair1/PHY/MODULATION/ofdm_mod.c index 3139a7bc08..44ca2dff9f 100755 --- a/openair1/PHY/MODULATION/ofdm_mod.c +++ b/openair1/PHY/MODULATION/ofdm_mod.c @@ -38,6 +38,7 @@ This section deals with basic functions for OFDM Modulation. #include "PHY/defs.h" #include "UTIL/LOG/log.h" +#include "UTIL/LOG/vcd_signal_dumper.h" //static short temp2[2048*4] __attribute__((aligned(16))); @@ -306,7 +307,9 @@ void do_OFDM_mod_l(LTE_eNB_COMMON *eNB_common_vars, int eNB_id, uint16_t next_sl //printf("do_OFDM_mod_l, slot=%d, l=%d, NUMBER_OF_OFDM_CARRIERS=%d,OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES=%d\n",next_slot, l,NUMBER_OF_OFDM_CARRIERS,OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES); + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_BEAM_PRECODING,1); beam_precoding(txdataF,txdataF_BF,frame_parms,eNB_common_vars->beam_weights[eNB_id],next_slot,l); + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_BEAM_PRECODING,0); for (aa=0; aanb_antennas_tx; aa++) { @@ -336,9 +339,8 @@ void do_OFDM_mod_l(LTE_eNB_COMMON *eNB_common_vars, int eNB_id, uint16_t next_sl frame_parms->nb_prefix_samples, // number of prefix samples CYCLIC_PREFIX); - /* printf("txdata[%d][%d]=%d\n",aa, - slot_offset+OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES0+(l-1)*OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES, - &txdata[aa][slot_offset+OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES0+(l-1)*OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES]);*/ + /* printf("txdata[%d][%d]=%d\n",aa,slot_offset+OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES0+(l-1)*OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES,txdata[aa][slot_offset+OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES0+(l-1)*OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES]); + * */ } } } diff --git a/openair1/SIMULATION/LTE_PHY/dlsim.c b/openair1/SIMULATION/LTE_PHY/dlsim.c index 0ea247f440..78308ade0d 100644 --- a/openair1/SIMULATION/LTE_PHY/dlsim.c +++ b/openair1/SIMULATION/LTE_PHY/dlsim.c @@ -951,10 +951,6 @@ int main(int argc, char **argv) } } - ue_spec_bf_weights = PHY_vars_eNB->dlsch_eNB[k][i]->ue_spec_bf_weights[j]; - - for (aa=0; aanb_antennas_tx; aa++) { - } } PHY_vars_eNB->dlsch_eNB[k][i]->rnti = n_rnti+k; diff --git a/openair2/UTIL/LOG/vcd_signal_dumper.c b/openair2/UTIL/LOG/vcd_signal_dumper.c index 78e481f3d6..4e38aac6eb 100644 --- a/openair2/UTIL/LOG/vcd_signal_dumper.c +++ b/openair2/UTIL/LOG/vcd_signal_dumper.c @@ -275,6 +275,8 @@ const char* eurecomFunctionsNames[] = { "phy_eNB_dlsch_modulation", "phy_eNB_dlsch_encoding", "phy_eNB_dlsch_scrambling", + "phy_eNB_beam_precoding", + "phy_eNB_ofdm_mod_l", /* MAC signals */ "macxface_macphy_init", diff --git a/openair2/UTIL/LOG/vcd_signal_dumper.h b/openair2/UTIL/LOG/vcd_signal_dumper.h index 0592e78b50..4bc11a281c 100644 --- a/openair2/UTIL/LOG/vcd_signal_dumper.h +++ b/openair2/UTIL/LOG/vcd_signal_dumper.h @@ -249,6 +249,8 @@ typedef enum { VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_MODULATION, VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_ENCODING, VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_SCRAMBLING, + VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_BEAM_PRECODING, + VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_OFDM_MODULATION, /* MAC signals */ VCD_SIGNAL_DUMPER_FUNCTIONS_MACPHY_INIT, diff --git a/targets/RT/USER/lte-softmodem.c b/targets/RT/USER/lte-softmodem.c index cab7e15b27..bd7d41610e 100644 --- a/targets/RT/USER/lte-softmodem.c +++ b/targets/RT/USER/lte-softmodem.c @@ -958,10 +958,13 @@ void do_OFDM_mod_rt(int subframe,PHY_VARS_eNB *phy_vars_eNB) slot_offset = subframe*phy_vars_eNB->lte_frame_parms.samples_per_tti; + if ((subframe_select(&phy_vars_eNB->lte_frame_parms,subframe)==SF_DL)|| ((subframe_select(&phy_vars_eNB->lte_frame_parms,subframe)==SF_S))) { // LOG_D(HW,"Frame %d: Generating slot %d\n",frame,next_slot); + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_OFDM_MODULATION,1); + do_OFDM_mod_l(&phy_vars_eNB->lte_eNB_common_vars, 0, subframe<<1, @@ -974,6 +977,8 @@ void do_OFDM_mod_rt(int subframe,PHY_VARS_eNB *phy_vars_eNB) 1+(subframe<<1), &phy_vars_eNB->lte_frame_parms); } + + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_OFDM_MODULATION,0); /* @@ -1289,7 +1294,7 @@ static void* eNB_thread_tx( void* param ) break; } } - + do_OFDM_mod_rt( proc->subframe_tx, PHY_vars_eNB_g[0][proc->CC_id] ); /* short *txdata = (short*)&PHY_vars_eNB_g[0][proc->CC_id]->lte_eNB_common_vars.txdata[0][0][proc->subframe_tx*PHY_vars_eNB_g[0][proc->CC_id]->lte_frame_parms.samples_per_tti]; From 1f8c702fbb1ec9bf782ad9ed07aa6ec7c66217b6 Mon Sep 17 00:00:00 2001 From: Xiwen JIANG Date: Thu, 25 Aug 2016 17:44:16 +0200 Subject: [PATCH 218/349] support more >1 EXMIMO2 cards --- openair1/PHY/impl_defs_lte.h | 8 ++--- targets/ARCH/EXMIMO/DRIVER/eurecom/fileops.c | 10 ++++-- .../ARCH/EXMIMO/USERSPACE/LIB/openair0_lib.c | 31 +++++++++-------- targets/RT/USER/lte-softmodem.c | 33 +++++++++++-------- 4 files changed, 48 insertions(+), 34 deletions(-) diff --git a/openair1/PHY/impl_defs_lte.h b/openair1/PHY/impl_defs_lte.h index 9d075dd9bb..ab8abd15de 100644 --- a/openair1/PHY/impl_defs_lte.h +++ b/openair1/PHY/impl_defs_lte.h @@ -1040,13 +1040,13 @@ typedef struct { /// first index: ? [0..1023] (hard coded) int16_t *prachF; /// \brief ?. - /// first index: rx antenna [0..3] (hard coded) \note Hard coded array size indexed by \c nb_antennas_rx. + /// first index: rx antenna [0..63] (hard coded) \note Hard coded array size indexed by \c nb_antennas_rx. /// second index: ? [0..ofdm_symbol_size*12[ - int16_t *rxsigF[4]; + int16_t *rxsigF[64]; /// \brief local buffer to compute prach_ifft (necessary in case of multiple CCs) - /// first index: rx antenna [0..3] (hard coded) \note Hard coded array size indexed by \c nb_antennas_rx. + /// first index: rx antenna [0..63] (hard coded) \note Hard coded array size indexed by \c nb_antennas_rx. /// second index: ? [0..2047] (hard coded) - int16_t *prach_ifft[4]; + int16_t *prach_ifft[64]; } LTE_eNB_PRACH; typedef struct { diff --git a/targets/ARCH/EXMIMO/DRIVER/eurecom/fileops.c b/targets/ARCH/EXMIMO/DRIVER/eurecom/fileops.c index 4427f4c8af..8153a44164 100755 --- a/targets/ARCH/EXMIMO/DRIVER/eurecom/fileops.c +++ b/targets/ARCH/EXMIMO/DRIVER/eurecom/fileops.c @@ -277,14 +277,18 @@ int openair_device_ioctl(struct inode *inode,struct file *filp, unsigned int cmd printk("[openair][IOCTL] : openair_DUMP_CONFIG(%d): exmimo_pci_kvirt[%d].exmimo_config_ptr = %p (phys %08x)\n", (int)arg, (int)arg, exmimo_pci_kvirt[(int)arg].exmimo_config_ptr, p_exmimo_pci_phys[(int)arg]->exmimo_config_ptr); - /*printk("EXMIMO_CONFIG: freq0 %d Hz, freq1 %d Hz, freqtx0 %d Hz, freqtx1 %d Hz, \nRX gain0 %d dB, RX Gain1 %d dB\n", + printk("[openair][IOCTL]: EXMIMO_CONFIG: freq0 %u Hz, freq1 %u Hz, freqtx0 %u Hz, freqtx1 %u Hz, \nRX gain0 %d dB, RX Gain1 %d dB, autocal (%d,%d,%d,%d)\n", exmimo_pci_kvirt[(int)arg].exmimo_config_ptr->rf.rf_freq_rx[0], exmimo_pci_kvirt[(int)arg].exmimo_config_ptr->rf.rf_freq_rx[1], exmimo_pci_kvirt[(int)arg].exmimo_config_ptr->rf.rf_freq_tx[0], exmimo_pci_kvirt[(int)arg].exmimo_config_ptr->rf.rf_freq_tx[1], exmimo_pci_kvirt[(int)arg].exmimo_config_ptr->rf.rx_gain[0][0], - exmimo_pci_kvirt[(int)arg].exmimo_config_ptr->rf.rx_gain[1][0]); - */ + exmimo_pci_kvirt[(int)arg].exmimo_config_ptr->rf.rx_gain[1][0], + exmimo_pci_kvirt[(int)arg].exmimo_config_ptr->rf.do_autocal[0], + exmimo_pci_kvirt[(int)arg].exmimo_config_ptr->rf.do_autocal[1], + exmimo_pci_kvirt[(int)arg].exmimo_config_ptr->rf.do_autocal[2], + exmimo_pci_kvirt[(int)arg].exmimo_config_ptr->rf.do_autocal[3]); + exmimo_send_pccmd((int)arg, EXMIMO_CONFIG); diff --git a/targets/ARCH/EXMIMO/USERSPACE/LIB/openair0_lib.c b/targets/ARCH/EXMIMO/USERSPACE/LIB/openair0_lib.c index 427cd47be8..c4d85d3d1a 100644 --- a/targets/ARCH/EXMIMO/USERSPACE/LIB/openair0_lib.c +++ b/targets/ARCH/EXMIMO/USERSPACE/LIB/openair0_lib.c @@ -252,7 +252,7 @@ int device_init(openair0_device *device, openair0_config_t *openair0_cfg) { // Initialize card // exmimo_config_t *p_exmimo_config; exmimo_id_t *p_exmimo_id; - int ret; + int ret, card; ret = openair0_open(); @@ -276,15 +276,17 @@ int device_init(openair0_device *device, openair0_config_t *openair0_cfg) { printf ("Detected %d number of cards, %d number of antennas.\n", openair0_num_detected_cards, openair0_num_antennas[0]); } - // p_exmimo_config = openair0_exmimo_pci[0].exmimo_config_ptr; - p_exmimo_id = openair0_exmimo_pci[0].exmimo_id_ptr; + for (card=0; cardboard_exmimoversion, p_exmimo_id->board_hwrev, p_exmimo_id->board_swrev); + printf("Card %d: ExpressMIMO %d, HW Rev %d, SW Rev 0x%d\n", card, p_exmimo_id->board_exmimoversion, p_exmimo_id->board_hwrev, p_exmimo_id->board_swrev); - // check if the software matches firmware - if (p_exmimo_id->board_swrev!=BOARD_SWREV_CNTL2) { - printf("Software revision %d and firmware revision %d do not match. Please update either the firmware or the software!\n",BOARD_SWREV_CNTL2,p_exmimo_id->board_swrev); - return(-1); + // check if the software matches firmware + if (p_exmimo_id->board_swrev!=BOARD_SWREV_CNTL2) { + printf("Software revision %d and firmware revision %d do not match. Please update either the firmware or the software!\n",BOARD_SWREV_CNTL2,p_exmimo_id->board_swrev); + return(-1); + } } device->type = EXMIMO_DEV; @@ -361,11 +363,17 @@ int openair0_config(openair0_config_t *openair0_cfg, int UE_flag) #endif for (ant=0; ant<4; ant++) { + p_exmimo_config->rf.rf_freq_rx[ant] = 0; + p_exmimo_config->rf.rf_freq_tx[ant] = 0; + p_exmimo_config->rf.rf_mode[ant] = 0; + p_exmimo_config->rf.rx_gain[ant][0] = 0; + p_exmimo_config->rf.tx_gain[ant][0] = 0; + if (openair0_cfg[card].rx_freq[ant] || openair0_cfg[card].tx_freq[ant]) { ACTIVE_RF += (1<rf.rf_mode[ant] = RF_MODE_BASE; p_exmimo_config->rf.do_autocal[ant] = 1;//openair0_cfg[card].autocal[ant]; - printf("card %d, antenna %d, autocal %d\n",card,ant,openair0_cfg[card].autocal[ant]); + printf("card %d, antenna %d, autocal %d\n",card,ant,p_exmimo_config->rf.do_autocal[ant]); } if (openair0_cfg[card].tx_freq[ant]) { @@ -396,10 +404,7 @@ int openair0_config(openair0_config_t *openair0_cfg, int UE_flag) p_exmimo_config->rf.rf_mode[ant] += LNAByp; break; } - } else { - p_exmimo_config->rf.rf_mode[ant] = 0; - p_exmimo_config->rf.do_autocal[ant] = 0; - } + } p_exmimo_config->rf.rf_local[ant] = rf_local[ant]; p_exmimo_config->rf.rf_rxdc[ant] = rf_rxdc[ant]; diff --git a/targets/RT/USER/lte-softmodem.c b/targets/RT/USER/lte-softmodem.c index bd7d41610e..a5dd06e221 100644 --- a/targets/RT/USER/lte-softmodem.c +++ b/targets/RT/USER/lte-softmodem.c @@ -2926,7 +2926,8 @@ int main( int argc, char **argv ) if (rf_config_file[0] == '\0') openair0_cfg[0].configFilename = NULL; else - openair0_cfg[0].configFilename = rf_config_file; + for (card=0; cardnb_antennas_rx; i++) { - printf("Mapping eNB CC_id %d, rx_ant %d, freq %u on card %d, chain %d\n",CC_id,i,downlink_frequency[CC_id][i]+uplink_frequency_offset[CC_id][i],rf_map[CC_id].card,rf_map[CC_id].chain+i); + card = i/4; + ant = i%4; + printf("Mapping eNB CC_id %d, rx_ant %d, freq %u on card %d, chain %d\n",CC_id,i,downlink_frequency[CC_id][ant]+uplink_frequency_offset[CC_id][ant],rf_map[CC_id].card+card, rf_map[CC_id].chain+ant); free(phy_vars_eNB[CC_id]->lte_eNB_common_vars.rxdata[0][i]); - phy_vars_eNB[CC_id]->lte_eNB_common_vars.rxdata[0][i] = (int32_t*) openair0_exmimo_pci[rf_map[CC_id].card].adc_head[rf_map[CC_id].chain+i]; + phy_vars_eNB[CC_id]->lte_eNB_common_vars.rxdata[0][i] = (int32_t*) openair0_exmimo_pci[rf_map[CC_id].card+card].adc_head[rf_map[CC_id].chain+ant]; - if (openair0_cfg[rf_map[CC_id].card].rx_freq[rf_map[CC_id].chain+i]) { + if (openair0_cfg[rf_map[CC_id].card+card].rx_freq[rf_map[CC_id].chain+ant]) { printf("Error with rf_map! A channel has already been allocated!\n"); return(-1); } else { - openair0_cfg[rf_map[CC_id].card].rx_freq[rf_map[CC_id].chain+i] = downlink_frequency[CC_id][i]+uplink_frequency_offset[CC_id][i]; - openair0_cfg[rf_map[CC_id].card].rx_gain[rf_map[CC_id].chain+i] = rx_gain[CC_id][i]; - openair0_cfg[rf_map[CC_id].card].rx_num_channels++; + openair0_cfg[rf_map[CC_id].card+card].rx_freq[rf_map[CC_id].chain+ant] = downlink_frequency[CC_id][ant]+uplink_frequency_offset[CC_id][ant]; + openair0_cfg[rf_map[CC_id].card+card].rx_gain[rf_map[CC_id].chain+ant] = rx_gain[CC_id][ant]; + openair0_cfg[rf_map[CC_id].card+card].rx_num_channels++; } printf("rxdata[%d] @ %p\n",i,phy_vars_eNB[CC_id]->lte_eNB_common_vars.rxdata[0][i]); @@ -3982,17 +3985,19 @@ int setup_eNB_buffers(PHY_VARS_eNB **phy_vars_eNB, openair0_config_t *openair0_c } for (i=0; inb_antennas_tx; i++) { - printf("Mapping eNB CC_id %d, tx_ant %d, freq %u on card %d, chain %d\n",CC_id,i,downlink_frequency[CC_id][i],rf_map[CC_id].card,rf_map[CC_id].chain+i); + card = i/4; + ant = i%4; + printf("Mapping eNB CC_id %d, tx_ant %d, freq %u on card %d chain %d\n",CC_id,i,downlink_frequency[CC_id][ant],rf_map[CC_id].card+card,rf_map[CC_id].chain+ant); free(phy_vars_eNB[CC_id]->lte_eNB_common_vars.txdata[0][i]); - phy_vars_eNB[CC_id]->lte_eNB_common_vars.txdata[0][i] = (int32_t*) openair0_exmimo_pci[rf_map[CC_id].card].dac_head[rf_map[CC_id].chain+i]; + phy_vars_eNB[CC_id]->lte_eNB_common_vars.txdata[0][i] = (int32_t*) openair0_exmimo_pci[rf_map[CC_id].card+card].dac_head[rf_map[CC_id].chain+ant]; - if (openair0_cfg[rf_map[CC_id].card].tx_freq[rf_map[CC_id].chain+i]) { + if (openair0_cfg[rf_map[CC_id].card+card].tx_freq[rf_map[CC_id].chain+ant]) { printf("Error with rf_map! A channel has already been allocated!\n"); return(-1); } else { - openair0_cfg[rf_map[CC_id].card].tx_freq[rf_map[CC_id].chain+i] = downlink_frequency[CC_id][i]; - openair0_cfg[rf_map[CC_id].card].tx_gain[rf_map[CC_id].chain+i] = tx_gain[CC_id][i]; - openair0_cfg[rf_map[CC_id].card].tx_num_channels++; + openair0_cfg[rf_map[CC_id].card+card].tx_freq[rf_map[CC_id].chain+ant] = downlink_frequency[CC_id][ant]; + openair0_cfg[rf_map[CC_id].card+card].tx_gain[rf_map[CC_id].chain+ant] = tx_gain[CC_id][ant]; + openair0_cfg[rf_map[CC_id].card+card].tx_num_channels++; } printf("txdata[%d] @ %p\n",i,phy_vars_eNB[CC_id]->lte_eNB_common_vars.txdata[0][i]); From eac26b014fcc81c2676c3a754412e6f8e8f503cf Mon Sep 17 00:00:00 2001 From: Florian Kaltenberger Date: Tue, 30 Aug 2016 15:59:24 +0200 Subject: [PATCH 219/349] enabling deadline scheduler by default for EXMIMO2 --- cmake_targets/build_oai | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake_targets/build_oai b/cmake_targets/build_oai index 935c57f0f1..625e2fcf5e 100755 --- a/cmake_targets/build_oai +++ b/cmake_targets/build_oai @@ -333,7 +333,7 @@ function main() { #By default: EXMIMO: enable if [ "$FORCE_DEADLINE_SCHEDULER_FLAG_USER" = "" ]; then if [ "$HW" = "EXMIMO" ] ; then - DEADLINE_SCHEDULER_FLAG_USER="False" + DEADLINE_SCHEDULER_FLAG_USER="True" elif [ "$HW" = "ETHERNET" ] ; then DEADLINE_SCHEDULER_FLAG_USER="True" elif [ "$HW" = "OAI_USRP" ] ; then From cf672ca01684cece6c557a5d48803c2e82654f29 Mon Sep 17 00:00:00 2001 From: Xiwen JIANG Date: Tue, 30 Aug 2016 17:11:39 +0200 Subject: [PATCH 220/349] temporary fix for exmimo2 build (no longer requires libboost) to be tested with USRP --- cmake_targets/CMakeLists.txt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index a537f17e31..bfd2db6199 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -556,7 +556,7 @@ elseif (${RF_BOARD} STREQUAL "OAI_USRP") set(HW_SOURCE ${HW_SOURCE} ${OPENAIR_TARGETS}/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp) LINK_DIRECTORIES("/opt/lib") - set(option_HW_lib "-luhd -rdynamic -ldl") + set(option_HW_lib "-luhd -rdynamic -ldl -lboost_system") elseif (${RF_BOARD} STREQUAL "OAI_BLADERF") include_directories("${OPENAIR_TARGETS}/ARCH/BLADERF/USERSPACE/LIB/") @@ -1644,7 +1644,7 @@ target_link_libraries (lte-softmodem -ldl target_link_libraries (lte-softmodem ${LIBXML2_LIBRARIES}) target_link_libraries (lte-softmodem pthread m ${CONFIG_LIBRARIES} rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${NETTLE_LIBRARIES} sctp ${option_HW_lib} ${option_TP_lib} ${XFORMS_LIBRARIES} ) -target_link_libraries (lte-softmodem ${LIBBOOST_LIBRARIES} -lboost_system) #Added manually as it is not found for some reason for USRP +#target_link_libraries (lte-softmodem ${LIBBOOST_LIBRARIES} -lboost_system) #Added manually as it is not found for some reason for USRP target_link_libraries (lte-softmodem ${LIB_LMS_LIBRARIES}) target_link_libraries (lte-softmodem ${T_LIB}) @@ -1680,7 +1680,7 @@ target_link_libraries (lte-softmodem-nos1 target_link_libraries (lte-softmodem-nos1 ${LIBXML2_LIBRARIES}) target_link_libraries (lte-softmodem-nos1 pthread m ${CONFIG_LIBRARIES} rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${NETTLE_LIBRARIES} ${option_HW_lib} ${option_TP_lib} ${XFORMS_LIBRARIES} ) -target_link_libraries (lte-softmodem-nos1 ${LIBBOOST_LIBRARIES} -lboost_system) #Added manually as it is not found for some reason for USRP +#target_link_libraries (lte-softmodem-nos1 ${LIBBOOST_LIBRARIES} -lboost_system) #Added manually as it is not found for some reason for USRP target_link_libraries (lte-softmodem-nos1 ${LIB_LMS_LIBRARIES}) target_link_libraries (lte-softmodem-nos1 ${T_LIB}) @@ -1703,7 +1703,7 @@ target_link_libraries(rrh_gw UTIL LFDS -Wl,--end-group ) target_link_libraries (rrh_gw rt pthread m ) -target_link_libraries (rrh_gw ${option_HW_lib} ${option_TP_lib} ${LIBBOOST_LIBRARIES} -lboost_system ) #Added manually as it is not found for some reason for USRP +target_link_libraries (rrh_gw ${option_HW_lib} ${option_TP_lib} ${LIBBOOST_LIBRARIES}) #Added manually as it is not found for some reason for USRP target_link_libraries (rrh_gw ${LIB_LMS_LIBRARIES}) target_link_libraries (rrh_gw ${T_LIB}) From e29524a5fe5a50f78a3153965c5da894a953b153 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Mon, 5 Sep 2016 11:15:26 +0300 Subject: [PATCH 221/349] Fixed bug when using DCCH2 --- .../LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c | 7 +- .../CONF/enb.band5.agent.usrpb210.conf | 180 ++++++++++++++++++ 2 files changed, 184 insertions(+), 3 deletions(-) create mode 100644 targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band5.agent.usrpb210.conf diff --git a/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c b/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c index 655c60cc70..5f1e0dbbf2 100644 --- a/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c +++ b/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c @@ -364,8 +364,9 @@ schedule_ue_spec_default( header_len_dcch = 2; // 2 bytes DCCH SDU subheader + // TODO : Need to prioritize DRBs // Loop through the UE logical channels (DCCH, DCCH1, DTCH for now) - for (j = 1; j < 4; j++) { + for (j = 1; j < NB_RB_MAX; j++) { header_len+=3; // Need to see if we have space for data from this channel @@ -389,8 +390,8 @@ schedule_ue_spec_default( if (data_to_request < 128) { //The header will be one byte less header_len--; } - if (j == 1) { - data_to_request++; //It is not correct but fixes some RLC bug for DCCH + if (j == 1 || j == 2) { + data_to_request++; //It is not correct but fixes some RLC bug for DCCH } LOG_D(MAC, "[TEST]Will request %d from DCCH\n", data_to_request); rlc_pdus[channels_added] = (Protocol__PrpRlcPdu *) malloc(sizeof(Protocol__PrpRlcPdu)); diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band5.agent.usrpb210.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band5.agent.usrpb210.conf new file mode 100644 index 0000000000..caf54b5541 --- /dev/null +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band5.agent.usrpb210.conf @@ -0,0 +1,180 @@ +Active_eNBs = ( "eNB_Eurecom_LTEBox"); +# Asn1_verbosity, choice in: none, info, annoying +Asn1_verbosity = "none"; + +eNBs = +( + { + ////////// Identification parameters: + eNB_ID = 0xe00; + + cell_type = "CELL_MACRO_ENB"; + + eNB_name = "eNB_Eurecom_LTEBox"; + + // Tracking area code, 0x0000 and 0xfffe are reserved values + tracking_area_code = "1"; + + mobile_country_code = "208"; + + mobile_network_code = "95"; + + ////////// Physical parameters: + + component_carriers = ( + { + frame_type = "FDD"; + tdd_config = 3; + tdd_config_s = 0; + prefix_type = "NORMAL"; + eutra_band = 5; + downlink_frequency = 879000000L; + uplink_frequency_offset = -45000000; + Nid_cell = 0; + N_RB_DL = 25; + Nid_cell_mbsfn = 0; + nb_antenna_ports = 1; + nb_antennas_tx = 1; + nb_antennas_rx = 1; + tx_gain = 90; + rx_gain = 125; + prach_root = 0; + prach_config_index = 0; + prach_high_speed = "DISABLE"; + prach_zero_correlation = 1; + prach_freq_offset = 2; + pucch_delta_shift = 1; + pucch_nRB_CQI = 1; + pucch_nCS_AN = 0; + pucch_n1_AN = 32; + pdsch_referenceSignalPower = -29; + pdsch_p_b = 0; + pusch_n_SB = 1; + pusch_enable64QAM = "DISABLE"; + pusch_hoppingMode = "interSubFrame"; + pusch_hoppingOffset = 0; + pusch_groupHoppingEnabled = "ENABLE"; + pusch_groupAssignment = 0; + pusch_sequenceHoppingEnabled = "DISABLE"; + pusch_nDMRS1 = 1; + phich_duration = "NORMAL"; + phich_resource = "ONESIXTH"; + srs_enable = "DISABLE"; + /* srs_BandwidthConfig =; + srs_SubframeConfig =; + srs_ackNackST =; + srs_MaxUpPts =;*/ + + pusch_p0_Nominal = -90; + pusch_alpha = "AL1"; + pucch_p0_Nominal = -96; + msg3_delta_Preamble = 6; + pucch_deltaF_Format1 = "deltaF2"; + pucch_deltaF_Format1b = "deltaF3"; + pucch_deltaF_Format2 = "deltaF0"; + pucch_deltaF_Format2a = "deltaF0"; + pucch_deltaF_Format2b = "deltaF0"; + + rach_numberOfRA_Preambles = 64; + rach_preamblesGroupAConfig = "DISABLE"; + /* + rach_sizeOfRA_PreamblesGroupA = ; + rach_messageSizeGroupA = ; + rach_messagePowerOffsetGroupB = ; + */ + rach_powerRampingStep = 4; + rach_preambleInitialReceivedTargetPower = -108; + rach_preambleTransMax = 10; + rach_raResponseWindowSize = 10; + rach_macContentionResolutionTimer = 48; + rach_maxHARQ_Msg3Tx = 4; + + pcch_default_PagingCycle = 128; + pcch_nB = "oneT"; + bcch_modificationPeriodCoeff = 2; + ue_TimersAndConstants_t300 = 1000; + ue_TimersAndConstants_t301 = 1000; + ue_TimersAndConstants_t310 = 1000; + ue_TimersAndConstants_t311 = 10000; + ue_TimersAndConstants_n310 = 20; + ue_TimersAndConstants_n311 = 1; + + ue_TransmissionMode = 1; + } + ); + + srb1_parameters : + { + # timer_poll_retransmit = (ms) [5, 10, 15, 20,... 250, 300, 350, ... 500] + timer_poll_retransmit = 80; + + # timer_reordering = (ms) [0,5, ... 100, 110, 120, ... ,200] + timer_reordering = 35; + + # timer_reordering = (ms) [0,5, ... 250, 300, 350, ... ,500] + timer_status_prohibit = 0; + + # poll_pdu = [4, 8, 16, 32 , 64, 128, 256, infinity(>10000)] + poll_pdu = 4; + + # poll_byte = (kB) [25,50,75,100,125,250,375,500,750,1000,1250,1500,2000,3000,infinity(>10000)] + poll_byte = 99999; + + # max_retx_threshold = [1, 2, 3, 4 , 6, 8, 16, 32] + max_retx_threshold = 4; + } + + # ------- SCTP definitions + SCTP : + { + # Number of streams to use in input/output + SCTP_INSTREAMS = 2; + SCTP_OUTSTREAMS = 2; + }; + + ////////// MME parameters: + mme_ip_address = ( { ipv4 = "192.168.100.101"; + ipv6 = "192:168:100::17"; + active = "yes"; + preference = "ipv4"; + } + ); + + NETWORK_INTERFACES : + { + ENB_INTERFACE_NAME_FOR_S1_MME = "eth0"; + ENB_IPV4_ADDRESS_FOR_S1_MME = "192.168.100.106/24"; + + ENB_INTERFACE_NAME_FOR_S1U = "eth0"; + ENB_IPV4_ADDRESS_FOR_S1U = "192.168.100.106/24"; + ENB_PORT_FOR_S1U = 2152; # Spec 2152 + }; + + NETWORK_CONTROLLER : + { + ENB_AGENT_INTERFACE_NAME = "eth1"; + ENB_AGENT_IPV4_ADDRESS = "10.0.2.5/30"; + ENB_AGENT_PORT = 2210; + ENB_AGENT_CACHE = "/mnt/oai_agent_cache"; + }; + + + log_config : + { + global_log_level ="info"; + global_log_verbosity ="medium"; + hw_log_level ="info"; + hw_log_verbosity ="medium"; + phy_log_level ="info"; + phy_log_verbosity ="medium"; + mac_log_level ="info"; + mac_log_verbosity ="high"; + rlc_log_level ="info"; + rlc_log_verbosity ="medium"; + pdcp_log_level ="info"; + pdcp_log_verbosity ="medium"; + rrc_log_level ="info"; + rrc_log_verbosity ="medium"; + }; + } +); From 6b48fd6380424a00fe1bec170ee7639512bdda55 Mon Sep 17 00:00:00 2001 From: "Wilson W.K. Thong" Date: Mon, 2 May 2016 22:58:45 +0800 Subject: [PATCH 222/349] ** new procedure - refresh kENB from NAS -> AS ** added flow to refresh KeNB key in RRC on receiving S1AP-InitialContextSetup added flow to configure PDCP security mode enabled filling in the PDCP MAC code during and after RRC-SMC procedure (cherry picked from commit 898cd5c45aedb27625d73352568211b4467c8dd9) --- openair2/COMMON/as_message.h | 10 +++ openair2/COMMON/rrc_messages_def.h | 3 + openair2/COMMON/rrc_messages_types.h | 6 ++ openair2/RRC/LITE/defs.h | 4 + openair2/RRC/LITE/rrc_UE.c | 94 ++++++++++++++++++++ openair3/NAS/COMMON/API/NETWORK/l2_message.h | 10 +++ openair3/NAS/UE/EMM/SecurityModeControl.c | 6 +- openair3/NAS/UE/nas_itti_messaging.c | 35 ++++++++ openair3/NAS/UE/nas_itti_messaging.h | 5 ++ 9 files changed, 172 insertions(+), 1 deletion(-) diff --git a/openair2/COMMON/as_message.h b/openair2/COMMON/as_message.h index 30810a325e..5f7f6f3fa9 100644 --- a/openair2/COMMON/as_message.h +++ b/openair2/COMMON/as_message.h @@ -220,6 +220,16 @@ typedef struct broadcast_info_ind_s { #define AS_HSDUPA (1 << NET_ACCESS_HSDUPA) #define AS_EUTRAN (1 << NET_ACCESS_EUTRAN) +#if 1 // wilson 2016-05-02 add new message to update kenb in RRC after NAS SMC complete +/* + * NAS->AS -K_eNB refresh request + * NAS request AS to refresh its KeNB key + */ +typedef struct kenb_refresh_req_s { + Byte_t kenb[32]; +} kenb_refresh_req_t; +#endif + /* * NAS->AS - Cell Information request * NAS request AS to search for a suitable cell belonging to the selected diff --git a/openair2/COMMON/rrc_messages_def.h b/openair2/COMMON/rrc_messages_def.h index 27d3a6bdd4..d521eab0ff 100644 --- a/openair2/COMMON/rrc_messages_def.h +++ b/openair2/COMMON/rrc_messages_def.h @@ -64,6 +64,9 @@ MESSAGE_DEF(RRC_STATE_IND, MESSAGE_PRIORITY_MED, RrcStateInd, MESSAGE_DEF(RRC_CONFIGURATION_REQ, MESSAGE_PRIORITY_MED, RrcConfigurationReq, rrc_configuration_req) // UE: NAS -> RRC messages +#if 1 // wilson 2016-05-02 add new message to update kenb in RRC after NAS SMC complete +MESSAGE_DEF(NAS_KENB_REFRESH_REQ, MESSAGE_PRIORITY_MED, NasKenbRefreshReq, nas_kenb_refresh_req) +#endif MESSAGE_DEF(NAS_CELL_SELECTION_REQ, MESSAGE_PRIORITY_MED, NasCellSelectionReq, nas_cell_selection_req) MESSAGE_DEF(NAS_CONN_ESTABLI_REQ, MESSAGE_PRIORITY_MED, NasConnEstabliReq, nas_conn_establi_req) MESSAGE_DEF(NAS_UPLINK_DATA_REQ, MESSAGE_PRIORITY_MED, NasUlDataReq, nas_ul_data_req) diff --git a/openair2/COMMON/rrc_messages_types.h b/openair2/COMMON/rrc_messages_types.h index ffe194265f..908510d94b 100644 --- a/openair2/COMMON/rrc_messages_types.h +++ b/openair2/COMMON/rrc_messages_types.h @@ -70,6 +70,9 @@ typedef UL_DCCH_Message_t RrcUlDcchMessage; #define RRC_CONFIGURATION_REQ(mSGpTR) (mSGpTR)->ittiMsg.rrc_configuration_req +#if 1 // wilson 2016-05-02 add new message to update kenb in RRC after NAS SMC complete +#define NAS_KENB_REFRESH_REQ(mSGpTR) (mSGpTR)->ittiMsg.nas_kenb_refresh_req +#endif #define NAS_CELL_SELECTION_REQ(mSGpTR) (mSGpTR)->ittiMsg.nas_cell_selection_req #define NAS_CONN_ESTABLI_REQ(mSGpTR) (mSGpTR)->ittiMsg.nas_conn_establi_req #define NAS_UPLINK_DATA_REQ(mSGpTR) (mSGpTR)->ittiMsg.nas_ul_data_req @@ -183,6 +186,9 @@ typedef struct RrcConfigurationReq_s { } RrcConfigurationReq; // UE: NAS -> RRC messages +#if 1 // wilson 2016-05-02 add new message to update kenb in RRC after NAS SMC complete +typedef kenb_refresh_req_t NasKenbRefreshReq; +#endif typedef cell_info_req_t NasCellSelectionReq; typedef nas_establish_req_t NasConnEstabliReq; typedef ul_info_transfer_req_t NasUlDataReq; diff --git a/openair2/RRC/LITE/defs.h b/openair2/RRC/LITE/defs.h index e546b52f8e..e34c532990 100644 --- a/openair2/RRC/LITE/defs.h +++ b/openair2/RRC/LITE/defs.h @@ -182,7 +182,11 @@ typedef enum HO_STATE_e { #define PAYLOAD_SIZE_MAX 1024 #define RRC_BUF_SIZE 255 #define UNDEF_SECURITY_MODE 0xff +#if 1 // wilson 2016-05-01 let RRC security mode command to return OK instead of failed +#define NO_SECURITY_MODE 0x20 +#else #define NO_SECURITY_MODE 0x33 +#endif #define CBA_OFFSET 0xfff4 // #define NUM_MAX_CBA_GROUP 4 // in the platform_constants diff --git a/openair2/RRC/LITE/rrc_UE.c b/openair2/RRC/LITE/rrc_UE.c index 01c1ee6ca9..51c7aa076d 100644 --- a/openair2/RRC/LITE/rrc_UE.c +++ b/openair2/RRC/LITE/rrc_UE.c @@ -39,6 +39,7 @@ #define RRC_UE_C #include "assertions.h" +#include "hashtable.h" #include "asn1_conversions.h" #include "defs.h" #include "PHY/TOOLS/dB_routines.h" @@ -107,6 +108,15 @@ extern void *bigphys_malloc(int); extern int8_t dB_fixed2(uint32_t x,uint32_t y); +extern void pdcp_config_set_security( + const protocol_ctxt_t* const ctxt_pP, + pdcp_t * const pdcp_pP, + const rb_id_t rb_idP, + const uint16_t lc_idP, + const uint8_t security_modeP, + uint8_t * const kRRCenc, + uint8_t * const kRRCint, + uint8_t * const kUPenc); // internal prototypes @@ -1392,6 +1402,64 @@ rrc_ue_process_securityModeCommand( ul_dcch_msg.message.choice.c1.present = UL_DCCH_MessageType__c1_PR_securityModeFailure; } + +#if 1 // wilson 2016-01-05 config PDCP security mode +#if defined(ENABLE_SECURITY) + uint8_t *kRRCenc = NULL; + uint8_t *kUPenc = NULL; + uint8_t *kRRCint = NULL; + pdcp_t *pdcp_p = NULL; + hash_key_t key = HASHTABLE_NOT_A_KEY_VALUE; + hashtable_rc_t h_rc; + + key = PDCP_COLL_KEY_VALUE(ctxt_pP->module_id, ctxt_pP->rnti, + ctxt_pP->enb_flag, DCCH, SRB_FLAG_YES); + h_rc = hashtable_get(pdcp_coll_p, key, (void**) &pdcp_p); + + if (h_rc == HASH_TABLE_OK) { + LOG_D(RRC, "PDCP_COLL_KEY_VALUE() returns valid key = %d\n", key); + + LOG_D(RRC, "driving kRRCenc, kRRCint and kUPenc from KeNB=" + "%02x%02x%02x%02x" + "%02x%02x%02x%02x" + "%02x%02x%02x%02x" + "%02x%02x%02x%02x" + "%02x%02x%02x%02x" + "%02x%02x%02x%02x" + "%02x%02x%02x%02x" + "%02x%02x%02x%02x\n", + UE_rrc_inst[ctxt_pP->module_id].kenb[0], UE_rrc_inst[ctxt_pP->module_id].kenb[1], UE_rrc_inst[ctxt_pP->module_id].kenb[2], UE_rrc_inst[ctxt_pP->module_id].kenb[3], + UE_rrc_inst[ctxt_pP->module_id].kenb[4], UE_rrc_inst[ctxt_pP->module_id].kenb[5], UE_rrc_inst[ctxt_pP->module_id].kenb[6], UE_rrc_inst[ctxt_pP->module_id].kenb[7], + UE_rrc_inst[ctxt_pP->module_id].kenb[8], UE_rrc_inst[ctxt_pP->module_id].kenb[9], UE_rrc_inst[ctxt_pP->module_id].kenb[10], UE_rrc_inst[ctxt_pP->module_id].kenb[11], + UE_rrc_inst[ctxt_pP->module_id].kenb[12], UE_rrc_inst[ctxt_pP->module_id].kenb[13], UE_rrc_inst[ctxt_pP->module_id].kenb[14], UE_rrc_inst[ctxt_pP->module_id].kenb[15], + UE_rrc_inst[ctxt_pP->module_id].kenb[16], UE_rrc_inst[ctxt_pP->module_id].kenb[17], UE_rrc_inst[ctxt_pP->module_id].kenb[18], UE_rrc_inst[ctxt_pP->module_id].kenb[19], + UE_rrc_inst[ctxt_pP->module_id].kenb[20], UE_rrc_inst[ctxt_pP->module_id].kenb[21], UE_rrc_inst[ctxt_pP->module_id].kenb[22], UE_rrc_inst[ctxt_pP->module_id].kenb[23], + UE_rrc_inst[ctxt_pP->module_id].kenb[24], UE_rrc_inst[ctxt_pP->module_id].kenb[25], UE_rrc_inst[ctxt_pP->module_id].kenb[26], UE_rrc_inst[ctxt_pP->module_id].kenb[27], + UE_rrc_inst[ctxt_pP->module_id].kenb[28], UE_rrc_inst[ctxt_pP->module_id].kenb[29], UE_rrc_inst[ctxt_pP->module_id].kenb[30], UE_rrc_inst[ctxt_pP->module_id].kenb[31]); + + derive_key_rrc_enc(UE_rrc_inst[ctxt_pP->module_id].ciphering_algorithm, + UE_rrc_inst[ctxt_pP->module_id].kenb, &kRRCenc); + derive_key_rrc_int(UE_rrc_inst[ctxt_pP->module_id].integrity_algorithm, + UE_rrc_inst[ctxt_pP->module_id].kenb, &kRRCint); + derive_key_up_enc(UE_rrc_inst[ctxt_pP->module_id].ciphering_algorithm, + UE_rrc_inst[ctxt_pP->module_id].kenb, &kUPenc); + + if (securityMode != 0xff) { + pdcp_config_set_security(ctxt_pP, pdcp_p, 0, 0, + UE_rrc_inst[ctxt_pP->module_id].ciphering_algorithm + | (UE_rrc_inst[ctxt_pP->module_id].integrity_algorithm << 4), + kRRCenc, kRRCint, kUPenc); + } else { + LOG_W(RRC, "skipped pdcp_config_set_security() as securityMode == 0x%02x", + securityMode); + } + } else { + LOG_W(RRC, "Could not get PDCP instance where key=0x%\n", key); + } + +#endif //#if defined(ENABLE_SECURITY) +#endif //#if 1 //wilson + if (securityModeCommand->criticalExtensions.present == SecurityModeCommand__criticalExtensions_PR_c1) { if (securityModeCommand->criticalExtensions.choice.c1.present == SecurityModeCommand__criticalExtensions__c1_PR_securityModeCommand_r8) { @@ -4063,6 +4131,32 @@ void *rrc_ue_task( void *args_p ) # if defined(ENABLE_USE_MME) +#if 1 // wilson 2016-05-02 add new message to update kenb in RRC after NAS SMC complete + case NAS_KENB_REFRESH_REQ: + memcpy((void*)UE_rrc_inst[ue_mod_id].kenb, (void*)NAS_KENB_REFRESH_REQ(msg_p).kenb, sizeof(UE_rrc_inst[ue_mod_id].kenb)); + + LOG_D(RRC, "[UE %d] Received %s: refreshed RRC::KeNB = " + "%02x%02x%02x%02x" + "%02x%02x%02x%02x" + "%02x%02x%02x%02x" + "%02x%02x%02x%02x" + "%02x%02x%02x%02x" + "%02x%02x%02x%02x" + "%02x%02x%02x%02x" + "%02x%02x%02x%02x\n", + ue_mod_id, msg_name, + UE_rrc_inst[ue_mod_id].kenb[0], UE_rrc_inst[ue_mod_id].kenb[1], UE_rrc_inst[ue_mod_id].kenb[2], UE_rrc_inst[ue_mod_id].kenb[3], + UE_rrc_inst[ue_mod_id].kenb[4], UE_rrc_inst[ue_mod_id].kenb[5], UE_rrc_inst[ue_mod_id].kenb[6], UE_rrc_inst[ue_mod_id].kenb[7], + UE_rrc_inst[ue_mod_id].kenb[8], UE_rrc_inst[ue_mod_id].kenb[9], UE_rrc_inst[ue_mod_id].kenb[10], UE_rrc_inst[ue_mod_id].kenb[11], + UE_rrc_inst[ue_mod_id].kenb[12], UE_rrc_inst[ue_mod_id].kenb[13], UE_rrc_inst[ue_mod_id].kenb[14], UE_rrc_inst[ue_mod_id].kenb[15], + UE_rrc_inst[ue_mod_id].kenb[16], UE_rrc_inst[ue_mod_id].kenb[17], UE_rrc_inst[ue_mod_id].kenb[18], UE_rrc_inst[ue_mod_id].kenb[19], + UE_rrc_inst[ue_mod_id].kenb[20], UE_rrc_inst[ue_mod_id].kenb[21], UE_rrc_inst[ue_mod_id].kenb[22], UE_rrc_inst[ue_mod_id].kenb[23], + UE_rrc_inst[ue_mod_id].kenb[24], UE_rrc_inst[ue_mod_id].kenb[25], UE_rrc_inst[ue_mod_id].kenb[26], UE_rrc_inst[ue_mod_id].kenb[27], + UE_rrc_inst[ue_mod_id].kenb[28], UE_rrc_inst[ue_mod_id].kenb[29], UE_rrc_inst[ue_mod_id].kenb[30], UE_rrc_inst[ue_mod_id].kenb[31]); + + break; +#endif + /* NAS messages */ case NAS_CELL_SELECTION_REQ: ue_mod_id = 0; /* TODO force ue_mod_id to first UE, NAS UE not virtualized yet */ diff --git a/openair3/NAS/COMMON/API/NETWORK/l2_message.h b/openair3/NAS/COMMON/API/NETWORK/l2_message.h index 02e5d87354..603f7c0d7d 100644 --- a/openair3/NAS/COMMON/API/NETWORK/l2_message.h +++ b/openair3/NAS/COMMON/API/NETWORK/l2_message.h @@ -116,6 +116,15 @@ Description Defines the messages supported by the Access Stratum sublayer #define AS_HSDUPA (1 << NET_ACCESS_HSDUPA) #define AS_EUTRAN (1 << NET_ACCESS_EUTRAN) +/* + * NAS->AS -K_eNB refresh request + * NAS request AS to refresh its KeNB key + */ +typedef struct kenb_refresh_req_s { + Byte_t kenb[32]; +} kenb_refresh_req_t; + +#if 1 // wilson 2016-05-02 add new message to update kenb in RRC after NAS SMC complete /* * NAS->AS - Cell Information request * NAS request AS to search for a suitable cell belonging to the selected @@ -125,6 +134,7 @@ typedef struct { plmn_t plmnID; /* PLMN identifier */ Byte_t rat; /* Bitmap - set of radio access technologies */ } cell_info_req_t; +#endif /* * AS->NAS - Cell Information response diff --git a/openair3/NAS/UE/EMM/SecurityModeControl.c b/openair3/NAS/UE/EMM/SecurityModeControl.c index fd7e4c3991..fa500ad316 100755 --- a/openair3/NAS/UE/EMM/SecurityModeControl.c +++ b/openair3/NAS/UE/EMM/SecurityModeControl.c @@ -72,6 +72,8 @@ Description Defines the security mode control EMM procedure executed by the #include "secu_defs.h" #include "msc.h" +#include "nas_itti_messaging.h" + /****************************************************************************/ /**************** E X T E R N A L D E F I N I T I O N S ****************/ /****************************************************************************/ @@ -293,7 +295,9 @@ int emm_proc_security_mode_command(int native_ksi, int ksi, _emm_data.security->selected_algorithms.encryption = seea; _emm_data.security->selected_algorithms.integrity = seia; - +#if 1 // wilson 2016-05-02 add new message to update kenb in RRC after NAS SMC complete + nas_itti_kenb_refresh_req(_security_data.kenb.value); +#endif } /* * NAS security mode command not accepted by the UE diff --git a/openair3/NAS/UE/nas_itti_messaging.c b/openair3/NAS/UE/nas_itti_messaging.c index 7b8f630b89..ff16c83ebf 100755 --- a/openair3/NAS/UE/nas_itti_messaging.c +++ b/openair3/NAS/UE/nas_itti_messaging.c @@ -187,6 +187,41 @@ int nas_itti_protected_msg(const char *buffer, const nas_message_t *msg, const i extern unsigned char NB_eNB_INST; +#if 1 // wilson 2016-05-02 add new message to update kenb in RRC after NAS SMC complete +int nas_itti_kenb_refresh_req(const Byte_t kenb[32]) +{ + MessageDef *message_p; + + message_p = itti_alloc_new_message(TASK_NAS_UE, NAS_KENB_REFRESH_REQ); + + memcpy(NAS_KENB_REFRESH_REQ(message_p).kenb, kenb, sizeof(NAS_KENB_REFRESH_REQ(message_p).kenb)); + + MSC_LOG_TX_MESSAGE( + MSC_NAS_UE, + MSC_RRC_UE, + NULL,0, + "0 NAS_KENB_REFRESH_REQ KeNB " + "%02x%02x%02x%02x" + "%02x%02x%02x%02x" + "%02x%02x%02x%02x" + "%02x%02x%02x%02x" + "%02x%02x%02x%02x" + "%02x%02x%02x%02x" + "%02x%02x%02x%02x" + "%02x%02x%02x%02x", + kenb[0], kenb[1], kenb[2], kenb[3], + kenb[4], kenb[5], kenb[6], kenb[7], + kenb[8], kenb[9], kenb[10], kenb[11], + kenb[12], kenb[13], kenb[14], kenb[15], + kenb[16], kenb[17], kenb[18], kenb[19], + kenb[20], kenb[21], kenb[22], kenb[23], + kenb[24], kenb[25], kenb[26], kenb[27], + kenb[28], kenb[29], kenb[30], kenb[31]); + + return itti_send_msg_to_task(TASK_RRC_UE, NB_eNB_INST + 0 /* TODO to be virtualized */, message_p); +} +#endif + int nas_itti_cell_info_req(const plmn_t plmnID, const Byte_t rat) { MessageDef *message_p; diff --git a/openair3/NAS/UE/nas_itti_messaging.h b/openair3/NAS/UE/nas_itti_messaging.h index 9ea80f63c0..dc8d41a239 100755 --- a/openair3/NAS/UE/nas_itti_messaging.h +++ b/openair3/NAS/UE/nas_itti_messaging.h @@ -54,6 +54,11 @@ int nas_itti_protected_msg( # if defined(NAS_BUILT_IN_UE) + +#if 1 // wilson 2016-05-02 add new message to update kenb in RRC after NAS SMC complete +int nas_itti_kenb_refresh_req(const Byte_t kenb[32]); +#endif + int nas_itti_cell_info_req(const plmn_t plmnID, const Byte_t rat); int nas_itti_nas_establish_req(as_cause_t cause, as_call_type_t type, as_stmsi_t s_tmsi, plmn_t plmnID, Byte_t *data_pP, uint32_t lengthP); From fe2b7d80d3f43845e3e1a0404f92a9d1a4a77c7e Mon Sep 17 00:00:00 2001 From: "Wilson W.K. Thong" Date: Mon, 2 May 2016 23:13:30 +0800 Subject: [PATCH 223/349] removed 'wilson' from the codes --- openair2/COMMON/as_message.h | 2 -- openair2/COMMON/rrc_messages_def.h | 2 -- openair2/COMMON/rrc_messages_types.h | 4 ---- openair2/RRC/LITE/defs.h | 4 ---- openair2/RRC/LITE/rrc_UE.c | 4 ---- openair3/NAS/COMMON/API/NETWORK/l2_message.h | 2 -- openair3/NAS/UE/EMM/SecurityModeControl.c | 2 -- openair3/NAS/UE/nas_itti_messaging.c | 2 -- openair3/NAS/UE/nas_itti_messaging.h | 2 -- 9 files changed, 24 deletions(-) diff --git a/openair2/COMMON/as_message.h b/openair2/COMMON/as_message.h index 5f7f6f3fa9..976a398061 100644 --- a/openair2/COMMON/as_message.h +++ b/openair2/COMMON/as_message.h @@ -220,7 +220,6 @@ typedef struct broadcast_info_ind_s { #define AS_HSDUPA (1 << NET_ACCESS_HSDUPA) #define AS_EUTRAN (1 << NET_ACCESS_EUTRAN) -#if 1 // wilson 2016-05-02 add new message to update kenb in RRC after NAS SMC complete /* * NAS->AS -K_eNB refresh request * NAS request AS to refresh its KeNB key @@ -228,7 +227,6 @@ typedef struct broadcast_info_ind_s { typedef struct kenb_refresh_req_s { Byte_t kenb[32]; } kenb_refresh_req_t; -#endif /* * NAS->AS - Cell Information request diff --git a/openair2/COMMON/rrc_messages_def.h b/openair2/COMMON/rrc_messages_def.h index d521eab0ff..83cd8558d4 100644 --- a/openair2/COMMON/rrc_messages_def.h +++ b/openair2/COMMON/rrc_messages_def.h @@ -64,9 +64,7 @@ MESSAGE_DEF(RRC_STATE_IND, MESSAGE_PRIORITY_MED, RrcStateInd, MESSAGE_DEF(RRC_CONFIGURATION_REQ, MESSAGE_PRIORITY_MED, RrcConfigurationReq, rrc_configuration_req) // UE: NAS -> RRC messages -#if 1 // wilson 2016-05-02 add new message to update kenb in RRC after NAS SMC complete MESSAGE_DEF(NAS_KENB_REFRESH_REQ, MESSAGE_PRIORITY_MED, NasKenbRefreshReq, nas_kenb_refresh_req) -#endif MESSAGE_DEF(NAS_CELL_SELECTION_REQ, MESSAGE_PRIORITY_MED, NasCellSelectionReq, nas_cell_selection_req) MESSAGE_DEF(NAS_CONN_ESTABLI_REQ, MESSAGE_PRIORITY_MED, NasConnEstabliReq, nas_conn_establi_req) MESSAGE_DEF(NAS_UPLINK_DATA_REQ, MESSAGE_PRIORITY_MED, NasUlDataReq, nas_ul_data_req) diff --git a/openair2/COMMON/rrc_messages_types.h b/openair2/COMMON/rrc_messages_types.h index 908510d94b..1befc4a676 100644 --- a/openair2/COMMON/rrc_messages_types.h +++ b/openair2/COMMON/rrc_messages_types.h @@ -70,9 +70,7 @@ typedef UL_DCCH_Message_t RrcUlDcchMessage; #define RRC_CONFIGURATION_REQ(mSGpTR) (mSGpTR)->ittiMsg.rrc_configuration_req -#if 1 // wilson 2016-05-02 add new message to update kenb in RRC after NAS SMC complete #define NAS_KENB_REFRESH_REQ(mSGpTR) (mSGpTR)->ittiMsg.nas_kenb_refresh_req -#endif #define NAS_CELL_SELECTION_REQ(mSGpTR) (mSGpTR)->ittiMsg.nas_cell_selection_req #define NAS_CONN_ESTABLI_REQ(mSGpTR) (mSGpTR)->ittiMsg.nas_conn_establi_req #define NAS_UPLINK_DATA_REQ(mSGpTR) (mSGpTR)->ittiMsg.nas_ul_data_req @@ -186,9 +184,7 @@ typedef struct RrcConfigurationReq_s { } RrcConfigurationReq; // UE: NAS -> RRC messages -#if 1 // wilson 2016-05-02 add new message to update kenb in RRC after NAS SMC complete typedef kenb_refresh_req_t NasKenbRefreshReq; -#endif typedef cell_info_req_t NasCellSelectionReq; typedef nas_establish_req_t NasConnEstabliReq; typedef ul_info_transfer_req_t NasUlDataReq; diff --git a/openair2/RRC/LITE/defs.h b/openair2/RRC/LITE/defs.h index e34c532990..b15b70b815 100644 --- a/openair2/RRC/LITE/defs.h +++ b/openair2/RRC/LITE/defs.h @@ -182,11 +182,7 @@ typedef enum HO_STATE_e { #define PAYLOAD_SIZE_MAX 1024 #define RRC_BUF_SIZE 255 #define UNDEF_SECURITY_MODE 0xff -#if 1 // wilson 2016-05-01 let RRC security mode command to return OK instead of failed #define NO_SECURITY_MODE 0x20 -#else -#define NO_SECURITY_MODE 0x33 -#endif #define CBA_OFFSET 0xfff4 // #define NUM_MAX_CBA_GROUP 4 // in the platform_constants diff --git a/openair2/RRC/LITE/rrc_UE.c b/openair2/RRC/LITE/rrc_UE.c index 51c7aa076d..d666e54684 100644 --- a/openair2/RRC/LITE/rrc_UE.c +++ b/openair2/RRC/LITE/rrc_UE.c @@ -1403,7 +1403,6 @@ rrc_ue_process_securityModeCommand( } -#if 1 // wilson 2016-01-05 config PDCP security mode #if defined(ENABLE_SECURITY) uint8_t *kRRCenc = NULL; uint8_t *kUPenc = NULL; @@ -1458,7 +1457,6 @@ rrc_ue_process_securityModeCommand( } #endif //#if defined(ENABLE_SECURITY) -#endif //#if 1 //wilson if (securityModeCommand->criticalExtensions.present == SecurityModeCommand__criticalExtensions_PR_c1) { if (securityModeCommand->criticalExtensions.choice.c1.present == SecurityModeCommand__criticalExtensions__c1_PR_securityModeCommand_r8) { @@ -4131,7 +4129,6 @@ void *rrc_ue_task( void *args_p ) # if defined(ENABLE_USE_MME) -#if 1 // wilson 2016-05-02 add new message to update kenb in RRC after NAS SMC complete case NAS_KENB_REFRESH_REQ: memcpy((void*)UE_rrc_inst[ue_mod_id].kenb, (void*)NAS_KENB_REFRESH_REQ(msg_p).kenb, sizeof(UE_rrc_inst[ue_mod_id].kenb)); @@ -4155,7 +4152,6 @@ void *rrc_ue_task( void *args_p ) UE_rrc_inst[ue_mod_id].kenb[28], UE_rrc_inst[ue_mod_id].kenb[29], UE_rrc_inst[ue_mod_id].kenb[30], UE_rrc_inst[ue_mod_id].kenb[31]); break; -#endif /* NAS messages */ case NAS_CELL_SELECTION_REQ: diff --git a/openair3/NAS/COMMON/API/NETWORK/l2_message.h b/openair3/NAS/COMMON/API/NETWORK/l2_message.h index 603f7c0d7d..9c349b8d06 100644 --- a/openair3/NAS/COMMON/API/NETWORK/l2_message.h +++ b/openair3/NAS/COMMON/API/NETWORK/l2_message.h @@ -124,7 +124,6 @@ typedef struct kenb_refresh_req_s { Byte_t kenb[32]; } kenb_refresh_req_t; -#if 1 // wilson 2016-05-02 add new message to update kenb in RRC after NAS SMC complete /* * NAS->AS - Cell Information request * NAS request AS to search for a suitable cell belonging to the selected @@ -134,7 +133,6 @@ typedef struct { plmn_t plmnID; /* PLMN identifier */ Byte_t rat; /* Bitmap - set of radio access technologies */ } cell_info_req_t; -#endif /* * AS->NAS - Cell Information response diff --git a/openair3/NAS/UE/EMM/SecurityModeControl.c b/openair3/NAS/UE/EMM/SecurityModeControl.c index fa500ad316..b3f2b6f8a8 100755 --- a/openair3/NAS/UE/EMM/SecurityModeControl.c +++ b/openair3/NAS/UE/EMM/SecurityModeControl.c @@ -295,9 +295,7 @@ int emm_proc_security_mode_command(int native_ksi, int ksi, _emm_data.security->selected_algorithms.encryption = seea; _emm_data.security->selected_algorithms.integrity = seia; -#if 1 // wilson 2016-05-02 add new message to update kenb in RRC after NAS SMC complete nas_itti_kenb_refresh_req(_security_data.kenb.value); -#endif } /* * NAS security mode command not accepted by the UE diff --git a/openair3/NAS/UE/nas_itti_messaging.c b/openair3/NAS/UE/nas_itti_messaging.c index ff16c83ebf..a28c7394b2 100755 --- a/openair3/NAS/UE/nas_itti_messaging.c +++ b/openair3/NAS/UE/nas_itti_messaging.c @@ -187,7 +187,6 @@ int nas_itti_protected_msg(const char *buffer, const nas_message_t *msg, const i extern unsigned char NB_eNB_INST; -#if 1 // wilson 2016-05-02 add new message to update kenb in RRC after NAS SMC complete int nas_itti_kenb_refresh_req(const Byte_t kenb[32]) { MessageDef *message_p; @@ -220,7 +219,6 @@ int nas_itti_kenb_refresh_req(const Byte_t kenb[32]) return itti_send_msg_to_task(TASK_RRC_UE, NB_eNB_INST + 0 /* TODO to be virtualized */, message_p); } -#endif int nas_itti_cell_info_req(const plmn_t plmnID, const Byte_t rat) { diff --git a/openair3/NAS/UE/nas_itti_messaging.h b/openair3/NAS/UE/nas_itti_messaging.h index dc8d41a239..a9db232d70 100755 --- a/openair3/NAS/UE/nas_itti_messaging.h +++ b/openair3/NAS/UE/nas_itti_messaging.h @@ -55,9 +55,7 @@ int nas_itti_protected_msg( # if defined(NAS_BUILT_IN_UE) -#if 1 // wilson 2016-05-02 add new message to update kenb in RRC after NAS SMC complete int nas_itti_kenb_refresh_req(const Byte_t kenb[32]); -#endif int nas_itti_cell_info_req(const plmn_t plmnID, const Byte_t rat); From 7e2c8e39f820a0dc76d340ec290ab8a26f9ea747 Mon Sep 17 00:00:00 2001 From: "Wilson W.K. Thong" Date: Tue, 3 May 2016 01:32:48 +0800 Subject: [PATCH 224/349] fixed oaisim build failed with the new KeNB refresh request message from NAS -> AS --- openair3/NAS/UE/EMM/SecurityModeControl.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/openair3/NAS/UE/EMM/SecurityModeControl.c b/openair3/NAS/UE/EMM/SecurityModeControl.c index b3f2b6f8a8..9f4186412e 100755 --- a/openair3/NAS/UE/EMM/SecurityModeControl.c +++ b/openair3/NAS/UE/EMM/SecurityModeControl.c @@ -72,7 +72,9 @@ Description Defines the security mode control EMM procedure executed by the #include "secu_defs.h" #include "msc.h" +#if defined(NAS_BUILT_IN_UE) #include "nas_itti_messaging.h" +#endif /****************************************************************************/ /**************** E X T E R N A L D E F I N I T I O N S ****************/ @@ -295,7 +297,9 @@ int emm_proc_security_mode_command(int native_ksi, int ksi, _emm_data.security->selected_algorithms.encryption = seea; _emm_data.security->selected_algorithms.integrity = seia; +#if defined(NAS_BUILT_IN_UE) nas_itti_kenb_refresh_req(_security_data.kenb.value); +#endif } /* * NAS security mode command not accepted by the UE From 19c81e741e61956cb0c49ddc2c7d65872efb1101 Mon Sep 17 00:00:00 2001 From: "Wilson W.K. Thong" Date: Sun, 18 Sep 2016 15:34:47 +0800 Subject: [PATCH 225/349] fixed hard-code DRB-ID<->LC-ID mapping (DRB-ID = LC-ID - 2) so they are not fully configurable fixed hard-code default DRB-ID (1) so it is now fully configurable (cherry picked from commit 4499124853b8985c3f157721997125370f1ca475) Conflicts: openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c Conflicts: openair2/LAYER2/PDCP_v10.1.0/pdcp.c --- openair2/LAYER2/PDCP_v10.1.0/pdcp.c | 64 ++++++++- openair2/LAYER2/PDCP_v10.1.0/pdcp.h | 20 ++- openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c | 28 +++- openair2/LAYER2/RLC/AM_v9.3.0/rlc_am.c | 10 +- openair2/LAYER2/RLC/AM_v9.3.0/rlc_am.h | 12 +- openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_init.c | 7 +- openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_init.h | 4 +- openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_test.c | 4 +- openair2/LAYER2/RLC/TM_v9.3.0/rlc_tm_init.c | 15 ++- openair2/LAYER2/RLC/TM_v9.3.0/rlc_tm_init.h | 10 +- .../RLC/UM_v9.3.0/rlc_um_control_primitives.c | 18 ++- .../RLC/UM_v9.3.0/rlc_um_control_primitives.h | 14 +- openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_test.c | 20 +-- openair2/LAYER2/RLC/rlc.h | 13 +- openair2/LAYER2/RLC/rlc_mac.c | 20 ++- openair2/LAYER2/RLC/rlc_rrc.c | 122 +++++++++++++----- openair2/RRC/LITE/defs.h | 3 + openair2/RRC/LITE/rrc_UE.c | 22 +++- openair2/RRC/LITE/rrc_eNB.c | 8 +- 19 files changed, 323 insertions(+), 91 deletions(-) diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c index 3779adbbc9..7f9017201a 100755 --- a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c +++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c @@ -1065,6 +1065,7 @@ rrc_pdcp_config_asn1_req ( #ifdef Rel10 ,PMCH_InfoList_r9_t* const pmch_InfoList_r9_pP #endif + ,rb_id_t *const defaultDRB // 2016-05-28 wilson : remember the default DRB ) //----------------------------------------------------------------------------- { @@ -1086,6 +1087,10 @@ rrc_pdcp_config_asn1_req ( hash_key_t key = HASHTABLE_NOT_A_KEY_VALUE; hashtable_rc_t h_rc; +#ifndef ASTRI_FIX // 2016-05-28 wilson : remember the default DRB + hash_key_t key_defaultDRB = HASHTABLE_NOT_A_KEY_VALUE; + hashtable_rc_t h_defaultDRB_rc; +#endif #ifdef Rel10 int i,j; MBMS_SessionInfoList_r9_t *mbms_SessionInfoList_r9_p = NULL; @@ -1106,7 +1111,11 @@ rrc_pdcp_config_asn1_req ( srb_id = srb2add_list_pP->list.array[cnt]->srb_Identity; srb_toaddmod_p = srb2add_list_pP->list.array[cnt]; rlc_type = RLC_MODE_AM; +#if 0 lc_id = srb_id;// + 2; +#else // 2016-05-27 wilson : fixing the LC-id <-> SRB-id mapping + lc_id = srb_id; +#endif key = PDCP_COLL_KEY_VALUE(ctxt_pP->module_id, ctxt_pP->rnti, ctxt_pP->enb_flag, srb_id, SRB_FLAG_YES); h_rc = hashtable_get(pdcp_coll_p, key, (void**)&pdcp_p); @@ -1186,8 +1195,23 @@ rrc_pdcp_config_asn1_req ( drb_toaddmod_p = drb2add_list_pP->list.array[cnt]; drb_id = drb_toaddmod_p->drb_Identity;// + drb_id_offset; - +#ifdef ASTRI_FIX lc_id = drb_id + 2; +#else // 2016-05-27 wilson : fixing the mapping between LC-id and DRB-id + if (drb_toaddmod_p->logicalChannelIdentity) { + lc_id = *(drb_toaddmod_p->logicalChannelIdentity); + } else { + LOG_E(PDCP, PROTOCOL_PDCP_CTXT_FMT" logicalChannelIdentity is missing in DRB-ToAddMod information element!\n", + PROTOCOL_PDCP_CTXT_ARGS(ctxt_pP, pdcp_p)); + continue; + } + + if (lc_id == 1 || lc_id == 2) { + LOG_E(RLC, PROTOCOL_CTXT_FMT" logicalChannelIdentity = %d is invalid in RRC message when adding DRB!\n", PROTOCOL_CTXT_ARGS(ctxt_pP), lc_id); + continue; + } +#endif + DevCheck4(drb_id < maxDRB, drb_id, maxDRB, ctxt_pP->module_id, ctxt_pP->rnti); key = PDCP_COLL_KEY_VALUE(ctxt_pP->module_id, ctxt_pP->rnti, ctxt_pP->enb_flag, drb_id, SRB_FLAG_NO); h_rc = hashtable_get(pdcp_coll_p, key, (void**)&pdcp_p); @@ -1203,6 +1227,22 @@ rrc_pdcp_config_asn1_req ( pdcp_p = calloc(1, sizeof(pdcp_t)); h_rc = hashtable_insert(pdcp_coll_p, key, pdcp_p); +#ifndef ASTRI_FIX + if ((defaultDRB != NULL) && (*defaultDRB == drb_id)) { + key_defaultDRB = PDCP_COLL_KEY_DEFAULT_DRB_VALUE(ctxt_pP->module_id, ctxt_pP->rnti, ctxt_pP->enb_flag); + h_defaultDRB_rc = hashtable_insert(pdcp_coll_p, key_defaultDRB, pdcp_p); + } else { + h_defaultDRB_rc = HASH_TABLE_OK; // do not trigger any error handling if this is not a default DRB + } + + if (h_defaultDRB_rc != HASH_TABLE_OK) { + LOG_E(PDCP, PROTOCOL_PDCP_CTXT_FMT" CONFIG_ACTION_ADD ADD default DRB key 0x%"PRIx64" FAILED\n", + PROTOCOL_PDCP_CTXT_ARGS(ctxt_pP, pdcp_p), + key_defaultDRB); + free(pdcp_p); + return TRUE; + } else +#endif if (h_rc != HASH_TABLE_OK) { LOG_E(PDCP, PROTOCOL_PDCP_CTXT_FMT" CONFIG_ACTION_ADD ADD key 0x%"PRIx64" FAILED\n", PROTOCOL_PDCP_CTXT_ARGS(ctxt_pP, pdcp_p), @@ -1297,7 +1337,9 @@ rrc_pdcp_config_asn1_req ( for (cnt=0; cntlist.count; cnt++) { pdrb_id_p = drb2release_list_pP->list.array[cnt]; drb_id = *pdrb_id_p; +#if 0 // 2016-05-27 wilson : fixing the hard-coded mapping between DRB-id <-> LC-id lc_id = drb_id + 2; +#endif key = PDCP_COLL_KEY_VALUE(ctxt_pP->module_id, ctxt_pP->rnti, ctxt_pP->enb_flag, srb_id, SRB_FLAG_NO); h_rc = hashtable_get(pdcp_coll_p, key, (void**)&pdcp_p); @@ -1308,6 +1350,10 @@ rrc_pdcp_config_asn1_req ( continue; } +#ifndef ASTRI_FIX // 2016-05-27 wilson : fixing the hard-coded mapping between DRB-id <-> LC-id + lc_id = pdcp_p->lcid; +#endif + action = CONFIG_ACTION_REMOVE; pdcp_config_req_asn1 ( ctxt_pP, @@ -1326,6 +1372,22 @@ rrc_pdcp_config_asn1_req ( kRRCint_pP, kUPenc_pP); h_rc = hashtable_remove(pdcp_coll_p, key); + +#ifndef ASTRI_FIX // 2016-05-28 wilson : remember the default DRB + if ((defaultDRB != NULL) && (*defaultDRB == drb_id)) { + // this is the default DRB being removed, although this is not allowed in standard + key_defaultDRB = PDCP_COLL_KEY_DEFAULT_DRB_VALUE(ctxt_pP->module_id, ctxt_pP->rnti, ctxt_pP->enb_flag); + h_defaultDRB_rc = hashtable_get(pdcp_coll_p, key_defaultDRB, (void**)&pdcp_p); + + if (h_defaultDRB_rc == HASH_TABLE_OK) { + h_defaultDRB_rc = hashtable_remove(pdcp_coll_p, key_defaultDRB); + } else { + LOG_E(PDCP, PROTOCOL_CTXT_FMT" PDCP REMOVE FAILED default DRB\n", PROTOCOL_CTXT_ARGS(ctxt_pP)); + } + } else { + key_defaultDRB = HASH_TABLE_OK; // do not trigger any error handling if this is not a default DRB + } +#endif } } diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp.h b/openair2/LAYER2/PDCP_v10.1.0/pdcp.h index 52322b1348..5f9e3f397a 100755 --- a/openair2/LAYER2/PDCP_v10.1.0/pdcp.h +++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp.h @@ -279,6 +279,7 @@ public_pdcp(void rrc_pdcp_config_req ( * \param[in] kRRCenc RRC encryption key * \param[in] kRRCint RRC integrity key * \param[in] kUPenc User-Plane encryption key +* \param[in] defaultDRB Default DRB ID * \return A status about the processing, OK or error code. */ public_pdcp( @@ -294,6 +295,7 @@ public_pdcp( #ifdef Rel10 ,PMCH_InfoList_r9_t *pmch_InfoList_r9 #endif + ,rb_id_t *const defaultDRB // 2016-05-28 wilson : remember the default DRB )); /*! \fn boolean_t pdcp_config_req_asn1 (const protocol_ctxt_t* const ctxt_pP, srb_flag_t srb_flagP, uint32_t action, rb_id_t rb_id, uint8_t rb_sn, uint8_t rb_report, uint16_t header_compression_profile, uint8_t security_mode) @@ -467,12 +469,28 @@ protected_pdcp(unsigned char pdcp_input_sdu_buffer[MAX_IP_PACKET_SIZE]; protected_pdcp(sdu_size_t pdcp_input_index_header;) protected_pdcp(sdu_size_t pdcp_input_sdu_size_read;) protected_pdcp(sdu_size_t pdcp_input_sdu_remaining_size_to_read;) + #define PDCP_COLL_KEY_VALUE(mODULE_iD, rNTI, iS_eNB, rB_iD, iS_sRB) \ ((hash_key_t)mODULE_iD | \ (((hash_key_t)(rNTI)) << 8) | \ (((hash_key_t)(iS_eNB)) << 24) | \ (((hash_key_t)(rB_iD)) << 25) | \ - (((hash_key_t)(iS_sRB)) << 33)) + (((hash_key_t)(iS_sRB)) << 33) | \ + (((hash_key_t)(0x55)) << 34)) + +#ifndef ASTRI_FIX // 2016-05-28 wilson : for remeber the default DRB + +// hash key to the same PDCP as indexed by PDCP_COLL_KEY_VALUE(... rB_iD, iS_sRB=0) where rB_iD +// is the default DRB ID. The hidden code 0x55 indicates the key is indexed by (rB_iD,is_sRB) +// whereas the hidden code 0xaa indicates the key is for default DRB only +#define PDCP_COLL_KEY_DEFAULT_DRB_VALUE(mODULE_iD, rNTI, iS_eNB) \ + ((hash_key_t)mODULE_iD | \ + (((hash_key_t)(rNTI)) << 8) | \ + (((hash_key_t)(iS_eNB)) << 24) | \ + (((hash_key_t)(0xff)) << 25) | \ + (((hash_key_t)(0x00)) << 33) | \ + (((hash_key_t)(0xaa)) << 34)) +#endif // service id max val is maxServiceCount = 16 (asn1_constants.h) diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c index 390ad5a48d..8dea985345 100755 --- a/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c +++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c @@ -75,6 +75,7 @@ extern int otg_enabled; #ifdef PDCP_USE_NETLINK #include #include +#include "NETWORK_DRIVER/UE_IP/constant.h" extern char nl_rx_buf[NL_MAX_PAYLOAD]; extern struct sockaddr_nl nas_src_addr, nas_dest_addr; @@ -194,7 +195,7 @@ int pdcp_fifo_flush_sdus(const protocol_ctxt_t* const ctxt_pP) ret = sendmsg(nas_sock_fd,&nas_msg_tx,0); if (ret<0) { - LOG_D(PDCP, "[PDCP_FIFOS] sendmsg returns %d (errno: %d)\n", ret, errno); + LOG_E(PDCP, "[PDCP_FIFOS] sendmsg returns %d (errno: %d)\n", ret, errno); MSC_LOG_TX_MESSAGE_FAILED( (ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_PDCP_ENB:MSC_PDCP_UE, (ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_IP_ENB:MSC_IP_UE, @@ -499,6 +500,10 @@ int pdcp_fifo_read_input_sdus (const protocol_ctxt_t* const ctxt_pP) ctxt.frame = ctxt_cpy.frame; ctxt.enb_flag = ctxt_cpy.enb_flag; +#ifdef PDCP_DEBUG + LOG_I(PDCP, "[PDCP][NETLINK] pdcp_read_header_g.rb_id = %d\n", pdcp_read_header_g.rb_id); +#endif + if (ctxt_cpy.enb_flag) { ctxt.module_id = 0; rab_id = pdcp_read_header_g.rb_id % maxDRB; @@ -594,11 +599,26 @@ int pdcp_fifo_read_input_sdus (const protocol_ctxt_t* const ctxt_pP) } } else { // enb_flag if (rab_id != 0) { - rab_id = rab_id % maxDRB; - key = PDCP_COLL_KEY_VALUE(ctxt.module_id, ctxt.rnti, ctxt.enb_flag, rab_id, SRB_FLAG_NO); - h_rc = hashtable_get(pdcp_coll_p, key, (void**)&pdcp_p); +#ifndef ASTRI_FIX // 2016-05-30 wilson : fix hard-code default DRB ID + if (rab_id == UE_IP_DEFAULT_RAB_ID) { + LOG_D(PDCP, "PDCP_COLL_KEY_DEFAULT_DRB_VALUE(module_id=%d, rnti=%x, enb_flag=%d)\n", + ctxt.module_id, ctxt.rnti, ctxt.enb_flag); + key = PDCP_COLL_KEY_DEFAULT_DRB_VALUE(ctxt.module_id, ctxt.rnti, ctxt.enb_flag); + h_rc = hashtable_get(pdcp_coll_p, key, (void**)&pdcp_p); + } else +#endif + { + rab_id = rab_id % maxDRB; + LOG_D(PDCP, "PDCP_COLL_KEY_VALUE(module_id=%d, rnti=%x, enb_flag=%d, rab_id=%d, SRB_FLAG=%d)\n", + ctxt.module_id, ctxt.rnti, ctxt.enb_flag, rab_id, SRB_FLAG_NO); + key = PDCP_COLL_KEY_VALUE(ctxt.module_id, ctxt.rnti, ctxt.enb_flag, rab_id, SRB_FLAG_NO); + h_rc = hashtable_get(pdcp_coll_p, key, (void**)&pdcp_p); + } if (h_rc == HASH_TABLE_OK) { +#ifndef ASTRI_FIX // 2016-05-30 wilson : fix default DRB-ID to be configurable + rab_id = pdcp_p->rb_id; +#endif #ifdef PDCP_DEBUG LOG_D(PDCP, "[FRAME %5u][UE][NETLINK][IP->PDCP] INST %d: Received socket with length %d (nlmsg_len = %d) on Rab %d \n", ctxt.frame, diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am.c b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am.c index fd8279579d..8d45ac9582 100755 --- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am.c +++ b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am.c @@ -120,7 +120,8 @@ config_req_rlc_am ( const protocol_ctxt_t* const ctxt_pP, const srb_flag_t srb_flagP, rlc_am_info_t * const config_am_pP, - const rb_id_t rb_idP + const rb_id_t rb_idP, + const logical_chan_id_t chan_idP // 2016-05-27 wilson : added this argument for storing the DRB-id <-> LC-id mapping in RLC ) { rlc_union_t *rlc_union_p = NULL; @@ -142,7 +143,7 @@ config_req_rlc_am ( config_am_pP->t_reordering, config_am_pP->t_status_prohibit); rlc_am_init(ctxt_pP, l_rlc_p); - rlc_am_set_debug_infos(ctxt_pP, l_rlc_p, srb_flagP, rb_idP); + rlc_am_set_debug_infos(ctxt_pP, l_rlc_p, srb_flagP, rb_idP, chan_idP); rlc_am_configure(ctxt_pP, l_rlc_p, config_am_pP->max_retx_threshold, config_am_pP->poll_pdu, @@ -167,7 +168,8 @@ void config_req_rlc_am_asn1 ( const protocol_ctxt_t* const ctxt_pP, const srb_flag_t srb_flagP, const struct RLC_Config__am * const config_am_pP, - const rb_id_t rb_idP) + const rb_id_t rb_idP, + const logical_chan_id_t chan_idP) // 2016-05-27 wilson : added this argument for storing the DRB-id <-> LC-id mapping in RLC { rlc_union_t *rlc_union_p = NULL; rlc_am_entity_t *l_rlc_p = NULL; @@ -208,7 +210,7 @@ void config_req_rlc_am_asn1 ( t_StatusProhibit_tab[config_am_pP->dl_AM_RLC.t_StatusProhibit]); rlc_am_init(ctxt_pP, l_rlc_p); - rlc_am_set_debug_infos(ctxt_pP, l_rlc_p, srb_flagP, rb_idP); + rlc_am_set_debug_infos(ctxt_pP, l_rlc_p, srb_flagP, rb_idP, chan_idP); rlc_am_configure(ctxt_pP, l_rlc_p, maxRetxThreshold_tab[config_am_pP->ul_AM_RLC.maxRetxThreshold], pollPDU_tab[config_am_pP->ul_AM_RLC.pollPDU], diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am.h b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am.h index 70cbb3b12e..df9f8d6c88 100755 --- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am.h +++ b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am.h @@ -135,31 +135,35 @@ public_rlc_am(void rlc_am_release ( * @{ */ -/*! \fn void config_req_rlc_am (const protocol_ctxt_t* const ctxtP, const srb_flag_t srb_flagP, rlc_am_info_t * config_amP, rb_id_t rb_idP) +/*! \fn void config_req_rlc_am (const protocol_ctxt_t* const ctxtP, const srb_flag_t srb_flagP, rlc_am_info_t * config_amP, rb_id_t rb_idP, logical_chan_id_t chan_idP) * \brief Configure the UL and DL parameters of the RLC AM * \param[in] ctxt_pP Running context. * \param[in] srb_flagP Flag to indicate signalling radio bearer (1) or data radio bearer (0). * \param[in] config_amP Configuration parameters for RLC AM instance. * \param[in] rb_idP Radio bearer identifier. +* \param[in] chan_idP Transport channel identifier. */ public_rlc_am(void config_req_rlc_am ( const protocol_ctxt_t* const ctxtP, const srb_flag_t srb_flagP, const rlc_am_info_t * const config_amP, - const rb_id_t rb_idP);) + const rb_id_t rb_idP, + const logical_chan_id_t chan_idP);) // 2016-05-27 wilson : added this argument for storing the DRB-id <-> LC-id mapping in RLC -/*! \fn void config_req_rlc_am_asn1 (const protocol_ctxt_t* const ctxtP, const srb_flag_t srb_flagP, struct RLC_Config__am * config_amP, rb_id_t rb_idP) +/*! \fn void config_req_rlc_am_asn1 (const protocol_ctxt_t* const ctxtP, const srb_flag_t srb_flagP, struct RLC_Config__am * config_amP, rb_id_t rb_idP, logical_chan_id_t chan_idP) * \brief Configure the UL and DL parameters of the RLC AM with the asn1c autogenerated pameters structs * \param[in] ctxt_pP Running context. * \param[in] srb_flagP Flag to indicate signalling radio bearer (1) or data radio bearer (0). * \param[in] config_amP Configuration parameters for RLC AM instance. * \param[in] rb_idP Radio bearer identifier. +* \param[in] chan_idP Transport channel identifier. */ public_rlc_am(void config_req_rlc_am_asn1 ( const protocol_ctxt_t* const ctxtP, const srb_flag_t srb_flagP, const struct RLC_Config__am * const config_amP, - const rb_id_t rb_idP);) + const rb_id_t rb_idP, + const logical_chan_id_t chan_idP);) // 2016-05-27 wilson : added this argument for storing the DRB-id <-> LC-id mapping in RLC /** @} */ diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_init.c b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_init.c index 81645f06fe..5dcdbc68d1 100755 --- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_init.c +++ b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_init.c @@ -253,10 +253,13 @@ rlc_am_set_debug_infos( const protocol_ctxt_t* const ctxt_pP, rlc_am_entity_t *const rlc_pP, const srb_flag_t srb_flagP, - const rb_id_t rb_idP) + const rb_id_t rb_idP, + const logical_chan_id_t chan_idP) // 2016-05-27 wilson : added this argument for storing the DRB-id <-> LC-id mapping in RLC) { - rlc_pP->rb_id = rb_idP; +#ifndef ASTRI_FIX // 2016-05-27 wilson : added this argument for storing the DRB-id <-> LC-id mapping in RLC) + rlc_pP->channel_id = chan_idP; +#endif if (srb_flagP) { rlc_pP->is_data_plane = 0; diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_init.h b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_init.h index ed2f7f2936..f3e38b6bd2 100755 --- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_init.h +++ b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_init.h @@ -112,13 +112,15 @@ public_rlc_am_init( void rlc_am_configure(const protocol_ctxt_t* const ctxtP, const uint32_t t_reorderingP, const uint32_t t_status_prohibitP);) + /*! \fn void rlc_am_set_debug_infos(const protocol_ctxt_t* const ctxtP, rlc_am_entity_t * const rlc_pP, const srb_flag_t srb_flagP, const rb_id_t rb_idP) * \brief Set informations that will be displayed in traces, helping the debug process. * \param[in] ctxtP Running context. * \param[in] rlc_pP RLC AM protocol instance pointer. * \param[in] srb_flagP Flag to indicate signalling radio bearer (1) or data radio bearer (0). * \param[in] rb_idP Radio bearer identifier. +* \param[in] chan_idP Transport channel identifier. */ -public_rlc_am_init( void rlc_am_set_debug_infos(const protocol_ctxt_t* const ctxtP, rlc_am_entity_t * const rlc_pP, const srb_flag_t srb_flagP, const rb_id_t rb_idP);) +public_rlc_am_init( void rlc_am_set_debug_infos(const protocol_ctxt_t* const ctxtP, rlc_am_entity_t * const rlc_pP, const srb_flag_t srb_flagP, const rb_id_t rb_idP, const logical_chan_id_t chan_idP /*2016-05-27 wilson : added this argument for storing the DRB-id <-> LC-id mapping in RLC)*/);) /** @} */ #endif diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_test.c b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_test.c index 13f96e1f3f..719ba2c241 100755 --- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_test.c +++ b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_test.c @@ -705,8 +705,8 @@ void rlc_am_v9_3_0_test_tx_rx() rlc_am_init(&g_am_tx, g_frame); rlc_am_init(&g_am_rx, g_frame); - rlc_am_set_debug_infos(&g_am_tx, g_frame, 0, 0, 0, 1); - rlc_am_set_debug_infos(&g_am_rx, g_frame, 1, 1, 1, 1); + rlc_am_set_debug_infos(&g_am_tx, g_frame, 0, 0, 0, 1, 1 /* LC-id = DRB-id */); + rlc_am_set_debug_infos(&g_am_rx, g_frame, 1, 1, 1, 1, 1 /* LC-id = DRB-id */); rlc_am_configure(&g_am_tx, g_frame, max_retx_threshold, poll_pdu, poll_byte, t_poll_retransmit, t_reordering, t_status_prohibit); rlc_am_configure(&g_am_rx, g_frame, max_retx_threshold, poll_pdu, poll_byte, t_poll_retransmit, t_reordering, t_status_prohibit); diff --git a/openair2/LAYER2/RLC/TM_v9.3.0/rlc_tm_init.c b/openair2/LAYER2/RLC/TM_v9.3.0/rlc_tm_init.c index 6b1b487286..533730ce68 100755 --- a/openair2/LAYER2/RLC/TM_v9.3.0/rlc_tm_init.c +++ b/openair2/LAYER2/RLC/TM_v9.3.0/rlc_tm_init.c @@ -36,7 +36,8 @@ void config_req_rlc_tm ( const protocol_ctxt_t* const ctxt_pP, const srb_flag_t srb_flagP, const rlc_tm_info_t * const config_tmP, - const rb_id_t rb_idP + const rb_id_t rb_idP, + const logical_chan_id_t chan_idP ) { rlc_union_t *rlc_union_p = NULL; @@ -55,7 +56,11 @@ void config_req_rlc_tm ( rlc_tm_init(ctxt_pP, rlc_p); rlc_p->protocol_state = RLC_DATA_TRANSFER_READY_STATE; - rlc_tm_set_debug_infos(ctxt_pP, rlc_p, rb_idP, srb_flagP); +#ifdef ASTRI_FIX + rlc_tm_set_debug_infos(ctxt_pP, rlc_p, srb_flagP, rb_idP); // 2016-05-27 wilson : fix incorrect argument ordering! +#else + rlc_tm_set_debug_infos(ctxt_pP, rlc_p, srb_flagP, rb_idP, chan_idP); // 2016-05-27 wilson : fix DRB-id <-> LC-id mapping +#endif rlc_tm_configure(ctxt_pP, rlc_p, config_tmP->is_uplink_downlink); } else { LOG_E(RLC, PROTOCOL_RLC_TM_CTXT_FMT" CONFIG_REQ RB %u RLC NOT FOUND\n", @@ -151,9 +156,11 @@ void rlc_tm_set_debug_infos( const protocol_ctxt_t* const ctxt_pP, rlc_tm_entity_t * const rlcP, const srb_flag_t srb_flagP, - const rb_id_t rb_idP) + const rb_id_t rb_idP, + const logical_chan_id_t chan_idP) // 2016-05-27 wilson : fixing the DRB-id <-> LC-id mapping { - rlcP->rb_id = rb_idP; + rlcP->rb_id = rb_idP; + rlcP->channel_id = chan_idP; if (srb_flagP) { rlcP->is_data_plane = 0; diff --git a/openair2/LAYER2/RLC/TM_v9.3.0/rlc_tm_init.h b/openair2/LAYER2/RLC/TM_v9.3.0/rlc_tm_init.h index 48322c98b8..ecd23a2c2f 100755 --- a/openair2/LAYER2/RLC/TM_v9.3.0/rlc_tm_init.h +++ b/openair2/LAYER2/RLC/TM_v9.3.0/rlc_tm_init.h @@ -80,13 +80,14 @@ typedef volatile struct rlc_tm_info_s { * \param[in] srb_flagP Flag to indicate SRB (1) or DRB (0) * \param[in] config_tmP Configuration parameters for RLC TM instance. * \param[in] rb_idP Radio bearer identifier. -* \param[in] srb_flagP Flag to indicate signalling radio bearer (1) or data radio bearer (0). +* \param[in] chan_idP Transport channel identifier. */ public_rlc_tm_init( void config_req_rlc_tm ( const protocol_ctxt_t* const ctxt_pP, const srb_flag_t srb_flagP, const rlc_tm_info_t * const config_tmP, - const rb_id_t rb_idP);) + const rb_id_t rb_idP, + const logical_chan_id_t chan_idP);) // 2016-05-27 wilson : fixing DRB-id <-> LC-id mapping /*! \fn void rlc_tm_init (const protocol_ctxt_t* const ctxt_pP, rlc_tm_entity_t * const rlcP) * \brief Initialize a RLC TM protocol instance, initialize all variables, lists, allocate buffers for making this instance ready to be configured with protocol configuration parameters. After this initialization the RLC TM protocol instance will be in RLC_NULL_STATE state. @@ -127,11 +128,14 @@ protected_rlc_tm_init(void rlc_tm_configure( * \param[in] rlcP RLC TM protocol instance pointer. * \param[in] srb_flagP Flag to indicate signalling radio bearer (1) or data radio bearer (0). * \param[in] rb_idP Radio bearer identifier. +* \param[in] chan_idP Transport channel identifier */ protected_rlc_tm_init(void rlc_tm_set_debug_infos( const protocol_ctxt_t* const ctxt_pP, rlc_tm_entity_t * const rlcP, const srb_flag_t srb_flagP, - const rb_id_t rb_idP);) + const rb_id_t rb_idP, + const logical_chan_id_t chan_idP);) /*2016-05-27 wilson : added this argument for storing the DRB-id <-> LC-id mapping in RLC)*/ + /** @} */ # endif diff --git a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_control_primitives.c b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_control_primitives.c index a91e384a55..990399c940 100755 --- a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_control_primitives.c +++ b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_control_primitives.c @@ -47,7 +47,8 @@ void config_req_rlc_um ( const protocol_ctxt_t* const ctxt_pP, const srb_flag_t srb_flagP, const rlc_um_info_t * const config_um_pP, - const rb_id_t rb_idP) + const rb_id_t rb_idP, + const logical_chan_id_t chan_idP) { rlc_union_t *rlc_union_p = NULL; rlc_um_entity_t *rlc_p = NULL; @@ -68,7 +69,7 @@ void config_req_rlc_um ( rlc_um_init(ctxt_pP, rlc_p); if (rlc_um_fsm_notify_event (ctxt_pP, rlc_p, RLC_UM_RECEIVE_CRLC_CONFIG_REQ_ENTER_DATA_TRANSFER_READY_STATE_EVENT)) { - rlc_um_set_debug_infos(ctxt_pP, rlc_p, srb_flagP, rb_idP); + rlc_um_set_debug_infos(ctxt_pP, rlc_p, srb_flagP, rb_idP, chan_idP); rlc_um_configure( ctxt_pP, rlc_p, @@ -94,7 +95,8 @@ void config_req_rlc_um_asn1 ( const mbms_service_id_t mbms_service_idP, const UL_UM_RLC_t * const ul_rlc_pP, const DL_UM_RLC_t * const dl_rlc_pP, - const rb_id_t rb_idP) + const rb_id_t rb_idP, + const logical_chan_id_t chan_idP) { uint32_t ul_sn_FieldLength = 0; uint32_t dl_sn_FieldLength = 0; @@ -142,7 +144,7 @@ void config_req_rlc_um_asn1 ( if (rlc_um_fsm_notify_event (ctxt_pP, rlc_p, RLC_UM_RECEIVE_CRLC_CONFIG_REQ_ENTER_DATA_TRANSFER_READY_STATE_EVENT)) { - rlc_um_set_debug_infos(ctxt_pP,rlc_p, srb_flagP, rb_idP); + rlc_um_set_debug_infos(ctxt_pP,rlc_p, srb_flagP, rb_idP, chan_idP); if (ul_rlc_pP != NULL) { switch (ul_rlc_pP->sn_FieldLength) { @@ -423,14 +425,16 @@ void rlc_um_configure( void rlc_um_set_debug_infos( const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t * const rlc_pP, - const srb_flag_t srb_flagP, - const rb_id_t rb_idP) + const srb_flag_t srb_flagP, + const rb_id_t rb_idP, + const logical_chan_id_t chan_idP) // 2016-05-27 wilson : fixing DRB-id <-> LC-id mapping { LOG_D(RLC, PROTOCOL_RLC_UM_CTXT_FMT" [SET DEBUG INFOS] rb_id %d srb_flag %d\n", PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP,rlc_pP), rb_idP, srb_flagP); - rlc_pP->rb_id = rb_idP; + rlc_pP->rb_id = rb_idP; + rlc_pP->channel_id = chan_idP; // 2016-05-27 wilson : fixing DRB-id <-> LC-id mapping if (srb_flagP) { rlc_pP->is_data_plane = 0; diff --git a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_control_primitives.h b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_control_primitives.h index b9a5166ed2..18dd656024 100644 --- a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_control_primitives.h +++ b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_control_primitives.h @@ -84,12 +84,14 @@ typedef volatile struct { * \param[in] srb_flagP Flag to indicate signalling radio bearer (1) or data radio bearer (0). * \param[in] config_umP Configuration parameters for RLC UM instance. * \param[in] rb_idP Radio bearer identifier. +* \param[in] chan_idP Transport channel identifier. */ public_rlc_um_control_primitives( void config_req_rlc_um ( const protocol_ctxt_t* const ctxt_pP, const srb_flag_t srb_flagP, const rlc_um_info_t * const config_umP, - const rb_id_t rb_idP);) + const rb_id_t rb_idP, + const logical_chan_id_t chan_idP);) // 2016-05-27 wilson : fixing DRB-id <-> LC-id mapping /*! \fn void config_req_rlc_um_asn1 ( * const protocol_ctxt_t* const ctxt_pP, @@ -109,6 +111,7 @@ public_rlc_um_control_primitives( void config_req_rlc_um ( * \param[in] ul_rlc_pP Configuration parameters for RLC UM UL instance. * \param[in] dl_rlc_pP Configuration parameters for RLC UM DL instance. * \param[in] rb_idP Radio bearer identifier. +* \param[in] chan_idP Transport channel identifier. */ public_rlc_um_control_primitives( void config_req_rlc_um_asn1 ( const protocol_ctxt_t* const ctxt_pP, @@ -118,7 +121,8 @@ public_rlc_um_control_primitives( void config_req_rlc_um_asn1 ( const mbms_service_id_t mbms_service_idP, const UL_UM_RLC_t * const ul_rlc_pP, const DL_UM_RLC_t * const dl_rlc_pP, - const rb_id_t rb_idP);) + const rb_id_t rb_idP, + const logical_chan_id_t chan_idP);) // 2016-05-27 wilson : fixing DRB-id <-> LC-id mapping /*! \fn void rlc_um_init (const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t * const rlc_pP) * \brief Initialize a RLC UM protocol instance, initialize all variables, lists, allocate buffers for making this instance ready to be configured with protocol configuration parameters. After this initialization the RLC UM protocol instance will be in RLC_NULL_STATE state. @@ -176,13 +180,15 @@ protected_rlc_um_control_primitives(void rlc_um_configure( * \brief Set debug informations for a RLC UM protocol instance, these informations are only for trace purpose. * \param[in] ctxtP Running context. * \param[in] rlc_pP RLC UM protocol instance pointer. -* \param[in] rb_idP Radio bearer identifier. * \param[in] srb_flagP Flag to indicate signalling radio bearer (1) or data radio bearer (0). +* \param[in] rb_idP Radio bearer identifier. +* \param[in] chan_idP Transport channel identifier. */ protected_rlc_um_control_primitives(void rlc_um_set_debug_infos( const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t * const rlc_pP, const srb_flag_t srb_flagP, - const rb_id_t rb_idP);) + const rb_id_t rb_idP, + const logical_chan_id_t chan_idP);) // 2016-05-27 wilson : fixing DRB-id <-> LC-id mapping /** @} */ # endif diff --git a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_test.c b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_test.c index 04afcff0ff..ce613be23e 100755 --- a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_test.c +++ b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_test.c @@ -195,8 +195,8 @@ void rlc_um_v9_3_0_test_windows_10() rlc_um_init(&um1); rlc_um_init(&um2); - rlc_um_set_debug_infos(&um1, g_frame, 0, 0, 0, 1); - rlc_um_set_debug_infos(&um2, g_frame, 1, 1, 1, 1); + rlc_um_set_debug_infos(&um1, g_frame, 0, 0, 0, 1, 1 /*LC-id = RAB-id*/); + rlc_um_set_debug_infos(&um2, g_frame, 1, 1, 1, 1, 1 /*LC-id = RAB-id*/); rlc_um_configure(&um1, g_frame, timer_reordering, sn_field_length, sn_field_length, is_mXch); rlc_um_configure(&um2, g_frame, timer_reordering, sn_field_length, sn_field_length, is_mXch); @@ -249,8 +249,8 @@ void rlc_um_v9_3_0_test_windows_5() rlc_um_init(&um1); rlc_um_init(&um2); - rlc_um_set_debug_infos(&um1, g_frame, 0, 0, 0, 1); - rlc_um_set_debug_infos(&um2, g_frame, 1, 1, 1, 1); + rlc_um_set_debug_infos(&um1, g_frame, 0, 0, 0, 1, 1 /* LC-id = DRB-id */); + rlc_um_set_debug_infos(&um2, g_frame, 1, 1, 1, 1, 1 /* LC-id = DRB-id */); rlc_um_configure(&um1, g_frame, timer_reordering, sn_field_length, sn_field_length, is_mXch); rlc_um_configure(&um2, g_frame, timer_reordering, sn_field_length, sn_field_length, is_mXch); @@ -621,8 +621,8 @@ void rlc_um_v9_3_0_test_reordering(uint32_t sn_field_lengthP) um_info.is_mXch = 0; srand (0); - config_req_rlc_um (&um_tx, 0,0,0, &um_info, 0, SIGNALLING_RADIO_BEARER); - config_req_rlc_um (&um_rx, 0,1,1, &um_info, 1, SIGNALLING_RADIO_BEARER); + config_req_rlc_um (&um_tx, 0,0,0, &um_info, 0, SIGNALLING_RADIO_BEARER, SIGNALLING_RADIO_BEARER /*LC-id = DRB-id*/); + config_req_rlc_um (&um_rx, 0,1,1, &um_info, 1, SIGNALLING_RADIO_BEARER, SIGNALLING_RADIO_BEARER /*LC-id = DRB-id*/); rlc_um_display_rx_window(&um_tx); @@ -743,8 +743,8 @@ void rlc_um_v9_3_0_test_tx_rx_10(void) um_info.is_mXch = 0; srand (0); - config_req_rlc_um (&um_tx, 0,0,0, &um_info, 0, SIGNALLING_RADIO_BEARER); - config_req_rlc_um (&um_rx, 0,1,1, &um_info, 1, SIGNALLING_RADIO_BEARER); + config_req_rlc_um (&um_tx, 0,0,0, &um_info, 0, SIGNALLING_RADIO_BEARER, SIGNALLING_RADIO_BEARER /*LC-id = DRB-id*/); + config_req_rlc_um (&um_rx, 0,1,1, &um_info, 1, SIGNALLING_RADIO_BEARER, SIGNALLING_RADIO_BEARER /*LC-id = DRB-id*/); rlc_um_display_rx_window(&um_tx); @@ -1072,8 +1072,8 @@ void rlc_um_v9_3_0_test_tx_rx_5(void) um_info.is_mXch = 0; srand (0); - config_req_rlc_um (&um_tx, 0,0,0, &um_info, 0, SIGNALLING_RADIO_BEARER); - config_req_rlc_um (&um_rx, 0,1,1, &um_info, 1, SIGNALLING_RADIO_BEARER); + config_req_rlc_um (&um_tx, 0,0,0, &um_info, 0, SIGNALLING_RADIO_BEARER, SIGNALLING_RADIO_BEARER /*LC-id = DRB-id*/); + config_req_rlc_um (&um_rx, 0,1,1, &um_info, 1, SIGNALLING_RADIO_BEARER, SIGNALLING_RADIO_BEARER /*LC-id = DRB-id*/); rlc_um_display_rx_window(&um_tx); diff --git a/openair2/LAYER2/RLC/rlc.h b/openair2/LAYER2/RLC/rlc.h index 72fde0b746..525e75a4d9 100755 --- a/openair2/LAYER2/RLC/rlc.h +++ b/openair2/LAYER2/RLC/rlc.h @@ -269,7 +269,18 @@ public_rlc(logical_chan_id_t rlc_mbms_rbid2lcid_eNB[NUMBER_OF_eNB_MAX][NB_RB_ (((hash_key_t)(rNTI)) << 8) | \ (((hash_key_t)(iS_eNB)) << 24) | \ (((hash_key_t)(rB_iD)) << 25) | \ - (((hash_key_t)(iS_sRB)) << 33)) + (((hash_key_t)(iS_sRB)) << 33) | \ + (((hash_key_t)(0x05)) << 34)) + +// index to the same RLC entity as RLC_COLL_KEY_VALUE(), but using LC_id instead +// the hidden last key indicates if this is a hash-key with RB_id (0x05) or LC_id (0x0a) +#define RLC_COLL_KEY_LCID_VALUE(eNB_iD, rNTI, iS_eNB, lC_iD, iS_sRB) \ + ((hash_key_t)eNB_iD | \ + (((hash_key_t)(rNTI)) << 8) | \ + (((hash_key_t)(iS_eNB)) << 24) | \ + (((hash_key_t)(lC_iD)) << 25) | \ + (((hash_key_t)(iS_sRB)) << 33) | \ + (((hash_key_t)(0x0a)) << 34)) // service id max val is maxServiceCount = 16 (asn1_constants.h) diff --git a/openair2/LAYER2/RLC/rlc_mac.c b/openair2/LAYER2/RLC/rlc_mac.c index 3bde40888f..2f347cd227 100644 --- a/openair2/LAYER2/RLC/rlc_mac.c +++ b/openair2/LAYER2/RLC/rlc_mac.c @@ -136,7 +136,7 @@ tbs_size_t mac_rlc_data_req( { //----------------------------------------------------------------------------- struct mac_data_req data_request; - rb_id_t rb_id = 0; + // rb_id_t rb_id = 0; // 2016-05-27 wilson : not needed after DRB-id <-> LC-id mapping fix rlc_mode_t rlc_mode = RLC_MODE_NONE; rlc_mbms_id_t *mbms_id_p = NULL; rlc_union_t *rlc_union_p = NULL; @@ -179,6 +179,7 @@ tbs_size_t mac_rlc_data_req( return (tbs_size_t)0; } } else { +#ifdef ASTRI_FIX // 2016-05-27 wilson : fixing the DRB-id <-> LC-id mapping if (channel_idP > 2) { rb_id = channel_idP - 2; } else { @@ -186,6 +187,9 @@ tbs_size_t mac_rlc_data_req( } key = RLC_COLL_KEY_VALUE(module_idP, rntiP, enb_flagP, rb_id, srb_flag); +#else + key = RLC_COLL_KEY_LCID_VALUE(module_idP, rntiP, enb_flagP, channel_idP, srb_flag); +#endif } h_rc = hashtable_get(rlc_coll_p, key, (void**)&rlc_union_p); @@ -194,7 +198,7 @@ tbs_size_t mac_rlc_data_req( rlc_mode = rlc_union_p->mode; } else { rlc_mode = RLC_MODE_NONE; - AssertFatal (0 , "RLC not configured rb id %u lcid %u RNTI %x!\n", rb_id, channel_idP, rntiP); + AssertFatal (0 , "RLC not configured lcid %u RNTI %x!\n", channel_idP, rntiP); } switch (rlc_mode) { @@ -244,7 +248,7 @@ void mac_rlc_data_ind ( crc_t *crcs_pP) { //----------------------------------------------------------------------------- - rb_id_t rb_id = 0; + // rb_id_t rb_id = 0; // 2016-05-27 wilson : not needed after DRB-id <-> LC-id mapping fix rlc_mode_t rlc_mode = RLC_MODE_NONE; rlc_mbms_id_t *mbms_id_p = NULL; rlc_union_t *rlc_union_p = NULL; @@ -294,6 +298,7 @@ void mac_rlc_data_ind ( return; } } else { +#ifdef ASTRI_FIX // 2016-05-27 wilson : fixing the DRB-id <-> LC-id mapping if (channel_idP > 2) { rb_id = channel_idP - 2; } else { @@ -301,6 +306,9 @@ void mac_rlc_data_ind ( } key = RLC_COLL_KEY_VALUE(module_idP, rntiP, enb_flagP, rb_id, srb_flag); +#else + key = RLC_COLL_KEY_LCID_VALUE(module_idP, rntiP, enb_flagP, channel_idP, srb_flag); +#endif } h_rc = hashtable_get(rlc_coll_p, key, (void**)&rlc_union_p); @@ -350,7 +358,7 @@ mac_rlc_status_resp_t mac_rlc_status_ind( mac_rlc_status_resp_t mac_rlc_status_resp; struct mac_status_ind tx_status; struct mac_status_resp status_resp; - rb_id_t rb_id = 0; + // rb_id_t rb_id = 0; // 2016-05-27 wilson : not needed after DRB-id <-> LC-id mapping fix rlc_mode_t rlc_mode = RLC_MODE_NONE; rlc_mbms_id_t *mbms_id_p = NULL; rlc_union_t *rlc_union_p = NULL; @@ -399,6 +407,7 @@ mac_rlc_status_resp_t mac_rlc_status_ind( key = RLC_COLL_KEY_MBMS_VALUE(module_idP, rntiP, enb_flagP, mbms_id_p->service_id, mbms_id_p->session_id); } else { +#ifdef ASTRI_FIX // 2016-05-27 wilson : fixing the DRB-id <-> LC-id mapping if (channel_idP > 2) { rb_id = channel_idP - 2; } else { @@ -406,6 +415,9 @@ mac_rlc_status_resp_t mac_rlc_status_ind( } key = RLC_COLL_KEY_VALUE(module_idP, rntiP, enb_flagP, rb_id, srb_flag); +#else + key = RLC_COLL_KEY_LCID_VALUE(module_idP, rntiP, enb_flagP, channel_idP, srb_flag); +#endif } h_rc = hashtable_get(rlc_coll_p, key, (void**)&rlc_union_p); diff --git a/openair2/LAYER2/RLC/rlc_rrc.c b/openair2/LAYER2/RLC/rlc_rrc.c index 9919cc0f70..aba2ab411f 100644 --- a/openair2/LAYER2/RLC/rlc_rrc.c +++ b/openair2/LAYER2/RLC/rlc_rrc.c @@ -104,7 +104,11 @@ rlc_op_status_t rrc_rlc_config_asn1_req (const protocol_ctxt_t * const ctxt_pP if (srb2add_listP != NULL) { for (cnt=0; cntlist.count; cnt++) { rb_id = srb2add_listP->list.array[cnt]->srb_Identity; +#if 0 lc_id = rb_id + 2; +#else // 2016-05-26 wilson : fixing the LC-id<->SRB-id mapping for SRB + lc_id = rb_id; +#endif LOG_D(RLC, "Adding SRB %d, rb_id %d\n",srb2add_listP->list.array[cnt]->srb_Identity,rb_id); srb_toaddmod_p = srb2add_listP->list.array[cnt]; @@ -125,7 +129,7 @@ rlc_op_status_t rrc_rlc_config_asn1_req (const protocol_ctxt_t * const ctxt_pP ctxt_pP, SRB_FLAG_YES, &srb_toaddmod_p->rlc_Config->choice.explicitValue.choice.am, - rb_id); + rb_id, lc_id); } else { LOG_E(RLC, PROTOCOL_CTXT_FMT" ERROR IN ALLOCATING SRB %d \n", PROTOCOL_CTXT_ARGS(ctxt_pP), @@ -144,7 +148,7 @@ rlc_op_status_t rrc_rlc_config_asn1_req (const protocol_ctxt_t * const ctxt_pP UNUSED_PARAM_MBMS_SERVICE_ID, &srb_toaddmod_p->rlc_Config->choice.explicitValue.choice.um_Bi_Directional.ul_UM_RLC, &srb_toaddmod_p->rlc_Config->choice.explicitValue.choice.um_Bi_Directional.dl_UM_RLC, - rb_id); + rb_id, lc_id); } else { LOG_E(RLC, PROTOCOL_CTXT_FMT" ERROR IN ALLOCATING SRB %d \n", PROTOCOL_CTXT_ARGS(ctxt_pP), @@ -163,7 +167,7 @@ rlc_op_status_t rrc_rlc_config_asn1_req (const protocol_ctxt_t * const ctxt_pP UNUSED_PARAM_MBMS_SERVICE_ID, &srb_toaddmod_p->rlc_Config->choice.explicitValue.choice.um_Uni_Directional_UL.ul_UM_RLC, NULL, - rb_id); + rb_id, lc_id); } else { LOG_E(RLC, PROTOCOL_CTXT_FMT" ERROR IN ALLOCATING SRB %d \n", PROTOCOL_CTXT_ARGS(ctxt_pP), @@ -182,7 +186,7 @@ rlc_op_status_t rrc_rlc_config_asn1_req (const protocol_ctxt_t * const ctxt_pP UNUSED_PARAM_MBMS_SERVICE_ID, NULL, &srb_toaddmod_p->rlc_Config->choice.explicitValue.choice.um_Uni_Directional_DL.dl_UM_RLC, - rb_id); + rb_id, lc_id); } else { LOG_E(RLC, PROTOCOL_CTXT_FMT" ERROR IN ALLOCATING SRB %d \n", PROTOCOL_CTXT_ARGS(ctxt_pP), @@ -211,7 +215,7 @@ rlc_op_status_t rrc_rlc_config_asn1_req (const protocol_ctxt_t * const ctxt_pP UNUSED_PARAM_MBMS_SERVICE_ID, NULL, // TO DO DEFAULT CONFIG NULL, // TO DO DEFAULT CONFIG - rb_id); + rb_id, lc_id); } else { LOG_D(RLC, PROTOCOL_CTXT_FMT" ERROR IN ALLOCATING SRB %d \n", PROTOCOL_CTXT_ARGS(ctxt_pP), @@ -232,7 +236,22 @@ rlc_op_status_t rrc_rlc_config_asn1_req (const protocol_ctxt_t * const ctxt_pP drb_toaddmod_p = drb2add_listP->list.array[cnt]; drb_id = drb_toaddmod_p->drb_Identity; +#if 0 lc_id = drb_id + 2; +#else // 2016-05-26 wilson : fixing the LC-id <-> DRB-id mapping + if (drb_toaddmod_p->logicalChannelIdentity) { + lc_id = *drb_toaddmod_p->logicalChannelIdentity; + } else { + LOG_E(RLC, PROTOCOL_CTXT_FMT" logicalChannelIdentity is missing from drb-ToAddMod information element!\n", PROTOCOL_CTXT_ARGS(ctxt_pP)); + continue; + } + + if (lc_id == 1 || lc_id == 2) { + LOG_E(RLC, PROTOCOL_CTXT_FMT" logicalChannelIdentity = %d is invalid in RRC message when adding DRB!\n", PROTOCOL_CTXT_ARGS(ctxt_pP), lc_id); + continue; + } + +#endif LOG_I(RLC, "Adding DRB %d, lc_id %d\n",drb_id,lc_id); @@ -249,7 +268,7 @@ rlc_op_status_t rrc_rlc_config_asn1_req (const protocol_ctxt_t * const ctxt_pP ctxt_pP, SRB_FLAG_NO, &drb_toaddmod_p->rlc_Config->choice.am, - drb_id); + drb_id, lc_id); } break; @@ -264,7 +283,7 @@ rlc_op_status_t rrc_rlc_config_asn1_req (const protocol_ctxt_t * const ctxt_pP UNUSED_PARAM_MBMS_SERVICE_ID, &drb_toaddmod_p->rlc_Config->choice.um_Bi_Directional.ul_UM_RLC, &drb_toaddmod_p->rlc_Config->choice.um_Bi_Directional.dl_UM_RLC, - drb_id); + drb_id, lc_id); } break; @@ -279,7 +298,7 @@ rlc_op_status_t rrc_rlc_config_asn1_req (const protocol_ctxt_t * const ctxt_pP UNUSED_PARAM_MBMS_SERVICE_ID, &drb_toaddmod_p->rlc_Config->choice.um_Uni_Directional_UL.ul_UM_RLC, NULL, - drb_id); + drb_id, lc_id); } break; @@ -294,7 +313,7 @@ rlc_op_status_t rrc_rlc_config_asn1_req (const protocol_ctxt_t * const ctxt_pP UNUSED_PARAM_MBMS_SERVICE_ID, NULL, &drb_toaddmod_p->rlc_Config->choice.um_Uni_Directional_DL.dl_UM_RLC, - drb_id); + drb_id, lc_id); } break; @@ -378,7 +397,7 @@ rlc_op_status_t rrc_rlc_config_asn1_req (const protocol_ctxt_t * const ctxt_pP mbms_service_id, NULL, &dl_um_rlc, - rb_id); + rb_id, lc_id); } } } @@ -459,6 +478,10 @@ rlc_op_status_t rrc_rlc_remove_rlc ( logical_chan_id_t lcid = 0; hash_key_t key = HASHTABLE_NOT_A_KEY_VALUE; hashtable_rc_t h_rc; +#ifndef ASTRI_FIX // 2016-05-27 wilson : fixing DRB-id <-> LC-id mapping + hash_key_t key_lcid = HASHTABLE_NOT_A_KEY_VALUE; + hashtable_rc_t h_lcid_rc; +#endif rlc_union_t *rlc_union_p = NULL; #ifdef Rel10 rlc_mbms_id_t *mbms_id_p = NULL; @@ -502,23 +525,51 @@ rlc_op_status_t rrc_rlc_remove_rlc ( h_rc = hashtable_get(rlc_coll_p, key, (void**)&rlc_union_p); if (h_rc == HASH_TABLE_OK) { - h_rc = hashtable_remove(rlc_coll_p, key); - LOG_D(RLC, PROTOCOL_CTXT_FMT"[%s %u] RELEASED %s\n", - PROTOCOL_CTXT_ARGS(ctxt_pP), - (srb_flagP) ? "SRB" : "DRB", - rb_idP, - (srb_flagP) ? "SRB" : "DRB"); - } else if (h_rc == HASH_TABLE_KEY_NOT_EXISTS) { - LOG_D(RLC, PROTOCOL_CTXT_FMT"[%s %u] RELEASE : RLC NOT FOUND %s\n", - PROTOCOL_CTXT_ARGS(ctxt_pP), - (srb_flagP) ? "SRB" : "DRB", - rb_idP, - (srb_flagP) ? "SRB" : "DRB"); +#ifndef ASTRI_FIX // 2016-05-27 wilson : fixing the DRB-id <-> LC-id mapping + // also remove the hash-key created by LC-id + switch (rlc_union_p->mode) { + case RLC_MODE_AM: + lcid = rlc_union_p->rlc.am.channel_id; + break; + case RLC_MODE_UM: + lcid = rlc_union_p->rlc.um.channel_id; + break; + case RLC_MODE_TM: + lcid = rlc_union_p->rlc.tm.channel_id; + break; + default: + LOG_E(RLC, PROTOCOL_CTXT_FMT"[%s %u] RLC mode is unknown!\n", + PROTOCOL_CTXT_ARGS(ctxt_pP), + (srb_flagP) ? "SRB" : "DRB", + rb_idP); + } + key_lcid = RLC_COLL_KEY_LCID_VALUE(ctxt_pP->module_id, ctxt_pP->rnti, ctxt_pP->enb_flag, lcid, srb_flagP); + h_lcid_rc = hashtable_get(rlc_coll_p, key_lcid, (void**)&rlc_union_p); } else { - LOG_E(RLC, PROTOCOL_CTXT_FMT"[%s %u] RELEASE : INTERNAL ERROR %s\n", + h_lcid_rc = HASH_TABLE_KEY_NOT_EXISTS; + } + + if ((h_rc == HASH_TABLE_OK) && (h_lcid_rc == HASH_TABLE_OK)) { + h_lcid_rc = hashtable_remove(rlc_coll_p, key_lcid); +#endif + h_rc = hashtable_remove(rlc_coll_p, key); + LOG_D(RLC, PROTOCOL_CTXT_FMT"[%s %u LCID %d] RELEASED %s\n", PROTOCOL_CTXT_ARGS(ctxt_pP), (srb_flagP) ? "SRB" : "DRB", - rb_idP, + rb_idP, lcid, + (srb_flagP) ? "SRB" : "DRB"); + } else if ((h_rc == HASH_TABLE_KEY_NOT_EXISTS) || (h_lcid_rc == HASH_TABLE_KEY_NOT_EXISTS)) { + LOG_D(RLC, PROTOCOL_CTXT_FMT"[%s %u LCID %d] RELEASE : RLC NOT FOUND %s, by RB-ID=%d, by LC-ID=%d\n", + PROTOCOL_CTXT_ARGS(ctxt_pP), + (srb_flagP) ? "SRB" : "DRB", + rb_idP, lcid, + (srb_flagP) ? "SRB" : "DRB", + h_rc, h_lcid_rc); + } else { + LOG_E(RLC, PROTOCOL_CTXT_FMT"[%s %u LCID %d] RELEASE : INTERNAL ERROR %s\n", + PROTOCOL_CTXT_ARGS(ctxt_pP), + (srb_flagP) ? "SRB" : "DRB", + rb_idP, lcid, (srb_flagP) ? "SRB" : "DRB"); } @@ -536,6 +587,10 @@ rlc_union_t* rrc_rlc_add_rlc ( //----------------------------------------------------------------------------- hash_key_t key = HASHTABLE_NOT_A_KEY_VALUE; hashtable_rc_t h_rc; +#if 1 // 2016-05-26 wilson hash_key to the same RLC entity but indexed by LC_id instead of RB_id + hash_key_t key_lcid = HASHTABLE_NOT_A_KEY_VALUE; + hashtable_rc_t h_lcid_rc; +#endif rlc_union_t *rlc_union_p = NULL; #ifdef Rel10 rlc_mbms_id_t *mbms_id_p = NULL; @@ -576,6 +631,9 @@ rlc_union_t* rrc_rlc_add_rlc ( #endif { key = RLC_COLL_KEY_VALUE(ctxt_pP->module_id, ctxt_pP->rnti, ctxt_pP->enb_flag, rb_idP, srb_flagP); +#ifndef ASTRI_FIX // 2016-05-26 wilson : fix DRB-id <-> LC-id mapping + key_lcid = RLC_COLL_KEY_LCID_VALUE(ctxt_pP->module_id, ctxt_pP->rnti, ctxt_pP->enb_flag, chan_idP, srb_flagP); +#endif } h_rc = hashtable_get(rlc_coll_p, key, (void**)&rlc_union_p); @@ -591,8 +649,11 @@ rlc_union_t* rrc_rlc_add_rlc ( } else if (h_rc == HASH_TABLE_KEY_NOT_EXISTS) { rlc_union_p = calloc(1, sizeof(rlc_union_t)); h_rc = hashtable_insert(rlc_coll_p, key, rlc_union_p); +#ifndef ASTRI_FIX // 2016-05-26 wilson + h_lcid_rc = hashtable_insert(rlc_coll_p, key_lcid, rlc_union_p); +#endif - if (h_rc == HASH_TABLE_OK) { + if ((h_rc == HASH_TABLE_OK) && (h_lcid_rc == HASH_TABLE_OK)) { #ifdef Rel10 if (MBMS_flagP == TRUE) { @@ -613,11 +674,12 @@ rlc_union_t* rrc_rlc_add_rlc ( rlc_union_p->mode = rlc_modeP; return rlc_union_p; } else { - LOG_E(RLC, PROTOCOL_CTXT_FMT"[%s %u] rrc_rlc_add_rlc FAILED %s\n", + LOG_E(RLC, PROTOCOL_CTXT_FMT"[%s %u] rrc_rlc_add_rlc FAILED %s (add by RB_id=%d; add by LC_id=%d)\n", PROTOCOL_CTXT_ARGS(ctxt_pP), (srb_flagP) ? "SRB" : "DRB", rb_idP, - (srb_flagP) ? "SRB" : "DRB"); + (srb_flagP) ? "SRB" : "DRB", + h_rc, h_lcid_rc); free(rlc_union_p); rlc_union_p = NULL; return NULL; @@ -674,7 +736,7 @@ rlc_op_status_t rrc_rlc_config_req ( ctxt_pP, srb_flagP, &rlc_infoP.rlc.rlc_am_info, - rb_idP); + rb_idP, rb_idP); break; case RLC_MODE_UM: @@ -685,7 +747,7 @@ rlc_op_status_t rrc_rlc_config_req ( ctxt_pP, srb_flagP, &rlc_infoP.rlc.rlc_um_info, - rb_idP); + rb_idP, rb_idP); break; case RLC_MODE_TM: @@ -696,7 +758,7 @@ rlc_op_status_t rrc_rlc_config_req ( ctxt_pP, srb_flagP, &rlc_infoP.rlc.rlc_tm_info, - rb_idP); + rb_idP, rb_idP); break; default: diff --git a/openair2/RRC/LITE/defs.h b/openair2/RRC/LITE/defs.h index e546b52f8e..1a39020a84 100644 --- a/openair2/RRC/LITE/defs.h +++ b/openair2/RRC/LITE/defs.h @@ -506,6 +506,9 @@ typedef struct UE_RRC_INST_s { struct SRB_ToAddMod *SRB1_config[NB_CNX_UE]; struct SRB_ToAddMod *SRB2_config[NB_CNX_UE]; struct DRB_ToAddMod *DRB_config[NB_CNX_UE][8]; +#ifndef ASTRI_FIX + rb_id_t *defaultDRB; // 2015-05-27 wilson : remember the default DRB ID +#endif MeasObjectToAddMod_t *MeasObj[NB_CNX_UE][MAX_MEAS_OBJ]; struct ReportConfigToAddMod *ReportConfig[NB_CNX_UE][MAX_MEAS_CONFIG]; struct QuantityConfig *QuantityConfig[NB_CNX_UE]; diff --git a/openair2/RRC/LITE/rrc_UE.c b/openair2/RRC/LITE/rrc_UE.c index 01c1ee6ca9..cd1389fbc0 100644 --- a/openair2/RRC/LITE/rrc_UE.c +++ b/openair2/RRC/LITE/rrc_UE.c @@ -1060,7 +1060,7 @@ rrc_ue_process_radioResourceConfigDedicated( #ifdef Rel10 ,(PMCH_InfoList_r9_t *)NULL #endif - ); + ,NULL); // Refresh SRBs rrc_rlc_config_asn1_req(ctxt_pP, @@ -1200,6 +1200,18 @@ rrc_ue_process_radioResourceConfigDedicated( // Establish DRBs if present if (radioResourceConfigDedicated->drb_ToAddModList) { + +#ifndef ASTRI_FIX // 2016-05-28 wilson : remember the default DRB ID + if ( (UE_rrc_inst[ctxt_pP->module_id].defaultDRB == NULL) && + (radioResourceConfigDedicated->drb_ToAddModList->list.count >= 1) ) { + // configure the first DRB ID as the default DRB ID + UE_rrc_inst[ctxt_pP->module_id].defaultDRB = malloc(sizeof(rb_id_t)); + *UE_rrc_inst[ctxt_pP->module_id].defaultDRB = radioResourceConfigDedicated->drb_ToAddModList->list.array[0]->drb_Identity; + LOG_I(RRC,"[UE %d] default DRB = %d\n",ctxt_pP->module_id, *UE_rrc_inst[ctxt_pP->module_id].defaultDRB); + } + +#endif + uint8_t *kUPenc = NULL; #if defined(ENABLE_SECURITY) @@ -1231,7 +1243,7 @@ rrc_ue_process_radioResourceConfigDedicated( #ifdef Rel10 ,(PMCH_InfoList_r9_t *)NULL #endif - ); + , UE_rrc_inst[ctxt_pP->module_id].defaultDRB); // Refresh DRBs rrc_rlc_config_asn1_req(ctxt_pP, @@ -1725,7 +1737,7 @@ rrc_ue_process_mobilityControlInfo( #ifdef Rel10 ,NULL #endif - ); + ,NULL); rrc_rlc_config_asn1_req(NB_eNB_INST+ue_mod_idP, frameP,0,eNB_index, NULL,// SRB_ToAddModList @@ -1734,7 +1746,7 @@ rrc_ue_process_mobilityControlInfo( #ifdef Rel10 ,NULL #endif - ); + ,NULL); */ @@ -3906,7 +3918,7 @@ static void decode_MBSFNAreaConfiguration( module_id_t ue_mod_idP, uint8_t eNB_i #ifdef Rel10 ,&(UE_rrc_inst[ue_mod_idP].mcch_message[eNB_index]->pmch_InfoList_r9) #endif - ); + ,NULL); rrc_rlc_config_asn1_req(&ctxt, NULL,// SRB_ToAddModList diff --git a/openair2/RRC/LITE/rrc_eNB.c b/openair2/RRC/LITE/rrc_eNB.c index 7f36a9b36c..428f5196f6 100644 --- a/openair2/RRC/LITE/rrc_eNB.c +++ b/openair2/RRC/LITE/rrc_eNB.c @@ -481,7 +481,7 @@ static void init_MBMS( # ifdef Rel10 , &(eNB_rrc_inst[enb_mod_idP].carrier[CC_id].mcch_message->pmch_InfoList_r9) # endif - ); + ,NULL); rrc_rlc_config_asn1_req(&ctxt, NULL, // SRB_ToAddModList @@ -3282,7 +3282,7 @@ rrc_eNB_generate_RRCConnectionReconfiguration_handover( #ifdef Rel10 , (PMCH_InfoList_r9_t *) NULL #endif - ); + ,NULL); rrc_rlc_config_asn1_req(&ctxt, ue_context_pP->ue_context.SRB_configList, @@ -3524,7 +3524,7 @@ rrc_eNB_process_RRCConnectionReconfigurationComplete( #ifdef Rel10 , (PMCH_InfoList_r9_t *) NULL #endif - ); + ,NULL); // Refresh SRBs/DRBs rrc_rlc_config_asn1_req( ctxt_pP, @@ -4336,7 +4336,7 @@ rrc_eNB_decode_ccch( # ifdef Rel10 , (PMCH_InfoList_r9_t *) NULL # endif - ); + ,NULL); rrc_rlc_config_asn1_req(ctxt_pP, ue_context_p->ue_context.SRB_configList, From 6feb848ebe204653ed565d73881ecb7ef3c0d892 Mon Sep 17 00:00:00 2001 From: "Wilson W.K. Thong" Date: Sun, 18 Sep 2016 15:35:48 +0800 Subject: [PATCH 226/349] removed all 'wilson' and 'ASTRI' words from comments Conflicts: openair2/LAYER2/PDCP_v10.1.0/pdcp.c openair2/LAYER2/RLC/rlc_rrc.c --- openair2/LAYER2/PDCP_v10.1.0/pdcp.c | 28 +++------------- openair2/LAYER2/PDCP_v10.1.0/pdcp.h | 5 +-- openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c | 7 +--- openair2/LAYER2/RLC/AM_v9.3.0/rlc_am.c | 4 +-- openair2/LAYER2/RLC/AM_v9.3.0/rlc_am.h | 4 +-- openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_init.c | 4 +-- openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_init.h | 2 +- openair2/LAYER2/RLC/TM_v9.3.0/rlc_tm_init.c | 8 ++--- openair2/LAYER2/RLC/TM_v9.3.0/rlc_tm_init.h | 4 +-- .../RLC/UM_v9.3.0/rlc_um_control_primitives.c | 4 +-- .../RLC/UM_v9.3.0/rlc_um_control_primitives.h | 6 ++-- openair2/LAYER2/RLC/rlc_mac.c | 33 ------------------- openair2/LAYER2/RLC/rlc_rrc.c | 21 +----------- openair2/RRC/LITE/defs.h | 4 +-- openair2/RRC/LITE/rrc_UE.c | 3 -- 15 files changed, 23 insertions(+), 114 deletions(-) diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c index 7f9017201a..8c7abe963c 100755 --- a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c +++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c @@ -1065,7 +1065,7 @@ rrc_pdcp_config_asn1_req ( #ifdef Rel10 ,PMCH_InfoList_r9_t* const pmch_InfoList_r9_pP #endif - ,rb_id_t *const defaultDRB // 2016-05-28 wilson : remember the default DRB + ,rb_id_t *const defaultDRB ) //----------------------------------------------------------------------------- { @@ -1087,10 +1087,8 @@ rrc_pdcp_config_asn1_req ( hash_key_t key = HASHTABLE_NOT_A_KEY_VALUE; hashtable_rc_t h_rc; -#ifndef ASTRI_FIX // 2016-05-28 wilson : remember the default DRB hash_key_t key_defaultDRB = HASHTABLE_NOT_A_KEY_VALUE; hashtable_rc_t h_defaultDRB_rc; -#endif #ifdef Rel10 int i,j; MBMS_SessionInfoList_r9_t *mbms_SessionInfoList_r9_p = NULL; @@ -1111,11 +1109,7 @@ rrc_pdcp_config_asn1_req ( srb_id = srb2add_list_pP->list.array[cnt]->srb_Identity; srb_toaddmod_p = srb2add_list_pP->list.array[cnt]; rlc_type = RLC_MODE_AM; -#if 0 - lc_id = srb_id;// + 2; -#else // 2016-05-27 wilson : fixing the LC-id <-> SRB-id mapping lc_id = srb_id; -#endif key = PDCP_COLL_KEY_VALUE(ctxt_pP->module_id, ctxt_pP->rnti, ctxt_pP->enb_flag, srb_id, SRB_FLAG_YES); h_rc = hashtable_get(pdcp_coll_p, key, (void**)&pdcp_p); @@ -1195,9 +1189,6 @@ rrc_pdcp_config_asn1_req ( drb_toaddmod_p = drb2add_list_pP->list.array[cnt]; drb_id = drb_toaddmod_p->drb_Identity;// + drb_id_offset; -#ifdef ASTRI_FIX - lc_id = drb_id + 2; -#else // 2016-05-27 wilson : fixing the mapping between LC-id and DRB-id if (drb_toaddmod_p->logicalChannelIdentity) { lc_id = *(drb_toaddmod_p->logicalChannelIdentity); } else { @@ -1210,7 +1201,6 @@ rrc_pdcp_config_asn1_req ( LOG_E(RLC, PROTOCOL_CTXT_FMT" logicalChannelIdentity = %d is invalid in RRC message when adding DRB!\n", PROTOCOL_CTXT_ARGS(ctxt_pP), lc_id); continue; } -#endif DevCheck4(drb_id < maxDRB, drb_id, maxDRB, ctxt_pP->module_id, ctxt_pP->rnti); key = PDCP_COLL_KEY_VALUE(ctxt_pP->module_id, ctxt_pP->rnti, ctxt_pP->enb_flag, drb_id, SRB_FLAG_NO); @@ -1227,7 +1217,7 @@ rrc_pdcp_config_asn1_req ( pdcp_p = calloc(1, sizeof(pdcp_t)); h_rc = hashtable_insert(pdcp_coll_p, key, pdcp_p); -#ifndef ASTRI_FIX + // save the first configured DRB-ID as the default DRB-ID if ((defaultDRB != NULL) && (*defaultDRB == drb_id)) { key_defaultDRB = PDCP_COLL_KEY_DEFAULT_DRB_VALUE(ctxt_pP->module_id, ctxt_pP->rnti, ctxt_pP->enb_flag); h_defaultDRB_rc = hashtable_insert(pdcp_coll_p, key_defaultDRB, pdcp_p); @@ -1241,9 +1231,7 @@ rrc_pdcp_config_asn1_req ( key_defaultDRB); free(pdcp_p); return TRUE; - } else -#endif - if (h_rc != HASH_TABLE_OK) { + } else if (h_rc != HASH_TABLE_OK) { LOG_E(PDCP, PROTOCOL_PDCP_CTXT_FMT" CONFIG_ACTION_ADD ADD key 0x%"PRIx64" FAILED\n", PROTOCOL_PDCP_CTXT_ARGS(ctxt_pP, pdcp_p), key); @@ -1337,9 +1325,6 @@ rrc_pdcp_config_asn1_req ( for (cnt=0; cntlist.count; cnt++) { pdrb_id_p = drb2release_list_pP->list.array[cnt]; drb_id = *pdrb_id_p; -#if 0 // 2016-05-27 wilson : fixing the hard-coded mapping between DRB-id <-> LC-id - lc_id = drb_id + 2; -#endif key = PDCP_COLL_KEY_VALUE(ctxt_pP->module_id, ctxt_pP->rnti, ctxt_pP->enb_flag, srb_id, SRB_FLAG_NO); h_rc = hashtable_get(pdcp_coll_p, key, (void**)&pdcp_p); @@ -1349,10 +1334,7 @@ rrc_pdcp_config_asn1_req ( drb_id); continue; } - -#ifndef ASTRI_FIX // 2016-05-27 wilson : fixing the hard-coded mapping between DRB-id <-> LC-id lc_id = pdcp_p->lcid; -#endif action = CONFIG_ACTION_REMOVE; pdcp_config_req_asn1 ( @@ -1373,9 +1355,8 @@ rrc_pdcp_config_asn1_req ( kUPenc_pP); h_rc = hashtable_remove(pdcp_coll_p, key); -#ifndef ASTRI_FIX // 2016-05-28 wilson : remember the default DRB if ((defaultDRB != NULL) && (*defaultDRB == drb_id)) { - // this is the default DRB being removed, although this is not allowed in standard + // default DRB being removed. nevertheless this shouldn't happen as removing default DRB is not allowed in standard key_defaultDRB = PDCP_COLL_KEY_DEFAULT_DRB_VALUE(ctxt_pP->module_id, ctxt_pP->rnti, ctxt_pP->enb_flag); h_defaultDRB_rc = hashtable_get(pdcp_coll_p, key_defaultDRB, (void**)&pdcp_p); @@ -1387,7 +1368,6 @@ rrc_pdcp_config_asn1_req ( } else { key_defaultDRB = HASH_TABLE_OK; // do not trigger any error handling if this is not a default DRB } -#endif } } diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp.h b/openair2/LAYER2/PDCP_v10.1.0/pdcp.h index 5f9e3f397a..7d162d1609 100755 --- a/openair2/LAYER2/PDCP_v10.1.0/pdcp.h +++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp.h @@ -295,7 +295,7 @@ public_pdcp( #ifdef Rel10 ,PMCH_InfoList_r9_t *pmch_InfoList_r9 #endif - ,rb_id_t *const defaultDRB // 2016-05-28 wilson : remember the default DRB + ,rb_id_t *const defaultDRB )); /*! \fn boolean_t pdcp_config_req_asn1 (const protocol_ctxt_t* const ctxt_pP, srb_flag_t srb_flagP, uint32_t action, rb_id_t rb_id, uint8_t rb_sn, uint8_t rb_report, uint16_t header_compression_profile, uint8_t security_mode) @@ -478,8 +478,6 @@ protected_pdcp(sdu_size_t pdcp_input_sdu_remaining_size_to_read;) (((hash_key_t)(iS_sRB)) << 33) | \ (((hash_key_t)(0x55)) << 34)) -#ifndef ASTRI_FIX // 2016-05-28 wilson : for remeber the default DRB - // hash key to the same PDCP as indexed by PDCP_COLL_KEY_VALUE(... rB_iD, iS_sRB=0) where rB_iD // is the default DRB ID. The hidden code 0x55 indicates the key is indexed by (rB_iD,is_sRB) // whereas the hidden code 0xaa indicates the key is for default DRB only @@ -490,7 +488,6 @@ protected_pdcp(sdu_size_t pdcp_input_sdu_remaining_size_to_read;) (((hash_key_t)(0xff)) << 25) | \ (((hash_key_t)(0x00)) << 33) | \ (((hash_key_t)(0xaa)) << 34)) -#endif // service id max val is maxServiceCount = 16 (asn1_constants.h) diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c index 8dea985345..1cde2010f4 100755 --- a/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c +++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c @@ -599,15 +599,12 @@ int pdcp_fifo_read_input_sdus (const protocol_ctxt_t* const ctxt_pP) } } else { // enb_flag if (rab_id != 0) { -#ifndef ASTRI_FIX // 2016-05-30 wilson : fix hard-code default DRB ID if (rab_id == UE_IP_DEFAULT_RAB_ID) { LOG_D(PDCP, "PDCP_COLL_KEY_DEFAULT_DRB_VALUE(module_id=%d, rnti=%x, enb_flag=%d)\n", ctxt.module_id, ctxt.rnti, ctxt.enb_flag); key = PDCP_COLL_KEY_DEFAULT_DRB_VALUE(ctxt.module_id, ctxt.rnti, ctxt.enb_flag); h_rc = hashtable_get(pdcp_coll_p, key, (void**)&pdcp_p); - } else -#endif - { + } else { rab_id = rab_id % maxDRB; LOG_D(PDCP, "PDCP_COLL_KEY_VALUE(module_id=%d, rnti=%x, enb_flag=%d, rab_id=%d, SRB_FLAG=%d)\n", ctxt.module_id, ctxt.rnti, ctxt.enb_flag, rab_id, SRB_FLAG_NO); @@ -616,9 +613,7 @@ int pdcp_fifo_read_input_sdus (const protocol_ctxt_t* const ctxt_pP) } if (h_rc == HASH_TABLE_OK) { -#ifndef ASTRI_FIX // 2016-05-30 wilson : fix default DRB-ID to be configurable rab_id = pdcp_p->rb_id; -#endif #ifdef PDCP_DEBUG LOG_D(PDCP, "[FRAME %5u][UE][NETLINK][IP->PDCP] INST %d: Received socket with length %d (nlmsg_len = %d) on Rab %d \n", ctxt.frame, diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am.c b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am.c index 8d45ac9582..ff807f711e 100755 --- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am.c +++ b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am.c @@ -121,7 +121,7 @@ config_req_rlc_am ( const srb_flag_t srb_flagP, rlc_am_info_t * const config_am_pP, const rb_id_t rb_idP, - const logical_chan_id_t chan_idP // 2016-05-27 wilson : added this argument for storing the DRB-id <-> LC-id mapping in RLC + const logical_chan_id_t chan_idP ) { rlc_union_t *rlc_union_p = NULL; @@ -169,7 +169,7 @@ void config_req_rlc_am_asn1 ( const srb_flag_t srb_flagP, const struct RLC_Config__am * const config_am_pP, const rb_id_t rb_idP, - const logical_chan_id_t chan_idP) // 2016-05-27 wilson : added this argument for storing the DRB-id <-> LC-id mapping in RLC + const logical_chan_id_t chan_idP) { rlc_union_t *rlc_union_p = NULL; rlc_am_entity_t *l_rlc_p = NULL; diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am.h b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am.h index df9f8d6c88..305326113e 100755 --- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am.h +++ b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am.h @@ -148,7 +148,7 @@ public_rlc_am(void config_req_rlc_am ( const srb_flag_t srb_flagP, const rlc_am_info_t * const config_amP, const rb_id_t rb_idP, - const logical_chan_id_t chan_idP);) // 2016-05-27 wilson : added this argument for storing the DRB-id <-> LC-id mapping in RLC + const logical_chan_id_t chan_idP);) /*! \fn void config_req_rlc_am_asn1 (const protocol_ctxt_t* const ctxtP, const srb_flag_t srb_flagP, struct RLC_Config__am * config_amP, rb_id_t rb_idP, logical_chan_id_t chan_idP) * \brief Configure the UL and DL parameters of the RLC AM with the asn1c autogenerated pameters structs @@ -163,7 +163,7 @@ public_rlc_am(void config_req_rlc_am_asn1 ( const srb_flag_t srb_flagP, const struct RLC_Config__am * const config_amP, const rb_id_t rb_idP, - const logical_chan_id_t chan_idP);) // 2016-05-27 wilson : added this argument for storing the DRB-id <-> LC-id mapping in RLC + const logical_chan_id_t chan_idP);) /** @} */ diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_init.c b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_init.c index 5dcdbc68d1..1c82c1ff4b 100755 --- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_init.c +++ b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_init.c @@ -254,12 +254,10 @@ rlc_am_set_debug_infos( rlc_am_entity_t *const rlc_pP, const srb_flag_t srb_flagP, const rb_id_t rb_idP, - const logical_chan_id_t chan_idP) // 2016-05-27 wilson : added this argument for storing the DRB-id <-> LC-id mapping in RLC) + const logical_chan_id_t chan_idP) { rlc_pP->rb_id = rb_idP; -#ifndef ASTRI_FIX // 2016-05-27 wilson : added this argument for storing the DRB-id <-> LC-id mapping in RLC) rlc_pP->channel_id = chan_idP; -#endif if (srb_flagP) { rlc_pP->is_data_plane = 0; diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_init.h b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_init.h index f3e38b6bd2..342921bcc9 100755 --- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_init.h +++ b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_init.h @@ -121,6 +121,6 @@ public_rlc_am_init( void rlc_am_configure(const protocol_ctxt_t* const ctxtP, * \param[in] rb_idP Radio bearer identifier. * \param[in] chan_idP Transport channel identifier. */ -public_rlc_am_init( void rlc_am_set_debug_infos(const protocol_ctxt_t* const ctxtP, rlc_am_entity_t * const rlc_pP, const srb_flag_t srb_flagP, const rb_id_t rb_idP, const logical_chan_id_t chan_idP /*2016-05-27 wilson : added this argument for storing the DRB-id <-> LC-id mapping in RLC)*/);) +public_rlc_am_init( void rlc_am_set_debug_infos(const protocol_ctxt_t* const ctxtP, rlc_am_entity_t * const rlc_pP, const srb_flag_t srb_flagP, const rb_id_t rb_idP, const logical_chan_id_t chan_idP);) /** @} */ #endif diff --git a/openair2/LAYER2/RLC/TM_v9.3.0/rlc_tm_init.c b/openair2/LAYER2/RLC/TM_v9.3.0/rlc_tm_init.c index 533730ce68..f89aa3b454 100755 --- a/openair2/LAYER2/RLC/TM_v9.3.0/rlc_tm_init.c +++ b/openair2/LAYER2/RLC/TM_v9.3.0/rlc_tm_init.c @@ -56,11 +56,7 @@ void config_req_rlc_tm ( rlc_tm_init(ctxt_pP, rlc_p); rlc_p->protocol_state = RLC_DATA_TRANSFER_READY_STATE; -#ifdef ASTRI_FIX - rlc_tm_set_debug_infos(ctxt_pP, rlc_p, srb_flagP, rb_idP); // 2016-05-27 wilson : fix incorrect argument ordering! -#else - rlc_tm_set_debug_infos(ctxt_pP, rlc_p, srb_flagP, rb_idP, chan_idP); // 2016-05-27 wilson : fix DRB-id <-> LC-id mapping -#endif + rlc_tm_set_debug_infos(ctxt_pP, rlc_p, srb_flagP, rb_idP, chan_idP); rlc_tm_configure(ctxt_pP, rlc_p, config_tmP->is_uplink_downlink); } else { LOG_E(RLC, PROTOCOL_RLC_TM_CTXT_FMT" CONFIG_REQ RB %u RLC NOT FOUND\n", @@ -157,7 +153,7 @@ void rlc_tm_set_debug_infos( rlc_tm_entity_t * const rlcP, const srb_flag_t srb_flagP, const rb_id_t rb_idP, - const logical_chan_id_t chan_idP) // 2016-05-27 wilson : fixing the DRB-id <-> LC-id mapping + const logical_chan_id_t chan_idP) { rlcP->rb_id = rb_idP; rlcP->channel_id = chan_idP; diff --git a/openair2/LAYER2/RLC/TM_v9.3.0/rlc_tm_init.h b/openair2/LAYER2/RLC/TM_v9.3.0/rlc_tm_init.h index ecd23a2c2f..daf9b5a643 100755 --- a/openair2/LAYER2/RLC/TM_v9.3.0/rlc_tm_init.h +++ b/openair2/LAYER2/RLC/TM_v9.3.0/rlc_tm_init.h @@ -87,7 +87,7 @@ public_rlc_tm_init( void config_req_rlc_tm ( const srb_flag_t srb_flagP, const rlc_tm_info_t * const config_tmP, const rb_id_t rb_idP, - const logical_chan_id_t chan_idP);) // 2016-05-27 wilson : fixing DRB-id <-> LC-id mapping + const logical_chan_id_t chan_idP);) /*! \fn void rlc_tm_init (const protocol_ctxt_t* const ctxt_pP, rlc_tm_entity_t * const rlcP) * \brief Initialize a RLC TM protocol instance, initialize all variables, lists, allocate buffers for making this instance ready to be configured with protocol configuration parameters. After this initialization the RLC TM protocol instance will be in RLC_NULL_STATE state. @@ -135,7 +135,7 @@ protected_rlc_tm_init(void rlc_tm_set_debug_infos( rlc_tm_entity_t * const rlcP, const srb_flag_t srb_flagP, const rb_id_t rb_idP, - const logical_chan_id_t chan_idP);) /*2016-05-27 wilson : added this argument for storing the DRB-id <-> LC-id mapping in RLC)*/ + const logical_chan_id_t chan_idP);) /** @} */ # endif diff --git a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_control_primitives.c b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_control_primitives.c index 990399c940..1ecf5f882a 100755 --- a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_control_primitives.c +++ b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_control_primitives.c @@ -427,14 +427,14 @@ void rlc_um_set_debug_infos( rlc_um_entity_t * const rlc_pP, const srb_flag_t srb_flagP, const rb_id_t rb_idP, - const logical_chan_id_t chan_idP) // 2016-05-27 wilson : fixing DRB-id <-> LC-id mapping + const logical_chan_id_t chan_idP) { LOG_D(RLC, PROTOCOL_RLC_UM_CTXT_FMT" [SET DEBUG INFOS] rb_id %d srb_flag %d\n", PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP,rlc_pP), rb_idP, srb_flagP); rlc_pP->rb_id = rb_idP; - rlc_pP->channel_id = chan_idP; // 2016-05-27 wilson : fixing DRB-id <-> LC-id mapping + rlc_pP->channel_id = chan_idP; if (srb_flagP) { rlc_pP->is_data_plane = 0; diff --git a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_control_primitives.h b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_control_primitives.h index 18dd656024..af3934f662 100644 --- a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_control_primitives.h +++ b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_control_primitives.h @@ -91,7 +91,7 @@ public_rlc_um_control_primitives( void config_req_rlc_um ( const srb_flag_t srb_flagP, const rlc_um_info_t * const config_umP, const rb_id_t rb_idP, - const logical_chan_id_t chan_idP);) // 2016-05-27 wilson : fixing DRB-id <-> LC-id mapping + const logical_chan_id_t chan_idP);) /*! \fn void config_req_rlc_um_asn1 ( * const protocol_ctxt_t* const ctxt_pP, @@ -122,7 +122,7 @@ public_rlc_um_control_primitives( void config_req_rlc_um_asn1 ( const UL_UM_RLC_t * const ul_rlc_pP, const DL_UM_RLC_t * const dl_rlc_pP, const rb_id_t rb_idP, - const logical_chan_id_t chan_idP);) // 2016-05-27 wilson : fixing DRB-id <-> LC-id mapping + const logical_chan_id_t chan_idP);) /*! \fn void rlc_um_init (const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t * const rlc_pP) * \brief Initialize a RLC UM protocol instance, initialize all variables, lists, allocate buffers for making this instance ready to be configured with protocol configuration parameters. After this initialization the RLC UM protocol instance will be in RLC_NULL_STATE state. @@ -189,6 +189,6 @@ protected_rlc_um_control_primitives(void rlc_um_set_debug_infos( rlc_um_entity_t * const rlc_pP, const srb_flag_t srb_flagP, const rb_id_t rb_idP, - const logical_chan_id_t chan_idP);) // 2016-05-27 wilson : fixing DRB-id <-> LC-id mapping + const logical_chan_id_t chan_idP);) /** @} */ # endif diff --git a/openair2/LAYER2/RLC/rlc_mac.c b/openair2/LAYER2/RLC/rlc_mac.c index 2f347cd227..76dab9a6d3 100644 --- a/openair2/LAYER2/RLC/rlc_mac.c +++ b/openair2/LAYER2/RLC/rlc_mac.c @@ -136,7 +136,6 @@ tbs_size_t mac_rlc_data_req( { //----------------------------------------------------------------------------- struct mac_data_req data_request; - // rb_id_t rb_id = 0; // 2016-05-27 wilson : not needed after DRB-id <-> LC-id mapping fix rlc_mode_t rlc_mode = RLC_MODE_NONE; rlc_mbms_id_t *mbms_id_p = NULL; rlc_union_t *rlc_union_p = NULL; @@ -179,17 +178,7 @@ tbs_size_t mac_rlc_data_req( return (tbs_size_t)0; } } else { -#ifdef ASTRI_FIX // 2016-05-27 wilson : fixing the DRB-id <-> LC-id mapping - if (channel_idP > 2) { - rb_id = channel_idP - 2; - } else { - rb_id = channel_idP; - } - - key = RLC_COLL_KEY_VALUE(module_idP, rntiP, enb_flagP, rb_id, srb_flag); -#else key = RLC_COLL_KEY_LCID_VALUE(module_idP, rntiP, enb_flagP, channel_idP, srb_flag); -#endif } h_rc = hashtable_get(rlc_coll_p, key, (void**)&rlc_union_p); @@ -248,7 +237,6 @@ void mac_rlc_data_ind ( crc_t *crcs_pP) { //----------------------------------------------------------------------------- - // rb_id_t rb_id = 0; // 2016-05-27 wilson : not needed after DRB-id <-> LC-id mapping fix rlc_mode_t rlc_mode = RLC_MODE_NONE; rlc_mbms_id_t *mbms_id_p = NULL; rlc_union_t *rlc_union_p = NULL; @@ -298,17 +286,7 @@ void mac_rlc_data_ind ( return; } } else { -#ifdef ASTRI_FIX // 2016-05-27 wilson : fixing the DRB-id <-> LC-id mapping - if (channel_idP > 2) { - rb_id = channel_idP - 2; - } else { - rb_id = channel_idP; - } - - key = RLC_COLL_KEY_VALUE(module_idP, rntiP, enb_flagP, rb_id, srb_flag); -#else key = RLC_COLL_KEY_LCID_VALUE(module_idP, rntiP, enb_flagP, channel_idP, srb_flag); -#endif } h_rc = hashtable_get(rlc_coll_p, key, (void**)&rlc_union_p); @@ -358,7 +336,6 @@ mac_rlc_status_resp_t mac_rlc_status_ind( mac_rlc_status_resp_t mac_rlc_status_resp; struct mac_status_ind tx_status; struct mac_status_resp status_resp; - // rb_id_t rb_id = 0; // 2016-05-27 wilson : not needed after DRB-id <-> LC-id mapping fix rlc_mode_t rlc_mode = RLC_MODE_NONE; rlc_mbms_id_t *mbms_id_p = NULL; rlc_union_t *rlc_union_p = NULL; @@ -407,17 +384,7 @@ mac_rlc_status_resp_t mac_rlc_status_ind( key = RLC_COLL_KEY_MBMS_VALUE(module_idP, rntiP, enb_flagP, mbms_id_p->service_id, mbms_id_p->session_id); } else { -#ifdef ASTRI_FIX // 2016-05-27 wilson : fixing the DRB-id <-> LC-id mapping - if (channel_idP > 2) { - rb_id = channel_idP - 2; - } else { - rb_id = channel_idP; - } - - key = RLC_COLL_KEY_VALUE(module_idP, rntiP, enb_flagP, rb_id, srb_flag); -#else key = RLC_COLL_KEY_LCID_VALUE(module_idP, rntiP, enb_flagP, channel_idP, srb_flag); -#endif } h_rc = hashtable_get(rlc_coll_p, key, (void**)&rlc_union_p); diff --git a/openair2/LAYER2/RLC/rlc_rrc.c b/openair2/LAYER2/RLC/rlc_rrc.c index aba2ab411f..c6ef4a1c5d 100644 --- a/openair2/LAYER2/RLC/rlc_rrc.c +++ b/openair2/LAYER2/RLC/rlc_rrc.c @@ -104,11 +104,7 @@ rlc_op_status_t rrc_rlc_config_asn1_req (const protocol_ctxt_t * const ctxt_pP if (srb2add_listP != NULL) { for (cnt=0; cntlist.count; cnt++) { rb_id = srb2add_listP->list.array[cnt]->srb_Identity; -#if 0 - lc_id = rb_id + 2; -#else // 2016-05-26 wilson : fixing the LC-id<->SRB-id mapping for SRB lc_id = rb_id; -#endif LOG_D(RLC, "Adding SRB %d, rb_id %d\n",srb2add_listP->list.array[cnt]->srb_Identity,rb_id); srb_toaddmod_p = srb2add_listP->list.array[cnt]; @@ -236,9 +232,6 @@ rlc_op_status_t rrc_rlc_config_asn1_req (const protocol_ctxt_t * const ctxt_pP drb_toaddmod_p = drb2add_listP->list.array[cnt]; drb_id = drb_toaddmod_p->drb_Identity; -#if 0 - lc_id = drb_id + 2; -#else // 2016-05-26 wilson : fixing the LC-id <-> DRB-id mapping if (drb_toaddmod_p->logicalChannelIdentity) { lc_id = *drb_toaddmod_p->logicalChannelIdentity; } else { @@ -251,9 +244,7 @@ rlc_op_status_t rrc_rlc_config_asn1_req (const protocol_ctxt_t * const ctxt_pP continue; } -#endif - - LOG_I(RLC, "Adding DRB %d, lc_id %d\n",drb_id,lc_id); + LOG_D(RLC, "Adding DRB %d, lc_id %d\n",drb_id,lc_id); if (drb_toaddmod_p->rlc_Config) { @@ -478,10 +469,8 @@ rlc_op_status_t rrc_rlc_remove_rlc ( logical_chan_id_t lcid = 0; hash_key_t key = HASHTABLE_NOT_A_KEY_VALUE; hashtable_rc_t h_rc; -#ifndef ASTRI_FIX // 2016-05-27 wilson : fixing DRB-id <-> LC-id mapping hash_key_t key_lcid = HASHTABLE_NOT_A_KEY_VALUE; hashtable_rc_t h_lcid_rc; -#endif rlc_union_t *rlc_union_p = NULL; #ifdef Rel10 rlc_mbms_id_t *mbms_id_p = NULL; @@ -525,7 +514,6 @@ rlc_op_status_t rrc_rlc_remove_rlc ( h_rc = hashtable_get(rlc_coll_p, key, (void**)&rlc_union_p); if (h_rc == HASH_TABLE_OK) { -#ifndef ASTRI_FIX // 2016-05-27 wilson : fixing the DRB-id <-> LC-id mapping // also remove the hash-key created by LC-id switch (rlc_union_p->mode) { case RLC_MODE_AM: @@ -551,7 +539,6 @@ rlc_op_status_t rrc_rlc_remove_rlc ( if ((h_rc == HASH_TABLE_OK) && (h_lcid_rc == HASH_TABLE_OK)) { h_lcid_rc = hashtable_remove(rlc_coll_p, key_lcid); -#endif h_rc = hashtable_remove(rlc_coll_p, key); LOG_D(RLC, PROTOCOL_CTXT_FMT"[%s %u LCID %d] RELEASED %s\n", PROTOCOL_CTXT_ARGS(ctxt_pP), @@ -587,10 +574,8 @@ rlc_union_t* rrc_rlc_add_rlc ( //----------------------------------------------------------------------------- hash_key_t key = HASHTABLE_NOT_A_KEY_VALUE; hashtable_rc_t h_rc; -#if 1 // 2016-05-26 wilson hash_key to the same RLC entity but indexed by LC_id instead of RB_id hash_key_t key_lcid = HASHTABLE_NOT_A_KEY_VALUE; hashtable_rc_t h_lcid_rc; -#endif rlc_union_t *rlc_union_p = NULL; #ifdef Rel10 rlc_mbms_id_t *mbms_id_p = NULL; @@ -631,9 +616,7 @@ rlc_union_t* rrc_rlc_add_rlc ( #endif { key = RLC_COLL_KEY_VALUE(ctxt_pP->module_id, ctxt_pP->rnti, ctxt_pP->enb_flag, rb_idP, srb_flagP); -#ifndef ASTRI_FIX // 2016-05-26 wilson : fix DRB-id <-> LC-id mapping key_lcid = RLC_COLL_KEY_LCID_VALUE(ctxt_pP->module_id, ctxt_pP->rnti, ctxt_pP->enb_flag, chan_idP, srb_flagP); -#endif } h_rc = hashtable_get(rlc_coll_p, key, (void**)&rlc_union_p); @@ -649,9 +632,7 @@ rlc_union_t* rrc_rlc_add_rlc ( } else if (h_rc == HASH_TABLE_KEY_NOT_EXISTS) { rlc_union_p = calloc(1, sizeof(rlc_union_t)); h_rc = hashtable_insert(rlc_coll_p, key, rlc_union_p); -#ifndef ASTRI_FIX // 2016-05-26 wilson h_lcid_rc = hashtable_insert(rlc_coll_p, key_lcid, rlc_union_p); -#endif if ((h_rc == HASH_TABLE_OK) && (h_lcid_rc == HASH_TABLE_OK)) { #ifdef Rel10 diff --git a/openair2/RRC/LITE/defs.h b/openair2/RRC/LITE/defs.h index 1a39020a84..04d1fcc9f5 100644 --- a/openair2/RRC/LITE/defs.h +++ b/openair2/RRC/LITE/defs.h @@ -506,9 +506,7 @@ typedef struct UE_RRC_INST_s { struct SRB_ToAddMod *SRB1_config[NB_CNX_UE]; struct SRB_ToAddMod *SRB2_config[NB_CNX_UE]; struct DRB_ToAddMod *DRB_config[NB_CNX_UE][8]; -#ifndef ASTRI_FIX - rb_id_t *defaultDRB; // 2015-05-27 wilson : remember the default DRB ID -#endif + rb_id_t *defaultDRB; // remember the ID of the default DRB MeasObjectToAddMod_t *MeasObj[NB_CNX_UE][MAX_MEAS_OBJ]; struct ReportConfigToAddMod *ReportConfig[NB_CNX_UE][MAX_MEAS_CONFIG]; struct QuantityConfig *QuantityConfig[NB_CNX_UE]; diff --git a/openair2/RRC/LITE/rrc_UE.c b/openair2/RRC/LITE/rrc_UE.c index cd1389fbc0..b51b00241f 100644 --- a/openair2/RRC/LITE/rrc_UE.c +++ b/openair2/RRC/LITE/rrc_UE.c @@ -1201,7 +1201,6 @@ rrc_ue_process_radioResourceConfigDedicated( // Establish DRBs if present if (radioResourceConfigDedicated->drb_ToAddModList) { -#ifndef ASTRI_FIX // 2016-05-28 wilson : remember the default DRB ID if ( (UE_rrc_inst[ctxt_pP->module_id].defaultDRB == NULL) && (radioResourceConfigDedicated->drb_ToAddModList->list.count >= 1) ) { // configure the first DRB ID as the default DRB ID @@ -1210,8 +1209,6 @@ rrc_ue_process_radioResourceConfigDedicated( LOG_I(RRC,"[UE %d] default DRB = %d\n",ctxt_pP->module_id, *UE_rrc_inst[ctxt_pP->module_id].defaultDRB); } -#endif - uint8_t *kUPenc = NULL; #if defined(ENABLE_SECURITY) From 1de77c7a4e4c792b51c86954a77be03366b361bf Mon Sep 17 00:00:00 2001 From: "Wilson W.K. Thong" Date: Fri, 29 Jul 2016 17:01:00 +0800 Subject: [PATCH 227/349] changed so USRP also uses the piece of codes EXMIMO is uing in setting TA=624 when it is TDD (cherry picked from commit a75dbc4156ed4e216145f1deb81c6e04c1cddf02) --- targets/RT/USER/lte-softmodem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/targets/RT/USER/lte-softmodem.c b/targets/RT/USER/lte-softmodem.c index ee4344cd2d..59b2604ec5 100644 --- a/targets/RT/USER/lte-softmodem.c +++ b/targets/RT/USER/lte-softmodem.c @@ -3163,7 +3163,7 @@ int main( int argc, char **argv ) UE[CC_id]->tx_power_max_dBm = tx_max_power[CC_id]; -#ifdef EXMIMO +#if defined(EXMIMO) || defined(OAI_USRP) // 2016-04-27 wilson also set TDD N_TA_offset with USRP //N_TA_offset if (UE[CC_id]->lte_frame_parms.frame_type == TDD) { if (UE[CC_id]->lte_frame_parms.N_RB_DL == 100) From 95077bae4f88c83bd828c8c5be71f75cf67fdbd3 Mon Sep 17 00:00:00 2001 From: "Wilson W.K. Thong" Date: Mon, 19 Sep 2016 12:01:16 +0800 Subject: [PATCH 228/349] removed words 'wilson' from src --- targets/RT/USER/lte-softmodem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/targets/RT/USER/lte-softmodem.c b/targets/RT/USER/lte-softmodem.c index 59b2604ec5..28d7620810 100644 --- a/targets/RT/USER/lte-softmodem.c +++ b/targets/RT/USER/lte-softmodem.c @@ -3163,7 +3163,7 @@ int main( int argc, char **argv ) UE[CC_id]->tx_power_max_dBm = tx_max_power[CC_id]; -#if defined(EXMIMO) || defined(OAI_USRP) // 2016-04-27 wilson also set TDD N_TA_offset with USRP +#if defined(EXMIMO) || defined(OAI_USRP) //N_TA_offset if (UE[CC_id]->lte_frame_parms.frame_type == TDD) { if (UE[CC_id]->lte_frame_parms.N_RB_DL == 100) From 754cab7ec44631db4bc194829e0880e1954c2b1b Mon Sep 17 00:00:00 2001 From: "Wilson W.K. Thong" Date: Mon, 19 Sep 2016 15:08:50 +0800 Subject: [PATCH 229/349] added SFN to wireshark logging output Conflicts: openair2/LAYER2/MAC/eNB_scheduler_ulsch.c openair2/LAYER2/MAC/ue_procedures.c --- openair2/LAYER2/MAC/eNB_scheduler_RA.c | 2 +- openair2/LAYER2/MAC/eNB_scheduler_bch.c | 1 + openair2/LAYER2/MAC/eNB_scheduler_dlsch.c | 2 +- openair2/LAYER2/MAC/eNB_scheduler_mch.c | 2 +- openair2/LAYER2/MAC/eNB_scheduler_ulsch.c | 2 +- openair2/LAYER2/MAC/ra_procedures.c | 4 ++-- openair2/LAYER2/MAC/rar_tools.c | 2 +- openair2/LAYER2/MAC/ue_procedures.c | 7 ++++--- openair2/UTIL/OPT/opt.h | 2 +- openair2/UTIL/OPT/probe.c | 14 +++++++------- 10 files changed, 20 insertions(+), 18 deletions(-) diff --git a/openair2/LAYER2/MAC/eNB_scheduler_RA.c b/openair2/LAYER2/MAC/eNB_scheduler_RA.c index c3a2aea0a5..7022333439 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler_RA.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_RA.c @@ -651,7 +651,7 @@ void schedule_RA(module_id_t module_idP,frame_t frameP, sub_frame_t subframeP,un if (opt_enabled==1) { trace_pdu(1, (uint8_t *)eNB->UE_list.DLSCH_pdu[CC_id][0][(unsigned char)UE_id].payload[0], rrc_sdu_length, UE_id, 3, UE_RNTI(module_idP, UE_id), - eNB->subframe,0,0); + eNB->frame, eNB->subframe,0,0); LOG_D(OPT,"[eNB %d][DLSCH] CC_id %d Frame %d trace pdu for rnti %x with size %d\n", module_idP, CC_id, frameP, UE_RNTI(module_idP,UE_id), rrc_sdu_length); } diff --git a/openair2/LAYER2/MAC/eNB_scheduler_bch.c b/openair2/LAYER2/MAC/eNB_scheduler_bch.c index f3774777a1..f4586ff9e8 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler_bch.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_bch.c @@ -319,6 +319,7 @@ schedule_SI( 0xffff, 4, 0xffff, + eNB->frame, eNB->subframe, 0, 0); diff --git a/openair2/LAYER2/MAC/eNB_scheduler_dlsch.c b/openair2/LAYER2/MAC/eNB_scheduler_dlsch.c index 61a0357691..fb8d4f3354 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler_dlsch.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_dlsch.c @@ -1122,7 +1122,7 @@ schedule_ue_spec( if (opt_enabled == 1) { trace_pdu(1, (uint8_t *)UE_list->DLSCH_pdu[CC_id][0][UE_id].payload[0], TBS, module_idP, 3, UE_RNTI(module_idP,UE_id), - eNB->subframe,0,0); + eNB->frame, eNB->subframe,0,0); LOG_D(OPT,"[eNB %d][DLSCH] CC_id %d Frame %d rnti %x with size %d\n", module_idP, CC_id, frameP, UE_RNTI(module_idP,UE_id), TBS); } diff --git a/openair2/LAYER2/MAC/eNB_scheduler_mch.c b/openair2/LAYER2/MAC/eNB_scheduler_mch.c index a6926e15ad..42189d0df2 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler_mch.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_mch.c @@ -629,7 +629,7 @@ int schedule_MBMS(module_id_t module_idP, uint8_t CC_id, frame_t frameP, sub_fra if (opt_enabled ==1 ) { trace_pdu(1, (uint8_t *)eNB_mac_inst[module_idP].common_channels[CC_id].MCH_pdu.payload, TBS, module_idP, 6, 0xffff, // M_RNTI = 6 in wirehsark - eNB_mac_inst[module_idP].subframe,0,0); + eNB_mac_inst[module_idP].frame, eNB_mac_inst[module_idP].subframe,0,0); LOG_D(OPT,"[eNB %d][MCH] CC_id %d Frame %d : MAC PDU with size %d\n", module_idP, CC_id, frameP, TBS); } diff --git a/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c b/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c index f0ad4ee3ee..a5395c2f7c 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c @@ -101,7 +101,7 @@ void rx_sdu(const module_id_t enb_mod_idP, VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RX_SDU,1); if (opt_enabled == 1) { - trace_pdu(0, sduP,sdu_lenP, 0, 3, rntiP,subframeP, 0,0); + trace_pdu(0, sduP,sdu_lenP, 0, 3, rntiP, frameP, subframeP, 0,0); LOG_D(OPT,"[eNB %d][ULSCH] Frame %d rnti %x with size %d\n", enb_mod_idP, frameP, rntiP, sdu_lenP); } diff --git a/openair2/LAYER2/MAC/ra_procedures.c b/openair2/LAYER2/MAC/ra_procedures.c index 669077bf4f..61289e0d36 100644 --- a/openair2/LAYER2/MAC/ra_procedures.c +++ b/openair2/LAYER2/MAC/ra_procedures.c @@ -280,7 +280,7 @@ void Msg1_tx(module_id_t module_idP,uint8_t CC_id,frame_t frameP, uint8_t eNB_id if (opt_enabled) { trace_pdu(0, NULL, 0, module_idP, 2, UE_mac_inst[module_idP].RA_prach_resources.ra_PreambleIndex, - UE_mac_inst[module_idP].subframe, 0, UE_mac_inst[module_idP].RA_attempt_number); + UE_mac_inst[module_idP].frame, UE_mac_inst[module_idP].subframe, 0, UE_mac_inst[module_idP].RA_attempt_number); LOG_D(OPT,"[UE %d][RAPROC] TX MSG1 Frame %d trace pdu for rnti %x with size %d\n", module_idP, frameP, 1, UE_mac_inst[module_idP].RA_Msg3_size); } @@ -304,7 +304,7 @@ void Msg3_tx(module_id_t module_idP,uint8_t CC_id,frame_t frameP, uint8_t eNB_id if (opt_enabled) { // msg3 trace_pdu(0, &UE_mac_inst[module_idP].CCCH_pdu.payload[0], UE_mac_inst[module_idP].RA_Msg3_size, - module_idP, 3, UE_mac_inst[module_idP].crnti, UE_mac_inst[module_idP].subframe, 0, 0); + module_idP, 3, UE_mac_inst[module_idP].crnti, UE_mac_inst[module_idP].frame, UE_mac_inst[module_idP].subframe, 0, 0); LOG_D(OPT,"[UE %d][RAPROC] MSG3 Frame %d trace pdu Preamble %d with size %d\n", module_idP, frameP, UE_mac_inst[module_idP].crnti /*UE_mac_inst[module_idP].RA_prach_resources.ra_PreambleIndex*/, UE_mac_inst[module_idP].RA_Msg3_size); } diff --git a/openair2/LAYER2/MAC/rar_tools.c b/openair2/LAYER2/MAC/rar_tools.c index be8dc43c97..c31b50eab6 100644 --- a/openair2/LAYER2/MAC/rar_tools.c +++ b/openair2/LAYER2/MAC/rar_tools.c @@ -126,7 +126,7 @@ unsigned short fill_rar( if (opt_enabled) { trace_pdu(1, dlsch_buffer, input_buffer_length, module_idP, 2, 1, - eNB_mac_inst[module_idP].subframe, 0, 0); + eNB_mac_inst[module_idP].frame, eNB_mac_inst[module_idP].subframe, 0, 0); LOG_D(OPT,"[eNB %d][RAPROC] CC_id %d RAR Frame %d trace pdu for rnti %x and rapid %d size %d\n", module_idP, CC_id, frameP, eNB_mac_inst[module_idP].common_channels[CC_id].RA_template[ra_idx].rnti, rarh->RAPID, input_buffer_length); diff --git a/openair2/LAYER2/MAC/ue_procedures.c b/openair2/LAYER2/MAC/ue_procedures.c index 90d227eb35..41415f2e1a 100644 --- a/openair2/LAYER2/MAC/ue_procedures.c +++ b/openair2/LAYER2/MAC/ue_procedures.c @@ -321,7 +321,7 @@ ue_send_sdu(module_id_t module_idP, if (opt_enabled) { trace_pdu(1, sdu, sdu_len, module_idP, 3, UE_mac_inst[module_idP].crnti, - UE_mac_inst[module_idP].subframe, 0, 0); + UE_mac_inst[module_idP].frame, UE_mac_inst[module_idP].subframe, 0, 0); LOG_D(OPT,"[UE %d][DLSCH] Frame %d trace pdu for rnti %x with size %d\n", module_idP, frameP, UE_mac_inst[module_idP].crnti, sdu_len); } @@ -499,6 +499,7 @@ void ue_decode_si(module_id_t module_idP,int CC_id,frame_t frameP, uint8_t eNB_i module_idP, 4, 0xffff, + UE_mac_inst[module_idP].frame, UE_mac_inst[module_idP].subframe, 0, 0); @@ -1498,9 +1499,9 @@ void ue_get_sdu(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_t subf stop_meas(&UE_mac_inst[module_idP].tx_ulsch_sdu); if (opt_enabled) { - trace_pdu(0, ulsch_buffer, buflen, module_idP, 3, UE_mac_inst[module_idP].crnti, UE_mac_inst[module_idP].subframe, 0, 0); + trace_pdu(0, ulsch_buffer, buflen, module_idP, 3, UE_mac_inst[module_idP].crnti, UE_mac_inst[module_idP].frame, UE_mac_inst[module_idP].subframe, 0, 0); LOG_D(OPT,"[UE %d][ULSCH] Frame %d trace pdu for rnti %x with size %d\n", - module_idP, UE_mac_inst[module_idP].subframe, UE_mac_inst[module_idP].crnti, buflen); + module_idP, UE_mac_inst[module_idP].frame, UE_mac_inst[module_idP].subframe, UE_mac_inst[module_idP].crnti, buflen); } } diff --git a/openair2/UTIL/OPT/opt.h b/openair2/UTIL/OPT/opt.h index bb3a099e12..8d2464641c 100644 --- a/openair2/UTIL/OPT/opt.h +++ b/openair2/UTIL/OPT/opt.h @@ -85,7 +85,7 @@ extern char in_path[100]; */ void trace_pdu(int direction, uint8_t *pdu_buffer, unsigned int pdu_buffer_size, - int ueid, int rntiType, int rnti, uint8_t subframe, + int ueid, int rntiType, int rnti, uint16_t sysFrame, uint8_t subframe, int oob_event, int oob_event_value); int init_opt(char *path, char *ip, char *port, radio_type_t radio_type_p); diff --git a/openair2/UTIL/OPT/probe.c b/openair2/UTIL/OPT/probe.c index eef98ae729..059a55a319 100644 --- a/openair2/UTIL/OPT/probe.c +++ b/openair2/UTIL/OPT/probe.c @@ -260,7 +260,7 @@ int opt_create_listener_socket(char *ip_address, uint16_t port) */ /* Add framing header to MAC PDU and send. */ static void SendFrame(guint8 radioType, guint8 direction, guint8 rntiType, - guint16 rnti, guint16 ueid, guint16 subframeNumber, + guint16 rnti, guint16 ueid, guint16 sfnSf, guint8 isPredefinedData, guint8 retx, guint8 crcStatus, guint8 oob_event, guint8 oob_event_value, uint8_t *pdu_buffer, unsigned int pdu_buffer_size) @@ -308,7 +308,7 @@ static void SendFrame(guint8 radioType, guint8 direction, guint8 rntiType, /* Subframe number */ frameBuffer[frameOffset++] = MAC_LTE_SUBFRAME_TAG; - tmp16 = htons(subframeNumber); // frame counter : this will give an expert info as wireshark expects SF and not F + tmp16 = htons(sfnSf); // frame counter : this will give an expert info as wireshark expects SF and not F memcpy(frameBuffer+frameOffset, &tmp16, 2); frameOffset += 2; @@ -317,7 +317,7 @@ static void SendFrame(guint8 radioType, guint8 direction, guint8 rntiType, #ifdef WIRESHARK_DEV frameOffset += 2; - tmp16 = htons(subframeNumber); // subframe + tmp16 = htons(sfnSf); // subframe memcpy(frameBuffer+frameOffset, &tmp16, 2); frameOffset += 2; #endif @@ -458,7 +458,7 @@ static int MAC_LTE_PCAP_WritePDU(MAC_Context_Info_t *context, /* Remote serveraddress (where Wireshark is running) */ void trace_pdu(int direction, uint8_t *pdu_buffer, unsigned int pdu_buffer_size, - int ueid, int rntiType, int rnti, uint8_t subframe, int oob_event, + int ueid, int rntiType, int rnti, uint16_t sysFrameNumber, uint8_t subFrameNumber, int oob_event, int oob_event_value) { MAC_Context_Info_t pdu_context; @@ -471,7 +471,7 @@ void trace_pdu(int direction, uint8_t *pdu_buffer, unsigned int pdu_buffer_size, SendFrame(radio_type, (direction == DIRECTION_DOWNLINK) ? DIRECTION_DOWNLINK : DIRECTION_UPLINK, - rntiType, rnti, ueid, subframe, + rntiType, rnti, ueid, (sysFrameNumber<<4) + subFrameNumber, 1, 0, 1, //guint8 isPredefinedData, guint8 retx, guint8 crcStatus oob_event,oob_event_value, pdu_buffer, pdu_buffer_size); @@ -490,8 +490,8 @@ void trace_pdu(int direction, uint8_t *pdu_buffer, unsigned int pdu_buffer_size, pdu_context.ueid = ueid; pdu_context.isRetx = 0; pdu_context.crcStatusOK =1; - pdu_context.sysFrameNumber = subframe; - pdu_context.subFrameNumber = 0; + pdu_context.sysFrameNumber = sysFrameNumber; + pdu_context.subFrameNumber = subFrameNumber; pdu_context.subframesSinceCaptureStart = subframesSinceCaptureStart++; MAC_LTE_PCAP_WritePDU( &pdu_context, pdu_buffer, pdu_buffer_size); break; From 8ce73e5a7e16de89bfe78976434cbc7b3012edfa Mon Sep 17 00:00:00 2001 From: calvin wang Date: Tue, 27 Sep 2016 17:08:17 +0800 Subject: [PATCH 230/349] L2 stabilization BSR fertilization --- openair2/LAYER2/MAC/config.c | 23 +++ openair2/LAYER2/MAC/defs.h | 8 + openair2/LAYER2/MAC/extern.h | 2 + openair2/LAYER2/MAC/proto.h | 6 +- openair2/LAYER2/MAC/ue_procedures.c | 219 +++++++++++++++++++--------- openair2/LAYER2/MAC/vars.h | 9 ++ 6 files changed, 198 insertions(+), 69 deletions(-) diff --git a/openair2/LAYER2/MAC/config.c b/openair2/LAYER2/MAC/config.c index 2c5a0799d2..030ac7a9f3 100644 --- a/openair2/LAYER2/MAC/config.c +++ b/openair2/LAYER2/MAC/config.c @@ -76,6 +76,7 @@ void ue_mac_reset(module_id_t module_idP,uint8_t eNB_index) // cancel all pending SRs UE_mac_inst[module_idP].scheduling_info.SR_pending=0; UE_mac_inst[module_idP].scheduling_info.SR_COUNTER=0; + UE_mac_inst[module_idP].BSR_reporting_active=0; // stop ongoing RACH procedure @@ -235,10 +236,31 @@ rrc_mac_config_req( UE_mac_inst[Mod_idP].scheduling_info.sr_ProhibitTimer = (uint16_t) 0; } + if (mac_MainConfig->ext2 && mac_MainConfig->ext2->mac_MainConfig_v1020) { + if (mac_MainConfig->ext2->mac_MainConfig_v1020->extendedBSR_Sizes_r10) { + UE_mac_inst[Mod_idP].scheduling_info.extendedBSR_Sizes_r10 = (uint16_t) *mac_MainConfig->ext2->mac_MainConfig_v1020->extendedBSR_Sizes_r10; + } else { + UE_mac_inst[Mod_idP].scheduling_info.extendedBSR_Sizes_r10 = (uint16_t)0; + } + if (mac_MainConfig->ext2->mac_MainConfig_v1020->extendedPHR_r10) { + UE_mac_inst[Mod_idP].scheduling_info.extendedPHR_r10 = (uint16_t) *mac_MainConfig->ext2->mac_MainConfig_v1020->extendedPHR_r10; + } else { + UE_mac_inst[Mod_idP].scheduling_info.extendedPHR_r10 = (uint16_t)0; + } + } else { + UE_mac_inst[Mod_idP].scheduling_info.extendedBSR_Sizes_r10 = (uint16_t)0; + UE_mac_inst[Mod_idP].scheduling_info.extendedPHR_r10 = (uint16_t)0; + } #endif UE_mac_inst[Mod_idP].scheduling_info.periodicBSR_SF = get_sf_periodicBSRTimer(UE_mac_inst[Mod_idP].scheduling_info.periodicBSR_Timer); UE_mac_inst[Mod_idP].scheduling_info.retxBSR_SF = get_sf_retxBSRTimer(UE_mac_inst[Mod_idP].scheduling_info.retxBSR_Timer); + UE_mac_inst[Mod_idP].BSR_reporting_active = 0; + LOG_D(MAC,"[UE %d]: periodic BSR %d (SF), retx BSR %d (SF)\n", + Mod_idP, + UE_mac_inst[Mod_idP].scheduling_info.periodicBSR_SF, + UE_mac_inst[Mod_idP].scheduling_info.retxBSR_SF); + UE_mac_inst[Mod_idP].scheduling_info.drx_config = mac_MainConfig->drx_Config; UE_mac_inst[Mod_idP].scheduling_info.phr_config = mac_MainConfig->phr_Config; @@ -259,6 +281,7 @@ rrc_mac_config_req( UE_mac_inst[Mod_idP].scheduling_info.periodicPHR_SF = get_sf_perioidicPHR_Timer(UE_mac_inst[Mod_idP].scheduling_info.periodicPHR_Timer); UE_mac_inst[Mod_idP].scheduling_info.prohibitPHR_SF = get_sf_prohibitPHR_Timer(UE_mac_inst[Mod_idP].scheduling_info.prohibitPHR_Timer); UE_mac_inst[Mod_idP].scheduling_info.PathlossChange_db = get_db_dl_PathlossChange(UE_mac_inst[Mod_idP].scheduling_info.PathlossChange); + UE_mac_inst[Mod_idP].PHR_reporting_active = 0; LOG_D(MAC,"[UE %d] config PHR (%d): periodic %d (SF) prohibit %d (SF) pathlosschange %d (db) \n", Mod_idP, (mac_MainConfig->phr_Config)?mac_MainConfig->phr_Config->present:-1, diff --git a/openair2/LAYER2/MAC/defs.h b/openair2/LAYER2/MAC/defs.h index 713c9d967c..4edfef1677 100644 --- a/openair2/LAYER2/MAC/defs.h +++ b/openair2/LAYER2/MAC/defs.h @@ -983,6 +983,12 @@ typedef struct { int16_t prohibitPHR_SF; ///DL Pathloss Change in db uint16_t PathlossChange_db; + + /// default value is false + uint16_t extendedBSR_Sizes_r10; + /// default value is false + uint16_t extendedPHR_r10; + //Bj bucket usage per lcid int16_t Bj[MAX_NUM_LCID]; // Bucket size per lcid @@ -1070,6 +1076,8 @@ typedef struct { uint8_t PHR_reporting_active; /// power backoff due to power management (as allowed by P-MPRc) for this cell uint8_t power_backoff_db[NUMBER_OF_eNB_MAX]; + /// BSR report falg management + uint8_t BSR_reporting_active; /// MBSFN_Subframe Configuration struct MBSFN_SubframeConfig *mbsfn_SubframeConfig[8]; // FIXME replace 8 by MAX_MBSFN_AREA? /// number of subframe allocation pattern available for MBSFN sync area diff --git a/openair2/LAYER2/MAC/extern.h b/openair2/LAYER2/MAC/extern.h index ca847acf4c..bb37a3766f 100644 --- a/openair2/LAYER2/MAC/extern.h +++ b/openair2/LAYER2/MAC/extern.h @@ -53,6 +53,8 @@ extern const uint32_t BSR_TABLE[BSR_TABLE_SIZE]; //extern uint32_t EBSR_Level[63]; +extern const uint32_t Extended_BSR_TABLE[BSR_TABLE_SIZE]; +//extern uint32_t Extended_BSR_TABLE[63]; ----currently not used extern UE_MAC_INST *UE_mac_inst; extern eNB_MAC_INST *eNB_mac_inst; diff --git a/openair2/LAYER2/MAC/proto.h b/openair2/LAYER2/MAC/proto.h index 9a0f60167d..4133d6a2eb 100644 --- a/openair2/LAYER2/MAC/proto.h +++ b/openair2/LAYER2/MAC/proto.h @@ -548,7 +548,7 @@ int cba_access(module_id_t module_idP,frame_t frameP,sub_frame_t subframe, uint8 \param[in] Mod_id instance of the UE \param[out] lcgid */ -int get_bsr_lcgid (module_id_t module_idP); +int get_bsr_lcgid (module_id_t module_idP, int *num_lcgid); /*! \fn uint8_t get_bsr_len (module_id_t module_idP,uint16_t bufflen); \brief determine whether the bsr is short or long assuming that the MAC pdu is built @@ -582,14 +582,14 @@ BSR_LONG * get_bsr_long(module_id_t module_idP, uint8_t bsr_len); */ boolean_t update_bsr(module_id_t module_idP, frame_t frameP, eNB_index_t eNB_index, uint8_t lcid, uint8_t lcgid); -/*! \fn locate (int *table, int size, int value) +/*! \fn locate_BsrIndexByBufferSize (int *table, int size, int value) \brief locate the BSR level in the table as defined in 36.321. This function requires that he values in table to be monotonic, either increasing or decreasing. The returned value is not less than 0, nor greater than n-1, where n is the size of table. \param[in] *table Pointer to BSR table \param[in] size Size of the table \param[in] value Value of the buffer \return the index in the BSR_LEVEL table */ -uint8_t locate (const uint32_t *table, int size, int value); +uint8_t locate_BsrIndexByBufferSize (const uint32_t *table, int size, int value); /*! \fn int get_sf_periodicBSRTimer(uint8_t periodicBSR_Timer) diff --git a/openair2/LAYER2/MAC/ue_procedures.c b/openair2/LAYER2/MAC/ue_procedures.c index 90d227eb35..6fc95f55d5 100644 --- a/openair2/LAYER2/MAC/ue_procedures.c +++ b/openair2/LAYER2/MAC/ue_procedures.c @@ -110,13 +110,17 @@ void ue_init_mac(module_id_t module_idP) UE_mac_inst[module_idP].scheduling_info.sr_ProhibitTimer_Running=0; UE_mac_inst[module_idP].scheduling_info.maxHARQ_Tx=MAC_MainConfig__ul_SCH_Config__maxHARQ_Tx_n5; UE_mac_inst[module_idP].scheduling_info.ttiBundling=0; + UE_mac_inst[module_idP].scheduling_info.extendedBSR_Sizes_r10=0; + UE_mac_inst[module_idP].scheduling_info.extendedPHR_r10=0; UE_mac_inst[module_idP].scheduling_info.drx_config=NULL; UE_mac_inst[module_idP].scheduling_info.phr_config=NULL; UE_mac_inst[module_idP].scheduling_info.periodicBSR_SF = get_sf_periodicBSRTimer(UE_mac_inst[module_idP].scheduling_info.periodicBSR_Timer); UE_mac_inst[module_idP].scheduling_info.retxBSR_SF = get_sf_retxBSRTimer(UE_mac_inst[module_idP].scheduling_info.retxBSR_Timer); + UE_mac_inst[module_idP].BSR_reporting_active = 0; UE_mac_inst[module_idP].scheduling_info.periodicPHR_SF = get_sf_perioidicPHR_Timer(UE_mac_inst[module_idP].scheduling_info.periodicPHR_Timer); UE_mac_inst[module_idP].scheduling_info.prohibitPHR_SF = get_sf_prohibitPHR_Timer(UE_mac_inst[module_idP].scheduling_info.prohibitPHR_Timer); UE_mac_inst[module_idP].scheduling_info.PathlossChange_db = get_db_dl_PathlossChange(UE_mac_inst[module_idP].scheduling_info.PathlossChange); + UE_mac_inst[module_idP].PHR_reporting_active = 0; for (i=0; i < MAX_NUM_LCID; i++) { LOG_D(MAC,"[UE%d] Applying default logical channel config for LCGID %d\n",module_idP,i); @@ -296,18 +300,28 @@ uint32_t ue_get_SR(module_id_t module_idP,int CC_id,frame_t frameP,uint8_t eNB_i // initiate RA UE_mac_inst[module_idP].scheduling_info.SR_pending=0; UE_mac_inst[module_idP].scheduling_info.SR_COUNTER=0; + // release all pucch resource + UE_mac_inst[module_idP].physicalConfigDedicated = NULL; + UE_mac_inst[module_idP].ul_active=0; + UE_mac_inst[module_idP].BSR_reporting_active=0; + + LOG_T(MAC,"[UE %d] Release all SRs \n", module_idP); return(0); } } //------------------------------------------------------------------------------ void -ue_send_sdu(module_id_t module_idP, - uint8_t CC_id, - frame_t frameP, - uint8_t* sdu, - uint16_t sdu_len, - uint8_t eNB_index) { +ue_send_sdu( + module_id_t module_idP, + uint8_t CC_id, + frame_t frameP, + uint8_t* sdu, + uint16_t sdu_len, + uint8_t eNB_index +) +//------------------------------------------------------------------------------ +{ unsigned char rx_ces[MAX_NUM_CE],num_ce,num_sdu,i,*payload_ptr; unsigned char rx_lcids[NB_RB_MAX]; @@ -1188,17 +1202,20 @@ void ue_get_sdu(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_t subf uint8_t payload_offset=0,num_sdus=0; uint8_t ulsch_buff[MAX_ULSCH_PAYLOAD_BYTES]; uint16_t sdu_length_total=0; - BSR_SHORT bsr_short; + BSR_SHORT bsr_short,bsr_truncated; BSR_LONG bsr_long; BSR_SHORT *bsr_s=&bsr_short; + BSR_SHORT *bsr_t=&bsr_truncated; BSR_LONG *bsr_l=&bsr_long; POWER_HEADROOM_CMD phr; POWER_HEADROOM_CMD *phr_p=&phr; - unsigned short short_padding=0, post_padding=0; + unsigned short short_padding=0, post_padding=0, padding_len=0; int lcgid; int j; // used for padding // Compute header length - + int all_pdu_len; + int num_lcgid=0; + if (CC_id>0) { LOG_E(MAC,"Transmission on secondary CCs is not supported yet\n"); mac_xface->macphy_exit("MAC FATAL CC_id>0"); @@ -1243,8 +1260,8 @@ void ue_get_sdu(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_t subf } bsr_ce_len = get_bsr_len (module_idP, buflen-phr_len); - - if (bsr_ce_len > 0 ) { + // retxBSR-Timer expires or periodicBSR-Timer expires and UE has data available for transmission + if ((bsr_ce_len > 0 ) && (UE_mac_inst[module_idP].BSR_reporting_active > 0)) { bsr_len = bsr_ce_len + bsr_header_len; LOG_D(MAC,"[UE %d] header size info: dcch %d, dcch1 %d, dtch %d, bsr (ce%d,hdr%d) buff_len %d\n", module_idP, dcch_header_len,dcch1_header_len,dtch_header_len, bsr_ce_len, bsr_header_len, buflen); @@ -1338,8 +1355,9 @@ void ue_get_sdu(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_t subf dtch_header_len+=3; dtch_header_len_last=3; + all_pdu_len = bsr_len+phr_len+dcch_header_len+dcch1_header_len+dtch_header_len+sdu_length_total; if ((UE_mac_inst[module_idP].scheduling_info.LCID_status[lcid] == LCID_NOT_EMPTY) && - ((bsr_len+phr_len+dcch_header_len+dcch1_header_len+dtch_header_len+sdu_length_total) <= buflen)) { + (all_pdu_len <= buflen)) { // optimize the dtch header lenght //if ((UE_mac_inst[module_idP].scheduling_info.BSR_bytes[DTCH] > 128) && @@ -1357,7 +1375,7 @@ void ue_get_sdu(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_t subf ENB_FLAG_NO, MBMS_FLAG_NO, // eNB_index lcid, - buflen-bsr_len-phr_len-dcch_header_len-dcch1_header_len-dtch_header_len-sdu_length_total); + buflen-all_pdu_len); LOG_D(MAC,"[UE %d] Frame %d : UL-DTCH -> ULSCH%d, %d bytes to send (Transport Block size %d, mac header len %d, BSR byte[%d] %d)\n", module_idP,frameP, lcid, rlc_status.bytes_in_buffer,buflen,dtch_header_len, @@ -1390,31 +1408,54 @@ void ue_get_sdu(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_t subf dtch_header_len -= 3; } } - - lcgid= get_bsr_lcgid(module_idP); - if (lcgid < 0 ) { + lcgid= get_bsr_lcgid(module_idP, &num_lcgid); + + if (num_lcgid == 0 ) { bsr_s = NULL; - bsr_l = NULL ; - } else if ((lcgid ==MAX_NUM_LCGID) && (bsr_ce_len == sizeof(BSR_LONG))) { - bsr_s = NULL; - bsr_l->Buffer_size0 = UE_mac_inst[module_idP].scheduling_info.BSR[LCGID0]; - bsr_l->Buffer_size1 = UE_mac_inst[module_idP].scheduling_info.BSR[LCGID1]; - bsr_l->Buffer_size2 = UE_mac_inst[module_idP].scheduling_info.BSR[LCGID2]; - bsr_l->Buffer_size3 = UE_mac_inst[module_idP].scheduling_info.BSR[LCGID3]; - LOG_D(MAC, "[UE %d] Frame %d report long BSR (level LCGID0 %d,level LCGID1 %d,level LCGID2 %d,level LCGID3 %d)\n", module_idP,frameP, - UE_mac_inst[module_idP].scheduling_info.BSR[LCGID0], - UE_mac_inst[module_idP].scheduling_info.BSR[LCGID1], - UE_mac_inst[module_idP].scheduling_info.BSR[LCGID2], - UE_mac_inst[module_idP].scheduling_info.BSR[LCGID3]); - } else if (bsr_ce_len == sizeof(BSR_SHORT)) { + bsr_t = NULL; bsr_l = NULL; - bsr_s->LCGID = lcgid; - bsr_s->Buffer_size = UE_mac_inst[module_idP].scheduling_info.BSR[lcgid]; - LOG_D(MAC,"[UE %d] Frame %d report SHORT BSR with level %d for LCGID %d\n", + } else if (num_lcgid == 1){ + if (bsr_ce_len == sizeof(BSR_SHORT)){ + bsr_l = NULL; + bsr_t = NULL; + bsr_s->LCGID = lcgid; + bsr_s->Buffer_size = UE_mac_inst[module_idP].scheduling_info.BSR[lcgid]; + LOG_D(MAC,"[UE %d] Frame %d report SHORT BSR with level %d for LCGID %d\n", + module_idP, frameP, UE_mac_inst[module_idP].scheduling_info.BSR[lcgid],lcgid); + } else { + bsr_s = NULL; + bsr_t = NULL; + bsr_l = NULL; + } + } else if (num_lcgid > 1) { + if (bsr_ce_len == sizeof(BSR_LONG)){ + bsr_t = NULL; + bsr_s = NULL; + bsr_l->Buffer_size0 = UE_mac_inst[module_idP].scheduling_info.BSR[LCGID0]; + bsr_l->Buffer_size1 = UE_mac_inst[module_idP].scheduling_info.BSR[LCGID1]; + bsr_l->Buffer_size2 = UE_mac_inst[module_idP].scheduling_info.BSR[LCGID2]; + bsr_l->Buffer_size3 = UE_mac_inst[module_idP].scheduling_info.BSR[LCGID3]; + LOG_D(MAC, "[UE %d] Frame %d report long BSR (level LCGID0 %d,level LCGID1 %d,level LCGID2 %d,level LCGID3 %d)\n", module_idP,frameP, + UE_mac_inst[module_idP].scheduling_info.BSR[LCGID0], + UE_mac_inst[module_idP].scheduling_info.BSR[LCGID1], + UE_mac_inst[module_idP].scheduling_info.BSR[LCGID2], + UE_mac_inst[module_idP].scheduling_info.BSR[LCGID3]); + } else if (bsr_ce_len == sizeof(BSR_SHORT)){ + bsr_l = NULL; + bsr_s = NULL; + bsr_t->LCGID = lcgid; + bsr_s->Buffer_size = UE_mac_inst[module_idP].scheduling_info.BSR[lcgid]; + LOG_D(MAC,"[UE %d] Frame %d report SHORT BSR with level %d for LCGID %d\n", module_idP, frameP, UE_mac_inst[module_idP].scheduling_info.BSR[lcgid],lcgid); + } else { + bsr_s = NULL; + bsr_t = NULL; + bsr_l = NULL; + } } else { bsr_s = NULL; + bsr_t = NULL; bsr_l = NULL; } @@ -1444,12 +1485,14 @@ void ue_get_sdu(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_t subf dtch_header_len_last-=1; dtch_header_len= (dtch_header_len >0)? dtch_header_len - dtch_header_len_last : dtch_header_len; } - - if ((buflen-bsr_len-phr_len-dcch_header_len-dcch1_header_len-dtch_header_len-sdu_length_total) <= 2) { - short_padding = buflen-bsr_len-phr_len-dcch_header_len-dcch1_header_len-dtch_header_len-sdu_length_total; + // 1-bit padding or 2-bit padding special padding subheader + padding_len = buflen-bsr_len-phr_len-dcch_header_len-dcch1_header_len-dtch_header_len-sdu_length_total; + if (padding_len <= 2) { + short_padding = padding_len; + // only add padding header post_padding = 0; } else { - if ((buflen-bsr_len-phr_len-dcch_header_len-dcch1_header_len-dtch_header_len-sdu_length_total) == buflen) { + if (padding_len == buflen) {// nona mac pdu *access_mode=CANCELED_ACCESS; } @@ -1474,7 +1517,7 @@ void ue_get_sdu(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_t subf sdu_lcids, // sdu lcid phr_p, // power headroom NULL, // crnti - NULL, // truncated bsr + bsr_t, // truncated bsr bsr_s, // short bsr bsr_l, post_padding); // long_bsr @@ -1494,6 +1537,9 @@ void ue_get_sdu(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_t subf module_idP,payload_offset, sdu_length_total); UE_mac_inst[module_idP].scheduling_info.SR_pending=0; UE_mac_inst[module_idP].scheduling_info.SR_COUNTER=0; + UE_mac_inst[module_idP].BSR_reporting_active=0; + UE_mac_inst[module_idP].scheduling_info.periodicBSR_SF = get_sf_periodicBSRTimer(UE_mac_inst[module_idP].scheduling_info.periodicBSR_Timer); + UE_mac_inst[module_idP].scheduling_info.retxBSR_SF = get_sf_retxBSRTimer(UE_mac_inst[module_idP].scheduling_info.retxBSR_Timer); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_GET_SDU, VCD_FUNCTION_OUT); stop_meas(&UE_mac_inst[module_idP].tx_ulsch_sdu); @@ -1655,7 +1701,22 @@ ue_scheduler( // call SR procedure to generate pending SR and BSR for next PUCCH/PUSCH TxOp. This should implement the procedures // outlined in Sections 5.4.4 an 5.4.5 of 36.321 - // Put this in another function + // Call BSR procedure as described in Section 5.4.5 in 36.321 + if (UE_mac_inst[module_idP].scheduling_info.periodicBSR_SF == get_sf_periodicBSRTimer(MAC_MainConfig__ul_SCH_Config__periodicBSR_Timer_infinity)) { + UE_mac_inst[module_idP].BSR_reporting_active = 1; + } else if (UE_mac_inst[module_idP].scheduling_info.periodicBSR_SF <= 0 ){ + // trigger BSR and reset the timer later when the BSR report is sent + UE_mac_inst[module_idP].BSR_reporting_active = 1; + } else if (UE_mac_inst[module_idP].BSR_reporting_active == 0 ) { + UE_mac_inst[module_idP].scheduling_info.periodicBSR_SF--; + } + + if (UE_mac_inst[module_idP].scheduling_info.retxBSR_SF <= 0){ + // trigger BSR and reset the timer later when the BSR report is sent + UE_mac_inst[module_idP].BSR_reporting_active = 1; + } else if (UE_mac_inst[module_idP].BSR_reporting_active == 0 ) { + UE_mac_inst[module_idP].scheduling_info.retxBSR_SF--; + } // Get RLC status info and update Bj for all lcids that are active for (lcid=DCCH; lcid <= DTCH; lcid++ ) { @@ -1899,54 +1960,75 @@ int cba_access(module_id_t module_idP,frame_t frameP,sub_frame_t subframe, uint8 } #endif -int get_bsr_lcgid (module_id_t module_idP) +int get_bsr_lcgid (module_id_t module_idP, int *num_lcgid) { int lcgid, lcgid_tmp=-1; int num_active_lcgid = 0; for (lcgid = 0 ; lcgid < MAX_NUM_LCGID; lcgid++) { if (UE_mac_inst[module_idP].scheduling_info.BSR[lcgid] > 0 ) { - lcgid_tmp = lcgid; + if (lcgid_tmp == -1){ + // first priority lcgid + lcgid_tmp = lcgid; + } num_active_lcgid+=1; } } - + *num_lcgid = num_active_lcgid; + if (num_active_lcgid == 0) { - return -1; - } else if (num_active_lcgid == 1) { - return lcgid_tmp; + return -1; // no data } else { - return MAX_NUM_LCGID; + return lcgid_tmp;//only one lcgid, report short bsr } } uint8_t get_bsr_len (module_id_t module_idP, uint16_t buflen) { - int lcgid=0; uint8_t bsr_len=0, num_lcgid=0; int pdu = 0; + int long_bsr_plus_subheader_length = sizeof(BSR_LONG)+sizeof(SCH_SUBHEADER_FIXED); + int short_bsr_plus_subheader_length = sizeof(BSR_SHORT)+sizeof(SCH_SUBHEADER_FIXED); - + // check how many lcg have data to report for (lcgid=0; lcgid < MAX_NUM_LCGID; lcgid++ ) { if (UE_mac_inst[module_idP].scheduling_info.BSR_bytes[lcgid] > 0 ) { - pdu += (UE_mac_inst[module_idP].scheduling_info.BSR_bytes[lcgid] + bsr_len + 2); //2 = sizeof(SCH_SUBHEADER_SHORT) + num_lcgid ++; + pdu += (UE_mac_inst[module_idP].scheduling_info.BSR_bytes[lcgid] + sizeof(SCH_SUBHEADER_SHORT)); } - if (UE_mac_inst[module_idP].scheduling_info.BSR_bytes[lcgid] > 128 ) { // long header size: adjust the header size pdu += 1; } - - // current phy buff can not transport all sdu for this lcgid -> transmit a bsr for this lcgid - - if ( (pdu > buflen) && (UE_mac_inst[module_idP].scheduling_info.BSR_bytes[lcgid] > 0 ) ) { - num_lcgid +=1; - bsr_len = (num_lcgid >= 2 ) ? sizeof(BSR_LONG) : sizeof(BSR_SHORT) ; + LOG_D(MAC,"BSR Bytes %d for lcgid %d num lcgid %d\n", UE_mac_inst[module_idP].scheduling_info.BSR_bytes[lcgid], lcgid, num_lcgid); + } + // current phy buff can not transport all sdu for this lcgid -> transmit a bsr for this lcgid + if (buflen < pdu) { + if (num_lcgid > 0) { + bsr_len = sizeof(BSR_SHORT); + } else { + bsr_len = 0; } - - LOG_D(MAC,"BSR Bytes %d for lcgid %d bsr len %d num lcgid %d\n", UE_mac_inst[module_idP].scheduling_info.BSR_bytes[lcgid], lcgid, bsr_len, num_lcgid); + } + // padding larger then long bsr + if (buflen > (pdu + long_bsr_plus_subheader_length)) { + if (num_lcgid > 1) { + bsr_len = sizeof(BSR_LONG); + } else if (num_lcgid > 0) { + bsr_len = sizeof(BSR_SHORT); + } else { + bsr_len = 0; + } + } + // padding larger then short bsr and shorter then long bsr + if ((buflen < (pdu + long_bsr_plus_subheader_length)) && + (buflen > (pdu + short_bsr_plus_subheader_length))) { + if (num_lcgid > 0) { + bsr_len = sizeof(BSR_SHORT); + } else { + bsr_len = 0; + } } - if ( bsr_len > 0 ) LOG_D(MAC,"[UE %d] Prepare a %s (Transport Block Size %d, MAC pdu Size %d) \n", module_idP, map_int_to_str(BSR_names, bsr_len), buflen, pdu); @@ -1959,11 +2041,11 @@ boolean_t update_bsr(module_id_t module_idP, frame_t frameP, eNB_index_t eNB_in { mac_rlc_status_resp_t rlc_status; - boolean_t sr_pending = FALSE; + boolean_t Bsr_pending = FALSE; if ((lcg_id < 0) || (lcg_id >= MAX_NUM_LCGID) ) { - return sr_pending; + return Bsr_pending; } // fixme: need a better way to reset @@ -1979,10 +2061,15 @@ boolean_t update_bsr(module_id_t module_idP, frame_t frameP, eNB_index_t eNB_in 0); if (rlc_status.bytes_in_buffer > 0 ) { - sr_pending = TRUE; + //BSR trigger SR + Bsr_pending = TRUE; UE_mac_inst[module_idP].scheduling_info.LCID_status[lcid] = LCID_NOT_EMPTY; - UE_mac_inst[module_idP].scheduling_info.BSR[lcg_id] += locate (BSR_TABLE,BSR_TABLE_SIZE, rlc_status.bytes_in_buffer); - UE_mac_inst[module_idP].scheduling_info.BSR_bytes[lcg_id] += rlc_status.bytes_in_buffer; + UE_mac_inst[module_idP].scheduling_info.BSR_bytes[lcg_id] = rlc_status.bytes_in_buffer; + if (UE_mac_inst[module_idP].scheduling_info.extendedBSR_Sizes_r10 == TRUE){ + UE_mac_inst[module_idP].scheduling_info.BSR[lcg_id] = locate_BsrIndexByBufferSize(Extended_BSR_TABLE, BSR_TABLE_SIZE, UE_mac_inst[module_idP].scheduling_info.BSR_bytes[lcg_id]); + } else { + UE_mac_inst[module_idP].scheduling_info.BSR[lcg_id] = locate_BsrIndexByBufferSize(BSR_TABLE, BSR_TABLE_SIZE, UE_mac_inst[module_idP].scheduling_info.BSR_bytes[lcg_id]); + } // UE_mac_inst[module_idP].scheduling_info.BSR_short_lcid = lcid; // only applicable to short bsr LOG_D(MAC,"[UE %d] BSR level %d (LCGID %d, rlc buffer %d byte)\n", module_idP, UE_mac_inst[module_idP].scheduling_info.BSR[lcg_id],lcg_id, UE_mac_inst[module_idP].scheduling_info.BSR_bytes[lcg_id]); @@ -1992,10 +2079,10 @@ boolean_t update_bsr(module_id_t module_idP, frame_t frameP, eNB_index_t eNB_in } //} - return sr_pending; + return Bsr_pending; } -uint8_t locate (const uint32_t *table, int size, int value) +uint8_t locate_BsrIndexByBufferSize (const uint32_t *table, int size, int value) { uint8_t ju, jm, jl; @@ -2026,7 +2113,7 @@ uint8_t locate (const uint32_t *table, int size, int value) if (value == table[jl]) { return jl; - } else { + } else { return jl+1; //equally ju } diff --git a/openair2/LAYER2/MAC/vars.h b/openair2/LAYER2/MAC/vars.h index 508c7f8c21..3020706815 100644 --- a/openair2/LAYER2/MAC/vars.h +++ b/openair2/LAYER2/MAC/vars.h @@ -52,6 +52,15 @@ const uint32_t BSR_TABLE[BSR_TABLE_SIZE]= {0,10,12,14,17,19,22,26,31,36,42,49,57 1326,1552,1817,2127,2490,2915,3413,3995,4677,5467,6411,7505,8787,10287,12043,14099, 16507,19325,22624,26487,31009,36304,42502,49759,58255,68201,79846,93479,109439, 128125,150000, 300000 }; +// extended bsr table--currently not used +const uint32_t Extended_BSR_TABLE[BSR_TABLE_SIZE] = {0,10,13,16,19,23,29,35,43,53,65,80,98,120,147, + 181,223,274,337,414,509,625,769,945,1162,1429, + 1757,2161,2657,3267,4017,4940,6074,7469,9185, + 11294,13888,17077,20999,25822,31752,39045,48012, + 59039,72598,89272,109774,134986,165989,204111, + 250990,308634,379519,466683,573866,705666,867737, + 1067031,1312097,1613447,1984009,2439678,3000000, + 6000000}; //uint32_t EBSR_Level[63]={0,10,13,16,19,23,29,35,43,53,65,80,98,120,147,181}; From a5210e4f4f9160730edc2b84c40a5f502de4db74 Mon Sep 17 00:00:00 2001 From: fnabet Date: Wed, 28 Sep 2016 17:36:07 +0200 Subject: [PATCH 231/349] UE L2 changes for 3GPP alignement --- openair2/LAYER2/MAC/ue_procedures.c | 31 ++++++++++++++++++- .../LAYER2/RLC/AM_v9.3.0/rlc_am_receiver.c | 3 +- 2 files changed, 32 insertions(+), 2 deletions(-) diff --git a/openair2/LAYER2/MAC/ue_procedures.c b/openair2/LAYER2/MAC/ue_procedures.c index 90d227eb35..4547adabac 100644 --- a/openair2/LAYER2/MAC/ue_procedures.c +++ b/openair2/LAYER2/MAC/ue_procedures.c @@ -151,7 +151,7 @@ unsigned char *parse_header(unsigned char *mac_header, unsigned short tb_length) { - unsigned char not_done=1,num_ces=0,num_sdus=0,lcid, num_sdu_cnt; + unsigned char not_done=1,num_ces=0,num_cont_res = 0,num_padding = 0,num_sdus=0,lcid, num_sdu_cnt; unsigned char *mac_header_ptr = mac_header; unsigned short length,ce_len=0; @@ -165,6 +165,14 @@ unsigned char *parse_header(unsigned char *mac_header, lcid = ((SCH_SUBHEADER_FIXED *)mac_header_ptr)->LCID; if (lcid < UE_CONT_RES) { + //FNA: Contention Resolution check according to Annex B of 36.321 + // if this is for CCCH then a Contention Resolution must have been parsed before + if ((lcid == 0) && (num_cont_res == 0)) { + LOG_W(MAC,"[UE] Msg4 Wrong received format: CCCH received without Contention Resolution before\n"); + // exit parsing + return NULL; + } + //printf("[MAC][UE] header %x.%x.%x\n",mac_header_ptr[0],mac_header_ptr[1],mac_header_ptr[2]); if (not_done==0) {// last MAC SDU, length is implicit mac_header_ptr++; @@ -196,6 +204,7 @@ unsigned char *parse_header(unsigned char *mac_header, num_sdus++; } else { // This is a control element subheader if (lcid == SHORT_PADDING) { + num_padding ++; mac_header_ptr++; } else { rx_ces[num_ces] = lcid; @@ -205,6 +214,23 @@ unsigned char *parse_header(unsigned char *mac_header, if (lcid==TIMING_ADV_CMD) { ce_len++; } else if (lcid==UE_CONT_RES) { + + // FNA: check MAC Header is one of thoses defined in Annex B of 36.321 + // Check there is only 1 Contention Resolution + if (num_cont_res) { + LOG_W(MAC,"[UE] Msg4 Wrong received format: More than 1 Contention Resolution\n"); + // exit parsing + return NULL; + + } + + // UE_CONT_RES shall never be the last subheader unless this is the only MAC subheader + if ((not_done == 0) && ((num_sdus) || (num_ces > 1) || (num_padding))) { + LOG_W(MAC,"[UE] Msg4 Wrong received format: Contention Resolution after num_ces=%d num_sdus=%d num_padding=%d\n",num_ces,num_sdus,num_padding); + // exit parsing + return NULL; + } + num_cont_res ++; ce_len+=6; } } @@ -343,6 +369,8 @@ ue_send_sdu(module_id_t module_idP, LOG_T(MAC,"\n"); #endif + if (payload_ptr != NULL) { + for (i=0; it_reordering.running) { - if ((rlc_pP->vr_x == rlc_pP->vr_r) || ((rlc_am_in_rx_window(ctxt_pP, rlc_pP, pdu_info_p->sn) == 0) && (rlc_pP->vr_x != rlc_pP->vr_mr))) { + if ((rlc_pP->vr_x == rlc_pP->vr_r) || ((rlc_am_in_rx_window(ctxt_pP, rlc_pP, rlc_pP->vr_x) == 0) && (rlc_pP->vr_x != rlc_pP->vr_mr))) { rlc_am_stop_and_reset_timer_reordering(ctxt_pP, rlc_pP); } } From b11ed995d258dd65877849947c0b08390019649e Mon Sep 17 00:00:00 2001 From: fnabet Date: Mon, 10 Oct 2016 16:22:01 +0200 Subject: [PATCH 232/349] fix build issue after merge from develop --- openair2/LAYER2/MAC/ue_procedures.c | 1 + openair2/LAYER2/RLC/rlc_rrc.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/openair2/LAYER2/MAC/ue_procedures.c b/openair2/LAYER2/MAC/ue_procedures.c index f06582c857..4bc613ffbe 100644 --- a/openair2/LAYER2/MAC/ue_procedures.c +++ b/openair2/LAYER2/MAC/ue_procedures.c @@ -564,6 +564,7 @@ void ue_decode_p(module_id_t module_idP,int CC_id,frame_t frameP, uint8_t eNB_in module_idP, 4, P_RNTI, + UE_mac_inst[module_idP].frame, UE_mac_inst[module_idP].subframe, 0, 0); diff --git a/openair2/LAYER2/RLC/rlc_rrc.c b/openair2/LAYER2/RLC/rlc_rrc.c index ae091651a8..9ed5c4672e 100644 --- a/openair2/LAYER2/RLC/rlc_rrc.c +++ b/openair2/LAYER2/RLC/rlc_rrc.c @@ -216,7 +216,7 @@ rlc_op_status_t rrc_rlc_config_asn1_req (const protocol_ctxt_t * const ctxt_pP ctxt_pP, SRB_FLAG_YES, &srb_toaddmod_p->rlc_Config->choice.explicitValue.choice.am, - rb_id); + rb_id,lc_id); } else { LOG_E(RLC, PROTOCOL_CTXT_FMT" ERROR IN ALLOCATING SRB %d \n", PROTOCOL_CTXT_ARGS(ctxt_pP), From 138ed2fbb429efc465ed9136a80cf3a79780ce5c Mon Sep 17 00:00:00 2001 From: fnabet Date: Mon, 10 Oct 2016 17:16:01 +0200 Subject: [PATCH 233/349] [OAI-UE] fixes: 1- frame/subframe update 2- ccch discard regression --- openair2/LAYER2/MAC/ue_procedures.c | 8 -------- targets/RT/USER/lte-ue.c | 9 +++++++-- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/openair2/LAYER2/MAC/ue_procedures.c b/openair2/LAYER2/MAC/ue_procedures.c index 4bc613ffbe..448d2ed541 100644 --- a/openair2/LAYER2/MAC/ue_procedures.c +++ b/openair2/LAYER2/MAC/ue_procedures.c @@ -165,14 +165,6 @@ unsigned char *parse_header(unsigned char *mac_header, lcid = ((SCH_SUBHEADER_FIXED *)mac_header_ptr)->LCID; if (lcid < UE_CONT_RES) { - //FNA: Contention Resolution check according to Annex B of 36.321 - // if this is for CCCH then a Contention Resolution must have been parsed before - if ((lcid == 0) && (num_cont_res == 0)) { - LOG_W(MAC,"[UE] Msg4 Wrong received format: CCCH received without Contention Resolution before\n"); - // exit parsing - return NULL; - } - //printf("[MAC][UE] header %x.%x.%x\n",mac_header_ptr[0],mac_header_ptr[1],mac_header_ptr[2]); if (not_done==0) {// last MAC SDU, length is implicit mac_header_ptr++; diff --git a/targets/RT/USER/lte-ue.c b/targets/RT/USER/lte-ue.c index 1c338c3df0..81d60a3d08 100644 --- a/targets/RT/USER/lte-ue.c +++ b/targets/RT/USER/lte-ue.c @@ -1035,8 +1035,8 @@ void *UE_thread(void *arg) { }// start_rx_stream==0 else { - UE->proc.proc_rxtx[0].frame_rx++; - UE->proc.proc_rxtx[1].frame_rx++; + //UE->proc.proc_rxtx[0].frame_rx++; + //UE->proc.proc_rxtx[1].frame_rx++; for (int sf=0;sf<10;sf++) { for (i=0; iframe_parms.nb_antennas_rx; i++) @@ -1122,6 +1122,11 @@ void *UE_thread(void *arg) { } // increment instance count and change proc subframe/frame variables int instance_cnt_rxtx = ++proc->instance_cnt_rxtx; + if(sf == 0) + { + UE->proc.proc_rxtx[0].frame_rx++; + UE->proc.proc_rxtx[1].frame_rx++; + } proc->subframe_rx=sf; proc->subframe_tx=(sf+4)%10; proc->frame_tx = proc->frame_rx + ((proc->subframe_rx>5)?1:0); From 0705e71ffc72db255fedbf853f72332c36c402d0 Mon Sep 17 00:00:00 2001 From: hbilel Date: Wed, 12 Oct 2016 14:29:48 +0200 Subject: [PATCH 234/349] [OAI-UE] SRS feature 1- Implement SRS procedures --- cmake_targets/CMakeLists.txt | 1 + openair1/PHY/INIT/lte_init.c | 41 +++ openair1/PHY/LTE_TRANSPORT/defs.h | 2 + openair1/PHY/extern.h | 12 + openair1/PHY/impl_defs_lte.h | 4 + openair1/SCHED/Makefile.inc | 1 + openair1/SCHED/defs.h | 9 + openair1/SCHED/phy_procedures_lte_ue.c | 243 +++++++++++++++++- openair1/SCHED/srs_pc.c | 99 +++++++ openair2/RRC/LITE/MESSAGES/asn1_msg.c | 18 +- openair2/RRC/LITE/rrc_eNB.c | 2 +- ...band7.tm1.generic.oaisim.local_no_mme.conf | 10 +- targets/SIMU/USER/oaisim_functions.c | 4 +- 13 files changed, 421 insertions(+), 25 deletions(-) create mode 100644 openair1/SCHED/srs_pc.c diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index 5e86d59378..d47389e7b4 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -931,6 +931,7 @@ set(SCHED_SRC ${OPENAIR1_DIR}/SCHED/phy_mac_stub.c ${OPENAIR1_DIR}/SCHED/pucch_pc.c ${OPENAIR1_DIR}/SCHED/pusch_pc.c + ${OPENAIR1_DIR}/SCHED/srs_pc.c ) add_library(SCHED_LIB ${SCHED_SRC}) diff --git a/openair1/PHY/INIT/lte_init.c b/openair1/PHY/INIT/lte_init.c index a2e4fa8747..d358329b63 100644 --- a/openair1/PHY/INIT/lte_init.c +++ b/openair1/PHY/INIT/lte_init.c @@ -489,6 +489,26 @@ void phy_config_dedicated_eNB_step2(PHY_VARS_eNB *eNB) } + if (physicalConfigDedicated->soundingRS_UL_ConfigDedicated) { + if (physicalConfigDedicated->soundingRS_UL_ConfigDedicated->present == SchedulingRequestConfig_PR_setup) { + + eNB->soundingrs_ul_config_dedicated[UE_id].duration = physicalConfigDedicated->soundingRS_UL_ConfigDedicated->choice.setup.duration; + eNB->soundingrs_ul_config_dedicated[UE_id].cyclicShift = physicalConfigDedicated->soundingRS_UL_ConfigDedicated->choice.setup.cyclicShift; + eNB->soundingrs_ul_config_dedicated[UE_id].freqDomainPosition = physicalConfigDedicated->soundingRS_UL_ConfigDedicated->choice.setup.freqDomainPosition; + eNB->soundingrs_ul_config_dedicated[UE_id].srs_Bandwidth = physicalConfigDedicated->soundingRS_UL_ConfigDedicated->choice.setup.srs_Bandwidth; + eNB->soundingrs_ul_config_dedicated[UE_id].srs_ConfigIndex = physicalConfigDedicated->soundingRS_UL_ConfigDedicated->choice.setup.srs_ConfigIndex; + eNB->soundingrs_ul_config_dedicated[UE_id].srs_HoppingBandwidth = physicalConfigDedicated->soundingRS_UL_ConfigDedicated->choice.setup.srs_HoppingBandwidth; + eNB->soundingrs_ul_config_dedicated[UE_id].transmissionComb = physicalConfigDedicated->soundingRS_UL_ConfigDedicated->choice.setup.transmissionComb; + + + LOG_D(PHY,"soundingrs_ul_config_dedicated.srs_ConfigIndex %d\n",eNB->soundingrs_ul_config_dedicated[UE_id].srs_ConfigIndex); + + } + + LOG_D(PHY,"------------------------------------------------------------\n"); + + } + eNB->physicalConfigDedicated[UE_id] = NULL; } } @@ -859,6 +879,27 @@ void phy_config_dedicated_ue(uint8_t Mod_id,int CC_id,uint8_t eNB_id, } + if (physicalConfigDedicated->soundingRS_UL_ConfigDedicated) { + + if (physicalConfigDedicated->soundingRS_UL_ConfigDedicated->present == SchedulingRequestConfig_PR_setup) { + + phy_vars_ue->soundingrs_ul_config_dedicated[eNB_id].duration = physicalConfigDedicated->soundingRS_UL_ConfigDedicated->choice.setup.duration; + phy_vars_ue->soundingrs_ul_config_dedicated[eNB_id].cyclicShift = physicalConfigDedicated->soundingRS_UL_ConfigDedicated->choice.setup.cyclicShift; + phy_vars_ue->soundingrs_ul_config_dedicated[eNB_id].freqDomainPosition = physicalConfigDedicated->soundingRS_UL_ConfigDedicated->choice.setup.freqDomainPosition; + phy_vars_ue->soundingrs_ul_config_dedicated[eNB_id].srs_Bandwidth = physicalConfigDedicated->soundingRS_UL_ConfigDedicated->choice.setup.srs_Bandwidth; + phy_vars_ue->soundingrs_ul_config_dedicated[eNB_id].srs_ConfigIndex = physicalConfigDedicated->soundingRS_UL_ConfigDedicated->choice.setup.srs_ConfigIndex; + phy_vars_ue->soundingrs_ul_config_dedicated[eNB_id].srs_HoppingBandwidth = physicalConfigDedicated->soundingRS_UL_ConfigDedicated->choice.setup.srs_HoppingBandwidth; + phy_vars_ue->soundingrs_ul_config_dedicated[eNB_id].transmissionComb = physicalConfigDedicated->soundingRS_UL_ConfigDedicated->choice.setup.transmissionComb; + + + LOG_D(PHY,"soundingrs_ul_config_dedicated.srs_ConfigIndex %d\n",phy_vars_ue->soundingrs_ul_config_dedicated[eNB_id].srs_ConfigIndex); + } + + LOG_D(PHY,"------------------------------------------------------------\n"); + + } + + #ifdef CBA if (physicalConfigDedicated->pusch_CBAConfigDedicated_vlola) { diff --git a/openair1/PHY/LTE_TRANSPORT/defs.h b/openair1/PHY/LTE_TRANSPORT/defs.h index 26e2d40460..be6cd4f5a0 100644 --- a/openair1/PHY/LTE_TRANSPORT/defs.h +++ b/openair1/PHY/LTE_TRANSPORT/defs.h @@ -341,6 +341,8 @@ typedef struct { int16_t Po_PUSCH; /// PHR - current power headroom (based on last PUSCH transmission) int16_t PHR; + /// Po_SRS - target output power for SRS + int16_t Po_SRS; /// num active cba group uint8_t num_active_cba_groups; /// num dci found for cba diff --git a/openair1/PHY/extern.h b/openair1/PHY/extern.h index 867f980e5f..2ce2d03ff5 100755 --- a/openair1/PHY/extern.h +++ b/openair1/PHY/extern.h @@ -118,5 +118,17 @@ extern char eNB_timing[2][20]; extern int16_t unscrambling_lut[65536*16]; extern uint8_t scrambling_lut[65536*16]; +extern unsigned short msrsb_6_40[8][4]; +extern unsigned short msrsb_41_60[8][4]; +extern unsigned short msrsb_61_80[8][4]; +extern unsigned short msrsb_81_110[8][4]; +extern unsigned short Nb_6_40[8][4]; +extern unsigned short Nb_41_60[8][4]; +extern unsigned short Nb_61_80[8][4]; +extern unsigned short Nb_81_110[8][4]; + +extern uint16_t hundred_times_log10_NPRB[100]; +extern uint8_t alpha_lut[8]; + #endif /*__PHY_EXTERN_H__ */ diff --git a/openair1/PHY/impl_defs_lte.h b/openair1/PHY/impl_defs_lte.h index bed2057800..6813fe058f 100644 --- a/openair1/PHY/impl_defs_lte.h +++ b/openair1/PHY/impl_defs_lte.h @@ -319,6 +319,10 @@ typedef struct { uint16_t srs_ConfigIndex; /// Parameter: \f$n^\text{CS}_\text{SRS}\f$. See TS 36.211 (5.5.3.1). \vr{[0..7]} \note the specification sais it is an enumerated value. uint8_t cyclicShift; + // Parameter: cell srs subframe for internal implementation + uint8_t srsCellSubframe; + // Parameter: ue srs subframe for internal implementation + uint8_t srsUeSubframe; } SOUNDINGRS_UL_CONFIG_DEDICATED; /// UplinkPowerControlDedicated Information Element from 36.331 RRC spec diff --git a/openair1/SCHED/Makefile.inc b/openair1/SCHED/Makefile.inc index e3fd877e5d..559d3dca32 100644 --- a/openair1/SCHED/Makefile.inc +++ b/openair1/SCHED/Makefile.inc @@ -3,3 +3,4 @@ SCHED_OBJS += $(TOP_DIR)/SCHED/phy_procedures_lte_ue.o SCHED_OBJS += $(TOP_DIR)/SCHED/phy_procedures_lte_eNb.o SCHED_OBJS += $(TOP_DIR)/SCHED/pusch_pc.o SCHED_OBJS += $(TOP_DIR)/SCHED/pucch_pc.o +SCHED_OBJS += $(TOP_DIR)/SCHED/srs_pc.o diff --git a/openair1/SCHED/defs.h b/openair1/SCHED/defs.h index f9ebd3b3b0..10a0cf6e4b 100644 --- a/openair1/SCHED/defs.h +++ b/openair1/SCHED/defs.h @@ -444,6 +444,15 @@ int8_t pucch_power_cntl(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t subframe,ui */ void pusch_power_cntl(PHY_VARS_UE *phy_vars_ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uint8_t j, uint8_t abstraction_flag); +/*! \brief This function implements the power control mechanism for SRS from 36.213. + @param phy_vars_ue PHY variables + @param proc Pointer to proc descriptor + @param eNB_id Index of eNB + @param j index of type of PUSCH (SPS, Normal, Msg3) + @returns Transmit power + */ +void srs_power_cntl(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uint8_t *pnb_rb_srs, uint8_t abstraction_flag); + int8_t get_PHR(uint8_t Mod_id, uint8_t CC_id, uint8_t eNB_index); #ifdef LOCALIZATION diff --git a/openair1/SCHED/phy_procedures_lte_ue.c b/openair1/SCHED/phy_procedures_lte_ue.c index 5fa9f9f2f5..f15e4768c0 100755 --- a/openair1/SCHED/phy_procedures_lte_ue.c +++ b/openair1/SCHED/phy_procedures_lte_ue.c @@ -205,6 +205,7 @@ unsigned int get_tx_amp(int power_dBm, int power_max_dBm, int N_RB_UL, int nb_rb int gain_dB = power_dBm - power_max_dBm; double gain_lin; + LOG_I(PHY,"Get Tx Amp; Gain[dB]: %d, AMP: %d\n",gain_dB,AMP); if (gain_dB < -20) return(AMP/10); @@ -385,6 +386,180 @@ uint8_t is_SR_TXOp(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id) return(0); } +void compute_srs_pos(lte_frame_type_t frameType,uint16_t isrs,uint16_t *psrsPeriodicity,uint16_t *psrsOffset) +{ + if(TDD == frameType) + { + if(isrs<10) + { + mac_xface->macphy_exit("2 ms SRS periodicity not supported"); + } + + if((isrs>9)&&(isrs<15)) + { + *psrsPeriodicity=5; + *psrsOffset=isrs-10; + } + if((isrs>14)&&(isrs<25)) + { + *psrsPeriodicity=10; + *psrsOffset=isrs-15; + } + if((isrs>24)&&(isrs<45)) + { + *psrsPeriodicity=20; + *psrsOffset=isrs-25; + } + if((isrs>44)&&(isrs<85)) + { + *psrsPeriodicity=40; + *psrsOffset=isrs-45; + } + if((isrs>84)&&(isrs<165)) + { + *psrsPeriodicity=80; + *psrsOffset=isrs-85; + } + if((isrs>164)&&(isrs<325)) + { + *psrsPeriodicity=160; + *psrsOffset=isrs-165; + } + if((isrs>324)&&(isrs<645)) + { + *psrsPeriodicity=320; + *psrsOffset=isrs-325; + } + + if(isrs>644) + { + mac_xface->macphy_exit("Isrs out of range"); + } + + } + else + { + if(isrs<2) + { + *psrsPeriodicity=2; + *psrsOffset=isrs; + } + if((isrs>1)&&(isrs<7)) + { + *psrsPeriodicity=5; + *psrsOffset=isrs-2; + } + if((isrs>6)&&(isrs<17)) + { + *psrsPeriodicity=10; + *psrsOffset=isrs-7; + } + if((isrs>16)&&(isrs<37)) + { + *psrsPeriodicity=20; + *psrsOffset=isrs-17; + } + if((isrs>36)&&(isrs<77)) + { + *psrsPeriodicity=40; + *psrsOffset=isrs-37; + } + if((isrs>76)&&(isrs<157)) + { + *psrsPeriodicity=80; + *psrsOffset=isrs-77; + } + if((isrs>156)&&(isrs<317)) + { + *psrsPeriodicity=160; + *psrsOffset=isrs-157; + } + if((isrs>316)&&(isrs<637)) + { + *psrsPeriodicity=320; + *psrsOffset=isrs-317; + } + if(isrs>636) + { + mac_xface->macphy_exit("Isrs out of range"); + } + } +} + +void ue_compute_srs_occasion(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id) +{ + LTE_DL_FRAME_PARMS *frame_parms = &ue->frame_parms; + int frame_tx = proc->frame_tx; + int subframe_tx = proc->subframe_tx; + uint8_t isSubframeSRS = 0; // SRS Cell Occasion + uint8_t isSubframeSRSTx = 0; // SRS UE Occasion + + SOUNDINGRS_UL_CONFIG_DEDICATED *pSoundingrs_ul_config_dedicated=&ue->soundingrs_ul_config_dedicated[eNB_id]; + + // check for SRS opportunity + pSoundingrs_ul_config_dedicated->srsUeSubframe = 0; + pSoundingrs_ul_config_dedicated->srsCellSubframe = 0; + if(frame_parms->soundingrs_ul_config_common.enabled_flag) + { + + LOG_D(PHY," SRS SUBFRAMECONFIG: %d, Isrs: %d \n", frame_parms->soundingrs_ul_config_common.srs_SubframeConfig, pSoundingrs_ul_config_dedicated->srs_ConfigIndex); + + uint8_t TSFC; + uint16_t deltaTSFC; // bitmap + uint8_t srs_SubframeConfig; + uint16_t srsPeriodicity; + uint16_t srsOffset; + + // table resuming TSFC (Period) and deltaSFC (offset) + const uint16_t deltaTSFCTabType1[15][2] = { {1,1},{1,2},{2,2},{1,5},{2,5},{4,5},{8,5},{3,5},{12,5},{1,10},{2,10},{4,10},{8,10},{351,10},{383,10} }; // Table 5.5.3.3-2 3GPP 36.211 FDD + const uint16_t deltaTSFCTabType2[14][2] = { {2,5},{6,5},{10,5},{18,5},{14,5},{22,5},{26,5},{30,5},{70,10},{74,10},{194,10},{326,10},{586,10},{210,10} }; // Table 5.5.3.3-2 3GPP 36.211 TDD + + srs_SubframeConfig = frame_parms->soundingrs_ul_config_common.srs_SubframeConfig; + if (FDD == frame_parms->frame_type) + { + // srs_SubframeConfig =< 14 + deltaTSFC = deltaTSFCTabType1[srs_SubframeConfig][0]; + TSFC = deltaTSFCTabType1[srs_SubframeConfig][1]; + } + else + { + // srs_SubframeConfig =< 13 + deltaTSFC = deltaTSFCTabType2[srs_SubframeConfig][0]; + TSFC = deltaTSFCTabType2[srs_SubframeConfig][1]; + } + + LOG_D(PHY," ISTDD: %d, TSFC: %d, deltaTSFC: %d, AbsSubframeTX: %d\n", frame_parms->frame_type, TSFC, deltaTSFC, (((int)frame_tx*10)+(int)subframe_tx)); + + // Sounding reference signal subframes are the subframes satisfying ns/2 mod TSFC (- deltaTSFC + uint16_t tmp = (subframe_tx % TSFC); + if((1<srsCellSubframe = 1; + } + + + compute_srs_pos(frame_parms->frame_type, pSoundingrs_ul_config_dedicated->srs_ConfigIndex, &srsPeriodicity, &srsOffset); + + // transmit SRS if the four following constraints are respected: + // - UE is configured to transmit SRS + // - SRS are configured in current subframe + // - UE is configured to send SRS in this subframe + // - CQI is not scheduled in PUCCH transmission - TO BE ADDED + // - simultaneous transmission of SRS and ACKNACK is authorised - TO BE CHECKED + if( isSubframeSRS && + (((10*frame_tx+subframe_tx) % srsPeriodicity) == srsOffset) + //(! is_pucch_per_cqi_report)) + ) + { + isSubframeSRSTx = 1; + pSoundingrs_ul_config_dedicated->srsUeSubframe = 1; + } + LOG_D(PHY," isSubframeSRS: %d, isSubframeSRSTx: %d \n", isSubframeSRS, isSubframeSRSTx); + } +} + uint16_t get_n1_pucch(PHY_VARS_UE *ue, UE_rxtx_proc_t *proc, uint8_t eNB_id, @@ -1086,6 +1261,49 @@ void ue_ulsch_uespec_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB } // subframe_scheduling_flag==1 } +void ue_srs_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uint8_t abstraction_flag) +{ + + //LTE_DL_FRAME_PARMS *frame_parms = &ue->frame_parms; + //int8_t frame_tx = proc->frame_tx; + int8_t subframe_tx = proc->subframe_tx; + int16_t tx_amp; + int16_t Po_SRS; + uint8_t nb_rb_srs; + + SOUNDINGRS_UL_CONFIG_DEDICATED *pSoundingrs_ul_config_dedicated=&ue->soundingrs_ul_config_dedicated[eNB_id]; + uint8_t isSrsTxOccasion = pSoundingrs_ul_config_dedicated->srsUeSubframe; + + if(isSrsTxOccasion) + { + ue->generate_ul_signal[eNB_id] = 1; + if (ue->mac_enabled==1) + { + srs_power_cntl(ue,proc,eNB_id, (uint8_t*)(&nb_rb_srs), abstraction_flag); + Po_SRS = ue->ulsch[eNB_id]->Po_SRS; + } + else + { + Po_SRS = ue->tx_power_max_dBm; + } + +#if defined(EXMIMO) || defined(OAI_USRP) || defined(OAI_BLADERF) || defined(OAI_LMSSDR) + 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; +#endif + LOG_I(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, + Po_SRS, + ue->frame_parms.N_RB_UL, + nb_rb_srs, + tx_amp); + + generate_srs_tx(ue, eNB_id, tx_amp, subframe_tx); + } +} void ue_pucch_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uint8_t abstraction_flag) { @@ -1103,6 +1321,9 @@ void ue_pucch_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uin int tx_amp; int8_t Po_PUCCH; + SOUNDINGRS_UL_CONFIG_DEDICATED *pSoundingrs_ul_config_dedicated=&ue->soundingrs_ul_config_dedicated[eNB_id]; + uint8_t isShortenPucch = pSoundingrs_ul_config_dedicated->srsCellSubframe; + bundling_flag = ue->pucch_config_dedicated[eNB_id].tdd_AckNackFeedbackMode; if ((frame_parms->frame_type==FDD) || @@ -1175,19 +1396,21 @@ void ue_pucch_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uin #endif if (SR_payload>0) { - LOG_D(PHY,"[UE %d][SR %x] Frame %d subframe %d Generating PUCCH 1a/1b payload %d,%d (with SR for PUSCH), n1_pucch %d, Po_PUCCH, amp %d\n", + LOG_I(PHY,"[UE %d][SR %x] Frame %d subframe %d Generating PUCCH 1a/1b payload %d,%d (with SR for PUSCH), shorten_pucch %d, n1_pucch %d, Po_PUCCH, amp %d\n", Mod_id, ue->dlsch[eNB_id][0]->rnti, + isShortenPucch, frame_tx, subframe_tx, pucch_ack_payload[0],pucch_ack_payload[1], ue->scheduling_request_config[eNB_id].sr_PUCCH_ResourceIndex, Po_PUCCH, tx_amp); } else { - LOG_D(PHY,"[UE %d][PDSCH %x] Frame %d subframe %d Generating PUCCH 1a/1b, n1_pucch %d, b[0]=%d,b[1]=%d (SR_Payload %d), Po_PUCCH %d, amp %d\n", + LOG_I(PHY,"[UE %d][PDSCH %x] Frame %d subframe %d Generating PUCCH 1a/1b, shorten_pucch %d, n1_pucch %d, b[0]=%d,b[1]=%d (SR_Payload %d), Po_PUCCH %d, amp %d\n", Mod_id, ue->dlsch[eNB_id][0]->rnti, frame_tx, subframe_tx, + isShortenPucch, n1_pucch,pucch_ack_payload[0],pucch_ack_payload[1],SR_payload, Po_PUCCH, tx_amp); @@ -1201,7 +1424,7 @@ void ue_pucch_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uin format, &ue->pucch_config_dedicated[eNB_id], n1_pucch, - 1, // shortened format + isShortenPucch, // shortened format pucch_ack_payload, tx_amp, subframe_tx); @@ -1236,10 +1459,11 @@ void ue_pucch_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uin #else tx_amp = AMP; #endif - LOG_D(PHY,"[UE %d][SR %x] Frame %d subframe %d Generating PUCCH 1 (SR for PUSCH), n1_pucch %d, Po_PUCCH %d\n", + LOG_I(PHY,"[UE %d][SR %x] Frame %d subframe %d Generating PUCCH 1 (SR for PUSCH), shorten_pucch %d, n1_pucch %d, Po_PUCCH %d\n", Mod_id, ue->dlsch[eNB_id][0]->rnti, frame_tx, subframe_tx, + isShortenPucch, ue->scheduling_request_config[eNB_id].sr_PUCCH_ResourceIndex, Po_PUCCH); @@ -1251,7 +1475,7 @@ void ue_pucch_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uin pucch_format1, &ue->pucch_config_dedicated[eNB_id], ue->scheduling_request_config[eNB_id].sr_PUCCH_ResourceIndex, - 1, // shortened format + isShortenPucch, // shortened format pucch_ack_payload, // this is ignored anyway, we just need a pointer tx_amp, subframe_tx); @@ -1306,8 +1530,13 @@ void phy_procedures_UE_TX(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,ui } - if (ue->UE_mode[eNB_id] == PUSCH) { // check if we need to use PUCCH 1a/1b - ue_pucch_procedures(ue,proc,eNB_id,abstraction_flag); + if (ue->UE_mode[eNB_id] == PUSCH) { + // check cell srs subframe and ue srs subframe + ue_compute_srs_occasion(ue,proc,eNB_id); + // check if we need to use PUCCH 1a/1b + ue_pucch_procedures(ue,proc,eNB_id,abstraction_flag); + // check if we need to use SRS + ue_srs_procedures(ue,proc,eNB_id,abstraction_flag); } // UE_mode==PUSCH diff --git a/openair1/SCHED/srs_pc.c b/openair1/SCHED/srs_pc.c new file mode 100644 index 0000000000..dc9b8fef46 --- /dev/null +++ b/openair1/SCHED/srs_pc.c @@ -0,0 +1,99 @@ +/******************************************************************************* + OpenAirInterface + Copyright(c) 1999 - 2014 Eurecom + + OpenAirInterface is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + + OpenAirInterface is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with OpenAirInterface.The full GNU General Public License is + included in this distribution in the file called "COPYING". If not, + see . + + Contact Information + OpenAirInterface Admin: openair_admin@eurecom.fr + OpenAirInterface Tech : openair_tech@eurecom.fr + OpenAirInterface Dev : openair4g-devel@lists.eurecom.fr + + Address : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE + + *******************************************************************************/ + +/*! \file srs_pc.c + * \brief Implementation of UE SRS Power Control procedures from 36.213 LTE specifications (Section + * \author H. Bilel + * \date 2016 + * \version 0.1 + * \company TCL + * \email: haithem.bilel@alcatelOneTouch.com + * \note + * \warning + */ + +#include "PHY/defs.h" +#include "PHY/LTE_TRANSPORT/proto.h" +#include "PHY/extern.h" + +void srs_power_cntl(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uint8_t *pnb_rb_srs, uint8_t abstraction_flag) +{ + + int16_t PL; + int8_t P_opusch; + int8_t Psrs_offset; + int16_t P_srs; + int16_t f_pusch; + uint8_t alpha; + uint8_t Msrs = 0; + + + SOUNDINGRS_UL_CONFIG_DEDICATED *psoundingrs_ul_config_dedicated = &ue->soundingrs_ul_config_dedicated[eNB_id]; + LTE_DL_FRAME_PARMS *pframe_parms = &ue->frame_parms; + + uint8_t Bsrs = psoundingrs_ul_config_dedicated->srs_Bandwidth; + uint8_t Csrs = pframe_parms->soundingrs_ul_config_common.srs_BandwidthConfig; + LOG_I(PHY," SRS Power Control; AbsSubframe %d.%d, eNB_id %d, srs_Bandwidth %d, srs_BandwidthConfig %d \n",proc->frame_tx,proc->subframe_tx,eNB_id,Bsrs,Csrs); + + if (pframe_parms->N_RB_UL < 41) + { + Msrs = Nb_6_40[Csrs][Bsrs]; + } + else if (pframe_parms->N_RB_UL < 61) + { + Msrs = Nb_41_60[Csrs][Bsrs]; + } + else if (pframe_parms->N_RB_UL < 81) + { + Msrs = Nb_61_80[Csrs][Bsrs]; + } + else if (pframe_parms->N_RB_UL <111) + { + Msrs = Nb_81_110[Csrs][Bsrs]; + } + + // SRS Power control 36.213 5.1.3.1 + // P_srs = P_srs_offset+ 10log10(Msrs) + P_opusch(j) + alpha*PL + f(i)) + + Psrs_offset = (ue->ul_power_control_dedicated[eNB_id].pSRS_Offset - 3); + P_opusch = ue->frame_parms.ul_power_control_config_common.p0_NominalPUSCH; + f_pusch = ue->ulsch[eNB_id]->f_pusch; + alpha = alpha_lut[ue->frame_parms.ul_power_control_config_common.alpha]; + PL = get_PL(ue->Mod_id,ue->CC_id,eNB_id); + + LOG_I(PHY," SRS Power Control; eNB_id %d, p0_NominalPUSCH %d, alpha %d \n",eNB_id,P_opusch,alpha); + LOG_I(PHY," SRS Power Control; eNB_id %d, pSRS_Offset %d, Msrs %d, PL %d, f_pusch %d \n",eNB_id,Psrs_offset,Msrs,PL,f_pusch); + + P_srs = P_opusch + Psrs_offset + f_pusch; + P_srs += (((int32_t)alpha * (int32_t)PL) + hundred_times_log10_NPRB[Msrs-1])/100 ; + + ue->ulsch[eNB_id]->Po_SRS = P_srs; + pnb_rb_srs[0] = Msrs; + LOG_I(PHY," SRS Power Control; eNB_id %d, P_srs[dBm] %d\n",eNB_id,P_srs); +} diff --git a/openair2/RRC/LITE/MESSAGES/asn1_msg.c b/openair2/RRC/LITE/MESSAGES/asn1_msg.c index 13cfae80da..e0556b92bf 100644 --- a/openair2/RRC/LITE/MESSAGES/asn1_msg.c +++ b/openair2/RRC/LITE/MESSAGES/asn1_msg.c @@ -1496,7 +1496,7 @@ do_RRCConnectionSetup( physicalConfigDedicated2->tpc_PDCCH_ConfigPUCCH = CALLOC(1,sizeof(*physicalConfigDedicated2->tpc_PDCCH_ConfigPUCCH)); physicalConfigDedicated2->tpc_PDCCH_ConfigPUSCH = CALLOC(1,sizeof(*physicalConfigDedicated2->tpc_PDCCH_ConfigPUSCH)); physicalConfigDedicated2->cqi_ReportConfig = CALLOC(1,sizeof(*physicalConfigDedicated2->cqi_ReportConfig)); - physicalConfigDedicated2->soundingRS_UL_ConfigDedicated = NULL;//CALLOC(1,sizeof(*physicalConfigDedicated2->soundingRS_UL_ConfigDedicated)); + physicalConfigDedicated2->soundingRS_UL_ConfigDedicated = CALLOC(1,sizeof(*physicalConfigDedicated2->soundingRS_UL_ConfigDedicated)); physicalConfigDedicated2->antennaInfo = CALLOC(1,sizeof(*physicalConfigDedicated2->antennaInfo)); physicalConfigDedicated2->schedulingRequestConfig = CALLOC(1,sizeof(*physicalConfigDedicated2->schedulingRequestConfig)); #ifdef CBA @@ -1582,19 +1582,17 @@ do_RRCConnectionSetup( */ //soundingRS-UL-ConfigDedicated - /* physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->present = SoundingRS_UL_ConfigDedicated_PR_setup; - assign_enum(&physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->choice.setup.srs_Bandwidth, - SoundingRS_UL_ConfigDedicated__setup__srs_Bandwidth_bw0); - assign_enum(&physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->choice.setup.srs_HoppingBandwidth, - SoundingRS_UL_ConfigDedicated__setup__srs_HoppingBandwidth_hbw0); + physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->choice.setup.srs_Bandwidth = + SoundingRS_UL_ConfigDedicated__setup__srs_Bandwidth_bw0; + physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->choice.setup.srs_HoppingBandwidth = + SoundingRS_UL_ConfigDedicated__setup__srs_HoppingBandwidth_hbw0; physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->choice.setup.freqDomainPosition=0; physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->choice.setup.duration=1; - physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->choice.setup.srs_ConfigIndex=1; + physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->choice.setup.srs_ConfigIndex=45; physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->choice.setup.transmissionComb=0; - assign_enum(&physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->choice.setup.cyclicShift, - SoundingRS_UL_ConfigDedicated__setup__cyclicShift_cs0); - */ + physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->choice.setup.cyclicShift= + SoundingRS_UL_ConfigDedicated__setup__cyclicShift_cs0; //AntennaInfoDedicated diff --git a/openair2/RRC/LITE/rrc_eNB.c b/openair2/RRC/LITE/rrc_eNB.c index 5807ababf2..517e354164 100644 --- a/openair2/RRC/LITE/rrc_eNB.c +++ b/openair2/RRC/LITE/rrc_eNB.c @@ -2621,7 +2621,7 @@ rrc_eNB_generate_RRCConnectionReconfiguration_handover( physicalConfigDedicated2->tpc_PDCCH_ConfigPUSCH = CALLOC(1, sizeof(*physicalConfigDedicated2->tpc_PDCCH_ConfigPUSCH)); physicalConfigDedicated2->cqi_ReportConfig = NULL; //CALLOC(1,sizeof(*physicalConfigDedicated2->cqi_ReportConfig)); - physicalConfigDedicated2->soundingRS_UL_ConfigDedicated = NULL; //CALLOC(1,sizeof(*physicalConfigDedicated2->soundingRS_UL_ConfigDedicated)); + physicalConfigDedicated2->soundingRS_UL_ConfigDedicated = CALLOC(1,sizeof(*physicalConfigDedicated2->soundingRS_UL_ConfigDedicated)); physicalConfigDedicated2->antennaInfo = CALLOC(1, sizeof(*physicalConfigDedicated2->antennaInfo)); physicalConfigDedicated2->schedulingRequestConfig = CALLOC(1, sizeof(*physicalConfigDedicated2->schedulingRequestConfig)); diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.generic.oaisim.local_no_mme.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.generic.oaisim.local_no_mme.conf index ef7c1cc19c..a79cb2cae6 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.generic.oaisim.local_no_mme.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.generic.oaisim.local_no_mme.conf @@ -62,11 +62,11 @@ eNBs = pusch_nDMRS1 = 0; phich_duration = "NORMAL"; phich_resource = "ONESIXTH"; - srs_enable = "DISABLE"; - /* srs_BandwidthConfig =; - srs_SubframeConfig =; - srs_ackNackST =; - srs_MaxUpPts =;*/ + srs_enable = "ENABLE"; + srs_BandwidthConfig =2; + srs_SubframeConfig =13; + srs_ackNackST ="DISABLE"; + srs_MaxUpPts ="DISABLE"; pusch_p0_Nominal = -108; pusch_alpha = "AL1"; diff --git a/targets/SIMU/USER/oaisim_functions.c b/targets/SIMU/USER/oaisim_functions.c index 2b19e30a9b..c493086963 100644 --- a/targets/SIMU/USER/oaisim_functions.c +++ b/targets/SIMU/USER/oaisim_functions.c @@ -1283,7 +1283,7 @@ void init_openair1(void) for (UE_id=0; UE_idtx_power_max_dBm=23; + PHY_vars_UE_g[UE_id][CC_id]->tx_power_max_dBm=10; PHY_vars_UE_g[UE_id][CC_id]->rx_total_gain_dB=100; @@ -1525,7 +1525,7 @@ void update_ocm() //calc_path_loss (enb_data[eNB_id], ue_data[UE_id], eNB2UE[eNB_id][UE_id], oai_emulation.environment_system_config,0); UE2eNB[UE_id][eNB_id][CC_id]->path_loss_dB = eNB2UE[eNB_id][UE_id][CC_id]->path_loss_dB; // if (frame % 50 == 0) - LOG_I(OCM,"Path loss (CCid %d) between eNB %d at (%f,%f) and UE %d at (%f,%f) is %f, angle %f\n", + LOG_D(OCM,"Path loss (CCid %d) between eNB %d at (%f,%f) and UE %d at (%f,%f) is %f, angle %f\n", CC_id,eNB_id,enb_data[eNB_id]->x,enb_data[eNB_id]->y,UE_id,ue_data[UE_id]->x,ue_data[UE_id]->y, eNB2UE[eNB_id][UE_id][CC_id]->path_loss_dB, eNB2UE[eNB_id][UE_id][CC_id]->aoa); //double dx, dy, distance; From 9d5621e65cae7e830bfce656dc04434ccbc260b6 Mon Sep 17 00:00:00 2001 From: fnabet Date: Wed, 12 Oct 2016 17:47:31 +0200 Subject: [PATCH 235/349] [OAI-UE] SRS feature 1- Implement SRS procedures 2- Implement SRS procedures part2 --- openair1/PHY/INIT/lte_init.c | 3 ++- openair1/PHY/impl_defs_lte.h | 2 ++ openair1/SCHED/phy_procedures_lte_ue.c | 11 ++++++----- openair1/SCHED/srs_pc.c | 9 +++++---- 4 files changed, 15 insertions(+), 10 deletions(-) diff --git a/openair1/PHY/INIT/lte_init.c b/openair1/PHY/INIT/lte_init.c index d358329b63..cb299110f5 100644 --- a/openair1/PHY/INIT/lte_init.c +++ b/openair1/PHY/INIT/lte_init.c @@ -881,8 +881,9 @@ void phy_config_dedicated_ue(uint8_t Mod_id,int CC_id,uint8_t eNB_id, if (physicalConfigDedicated->soundingRS_UL_ConfigDedicated) { + phy_vars_ue->soundingrs_ul_config_dedicated[eNB_id].srsConfigDedicatedSetup = 0; if (physicalConfigDedicated->soundingRS_UL_ConfigDedicated->present == SchedulingRequestConfig_PR_setup) { - + phy_vars_ue->soundingrs_ul_config_dedicated[eNB_id].srsConfigDedicatedSetup = 1; phy_vars_ue->soundingrs_ul_config_dedicated[eNB_id].duration = physicalConfigDedicated->soundingRS_UL_ConfigDedicated->choice.setup.duration; phy_vars_ue->soundingrs_ul_config_dedicated[eNB_id].cyclicShift = physicalConfigDedicated->soundingRS_UL_ConfigDedicated->choice.setup.cyclicShift; phy_vars_ue->soundingrs_ul_config_dedicated[eNB_id].freqDomainPosition = physicalConfigDedicated->soundingRS_UL_ConfigDedicated->choice.setup.freqDomainPosition; diff --git a/openair1/PHY/impl_defs_lte.h b/openair1/PHY/impl_defs_lte.h index 6813fe058f..4ec446cd5f 100644 --- a/openair1/PHY/impl_defs_lte.h +++ b/openair1/PHY/impl_defs_lte.h @@ -319,6 +319,8 @@ typedef struct { uint16_t srs_ConfigIndex; /// Parameter: \f$n^\text{CS}_\text{SRS}\f$. See TS 36.211 (5.5.3.1). \vr{[0..7]} \note the specification sais it is an enumerated value. uint8_t cyclicShift; + // Parameter: ue srs subframe for internal implementation + uint8_t srsConfigDedicatedSetup; // Parameter: cell srs subframe for internal implementation uint8_t srsCellSubframe; // Parameter: ue srs subframe for internal implementation diff --git a/openair1/SCHED/phy_procedures_lte_ue.c b/openair1/SCHED/phy_procedures_lte_ue.c index f15e4768c0..9670df5b4a 100755 --- a/openair1/SCHED/phy_procedures_lte_ue.c +++ b/openair1/SCHED/phy_procedures_lte_ue.c @@ -502,7 +502,7 @@ void ue_compute_srs_occasion(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id if(frame_parms->soundingrs_ul_config_common.enabled_flag) { - LOG_D(PHY," SRS SUBFRAMECONFIG: %d, Isrs: %d \n", frame_parms->soundingrs_ul_config_common.srs_SubframeConfig, pSoundingrs_ul_config_dedicated->srs_ConfigIndex); + LOG_I(PHY," SRS SUBFRAMECONFIG: %d, Isrs: %d \n", frame_parms->soundingrs_ul_config_common.srs_SubframeConfig, pSoundingrs_ul_config_dedicated->srs_ConfigIndex); uint8_t TSFC; uint16_t deltaTSFC; // bitmap @@ -528,8 +528,6 @@ void ue_compute_srs_occasion(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id TSFC = deltaTSFCTabType2[srs_SubframeConfig][1]; } - LOG_D(PHY," ISTDD: %d, TSFC: %d, deltaTSFC: %d, AbsSubframeTX: %d\n", frame_parms->frame_type, TSFC, deltaTSFC, (((int)frame_tx*10)+(int)subframe_tx)); - // Sounding reference signal subframes are the subframes satisfying ns/2 mod TSFC (- deltaTSFC uint16_t tmp = (subframe_tx % TSFC); if((1<srsCellSubframe = 1; } + LOG_I(PHY," ISTDD: %d, TSFC: %d, deltaTSFC: %d, AbsSubframeTX: %d.%d, srsCellSubframe: %d \n", frame_parms->frame_type, TSFC, deltaTSFC, frame_tx, subframe_tx, pSoundingrs_ul_config_dedicated->srsCellSubframe); - + if(pSoundingrs_ul_config_dedicated->srsConfigDedicatedSetup) + { compute_srs_pos(frame_parms->frame_type, pSoundingrs_ul_config_dedicated->srs_ConfigIndex, &srsPeriodicity, &srsOffset); // transmit SRS if the four following constraints are respected: @@ -556,7 +556,8 @@ void ue_compute_srs_occasion(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id isSubframeSRSTx = 1; pSoundingrs_ul_config_dedicated->srsUeSubframe = 1; } - LOG_D(PHY," isSubframeSRS: %d, isSubframeSRSTx: %d \n", isSubframeSRS, isSubframeSRSTx); + LOG_I(PHY," isSubframeSRS: %d, isSubframeSRSTx: %d \n", isSubframeSRS, isSubframeSRSTx); + } } } diff --git a/openair1/SCHED/srs_pc.c b/openair1/SCHED/srs_pc.c index dc9b8fef46..3ec5f00f9a 100644 --- a/openair1/SCHED/srs_pc.c +++ b/openair1/SCHED/srs_pc.c @@ -59,7 +59,7 @@ void srs_power_cntl(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uint8_t uint8_t Bsrs = psoundingrs_ul_config_dedicated->srs_Bandwidth; uint8_t Csrs = pframe_parms->soundingrs_ul_config_common.srs_BandwidthConfig; - LOG_I(PHY," SRS Power Control; AbsSubframe %d.%d, eNB_id %d, srs_Bandwidth %d, srs_BandwidthConfig %d \n",proc->frame_tx,proc->subframe_tx,eNB_id,Bsrs,Csrs); + LOG_I(PHY," SRS Power Control; AbsSubframe %d.%d, eNB_id %d, N_RB_UL %d, srs_Bandwidth %d, srs_BandwidthConfig %d \n",proc->frame_tx,proc->subframe_tx,eNB_id,pframe_parms->N_RB_UL,Bsrs,Csrs); if (pframe_parms->N_RB_UL < 41) { @@ -88,12 +88,13 @@ void srs_power_cntl(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uint8_t PL = get_PL(ue->Mod_id,ue->CC_id,eNB_id); LOG_I(PHY," SRS Power Control; eNB_id %d, p0_NominalPUSCH %d, alpha %d \n",eNB_id,P_opusch,alpha); - LOG_I(PHY," SRS Power Control; eNB_id %d, pSRS_Offset %d, Msrs %d, PL %d, f_pusch %d \n",eNB_id,Psrs_offset,Msrs,PL,f_pusch); + LOG_I(PHY," SRS Power Control; eNB_id %d, pSRS_Offset[dB] %d, Msrs %d, PL %d, f_pusch %d \n",eNB_id,Psrs_offset,Msrs,PL,f_pusch); P_srs = P_opusch + Psrs_offset + f_pusch; P_srs += (((int32_t)alpha * (int32_t)PL) + hundred_times_log10_NPRB[Msrs-1])/100 ; - ue->ulsch[eNB_id]->Po_SRS = P_srs; + ue->ulsch[eNB_id]->Po_SRS = P_srs < ue->tx_power_max_dBm ? P_srs:ue->tx_power_max_dBm; // MIN(PcMax,Psrs) + pnb_rb_srs[0] = Msrs; - LOG_I(PHY," SRS Power Control; eNB_id %d, P_srs[dBm] %d\n",eNB_id,P_srs); + LOG_I(PHY," SRS Power Control; eNB_id %d, P_srs[dBm] %d, P_cmax[dBm] %d, Psrs[dBm] %d\n",eNB_id,P_srs,ue->tx_power_max_dBm,ue->ulsch[eNB_id]->Po_SRS); } From 9938bd5d05e52c1d41b940f5445ae17f2d57d62e Mon Sep 17 00:00:00 2001 From: fnabet Date: Tue, 18 Oct 2016 16:15:49 +0200 Subject: [PATCH 236/349] [OAI-UE] SRS feature 1- Implement SRS procedures 2- Implement SRS procedures part2 3- Implement SRS: SRS valid on CMW --- openair1/PHY/LTE_TRANSPORT/dci.c | 2 +- openair1/PHY/LTE_TRANSPORT/group_hopping.c | 6 ++ openair1/PHY/LTE_TRANSPORT/srs_modulation.c | 70 +++++++++------------ openair1/PHY/impl_defs_lte.h | 5 ++ openair1/SCHED/phy_procedures_lte_ue.c | 42 ++++++++----- openair1/SCHED/srs_pc.c | 26 +++++--- 6 files changed, 86 insertions(+), 65 deletions(-) diff --git a/openair1/PHY/LTE_TRANSPORT/dci.c b/openair1/PHY/LTE_TRANSPORT/dci.c index ac081f840b..49966f9910 100644 --- a/openair1/PHY/LTE_TRANSPORT/dci.c +++ b/openair1/PHY/LTE_TRANSPORT/dci.c @@ -2865,7 +2865,7 @@ void dci_decoding_procedure0(LTE_UE_PDCCH **pdcch_vars, } } - LOG_D(PHY,"DCI decoding CRNTI [format_c: %d, nCCE[subframe: %d]: %d ]\n",format_c, subframe, pdcch_vars[eNB_id]->nCCE[subframe]); + LOG_D(PHY,"DCI decoding CRNTI [format: %d, nCCE[subframe: %d]: %d ], AggregationLevel %d \n",format_c, subframe, pdcch_vars[eNB_id]->nCCE[subframe],L2); // memcpy(&dci_alloc[*dci_cnt].dci_pdu[0],dci_decoded_output,sizeof_bytes); diff --git a/openair1/PHY/LTE_TRANSPORT/group_hopping.c b/openair1/PHY/LTE_TRANSPORT/group_hopping.c index 64c0830386..ed3cb11c08 100644 --- a/openair1/PHY/LTE_TRANSPORT/group_hopping.c +++ b/openair1/PHY/LTE_TRANSPORT/group_hopping.c @@ -50,6 +50,8 @@ void generate_grouphop(LTE_DL_FRAME_PARMS *frame_parms) // This is from Section 5.5.1.3 uint32_t fss_pusch = frame_parms->Nid_cell + frame_parms->pusch_config_common.ul_ReferenceSignalsPUSCH.groupAssignmentPUSCH; + uint32_t fss_pucch = frame_parms->Nid_cell; + x2 = frame_parms->Nid_cell/30; #ifdef DEBUG_GROUPHOP printf("[PHY] GroupHop:"); @@ -57,7 +59,10 @@ void generate_grouphop(LTE_DL_FRAME_PARMS *frame_parms) for (ns=0; ns<20; ns++) { if (frame_parms->pusch_config_common.ul_ReferenceSignalsPUSCH.groupHoppingEnabled == 0) + { frame_parms->pusch_config_common.ul_ReferenceSignalsPUSCH.grouphop[ns] = fss_pusch%30; + frame_parms->pucch_config_common.grouphop[ns] = fss_pucch%30; + } else { if ((ns&3) == 0) { s = lte_gold_generic(&x1,&x2,reset); @@ -65,6 +70,7 @@ void generate_grouphop(LTE_DL_FRAME_PARMS *frame_parms) } frame_parms->pusch_config_common.ul_ReferenceSignalsPUSCH.grouphop[ns] = (((uint8_t*)&s)[ns&3]+fss_pusch)%30; + frame_parms->pucch_config_common.grouphop[ns] = (((uint8_t*)&s)[ns&3]+fss_pucch)%30; } #ifdef DEBUG_GROUPHOP diff --git a/openair1/PHY/LTE_TRANSPORT/srs_modulation.c b/openair1/PHY/LTE_TRANSPORT/srs_modulation.c index cb5d653909..8f2ad8907a 100644 --- a/openair1/PHY/LTE_TRANSPORT/srs_modulation.c +++ b/openair1/PHY/LTE_TRANSPORT/srs_modulation.c @@ -137,11 +137,10 @@ int32_t generate_srs_tx(PHY_VARS_UE *ue, LTE_DL_FRAME_PARMS *frame_parms=&ue->frame_parms; SOUNDINGRS_UL_CONFIG_DEDICATED *soundingrs_ul_config_dedicated=&ue->soundingrs_ul_config_dedicated[eNB_id]; - int32_t *txdataF = ue->common_vars.txdataF[0]; + int32_t **txdataF = ue->common_vars.txdataF; uint16_t msrsb=0,Nb=0,nb,b,msrs0=0,k,Msc_RS,Msc_RS_idx,carrier_pos,symbol_offset; uint16_t *Msc_idx_ptr; int32_t k0; - uint32_t T_SFC; uint32_t subframe_offset; uint8_t Bsrs = soundingrs_ul_config_dedicated->srs_Bandwidth; uint8_t Csrs = frame_parms->soundingrs_ul_config_common.srs_BandwidthConfig; @@ -149,6 +148,16 @@ int32_t generate_srs_tx(PHY_VARS_UE *ue, uint8_t n_RRC = soundingrs_ul_config_dedicated->freqDomainPosition; uint8_t kTC = soundingrs_ul_config_dedicated->transmissionComb; + // u is the PUCCH sequence-group number defined in Section 5.5.1.3 + // ν is the base sequence number defined in Section 5.5.1.4 + uint32_t u=frame_parms->pucch_config_common.grouphop[1+(subframe<<1)];; + uint32_t v=frame_parms->pusch_config_common.ul_ReferenceSignalsPUSCH.seqhop[1+(subframe<<1)]; + + LOG_D(PHY,"SRS root sequence: u %d, v %d\n",u,v); + LOG_D(PHY,"CommonSrsConfig: Csrs %d, Ssrs %d, AnSrsSimultan %d \n",Csrs,Ssrs,frame_parms->soundingrs_ul_config_common.ackNackSRS_SimultaneousTransmission); + LOG_D(PHY,"DedicatedSrsConfig: Bsrs %d, bhop %d, nRRC %d, Isrs %d, kTC %d, n_SRS %d\n",Bsrs,soundingrs_ul_config_dedicated->srs_HoppingBandwidth,n_RRC + ,soundingrs_ul_config_dedicated->srs_ConfigIndex,kTC + ,soundingrs_ul_config_dedicated->cyclicShift); if (frame_parms->N_RB_UL < 41) { msrs0 = msrsb_6_40[Csrs][0]; @@ -169,7 +178,7 @@ int32_t generate_srs_tx(PHY_VARS_UE *ue, } Msc_RS = msrsb * 6; - k0 = (((frame_parms->N_RB_UL>>1)-(msrs0>>1))*12) + kTC; + k0 = ( ( (int16_t)(frame_parms->N_RB_UL>>1) - (int16_t)(msrs0>>1) ) * 12 ) + kTC; nb = (4*n_RRC/msrsb)%Nb; for (b=0; b<=Bsrs; b++) { @@ -208,53 +217,32 @@ int32_t generate_srs_tx(PHY_VARS_UE *ue, msg("generate_srs_tx: Msc_RS = %d, Msc_RS_idx = %d\n",Msc_RS, Msc_RS_idx); #endif - T_SFC = (Ssrs<=7 ? 5 : 10); + carrier_pos = (frame_parms->first_carrier_offset + k0); + if (carrier_pos>frame_parms->ofdm_symbol_size) { + carrier_pos -= frame_parms->ofdm_symbol_size; + } + uint16_t nsymb = (frame_parms->Ncp==0) ? 14:12; + symbol_offset = (int)frame_parms->ofdm_symbol_size*((subframe*nsymb)+(nsymb-1)); - if ((1<<(subframe%T_SFC))&transmission_offset_tdd[Ssrs]) { - -#ifndef IFFT_FPGA_UE - carrier_pos = (frame_parms->first_carrier_offset + k0) % frame_parms->ofdm_symbol_size; //msg("carrier_pos = %d\n",carrier_pos); + //subframe_offset = subframe*frame_parms->symbols_per_tti*frame_parms->ofdm_symbol_size; + //symbol_offset = subframe_offset+(frame_parms->symbols_per_tti-1)*frame_parms->ofdm_symbol_size; - subframe_offset = subframe*frame_parms->symbols_per_tti*frame_parms->ofdm_symbol_size; - symbol_offset = subframe_offset+(frame_parms->symbols_per_tti-1)*frame_parms->ofdm_symbol_size; + int32_t *txptr; + txptr = &txdataF[0][symbol_offset]; for (k=0; k>15); - ((short*) txdataF)[2*(symbol_offset + carrier_pos)+1] = (short) (((int32_t) amp * (int32_t) ul_ref_sigs[0][0][Msc_RS_idx][(k<<1)+1])>>15); - carrier_pos+=2; + int32_t real = ((int32_t) amp * (int32_t) ul_ref_sigs[u][v][Msc_RS_idx][k<<1]) >> 15; + int32_t imag = ((int32_t) amp * (int32_t) ul_ref_sigs[u][v][Msc_RS_idx][(k<<1)+1]) >> 15; + txptr[carrier_pos] = (real&0xFFFF) + ((imag<<16)&0xFFFF0000); + + + carrier_pos = carrier_pos+2; if (carrier_pos >= frame_parms->ofdm_symbol_size) - carrier_pos=1; + carrier_pos=carrier_pos-frame_parms->ofdm_symbol_size; } -#else - carrier_pos = (frame_parms->N_RB_UL*12/2 + k0) % (frame_parms->N_RB_UL*12); - //msg("carrier_pos = %d\n",carrier_pos); - - subframe_offset = subframe*frame_parms->symbols_per_tti*frame_parms->N_RB_UL*12; - symbol_offset = subframe_offset+(frame_parms->symbols_per_tti-1)*frame_parms->N_RB_UL*12; - - for (k=0; k= 0) && (ul_ref_sigs[0][0][Msc_RS_idx][(k<<1)+1] >= 0)) - txdataF[symbol_offset+carrier_pos] = (int32_t) 4; - else if ((ul_ref_sigs[0][0][Msc_RS_idx][k<<1] >= 0) && (ul_ref_sigs[0][0][Msc_RS_idx][(k<<1)+1] < 0)) - txdataF[symbol_offset+carrier_pos] = (int32_t) 2; - else if ((ul_ref_sigs[0][0][Msc_RS_idx][k<<1] < 0) && (ul_ref_sigs[0][0][Msc_RS_idx][(k<<1)+1] >= 0)) - txdataF[symbol_offset+carrier_pos] = (int32_t) 3; - else if ((ul_ref_sigs[0][0][Msc_RS_idx][k<<1] < 0) && (ul_ref_sigs[0][0][Msc_RS_idx][(k<<1)+1] < 0)) - txdataF[symbol_offset+carrier_pos] = (int32_t) 1; - - carrier_pos+=2; - - if (carrier_pos >= frame_parms->N_RB_UL*12) - carrier_pos=0; - } - -#endif - // write_output("srs_txF.m","srstxF",&txdataF[symbol_offset],512,1,1); - } - return(0); } diff --git a/openair1/PHY/impl_defs_lte.h b/openair1/PHY/impl_defs_lte.h index 4ec446cd5f..30dbff7b86 100644 --- a/openair1/PHY/impl_defs_lte.h +++ b/openair1/PHY/impl_defs_lte.h @@ -148,6 +148,11 @@ typedef struct { uint8_t nCS_AN; /// Parameter: \f$N^{(1)}_\text{PUCCH}\f$ see TS 36.213 (10.1). \vr{[0..2047]} uint16_t n1PUCCH_AN; + + /// group hopping sequence for DRS \note not part of offical UL-PUCCH_CONFIG_COMMON ASN1 specification. + uint8_t grouphop[20]; + /// sequence hopping sequence for DRS \note not part of offical UL-PUCCH_CONFIG_COMMON ASN1 specification. + uint8_t seqhop[20]; } PUCCH_CONFIG_COMMON; /// UL-ReferenceSignalsPUSCH from 36.331 RRC spec diff --git a/openair1/SCHED/phy_procedures_lte_ue.c b/openair1/SCHED/phy_procedures_lte_ue.c index 9670df5b4a..f3ed4ec645 100755 --- a/openair1/SCHED/phy_procedures_lte_ue.c +++ b/openair1/SCHED/phy_procedures_lte_ue.c @@ -205,7 +205,6 @@ unsigned int get_tx_amp(int power_dBm, int power_max_dBm, int N_RB_UL, int nb_rb int gain_dB = power_dBm - power_max_dBm; double gain_lin; - LOG_I(PHY,"Get Tx Amp; Gain[dB]: %d, AMP: %d\n",gain_dB,AMP); if (gain_dB < -20) return(AMP/10); @@ -492,17 +491,19 @@ void ue_compute_srs_occasion(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id int frame_tx = proc->frame_tx; int subframe_tx = proc->subframe_tx; uint8_t isSubframeSRS = 0; // SRS Cell Occasion - uint8_t isSubframeSRSTx = 0; // SRS UE Occasion SOUNDINGRS_UL_CONFIG_DEDICATED *pSoundingrs_ul_config_dedicated=&ue->soundingrs_ul_config_dedicated[eNB_id]; // check for SRS opportunity pSoundingrs_ul_config_dedicated->srsUeSubframe = 0; pSoundingrs_ul_config_dedicated->srsCellSubframe = 0; + + ue->ulsch[eNB_id]->srs_active = 0; + ue->ulsch[eNB_id]->Nsymb_pusch = 12-(frame_parms->Ncp<<1)- ue->ulsch[eNB_id]->srs_active; if(frame_parms->soundingrs_ul_config_common.enabled_flag) { - LOG_I(PHY," SRS SUBFRAMECONFIG: %d, Isrs: %d \n", frame_parms->soundingrs_ul_config_common.srs_SubframeConfig, pSoundingrs_ul_config_dedicated->srs_ConfigIndex); + LOG_D(PHY," SRS SUBFRAMECONFIG: %d, Isrs: %d \n", frame_parms->soundingrs_ul_config_common.srs_SubframeConfig, pSoundingrs_ul_config_dedicated->srs_ConfigIndex); uint8_t TSFC; uint16_t deltaTSFC; // bitmap @@ -536,12 +537,14 @@ void ue_compute_srs_occasion(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id isSubframeSRS = 1; pSoundingrs_ul_config_dedicated->srsCellSubframe = 1; } - LOG_I(PHY," ISTDD: %d, TSFC: %d, deltaTSFC: %d, AbsSubframeTX: %d.%d, srsCellSubframe: %d \n", frame_parms->frame_type, TSFC, deltaTSFC, frame_tx, subframe_tx, pSoundingrs_ul_config_dedicated->srsCellSubframe); - + LOG_D(PHY," ISTDD: %d, TSFC: %d, deltaTSFC: %d, AbsSubframeTX: %d.%d, srsCellSubframe: %d \n", frame_parms->frame_type, TSFC, deltaTSFC, frame_tx, subframe_tx, pSoundingrs_ul_config_dedicated->srsCellSubframe); + LOG_D(PHY," SrsDedicatedSetup: %d \n",pSoundingrs_ul_config_dedicated->srsConfigDedicatedSetup); if(pSoundingrs_ul_config_dedicated->srsConfigDedicatedSetup) { compute_srs_pos(frame_parms->frame_type, pSoundingrs_ul_config_dedicated->srs_ConfigIndex, &srsPeriodicity, &srsOffset); + LOG_D(PHY," srsPeriodicity: %d srsOffset: %d isSubframeSRS %d \n",srsPeriodicity,srsOffset,isSubframeSRS); + // transmit SRS if the four following constraints are respected: // - UE is configured to transmit SRS // - SRS are configured in current subframe @@ -553,11 +556,12 @@ void ue_compute_srs_occasion(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id //(! is_pucch_per_cqi_report)) ) { - isSubframeSRSTx = 1; pSoundingrs_ul_config_dedicated->srsUeSubframe = 1; + ue->ulsch[eNB_id]->srs_active = 1; + ue->ulsch[eNB_id]->Nsymb_pusch = 12-(frame_parms->Ncp<<1)- ue->ulsch[eNB_id]->srs_active; } - LOG_I(PHY," isSubframeSRS: %d, isSubframeSRSTx: %d \n", isSubframeSRS, isSubframeSRSTx); } + LOG_D(PHY," srsCellSubframe: %d, srsUeSubframe: %d, Nsymb-pusch: %d \n", pSoundingrs_ul_config_dedicated->srsCellSubframe, pSoundingrs_ul_config_dedicated->srsUeSubframe, ue->ulsch[eNB_id]->Nsymb_pusch); } } @@ -1289,14 +1293,21 @@ void ue_srs_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uint8 } #if defined(EXMIMO) || defined(OAI_USRP) || defined(OAI_BLADERF) || defined(OAI_LMSSDR) + 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; + } #else tx_amp = AMP; #endif - LOG_I(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, + 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, Po_SRS, ue->frame_parms.N_RB_UL, nb_rb_srs, @@ -1323,7 +1334,7 @@ void ue_pucch_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uin int8_t Po_PUCCH; SOUNDINGRS_UL_CONFIG_DEDICATED *pSoundingrs_ul_config_dedicated=&ue->soundingrs_ul_config_dedicated[eNB_id]; - uint8_t isShortenPucch = pSoundingrs_ul_config_dedicated->srsCellSubframe; + uint8_t isShortenPucch = (pSoundingrs_ul_config_dedicated->srsCellSubframe && frame_parms->soundingrs_ul_config_common.ackNackSRS_SimultaneousTransmission); bundling_flag = ue->pucch_config_dedicated[eNB_id].tdd_AckNackFeedbackMode; @@ -1397,9 +1408,10 @@ void ue_pucch_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uin #endif if (SR_payload>0) { - LOG_I(PHY,"[UE %d][SR %x] Frame %d subframe %d Generating PUCCH 1a/1b payload %d,%d (with SR for PUSCH), shorten_pucch %d, n1_pucch %d, Po_PUCCH, amp %d\n", + LOG_D(PHY,"[UE %d][SR %x] Frame %d subframe %d Generating PUCCH 1a/1b payload %d,%d (with SR for PUSCH), an_srs_simultanous %d, shorten_pucch %d, n1_pucch %d, Po_PUCCH, amp %d\n", Mod_id, ue->dlsch[eNB_id][0]->rnti, + frame_parms->soundingrs_ul_config_common.ackNackSRS_SimultaneousTransmission, isShortenPucch, frame_tx, subframe_tx, pucch_ack_payload[0],pucch_ack_payload[1], @@ -1407,10 +1419,11 @@ void ue_pucch_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uin Po_PUCCH, tx_amp); } else { - LOG_I(PHY,"[UE %d][PDSCH %x] Frame %d subframe %d Generating PUCCH 1a/1b, shorten_pucch %d, n1_pucch %d, b[0]=%d,b[1]=%d (SR_Payload %d), Po_PUCCH %d, amp %d\n", + LOG_D(PHY,"[UE %d][PDSCH %x] Frame %d subframe %d Generating PUCCH 1a/1b, an_srs_simultanous %d, shorten_pucch %d, n1_pucch %d, b[0]=%d,b[1]=%d (SR_Payload %d), Po_PUCCH %d, amp %d\n", Mod_id, ue->dlsch[eNB_id][0]->rnti, frame_tx, subframe_tx, + frame_parms->soundingrs_ul_config_common.ackNackSRS_SimultaneousTransmission, isShortenPucch, n1_pucch,pucch_ack_payload[0],pucch_ack_payload[1],SR_payload, Po_PUCCH, @@ -1460,10 +1473,11 @@ void ue_pucch_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uin #else tx_amp = AMP; #endif - LOG_I(PHY,"[UE %d][SR %x] Frame %d subframe %d Generating PUCCH 1 (SR for PUSCH), shorten_pucch %d, n1_pucch %d, Po_PUCCH %d\n", + LOG_D(PHY,"[UE %d][SR %x] Frame %d subframe %d Generating PUCCH 1 (SR for PUSCH), an_srs_simultanous %d, shorten_pucch %d, n1_pucch %d, Po_PUCCH %d\n", Mod_id, ue->dlsch[eNB_id][0]->rnti, frame_tx, subframe_tx, + frame_parms->soundingrs_ul_config_common.ackNackSRS_SimultaneousTransmission, isShortenPucch, ue->scheduling_request_config[eNB_id].sr_PUCCH_ResourceIndex, Po_PUCCH); @@ -1526,14 +1540,14 @@ void phy_procedures_UE_TX(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,ui } if (ue->UE_mode[eNB_id] != PRACH) { + // check cell srs subframe and ue srs subframe. This has an impact on pusch encoding + ue_compute_srs_occasion(ue,proc,eNB_id); ue_ulsch_uespec_procedures(ue,proc,eNB_id,abstraction_flag); } if (ue->UE_mode[eNB_id] == PUSCH) { - // check cell srs subframe and ue srs subframe - ue_compute_srs_occasion(ue,proc,eNB_id); // check if we need to use PUCCH 1a/1b ue_pucch_procedures(ue,proc,eNB_id,abstraction_flag); // check if we need to use SRS diff --git a/openair1/SCHED/srs_pc.c b/openair1/SCHED/srs_pc.c index 3ec5f00f9a..461d230975 100644 --- a/openair1/SCHED/srs_pc.c +++ b/openair1/SCHED/srs_pc.c @@ -46,7 +46,8 @@ void srs_power_cntl(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uint8_t { int16_t PL; - int8_t P_opusch; + int8_t p0_NominalPUSCH; + int8_t p0_UE_PUSCH; int8_t Psrs_offset; int16_t P_srs; int16_t f_pusch; @@ -59,7 +60,7 @@ void srs_power_cntl(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uint8_t uint8_t Bsrs = psoundingrs_ul_config_dedicated->srs_Bandwidth; uint8_t Csrs = pframe_parms->soundingrs_ul_config_common.srs_BandwidthConfig; - LOG_I(PHY," SRS Power Control; AbsSubframe %d.%d, eNB_id %d, N_RB_UL %d, srs_Bandwidth %d, srs_BandwidthConfig %d \n",proc->frame_tx,proc->subframe_tx,eNB_id,pframe_parms->N_RB_UL,Bsrs,Csrs); + LOG_D(PHY," SRS Power Control; AbsSubframe %d.%d, eNB_id %d, N_RB_UL %d, srs_Bandwidth %d, srs_BandwidthConfig %d \n",proc->frame_tx,proc->subframe_tx,eNB_id,pframe_parms->N_RB_UL,Bsrs,Csrs); if (pframe_parms->N_RB_UL < 41) { @@ -81,20 +82,27 @@ void srs_power_cntl(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uint8_t // SRS Power control 36.213 5.1.3.1 // P_srs = P_srs_offset+ 10log10(Msrs) + P_opusch(j) + alpha*PL + f(i)) - Psrs_offset = (ue->ul_power_control_dedicated[eNB_id].pSRS_Offset - 3); - P_opusch = ue->frame_parms.ul_power_control_config_common.p0_NominalPUSCH; + p0_NominalPUSCH = ue->frame_parms.ul_power_control_config_common.p0_NominalPUSCH; + p0_UE_PUSCH = ue->ul_power_control_dedicated[eNB_id].p0_UE_PUSCH; + Psrs_offset = (ue->ul_power_control_dedicated[eNB_id].pSRS_Offset - 3); + + f_pusch = ue->ulsch[eNB_id]->f_pusch; alpha = alpha_lut[ue->frame_parms.ul_power_control_config_common.alpha]; PL = get_PL(ue->Mod_id,ue->CC_id,eNB_id); - LOG_I(PHY," SRS Power Control; eNB_id %d, p0_NominalPUSCH %d, alpha %d \n",eNB_id,P_opusch,alpha); - LOG_I(PHY," SRS Power Control; eNB_id %d, pSRS_Offset[dB] %d, Msrs %d, PL %d, f_pusch %d \n",eNB_id,Psrs_offset,Msrs,PL,f_pusch); + LOG_D(PHY," SRS Power Control; eNB_id %d, p0_NominalPUSCH %d, p0_UE_PUSCH %d, alpha %d \n",eNB_id,p0_NominalPUSCH,p0_UE_PUSCH,alpha); + LOG_D(PHY," SRS Power Control; eNB_id %d, pSRS_Offset[dB] %d, Msrs %d, PL %d, f_pusch %d \n",eNB_id,Psrs_offset,Msrs,PL,f_pusch); - P_srs = P_opusch + Psrs_offset + f_pusch; + P_srs = (p0_NominalPUSCH + p0_UE_PUSCH) + Psrs_offset + f_pusch; P_srs += (((int32_t)alpha * (int32_t)PL) + hundred_times_log10_NPRB[Msrs-1])/100 ; - ue->ulsch[eNB_id]->Po_SRS = P_srs < ue->tx_power_max_dBm ? P_srs:ue->tx_power_max_dBm; // MIN(PcMax,Psrs) + ue->ulsch[eNB_id]->Po_SRS = P_srs; + if(ue->ulsch[eNB_id]->Po_SRS > ue->tx_power_max_dBm) + { + ue->ulsch[eNB_id]->Po_SRS = ue->tx_power_max_dBm; + } pnb_rb_srs[0] = Msrs; - LOG_I(PHY," SRS Power Control; eNB_id %d, P_srs[dBm] %d, P_cmax[dBm] %d, Psrs[dBm] %d\n",eNB_id,P_srs,ue->tx_power_max_dBm,ue->ulsch[eNB_id]->Po_SRS); + LOG_D(PHY," SRS Power Control; eNB_id %d, Psrs_pc[dBm] %d, Pcmax[dBm] %d, Psrs[dBm] %d\n",eNB_id,P_srs,ue->tx_power_max_dBm,ue->ulsch[eNB_id]->Po_SRS); } From 9ed966cfe6d849f721eab5035a6a2c7a1106d1fe Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Wed, 19 Oct 2016 15:16:58 +0300 Subject: [PATCH 237/349] Added conf file for flexran oaisim --- ...enb.band7.flexran.oaisim.local_no_mme.conf | 160 ++++++++++++++++++ 1 file changed, 160 insertions(+) create mode 100644 targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.flexran.oaisim.local_no_mme.conf diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.flexran.oaisim.local_no_mme.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.flexran.oaisim.local_no_mme.conf new file mode 100644 index 0000000000..ca36fab455 --- /dev/null +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.flexran.oaisim.local_no_mme.conf @@ -0,0 +1,160 @@ +Active_eNBs = ( "eNB_Eurecom_LTEBox"); +# Asn1_verbosity, choice in: none, info, annoying +Asn1_verbosity = "none"; + +eNBs = +( + { + ////////// Identification parameters: + eNB_ID = 0xe00; + + cell_type = "CELL_MACRO_ENB"; + + eNB_name = "eNB_Eurecom_LTEBox"; + + // Tracking area code, 0x0000 and 0xfffe are reserved values + tracking_area_code = "1"; + + mobile_country_code = "208"; + + mobile_network_code = "10"; + + ////////// Physical parameters: + + component_carriers = ( + { + node_function = "eNodeB_3GPP"; + node_timing = "synch_to_ext_device"; + node_synch_ref = 0; + frame_type = "FDD"; + tdd_config = 3; + tdd_config_s = 0; + prefix_type = "NORMAL"; + eutra_band = 7; + downlink_frequency = 2680000000L; + uplink_frequency_offset = -120000000; + Nid_cell = 0; + N_RB_DL = 25; + Nid_cell_mbsfn = 0; + nb_antenna_ports = 2; + nb_antennas_tx = 2; + nb_antennas_rx = 2; + tx_gain = 25; + rx_gain = 20; + prach_root = 0; + prach_config_index = 0; + prach_high_speed = "DISABLE"; + prach_zero_correlation = 1; + prach_freq_offset = 2; + pucch_delta_shift = 1; + pucch_nRB_CQI = 1; + pucch_nCS_AN = 0; + pucch_n1_AN = 32; + pdsch_referenceSignalPower = 0; + pdsch_p_b = 0; + pusch_n_SB = 1; + pusch_enable64QAM = "DISABLE"; + pusch_hoppingMode = "interSubFrame"; + pusch_hoppingOffset = 0; + pusch_groupHoppingEnabled = "ENABLE"; + pusch_groupAssignment = 0; + pusch_sequenceHoppingEnabled = "DISABLE"; + pusch_nDMRS1 = 0; + phich_duration = "NORMAL"; + phich_resource = "ONESIXTH"; + srs_enable = "DISABLE"; + /* srs_BandwidthConfig =; + srs_SubframeConfig =; + srs_ackNackST =; + srs_MaxUpPts =;*/ + + pusch_p0_Nominal = -108; + pusch_alpha = "AL1"; + pucch_p0_Nominal = -108; + msg3_delta_Preamble = 6; + pucch_deltaF_Format1 = "deltaF2"; + pucch_deltaF_Format1b = "deltaF3"; + pucch_deltaF_Format2 = "deltaF0"; + pucch_deltaF_Format2a = "deltaF0"; + pucch_deltaF_Format2b = "deltaF0"; + + rach_numberOfRA_Preambles = 64; + rach_preamblesGroupAConfig = "DISABLE"; + /* + rach_sizeOfRA_PreamblesGroupA = ; + rach_messageSizeGroupA = ; + rach_messagePowerOffsetGroupB = ; + */ + rach_powerRampingStep = 2; + rach_preambleInitialReceivedTargetPower = -100; + rach_preambleTransMax = 10; + rach_raResponseWindowSize = 10; + rach_macContentionResolutionTimer = 48; + rach_maxHARQ_Msg3Tx = 4; + + pcch_default_PagingCycle = 128; + pcch_nB = "oneT"; + bcch_modificationPeriodCoeff = 2; + ue_TimersAndConstants_t300 = 1000; + ue_TimersAndConstants_t301 = 1000; + ue_TimersAndConstants_t310 = 1000; + ue_TimersAndConstants_t311 = 10000; + ue_TimersAndConstants_n310 = 20; + ue_TimersAndConstants_n311 = 1; + + ue_TransmissionMode = 2; + } + ); + + ////////// MME parameters: + mme_ip_address = ( { ipv4 = "0.0.0.0"; + ipv6 = "0::0"; + active = "yes"; + preference = "ipv4"; + } + ); + + NETWORK_INTERFACES : + { + ENB_INTERFACE_NAME_FOR_S1_MME = "none"; + ENB_IPV4_ADDRESS_FOR_S1_MME = "0.0.0.0/24"; + + ENB_INTERFACE_NAME_FOR_S1U = "none"; + ENB_IPV4_ADDRESS_FOR_S1U = "0.0.0.0/24"; + ENB_PORT_FOR_S1U = 2153; # Spec 2152 + }; + + NETWORK_CONTROLLER : + { + ENB_AGENT_INTERFACE_NAME = "eth1"; + ENB_AGENT_IPV4_ADDRESS = "10.0.2.5/30"; + ENB_AGENT_PORT = 2210; + ENB_AGENT_CACHE = "/mnt/oai_agent_cache"; + }; + + log_config : + { + global_log_level ="trace"; + global_log_verbosity ="medium"; + hw_log_level ="info"; + hw_log_verbosity ="medium"; + phy_log_level ="trace"; + phy_log_verbosity ="medium"; + mac_log_level ="trace"; + mac_log_verbosity ="medium"; + rlc_log_level ="trace"; + rlc_log_verbosity ="medium"; + pdcp_log_level ="trace"; + pdcp_log_verbosity ="medium"; + rrc_log_level ="trace"; + rrc_log_verbosity ="medium"; + gtpu_log_level ="debug"; + gtpu_log_verbosity ="medium"; + udp_log_level ="debug"; + udp_log_verbosity ="medium"; + osa_log_level ="debug"; + osa_log_verbosity ="low"; + }; + + } +); From d8defff0fa8c2fe29c3d98b48fd1fc2b28cb0095 Mon Sep 17 00:00:00 2001 From: Raymond Knopp Date: Thu, 20 Oct 2016 06:32:33 -0700 Subject: [PATCH 238/349] periodic cqi procedures --- openair1/PHY/INIT/lte_init.c | 31 ++- openair1/PHY/LTE_TRANSPORT/proto.h | 18 ++ openair1/PHY/LTE_TRANSPORT/pucch.c | 14 +- openair1/PHY/LTE_TRANSPORT/uci_tools.c | 2 + openair1/PHY/impl_defs_lte.h | 14 +- openair1/SCHED/defs.h | 4 + openair1/SCHED/phy_procedures_lte_ue.c | 244 +++++++++++++++++- .../LAYER2/MAC/eNB_scheduler_primitives.c | 2 +- 8 files changed, 317 insertions(+), 12 deletions(-) diff --git a/openair1/PHY/INIT/lte_init.c b/openair1/PHY/INIT/lte_init.c index 3fb1d0c26b..268e2dcabd 100644 --- a/openair1/PHY/INIT/lte_init.c +++ b/openair1/PHY/INIT/lte_init.c @@ -742,7 +742,8 @@ void phy_config_dedicated_ue(uint8_t Mod_id,int CC_id,uint8_t eNB_id, phy_vars_ue->dlsch_received_last[eNB_id]=0; phy_vars_ue->dlsch_fer[eNB_id]=0; - + phy_vars_ue->cqi_report_config[eNB_id].CQI_ReportPeriodic.ri_ConfigIndex = -1; + phy_vars_ue->cqi_report_config[eNB_id].CQI_ReportPeriodic.cqi_PMI_ConfigIndex = -1; if (physicalConfigDedicated) { LOG_D(PHY,"[UE %d] Received physicalConfigDedicated from eNB %d\n",Mod_id, eNB_id); @@ -852,6 +853,31 @@ void phy_config_dedicated_ue(uint8_t Mod_id,int CC_id,uint8_t eNB_id, } + if (physicalConfigDedicated->cqi_ReportConfig) { + if (physicalConfigDedicated->cqi_ReportConfig->cqi_ReportModeAperiodic) { + // configure PUSCH CQI reporting + phy_vars_ue->cqi_report_config[eNB_id].cqi_ReportModeAperiodic = *physicalConfigDedicated->cqi_ReportConfig->cqi_ReportModeAperiodic; + if ((phy_vars_ue->cqi_report_config[eNB_id].cqi_ReportModeAperiodic != rm12) && + (phy_vars_ue->cqi_report_config[eNB_id].cqi_ReportModeAperiodic != rm30) && + (phy_vars_ue->cqi_report_config[eNB_id].cqi_ReportModeAperiodic != rm31)) + LOG_E(PHY,"Unsupported Aperiodic CQI Feedback Mode : %d\n",phy_vars_ue->cqi_report_config[eNB_id].cqi_ReportModeAperiodic); + } + if (physicalConfigDedicated->cqi_ReportConfig->cqi_ReportPeriodic) { + if (physicalConfigDedicated->cqi_ReportConfig->cqi_ReportPeriodic->present == CQI_ReportPeriodic_PR_setup) { + // configure PUCCH CQI reporting + phy_vars_ue->cqi_report_config[eNB_id].CQI_ReportPeriodic.cqi_PUCCH_ResourceIndex = physicalConfigDedicated->cqi_ReportConfig->cqi_ReportPeriodic->choice.setup.cqi_PUCCH_ResourceIndex; + phy_vars_ue->cqi_report_config[eNB_id].CQI_ReportPeriodic.cqi_PMI_ConfigIndex = physicalConfigDedicated->cqi_ReportConfig->cqi_ReportPeriodic->choice.setup.cqi_pmi_ConfigIndex; + if (physicalConfigDedicated->cqi_ReportConfig->cqi_ReportPeriodic->choice.setup.ri_ConfigIndex) + phy_vars_ue->cqi_report_config[eNB_id].CQI_ReportPeriodic.ri_ConfigIndex = *physicalConfigDedicated->cqi_ReportConfig->cqi_ReportPeriodic->choice.setup.ri_ConfigIndex; + } + else if (physicalConfigDedicated->cqi_ReportConfig->cqi_ReportPeriodic->present == CQI_ReportPeriodic_PR_release) { + // handle release + phy_vars_ue->cqi_report_config[eNB_id].CQI_ReportPeriodic.ri_ConfigIndex = -1; + phy_vars_ue->cqi_report_config[eNB_id].CQI_ReportPeriodic.cqi_PMI_ConfigIndex = -1; + } + } + } + #ifdef CBA if (physicalConfigDedicated->pusch_CBAConfigDedicated_vlola) { @@ -868,6 +894,9 @@ void phy_config_dedicated_ue(uint8_t Mod_id,int CC_id,uint8_t eNB_id, return; } + // fill cqi parameters for periodic CQI reporting + get_cqipmiri_params(phy_vars_ue,eNB_id); + } void phy_config_cba_rnti (module_id_t Mod_id,int CC_id,eNB_flag_t eNB_flag, uint8_t index, rnti_t cba_rnti, uint8_t cba_group_id, uint8_t num_active_cba_groups) diff --git a/openair1/PHY/LTE_TRANSPORT/proto.h b/openair1/PHY/LTE_TRANSPORT/proto.h index 86bc3723af..7906d4bdd2 100644 --- a/openair1/PHY/LTE_TRANSPORT/proto.h +++ b/openair1/PHY/LTE_TRANSPORT/proto.h @@ -1445,6 +1445,9 @@ int32_t generate_ue_ulsch_params_from_rar(PHY_VARS_UE *phy_vars_ue, uint8_t eNB_id); double sinr_eff_cqi_calc(PHY_VARS_UE *phy_vars_ue, uint8_t eNB_id); + +uint8_t sinr2cqi(double sinr,uint8_t trans_mode); + int generate_eNB_ulsch_params_from_dci(PHY_VARS_eNB *PHY_vars_eNB, eNB_rxtx_proc_t *proc, void *dci_pdu, @@ -1712,6 +1715,21 @@ void generate_pucch1x(int32_t **txdataF, int16_t amp, uint8_t subframe); +void generate_pucch2x(int32_t **txdataF, + LTE_DL_FRAME_PARMS *fp, + uint8_t ncs_cell[20][7], + PUCCH_FMT_t fmt, + PUCCH_CONFIG_DEDICATED *pucch_config_dedicated, + uint16_t n2_pucch, + uint8_t shortened_format, + uint16_t *payload, + int A, + int B2, + int16_t amp, + uint8_t subframe, + uint16_t rnti); + + void generate_pucch_emul(PHY_VARS_UE *phy_vars_ue, UE_rxtx_proc_t *proc, PUCCH_FMT_t format, diff --git a/openair1/PHY/LTE_TRANSPORT/pucch.c b/openair1/PHY/LTE_TRANSPORT/pucch.c index c0c54b9782..8ecde3747b 100644 --- a/openair1/PHY/LTE_TRANSPORT/pucch.c +++ b/openair1/PHY/LTE_TRANSPORT/pucch.c @@ -460,10 +460,13 @@ inline void pucch2x_modulation(uint8_t *btilde,int16_t *d,int16_t amp) { } + + uint32_t pucch_code[13] = {0xFFFFF,0x5A933,0x10E5A,0x6339C,0x73CE0, 0xFFC00,0xD8E64,0x4F6B0,0x218EC,0x1B746, 0x0FFFF,0x33FFF,0x3FFFC}; + void generate_pucch2x(int32_t **txdataF, LTE_DL_FRAME_PARMS *fp, uint8_t ncs_cell[20][7], @@ -471,7 +474,7 @@ void generate_pucch2x(int32_t **txdataF, PUCCH_CONFIG_DEDICATED *pucch_config_dedicated, uint16_t n2_pucch, uint8_t shortened_format, - uint32_t *payload, + uint16_t *payload, int A, int B2, int16_t amp, @@ -559,10 +562,13 @@ void generate_pucch2x(int32_t **txdataF, nprime = (n2_pucch < 12*NRB2) ? n2_pucch % 12 : (n2_pucch+Ncs1 + 1)%12; - else + else { nprime = (n2_pucch < 12*NRB2) ? ((12*(nprime+1)) % 13)-1 : (10-n2_pucch)%12; + if (shortened_format == 1) + N_UL_symb--; + } //loop over symbols in slot for (l=0; lcqi_report_config[eNB_id].CQI_ReportPeriodic; + int cqi_PMI_ConfigIndex = cqirep->cqi_PMI_ConfigIndex; + + if (ue->frame_parms.frame_type == FDD) { + if (cqi_PMI_ConfigIndex <= 1) { // 2 ms CQI_PMI period + cqirep->Npd = 2; + cqirep->N_OFFSET_CQI = cqi_PMI_ConfigIndex; + } else if (cqi_PMI_ConfigIndex <= 6) { // 5 ms CQI_PMI period + cqirep->Npd = 5; + cqirep->N_OFFSET_CQI = cqi_PMI_ConfigIndex-1; + } else if (cqi_PMI_ConfigIndex <=16) { // 10ms CQI_PMI period + cqirep->Npd = 10; + cqirep->N_OFFSET_CQI = cqi_PMI_ConfigIndex-6; + } else if (cqi_PMI_ConfigIndex <= 36) { // 20 ms CQI_PMI period + cqirep->Npd = 20; + cqirep->N_OFFSET_CQI = cqi_PMI_ConfigIndex-16; + } else if (cqi_PMI_ConfigIndex <= 76) { // 40 ms CQI_PMI period + cqirep->Npd = 40; + cqirep->N_OFFSET_CQI = cqi_PMI_ConfigIndex-36; + } else if (cqi_PMI_ConfigIndex <= 156) { // 80 ms CQI_PMI period + cqirep->Npd = 80; + cqirep->N_OFFSET_CQI = cqi_PMI_ConfigIndex-76; + } else if (cqi_PMI_ConfigIndex <= 316) { // 160 ms CQI_PMI period + cqirep->Npd = 160; + cqirep->N_OFFSET_CQI = cqi_PMI_ConfigIndex-156; + } + else if (cqi_PMI_ConfigIndex > 317) { + + if (cqi_PMI_ConfigIndex <= 349) { // 32 ms CQI_PMI period + cqirep->Npd = 32; + cqirep->N_OFFSET_CQI = cqi_PMI_ConfigIndex-316; + } + else if (cqi_PMI_ConfigIndex <= 413) { // 64 ms CQI_PMI period + cqirep->Npd = 64; + cqirep->N_OFFSET_CQI = cqi_PMI_ConfigIndex-349; + } + else if (cqi_PMI_ConfigIndex <= 541) { // 128 ms CQI_PMI period + cqirep->Npd = 128; + cqirep->N_OFFSET_CQI = cqi_PMI_ConfigIndex-413; + } + } + } + else { // TDD + if (cqi_PMI_ConfigIndex == 0) { // all UL subframes + cqirep->Npd = 1; + cqirep->N_OFFSET_CQI = 0; + } else if (cqi_PMI_ConfigIndex <= 6) { // 5 ms CQI_PMI period + cqirep->Npd = 5; + cqirep->N_OFFSET_CQI = cqi_PMI_ConfigIndex-1; + } else if (cqi_PMI_ConfigIndex <=16) { // 10ms CQI_PMI period + cqirep->Npd = 10; + cqirep->N_OFFSET_CQI = cqi_PMI_ConfigIndex-6; + } else if (cqi_PMI_ConfigIndex <= 36) { // 20 ms CQI_PMI period + cqirep->Npd = 20; + cqirep->N_OFFSET_CQI = cqi_PMI_ConfigIndex-16; + } else if (cqi_PMI_ConfigIndex <= 76) { // 40 ms CQI_PMI period + cqirep->Npd = 40; + cqirep->N_OFFSET_CQI = cqi_PMI_ConfigIndex-36; + } else if (cqi_PMI_ConfigIndex <= 156) { // 80 ms CQI_PMI period + cqirep->Npd = 80; + cqirep->N_OFFSET_CQI = cqi_PMI_ConfigIndex-76; + } else if (cqi_PMI_ConfigIndex <= 316) { // 160 ms CQI_PMI period + cqirep->Npd = 160; + cqirep->N_OFFSET_CQI = cqi_PMI_ConfigIndex-156; + } + } +} + +uint8_t is_cqi_TXOp(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id) +{ + int subframe = proc->subframe_tx; + int frame = proc->frame_tx; + CQI_REPORTPERIODIC *cqirep = &ue->cqi_report_config[eNB_id].CQI_ReportPeriodic; + + LOG_D(PHY,"[UE %d][SR %x] Frame %d subframe %d Checking for CQI TXOp (cqi_ConfigIndex %d)\n", + ue->Mod_id,ue->pdcch_vars[eNB_id]->crnti,frame,subframe, + cqirep->cqi_PMI_ConfigIndex); + + if (((10*frame + subframe) % cqirep->Npd) == cqirep->N_OFFSET_CQI) + return(1); + else + return(0); +} +uint8_t is_ri_TXOp(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id) +{ + + + int subframe = proc->subframe_tx; + int frame = proc->frame_tx; + CQI_REPORTPERIODIC *cqirep = &ue->cqi_report_config[eNB_id].CQI_ReportPeriodic; + int log2Mri = cqirep->ri_ConfigIndex/161; + int N_OFFSET_RI = cqirep->ri_ConfigIndex % 161; + + LOG_D(PHY,"[UE %d][SR %x] Frame %d subframe %d Checking for RI TXOp (ri_ConfigIndex %d)\n", + ue->Mod_id,ue->pdcch_vars[eNB_id]->crnti,frame,subframe, + cqirep->ri_ConfigIndex); + + if (((10*frame + subframe + cqirep->N_OFFSET_CQI - N_OFFSET_RI) % (cqirep->Npd<transmission_mode[eNB_id]<4)|| + (ue->transmission_mode[eNB_id]==7)) { // Mode 1-0 feedback + // 4-bit CQI message + *len=4; + return(sinr2cqi((double)ue->measurements.wideband_cqi_avg[eNB_id], + ue->transmission_mode[eNB_id])); + } + else { // Mode 1-1 feedback, later + *len=0; + // 2-antenna ports RI=1, 6 bits (2 PMI, 4 CQI) + + // 2-antenna ports RI=2, 8 bits (1 PMI, 7 CQI/DIFF CQI) + return(0); + } +} + + +int16_t get_pucch2_ri(PHY_VARS_UE *ue,int eNB_id) { + + return(1); +} + void ue_pucch_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uint8_t abstraction_flag) { uint8_t pucch_ack_payload[2]; - uint8_t n1_pucch; + uint8_t n1_pucch,n2_pucch; ANFBmode_t bundling_flag; PUCCH_FMT_t format; + uint8_t SR_payload; + uint16_t CQI_payload; + uint16_t RI_payload; + LTE_DL_FRAME_PARMS *frame_parms = &ue->frame_parms; int frame_tx=proc->frame_tx; int subframe_tx=proc->subframe_tx; @@ -1210,7 +1344,7 @@ void ue_pucch_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uin #endif } } else if (SR_payload==1) { // no ACK/NAK but SR is triggered by MAC - + if (ue->mac_enabled == 1) { Po_PUCCH = pucch_power_cntl(ue,proc,subframe_tx,eNB_id,pucch_format1); } @@ -1258,6 +1392,107 @@ void ue_pucch_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uin } } // SR_Payload==1 + + // PUCCH 2x + + if (ue->generate_ul_signal[eNB_id] == 0) { // we have not generated ACK/NAK/SR in this subframe + + n2_pucch = ue->cqi_report_config[eNB_id].CQI_ReportPeriodic.cqi_PUCCH_ResourceIndex; + // only use format2 for now, i.e. now ACK/NAK - CQI multiplexing + format = pucch_format2; + + // Periodic CQI report + if ((ue->cqi_report_config[eNB_id].CQI_ReportPeriodic.cqi_PMI_ConfigIndex>0)&& + (is_cqi_TXOp(ue,proc,eNB_id)==1)){ + + if (ue->mac_enabled == 1) { + Po_PUCCH = pucch_power_cntl(ue,proc,subframe_tx,eNB_id,format); + } + else { + Po_PUCCH = ue->tx_power_max_dBm; + } + ue->tx_power_dBm[subframe_tx] = Po_PUCCH; + ue->tx_total_RE[subframe_tx] = 12; + +#if defined(EXMIMO) || defined(OAI_USRP) || defined(OAI_BLADERF) || defined(OAI_LMSSDR) + tx_amp = get_tx_amp(Po_PUCCH, + ue->tx_power_max_dBm, + ue->frame_parms.N_RB_UL, + 1); +#else + tx_amp = AMP; +#endif + LOG_D(PHY,"[UE %d][SR %x] Frame %d subframe %d Generating PUCCH 2 (CQI), n2_pucch %d, Po_PUCCH %d\n", + Mod_id, + ue->dlsch[eNB_id][0]->rnti, + frame_tx, subframe_tx, + n2_pucch, + Po_PUCCH); + + int len; + // get the payload : < 12 bits, returned in len + CQI_payload = get_pucch2_cqi(ue,eNB_id,&len); + generate_pucch2x(ue->common_vars.txdataF, + &ue->frame_parms, + ue->ncs_cell, + format, + &ue->pucch_config_dedicated[eNB_id], + n2_pucch, + 1, // shortened format + &CQI_payload, + len, // A + 0, // B2 not needed + tx_amp, + subframe_tx, + ue->pdcch_vars[eNB_id]->crnti); + + } + // Periodic RI report + else if ((ue->cqi_report_config[eNB_id].CQI_ReportPeriodic.ri_ConfigIndex>0) && + (is_ri_TXOp(ue,proc,eNB_id)==1)){ + + if (ue->mac_enabled == 1) { + Po_PUCCH = pucch_power_cntl(ue,proc,subframe_tx,eNB_id,format); + } + else { + Po_PUCCH = ue->tx_power_max_dBm; + } + ue->tx_power_dBm[subframe_tx] = Po_PUCCH; + ue->tx_total_RE[subframe_tx] = 12; + +#if defined(EXMIMO) || defined(OAI_USRP) || defined(OAI_BLADERF) || defined(OAI_LMSSDR) + tx_amp = get_tx_amp(Po_PUCCH, + ue->tx_power_max_dBm, + ue->frame_parms.N_RB_UL, + 1); +#else + tx_amp = AMP; +#endif + LOG_D(PHY,"[UE %d][SR %x] Frame %d subframe %d Generating PUCCH 2 (RI), n2_pucch %d, Po_PUCCH %d\n", + Mod_id, + ue->dlsch[eNB_id][0]->rnti, + frame_tx, subframe_tx, + n2_pucch, + Po_PUCCH); + + RI_payload = get_pucch2_ri(ue,eNB_id); + + generate_pucch2x(ue->common_vars.txdataF, + &ue->frame_parms, + ue->ncs_cell, + format, + &ue->pucch_config_dedicated[eNB_id], + n2_pucch, + 1, // shortened format + &RI_payload, + 1, // A + 0, // B2 not needed + tx_amp, + subframe_tx, + ue->pdcch_vars[eNB_id]->crnti); + + } + } } void phy_procedures_UE_TX(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uint8_t abstraction_flag,runmode_t mode,relaying_type_t r_type) { @@ -1299,7 +1534,10 @@ void phy_procedures_UE_TX(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,ui } if (ue->UE_mode[eNB_id] == PUSCH) { // check if we need to use PUCCH 1a/1b - ue_pucch_procedures(ue,proc,eNB_id,abstraction_flag); + + ue_pucch_procedures(ue,proc,eNB_id,abstraction_flag); + + } // UE_mode==PUSCH diff --git a/openair2/LAYER2/MAC/eNB_scheduler_primitives.c b/openair2/LAYER2/MAC/eNB_scheduler_primitives.c index 7946fdf663..2107ad0f9a 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler_primitives.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_primitives.c @@ -1006,7 +1006,7 @@ void dump_CCE_table(int *CCE_table,const int nCCE,const unsigned short rnti,cons for (i=0;i Date: Thu, 20 Oct 2016 16:36:43 +0300 Subject: [PATCH 239/349] Moved agent and protocol to flexran naming convention --- cmake_targets/CMakeLists.txt | 88 ++-- .../ENB_APP/MESSAGES/V2/config_common.proto | 142 +++--- .../ENB_APP/MESSAGES/V2/config_messages.proto | 44 +- .../MESSAGES/V2/control_delegation.proto | 4 +- .../MESSAGES/V2/controller_commands.proto | 26 +- openair2/ENB_APP/MESSAGES/V2/flexran.proto | 210 +++++++++ openair2/ENB_APP/MESSAGES/V2/header.proto | 38 +- .../ENB_APP/MESSAGES/V2/mac_primitives.proto | 48 +- openair2/ENB_APP/MESSAGES/V2/progran.proto | 210 --------- .../ENB_APP/MESSAGES/V2/stats_common.proto | 112 ++--- .../ENB_APP/MESSAGES/V2/stats_messages.proto | 60 +-- .../ENB_APP/MESSAGES/V2/time_common.proto | 20 +- openair2/ENB_APP/enb_agent.c | 16 +- openair2/ENB_APP/enb_agent_common.c | 406 ++++++++--------- openair2/ENB_APP/enb_agent_common.h | 76 ++-- openair2/ENB_APP/enb_agent_handler.c | 64 +-- openair2/ENB_APP/enb_agent_mac.c | 418 +++++++++--------- openair2/ENB_APP/enb_agent_mac.h | 34 +- openair2/ENB_APP/enb_agent_mac_defs.h | 12 +- openair2/ENB_APP/enb_agent_mac_internal.c | 166 +++---- openair2/ENB_APP/enb_agent_mac_internal.h | 32 +- openair2/ENB_APP/enb_agent_task_manager.c | 2 +- openair2/ENB_APP/enb_agent_task_manager.h | 8 +- .../MAC/eNB_agent_scheduler_dataplane.c | 84 ++-- .../LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c | 64 +-- .../MAC/eNB_agent_scheduler_dlsch_ue_remote.c | 2 +- .../MAC/eNB_agent_scheduler_dlsch_ue_remote.h | 6 +- openair2/LAYER2/MAC/eNB_scheduler.c | 4 +- openair2/LAYER2/MAC/enb_agent_mac_proto.h | 10 +- ...onversions.h => flexran_dci_conversions.h} | 40 +- openair2/RRC/LITE/rrc_eNB.c | 4 +- 31 files changed, 1225 insertions(+), 1225 deletions(-) create mode 100644 openair2/ENB_APP/MESSAGES/V2/flexran.proto delete mode 100644 openair2/ENB_APP/MESSAGES/V2/progran.proto rename openair2/LAYER2/MAC/{progran_dci_conversions.h => flexran_dci_conversions.h} (58%) diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index c93d7077fc..196baf166b 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -840,55 +840,55 @@ include_directories("${OPENAIR_DIR}") ################ if (ENB_AGENT_SB_IF) # set the version of protobuf messages, V3 not supported yet - add_list1_option(PRPT_VERSION V2 "PRPT MSG protobuf grammar version" V2 V3) + add_list1_option(FLPT_VERSION V2 "FLPT MSG protobuf grammar version" V2 V3) - if (${PRPT_VERSION} STREQUAL "V2") - set (PRPTDIR V2) - elseif (${PRPT_VERSION} STREQUAL "V3") - set (PRPTDIR V3) - endif(${PRPT_VERSION} STREQUAL "V2") + if (${FLPT_VERSION} STREQUAL "V2") + set (FLPTDIR V2) + elseif (${FLPT_VERSION} STREQUAL "V3") + set (FLPTDIR V3) + endif(${FLPT_VERSION} STREQUAL "V2") - set(PRPT_MSG_DIR ${OPENAIR2_DIR}/ENB_APP/MESSAGES/${PRPTDIR} ) - set(PRPT_MSG_FILES - ${PRPT_MSG_DIR}/header.proto - ${PRPT_MSG_DIR}/progran.proto - ${PRPT_MSG_DIR}/stats_common.proto - ${PRPT_MSG_DIR}/stats_messages.proto - ${PRPT_MSG_DIR}/time_common.proto - ${PRPT_MSG_DIR}/controller_commands.proto - ${PRPT_MSG_DIR}/mac_primitives.proto - ${PRPT_MSG_DIR}/config_messages.proto - ${PRPT_MSG_DIR}/config_common.proto - ${PRPT_MSG_DIR}/control_delegation.proto + set(FLPT_MSG_DIR ${OPENAIR2_DIR}/ENB_APP/MESSAGES/${FLPTDIR} ) + set(FLPT_MSG_FILES + ${FLPT_MSG_DIR}/header.proto + ${FLPT_MSG_DIR}/flexran.proto + ${FLPT_MSG_DIR}/stats_common.proto + ${FLPT_MSG_DIR}/stats_messages.proto + ${FLPT_MSG_DIR}/time_common.proto + ${FLPT_MSG_DIR}/controller_commands.proto + ${FLPT_MSG_DIR}/mac_primitives.proto + ${FLPT_MSG_DIR}/config_messages.proto + ${FLPT_MSG_DIR}/config_common.proto + ${FLPT_MSG_DIR}/control_delegation.proto ) - set(PRPT_C_DIR ${protobuf_generated_dir}/${PRPTDIR}) - #message("calling protoc_call=${protoc_call} PRPT_C_DIR=${PRPT_C_DIR} PRPT_MSG_FILES=${PRPT_MSG_FILES}") - execute_process(COMMAND ${protoc_call} ${PRPT_C_DIR} ${PRPT_MSG_DIR} ${PRPT_MSG_FILES}) - file(GLOB PRPT_source ${PRPT_C_DIR}/*.c) - set(PRPT_OAI_generated - ${PRPT_C_DIR}/header.pb-c.c - ${PRPT_C_DIR}/progran.pb-c.c - ${PRPT_C_DIR}/stats_common.pb-c.c - ${PRPT_C_DIR}/stats_messages.pb-c.c - ${PRPT_C_DIR}/time_common.pb-c.c - ${PRPT_C_DIR}/controller_commands.pb-c.c - ${PRPT_C_DIR}/mac_primitives.pb-c.c - ${PRPT_C_DIR}/config_messages.pb-c.c - ${PRPT_C_DIR}/config_common.pb-c.c - ${PRPT_C_DIR}/control_delegation.pb-c.c + set(FLPT_C_DIR ${protobuf_generated_dir}/${FLPTDIR}) + #message("calling protoc_call=${protoc_call} FLPT_C_DIR=${FLPT_C_DIR} FLPT_MSG_FILES=${FLPT_MSG_FILES}") + execute_process(COMMAND ${protoc_call} ${FLPT_C_DIR} ${FLPT_MSG_DIR} ${FLPT_MSG_FILES}) + file(GLOB FLPT_source ${FLPT_C_DIR}/*.c) + set(FLPT_OAI_generated + ${FLPT_C_DIR}/header.pb-c.c + ${FLPT_C_DIR}/flexran.pb-c.c + ${FLPT_C_DIR}/stats_common.pb-c.c + ${FLPT_C_DIR}/stats_messages.pb-c.c + ${FLPT_C_DIR}/time_common.pb-c.c + ${FLPT_C_DIR}/controller_commands.pb-c.c + ${FLPT_C_DIR}/mac_primitives.pb-c.c + ${FLPT_C_DIR}/config_messages.pb-c.c + ${FLPT_C_DIR}/config_common.pb-c.c + ${FLPT_C_DIR}/control_delegation.pb-c.c ) - file(GLOB prpt_h ${PRPT_C_DIR}/*.h) - set(prpt_h ${prpt_h} ) + file(GLOB flpt_h ${FLPT_C_DIR}/*.h) + set(flpt_h ${flpt_h} ) - add_library(PRPT_MSG - ${PRPT_OAI_generated} - ${PRPT_source} + add_library(FLPT_MSG + ${FLPT_OAI_generated} + ${FLPT_source} ) - set(PRPT_MSG_LIB PRPT_MSG) - #message("prpt c dir is : ${PRPT_C_DIR}") - include_directories (${PRPT_C_DIR}) + set(FLPT_MSG_LIB FLPT_MSG) + #message("prpt c dir is : ${FLPT_C_DIR}") + include_directories (${FLPT_C_DIR}) add_library(ASYNC_IF ${OPENAIR2_DIR}/UTIL/ASYNC_IF/socket_link.c @@ -1757,7 +1757,7 @@ add_executable(lte-softmodem target_link_libraries (lte-softmodem -ldl -Wl,--start-group - RRC_LIB S1AP_LIB S1AP_ENB GTPV1U SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT UDP SCHED_LIB PHY LFDS L2 ${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} ${ITTI_LIB} ${MIH_LIB} ${PRPT_MSG_LIB} ${ASYNC_IF_LIB} ${ENB_AGENT_LIB} LFDS7 + RRC_LIB S1AP_LIB S1AP_ENB GTPV1U SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT UDP SCHED_LIB PHY LFDS L2 ${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} ${ITTI_LIB} ${MIH_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${ENB_AGENT_LIB} LFDS7 -Wl,--end-group ) target_link_libraries (lte-softmodem ${LIBXML2_LIBRARIES}) @@ -1791,7 +1791,7 @@ add_executable(lte-softmodem-nos1 ) target_link_libraries (lte-softmodem-nos1 -Wl,--start-group - RRC_LIB SECU_CN SECU_OSA UTIL HASHTABLE SCHED_LIB PHY LFDS L2 ${MSC_LIB} ${RAL_LIB} ${ITTI_LIB} ${MIH_LIB} ${PRPT_MSG_LIB} ${ASYNC_IF_LIB} ${ENB_AGENT_LIB} LFDS7 + RRC_LIB SECU_CN SECU_OSA UTIL HASHTABLE SCHED_LIB PHY LFDS L2 ${MSC_LIB} ${RAL_LIB} ${ITTI_LIB} ${MIH_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${ENB_AGENT_LIB} LFDS7 -Wl,--end-group ) target_link_libraries (lte-softmodem-nos1 ${LIBXML2_LIBRARIES}) @@ -1936,7 +1936,7 @@ add_executable(oaisim_nos1 target_include_directories(oaisim_nos1 PUBLIC ${OPENAIR_TARGETS}/SIMU/USER) target_link_libraries (oaisim_nos1 -Wl,--start-group - RRC_LIB X2AP_LIB SECU_CN UTIL HASHTABLE SCHED_LIB PHY LFDS ${MSC_LIB} L2 ${RAL_LIB} SIMU SIMU_ETH SECU_OSA ${ITTI_LIB} ${MIH_LIB} ${PRPT_MSG_LIB} ${ASYNC_IF_LIB} ${ENB_AGENT_LIB} LFDS7 + RRC_LIB X2AP_LIB SECU_CN UTIL HASHTABLE SCHED_LIB PHY LFDS ${MSC_LIB} L2 ${RAL_LIB} SIMU SIMU_ETH SECU_OSA ${ITTI_LIB} ${MIH_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${ENB_AGENT_LIB} LFDS7 -Wl,--end-group ) target_link_libraries (oaisim_nos1 ${LIBXML2_LIBRARIES} ${LAPACK_LIBRARIES}) diff --git a/openair2/ENB_APP/MESSAGES/V2/config_common.proto b/openair2/ENB_APP/MESSAGES/V2/config_common.proto index cf07f423aa..51ae711277 100644 --- a/openair2/ENB_APP/MESSAGES/V2/config_common.proto +++ b/openair2/ENB_APP/MESSAGES/V2/config_common.proto @@ -5,64 +5,64 @@ package protocol; // Cell config related structures and enums // -message prp_si_config { +message flex_si_config { optional uint32 sfn = 1; optional uint32 sib1_length = 2; // The length of SIB1 in bytes optional uint32 si_window_length = 3; // The scheduling window for all SIs in SF - repeated prp_si_message si_message = 4; // List of SI messages to be sent. + repeated flex_si_message si_message = 4; // List of SI messages to be sent. // The index identifies the type of an SI message // 0 - SIB1 // 1..31 - SIx // 32..63 - PCCH } -message prp_si_message { +message flex_si_message { optional uint32 periodicity = 1; // Periodicity of SI msg in radio frames optional uint32 length = 2; // The length of the SI message in bytes } -enum prp_hopping_mode { - PRHM_INTER = 0; - PRHM_INTERINTRA = 1; +enum flex_hopping_mode { + FLHM_INTER = 0; + FLHM_INTERINTRA = 1; } -enum prp_phich_resource { - PRPR_ONE_SIXTH = 0; - PRPR_HALF = 1; - PRPR_ONE = 2; - PRPR_TWO = 3; +enum flex_phich_resource { + FLPR_ONE_SIXTH = 0; + FLPR_HALF = 1; + FLPR_ONE = 2; + FLPR_TWO = 3; } -enum prp_phich_duration { - PRPD_NORMAL = 0; - PRPD_EXTENDED = 1; +enum flex_phich_duration { + FLPD_NORMAL = 0; + FLPD_EXTENDED = 1; } -enum prp_ul_cyclic_prefix_length { - PRUCPL_NORMAL = 0; - PRUCPL_EXTENDED = 1; +enum flex_ul_cyclic_prefix_length { + FLUCPL_NORMAL = 0; + FLUCPL_EXTENDED = 1; } -enum prp_dl_cyclic_prefix_length { - PRDCPL_NORMAL = 0; - PRDCPL_EXTENDED = 1; +enum flex_dl_cyclic_prefix_length { + FLDCPL_NORMAL = 0; + FLDCPL_EXTENDED = 1; } -enum prp_duplex_mode { - PRDM_TDD = 0; - PRDM_FDD = 1; +enum flex_duplex_mode { + FLDM_TDD = 0; + FLDM_FDD = 1; } -enum prp_qam { - PREQ_MOD_16QAM = 0; - PREQ_MOD_64QAM = 1; +enum flex_qam { + FLEQ_MOD_16QAM = 0; + FLEQ_MOD_64QAM = 1; } // // UE config related structures and enums // -message prp_drx_config { +message flex_drx_config { optional uint32 on_duration_timer = 1; // Timer in SF. See TS 36.321 optional uint32 drx_inactivity_timer = 2; // Timer in SF. See TS 36.321 optional uint32 drx_retransmission_timer = 3; // Timer in SF. See TS 36.321 @@ -72,30 +72,30 @@ message prp_drx_config { optional uint32 drx_short_cycle_timer = 7; // Timer in subframes. See TS 36.321 } -message prp_sps_config { +message flex_sps_config { optional uint32 semi_persistent_sched_interval_UL = 1; // SPS UL scheduling interval in SF optional uint32 semi_persistent_sched_interval_DL = 2; // SPS DL scheduling interval in SF optional uint32 num_of_conf_sps_proc = 3; // Number of SPS HARQ processes. See TS 36.321 repeated uint32 n1_PUCCH_AN_persistent_element = 4;// See TS36.213. Ignored when config is used - // as part of PRPT_SET_UE_CONFIG + // as part of FLPT_SET_UE_CONFIG optional uint32 implicit_release_after = 5; // number of empty transmissions before release of SPS } -message prp_sr_config { +message flex_sr_config { optional uint32 sr_action = 1; // Indicates if SR config should be changed or released - // One of the PRSRA_* enum values + // One of the FLSRA_* enum values optional uint32 sched_interval = 2; // SR scheduling interval in SF optional uint32 dsr_trans_max = 3; // See TS 36.213 } -message prp_cqi_config { +message flex_cqi_config { optional uint32 cqi_action = 1; // Indicats if CQI changed or released. - // One of the PRSRA_* enum values + // One of the FLSRA_* enum values optional uint32 cqi_sched_interval = 2; // CQI scheduling interval in SF optional uint32 ri_sched_interval = 3; // RI scheduling interval in SF } -message prp_ue_capabilities { +message flex_ue_capabilities { optional uint32 half_duplex = 1; // Boolean value. Only half duplex support. FDD operation optional uint32 intra_SF_hopping = 2; // Support for intra-subframe hopping. Boolean value optional uint32 type2_sb_1 = 3; // Support for type 2 hopping with n_sb > 1 @@ -103,7 +103,7 @@ message prp_ue_capabilities { optional uint32 res_alloc_type1 = 5; // Boolean value. UE support for resource allocation type 1 } -message prp_scell_config { +message flex_scell_config { optional uint32 carrier_index = 1; // Id of the carrier component optional uint32 scell_index = 2; // Index of this Scell (RRC SCellIndex) optional uint32 use_ccs = 3; // Boolean value. Indicates if cross-carrier scheduling @@ -113,46 +113,46 @@ message prp_scell_config { optional uint32 pdsch_start = 5; // Starting OFDM symbol of PDSCH data region for this SCell } -enum prp_meas_gap_config_pattern { - PRMGCP_GP1 = 0; - PRMGCP_GP2 = 1; - PRMGCP_OFF = 2; +enum flex_meas_gap_config_pattern { + FLMGCP_GP1 = 0; + FLMGCP_GP2 = 1; + FLMGCP_OFF = 2; } -enum prp_setup_release_action { - PRSRA_SETUP = 0; - PRSRA_RELEASE = 1; +enum flex_setup_release_action { + FLSRA_SETUP = 0; + FLSRA_RELEASE = 1; } -enum prp_ue_transmission_antenna { - PRUTA_NONE = 0; - PRUTA_OPEN_LOOP = 1; - PRUTA_CLOSED_LOOP = 2; +enum flex_ue_transmission_antenna { + FLUTA_NONE = 0; + FLUTA_OPEN_LOOP = 1; + FLUTA_CLOSED_LOOP = 2; } -enum prp_aperiodic_cqi_report_mode { - PRACRM_RM12 = 0; - PRACRM_RM20 = 1; - PRACRM_RM22 = 2; - PRACRM_RM30 = 3; - PRACRM_RM31 = 4; - PRACRM_NONE = 5; +enum flex_aperiodic_cqi_report_mode { + FLACRM_RM12 = 0; + FLACRM_RM20 = 1; + FLACRM_RM22 = 2; + FLACRM_RM30 = 3; + FLACRM_RM31 = 4; + FLACRM_NONE = 5; } -enum prp_tdd_ack_nack_feedback_mode { - PRTANFM_BUNDLING = 0; - PRTANFM_MULTIPLEXING = 1; +enum flex_tdd_ack_nack_feedback_mode { + FLTANFM_BUNDLING = 0; + FLTANFM_MULTIPLEXING = 1; } // // Logical channel config related structures and enums // -message prp_lc_config { +message flex_lc_config { optional uint32 lcid = 1; // The logical channel id optional uint32 lcg = 2; // The logical channel group (0..3) the LC is mapped to - optional uint32 direction = 3; // The LC direction. One of the PRLCD_* enum values - optional uint32 qos_bearer_type = 4;// GBR or NGBR bearer. One of the PRQBT_* enum values + optional uint32 direction = 3; // The LC direction. One of the FLLCD_* enum values + optional uint32 qos_bearer_type = 4;// GBR or NGBR bearer. One of the FLQBT_* enum values optional uint32 qci = 5; // The QCI defined in TS 23.203, coded as defined in TS 36.413 // One less than the actual QCI value optional uint64 e_RAB_max_bitrate_UL = 6; // In bps (GBR only) @@ -161,20 +161,20 @@ message prp_lc_config { optional uint64 e_RAB_guaranteed_bitrate_DL = 9; // In bps (GBR only) } -enum prp_lc_direction { - PRLCD_UL = 0; - PRLCD_DL = 1; - PRLCD_BOTH = 2; +enum flex_lc_direction { + FLLCD_UL = 0; + FLLCD_DL = 1; + FLLCD_BOTH = 2; } -enum prp_qos_bearer_type { - PRQBT_NON_GBR = 0; - PRQBT_GBR = 1; +enum flex_qos_bearer_type { + FLQBT_NON_GBR = 0; + FLQBT_GBR = 1; } -enum prp_ue_state_change_type { - PRUESC_UPDATED = 0; - PRUESC_ACTIVATED = 1; - PRUESC_DEACTIVATED = 2; - PRUESC_MOVED = 3; +enum flex_ue_state_change_type { + FLUESC_UPDATED = 0; + FLUESC_ACTIVATED = 1; + FLUESC_DEACTIVATED = 2; + FLUESC_MOVED = 3; } \ No newline at end of file diff --git a/openair2/ENB_APP/MESSAGES/V2/config_messages.proto b/openair2/ENB_APP/MESSAGES/V2/config_messages.proto index 4e1151a7e8..441e193569 100644 --- a/openair2/ENB_APP/MESSAGES/V2/config_messages.proto +++ b/openair2/ENB_APP/MESSAGES/V2/config_messages.proto @@ -3,23 +3,23 @@ package protocol; import "config_common.proto"; -message prp_cell_config { +message flex_cell_config { optional uint32 phy_cell_id = 1; // The PCI of this cell optional uint32 cell_id = 2; // The PLMN cell id of this cell optional uint32 pusch_hopping_offset = 3; // PUSCH resources in RBs for hopping - optional uint32 hopping_mode = 4; // One of the PRHM_* enum values + optional uint32 hopping_mode = 4; // One of the FLHM_* enum values optional uint32 n_sb = 5; // The number of subbands optional uint32 phich_resource = 6; // The number of REGs used for PHICH - // One of the PRPR_* enum values - optional uint32 phich_duration = 7; // One of the PRPD_* enum values + // One of the FLPR_* enum values + optional uint32 phich_duration = 7; // One of the FLPD_* enum values optional uint32 init_nr_PDCCH_OFDM_sym = 8; // See TS 36.211, section 6.9 - optional prp_si_config si_config = 9; // The SI configuration + optional flex_si_config si_config = 9; // The SI configuration optional uint32 dl_bandwidth = 10; // The DL transmission bandwidth in RBs optional uint32 ul_bandwidth = 11; // The UL transmission bandwidth in RBs - optional uint32 ul_cyclic_prefix_length = 13; // One of the PRUCPL_* enum values - optional uint32 dl_cyclic_prefix_length = 14; // One of the PRDCPL_* enum values + optional uint32 ul_cyclic_prefix_length = 13; // One of the FLUCPL_* enum values + optional uint32 dl_cyclic_prefix_length = 14; // One of the FLDCPL_* enum values optional uint32 antenna_ports_count = 15; // Number of cell specific antenna ports - optional uint32 duplex_mode = 16; // One of the PRDM_* enum values + optional uint32 duplex_mode = 16; // One of the FLDM_* enum values optional uint32 subframe_assignment = 17; // DL/UL subframe assignment. TDD only optional uint32 special_subframe_patterns = 18; // TDD only. See TS 36.211, table 4.2.1 repeated uint32 mbsfn_subframe_config_rfperiod = 19; // The MBSFN radio frame period (Optional) @@ -36,30 +36,30 @@ message prp_cell_config { optional uint32 srs_subframe_config = 30; // See TS 36.211, table 5.5.3.3-1 and 2 optional uint32 srs_bw_config = 31; // See TS 36.211, section 5.5.3.2 optional uint32 srs_mac_up_pts = 32; // Boolean value. See TS 36.211, section 5.5.3.2. TDD only - optional uint32 enable_64QAM = 33; // One of the PREQ_* enum values + optional uint32 enable_64QAM = 33; // One of the FLEQ_* enum values optional uint32 carrier_index = 34; // Carrier component index } -message prp_ue_config { +message flex_ue_config { optional uint32 rnti = 1; - optional prp_drx_config drx_config = 2; // The DRX configuration (Optional) + optional flex_drx_config drx_config = 2; // The DRX configuration (Optional) optional uint32 time_alignment_timer = 3; // Timer in SF. Control the synchronization // status of the UE, not the actual advance procedure // See TS 36.321 optional uint32 meas_gap_config_pattern = 4; // Measurement gap configuration. - // One of the PRMGCP_* enum values + // One of the FLMGCP_* enum values // See TS 36.133 optional uint32 meas_gap_config_sf_offset = 5; // Measurement gap offset if applicable - optional prp_sps_config sps_config = 6; // The SPS configuration (Optional) - optional prp_sr_config sr_config = 7; // The SR configuration (Optional) - optional prp_cqi_config cqi_config = 8; // The CQI configuration (Optional) + optional flex_sps_config sps_config = 6; // The SPS configuration (Optional) + optional flex_sr_config sr_config = 7; // The SR configuration (Optional) + optional flex_cqi_config cqi_config = 8; // The CQI configuration (Optional) optional uint32 transmission_mode = 9; // The UE transmission mode optional uint64 ue_aggregated_max_bitrate_UL = 10; // Aggregated bit-rate of non-gbr bearer // per UE. See TS 36.413 optional uint64 ue_aggregated_max_bitrate_DL = 11; // Aggregated bit-rate of non-gbr bearer // per UE. See TS 36.413 - optional prp_ue_capabilities capabilities = 12; - optional uint32 ue_transmission_antenna = 13; // One of the PRUTA_* enum values + optional flex_ue_capabilities capabilities = 12; + optional uint32 ue_transmission_antenna = 13; // One of the FLUTA_* enum values optional uint32 tti_bundling = 14; // Boolean value. See TS 36.321 optional uint32 max_HARQ_tx = 15; // The max HARQ retransmission for UL optional uint32 beta_offset_ACK_index = 16; // See TS 36.213 @@ -67,20 +67,20 @@ message prp_ue_config { optional uint32 beta_offset_CQI_index = 18; // See TS 36.213 optional uint32 ack_nack_simultaneous_trans = 19;// Boolean. See TS 36.213 optional uint32 simultaneous_ack_nack_cqi = 20; // Boolean. See TS 36.213 - optional uint32 aperiodic_cqi_rep_mode = 21; // One of the PRACRM_* enum values - optional uint32 tdd_ack_nack_feedback = 22; // One of the PRTANFM_* enum values + optional uint32 aperiodic_cqi_rep_mode = 21; // One of the FLACRM_* enum values + optional uint32 tdd_ack_nack_feedback = 22; // One of the FLTANFM_* enum values optional uint32 ack_nack_repetition_factor = 23;// See TS 36.213, section 10.1 optional uint32 extended_bsr_size = 24; // Boolean for extended BSR size optional uint32 ca_support = 25; // Boolean. Support for carrier aggregation optional uint32 cross_carrier_sched_support = 26; // Boolean value optional uint32 pcell_carrier_index = 27; // Index of primary cell - repeated prp_scell_config scell_config = 28; // Secondary cells configuration + repeated flex_scell_config scell_config = 28; // Secondary cells configuration optional uint32 scell_deactivation_timer = 29;// Deactivation timer for secondary cell } -message prp_lc_ue_config { +message flex_lc_ue_config { optional uint32 rnti = 1; - repeated prp_lc_config lc_config = 2; // A list of LC configurations for the given UE + repeated flex_lc_config lc_config = 2; // A list of LC configurations for the given UE } diff --git a/openair2/ENB_APP/MESSAGES/V2/control_delegation.proto b/openair2/ENB_APP/MESSAGES/V2/control_delegation.proto index c5ce58d3a2..3a5efaf7d4 100644 --- a/openair2/ENB_APP/MESSAGES/V2/control_delegation.proto +++ b/openair2/ENB_APP/MESSAGES/V2/control_delegation.proto @@ -1,6 +1,6 @@ //'syntax = "proto2";' package protocol; -enum prp_control_delegation_type { - PRCDT_MAC_DL_UE_SCHEDULER = 1; // DL UE scheduler delegation +enum flex_control_delegation_type { + FLCDT_MAC_DL_UE_SCHEDULER = 1; // DL UE scheduler delegation } \ No newline at end of file diff --git a/openair2/ENB_APP/MESSAGES/V2/controller_commands.proto b/openair2/ENB_APP/MESSAGES/V2/controller_commands.proto index 4ef8c0a370..cbec332b30 100644 --- a/openair2/ENB_APP/MESSAGES/V2/controller_commands.proto +++ b/openair2/ENB_APP/MESSAGES/V2/controller_commands.proto @@ -6,11 +6,11 @@ import "mac_primitives.proto"; // Body of UE DL MAC scheduling configuration info // -message prp_dl_data { +message flex_dl_data { optional uint32 rnti = 1; - optional prp_dl_dci dl_dci = 2; + optional flex_dl_dci dl_dci = 2; repeated uint32 ce_bitmap = 3; // list of 2 MAC CEs, one for each TB - repeated prp_rlc_pdu rlc_pdu = 4; // list of parameters for the creation of RLC PDUs. One for each lcid + repeated flex_rlc_pdu rlc_pdu = 4; // list of parameters for the creation of RLC PDUs. One for each lcid optional uint32 serv_cell_index = 5; optional uint32 act_deact_ce = 6; //Hex content of MAC CE for Activation/Deactivation in CA } @@ -18,10 +18,10 @@ message prp_dl_data { // // Body of the RAR scheduler configuration // -message prp_dl_rar { +message flex_dl_rar { optional uint32 rnti = 1; optional uint32 grant = 2; // The 20-bit UL grant. TS 36.213, sec 6.2 - optional prp_dl_dci rar_dci = 3; + optional flex_dl_dci rar_dci = 3; optional uint32 carrier_index = 4; // The carrier index for the RAR } @@ -29,13 +29,13 @@ message prp_dl_rar { // Body of the paging/broadcast configuration message // -message prp_dl_broadcast { - optional uint32 type = 1; // The PRBT_* values +message flex_dl_broadcast { + optional uint32 type = 1; // The FLBT_* values optional uint32 index = 2; // Index of the broadcast message: // 0 - SIB1, // 1..31 - Six, - // 32..63 - PCCH (PCCH index obtained from prp_paging_info) - optional prp_dl_dci broad_dci = 3; + // 32..63 - PCCH (PCCH index obtained from flex_paging_info) + optional flex_dl_dci broad_dci = 3; optional uint32 carrier_index = 4; // Index of the carrier for broadcast } @@ -43,7 +43,7 @@ message prp_dl_broadcast { // Body of the OFDM symbol count message // -message prp_pdcch_ofdm_sym_count { +message flex_pdcch_ofdm_sym_count { optional uint32 carrier_index = 1; optional uint32 num_pdcch_ofdm_symbols = 2; } @@ -52,7 +52,7 @@ message prp_pdcch_ofdm_sym_count { // Types of commands related enums // -enum prp_broadcast_type { - PRBT_BCCH = 0; - PRBT_PCCH = 1; +enum flex_broadcast_type { + FLBT_BCCH = 0; + FLBT_PCCH = 1; } \ No newline at end of file diff --git a/openair2/ENB_APP/MESSAGES/V2/flexran.proto b/openair2/ENB_APP/MESSAGES/V2/flexran.proto new file mode 100644 index 0000000000..3a1d40bca6 --- /dev/null +++ b/openair2/ENB_APP/MESSAGES/V2/flexran.proto @@ -0,0 +1,210 @@ +//'syntax = "proto2";' +package protocol; + +import "stats_messages.proto"; +import "header.proto"; +import "time_common.proto"; +import "config_messages.proto"; +import "controller_commands.proto"; +import "control_delegation.proto"; + +message flexran_message { + optional flexran_direction msg_dir = 100; + oneof msg { + flex_hello hello_msg = 1; + flex_echo_request echo_request_msg = 2; + flex_echo_reply echo_reply_msg = 3; + flex_stats_request stats_request_msg = 4; + flex_stats_reply stats_reply_msg = 5; + flex_sf_trigger sf_trigger_msg = 6; + flex_ul_sr_info ul_sr_info_msg = 7; + flex_enb_config_request enb_config_request_msg = 8; + flex_enb_config_reply enb_config_reply_msg = 9; + flex_ue_config_request ue_config_request_msg = 10; + flex_ue_config_reply ue_config_reply_msg = 11; + flex_lc_config_request lc_config_request_msg = 12; + flex_lc_config_reply lc_config_reply_msg = 13; + flex_dl_mac_config dl_mac_config_msg = 14; + flex_ue_state_change ue_state_change_msg = 15; + flex_control_delegation control_delegation_msg = 16; + flex_agent_reconfiguration agent_reconfiguration_msg = 17; + } +} + +enum flexran_direction { + //option allow_alias = true; + NOT_SET = 0; + INITIATING_MESSAGE = 1; + SUCCESSFUL_OUTCOME=2; + UNSUCCESSFUL_OUTCOME=3; +} + +enum flexran_err { + option allow_alias = true; + // message errors + NO_ERR = 0; + MSG_DEQUEUING = -1; + MSG_ENQUEUING = -2; + MSG_DECODING = -3; + MSG_ENCODING = -4; + MSG_BUILD = -5; + MSG_NOT_SUPPORTED = -6; + MSG_NOT_HANDLED = -7; + MSG_NOT_VALIDATED = -8; + MSG_OUT_DATED = -9; + + + // other erros + UNEXPECTED = -100; +} + +// +// Maintenance and discovery messages +// + +message flex_hello { + optional flex_header header = 1; +} + +message flex_echo_request { + optional flex_header header = 1; + extensions 100 to 199; +} + + +message flex_echo_reply { + optional flex_header header = 1; + extensions 100 to 199; +} + + +// +// Statistics request and reply message +// + +message flex_stats_request { + optional flex_header header = 1; + optional flex_stats_type type = 2; + oneof body { + flex_complete_stats_request complete_stats_request = 3; + flex_cell_stats_request cell_stats_request = 4; + flex_ue_stats_request ue_stats_request = 5; + } +} + +message flex_stats_reply { + optional flex_header header = 1; + repeated flex_ue_stats_report ue_report = 2; + repeated flex_cell_stats_report cell_report = 3; +} + +// +// Time indication messages +// + +message flex_sf_trigger { + optional flex_header header = 1; + optional uint32 sfn_sf = 2; + repeated flex_dl_info dl_info = 3; + repeated flex_ul_info ul_info = 4; +} + +// +// Asynchronous messages +// + +message flex_ul_sr_info { + optional flex_header header = 1; + optional uint32 sfn_sf = 2; + repeated uint32 rnti = 3; +} + +// +// eNB configuration messages +// +message flex_enb_config_request { + optional flex_header header = 1; +} + +message flex_enb_config_reply { + optional flex_header header = 1; + optional uint32 eNB_id = 2; // Unique id to distinguish the eNB + repeated flex_cell_config cell_config = 3; +} + +message flex_ue_config_request { + optional flex_header header = 1; +} + +message flex_ue_config_reply { + optional flex_header header = 1; + repeated flex_ue_config ue_config = 2; +} + +message flex_lc_config_request { + optional flex_header header = 1; +} + +message flex_lc_config_reply { + optional flex_header header = 1; + repeated flex_lc_ue_config lc_ue_config = 2; +} + +// +// Controller command messages +// + +message flex_dl_mac_config { + optional flex_header header = 1; + optional uint32 sfn_sf = 2; + repeated flex_dl_data dl_ue_data = 3; + repeated flex_dl_rar dl_rar = 4; + repeated flex_dl_broadcast dl_broadcast = 5; + repeated flex_pdcch_ofdm_sym_count ofdm_sym = 6; // OFDM symbol count for each CC +} + +// +// UE state change message +// + +message flex_ue_state_change { + optional flex_header header = 1; + optional uint32 type = 2; // One of the FLUESC_* values + optional flex_ue_config config = 3; // Body of the message (based on type) +} + +// +// Control delegation message +// + +message flex_control_delegation { + optional flex_header header = 1; + optional uint32 delegation_type = 2; // Bitmap of FLCDT_* flags + optional bytes payload = 3; // Byte array of shared lib containing the delegated functions + optional string name = 4; // The delegated functions names ordered based on bitmap flags +} + +// +// Agent reconfiguration message +// + +message flex_agent_reconfiguration { + optional flex_header header = 1; + optional string policy = 2; // The policy changes using YAML syntax in string format +} + +// Extensions of the echo request and reply +// messages for carrying a latency value in ms +message flex_echo_request_latency { + extend flex_echo_request { + optional uint32 latency = 100; + } +} + +message flex_echo_reply_latency { + extend flex_echo_reply { + optional uint32 latency = 100; + } +} + + diff --git a/openair2/ENB_APP/MESSAGES/V2/header.proto b/openair2/ENB_APP/MESSAGES/V2/header.proto index 44ad93e16b..dfd5ea6c99 100644 --- a/openair2/ENB_APP/MESSAGES/V2/header.proto +++ b/openair2/ENB_APP/MESSAGES/V2/header.proto @@ -1,43 +1,43 @@ package protocol; -message prp_header { +message flex_header { optional uint32 version = 1; optional uint32 type = 2; optional uint32 xid = 4; } -enum prp_type { +enum flex_type { // Discovery and maintenance messages - PRPT_HELLO = 0; - PRPT_ECHO_REQUEST = 1; - PRPT_ECHO_REPLY = 2; + FLPT_HELLO = 0; + FLPT_ECHO_REQUEST = 1; + FLPT_ECHO_REPLY = 2; // Statistics and measurement messages - PRPT_STATS_REQUEST = 3; - PRPT_STATS_REPLY = 4; + FLPT_STATS_REQUEST = 3; + FLPT_STATS_REPLY = 4; // Time indication messages - PRPT_SF_TRIGGER = 5; + FLPT_SF_TRIGGER = 5; // Asynchronous messages - PRPT_UL_SR_INFO = 6; + FLPT_UL_SR_INFO = 6; // eNB configuration messages - PRPT_GET_ENB_CONFIG_REQUEST = 7; - PRPT_GET_ENB_CONFIG_REPLY = 8; - PRPT_GET_UE_CONFIG_REQUEST = 9; - PRPT_GET_UE_CONFIG_REPLY = 10; - PRPT_GET_LC_CONFIG_REQUEST = 11; - PRPT_GET_LC_CONFIG_REPLY = 12; + FLPT_GET_ENB_CONFIG_REQUEST = 7; + FLPT_GET_ENB_CONFIG_REPLY = 8; + FLPT_GET_UE_CONFIG_REQUEST = 9; + FLPT_GET_UE_CONFIG_REPLY = 10; + FLPT_GET_LC_CONFIG_REQUEST = 11; + FLPT_GET_LC_CONFIG_REPLY = 12; //Controller command messages - PRPT_DL_MAC_CONFIG = 13; + FLPT_DL_MAC_CONFIG = 13; // UE state change messages - PRPT_UE_STATE_CHANGE = 14; + FLPT_UE_STATE_CHANGE = 14; // Control delegation messages - PRPT_DELEGATE_CONTROL = 15; - PRPT_RECONFIGURE_AGENT = 16; + FLPT_DELEGATE_CONTROL = 15; + FLPT_RECONFIGURE_AGENT = 16; } diff --git a/openair2/ENB_APP/MESSAGES/V2/mac_primitives.proto b/openair2/ENB_APP/MESSAGES/V2/mac_primitives.proto index 4378e6d668..be7c72ab7b 100644 --- a/openair2/ENB_APP/MESSAGES/V2/mac_primitives.proto +++ b/openair2/ENB_APP/MESSAGES/V2/mac_primitives.proto @@ -4,7 +4,7 @@ package protocol; // Message containing the DL DCI info // -message prp_dl_dci { +message flex_dl_dci { optional uint32 rnti = 1; optional uint32 res_alloc = 2; // Type of resource allocation optional uint32 rb_bitmap = 3; // Bitmap for RB allocation @@ -17,17 +17,17 @@ message prp_dl_dci { optional uint32 aggr_level = 10; optional uint32 precoding_info = 11; // 2 antenna ports:0..6, // 4 antenna ports:0..50 - optional uint32 format = 12; // DCI format. A PRDCIF_* value + optional uint32 format = 12; // DCI format. A FLDCIF_* value optional uint32 tpc = 13; // TS 36.213, sec 5.1.1.1 optional uint32 harq_process = 14; // HARQ process ID optional uint32 dai = 15; // TDD only - optional uint32 vrb_format = 16; // One of the PRVRBF_* values + optional uint32 vrb_format = 16; // One of the FLVRBF_* values optional uint32 tb_swap = 17; // Boolean. TB to codeword swap flag optional uint32 sps_release = 18; // Flag value optional uint32 pdcch_order = 19; optional uint32 preamble_index = 20; // Only valid if pdcch_order = 1 optional uint32 prach_mask_index = 21; // Only valid if pdcch_order = 1 - optional uint32 n_gap = 22; // One of the PRNGV_* values + optional uint32 n_gap = 22; // One of the FLNGV_* values optional uint32 tbs_idx = 23; // The TBS index for Format 1A optional uint32 dl_power_offset = 24; // For format 1D optional uint32 pdcch_power_offset = 25; // DL PDCCH power boosting in dB @@ -39,11 +39,11 @@ message prp_dl_dci { // Messages related to the creation of RLC PDUs // -message prp_rlc_pdu { - repeated prp_rlc_pdu_tb rlc_pdu_tb = 1; // list of parameters for the creation of RLC PDUs. One for each TB +message flex_rlc_pdu { + repeated flex_rlc_pdu_tb rlc_pdu_tb = 1; // list of parameters for the creation of RLC PDUs. One for each TB } -message prp_rlc_pdu_tb { +message flex_rlc_pdu_tb { optional uint32 logical_channel_id = 1; optional uint32 size = 2; // Maximum RLC PDU to be created in bytes } @@ -52,25 +52,25 @@ message prp_rlc_pdu_tb { // MAC content types related enums // -enum prp_dci_format { - PRDCIF_1 = 0; - PRDCIF_1A = 1; - PRDCIF_1B = 2; - PRDCIF_1C = 3; - PRDCIF_1D = 4; - PRDCIF_2 = 5; - PRDCIF_2A = 6; - PRDCIF_2B = 7; - PRDCIF_3 = 8; - PRDCIF_3A = 9; +enum flex_dci_format { + FLDCIF_1 = 0; + FLDCIF_1A = 1; + FLDCIF_1B = 2; + FLDCIF_1C = 3; + FLDCIF_1D = 4; + FLDCIF_2 = 5; + FLDCIF_2A = 6; + FLDCIF_2B = 7; + FLDCIF_3 = 8; + FLDCIF_3A = 9; } -enum prp_vrb_format { - PRVRBF_LOCALIZED = 0; - PRVRBF_DISTRIBUTED = 1; +enum flex_vrb_format { + FLVRBF_LOCALIZED = 0; + FLVRBF_DISTRIBUTED = 1; } -enum prp_ngap_val { - PRNGV_1 = 0; - PRNGV_2 = 1; +enum flex_ngap_val { + FLNGV_1 = 0; + FLNGV_2 = 1; } \ No newline at end of file diff --git a/openair2/ENB_APP/MESSAGES/V2/progran.proto b/openair2/ENB_APP/MESSAGES/V2/progran.proto deleted file mode 100644 index 235aba4363..0000000000 --- a/openair2/ENB_APP/MESSAGES/V2/progran.proto +++ /dev/null @@ -1,210 +0,0 @@ -//'syntax = "proto2";' -package protocol; - -import "stats_messages.proto"; -import "header.proto"; -import "time_common.proto"; -import "config_messages.proto"; -import "controller_commands.proto"; -import "control_delegation.proto"; - -message progran_message { - optional progran_direction msg_dir = 100; - oneof msg { - prp_hello hello_msg = 1; - prp_echo_request echo_request_msg = 2; - prp_echo_reply echo_reply_msg = 3; - prp_stats_request stats_request_msg = 4; - prp_stats_reply stats_reply_msg = 5; - prp_sf_trigger sf_trigger_msg = 6; - prp_ul_sr_info ul_sr_info_msg = 7; - prp_enb_config_request enb_config_request_msg = 8; - prp_enb_config_reply enb_config_reply_msg = 9; - prp_ue_config_request ue_config_request_msg = 10; - prp_ue_config_reply ue_config_reply_msg = 11; - prp_lc_config_request lc_config_request_msg = 12; - prp_lc_config_reply lc_config_reply_msg = 13; - prp_dl_mac_config dl_mac_config_msg = 14; - prp_ue_state_change ue_state_change_msg = 15; - prp_control_delegation control_delegation_msg = 16; - prp_agent_reconfiguration agent_reconfiguration_msg = 17; - } -} - -enum progran_direction { - //option allow_alias = true; - NOT_SET = 0; - INITIATING_MESSAGE = 1; - SUCCESSFUL_OUTCOME=2; - UNSUCCESSFUL_OUTCOME=3; -} - -enum progran_err { - option allow_alias = true; - // message errors - NO_ERR = 0; - MSG_DEQUEUING = -1; - MSG_ENQUEUING = -2; - MSG_DECODING = -3; - MSG_ENCODING = -4; - MSG_BUILD = -5; - MSG_NOT_SUPPORTED = -6; - MSG_NOT_HANDLED = -7; - MSG_NOT_VALIDATED = -8; - MSG_OUT_DATED = -9; - - - // other erros - UNEXPECTED = -100; -} - -// -// Maintenance and discovery messages -// - -message prp_hello { - optional prp_header header = 1; -} - -message prp_echo_request { - optional prp_header header = 1; - extensions 100 to 199; -} - - -message prp_echo_reply { - optional prp_header header = 1; - extensions 100 to 199; -} - - -// -// Statistics request and reply message -// - -message prp_stats_request { - optional prp_header header = 1; - optional prp_stats_type type = 2; - oneof body { - prp_complete_stats_request complete_stats_request = 3; - prp_cell_stats_request cell_stats_request = 4; - prp_ue_stats_request ue_stats_request = 5; - } -} - -message prp_stats_reply { - optional prp_header header = 1; - repeated prp_ue_stats_report ue_report = 2; - repeated prp_cell_stats_report cell_report = 3; -} - -// -// Time indication messages -// - -message prp_sf_trigger { - optional prp_header header = 1; - optional uint32 sfn_sf = 2; - repeated prp_dl_info dl_info = 3; - repeated prp_ul_info ul_info = 4; -} - -// -// Asynchronous messages -// - -message prp_ul_sr_info { - optional prp_header header = 1; - optional uint32 sfn_sf = 2; - repeated uint32 rnti = 3; -} - -// -// eNB configuration messages -// -message prp_enb_config_request { - optional prp_header header = 1; -} - -message prp_enb_config_reply { - optional prp_header header = 1; - optional uint32 eNB_id = 2; // Unique id to distinguish the eNB - repeated prp_cell_config cell_config = 3; -} - -message prp_ue_config_request { - optional prp_header header = 1; -} - -message prp_ue_config_reply { - optional prp_header header = 1; - repeated prp_ue_config ue_config = 2; -} - -message prp_lc_config_request { - optional prp_header header = 1; -} - -message prp_lc_config_reply { - optional prp_header header = 1; - repeated prp_lc_ue_config lc_ue_config = 2; -} - -// -// Controller command messages -// - -message prp_dl_mac_config { - optional prp_header header = 1; - optional uint32 sfn_sf = 2; - repeated prp_dl_data dl_ue_data = 3; - repeated prp_dl_rar dl_rar = 4; - repeated prp_dl_broadcast dl_broadcast = 5; - repeated prp_pdcch_ofdm_sym_count ofdm_sym = 6; // OFDM symbol count for each CC -} - -// -// UE state change message -// - -message prp_ue_state_change { - optional prp_header header = 1; - optional uint32 type = 2; // One of the PRUESC_* values - optional prp_ue_config config = 3; // Body of the message (based on type) -} - -// -// Control delegation message -// - -message prp_control_delegation { - optional prp_header header = 1; - optional uint32 delegation_type = 2; // Bitmap of PRCDT_* flags - optional bytes payload = 3; // Byte array of shared lib containing the delegated functions - optional string name = 4; // The delegated functions names ordered based on bitmap flags -} - -// -// Agent reconfiguration message -// - -message prp_agent_reconfiguration { - optional prp_header header = 1; - optional string policy = 2; // The policy changes using YAML syntax in string format -} - -// Extensions of the echo request and reply -// messages for carrying a latency value in ms -message prp_echo_request_latency { - extend prp_echo_request { - optional uint32 latency = 100; - } -} - -message prp_echo_reply_latency { - extend prp_echo_reply { - optional uint32 latency = 100; - } -} - - diff --git a/openair2/ENB_APP/MESSAGES/V2/stats_common.proto b/openair2/ENB_APP/MESSAGES/V2/stats_common.proto index 50d66a620c..70f99618ac 100644 --- a/openair2/ENB_APP/MESSAGES/V2/stats_common.proto +++ b/openair2/ENB_APP/MESSAGES/V2/stats_common.proto @@ -5,7 +5,7 @@ package protocol; // // RLC buffer status for a specific logical channel of a UE -message prp_rlc_bsr { +message flex_rlc_bsr { optional uint32 lc_id = 1; optional uint32 tx_queue_size = 2; optional uint32 tx_queue_hol_delay = 3; @@ -15,39 +15,39 @@ message prp_rlc_bsr { } // Flags for MAC Control Elements -enum prp_ce_type { - PRPCET_TA = 1; - PRPCET_DRX = 2; - PRPCET_CR = 4; - PRPCET_CA = 8; +enum flex_ce_type { + FLPCET_TA = 1; + FLPCET_DRX = 2; + FLPCET_CR = 4; + FLPCET_CA = 8; } // Types of DL CSI reports -enum prp_csi_type { - PRCSIT_P10 = 0; - PRCSIT_P11 = 1; - PRCSIT_P20 = 2; - PRCSIT_P21 = 3; - PRCSIT_A12 = 4; - PRCSIT_A22 = 5; - PRCSIT_A20 = 6; - PRCSIT_A30 = 7; - PRCSIT_A31 = 8; +enum flex_csi_type { + FLCSIT_P10 = 0; + FLCSIT_P11 = 1; + FLCSIT_P20 = 2; + FLCSIT_P21 = 3; + FLCSIT_A12 = 4; + FLCSIT_A22 = 5; + FLCSIT_A20 = 6; + FLCSIT_A30 = 7; + FLCSIT_A31 = 8; } // CSI type P10 -message prp_csi_p10 { +message flex_csi_p10 { optional uint32 wb_cqi = 1; } // CSI type P11 -message prp_csi_p11 { +message flex_csi_p11 { repeated uint32 wb_cqi = 1; optional uint32 wb_pmi = 2; } // CSI type P20 -message prp_csi_p20 { +message flex_csi_p20 { optional uint32 wb_cqi = 1; optional uint32 sb_cqi = 2; optional uint32 bandwidth_part_index = 3; @@ -55,7 +55,7 @@ message prp_csi_p20 { } // CSI type P21 -message prp_csi_p21 { +message flex_csi_p21 { repeated uint32 wb_cqi = 1; optional uint32 wb_pmi = 2; repeated uint32 sb_cqi = 3; @@ -64,13 +64,13 @@ message prp_csi_p21 { } // CSI type A12 -message prp_csi_a12 { +message flex_csi_a12 { repeated uint32 wb_cqi = 1; repeated uint32 sb_pmi = 2; } // CSI type A22 -message prp_csi_a22 { +message flex_csi_a22 { repeated uint32 wb_cqi = 1; repeated uint32 sb_cqi = 2; optional uint32 wb_pmi = 3; @@ -79,56 +79,56 @@ message prp_csi_a22 { } // CSI type A20 -message prp_csi_a20 { +message flex_csi_a20 { optional uint32 wb_cqi = 1; optional uint32 sb_cqi = 2; repeated uint32 sb_list = 3; } // CSI type A30 -message prp_csi_a30 { +message flex_csi_a30 { optional uint32 wb_cqi = 1; repeated uint32 sb_cqi = 2; } // CSI type A31 -message prp_csi_a31 { +message flex_csi_a31 { repeated uint32 wb_cqi = 1; - repeated prp_msb_cqi sb_cqi = 2; + repeated flex_msb_cqi sb_cqi = 2; optional uint32 wb_pmi = 3; } // The CQI for the M-preffered subband -message prp_msb_cqi { +message flex_msb_cqi { repeated uint32 sb_cqi = 1; } // The CSI report of the UE for a specific servCellIndex -message prp_dl_csi { +message flex_dl_csi { optional uint32 serv_cell_index = 1; optional uint32 ri = 2; - optional prp_csi_type type = 3; + optional flex_csi_type type = 3; oneof report { - prp_csi_p10 p10csi = 4; - prp_csi_p11 p11csi = 5; - prp_csi_p20 p20csi = 6; - prp_csi_p21 p21csi = 7; - prp_csi_a12 a12csi = 8; - prp_csi_a22 a22csi = 9; - prp_csi_a20 a20csi = 10; - prp_csi_a30 a30csi = 11; - prp_csi_a31 a31csi = 12; + flex_csi_p10 p10csi = 4; + flex_csi_p11 p11csi = 5; + flex_csi_p20 p20csi = 6; + flex_csi_p21 p21csi = 7; + flex_csi_a12 a12csi = 8; + flex_csi_a22 a22csi = 9; + flex_csi_a20 a20csi = 10; + flex_csi_a30 a30csi = 11; + flex_csi_a31 a31csi = 12; } } // The full DL CQI report for all CC of a UE -message prp_dl_cqi_report { +message flex_dl_cqi_report { optional uint32 sfn_sn = 1; - repeated prp_dl_csi csi_report = 2; + repeated flex_dl_csi csi_report = 2; } // Paging message info -message prp_paging_info { +message flex_paging_info { optional uint32 paging_index = 1; optional uint32 paging_message_size = 2; optional uint32 paging_subframe = 3; @@ -136,34 +136,34 @@ message prp_paging_info { } // Report for the paging buffer status -message prp_paging_buffer_report { - repeated prp_paging_info paging_info = 1; +message flex_paging_buffer_report { + repeated flex_paging_info paging_info = 1; } // The type of UL CQI -enum prp_ul_cqi_type { - PRUCT_SRS = 0; - PRUCT_PUSCH = 1; - PRUCT_PUCCH_1 = 2; - PRUCT_PUCCH_2 = 3; - PRUCT_PRACH = 4; +enum flex_ul_cqi_type { + FLUCT_SRS = 0; + FLUCT_PUSCH = 1; + FLUCT_PUCCH_1 = 2; + FLUCT_PUCCH_2 = 3; + FLUCT_PRACH = 4; } // UL CQI report for a specific UE for a given report type -message prp_ul_cqi { - optional prp_ul_cqi_type type = 1; +message flex_ul_cqi { + optional flex_ul_cqi_type type = 1; repeated uint32 sinr = 2; optional uint32 serv_cell_index = 3; } // Full UL CQI report for a specific UE -message prp_ul_cqi_report { +message flex_ul_cqi_report { optional uint32 sfn_sn = 1; - repeated prp_ul_cqi cqi_meas = 2; - repeated prp_pucch_dbm pucch_dbm = 3; + repeated flex_ul_cqi cqi_meas = 2; + repeated flex_pucch_dbm pucch_dbm = 3; } -message prp_pucch_dbm { +message flex_pucch_dbm { optional int32 p0_pucch_dbm = 1; optional uint32 serv_cell_index = 2; } @@ -173,7 +173,7 @@ message prp_pucch_dbm { // // The UL noise and interference report for a UE -message prp_noise_interference_report { +message flex_noise_interference_report { optional uint32 sfn_sf = 1; optional uint32 rip = 2; optional uint32 tnp = 3; diff --git a/openair2/ENB_APP/MESSAGES/V2/stats_messages.proto b/openair2/ENB_APP/MESSAGES/V2/stats_messages.proto index 5ec7ae690c..1b1567dda1 100644 --- a/openair2/ENB_APP/MESSAGES/V2/stats_messages.proto +++ b/openair2/ENB_APP/MESSAGES/V2/stats_messages.proto @@ -7,19 +7,19 @@ import "stats_common.proto"; // Bodies of statistics report requests // -message prp_complete_stats_request { - optional prp_stats_report_freq report_frequency = 1; +message flex_complete_stats_request { + optional flex_stats_report_freq report_frequency = 1; optional uint32 sf = 2; optional uint32 cell_report_flags = 3; optional uint32 ue_report_flags = 4; } -message prp_cell_stats_request { +message flex_cell_stats_request { repeated uint32 cell = 1; optional uint32 flags = 2; } -message prp_ue_stats_request { +message flex_ue_stats_request { repeated uint32 rnti = 1; optional uint32 flags = 2; } @@ -29,23 +29,23 @@ message prp_ue_stats_request { // // The full statistics report for a specific cell -message prp_cell_stats_report { +message flex_cell_stats_report { optional uint32 carrier_index = 1; optional uint32 flags = 2; - optional prp_noise_interference_report noise_inter_report = 3; + optional flex_noise_interference_report noise_inter_report = 3; } // Statistics report for a specific UE -message prp_ue_stats_report { +message flex_ue_stats_report { optional uint32 rnti = 1; optional uint32 flags = 2; repeated uint32 bsr = 3; optional uint32 phr = 4; - repeated prp_rlc_bsr rlc_report = 5; + repeated flex_rlc_bsr rlc_report = 5; optional uint32 pending_mac_ces = 6; - optional prp_dl_cqi_report dl_cqi_report = 7; - optional prp_paging_buffer_report pbr = 8; - optional prp_ul_cqi_report ul_cqi_report = 9; + optional flex_dl_cqi_report dl_cqi_report = 7; + optional flex_paging_buffer_report pbr = 8; + optional flex_ul_cqi_report ul_cqi_report = 9; } // @@ -54,33 +54,33 @@ message prp_ue_stats_report { //Types of statistics requested by the controller -enum prp_stats_type { - PRST_COMPLETE_STATS = 0; - PRST_CELL_STATS = 1; - PRST_UE_STATS = 2; +enum flex_stats_type { + FLST_COMPLETE_STATS = 0; + FLST_CELL_STATS = 1; + FLST_UE_STATS = 2; } // Report frequency for the requested statistics -enum prp_stats_report_freq { - PRSRF_ONCE = 0; - PRSRF_PERIODICAL = 1; - PRSRF_CONTINUOUS = 2; - PRSRF_OFF = 3; +enum flex_stats_report_freq { + FLSRF_ONCE = 0; + FLSRF_PERIODICAL = 1; + FLSRF_CONTINUOUS = 2; + FLSRF_OFF = 3; } // Flags for cell statistics -enum prp_cell_stats_type { - PRCST_NOISE_INTERFERENCE = 1; +enum flex_cell_stats_type { + FLCST_NOISE_INTERFERENCE = 1; } // Flags for UE-related statistics -enum prp_ue_stats_type { - PRUST_BSR = 1; - PRUST_PRH = 2; - PRUST_RLC_BS = 4; - PRUST_MAC_CE_BS = 8; - PRUST_DL_CQI = 16; - PRUST_PBS = 32; - PRUST_UL_CQI = 64; +enum flex_ue_stats_type { + FLUST_BSR = 1; + FLUST_PRH = 2; + FLUST_RLC_BS = 4; + FLUST_MAC_CE_BS = 8; + FLUST_DL_CQI = 16; + FLUST_PBS = 32; + FLUST_UL_CQI = 64; // To be extended with more types of stats } \ No newline at end of file diff --git a/openair2/ENB_APP/MESSAGES/V2/time_common.proto b/openair2/ENB_APP/MESSAGES/V2/time_common.proto index 4c3ac4911e..30a56bb776 100644 --- a/openair2/ENB_APP/MESSAGES/V2/time_common.proto +++ b/openair2/ENB_APP/MESSAGES/V2/time_common.proto @@ -1,25 +1,25 @@ package protocol; -enum prp_harq_status { - PRHS_ACK = 0; - PRHS_NACK = 1; - PRHS_DTX = 2; +enum flex_harq_status { + FLHS_ACK = 0; + FLHS_NACK = 1; + FLHS_DTX = 2; } -enum prp_reception_status { - PRRS_OK = 0; - PRRS_NOT_OK = 1; - PRRS_NOT_VALID = 2; +enum flex_reception_status { + FLRS_OK = 0; + FLRS_NOT_OK = 1; + FLRS_NOT_VALID = 2; } -message prp_dl_info { +message flex_dl_info { optional uint32 rnti = 1; optional uint32 harq_process_id = 2; repeated uint32 harq_status = 3; optional uint32 serv_cell_index = 4; } -message prp_ul_info { +message flex_ul_info { optional uint32 rnti = 1; repeated uint32 ul_reception = 2; optional uint32 reception_status = 3; diff --git a/openair2/ENB_APP/enb_agent.c b/openair2/ENB_APP/enb_agent.c index 6a9bcad878..8286771104 100644 --- a/openair2/ENB_APP/enb_agent.c +++ b/openair2/ENB_APP/enb_agent.c @@ -29,7 +29,7 @@ /*! \file enb_agent.h * \brief top level enb agent receive thread and itti task - * \author Navid Nikaein and Xenofon Foukas + * \author Xenofon Foukas and Navid Nikaein * \date 2016 * \version 0.1 */ @@ -57,7 +57,7 @@ char local_cache[40]; void *send_thread(void *args); void *receive_thread(void *args); pthread_t new_thread(void *(*f)(void *), void *b); -Protocol__ProgranMessage *enb_agent_timeout(void* args); +Protocol__FlexranMessage *enb_agent_timeout(void* args); int agent_task_created = 0; @@ -68,7 +68,7 @@ int agent_task_created = 0; void *enb_agent_task(void *args){ //enb_agent_instance_t *d = (enb_agent_instance_t *) args; - Protocol__ProgranMessage *msg; + Protocol__FlexranMessage *msg; void *data; int size; err_code_t err_code; @@ -104,7 +104,7 @@ void *enb_agent_task(void *args){ data=enb_agent_pack_message(msg,&size); elem = get_timer_entry(msg_p->ittiMsg.timer_has_expired.timer_id); if (enb_agent_msg_send(elem->agent_id, ENB_AGENT_DEFAULT, data, size, priority)) { - err_code = PROTOCOL__PROGRAN_ERR__MSG_ENQUEUING; + err_code = PROTOCOL__FLEXRAN_ERR__MSG_ENQUEUING; goto error; } @@ -135,11 +135,11 @@ void *receive_thread(void *args) { int priority; err_code_t err_code; - Protocol__ProgranMessage *msg; + Protocol__FlexranMessage *msg; while (1) { //if (enb_agent_msg_recv(d->enb_id, ENB_AGENT_DEFAULT, &data, &size, &priority)) { - // err_code = PROTOCOL__PROGRAN_ERR__MSG_DEQUEUING; + // err_code = PROTOCOL__FLEXRAN_ERR__MSG_DEQUEUING; // goto error; //} @@ -157,7 +157,7 @@ void *receive_thread(void *args) { data=enb_agent_pack_message(msg,&size); if (enb_agent_msg_send(d->enb_id, ENB_AGENT_DEFAULT, data, size, priority)) { - err_code = PROTOCOL__PROGRAN_ERR__MSG_ENQUEUING; + err_code = PROTOCOL__FLEXRAN_ERR__MSG_ENQUEUING; goto error; } @@ -337,7 +337,7 @@ error: -Protocol__ProgranMessage *enb_agent_timeout(void* args){ +Protocol__FlexranMessage *enb_agent_timeout(void* args){ // enb_agent_timer_args_t *timer_args = calloc(1, sizeof(*timer_args)); //memcpy (timer_args, args, sizeof(*timer_args)); diff --git a/openair2/ENB_APP/enb_agent_common.c b/openair2/ENB_APP/enb_agent_common.c index 0f148d82dd..2baecd6041 100644 --- a/openair2/ENB_APP/enb_agent_common.c +++ b/openair2/ENB_APP/enb_agent_common.c @@ -29,7 +29,7 @@ /*! \file enb_agent_common.c * \brief common primitives for all agents - * \author Navid Nikaein and Xenofon Foukas + * \author Xenofon Foukas, Mohamed Kassem and Navid Nikaein * \date 2016 * \version 0.1 */ @@ -55,15 +55,15 @@ void * enb_rrc[NUM_MAX_ENB]; * message primitives */ -int enb_agent_serialize_message(Protocol__ProgranMessage *msg, void **buf, int *size) { +int enb_agent_serialize_message(Protocol__FlexranMessage *msg, void **buf, int *size) { - *size = protocol__progran_message__get_packed_size(msg); + *size = protocol__flexran_message__get_packed_size(msg); *buf = malloc(*size); if (buf == NULL) goto error; - protocol__progran_message__pack(msg, *buf); + protocol__flexran_message__pack(msg, *buf); return 0; @@ -76,8 +76,8 @@ int enb_agent_serialize_message(Protocol__ProgranMessage *msg, void **buf, int * /* We assume that the buffer size is equal to the message size. Should be chekced durint Tx/Rx */ -int enb_agent_deserialize_message(void *data, int size, Protocol__ProgranMessage **msg) { - *msg = protocol__progran_message__unpack(NULL, size, data); +int enb_agent_deserialize_message(void *data, int size, Protocol__FlexranMessage **msg) { + *msg = protocol__flexran_message__unpack(NULL, size, data); if (*msg == NULL) goto error; @@ -90,14 +90,14 @@ int enb_agent_deserialize_message(void *data, int size, Protocol__ProgranMessage -int prp_create_header(xid_t xid, Protocol__PrpType type, Protocol__PrpHeader **header) { +int flex_create_header(xid_t xid, Protocol__FlexType type, Protocol__FlexHeader **header) { - *header = malloc(sizeof(Protocol__PrpHeader)); + *header = malloc(sizeof(Protocol__FlexHeader)); if(*header == NULL) goto error; - protocol__prp_header__init(*header); - (*header)->version = PROGRAN_VERSION; + protocol__flex_header__init(*header); + (*header)->version = FLEXRAN_VERSION; (*header)->has_version = 1; // check if the type is set (*header)->type = type; @@ -112,28 +112,28 @@ int prp_create_header(xid_t xid, Protocol__PrpType type, Protocol__PrpHeader ** } -int enb_agent_hello(mid_t mod_id, const void *params, Protocol__ProgranMessage **msg) { +int enb_agent_hello(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg) { - Protocol__PrpHeader *header; + Protocol__FlexHeader *header; /*TODO: Need to set random xid or xid from received hello message*/ xid_t xid = 1; - if (prp_create_header(xid, PROTOCOL__PRP_TYPE__PRPT_HELLO, &header) != 0) + if (flex_create_header(xid, PROTOCOL__FLEX_TYPE__FLPT_HELLO, &header) != 0) goto error; - Protocol__PrpHello *hello_msg; - hello_msg = malloc(sizeof(Protocol__PrpHello)); + Protocol__FlexHello *hello_msg; + hello_msg = malloc(sizeof(Protocol__FlexHello)); if(hello_msg == NULL) goto error; - protocol__prp_hello__init(hello_msg); + protocol__flex_hello__init(hello_msg); hello_msg->header = header; - *msg = malloc(sizeof(Protocol__ProgranMessage)); + *msg = malloc(sizeof(Protocol__FlexranMessage)); if(*msg == NULL) goto error; - protocol__progran_message__init(*msg); - (*msg)->msg_case = PROTOCOL__PROGRAN_MESSAGE__MSG_HELLO_MSG; - (*msg)->msg_dir = PROTOCOL__PROGRAN_DIRECTION__SUCCESSFUL_OUTCOME; + protocol__flexran_message__init(*msg); + (*msg)->msg_case = PROTOCOL__FLEXRAN_MESSAGE__MSG_HELLO_MSG; + (*msg)->msg_dir = PROTOCOL__FLEXRAN_DIRECTION__SUCCESSFUL_OUTCOME; (*msg)->has_msg_dir = 1; (*msg)->hello_msg = hello_msg; return 0; @@ -150,9 +150,9 @@ int enb_agent_hello(mid_t mod_id, const void *params, Protocol__ProgranMessage * } -int enb_agent_destroy_hello(Protocol__ProgranMessage *msg) { +int enb_agent_destroy_hello(Protocol__FlexranMessage *msg) { - if(msg->msg_case != PROTOCOL__PROGRAN_MESSAGE__MSG_HELLO_MSG) + if(msg->msg_case != PROTOCOL__FLEXRAN_MESSAGE__MSG_HELLO_MSG) goto error; free(msg->hello_msg->header); @@ -166,26 +166,26 @@ int enb_agent_destroy_hello(Protocol__ProgranMessage *msg) { } -int enb_agent_echo_request(mid_t mod_id, const void* params, Protocol__ProgranMessage **msg) { - Protocol__PrpHeader *header; +int enb_agent_echo_request(mid_t mod_id, const void* params, Protocol__FlexranMessage **msg) { + Protocol__FlexHeader *header; /*TODO: Need to set a random xid*/ xid_t xid = 1; - if (prp_create_header(xid, PROTOCOL__PRP_TYPE__PRPT_ECHO_REQUEST, &header) != 0) + if (flex_create_header(xid, PROTOCOL__FLEX_TYPE__FLPT_ECHO_REQUEST, &header) != 0) goto error; - Protocol__PrpEchoRequest *echo_request_msg; - echo_request_msg = malloc(sizeof(Protocol__PrpEchoRequest)); + Protocol__FlexEchoRequest *echo_request_msg; + echo_request_msg = malloc(sizeof(Protocol__FlexEchoRequest)); if(echo_request_msg == NULL) goto error; - protocol__prp_echo_request__init(echo_request_msg); + protocol__flex_echo_request__init(echo_request_msg); echo_request_msg->header = header; - *msg = malloc(sizeof(Protocol__ProgranMessage)); + *msg = malloc(sizeof(Protocol__FlexranMessage)); if(*msg == NULL) goto error; - protocol__progran_message__init(*msg); - (*msg)->msg_case = PROTOCOL__PROGRAN_MESSAGE__MSG_ECHO_REQUEST_MSG; - (*msg)->msg_dir = PROTOCOL__PROGRAN_DIRECTION__INITIATING_MESSAGE; + protocol__flexran_message__init(*msg); + (*msg)->msg_case = PROTOCOL__FLEXRAN_MESSAGE__MSG_ECHO_REQUEST_MSG; + (*msg)->msg_dir = PROTOCOL__FLEXRAN_DIRECTION__INITIATING_MESSAGE; (*msg)->echo_request_msg = echo_request_msg; return 0; @@ -201,8 +201,8 @@ int enb_agent_echo_request(mid_t mod_id, const void* params, Protocol__ProgranMe } -int enb_agent_destroy_echo_request(Protocol__ProgranMessage *msg) { - if(msg->msg_case != PROTOCOL__PROGRAN_MESSAGE__MSG_ECHO_REQUEST_MSG) +int enb_agent_destroy_echo_request(Protocol__FlexranMessage *msg) { + if(msg->msg_case != PROTOCOL__FLEXRAN_MESSAGE__MSG_ECHO_REQUEST_MSG) goto error; free(msg->echo_request_msg->header); @@ -217,30 +217,30 @@ int enb_agent_destroy_echo_request(Protocol__ProgranMessage *msg) { -int enb_agent_echo_reply(mid_t mod_id, const void *params, Protocol__ProgranMessage **msg) { +int enb_agent_echo_reply(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg) { xid_t xid; - Protocol__ProgranMessage *input = (Protocol__ProgranMessage *)params; - Protocol__PrpEchoRequest *echo_req = input->echo_request_msg; + Protocol__FlexranMessage *input = (Protocol__FlexranMessage *)params; + Protocol__FlexEchoRequest *echo_req = input->echo_request_msg; xid = (echo_req->header)->xid; - Protocol__PrpHeader *header; - if (prp_create_header(xid, PROTOCOL__PRP_TYPE__PRPT_ECHO_REPLY, &header) != 0) + Protocol__FlexHeader *header; + if (flex_create_header(xid, PROTOCOL__FLEX_TYPE__FLPT_ECHO_REPLY, &header) != 0) goto error; - Protocol__PrpEchoReply *echo_reply_msg; - echo_reply_msg = malloc(sizeof(Protocol__PrpEchoReply)); + Protocol__FlexEchoReply *echo_reply_msg; + echo_reply_msg = malloc(sizeof(Protocol__FlexEchoReply)); if(echo_reply_msg == NULL) goto error; - protocol__prp_echo_reply__init(echo_reply_msg); + protocol__flex_echo_reply__init(echo_reply_msg); echo_reply_msg->header = header; - *msg = malloc(sizeof(Protocol__ProgranMessage)); + *msg = malloc(sizeof(Protocol__FlexranMessage)); if(*msg == NULL) goto error; - protocol__progran_message__init(*msg); - (*msg)->msg_case = PROTOCOL__PROGRAN_MESSAGE__MSG_ECHO_REPLY_MSG; - (*msg)->msg_dir = PROTOCOL__PROGRAN_DIRECTION__SUCCESSFUL_OUTCOME; + protocol__flexran_message__init(*msg); + (*msg)->msg_case = PROTOCOL__FLEXRAN_MESSAGE__MSG_ECHO_REPLY_MSG; + (*msg)->msg_dir = PROTOCOL__FLEXRAN_DIRECTION__SUCCESSFUL_OUTCOME; (*msg)->has_msg_dir = 1; (*msg)->echo_reply_msg = echo_reply_msg; return 0; @@ -257,8 +257,8 @@ int enb_agent_echo_reply(mid_t mod_id, const void *params, Protocol__ProgranMess } -int enb_agent_destroy_echo_reply(Protocol__ProgranMessage *msg) { - if(msg->msg_case != PROTOCOL__PROGRAN_MESSAGE__MSG_ECHO_REPLY_MSG) +int enb_agent_destroy_echo_reply(Protocol__FlexranMessage *msg) { + if(msg->msg_case != PROTOCOL__FLEXRAN_MESSAGE__MSG_ECHO_REPLY_MSG) goto error; free(msg->echo_reply_msg->header); @@ -272,12 +272,12 @@ int enb_agent_destroy_echo_reply(Protocol__ProgranMessage *msg) { } -int enb_agent_destroy_enb_config_reply(Protocol__ProgranMessage *msg) { - if(msg->msg_case != PROTOCOL__PROGRAN_MESSAGE__MSG_ENB_CONFIG_REPLY_MSG) +int enb_agent_destroy_enb_config_reply(Protocol__FlexranMessage *msg) { + if(msg->msg_case != PROTOCOL__FLEXRAN_MESSAGE__MSG_ENB_CONFIG_REPLY_MSG) goto error; free(msg->enb_config_reply_msg->header); int i, j; - Protocol__PrpEnbConfigReply *reply = msg->enb_config_reply_msg; + Protocol__FlexEnbConfigReply *reply = msg->enb_config_reply_msg; for(i = 0; i < reply->n_cell_config;i++){ free(reply->cell_config[i]->mbsfn_subframe_config_rfoffset); @@ -302,12 +302,12 @@ int enb_agent_destroy_enb_config_reply(Protocol__ProgranMessage *msg) { return -1; } -int enb_agent_destroy_ue_config_reply(Protocol__ProgranMessage *msg) { - if(msg->msg_case != PROTOCOL__PROGRAN_MESSAGE__MSG_UE_CONFIG_REPLY_MSG) +int enb_agent_destroy_ue_config_reply(Protocol__FlexranMessage *msg) { + if(msg->msg_case != PROTOCOL__FLEXRAN_MESSAGE__MSG_UE_CONFIG_REPLY_MSG) goto error; free(msg->ue_config_reply_msg->header); int i, j; - Protocol__PrpUeConfigReply *reply = msg->ue_config_reply_msg; + Protocol__FlexUeConfigReply *reply = msg->ue_config_reply_msg; for(i = 0; i < reply->n_ue_config;i++){ free(reply->ue_config[i]->capabilities); @@ -323,8 +323,8 @@ int enb_agent_destroy_ue_config_reply(Protocol__ProgranMessage *msg) { return -1; } -int enb_agent_destroy_lc_config_reply(Protocol__ProgranMessage *msg) { - if(msg->msg_case != PROTOCOL__PROGRAN_MESSAGE__MSG_LC_CONFIG_REPLY_MSG) +int enb_agent_destroy_lc_config_reply(Protocol__FlexranMessage *msg) { + if(msg->msg_case != PROTOCOL__FLEXRAN_MESSAGE__MSG_LC_CONFIG_REPLY_MSG) goto error; int i, j; @@ -345,8 +345,8 @@ int enb_agent_destroy_lc_config_reply(Protocol__ProgranMessage *msg) { return -1; } -int enb_agent_destroy_ue_state_change(Protocol__ProgranMessage *msg) { - if(msg->msg_case != PROTOCOL__PROGRAN_MESSAGE__MSG_UE_STATE_CHANGE_MSG) +int enb_agent_destroy_ue_state_change(Protocol__FlexranMessage *msg) { + if(msg->msg_case != PROTOCOL__FLEXRAN_MESSAGE__MSG_UE_STATE_CHANGE_MSG) goto error; free(msg->ue_state_change_msg->header); //TODO: Free the contents of the UE config structure @@ -359,8 +359,8 @@ int enb_agent_destroy_ue_state_change(Protocol__ProgranMessage *msg) { return -1; } -int enb_agent_destroy_enb_config_request(Protocol__ProgranMessage *msg) { - if(msg->msg_case != PROTOCOL__PROGRAN_MESSAGE__MSG_ENB_CONFIG_REQUEST_MSG) +int enb_agent_destroy_enb_config_request(Protocol__FlexranMessage *msg) { + if(msg->msg_case != PROTOCOL__FLEXRAN_MESSAGE__MSG_ENB_CONFIG_REQUEST_MSG) goto error; free(msg->enb_config_request_msg->header); free(msg->enb_config_request_msg); @@ -372,12 +372,12 @@ int enb_agent_destroy_enb_config_request(Protocol__ProgranMessage *msg) { return -1; } -int enb_agent_destroy_ue_config_request(Protocol__ProgranMessage *msg) { +int enb_agent_destroy_ue_config_request(Protocol__FlexranMessage *msg) { /* TODO: Deallocate memory for a dynamically allocated UE config message */ return 0; } -int enb_agent_destroy_lc_config_request(Protocol__ProgranMessage *msg) { +int enb_agent_destroy_lc_config_request(Protocol__FlexranMessage *msg) { /* TODO: Deallocate memory for a dynamically allocated LC config message */ return 0; } @@ -397,10 +397,10 @@ long timer_end(struct timespec start_time){ return diffInNanos; } -int enb_agent_control_delegation(mid_t mod_id, const void *params, Protocol__ProgranMessage **msg) { +int enb_agent_control_delegation(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg) { - Protocol__ProgranMessage *input = (Protocol__ProgranMessage *)params; - Protocol__PrpControlDelegation *control_delegation_msg = input->control_delegation_msg; + Protocol__FlexranMessage *input = (Protocol__FlexranMessage *)params; + Protocol__FlexControlDelegation *control_delegation_msg = input->control_delegation_msg; uint32_t delegation_type = control_delegation_msg->delegation_type; @@ -428,13 +428,13 @@ int enb_agent_control_delegation(mid_t mod_id, const void *params, Protocol__Pro return -1; } -int enb_agent_destroy_control_delegation(Protocol__ProgranMessage *msg) { +int enb_agent_destroy_control_delegation(Protocol__FlexranMessage *msg) { /*TODO: Dealocate memory for a dynamically allocated control delegation message*/ } -int enb_agent_reconfiguration(mid_t mod_id, const void *params, Protocol__ProgranMessage **msg) { - Protocol__ProgranMessage *input = (Protocol__ProgranMessage *)params; - Protocol__PrpAgentReconfiguration *agent_reconfiguration_msg = input->agent_reconfiguration_msg; +int enb_agent_reconfiguration(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg) { + Protocol__FlexranMessage *input = (Protocol__FlexranMessage *)params; + Protocol__FlexAgentReconfiguration *agent_reconfiguration_msg = input->agent_reconfiguration_msg; apply_reconfiguration_policy(mod_id, agent_reconfiguration_msg->policy, strlen(agent_reconfiguration_msg->policy)); @@ -442,7 +442,7 @@ int enb_agent_reconfiguration(mid_t mod_id, const void *params, Protocol__Progra return 0; } -int enb_agent_destroy_agent_reconfiguration(Protocol__ProgranMessage *msg) { +int enb_agent_destroy_agent_reconfiguration(Protocol__FlexranMessage *msg) { /*TODO: Dealocate memory for a dynamically allocated agent reconfiguration message*/ } @@ -949,11 +949,11 @@ int get_meas_gap_config(mid_t mod_id, mid_t ue_id) { if(ue_context_p->ue_context.measGapConfig != NULL){ if(ue_context_p->ue_context.measGapConfig->present == MeasGapConfig_PR_setup) { if (ue_context_p->ue_context.measGapConfig->choice.setup.gapOffset.present == MeasGapConfig__setup__gapOffset_PR_gp0) { - return PROTOCOL__PRP_MEAS_GAP_CONFIG_PATTERN__PRMGCP_GP1; + return PROTOCOL__FLEX_MEAS_GAP_CONFIG_PATTERN__FLMGCP_GP1; } else if (ue_context_p->ue_context.measGapConfig->choice.setup.gapOffset.present == MeasGapConfig__setup__gapOffset_PR_gp1) { - return PROTOCOL__PRP_MEAS_GAP_CONFIG_PATTERN__PRMGCP_GP2; + return PROTOCOL__FLEX_MEAS_GAP_CONFIG_PATTERN__FLMGCP_GP2; } else { - return PROTOCOL__PRP_MEAS_GAP_CONFIG_PATTERN__PRMGCP_OFF; + return PROTOCOL__FLEX_MEAS_GAP_CONFIG_PATTERN__FLMGCP_OFF; } } } @@ -1258,38 +1258,38 @@ int get_direction(mid_t ue_id, mid_t lc_id) int enb_agent_ue_state_change(mid_t mod_id, uint32_t rnti, uint8_t state_change) { int size; - Protocol__ProgranMessage *msg; - Protocol__PrpHeader *header; + Protocol__FlexranMessage *msg; + Protocol__FlexHeader *header; void *data; int priority; err_code_t err_code; int xid = 0; - if (prp_create_header(xid, PROTOCOL__PRP_TYPE__PRPT_UE_STATE_CHANGE, &header) != 0) + if (flex_create_header(xid, PROTOCOL__FLEX_TYPE__FLPT_UE_STATE_CHANGE, &header) != 0) goto error; - Protocol__PrpUeStateChange *ue_state_change_msg; - ue_state_change_msg = malloc(sizeof(Protocol__PrpUeStateChange)); + Protocol__FlexUeStateChange *ue_state_change_msg; + ue_state_change_msg = malloc(sizeof(Protocol__FlexUeStateChange)); if(ue_state_change_msg == NULL) { goto error; } - protocol__prp_ue_state_change__init(ue_state_change_msg); + protocol__flex_ue_state_change__init(ue_state_change_msg); ue_state_change_msg->has_type = 1; ue_state_change_msg->type = state_change; - Protocol__PrpUeConfig *config; - config = malloc(sizeof(Protocol__PrpUeConfig)); + Protocol__FlexUeConfig *config; + config = malloc(sizeof(Protocol__FlexUeConfig)); if (config == NULL) { goto error; } - protocol__prp_ue_config__init(config); - if (state_change == PROTOCOL__PRP_UE_STATE_CHANGE_TYPE__PRUESC_DEACTIVATED) { + protocol__flex_ue_config__init(config); + if (state_change == PROTOCOL__FLEX_UE_STATE_CHANGE_TYPE__FLUESC_DEACTIVATED) { // Simply set the rnti of the UE config->has_rnti = 1; config->rnti = rnti; - } else if (state_change == PROTOCOL__PRP_UE_STATE_CHANGE_TYPE__PRUESC_UPDATED - || state_change == PROTOCOL__PRP_UE_STATE_CHANGE_TYPE__PRUESC_ACTIVATED) { + } else if (state_change == PROTOCOL__FLEX_UE_STATE_CHANGE_TYPE__FLUESC_UPDATED + || state_change == PROTOCOL__FLEX_UE_STATE_CHANGE_TYPE__FLUESC_ACTIVATED) { int i =find_UE_id(mod_id,rnti); config->has_rnti = 1; config->rnti = rnti; @@ -1305,7 +1305,7 @@ int enb_agent_ue_state_change(mid_t mod_id, uint32_t rnti, uint8_t state_change) } //TODO: Set the measurement gap offset if applicable if(config->has_meas_gap_config_pattern == 1 && - config->meas_gap_config_pattern != PROTOCOL__PRP_MEAS_GAP_CONFIG_PATTERN__PRMGCP_OFF) { + config->meas_gap_config_pattern != PROTOCOL__FLEX_MEAS_GAP_CONFIG_PATTERN__FLMGCP_OFF) { config->meas_gap_config_sf_offset = get_meas_gap_config_offset(mod_id,i); config->has_meas_gap_config_sf_offset = 1; } @@ -1333,9 +1333,9 @@ int enb_agent_ue_state_change(mid_t mod_id, uint32_t rnti, uint8_t state_change) config->has_ue_aggregated_max_bitrate_dl = 1; //TODO: Set the UE capabilities - Protocol__PrpUeCapabilities *c_capabilities; - c_capabilities = malloc(sizeof(Protocol__PrpUeCapabilities)); - protocol__prp_ue_capabilities__init(c_capabilities); + Protocol__FlexUeCapabilities *c_capabilities; + c_capabilities = malloc(sizeof(Protocol__FlexUeCapabilities)); + protocol__flex_ue_capabilities__init(c_capabilities); //TODO: Set half duplex (FDD operation) c_capabilities->has_half_duplex = 1; c_capabilities->half_duplex = 1;//get_half_duplex(i); @@ -1353,7 +1353,7 @@ int enb_agent_ue_state_change(mid_t mod_id, uint32_t rnti, uint8_t state_change) c_capabilities->res_alloc_type1 = 1;//get_res_alloc_type1(i); //Set the capabilites to the message config->capabilities = c_capabilities; - //TODO: Set UE transmission antenna. One of the PRUTA_* values + //TODO: Set UE transmission antenna. One of the FLUTA_* values if(get_ue_transmission_antenna(mod_id,i) != -1){ config->has_ue_transmission_antenna = 1; config->ue_transmission_antenna = get_ue_transmission_antenna(mod_id,i); @@ -1398,7 +1398,7 @@ int enb_agent_ue_state_change(mid_t mod_id, uint32_t rnti, uint8_t state_change) config->has_aperiodic_cqi_rep_mode = 1; int mode = get_aperiodic_cqi_rep_mode(mod_id,i); if (mode > 4) { - config->aperiodic_cqi_rep_mode = PROTOCOL__PRP_APERIODIC_CQI_REPORT_MODE__PRACRM_NONE; + config->aperiodic_cqi_rep_mode = PROTOCOL__FLEX_APERIODIC_CQI_REPORT_MODE__FLACRM_NONE; } else { config->aperiodic_cqi_rep_mode = mode; } @@ -1435,24 +1435,24 @@ int enb_agent_ue_state_change(mid_t mod_id, uint32_t rnti, uint8_t state_change) config->has_scell_deactivation_timer = 1; config->scell_deactivation_timer = 1; } - } else if (state_change == PROTOCOL__PRP_UE_STATE_CHANGE_TYPE__PRUESC_MOVED) { + } else if (state_change == PROTOCOL__FLEX_UE_STATE_CHANGE_TYPE__FLUESC_MOVED) { // TODO: Not supported for now. Leave blank } ue_state_change_msg->config = config; - msg = malloc(sizeof(Protocol__ProgranMessage)); + msg = malloc(sizeof(Protocol__FlexranMessage)); if (msg == NULL) { goto error; } - protocol__progran_message__init(msg); - msg->msg_case = PROTOCOL__PROGRAN_MESSAGE__MSG_UE_STATE_CHANGE_MSG; - msg->msg_dir = PROTOCOL__PROGRAN_DIRECTION__INITIATING_MESSAGE; + protocol__flexran_message__init(msg); + msg->msg_case = PROTOCOL__FLEXRAN_MESSAGE__MSG_UE_STATE_CHANGE_MSG; + msg->msg_dir = PROTOCOL__FLEXRAN_DIRECTION__INITIATING_MESSAGE; msg->ue_state_change_msg = ue_state_change_msg; data = enb_agent_pack_message(msg, &size); /*Send sr info using the MAC channel of the eNB*/ if (enb_agent_msg_send(mod_id, ENB_AGENT_DEFAULT, data, size, priority)) { - err_code = PROTOCOL__PROGRAN_ERR__MSG_ENQUEUING; + err_code = PROTOCOL__FLEXRAN_ERR__MSG_ENQUEUING; goto error; } @@ -1466,38 +1466,38 @@ int enb_agent_ue_state_change(mid_t mod_id, uint32_t rnti, uint8_t state_change) * timer primitives */ -int enb_agent_lc_config_reply(mid_t mod_id, const void *params, Protocol__ProgranMessage **msg) { +int enb_agent_lc_config_reply(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg) { xid_t xid; - Protocol__ProgranMessage *input = (Protocol__ProgranMessage *)params; - Protocol__PrpLcConfigRequest *lc_config_request_msg = input->lc_config_request_msg; + Protocol__FlexranMessage *input = (Protocol__FlexranMessage *)params; + Protocol__FlexLcConfigRequest *lc_config_request_msg = input->lc_config_request_msg; xid = (lc_config_request_msg->header)->xid; int i, j; - Protocol__PrpHeader *header; - if(prp_create_header(xid, PROTOCOL__PRP_TYPE__PRPT_GET_LC_CONFIG_REPLY, &header) != 0) + Protocol__FlexHeader *header; + if(flex_create_header(xid, PROTOCOL__FLEX_TYPE__FLPT_GET_LC_CONFIG_REPLY, &header) != 0) goto error; - Protocol__PrpLcConfigReply *lc_config_reply_msg; - lc_config_reply_msg = malloc(sizeof(Protocol__PrpLcConfigReply)); + Protocol__FlexLcConfigReply *lc_config_reply_msg; + lc_config_reply_msg = malloc(sizeof(Protocol__FlexLcConfigReply)); if(lc_config_reply_msg == NULL) goto error; - protocol__prp_lc_config_reply__init(lc_config_reply_msg); + protocol__flex_lc_config_reply__init(lc_config_reply_msg); lc_config_reply_msg->header = header; //TODO: Fill in the actual number of UEs that we are going to report LC configs about lc_config_reply_msg->n_lc_ue_config = get_num_ues(mod_id); - Protocol__PrpLcUeConfig **lc_ue_config; + Protocol__FlexLcUeConfig **lc_ue_config; if (lc_config_reply_msg->n_lc_ue_config > 0) { - lc_ue_config = malloc(sizeof(Protocol__PrpLcUeConfig *) * lc_config_reply_msg->n_lc_ue_config); + lc_ue_config = malloc(sizeof(Protocol__FlexLcUeConfig *) * lc_config_reply_msg->n_lc_ue_config); if (lc_ue_config == NULL) { goto error; } // Fill the config for each UE for (i = 0; i < lc_config_reply_msg->n_lc_ue_config; i++) { - lc_ue_config[i] = malloc(sizeof(Protocol__PrpLcUeConfig)); - protocol__prp_lc_ue_config__init(lc_ue_config[i]); + lc_ue_config[i] = malloc(sizeof(Protocol__FlexLcUeConfig)); + protocol__flex_lc_ue_config__init(lc_ue_config[i]); //TODO: Set the RNTI of the UE lc_ue_config[i]->has_rnti = 1; lc_ue_config[i]->rnti = get_ue_crnti(mod_id,i); @@ -1512,15 +1512,15 @@ int enb_agent_lc_config_reply(mid_t mod_id, const void *params, Protocol__Progra } else { lc_ue_config[i]->n_lc_config = 3; } - Protocol__PrpLcConfig **lc_config; + Protocol__FlexLcConfig **lc_config; if (lc_ue_config[i]->n_lc_config > 0) { - lc_config = malloc(sizeof(Protocol__PrpLcConfig *) * lc_ue_config[i]->n_lc_config); + lc_config = malloc(sizeof(Protocol__FlexLcConfig *) * lc_ue_config[i]->n_lc_config); if (lc_config == NULL) { goto error; } for (j = 0; j < lc_ue_config[i]->n_lc_config; j++) { - lc_config[j] = malloc(sizeof(Protocol__PrpLcConfig)); - protocol__prp_lc_config__init(lc_config[j]); + lc_config[j] = malloc(sizeof(Protocol__FlexLcConfig)); + protocol__flex_lc_config__init(lc_config[j]); //TODO: Set the LC id lc_config[j]->has_lcid = 1; lc_config[j]->lcid = j+1; @@ -1533,14 +1533,14 @@ int enb_agent_lc_config_reply(mid_t mod_id, const void *params, Protocol__Progra //TODO: Set the LC direction lc_config[j]->has_direction = 1; lc_config[j]->direction = get_direction(i,j+1); - //TODO: Bearer type. One of PRQBT_* values + //TODO: Bearer type. One of FLQBT_* values lc_config[j]->has_qos_bearer_type = 1; - lc_config[j]->qos_bearer_type = PROTOCOL__PRP_QOS_BEARER_TYPE__PRQBT_NON_GBR; + lc_config[j]->qos_bearer_type = PROTOCOL__FLEX_QOS_BEARER_TYPE__FLQBT_NON_GBR; //TODO: Set the QCI defined in TS 23.203, coded as defined in TS 36.413 // One less than the actual QCI value lc_config[j]->has_qci = 1; lc_config[j]->qci = 1; - if (lc_config[j]->direction == PROTOCOL__PRP_QOS_BEARER_TYPE__PRQBT_GBR) { + if (lc_config[j]->direction == PROTOCOL__FLEX_QOS_BEARER_TYPE__FLQBT_GBR) { //TODO: Set the max bitrate (UL) lc_config[j]->has_e_rab_max_bitrate_ul = 1; lc_config[j]->e_rab_max_bitrate_ul = 1; @@ -1560,12 +1560,12 @@ int enb_agent_lc_config_reply(mid_t mod_id, const void *params, Protocol__Progra } // end for UE lc_config_reply_msg->lc_ue_config = lc_ue_config; } // lc_config_reply_msg->n_lc_ue_config > 0 - *msg = malloc(sizeof(Protocol__ProgranMessage)); + *msg = malloc(sizeof(Protocol__FlexranMessage)); if (*msg == NULL) goto error; - protocol__progran_message__init(*msg); - (*msg)->msg_case = PROTOCOL__PROGRAN_MESSAGE__MSG_LC_CONFIG_REPLY_MSG; - (*msg)->msg_dir = PROTOCOL__PROGRAN_DIRECTION__SUCCESSFUL_OUTCOME; + protocol__flexran_message__init(*msg); + (*msg)->msg_case = PROTOCOL__FLEXRAN_MESSAGE__MSG_LC_CONFIG_REPLY_MSG; + (*msg)->msg_dir = PROTOCOL__FLEXRAN_DIRECTION__SUCCESSFUL_OUTCOME; (*msg)->lc_config_reply_msg = lc_config_reply_msg; return 0; @@ -1588,38 +1588,38 @@ int enb_agent_lc_config_reply(mid_t mod_id, const void *params, Protocol__Progra * ************************************ */ -int enb_agent_ue_config_reply(mid_t mod_id, const void *params, Protocol__ProgranMessage **msg) { +int enb_agent_ue_config_reply(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg) { xid_t xid; - Protocol__ProgranMessage *input = (Protocol__ProgranMessage *)params; - Protocol__PrpUeConfigRequest *ue_config_request_msg = input->ue_config_request_msg; + Protocol__FlexranMessage *input = (Protocol__FlexranMessage *)params; + Protocol__FlexUeConfigRequest *ue_config_request_msg = input->ue_config_request_msg; xid = (ue_config_request_msg->header)->xid; int i; - Protocol__PrpHeader *header; - if(prp_create_header(xid, PROTOCOL__PRP_TYPE__PRPT_GET_UE_CONFIG_REPLY, &header) != 0) + Protocol__FlexHeader *header; + if(flex_create_header(xid, PROTOCOL__FLEX_TYPE__FLPT_GET_UE_CONFIG_REPLY, &header) != 0) goto error; - Protocol__PrpUeConfigReply *ue_config_reply_msg; - ue_config_reply_msg = malloc(sizeof(Protocol__PrpUeConfigReply)); + Protocol__FlexUeConfigReply *ue_config_reply_msg; + ue_config_reply_msg = malloc(sizeof(Protocol__FlexUeConfigReply)); if(ue_config_reply_msg == NULL) goto error; - protocol__prp_ue_config_reply__init(ue_config_reply_msg); + protocol__flex_ue_config_reply__init(ue_config_reply_msg); ue_config_reply_msg->header = header; //TODO: Fill in the actual number of UEs that are currently connected ue_config_reply_msg->n_ue_config = get_num_ues(mod_id); - Protocol__PrpUeConfig **ue_config; + Protocol__FlexUeConfig **ue_config; if (ue_config_reply_msg->n_ue_config > 0) { - ue_config = malloc(sizeof(Protocol__PrpUeConfig *) * ue_config_reply_msg->n_ue_config); + ue_config = malloc(sizeof(Protocol__FlexUeConfig *) * ue_config_reply_msg->n_ue_config); if (ue_config == NULL) { goto error; } for (i = 0; i < ue_config_reply_msg->n_ue_config; i++) { - ue_config[i] = malloc(sizeof(Protocol__PrpUeConfig)); - protocol__prp_ue_config__init(ue_config[i]); + ue_config[i] = malloc(sizeof(Protocol__FlexUeConfig)); + protocol__flex_ue_config__init(ue_config[i]); //TODO: Set the RNTI of the ue with id i ue_config[i]->rnti = get_ue_crnti(mod_id,i); ue_config[i]->has_rnti = 1; @@ -1638,7 +1638,7 @@ int enb_agent_ue_config_reply(mid_t mod_id, const void *params, Protocol__Progra } //TODO: Set the measurement gap offset if applicable if(ue_config[i]->has_meas_gap_config_pattern == 1 && - ue_config[i]->meas_gap_config_pattern != PROTOCOL__PRP_MEAS_GAP_CONFIG_PATTERN__PRMGCP_OFF) { + ue_config[i]->meas_gap_config_pattern != PROTOCOL__FLEX_MEAS_GAP_CONFIG_PATTERN__FLMGCP_OFF) { ue_config[i]->meas_gap_config_sf_offset = get_meas_gap_config_offset(mod_id,i); ue_config[i]->has_meas_gap_config_sf_offset = 1; } @@ -1666,9 +1666,9 @@ int enb_agent_ue_config_reply(mid_t mod_id, const void *params, Protocol__Progra ue_config[i]->has_ue_aggregated_max_bitrate_dl = 1; //TODO: Set the UE capabilities - Protocol__PrpUeCapabilities *capabilities; - capabilities = malloc(sizeof(Protocol__PrpUeCapabilities)); - protocol__prp_ue_capabilities__init(capabilities); + Protocol__FlexUeCapabilities *capabilities; + capabilities = malloc(sizeof(Protocol__FlexUeCapabilities)); + protocol__flex_ue_capabilities__init(capabilities); //TODO: Set half duplex (FDD operation) capabilities->has_half_duplex = 1; capabilities->half_duplex = 1;//get_half_duplex(i); @@ -1686,7 +1686,7 @@ int enb_agent_ue_config_reply(mid_t mod_id, const void *params, Protocol__Progra capabilities->res_alloc_type1 = 1;//get_res_alloc_type1(i); //Set the capabilites to the message ue_config[i]->capabilities = capabilities; - //TODO: Set UE transmission antenna. One of the PRUTA_* values + //TODO: Set UE transmission antenna. One of the FLUTA_* values if(get_ue_transmission_antenna(mod_id,i) != -1){ ue_config[i]->has_ue_transmission_antenna = 1; ue_config[i]->ue_transmission_antenna = get_ue_transmission_antenna(mod_id,i); @@ -1726,12 +1726,12 @@ int enb_agent_ue_config_reply(mid_t mod_id, const void *params, Protocol__Progra ue_config[i]->has_simultaneous_ack_nack_cqi = 1; ue_config[i]->simultaneous_ack_nack_cqi = get_simultaneous_ack_nack_cqi(mod_id,i); } - //TODO: Set PRACRM_* value regarding aperiodic cqi report mode + //TODO: Set FLACRM_* value regarding aperiodic cqi report mode if(get_aperiodic_cqi_rep_mode(mod_id,i) != -1){ ue_config[i]->has_aperiodic_cqi_rep_mode = 1; int mode = get_aperiodic_cqi_rep_mode(mod_id,i); if (mode > 4) { - ue_config[i]->aperiodic_cqi_rep_mode = PROTOCOL__PRP_APERIODIC_CQI_REPORT_MODE__PRACRM_NONE; + ue_config[i]->aperiodic_cqi_rep_mode = PROTOCOL__FLEX_APERIODIC_CQI_REPORT_MODE__FLACRM_NONE; } else { ue_config[i]->aperiodic_cqi_rep_mode = mode; } @@ -1770,12 +1770,12 @@ int enb_agent_ue_config_reply(mid_t mod_id, const void *params, Protocol__Progra } ue_config_reply_msg->ue_config = ue_config; } - *msg = malloc(sizeof(Protocol__ProgranMessage)); + *msg = malloc(sizeof(Protocol__FlexranMessage)); if (*msg == NULL) goto error; - protocol__progran_message__init(*msg); - (*msg)->msg_case = PROTOCOL__PROGRAN_MESSAGE__MSG_UE_CONFIG_REPLY_MSG; - (*msg)->msg_dir = PROTOCOL__PROGRAN_DIRECTION__SUCCESSFUL_OUTCOME; + protocol__flexran_message__init(*msg); + (*msg)->msg_case = PROTOCOL__FLEXRAN_MESSAGE__MSG_UE_CONFIG_REPLY_MSG; + (*msg)->msg_dir = PROTOCOL__FLEXRAN_DIRECTION__SUCCESSFUL_OUTCOME; (*msg)->ue_config_reply_msg = ue_config_reply_msg; return 0; @@ -1798,29 +1798,29 @@ int enb_agent_ue_config_reply(mid_t mod_id, const void *params, Protocol__Progra * ************************************ */ -int enb_agent_enb_config_request(mid_t mod_id, const void* params, Protocol__ProgranMessage **msg) { +int enb_agent_enb_config_request(mid_t mod_id, const void* params, Protocol__FlexranMessage **msg) { - Protocol__PrpHeader *header; + Protocol__FlexHeader *header; xid_t xid = 1; - if(prp_create_header(xid,PROTOCOL__PRP_TYPE__PRPT_GET_ENB_CONFIG_REQUEST, &header) != 0) + if(flex_create_header(xid,PROTOCOL__FLEX_TYPE__FLPT_GET_ENB_CONFIG_REQUEST, &header) != 0) goto error; - Protocol__PrpEnbConfigRequest *enb_config_request_msg; - enb_config_request_msg = malloc(sizeof(Protocol__PrpEnbConfigRequest)); + Protocol__FlexEnbConfigRequest *enb_config_request_msg; + enb_config_request_msg = malloc(sizeof(Protocol__FlexEnbConfigRequest)); if(enb_config_request_msg == NULL) goto error; - protocol__prp_enb_config_request__init(enb_config_request_msg); + protocol__flex_enb_config_request__init(enb_config_request_msg); enb_config_request_msg->header = header; - *msg = malloc(sizeof(Protocol__ProgranMessage)); + *msg = malloc(sizeof(Protocol__FlexranMessage)); if(*msg == NULL) goto error; - protocol__progran_message__init(*msg); - (*msg)->msg_case = PROTOCOL__PROGRAN_MESSAGE__MSG_ENB_CONFIG_REQUEST_MSG; - (*msg)->msg_dir = PROTOCOL__PROGRAN_DIRECTION__INITIATING_MESSAGE; + protocol__flexran_message__init(*msg); + (*msg)->msg_case = PROTOCOL__FLEXRAN_MESSAGE__MSG_ENB_CONFIG_REQUEST_MSG; + (*msg)->msg_dir = PROTOCOL__FLEXRAN_DIRECTION__INITIATING_MESSAGE; (*msg)->enb_config_request_msg = enb_config_request_msg; return 0; @@ -1836,26 +1836,26 @@ int enb_agent_enb_config_request(mid_t mod_id, const void* params, Protocol__Pro return -1; } -int enb_agent_enb_config_reply(mid_t mod_id, const void *params, Protocol__ProgranMessage **msg) { +int enb_agent_enb_config_reply(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg) { xid_t xid; - Protocol__ProgranMessage *input = (Protocol__ProgranMessage *)params; - Protocol__PrpEnbConfigRequest *enb_config_req_msg = input->enb_config_request_msg; + Protocol__FlexranMessage *input = (Protocol__FlexranMessage *)params; + Protocol__FlexEnbConfigRequest *enb_config_req_msg = input->enb_config_request_msg; xid = (enb_config_req_msg->header)->xid; int i, j, k; int cc_id = 0; int enb_id = mod_id; - Protocol__PrpHeader *header; - if(prp_create_header(xid, PROTOCOL__PRP_TYPE__PRPT_GET_ENB_CONFIG_REPLY, &header) != 0) + Protocol__FlexHeader *header; + if(flex_create_header(xid, PROTOCOL__FLEX_TYPE__FLPT_GET_ENB_CONFIG_REPLY, &header) != 0) goto error; - Protocol__PrpEnbConfigReply *enb_config_reply_msg; - enb_config_reply_msg = malloc(sizeof(Protocol__PrpEnbConfigReply)); + Protocol__FlexEnbConfigReply *enb_config_reply_msg; + enb_config_reply_msg = malloc(sizeof(Protocol__FlexEnbConfigReply)); if(enb_config_reply_msg == NULL) goto error; - protocol__prp_enb_config_reply__init(enb_config_reply_msg); + protocol__flex_enb_config_reply__init(enb_config_reply_msg); enb_config_reply_msg->header = header; enb_config_reply_msg->enb_id = mod_id; @@ -1863,14 +1863,14 @@ int enb_agent_enb_config_reply(mid_t mod_id, const void *params, Protocol__Progr enb_config_reply_msg->n_cell_config = MAX_NUM_CCs; - Protocol__PrpCellConfig **cell_conf; + Protocol__FlexCellConfig **cell_conf; if(enb_config_reply_msg->n_cell_config > 0){ - cell_conf = malloc(sizeof(Protocol__PrpCellConfig *) * enb_config_reply_msg->n_cell_config); + cell_conf = malloc(sizeof(Protocol__FlexCellConfig *) * enb_config_reply_msg->n_cell_config); if(cell_conf == NULL) goto error; for(i = 0; i < enb_config_reply_msg->n_cell_config; i++){ - cell_conf[i] = malloc(sizeof(Protocol__PrpCellConfig)); - protocol__prp_cell_config__init(cell_conf[i]); + cell_conf[i] = malloc(sizeof(Protocol__FlexCellConfig)); + protocol__flex_cell_config__init(cell_conf[i]); //TODO: Fill in with actual value, the PCI of this cell cell_conf[i]->phy_cell_id = 1; cell_conf[i]->has_phy_cell_id = get_cell_id(enb_id,i); @@ -1882,41 +1882,41 @@ int enb_agent_enb_config_reply(mid_t mod_id, const void *params, Protocol__Progr cell_conf[i]->has_pusch_hopping_offset = 1; //TODO: Fill in with actual value if(get_hopping_mode(enb_id,i) == 0){ - cell_conf[i]->hopping_mode = PROTOCOL__PRP_HOPPING_MODE__PRHM_INTER; + cell_conf[i]->hopping_mode = PROTOCOL__FLEX_HOPPING_MODE__FLHM_INTER; }else if(get_hopping_mode(enb_id,i) == 1){ - cell_conf[i]->hopping_mode = PROTOCOL__PRP_HOPPING_MODE__PRHM_INTERINTRA; + cell_conf[i]->hopping_mode = PROTOCOL__FLEX_HOPPING_MODE__FLHM_INTERINTRA; } cell_conf[i]->has_hopping_mode = 1; //TODO: Fill in with actual value, the number of subbands cell_conf[i]->n_sb = get_n_SB(enb_id,i); cell_conf[i]->has_n_sb = 1; - //TODO: Fill in with actual value, The number of resource element groups used for PHICH. One of PRPR_ + //TODO: Fill in with actual value, The number of resource element groups used for PHICH. One of FLPR_ if(get_phich_resource(enb_id,i) == 0){ - cell_conf[i]->phich_resource = PROTOCOL__PRP_PHICH_RESOURCE__PRPR_ONE_SIXTH; //0 + cell_conf[i]->phich_resource = PROTOCOL__FLEX_PHICH_RESOURCE__FLPR_ONE_SIXTH; //0 }else if (get_phich_resource(enb_id,i) == 1){ - cell_conf[i]->phich_resource = PROTOCOL__PRP_PHICH_RESOURCE__PRPR_HALF; //1 + cell_conf[i]->phich_resource = PROTOCOL__FLEX_PHICH_RESOURCE__FLPR_HALF; //1 }else if (get_phich_resource(enb_id,i) == 2){ - cell_conf[i]->phich_resource = PROTOCOL__PRP_PHICH_RESOURCE__PRPR_ONE; // 2 + cell_conf[i]->phich_resource = PROTOCOL__FLEX_PHICH_RESOURCE__FLPR_ONE; // 2 }else if (get_phich_resource(enb_id,i) == 3){ - cell_conf[i]->phich_resource = PROTOCOL__PRP_PHICH_RESOURCE__PRPR_TWO;//3 + cell_conf[i]->phich_resource = PROTOCOL__FLEX_PHICH_RESOURCE__FLPR_TWO;//3 } cell_conf[i]->has_phich_resource = 1; - //TODO: Fill in with actual value, one of the PRPD_ values + //TODO: Fill in with actual value, one of the FLPD_ values if(get_phich_duration(enb_id,i) == 0){ - cell_conf[i]->phich_duration = PROTOCOL__PRP_PHICH_DURATION__PRPD_NORMAL; + cell_conf[i]->phich_duration = PROTOCOL__FLEX_PHICH_DURATION__FLPD_NORMAL; }else if(get_phich_duration(enb_id,i) == 1){ - cell_conf[i]->phich_duration = PROTOCOL__PRP_PHICH_DURATION__PRPD_EXTENDED; + cell_conf[i]->phich_duration = PROTOCOL__FLEX_PHICH_DURATION__FLPD_EXTENDED; } cell_conf[i]->has_phich_duration = 1; //TODO: Fill in with actual value, See TS 36.211, section 6.9 cell_conf[i]->init_nr_pdcch_ofdm_sym = get_num_pdcch_symb(enb_id,i); cell_conf[i]->has_init_nr_pdcch_ofdm_sym = 1; //TODO: Fill in with actual value - /* Protocol__PrpSiConfig *si_config; */ - /* si_config = malloc(sizeof(Protocol__PrpSiConfig)); */ + /* Protocol__FlexSiConfig *si_config; */ + /* si_config = malloc(sizeof(Protocol__FlexSiConfig)); */ /* if(si_config == NULL) */ /* goto error; */ - /* protocol__prp_si_config__init(si_config); */ + /* protocol__flex_si_config__init(si_config); */ /* //TODO: Fill in with actual value, Frame number to apply the SI configuration */ /* si_config->sfn = 1; */ /* si_config->has_sfn = 1; */ @@ -1928,15 +1928,15 @@ int enb_agent_enb_config_reply(mid_t mod_id, const void *params, Protocol__Progr /* si_config->has_si_window_length = 1; */ /* //TODO: Fill in with actual value, the number of SI messages */ /* si_config->n_si_message=1; */ - /* Protocol__PrpSiMessage **si_message; */ - /* si_message = malloc(sizeof(Protocol__PrpSiMessage *) * si_config->n_si_message); */ + /* Protocol__FlexSiMessage **si_message; */ + /* si_message = malloc(sizeof(Protocol__FlexSiMessage *) * si_config->n_si_message); */ /* if(si_message == NULL) */ /* goto error; */ /* for(j = 0; j < si_config->n_si_message; j++){ */ - /* si_message[j] = malloc(sizeof(Protocol__PrpSiMessage)); */ + /* si_message[j] = malloc(sizeof(Protocol__FlexSiMessage)); */ /* if(si_message[j] == NULL) */ /* goto error; */ - /* protocol__prp_si_message__init(si_message[j]); */ + /* protocol__flex_si_message__init(si_message[j]); */ /* //TODO: Fill in with actual value, Periodicity of SI msg in radio frames */ /* si_message[j]->periodicity = 1; //SIPeriod */ /* si_message[j]->has_periodicity = 1; */ @@ -1955,29 +1955,29 @@ int enb_agent_enb_config_reply(mid_t mod_id, const void *params, Protocol__Progr //TODO: Fill in with actual value, the UL transmission bandwidth in RBs cell_conf[i]->ul_bandwidth = get_N_RB_UL(enb_id,i); cell_conf[i]->has_ul_bandwidth = 1; - //TODO: Fill in with actual value, one of PRUCPL values + //TODO: Fill in with actual value, one of FLUCPL values if(get_ul_cyclic_prefix_length(enb_id,i) == 0){ - cell_conf[i]->ul_cyclic_prefix_length = PROTOCOL__PRP_UL_CYCLIC_PREFIX_LENGTH__PRUCPL_NORMAL; + cell_conf[i]->ul_cyclic_prefix_length = PROTOCOL__FLEX_UL_CYCLIC_PREFIX_LENGTH__FLUCPL_NORMAL; }else if(get_ul_cyclic_prefix_length(enb_id,i) == 1){ - cell_conf[i]->ul_cyclic_prefix_length = PROTOCOL__PRP_UL_CYCLIC_PREFIX_LENGTH__PRUCPL_EXTENDED; + cell_conf[i]->ul_cyclic_prefix_length = PROTOCOL__FLEX_UL_CYCLIC_PREFIX_LENGTH__FLUCPL_EXTENDED; } cell_conf[i]->has_ul_cyclic_prefix_length = 1; - //TODO: Fill in with actual value, one of PRUCPL values + //TODO: Fill in with actual value, one of FLUCPL values if(get_ul_cyclic_prefix_length(enb_id,i) == 0){ - cell_conf[i]->ul_cyclic_prefix_length = PROTOCOL__PRP_DL_CYCLIC_PREFIX_LENGTH__PRDCPL_NORMAL; + cell_conf[i]->ul_cyclic_prefix_length = PROTOCOL__FLEX_DL_CYCLIC_PREFIX_LENGTH__FLDCPL_NORMAL; }else if(get_ul_cyclic_prefix_length(enb_id,i) == 1){ - cell_conf[i]->ul_cyclic_prefix_length = PROTOCOL__PRP_DL_CYCLIC_PREFIX_LENGTH__PRDCPL_EXTENDED; + cell_conf[i]->ul_cyclic_prefix_length = PROTOCOL__FLEX_DL_CYCLIC_PREFIX_LENGTH__FLDCPL_EXTENDED; } cell_conf[i]->has_dl_cyclic_prefix_length = 1; //TODO: Fill in with actual value, number of cell specific antenna ports cell_conf[i]->antenna_ports_count = 1; cell_conf[i]->has_antenna_ports_count = 1; - //TODO: Fill in with actual value, one of PRDM values + //TODO: Fill in with actual value, one of FLDM values if(get_duplex_mode(enb_id,i) == 1){ - cell_conf[i]->duplex_mode = PROTOCOL__PRP_DUPLEX_MODE__PRDM_FDD; + cell_conf[i]->duplex_mode = PROTOCOL__FLEX_DUPLEX_MODE__FLDM_FDD; }else if(get_duplex_mode(enb_id,i) == 0){ - cell_conf[i]->duplex_mode = PROTOCOL__PRP_DUPLEX_MODE__PRDM_TDD; + cell_conf[i]->duplex_mode = PROTOCOL__FLEX_DUPLEX_MODE__FLDM_TDD; } cell_conf[i]->has_duplex_mode = 1; //TODO: Fill in with actual value, DL/UL subframe assignment. TDD only @@ -2052,11 +2052,11 @@ int enb_agent_enb_config_reply(mid_t mod_id, const void *params, Protocol__Progr //TODO: Fill in with actual value, Boolean value. See TS 36.211, section 5.5.3.2. TDD only cell_conf[i]->srs_mac_up_pts = get_srs_MaxUpPts(enb_id,i); cell_conf[i]->has_srs_mac_up_pts = 1; - //TODO: Fill in with actual value, One of the PREQ_ values + //TODO: Fill in with actual value, One of the FLEQ_ values if(get_enable64QAM(enb_id,i) == 0){ - cell_conf[i]->enable_64qam = PROTOCOL__PRP_QAM__PREQ_MOD_16QAM; + cell_conf[i]->enable_64qam = PROTOCOL__FLEX_QAM__FLEQ_MOD_16QAM; }else if(get_enable64QAM(enb_id,i) == 1){ - cell_conf[i]->enable_64qam = PROTOCOL__PRP_QAM__PREQ_MOD_64QAM; + cell_conf[i]->enable_64qam = PROTOCOL__FLEX_QAM__FLEQ_MOD_64QAM; } cell_conf[i]->has_enable_64qam = 1; //TODO: Fill in with actual value, Carrier component index @@ -2065,12 +2065,12 @@ int enb_agent_enb_config_reply(mid_t mod_id, const void *params, Protocol__Progr } enb_config_reply_msg->cell_config=cell_conf; } - *msg = malloc(sizeof(Protocol__ProgranMessage)); + *msg = malloc(sizeof(Protocol__FlexranMessage)); if(*msg == NULL) goto error; - protocol__progran_message__init(*msg); - (*msg)->msg_case = PROTOCOL__PROGRAN_MESSAGE__MSG_ENB_CONFIG_REPLY_MSG; - (*msg)->msg_dir = PROTOCOL__PROGRAN_DIRECTION__SUCCESSFUL_OUTCOME; + protocol__flexran_message__init(*msg); + (*msg)->msg_case = PROTOCOL__FLEXRAN_MESSAGE__MSG_ENB_CONFIG_REPLY_MSG; + (*msg)->msg_dir = PROTOCOL__FLEXRAN_DIRECTION__SUCCESSFUL_OUTCOME; (*msg)->enb_config_reply_msg = enb_config_reply_msg; return 0; @@ -2104,7 +2104,7 @@ err_code_t enb_agent_init_timer(void){ memset(&e, 0, sizeof(enb_agent_timer_element_t)); RB_INSERT(enb_agent_map, &agent_map, &e); */ - return PROTOCOL__PROGRAN_ERR__NO_ERR; + return PROTOCOL__FLEXRAN_ERR__NO_ERR; } RB_GENERATE(enb_agent_map,enb_agent_timer_element_s, entry, enb_agent_compare_timer); @@ -2190,7 +2190,7 @@ err_code_t enb_agent_destroy_timer(long timer_id){ if (e != NULL ) { RB_REMOVE(enb_agent_map, &timer_instance.enb_agent_head, e); - enb_agent_destroy_progran_message(e->timer_args->msg); + enb_agent_destroy_flexran_message(e->timer_args->msg); free(e); } @@ -2211,7 +2211,7 @@ err_code_t enb_agent_destroy_timer_by_task_id(xid_t xid) { if (e->xid == xid) { timer_id = e->timer_id; RB_REMOVE(enb_agent_map, &timer_instance.enb_agent_head, e); - enb_agent_destroy_progran_message(e->timer_args->msg); + enb_agent_destroy_flexran_message(e->timer_args->msg); free(e); if (timer_remove(timer_id) < 0 ) { goto error; @@ -2232,7 +2232,7 @@ err_code_t enb_agent_destroy_timers(void){ RB_FOREACH(e, enb_agent_map, &timer_instance.enb_agent_head) { RB_REMOVE(enb_agent_map, &timer_instance.enb_agent_head, e); timer_remove(e->timer_id); - enb_agent_destroy_progran_message(e->timer_args->msg); + enb_agent_destroy_flexran_message(e->timer_args->msg); free(e); } @@ -2310,7 +2310,7 @@ err_code_t enb_agent_restart_timer(uint32_t *timer_id){ } if (ret < 0 ) { - return PROTOCOL__PROGRAN_ERR__TIMER_SETUP_FAILED; + return PROTOCOL__FLEXRAN_ERR__TIMER_SETUP_FAILED; } return 0; diff --git a/openair2/ENB_APP/enb_agent_common.h b/openair2/ENB_APP/enb_agent_common.h index 18c9129989..b5a35ec338 100644 --- a/openair2/ENB_APP/enb_agent_common.h +++ b/openair2/ENB_APP/enb_agent_common.h @@ -29,7 +29,7 @@ /*! \file enb_agent_common.h * \brief common message primitves and utilities - * \author Navid Nikaein and Xenofon Foukas + * \author Xenofon Foukas, Mohamed Kassem and Navid Nikaein * \date 2016 * \version 0.1 */ @@ -42,7 +42,7 @@ #include #include "header.pb-c.h" -#include "progran.pb-c.h" +#include "flexran.pb-c.h" #include "stats_messages.pb-c.h" #include "stats_common.pb-c.h" @@ -56,72 +56,72 @@ # include "intertask_interface.h" # include "timer.h" -#define PROGRAN_VERSION 0 +#define FLEXRAN_VERSION 0 typedef int (*enb_agent_message_decoded_callback)( mid_t mod_id, const void *params, - Protocol__ProgranMessage **msg + Protocol__FlexranMessage **msg ); typedef int (*enb_agent_message_destruction_callback)( - Protocol__ProgranMessage *msg + Protocol__FlexranMessage *msg ); /********************************** - * progRAN protocol messages helper + * FlexRAN protocol messages helper * functions and generic handlers **********************************/ -int enb_agent_serialize_message(Protocol__ProgranMessage *msg, void **buf, int *size); -int enb_agent_deserialize_message(void *data, int size, Protocol__ProgranMessage **msg); +int enb_agent_serialize_message(Protocol__FlexranMessage *msg, void **buf, int *size); +int enb_agent_deserialize_message(void *data, int size, Protocol__FlexranMessage **msg); -void * enb_agent_pack_message(Protocol__ProgranMessage *msg, +void * enb_agent_pack_message(Protocol__FlexranMessage *msg, uint32_t * size); -err_code_t enb_agent_destroy_progran_message(Protocol__ProgranMessage *msg); +err_code_t enb_agent_destroy_flexran_message(Protocol__FlexranMessage *msg); -int prp_create_header(xid_t xid, Protocol__PrpType type, Protocol__PrpHeader **header); +int flex_create_header(xid_t xid, Protocol__FlexType type, Protocol__FlexHeader **header); -int enb_agent_hello(mid_t mod_id, const void *params, Protocol__ProgranMessage **msg); -int enb_agent_destroy_hello(Protocol__ProgranMessage *msg); +int enb_agent_hello(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg); +int enb_agent_destroy_hello(Protocol__FlexranMessage *msg); -int enb_agent_echo_request(mid_t mod_id, const void *params, Protocol__ProgranMessage **msg); -int enb_agent_destroy_echo_request(Protocol__ProgranMessage *msg); +int enb_agent_echo_request(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg); +int enb_agent_destroy_echo_request(Protocol__FlexranMessage *msg); -int enb_agent_echo_reply(mid_t mod_id, const void *params, Protocol__ProgranMessage **msg); -int enb_agent_destroy_echo_reply(Protocol__ProgranMessage *msg); +int enb_agent_echo_reply(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg); +int enb_agent_destroy_echo_reply(Protocol__FlexranMessage *msg); -int enb_agent_enb_config_reply(mid_t mod_id, const void *params, Protocol__ProgranMessage **msg); -int enb_agent_destroy_enb_config_reply(Protocol__ProgranMessage *msg); +int enb_agent_enb_config_reply(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg); +int enb_agent_destroy_enb_config_reply(Protocol__FlexranMessage *msg); -int enb_agent_ue_config_reply(mid_t mod_id, const void *params, Protocol__ProgranMessage **msg); -int enb_agent_destroy_ue_config_reply(Protocol__ProgranMessage *msg); +int enb_agent_ue_config_reply(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg); +int enb_agent_destroy_ue_config_reply(Protocol__FlexranMessage *msg); -int enb_agent_lc_config_reply(mid_t mod_id, const void *params, Protocol__ProgranMessage **msg); -int enb_agent_destroy_lc_config_reply(Protocol__ProgranMessage *msg); +int enb_agent_lc_config_reply(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg); +int enb_agent_destroy_lc_config_reply(Protocol__FlexranMessage *msg); -int enb_agent_enb_config_request(mid_t mod_id, const void* params, Protocol__ProgranMessage **msg); -int enb_agent_destroy_enb_config_request(Protocol__ProgranMessage *msg); +int enb_agent_enb_config_request(mid_t mod_id, const void* params, Protocol__FlexranMessage **msg); +int enb_agent_destroy_enb_config_request(Protocol__FlexranMessage *msg); -int enb_agent_destroy_ue_config_request(Protocol__ProgranMessage *msg); +int enb_agent_destroy_ue_config_request(Protocol__FlexranMessage *msg); -int enb_agent_destroy_lc_config_request(Protocol__ProgranMessage *msg); +int enb_agent_destroy_lc_config_request(Protocol__FlexranMessage *msg); int enb_agent_ue_state_change(mid_t mod_id, uint32_t rnti, uint8_t state_change); -int enb_agent_destroy_ue_state_change(Protocol__ProgranMessage *msg); +int enb_agent_destroy_ue_state_change(Protocol__FlexranMessage *msg); -int enb_agent_control_delegation(mid_t mod_id, const void *params, Protocol__ProgranMessage **msg); -int enb_agent_destroy_control_delegation(Protocol__ProgranMessage *msg); +int enb_agent_control_delegation(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg); +int enb_agent_destroy_control_delegation(Protocol__FlexranMessage *msg); -int enb_agent_reconfiguration(mid_t mod_id, const void *params, Protocol__ProgranMessage **msg); -int enb_agent_destroy_agent_reconfiguration(Protocol__ProgranMessage *msg); +int enb_agent_reconfiguration(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg); +int enb_agent_destroy_agent_reconfiguration(Protocol__FlexranMessage *msg); -Protocol__ProgranMessage* enb_agent_handle_message (mid_t mod_id, +Protocol__FlexranMessage* enb_agent_handle_message (mid_t mod_id, uint8_t *data, uint32_t size); -Protocol__ProgranMessage *enb_agent_handle_timed_task(void *args); +Protocol__FlexranMessage *enb_agent_handle_timed_task(void *args); @@ -145,7 +145,7 @@ unsigned int get_current_system_frame_num(mid_t mod_id); unsigned int get_current_subframe(mid_t mod_id); /*Return the frame and subframe number in compact 16-bit format. - Bits 0-3 subframe, rest for frame. Required by progRAN protocol*/ + Bits 0-3 subframe, rest for frame. Required by FlexRAN protocol*/ uint16_t get_sfn_sf (mid_t mod_id); uint16_t get_future_sfn_sf(mid_t mod_id, int ahead_of_time); @@ -287,7 +287,7 @@ int get_direction(mid_t ue_id, mid_t lc_id); /* Type of the callback executed when the timer expired */ -typedef Protocol__ProgranMessage *(*enb_agent_timer_callback_t)(void*); +typedef Protocol__FlexranMessage *(*enb_agent_timer_callback_t)(void*); typedef enum { /* oneshot timer: */ @@ -319,7 +319,7 @@ typedef enum { typedef struct enb_agent_timer_args_s{ mid_t mod_id; - Protocol__ProgranMessage *msg; + Protocol__FlexranMessage *msg; } enb_agent_timer_args_t; @@ -371,7 +371,7 @@ err_code_t enb_agent_restart_timer(long *timer_id); struct enb_agent_timer_element_s * get_timer_entry(long timer_id); -Protocol__ProgranMessage * enb_agent_process_timeout(long timer_id, void* timer_args); +Protocol__FlexranMessage * enb_agent_process_timeout(long timer_id, void* timer_args); int enb_agent_compare_timer(struct enb_agent_timer_element_s *a, struct enb_agent_timer_element_s *b); diff --git a/openair2/ENB_APP/enb_agent_handler.c b/openair2/ENB_APP/enb_agent_handler.c index da53343818..46459f98bc 100644 --- a/openair2/ENB_APP/enb_agent_handler.c +++ b/openair2/ENB_APP/enb_agent_handler.c @@ -29,7 +29,7 @@ /*! \file enb_agent_handler.c * \brief enb agent tx and rx message handler - * \author Navid Nikaein and Xenofon Foukas + * \author Xenofon Foukas and Navid Nikaein * \date 2016 * \version 0.1 */ @@ -42,23 +42,23 @@ #include "assertions.h" enb_agent_message_decoded_callback agent_messages_callback[][3] = { - {enb_agent_hello, 0, 0}, /*PROTOCOL__PROGRAN_MESSAGE__MSG_HELLO_MSG*/ - {enb_agent_echo_reply, 0, 0}, /*PROTOCOL__PROGRAN_MESSAGE__MSG_ECHO_REQUEST_MSG*/ - {0, 0, 0}, /*PROTOCOL__PROGRAN_MESSAGE__MSG_ECHO_REPLY_MSG*/ //Must add handler when receiving echo reply - {enb_agent_mac_handle_stats, 0, 0}, /*PROTOCOL__PROGRAN_MESSAGE__MSG_STATS_REQUEST_MSG*/ - {0, 0, 0}, /*PROTOCOL__PROGRAN_MESSAGE__MSG_STATS_REPLY_MSG*/ - {0, 0, 0}, /*PROTOCOK__PROGRAN_MESSAGE__MSG_SF_TRIGGER_MSG*/ - {0, 0, 0}, /*PROTOCOL__PROGRAN_MESSAGE__MSG_UL_SR_INFO_MSG*/ - {enb_agent_enb_config_reply, 0, 0}, /*PROTOCOL__PROGRAN_MESSAGE__MSG_ENB_CONFIG_REQUEST_MSG*/ - {0, 0, 0}, /*PROTOCOL__PROGRAN_MESSAGE__MSG_ENB_CONFIG_REPLY_MSG*/ - {enb_agent_ue_config_reply, 0, 0}, /*PROTOCOL__PROGRAN_MESSAGE__MSG_UE_CONFIG_REQUEST_MSG*/ - {0, 0, 0}, /*PROTOCOL__PROGRAN_MESSAGE__MSG_UE_CONFIG_REPLY_MSG*/ - {enb_agent_lc_config_reply, 0, 0}, /*PROTOCOL__PROGRAN_MESSAGE__MSG_LC_CONFIG_REQUEST_MSG*/ - {0, 0, 0}, /*PROTOCOL__PROGRAN_MESSAGE__MSG_LC_CONFIG_REPLY_MSG*/ - {enb_agent_mac_handle_dl_mac_config, 0, 0}, /*PROTOCOL__PROGRAN_MESSAGE__MSG_DL_MAC_CONFIG_MSG*/ - {0, 0, 0}, /*PROTOCOL__PROGRAN_MESSAGE__MSG_UE_STATE_CHANGE_MSG*/ - {enb_agent_control_delegation, 0, 0}, /*PROTOCOL__PROGRAN_MESSAGE__MSG_CONTROL_DELEGATION_MSG*/ - {enb_agent_reconfiguration, 0, 0}, /*PROTOCOL__PROGRAN_MESSAGE__MSG_AGENT_RECONFIGURATION_MSG*/ + {enb_agent_hello, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_HELLO_MSG*/ + {enb_agent_echo_reply, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_ECHO_REQUEST_MSG*/ + {0, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_ECHO_REPLY_MSG*/ //Must add handler when receiving echo reply + {enb_agent_mac_handle_stats, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_STATS_REQUEST_MSG*/ + {0, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_STATS_REPLY_MSG*/ + {0, 0, 0}, /*PROTOCOK__FLEXRAN_MESSAGE__MSG_SF_TRIGGER_MSG*/ + {0, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_UL_SR_INFO_MSG*/ + {enb_agent_enb_config_reply, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_ENB_CONFIG_REQUEST_MSG*/ + {0, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_ENB_CONFIG_REPLY_MSG*/ + {enb_agent_ue_config_reply, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_UE_CONFIG_REQUEST_MSG*/ + {0, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_UE_CONFIG_REPLY_MSG*/ + {enb_agent_lc_config_reply, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_LC_CONFIG_REQUEST_MSG*/ + {0, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_LC_CONFIG_REPLY_MSG*/ + {enb_agent_mac_handle_dl_mac_config, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_DL_MAC_CONFIG_MSG*/ + {0, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_UE_STATE_CHANGE_MSG*/ + {enb_agent_control_delegation, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_CONTROL_DELEGATION_MSG*/ + {enb_agent_reconfiguration, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_AGENT_RECONFIGURATION_MSG*/ }; enb_agent_message_destruction_callback message_destruction_callback[] = { @@ -89,27 +89,27 @@ static const char *enb_agent_direction2String[] = { }; -Protocol__ProgranMessage* enb_agent_handle_message (mid_t mod_id, +Protocol__FlexranMessage* enb_agent_handle_message (mid_t mod_id, uint8_t *data, uint32_t size){ - Protocol__ProgranMessage *decoded_message, *reply_message; + Protocol__FlexranMessage *decoded_message, *reply_message; err_code_t err_code; DevAssert(data != NULL); if (enb_agent_deserialize_message(data, size, &decoded_message) < 0) { - err_code= PROTOCOL__PROGRAN_ERR__MSG_DECODING; + err_code= PROTOCOL__FLEXRAN_ERR__MSG_DECODING; goto error; } if ((decoded_message->msg_case > sizeof(agent_messages_callback) / (3*sizeof(enb_agent_message_decoded_callback))) || - (decoded_message->msg_dir > PROTOCOL__PROGRAN_DIRECTION__UNSUCCESSFUL_OUTCOME)){ - err_code= PROTOCOL__PROGRAN_ERR__MSG_NOT_HANDLED; + (decoded_message->msg_dir > PROTOCOL__FLEXRAN_DIRECTION__UNSUCCESSFUL_OUTCOME)){ + err_code= PROTOCOL__FLEXRAN_ERR__MSG_NOT_HANDLED; goto error; } if (agent_messages_callback[decoded_message->msg_case-1][decoded_message->msg_dir-1] == NULL) { - err_code= PROTOCOL__PROGRAN_ERR__MSG_NOT_SUPPORTED; + err_code= PROTOCOL__FLEXRAN_ERR__MSG_NOT_SUPPORTED; goto error; } @@ -118,7 +118,7 @@ Protocol__ProgranMessage* enb_agent_handle_message (mid_t mod_id, if ( err_code < 0 ){ goto error; } else if (err_code == 1) { //If err_code > 1, we do not want to dispose the message yet - protocol__progran_message__free_unpacked(decoded_message, NULL); + protocol__flexran_message__free_unpacked(decoded_message, NULL); } return reply_message; @@ -130,14 +130,14 @@ error: -void * enb_agent_pack_message(Protocol__ProgranMessage *msg, +void * enb_agent_pack_message(Protocol__FlexranMessage *msg, uint32_t * size){ void * buffer; - err_code_t err_code = PROTOCOL__PROGRAN_ERR__NO_ERR; + err_code_t err_code = PROTOCOL__FLEXRAN_ERR__NO_ERR; if (enb_agent_serialize_message(msg, &buffer, size) < 0 ) { - err_code = PROTOCOL__PROGRAN_ERR__MSG_ENCODING; + err_code = PROTOCOL__FLEXRAN_ERR__MSG_ENCODING; goto error; } @@ -157,11 +157,11 @@ void * enb_agent_pack_message(Protocol__ProgranMessage *msg, return NULL; } -Protocol__ProgranMessage *enb_agent_handle_timed_task(void *args) { +Protocol__FlexranMessage *enb_agent_handle_timed_task(void *args) { err_code_t err_code; enb_agent_timer_args_t *timer_args = (enb_agent_timer_args_t *) args; - Protocol__ProgranMessage *timed_task, *reply_message; + Protocol__FlexranMessage *timed_task, *reply_message; timed_task = timer_args->msg; err_code = ((*agent_messages_callback[timed_task->msg_case-1][timed_task->msg_dir-1])(timer_args->mod_id, (void *) timed_task, &reply_message)); if ( err_code < 0 ){ @@ -175,7 +175,7 @@ Protocol__ProgranMessage *enb_agent_handle_timed_task(void *args) { return NULL; } -Protocol__ProgranMessage* enb_agent_process_timeout(long timer_id, void* timer_args){ +Protocol__FlexranMessage* enb_agent_process_timeout(long timer_id, void* timer_args){ struct enb_agent_timer_element_s *found = get_timer_entry(timer_id); @@ -192,6 +192,6 @@ Protocol__ProgranMessage* enb_agent_process_timeout(long timer_id, void* timer_a return TIMER_ELEMENT_NOT_FOUND; } -err_code_t enb_agent_destroy_progran_message(Protocol__ProgranMessage *msg) { +err_code_t enb_agent_destroy_flexran_message(Protocol__FlexranMessage *msg) { return ((*message_destruction_callback[msg->msg_case-1])(msg)); } diff --git a/openair2/ENB_APP/enb_agent_mac.c b/openair2/ENB_APP/enb_agent_mac.c index 744768135e..d040622a02 100644 --- a/openair2/ENB_APP/enb_agent_mac.c +++ b/openair2/ENB_APP/enb_agent_mac.c @@ -29,7 +29,7 @@ /*! \file enb_agent_mac.c * \brief enb agent message handler for MAC layer - * \author Navid Nikaein and Xenofon Foukas + * \author Xenofon Foukas, Mohamed Kassem and Navid Nikaein * \date 2016 * \version 0.1 */ @@ -61,7 +61,7 @@ struct lfds700_ringbuffer_element *dl_mac_config_array[NUM_MAX_ENB]; struct lfds700_ringbuffer_state ringbuffer_state[NUM_MAX_ENB]; -int enb_agent_mac_handle_stats(mid_t mod_id, const void *params, Protocol__ProgranMessage **msg){ +int enb_agent_mac_handle_stats(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg){ // TODO: Must deal with sanitization of input // TODO: Must check if RNTIs and cell ids of the request actually exist @@ -86,16 +86,16 @@ int enb_agent_mac_handle_stats(mid_t mod_id, const void *params, Protocol__Progr uint32_t ue_flags = 0; uint32_t c_flags = 0; - Protocol__ProgranMessage *input = (Protocol__ProgranMessage *)params; + Protocol__FlexranMessage *input = (Protocol__FlexranMessage *)params; - Protocol__PrpStatsRequest *stats_req = input->stats_request_msg; + Protocol__FlexStatsRequest *stats_req = input->stats_request_msg; xid = (stats_req->header)->xid; // Check the type of request that is made switch(stats_req->body_case) { - case PROTOCOL__PRP_STATS_REQUEST__BODY_COMPLETE_STATS_REQUEST: ; - Protocol__PrpCompleteStatsRequest *comp_req = stats_req->complete_stats_request; - if (comp_req->report_frequency == PROTOCOL__PRP_STATS_REPORT_FREQ__PRSRF_OFF) { + case PROTOCOL__FLEX_STATS_REQUEST__BODY_COMPLETE_STATS_REQUEST: ; + Protocol__FlexCompleteStatsRequest *comp_req = stats_req->complete_stats_request; + if (comp_req->report_frequency == PROTOCOL__FLEX_STATS_REPORT_FREQ__FLSRF_OFF) { /*Disable both periodic and continuous updates*/ enb_agent_disable_cont_mac_stats_update(mod_id); enb_agent_destroy_timer_by_task_id(xid); @@ -133,12 +133,12 @@ int enb_agent_mac_handle_stats(mid_t mod_id, const void *params, Protocol__Progr report_config.cc_report_type[i].cc_report_flags = c_flags; } /* Check if request was periodical */ - if (comp_req->report_frequency == PROTOCOL__PRP_STATS_REPORT_FREQ__PRSRF_PERIODICAL) { - /* Create a one off progran message as an argument for the periodical task */ - Protocol__ProgranMessage *timer_msg; + if (comp_req->report_frequency == PROTOCOL__FLEX_STATS_REPORT_FREQ__FLSRF_PERIODICAL) { + /* Create a one off flexran message as an argument for the periodical task */ + Protocol__FlexranMessage *timer_msg; stats_request_config_t request_config; - request_config.report_type = PROTOCOL__PRP_STATS_TYPE__PRST_COMPLETE_STATS; - request_config.report_frequency = PROTOCOL__PRP_STATS_REPORT_FREQ__PRSRF_ONCE; + request_config.report_type = PROTOCOL__FLEX_STATS_TYPE__FLST_COMPLETE_STATS; + request_config.report_frequency = PROTOCOL__FLEX_STATS_REPORT_FREQ__FLSRF_ONCE; request_config.period = 0; /* Need to make sure that the ue flags are saved (Bug) */ if (report_config.nr_ue == 0) { @@ -170,13 +170,13 @@ int enb_agent_mac_handle_stats(mid_t mod_id, const void *params, Protocol__Progr usec_interval = usec_interval%(1000*1000); } enb_agent_create_timer(sec_interval, usec_interval, ENB_AGENT_DEFAULT, enb_id, ENB_AGENT_TIMER_TYPE_PERIODIC, xid, enb_agent_handle_timed_task,(void*) timer_args, &timer_id); - } else if (comp_req->report_frequency == PROTOCOL__PRP_STATS_REPORT_FREQ__PRSRF_CONTINUOUS) { + } else if (comp_req->report_frequency == PROTOCOL__FLEX_STATS_REPORT_FREQ__FLSRF_CONTINUOUS) { /*If request was for continuous updates, disable the previous configuration and set up a new one*/ enb_agent_disable_cont_mac_stats_update(mod_id); stats_request_config_t request_config; - request_config.report_type = PROTOCOL__PRP_STATS_TYPE__PRST_COMPLETE_STATS; - request_config.report_frequency = PROTOCOL__PRP_STATS_REPORT_FREQ__PRSRF_ONCE; + request_config.report_type = PROTOCOL__FLEX_STATS_TYPE__FLST_COMPLETE_STATS; + request_config.report_frequency = PROTOCOL__FLEX_STATS_REPORT_FREQ__FLSRF_ONCE; request_config.period = 0; /* Need to make sure that the ue flags are saved (Bug) */ if (report_config.nr_ue == 0) { @@ -195,8 +195,8 @@ int enb_agent_mac_handle_stats(mid_t mod_id, const void *params, Protocol__Progr } } break; - case PROTOCOL__PRP_STATS_REQUEST__BODY_CELL_STATS_REQUEST:; - Protocol__PrpCellStatsRequest *cell_req = stats_req->cell_stats_request; + case PROTOCOL__FLEX_STATS_REQUEST__BODY_CELL_STATS_REQUEST:; + Protocol__FlexCellStatsRequest *cell_req = stats_req->cell_stats_request; // UE report config will be blank report_config.nr_ue = 0; report_config.ue_report_type = NULL; @@ -213,8 +213,8 @@ int enb_agent_mac_handle_stats(mid_t mod_id, const void *params, Protocol__Progr report_config.cc_report_type[i].cc_report_flags = cell_req->flags; } break; - case PROTOCOL__PRP_STATS_REQUEST__BODY_UE_STATS_REQUEST:; - Protocol__PrpUeStatsRequest *ue_req = stats_req->ue_stats_request; + case PROTOCOL__FLEX_STATS_REQUEST__BODY_UE_STATS_REQUEST:; + Protocol__FlexUeStatsRequest *ue_req = stats_req->ue_stats_request; // Cell report config will be blank report_config.nr_cc = 0; report_config.cc_report_type = NULL; @@ -237,7 +237,7 @@ int enb_agent_mac_handle_stats(mid_t mod_id, const void *params, Protocol__Progr } if (enb_agent_mac_stats_reply(enb_id, xid, &report_config, msg) < 0 ){ - err_code = PROTOCOL__PROGRAN_ERR__MSG_BUILD; + err_code = PROTOCOL__FLEXRAN_ERR__MSG_BUILD; goto error; } @@ -254,32 +254,32 @@ int enb_agent_mac_handle_stats(mid_t mod_id, const void *params, Protocol__Progr int enb_agent_mac_stats_request(mid_t mod_id, xid_t xid, const stats_request_config_t *report_config, - Protocol__ProgranMessage **msg) { - Protocol__PrpHeader *header; + Protocol__FlexranMessage **msg) { + Protocol__FlexHeader *header; int i; - if (prp_create_header(xid, PROTOCOL__PRP_TYPE__PRPT_STATS_REQUEST, &header) != 0) + if (flex_create_header(xid, PROTOCOL__FLEX_TYPE__FLPT_STATS_REQUEST, &header) != 0) goto error; - Protocol__PrpStatsRequest *stats_request_msg; - stats_request_msg = malloc(sizeof(Protocol__PrpStatsRequest)); + Protocol__FlexStatsRequest *stats_request_msg; + stats_request_msg = malloc(sizeof(Protocol__FlexStatsRequest)); if(stats_request_msg == NULL) goto error; - protocol__prp_stats_request__init(stats_request_msg); + protocol__flex_stats_request__init(stats_request_msg); stats_request_msg->header = header; stats_request_msg->type = report_config->report_type; stats_request_msg->has_type = 1; switch (report_config->report_type) { - case PROTOCOL__PRP_STATS_TYPE__PRST_COMPLETE_STATS: - stats_request_msg->body_case = PROTOCOL__PRP_STATS_REQUEST__BODY_COMPLETE_STATS_REQUEST; - Protocol__PrpCompleteStatsRequest *complete_stats; - complete_stats = malloc(sizeof(Protocol__PrpCompleteStatsRequest)); + case PROTOCOL__FLEX_STATS_TYPE__FLST_COMPLETE_STATS: + stats_request_msg->body_case = PROTOCOL__FLEX_STATS_REQUEST__BODY_COMPLETE_STATS_REQUEST; + Protocol__FlexCompleteStatsRequest *complete_stats; + complete_stats = malloc(sizeof(Protocol__FlexCompleteStatsRequest)); if(complete_stats == NULL) goto error; - protocol__prp_complete_stats_request__init(complete_stats); + protocol__flex_complete_stats_request__init(complete_stats); complete_stats->report_frequency = report_config->report_frequency; complete_stats->has_report_frequency = 1; complete_stats->sf = report_config->period; @@ -294,13 +294,13 @@ int enb_agent_mac_stats_request(mid_t mod_id, } stats_request_msg->complete_stats_request = complete_stats; break; - case PROTOCOL__PRP_STATS_TYPE__PRST_CELL_STATS: - stats_request_msg->body_case = PROTOCOL__PRP_STATS_REQUEST__BODY_CELL_STATS_REQUEST; - Protocol__PrpCellStatsRequest *cell_stats; - cell_stats = malloc(sizeof(Protocol__PrpCellStatsRequest)); + case PROTOCOL__FLEX_STATS_TYPE__FLST_CELL_STATS: + stats_request_msg->body_case = PROTOCOL__FLEX_STATS_REQUEST__BODY_CELL_STATS_REQUEST; + Protocol__FlexCellStatsRequest *cell_stats; + cell_stats = malloc(sizeof(Protocol__FlexCellStatsRequest)); if(cell_stats == NULL) goto error; - protocol__prp_cell_stats_request__init(cell_stats); + protocol__flex_cell_stats_request__init(cell_stats); cell_stats->n_cell = report_config->config->nr_cc; cell_stats->has_flags = 1; if (cell_stats->n_cell > 0) { @@ -314,13 +314,13 @@ int enb_agent_mac_stats_request(mid_t mod_id, } stats_request_msg->cell_stats_request = cell_stats; break; - case PROTOCOL__PRP_STATS_TYPE__PRST_UE_STATS: - stats_request_msg->body_case = PROTOCOL__PRP_STATS_REQUEST__BODY_UE_STATS_REQUEST; - Protocol__PrpUeStatsRequest *ue_stats; - ue_stats = malloc(sizeof(Protocol__PrpUeStatsRequest)); + case PROTOCOL__FLEX_STATS_TYPE__FLST_UE_STATS: + stats_request_msg->body_case = PROTOCOL__FLEX_STATS_REQUEST__BODY_UE_STATS_REQUEST; + Protocol__FlexUeStatsRequest *ue_stats; + ue_stats = malloc(sizeof(Protocol__FlexUeStatsRequest)); if(ue_stats == NULL) goto error; - protocol__prp_ue_stats_request__init(ue_stats); + protocol__flex_ue_stats_request__init(ue_stats); ue_stats->n_rnti = report_config->config->nr_ue; ue_stats->has_flags = 1; if (ue_stats->n_rnti > 0) { @@ -337,12 +337,12 @@ int enb_agent_mac_stats_request(mid_t mod_id, default: goto error; } - *msg = malloc(sizeof(Protocol__ProgranMessage)); + *msg = malloc(sizeof(Protocol__FlexranMessage)); if(*msg == NULL) goto error; - protocol__progran_message__init(*msg); - (*msg)->msg_case = PROTOCOL__PROGRAN_MESSAGE__MSG_STATS_REQUEST_MSG; - (*msg)->msg_dir = PROTOCOL__PROGRAN_DIRECTION__INITIATING_MESSAGE; + protocol__flexran_message__init(*msg); + (*msg)->msg_case = PROTOCOL__FLEXRAN_MESSAGE__MSG_STATS_REQUEST_MSG; + (*msg)->msg_dir = PROTOCOL__FLEXRAN_DIRECTION__INITIATING_MESSAGE; (*msg)->stats_request_msg = stats_request_msg; return 0; @@ -358,14 +358,14 @@ int enb_agent_mac_stats_request(mid_t mod_id, return -1; } -int enb_agent_mac_destroy_stats_request(Protocol__ProgranMessage *msg) { - if(msg->msg_case != PROTOCOL__PROGRAN_MESSAGE__MSG_STATS_REQUEST_MSG) +int enb_agent_mac_destroy_stats_request(Protocol__FlexranMessage *msg) { + if(msg->msg_case != PROTOCOL__FLEXRAN_MESSAGE__MSG_STATS_REQUEST_MSG) goto error; free(msg->stats_request_msg->header); - if (msg->stats_request_msg->body_case == PROTOCOL__PRP_STATS_REQUEST__BODY_CELL_STATS_REQUEST) { + if (msg->stats_request_msg->body_case == PROTOCOL__FLEX_STATS_REQUEST__BODY_CELL_STATS_REQUEST) { free(msg->stats_request_msg->cell_stats_request->cell); } - if (msg->stats_request_msg->body_case == PROTOCOL__PRP_STATS_REQUEST__BODY_UE_STATS_REQUEST) { + if (msg->stats_request_msg->body_case == PROTOCOL__FLEX_STATS_REQUEST__BODY_UE_STATS_REQUEST) { free(msg->stats_request_msg->ue_stats_request->rnti); } free(msg->stats_request_msg); @@ -380,8 +380,8 @@ int enb_agent_mac_destroy_stats_request(Protocol__ProgranMessage *msg) { int enb_agent_mac_stats_reply(mid_t mod_id, xid_t xid, const report_config_t *report_config, - Protocol__ProgranMessage **msg) { - Protocol__PrpHeader *header; + Protocol__FlexranMessage **msg) { + Protocol__FlexHeader *header; int i, j, k; int cc_id = 0; int enb_id = mod_id; @@ -389,31 +389,31 @@ int enb_agent_mac_stats_reply(mid_t mod_id, //UE_list_t *eNB_UE_list= &eNB->UE_list; - if (prp_create_header(xid, PROTOCOL__PRP_TYPE__PRPT_STATS_REPLY, &header) != 0) + if (flex_create_header(xid, PROTOCOL__FLEX_TYPE__FLPT_STATS_REPLY, &header) != 0) goto error; - Protocol__PrpStatsReply *stats_reply_msg; - stats_reply_msg = malloc(sizeof(Protocol__PrpStatsReply)); + Protocol__FlexStatsReply *stats_reply_msg; + stats_reply_msg = malloc(sizeof(Protocol__FlexStatsReply)); if (stats_reply_msg == NULL) goto error; - protocol__prp_stats_reply__init(stats_reply_msg); + protocol__flex_stats_reply__init(stats_reply_msg); stats_reply_msg->header = header; stats_reply_msg->n_ue_report = report_config->nr_ue; stats_reply_msg->n_cell_report = report_config->nr_cc; - Protocol__PrpUeStatsReport **ue_report; - Protocol__PrpCellStatsReport **cell_report; + Protocol__FlexUeStatsReport **ue_report; + Protocol__FlexCellStatsReport **cell_report; /* Allocate memory for list of UE reports */ if (report_config->nr_ue > 0) { - ue_report = malloc(sizeof(Protocol__PrpUeStatsReport *) * report_config->nr_ue); + ue_report = malloc(sizeof(Protocol__FlexUeStatsReport *) * report_config->nr_ue); if (ue_report == NULL) goto error; for (i = 0; i < report_config->nr_ue; i++) { - ue_report[i] = malloc(sizeof(Protocol__PrpUeStatsReport)); - protocol__prp_ue_stats_report__init(ue_report[i]); + ue_report[i] = malloc(sizeof(Protocol__FlexUeStatsReport)); + protocol__flex_ue_stats_report__init(ue_report[i]); ue_report[i]->rnti = report_config->ue_report_type[i].ue_rnti; ue_report[i]->has_rnti = 1; ue_report[i]->flags = report_config->ue_report_type[i].ue_report_flags; @@ -421,9 +421,9 @@ int enb_agent_mac_stats_reply(mid_t mod_id, /* Check the types of reports that need to be constructed based on flag values */ /* Check flag for creation of buffer status report */ - if (report_config->ue_report_type[i].ue_report_flags & PROTOCOL__PRP_UE_STATS_TYPE__PRUST_BSR) { - //TODO: Create a report for each LCG (4 elements). See prp_ue_stats_report of - // progRAN specifications for more details + if (report_config->ue_report_type[i].ue_report_flags & PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_BSR) { + //TODO: Create a report for each LCG (4 elements). See flex_ue_stats_report of + // FlexRAN specifications for more details ue_report[i]->n_bsr = 4; uint32_t *elem; elem = (uint32_t *) malloc(sizeof(uint32_t)*ue_report[i]->n_bsr); @@ -438,28 +438,28 @@ int enb_agent_mac_stats_reply(mid_t mod_id, } /* Check flag for creation of PRH report */ - if (report_config->ue_report_type[i].ue_report_flags & PROTOCOL__PRP_UE_STATS_TYPE__PRUST_PRH) { + if (report_config->ue_report_type[i].ue_report_flags & PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_PRH) { // TODO: Fill in the actual power headroom value for the RNTI ue_report[i]->phr = get_ue_phr (enb_id, i); // eNB_UE_list->UE_template[UE_PCCID(enb_id,i)][i].phr_info; ue_report[i]->has_phr = 1; } /* Check flag for creation of RLC buffer status report */ - if (report_config->ue_report_type[i].ue_report_flags & PROTOCOL__PRP_UE_STATS_TYPE__PRUST_RLC_BS) { + if (report_config->ue_report_type[i].ue_report_flags & PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_RLC_BS) { // TODO: Fill in the actual RLC buffer status reports ue_report[i]->n_rlc_report = 3; // Set this to the number of LCs for this UE - Protocol__PrpRlcBsr ** rlc_reports; - rlc_reports = malloc(sizeof(Protocol__PrpRlcBsr *) * ue_report[i]->n_rlc_report); + Protocol__FlexRlcBsr ** rlc_reports; + rlc_reports = malloc(sizeof(Protocol__FlexRlcBsr *) * ue_report[i]->n_rlc_report); if (rlc_reports == NULL) goto error; // Fill the buffer status report for each logical channel of the UE // NN: see LAYER2/openair2_proc.c for rlc status for (j = 0; j < ue_report[i]->n_rlc_report; j++) { - rlc_reports[j] = malloc(sizeof(Protocol__PrpRlcBsr)); + rlc_reports[j] = malloc(sizeof(Protocol__FlexRlcBsr)); if (rlc_reports[j] == NULL) goto error; - protocol__prp_rlc_bsr__init(rlc_reports[j]); + protocol__flex_rlc_bsr__init(rlc_reports[j]); //TODO:Set logical channel id rlc_reports[j]->lc_id = j+1; rlc_reports[j]->has_lc_id = 1; @@ -485,38 +485,38 @@ int enb_agent_mac_stats_reply(mid_t mod_id, } /* Check flag for creation of MAC CE buffer status report */ - if (report_config->ue_report_type[i].ue_report_flags & PROTOCOL__PRP_UE_STATS_TYPE__PRUST_MAC_CE_BS) { + if (report_config->ue_report_type[i].ue_report_flags & PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_MAC_CE_BS) { // TODO: Fill in the actual MAC CE buffer status report ue_report[i]->pending_mac_ces = (get_MAC_CE_bitmap_TA(enb_id,i,0) | (0 << 1) | (0 << 2) | (0 << 3)) & 15; /* Use as bitmap. Set one or more of the; /* Use as bitmap. Set one or more of the - PROTOCOL__PRP_CE_TYPE__PRPCET_ values + PROTOCOL__FLEX_CE_TYPE__FLPCET_ values found in stats_common.pb-c.h. See - prp_ce_type in progRAN specification */ + flex_ce_type in FlexRAN specification */ ue_report[i]->has_pending_mac_ces = 1; } /* Check flag for creation of DL CQI report */ - if (report_config->ue_report_type[i].ue_report_flags & PROTOCOL__PRP_UE_STATS_TYPE__PRUST_DL_CQI) { + if (report_config->ue_report_type[i].ue_report_flags & PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_DL_CQI) { // TODO: Fill in the actual DL CQI report for the UE based on its configuration - Protocol__PrpDlCqiReport * dl_report; - dl_report = malloc(sizeof(Protocol__PrpDlCqiReport)); + Protocol__FlexDlCqiReport * dl_report; + dl_report = malloc(sizeof(Protocol__FlexDlCqiReport)); if (dl_report == NULL) goto error; - protocol__prp_dl_cqi_report__init(dl_report); + protocol__flex_dl_cqi_report__init(dl_report); //TODO:Set the SFN and SF of the last report held in the agent. dl_report->sfn_sn = get_sfn_sf(enb_id); dl_report->has_sfn_sn = 1; //TODO:Set the number of DL CQI reports for this UE. One for each CC dl_report->n_csi_report = get_active_CC(enb_id,i); //TODO:Create the actual CSI reports. - Protocol__PrpDlCsi **csi_reports; - csi_reports = malloc(sizeof(Protocol__PrpDlCsi *)*dl_report->n_csi_report); + Protocol__FlexDlCsi **csi_reports; + csi_reports = malloc(sizeof(Protocol__FlexDlCsi *)*dl_report->n_csi_report); if (csi_reports == NULL) goto error; for (j = 0; j < dl_report->n_csi_report; j++) { - csi_reports[j] = malloc(sizeof(Protocol__PrpDlCsi)); + csi_reports[j] = malloc(sizeof(Protocol__FlexDlCsi)); if (csi_reports[j] == NULL) goto error; - protocol__prp_dl_csi__init(csi_reports[j]); + protocol__flex_dl_csi__init(csi_reports[j]); //TODO: the servCellIndex for this report csi_reports[j]->serv_cell_index = j; csi_reports[j]->has_serv_cell_index = 1; @@ -526,16 +526,16 @@ int enb_agent_mac_stats_reply(mid_t mod_id, //TODO: the type of CSI report based on the configuration of the UE //For this example we use type P10, which only needs a wideband value //The full set of types can be found in stats_common.pb-c.h and - //in the progRAN specifications - csi_reports[j]->type = PROTOCOL__PRP_CSI_TYPE__PRCSIT_P10; + //in the FlexRAN specifications + csi_reports[j]->type = PROTOCOL__FLEX_CSI_TYPE__FLCSIT_P10; csi_reports[j]->has_type = 1; - csi_reports[j]->report_case = PROTOCOL__PRP_DL_CSI__REPORT_P10CSI; - if(csi_reports[j]->report_case == PROTOCOL__PRP_DL_CSI__REPORT_P10CSI){ - Protocol__PrpCsiP10 *csi10; - csi10 = malloc(sizeof(Protocol__PrpCsiP10)); + csi_reports[j]->report_case = PROTOCOL__FLEX_DL_CSI__REPORT_P10CSI; + if(csi_reports[j]->report_case == PROTOCOL__FLEX_DL_CSI__REPORT_P10CSI){ + Protocol__FlexCsiP10 *csi10; + csi10 = malloc(sizeof(Protocol__FlexCsiP10)); if (csi10 == NULL) goto error; - protocol__prp_csi_p10__init(csi10); + protocol__flex_csi_p10__init(csi10); //TODO: set the wideband value // NN: this is also depends on cc_id csi10->wb_cqi = get_ue_wcqi (enb_id, i); //eNB_UE_list->eNB_UE_stats[UE_PCCID(enb_id,i)][i].dl_cqi; @@ -543,28 +543,28 @@ int enb_agent_mac_stats_reply(mid_t mod_id, //Add the type of measurements to the csi report in the proper union type csi_reports[j]->p10csi = csi10; } - else if(csi_reports[j]->report_case == PROTOCOL__PRP_DL_CSI__REPORT_P11CSI){ + else if(csi_reports[j]->report_case == PROTOCOL__FLEX_DL_CSI__REPORT_P11CSI){ } - else if(csi_reports[j]->report_case == PROTOCOL__PRP_DL_CSI__REPORT_P20CSI){ + else if(csi_reports[j]->report_case == PROTOCOL__FLEX_DL_CSI__REPORT_P20CSI){ } - else if(csi_reports[j]->report_case == PROTOCOL__PRP_DL_CSI__REPORT_P21CSI){ + else if(csi_reports[j]->report_case == PROTOCOL__FLEX_DL_CSI__REPORT_P21CSI){ } - else if(csi_reports[j]->report_case == PROTOCOL__PRP_DL_CSI__REPORT_A12CSI){ + else if(csi_reports[j]->report_case == PROTOCOL__FLEX_DL_CSI__REPORT_A12CSI){ } - else if(csi_reports[j]->report_case == PROTOCOL__PRP_DL_CSI__REPORT_A22CSI){ + else if(csi_reports[j]->report_case == PROTOCOL__FLEX_DL_CSI__REPORT_A22CSI){ } - else if(csi_reports[j]->report_case == PROTOCOL__PRP_DL_CSI__REPORT_A20CSI){ + else if(csi_reports[j]->report_case == PROTOCOL__FLEX_DL_CSI__REPORT_A20CSI){ } - else if(csi_reports[j]->report_case == PROTOCOL__PRP_DL_CSI__REPORT_A30CSI){ + else if(csi_reports[j]->report_case == PROTOCOL__FLEX_DL_CSI__REPORT_A30CSI){ } - else if(csi_reports[j]->report_case == PROTOCOL__PRP_DL_CSI__REPORT_A31CSI){ + else if(csi_reports[j]->report_case == PROTOCOL__FLEX_DL_CSI__REPORT_A31CSI){ } } @@ -575,26 +575,26 @@ int enb_agent_mac_stats_reply(mid_t mod_id, } /* Check flag for creation of paging buffer status report */ - if (report_config->ue_report_type[i].ue_report_flags & PROTOCOL__PRP_UE_STATS_TYPE__PRUST_PBS) { + if (report_config->ue_report_type[i].ue_report_flags & PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_PBS) { //TODO: Fill in the actual paging buffer status report. For this field to be valid, the RNTI //set in the report must be a P-RNTI - Protocol__PrpPagingBufferReport *paging_report; - paging_report = malloc(sizeof(Protocol__PrpPagingBufferReport)); + Protocol__FlexPagingBufferReport *paging_report; + paging_report = malloc(sizeof(Protocol__FlexPagingBufferReport)); if (paging_report == NULL) goto error; - protocol__prp_paging_buffer_report__init(paging_report); + protocol__flex_paging_buffer_report__init(paging_report); //Set the number of pending paging messages paging_report->n_paging_info = 1; //Provide a report for each pending paging message - Protocol__PrpPagingInfo **p_info; - p_info = malloc(sizeof(Protocol__PrpPagingInfo *) * paging_report->n_paging_info); + Protocol__FlexPagingInfo **p_info; + p_info = malloc(sizeof(Protocol__FlexPagingInfo *) * paging_report->n_paging_info); if (p_info == NULL) goto error; for (j = 0; j < paging_report->n_paging_info; j++) { - p_info[j] = malloc(sizeof(Protocol__PrpPagingInfo)); + p_info[j] = malloc(sizeof(Protocol__FlexPagingInfo)); if(p_info[j] == NULL) goto error; - protocol__prp_paging_info__init(p_info[j]); + protocol__flex_paging_info__init(p_info[j]); //TODO: Set paging index. This index is the same that will be used for the scheduling of the //paging message by the controller p_info[j]->paging_index = 10; @@ -616,35 +616,35 @@ int enb_agent_mac_stats_reply(mid_t mod_id, } /* Check flag for creation of UL CQI report */ - if (report_config->ue_report_type[i].ue_report_flags & PROTOCOL__PRP_UE_STATS_TYPE__PRUST_UL_CQI) { + if (report_config->ue_report_type[i].ue_report_flags & PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_UL_CQI) { //Fill in the full UL CQI report of the UE - Protocol__PrpUlCqiReport *full_ul_report; - full_ul_report = malloc(sizeof(Protocol__PrpUlCqiReport)); + Protocol__FlexUlCqiReport *full_ul_report; + full_ul_report = malloc(sizeof(Protocol__FlexUlCqiReport)); if(full_ul_report == NULL) goto error; - protocol__prp_ul_cqi_report__init(full_ul_report); + protocol__flex_ul_cqi_report__init(full_ul_report); //TODO:Set the SFN and SF of the generated report full_ul_report->sfn_sn = get_sfn_sf(enb_id); full_ul_report->has_sfn_sn = 1; //TODO:Set the number of UL measurement reports based on the types of measurements //configured for this UE and on the servCellIndex full_ul_report->n_cqi_meas = 1; - Protocol__PrpUlCqi **ul_report; - ul_report = malloc(sizeof(Protocol__PrpUlCqi *) * full_ul_report->n_cqi_meas); + Protocol__FlexUlCqi **ul_report; + ul_report = malloc(sizeof(Protocol__FlexUlCqi *) * full_ul_report->n_cqi_meas); if(ul_report == NULL) goto error; //Fill each UL report of the UE for each of the configured report types for(j = 0; j < full_ul_report->n_cqi_meas; j++) { - ul_report[j] = malloc(sizeof(Protocol__PrpUlCqi)); + ul_report[j] = malloc(sizeof(Protocol__FlexUlCqi)); if(ul_report[j] == NULL) goto error; - protocol__prp_ul_cqi__init(ul_report[j]); + protocol__flex_ul_cqi__init(ul_report[j]); //TODO: Set the type of the UL report. As an example set it to SRS UL report - // See enum prp_ul_cqi_type in progRAN specification for more details - ul_report[j]->type = PROTOCOL__PRP_UL_CQI_TYPE__PRUCT_SRS; + // See enum flex_ul_cqi_type in FlexRAN specification for more details + ul_report[j]->type = PROTOCOL__FLEX_UL_CQI_TYPE__FLUCT_SRS; ul_report[j]->has_type = 1; //TODO:Set the number of SINR measurements based on the report type - //See struct prp_ul_cqi in progRAN specification for more details + //See struct flex_ul_cqi in FlexRAN specification for more details ul_report[j]->n_sinr = 100; uint32_t *sinr_meas; sinr_meas = (uint32_t *) malloc(sizeof(uint32_t) * ul_report[j]->n_sinr); @@ -663,11 +663,11 @@ int enb_agent_mac_stats_reply(mid_t mod_id, full_ul_report->cqi_meas = ul_report; full_ul_report->n_pucch_dbm = MAX_NUM_CCs; - full_ul_report->pucch_dbm = malloc(sizeof(Protocol__PrpPucchDbm *) * full_ul_report->n_pucch_dbm); + full_ul_report->pucch_dbm = malloc(sizeof(Protocol__FlexPucchDbm *) * full_ul_report->n_pucch_dbm); for (j = 0; j < MAX_NUM_CCs; j++) { - full_ul_report->pucch_dbm[j] = malloc(sizeof(Protocol__PrpPucchDbm)); - protocol__prp_pucch_dbm__init(full_ul_report->pucch_dbm[j]); + full_ul_report->pucch_dbm[j] = malloc(sizeof(Protocol__FlexPucchDbm)); + protocol__flex_pucch_dbm__init(full_ul_report->pucch_dbm[j]); full_ul_report->pucch_dbm[j]->has_serv_cell_index = 1; full_ul_report->pucch_dbm[j]->serv_cell_index = j; if(get_p0_pucch_dbm(enb_id,i, j) != -1){ @@ -687,28 +687,28 @@ int enb_agent_mac_stats_reply(mid_t mod_id, /* Allocate memory for list of cell reports */ if (report_config->nr_cc > 0) { - cell_report = malloc(sizeof(Protocol__PrpCellStatsReport *) * report_config->nr_cc); + cell_report = malloc(sizeof(Protocol__FlexCellStatsReport *) * report_config->nr_cc); if (cell_report == NULL) goto error; // Fill in the Cell reports for (i = 0; i < report_config->nr_cc; i++) { - cell_report[i] = malloc(sizeof(Protocol__PrpCellStatsReport)); + cell_report[i] = malloc(sizeof(Protocol__FlexCellStatsReport)); if(cell_report[i] == NULL) goto error; - protocol__prp_cell_stats_report__init(cell_report[i]); + protocol__flex_cell_stats_report__init(cell_report[i]); cell_report[i]->carrier_index = report_config->cc_report_type[i].cc_id; cell_report[i]->has_carrier_index = 1; cell_report[i]->flags = report_config->cc_report_type[i].cc_report_flags; cell_report[i]->has_flags = 1; /* Check flag for creation of noise and interference report */ - if(report_config->cc_report_type[i].cc_report_flags & PROTOCOL__PRP_CELL_STATS_TYPE__PRCST_NOISE_INTERFERENCE) { + if(report_config->cc_report_type[i].cc_report_flags & PROTOCOL__FLEX_CELL_STATS_TYPE__FLCST_NOISE_INTERFERENCE) { // TODO: Fill in the actual noise and interference report for this cell - Protocol__PrpNoiseInterferenceReport *ni_report; - ni_report = malloc(sizeof(Protocol__PrpNoiseInterferenceReport)); + Protocol__FlexNoiseInterferenceReport *ni_report; + ni_report = malloc(sizeof(Protocol__FlexNoiseInterferenceReport)); if(ni_report == NULL) goto error; - protocol__prp_noise_interference_report__init(ni_report); + protocol__flex_noise_interference_report__init(ni_report); // Current frame and subframe number ni_report->sfn_sf = get_sfn_sf(enb_id); ni_report->has_sfn_sf = 1; @@ -728,12 +728,12 @@ int enb_agent_mac_stats_reply(mid_t mod_id, stats_reply_msg->cell_report = cell_report; } - *msg = malloc(sizeof(Protocol__ProgranMessage)); + *msg = malloc(sizeof(Protocol__FlexranMessage)); if(*msg == NULL) goto error; - protocol__progran_message__init(*msg); - (*msg)->msg_case = PROTOCOL__PROGRAN_MESSAGE__MSG_STATS_REPLY_MSG; - (*msg)->msg_dir = PROTOCOL__PROGRAN_DIRECTION__SUCCESSFUL_OUTCOME; + protocol__flexran_message__init(*msg); + (*msg)->msg_case = PROTOCOL__FLEXRAN_MESSAGE__MSG_STATS_REPLY_MSG; + (*msg)->msg_dir = PROTOCOL__FLEXRAN_DIRECTION__SUCCESSFUL_OUTCOME; (*msg)->stats_reply_msg = stats_reply_msg; return 0; @@ -749,17 +749,17 @@ int enb_agent_mac_stats_reply(mid_t mod_id, return -1; } -int enb_agent_mac_destroy_stats_reply(Protocol__ProgranMessage *msg) { +int enb_agent_mac_destroy_stats_reply(Protocol__FlexranMessage *msg) { //TODO: Need to deallocate memory for the stats reply message - if(msg->msg_case != PROTOCOL__PROGRAN_MESSAGE__MSG_STATS_REPLY_MSG) + if(msg->msg_case != PROTOCOL__FLEXRAN_MESSAGE__MSG_STATS_REPLY_MSG) goto error; free(msg->stats_reply_msg->header); int i, j, k; - Protocol__PrpStatsReply *reply = msg->stats_reply_msg; - Protocol__PrpDlCqiReport *dl_report; - Protocol__PrpUlCqiReport *ul_report; - Protocol__PrpPagingBufferReport *paging_report; + Protocol__FlexStatsReply *reply = msg->stats_reply_msg; + Protocol__FlexDlCqiReport *dl_report; + Protocol__FlexUlCqiReport *ul_report; + Protocol__FlexPagingBufferReport *paging_report; // Free the memory for the UE reports for (i = 0; i < reply->n_ue_report; i++) { @@ -769,47 +769,47 @@ int enb_agent_mac_destroy_stats_reply(Protocol__ProgranMessage *msg) { } free(reply->ue_report[i]->rlc_report); // If DL CQI report flag was set - if (reply->ue_report[i]->flags & PROTOCOL__PRP_UE_STATS_TYPE__PRUST_DL_CQI) { + if (reply->ue_report[i]->flags & PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_DL_CQI) { dl_report = reply->ue_report[i]->dl_cqi_report; // Delete all CSI reports for (j = 0; j < dl_report->n_csi_report; j++) { //Must free memory based on the type of report switch(dl_report->csi_report[j]->report_case) { - case PROTOCOL__PRP_DL_CSI__REPORT_P10CSI: + case PROTOCOL__FLEX_DL_CSI__REPORT_P10CSI: free(dl_report->csi_report[j]->p10csi); break; - case PROTOCOL__PRP_DL_CSI__REPORT_P11CSI: + case PROTOCOL__FLEX_DL_CSI__REPORT_P11CSI: free(dl_report->csi_report[j]->p11csi->wb_cqi); free(dl_report->csi_report[j]->p11csi); break; - case PROTOCOL__PRP_DL_CSI__REPORT_P20CSI: + case PROTOCOL__FLEX_DL_CSI__REPORT_P20CSI: free(dl_report->csi_report[j]->p20csi); break; - case PROTOCOL__PRP_DL_CSI__REPORT_P21CSI: + case PROTOCOL__FLEX_DL_CSI__REPORT_P21CSI: free(dl_report->csi_report[j]->p21csi->wb_cqi); free(dl_report->csi_report[j]->p21csi->sb_cqi); free(dl_report->csi_report[j]->p21csi); break; - case PROTOCOL__PRP_DL_CSI__REPORT_A12CSI: + case PROTOCOL__FLEX_DL_CSI__REPORT_A12CSI: free(dl_report->csi_report[j]->a12csi->wb_cqi); free(dl_report->csi_report[j]->a12csi->sb_pmi); free(dl_report->csi_report[j]->a12csi); break; - case PROTOCOL__PRP_DL_CSI__REPORT_A22CSI: + case PROTOCOL__FLEX_DL_CSI__REPORT_A22CSI: free(dl_report->csi_report[j]->a22csi->wb_cqi); free(dl_report->csi_report[j]->a22csi->sb_cqi); free(dl_report->csi_report[j]->a22csi->sb_list); free(dl_report->csi_report[j]->a22csi); break; - case PROTOCOL__PRP_DL_CSI__REPORT_A20CSI: + case PROTOCOL__FLEX_DL_CSI__REPORT_A20CSI: free(dl_report->csi_report[j]->a20csi->sb_list); free(dl_report->csi_report[j]->a20csi); break; - case PROTOCOL__PRP_DL_CSI__REPORT_A30CSI: + case PROTOCOL__FLEX_DL_CSI__REPORT_A30CSI: free(dl_report->csi_report[j]->a30csi->sb_cqi); free(dl_report->csi_report[j]->a30csi); break; - case PROTOCOL__PRP_DL_CSI__REPORT_A31CSI: + case PROTOCOL__FLEX_DL_CSI__REPORT_A31CSI: free(dl_report->csi_report[j]->a31csi->wb_cqi); for (k = 0; k < dl_report->csi_report[j]->a31csi->n_sb_cqi; k++) { free(dl_report->csi_report[j]->a31csi->sb_cqi[k]); @@ -824,7 +824,7 @@ int enb_agent_mac_destroy_stats_reply(Protocol__ProgranMessage *msg) { free(dl_report); } // If Paging buffer report flag was set - if (reply->ue_report[i]->flags & PROTOCOL__PRP_UE_STATS_TYPE__PRUST_PBS) { + if (reply->ue_report[i]->flags & PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_PBS) { paging_report = reply->ue_report[i]->pbr; // Delete all paging buffer reports for (j = 0; j < paging_report->n_paging_info; j++) { @@ -834,7 +834,7 @@ int enb_agent_mac_destroy_stats_reply(Protocol__ProgranMessage *msg) { free(paging_report); } // If UL CQI report flag was set - if (reply->ue_report[i]->flags & PROTOCOL__PRP_UE_STATS_TYPE__PRUST_UL_CQI) { + if (reply->ue_report[i]->flags & PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_UL_CQI) { ul_report = reply->ue_report[i]->ul_cqi_report; for (j = 0; j < ul_report->n_cqi_meas; j++) { free(ul_report->cqi_meas[j]->sinr); @@ -866,19 +866,19 @@ int enb_agent_mac_destroy_stats_reply(Protocol__ProgranMessage *msg) { return -1; } -int enb_agent_mac_sr_info(mid_t mod_id, const void *params, Protocol__ProgranMessage **msg) { - Protocol__PrpHeader *header; +int enb_agent_mac_sr_info(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg) { + Protocol__FlexHeader *header; int i; const int xid = *((int *)params); - if (prp_create_header(xid, PROTOCOL__PRP_TYPE__PRPT_UL_SR_INFO, &header) != 0) + if (flex_create_header(xid, PROTOCOL__FLEX_TYPE__FLPT_UL_SR_INFO, &header) != 0) goto error; - Protocol__PrpUlSrInfo *ul_sr_info_msg; - ul_sr_info_msg = malloc(sizeof(Protocol__PrpUlSrInfo)); + Protocol__FlexUlSrInfo *ul_sr_info_msg; + ul_sr_info_msg = malloc(sizeof(Protocol__FlexUlSrInfo)); if (ul_sr_info_msg == NULL) { goto error; } - protocol__prp_ul_sr_info__init(ul_sr_info_msg); + protocol__flex_ul_sr_info__init(ul_sr_info_msg); ul_sr_info_msg->header = header; ul_sr_info_msg->has_sfn_sf = 1; @@ -895,12 +895,12 @@ int enb_agent_mac_sr_info(mid_t mod_id, const void *params, Protocol__ProgranMes ul_sr_info_msg->rnti[i] = 1; } - *msg = malloc(sizeof(Protocol__ProgranMessage)); + *msg = malloc(sizeof(Protocol__FlexranMessage)); if(*msg == NULL) goto error; - protocol__progran_message__init(*msg); - (*msg)->msg_case = PROTOCOL__PROGRAN_MESSAGE__MSG_UL_SR_INFO_MSG; - (*msg)->msg_dir = PROTOCOL__PROGRAN_DIRECTION__INITIATING_MESSAGE; + protocol__flexran_message__init(*msg); + (*msg)->msg_case = PROTOCOL__FLEXRAN_MESSAGE__MSG_UL_SR_INFO_MSG; + (*msg)->msg_dir = PROTOCOL__FLEXRAN_DIRECTION__INITIATING_MESSAGE; (*msg)->ul_sr_info_msg = ul_sr_info_msg; return 0; @@ -918,8 +918,8 @@ int enb_agent_mac_sr_info(mid_t mod_id, const void *params, Protocol__ProgranMes return -1; } -int enb_agent_mac_destroy_sr_info(Protocol__ProgranMessage *msg) { - if(msg->msg_case != PROTOCOL__PROGRAN_MESSAGE__MSG_UL_SR_INFO_MSG) +int enb_agent_mac_destroy_sr_info(Protocol__FlexranMessage *msg) { + if(msg->msg_case != PROTOCOL__FLEXRAN_MESSAGE__MSG_UL_SR_INFO_MSG) goto error; free(msg->ul_sr_info_msg->header); @@ -933,19 +933,19 @@ int enb_agent_mac_destroy_sr_info(Protocol__ProgranMessage *msg) { return -1; } -int enb_agent_mac_sf_trigger(mid_t mod_id, const void *params, Protocol__ProgranMessage **msg) { - Protocol__PrpHeader *header; +int enb_agent_mac_sf_trigger(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg) { + Protocol__FlexHeader *header; int i,j; const int xid = *((int *)params); - if (prp_create_header(xid, PROTOCOL__PRP_TYPE__PRPT_SF_TRIGGER, &header) != 0) + if (flex_create_header(xid, PROTOCOL__FLEX_TYPE__FLPT_SF_TRIGGER, &header) != 0) goto error; - Protocol__PrpSfTrigger *sf_trigger_msg; - sf_trigger_msg = malloc(sizeof(Protocol__PrpSfTrigger)); + Protocol__FlexSfTrigger *sf_trigger_msg; + sf_trigger_msg = malloc(sizeof(Protocol__FlexSfTrigger)); if (sf_trigger_msg == NULL) { goto error; } - protocol__prp_sf_trigger__init(sf_trigger_msg); + protocol__flex_sf_trigger__init(sf_trigger_msg); frame_t frame; sub_frame_t subframe; @@ -974,18 +974,18 @@ int enb_agent_mac_sf_trigger(mid_t mod_id, const void *params, Protocol__Progran */ sf_trigger_msg->n_dl_info = get_num_ues(mod_id); - Protocol__PrpDlInfo **dl_info = NULL; + Protocol__FlexDlInfo **dl_info = NULL; if (sf_trigger_msg->n_dl_info > 0) { - dl_info = malloc(sizeof(Protocol__PrpDlInfo *) * sf_trigger_msg->n_dl_info); + dl_info = malloc(sizeof(Protocol__FlexDlInfo *) * sf_trigger_msg->n_dl_info); if(dl_info == NULL) goto error; //Fill the status of the current HARQ process for each UE for(i = 0; i < sf_trigger_msg->n_dl_info; i++) { - dl_info[i] = malloc(sizeof(Protocol__PrpDlInfo)); + dl_info[i] = malloc(sizeof(Protocol__FlexDlInfo)); if(dl_info[i] == NULL) goto error; - protocol__prp_dl_info__init(dl_info[i]); + protocol__flex_dl_info__init(dl_info[i]); dl_info[i]->rnti = get_ue_crnti(mod_id, i); dl_info[i]->has_rnti = 1; /*TODO: fill in the right id of this round's HARQ process for this UE*/ @@ -1000,9 +1000,9 @@ int enb_agent_mac_sf_trigger(mid_t mod_id, const void *params, Protocol__Progran for (j = 0; j < dl_info[i]->n_harq_status; j++) { // TODO: This should be different per TB if(harq_status == 0) - dl_info[i]->harq_status[j] = PROTOCOL__PRP_HARQ_STATUS__PRHS_ACK; + dl_info[i]->harq_status[j] = PROTOCOL__FLEX_HARQ_STATUS__FLHS_ACK; else if (harq_status == 1) - dl_info[i]->harq_status[j] = PROTOCOL__PRP_HARQ_STATUS__PRHS_NACK; + dl_info[i]->harq_status[j] = PROTOCOL__FLEX_HARQ_STATUS__FLHS_NACK; } /*TODO: fill in the serving cell index for this UE */ dl_info[i]->serv_cell_index = UE_PCCID(mod_id,i); @@ -1017,18 +1017,18 @@ int enb_agent_mac_sf_trigger(mid_t mod_id, const void *params, Protocol__Progran */ sf_trigger_msg->n_ul_info = get_num_ues(mod_id); - Protocol__PrpUlInfo **ul_info = NULL; + Protocol__FlexUlInfo **ul_info = NULL; if (sf_trigger_msg->n_ul_info > 0) { - ul_info = malloc(sizeof(Protocol__PrpUlInfo *) * sf_trigger_msg->n_ul_info); + ul_info = malloc(sizeof(Protocol__FlexUlInfo *) * sf_trigger_msg->n_ul_info); if(ul_info == NULL) goto error; //Fill the reception info for each transmitting UE for(i = 0; i < sf_trigger_msg->n_ul_info; i++) { - ul_info[i] = malloc(sizeof(Protocol__PrpUlInfo)); + ul_info[i] = malloc(sizeof(Protocol__FlexUlInfo)); if(ul_info[i] == NULL) goto error; - protocol__prp_ul_info__init(ul_info[i]); + protocol__flex_ul_info__init(ul_info[i]); ul_info[i]->rnti = get_ue_crnti(mod_id, i); ul_info[i]->has_rnti = 1; /*TODO: fill in the Tx power control command for this UE (if available)*/ @@ -1048,7 +1048,7 @@ int enb_agent_mac_sf_trigger(mid_t mod_id, const void *params, Protocol__Progran ul_info[i]->ul_reception[j] = 100; } /*TODO: Fill in the reception status for each UEs data*/ - ul_info[i]->reception_status = PROTOCOL__PRP_RECEPTION_STATUS__PRRS_OK; + ul_info[i]->reception_status = PROTOCOL__FLEX_RECEPTION_STATUS__FLRS_OK; ul_info[i]->has_reception_status = 1; /*TODO: fill in the serving cell index for this UE */ ul_info[i]->serv_cell_index = UE_PCCID(mod_id,i); @@ -1058,12 +1058,12 @@ int enb_agent_mac_sf_trigger(mid_t mod_id, const void *params, Protocol__Progran sf_trigger_msg->ul_info = ul_info; - *msg = malloc(sizeof(Protocol__ProgranMessage)); + *msg = malloc(sizeof(Protocol__FlexranMessage)); if(*msg == NULL) goto error; - protocol__progran_message__init(*msg); - (*msg)->msg_case = PROTOCOL__PROGRAN_MESSAGE__MSG_SF_TRIGGER_MSG; - (*msg)->msg_dir = PROTOCOL__PROGRAN_DIRECTION__INITIATING_MESSAGE; + protocol__flexran_message__init(*msg); + (*msg)->msg_case = PROTOCOL__FLEXRAN_MESSAGE__MSG_SF_TRIGGER_MSG; + (*msg)->msg_dir = PROTOCOL__FLEXRAN_DIRECTION__INITIATING_MESSAGE; (*msg)->sf_trigger_msg = sf_trigger_msg; return 0; @@ -1087,9 +1087,9 @@ int enb_agent_mac_sf_trigger(mid_t mod_id, const void *params, Protocol__Progran return -1; } -int enb_agent_mac_destroy_sf_trigger(Protocol__ProgranMessage *msg) { +int enb_agent_mac_destroy_sf_trigger(Protocol__FlexranMessage *msg) { int i; - if(msg->msg_case != PROTOCOL__PROGRAN_MESSAGE__MSG_SF_TRIGGER_MSG) + if(msg->msg_case != PROTOCOL__FLEXRAN_MESSAGE__MSG_SF_TRIGGER_MSG) goto error; free(msg->sf_trigger_msg->header); @@ -1113,30 +1113,30 @@ int enb_agent_mac_destroy_sf_trigger(Protocol__ProgranMessage *msg) { return -1; } -int enb_agent_mac_create_empty_dl_config(mid_t mod_id, Protocol__ProgranMessage **msg) { +int enb_agent_mac_create_empty_dl_config(mid_t mod_id, Protocol__FlexranMessage **msg) { int xid = 0; - Protocol__PrpHeader *header; - if (prp_create_header(xid, PROTOCOL__PRP_TYPE__PRPT_DL_MAC_CONFIG, &header) != 0) + Protocol__FlexHeader *header; + if (flex_create_header(xid, PROTOCOL__FLEX_TYPE__FLPT_DL_MAC_CONFIG, &header) != 0) goto error; - Protocol__PrpDlMacConfig *dl_mac_config_msg; - dl_mac_config_msg = malloc(sizeof(Protocol__PrpDlMacConfig)); + Protocol__FlexDlMacConfig *dl_mac_config_msg; + dl_mac_config_msg = malloc(sizeof(Protocol__FlexDlMacConfig)); if (dl_mac_config_msg == NULL) { goto error; } - protocol__prp_dl_mac_config__init(dl_mac_config_msg); + protocol__flex_dl_mac_config__init(dl_mac_config_msg); dl_mac_config_msg->header = header; dl_mac_config_msg->has_sfn_sf = 1; dl_mac_config_msg->sfn_sf = get_sfn_sf(mod_id); - *msg = malloc(sizeof(Protocol__ProgranMessage)); + *msg = malloc(sizeof(Protocol__FlexranMessage)); if(*msg == NULL) goto error; - protocol__progran_message__init(*msg); - (*msg)->msg_case = PROTOCOL__PROGRAN_MESSAGE__MSG_DL_MAC_CONFIG_MSG; - (*msg)->msg_dir = PROTOCOL__PROGRAN_DIRECTION__INITIATING_MESSAGE; + protocol__flexran_message__init(*msg); + (*msg)->msg_case = PROTOCOL__FLEXRAN_MESSAGE__MSG_DL_MAC_CONFIG_MSG; + (*msg)->msg_dir = PROTOCOL__FLEXRAN_DIRECTION__INITIATING_MESSAGE; (*msg)->dl_mac_config_msg = dl_mac_config_msg; return 0; @@ -1145,12 +1145,12 @@ int enb_agent_mac_create_empty_dl_config(mid_t mod_id, Protocol__ProgranMessage return -1; } -int enb_agent_mac_destroy_dl_config(Protocol__ProgranMessage *msg) { +int enb_agent_mac_destroy_dl_config(Protocol__FlexranMessage *msg) { int i,j, k; - if(msg->msg_case != PROTOCOL__PROGRAN_MESSAGE__MSG_DL_MAC_CONFIG_MSG) + if(msg->msg_case != PROTOCOL__FLEXRAN_MESSAGE__MSG_DL_MAC_CONFIG_MSG) goto error; - Protocol__PrpDlDci *dl_dci; + Protocol__FlexDlDci *dl_dci; free(msg->dl_mac_config_msg->header); for (i = 0; i < msg->dl_mac_config_msg->n_dl_ue_data; i++) { @@ -1208,7 +1208,7 @@ int enb_agent_mac_destroy_dl_config(Protocol__ProgranMessage *msg) { return -1; } -void enb_agent_get_pending_dl_mac_config(mid_t mod_id, Protocol__ProgranMessage **msg) { +void enb_agent_get_pending_dl_mac_config(mid_t mod_id, Protocol__FlexranMessage **msg) { struct lfds700_misc_prng_state ls; @@ -1220,11 +1220,11 @@ void enb_agent_get_pending_dl_mac_config(mid_t mod_id, Protocol__ProgranMessage } } -int enb_agent_mac_handle_dl_mac_config(mid_t mod_id, const void *params, Protocol__ProgranMessage **msg) { +int enb_agent_mac_handle_dl_mac_config(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg) { struct lfds700_misc_prng_state ls; enum lfds700_misc_flag overwrite_occurred_flag; - Protocol__ProgranMessage *overwritten_dl_config; + Protocol__FlexranMessage *overwritten_dl_config; LFDS700_MISC_MAKE_VALID_ON_CURRENT_LOGICAL_CORE_INITS_COMPLETED_BEFORE_NOW_ON_ANY_OTHER_LOGICAL_CORE; lfds700_misc_prng_init(&ls); @@ -1264,7 +1264,7 @@ void enb_agent_init_mac_agent(mid_t mod_id) { void enb_agent_send_sr_info(mid_t mod_id) { int size; - Protocol__ProgranMessage *msg; + Protocol__FlexranMessage *msg; void *data; int priority; err_code_t err_code; @@ -1281,7 +1281,7 @@ void enb_agent_send_sr_info(mid_t mod_id) { data=enb_agent_pack_message(msg, &size); /*Send sr info using the MAC channel of the eNB*/ if (enb_agent_msg_send(mod_id, ENB_AGENT_MAC, data, size, priority)) { - err_code = PROTOCOL__PROGRAN_ERR__MSG_ENQUEUING; + err_code = PROTOCOL__FLEXRAN_ERR__MSG_ENQUEUING; goto error; } @@ -1294,7 +1294,7 @@ void enb_agent_send_sr_info(mid_t mod_id) { void enb_agent_send_sf_trigger(mid_t mod_id) { int size; - Protocol__ProgranMessage *msg; + Protocol__FlexranMessage *msg; void *data; int priority; err_code_t err_code; @@ -1311,7 +1311,7 @@ void enb_agent_send_sf_trigger(mid_t mod_id) { data=enb_agent_pack_message(msg, &size); /*Send sr info using the MAC channel of the eNB*/ if (enb_agent_msg_send(mod_id, ENB_AGENT_MAC, data, size, priority)) { - err_code = PROTOCOL__PROGRAN_ERR__MSG_ENQUEUING; + err_code = PROTOCOL__FLEXRAN_ERR__MSG_ENQUEUING; goto error; } @@ -1324,7 +1324,7 @@ void enb_agent_send_sf_trigger(mid_t mod_id) { void enb_agent_send_update_mac_stats(mid_t mod_id) { - Protocol__ProgranMessage *current_report = NULL, *msg; + Protocol__FlexranMessage *current_report = NULL, *msg; void *data; int size; err_code_t err_code; @@ -1352,7 +1352,7 @@ void enb_agent_send_update_mac_stats(mid_t mod_id) { /* msg = enb_agent_generate_diff_mac_stats_report(current_report, mac_stats_context[mod_id].prev_stats_reply); */ /* /\*Destroy the old stats*\/ */ - /* enb_agent_destroy_progran_message(mac_stats_context[mod_id].prev_stats_reply); */ + /* enb_agent_destroy_flexran_message(mac_stats_context[mod_id].prev_stats_reply); */ /* } */ /* /\*Use the current report for future comparissons*\/ */ /* mac_stats_context[mod_id].prev_stats_reply = current_report; */ @@ -1366,7 +1366,7 @@ void enb_agent_send_update_mac_stats(mid_t mod_id) { data=enb_agent_pack_message(current_report, &size); /*Send any stats updates using the MAC channel of the eNB*/ if (enb_agent_msg_send(mod_id, ENB_AGENT_MAC, data, size, priority)) { - err_code = PROTOCOL__PROGRAN_ERR__MSG_ENQUEUING; + err_code = PROTOCOL__FLEXRAN_ERR__MSG_ENQUEUING; goto error; } @@ -1447,8 +1447,8 @@ err_code_t enb_agent_destroy_cont_mac_stats_update(mid_t mod_id) { /*Disable the continuous updates for the MAC*/ mac_stats_context[mod_id].cont_update = 0; mac_stats_context[mod_id].is_initialized = 0; - enb_agent_destroy_progran_message(mac_stats_context[mod_id].stats_req); - enb_agent_destroy_progran_message(mac_stats_context[mod_id].prev_stats_reply); + enb_agent_destroy_flexran_message(mac_stats_context[mod_id].stats_req); + enb_agent_destroy_flexran_message(mac_stats_context[mod_id].prev_stats_reply); free(mac_stats_context[mod_id].mutex); mac_agent_registered[mod_id] = NULL; @@ -1463,7 +1463,7 @@ err_code_t enb_agent_enable_cont_mac_stats_update(mid_t mod_id, goto error; } - Protocol__ProgranMessage *req_msg; + Protocol__FlexranMessage *req_msg; enb_agent_mac_stats_request(mod_id, xid, stats_req, &req_msg); mac_stats_context[mod_id].stats_req = req_msg; @@ -1490,10 +1490,10 @@ err_code_t enb_agent_disable_cont_mac_stats_update(mid_t mod_id) { mac_stats_context[mod_id].cont_update = 0; mac_stats_context[mod_id].xid = 0; if (mac_stats_context[mod_id].stats_req != NULL) { - enb_agent_destroy_progran_message(mac_stats_context[mod_id].stats_req); + enb_agent_destroy_flexran_message(mac_stats_context[mod_id].stats_req); } if (mac_stats_context[mod_id].prev_stats_reply != NULL) { - enb_agent_destroy_progran_message(mac_stats_context[mod_id].prev_stats_reply); + enb_agent_destroy_flexran_message(mac_stats_context[mod_id].prev_stats_reply); } if (pthread_mutex_unlock(mac_stats_context[mod_id].mutex)) { goto error; diff --git a/openair2/ENB_APP/enb_agent_mac.h b/openair2/ENB_APP/enb_agent_mac.h index 2a8f4c3a40..a6b9a0fe80 100644 --- a/openair2/ENB_APP/enb_agent_mac.h +++ b/openair2/ENB_APP/enb_agent_mac.h @@ -29,7 +29,7 @@ /*! \file enb_agent_mac.h * \brief enb agent message handler APIs for MAC layer - * \author Navid Nikaein and Xenofon Foukas + * \author Xenofon Foukas, Mohamed Kassem and Navid Nikaein * \date 2016 * \version 0.1 */ @@ -38,7 +38,7 @@ #define ENB_AGENT_MAC_H_ #include "header.pb-c.h" -#include "progran.pb-c.h" +#include "flexran.pb-c.h" #include "stats_messages.pb-c.h" #include "stats_common.pb-c.h" @@ -52,14 +52,14 @@ typedef struct { uint16_t ue_rnti; uint32_t ue_report_flags; /* Indicates the report elements required for this UE id. See - ProgRAN specification 1.2.4.2 */ + FlexRAN specification 1.2.4.2 */ } ue_report_type_t; typedef struct { uint16_t cc_id; uint32_t cc_report_flags; /* Indicates the report elements required for this CC index. See - ProgRAN specification 1.2.4.3 */ + FlexRAN specification 1.2.4.3 */ } cc_report_type_t; typedef struct { @@ -79,29 +79,29 @@ typedef struct stats_request_config_s{ /* Initialization function for the agent structures etc */ void enb_agent_init_mac_agent(mid_t mod_id); -int enb_agent_mac_handle_stats(mid_t mod_id, const void *params, Protocol__ProgranMessage **msg); +int enb_agent_mac_handle_stats(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg); -int enb_agent_mac_stats_request(mid_t mod_id, xid_t xid, const stats_request_config_t *report_config, Protocol__ProgranMessage **msg); +int enb_agent_mac_stats_request(mid_t mod_id, xid_t xid, const stats_request_config_t *report_config, Protocol__FlexranMessage **msg); -int enb_agent_mac_destroy_stats_request(Protocol__ProgranMessage *msg); +int enb_agent_mac_destroy_stats_request(Protocol__FlexranMessage *msg); -int enb_agent_mac_stats_reply(mid_t mod_id, xid_t xid, const report_config_t *report_config, Protocol__ProgranMessage **msg); +int enb_agent_mac_stats_reply(mid_t mod_id, xid_t xid, const report_config_t *report_config, Protocol__FlexranMessage **msg); -int enb_agent_mac_destroy_stats_reply(Protocol__ProgranMessage *msg); +int enb_agent_mac_destroy_stats_reply(Protocol__FlexranMessage *msg); -int enb_agent_mac_sr_info(mid_t mod_id, const void *params, Protocol__ProgranMessage **msg); +int enb_agent_mac_sr_info(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg); -int enb_agent_mac_destroy_sr_info(Protocol__ProgranMessage *msg); +int enb_agent_mac_destroy_sr_info(Protocol__FlexranMessage *msg); -int enb_agent_mac_sf_trigger(mid_t mod_id, const void *params, Protocol__ProgranMessage **msg); +int enb_agent_mac_sf_trigger(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg); -int enb_agent_mac_destroy_sf_trigger(Protocol__ProgranMessage *msg); +int enb_agent_mac_destroy_sf_trigger(Protocol__FlexranMessage *msg); -int enb_agent_mac_create_empty_dl_config(mid_t mod_id, Protocol__ProgranMessage **msg); +int enb_agent_mac_create_empty_dl_config(mid_t mod_id, Protocol__FlexranMessage **msg); -int enb_agent_mac_destroy_dl_config(Protocol__ProgranMessage *msg); +int enb_agent_mac_destroy_dl_config(Protocol__FlexranMessage *msg); -int enb_agent_mac_handle_dl_mac_config(mid_t mod_id, const void *params, Protocol__ProgranMessage **msg); +int enb_agent_mac_handle_dl_mac_config(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg); /********************************** @@ -119,7 +119,7 @@ void enb_agent_send_sf_trigger(mid_t mod_id); void enb_agent_send_update_mac_stats(mid_t mod_id); /// Provide to the scheduler a pending dl_mac_config message -void enb_agent_get_pending_dl_mac_config(mid_t mod_id, Protocol__ProgranMessage **msg); +void enb_agent_get_pending_dl_mac_config(mid_t mod_id, Protocol__FlexranMessage **msg); /*Register technology specific interface callbacks*/ int enb_agent_register_mac_xface(mid_t mod_id, AGENT_MAC_xface *xface); diff --git a/openair2/ENB_APP/enb_agent_mac_defs.h b/openair2/ENB_APP/enb_agent_mac_defs.h index 1511ee7262..cf473cae7d 100644 --- a/openair2/ENB_APP/enb_agent_mac_defs.h +++ b/openair2/ENB_APP/enb_agent_mac_defs.h @@ -39,7 +39,7 @@ #define __ENB_AGENT_MAC_PRIMITIVES_H__ #include "enb_agent_defs.h" -#include "progran.pb-c.h" +#include "flexran.pb-c.h" #include "header.pb-c.h" #define RINGBUFFER_SIZE 100 @@ -60,13 +60,13 @@ typedef struct { /// Provide to the scheduler a pending dl_mac_config message void (*enb_agent_get_pending_dl_mac_config)(mid_t mod_id, - Protocol__ProgranMessage **msg); + Protocol__FlexranMessage **msg); - /// Run the UE DL scheduler and fill the Protocol__ProgranMessage. Assumes that - /// dl_info is already initialized as prp_dl_mac_config and fills the - /// prp_dl_data part of it + /// Run the UE DL scheduler and fill the Protocol__FlexranMessage. Assumes that + /// dl_info is already initialized as flex_dl_mac_config and fills the + /// flex_dl_data part of it void (*enb_agent_schedule_ue_spec)(mid_t mod_id, uint32_t frame, uint32_t subframe, - int *mbsfn_flag, Protocol__ProgranMessage **dl_info); + int *mbsfn_flag, Protocol__FlexranMessage **dl_info); /// Notify the controller for a state change of a particular UE, by sending the proper diff --git a/openair2/ENB_APP/enb_agent_mac_internal.c b/openair2/ENB_APP/enb_agent_mac_internal.c index 4d5ba34610..b42b3ac79b 100644 --- a/openair2/ENB_APP/enb_agent_mac_internal.c +++ b/openair2/ENB_APP/enb_agent_mac_internal.c @@ -39,20 +39,20 @@ #include "enb_agent_mac_internal.h" -Protocol__ProgranMessage * enb_agent_generate_diff_mac_stats_report(Protocol__ProgranMessage *new_message, - Protocol__ProgranMessage *old_message) { +Protocol__FlexranMessage * enb_agent_generate_diff_mac_stats_report(Protocol__FlexranMessage *new_message, + Protocol__FlexranMessage *old_message) { int i, j; - Protocol__PrpStatsReply *old_report, *new_report; + Protocol__FlexStatsReply *old_report, *new_report; - Protocol__PrpStatsReply *stats_reply_msg = NULL; - Protocol__ProgranMessage *msg = NULL; + Protocol__FlexStatsReply *stats_reply_msg = NULL; + Protocol__FlexranMessage *msg = NULL; - Protocol__PrpUeStatsReport **ue_report; - Protocol__PrpUeStatsReport *tmp_ue_report[NUM_MAX_UE]; - Protocol__PrpCellStatsReport **cell_report; - Protocol__PrpCellStatsReport *tmp_cell_report[NUM_MAX_UE]; + Protocol__FlexUeStatsReport **ue_report; + Protocol__FlexUeStatsReport *tmp_ue_report[NUM_MAX_UE]; + Protocol__FlexCellStatsReport **cell_report; + Protocol__FlexCellStatsReport *tmp_cell_report[NUM_MAX_UE]; old_report = old_message->stats_reply_msg; new_report = new_message->stats_reply_msg; @@ -113,7 +113,7 @@ Protocol__ProgranMessage * enb_agent_generate_diff_mac_stats_report(Protocol__Pr /*TODO: create the reply message based on the findings*/ /*Create ue report list*/ if (n_ue_report > 0) { - ue_report = malloc(sizeof(Protocol__PrpUeStatsReport *)); + ue_report = malloc(sizeof(Protocol__FlexUeStatsReport *)); for (i = 0; i 0) { - cell_report = malloc(sizeof(Protocol__PrpCellStatsReport *)); + cell_report = malloc(sizeof(Protocol__FlexCellStatsReport *)); for (i = 0; i 0 || n_ue_report > 0) { /*Create header*/ int xid = old_report->header->xid; - Protocol__PrpHeader *header; - if (prp_create_header(xid, PROTOCOL__PRP_TYPE__PRPT_STATS_REPLY, &header) != 0) { + Protocol__FlexHeader *header; + if (flex_create_header(xid, PROTOCOL__FLEX_TYPE__FLPT_STATS_REPLY, &header) != 0) { goto error; } - stats_reply_msg = malloc(sizeof(Protocol__PrpStatsReply)); - protocol__prp_stats_reply__init(stats_reply_msg); + stats_reply_msg = malloc(sizeof(Protocol__FlexStatsReply)); + protocol__flex_stats_reply__init(stats_reply_msg); stats_reply_msg->header = header; stats_reply_msg->n_ue_report = n_ue_report; stats_reply_msg->ue_report = ue_report; stats_reply_msg->n_cell_report = n_cell_report; stats_reply_msg->cell_report = cell_report; - msg = malloc(sizeof(Protocol__ProgranMessage)); + msg = malloc(sizeof(Protocol__FlexranMessage)); if(msg == NULL) goto error; - protocol__progran_message__init(msg); - msg->msg_case = PROTOCOL__PROGRAN_MESSAGE__MSG_STATS_REPLY_MSG; - msg->msg_dir = PROTOCOL__PROGRAN_DIRECTION__SUCCESSFUL_OUTCOME; + protocol__flexran_message__init(msg); + msg->msg_case = PROTOCOL__FLEXRAN_MESSAGE__MSG_STATS_REPLY_MSG; + msg->msg_dir = PROTOCOL__FLEXRAN_DIRECTION__SUCCESSFUL_OUTCOME; msg->stats_reply_msg = stats_reply_msg; } return msg; @@ -155,28 +155,28 @@ Protocol__ProgranMessage * enb_agent_generate_diff_mac_stats_report(Protocol__Pr return NULL; } -int compare_ue_stats_reports(Protocol__PrpUeStatsReport *rep1, - Protocol__PrpUeStatsReport *rep2) { +int compare_ue_stats_reports(Protocol__FlexUeStatsReport *rep1, + Protocol__FlexUeStatsReport *rep2) { return 1; } -int compare_cell_stats_reports(Protocol__PrpCellStatsReport *rep1, - Protocol__PrpCellStatsReport *rep2) { +int compare_cell_stats_reports(Protocol__FlexCellStatsReport *rep1, + Protocol__FlexCellStatsReport *rep2) { return 1; } -Protocol__PrpUeStatsReport * copy_ue_stats_report(Protocol__PrpUeStatsReport * original) { +Protocol__FlexUeStatsReport * copy_ue_stats_report(Protocol__FlexUeStatsReport * original) { int i; - Protocol__PrpUeStatsReport *copy = malloc(sizeof(Protocol__PrpUeStatsReport)); + Protocol__FlexUeStatsReport *copy = malloc(sizeof(Protocol__FlexUeStatsReport)); if (copy == NULL) goto error; - protocol__prp_ue_stats_report__init(copy); + protocol__flex_ue_stats_report__init(copy); copy->rnti = original->rnti; copy->has_rnti = original->has_rnti; copy->flags = original->flags; copy->has_flags = original->has_flags; - if (copy->flags & PROTOCOL__PRP_UE_STATS_TYPE__PRUST_BSR) { + if (copy->flags & PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_BSR) { copy->n_bsr = original->n_bsr; if (copy->n_bsr > 0) { uint32_t *elem; @@ -190,16 +190,16 @@ Protocol__PrpUeStatsReport * copy_ue_stats_report(Protocol__PrpUeStatsReport * o } } - if (copy->flags & PROTOCOL__PRP_UE_STATS_TYPE__PRUST_PRH) { + if (copy->flags & PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_PRH) { copy->has_phr = original->has_phr; copy->phr = original->phr; } - if (copy->flags & PROTOCOL__PRP_UE_STATS_TYPE__PRUST_RLC_BS) { + if (copy->flags & PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_RLC_BS) { copy->n_rlc_report = original->n_rlc_report; if (copy->n_rlc_report > 0) { - Protocol__PrpRlcBsr ** rlc_reports; - rlc_reports = malloc(sizeof(Protocol__PrpRlcBsr) * copy->n_rlc_report); + Protocol__FlexRlcBsr ** rlc_reports; + rlc_reports = malloc(sizeof(Protocol__FlexRlcBsr) * copy->n_rlc_report); if (rlc_reports == NULL) goto error; for (i = 0; i < copy->n_rlc_report; i++) { @@ -209,22 +209,22 @@ Protocol__PrpUeStatsReport * copy_ue_stats_report(Protocol__PrpUeStatsReport * o } } - if (copy->flags & PROTOCOL__PRP_UE_STATS_TYPE__PRUST_MAC_CE_BS) { + if (copy->flags & PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_MAC_CE_BS) { copy->has_pending_mac_ces = original->has_pending_mac_ces; copy->pending_mac_ces = original->pending_mac_ces; } - if (copy->flags & PROTOCOL__PRP_UE_STATS_TYPE__PRUST_DL_CQI) { + if (copy->flags & PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_DL_CQI) { copy->dl_cqi_report = copy_dl_cqi_report(original->dl_cqi_report); } - if (copy->flags & PROTOCOL__PRP_UE_STATS_TYPE__PRUST_PBS) { + if (copy->flags & PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_PBS) { /*Copy the Paging Buffer report*/ copy->pbr = copy_paging_buffer_report(original->pbr); } - if (copy->flags & PROTOCOL__PRP_UE_STATS_TYPE__PRUST_UL_CQI) { + if (copy->flags & PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_UL_CQI) { /*TODO: Copy the UL report*/ copy->ul_cqi_report = copy_ul_cqi_report(original->ul_cqi_report); } @@ -235,11 +235,11 @@ Protocol__PrpUeStatsReport * copy_ue_stats_report(Protocol__PrpUeStatsReport * o return NULL; } -Protocol__PrpRlcBsr * copy_rlc_report(Protocol__PrpRlcBsr * original) { - Protocol__PrpRlcBsr * copy = malloc(sizeof(Protocol__PrpRlcBsr)); +Protocol__FlexRlcBsr * copy_rlc_report(Protocol__FlexRlcBsr * original) { + Protocol__FlexRlcBsr * copy = malloc(sizeof(Protocol__FlexRlcBsr)); if (copy == NULL) goto error; - protocol__prp_rlc_bsr__init(copy); + protocol__flex_rlc_bsr__init(copy); copy->lc_id = original->lc_id; copy->has_lc_id = original->has_lc_id; copy->tx_queue_size = original->tx_queue_size; @@ -259,30 +259,30 @@ Protocol__PrpRlcBsr * copy_rlc_report(Protocol__PrpRlcBsr * original) { return NULL; } -Protocol__PrpUlCqiReport * copy_ul_cqi_report(Protocol__PrpUlCqiReport * original) { +Protocol__FlexUlCqiReport * copy_ul_cqi_report(Protocol__FlexUlCqiReport * original) { int i, j; //Fill in the full UL CQI report of the UE - Protocol__PrpUlCqiReport *full_ul_report; - full_ul_report = malloc(sizeof(Protocol__PrpUlCqiReport)); + Protocol__FlexUlCqiReport *full_ul_report; + full_ul_report = malloc(sizeof(Protocol__FlexUlCqiReport)); if(full_ul_report == NULL) { goto error; } - protocol__prp_ul_cqi_report__init(full_ul_report); + protocol__flex_ul_cqi_report__init(full_ul_report); //TODO:Set the SFN and SF of the generated report full_ul_report->sfn_sn = original->sfn_sn; full_ul_report->has_sfn_sn = original->has_sfn_sn; full_ul_report->n_cqi_meas = original->n_cqi_meas; - Protocol__PrpUlCqi **ul_report; - ul_report = malloc(sizeof(Protocol__PrpUlCqi *) * full_ul_report->n_cqi_meas); + Protocol__FlexUlCqi **ul_report; + ul_report = malloc(sizeof(Protocol__FlexUlCqi *) * full_ul_report->n_cqi_meas); if(ul_report == NULL) goto error; for(i = 0; i++; i < full_ul_report->n_cqi_meas) { - ul_report[i] = malloc(sizeof(Protocol__PrpUlCqi)); + ul_report[i] = malloc(sizeof(Protocol__FlexUlCqi)); if(ul_report[i] == NULL) goto error; - protocol__prp_ul_cqi__init(ul_report[i]); + protocol__flex_ul_cqi__init(ul_report[i]); ul_report[i]->type = original->cqi_meas[i]->type; ul_report[i]->has_type = original->cqi_meas[i]->has_type; ul_report[i]->n_sinr = original->cqi_meas[i]->n_sinr; @@ -305,21 +305,21 @@ Protocol__PrpUlCqiReport * copy_ul_cqi_report(Protocol__PrpUlCqiReport * origina return NULL; } -Protocol__PrpDlCqiReport * copy_dl_cqi_report(Protocol__PrpDlCqiReport * original) { +Protocol__FlexDlCqiReport * copy_dl_cqi_report(Protocol__FlexDlCqiReport * original) { int i; /*Copy the DL report*/ - Protocol__PrpDlCqiReport * dl_report; - dl_report = malloc(sizeof(Protocol__PrpDlCqiReport)); + Protocol__FlexDlCqiReport * dl_report; + dl_report = malloc(sizeof(Protocol__FlexDlCqiReport)); if (dl_report == NULL) goto error; - protocol__prp_dl_cqi_report__init(dl_report); + protocol__flex_dl_cqi_report__init(dl_report); dl_report->sfn_sn = original->sfn_sn; dl_report->has_sfn_sn = original->has_sfn_sn; dl_report->n_csi_report = original->n_csi_report; - Protocol__PrpDlCsi **csi_reports; - csi_reports = malloc(sizeof(Protocol__PrpDlCsi *) * dl_report->n_csi_report); + Protocol__FlexDlCsi **csi_reports; + csi_reports = malloc(sizeof(Protocol__FlexDlCsi *) * dl_report->n_csi_report); if (csi_reports == NULL) goto error; @@ -334,26 +334,26 @@ Protocol__PrpDlCqiReport * copy_dl_cqi_report(Protocol__PrpDlCqiReport * origina return NULL; } -Protocol__PrpPagingBufferReport * copy_paging_buffer_report(Protocol__PrpPagingBufferReport *original) { +Protocol__FlexPagingBufferReport * copy_paging_buffer_report(Protocol__FlexPagingBufferReport *original) { int i; - Protocol__PrpPagingBufferReport *copy; - copy = malloc(sizeof(Protocol__PrpPagingBufferReport)); + Protocol__FlexPagingBufferReport *copy; + copy = malloc(sizeof(Protocol__FlexPagingBufferReport)); if (copy == NULL) goto error; - protocol__prp_paging_buffer_report__init(copy); + protocol__flex_paging_buffer_report__init(copy); copy->n_paging_info = original->n_paging_info; - Protocol__PrpPagingInfo **p_info; - p_info = malloc(sizeof(Protocol__PrpPagingInfo *) * copy->n_paging_info); + Protocol__FlexPagingInfo **p_info; + p_info = malloc(sizeof(Protocol__FlexPagingInfo *) * copy->n_paging_info); if (p_info == NULL) goto error; for (i = 0; i < copy->n_paging_info; i++) { - p_info[i] = malloc(sizeof(Protocol__PrpPagingInfo)); + p_info[i] = malloc(sizeof(Protocol__FlexPagingInfo)); if(p_info[i] == NULL) goto error; - protocol__prp_paging_info__init(p_info[i]); + protocol__flex_paging_info__init(p_info[i]); p_info[i]->paging_index = original->paging_info[i]->paging_index; p_info[i]->has_paging_index = original->paging_info[i]->has_paging_index;; p_info[i]->paging_message_size = original->paging_info[i]->paging_message_size; @@ -371,12 +371,12 @@ Protocol__PrpPagingBufferReport * copy_paging_buffer_report(Protocol__PrpPagingB return NULL; } -Protocol__PrpDlCsi * copy_csi_report(Protocol__PrpDlCsi * original) { +Protocol__FlexDlCsi * copy_csi_report(Protocol__FlexDlCsi * original) { int i, j; - Protocol__PrpDlCsi *copy = malloc(sizeof(Protocol__PrpDlCsi)); + Protocol__FlexDlCsi *copy = malloc(sizeof(Protocol__FlexDlCsi)); if (copy == NULL) goto error; - protocol__prp_dl_csi__init(copy); + protocol__flex_dl_csi__init(copy); copy->serv_cell_index = original->serv_cell_index; copy->has_serv_cell_index = original->has_serv_cell_index; copy->ri = original->ri; @@ -387,11 +387,11 @@ Protocol__PrpDlCsi * copy_csi_report(Protocol__PrpDlCsi * original) { copy->report_case = original->report_case; switch (copy->report_case) { - case PROTOCOL__PRP_DL_CSI__REPORT_P10CSI: + case PROTOCOL__FLEX_DL_CSI__REPORT_P10CSI: copy->p10csi->wb_cqi = original->p10csi->wb_cqi; copy->p10csi->has_wb_cqi = original->p10csi->has_wb_cqi; break; - case PROTOCOL__PRP_DL_CSI__REPORT_P11CSI: + case PROTOCOL__FLEX_DL_CSI__REPORT_P11CSI: copy->p11csi->n_wb_cqi = original->p11csi->n_wb_cqi; copy->p11csi->wb_cqi = (uint32_t *) malloc(sizeof(uint32_t) * copy->p11csi->n_wb_cqi); for (i = 0; i < copy->p11csi->n_wb_cqi; i++) { @@ -400,7 +400,7 @@ Protocol__PrpDlCsi * copy_csi_report(Protocol__PrpDlCsi * original) { copy->p11csi->has_wb_pmi = original->p11csi->has_wb_pmi; copy->p11csi->wb_pmi = original->p11csi->wb_pmi; break; - case PROTOCOL__PRP_DL_CSI__REPORT_P20CSI: + case PROTOCOL__FLEX_DL_CSI__REPORT_P20CSI: copy->p20csi->has_wb_cqi = original->p20csi->has_wb_cqi; copy->p20csi->wb_cqi = original->p20csi->wb_cqi; copy->p20csi->has_sb_cqi = original->p20csi->has_sb_cqi; @@ -410,7 +410,7 @@ Protocol__PrpDlCsi * copy_csi_report(Protocol__PrpDlCsi * original) { copy->p20csi->has_sb_index = original->p20csi->has_sb_index; copy->p20csi->sb_index = original->p20csi->sb_index; break; - case PROTOCOL__PRP_DL_CSI__REPORT_P21CSI: + case PROTOCOL__FLEX_DL_CSI__REPORT_P21CSI: copy->p21csi->n_wb_cqi = original->p21csi->n_wb_cqi; copy->p21csi->wb_cqi = (uint32_t *) malloc(sizeof(uint32_t) * copy->p21csi->n_wb_cqi); for (i = 0; i < copy->p21csi->n_wb_cqi; i++) { @@ -428,7 +428,7 @@ Protocol__PrpDlCsi * copy_csi_report(Protocol__PrpDlCsi * original) { copy->p21csi->has_sb_index = original->p21csi->has_sb_index; copy->p21csi->sb_index = original->p21csi->sb_index; break; - case PROTOCOL__PRP_DL_CSI__REPORT_A12CSI: + case PROTOCOL__FLEX_DL_CSI__REPORT_A12CSI: copy->a12csi->n_wb_cqi = original->a12csi->n_wb_cqi; copy->a12csi->wb_cqi = (uint32_t *) malloc(sizeof(uint32_t) * copy->a12csi->n_wb_cqi); for (i = 0; i < copy->a12csi->n_wb_cqi; i++) { @@ -440,7 +440,7 @@ Protocol__PrpDlCsi * copy_csi_report(Protocol__PrpDlCsi * original) { copy->a12csi->sb_pmi[i] = original->a12csi->sb_pmi[i]; } break; - case PROTOCOL__PRP_DL_CSI__REPORT_A22CSI: + case PROTOCOL__FLEX_DL_CSI__REPORT_A22CSI: copy->a22csi->n_wb_cqi = original->a22csi->n_wb_cqi; copy->a22csi->wb_cqi = (uint32_t *) malloc(sizeof(uint32_t) * copy->a22csi->n_wb_cqi); for (i = 0; i < copy->a22csi->n_wb_cqi; i++) { @@ -461,7 +461,7 @@ Protocol__PrpDlCsi * copy_csi_report(Protocol__PrpDlCsi * original) { copy->a22csi->sb_list[i] = original->a22csi->sb_list[i]; } break; - case PROTOCOL__PRP_DL_CSI__REPORT_A20CSI: + case PROTOCOL__FLEX_DL_CSI__REPORT_A20CSI: copy->a20csi->has_wb_cqi = original->a20csi->has_wb_cqi; copy->a20csi->wb_cqi = original->a20csi->wb_cqi; copy->a20csi->has_sb_cqi = original->a20csi->has_sb_cqi; @@ -472,7 +472,7 @@ Protocol__PrpDlCsi * copy_csi_report(Protocol__PrpDlCsi * original) { copy->a20csi->sb_list[i] = original->a20csi->sb_list[i]; } break; - case PROTOCOL__PRP_DL_CSI__REPORT_A30CSI: + case PROTOCOL__FLEX_DL_CSI__REPORT_A30CSI: copy->a30csi->has_wb_cqi = original->a30csi->has_wb_cqi; copy->a30csi->wb_cqi = original->a30csi->wb_cqi; copy->a30csi->n_sb_cqi = original->a30csi->n_sb_cqi; @@ -481,7 +481,7 @@ Protocol__PrpDlCsi * copy_csi_report(Protocol__PrpDlCsi * original) { copy->a30csi->sb_cqi[i] = original->a30csi->sb_cqi[i]; } break; - case PROTOCOL__PRP_DL_CSI__REPORT_A31CSI: + case PROTOCOL__FLEX_DL_CSI__REPORT_A31CSI: copy->a31csi->n_wb_cqi = original->a31csi->n_wb_cqi; copy->a31csi->wb_cqi = (uint32_t *) malloc(sizeof(uint32_t) * copy->a31csi->n_wb_cqi); for (i = 0; i < copy->a31csi->n_wb_cqi; i++) { @@ -490,16 +490,16 @@ Protocol__PrpDlCsi * copy_csi_report(Protocol__PrpDlCsi * original) { copy->a31csi->has_wb_pmi = original->a31csi->has_wb_pmi; copy->a31csi->wb_pmi = original->a31csi->wb_pmi; copy->a31csi->n_sb_cqi = original->a31csi->n_sb_cqi; - copy->a31csi->sb_cqi = malloc(sizeof(Protocol__PrpMsbCqi *) * copy->a31csi->n_sb_cqi); + copy->a31csi->sb_cqi = malloc(sizeof(Protocol__FlexMsbCqi *) * copy->a31csi->n_sb_cqi); if (copy->a31csi == NULL) { goto error; } for (i = 0; i < copy->a31csi->n_sb_cqi; i++) { - copy->a31csi->sb_cqi[i] = malloc(sizeof(Protocol__PrpMsbCqi)); + copy->a31csi->sb_cqi[i] = malloc(sizeof(Protocol__FlexMsbCqi)); if (copy->a31csi->sb_cqi[i] == NULL) { goto error; } - protocol__prp_msb_cqi__init(copy->a31csi->sb_cqi[i]); + protocol__flex_msb_cqi__init(copy->a31csi->sb_cqi[i]); copy->a31csi->sb_cqi[i]->n_sb_cqi = original->a31csi->sb_cqi[i]->n_sb_cqi; copy->a31csi->sb_cqi[i]->sb_cqi = (uint32_t *) malloc(sizeof(uint32_t) * copy->a31csi->sb_cqi[i]->n_sb_cqi); for (j = 0; j < copy->a31csi->sb_cqi[i]->n_sb_cqi; j++) { @@ -516,20 +516,20 @@ Protocol__PrpDlCsi * copy_csi_report(Protocol__PrpDlCsi * original) { return NULL; } -Protocol__PrpCellStatsReport * copy_cell_stats_report(Protocol__PrpCellStatsReport *original) { +Protocol__FlexCellStatsReport * copy_cell_stats_report(Protocol__FlexCellStatsReport *original) { - Protocol__PrpCellStatsReport * copy = malloc(sizeof(Protocol__PrpCellStatsReport)); + Protocol__FlexCellStatsReport * copy = malloc(sizeof(Protocol__FlexCellStatsReport)); if(copy == NULL) { goto error; } - protocol__prp_cell_stats_report__init(copy); + protocol__flex_cell_stats_report__init(copy); copy->carrier_index = original->carrier_index; copy->has_carrier_index = original->has_carrier_index; copy->flags = original->flags; copy->has_flags = original->has_flags; - if(copy->flags & PROTOCOL__PRP_CELL_STATS_TYPE__PRCST_NOISE_INTERFERENCE) { + if(copy->flags & PROTOCOL__FLEX_CELL_STATS_TYPE__FLCST_NOISE_INTERFERENCE) { copy->noise_inter_report = copy_noise_inter_report(original->noise_inter_report); } @@ -539,13 +539,13 @@ Protocol__PrpCellStatsReport * copy_cell_stats_report(Protocol__PrpCellStatsRepo return NULL; } -Protocol__PrpNoiseInterferenceReport * copy_noise_inter_report(Protocol__PrpNoiseInterferenceReport *original) { - Protocol__PrpNoiseInterferenceReport *ni_report; - ni_report = malloc(sizeof(Protocol__PrpNoiseInterferenceReport)); +Protocol__FlexNoiseInterferenceReport * copy_noise_inter_report(Protocol__FlexNoiseInterferenceReport *original) { + Protocol__FlexNoiseInterferenceReport *ni_report; + ni_report = malloc(sizeof(Protocol__FlexNoiseInterferenceReport)); if(ni_report == NULL) { goto error; } - protocol__prp_noise_interference_report__init(ni_report); + protocol__flex_noise_interference_report__init(ni_report); // Current frame and subframe number ni_report->sfn_sf = original->sfn_sf; ni_report->has_sfn_sf = original->sfn_sf; diff --git a/openair2/ENB_APP/enb_agent_mac_internal.h b/openair2/ENB_APP/enb_agent_mac_internal.h index 4a76f0ed38..86a021f946 100644 --- a/openair2/ENB_APP/enb_agent_mac_internal.h +++ b/openair2/ENB_APP/enb_agent_mac_internal.h @@ -53,8 +53,8 @@ typedef struct { uint8_t is_initialized; volatile uint8_t cont_update; xid_t xid; - Protocol__ProgranMessage *stats_req; - Protocol__ProgranMessage *prev_stats_reply; + Protocol__FlexranMessage *stats_req; + Protocol__FlexranMessage *prev_stats_reply; pthread_mutex_t *mutex; } mac_stats_updates_context_t; @@ -75,30 +75,30 @@ err_code_t enb_agent_enable_cont_mac_stats_update(mid_t mod_id, xid_t xid, err_code_t enb_agent_disable_cont_mac_stats_update(mid_t mod_id); -Protocol__ProgranMessage * enb_agent_generate_diff_mac_stats_report(Protocol__ProgranMessage *new_report, - Protocol__ProgranMessage *old_report); +Protocol__FlexranMessage * enb_agent_generate_diff_mac_stats_report(Protocol__FlexranMessage *new_report, + Protocol__FlexranMessage *old_report); -Protocol__PrpUeStatsReport * copy_ue_stats_report(Protocol__PrpUeStatsReport * original); +Protocol__FlexUeStatsReport * copy_ue_stats_report(Protocol__FlexUeStatsReport * original); -Protocol__PrpCellStatsReport * copy_cell_stats_report(Protocol__PrpCellStatsReport *original); +Protocol__FlexCellStatsReport * copy_cell_stats_report(Protocol__FlexCellStatsReport *original); -Protocol__PrpRlcBsr * copy_rlc_report(Protocol__PrpRlcBsr * original); +Protocol__FlexRlcBsr * copy_rlc_report(Protocol__FlexRlcBsr * original); -Protocol__PrpUlCqiReport * copy_ul_cqi_report(Protocol__PrpUlCqiReport * original); +Protocol__FlexUlCqiReport * copy_ul_cqi_report(Protocol__FlexUlCqiReport * original); -Protocol__PrpDlCqiReport * copy_dl_cqi_report(Protocol__PrpDlCqiReport * original); +Protocol__FlexDlCqiReport * copy_dl_cqi_report(Protocol__FlexDlCqiReport * original); -Protocol__PrpPagingBufferReport * copy_paging_buffer_report(Protocol__PrpPagingBufferReport *original); +Protocol__FlexPagingBufferReport * copy_paging_buffer_report(Protocol__FlexPagingBufferReport *original); -Protocol__PrpDlCsi * copy_csi_report(Protocol__PrpDlCsi * original); +Protocol__FlexDlCsi * copy_csi_report(Protocol__FlexDlCsi * original); -Protocol__PrpNoiseInterferenceReport * copy_noise_inter_report(Protocol__PrpNoiseInterferenceReport *original); +Protocol__FlexNoiseInterferenceReport * copy_noise_inter_report(Protocol__FlexNoiseInterferenceReport *original); -int compare_ue_stats_reports(Protocol__PrpUeStatsReport *rep1, - Protocol__PrpUeStatsReport *rep2); +int compare_ue_stats_reports(Protocol__FlexUeStatsReport *rep1, + Protocol__FlexUeStatsReport *rep2); -int compare_cell_stats_reports(Protocol__PrpCellStatsReport *rep1, - Protocol__PrpCellStatsReport *rep2); +int compare_cell_stats_reports(Protocol__FlexCellStatsReport *rep1, + Protocol__FlexCellStatsReport *rep2); /* Functions for parsing the MAC agent policy reconfiguration command */ diff --git a/openair2/ENB_APP/enb_agent_task_manager.c b/openair2/ENB_APP/enb_agent_task_manager.c index e2c31319e4..9b4be2ff6a 100644 --- a/openair2/ENB_APP/enb_agent_task_manager.c +++ b/openair2/ENB_APP/enb_agent_task_manager.c @@ -48,7 +48,7 @@ #define RIGHT(x) (2 * (x) + 2) #define PARENT(x) ((x - 1) / 2) -enb_agent_task_t *enb_agent_task_create(Protocol__ProgranMessage *msg, +enb_agent_task_t *enb_agent_task_create(Protocol__FlexranMessage *msg, uint16_t frame_num, uint8_t subframe_num) { enb_agent_task_t *task = NULL; task = malloc(sizeof(enb_agent_task_t)); diff --git a/openair2/ENB_APP/enb_agent_task_manager.h b/openair2/ENB_APP/enb_agent_task_manager.h index ef60152b27..0c458061cf 100644 --- a/openair2/ENB_APP/enb_agent_task_manager.h +++ b/openair2/ENB_APP/enb_agent_task_manager.h @@ -41,7 +41,7 @@ #include #include -#include "progran.pb-c.h" +#include "flexran.pb-c.h" #include "enb_agent_common.h" @@ -59,8 +59,8 @@ typedef struct enb_agent_task_s { uint16_t frame_num; /* The subframe in which the task needs to be executed */ uint8_t subframe_num; - /* The task to be executed in the form of a Protocol__ProgranMessage */ - Protocol__ProgranMessage *task; + /* The task to be executed in the form of a Protocol__FlexranMessage */ + Protocol__FlexranMessage *task; } enb_agent_task_t; /** @@ -95,7 +95,7 @@ typedef enum { /** * Allocate memory for a task in the queue */ -enb_agent_task_t *enb_agent_task_create(Protocol__ProgranMessage *msg, +enb_agent_task_t *enb_agent_task_create(Protocol__FlexranMessage *msg, uint16_t frame_num, uint8_t subframe_num); /** diff --git a/openair2/LAYER2/MAC/eNB_agent_scheduler_dataplane.c b/openair2/LAYER2/MAC/eNB_agent_scheduler_dataplane.c index b2a66bfe2d..b75b0467b1 100644 --- a/openair2/LAYER2/MAC/eNB_agent_scheduler_dataplane.c +++ b/openair2/LAYER2/MAC/eNB_agent_scheduler_dataplane.c @@ -48,7 +48,7 @@ #include "LAYER2/MAC/defs.h" #include "LAYER2/MAC/proto.h" #include "LAYER2/MAC/extern.h" -#include "LAYER2/MAC/progran_dci_conversions.h" +#include "LAYER2/MAC/flexran_dci_conversions.h" #include "UTIL/LOG/log.h" #include "UTIL/LOG/vcd_signal_dumper.h" @@ -60,7 +60,7 @@ #include "RRC/L2_INTERFACE/openair_rrc_L2_interface.h" #include "header.pb-c.h" -#include "progran.pb-c.h" +#include "flexran.pb-c.h" #include "SIMULATION/TOOLS/defs.h" // for taus @@ -69,9 +69,9 @@ void apply_dl_scheduling_decisions(mid_t mod_id, uint32_t frame, uint32_t subframe, int *mbsfn_flag, - const Protocol__ProgranMessage *dl_scheduling_info) { + const Protocol__FlexranMessage *dl_scheduling_info) { - Protocol__PrpDlMacConfig *mac_config = dl_scheduling_info->dl_mac_config_msg; + Protocol__FlexDlMacConfig *mac_config = dl_scheduling_info->dl_mac_config_msg; // Check if there is anything to schedule for random access if (mac_config->n_dl_rar > 0) { @@ -97,7 +97,7 @@ void apply_ue_spec_scheduling_decisions(mid_t mod_id, uint32_t subframe, int *mbsfn_flag, uint32_t n_dl_ue_data, - const Protocol__PrpDlData **dl_ue_data) { + const Protocol__FlexDlData **dl_ue_data) { uint8_t CC_id; int UE_id; @@ -128,8 +128,8 @@ void apply_ue_spec_scheduling_decisions(mid_t mod_id, int i; - Protocol__PrpDlData *dl_data; - Protocol__PrpDlDci *dl_dci; + Protocol__FlexDlData *dl_data; + Protocol__FlexDlDci *dl_dci; uint32_t rlc_size, n_lc, lcid; @@ -161,7 +161,7 @@ void apply_ue_spec_scheduling_decisions(mid_t mod_id, if (dl_data->n_ce_bitmap > 0) { //Check if there is TA command and set the length appropriately - ta_len = (dl_data->ce_bitmap[0] & PROTOCOL__PRP_CE_TYPE__PRPCET_TA) ? 2 : 0; + ta_len = (dl_data->ce_bitmap[0] & PROTOCOL__FLEX_CE_TYPE__FLPCET_TA) ? 2 : 0; } if (ta_len > 0) { @@ -359,7 +359,7 @@ void apply_ue_spec_scheduling_decisions(mid_t mod_id, } void fill_oai_dci(mid_t mod_id, uint32_t CC_id, uint32_t rnti, - const Protocol__PrpDlDci *dl_dci) { + const Protocol__FlexDlDci *dl_dci) { void *DLSCH_dci = NULL; DCI_PDU *DCI_pdu; @@ -397,92 +397,92 @@ void fill_oai_dci(mid_t mod_id, uint32_t CC_id, uint32_t rnti, switch (frame_parms[CC_id]->N_RB_DL) { case 6: if (frame_parms[CC_id]->frame_type == TDD) { - if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1) { + if (dl_dci->format == PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_1) { FILL_DCI_TDD_1(DCI1_1_5MHz_TDD_t, DLSCH_dci, dl_dci); size_bytes = sizeof(DCI1_1_5MHz_TDD_t); size_bits = sizeof_DCI1_1_5MHz_TDD_t; - } else if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_2A) { + } else if (dl_dci->format == PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_2A) { //TODO - } else if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1D) { + } else if (dl_dci->format == PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_1D) { //TODO } } else { - if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1) { + if (dl_dci->format == PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_1) { FILL_DCI_FDD_1(DCI1_1_5MHz_FDD_t, DLSCH_dci, dl_dci); size_bytes = sizeof(DCI1_1_5MHz_FDD_t); size_bits = sizeof_DCI1_1_5MHz_FDD_t; - } else if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_2A) { + } else if (dl_dci->format == PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_2A) { //TODO - } else if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1D) { + } else if (dl_dci->format == PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_1D) { //TODO } } break; case 25: if (frame_parms[CC_id]->frame_type == TDD) { - if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1) { + if (dl_dci->format == PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_1) { FILL_DCI_TDD_1(DCI1_5MHz_TDD_t, DLSCH_dci, dl_dci); size_bytes = sizeof(DCI1_5MHz_TDD_t); size_bits = sizeof_DCI1_5MHz_TDD_t; - } else if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_2A) { + } else if (dl_dci->format == PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_2A) { //TODO - } else if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1D) { + } else if (dl_dci->format == PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_1D) { //TODO } } else { - if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1) { + if (dl_dci->format == PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_1) { FILL_DCI_FDD_1(DCI1_5MHz_FDD_t, DLSCH_dci, dl_dci); size_bytes = sizeof(DCI1_5MHz_FDD_t); size_bits = sizeof_DCI1_5MHz_FDD_t; - } else if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_2A) { + } else if (dl_dci->format == PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_2A) { //TODO - } else if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1D) { + } else if (dl_dci->format == PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_1D) { //TODO } } break; case 50: if (frame_parms[CC_id]->frame_type == TDD) { - if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1) { + if (dl_dci->format == PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_1) { FILL_DCI_TDD_1(DCI1_10MHz_TDD_t, DLSCH_dci, dl_dci); size_bytes = sizeof(DCI1_10MHz_TDD_t); size_bits = sizeof_DCI1_10MHz_TDD_t; - } else if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_2A) { + } else if (dl_dci->format == PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_2A) { //TODO - } else if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1D) { + } else if (dl_dci->format == PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_1D) { //TODO } } else { - if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1) { + if (dl_dci->format == PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_1) { FILL_DCI_FDD_1(DCI1_10MHz_FDD_t, DLSCH_dci, dl_dci); size_bytes = sizeof(DCI1_10MHz_FDD_t); size_bits = sizeof_DCI1_10MHz_FDD_t; - } else if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_2A) { + } else if (dl_dci->format == PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_2A) { //TODO - } else if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1D) { + } else if (dl_dci->format == PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_1D) { //TODO } } break; case 100: if (frame_parms[CC_id]->frame_type == TDD) { - if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1) { + if (dl_dci->format == PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_1) { FILL_DCI_TDD_1(DCI1_20MHz_TDD_t, DLSCH_dci, dl_dci); size_bytes = sizeof(DCI1_20MHz_TDD_t); size_bits = sizeof_DCI1_20MHz_TDD_t; - } else if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_2A) { + } else if (dl_dci->format == PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_2A) { //TODO - } else if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1D) { + } else if (dl_dci->format == PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_1D) { //TODO } } else { - if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1) { + if (dl_dci->format == PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_1) { FILL_DCI_FDD_1(DCI1_20MHz_FDD_t, DLSCH_dci, dl_dci); size_bytes = sizeof(DCI1_20MHz_FDD_t); size_bits = sizeof_DCI1_20MHz_FDD_t; - } else if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_2A) { + } else if (dl_dci->format == PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_2A) { //TODO - } else if (dl_dci->format == PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1D) { + } else if (dl_dci->format == PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_1D) { //TODO } } @@ -491,31 +491,31 @@ void fill_oai_dci(mid_t mod_id, uint32_t CC_id, uint32_t rnti, //Set format to the proper type switch(dl_dci->format) { - case PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1: + case PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_1: format = format1; break; - case PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1A: + case PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_1A: format = format1A; break; - case PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1B: + case PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_1B: format = format1B; break; - case PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1C: + case PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_1C: format = format1C; break; - case PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1D: + case PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_1D: format = format1E_2A_M10PRB; break; - case PROTOCOL__PRP_DCI_FORMAT__PRDCIF_2: + case PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_2: format = format2; break; - case PROTOCOL__PRP_DCI_FORMAT__PRDCIF_2A: + case PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_2A: format = format2A; break; - case PROTOCOL__PRP_DCI_FORMAT__PRDCIF_2B: + case PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_2B: format = format2B; break; - case PROTOCOL__PRP_DCI_FORMAT__PRDCIF_3: + case PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_3: format = 3; break; default: diff --git a/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c b/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c index e1e22de549..90d5ad5f1b 100644 --- a/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c +++ b/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c @@ -63,7 +63,7 @@ #include "pdcp.h" #include "header.pb-c.h" -#include "progran.pb-c.h" +#include "flexran.pb-c.h" #include "enb_agent_mac.h" #include "SIMULATION/TOOLS/defs.h" // for taus @@ -81,7 +81,7 @@ schedule_ue_spec_default( uint32_t frame, uint32_t subframe, int *mbsfn_flag, - Protocol__ProgranMessage **dl_info + Protocol__FlexranMessage **dl_info ) //------------------------------------------------------------------------------ { @@ -109,14 +109,14 @@ schedule_ue_spec_default( static int32_t tpc_accumulated=0; UE_sched_ctrl *ue_sched_ctl; - Protocol__PrpDlData *dl_data[NUM_MAX_UE]; + Protocol__FlexDlData *dl_data[NUM_MAX_UE]; int num_ues_added = 0; int channels_added = 0; - Protocol__PrpDlDci *dl_dci; - Protocol__PrpRlcPdu *rlc_pdus[11]; + Protocol__FlexDlDci *dl_dci; + Protocol__FlexRlcPdu *rlc_pdus[11]; uint32_t *ce_bitmap; - Protocol__PrpRlcPdu **rlc_pdu; + Protocol__FlexRlcPdu **rlc_pdu; int num_tb; uint32_t ce_flags = 0; @@ -216,8 +216,8 @@ schedule_ue_spec_default( channels_added = 0; // After this point all the UEs will be scheduled - dl_data[num_ues_added] = (Protocol__PrpDlData *) malloc(sizeof(Protocol__PrpDlData)); - protocol__prp_dl_data__init(dl_data[num_ues_added]); + dl_data[num_ues_added] = (Protocol__FlexDlData *) malloc(sizeof(Protocol__FlexDlData)); + protocol__flex_dl_data__init(dl_data[num_ues_added]); dl_data[num_ues_added]->has_rnti = 1; dl_data[num_ues_added]->rnti = rnti; dl_data[num_ues_added]->n_rlc_pdu = 0; @@ -258,8 +258,8 @@ schedule_ue_spec_default( eNB_UE_stats->DL_cqi[0], mcs, UE_list->eNB_UE_stats[CC_id][UE_id].rrc_status); - dl_dci = (Protocol__PrpDlDci*) malloc(sizeof(Protocol__PrpDlDci)); - protocol__prp_dl_dci__init(dl_dci); + dl_dci = (Protocol__FlexDlDci*) malloc(sizeof(Protocol__FlexDlDci)); + protocol__flex_dl_dci__init(dl_dci); dl_data[num_ues_added]->dl_dci = dl_dci; @@ -353,12 +353,12 @@ schedule_ue_spec_default( dl_data[num_ues_added]->ce_bitmap = (uint32_t *) malloc(sizeof(uint32_t) * 2); if (ta_len > 0) { - ce_flags |= PROTOCOL__PRP_CE_TYPE__PRPCET_TA; + ce_flags |= PROTOCOL__FLEX_CE_TYPE__FLPCET_TA; } /*TODO: Add other flags if DRX and other CE are required*/ - // Add the control element flags to the progran message + // Add the control element flags to the flexran message dl_data[num_ues_added]->ce_bitmap[0] = ce_flags; dl_data[num_ues_added]->ce_bitmap[1] = ce_flags; @@ -394,18 +394,18 @@ schedule_ue_spec_default( data_to_request++; //It is not correct but fixes some RLC bug for DCCH } LOG_D(MAC, "[TEST]Will request %d from DCCH\n", data_to_request); - rlc_pdus[channels_added] = (Protocol__PrpRlcPdu *) malloc(sizeof(Protocol__PrpRlcPdu)); - protocol__prp_rlc_pdu__init(rlc_pdus[channels_added]); + rlc_pdus[channels_added] = (Protocol__FlexRlcPdu *) malloc(sizeof(Protocol__FlexRlcPdu)); + protocol__flex_rlc_pdu__init(rlc_pdus[channels_added]); rlc_pdus[channels_added]->n_rlc_pdu_tb = 2; - rlc_pdus[channels_added]->rlc_pdu_tb = (Protocol__PrpRlcPduTb **) malloc(sizeof(Protocol__PrpRlcPduTb *) * 2); - rlc_pdus[channels_added]->rlc_pdu_tb[0] = (Protocol__PrpRlcPduTb *) malloc(sizeof(Protocol__PrpRlcPduTb)); - protocol__prp_rlc_pdu_tb__init(rlc_pdus[channels_added]->rlc_pdu_tb[0]); + rlc_pdus[channels_added]->rlc_pdu_tb = (Protocol__FlexRlcPduTb **) malloc(sizeof(Protocol__FlexRlcPduTb *) * 2); + rlc_pdus[channels_added]->rlc_pdu_tb[0] = (Protocol__FlexRlcPduTb *) malloc(sizeof(Protocol__FlexRlcPduTb)); + protocol__flex_rlc_pdu_tb__init(rlc_pdus[channels_added]->rlc_pdu_tb[0]); rlc_pdus[channels_added]->rlc_pdu_tb[0]->has_logical_channel_id = 1; rlc_pdus[channels_added]->rlc_pdu_tb[0]->logical_channel_id = j; rlc_pdus[channels_added]->rlc_pdu_tb[0]->has_size = 1; rlc_pdus[channels_added]->rlc_pdu_tb[0]->size = data_to_request; - rlc_pdus[channels_added]->rlc_pdu_tb[1] = (Protocol__PrpRlcPduTb *) malloc(sizeof(Protocol__PrpRlcPduTb)); - protocol__prp_rlc_pdu_tb__init(rlc_pdus[channels_added]->rlc_pdu_tb[1]); + rlc_pdus[channels_added]->rlc_pdu_tb[1] = (Protocol__FlexRlcPduTb *) malloc(sizeof(Protocol__FlexRlcPduTb)); + protocol__flex_rlc_pdu_tb__init(rlc_pdus[channels_added]->rlc_pdu_tb[1]); rlc_pdus[channels_added]->rlc_pdu_tb[1]->has_logical_channel_id = 1; rlc_pdus[channels_added]->rlc_pdu_tb[1]->logical_channel_id = j; rlc_pdus[channels_added]->rlc_pdu_tb[1]->has_size = 1; @@ -422,7 +422,7 @@ schedule_ue_spec_default( } // End of iterating the logical channels // Add rlc_pdus to the dl_data message - dl_data[num_ues_added]->rlc_pdu = (Protocol__PrpRlcPdu **) malloc(sizeof(Protocol__PrpRlcPdu *) * + dl_data[num_ues_added]->rlc_pdu = (Protocol__FlexRlcPdu **) malloc(sizeof(Protocol__FlexRlcPdu *) * dl_data[num_ues_added]->n_rlc_pdu); for (i = 0; i < dl_data[num_ues_added]->n_rlc_pdu; i++) { dl_data[num_ues_added]->rlc_pdu[i] = rlc_pdus[i]; @@ -595,9 +595,9 @@ schedule_ue_spec_default( dl_dci->has_res_alloc = 1; dl_dci->res_alloc = 0; dl_dci->has_vrb_format = 1; - dl_dci->vrb_format = PROTOCOL__PRP_VRB_FORMAT__PRVRBF_LOCALIZED; + dl_dci->vrb_format = PROTOCOL__FLEX_VRB_FORMAT__FLVRBF_LOCALIZED; dl_dci->has_format = 1; - dl_dci->format = PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1; + dl_dci->format = PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_1; dl_dci->has_rb_bitmap = 1; dl_dci->rb_bitmap = allocate_prbs_sub(nb_rb, rballoc_sub); dl_dci->has_rb_shift = 1; @@ -625,9 +625,9 @@ schedule_ue_spec_default( dl_dci->has_res_alloc = 1; dl_dci->res_alloc = 0; dl_dci->has_vrb_format = 1; - dl_dci->vrb_format = PROTOCOL__PRP_VRB_FORMAT__PRVRBF_LOCALIZED; + dl_dci->vrb_format = PROTOCOL__FLEX_VRB_FORMAT__FLVRBF_LOCALIZED; dl_dci->has_format = 1; - dl_dci->format = PROTOCOL__PRP_DCI_FORMAT__PRDCIF_2A; + dl_dci->format = PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_2A; dl_dci->has_rb_bitmap = 1; dl_dci->rb_bitmap = allocate_prbs_sub(nb_rb, rballoc_sub); dl_dci->has_rb_shift = 1; @@ -659,9 +659,9 @@ schedule_ue_spec_default( dl_dci->has_res_alloc = 1; dl_dci->res_alloc = 0; dl_dci->has_vrb_format = 1; - dl_dci->vrb_format = PROTOCOL__PRP_VRB_FORMAT__PRVRBF_LOCALIZED; + dl_dci->vrb_format = PROTOCOL__FLEX_VRB_FORMAT__FLVRBF_LOCALIZED; dl_dci->has_format = 1; - dl_dci->format = PROTOCOL__PRP_DCI_FORMAT__PRDCIF_2A; + dl_dci->format = PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_2A; dl_dci->has_rb_bitmap = 1; dl_dci->rb_bitmap = allocate_prbs_sub(nb_rb, rballoc_sub); dl_dci->has_rb_shift = 1; @@ -693,9 +693,9 @@ schedule_ue_spec_default( dl_dci->has_res_alloc = 1; dl_dci->res_alloc = 0; dl_dci->has_vrb_format = 1; - dl_dci->vrb_format = PROTOCOL__PRP_VRB_FORMAT__PRVRBF_LOCALIZED; + dl_dci->vrb_format = PROTOCOL__FLEX_VRB_FORMAT__FLVRBF_LOCALIZED; dl_dci->has_format = 1; - dl_dci->format = PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1D; + dl_dci->format = PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_1D; dl_dci->has_rb_bitmap = 1; dl_dci->rb_bitmap = allocate_prbs_sub(nb_rb, rballoc_sub); dl_dci->has_rb_shift = 1; @@ -733,9 +733,9 @@ schedule_ue_spec_default( dl_dci->has_res_alloc = 1; dl_dci->res_alloc = 0; dl_dci->has_vrb_format = 1; - dl_dci->vrb_format = PROTOCOL__PRP_VRB_FORMAT__PRVRBF_LOCALIZED; + dl_dci->vrb_format = PROTOCOL__FLEX_VRB_FORMAT__FLVRBF_LOCALIZED; dl_dci->has_format = 1; - dl_dci->format = PROTOCOL__PRP_DCI_FORMAT__PRDCIF_1D; + dl_dci->format = PROTOCOL__FLEX_DCI_FORMAT__FLDCIF_1D; dl_dci->has_rb_bitmap = 1; dl_dci->rb_bitmap = allocate_prbs_sub(nb_rb, rballoc_sub); dl_dci->has_rb_shift = 1; @@ -770,9 +770,9 @@ schedule_ue_spec_default( } // UE_id loop } // CC_id loop - // Add all the dl_data elements to the progran message + // Add all the dl_data elements to the flexran message (*dl_info)->dl_mac_config_msg->n_dl_ue_data = num_ues_added; - (*dl_info)->dl_mac_config_msg->dl_ue_data = (Protocol__PrpDlData **) malloc(sizeof(Protocol__PrpDlData *) * num_ues_added); + (*dl_info)->dl_mac_config_msg->dl_ue_data = (Protocol__FlexDlData **) malloc(sizeof(Protocol__FlexDlData *) * num_ues_added); for (i = 0; i < num_ues_added; i++) { (*dl_info)->dl_mac_config_msg->dl_ue_data[i] = dl_data[i]; } diff --git a/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue_remote.c b/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue_remote.c index d8d2373332..b5882c84e3 100644 --- a/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue_remote.c +++ b/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue_remote.c @@ -53,7 +53,7 @@ int queue_initialized = 0; //uint32_t sched [] = {1, 2, 3}; void schedule_ue_spec_remote(mid_t mod_id, uint32_t frame, uint32_t subframe, - int *mbsfn_flag, Protocol__ProgranMessage **dl_info) { + int *mbsfn_flag, Protocol__FlexranMessage **dl_info) { //if ((subframe == skip_subframe) && (frame % period == 0)) { diff --git a/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue_remote.h b/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue_remote.h index 7d2c2cbc6f..9ff750969b 100644 --- a/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue_remote.h +++ b/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue_remote.h @@ -40,7 +40,7 @@ #ifndef __LAYER2_MAC_ENB_AGENT_SCHEDULER_DLSCH_UE_REMOTE_H__ #define __LAYER2_MAC_ENB_AGENT_SCHEDULER_DLSCH_UE_REMOTE_H___ -#include "progran.pb-c.h" +#include "flexran.pb-c.h" #include "header.pb-c.h" #include "ENB_APP/enb_agent_defs.h" @@ -54,7 +54,7 @@ #define SCHED_AHEAD_SUBFRAMES 20 typedef struct dl_mac_config_element_s { - Protocol__ProgranMessage *dl_info; + Protocol__FlexranMessage *dl_info; TAILQ_ENTRY(dl_mac_config_element_s) configs; } dl_mac_config_element_t; @@ -64,7 +64,7 @@ TAILQ_HEAD(DlMacConfigHead, dl_mac_config_element_s); * Default scheduler used by the eNB agent */ void schedule_ue_spec_remote(mid_t mod_id, uint32_t frame, uint32_t subframe, - int *mbsfn_flag, Protocol__ProgranMessage **dl_info); + int *mbsfn_flag, Protocol__FlexranMessage **dl_info); // Find the difference in subframes from the given subframe diff --git a/openair2/LAYER2/MAC/eNB_scheduler.c b/openair2/LAYER2/MAC/eNB_scheduler.c index f83606eddf..b57f5e965b 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler.c +++ b/openair2/LAYER2/MAC/eNB_scheduler.c @@ -103,7 +103,7 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, void *DLSCH_dci=NULL; int size_bits=0,size_bytes=0; - Protocol__ProgranMessage *msg; + Protocol__FlexranMessage *msg; LOG_D(MAC,"[eNB %d] Frame %d, Subframe %d, entering MAC scheduler (UE_list->head %d)\n",module_idP, frameP, subframeP,UE_list->head); @@ -143,7 +143,7 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, if (mac_agent_registered[module_idP]) { agent_mac_xface[module_idP]->enb_agent_notify_ue_state_change(module_idP, rnti, - PROTOCOL__PRP_UE_STATE_CHANGE_TYPE__PRUESC_DEACTIVATED); + PROTOCOL__FLEX_UE_STATE_CHANGE_TYPE__FLUESC_DEACTIVATED); } } else { diff --git a/openair2/LAYER2/MAC/enb_agent_mac_proto.h b/openair2/LAYER2/MAC/enb_agent_mac_proto.h index f453fa2fa3..3c2d36e678 100644 --- a/openair2/LAYER2/MAC/enb_agent_mac_proto.h +++ b/openair2/LAYER2/MAC/enb_agent_mac_proto.h @@ -42,29 +42,29 @@ #include "enb_agent_defs.h" #include "header.pb-c.h" -#include "progran.pb-c.h" +#include "flexran.pb-c.h" /* * Default scheduler used by the eNB agent */ void schedule_ue_spec_default(mid_t mod_id, uint32_t frame, uint32_t subframe, - int *mbsfn_flag, Protocol__ProgranMessage **dl_info); + int *mbsfn_flag, Protocol__FlexranMessage **dl_info); /* * Data plane function for applying the DL decisions of the scheduler */ void apply_dl_scheduling_decisions(mid_t mod_id, uint32_t frame, uint32_t subframe, int *mbsfn_flag, - const Protocol__ProgranMessage *dl_scheduling_info); + const Protocol__FlexranMessage *dl_scheduling_info); /* * Data plane function for applying the UE specific DL decisions of the scheduler */ void apply_ue_spec_scheduling_decisions(mid_t mod_id, uint32_t frame, uint32_t subframe, int *mbsfn_flag, - uint32_t n_dl_ue_data, const Protocol__PrpDlData **dl_ue_data); + uint32_t n_dl_ue_data, const Protocol__FlexDlData **dl_ue_data); /* * Data plane function for filling the DCI structure */ -void fill_oai_dci(mid_t mod_id, uint32_t CC_id, uint32_t rnti, const Protocol__PrpDlDci *dl_dci); +void fill_oai_dci(mid_t mod_id, uint32_t CC_id, uint32_t rnti, const Protocol__FlexDlDci *dl_dci); #endif diff --git a/openair2/LAYER2/MAC/progran_dci_conversions.h b/openair2/LAYER2/MAC/flexran_dci_conversions.h similarity index 58% rename from openair2/LAYER2/MAC/progran_dci_conversions.h rename to openair2/LAYER2/MAC/flexran_dci_conversions.h index 90324fdb30..e9d9494a1a 100644 --- a/openair2/LAYER2/MAC/progran_dci_conversions.h +++ b/openair2/LAYER2/MAC/flexran_dci_conversions.h @@ -28,32 +28,32 @@ *******************************************************************************/ /*! \file dci_conversions.h - * \brief Conversion helpers from progran messages to OAI formats DCI + * \brief Conversion helpers from flexran messages to OAI formats DCI * \author Xenofon Foukas * \date 2016 * \version 0.1 */ -#ifndef LAYER2_MAC_PROGRAN_DCI_CONVERISIONS_H__ -#define LAYER2_MAC_DCI_PROGRAN_CONVERISIONS_H__ +#ifndef LAYER2_MAC_FLEXRAN_DCI_CONVERISIONS_H__ +#define LAYER2_MAC_DCI_FLEXRAN_CONVERISIONS_H__ -#define FILL_DCI_FDD_1(TYPE, DCI, PROGRAN_DCI) \ - ((TYPE*)DCI)->harq_pid = PROGRAN_DCI->harq_process; \ - ((TYPE*)DCI)->rv = PROGRAN_DCI->rv[0]; \ - ((TYPE*)DCI)->rballoc = PROGRAN_DCI->rb_bitmap; \ - ((TYPE*)DCI)->rah = PROGRAN_DCI->res_alloc; \ - ((TYPE*)DCI)->mcs = PROGRAN_DCI->mcs[0]; \ - ((TYPE*)DCI)->TPC = PROGRAN_DCI->tpc; \ - ((TYPE*)DCI)->ndi = PROGRAN_DCI->ndi[0]; +#define FILL_DCI_FDD_1(TYPE, DCI, FLEXRAN_DCI) \ + ((TYPE*)DCI)->harq_pid = FLEXRAN_DCI->harq_process; \ + ((TYPE*)DCI)->rv = FLEXRAN_DCI->rv[0]; \ + ((TYPE*)DCI)->rballoc = FLEXRAN_DCI->rb_bitmap; \ + ((TYPE*)DCI)->rah = FLEXRAN_DCI->res_alloc; \ + ((TYPE*)DCI)->mcs = FLEXRAN_DCI->mcs[0]; \ + ((TYPE*)DCI)->TPC = FLEXRAN_DCI->tpc; \ + ((TYPE*)DCI)->ndi = FLEXRAN_DCI->ndi[0]; -#define FILL_DCI_TDD_1(TYPE, DCI, PROGRAN_DCI) \ - ((TYPE*)DCI)->harq_pid = PROGRAN_DCI->harq_process; \ - ((TYPE*)DCI)->rv = PROGRAN_DCI->rv[0]; \ - ((TYPE*)DCI)->dai = PROGRAN_DCI->dai; \ - ((TYPE*)DCI)->rballoc = PROGRAN_DCI->rb_bitmap; \ - ((TYPE*)DCI)->rah = PROGRAN_DCI->res_alloc; \ - ((TYPE*)DCI)->mcs = PROGRAN_DCI->mcs[0]; \ - ((TYPE*)DCI)->TPC = PROGRAN_DCI->tpc; \ - ((TYPE*)DCI)->ndi = PROGRAN_DCI->ndi[0]; +#define FILL_DCI_TDD_1(TYPE, DCI, FLEXRAN_DCI) \ + ((TYPE*)DCI)->harq_pid = FLEXRAN_DCI->harq_process; \ + ((TYPE*)DCI)->rv = FLEXRAN_DCI->rv[0]; \ + ((TYPE*)DCI)->dai = FLEXRAN_DCI->dai; \ + ((TYPE*)DCI)->rballoc = FLEXRAN_DCI->rb_bitmap; \ + ((TYPE*)DCI)->rah = FLEXRAN_DCI->res_alloc; \ + ((TYPE*)DCI)->mcs = FLEXRAN_DCI->mcs[0]; \ + ((TYPE*)DCI)->TPC = FLEXRAN_DCI->tpc; \ + ((TYPE*)DCI)->ndi = FLEXRAN_DCI->ndi[0]; #endif diff --git a/openair2/RRC/LITE/rrc_eNB.c b/openair2/RRC/LITE/rrc_eNB.c index 655c8d4c02..2b075a7ed3 100644 --- a/openair2/RRC/LITE/rrc_eNB.c +++ b/openair2/RRC/LITE/rrc_eNB.c @@ -4545,7 +4545,7 @@ rrc_eNB_decode_dcch( if (mac_agent_registered[ctxt_pP->module_id]) { agent_mac_xface[ctxt_pP->eNB_index]->enb_agent_notify_ue_state_change(ctxt_pP->module_id, ue_context_p->ue_id_rnti, - PROTOCOL__PRP_UE_STATE_CHANGE_TYPE__PRUESC_UPDATED); + PROTOCOL__FLEX_UE_STATE_CHANGE_TYPE__FLUESC_UPDATED); } } #if defined(ENABLE_ITTI) @@ -4646,7 +4646,7 @@ rrc_eNB_decode_dcch( if (mac_agent_registered[ctxt_pP->module_id]) { agent_mac_xface[ctxt_pP->eNB_index]->enb_agent_notify_ue_state_change(ctxt_pP->module_id, ue_context_p->ue_id_rnti, - PROTOCOL__PRP_UE_STATE_CHANGE_TYPE__PRUESC_ACTIVATED); + PROTOCOL__FLEX_UE_STATE_CHANGE_TYPE__FLUESC_ACTIVATED); } } } From 948f2df9f1b00805f30ff0858c3d2ee9bd485a31 Mon Sep 17 00:00:00 2001 From: calvin wang Date: Fri, 21 Oct 2016 18:26:50 +0800 Subject: [PATCH 240/349] modify BSR code according comments --- openair2/LAYER2/MAC/config.c | 2 +- openair2/LAYER2/MAC/defs.h | 2 +- openair2/LAYER2/MAC/proto.h | 4 +- openair2/LAYER2/MAC/ra_procedures.c | 2 +- openair2/LAYER2/MAC/ue_procedures.c | 206 ++++++++++++---------------- 5 files changed, 90 insertions(+), 126 deletions(-) diff --git a/openair2/LAYER2/MAC/config.c b/openair2/LAYER2/MAC/config.c index 030ac7a9f3..90889d6381 100644 --- a/openair2/LAYER2/MAC/config.c +++ b/openair2/LAYER2/MAC/config.c @@ -233,7 +233,7 @@ rrc_mac_config_req( if (mac_MainConfig->ext1 && mac_MainConfig->ext1->sr_ProhibitTimer_r9) { UE_mac_inst[Mod_idP].scheduling_info.sr_ProhibitTimer = (uint16_t) *mac_MainConfig->ext1->sr_ProhibitTimer_r9; } else { - UE_mac_inst[Mod_idP].scheduling_info.sr_ProhibitTimer = (uint16_t) 0; + UE_mac_inst[Mod_idP].scheduling_info.sr_ProhibitTimer = 0; } if (mac_MainConfig->ext2 && mac_MainConfig->ext2->mac_MainConfig_v1020) { diff --git a/openair2/LAYER2/MAC/defs.h b/openair2/LAYER2/MAC/defs.h index 4edfef1677..8f0d4f5951 100644 --- a/openair2/LAYER2/MAC/defs.h +++ b/openair2/LAYER2/MAC/defs.h @@ -941,7 +941,7 @@ typedef enum { typedef struct { /// buffer status for each lcgid uint8_t BSR[MAX_NUM_LCGID]; // should be more for mesh topology - /// keep the number of bytes in rlc buffer for each lcid + /// keep the number of bytes in rlc buffer for each lcgid uint16_t BSR_bytes[MAX_NUM_LCGID]; /// buffer status for each lcid uint8_t LCID_status[MAX_NUM_LCID]; diff --git a/openair2/LAYER2/MAC/proto.h b/openair2/LAYER2/MAC/proto.h index 4133d6a2eb..0bc3eb00ec 100644 --- a/openair2/LAYER2/MAC/proto.h +++ b/openair2/LAYER2/MAC/proto.h @@ -548,7 +548,7 @@ int cba_access(module_id_t module_idP,frame_t frameP,sub_frame_t subframe, uint8 \param[in] Mod_id instance of the UE \param[out] lcgid */ -int get_bsr_lcgid (module_id_t module_idP, int *num_lcgid); +int get_bsr_lcgid (module_id_t module_idP); /*! \fn uint8_t get_bsr_len (module_id_t module_idP,uint16_t bufflen); \brief determine whether the bsr is short or long assuming that the MAC pdu is built @@ -556,7 +556,7 @@ int get_bsr_lcgid (module_id_t module_idP, int *num_lcgid); \param[in] bufflen size of phy transport block \param[out] bsr_len size of bsr control element */ -uint8_t get_bsr_len (module_id_t module_idP, uint16_t buflen); +uint8_t get_bsr_len (module_id_t module_idP, uint8_t eNB_index,frame_t frameP,uint16_t buflen); /*! \fn BSR_SHORT * get_bsr_short(module_id_t module_idP, uint8_t bsr_len) \brief get short bsr level diff --git a/openair2/LAYER2/MAC/ra_procedures.c b/openair2/LAYER2/MAC/ra_procedures.c index 669077bf4f..e60dfc6292 100644 --- a/openair2/LAYER2/MAC/ra_procedures.c +++ b/openair2/LAYER2/MAC/ra_procedures.c @@ -399,7 +399,7 @@ PRACH_RESOURCES_t *ue_get_rach(module_id_t module_idP,int CC_id,frame_t frameP, 1); //post_padding return(&UE_mac_inst[module_idP].RA_prach_resources); - } else if (UE_mac_inst[module_idP].scheduling_info.BSR_bytes[DCCH] > 0) { + } else if (UE_mac_inst[module_idP].scheduling_info.BSR_bytes[UE_mac_inst[module_idP].scheduling_info.LCGID[DCCH]] > 0) { // This is for triggering a transmission on DCCH using PRACH (during handover, or sending SR for example) dcch_header_len = 2 + 2; /// SHORT Subheader + C-RNTI control element rlc_status = mac_rlc_status_ind(module_idP,UE_mac_inst[module_idP].crnti, eNB_indexP,frameP,ENB_FLAG_NO,MBMS_FLAG_NO, diff --git a/openair2/LAYER2/MAC/ue_procedures.c b/openair2/LAYER2/MAC/ue_procedures.c index 6fc95f55d5..97b7e433c4 100644 --- a/openair2/LAYER2/MAC/ue_procedures.c +++ b/openair2/LAYER2/MAC/ue_procedures.c @@ -133,7 +133,7 @@ void ue_init_mac(module_id_t module_idP) UE_mac_inst[module_idP].scheduling_info.LCGID[i]=1; } - UE_mac_inst[module_idP].scheduling_info.LCID_status[i]=0; + UE_mac_inst[module_idP].scheduling_info.LCID_status[i]=LCID_EMPTY; } #ifdef CBA @@ -1202,10 +1202,9 @@ void ue_get_sdu(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_t subf uint8_t payload_offset=0,num_sdus=0; uint8_t ulsch_buff[MAX_ULSCH_PAYLOAD_BYTES]; uint16_t sdu_length_total=0; - BSR_SHORT bsr_short,bsr_truncated; + BSR_SHORT bsr_short; BSR_LONG bsr_long; BSR_SHORT *bsr_s=&bsr_short; - BSR_SHORT *bsr_t=&bsr_truncated; BSR_LONG *bsr_l=&bsr_long; POWER_HEADROOM_CMD phr; POWER_HEADROOM_CMD *phr_p=&phr; @@ -1214,7 +1213,6 @@ void ue_get_sdu(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_t subf int j; // used for padding // Compute header length int all_pdu_len; - int num_lcgid=0; if (CC_id>0) { LOG_E(MAC,"Transmission on secondary CCs is not supported yet\n"); @@ -1249,18 +1247,9 @@ void ue_get_sdu(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_t subf dtch_header_len=(buflen > 128 ) ? 3 : 2 ; //sizeof(SCH_SUBHEADER_LONG)-1 : sizeof(SCH_SUBHEADER_SHORT); bsr_header_len = 1;//sizeof(SCH_SUBHEADER_FIXED); phr_header_len = 1;//sizeof(SCH_SUBHEADER_FIXED); - phr_ce_len = (UE_mac_inst[module_idP].PHR_reporting_active == 1) ? 1 /* sizeof(POWER_HEADROOM_CMD)*/: 0; - if (phr_ce_len > 0) { - phr_len = phr_ce_len + phr_header_len; - LOG_D(MAC,"[UE %d] header size info: PHR len %d (ce%d,hdr%d) buff_len %d\n", - module_idP, phr_len, phr_ce_len, phr_header_len, buflen); - } else { - phr_len=0; - } - - bsr_ce_len = get_bsr_len (module_idP, buflen-phr_len); - // retxBSR-Timer expires or periodicBSR-Timer expires and UE has data available for transmission + bsr_ce_len = get_bsr_len (module_idP, eNB_index, frameP, buflen); + // retxBSR-Timer expires or periodicBSR-Timer expires and Regular BSR trigger if ((bsr_ce_len > 0 ) && (UE_mac_inst[module_idP].BSR_reporting_active > 0)) { bsr_len = bsr_ce_len + bsr_header_len; LOG_D(MAC,"[UE %d] header size info: dcch %d, dcch1 %d, dtch %d, bsr (ce%d,hdr%d) buff_len %d\n", @@ -1272,6 +1261,15 @@ void ue_get_sdu(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_t subf //bsr_len = bsr_ce_len + bsr_header_len; } + phr_ce_len = (UE_mac_inst[module_idP].PHR_reporting_active == 1) ? 1 /* sizeof(POWER_HEADROOM_CMD)*/: 0; + if (phr_ce_len > 0) { + phr_len = phr_ce_len + phr_header_len; + LOG_D(MAC,"[UE %d] header size info: PHR len %d (ce%d,hdr%d) buff_len %d\n", + module_idP, phr_len, phr_ce_len, phr_header_len, buflen); + } else { + phr_len=0; + } + // check for UL bandwidth requests and add SR control element // check for UL bandwidth requests and add SR control element @@ -1305,8 +1303,9 @@ void ue_get_sdu(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_t subf sdu_lcids[0] = DCCH; LOG_D(MAC,"[UE %d] TX Got %d bytes for DCCH\n",module_idP,sdu_lengths[0]); num_sdus = 1; - update_bsr(module_idP, frameP, eNB_index, DCCH, UE_mac_inst[module_idP].scheduling_info.LCGID[DCCH]); + //update_bsr(module_idP, frameP, eNB_index, DCCH, UE_mac_inst[module_idP].scheduling_info.LCGID[DCCH]); //header_len +=2; + UE_mac_inst[module_idP].scheduling_info.LCID_status[DCCH] = LCID_EMPTY; } else { dcch_header_len=0; num_sdus = 0; @@ -1345,6 +1344,7 @@ void ue_get_sdu(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_t subf num_sdus++; //update_bsr(module_idP, frameP, DCCH1); //dcch_header_len +=2; // include dcch1 + UE_mac_inst[module_idP].scheduling_info.LCID_status[DCCH1] = LCID_EMPTY; } else { dcch1_header_len =0; } @@ -1379,7 +1379,7 @@ void ue_get_sdu(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_t subf LOG_D(MAC,"[UE %d] Frame %d : UL-DTCH -> ULSCH%d, %d bytes to send (Transport Block size %d, mac header len %d, BSR byte[%d] %d)\n", module_idP,frameP, lcid, rlc_status.bytes_in_buffer,buflen,dtch_header_len, - lcid, UE_mac_inst[module_idP].scheduling_info.BSR_bytes[lcid]); + lcid, UE_mac_inst[module_idP].scheduling_info.BSR_bytes[UE_mac_inst[module_idP].scheduling_info.LCGID[lcid]]); if (rlc_status.bytes_in_buffer > 0) { sdu_lengths[num_sdus] = mac_rlc_data_req(module_idP, @@ -1400,62 +1400,54 @@ void ue_get_sdu(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_t subf dtch_header_len_last --; } num_sdus++; - UE_mac_inst[module_idP].ul_active = update_bsr(module_idP, frameP, eNB_index,lcid, UE_mac_inst[module_idP].scheduling_info.LCGID[lcid]); + //UE_mac_inst[module_idP].ul_active = update_bsr(module_idP, frameP, eNB_index,lcid, UE_mac_inst[module_idP].scheduling_info.LCGID[lcid]); } else { dtch_header_len -= 3; } + UE_mac_inst[module_idP].scheduling_info.LCID_status[lcid] = LCID_EMPTY; } else { // no rlc pdu : generate the dummy header dtch_header_len -= 3; } } - lcgid= get_bsr_lcgid(module_idP, &num_lcgid); + lcgid= get_bsr_lcgid(module_idP); - if (num_lcgid == 0 ) { + if (lcgid < 0 ) { bsr_s = NULL; - bsr_t = NULL; + bsr_l = NULL ; + } else if ((lcgid ==MAX_NUM_LCGID) && (bsr_ce_len == sizeof(BSR_LONG))) { + bsr_s = NULL; + bsr_l->Buffer_size0 = UE_mac_inst[module_idP].scheduling_info.BSR[LCGID0]; + bsr_l->Buffer_size1 = UE_mac_inst[module_idP].scheduling_info.BSR[LCGID1]; + bsr_l->Buffer_size2 = UE_mac_inst[module_idP].scheduling_info.BSR[LCGID2]; + bsr_l->Buffer_size3 = UE_mac_inst[module_idP].scheduling_info.BSR[LCGID3]; + + UE_mac_inst[module_idP].scheduling_info.BSR_bytes[LCGID0] = 0; + UE_mac_inst[module_idP].scheduling_info.BSR_bytes[LCGID1] = 0; + UE_mac_inst[module_idP].scheduling_info.BSR_bytes[LCGID2] = 0; + UE_mac_inst[module_idP].scheduling_info.BSR_bytes[LCGID3] = 0; + UE_mac_inst[module_idP].scheduling_info.BSR[LCGID0] = 0; + UE_mac_inst[module_idP].scheduling_info.BSR[LCGID1] = 0; + UE_mac_inst[module_idP].scheduling_info.BSR[LCGID2] = 0; + UE_mac_inst[module_idP].scheduling_info.BSR[LCGID3] = 0; + + LOG_D(MAC, "[UE %d] Frame %d report long BSR (level LCGID0 %d,level LCGID1 %d,level LCGID2 %d,level LCGID3 %d)\n", module_idP,frameP, + UE_mac_inst[module_idP].scheduling_info.BSR[LCGID0], + UE_mac_inst[module_idP].scheduling_info.BSR[LCGID1], + UE_mac_inst[module_idP].scheduling_info.BSR[LCGID2], + UE_mac_inst[module_idP].scheduling_info.BSR[LCGID3]); + } else if (bsr_ce_len == sizeof(BSR_SHORT)) { bsr_l = NULL; - } else if (num_lcgid == 1){ - if (bsr_ce_len == sizeof(BSR_SHORT)){ - bsr_l = NULL; - bsr_t = NULL; - bsr_s->LCGID = lcgid; - bsr_s->Buffer_size = UE_mac_inst[module_idP].scheduling_info.BSR[lcgid]; - LOG_D(MAC,"[UE %d] Frame %d report SHORT BSR with level %d for LCGID %d\n", - module_idP, frameP, UE_mac_inst[module_idP].scheduling_info.BSR[lcgid],lcgid); - } else { - bsr_s = NULL; - bsr_t = NULL; - bsr_l = NULL; - } - } else if (num_lcgid > 1) { - if (bsr_ce_len == sizeof(BSR_LONG)){ - bsr_t = NULL; - bsr_s = NULL; - bsr_l->Buffer_size0 = UE_mac_inst[module_idP].scheduling_info.BSR[LCGID0]; - bsr_l->Buffer_size1 = UE_mac_inst[module_idP].scheduling_info.BSR[LCGID1]; - bsr_l->Buffer_size2 = UE_mac_inst[module_idP].scheduling_info.BSR[LCGID2]; - bsr_l->Buffer_size3 = UE_mac_inst[module_idP].scheduling_info.BSR[LCGID3]; - LOG_D(MAC, "[UE %d] Frame %d report long BSR (level LCGID0 %d,level LCGID1 %d,level LCGID2 %d,level LCGID3 %d)\n", module_idP,frameP, - UE_mac_inst[module_idP].scheduling_info.BSR[LCGID0], - UE_mac_inst[module_idP].scheduling_info.BSR[LCGID1], - UE_mac_inst[module_idP].scheduling_info.BSR[LCGID2], - UE_mac_inst[module_idP].scheduling_info.BSR[LCGID3]); - } else if (bsr_ce_len == sizeof(BSR_SHORT)){ - bsr_l = NULL; - bsr_s = NULL; - bsr_t->LCGID = lcgid; - bsr_s->Buffer_size = UE_mac_inst[module_idP].scheduling_info.BSR[lcgid]; - LOG_D(MAC,"[UE %d] Frame %d report SHORT BSR with level %d for LCGID %d\n", + bsr_s->LCGID = lcgid; + bsr_s->Buffer_size = UE_mac_inst[module_idP].scheduling_info.BSR[lcgid]; + + UE_mac_inst[module_idP].scheduling_info.BSR_bytes[lcgid] = 0; + UE_mac_inst[module_idP].scheduling_info.BSR[lcgid] = 0; + + LOG_D(MAC,"[UE %d] Frame %d report SHORT BSR with level %d for LCGID %d\n", module_idP, frameP, UE_mac_inst[module_idP].scheduling_info.BSR[lcgid],lcgid); - } else { - bsr_s = NULL; - bsr_t = NULL; - bsr_l = NULL; - } } else { bsr_s = NULL; - bsr_t = NULL; bsr_l = NULL; } @@ -1517,7 +1509,7 @@ void ue_get_sdu(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_t subf sdu_lcids, // sdu lcid phr_p, // power headroom NULL, // crnti - bsr_t, // truncated bsr + NULL, // truncated bsr bsr_s, // short bsr bsr_l, post_padding); // long_bsr @@ -1719,7 +1711,7 @@ ue_scheduler( } // Get RLC status info and update Bj for all lcids that are active - for (lcid=DCCH; lcid <= DTCH; lcid++ ) { + for (lcid=DCCH; lcid < MAX_NUM_LCID; lcid++ ) { if ((lcid == 0) ||(UE_mac_inst[module_idP].logicalChannelConfig[lcid])) { // meausre the Bj if ((directionP == SF_UL)&& (UE_mac_inst[module_idP].scheduling_info.Bj[lcid] >= 0)) { @@ -1740,6 +1732,8 @@ ue_scheduler( if (update_bsr(module_idP,frameP, eNB_indexP, lcid, UE_mac_inst[module_idP].scheduling_info.LCGID[lcid])) { UE_mac_inst[module_idP].scheduling_info.SR_pending= 1; + // Regular BSR trigger + UE_mac_inst[module_idP].BSR_reporting_active = 1; LOG_D(MAC,"[UE %d][SR] Frame %d subframe %d SR for PUSCH is pending for LCGID %d with BSR level %d (%d bytes in RLC)\n", module_idP, frameP,subframeP,UE_mac_inst[module_idP].scheduling_info.LCGID[lcid], UE_mac_inst[module_idP].scheduling_info.BSR[UE_mac_inst[module_idP].scheduling_info.LCGID[lcid]], @@ -1960,75 +1954,49 @@ int cba_access(module_id_t module_idP,frame_t frameP,sub_frame_t subframe, uint8 } #endif -int get_bsr_lcgid (module_id_t module_idP, int *num_lcgid) +int get_bsr_lcgid (module_id_t module_idP) { int lcgid, lcgid_tmp=-1; int num_active_lcgid = 0; for (lcgid = 0 ; lcgid < MAX_NUM_LCGID; lcgid++) { if (UE_mac_inst[module_idP].scheduling_info.BSR[lcgid] > 0 ) { - if (lcgid_tmp == -1){ - // first priority lcgid - lcgid_tmp = lcgid; - } + lcgid_tmp = lcgid; num_active_lcgid+=1; } } - *num_lcgid = num_active_lcgid; - + if (num_active_lcgid == 0) { - return -1; // no data + return -1; + } else if (num_active_lcgid == 1) { + return lcgid_tmp; } else { - return lcgid_tmp;//only one lcgid, report short bsr + return MAX_NUM_LCGID; } } -uint8_t get_bsr_len (module_id_t module_idP, uint16_t buflen) +uint8_t get_bsr_len (module_id_t module_idP, uint8_t eNB_index,frame_t frameP,uint16_t buflen) { - int lcgid=0; - uint8_t bsr_len=0, num_lcgid=0; + int lcid; + uint8_t bsr_len=0, num_lcid=0; int pdu = 0; - int long_bsr_plus_subheader_length = sizeof(BSR_LONG)+sizeof(SCH_SUBHEADER_FIXED); - int short_bsr_plus_subheader_length = sizeof(BSR_SHORT)+sizeof(SCH_SUBHEADER_FIXED); + mac_rlc_status_resp_t rlc_status; - // check how many lcg have data to report - for (lcgid=0; lcgid < MAX_NUM_LCGID; lcgid++ ) { - if (UE_mac_inst[module_idP].scheduling_info.BSR_bytes[lcgid] > 0 ) { - num_lcgid ++; - pdu += (UE_mac_inst[module_idP].scheduling_info.BSR_bytes[lcgid] + sizeof(SCH_SUBHEADER_SHORT)); + for (lcid=DCCH; lcid 0 ) { + pdu += rlc_status.bytes_in_buffer + sizeof(SCH_SUBHEADER_SHORT) + bsr_len; + if (rlc_status.bytes_in_buffer > 128 ) { + pdu += 1; //sizeof(SCH_SUBHEADER_LONG) + } } - if (UE_mac_inst[module_idP].scheduling_info.BSR_bytes[lcgid] > 128 ) { // long header size: adjust the header size - pdu += 1; - } - LOG_D(MAC,"BSR Bytes %d for lcgid %d num lcgid %d\n", UE_mac_inst[module_idP].scheduling_info.BSR_bytes[lcgid], lcgid, num_lcgid); - } - // current phy buff can not transport all sdu for this lcgid -> transmit a bsr for this lcgid - if (buflen < pdu) { - if (num_lcgid > 0) { - bsr_len = sizeof(BSR_SHORT); - } else { - bsr_len = 0; - } - } - // padding larger then long bsr - if (buflen > (pdu + long_bsr_plus_subheader_length)) { - if (num_lcgid > 1) { - bsr_len = sizeof(BSR_LONG); - } else if (num_lcgid > 0) { - bsr_len = sizeof(BSR_SHORT); - } else { - bsr_len = 0; - } - } - // padding larger then short bsr and shorter then long bsr - if ((buflen < (pdu + long_bsr_plus_subheader_length)) && - (buflen > (pdu + short_bsr_plus_subheader_length))) { - if (num_lcgid > 0) { - bsr_len = sizeof(BSR_SHORT); - } else { - bsr_len = 0; + if ( (pdu > buflen) && (rlc_status.bytes_in_buffer > 0 ) ) { + num_lcid +=1; + bsr_len = (num_lcid >= 2 ) ? sizeof(BSR_LONG) : sizeof(BSR_SHORT) ; } + LOG_D(MAC,"LC buffer Bytes %d for lcid %d bsr len %d num lcid %d\n", rlc_status.bytes_in_buffer, lcid, bsr_len, num_lcid); } + if ( bsr_len > 0 ) LOG_D(MAC,"[UE %d] Prepare a %s (Transport Block Size %d, MAC pdu Size %d) \n", module_idP, map_int_to_str(BSR_names, bsr_len), buflen, pdu); @@ -2036,16 +2004,15 @@ uint8_t get_bsr_len (module_id_t module_idP, uint16_t buflen) return bsr_len; } - boolean_t update_bsr(module_id_t module_idP, frame_t frameP, eNB_index_t eNB_index, uint8_t lcid, uint8_t lcg_id) { mac_rlc_status_resp_t rlc_status; - boolean_t Bsr_pending = FALSE; + boolean_t sr_pending = FALSE; if ((lcg_id < 0) || (lcg_id >= MAX_NUM_LCGID) ) { - return Bsr_pending; + return sr_pending; } // fixme: need a better way to reset @@ -2062,14 +2029,11 @@ boolean_t update_bsr(module_id_t module_idP, frame_t frameP, eNB_index_t eNB_in if (rlc_status.bytes_in_buffer > 0 ) { //BSR trigger SR - Bsr_pending = TRUE; + sr_pending = TRUE; UE_mac_inst[module_idP].scheduling_info.LCID_status[lcid] = LCID_NOT_EMPTY; - UE_mac_inst[module_idP].scheduling_info.BSR_bytes[lcg_id] = rlc_status.bytes_in_buffer; - if (UE_mac_inst[module_idP].scheduling_info.extendedBSR_Sizes_r10 == TRUE){ - UE_mac_inst[module_idP].scheduling_info.BSR[lcg_id] = locate_BsrIndexByBufferSize(Extended_BSR_TABLE, BSR_TABLE_SIZE, UE_mac_inst[module_idP].scheduling_info.BSR_bytes[lcg_id]); - } else { - UE_mac_inst[module_idP].scheduling_info.BSR[lcg_id] = locate_BsrIndexByBufferSize(BSR_TABLE, BSR_TABLE_SIZE, UE_mac_inst[module_idP].scheduling_info.BSR_bytes[lcg_id]); - } + // sum lcid buffer which has same lcgid + UE_mac_inst[module_idP].scheduling_info.BSR_bytes[lcg_id] += rlc_status.bytes_in_buffer; + UE_mac_inst[module_idP].scheduling_info.BSR[lcg_id] = locate_BsrIndexByBufferSize(BSR_TABLE, BSR_TABLE_SIZE, UE_mac_inst[module_idP].scheduling_info.BSR_bytes[lcg_id]); // UE_mac_inst[module_idP].scheduling_info.BSR_short_lcid = lcid; // only applicable to short bsr LOG_D(MAC,"[UE %d] BSR level %d (LCGID %d, rlc buffer %d byte)\n", module_idP, UE_mac_inst[module_idP].scheduling_info.BSR[lcg_id],lcg_id, UE_mac_inst[module_idP].scheduling_info.BSR_bytes[lcg_id]); @@ -2079,7 +2043,7 @@ boolean_t update_bsr(module_id_t module_idP, frame_t frameP, eNB_index_t eNB_in } //} - return Bsr_pending; + return sr_pending; } uint8_t locate_BsrIndexByBufferSize (const uint32_t *table, int size, int value) From 15e299bd114bc7ec181793834f5a6d6a486387c7 Mon Sep 17 00:00:00 2001 From: fnabet Date: Fri, 21 Oct 2016 15:09:42 +0200 Subject: [PATCH 241/349] [OAI-UE] Authetification XOR Algo for usim test --- openair2/RRC/LITE/MESSAGES/asn1_msg.c | 6 +- openair3/NAS/TOOLS/usim_data.c | 1 + openair3/NAS/UE/API/USIM/usim_api.c | 193 +++++++++++++++++- openair3/NAS/UE/API/USIM/usim_api.h | 5 + openair3/NAS/UE/EMM/Authentication.c | 11 +- .../UE/EMM/SAP/EmmDeregisteredNormalService.c | 10 +- openair3/NAS/UE/EMM/emm_main.c | 2 + targets/RT/USER/lte-softmodem.c | 7 + 8 files changed, 231 insertions(+), 4 deletions(-) diff --git a/openair2/RRC/LITE/MESSAGES/asn1_msg.c b/openair2/RRC/LITE/MESSAGES/asn1_msg.c index e0556b92bf..3fe10c92f8 100644 --- a/openair2/RRC/LITE/MESSAGES/asn1_msg.c +++ b/openair2/RRC/LITE/MESSAGES/asn1_msg.c @@ -117,6 +117,7 @@ typedef struct xer_sprint_string_s { } xer_sprint_string_t; extern unsigned char NB_eNB_INST; +extern uint8_t usim_test; uint16_t two_tier_hexagonal_cellIds[7] = {0,1,2,4,5,7,8}; uint16_t two_tier_hexagonal_adjacent_cellIds[7][6] = {{1,2,4,5,7,8}, // CellId 0 @@ -1268,7 +1269,10 @@ uint8_t do_RRCConnectionSetupComplete(uint8_t Mod_id, uint8_t *buffer, const uin rrcConnectionSetupComplete->criticalExtensions.choice.c1.choice.rrcConnectionSetupComplete_r8.nonCriticalExtension=CALLOC(1, sizeof(*rrcConnectionSetupComplete->criticalExtensions.choice.c1.choice.rrcConnectionSetupComplete_r8.nonCriticalExtension)); - rrcConnectionSetupComplete->criticalExtensions.choice.c1.choice.rrcConnectionSetupComplete_r8.selectedPLMN_Identity=2; + if(usim_test == 0) + rrcConnectionSetupComplete->criticalExtensions.choice.c1.choice.rrcConnectionSetupComplete_r8.selectedPLMN_Identity= 2; + else + rrcConnectionSetupComplete->criticalExtensions.choice.c1.choice.rrcConnectionSetupComplete_r8.selectedPLMN_Identity= 1; rrcConnectionSetupComplete->criticalExtensions.choice.c1.choice.rrcConnectionSetupComplete_r8.registeredMME = NULL;//calloc(1,sizeof(*rrcConnectionSetupComplete->criticalExtensions.choice.c1.choice.rrcConnectionSetupComplete_r8.registeredMME)); diff --git a/openair3/NAS/TOOLS/usim_data.c b/openair3/NAS/TOOLS/usim_data.c index 1835f0b8b1..126ff4f78c 100644 --- a/openair3/NAS/TOOLS/usim_data.c +++ b/openair3/NAS/TOOLS/usim_data.c @@ -227,6 +227,7 @@ int main (int argc, const char* argv[]) usim_data.imsi.u.num.digit13 = 3; usim_data.imsi.u.num.digit14 = 4; usim_data.imsi.u.num.digit15 = 0xF; + usim_data.usimtestmode = 1; // set usim in test mode in order to get the CMW500 K key #endif /* * Ciphering and Integrity Keys diff --git a/openair3/NAS/UE/API/USIM/usim_api.c b/openair3/NAS/UE/API/USIM/usim_api.c index b0ccbf9504..df7d22db8e 100644 --- a/openair3/NAS/UE/API/USIM/usim_api.c +++ b/openair3/NAS/UE/API/USIM/usim_api.c @@ -79,6 +79,7 @@ Description Implements the API used by the NAS layer to read/write #define USIM_API_K_SIZE 16 //#define USIM_API_K_VALUE "fec86ba6eb707ed08905757b1bb44b8f" #define USIM_API_K_VALUE "8BAF473F2F8FD09487CCCBD7097C6862" +#define TEST_USIM_API_K_VALUE "000102030405060708090a0b0c0d0e0f" // CMW500 K key static uint8_t _usim_api_k[USIM_API_K_SIZE]; @@ -143,7 +144,14 @@ int usim_api_read(usim_data_t* data) } /* initialize the subscriber authentication security key */ - _usim_api_hex_string_to_hex_value(_usim_api_k, USIM_API_K_VALUE, USIM_API_K_SIZE); + if(data->usimtestmode == 0) + { + _usim_api_hex_string_to_hex_value(_usim_api_k, USIM_API_K_VALUE, USIM_API_K_SIZE); + } + else + { + _usim_api_hex_string_to_hex_value(_usim_api_k, TEST_USIM_API_K_VALUE, USIM_API_K_SIZE); + } free(path); LOG_FUNC_RETURN (RETURNok); @@ -188,6 +196,189 @@ int usim_api_write(const usim_data_t* data) LOG_FUNC_RETURN (RETURNok); } +/**************************************************************************** + ** ** + ** Name: usim_api_authenticate_test() ** + ** ** + ** Description: Performs mutual authentication of the USIM to the network,** + ** checking whether authentication token AUTN can be accep- ** + ** ted. If so, returns an authentication response RES and ** + ** the ciphering and integrity keys. ** + ** In case of synch failure, returns a re-synchronization ** + ** token AUTS. ** + ** ** + ** Key Generation for Test USIM based on 34.108 ** + ** ** + ** Authentication and key generating function algorithms are ** + ** specified in 3GPP TS 35.206. ** + ** ** + ** Inputs: rand_pP: Random challenge number ** + ** autn_pP: Authentication token ** + ** AUTN = (SQN xor AK) || AMF || MAC ** + ** 48 16 64 bits ** + ** Others: Security key ** + ** ** + ** Outputs: auts_pP: Re-synchronization token ** + ** res_pP: Authentication response ** + ** ck_pP: Ciphering key ** + ** ik_pP Integrity key ** + ** ** + ** Return: RETURNerror, RETURNok ** + ** Others: None ** + ** ** + ***************************************************************************/ +int usim_api_authenticate_test(const OctetString* rand_pP, const OctetString* autn_pP, + OctetString* auts_pP, OctetString* res_pP, + OctetString* ck_pP, OctetString* ik_pP) +{ + LOG_FUNC_IN; + + int rc; + int i; + + LOG_TRACE(INFO, "USIM-API - rand :%s",dump_octet_string(rand_pP)); + LOG_TRACE(INFO, "USIM-API - autn :%s",dump_octet_string(autn_pP)); + + //step1: XDOUT = RAND xor K + // RES = XDOUT + for (i=0; ivalue[i] = rand_pP->value[i] ^ _usim_api_k[i]; + } + + //step2: res = f2(xdout,n) + // ck = f3(xdout) + // ik = f4(xdout) + // ak = f5(xdout) + u8 ak[USIM_API_AK_SIZE]; + for (i=0; i<15; i++) + { + ck_pP->value[i] = res_pP->value[i+1]; + } + ck_pP->value[15] = res_pP->value[0]; + + for (i=0; i<14; i++) + { + ik_pP->value[i] = res_pP->value[i+2]; + } + ik_pP->value[14] = res_pP->value[0]; + ik_pP->value[15] = res_pP->value[1]; + + for (i=0; ivalue[i+3]; + } + LOG_TRACE(INFO, "USIM-API - res(f2) :%s",dump_octet_string(res_pP)); + LOG_TRACE(INFO, "USIM-API - ck(f3) :%s",dump_octet_string(ck_pP)); + LOG_TRACE(INFO, "USIM-API - ik(f4) :%s",dump_octet_string(ik_pP)); + LOG_TRACE(INFO, "USIM-API - ak(f5) : %02X%02X%02X%02X%02X%02X", + ak[0],ak[1],ak[2],ak[3],ak[4],ak[5]); + + //step3: concatenate SQN with AMP SQN||AMF + // SQN = AUTN xor ak + u8 sqn[USIM_API_SQN_SIZE]; + for (i = 0; i < USIM_API_SQN_SIZE; i++) { + sqn[i] = autn_pP->value[i] ^ ak[i]; + } + LOG_TRACE(INFO, "USIM-API - Retrieved SQN %02X%02X%02X%02X%02X%02X", + sqn[0],sqn[1],sqn[2],sqn[3],sqn[4],sqn[5]); + LOG_TRACE(INFO, "USIM-API - Retrieved AMF %02X%02X", + autn_pP->value[USIM_API_SQN_SIZE],autn_pP->value[USIM_API_SQN_SIZE+1]); + +#define USIM_API_XMAC_SIZE 8 + u8 cdout[USIM_API_XMAC_SIZE]; + for (i = 0; i < USIM_API_XMAC_SIZE; i++) + { + if(i < USIM_API_SQN_SIZE) + { + cdout[i] = sqn[i]; + } + else + { + cdout[i] = autn_pP->value[i]; + } + } + LOG_TRACE(INFO, "USIM-API - Retrieved CDOUT %02X%02X%02X%02X%02X%02X%02X%02X", + cdout[0],cdout[1],cdout[2],cdout[3],cdout[4],cdout[5],cdout[6],cdout[7]); + + //step4:calculate XMAC from cdout and xdout + u8 xmac[USIM_API_XMAC_SIZE]; + for(i = 0; i < USIM_API_XMAC_SIZE; i++) + { + xmac[i] = res_pP->value[i] ^ cdout[i]; + } + LOG_TRACE(INFO, + "USIM-API - Computed XMAC %02X%02X%02X%02X%02X%02X%02X%02X", + xmac[0],xmac[1],xmac[2],xmac[3], + xmac[4],xmac[5],xmac[6],xmac[7]); + + /* Compare the XMAC with the MAC included in AUTN */ +#define USIM_API_AMF_SIZE 2 + + if ( memcmp(xmac, &autn_pP->value[USIM_API_SQN_SIZE + USIM_API_AMF_SIZE], + USIM_API_XMAC_SIZE) != 0 ) { + LOG_TRACE(INFO, + "USIM-API - Comparing the XMAC with the MAC included in AUTN Failed"); + rc = RETURNerror; + //LOG_FUNC_RETURN (RETURNerror); + } else { + LOG_TRACE(INFO, + "USIM-API - Comparing the XMAC with the MAC included in AUTN Succeeded"); + /* Verify that the received sequence number SQN is in the correct range */ + rc = _usim_api_check_sqn(*(uint32_t*)(sqn), sqn[USIM_API_SQN_SIZE - 1]); + } + + + if (rc != RETURNok) { + /* Synchronisation failure; compute the AUTS parameter */ + + /* Concealed value of the counter SQNms in the USIM: + * Conc(SQNMS) = SQNMS ⊕ f5*K(RAND) */ + f5star(_usim_api_k, rand_pP->value, ak); + + + u8 sqn_ms[USIM_API_SQNMS_SIZE]; + memset(sqn_ms, 0, USIM_API_SQNMS_SIZE); + + //#define USIM_API_SQN_MS_SIZE 3 + printf("_usim_api_data.sqn_ms %p\n",_usim_api_data.sqn_ms); + for (i = 0; i < USIM_API_SQNMS_SIZE; i++) { + //#warning "LG:BUG HERE TODO" + printf("i %d: ((uint8_t*)(_usim_api_data.sqn_ms))[USIM_API_SQNMS_SIZE - i] %d\n",i, ((uint8_t*)(_usim_api_data.sqn_ms))[USIM_API_SQNMS_SIZE - i]); + sqn_ms[USIM_API_SQNMS_SIZE - i] = + ((uint8_t*)(_usim_api_data.sqn_ms))[USIM_API_SQNMS_SIZE - i]; + } + + u8 sqnms[USIM_API_SQNMS_SIZE]; + + for (i = 0; i < USIM_API_SQNMS_SIZE; i++) { + sqnms[i] = sqn_ms[i] ^ ak[i]; + } + + LOG_TRACE(DEBUG, "USIM-API - SQNms %02X%02X%02X%02X%02X%02X", + sqnms[0],sqnms[1],sqnms[2],sqnms[3],sqnms[4],sqnms[5]); + + /* Synchronisation message authentication code: + * MACS = f1*K(SQNMS || RAND || AMF) */ +#define USIM_API_MACS_SIZE USIM_API_XMAC_SIZE + u8 macs[USIM_API_MACS_SIZE]; + f1star(_usim_api_k, rand_pP->value, sqn_ms, + &rand_pP->value[USIM_API_SQN_SIZE], macs); + LOG_TRACE(DEBUG, "USIM-API - MACS %02X%02X%02X%02X%02X%02X%02X%02X", + macs[0],macs[1],macs[2],macs[3], + macs[4],macs[5],macs[6],macs[7]); + + /* Synchronisation authentication token: + * AUTS = Conc(SQNMS) || MACS */ + memcpy(&auts_pP->value[0], sqnms, USIM_API_SQNMS_SIZE); + memcpy(&auts_pP->value[USIM_API_SQNMS_SIZE], macs, USIM_API_MACS_SIZE); + auts_pP->length = USIM_API_SQNMS_SIZE + USIM_API_MACS_SIZE; + LOG_FUNC_RETURN (RETURNerror); + } + + LOG_FUNC_RETURN (RETURNok); +} + /**************************************************************************** ** ** ** Name: usim_api_authenticate() ** diff --git a/openair3/NAS/UE/API/USIM/usim_api.h b/openair3/NAS/UE/API/USIM/usim_api.h index f7e85f95e7..fd4b3e3301 100644 --- a/openair3/NAS/UE/API/USIM/usim_api.h +++ b/openair3/NAS/UE/API/USIM/usim_api.h @@ -334,6 +334,8 @@ typedef struct { usim_epsloci_t epsloci; /* Non-Access Stratum configuration */ usim_nasconfig_t nasconfig; + /* usim test mode */ + uint8_t usimtestmode; } usim_data_t; /****************************************************************************/ @@ -351,5 +353,8 @@ int usim_api_write(const usim_data_t* data); int usim_api_authenticate(const OctetString* rand, const OctetString* autn, OctetString* auts, OctetString* res, OctetString* ck, OctetString* ik); +int usim_api_authenticate_test(const OctetString* rand, const OctetString* autn, + OctetString* auts, OctetString* res, + OctetString* ck, OctetString* ik); #endif /* __USIM_API_H__*/ diff --git a/openair3/NAS/UE/EMM/Authentication.c b/openair3/NAS/UE/EMM/Authentication.c index 6285534450..96f28d7e86 100755 --- a/openair3/NAS/UE/EMM/Authentication.c +++ b/openair3/NAS/UE/EMM/Authentication.c @@ -86,6 +86,8 @@ extern void *_emm_service_t3417_handler(void *); extern void *_emm_detach_t3421_handler(void *); extern void *_emm_tau_t3430_handler(void *); +extern uint8_t usim_test; + /****************************************************************************/ /******************* L O C A L D E F I N I T I O N S *******************/ /****************************************************************************/ @@ -240,7 +242,14 @@ int emm_proc_authentication_request(int native_ksi, int ksi, * of the core network by means of the received AUTN parameter and * request the USIM to compute RES, CK and IK for given RAND */ - rc = usim_api_authenticate(rand, autn, &auts, &res, &ck, &ik); + if(usim_test == 0) + { + rc = usim_api_authenticate(rand, autn, &auts, &res, &ck, &ik); + } + else + { + rc = usim_api_authenticate_test(rand, autn, &auts, &res, &ck, &ik); // XOR algo for autentication on usim test mode + } } if (rc != RETURNok) { diff --git a/openair3/NAS/UE/EMM/SAP/EmmDeregisteredNormalService.c b/openair3/NAS/UE/EMM/SAP/EmmDeregisteredNormalService.c index 25924fd9f2..167c80ee51 100755 --- a/openair3/NAS/UE/EMM/SAP/EmmDeregisteredNormalService.c +++ b/openair3/NAS/UE/EMM/SAP/EmmDeregisteredNormalService.c @@ -62,6 +62,7 @@ Description Implements the EPS Mobility Management procedures executed /****************************************************************************/ /**************** E X T E R N A L D E F I N I T I O N S ****************/ /****************************************************************************/ +extern uint8_t usim_test; /****************************************************************************/ /******************* L O C A L D E F I N I T I O N S *******************/ @@ -116,7 +117,14 @@ int EmmDeregisteredNormalService(const emm_reg_t *evt) /* * Initiate the attach procedure for EPS services */ - rc = emm_proc_attach(EMM_ATTACH_TYPE_EPS); + if(usim_test == 0) + { + rc = emm_proc_attach(EMM_ATTACH_TYPE_EPS); + } + else + { + rc = emm_proc_attach(EMM_ATTACH_TYPE_IMSI); // CMW500 IMSI initial attach expected + } break; case _EMMREG_ATTACH_REQ: diff --git a/openair3/NAS/UE/EMM/emm_main.c b/openair3/NAS/UE/EMM/emm_main.c index dbeacaa149..3ec9aa5cac 100755 --- a/openair3/NAS/UE/EMM/emm_main.c +++ b/openair3/NAS/UE/EMM/emm_main.c @@ -59,6 +59,7 @@ Description Defines the EPS Mobility Management procedure call manager, /****************************************************************************/ /**************** E X T E R N A L D E F I N I T I O N S ****************/ /****************************************************************************/ +extern uint8_t usim_test; /****************************************************************************/ /******************* L O C A L D E F I N I T I O N S *******************/ @@ -166,6 +167,7 @@ void emm_main_initialize(emm_indication_callback_t cb, const char *imei) /* * Get USIM application data */ + _usim_data.usimtestmode = usim_test; if ( usim_api_read(&_usim_data) != RETURNok ) { /* The USIM application may not be present or not valid */ LOG_TRACE(WARNING, "EMM-MAIN - Failed to read USIM application data"); diff --git a/targets/RT/USER/lte-softmodem.c b/targets/RT/USER/lte-softmodem.c index d055eea3ad..ba4988cbfa 100644 --- a/targets/RT/USER/lte-softmodem.c +++ b/targets/RT/USER/lte-softmodem.c @@ -212,6 +212,7 @@ char rf_config_file[1024]; int chain_offset=0; int phy_test = 0; +uint8_t usim_test = 0; char ref[128] = "internal"; @@ -387,6 +388,7 @@ void help (void) { printf(" --loop-memory get softmodem (UE) to loop through memory instead of acquiring from HW\n"); printf(" --mmapped-dma sets flag for improved EXMIMO UE performance\n"); printf(" --single-thread runs lte-softmodem in only one thread\n"); + printf(" --usim-test use XOR autentication algo in case of test usim mode\n"); printf(" -C Set the downlink frequency for all component carriers\n"); printf(" -d Enable soft scope and L1 and L2 stats (Xforms)\n"); printf(" -F Calibrate the EXMIMO borad, available files: exmimo2_2arxg.lime exmimo2_2brxg.lime \n"); @@ -693,6 +695,7 @@ static void get_options (int argc, char **argv) LONG_OPTION_DUMP_FRAME, LONG_OPTION_LOOPMEMORY, LONG_OPTION_PHYTEST, + LONG_OPTION_USIMTEST, LONG_OPTION_MMAPPED_DMA, LONG_OPTION_SINGLE_THREAD, #if T_TRACER @@ -719,6 +722,7 @@ static void get_options (int argc, char **argv) {"ue-dump-frame", no_argument, NULL, LONG_OPTION_DUMP_FRAME}, {"loop-memory", required_argument, NULL, LONG_OPTION_LOOPMEMORY}, {"phy-test", no_argument, NULL, LONG_OPTION_PHYTEST}, + {"usim-test", no_argument, NULL, LONG_OPTION_USIMTEST}, {"mmapped-dma", no_argument, NULL, LONG_OPTION_MMAPPED_DMA}, {"single-thread", no_argument, NULL, LONG_OPTION_SINGLE_THREAD}, #if T_TRACER @@ -818,6 +822,9 @@ static void get_options (int argc, char **argv) phy_test = 1; break; + case LONG_OPTION_USIMTEST: + usim_test = 1; + break; case LONG_OPTION_MMAPPED_DMA: mmapped_dma = 1; break; From b6c7909d03f740a2b390cf2bc6c7c8af62bda476 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Mon, 24 Oct 2016 19:14:07 +0300 Subject: [PATCH 242/349] Fixed bugs related to MAC padding and RLC requests in AM mode --- .../MAC/eNB_agent_scheduler_dataplane.c | 29 ++- .../LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c | 12 +- .../LAYER2/MAC/eNB_scheduler_primitives.c | 2 +- .../enb.band7.flexran.50PRB.usrpb210.conf | 182 ++++++++++++++++++ 4 files changed, 209 insertions(+), 16 deletions(-) create mode 100644 targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.flexran.50PRB.usrpb210.conf diff --git a/openair2/LAYER2/MAC/eNB_agent_scheduler_dataplane.c b/openair2/LAYER2/MAC/eNB_agent_scheduler_dataplane.c index b75b0467b1..a4d4d79250 100644 --- a/openair2/LAYER2/MAC/eNB_agent_scheduler_dataplane.c +++ b/openair2/LAYER2/MAC/eNB_agent_scheduler_dataplane.c @@ -126,6 +126,8 @@ void apply_ue_spec_scheduling_decisions(mid_t mod_id, static int32_t tpc_accumulated=0; UE_sched_ctrl *ue_sched_ctl; + int last_sdu_header_len = 0; + int i; Protocol__FlexDlData *dl_data; @@ -161,18 +163,21 @@ void apply_ue_spec_scheduling_decisions(mid_t mod_id, if (dl_data->n_ce_bitmap > 0) { //Check if there is TA command and set the length appropriately - ta_len = (dl_data->ce_bitmap[0] & PROTOCOL__FLEX_CE_TYPE__FLPCET_TA) ? 2 : 0; + ta_len = (dl_data->ce_bitmap[0] & PROTOCOL__FLEX_CE_TYPE__FLPCET_TA) ? 1 : 0; } + + num_sdus = 0; + sdu_length_total = 0; if (ta_len > 0) { // Reset the measurement ue_sched_ctl->ta_timer = 20; eNB_UE_stats->timing_advance_update = 0; + header_len = ta_len; + last_sdu_header_len = ta_len; } - + n_lc = dl_data->n_rlc_pdu; - num_sdus = 0; - sdu_length_total = 0; // Go through each one of the channel commands and create SDUs for (i = 0; i < n_lc; i++) { lcid = dl_data->rlc_pdu[i]->rlc_pdu_tb[0]->logical_channel_id; @@ -192,6 +197,10 @@ void apply_ue_spec_scheduling_decisions(mid_t mod_id, if (rlc_status.bytes_in_buffer > 0) { + if (rlc_size <= 2) { + rlc_size = 3; + } + rlc_status = mac_rlc_status_ind(mod_id, rnti, mod_id, @@ -223,12 +232,13 @@ void apply_ue_spec_scheduling_decisions(mid_t mod_id, UE_list->eNB_UE_stats[CC_id][UE_id].num_pdu_tx[lcid] += 1; UE_list->eNB_UE_stats[CC_id][UE_id].num_bytes_tx[lcid] += sdu_lengths[i]; - if (sdu_lengths[i] < 128) { + if (sdu_lengths[i] <= 128) { header_len += 2; + last_sdu_header_len = 2; } else { header_len += 3; + last_sdu_header_len = 3; } - num_sdus++; } } @@ -238,13 +248,14 @@ void apply_ue_spec_scheduling_decisions(mid_t mod_id, if (((sdu_length_total + header_len) > 0)) { - header_len_tmp = header_len; + // header_len_tmp = header_len; // If we have only a single SDU, header length becomes 1 - if (header_len == 2 || header_len == 3) { + if ((num_sdus + ta_len) == 1) { + //if (header_len == 2 || header_len == 3) { header_len = 1; } else { - header_len--; + header_len = (header_len - last_sdu_header_len) + 1; } // there is a payload diff --git a/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c b/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c index 90d5ad5f1b..4572e73def 100644 --- a/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c +++ b/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c @@ -371,7 +371,7 @@ schedule_ue_spec_default( // Need to see if we have space for data from this channel if (dci_tbs - ta_len - header_len > 0) { - LOG_D(MAC, "[TEST]Requested %d bytes from RLC buffer if channel %d during first call\n", dci_tbs-ta_len-header_len); + LOG_D(MAC, "[TEST]Requested %d bytes from RLC buffer on channel %d during first call\n", dci_tbs-ta_len-header_len); //If we have space, we need to see how much data we can request at most (if any available) rlc_status = mac_rlc_status_ind(mod_id, rnti, @@ -390,10 +390,10 @@ schedule_ue_spec_default( if (data_to_request < 128) { //The header will be one byte less header_len--; } - if (j == 1 || j == 2) { - data_to_request++; //It is not correct but fixes some RLC bug for DCCH - } - LOG_D(MAC, "[TEST]Will request %d from DCCH\n", data_to_request); + /* if (j == 1 || j == 2) { */ + /* data_to_request+=0; + /* } */ + LOG_D(MAC, "[TEST]Will request %d from channel %d\n", data_to_request, j); rlc_pdus[channels_added] = (Protocol__FlexRlcPdu *) malloc(sizeof(Protocol__FlexRlcPdu)); protocol__flex_rlc_pdu__init(rlc_pdus[channels_added]); rlc_pdus[channels_added]->n_rlc_pdu_tb = 2; @@ -523,7 +523,7 @@ schedule_ue_spec_default( if (frame_parms[CC_id]->frame_type == TDD) { UE_list->UE_template[CC_id][UE_id].DAI++; // printf("DAI update: subframeP %d: UE %d, DAI %d\n",subframeP,UE_id,UE_list->UE_template[CC_id][UE_id].DAI); -#warning only for 5MHz channel + //#warning only for 5MHz channel update_ul_dci(mod_id, CC_id, rnti, UE_list->UE_template[CC_id][UE_id].DAI); } diff --git a/openair2/LAYER2/MAC/eNB_scheduler_primitives.c b/openair2/LAYER2/MAC/eNB_scheduler_primitives.c index 7946fdf663..a5c1e90147 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler_primitives.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_primitives.c @@ -146,7 +146,7 @@ rnti_t UE_RNTI(module_id_t mod_idP, int ue_idP) return (rnti); } - LOG_E(MAC,"[eNB %d] Couldn't find RNTI for UE %d\n",mod_idP,ue_idP); + LOG_D(MAC,"[eNB %d] Couldn't find RNTI for UE %d\n",mod_idP,ue_idP); //display_backtrace(); return(NOT_A_RNTI); } diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.flexran.50PRB.usrpb210.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.flexran.50PRB.usrpb210.conf new file mode 100644 index 0000000000..f73a78b3b0 --- /dev/null +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.flexran.50PRB.usrpb210.conf @@ -0,0 +1,182 @@ +Active_eNBs = ( "eNB_Eurecom_LTEBox"); +# Asn1_verbosity, choice in: none, info, annoying +Asn1_verbosity = "none"; + +eNBs = +( + { + ////////// Identification parameters: + eNB_ID = 0xe00; + + cell_type = "CELL_MACRO_ENB"; + + eNB_name = "eNB_Eurecom_LTEBox"; + + // Tracking area code, 0x0000 and 0xfffe are reserved values + tracking_area_code = "1"; + + mobile_country_code = "208"; + + mobile_network_code = "95"; + + ////////// Physical parameters: + + component_carriers = ( + { + node_function = "eNodeB_3GPP"; + node_timing = "synch_to_ext_device"; + node_synch_ref = 0; + frame_type = "FDD"; + tdd_config = 3; + tdd_config_s = 0; + prefix_type = "NORMAL"; + eutra_band = 7; + downlink_frequency = 2660000000L; + uplink_frequency_offset = -120000000; + Nid_cell = 0; + N_RB_DL = 50; + Nid_cell_mbsfn = 0; + nb_antenna_ports = 1; + nb_antennas_tx = 1; + nb_antennas_rx = 1; + tx_gain = 90; + rx_gain = 125; + prach_root = 0; + prach_config_index = 0; + prach_high_speed = "DISABLE"; + prach_zero_correlation = 1; + prach_freq_offset = 2; + pucch_delta_shift = 1; + pucch_nRB_CQI = 1; + pucch_nCS_AN = 0; + pucch_n1_AN = 32; + pdsch_referenceSignalPower = -27; + pdsch_p_b = 0; + pusch_n_SB = 1; + pusch_enable64QAM = "DISABLE"; + pusch_hoppingMode = "interSubFrame"; + pusch_hoppingOffset = 0; + pusch_groupHoppingEnabled = "ENABLE"; + pusch_groupAssignment = 0; + pusch_sequenceHoppingEnabled = "DISABLE"; + pusch_nDMRS1 = 1; + phich_duration = "NORMAL"; + phich_resource = "ONESIXTH"; + srs_enable = "DISABLE"; + /* srs_BandwidthConfig =; + srs_SubframeConfig =; + srs_ackNackST =; + srs_MaxUpPts =;*/ + + pusch_p0_Nominal = -96; + pusch_alpha = "AL1"; + pucch_p0_Nominal = -100; + msg3_delta_Preamble = 6; + pucch_deltaF_Format1 = "deltaF2"; + pucch_deltaF_Format1b = "deltaF3"; + pucch_deltaF_Format2 = "deltaF0"; + pucch_deltaF_Format2a = "deltaF0"; + pucch_deltaF_Format2b = "deltaF0"; + + rach_numberOfRA_Preambles = 64; + rach_preamblesGroupAConfig = "DISABLE"; + /* + rach_sizeOfRA_PreamblesGroupA = ; + rach_messageSizeGroupA = ; + rach_messagePowerOffsetGroupB = ; + */ + rach_powerRampingStep = 4; + rach_preambleInitialReceivedTargetPower = -104; + rach_preambleTransMax = 10; + rach_raResponseWindowSize = 10; + rach_macContentionResolutionTimer = 48; + rach_maxHARQ_Msg3Tx = 4; + + pcch_default_PagingCycle = 128; + pcch_nB = "oneT"; + bcch_modificationPeriodCoeff = 2; + ue_TimersAndConstants_t300 = 1000; + ue_TimersAndConstants_t301 = 1000; + ue_TimersAndConstants_t310 = 1000; + ue_TimersAndConstants_t311 = 10000; + ue_TimersAndConstants_n310 = 20; + ue_TimersAndConstants_n311 = 1; + + ue_TransmissionMode = 1; + } + ); + + srb1_parameters : + { + # timer_poll_retransmit = (ms) [5, 10, 15, 20,... 250, 300, 350, ... 500] + timer_poll_retransmit = 80; + + # timer_reordering = (ms) [0,5, ... 100, 110, 120, ... ,200] + timer_reordering = 35; + + # timer_reordering = (ms) [0,5, ... 250, 300, 350, ... ,500] + timer_status_prohibit = 0; + + # poll_pdu = [4, 8, 16, 32 , 64, 128, 256, infinity(>10000)] + poll_pdu = 4; + + # poll_byte = (kB) [25,50,75,100,125,250,375,500,750,1000,1250,1500,2000,3000,infinity(>10000)] + poll_byte = 99999; + + # max_retx_threshold = [1, 2, 3, 4 , 6, 8, 16, 32] + max_retx_threshold = 4; + } + + # ------- SCTP definitions + SCTP : + { + # Number of streams to use in input/output + SCTP_INSTREAMS = 2; + SCTP_OUTSTREAMS = 2; + }; + + ////////// MME parameters: + mme_ip_address = ( { ipv4 = "192.168.100.101"; + ipv6 = "192:168:30::17"; + active = "yes"; + preference = "ipv4"; + } + ); + + NETWORK_INTERFACES : + { + ENB_INTERFACE_NAME_FOR_S1_MME = "eth0"; + ENB_IPV4_ADDRESS_FOR_S1_MME = "192.168.100.106/24"; + + ENB_INTERFACE_NAME_FOR_S1U = "eth0"; + ENB_IPV4_ADDRESS_FOR_S1U = "192.168.100.106/24"; + ENB_PORT_FOR_S1U = 2152; # Spec 2152 + }; + + NETWORK_CONTROLLER : + { + ENB_AGENT_INTERFACE_NAME = "eth1"; + ENB_AGENT_IPV4_ADDRESS = "10.0.2.5/30"; + ENB_AGENT_PORT = 2210; + ENB_AGENT_CACHE = "/mnt/oai_agent_cache"; + }; + + log_config : + { + global_log_level ="info"; + global_log_verbosity ="medium"; + hw_log_level ="info"; + hw_log_verbosity ="medium"; + phy_log_level ="info"; + phy_log_verbosity ="medium"; + mac_log_level ="info"; + mac_log_verbosity ="high"; + rlc_log_level ="info"; + rlc_log_verbosity ="medium"; + pdcp_log_level ="info"; + pdcp_log_verbosity ="medium"; + rrc_log_level ="info"; + rrc_log_verbosity ="medium"; + }; + } +); From c37446507ae21aff9fd4364ba8d63b19fcf66799 Mon Sep 17 00:00:00 2001 From: ROBERT Benoit Date: Tue, 25 Oct 2016 16:51:37 +0200 Subject: [PATCH 243/349] Add testing capabilities for OAI UE in autotest framework Autotest Framework modifications: -> paramiko.Transport((hostname, ports)) : issue on my configuration -> add --test-suite command line parameter to select a different test suite XML file (default is test_case_list.xml) -> add patch file functionnality when installing remote machine : required to add LOG printing for pass/fail evaluation -> add lte-softmodem-noS1 test class - fork of lte-softmodem with the following modification - no EPC management on lte-softmodem-noS1 class - add cell synchronization detection as a precondition for test results analysis - add metric extraction for pass/fail criteria (metrics are defined in XML file) - generate graphics for performances metrics (used in the HTML report -> not available in this delivery) Patch files: -> autotest_ue_cell_synch_event.patch : Add log for cell synchronization detection -> autotest_ue_dlsch_bitrate_metric.patch : Add log for DLSCH bitrate capture -> 3gpplte_turbo_decoder_sse_8bit.patch : hotfix for turbo decoder in autotest (issue followed in oai1B project) -> phy_test__target_dl_mcs.patch : hotfix for --phy-test configuration (MCS) --- cmake_targets/autotests/autotest_analyser.py | 161 + .../autotests/lib_autotest_analyser.py | 414 +++ .../3gpplte_turbo_decoder_sse_8bit.patch | 25 + .../autotest_ue_cell_synch_event.patch | 18 + .../autotest_ue_dlsch_bitrate_metric.patch | 19 + .../patches/phy_test__target_dl_mcs.patch | 17 + .../autotests/run_exec_lte-softmodem_tests.py | 664 +++- .../autotests/run_lte-softmodem-nos1_tests.py | 2785 ++++++++++++++ .../autotests/testsuite_ue_noS1_eurecom.xml | 3214 +++++++++++++++++ 9 files changed, 7315 insertions(+), 2 deletions(-) create mode 100755 cmake_targets/autotests/autotest_analyser.py create mode 100644 cmake_targets/autotests/lib_autotest_analyser.py create mode 100644 cmake_targets/autotests/patches/3gpplte_turbo_decoder_sse_8bit.patch create mode 100644 cmake_targets/autotests/patches/autotest_ue_cell_synch_event.patch create mode 100644 cmake_targets/autotests/patches/autotest_ue_dlsch_bitrate_metric.patch create mode 100644 cmake_targets/autotests/patches/phy_test__target_dl_mcs.patch create mode 100755 cmake_targets/autotests/run_lte-softmodem-nos1_tests.py create mode 100644 cmake_targets/autotests/testsuite_ue_noS1_eurecom.xml diff --git a/cmake_targets/autotests/autotest_analyser.py b/cmake_targets/autotests/autotest_analyser.py new file mode 100755 index 0000000000..a75727ad65 --- /dev/null +++ b/cmake_targets/autotests/autotest_analyser.py @@ -0,0 +1,161 @@ +#! /usr/bin/python +#****************************************************************************** +# +# \file autotest_analyser.py +# +# \par Informations +# - \b Project : UED Autotest Framework +# - \b Software : +# +# \date 16 september 2016 +# +# \version 0.1 +# +# \brief helper to test lib_autotest_analyser.py +# +# \author Benoit ROBERT (benoit.robert@syrtem.com) +# +# \par Statement of Ownership +# COPYRIGHT (c) 2016 BY SYRTEM S.A.R.L +# This software is furnished under license and may be used and copied +# only in accordance with the terms of such license and with the inclusion +# of the above COPYRIGHT notice. This SOFTWARE or any other copies thereof +# may not be provided or otherwise made available to any other person. +# No title to and ownership of the SOFTWARE is hereby transferred. +# +# The information in this SOFTWARE is subject to change without notice +# and should not be constructed as a commitment by SYRTEM. +# SYRTEM assumes no responsibility for the use or reliability of its +# SOFTWARE on equipment or platform not explicitly validated by SYRTEM. +# +# ******************************************************************************* + +import os +import getopt +import sys +from subprocess import call + + + +#test_cases = ('030001', '030901', '031001', '031601', '031701', '031801', '031901', '032001', '032101', '032201', '032301', '032501', '032601', '032801') +test_cases = ('030030' , '030030' ) + +nb_run = 3 + +def error_opt(msg): + print("Option error: " + msg) + + +def main(args): + try: + analyser = __import__("lib_autotest_analyser") + except ImportError as err: + print('Import error: ' + str(err)) + exit(0) + + + log_path = 'log_save_2016-08-14/log/' + + + + metric = {} + metric['id'] = 'UE_DLSCH_BITRATE' + metric['description'] = 'UE downlink physical throughput' + metric['regex'] = '(UE_DLSCH_BITRATE) =\s+(\d+\.\d+) kbps.+frame = (\d+)\)' + metric['unit_of_meas'] = 'kbps' + metric['min_limit'] = 14668.8 + + +#report_path = log_path+'/report/' + +#os.system(' mkdir -p ' + report_path) + +#analyser.create_report_html(report_path) + +#return(0) + + for test_case in test_cases: + +# print test_case + if test_case == '030001': + metric['min_limit'] = 500.0 + if test_case == '030901': + metric['min_limit'] = 640.0 + if test_case == '031001': + metric['min_limit'] = 3200.0 + if test_case == '031601': + metric['min_limit'] = 5920.0 + if test_case == '031701': + metric['min_limit'] = 6000.0 + if test_case == '031801': + metric['min_limit'] = 6200.0 + if test_case == '031901': + metric['min_limit'] = 7000.0 + if test_case == '032001': + metric['min_limit'] = 7800.0 + if test_case == '032101': + metric['min_limit'] = 8000.0 + if test_case == '032201': + metric['min_limit'] = 9000.0 + if test_case == '032301': + metric['min_limit'] = 10000.0 + if test_case == '032501': + metric['min_limit'] = 11000.0 + if test_case == '032601': + metric['min_limit'] = 12000.0 + if test_case == '032801': + metric['min_limit'] = 12500.0 + + if test_case == '035201': + metric['min_limit'] = 14668.8 + if test_case == '036001': + metric['min_limit'] = 25363.2 + + + + for i in range(0, nb_run): + fname = 'log//'+test_case+'/run_'+str(i)+'/UE_exec_'+str(i)+'_.log' + args = {'metric' : metric, + 'file' : fname } + + cell_synch_status = analyser.check_cell_synchro(fname) + if cell_synch_status == 'CELL_SYNCH': + print '!!!!!!!!!!!!!! Cell synchronized !!!!!!!!!!!' + metric_checks_flag = 0 + else : + print '!!!!!!!!!!!!!! Cell NOT NOT synchronized !!!!!!!!!!!' + +# metric_extracted = analyser.do_extract_metrics(args) + +# print "min = "+ str( metric_extracted['metric_min'] ) +# print "min_index = "+ str( metric_extracted['metric_min_index'] ) +# print "max = "+ str( metric_extracted['metric_max'] ) +# print "max_index = "+ str( metric_extracted['metric_max_index'] ) +# print "mean = "+ str( metric_extracted['metric_mean'] ) +# print "median = "+ str( metric_extracted['metric_median'] ) + +# verdict = analyser.do_check_verdict(metric, metric_extracted) +# print verdict + +# fname= 'report/2016-9-8_toto/'+test_case+'/UE_metric_UE_DLSCH_BITRATE_'+str(i)+'_.png' +# fname= 'report/UE_metric_UE_DLSCH_BITRATE_'+test_case+'_'+str(i)+'.png' + +# print fname +# analyser.do_img_metrics(metric, metric_extracted, fname) + +# fname = 'log//'+test_case+'/run_'+str(i)+'/UE_traffic_'+str(i)+'_.log' + +# args = {'file' : fname } + +# traffic_metrics = analyser.do_extract_traffic_metrics(args) + +# fname= 'report/iperf_'+test_case+'_'+str(i)+'.png' + +# print fname +# analyser.do_img_traffic(traffic_metrics, fname) + + + +if __name__ == "__main__": + main(sys.argv) + diff --git a/cmake_targets/autotests/lib_autotest_analyser.py b/cmake_targets/autotests/lib_autotest_analyser.py new file mode 100644 index 0000000000..92dcc31e48 --- /dev/null +++ b/cmake_targets/autotests/lib_autotest_analyser.py @@ -0,0 +1,414 @@ +#****************************************************************************** +# +# \file lib_autotest_analyser.py +# +# \par Informations +# - \b Project : UED Autotest Framework +# - \b Software : +# +# \date 16 september 2016 +# +# \version 0.1 +# +# \brief library to extract metrics from autotest logs and assign a verdict +# +# \author Benoit ROBERT (benoit.robert@syrtem.com) +# +# \par Statement of Ownership +# COPYRIGHT (c) 2016 BY SYRTEM S.A.R.L +# This software is furnished under license and may be used and copied +# only in accordance with the terms of such license and with the inclusion +# of the above COPYRIGHT notice. This SOFTWARE or any other copies thereof +# may not be provided or otherwise made available to any other person. +# No title to and ownership of the SOFTWARE is hereby transferred. +# +# The information in this SOFTWARE is subject to change without notice +# and should not be constructed as a commitment by SYRTEM. +# SYRTEM assumes no responsibility for the use or reliability of its +# SOFTWARE on equipment or platform not explicitly validated by SYRTEM. +# +# ******************************************************************************* + + +import re +from pylab import * +from matplotlib.font_manager import FontProperties + +import os +from jinja2 import Environment, FileSystemLoader + + +PATH = os.path.dirname(os.path.abspath(__file__)) +TEMPLATE_ENVIRONMENT = Environment( + autoescape=False, + loader=FileSystemLoader(os.path.join(PATH, 'templates')), + trim_blocks=False) + + +def render_template(template_filename, context): + return TEMPLATE_ENVIRONMENT.get_template(template_filename).render(context) + + + +def init(args = None): + return + + +# +# +# +def do_extract_metrics(args): + +# print "" +# print "do_extract_metrics ... " + + fname = args['file'] + metric = args['metric'] +# print(fname) +# print 'metric id = ' + metric['id'] +# print 'metric regex = ' + metric['regex'] + + count = 0 + mmin = 0 + mmin_index = 0 + mmax = 0 + mmax_index = 0 + mean = 0 + median = 0 + + + output = np.fromregex(fname,metric['regex'], [('id', 'S20'), ('metric', np.float), ('frame', np.int)] ) +# print 'T0T0 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!' +# print output + count = output['metric'].size +# print count + if count > 0: + mmin = np.amin(output['metric']); + mmin_index = np.argmin(output['metric']); + mmax = np.amax(output['metric']); + mmax_index = np.argmax(output['metric']); + mean = np.mean(output['metric']); + median = np.median(output['metric']); + +# print ( ( (metric['min_limit'] > output['metric']).sum() / float(output['metric'].size) ) * 100 ) + + ret = { 'metric_count' : count, + 'metric_buf' : output, + 'metric_min' : mmin, + 'metric_min_index' : mmin_index, + 'metric_max' : mmax, + 'metric_max_index' : mmax_index, + 'metric_mean' : mean, + 'metric_median' : median, + } + return(ret) + +# +# +# +def do_check_verdict(metric_def, metric_data): + verdict = 'INCON' + + pass_fail_stat = metric_def['pass_fail_stat'] + + if pass_fail_stat == 'max_value': + metric_stat = metric_data['metric_max'] + elif pass_fail_stat == 'min_value': + metric_stat = metric_data['metric_min'] + elif pass_fail_stat == 'mean_value': + metric_stat = metric_data['metric_mean'] + elif pass_fail_stat == 'median_value': + metric_stat = metric_data['metric_median'] + else : + print "do_check_verdict -> undef metric stat (pass_fail_stat in xml file)" + return verdict + + if 'max_limit' in metric_def: + if metric_stat > metric_def['max_limit']: + verdict = 'FAIL' + else: + verdict = 'PASS' + + if 'min_limit' in metric_def: + if metric_stat < metric_def['min_limit']: + verdict = 'FAIL' + else: + verdict = 'PASS' + return verdict + + +def do_print_metrics(metric_def, metric_data): + + + if metric_data['metric_count'] > 0 : + +# output = np.array( metric_data['metric_buf'] , [('id', 'S20'), ('metric', np.float), ('frame', np.int)]) + output = metric_data['metric_buf'] +# print output + + fontP = FontProperties() + fontP.set_size('small') + + plt.scatter(output['frame'], output['metric'], color='b', alpha=0.33, s = 1 ) + plt.plot([0, output['frame'][metric_data['metric_count']-1]],[ metric_def['min_limit'],metric_def['min_limit']], 'r-', lw=2) # Red straight line + + plt.title('Physical throughput ') + plt.xlabel('frame') + plt.ylabel(metric_def['id']) + plt.legend(prop=fontP) + mng = plt.get_current_fig_manager() + plt.show() + +def do_img_metrics(metric_def, metric_data, fname): + + + if metric_data['metric_count'] > 0 : + +# output = np.array( metric_data['metric_buf'] , [('id', 'S20'), ('metric', np.float), ('frame', np.int)]) + output = metric_data['metric_buf'] +# print 'TITI !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!' +# print output + +# print metric_def['min_limit'] +# print metric_data['metric_count'] +# print output['frame'][metric_data['metric_count']-1] + + fontP = FontProperties() + fontP.set_size('small') + + plt.figure() + +# print output['frame'].size +# print output['metric'].size + + plt.scatter(output['frame'], output['metric'], color='b', alpha=0.33, s = 1 , label=metric_def['id']) + plt.plot([0, output['frame'][metric_data['metric_count']-1]],[ metric_def['min_limit'],metric_def['min_limit']], 'r-', lw=2, label='min limit') # Red straight line + + plt.title('Physical throughput ('+metric_def['unit_of_meas']+')') + plt.xlabel('frame') + plt.ylabel(metric_def['id']) + + # Set graphic minimum Y axis + # ------------------------- + if metric_data['metric_min'] == 0 : + plt.ylim(ymin=-metric_def['min_limit']/10) + else : + plt.ylim(ymin=0) + + y_axis_max = 0 + if metric_data['metric_max'] > metric_def['min_limit']: + y_axis_max =metric_data['metric_max']+metric_data['metric_max']/10 + else: + y_axis_max =metric_def['min_limit']+metric_def['min_limit']/10 + + plt.ylim(ymax=y_axis_max) + + lgd = plt.legend(prop=fontP, bbox_to_anchor=(1.05, 1), loc=2, borderaxespad=0.) + mng = plt.get_current_fig_manager() + plt.savefig(fname, bbox_extra_artists=(lgd,), bbox_inches='tight') + plt.close() + +# with open(fname, 'r') as f: +# for line in f: +# m = re.search(metric['regex'], line) +# if m : +# print m.group(1) + " -> "+m.group(2) + + + + +def do_extract_traffic_metrics(args): + + print "" + print "do_extract_traffic_metrics ... " + + fname = args['file'] + +# print(fname) +# print 'metric id = ' + metric['id'] + +#[ ID] Interval Transfer Bandwidth Jitter Lost/Total Datagrams +#[ 3] 0.0- 1.0 sec 238 KBytes 1.95 Mbits/sec 0.980 ms 2/ 174 (1.1%) +# [ 3] 0.0- 1.0 sec 63.2 KBytes 517 Kbits/sec 0.146 ms 1/ 45 (2.2%) + +# iperf_regex = '[\s*(\d+)]\s+\d+\.\d+-\s*(\d+\.\d+)\s+sec\s+(\d+).+(\d+\.\d+).+(\d+\.\d+).+(\d+)\/\s*(\d+)\s+\((\d+\.\d+)\%\)' + # ID 0.0 1.0 63.2 KByte 517 Kbits/s 0.146 + iperf_regex = '\[\s*(\d+)\]\s+(\d+\.*\d*)-\s*(\d+\.*\d*)\s+sec\s+(\d+\.*\d*)\s+(\D+)\s+(\d+\.*\d*)\s+(\D+)\s+(\d+\.*\d*)\s+ms\s+(\d+)\/\s*(\d+)\s+\((\d+\.*\d*)\%\)' +# print 'iperf regex = ' + iperf_regex + + count = 0 + bw_min = 0 + bw_max = 0 + bw_mean = 0 + bw_median = 0 + jitter_min = 0 + jitter_max = 0 + jitter_mean = 0 + jitter_median = 0 + + rl_min = 0 + rl_max = 0 + rl_mean = 0 + rl_median = 0 + + interval_stop_max = 0 + + output = np.fromregex(fname,iperf_regex, [('id', np.int) , ('interval_start', np.float), ('interval_stop', np.float), ('transfer', np.float), ('transfer_uom', 'S20') ,('bandwidth', np.float), ('bandwidth_uom', 'S20') ,('jitter', np.float), ('lost', np.int) , ('total', np.int), ('rate_lost', np.float) ] ) + + count = output['id'].size -1 + # remove last line that is an iperf result resume + + if count > 0: + + output= np.delete(output, (count), axis=0 ) +# print output + + bw_min = np.amin(output['bandwidth']); + bw_max = np.amax(output['bandwidth']); + bw_mean = np.mean(output['bandwidth']); + bw_median = np.median(output['bandwidth']); + + jitter_min = np.amin(output['jitter']); + jitter_max = np.amax(output['jitter']); + jitter_mean = np.mean(output['jitter']); + jitter_median = np.median(output['jitter']); + + rl_min = np.amin(output['rate_lost']); + rl_max = np.amax(output['rate_lost']); + rl_mean = np.mean(output['rate_lost']); + rl_median = np.median(output['rate_lost']); + + interval_stop_max = np.amax(output['interval_stop']); + + else : + count = 0 + + + ret = { 'traffic_count' : count, + 'traffic_buf' : output, + 'bw_min' : bw_min, + 'bw_max' : bw_max, + 'bw_mean' : bw_mean, + 'bw_median' : bw_median, + 'jitter_min' : jitter_min, + 'jitter_max' : jitter_max, + 'jitter_mean' : jitter_mean, + 'jitter_median' : jitter_median, + 'rl_min' : rl_min, + 'rl_max' : rl_max, + 'rl_mean' : rl_mean, + 'rl_median' : rl_median, + 'interval_stop_max' : interval_stop_max + } + return(ret) + + + + +def do_img_traffic(traffic_data, fname): + + + if traffic_data['traffic_count'] > 0 : + + output = traffic_data['traffic_buf'] + + + fontP = FontProperties() + fontP.set_size('small') + + fig = plt.figure(1) + + ax1= plt.subplot(311) + plt.plot(output['interval_stop'], output['bandwidth'], color='b' ) + ax1.set_title('Bandwidth (Mbits/s)') + ax1.set_ylim(ymin=-1) + ax1.set_xlim(xmax=np.amax(output['interval_stop'])) + text='min: '+str(traffic_data['bw_min'])+'\nmax: '+str(traffic_data['bw_max'])+'\nmean: '+str(traffic_data['bw_mean'])+'\nmedian: '+str(traffic_data['bw_median']) + ax1.text( np.amax(output['interval_stop'])+10,0,text) + + + ax2=plt.subplot(312) + plt.plot(output['interval_stop'], output['jitter'], color='b' ) + ax2.set_title('Jitter (ms)') + ax2.set_xlim(xmax=np.amax(output['interval_stop'])) + ax2.set_ylim(ymin=-1) + text='min: '+str(traffic_data['jitter_min'])+'\nmax: '+str(traffic_data['jitter_max'])+'\nmean: '+str(traffic_data['jitter_mean'])+'\nmedian: '+str(traffic_data['jitter_median']) + ax2.text( np.amax(output['interval_stop'])+10,0,text) + + ax3=plt.subplot(313) + plt.plot(output['interval_stop'], output['rate_lost'], color='b') + ax3.set_title('Loss rate %') + ax3.set_xlim(xmax=np.amax(output['interval_stop'])) + ax3.set_ylim(ymin=-1) + text='min: '+str(traffic_data['rl_min'])+'\nmax: '+str(traffic_data['rl_max'])+'\nmean: '+str(traffic_data['rl_mean'])+'\nmedian: '+str(traffic_data['rl_median']) + ax3.text( np.amax(output['interval_stop'])+10,0,text) + + +# plt.title('Physical throughput ('+metric_def['unit_of_meas']+')') + plt.xlabel('time (s)') +# plt.ylabel(metric_def['id']) + + # Set graphic minimum Y axis + # ------------------------- +# if traffic_data['bw_min'] == 0 : +# plt.ylim(ymin=-metric_def['min_limit']/10) +# else : +# plt.ylim(ymin=0) + +# y_axis_max = 0 +# if traffic_data['metric_max'] > metric_def['min_limit']: +# y_axis_max =traffic_data['metric_max']+traffic_data['metric_max']/10 +# else: +# y_axis_max =metric_def['min_limit']+metric_def['min_limit']/10 +# +# plt.ylim(ymax=y_axis_max) + + plt.tight_layout() + + lgd = plt.legend(prop=fontP, bbox_to_anchor=(1.05, 1), loc=2, borderaxespad=0.) + mng = plt.get_current_fig_manager() + plt.savefig(fname, bbox_inches='tight') + plt.close() + + + + +def create_report_html(context): + fname = context['report_path']+"/index.html" + + # + with open(fname, 'w') as f: + html = render_template('index.html', context) + f.write(html) + + +def create_test_report_detailed_html(context, fname ): + with open(fname, 'w') as f: + html = render_template('testcase_report.html', context) + f.write(html) + + +def check_cell_synchro(fname): + + with open(fname, 'r') as f: + for line in f: + + m = re.search('AUTOTEST Cell Sync \:', line) + if m : + print line + return 'CELL_SYNCH' + + return 'CELL_NOT_SYNCH' + + +def check_exec_seg_fault(fname): + + with open(fname, 'r') as f: + for line in f: + m = re.search('Segmentation fault', line) + if m : + print line + return 'SEG_FAULT' + + return 'NO_SEG_FAULT' + diff --git a/cmake_targets/autotests/patches/3gpplte_turbo_decoder_sse_8bit.patch b/cmake_targets/autotests/patches/3gpplte_turbo_decoder_sse_8bit.patch new file mode 100644 index 0000000000..957778f332 --- /dev/null +++ b/cmake_targets/autotests/patches/3gpplte_turbo_decoder_sse_8bit.patch @@ -0,0 +1,25 @@ +diff --git a/openair1/PHY/CODING/3gpplte_turbo_decoder_sse_8bit.c b/openair1/PHY/CODING/3gpplte_turbo_decoder_sse_8bit.c +index d2c7ac6..0853373 100644 +--- a/openair1/PHY/CODING/3gpplte_turbo_decoder_sse_8bit.c ++++ b/openair1/PHY/CODING/3gpplte_turbo_decoder_sse_8bit.c +@@ -493,7 +493,7 @@ void compute_beta8(llr_t* alpha,llr_t* beta,llr_t *m_11,llr_t* m_10,unsigned sho + + #endif + +- if (frame_length > 6143) { ++ if (frame_length > 6144) { + LOG_E(PHY,"compute_beta: frame_length %d\n",frame_length); + return; + } +@@ -979,6 +979,11 @@ unsigned char phy_threegpplte_turbo_decoder8(short *y, + } else + n2 = n; + ++ if(n2<256) ++ { ++ printf("phy_threegpplte_turbo_decoder8 : frame length < 256\n"); ++ return 255; ++ } + + for (iind=0; iind < 188 && f1f2mat[iind].nb_bits != n; iind++); + diff --git a/cmake_targets/autotests/patches/autotest_ue_cell_synch_event.patch b/cmake_targets/autotests/patches/autotest_ue_cell_synch_event.patch new file mode 100644 index 0000000000..8c80d55871 --- /dev/null +++ b/cmake_targets/autotests/patches/autotest_ue_cell_synch_event.patch @@ -0,0 +1,18 @@ +diff --git a/openair1/PHY/LTE_TRANSPORT/initial_sync.c b/openair1/PHY/LTE_TRANSPORT/initial_sync.c +index 71372d9..763397b 100644 +--- a/openair1/PHY/LTE_TRANSPORT/initial_sync.c ++++ b/openair1/PHY/LTE_TRANSPORT/initial_sync.c +@@ -477,6 +477,13 @@ int initial_sync(PHY_VARS_UE *ue, runmode_t mode) + //#endif + + if (ue->UE_scan_carrier == 0) { ++ ++ /* SYRTEM */ ++ printf("AUTOTEST Cell Sync : frame = %d, rx_offset %d, freq_offset %d \n", ++ ue->proc.proc_rxtx[0].frame_rx, ++ ue->rx_offset, ++ ue->common_vars.freq_offset ); ++ + if (ue->mac_enabled==1) { + LOG_I(PHY,"[UE%d] Sending synch status to higher layers\n",ue->Mod_id); + //mac_resynch(); diff --git a/cmake_targets/autotests/patches/autotest_ue_dlsch_bitrate_metric.patch b/cmake_targets/autotests/patches/autotest_ue_dlsch_bitrate_metric.patch new file mode 100644 index 0000000000..e8213960e1 --- /dev/null +++ b/cmake_targets/autotests/patches/autotest_ue_dlsch_bitrate_metric.patch @@ -0,0 +1,19 @@ +diff --git a/openair1/SCHED/phy_procedures_lte_ue.c b/openair1/SCHED/phy_procedures_lte_ue.c +index 3ed4c79..da88000 100644 +--- a/openair1/SCHED/phy_procedures_lte_ue.c ++++ b/openair1/SCHED/phy_procedures_lte_ue.c +@@ -2944,6 +2944,14 @@ int phy_procedures_UE_RX(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uin + LOG_D(PHY,"[UE %d] Calculating bitrate Frame %d: total_TBS = %d, total_TBS_last = %d, bitrate %f kbits\n", + ue->Mod_id,frame_rx,ue->total_TBS[eNB_id], + ue->total_TBS_last[eNB_id],(float) ue->bitrate[eNB_id]/1000.0); ++ ++ /* SYRTEM */ ++ if ((frame_rx % 100 == 0)) { ++ printf("AUTOTEST Metric : UE_DLSCH_BITRATE = %5.2f kbps (frame = %d) \n", (float) ue->bitrate[eNB_id]/1000.0, frame_rx); ++ /* End of SYRTEM */ ++ } ++ ++ + } + + diff --git a/cmake_targets/autotests/patches/phy_test__target_dl_mcs.patch b/cmake_targets/autotests/patches/phy_test__target_dl_mcs.patch new file mode 100644 index 0000000000..ec8c43cb72 --- /dev/null +++ b/cmake_targets/autotests/patches/phy_test__target_dl_mcs.patch @@ -0,0 +1,17 @@ + +diff --git a/targets/RT/USER/lte-softmodem.c b/targets/RT/USER/lte-softmodem.c +index 96645f8..a7f1dfb 100644 +--- a/targets/RT/USER/lte-softmodem.c ++++ b/targets/RT/USER/lte-softmodem.c +@@ -1602,6 +1602,11 @@ int main( int argc, char **argv ) + PHY_vars_eNB_g[0][CC_id] = init_lte_eNB(frame_parms[CC_id],0,frame_parms[CC_id]->Nid_cell,abstraction_flag); + PHY_vars_eNB_g[0][CC_id]->CC_id = CC_id; + ++ PHY_vars_eNB_g[0][CC_id]->ue_dl_rb_alloc=0x1fff; ++ PHY_vars_eNB_g[0][CC_id]->target_ue_dl_mcs=target_dl_mcs; ++ PHY_vars_eNB_g[0][CC_id]->ue_ul_nb_rb=6; ++ PHY_vars_eNB_g[0][CC_id]->target_ue_ul_mcs=target_ul_mcs; ++ + if (phy_test==1) PHY_vars_eNB_g[0][CC_id]->mac_enabled = 0; + else PHY_vars_eNB_g[0][CC_id]->mac_enabled = 1; + diff --git a/cmake_targets/autotests/run_exec_lte-softmodem_tests.py b/cmake_targets/autotests/run_exec_lte-softmodem_tests.py index 1dfd67b682..796235a77f 100755 --- a/cmake_targets/autotests/run_exec_lte-softmodem_tests.py +++ b/cmake_targets/autotests/run_exec_lte-softmodem_tests.py @@ -37,6 +37,8 @@ import math #from time import clock import xml.etree.ElementTree as ET import re +from colorama import Fore, Back, Style + import numpy as np import log @@ -167,7 +169,7 @@ def sftp_module (username, password, hostname, ports, paramList,logfile): #paramiko logfile path should not be changed with multiple calls. The logs seem to in first file regardless error = "" #The lines below are outside exception loop to be sure to terminate the test case if the network connectivity goes down or there is authentication failure - transport = paramiko.Transport(hostname, ports) + transport = paramiko.Transport((hostname, ports)) transport.connect(username = username, password = password) sftp = paramiko.SFTPClient.from_transport(transport) # index =0 @@ -1042,6 +1044,609 @@ def handle_testcaseclass_softmodem (testcase, oldprogramList, logdirOAI5GRepo , write_file(xmlFile, xml, mode="w") + + +# \brief handler for executing test cases (lte-softmodem-noS1) +# \param testcase name of testcase +# \param oldprogramList list of programs which must be terminated before running a test case +# \param logdirOAI5GRepo directory on remote machine which has openairinterface5g repo installed +# \param logdirOpenaircnRepo directory on remote machine which has openair-cn repo installed +# \param MachineList list of all machines on which test cases can be run +# \param user username with which to login +# \param password password with which to login +# \param CleanupAluLteBox string that contains commands to stop ALU Bell Labs LTEBox (specified in test_case_list.xml) +# \param ExmimoRfStop command to stop EXMIMO Card +# \param nruns_lte-softmodem global parameter to override number of runs (nruns) within the test case +def handle_testcaseclass_softmodem_noS1 (testcase, oldprogramList, logdirOAI5GRepo , logdirOpenaircnRepo, MachineList, user, password, CleanUpAluLteBox, ExmimoRfStop, nruns_lte_softmodem, timeout_cmd): + #We ignore the password sent to this function for secuirity reasons for password present in log files + #It is recommended to add a line in /etc/sudoers that looks something like below. The line below will run sudo without password prompt + # your_user_name ALL=(ALL:ALL) NOPASSWD: ALL + + indent="\t" + threads=[] + + # + # Test case parameters + # ----------------------------------------------------------------------------- + testcase_verdict = 'PASS' + testcase_time_start = datetime.datetime.now() + testcase_name = testcase.get('id') + testcase_class = testcase.findtext('class',default='') + testcase_desc = testcase.findtext('desc',default='') + if timeout_cmd == '': + timeout_cmd = testcase.findtext('TimeOut_cmd',default='') + timeout_cmd = int(float(timeout_cmd)) + timeout_thread = timeout_cmd + 60 #Timeout_thread is more than that of cmd to have room for compilation time, etc + if nruns_lte_softmodem == '': + nruns = testcase.findtext('nruns',default='') + else: + nruns = nruns_lte_softmodem + nruns = int(float(nruns)) + tags = testcase.findtext('tags',default='') + + max_ntries = testcase.findtext('max_ntries',default='') + if max_ntries : + max_ntries = int(float(max_ntries)) + else : + max_ntries = nruns + + print( indent + "> testcase time start : " + str(testcase_time_start) ) + print( indent + "> testcase class : " + testcase_class ) + print( indent + "> testcase description : " + testcase_desc ) + print( indent + "> testcase timeout : " + str(timeout_cmd) ) + print( indent + "> testcase thread timeout : " + str(timeout_thread) ) + print( indent + "> number of runs : " + str(nruns) ) + print( indent + "> number of max tries : " + str(max_ntries) ) + print( indent + "> testcase tags : " + tags ) + + logdir_local_testcase = openairdir_local + '/cmake_targets/autotests/log/'+ testcasename + logdir_eNB_testcase = logdirOAI5GRepo +'/cmake_targets/autotests/log/'+ testcasename + logdir_UE_testcase = logdirOAI5GRepo +'/cmake_targets/autotests/log/'+ testcasename + + # + # Local checks for test cases + # ----------------------------------------------- + + # Logging directory + if (not os.path.exists(logdir_local_testcase)): + os.system('mkdir -p ' + logdir_local_testcase) + + # + # REMOTE MACHINE COMPILATION + # ------------------------------------------------ + + eNBMachine = testcase.findtext('eNB',default='') + eNB_config_file = testcase.findtext('eNB_config_file',default='') + eNB_compile_prog = testcase.findtext('eNB_compile_prog',default='') + eNB_compile_prog_args = testcase.findtext('eNB_compile_prog_args',default='') + + logfile_compile_eNB = logdir_eNB_testcase + '/eNB_compile.log' + logfile_task_eNB_compile_out = logdir_eNB_testcase + '/eNB_task_compile_out.log' + logfile_task_eNB_compile = logdir_local_testcase + '/eNB_task_compile.log' + + # Check that machine is in test setup machine list + print( Fore.WHITE + indent + "> testcase eNB machine :"), + if (eNBMachine not in MachineList): + print( Fore.RED + eNBMachine + " not in test setup machine list") + testcase_verdict = 'INCON' + else : + print eNBMachine, + # get machine description + eNBMachineDesc = MachineDescDic[eNBMachine] + index_eNBMachine = MachineList.index(eNBMachine) + # check that openairinterface is installed on machine + oai_eNB = openair('localdomain', eNBMachine) + oai_eNB.connect(user, password) + cmd = 'cd ' + logdirOAI5GRepo + '; source oaienv ; env|grep --color=never OPENAIR' + res= oai_eNB.send_recv(cmd) + m = re.search('OPENAIR_HOME', res, re.DOTALL) + if m: + print + # Create testcase directory on remote eNB + cmd = 'rm -fr ' + logdir_eNB_testcase + ' ; mkdir -p ' + logdir_eNB_testcase + result = oai_eNB.send_recv(cmd) + + # Check if we need to compile lte-softmodem-noS1 on remote machine + eNB_compile_cmd = eNB_compile_prog + ' '+ eNB_compile_prog_args + if ('last_compile_prog' in eNBMachineDesc) and eNBMachineDesc['last_compile_prog'] == eNB_compile_cmd: + print( Fore.WHITE + indent + "> eNB machine compilation : skipped -> "+eNB_compile_cmd ) + else: + print( Fore.WHITE + indent + "> eNB machine compilation : triggered -> "+eNB_compile_cmd ) + eNBMachineDesc['last_compile_prog'] = eNB_compile_prog + ' '+ eNB_compile_prog_args # if last compilation is the same do not compile again + task_eNB_compile = ' ( uname -a ; date \n' + task_eNB_compile = task_eNB_compile + 'cd ' + logdirOAI5GRepo + ' ; source oaienv ; source cmake_targets/tools/build_helper \n' + task_eNB_compile = task_eNB_compile + 'env |grep OPENAIR \n' + task_eNB_compile = task_eNB_compile + update_config_file(oai_eNB, eNB_config_file, logdirOAI5GRepo, '$OPENAIR_DIR/cmake_targets/autotests/tools/search_repl.py') + '\n' + if eNB_compile_cmd != "": + task_eNB_compile = task_eNB_compile + ' ( ' + eNB_compile_cmd + ' ) > ' + logfile_compile_eNB + ' 2>&1 \n' + task_eNB_compile = task_eNB_compile + ' date ) > ' + logfile_task_eNB_compile_out + ' 2>&1 ' + write_file(logfile_task_eNB_compile, task_eNB_compile, mode="w") + + + thread_eNB = oaiThread(1, "eNB_thread_compile", eNBMachine, user, password , task_eNB_compile, False, timeout_thread) + threads.append(thread_eNB) + thread_eNB.start() + + else: + print( Fore.RED + " -> OAI5G not properly setup ! please check REMOTE MACHINE PREPARATION step") + testcase_verdict = 'INCON' + + + UEMachine = testcase.findtext('UE',default='') + UE_config_file = testcase.findtext('UE_config_file',default='') + UE_compile_prog = testcase.findtext('UE_compile_prog',default='') + UE_compile_prog_args = testcase.findtext('UE_compile_prog_args',default='') + + logfile_compile_UE = logdir_UE_testcase + '/UE_compile.log' + logfile_task_UE_compile_out = logdir_UE_testcase + '/UE_task_compile_out.log' + logfile_task_UE_compile = logdir_local_testcase + '/UE_task_compile.log' + + # Check that machine is in test setup machine list + print( Fore.WHITE + indent + "> testcase UE machine :"), + if (UEMachine not in MachineList): + print( Fore.RED + UEMachine + " not in test setup machine list") + testcase_verdict = 'INCON' + else : + print UEMachine, + # get machine description + UEMachineDesc = MachineDescDic[UEMachine] + index_UEMachine = MachineList.index(UEMachine) + # check that openairinterface is installed on machine + oai_UE = openair('localdomain', UEMachine) + oai_UE.connect(user, password) + cmd = 'cd ' + logdirOAI5GRepo + '; source oaienv ; env|grep --color=never OPENAIR' + res= oai_UE.send_recv(cmd) + m = re.search('OPENAIR_HOME', res, re.DOTALL) + if m: + print + # Create testcase directory on remote UE + cmd = 'rm -fr ' + logdir_UE_testcase + ' ; mkdir -p ' + logdir_UE_testcase + result = oai_UE.send_recv(cmd) + + # Check if we need to compile lte-softmodem-noS1 on remote machine + UE_compile_cmd = UE_compile_prog + ' '+ UE_compile_prog_args + if ('last_compile_prog' in UEMachineDesc) and UEMachineDesc['last_compile_prog'] == UE_compile_cmd: + print( Fore.WHITE + indent + "> UE machine compilation : skipped -> "+UE_compile_cmd ) + else: + print( Fore.WHITE + indent + "> UE machine compilation : triggered -> "+UE_compile_cmd ) + UEMachineDesc['last_compile_prog'] = UE_compile_prog + ' '+ UE_compile_prog_args + task_UE_compile = ' ( uname -a ; date \n' + task_UE_compile = task_UE_compile + 'cd ' + logdirOAI5GRepo + ' ; source oaienv ; source cmake_targets/tools/build_helper \n' + task_UE_compile = task_UE_compile + 'env |grep OPENAIR \n' + task_UE_compile = task_UE_compile + update_config_file(oai_UE, UE_config_file, logdirOAI5GRepo, '$OPENAIR_DIR/cmake_targets/autotests/tools/search_repl.py') + '\n' + if UE_compile_cmd != "": + task_UE_compile = task_UE_compile + ' ( ' + UE_compile_cmd + ' ) > ' + logfile_compile_UE + ' 2>&1 \n' + task_UE_compile = task_UE_compile + ' date ) > ' + logfile_task_UE_compile_out + ' 2>&1 ' + write_file(logfile_task_UE_compile, task_UE_compile, mode="w") + + thread_UE = oaiThread(2, "UE_thread_compile", UEMachine, user, password , task_UE_compile, False, timeout_thread) + threads.append(thread_UE) + thread_UE.start() + + else: + print( Fore.RED + " -> OAI5G not properly setup ! please check REMOTE MACHINE PREPARATION step") + testcase_verdict = 'INCON' + + + + + + + # Wait for Compilation thread to terminate + #----------------------------------------- + for t in threads: + t.join() + + # TODO check that compilation is succeed + + #first we compile all the programs +# thread_UE = oaiThread(3, "UE_thread", UEMachine, user, password , task_UE_compile, False, timeout_thread) +# threads.append(thread_UE) +# thread_UE.start() + + + + + +# index_UEMachine = MachineList.index(UEMachine) +# oai_UE = openair('localdomain', UEMachine) +# oai_UE.connect(user, password) +# res = oai_UE.send_recv(cmd) +# res = oai_eNB.send_recv(cmd) + + + + # + # RUN LOOP + # ------------------------------------------------ + if testcase_verdict != 'PASS': # if something went wrong to not run test cases + max_ntries=0 + + runs_results = [] + nb_runs = 0 + nb_run_pass = 0 + nb_run_failed = 0 + nb_run_inc = 0 + nb_run_skip = 0 + + nb_seg_fault = 0 + + for run in range(0,max_ntries): + + if nruns == nb_run_pass + nb_run_failed: + break + + nb_runs += 1 + + # + # RUN initialization + # ---------------------------------------------------- + print (Fore.WHITE + indent + "> RUN_"+str(run).zfill(2)+" : " ), + + sys.stdout.flush() + + run_start_time=datetime.datetime.now() + + logdir_local_run = openairdir_local + '/cmake_targets/autotests/log/'+ testcasename + '/run_' + str(run) + logdir_eNB_run = logdirOAI5GRepo +'/cmake_targets/autotests/log/' + testcasename + '/run_' + str(run) + logdir_UE_run = logdirOAI5GRepo +'/cmake_targets/autotests/log/' + testcasename + '/run_' + str(run) + + cmd = 'rm -fr ' + logdir_eNB_run + ' ; mkdir -p ' + logdir_eNB_run + result = oai_eNB.send_recv(cmd) + cmd = 'rm -fr ' + logdir_UE_run + ' ; mkdir -p ' + logdir_UE_run + result = oai_UE.send_recv(cmd) + cmd = ' rm -fr ' + logdir_local_run + ' ; mkdir -p ' + logdir_local_run + result = os.system(cmd) + + + # + # RUN parametrization + # ---------------------------------------------------- + eNB_pre_exec = testcase.findtext('eNB_pre_exec',default='') + eNB_pre_exec_args = testcase.findtext('eNB_pre_exec_args',default='') + eNB_main_exec = testcase.findtext('eNB_main_exec',default='') + eNB_main_exec_args = testcase.findtext('eNB_main_exec_args',default='') + eNB_traffic_exec = testcase.findtext('eNB_traffic_exec',default='') + eNB_traffic_exec_args = testcase.findtext('eNB_traffic_exec_args',default='') + eNB_terminate_missing_procs = testcase.findtext('eNB_terminate_missing_procs',default='True') + + logfile_exec_eNB = logdir_eNB_run + '/eNB_exec' + '_' + str(run) + '_.log' + logfile_pre_exec_eNB = logdir_eNB_run + '/eNB_pre_exec' + '_' + str(run) + '_.log' + logfile_task_eNB_out = logdir_eNB_run + '/eNB_task_out' + '_' + str(run) + '_.log' + logfile_traffic_eNB = logdir_eNB_run + '/eNB_traffic' + '_' + str(run) + '_.log' + logfile_task_eNB = logdir_local_run + '/eNB_task' + '_' + str(run) + '_.log' + + task_eNB = ' ( uname -a ; date \n' + task_eNB = task_eNB + 'cd ' + logdirOAI5GRepo + ' ; source oaienv ; source cmake_targets/tools/build_helper \n' + task_eNB = task_eNB + 'env |grep OPENAIR \n' + 'array_exec_pid=() \n' + if eNB_pre_exec != "": + task_eNB = task_eNB + ' ( date; ' + eNB_pre_exec + ' '+ eNB_pre_exec_args + ' ) > ' + logfile_pre_exec_eNB + ' 2>&1 \n' + if eNB_main_exec != "": + task_eNB = task_eNB + ' ( date; ' + addsudo(eNB_main_exec + ' ' + eNB_main_exec_args, '') + ' ) > ' + logfile_exec_eNB + ' 2>&1 & \n' + task_eNB = task_eNB + 'array_exec_pid+=($!) \n' + task_eNB = task_eNB + 'echo eNB_main_exec PID = $! \n' + if eNB_traffic_exec != "": + cmd_traffic = eNB_traffic_exec + ' ' + eNB_traffic_exec_args + if cmd_traffic.find('-c') >= 0: + cmd_traffic = cmd_traffic + ' -t ' + str(timeout_cmd - 80) + task_eNB = task_eNB + ' (date; ' + cmd_traffic + ' ) > ' + logfile_traffic_eNB + ' 2>&1 & \n' + task_eNB = task_eNB + 'array_exec_pid+=($!) \n' + task_eNB = task_eNB + 'echo eNB_traffic_exec PID = $! \n' + #terminate the eNB test case after timeout_cmd seconds + task_eNB = task_eNB + finalize_deploy_script (timeout_cmd, eNB_terminate_missing_procs) + ' \n' + #task_eNB = task_eNB + 'sleep ' + str(timeout_cmd) + ' \n' + task_eNB = task_eNB + 'handle_ctrl_c' + '\n' + task_eNB = task_eNB + ' ) > ' + logfile_task_eNB_out + ' 2>&1 ' + write_file(logfile_task_eNB, task_eNB, mode="w") + + + UE_pre_exec = testcase.findtext('UE_pre_exec',default='') + UE_pre_exec_args = testcase.findtext('UE_pre_exec_args',default='') + UE_main_exec = testcase.findtext('UE_main_exec',default='') + UE_main_exec_args = testcase.findtext('UE_main_exec_args',default='') + UE_traffic_exec = testcase.findtext('UE_traffic_exec',default='') + UE_traffic_exec_args = testcase.findtext('UE_traffic_exec_args',default='') + UE_terminate_missing_procs = testcase.findtext('UE_terminate_missing_procs',default='True') + UE_search_expr_true = testcase.findtext('UE_search_expr_true','') + + logfile_exec_UE = logdir_UE_run + '/UE_exec' + '_' + str(run) + '_.log' + logfile_pre_exec_UE = logdir_UE_run + '/UE_pre_exec' + '_' + str(run) + '_.log' + logfile_task_UE_out = logdir_UE_run + '/UE_task_out' + '_' + str(run) + '_.log' + logfile_traffic_UE = logdir_UE_run + '/UE_traffic' + '_' + str(run) + '_.log' + logfile_task_UE = logdir_local_run + '/UE_task' + '_' + str(run) + '_.log' + + + task_UE = ' ( uname -a ; date \n' + task_UE = task_UE + 'array_exec_pid=()' + '\n' + task_UE = task_UE + 'cd ' + logdirOAI5GRepo + '\n' + task_UE = task_UE + 'source oaienv \n' + task_UE = task_UE + 'source cmake_targets/tools/build_helper \n' + task_UE = task_UE + 'env |grep OPENAIR \n' + if UE_pre_exec != "": + task_UE = task_UE + ' ( date; ' + UE_pre_exec + ' '+ UE_pre_exec_args + ' ) > ' + logfile_pre_exec_UE + ' 2>&1 \n' + if UE_main_exec != "": + task_UE = task_UE + ' ( date; ' + addsudo(UE_main_exec + ' ' + UE_main_exec_args, '') + ' ) > ' + logfile_exec_UE + ' 2>&1 & \n' + task_UE = task_UE + 'array_exec_pid+=($!) \n' + task_UE = task_UE + 'echo UE_main_exec PID = $! \n' + if UE_traffic_exec != "": + cmd_traffic = UE_traffic_exec + ' ' + UE_traffic_exec_args + if cmd_traffic.find('-c') >= 0: + cmd_traffic = cmd_traffic + ' -t ' + str(timeout_cmd - 60) + task_UE = task_UE + ' ( date; ' + cmd_traffic + ' ) >' + logfile_traffic_UE + ' 2>&1 & \n' + task_UE = task_UE + 'array_exec_pid+=($!) \n' + task_UE = task_UE + 'echo UE_traffic_exec PID = $! \n' + #terminate the UE test case after timeout_cmd seconds + task_UE = task_UE + finalize_deploy_script (timeout_cmd, UE_terminate_missing_procs) + ' \n' + #task_UE = task_UE + 'sleep ' + str(timeout_cmd) + ' \n' + task_UE = task_UE + 'handle_ctrl_c' + '\n' + task_UE = task_UE + ' ) > ' + logfile_task_UE_out + ' 2>&1 ' + write_file(logfile_task_UE, task_UE, mode="w") + #task_UE = 'echo \" ' + task_UE + '\" > ' + logfile_script_UE + ' 2>&1 ; ' + task_UE + + + + + + + + # + # RUN work + # ---------------------------------------------------- + thread_eNB = oaiThread(1, "eNB_thread", eNBMachine, user, password , task_eNB, False, timeout_thread) + thread_UE = oaiThread(2, "UE_thread", UEMachine, user, password , task_UE, False, timeout_thread) + threads=[] + threads.append(thread_eNB) + threads.append(thread_UE) + thread_eNB.start() + thread_UE.start() + for t in threads: + t.join() + + # + # + #----------------------------------------------------- + cleanOldProgramsAllMachines([oai_eNB, oai_UE] , oldprogramList, CleanUpAluLteBox, ExmimoRfStop, [logdir_eNB_run, logdir_UE_run], logdirOAI5GRepo) + + SSHSessionWrapper(eNBMachine, user, None, password, logdir_eNB_run, logdir_local_testcase, "get_all") + #print "Copying files from UEMachine : " + UEMachine + "logdir_UE = " + logdir_UE + SSHSessionWrapper(UEMachine, user, None, password, logdir_UE_run, logdir_local_testcase, "get_all") + + metric_checks_flag = 1 + + fname = logdir_local_run+ '/UE_exec' + '_' + str(run) + '_.log' + cell_synch_status = analyser.check_cell_synchro(fname) + if cell_synch_status == 'CELL_SYNCH': + print '!!!!!!!!!!!!!! Cell synchronized !!!!!!!!!!!' + else : + print '!!!!!!!!!!!!!! Cell NOT NOT synchronized !!!!!!!!!!!' + metric_checks_flag = 0 + + ue_seg_fault_status = analyser.check_exec_seg_fault(fname) + if ue_seg_fault_status == 'SEG_FAULT' : + nb_seg_fault += 1 + + # + # Check metrics + #---------------------------------------------------- + runs_metrics = [] + run_traffic = [] + + if metric_checks_flag : + verdict = 'PASS' + + # UE side metrics + metricList=testcase.findall('UE_metric') + for metric in metricList: + metric_def = {} + metric_def['id'] = metric.get('id') + metric_def['description'] = metric.get('description') + metric_def['regex'] = metric.get('regex') + metric_def['unit_of_meas'] = metric.get('unit_of_meas') + metric_def['pass_fail_stat']= metric.get('pass_fail_stat') + metric_min_lim = metric.get('min_limit') + if metric_min_lim: + metric_def['min_limit'] = float(metric_min_lim) + metric_max_lim = metric.get('max_limit') + if metric_max_lim: + metric_def['max_limit'] = float(metric_max_lim) + + fname = logdir_local_run+ '/UE_exec' + '_' + str(run) + '_.log' + + args = {'metric' : metric_def, + 'file' : fname } + + metric_extracted = analyser.do_extract_metrics(args) + + print "\t > Metric "+metric_def['id']+" :" + print "\t\t> min = "+ str( metric_extracted['metric_min'] ) + print "\t\t> min_index = "+ str( metric_extracted['metric_min_index'] ) + print "\t\t> max = "+ str( metric_extracted['metric_max'] ) + print "\t\t> max_index = "+ str( metric_extracted['metric_max_index'] ) + print "\t\t> mean = "+ str( metric_extracted['metric_mean'] ) + print "\t\t> median = "+ str( metric_extracted['metric_median'] ) + + verdict = analyser.do_check_verdict(metric_def, metric_extracted) + + metric_fig = logdir_local_run+ '/UE_metric_'+ metric_def['id']+'_' + str(run) + '_.png' + analyser.do_img_metrics(metric_def, metric_extracted, metric_fig) + + + metric_fig_report = '../log/'+ testcasename + '/run_' + str(run) + '/UE_metric_'+ metric_def['id']+'_' + str(run) + '_.png' + + run_metrics = dict( metric_id = metric_def['id'], + metric_desc = metric_def['description'], + metric_uom = metric_def['unit_of_meas'], + metric_min = metric_extracted['metric_min'], + metric_min_index= metric_extracted['metric_min_index'], + metric_max = metric_extracted['metric_max'], + metric_max_index= metric_extracted['metric_max_index'], + metric_mean = metric_extracted['metric_mean'], + metric_median = metric_extracted['metric_median'], + metric_fig = metric_fig_report) + + if metric_def['pass_fail_stat'] : + run_metrics['pass_fail_stat'] = metric_def['pass_fail_stat'] + if metric_min_lim : + run_metrics['pass_fail_min_limit'] = metric_def['min_limit'] + if metric_max_lim : + run_metrics['pass_fail_max_limit'] = metric_def['max_limit'] + + runs_metrics.append(run_metrics) + + # Traffic analysis + if UE_traffic_exec != "": + + fname = logdir_local_run+ '/UE_traffic' + '_' + str(run) + '_.log' + args = {'file' : fname } + traffic_metrics = analyser.do_extract_traffic_metrics(args) + traffic_fig = logdir_local_run+ '/UE_traffic'+'_' + str(run) + '_.png' + analyser.do_img_traffic(traffic_metrics, traffic_fig) + + traffic_fig_report= '../log/'+ testcasename + '/run_' + str(run) + '/UE_traffic'+'_' + str(run) + '_.png' + + dur_pass_fail_crit = 'none' + if traffic_metrics['traffic_count'] == 0 : + verdict = 'FAIL' + elif UE_search_expr_true != "": + traffic_duration_limit = float(UE_search_expr_true) + dur_pass_fail_crit = str(traffic_duration_limit) + # print 'traffic_duration_limit = '+str(traffic_duration_limit) + # print 'traffic_metrics[interval_stop_max] = '+str(traffic_metrics['interval_stop_max']) + if traffic_metrics['interval_stop_max'] < traffic_duration_limit : + verdict = 'FAIL' + + + run_traffic = dict( traffic_count = traffic_metrics['traffic_count'], + bw_min = traffic_metrics['bw_min'], + bw_max = traffic_metrics['bw_max'], + bw_mean = traffic_metrics['bw_mean'], + bw_median = traffic_metrics['bw_median'], + jitter_min = traffic_metrics['jitter_min'], + jitter_max = traffic_metrics['jitter_max'], + jitter_mean = traffic_metrics['jitter_mean'], + jitter_median = traffic_metrics['jitter_median'], + rl_min = traffic_metrics['rl_min'], + rl_max = traffic_metrics['rl_max'], + rl_mean = traffic_metrics['rl_mean'], + rl_median = traffic_metrics['rl_median'], + iperf_duration = traffic_metrics['interval_stop_max'], + dur_pass_fail_crit = dur_pass_fail_crit, + traffic_fig = traffic_fig_report ) + else: + run_traffic = dict( traffic_count = 0) + + else : + verdict = 'SKIP' + + + + # + # RUN verdict and finalization + # ---------------------------------------------------- + run_stop_time=datetime.datetime.now() + run_duration = run_stop_time-run_start_time +# print (Fore.WHITE + ("duration=" :"), + print (Fore.WHITE + indent + "> RUN duration : "+ str(run_duration) +"s" ) + + print (Fore.WHITE + indent + "> RUN verdict :"), + + if verdict == 'PASS': + nb_run_pass += 1 + print ( Fore.GREEN + verdict) + elif verdict == 'FAIL': + nb_run_failed += 1 + testcase_verdict = 'FAIL' + print ( Fore.RED + verdict) + elif verdict == 'SKIP': + nb_run_skip += 1 + print ( Fore.YELLOW + verdict) + else: + nb_run_inc += 1 + if testcase_verdict == 'PASS' : testcase_verdict = 'INCON' + print (Fore.YELLOW+'INCONCLUSIVE') + + run_results = dict( run_id=str(run), + run_start_time = run_start_time, + run_stop_time = run_stop_time , + run_verdict = verdict, + ue_seg_fault_status = ue_seg_fault_status, + run_duration = run_duration, + runs_metrics = runs_metrics, + run_traffic = run_traffic) + runs_results.append(run_results) + + # END RUN LOOP + #---------------------------------------------------- + + # Test case duration + # ---------------------------------- + testcase_time_stop = datetime.datetime.now() + print(Fore.WHITE + indent + "> testcase time stop : " + str(testcase_time_start) ), + print " -> TestCase duration = "+str(testcase_time_stop - testcase_time_start) + + # Save remote log files + # ----------------------------------- + #Now we change the permissions of the logfiles to avoid some of them being with root permissions + cmd = 'sudo -E chown -R ' + user + ' ' + logdir_eNB_testcase + res= oai_eNB.send_recv(cmd) + cmd = 'sudo -E chown -R ' + user + ' ' + logdir_UE_testcase + res= oai_UE.send_recv(cmd) + + # Save remote log files on MTC + #print "Copying files from eNBMachine " + eNBMachine + "logdir_eNB = " + logdir_eNB + SSHSessionWrapper(eNBMachine, user, None, password, logdir_eNB_testcase, openairdir_local + '/cmake_targets/autotests/log/', "get_all") + #print "Copying files from UEMachine : " + UEMachine + "logdir_UE = " + logdir_UE + SSHSessionWrapper(UEMachine, user, None, password, logdir_UE_testcase, openairdir_local + '/cmake_targets/autotests/log/', "get_all") + + oai_eNB.disconnect() + oai_UE.disconnect() + + # Set test case final verdict + # ----------------------------------- + test_result_string = 'do be completed' + + if testcase_verdict == 'PASS': + if nb_run_pass == 0 : + testcase_verdict = 'INCON' + + print(Fore.WHITE + indent + "> testcase final verdict :"), + if testcase_verdict == 'PASS': + print ( Fore.GREEN + testcase_verdict) + elif testcase_verdict == 'FAIL': + print ( Fore.RED + testcase_verdict) + else: + print (Fore.YELLOW+'INCONCLUSIVE') + + duration= testcase_time_stop - testcase_time_start + xmlFile = logdir_local_testcase + '/test.' + testcasename + '.xml' + xml="\n \n" + write_file(xmlFile, xml, mode="w") + + + test_result = dict(testcase_name=testcasename, + testcaseclass=testcaseclass, + testcase_verdict = testcase_verdict, + testcase_time_start=testcase_time_start, + testcase_time_stop=testcase_time_stop, + tags=tags, + nruns=nb_runs, + nb_run_pass = nb_run_pass, + nb_run_skip = nb_run_skip, + nb_run_failed = nb_run_failed, + nb_run_inc=nb_run_inc, + nb_seg_fault = nb_seg_fault, + testcase_timeout=timeout_cmd, + testcase_duration = duration, + testcase_eNBMachine =eNBMachine, + testcase_UEMachine =UEMachine, + runs_results = runs_results) + #test_results.append(test_result) + + return testcase_verdict + + + + # \brief This function searches if test case is present in list of test cases that need to be executed by user # \param testcasename the test case to search for # \param testcasegroup list that is passed from the arguments @@ -1149,12 +1754,14 @@ if openairdir_local is None: locallogdir = openairdir_local + '/cmake_targets/autotests/log' MachineList = '' MachineListGeneric='' +MachineDescDic={} flag_remove_logdir=False flag_start_testcase=False nruns_lte_softmodem='' flag_skip_git_head_check=False flag_skip_oai_install=False Timeout_cmd='' +xmlInputFile='' print "Number of arguments argc = " + str(len(sys.argv)) #for index in range(1,len(sys.argv) ): # print "argv_" + str(index) + " : " + sys.argv[index] @@ -1218,6 +1825,9 @@ while i < len (sys.argv): i = i +1 elif arg == '--skip-oai-install': flag_skip_oai_install=True + elif arg == '--test-suite' : + xmlInputFile = sys.argv[i+1] + i = i +1 elif arg == '-h' : print "-s: This flag *MUST* be set to start the test cases" print "-r: Remove the log directory in autotests" @@ -1235,6 +1845,7 @@ while i < len (sys.argv): print "--skip-git-head-check: skip checking of GitHead remote/local branch (only for debugging)" print "--timeout_cmd: Override the default parameter (timeout_cmd) in test_case_list.xml. This parameter is in seconds and should be > 120" print "--skip-oai-install: Skips the openairinterface5g installer" + print "--test-suite: Select a XML test-suite file" sys.exit() else : print "Unrecongnized Option: <" + arg + ">. Use -h to see valid options" @@ -1264,6 +1875,13 @@ cmd='ps aux |grep \"/usr/bin/ssh -q -l guptar\"| awk \'{print $2}\' | sudo xargs os.system(cmd) +try: + analyser = __import__("lib_autotest_analyser") +except ImportError as err: + print('Import error: ' + str(err)) + exit(0) + + if flag_start_testcase == False: print "You need to start the testcase by passing option -s. Use -h to see all options. Aborting now..." sys.exit(1) @@ -1286,12 +1904,14 @@ os.system(cmd) print "host = " + host print "user = " + user -xmlInputFile=os.environ.get('OPENAIR_DIR')+"/cmake_targets/autotests/test_case_list.xml" +if xmlInputFile == '': + xmlInputFile=os.environ.get('OPENAIR_DIR')+"/cmake_targets/autotests/test_case_list.xml" NFSResultsDir = '/mnt/sradio' cleanupOldProgramsScript = '$OPENAIR_DIR/cmake_targets/autotests/tools/remove_old_programs.bash' logdir = '/tmp/' + 'OAITestFrameWork-' + user + '/' logdirOAI5GRepo = logdir + 'openairinterface5g/' logdirOpenaircnRepo = logdir + 'openair-cn/' +patchdir = logdirOAI5GRepo + 'cmake_targets/autotests/patches/' if flag_remove_logdir == True: print "Removing directory: " + locallogdir @@ -1333,6 +1953,8 @@ ExmimoRfStop = xmlRoot.findtext('ExmimoRfStop',default='') if nruns_lte_softmodem == '': nruns_lte_softmodem = xmlRoot.findtext('nruns_lte-softmodem',default='') +OAI5GpatchFileList=xmlRoot.findall('OAI5GPatchFile') + print "MachineList = " + MachineList print "GitOpenair-cnRepo = " + GitOpenaircnRepo print "GitOAI5GRepo = " + GitOAI5GRepo @@ -1365,6 +1987,7 @@ MachineListGeneric = MachineListGeneric.split() #index=0 for machine in MachineList: oai_list.append( openair('localdomain',machine)) + MachineDescDic[machine]={} #index = index + 1 @@ -1475,6 +2098,7 @@ for oai in oai_list: cmd = cmd + 'git checkout ' + GitOpenaircnRepoBranch + '\n' cmd = cmd + 'env |grep OPENAIR' + '\n' cmd = cmd + ' cd ' + logdir + '\n' + cmd = cmd + 'mkdir -p ' + patchdir + '\n' cmd = cmd + ' ) > ' + setuplogfile + ' 2>&1 \n' #cmd = cmd + 'echo \' ' + cmd + '\' > ' + setup_script + ' 2>&1 \n ' #result = oai_list[index].send_recv(cmd, False, 300 ) @@ -1500,8 +2124,27 @@ for t in threads_init_setup: localfile = locallogdir + '/setup_log_' + MachineList[index] + '_.txt' remotefile = logdir + '/setup_log_' + MachineList[index] + '_.txt' port = 22 + + #Now we copy patch files and apply them + print "Installating patch files on machine " + MachineList[index] + for patchFile in OAI5GpatchFileList: + localfile = os.path.expandvars('$OPENAIR_DIR/cmake_targets/autotests/patches/')+patchFile.get('name') + remotefile = logdirOAI5GRepo + '/cmake_targets/autotests/patches/'+patchFile.get('name') + if patchFile.get('machine') == MachineList[index] or patchFile.get('machine') == None: + if os.path.isfile(localfile): + print "\t> PATCH FILE :"+localfile + paramList=[] + paramList.append ( {"operation":'put', "localfile":localfile, "remotefile":remotefile} ) + sftp_module (user, pw, MachineList[index], port, paramList, sftp_log) + cmd = ' cd ' + logdirOAI5GRepo + ' ;git apply cmake_targets/autotests/patches/'+patchFile.get('name') + res = oai_list[index].send_recv(cmd) paramList=[] + + setuplogfile = logdir + '/setup_log_' + MachineList[index] + '_.txt' + setup_script = locallogdir + '/setup_script_' + MachineList[index] + '_.txt' + localfile = locallogdir + '/setup_log_' + MachineList[index] + '_.txt' + remotefile = logdir + '/setup_log_' + MachineList[index] + '_.txt' sftp_log = os.path.expandvars(locallogdir + '/sftp_module.log') paramList.append ( {"operation":'get', "localfile":localfile, "remotefile":remotefile} ) #sftp_module (user, pw, MachineList[index], port, localfile, remotefile, sftp_log, "get") @@ -1574,6 +2217,23 @@ for testcase in testcaseList: SSHSessionWrapper('localhost', user, None, pw , NFSTestsResultsDir , locallogdir, "put_all") oai_localhost.disconnect() + elif testcaseclass == 'lte-softmodem-noS1' : + eNBMachine = testcase.findtext('eNB',default='') + UEMachine = testcase.findtext('UE',default='') + if (eNBMachine not in MachineList)|(UEMachine not in MachineList): + print "One of the machines is not in the machine list" + print "eNBMachine : " + eNBMachine + "UEMachine : " + UEMachine + "MachineList : " + ','.join(MachineList) + print "testcasename = " + testcasename + " class = " + testcaseclass + threadListGlobal = wait_testcaseclass_generic_threads(threadListGlobal, Timeout_execution) + + handle_testcaseclass_softmodem_noS1 (testcase, CleanUpOldProgs, logdirOAI5GRepo, logdirOpenaircnRepo, MachineList, user, pw, CleanUpAluLteBox, ExmimoRfStop, nruns_lte_softmodem, Timeout_cmd ) + + #The lines below are copied from below to trace the failure of some of the machines in test setup. These lines below need to be removed in long term + print "Creating xml file for overall results..." + cmd = "cat $OPENAIR_DIR/cmake_targets/autotests/log/*/*.xml > $OPENAIR_DIR/cmake_targets/autotests/log/results_autotests.xml " + res=os.system(cmd) + os.system('sync') + elif (testcaseclass == 'compilation'): threadListGlobal = handle_testcaseclass_generic (testcasename, threadListGlobal, CleanUpOldProgs, logdirOAI5GRepo, MachineListGeneric, user, pw, CleanUpAluLteBox,Timeout_execution, ExmimoRfStop) elif (testcaseclass == 'execution'): diff --git a/cmake_targets/autotests/run_lte-softmodem-nos1_tests.py b/cmake_targets/autotests/run_lte-softmodem-nos1_tests.py new file mode 100755 index 0000000000..19939f0d5c --- /dev/null +++ b/cmake_targets/autotests/run_lte-softmodem-nos1_tests.py @@ -0,0 +1,2785 @@ +#! /usr/bin/python +#****************************************************************************** + +# OpenAirInterface +# Copyright(c) 1999 - 2014 Eurecom + +# OpenAirInterface is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. + + +# OpenAirInterface is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with OpenAirInterface.The full GNU General Public License is +# included in this distribution in the file called "COPYING". If not, +# see . + +# Contact Information +# OpenAirInterface Admin: openair_admin@eurecom.fr +# OpenAirInterface Tech : openair_tech@eurecom.fr +# OpenAirInterface Dev : openair4g-devel@lists.eurecom.fr + +# Address : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE + +# *******************************************************************************/ +# \author Rohit Gupta +# \version 0.1 +# @ingroup _test + + +#****************************************************************************** +# +# \file run_lte-softmodem-nos1_tests.py +# +# \par Informations +# - \b Project : UED Autotest Framework +# - \b Software : +# +# \date 16 september 2016 +# +# \version 0.1 +# +# \brief master test script to run test class 'handle_testcaseclass_softmodem_noS1' +# This script is largely inspired by 'run_exec_lte-softmodem_tests.py', and +# reused parts of it. +# +# \author Benoit ROBERT (benoit.robert@syrtem.com) +# +# \par Statement of Ownership +# COPYRIGHT (c) 2016 BY SYRTEM S.A.R.L +# This software is furnished under license and may be used and copied +# only in accordance with the terms of such license and with the inclusion +# of the above COPYRIGHT notice. This SOFTWARE or any other copies thereof +# may not be provided or otherwise made available to any other person. +# No title to and ownership of the SOFTWARE is hereby transferred. +# +# The information in this SOFTWARE is subject to change without notice +# and should not be constructed as a commitment by SYRTEM. +# SYRTEM assumes no responsibility for the use or reliability of its +# SOFTWARE on equipment or platform not explicitly validated by SYRTEM. +# +# ******************************************************************************* + +import tempfile +import threading +import sys +import traceback +import wave +import os +import time +import datetime +import getpass +import math #from time import clock +import xml.etree.ElementTree as ET +import re + +from colorama import Fore, Back, Style + +import numpy as np + +import log + +from openair import * + +import paramiko + +import subprocess +import commands +sys.path.append('/opt/ssh') +sys.path.append(os.path.expandvars('$OPENAIR_DIR/cmake_targets/autotests/tools/')) + +from lib_autotest import * +import ssh +from ssh import SSHSession +import argparse + + +def exit_prog(exit_val): + print(Style.RESET_ALL), + sys.exit(exit_val) + +# \brief write a string to a file +# \param filename name of file +# \param string string to write +# \mode file opening mode (default=write) +def write_file(filename, string, mode="w"): + text_file = open(filename, mode) + text_file.write(string) + text_file.close() + +# \brief function to check if test case passed throughput test +# \param filename name of file which has throughput results (usually from iperf -s ... +# \param min_tput minimum throughput +# \param max_tuput maximum throughput +# \param average average throughput +# \param min_duration minimum duration of throughput +#The throughput values found in file must be higher than values from from arguments 2,3,4,5 +#The function returns True if throughput conditions are saisfied else it returns fails +def tput_test(filename, min_tput, max_tput, average, min_duration): + + if os.path.exists(filename): + with open (filename, "r") as myfile: + data=myfile.read() + p=re.compile('(\d*.\d*) Mbits/sec') + array=p.findall(data) + array = [ float(x) for x in array ] + duration = array.__len__() + if duration !=0: + min_list = min(array) + max_list = max(array) + average_list = np.mean(array) + else: + min_list = 0 + max_list = 0 + average_list=0 + tput_string=' ( '+ "min=%0.2f" % min_list + ' Mbps / ' + "max=%0.2f" % max_list + ' Mbps / ' + "avg=%0.2f" % average_list + ' Mbps / ' + "dur=%0.2f" % duration + ' s) ' + if (min_list >= min_tput and max_list >= max_tput and average_list >= average and duration >= min_duration): + return True , tput_string + else: + return False , tput_string + else: + return False , tput_string + +# \brief Convert string to float or return None if there is exception +def try_convert_to_float(string, fail=None): + try: + return float(string) + except Exception: + return fail; + +# \brief get throughput statistics from log file +# \param search_expr search expression found in test_case_list.xml file +# \param logfile_traffic logfile which has traffic statistics +def tput_test_search_expr (search_expr, logfile_traffic): + result=0 + tput_string='' + if search_expr !='': + if search_expr.find('throughput_test')!= -1 : + p= re.compile('min\s*=\s*(\d*.\d*)\s*Mbits/sec') + min_tput=p.findall(search_expr) + if min_tput.__len__()==1: + min_tput = min_tput[0] + else: + min_tput = None + + p= re.compile('max\s*=\s*(\d*.\d*)\s*Mbits/sec') + max_tput=p.findall(search_expr) + if max_tput.__len__()==1: + max_tput = max_tput[0] + else: + max_tput = None + + p= re.compile('average\s*=\s*(\d*.\d*)\s*Mbits/sec') + avg_tput=p.findall(search_expr) + if avg_tput.__len__()==1: + avg_tput=avg_tput[0] + else: + avg_tput = None + + p= re.compile('duration\s*=\s*(\d*.\d*)\s*s') + duration=p.findall(search_expr) + if duration.__len__()==1: + duration = duration[0] + else: + duration = None + + min_tput = try_convert_to_float(min_tput) + max_tput = try_convert_to_float(max_tput) + avg_tput = try_convert_to_float(avg_tput) + duration = try_convert_to_float(duration) + + if (min_tput != None and max_tput != None and avg_tput != None and duration != None ): + result, tput_string = tput_test(logfile_traffic, min_tput, max_tput, avg_tput, duration) + else: + result=1 + + return result, tput_string + +# \brief function to copy files to/from remote machine +# \param username user with which to make sftp connection +# \param password password of user +# \param hostname host to connect +# \ports port of remote machine on which server is listening +# \paramList This is list of operations as a set {operation: "get/put", localfile: "filename", remotefile: "filename" +# \param logfile Ignored currently and set once at the beginning of program +def sftp_module (username, password, hostname, ports, paramList,logfile): + #localD = localfile + #remoteD = remotefile + #fd, paramiko_logfile = tempfile.mkstemp() + #res = os.close(fd ) + #paramiko logfile path should not be changed with multiple calls. The logs seem to in first file regardless + error = "" + #The lines below are outside exception loop to be sure to terminate the test case if the network connectivity goes down or there is authentication failure + transport = paramiko.Transport((hostname, ports)) + transport.connect(username = username, password = password) + sftp = paramiko.SFTPClient.from_transport(transport) + # index =0 + for param in paramList: + try: + operation = param["operation"] + localD = param["localfile"] + remoteD = param["remotefile"] + if operation == "put": + sftp.put(remotepath=remoteD, localpath=localD) + elif operation == "get": + sftp.get(remotepath=remoteD, localpath=localD) + else : + print "sftp_module: unidentified operation:<" + operation + "> Exiting now" + print "hostname = " + hostname + print "ports = " + ports + print "localfile = " + localD + print "remotefile = " + remoteD + print "operation = " + operation + sys.exit() + except Exception, e: + error = error + ' In function: ' + sys._getframe().f_code.co_name + ': *** Caught exception: ' + str(e.__class__) + " : " + str( e) + error = error + '\n username = ' + username + '\n hostname = ' + hostname + '\n localfile = ' + localD + '\n remotefile = ' + remoteD + '\n operation = ' + operation + '\nlogfile = ' + logfile + '\n ports = ' + str(ports) + '\n' + error = error + traceback.format_exc() + print error + + sftp.close() + transport.close() + res = os.system('\n echo \'SFTP Module Log for Machine: <' + hostname + '> starts...\' >> ' + logfile + ' 2>&1 ') + res = os.system('cat ' + paramiko_logfile + ' >> ' + logfile + ' 2>&1 \n') + write_file(logfile, error, "a") + res = os.system('\n echo \'SFTP Module Log for Machine: <' + hostname + '> ends...\' >> ' + logfile + ' 2>&1 \n') + +# \brief bash script stub put at the end of scripts to terminate it +# \param timeout_cmd terminate script after timeout_cmd seconds +# \param terminate_missing_procs if True terminate all the processes launched by script if one of them terminates prematurely (due to error) +def finalize_deploy_script (timeout_cmd, terminate_missing_procs='False'): + cmd = 'declare -i timeout_cmd='+str(timeout_cmd) + '\n' + if terminate_missing_procs == 'True': + cmd = cmd + """ + #The code below checks if one the processes launched in background has crashed. + #If it does, then the code below terminates all the child processes created by this script + declare -i wakeup_interval=1 + declare -i step=0 + echo \"Array pid = ${array_exec_pid[@]}\" + while [ "$step" -lt "$timeout_cmd" ] + do + declare -i break_while_loop=0 + #Iterate over each process ID in array_exec_pid + for i in "${array_exec_pid[@]}" + do + numchild=`pstree -p $i | perl -ne 's/\((\d+)\)/print " $1"/ge' |wc -w` + echo "PID = $i, numchild = $numchild" + if [ "$numchild" -eq "0" ] ; then + echo "Process ID $i has finished unexpectedly. Now preparing to kill all the processes " + break_while_loop=1 + break + fi + done + if [ "$break_while_loop" -eq "1" ] ; then + break + fi + step=$(( step + wakeup_interval )) + sleep $wakeup_interval + done + echo "Final time step (Duration of test case) = $step " + date + """ + else: + #We do not terminate the script if one of the processes has existed prematurely + cmd = cmd + 'sleep ' + str(timeout_cmd) + ' ; date \n' + + return cmd + +# \brief run python script and update config file params of test case +# \param oai module with already open connection +# \param config_string config string taken from xml file +# \param logdirRepo directory of remote repository +# \param python_script python script location +def update_config_file(oai, config_string, logdirRepo, python_script): + cmd="" + if config_string : + stringArray = config_string.splitlines() + #python_script = '$OPENAIR_DIR/targets/autotests/tools/search_repl.py' + for string in stringArray: + #split the string based on space now + string1=string.split() + cmd = cmd + 'python ' + python_script + ' ' + logdirRepo+'/'+string1[0] + ' ' + string1[1] + ' '+ string1[2] + '\n' + #cmd = cmd + 'perl -p -i -e \'s/'+ string1[1] + '\\s*=\\s*"\\S*"\\s*/' + string1[1] + ' = "' + string1[2] +'"' + '/g\' ' + logdirRepo + '/' +string1[0] + '\n' + return cmd + #result = oai.send_recv(cmd) + +# \brief thread safe sshsession wrapper due to occasional connection issues with ssh +# \param machine name of machine +# \param username user login for remote machine +# \param key_file file name which has keys to enable passwordless login +# \param password password for remote machine +# \param logdir_remote remote directory +# \param logdir_local_base local directory +# \param operation operation to perform (get_all, put_all) transfers recursively for directories +def SSHSessionWrapper(machine, username, key_file, password, logdir_remote, logdir_local_base, operation): + max_tries = 100 + i=0 + while i <= max_tries: + i = i +1 + try: + ssh = SSHSession(machine , username, key_file, password) + if operation == "get_all": + ssh.get_all(logdir_remote , logdir_local_base) + elif operation == "put_all": + ssh.put_all(logdir_local_base, logdir_remote ) + else: + print "Error: Uknown operation in SSHSessionWrapper. Exiting now..." + sys.exit(1) + break + except Exception, e: + error='' + error = error + ' In Class = function: ' + sys._getframe().f_code.co_name + ': *** Caught exception: ' + str(e.__class__) + " : " + str( e) + error = error + '\n username = ' + username + '\n machine = ' + machine + '\n logdir_remote = ' + logdir_remote + '\n logdir_local_base = ' + logdir_local_base + error = error + traceback.format_exc() + print error + print " Retrying again in 1 seconds" + time.sleep(1) + print "Continuing ..." + if i ==max_tries: + print "Fatal Error: Max no of retries reached. Exiting now..." + sys.exit(1) + + + +# \briefFunction to clean old programs that might be running from earlier execution +# \param oai - parameter for making connection to machine +# \parm programList list of programs that must be terminated before execution of any test case +# \param CleanUpAluLteBox program to terminate AlU Bell Labs LTE Box +# \param ExmimoRfStop String to stop EXMIMO card (specified in test_case_list.xml) +def cleanOldPrograms(oai, programList, CleanUpAluLteBox, ExmimoRfStop, logdir, logdirOAI5GRepo): + cmd = 'killall -9 ' + programList + result = oai.send(cmd, True) +# print "\t\t > "+cmd +# print "\t\t < "+result + +# print "Killing old programs on ..." + result + programArray = programList.split() + programListJoin = '|'.join(programArray) + cmd = " ( date ;echo \"Starting cleaning old programs.. \" ; dmesg|tail ; echo \"Current disk space.. \" ; df -h )>& " + logdir + "/oai_test_setup_cleanup.log.`hostname` 2>&1 ; sync" + result=oai.send_recv(cmd) +# print "\t\t > "+cmd +# print "\t\t < "+result + + cmd = cleanupOldProgramsScript + ' ' + '\''+programListJoin+'\'' + #result = oai.send_recv(cmd) + #print result + result = oai.send_expect_false(cmd, 'Match found', False) +# print "\t\t > "+cmd +# print "\t\t < "+result + +# print "Looking for old programs..." + result + res=oai.send_recv(CleanUpAluLteBox, True) +# print "\t\t > "+CleanUpAluLteBox +# print "\t\t < "+res + cmd= " echo \"Starting EXmimoRF Stop... \" >> " + logdir + "/oai_test_setup_cleanup.log.`hostname` 2>&1 ; sync "; + result = oai.send_recv(cmd) +# print "\t\t > "+cmd +# print "\t\t < "+result + cmd = "( " + "cd " + logdirOAI5GRepo + " ; source oaienv ; " + ExmimoRfStop + " ) >> " + logdir + "/oai_test_setup_cleanup.log.`hostname` 2>&1 ; sync " +# print "cleanoldprograms cmd = " + cmd + res=oai.send_recv(cmd, False, timeout=600) +# print "\t\t > "+cmd +# print "\t\t < "+res + + cmd= " echo \"Stopping EXmimoRF Stop... \" >> " + logdir + "/oai_test_setup_cleanup.log.`hostname` 2>&1 ; sync "; + result = oai.send_recv(cmd) +# print "\t\t > "+cmd +# print "\t\t < "+result + + #res = oai.send_recv(ExmimoRfStop, False) + cmd = " ( date ;echo \"Finished cleaning old programs.. \" ; dmesg | tail)>> $HOME/.oai_test_setup_cleanup.log.`hostname` 2>&1 ; sync" + res=oai.send_recv(cmd) +# print "\t\t > "+cmd +# print "\t\t < "+res + +# \brief Class thread to launch a generic command on remote machine +# \param threadID number of thread (for book keeping) +# \param threadname string of threadname (for book keeping) +# \param machine machine name on which to run the command +# \param username username with which to login +# \param password password with which to login +# \param cmd command as a string to run on remote machine +# \parma sudo if True sudo is set +# \param timeout timeout of command in seconds +class oaiThread (threading.Thread): + def __init__(self, threadID, threadname, machine, username, password, cmd, sudo, timeout): + threading.Thread.__init__(self) + self.threadID = threadID + self.threadname = threadname + self.machine = machine + self.username = username + self.password = password + self.cmd = cmd + self.sudo = sudo + self.timeout = timeout + def run(self): + try: + oai = openair('localdomain',self.machine) + oai.connect(self.username, self.password) + # print "Starting " + self.threadname + " on machine " + self.machine + result = oai.send_recv(self.cmd, self.sudo, self.timeout) + #print "result = " + result + #print "Exiting " + self.threadname + oai.disconnect() + except Exception, e: + error='' + error = error + ' In class oaiThread, function: ' + sys._getframe().f_code.co_name + ': *** Caught exception: ' + str(e.__class__) + " : " + str( e) + error = error + '\n threadID = ' + str(self.threadID) + '\n threadname = ' + self.threadname + '\n timeout = ' + str(self.timeout) + '\n machine = ' + self.machine + '\n cmd = ' + self.cmd + '\n timeout = ' + str(self.timeout) + '\n username = ' + self.username + '\n' + error = error + traceback.format_exc() + print error + + +# \brief This class runs test cases with class {execution, compilatation} +# \param threadID number of thread (for book keeping) +# \param name string of threadname (for book keeping) +# \param machine machine name on which to run the command +# \param logdirOAI5GRepo directory on remote machine which as openairinterface5g repo installed +# \param testcasename name of test case to run on remote machine +# \param CleanupAluLteBox string that contains commands to stop ALU Bell Labs LTEBox (specified in test_case_list.xml) +# \param user username with which to login +# \param password password with which to login +# \param timeout timeout of command in seconds +# \param ExmimoRfStop command to stop EXMIMO Card +class testCaseThread_generic (threading.Thread): + def __init__(self, threadID, name, machine, logdirOAI5GRepo, testcasename,oldprogramList, CleanupAluLteBox, user, password, timeout, ExmimoRfStop): + threading.Thread.__init__(self) + self.threadID = threadID + self.name = name + self.testcasename = testcasename + self.timeout = timeout + self.machine = machine + self.logdirOAI5GRepo = logdirOAI5GRepo + self.oldprogramList = oldprogramList + self.CleanupAluLteBox = CleanupAluLteBox + self.password=password + self.ExmimoRfStop = ExmimoRfStop + self.user = user + def run(self): + try: + mypassword='' + #addsudo = 'echo \'' + mypassword + '\' | sudo -S -E ' + addpass = 'echo \'' + mypassword + '\' | ' + #user = getpass.getuser() + print "Starting test case : " + self.testcasename + " On machine " + self.machine + " timeout = " + str(self.timeout) + oai = openair('localdomain',self.machine) + oai.connect(self.user, self.password) + #cleanOldPrograms(oai, self.oldprogramList, self.CleanupAluLteBox, self.ExmimoRfStop) + logdir_local = os.environ.get('OPENAIR_DIR') + logdir_local_testcase = logdir_local +'/cmake_targets/autotests/log/'+ self.testcasename + logdir_local_base = logdir_local +'/cmake_targets/autotests/log/' + logdir_remote_testcase = self.logdirOAI5GRepo + '/cmake_targets/autotests/log/' + self.testcasename + logdir_remote = self.logdirOAI5GRepo + '/cmake_targets/autotests/log/' + logfile_task_testcasename = logdir_local_testcase + '/test_task' + '_' + self.testcasename + '_.log' + logfile_task_testcasename_out = logdir_remote + '/test_task_out' + '_' + self.testcasename + '_.log' + #print "logdir_local_testcase = " + logdir_local_testcase + #print "logdir_remote_testcase = " + logdir_remote_testcase + #if os.path.exists(logdir_local_testcase) == True : + # os.removedirs(logdir_local_testcase) + #os.mkdir(logdir_local_testcase) + os.system("rm -fr " + logdir_local_testcase ) + os.system("mkdir -p " + logdir_local_testcase) + cmd = "mkdir -p " + logdir_remote_testcase + res = oai.send_recv(cmd, False, self.timeout) + #print "res = " + res + + cmd = "( cd " + self.logdirOAI5GRepo + " \n " + cmd = cmd + "source oaienv \n" + cmd = cmd + "$OPENAIR_DIR/cmake_targets/autotests/run_exec_autotests.bash --run-group \"" + self.testcasename + "\" -p \'\'" + cmd = cmd + " ) >& " + logfile_task_testcasename_out + " ; " + "mkdir -p " + logdir_remote_testcase + "; mv " + logfile_task_testcasename_out + " " +logdir_remote_testcase + + #print "cmd = " + cmd + res = oai.send_recv(cmd, False, self.timeout) + #print "res = " + res + #print "ThreadID = " + str(self.threadID) + "ThreadName: " + self.name + " testcasename: " + self.testcasename + "Execution Result = " + res + write_file(logfile_task_testcasename, cmd, mode="w") + #Now we copy all the remote files + #ssh = SSHSession(self.machine , username=user, key_file=None, password=self.password) + #ssh.get_all(logdir_remote_testcase , logdir_local_base) + SSHSessionWrapper(self.machine, self.user, None, self.password, logdir_remote_testcase, logdir_local_base, "get_all") + print "Finishing test case : " + self.testcasename + " On machine " + self.machine + #cleanOldPrograms(oai, self.oldprogramList, self.CleanupAluLteBox, self.ExmimoRfStop) + #oai.kill(user,mypassword) + oai.disconnect() + except Exception, e: + error='' + error = error + ' In Class = testCaseThread_generic, function: ' + sys._getframe().f_code.co_name + ': *** Caught exception: ' + str(e.__class__) + " : " + str( e) + error = error + '\n threadID = ' + str(self.threadID) + '\n threadName = ' + self.name + '\n testcasename = ' + self.testcasename + '\n machine = ' + self.machine + '\n logdirOAI5GRepo = ' + self.logdirOAI5GRepo + '\n' + '\n timeout = ' + str(self.timeout) + '\n user = ' + self.user + error = error + traceback.format_exc() + print error + print "Continuing with next test case..." + #sys.exit() + + + +# \bried function to run a command as a sudo +# \param cmd command as a string +# \param password password to be supplied +def addsudo (cmd, password=""): + cmd = 'echo \'' + password + '\' | sudo -S -E bash -c \' ' + cmd + '\' ' + return cmd + +# \brief handler for executing test cases (compilation, execution) +# \param name of testcase +# \param threadListGeneric list of threads which are already running on remote machines +# \param oldprogramList list of programs which must be terminated before running a test case +# \param logdirOAI5GRepo directory on remote machine which as openairinterface5g repo installed +# \param MachineList list of all machines on which generic test cases can be run +# \param user username with which to login +# \param password password with which to login +# \param CleanupAluLteBox string that contains commands to stop ALU Bell Labs LTEBox (specified in test_case_list.xml) +# \param timeout timeout of command in seconds +# \param ExmimoRfStop command to stop EXMIMO Card +def handle_testcaseclass_generic (testcasename, threadListGeneric, oldprogramList, logdirOAI5GRepo, MachineList, user, password, CleanupAluLteBox,timeout, ExmimoRfStop): + try: + mypassword=password + MachineListFree=[] + threadListNew=[] + while MachineListFree.__len__() == 0 : + MachineListBusy=[] + MachineListFree=[] + threadListNew=[] + #first we need to find the list of free machines that we could run our test case + if threadListGeneric.__len__() ==0 : + #This means no thread is started yet + MachineListFree = MachineList[:] + else : + for param in threadListGeneric : + thread_id = param["thread_id"] + machine = param["Machine"] + testcasenameold = param["testcasename"] + thread_id.join(1) + if thread_id.isAlive() == True: + threadListNew.append(param) + print "thread_id is alive: testcasename: " + testcasenameold + " on machine "+ machine + if machine not in MachineListBusy: + MachineListBusy.append(machine) + else : + print "thread_id is finished: testcasename: " + testcasenameold + " on machine " + machine + #threadListGeneric.remove(param) + #if machine not in MachineListFree: + # MachineListFree.append(machine) + #Now we check if there is at least one free machine + MachineListFree = MachineList[:] + for machine in MachineListBusy: + if machine in MachineListFree: + MachineListFree.remove(machine) + print "MachineListFree = " + ','.join(MachineListFree) + print "MachineListBusy = " + ','.join(MachineListBusy) + print "MachineList = " + ','.join(MachineList) + machine = MachineListFree[0] + thread = testCaseThread_generic(1,"Generic Thread_"+testcasename+"_"+ "machine_", machine, logdirOAI5GRepo, testcasename, oldprogramList, CleanupAluLteBox, user, password, timeout, ExmimoRfStop) + param={"thread_id":thread, "Machine":machine, "testcasename":testcasename} + thread.start() + threadListNew.append(param) + return threadListNew + except Exception, e: + error='' + error = error + ' In function: ' + sys._getframe().f_code.co_name + ': *** Caught exception: ' + str(e.__class__) + " : " + str( e) + error = error + '\n testcasename = ' + testcasename + '\n logdirOAI5GRepo = ' + logdirOAI5GRepo + '\n MachineList = ' + ','.join(MachineList) + '\n timeout = ' + str(timeout) + '\n' + 'user = ' + user + error = error + traceback.format_exc() + print error + print "Continuing..." + #sys.exit(1) + +# \brief Blocking wait for all threads related to generic testcase execution, class (compilation and execution) +# \param threadListGeneric list of threads which are running on remote machines +# \param timeout time to wait on threads in seconds +def wait_testcaseclass_generic_threads(threadListGeneric, timeout = 1): + threadListGenericNew=[] + for param in threadListGeneric: + thread_id = param["thread_id"] + machine = param["Machine"] + testcasenameold = param["testcasename"] + thread_id.join(timeout) + if thread_id.isAlive() == True: + threadListGenericNew.append(param) + print "thread_id on machine: " + machine + " is still alive: testcasename: " + testcasenameold + print " Exiting now..." + sys.exit(1) + else: + print "thread_id on machine: " + machine + " is stopped: testcasename: " + testcasenameold + #threadListGeneric.remove(param) + return threadListGenericNew + + +# \brief handler for executing test cases (lte-softmodem) +# \param testcase name of testcase +# \param oldprogramList list of programs which must be terminated before running a test case +# \param logdirOAI5GRepo directory on remote machine which has openairinterface5g repo installed +# \param logdirOpenaircnRepo directory on remote machine which has openair-cn repo installed +# \param MachineList list of all machines on which test cases can be run +# \param user username with which to login +# \param password password with which to login +# \param CleanupAluLteBox string that contains commands to stop ALU Bell Labs LTEBox (specified in test_case_list.xml) +# \param ExmimoRfStop command to stop EXMIMO Card +# \param nruns_lte-softmodem global parameter to override number of runs (nruns) within the test case +def handle_testcaseclass_softmodem (testcase, oldprogramList, logdirOAI5GRepo , logdirOpenaircnRepo, MachineList, user, password, CleanUpAluLteBox, ExmimoRfStop, nruns_lte_softmodem, timeout_cmd): + #We ignore the password sent to this function for secuirity reasons for password present in log files + #It is recommended to add a line in /etc/sudoers that looks something like below. The line below will run sudo without password prompt + # your_user_name ALL=(ALL:ALL) NOPASSWD: ALL + mypassword='' + #addsudo = 'echo \'' + mypassword + '\' | sudo -S -E ' + addpass = 'echo \'' + mypassword + '\' | ' + #user = getpass.getuser() + testcasename = testcase.get('id') + testcaseclass = testcase.findtext('class',default='') + if timeout_cmd == '': + timeout_cmd = testcase.findtext('TimeOut_cmd',default='') + timeout_cmd = int(float(timeout_cmd)) + #Timeout_thread is more than that of cmd to have room for compilation time, etc + timeout_thread = timeout_cmd + 300 + if nruns_lte_softmodem == '': + nruns = testcase.findtext('nruns',default='') + else: + nruns = nruns_lte_softmodem + nruns = int(float(nruns)) + tags = testcase.findtext('tags',default='') + + RRHMachine = testcase.findtext('RRH',default='') + RRH_compile_prog = testcase.findtext('RRH_compile_prog',default='') + RRH_compile_prog_args = testcase.findtext('RRH_compile_prog_args',default='') + RRH_pre_exec = testcase.findtext('RRH_pre_exec',default='') + RRH_pre_exec_args = testcase.findtext('RRH_pre_exec_args',default='') + RRH_main_exec = testcase.findtext('RRH_main_exec',default='') + RRH_main_exec_args = testcase.findtext('RRH_main_exec_args',default='') + RRH_terminate_missing_procs = testcase.findtext('RRH_terminate_missing_procs',default='True') + + + eNBMachine = testcase.findtext('eNB',default='') + eNB_config_file = testcase.findtext('eNB_config_file',default='') + eNB_compile_prog = testcase.findtext('eNB_compile_prog',default='') + eNB_compile_prog_args = testcase.findtext('eNB_compile_prog_args',default='') + eNB_pre_exec = testcase.findtext('eNB_pre_exec',default='') + eNB_pre_exec_args = testcase.findtext('eNB_pre_exec_args',default='') + eNB_main_exec = testcase.findtext('eNB_main_exec',default='') + eNB_main_exec_args = testcase.findtext('eNB_main_exec_args',default='') + eNB_traffic_exec = testcase.findtext('eNB_traffic_exec',default='') + eNB_traffic_exec_args = testcase.findtext('eNB_traffic_exec_args',default='') + eNB_terminate_missing_procs = testcase.findtext('eNB_terminate_missing_procs',default='True') + eNB_search_expr_true = testcase.findtext('eNB_search_expr_true','') + if re.compile('\w+').match(eNB_search_expr_true) != None: + eNB_search_expr_true = eNB_search_expr_true + ' duration=' + str(timeout_cmd-90) + 's' + + UEMachine = testcase.findtext('UE',default='') + UE_config_file = testcase.findtext('UE_config_file',default='') + UE_compile_prog = testcase.findtext('UE_compile_prog',default='') + UE_compile_prog_args = testcase.findtext('UE_compile_prog_args',default='') + UE_pre_exec = testcase.findtext('UE_pre_exec',default='') + UE_pre_exec_args = testcase.findtext('UE_pre_exec_args',default='') + UE_main_exec = testcase.findtext('UE_main_exec',default='') + UE_main_exec_args = testcase.findtext('UE_main_exec_args',default='') + UE_traffic_exec = testcase.findtext('UE_traffic_exec',default='') + UE_traffic_exec_args = testcase.findtext('UE_traffic_exec_args',default='') + UE_terminate_missing_procs = testcase.findtext('UE_terminate_missing_procs',default='True') + UE_search_expr_true = testcase.findtext('UE_search_expr_true','') + UE_stop_script = testcase.findtext('UE_stop_script','') + if re.compile('\w+').match(UE_search_expr_true) != None: + UE_search_expr_true = UE_search_expr_true + ' duration=' + str(timeout_cmd-90) + 's' + + EPCMachine = testcase.findtext('EPC',default='') + EPC_config_file = testcase.findtext('EPC_config_file',default='') + EPC_compile_prog = testcase.findtext('EPC_compile_prog',default='') + EPC_compile_prog_args = testcase.findtext('EPC_compile_prog_args',default='') + HSS_compile_prog = testcase.findtext('HSS_compile_prog',default='') + HSS_compile_prog_args = testcase.findtext('HSS_compile_prog_args',default='') + + EPC_pre_exec= testcase.findtext('EPC_pre_exec',default='') + EPC_pre_exec_args = testcase.findtext('EPC_pre_exec_args',default='') + EPC_main_exec= testcase.findtext('EPC_main_exec',default='') + EPC_main_exec_args = testcase.findtext('EPC_main_exec_args',default='') + HSS_main_exec= testcase.findtext('HSS_main_exec',default='') + HSS_main_exec_args = testcase.findtext('HSS_main_exec_args',default='') + EPC_traffic_exec = testcase.findtext('EPC_traffic_exec',default='') + EPC_traffic_exec_args = testcase.findtext('EPC_traffic_exec_args',default='') + EPC_terminate_missing_procs = testcase.findtext('EPC_terminate_missing_procs',default='True') + EPC_search_expr_true = testcase.findtext('EPC_search_expr_true','') + if re.compile('\w+').match(EPC_search_expr_true) != None: + EPC_search_expr_true = EPC_search_expr_true + ' duration=' + str(timeout_cmd-90) + 's' + + index_eNBMachine = MachineList.index(eNBMachine) + index_UEMachine = MachineList.index(UEMachine) +# index_EPCMachine = MachineList.index(EPCMachine) + cmd = 'cd ' + logdirOAI5GRepo + '; source oaienv ; env|grep OPENAIR' + oai_eNB = openair('localdomain', eNBMachine) + oai_eNB.connect(user, password) + res= oai_eNB.send_recv(cmd) + oai_UE = openair('localdomain', UEMachine) + oai_UE.connect(user, password) +# print cmd + res = oai_UE.send_recv(cmd) +# print res +# oai_EPC = openair('localdomain', EPCMfachine) +# oai_EPC.connect(user, password) + res = oai_eNB.send_recv(cmd) + if RRHMachine != '': + cmd = 'cd ' + logdirOAI5GRepo + '; source oaienv ; env|grep OPENAIR' + index_RRHMachine = MachineList.index(RRHMachine) + oai_RRH = openair('localdomain', RRHMachine) + oai_RRH.connect(user, password) + res= oai_RRH.send_recv(cmd) + #cleanOldPrograms(oai_eNB, oldprogramList, CleanUpAluLteBox, ExmimoRfStop) + #cleanOldPrograms(oai_UE, oldprogramList, CleanUpAluLteBox, ExmimoRfStop) + #cleanOldPrograms(oai_EPC, oldprogramList, CleanUpAluLteBox, ExmimoRfStop) + logdir_local = os.environ.get('OPENAIR_DIR') + if logdir_local is None: + print "Environment variable OPENAIR_DIR not set correctly" + sys.exit() + + #Make the log directory of test case + #cmd = 'mkdir -p ' + logdir_eNB + #result = oai_eNB.send_recv(cmd) + #cmd = 'mkdir -p ' + logdir_UE + #print cmd + #result = oai_UE.send_recv(cmd) + #print result + #cmd = 'mkdir -p ' + logdir_EPC + #result = oai_EPC.send_recv(cmd) + + print "Updating the config files for ENB/UE/EPC..." + #updating the eNB/UE/EPC configuration file from the test case + #update_config_file(oai_eNB, eNB_config_file, logdirOAI5GRepo) + #update_config_file(oai_UE, UE_config_file, logdirOAI5GRepo) + #update_config_file(oai_EPC, EPC_config_file, logdirOpenaircnRepo) + test_result=1 + test_result_string='' + start_time=time.time() + for run in range(0,nruns): + run_result=1 + run_result_string='' + logdir_eNB = logdirOAI5GRepo+'/cmake_targets/autotests/log/'+ testcasename + '/run_' + str(run) + logdir_RRH = logdirOAI5GRepo+'/cmake_targets/autotests/log/'+ testcasename + '/run_' + str(run) + logdir_UE = logdirOAI5GRepo+'/cmake_targets/autotests/log/'+ testcasename + '/run_' + str(run) + logdir_EPC = logdirOpenaircnRepo+'/TEST/autotests/log/'+ testcasename + '/run_' + str(run) + logdir_local_testcase = logdir_local + '/cmake_targets/autotests/log/'+ testcasename + '/run_' + str(run) + #Make the log directory of test case + if RRHMachine != '': + cmd = 'rm -fr ' + logdir_RRH + ' ; mkdir -p ' + logdir_RRH + result = oai_RRH.send_recv(cmd) + cmd = 'rm -fr ' + logdir_eNB + ' ; mkdir -p ' + logdir_eNB + result = oai_eNB.send_recv(cmd) + cmd = 'rm -fr ' + logdir_UE + ' ; mkdir -p ' + logdir_UE +# print cmd + result = oai_UE.send_recv(cmd) + # print result + cmd = 'rm -fr ' + logdir_EPC + '; mkdir -p ' + logdir_EPC +# result = oai_EPC.send_recv(cmd) + cmd = ' rm -fr ' + logdir_local_testcase + ' ; mkdir -p ' + logdir_local_testcase + result = os.system(cmd) + + if RRHMachine != '': + logfile_compile_RRH = logdir_RRH + '/RRH_compile' + '_' + str(run) + '_.log' + logfile_exec_RRH = logdir_RRH + '/RRH_exec' + '_' + str(run) + '_.log' + logfile_pre_exec_RRH = logdir_RRH + '/RRH_pre_exec' + '_' + str(run) + '_.log' + logfile_task_RRH_compile_out = logdir_RRH + '/RRH_task_compile_out' + '_' + str(run) + '_.log' + logfile_task_RRH_compile = logdir_local_testcase + '/RRH_task_compile' + '_' + str(run) + '_.log' + logfile_task_RRH_out = logdir_RRH + '/RRH_task_out' + '_' + str(run) + '_.log' + logfile_task_RRH = logdir_local_testcase + '/RRH_task' + '_' + str(run) + '_.log' + task_RRH_compile = ' ( uname -a ; date \n' + task_RRH_compile = task_RRH_compile + 'cd ' + logdirOAI5GRepo + ' ; source oaienv ; source cmake_targets/tools/build_helper \n' + task_RRH_compile = task_RRH_compile + 'env |grep OPENAIR \n' + if RRH_compile_prog != "": + task_RRH_compile = task_RRH_compile + ' ( ' + RRH_compile_prog + ' '+ RRH_compile_prog_args + ' ) > ' + logfile_compile_RRH + ' 2>&1 \n' + task_RRH_compile = task_RRH_compile + ' date ) > ' + logfile_task_RRH_compile_out + ' 2>&1 ' + write_file(logfile_task_RRH_compile, task_RRH_compile, mode="w") + + task_RRH = ' ( uname -a ; date \n' + task_RRH = task_RRH + ' export OPENAIR_TESTDIR=' + logdir_RRH + '\n' + task_RRH = task_RRH + 'cd ' + logdirOAI5GRepo + ' ; source oaienv ; source cmake_targets/tools/build_helper \n' + task_RRH = task_RRH + 'env |grep OPENAIR \n' + 'array_exec_pid=() \n' + + if RRH_pre_exec != "": + task_RRH = task_RRH + ' ( date; ' + RRH_pre_exec + ' '+ RRH_pre_exec_args + ' ) > ' + logfile_pre_exec_RRH + ' 2>&1 \n' + if RRH_main_exec != "": + task_RRH = task_RRH + ' ( date; ' + addsudo(RRH_main_exec + ' ' + RRH_main_exec_args, mypassword) + ' ) > ' + logfile_exec_RRH + ' 2>&1 & \n' + task_RRH = task_RRH + 'array_exec_pid+=($!) \n' + task_RRH = task_RRH + 'echo eNB_main_exec PID = $! \n' + #terminate the eNB test case after timeout_cmd seconds + task_RRH = task_RRH + finalize_deploy_script (timeout_cmd, RRH_terminate_missing_procs) + ' \n' + task_RRH = task_RRH + 'handle_ctrl_c' + '\n' + task_RRH = task_RRH + ' ) > ' + logfile_task_RRH_out + ' 2>&1 ' + write_file(logfile_task_RRH, task_RRH, mode="w") + + logfile_compile_eNB = logdir_eNB + '/eNB_compile' + '_' + str(run) + '_.log' + logfile_exec_eNB = logdir_eNB + '/eNB_exec' + '_' + str(run) + '_.log' + logfile_pre_exec_eNB = logdir_eNB + '/eNB_pre_exec' + '_' + str(run) + '_.log' + logfile_traffic_eNB = logdir_eNB + '/eNB_traffic' + '_' + str(run) + '_.log' + logfile_task_eNB_compile_out = logdir_eNB + '/eNB_task_compile_out' + '_' + str(run) + '_.log' + logfile_task_eNB_compile = logdir_local_testcase + '/eNB_task_compile' + '_' + str(run) + '_.log' + logfile_task_eNB_out = logdir_eNB + '/eNB_task_out' + '_' + str(run) + '_.log' + logfile_task_eNB = logdir_local_testcase + '/eNB_task' + '_' + str(run) + '_.log' + logfile_local_traffic_eNB_out = logdir_local_testcase + '/eNB_traffic' + '_' + str(run) + '_.log' + logfile_tshark_eNB = logdir_eNB + '/eNB_tshark' + '_' + str(run) + '_.log' + logfile_pcap_eNB = logdir_eNB + '/eNB_tshark' + '_' + str(run) + '_.pcap' + logfile_pcap_zip_eNB = logdir_eNB + '/eNB_tshark' + '_' + str(run) + '_.pcap.zip' + logfile_pcap_tmp_eNB = '/tmp/' + '/eNB_tshark' + '_' + str(run) + '_.pcap' + + task_eNB_compile = ' ( uname -a ; date \n' + task_eNB_compile = task_eNB_compile + 'cd ' + logdirOAI5GRepo + ' ; source oaienv ; source cmake_targets/tools/build_helper \n' + task_eNB_compile = task_eNB_compile + 'env |grep OPENAIR \n' + task_eNB_compile = task_eNB_compile + update_config_file(oai_eNB, eNB_config_file, logdirOAI5GRepo, '$OPENAIR_DIR/cmake_targets/autotests/tools/search_repl.py') + '\n' + if eNB_compile_prog != "": + task_eNB_compile = task_eNB_compile + ' ( ' + eNB_compile_prog + ' '+ eNB_compile_prog_args + ' ) > ' + logfile_compile_eNB + ' 2>&1 \n' + task_eNB_compile = task_eNB_compile + ' date ) > ' + logfile_task_eNB_compile_out + ' 2>&1 ' + write_file(logfile_task_eNB_compile, task_eNB_compile, mode="w") + + task_eNB = ' ( uname -a ; date \n' + task_eNB = task_eNB + ' export OPENAIR_TESTDIR=' + logdir_eNB + '\n' + task_eNB = task_eNB + 'cd ' + logdirOAI5GRepo + ' ; source oaienv ; source cmake_targets/tools/build_helper \n' + task_eNB = task_eNB + 'env |grep OPENAIR \n' + 'array_exec_pid=() \n' + + if eNB_pre_exec != "": + task_eNB = task_eNB + ' ( date; ' + eNB_pre_exec + ' '+ eNB_pre_exec_args + ' ) > ' + logfile_pre_exec_eNB + ' 2>&1 \n' + if eNB_main_exec != "": + task_eNB = task_eNB + ' ( date; ' + addsudo(eNB_main_exec + ' ' + eNB_main_exec_args, mypassword) + ' ) > ' + logfile_exec_eNB + ' 2>&1 & \n' + task_eNB = task_eNB + 'array_exec_pid+=($!) \n' + task_eNB = task_eNB + 'echo eNB_main_exec PID = $! \n' + if eNB_traffic_exec != "": + cmd_traffic = eNB_traffic_exec + ' ' + eNB_traffic_exec_args + if cmd_traffic.find('-c') >= 0: + cmd_traffic = cmd_traffic + ' -t ' + str(timeout_cmd - 60) + task_eNB = task_eNB + ' (date; ' + cmd_traffic + ' ) > ' + logfile_traffic_eNB + ' 2>&1 & \n' + task_eNB = task_eNB + 'array_exec_pid+=($!) \n' + task_eNB = task_eNB + 'echo eNB_traffic_exec PID = $! \n' + + task_eNB = task_eNB + ' (date; sudo rm -f ' + logfile_pcap_tmp_eNB + ' ; sudo -E tshark -i lo -s 65535 -a duration:' + str(timeout_cmd-10)+ ' -w ' + logfile_pcap_tmp_eNB+ ' ; sudo -E chown ' + user + ' ' + logfile_pcap_tmp_eNB + ' ; zip -j -9 ' + logfile_pcap_zip_eNB + ' ' + logfile_pcap_tmp_eNB + ' ) > ' + logfile_tshark_eNB + ' 2>&1 & \n ' + task_eNB = task_eNB + 'array_exec_pid+=($!) \n' + task_eNB = task_eNB + 'echo eNB_tshark_exec PID = $! \n' + #terminate the eNB test case after timeout_cmd seconds + task_eNB = task_eNB + finalize_deploy_script (timeout_cmd, eNB_terminate_missing_procs) + ' \n' + #task_eNB = task_eNB + 'sleep ' + str(timeout_cmd) + ' \n' + task_eNB = task_eNB + 'handle_ctrl_c' + '\n' + task_eNB = task_eNB + ' ) > ' + logfile_task_eNB_out + ' 2>&1 ' + write_file(logfile_task_eNB, task_eNB, mode="w") + + #task_eNB = 'echo \" ' + task_eNB + '\" > ' + logfile_script_eNB + ' 2>&1 ; ' + task_eNB + logfile_compile_UE = logdir_UE + '/UE_compile' + '_' + str(run) + '_.log' + logfile_exec_UE = logdir_UE + '/UE_exec' + '_' + str(run) + '_.log' + logfile_pre_exec_UE = logdir_UE + '/UE_pre_exec' + '_' + str(run) + '_.log' + logfile_traffic_UE = logdir_UE + '/UE_traffic' + '_' + str(run) + '_.log' + logfile_task_UE_out = logdir_UE + '/UE_task_out' + '_' + str(run) + '_.log' + logfile_task_UE = logdir_local_testcase + '/UE_task' + '_' + str(run) + '_.log' + logfile_task_UE_compile_out = logdir_UE + '/UE_task_compile_out' + '_' + str(run) + '_.log' + logfile_task_UE_compile = logdir_local_testcase + '/UE_task_compile' + '_' + str(run) + '_.log' + logfile_local_traffic_UE_out = logdir_local_testcase + '/UE_traffic' + '_' + str(run) + '_.log' + + task_UE_compile = ' ( uname -a ; date \n' + task_UE_compile = task_UE_compile + 'array_exec_pid=()' + '\n' + task_UE_compile = task_UE_compile + 'cd ' + logdirOAI5GRepo + '\n' + task_UE_compile = task_UE_compile + 'source oaienv \n' + task_UE_compile = task_UE_compile + 'source cmake_targets/tools/build_helper \n' + task_UE_compile = task_UE_compile + 'env |grep OPENAIR \n' + task_UE_compile = task_UE_compile + update_config_file(oai_UE, UE_config_file, logdirOAI5GRepo, '$OPENAIR_DIR/cmake_targets/autotests/tools/search_repl.py') + '\n' + if UE_compile_prog != "": + task_UE_compile = task_UE_compile + ' ( ' + UE_compile_prog + ' '+ UE_compile_prog_args + ' ) > ' + logfile_compile_UE + ' 2>&1 \n' + task_UE_compile = task_UE_compile + ' ) > ' + logfile_task_UE_compile_out + ' 2>&1 ' + write_file(logfile_task_UE_compile, task_UE_compile, mode="w") + + task_UE = ' ( uname -a ; date \n' + task_UE = task_UE + 'array_exec_pid=()' + '\n' + task_UE = task_UE + 'cd ' + logdirOAI5GRepo + '\n' + task_UE = task_UE + 'source oaienv \n' + task_UE = task_UE + 'source cmake_targets/tools/build_helper \n' + task_UE = task_UE + 'env |grep OPENAIR \n' + if UE_pre_exec != "": + task_UE = task_UE + ' ( date; ' + UE_pre_exec + ' '+ UE_pre_exec_args + ' ) > ' + logfile_pre_exec_UE + ' 2>&1 \n' + if UE_main_exec != "": + task_UE = task_UE + ' ( date; ' + addsudo(UE_main_exec + ' ' + UE_main_exec_args, mypassword) + ' ) > ' + logfile_exec_UE + ' 2>&1 & \n' + task_UE = task_UE + 'array_exec_pid+=($!) \n' + task_UE = task_UE + 'echo UE_main_exec PID = $! \n' + if UE_traffic_exec != "": + cmd_traffic = UE_traffic_exec + ' ' + UE_traffic_exec_args + if cmd_traffic.find('-c') >= 0: + cmd_traffic = cmd_traffic + ' -t ' + str(timeout_cmd - 60) + task_UE = task_UE + ' ( date; ' + cmd_traffic + ' ) >' + logfile_traffic_UE + ' 2>&1 & \n' + task_UE = task_UE + 'array_exec_pid+=($!) \n' + task_UE = task_UE + 'echo UE_traffic_exec PID = $! \n' + #terminate the UE test case after timeout_cmd seconds + task_UE = task_UE + finalize_deploy_script (timeout_cmd, UE_terminate_missing_procs) + ' \n' + #task_UE = task_UE + 'sleep ' + str(timeout_cmd) + ' \n' + task_UE = task_UE + 'handle_ctrl_c' + '\n' + task_UE = task_UE + ' ) > ' + logfile_task_UE_out + ' 2>&1 ' + write_file(logfile_task_UE, task_UE, mode="w") + #task_UE = 'echo \" ' + task_UE + '\" > ' + logfile_script_UE + ' 2>&1 ; ' + task_UE + + logfile_compile_EPC = logdir_EPC + '/EPC_compile' + '_' + str(run) + '_.log' + logfile_compile_HSS = logdir_EPC + '/HSS_compile' + '_' + str(run) + '_.log' + logfile_exec_EPC = logdir_EPC + '/EPC_exec' + '_' + str(run) + '_.log' + logfile_pre_exec_EPC = logdir_EPC + '/EPC_pre_exec' + '_' + str(run) + '_.log' + logfile_exec_HSS = logdir_EPC + '/HSS_exec' + '_' + str(run) + '_.log' + logfile_traffic_EPC = logdir_EPC + '/EPC_traffic' + '_' + str(run) + '_.log' + logfile_task_EPC_out = logdir_EPC + '/EPC_task_out' + '_' + str(run) + '_.log' + logfile_task_EPC = logdir_local_testcase + '/EPC_task' + '_' + str(run) + '_.log' + logfile_task_EPC_compile_out = logdir_EPC + '/EPC_task_compile_out' + '_' + str(run) + '_.log' + logfile_task_EPC_compile = logdir_local_testcase + '/EPC_task_compile' + '_' + str(run) + '_.log' + logfile_local_traffic_EPC_out = logdir_local_testcase + '/EPC_traffic' + '_' + str(run) + '_.log' + +# task_EPC_compile = ' ( uname -a ; date \n' +# task_EPC_compile = task_EPC_compile + 'array_exec_pid=()' + '\n' +# task_EPC_compile = task_EPC_compile + 'cd ' + logdirOpenaircnRepo + ' ; source oaienv \n' +# task_EPC_compile = task_EPC_compile + update_config_file(oai_EPC, EPC_config_file, logdirOpenaircnRepo, logdirOpenaircnRepo+'/TEST/autotests/tools/search_repl.py') + '\n' +# task_EPC_compile = task_EPC_compile + 'source BUILD/TOOLS/build_helper \n' +# if EPC_compile_prog != "": +# task_EPC_compile = task_EPC_compile + '(' + EPC_compile_prog + ' ' + EPC_compile_prog_args + ' ) > ' + logfile_compile_EPC + ' 2>&1 \n' +# if HSS_compile_prog != "": +# task_EPC_compile = task_EPC_compile + '(' + HSS_compile_prog + ' ' + HSS_compile_prog_args + ' ) > ' + logfile_compile_HSS + ' 2>&1 \n' +# task_EPC_compile = task_EPC_compile + ' ) > ' + logfile_task_EPC_compile_out + ' 2>&1 ' +# write_file(logfile_task_EPC_compile, task_EPC_compile, mode="w") + + task_EPC = ' ( uname -a ; date \n' + task_EPC = task_EPC + ' export OPENAIRCN_TESTDIR=' + logdir_EPC + '\n' + task_EPC = task_EPC + 'array_exec_pid=()' + '\n' + task_EPC = task_EPC + 'cd ' + logdirOpenaircnRepo + '; source oaienv\n' + task_EPC = task_EPC + 'source BUILD/TOOLS/build_helper \n' + if EPC_pre_exec != "": + task_EPC = task_EPC + ' ( date; ' + EPC_pre_exec + ' '+ EPC_pre_exec_args + ' ) > ' + logfile_pre_exec_EPC + ' 2>&1 \n' + if HSS_main_exec != "": + task_EPC = task_EPC + '( date; ' + addsudo (HSS_main_exec + ' ' + HSS_main_exec_args, mypassword) + ' ) > ' + logfile_exec_HSS + ' 2>&1 & \n' + task_EPC = task_EPC + 'array_exec_pid+=($!) \n' + task_EPC = task_EPC + 'echo HSS_main_exec PID = $! \n' + if EPC_main_exec != "": + task_EPC = task_EPC + '( date; ' + addsudo (EPC_main_exec + ' ' + EPC_main_exec_args, mypassword) + ' ) > ' + logfile_exec_EPC + ' 2>&1 & \n' + task_EPC = task_EPC + 'array_exec_pid+=($!) \n' + task_EPC = task_EPC + 'echo EPC_main_exec PID = $! \n' + if EPC_traffic_exec != "": + cmd_traffic = EPC_traffic_exec + ' ' + EPC_traffic_exec_args + if cmd_traffic.find('-c') >= 0: + cmd_traffic = cmd_traffic + ' -t ' + str(timeout_cmd - 60) + task_EPC = task_EPC + '( date; ' + cmd_traffic + ' ) > ' + logfile_traffic_EPC + ' 2>&1 & \n' + task_EPC = task_EPC + 'array_exec_pid+=($!) \n' + task_EPC = task_EPC + 'echo EPC_traffic_exec PID = $! \n' + #terminate the EPC test case after timeout_cmd seconds + task_EPC = task_EPC + finalize_deploy_script (timeout_cmd, EPC_terminate_missing_procs) + '\n' + #task_EPC = task_EPC + 'sleep ' + str(timeout_cmd) + '\n' + task_EPC = task_EPC + 'handle_ctrl_c' '\n' + task_EPC = task_EPC + ' ) > ' + logfile_task_EPC_out + ' 2>&1 ' + write_file(logfile_task_EPC, task_EPC, mode="w") + + #first we compile all the programs +# thread_EPC = oaiThread(1, "EPC_thread", EPCMachine, user, password , task_EPC_compile, False, timeout_thread) + thread_eNB = oaiThread(2, "eNB_thread", eNBMachine, user, password , task_eNB_compile, False, timeout_thread) + thread_UE = oaiThread(3, "UE_thread", UEMachine, user, password , task_UE_compile, False, timeout_thread) + if RRHMachine != '': + thread_RRH = oaiThread(4, "RRH_thread", RRHMachine, user, password , task_RRH_compile, False, timeout_thread) + threads=[] + threads.append(thread_eNB) + threads.append(thread_UE) +# threads.append(thread_EPC) + if RRHMachine != '': + threads.append(thread_RRH) + # Start new Threads + thread_eNB.start() + thread_UE.start() +# thread_EPC.start() + if RRHMachine != '': + thread_RRH.start() + #Wait for all the compile threads to complete + for t in threads: + t.join() + + #Now we execute all the threads +# thread_EPC = oaiThread(1, "EPC_thread", EPCMachine, user, password , task_EPC, False, timeout_thread) + thread_eNB = oaiThread(2, "eNB_thread", eNBMachine, user, password , task_eNB, False, timeout_thread) + thread_UE = oaiThread(3, "UE_thread", UEMachine, user, password , task_UE, False, timeout_thread) + if RRHMachine != '': + thread_RRH = oaiThread(4, "RRH_thread", RRHMachine, user, password , task_RRH, False, timeout_thread) + threads=[] + threads.append(thread_eNB) + threads.append(thread_UE) +# threads.append(thread_EPC) + if RRHMachine != '': + threads.append(thread_RRH) + # Start new Threads + + thread_eNB.start() + thread_UE.start() +# thread_EPC.start() + if RRHMachine != '': + thread_RRH.start() + #Wait for all the compile threads to complete + for t in threads: + t.join() + #Now we get the log files from remote machines on the local machine + if RRHMachine != '': + cleanOldProgramsAllMachines([oai_eNB, oai_UE, oai_EPC, oai_RRH] , oldprogramList, CleanUpAluLteBox, ExmimoRfStop, [logdir_eNB, logdir_UE, logdir_EPC, logdir_RRH], logdirOAI5GRepo) + else: + cleanOldProgramsAllMachines([oai_eNB, oai_UE] , oldprogramList, CleanUpAluLteBox, ExmimoRfStop, [logdir_eNB, logdir_UE, logdir_EPC], logdirOAI5GRepo) +# cleanOldProgramsAllMachines([oai_eNB, oai_UE, oai_EPC] , oldprogramList, CleanUpAluLteBox, ExmimoRfStop, [logdir_eNB, logdir_UE, logdir_EPC], logdirOAI5GRepo) + logfile_UE_stop_script_out = logdir_UE + '/UE_stop_script_out' + '_' + str(run) + '_.log' + logfile_UE_stop_script = logdir_local_testcase + '/UE_stop_script' + '_' + str(run) + '_.log' + + if UE_stop_script != "": + cmd = ' ( uname -a ; date \n' + cmd = cmd + 'cd ' + logdirOAI5GRepo + ' ; source oaienv ; source cmake_targets/tools/build_helper \n' + cmd = cmd + 'env |grep OPENAIR \n' + 'array_exec_pid=() \n' + cmd = cmd + UE_stop_script + '\n' + cmd = cmd + ') > ' + logfile_UE_stop_script_out + ' 2>&1 ' + write_file(logfile_UE_stop_script , cmd, mode="w") +# thread_UE = oaiThread(4, "UE_thread", UEMachine, user, password , cmd, False, timeout_thread) +# thread_UE.start() +# thread_UE.join() + + #Now we change the permissions of the logfiles to avoid some of them being with root permissions + cmd = 'sudo -E chown -R ' + user + ' ' + logdir_eNB + res= oai_eNB.send_recv(cmd) +# print "Changing permissions of logdir <" + logdir_eNB + "> in eNB machine..." + res + + cmd = 'sudo -E chown -R ' + user + ' ' + logdir_UE +# print cmd + res= oai_UE.send_recv(cmd) +# print res +# print "Changing permissions of logdir <" + logdir_UE + "> in UE machine..." + res + + cmd = 'sudo -E chown -R ' + user + ' ' + logdir_EPC +# res= oai_EPC.send_recv(cmd) +# print "Changing permissions of logdir <" + logdir_EPC + "> in EPC machine..." + res + + if RRHMachine != '': + cmd = 'sudo -E chown -R ' + user + ' ' + logdir_RRH + res= oai_RRH.send_recv(cmd) +# print "Changing permissions of logdir <" + logdir_RRH + "> in RRH machine..." + res + + print "Copying files from EPCMachine : " + EPCMachine + "logdir_EPC = " + logdir_EPC +# SSHSessionWrapper(EPCMachine, user, None, password, logdir_EPC, logdir_local + '/cmake_targets/autotests/log/'+ testcasename, "get_all") + + print "Copying files from eNBMachine " + eNBMachine + "logdir_eNB = " + logdir_eNB + SSHSessionWrapper(eNBMachine, user, None, password, logdir_eNB, logdir_local + '/cmake_targets/autotests/log/'+ testcasename, "get_all") + + print "Copying files from UEMachine : " + UEMachine + "logdir_UE = " + logdir_UE + SSHSessionWrapper(UEMachine, user, None, password, logdir_UE, logdir_local + '/cmake_targets/autotests/log/'+ testcasename, "get_all") + + if RRHMachine != '': + print "Copying files from RRHMachine : " + RRHMachine + "logdir_RRH = " + logdir_RRH + SSHSessionWrapper(RRHMachine, user, None, password, logdir_RRH, logdir_local + '/cmake_targets/autotests/log/'+ testcasename, "get_all") + + + #Currently we only perform throughput tests + tput_run_string='' + result, tput_string = tput_test_search_expr(eNB_search_expr_true, logfile_local_traffic_eNB_out) + tput_run_string = tput_run_string + tput_string + run_result=run_result&result + result, tput_string = tput_test_search_expr(EPC_search_expr_true, logfile_local_traffic_EPC_out) + run_result=run_result&result + tput_run_string = tput_run_string + tput_string + result, tput_string = tput_test_search_expr(UE_search_expr_true, logfile_local_traffic_UE_out) + run_result=run_result&result + tput_run_string = tput_run_string + tput_string + + if run_result == 1: + run_result_string = ' RUN_'+str(run) + ' = PASS' + else: + run_result_string = ' RUN_'+str(run) + ' = FAIL' + + #If there is assertion, we mark the test case as failure as most likely eNB crashed + cmd = "grep -ilr \"assertion\" " + logdir_local_testcase + " | cat " + cmd_out = subprocess.check_output ([cmd], shell=True) + if len(cmd_out) !=0 : + run_result=0 + run_result_string = ' RUN_'+str(run) + ' = FAIL(Assert)' + + #If there is thread busy error, we mark the test case as failure as most likely eNB crashed + cmd = "grep -ilr \"thread busy\" " + logdir_local_testcase + " | cat " + cmd_out = subprocess.check_output ([cmd], shell=True) + if len(cmd_out) !=0: + run_result=0 + run_result_string = ' RUN_'+str(run) + ' = FAIL(Thread_Busy)' + + run_result_string = run_result_string + tput_run_string + + test_result=test_result & run_result + test_result_string=test_result_string + run_result_string + + oai_eNB.disconnect() + oai_UE.disconnect() +# oai_EPC.disconnect() + #We need to close the new ssh session that was created + #if index_eNBMachine == index_EPCMachine: + # oai_EPC.disconnect() + #Now we finalize the xml file of the test case + end_time=time.time() + duration= end_time - start_time + xmlFile = logdir_local + '/cmake_targets/autotests/log/'+ testcasename + '/test.' + testcasename + '.xml' + if test_result ==0: + result='FAIL' + else: + result = 'PASS' + xml="\n \n" + write_file(xmlFile, xml, mode="w") + + + +# \brief handler for executing test cases (lte-softmodem-noS1) +# \param testcase name of testcase +# \param oldprogramList list of programs which must be terminated before running a test case +# \param logdirOAI5GRepo directory on remote machine which has openairinterface5g repo installed +# \param logdirOpenaircnRepo directory on remote machine which has openair-cn repo installed +# \param MachineList list of all machines on which test cases can be run +# \param user username with which to login +# \param password password with which to login +# \param CleanupAluLteBox string that contains commands to stop ALU Bell Labs LTEBox (specified in test_case_list.xml) +# \param ExmimoRfStop command to stop EXMIMO Card +# \param nruns_lte-softmodem global parameter to override number of runs (nruns) within the test case +def handle_testcaseclass_softmodem_noS1 (testcase, oldprogramList, logdirOAI5GRepo , logdirOpenaircnRepo, MachineList, user, password, CleanUpAluLteBox, ExmimoRfStop, nruns_lte_softmodem, timeout_cmd): + #We ignore the password sent to this function for secuirity reasons for password present in log files + #It is recommended to add a line in /etc/sudoers that looks something like below. The line below will run sudo without password prompt + # your_user_name ALL=(ALL:ALL) NOPASSWD: ALL + + indent="\t" + threads=[] + + # + # Test case parameters + # ----------------------------------------------------------------------------- + testcase_verdict = 'PASS' + testcase_time_start = datetime.datetime.now() + testcase_name = testcase.get('id') + testcase_class = testcase.findtext('class',default='') + testcase_desc = testcase.findtext('desc',default='') + if timeout_cmd == '': + timeout_cmd = testcase.findtext('TimeOut_cmd',default='') + timeout_cmd = int(float(timeout_cmd)) + timeout_thread = timeout_cmd + 60 #Timeout_thread is more than that of cmd to have room for compilation time, etc + if nruns_lte_softmodem == '': + nruns = testcase.findtext('nruns',default='') + else: + nruns = nruns_lte_softmodem + nruns = int(float(nruns)) + tags = testcase.findtext('tags',default='') + + max_ntries = testcase.findtext('max_ntries',default='') + if max_ntries : + max_ntries = int(float(max_ntries)) + else : + max_ntries = nruns + + print( indent + "> testcase time start : " + str(testcase_time_start) ) + print( indent + "> testcase class : " + testcase_class ) + print( indent + "> testcase description : " + testcase_desc ) + print( indent + "> testcase timeout : " + str(timeout_cmd) ) + print( indent + "> testcase thread timeout : " + str(timeout_thread) ) + print( indent + "> number of runs : " + str(nruns) ) + print( indent + "> number of max tries : " + str(max_ntries) ) + print( indent + "> testcase tags : " + tags ) + + logdir_local_testcase = openairdir_local + '/cmake_targets/autotests/log/'+ testcasename + logdir_eNB_testcase = logdirOAI5GRepo +'/cmake_targets/autotests/log/'+ testcasename + logdir_UE_testcase = logdirOAI5GRepo +'/cmake_targets/autotests/log/'+ testcasename + + # + # Local checks for test cases + # ----------------------------------------------- + + # Logging directory + if (not os.path.exists(logdir_local_testcase)): + os.system('mkdir -p ' + logdir_local_testcase) + + # + # REMOTE MACHINE COMPILATION + # ------------------------------------------------ + + eNBMachine = testcase.findtext('eNB',default='') + eNB_config_file = testcase.findtext('eNB_config_file',default='') + eNB_compile_prog = testcase.findtext('eNB_compile_prog',default='') + eNB_compile_prog_args = testcase.findtext('eNB_compile_prog_args',default='') + + logfile_compile_eNB = logdir_eNB_testcase + '/eNB_compile.log' + logfile_task_eNB_compile_out = logdir_eNB_testcase + '/eNB_task_compile_out.log' + logfile_task_eNB_compile = logdir_local_testcase + '/eNB_task_compile.log' + + # Check that machine is in test setup machine list + print( Fore.WHITE + indent + "> testcase eNB machine :"), + if (eNBMachine not in MachineList): + print( Fore.RED + eNBMachine + " not in test setup machine list") + testcase_verdict = 'INCON' + else : + print eNBMachine, + # get machine description + eNBMachineDesc = MachineDescDic[eNBMachine] + index_eNBMachine = MachineList.index(eNBMachine) + # check that openairinterface is installed on machine + oai_eNB = openair('localdomain', eNBMachine) + oai_eNB.connect(user, password) + cmd = 'cd ' + logdirOAI5GRepo + '; source oaienv ; env|grep --color=never OPENAIR' + res= oai_eNB.send_recv(cmd) + m = re.search('OPENAIR_HOME', res, re.DOTALL) + if m: + print + # Create testcase directory on remote eNB + cmd = 'rm -fr ' + logdir_eNB_testcase + ' ; mkdir -p ' + logdir_eNB_testcase + result = oai_eNB.send_recv(cmd) + + # Check if we need to compile lte-softmodem-noS1 on remote machine + eNB_compile_cmd = eNB_compile_prog + ' '+ eNB_compile_prog_args + if ('last_compile_prog' in eNBMachineDesc) and eNBMachineDesc['last_compile_prog'] == eNB_compile_cmd: + print( Fore.WHITE + indent + "> eNB machine compilation : skipped -> "+eNB_compile_cmd ) + else: + print( Fore.WHITE + indent + "> eNB machine compilation : triggered -> "+eNB_compile_cmd ) + eNBMachineDesc['last_compile_prog'] = eNB_compile_prog + ' '+ eNB_compile_prog_args # if last compilation is the same do not compile again + task_eNB_compile = ' ( uname -a ; date \n' + task_eNB_compile = task_eNB_compile + 'cd ' + logdirOAI5GRepo + ' ; source oaienv ; source cmake_targets/tools/build_helper \n' + task_eNB_compile = task_eNB_compile + 'env |grep OPENAIR \n' + task_eNB_compile = task_eNB_compile + update_config_file(oai_eNB, eNB_config_file, logdirOAI5GRepo, '$OPENAIR_DIR/cmake_targets/autotests/tools/search_repl.py') + '\n' + if eNB_compile_cmd != "": + task_eNB_compile = task_eNB_compile + ' ( ' + eNB_compile_cmd + ' ) > ' + logfile_compile_eNB + ' 2>&1 \n' + task_eNB_compile = task_eNB_compile + ' date ) > ' + logfile_task_eNB_compile_out + ' 2>&1 ' + write_file(logfile_task_eNB_compile, task_eNB_compile, mode="w") + + + thread_eNB = oaiThread(1, "eNB_thread_compile", eNBMachine, user, password , task_eNB_compile, False, timeout_thread) + threads.append(thread_eNB) + thread_eNB.start() + + else: + print( Fore.RED + " -> OAI5G not properly setup ! please check REMOTE MACHINE PREPARATION step") + testcase_verdict = 'INCON' + + + UEMachine = testcase.findtext('UE',default='') + UE_config_file = testcase.findtext('UE_config_file',default='') + UE_compile_prog = testcase.findtext('UE_compile_prog',default='') + UE_compile_prog_args = testcase.findtext('UE_compile_prog_args',default='') + + logfile_compile_UE = logdir_UE_testcase + '/UE_compile.log' + logfile_task_UE_compile_out = logdir_UE_testcase + '/UE_task_compile_out.log' + logfile_task_UE_compile = logdir_local_testcase + '/UE_task_compile.log' + + # Check that machine is in test setup machine list + print( Fore.WHITE + indent + "> testcase UE machine :"), + if (UEMachine not in MachineList): + print( Fore.RED + UEMachine + " not in test setup machine list") + testcase_verdict = 'INCON' + else : + print UEMachine, + # get machine description + UEMachineDesc = MachineDescDic[UEMachine] + index_UEMachine = MachineList.index(UEMachine) + # check that openairinterface is installed on machine + oai_UE = openair('localdomain', UEMachine) + oai_UE.connect(user, password) + cmd = 'cd ' + logdirOAI5GRepo + '; source oaienv ; env|grep --color=never OPENAIR' + res= oai_UE.send_recv(cmd) + m = re.search('OPENAIR_HOME', res, re.DOTALL) + if m: + print + # Create testcase directory on remote UE + cmd = 'rm -fr ' + logdir_UE_testcase + ' ; mkdir -p ' + logdir_UE_testcase + result = oai_UE.send_recv(cmd) + + # Check if we need to compile lte-softmodem-noS1 on remote machine + UE_compile_cmd = UE_compile_prog + ' '+ UE_compile_prog_args + if ('last_compile_prog' in UEMachineDesc) and UEMachineDesc['last_compile_prog'] == UE_compile_cmd: + print( Fore.WHITE + indent + "> UE machine compilation : skipped -> "+UE_compile_cmd ) + else: + print( Fore.WHITE + indent + "> UE machine compilation : triggered -> "+UE_compile_cmd ) + UEMachineDesc['last_compile_prog'] = UE_compile_prog + ' '+ UE_compile_prog_args + task_UE_compile = ' ( uname -a ; date \n' + task_UE_compile = task_UE_compile + 'cd ' + logdirOAI5GRepo + ' ; source oaienv ; source cmake_targets/tools/build_helper \n' + task_UE_compile = task_UE_compile + 'env |grep OPENAIR \n' + task_UE_compile = task_UE_compile + update_config_file(oai_UE, UE_config_file, logdirOAI5GRepo, '$OPENAIR_DIR/cmake_targets/autotests/tools/search_repl.py') + '\n' + if UE_compile_cmd != "": + task_UE_compile = task_UE_compile + ' ( ' + UE_compile_cmd + ' ) > ' + logfile_compile_UE + ' 2>&1 \n' + task_UE_compile = task_UE_compile + ' date ) > ' + logfile_task_UE_compile_out + ' 2>&1 ' + write_file(logfile_task_UE_compile, task_UE_compile, mode="w") + + thread_UE = oaiThread(2, "UE_thread_compile", UEMachine, user, password , task_UE_compile, False, timeout_thread) + threads.append(thread_UE) + thread_UE.start() + + else: + print( Fore.RED + " -> OAI5G not properly setup ! please check REMOTE MACHINE PREPARATION step") + testcase_verdict = 'INCON' + + + + + + + # Wait for Compilation thread to terminate + #----------------------------------------- + for t in threads: + t.join() + + # TODO check that compilation is succeed + + #first we compile all the programs +# thread_UE = oaiThread(3, "UE_thread", UEMachine, user, password , task_UE_compile, False, timeout_thread) +# threads.append(thread_UE) +# thread_UE.start() + + + + + +# index_UEMachine = MachineList.index(UEMachine) +# oai_UE = openair('localdomain', UEMachine) +# oai_UE.connect(user, password) +# res = oai_UE.send_recv(cmd) +# res = oai_eNB.send_recv(cmd) + + + + # + # RUN LOOP + # ------------------------------------------------ + if testcase_verdict != 'PASS': # if something went wrong to not run test cases + max_ntries=0 + + runs_results = [] + nb_runs = 0 + nb_run_pass = 0 + nb_run_failed = 0 + nb_run_inc = 0 + nb_run_skip = 0 + + nb_seg_fault = 0 + + for run in range(0,max_ntries): + + if nruns == nb_run_pass + nb_run_failed: + break + + nb_runs += 1 + + # + # RUN initialization + # ---------------------------------------------------- + print (Fore.WHITE + indent + "> RUN_"+str(run).zfill(2)+" : " ), + + sys.stdout.flush() + + run_start_time=datetime.datetime.now() + + logdir_local_run = openairdir_local + '/cmake_targets/autotests/log/'+ testcasename + '/run_' + str(run) + logdir_eNB_run = logdirOAI5GRepo +'/cmake_targets/autotests/log/' + testcasename + '/run_' + str(run) + logdir_UE_run = logdirOAI5GRepo +'/cmake_targets/autotests/log/' + testcasename + '/run_' + str(run) + + cmd = 'rm -fr ' + logdir_eNB_run + ' ; mkdir -p ' + logdir_eNB_run + result = oai_eNB.send_recv(cmd) + cmd = 'rm -fr ' + logdir_UE_run + ' ; mkdir -p ' + logdir_UE_run + result = oai_UE.send_recv(cmd) + cmd = ' rm -fr ' + logdir_local_run + ' ; mkdir -p ' + logdir_local_run + result = os.system(cmd) + + + # + # RUN parametrization + # ---------------------------------------------------- + eNB_pre_exec = testcase.findtext('eNB_pre_exec',default='') + eNB_pre_exec_args = testcase.findtext('eNB_pre_exec_args',default='') + eNB_main_exec = testcase.findtext('eNB_main_exec',default='') + eNB_main_exec_args = testcase.findtext('eNB_main_exec_args',default='') + eNB_traffic_exec = testcase.findtext('eNB_traffic_exec',default='') + eNB_traffic_exec_args = testcase.findtext('eNB_traffic_exec_args',default='') + eNB_terminate_missing_procs = testcase.findtext('eNB_terminate_missing_procs',default='True') + + logfile_exec_eNB = logdir_eNB_run + '/eNB_exec' + '_' + str(run) + '_.log' + logfile_pre_exec_eNB = logdir_eNB_run + '/eNB_pre_exec' + '_' + str(run) + '_.log' + logfile_task_eNB_out = logdir_eNB_run + '/eNB_task_out' + '_' + str(run) + '_.log' + logfile_traffic_eNB = logdir_eNB_run + '/eNB_traffic' + '_' + str(run) + '_.log' + logfile_task_eNB = logdir_local_run + '/eNB_task' + '_' + str(run) + '_.log' + + task_eNB = ' ( uname -a ; date \n' + task_eNB = task_eNB + 'cd ' + logdirOAI5GRepo + ' ; source oaienv ; source cmake_targets/tools/build_helper \n' + task_eNB = task_eNB + 'env |grep OPENAIR \n' + 'array_exec_pid=() \n' + if eNB_pre_exec != "": + task_eNB = task_eNB + ' ( date; ' + eNB_pre_exec + ' '+ eNB_pre_exec_args + ' ) > ' + logfile_pre_exec_eNB + ' 2>&1 \n' + if eNB_main_exec != "": + task_eNB = task_eNB + ' ( date; ' + addsudo(eNB_main_exec + ' ' + eNB_main_exec_args, '') + ' ) > ' + logfile_exec_eNB + ' 2>&1 & \n' + task_eNB = task_eNB + 'array_exec_pid+=($!) \n' + task_eNB = task_eNB + 'echo eNB_main_exec PID = $! \n' + if eNB_traffic_exec != "": + cmd_traffic = eNB_traffic_exec + ' ' + eNB_traffic_exec_args + if cmd_traffic.find('-c') >= 0: + cmd_traffic = cmd_traffic + ' -t ' + str(timeout_cmd - 80) + task_eNB = task_eNB + ' (date; ' + cmd_traffic + ' ) > ' + logfile_traffic_eNB + ' 2>&1 & \n' + task_eNB = task_eNB + 'array_exec_pid+=($!) \n' + task_eNB = task_eNB + 'echo eNB_traffic_exec PID = $! \n' + #terminate the eNB test case after timeout_cmd seconds + task_eNB = task_eNB + finalize_deploy_script (timeout_cmd, eNB_terminate_missing_procs) + ' \n' + #task_eNB = task_eNB + 'sleep ' + str(timeout_cmd) + ' \n' + task_eNB = task_eNB + 'handle_ctrl_c' + '\n' + task_eNB = task_eNB + ' ) > ' + logfile_task_eNB_out + ' 2>&1 ' + write_file(logfile_task_eNB, task_eNB, mode="w") + + + UE_pre_exec = testcase.findtext('UE_pre_exec',default='') + UE_pre_exec_args = testcase.findtext('UE_pre_exec_args',default='') + UE_main_exec = testcase.findtext('UE_main_exec',default='') + UE_main_exec_args = testcase.findtext('UE_main_exec_args',default='') + UE_traffic_exec = testcase.findtext('UE_traffic_exec',default='') + UE_traffic_exec_args = testcase.findtext('UE_traffic_exec_args',default='') + UE_terminate_missing_procs = testcase.findtext('UE_terminate_missing_procs',default='True') + UE_search_expr_true = testcase.findtext('UE_search_expr_true','') + + logfile_exec_UE = logdir_UE_run + '/UE_exec' + '_' + str(run) + '_.log' + logfile_pre_exec_UE = logdir_UE_run + '/UE_pre_exec' + '_' + str(run) + '_.log' + logfile_task_UE_out = logdir_UE_run + '/UE_task_out' + '_' + str(run) + '_.log' + logfile_traffic_UE = logdir_UE_run + '/UE_traffic' + '_' + str(run) + '_.log' + logfile_task_UE = logdir_local_run + '/UE_task' + '_' + str(run) + '_.log' + + + task_UE = ' ( uname -a ; date \n' + task_UE = task_UE + 'array_exec_pid=()' + '\n' + task_UE = task_UE + 'cd ' + logdirOAI5GRepo + '\n' + task_UE = task_UE + 'source oaienv \n' + task_UE = task_UE + 'source cmake_targets/tools/build_helper \n' + task_UE = task_UE + 'env |grep OPENAIR \n' + if UE_pre_exec != "": + task_UE = task_UE + ' ( date; ' + UE_pre_exec + ' '+ UE_pre_exec_args + ' ) > ' + logfile_pre_exec_UE + ' 2>&1 \n' + if UE_main_exec != "": + task_UE = task_UE + ' ( date; ' + addsudo(UE_main_exec + ' ' + UE_main_exec_args, '') + ' ) > ' + logfile_exec_UE + ' 2>&1 & \n' + task_UE = task_UE + 'array_exec_pid+=($!) \n' + task_UE = task_UE + 'echo UE_main_exec PID = $! \n' + if UE_traffic_exec != "": + cmd_traffic = UE_traffic_exec + ' ' + UE_traffic_exec_args + if cmd_traffic.find('-c') >= 0: + cmd_traffic = cmd_traffic + ' -t ' + str(timeout_cmd - 60) + task_UE = task_UE + ' ( date; ' + cmd_traffic + ' ) >' + logfile_traffic_UE + ' 2>&1 & \n' + task_UE = task_UE + 'array_exec_pid+=($!) \n' + task_UE = task_UE + 'echo UE_traffic_exec PID = $! \n' + #terminate the UE test case after timeout_cmd seconds + task_UE = task_UE + finalize_deploy_script (timeout_cmd, UE_terminate_missing_procs) + ' \n' + #task_UE = task_UE + 'sleep ' + str(timeout_cmd) + ' \n' + task_UE = task_UE + 'handle_ctrl_c' + '\n' + task_UE = task_UE + ' ) > ' + logfile_task_UE_out + ' 2>&1 ' + write_file(logfile_task_UE, task_UE, mode="w") + #task_UE = 'echo \" ' + task_UE + '\" > ' + logfile_script_UE + ' 2>&1 ; ' + task_UE + + + + + + + + # + # RUN work + # ---------------------------------------------------- + thread_eNB = oaiThread(1, "eNB_thread", eNBMachine, user, password , task_eNB, False, timeout_thread) + thread_UE = oaiThread(2, "UE_thread", UEMachine, user, password , task_UE, False, timeout_thread) + threads=[] + threads.append(thread_eNB) + threads.append(thread_UE) + thread_eNB.start() + thread_UE.start() + for t in threads: + t.join() + + # + # + #----------------------------------------------------- + cleanOldProgramsAllMachines([oai_eNB, oai_UE] , oldprogramList, CleanUpAluLteBox, ExmimoRfStop, [logdir_eNB_run, logdir_UE_run], logdirOAI5GRepo) + + SSHSessionWrapper(eNBMachine, user, None, password, logdir_eNB_run, logdir_local_testcase, "get_all") + #print "Copying files from UEMachine : " + UEMachine + "logdir_UE = " + logdir_UE + SSHSessionWrapper(UEMachine, user, None, password, logdir_UE_run, logdir_local_testcase, "get_all") + + metric_checks_flag = 1 + + fname = logdir_local_run+ '/UE_exec' + '_' + str(run) + '_.log' + cell_synch_status = analyser.check_cell_synchro(fname) + if cell_synch_status == 'CELL_SYNCH': + print '!!!!!!!!!!!!!! Cell synchronized !!!!!!!!!!!' + else : + print '!!!!!!!!!!!!!! Cell NOT NOT synchronized !!!!!!!!!!!' + metric_checks_flag = 0 + + ue_seg_fault_status = analyser.check_exec_seg_fault(fname) + if ue_seg_fault_status == 'SEG_FAULT' : + nb_seg_fault += 1 + + # + # Check metrics + #---------------------------------------------------- + runs_metrics = [] + run_traffic = [] + + if metric_checks_flag : + verdict = 'PASS' + + # UE side metrics + metricList=testcase.findall('UE_metric') + for metric in metricList: + metric_def = {} + metric_def['id'] = metric.get('id') + metric_def['description'] = metric.get('description') + metric_def['regex'] = metric.get('regex') + metric_def['unit_of_meas'] = metric.get('unit_of_meas') + metric_def['pass_fail_stat']= metric.get('pass_fail_stat') + metric_min_lim = metric.get('min_limit') + if metric_min_lim: + metric_def['min_limit'] = float(metric_min_lim) + metric_max_lim = metric.get('max_limit') + if metric_max_lim: + metric_def['max_limit'] = float(metric_max_lim) + + fname = logdir_local_run+ '/UE_exec' + '_' + str(run) + '_.log' + + args = {'metric' : metric_def, + 'file' : fname } + + metric_extracted = analyser.do_extract_metrics(args) + + print "\t > Metric "+metric_def['id']+" :" + print "\t\t> min = "+ str( metric_extracted['metric_min'] ) + print "\t\t> min_index = "+ str( metric_extracted['metric_min_index'] ) + print "\t\t> max = "+ str( metric_extracted['metric_max'] ) + print "\t\t> max_index = "+ str( metric_extracted['metric_max_index'] ) + print "\t\t> mean = "+ str( metric_extracted['metric_mean'] ) + print "\t\t> median = "+ str( metric_extracted['metric_median'] ) + + verdict = analyser.do_check_verdict(metric_def, metric_extracted) + + metric_fig = logdir_local_run+ '/UE_metric_'+ metric_def['id']+'_' + str(run) + '_.png' + analyser.do_img_metrics(metric_def, metric_extracted, metric_fig) + + + metric_fig_report = '../log/'+ testcasename + '/run_' + str(run) + '/UE_metric_'+ metric_def['id']+'_' + str(run) + '_.png' + + run_metrics = dict( metric_id = metric_def['id'], + metric_desc = metric_def['description'], + metric_uom = metric_def['unit_of_meas'], + metric_min = metric_extracted['metric_min'], + metric_min_index= metric_extracted['metric_min_index'], + metric_max = metric_extracted['metric_max'], + metric_max_index= metric_extracted['metric_max_index'], + metric_mean = metric_extracted['metric_mean'], + metric_median = metric_extracted['metric_median'], + metric_fig = metric_fig_report) + + if metric_def['pass_fail_stat'] : + run_metrics['pass_fail_stat'] = metric_def['pass_fail_stat'] + if metric_min_lim : + run_metrics['pass_fail_min_limit'] = metric_def['min_limit'] + if metric_max_lim : + run_metrics['pass_fail_max_limit'] = metric_def['max_limit'] + + runs_metrics.append(run_metrics) + + # Traffic analysis + if UE_traffic_exec != "": + + fname = logdir_local_run+ '/UE_traffic' + '_' + str(run) + '_.log' + args = {'file' : fname } + traffic_metrics = analyser.do_extract_traffic_metrics(args) + traffic_fig = logdir_local_run+ '/UE_traffic'+'_' + str(run) + '_.png' + analyser.do_img_traffic(traffic_metrics, traffic_fig) + + traffic_fig_report= '../log/'+ testcasename + '/run_' + str(run) + '/UE_traffic'+'_' + str(run) + '_.png' + + dur_pass_fail_crit = 'none' + if traffic_metrics['traffic_count'] == 0 : + verdict = 'FAIL' + elif UE_search_expr_true != "": + traffic_duration_limit = float(UE_search_expr_true) + dur_pass_fail_crit = str(traffic_duration_limit) + # print 'traffic_duration_limit = '+str(traffic_duration_limit) + # print 'traffic_metrics[interval_stop_max] = '+str(traffic_metrics['interval_stop_max']) + if traffic_metrics['interval_stop_max'] < traffic_duration_limit : + verdict = 'FAIL' + + + run_traffic = dict( traffic_count = traffic_metrics['traffic_count'], + bw_min = traffic_metrics['bw_min'], + bw_max = traffic_metrics['bw_max'], + bw_mean = traffic_metrics['bw_mean'], + bw_median = traffic_metrics['bw_median'], + jitter_min = traffic_metrics['jitter_min'], + jitter_max = traffic_metrics['jitter_max'], + jitter_mean = traffic_metrics['jitter_mean'], + jitter_median = traffic_metrics['jitter_median'], + rl_min = traffic_metrics['rl_min'], + rl_max = traffic_metrics['rl_max'], + rl_mean = traffic_metrics['rl_mean'], + rl_median = traffic_metrics['rl_median'], + iperf_duration = traffic_metrics['interval_stop_max'], + dur_pass_fail_crit = dur_pass_fail_crit, + traffic_fig = traffic_fig_report ) + else: + run_traffic = dict( traffic_count = 0) + + else : + verdict = 'SKIP' + + + + # + # RUN verdict and finalization + # ---------------------------------------------------- + run_stop_time=datetime.datetime.now() + run_duration = run_stop_time-run_start_time +# print (Fore.WHITE + ("duration=" :"), + print (Fore.WHITE + indent + "> RUN duration : "+ str(run_duration) +"s" ) + + print (Fore.WHITE + indent + "> RUN verdict :"), + + if verdict == 'PASS': + nb_run_pass += 1 + print ( Fore.GREEN + verdict) + elif verdict == 'FAIL': + nb_run_failed += 1 + testcase_verdict = 'FAIL' + print ( Fore.RED + verdict) + elif verdict == 'SKIP': + nb_run_skip += 1 + print ( Fore.YELLOW + verdict) + else: + nb_run_inc += 1 + if testcase_verdict == 'PASS' : testcase_verdict = 'INCON' + print (Fore.YELLOW+'INCONCLUSIVE') + + run_results = dict( run_id=str(run), + run_start_time = run_start_time, + run_stop_time = run_stop_time , + run_verdict = verdict, + ue_seg_fault_status = ue_seg_fault_status, + run_duration = run_duration, + runs_metrics = runs_metrics, + run_traffic = run_traffic) + runs_results.append(run_results) + + # END RUN LOOP + #---------------------------------------------------- + + # Test case duration + # ---------------------------------- + testcase_time_stop = datetime.datetime.now() + print(Fore.WHITE + indent + "> testcase time stop : " + str(testcase_time_start) ), + print " -> TestCase duration = "+str(testcase_time_stop - testcase_time_start) + + # Save remote log files + # ----------------------------------- + #Now we change the permissions of the logfiles to avoid some of them being with root permissions + cmd = 'sudo -E chown -R ' + user + ' ' + logdir_eNB_testcase + res= oai_eNB.send_recv(cmd) + cmd = 'sudo -E chown -R ' + user + ' ' + logdir_UE_testcase + res= oai_UE.send_recv(cmd) + + # Save remote log files on MTC + #print "Copying files from eNBMachine " + eNBMachine + "logdir_eNB = " + logdir_eNB + SSHSessionWrapper(eNBMachine, user, None, password, logdir_eNB_testcase, openairdir_local + '/cmake_targets/autotests/log/', "get_all") + #print "Copying files from UEMachine : " + UEMachine + "logdir_UE = " + logdir_UE + SSHSessionWrapper(UEMachine, user, None, password, logdir_UE_testcase, openairdir_local + '/cmake_targets/autotests/log/', "get_all") + + oai_eNB.disconnect() + oai_UE.disconnect() + + # Set test case final verdict + # ----------------------------------- + test_result_string = 'do be completed' + + if testcase_verdict == 'PASS': + if nb_run_pass == 0 : + testcase_verdict = 'INCON' + + print(Fore.WHITE + indent + "> testcase final verdict :"), + if testcase_verdict == 'PASS': + print ( Fore.GREEN + testcase_verdict) + elif testcase_verdict == 'FAIL': + print ( Fore.RED + testcase_verdict) + else: + print (Fore.YELLOW+'INCONCLUSIVE') + + duration= testcase_time_stop - testcase_time_start + xmlFile = logdir_local_testcase + '/test.' + testcasename + '.xml' + xml="\n \n" + write_file(xmlFile, xml, mode="w") + + + test_result = dict(testcase_name=testcasename, + testcaseclass=testcaseclass, + testcase_verdict = testcase_verdict, + testcase_time_start=testcase_time_start, + testcase_time_stop=testcase_time_stop, + tags=tags, + nruns=nb_runs, + nb_run_pass = nb_run_pass, + nb_run_skip = nb_run_skip, + nb_run_failed = nb_run_failed, + nb_run_inc=nb_run_inc, + nb_seg_fault = nb_seg_fault, + testcase_timeout=timeout_cmd, + testcase_duration = duration, + testcase_eNBMachine =eNBMachine, + testcase_UEMachine =UEMachine, + runs_results = runs_results) + test_results.append(test_result) + + return testcase_verdict + + + +# mypassword='' +# #addsudo = 'echo \'' + mypassword + '\' | sudo -S -E ' +# addpass = 'echo \'' + mypassword + '\' | ' +# #user = getpass.getuser() + + + + + + + +# eNB_traffic_exec = testcase.findtext('eNB_traffic_exec',default='') +# eNB_traffic_exec_args = testcase.findtext('eNB_traffic_exec_args',default='') +# eNB_terminate_missing_procs = testcase.findtext('eNB_terminate_missing_procs',default='True') +# eNB_search_expr_true = testcase.findtext('eNB_search_expr_true','') +# if re.compile('\w+').match(eNB_search_expr_true) != None: +# eNB_search_expr_true = eNB_search_expr_true + ' duration=' + str(timeout_cmd-90) + 's' + + + +# UE_traffic_exec = testcase.findtext('UE_traffic_exec',default='') +# UE_traffic_exec_args = testcase.findtext('UE_traffic_exec_args',default='') +# +# UE_search_expr_true = testcase.findtext('UE_search_expr_true','') +# UE_stop_script = testcase.findtext('UE_stop_script','') +# if re.compile('\w+').match(UE_search_expr_true) != None: +# UE_search_expr_true = UE_search_expr_true + ' duration=' + str(timeout_cmd-90) + 's' + + + +# #cleanOldPrograms(oai_eNB, oldprogramList, CleanUpAluLteBox, ExmimoRfStop) +# #cleanOldPrograms(oai_UE, oldprogramList, CleanUpAluLteBox, ExmimoRfStop) +# #cleanOldPrograms(oai_EPC, oldprogramList, CleanUpAluLteBox, ExmimoRfStop) +# logdir_local = os.environ.get('OPENAIR_DIR') +# if logdir_local is None: +# print "Environment variable OPENAIR_DIR not set correctly" +# sys.exit() + + +# print "Updating the config files for ENB/UE/EPC..." +# #updating the eNB/UE/EPC configuration file from the test case +# #update_config_file(oai_eNB, eNB_config_file, logdirOAI5GRepo) +# #update_config_file(oai_UE, UE_config_file, logdirOAI5GRepo) +# #update_config_file(oai_EPC, EPC_config_file, logdirOpenaircnRepo) + +# test_result=1 +# test_result_string='' +# start_time=time.time() + +# for run in range(0,nruns): +# run_result=1 +# run_result_string='' +# logdir_eNB = logdirOAI5GRepo+'/cmake_targets/autotests/log/'+ testcasename + '/run_' + str(run) +# logdir_UE = logdirOAI5GRepo+'/cmake_targets/autotests/log/'+ testcasename + + + + + +# logfile_traffic_eNB = logdir_eNB + '/eNB_traffic' + '_' + str(run) + '_.log' + + +# logfile_local_traffic_eNB_out = logdir_local_testcase + '/eNB_traffic' + '_' + str(run) + '_.log' +# logfile_tshark_eNB = logdir_eNB + '/eNB_tshark' + '_' + str(run) + '_.log' +# logfile_pcap_eNB = logdir_eNB + '/eNB_tshark' + '_' + str(run) + '_.pcap' +# logfile_pcap_zip_eNB = logdir_eNB + '/eNB_tshark' + '_' + str(run) + '_.pcap.zip' +# logfile_pcap_tmp_eNB = '/tmp/' + '/eNB_tshark' + '_' + str(run) + '_.pcap' + +# task_eNB_compile = ' ( uname -a ; date \n' +# task_eNB_compile = task_eNB_compile + 'cd ' + logdirOAI5GRepo + ' ; source oaienv ; source cmake_targets/tools/build_helper \n' +# task_eNB_compile = task_eNB_compile + 'env |grep OPENAIR \n' +# task_eNB_compile = task_eNB_compile + update_config_file(oai_eNB, eNB_config_file, logdirOAI5GRepo, '$OPENAIR_DIR/cmake_targets/autotests/tools/search_repl.py') + '\n' +# if eNB_compile_prog != "": +# task_eNB_compile = task_eNB_compile + ' ( ' + eNB_compile_prog + ' '+ eNB_compile_prog_args + ' ) > ' + logfile_compile_eNB + ' 2>&1 \n' +# task_eNB_compile = task_eNB_compile + ' date ) > ' + logfile_task_eNB_compile_out + ' 2>&1 ' +# write_file(logfile_task_eNB_compile, task_eNB_compile, mode="w") + + + +# #task_eNB = 'echo \" ' + task_eNB + '\" > ' + logfile_script_eNB + ' 2>&1 ; ' + task_eNB +# logfile_compile_UE = logdir_UE + '/UE_compile' + '_' + str(run) + '_.log' +# logfile_exec_UE = logdir_UE + '/UE_exec' + '_' + str(run) + '_.log' + + + + +# #Now we execute all the threads + + +# #Now we get the log files from remote machines on the local machine +# cleanOldProgramsAllMachines([oai_eNB, oai_UE] , oldprogramList, CleanUpAluLteBox, ExmimoRfStop, [logdir_eNB, logdir_UE, logdir_EPC], logdirOAI5GRepo) + +# logfile_UE_stop_script_out = logdir_UE + '/UE_stop_script_out' + '_' + str(run) + '_.log' +# logfile_UE_stop_script = logdir_local_testcase + '/UE_stop_script' + '_' + str(run) + '_.log' + +# if UE_stop_script != "": +# cmd = ' ( uname -a ; date \n' +# cmd = cmd + 'cd ' + logdirOAI5GRepo + ' ; source oaienv ; source cmake_targets/tools/build_helper \n' +# cmd = cmd + 'env |grep OPENAIR \n' + 'array_exec_pid=() \n' +# cmd = cmd + UE_stop_script + '\n' +# cmd = cmd + ') > ' + logfile_UE_stop_script_out + ' 2>&1 ' +# write_file(logfile_UE_stop_script , cmd, mode="w") +# # thread_UE = oaiThread(4, "UE_thread", UEMachine, user, password , cmd, False, timeout_thread) +# # thread_UE.start() +# # thread_UE.join() + + + + +# #Currently we only perform throughput tests +# tput_run_string='' +# result, tput_string = tput_test_search_expr(eNB_search_expr_true, logfile_local_traffic_eNB_out) +# tput_run_string = tput_run_string + tput_string +# run_result=run_result&result +# result, tput_string = tput_test_search_expr(EPC_search_expr_true, logfile_local_traffic_EPC_out) +# run_result=run_result&result +# tput_run_string = tput_run_string + tput_string +# result, tput_string = tput_test_search_expr(UE_search_expr_true, logfile_local_traffic_UE_out) +# run_result=run_result&result +# tput_run_string = tput_run_string + tput_string + +# if run_result == 1: +# run_result_string = ' RUN_'+str(run) + ' = PASS' +# else: +# run_result_string = ' RUN_'+str(run) + ' = FAIL' + +# #If there is assertion, we mark the test case as failure as most likely eNB crashed +# cmd = "grep -ilr \"assertion\" " + logdir_local_testcase + " | cat " +# cmd_out = subprocess.check_output ([cmd], shell=True) +# if len(cmd_out) !=0 : +# run_result=0 +# run_result_string = ' RUN_'+str(run) + ' = FAIL(Assert)' + +# #If there is thread busy error, we mark the test case as failure as most likely eNB crashed +# cmd = "grep -ilr \"thread busy\" " + logdir_local_testcase + " | cat " +# cmd_out = subprocess.check_output ([cmd], shell=True) +# if len(cmd_out) !=0: +# run_result=0 +# run_result_string = ' RUN_'+str(run) + ' = FAIL(Thread_Busy)' + +# run_result_string = run_result_string + tput_run_string + +# test_result=test_result & run_result +# test_result_string=test_result_string + run_result_string + + + + + + + + + +# \brief This function searches if test case is present in list of test cases that need to be executed by user +# \param testcasename the test case to search for +# \param testcasegroup list that is passed from the arguments +# \param test_case_exclude list of test cases excluded from execution (specified in test_case_list.xml) +def search_test_case_group(testcasename, testcasegroup, test_case_exclude): + + if test_case_exclude != "": + testcase_exclusion_list=test_case_exclude.split() + for entry in testcase_exclusion_list: + if entry.find('+') >=0: + match = re.search(entry, testcasename) + if match: + #print "\nSkipping test case as it is found in black list: " + testcasename + return False + else: + match = entry.find(testcasename) + if match >=0: + #print "\nSkipping test case as it is found in black list: " + testcasename + return False + if testcasegroup == '': + return True + else: + testcaselist = testcasegroup.split() + for entry in testcaselist: + if entry.find('+') >=0: + match = re.search(entry, testcasename) + if match: + return True + else: + match = testcasename.find(entry) + if match >=0: + return True + return False + +# \brief thread that cleans up remote machines from pre-existing test case executions +# \param threadID number of thread (for book keeping) +# \param threadname name of thread (for book keeping) +# \param oai handler that can be used to execute programs on remote machines +# \param CleanUpOldProgs list of programs which must be terminated before running a test case (specified in test_case_list.xml) +# \param CleanupAluLteBox string that contains commands to stop ALU Bell Labs LTEBox (specified in test_case_list.xml) +# \param ExmimoRfStop command to stop EXMIMO Card +class oaiCleanOldProgramThread (threading.Thread): + def __init__(self, threadID, threadname, oai, CleanUpOldProgs, CleanUpAluLteBox, ExmimoRfStop, logdir, logdirOAI5GRepo): + threading.Thread.__init__(self) + self.threadID = threadID + self.threadname = threadname + self.oai = oai + self.CleanUpOldProgs = CleanUpOldProgs + self.CleanUpAluLteBox = CleanUpAluLteBox + self.ExmimoRfStop = ExmimoRfStop + self.logdir = logdir + self.logdirOAI5GRepo = logdirOAI5GRepo + def run(self): + try: + cleanOldPrograms(self.oai, self.CleanUpOldProgs, self.CleanUpAluLteBox, self.ExmimoRfStop, self.logdir, self.logdirOAI5GRepo) + except Exception, e: + error='' + error = error + ' In class oaiCleanOldProgramThread, function: ' + sys._getframe().f_code.co_name + ': *** Caught exception: ' + str(e.__class__) + " : " + str( e) + error = error + '\n threadID = ' + str(self.threadID) + '\n threadname = ' + self.threadname + '\n CleanUpOldProgs = ' + self.CleanUpOldProgs + '\n CleanUpAluLteBox = ' + self.CleanUpAluLteBox + '\n ExmimoRfStop = ' + self.ExmimoRfStop + '\n' + error = error + traceback.format_exc() + print error + print "There is error in cleaning up old programs....." + #sys.exit(1) + +# \brief Run parallel threads in all machines for clean up old execution of test cases +# \param oai_list list of handlers that can be used to execute programs on remote machines +# \param CleanUpOldProgs list of programs which must be terminated before running a test case (specified in test_case_list.xml) +# \param CleanupAluLteBox string that contains commands to stop ALU Bell Labs LTEBox (specified in test_case_list.xml) +# \param ExmimoRfStop command to stop EXMIMO Card +def cleanOldProgramsAllMachines(oai_list, CleanOldProgs, CleanUpAluLteBox, ExmimoRfStop, logdir_list, logdirOAI5GRepo): + threadId=0 + threadList=[] + index=0 + if len(oai_list)!=len(logdir_list) : + logdir_list=[logdir[0]]*len(oai_list) + + for oai in oai_list: + threadName="cleanup_thread_"+str(threadId) + thread=oaiCleanOldProgramThread(threadId, threadName, oai, CleanUpOldProgs, CleanUpAluLteBox, ExmimoRfStop, logdir_list[index],logdirOAI5GRepo) + threadList.append(thread) + thread.start() + threadId = threadId + 1 + index = index+1 + for t in threadList: + t.join() + + +debug = 0 +pw ='' +i = 0 +dlsim=0 +localshell=0 +GitOAI5GRepo='' +GitOAI5GRepoBranch='' +GitOAI5GHeadVersion='' +user='' +pw='' +testcasegroup='' +NFSResultsShare='' +cleanUpRemoteMachines=False +openairdir_local = os.environ.get('OPENAIR_DIR') +if openairdir_local is None: + print "Environment variable OPENAIR_DIR not set correctly" + sys.exit() +locallogdir = openairdir_local + '/cmake_targets/autotests/log' +reportdir = openairdir_local + '/cmake_targets/autotests/report' +MachineList = '' +MachineListGeneric='' +MachineDescDic={} +flag_remove_logdir=False +flag_start_testcase=False +nruns_lte_softmodem='' +flag_skip_git_head_check=False +flag_skip_oai_install=False +flag_skip_machine_preparation=False +flag_skip_sanity_check=False +Timeout_cmd='' +xmlInputFile=os.environ.get('OPENAIR_DIR')+"/cmake_targets/autotests/testsuite_ue_noS1.xml" + +#print "Number of arguments argc = " + str(len(sys.argv)) +#for index in range(1,len(sys.argv) ): +# print "argv_" + str(index) + " : " + sys.argv[index] + +oai_list = [] + + +i=1 +while i < len (sys.argv): + arg=sys.argv[i] + if arg == '-r': + flag_remove_logdir=True + elif arg == '-s' : + flag_start_testcase=True + elif arg == '-g' : + testcasegroup = sys.argv[i+1].replace("\"","") + i = i +1 + elif arg == '-c': + cleanUpRemoteMachines=True + elif arg == '-5GRepo': + GitOAI5GRepo = sys.argv[i+1] + i = i +1 + elif arg == '-5GRepoBranch': + GitOAI5GRepoBranch = sys.argv[i+1] + i = i +1 + elif arg == '-5GRepoHeadVersion': + GitOAI5GHeadVersion = sys.argv[i+1] + #We now find the branch that corresponds to this Git Head Commit + cmd = "git show-ref --head " + " | grep " + GitOAI5GHeadVersion + cmd_out = subprocess.check_output ([cmd], shell=True) + cmd_out=cmd_out.replace("\n","") + cmd_out = cmd_out.split('/') + GitOAI5GRepoBranch = cmd_out[-1] + if GitOAI5GRepoBranch == '': + print "Error extracting GitBranch from head commit. Exiting now..." + sys.exit(1) + i = i +1 + elif arg == '-u': + user = sys.argv[i+1] + i = i +1 + elif arg == '-p': + pw = sys.argv[i+1] + i = i +1 + elif arg == '-n': + NFSResultsShare = sys.argv[i+1] + i = i +1 + elif arg == '--nrun_lte_softmodem': + nruns_lte_softmodem = sys.argv[i+1] + i = i +1 + elif arg == '-MachineList': + MachineList = sys.argv[i+1] + MachineList = MachineList.replace("\"","") + MachineList = MachineList.replace("\'","") + i = i +1 + elif arg == '-MachineListGeneric': + MachineListGeneric = sys.argv[i+1] + MachineListGeneric = MachineListGeneric.replace("\"","") + MachineListGeneric = MachineListGeneric.replace("\'","") + i = i +1 + elif arg == '--skip-git-head-check': + flag_skip_git_head_check=True + elif arg == '--timeout_cmd': + Timeout_cmd = sys.argv[i+1] + i = i +1 + elif arg == '--skip-oai-install': + flag_skip_oai_install=True + elif arg == '--skip-machine-preparation': + flag_skip_machine_preparation=True + elif arg == '--skip-sanity-check': + flag_skip_sanity_check=True + elif arg == '-h' : + print "-s: This flag *MUST* be set to start the test cases" + print "-r: Remove the log directory in autotests" + print "-g: Run test cases in a group" + print "-c: Run cleanup scripts on remote machines and exit" + print "-5GRepo: Repository for OAI 5G to use to run tests (overrides GitOAI5GRepo in test_case_list.xml)" + print "-5GRepoBranch: Branch for OAI 5G Repository to run tests (overrides the branch in test_case_list.xml)" + print "-5GRepoHeadVersion: Head commit on which to run tests (overrides the branch in test_case_list.xml)" + print "-u: use the user name passed as argument" + print "-p: use the password passed as an argument" + print "-n: Set the NFS share passed as an argument" + print "--nrun_lte_softmodem: Set the number of runs for lte-softmodem test case class" + print "-MachineList : overrides the MachineList parameter in test_case_list.xml" + print "-MachineListGeneric : overrides the MachineListGeneric parameter in test_case_list.xml" + print "--skip-git-head-check: skip checking of GitHead remote/local branch (only for debugging)" + print "--timeout_cmd: Override the default parameter (timeout_cmd) in test_case_list.xml. This parameter is in seconds and should be > 120" + print "--skip-oai-install: Skips the openairinterface5g installer" + print "--skip-machine-preparation: skipp the whole system preparation -> direct to test cases" + print "--skip-sanity-check: skipp the machine sanity checks" + sys.exit() + else : + print "Unrecongnized Option: <" + arg + ">. Use -h to see valid options" + sys.exit() + i= i + 1 + +logdir = '/tmp/' + 'OAITestFrameWork-' + user + '/' +logdirOAI5GRepo = logdir + 'openairinterface5g/' +logdirOpenaircnRepo = logdir + 'openair-cn/' +patchdir = logdirOAI5GRepo + 'cmake_targets/autotests/patches/' +NFSResultsDir = '/mnt/sradio' +cleanupOldProgramsScript = '$OPENAIR_DIR/cmake_targets/autotests/tools/remove_old_programs.bash' + +#Now we parse the xml file for basic configuration +xmlTree = ET.parse(xmlInputFile) +xmlRoot = xmlTree.getroot() + +# +# Read test session configuration +# --------------------------------------------------------------------------------- +print (Fore.YELLOW + '\nStep 0.1 - Read test session configuration') +print (Fore.YELLOW + '-------------------------------------------------') + +test_session_start_time = datetime.datetime.now() +print (Fore.WHITE + ' - start time : '+ str(test_session_start_time)) + +host = os.uname()[1] +print (Fore.WHITE + ' - MTC host : '+host) + + +if user=='': + user = getpass.getuser() +print (Fore.WHITE + ' - user : '+user) + +if pw=='': + pw = getpass.getpass() +print (Fore.WHITE + ' - password : '+pw) + +print (Fore.WHITE + ' - cmd line flags : ') +print (Fore.WHITE + ' + -s : '+str(flag_start_testcase)) +print (Fore.WHITE + ' + -r : '+str(flag_remove_logdir)) +print (Fore.WHITE + ' + -c : '+str(cleanUpRemoteMachines)) +print (Fore.WHITE + ' + --skip-git-head-check : '+str(flag_skip_git_head_check)) +print (Fore.WHITE + ' + --skip-oai-install : '+str(flag_skip_oai_install)) +print (Fore.WHITE + ' + --skip-machine-preparation : '+str(flag_skip_machine_preparation)) +print (Fore.WHITE + ' + --skip-sanity-check : '+str(flag_skip_sanity_check)) + + +print (Fore.WHITE + ' - Test setup basic config : (* -> overwrite by cmd line parameter)') +print (Fore.WHITE + ' + test setup config file : '+str(xmlInputFile)) +print (Fore.WHITE + ' + remote setup dir : '+str(logdir)) +print (Fore.WHITE + ' + remote OAI5G repo : '+str(logdirOAI5GRepo)) +print (Fore.WHITE + ' + remote OpenAirCN repo : '+str(logdirOpenaircnRepo)) + + +if MachineList =='': + MachineList = xmlRoot.findtext('MachineList',default='') +NFSResultsShare = xmlRoot.findtext('NFSResultsShare',default='') +GitOpenaircnRepo = xmlRoot.findtext('GitOpenair-cnRepo',default='') + +if GitOAI5GRepo == '': + GitOAI5GRepo = xmlRoot.findtext('GitOAI5GRepo',default='') + +if GitOAI5GRepoBranch == '': + GitOAI5GRepoBranch = xmlRoot.findtext('GitOAI5GRepoBranch',default='') +if GitOAI5GHeadVersion == '': + GitOAI5GHeadVersion = xmlRoot.findtext('GitOAI5GHeadVersion',default='') + +GitOpenaircnRepoBranch = xmlRoot.findtext('GitOpenair-cnRepoBranch',default='') +CleanUpOldProgs = xmlRoot.findtext('CleanUpOldProgs',default='') +CleanUpAluLteBox = xmlRoot.findtext('CleanUpAluLteBox',default='') +Timeout_execution = int (xmlRoot.findtext('Timeout_execution')) +if MachineListGeneric == '': + MachineListGeneric = xmlRoot.findtext('MachineListGeneric',default='') +TestCaseExclusionList = xmlRoot.findtext('TestCaseExclusionList',default='') +ExmimoRfStop = xmlRoot.findtext('ExmimoRfStop',default='') +if nruns_lte_softmodem == '': + nruns_lte_softmodem = xmlRoot.findtext('nruns_lte-softmodem',default='') + +print (Fore.WHITE + ' + MachineList : '+ MachineList) +print (Fore.WHITE + ' + GitOpenair-cnRepo : '+ GitOpenaircnRepo) +print (Fore.WHITE + ' + GitOAI5GRepo : '+ GitOAI5GRepo) +print (Fore.WHITE + ' + GitOAI5GBranch : '+ GitOAI5GRepoBranch) +print (Fore.WHITE + ' + GitOpenaircnRepoBranch : '+ GitOpenaircnRepoBranch) +print (Fore.WHITE + ' + NFSResultsShare : '+ NFSResultsShare) +print (Fore.WHITE + ' + nruns_lte_softmodem : '+ nruns_lte_softmodem) +print (Fore.WHITE + ' + Timeout_cmd : '+ Timeout_cmd) + + +if GitOAI5GHeadVersion == '': + cmd = "git log --pretty=format:\'%H\' -n 1 origin/"+ GitOAI5GRepoBranch +# cmd = "git show-ref --heads -s "+ GitOAI5GRepoBranch + GitOAI5GHeadVersion = subprocess.check_output ([cmd], shell=True) + GitOAI5GHeadVersion=GitOAI5GHeadVersion.replace("\n","") + + # Print commiter and date : git log -1 --pretty=format:"%an %ad" + +print (Fore.WHITE + ' + GitOAI5GHeadVersion : '+ GitOAI5GHeadVersion) +#print "CleanUpOldProgs = " + CleanUpOldProgs +print (Fore.WHITE + ' + Timeout_execution (s) : '+ str(Timeout_execution)) + +if GitOAI5GHeadVersion == '': + print "Error getting the OAI5GBranch Head version...Exiting" + sys.exit() + +NFSTestsResultsDir = NFSResultsShare + '/'+ GitOAI5GRepoBranch + '/' + GitOAI5GHeadVersion + +#print "NFSTestsResultsDir = " + NFSTestsResultsDir + +OAI5GpatchFileList=xmlRoot.findall('OAI5GPatchFile') + + + +MachineList = MachineList.split() +MachineListGeneric = MachineListGeneric.split() + + +MachineDescDic + + +# +# 'Check Mater Test Controller sanity (MTC)' +# --------------------------------------------------------------------------------- +print (Fore.YELLOW + '\nStep 0.2 - Check Mater Test Controller sanity (MTC)') +print (Fore.YELLOW + '-------------------------------------------------') + +try: + print (Fore.WHITE + ' - check OpenAirInterface environment variable OPENAIR1_DIR... '), + os.environ["OPENAIR1_DIR"] +except KeyError: + print (Fore.RED + 'FAILED') + print "Please set the environment variable OPENAIR1_DIR in the .bashrc or run 'source oaienv' " + exit_prog(1) +print (Fore.GREEN + 'OK') + +try: + print (Fore.WHITE + ' - check OpenAirInterface environment variable OPENAIR2_DIR... '), + os.environ["OPENAIR2_DIR"] +except KeyError: + print (Fore.RED + 'FAILED') + print "Please set the environment variable OPENAIR2_DIR in the .bashrc or run 'source oaienv' " + exit_prog(1) +print (Fore.GREEN + 'OK') + +try: + os.environ["OPENAIR_TARGETS"] +except KeyError: + print "Please set the environment variable OPENAIR_TARGETS in the .bashrc or run 'source oaienv' " + sexit_prog(1) + +print (Fore.WHITE + ' - kill zombie ssh sessions from earlier sessions... '), +cmd='ps aux |grep \"/usr/bin/ssh -q -l ' + user + '\"| tr -s \" \" :| cut -f 2 -d :| xargs kill -9 ' +os.system(cmd) +print (Fore.GREEN + 'DONE') + +if flag_start_testcase == False: + print "You need to start the testcase by passing option -s. Use -h to see all options. Aborting now..." + exit_prog(1) + + +#print "Killing zombie ssh sessions from earlier sessions..." +#cmd='ps aux |grep \"/usr/bin/ssh -q -l guptar\"|tr -s \" \" :|cut -f 2 -d :|xargs kill -9 ' +#cmd = cmd + '; ps aux |grep \"/usr/bin/ssh -q -l ' + user + '\"| tr -s \" \" :| cut -f 2 -d :| xargs kill -9 ' +#os.system(cmd) +#print cmd + +try: + analyser = __import__("lib_autotest_analyser") +except ImportError as err: + print('Import error: ' + str(err)) + exit(0) + +if flag_remove_logdir == True: + print "Removing directory: " + locallogdir + os.system(' rm -fr ' + locallogdir + '; mkdir -p ' + locallogdir ) + +if not os.path.exists(locallogdir): + os.system('mkdir -p ' + locallogdir ) + + +paramiko_logfile = os.path.expandvars('$OPENAIR_DIR/cmake_targets/autotests/log/paramiko.log') +res=os.system(' echo > ' + paramiko_logfile) +paramiko.util.log_to_file(paramiko_logfile) + + +# +# 'REMOTE MACHINE SANITY CHEKS' +# --------------------------------------------------------------------------------- +print (Fore.YELLOW + '\nStep 0.3 - REMOTE MACHINE SANITY CHEKS') +print (Fore.YELLOW + '-------------------------------------------------') + + +for machine in MachineList: + oai_list.append( openair('localdomain',machine)) + MachineDescDic[machine]={} + + +if not flag_skip_sanity_check: + + if localshell == 0: + try: + index=0 + for machine in MachineList: + print (Fore.WHITE + " - Check sanity for remote machine "+machine) + + oai_list[index].connect(user,pw) + print (Fore.WHITE + " > Checking for sudo permissions for user "+user+ " : "), + result = oai_list[index].send_expect_false('sudo -S -v','may not run sudo',True) + if (result == 'OK'): + print (Fore.GREEN + result ) + else: + print (Fore.RED + result ) + + print (Fore.WHITE + " > Cleaning Older running programs : "), + cleanOldPrograms(oai_list[index], CleanUpOldProgs, CleanUpAluLteBox, ExmimoRfStop, '$HOME', '/tmp') + print (Fore.WHITE + " Done") + + #result = oai_list[index].send('mount ' + NFSResultsDir, True) + #print "Mounting NFS Share " + NFSResultsDir + "..." + result + + # Check if NFS share is mounted correctly. + #print 'Checking if NFS Share<' + NFSResultsDir + '> is mounted correctly...' + #cmd = 'if grep -qs '+NFSResultsDir+ ' /proc/mounts; then echo \'' + NFSResultsDir + ' is mounted\' ; fi' + #search_expr = NFSResultsDir + ' is mounted' + #print "cmd = " + cmd + #print "search_expr = " + search_expr + #result = oai_list[index].send_expect(cmd, search_expr) + #print "Mount NFS_Results_Dir..." + result + index = index + 1 + + #oai.connect2(user,pw) + #oai.get_shell() + except : + print 'Fail to connect to the machine: '+ machine + sys.exit(1) + else: + pw = '' + oai_list[0].connect_localshell() +else: + print (Fore.RED + " Skipping Machine sanity check...") + + +# +# 'REMOTE MACHINE TEST SETUP CONFIGURATION' +# --------------------------------------------------------------------------------- +print (Fore.YELLOW + '\nStep 0.4 - REMOTE MACHINE PREPARATION') +print (Fore.YELLOW + '-------------------------------------------------') + +if not flag_skip_machine_preparation: + index=0 + threads_init_setup=[] + for oai in oai_list: + try: + print "setting up machine: " + MachineList[index] + #print oai_list[oai].send_recv('echo \''+pw+'\' |sudo -S -v') + #print oai_list[oai].send_recv('sudo su') + #print oai_list[oai].send_recv('who am i') + #cleanUpPrograms(oai_list[oai] + cmd = 'sudo -S -E rm -fr ' + logdir + ' ; mkdir -p ' + logdir + result = oai.send_recv(cmd) + print cmd + + setuplogfile = logdir + '/setup_log_' + MachineList[index] + '_.txt' + setup_script = locallogdir + '/setup_script_' + MachineList[index] + '_.txt' + cmd = ' ( \n' + #cmd = cmd + 'rm -fR ' + logdir + '\n' + #cmd = cmd + 'mkdir -p ' + logdir + '\n' + cmd = cmd + 'cd '+ logdir + '\n' + cmd = cmd + 'git config --global http.sslVerify false \n' + cmd = cmd + 'git clone '+ GitOAI5GRepo +' \n' + cmd = cmd + 'git clone '+ GitOpenaircnRepo + ' \n' + cmd = cmd + 'cd ' + logdirOAI5GRepo + '\n' + cmd = cmd + 'git checkout ' + GitOAI5GRepoBranch + '\n' + if GitOAI5GHeadVersion : + cmd = cmd + 'git checkout ' + GitOAI5GHeadVersion + '\n' + cmd = cmd + 'git_head=`git ls-remote |grep \'' + GitOAI5GRepoBranch + '\'` \n' + cmd = cmd + 'git_head=($git_head) \n' + cmd = cmd + 'git_head=${git_head[0]} \n' + cmd = cmd + 'echo \"GitOAI5GHeadVersion_remote = $git_head\" \n' + cmd = cmd + 'echo \"GitOAI5GHeadVersion_local = ' + GitOAI5GHeadVersion + '\" \n' + if flag_skip_git_head_check==True: + cmd = cmd + 'echo \"skipping GitHead check...\" \n ' + else: + cmd = cmd + 'if [ \"$git_head\" != \"'+ GitOAI5GHeadVersion + '\" ]; then echo \"error: Git openairinterface5g head version does not match\" ; fi \n' + cmd = cmd + 'source oaienv' + '\n' + if flag_skip_oai_install == False: + cmd = cmd + 'source $OPENAIR_DIR/cmake_targets/tools/build_helper \n' + cmd = cmd + 'echo \"Installing core OAI dependencies...Start\" \n' + cmd = cmd + '$OPENAIR_DIR/cmake_targets/build_oai -I --install-optional-packages \n' + cmd = cmd + 'echo \"Installing core OAI dependencies...Finished\" \n' + #cmd = cmd + 'echo \"Installing BLADERF OAI dependencies...Start\" \n' + #cmd = cmd + 'check_install_bladerf_driver \n' + #cmd = cmd + 'echo \"Installing BLADERF OAI dependencies...Finished\" \n' + #cmd = cmd + 'echo \"Installing USRP OAI dependencies...Start\" \n' + #cmd = cmd + 'check_install_usrp_uhd_driver \n' + #cmd = cmd + 'echo \"Installing USRP OAI dependencies...Finished\" \n' + cmd = cmd + 'cd ' + logdirOpenaircnRepo + '\n' + cmd = cmd + 'git checkout ' + GitOpenaircnRepoBranch + '\n' + cmd = cmd + 'env |grep OPENAIR' + '\n' + cmd = cmd + ' cd ' + logdir + '\n' + cmd = cmd + 'mkdir -p ' + patchdir + '\n' + cmd = cmd + ' ) > ' + setuplogfile + ' 2>&1 \n' + #cmd = cmd + 'echo \' ' + cmd + '\' > ' + setup_script + ' 2>&1 \n ' + #result = oai_list[index].send_recv(cmd, False, 300 ) + write_file(setup_script, cmd, mode="w") + tempThread = oaiThread(index, 'thread_setup_'+str(index)+'_' + MachineList[index] , MachineList[index] , user, pw, cmd, False, 3000) + threads_init_setup.append(tempThread ) + tempThread.start() + index = index + 1 + except Exception, e: + print 'There is error in one of the commands to setup the machine '+ MachineList[index] + error='' + error = error + ' In function: ' + sys._getframe().f_code.co_name + ': *** Caught exception: ' + str(e.__class__) + " : " + str( e) + error = error + traceback.format_exc() + print error + sys.exit(1) + + #Now we wait for all the threads to complete + index = 0 + for t in threads_init_setup: + t.join() + + port = 22 + paramList=[] + sftp_log = os.path.expandvars(locallogdir + '/sftp_module.log') + + #Now we copy patch files for u + print( Fore.WHITE + " - Installating patch files on machine " + MachineList[index]) + #Now we copy patch files for u + for patchFile in OAI5GpatchFileList: + localfile = os.path.expandvars('$OPENAIR_DIR/cmake_targets/autotests/patches/')+patchFile.get('name') + remotefile = logdirOAI5GRepo + '/cmake_targets/autotests/patches/'+patchFile.get('name') + if patchFile.get('machine') == MachineList[index] or patchFile.get('machine') == None: + if os.path.isfile(localfile): + print( Fore.WHITE + "\t> PATCH FILE :"+localfile) + paramList=[] + paramList.append ( {"operation":'put', "localfile":localfile, "remotefile":remotefile} ) + sftp_module (user, pw, MachineList[index], port, paramList, sftp_log) + cmd = ' cd ' + logdirOAI5GRepo + ' ;git apply cmake_targets/autotests/patches/'+patchFile.get('name') + res = oai_list[index].send_recv(cmd) + #print res + + paramList=[] + + #Now we copy test_case_list.xml on the remote machines + localfile = os.path.expandvars('$OPENAIR_DIR/cmake_targets/autotests/test_case_list.xml') + remotefile = logdirOAI5GRepo + '/cmake_targets/autotests/test_case_list.xml' + # paramList.append ( {"operation":'put', "localfile":localfile, "remotefile":remotefile} ) + # sftp_module (user, pw, MachineList[index], port, paramList, sftp_log) + + setuplogfile = logdir + '/setup_log_' + MachineList[index] + '_.txt' + setup_script = locallogdir + '/setup_script_' + MachineList[index] + '_.txt' + localfile = locallogdir + '/setup_log_' + MachineList[index] + '_.txt' + remotefile = logdir + '/setup_log_' + MachineList[index] + '_.txt' + + sftp_log = os.path.expandvars(locallogdir + '/sftp_module.log') + paramList.append ( {"operation":'get', "localfile":localfile, "remotefile":remotefile} ) + sftp_module (user, pw, MachineList[index], port, paramList, sftp_log) + + + cmd = ' cd ' + logdirOAI5GRepo + ' ; source oaienv ; env|grep OPENAIR \n' + res = oai_list[index].send_recv(cmd) + index = index +1 + if os.path.exists(localfile) == 0: + print "Setup log file <" + localfile + "> missing for machine <" + MachineList[index] + ">. Please check the setup log files. Exiting now" + sys.exit(1) + + #Now we process all the test cases + #Now we check if there was error in setup files + + status, out = commands.getstatusoutput('grep ' + ' -il \'error\' ' + locallogdir + '/setup_log*') + if (out != '') : + print "There is error in setup of machines" + print "status = " + str(status) + "\n Check files for error = " + out + print "Exiting now..." + sys.exit(1) + + cleanOldProgramsAllMachines(oai_list, CleanUpOldProgs, CleanUpAluLteBox, ExmimoRfStop, '$HOME' , logdirOAI5GRepo) + if cleanUpRemoteMachines == True: + print "Error while cleaning Remote machines" + print "Exiting now..." + sys.exit(0) + +else: + print (Fore.RED + " Skipping Machine preparation...") + +# ************************************************************************** +# ************************************************************************** +# STEP 2 - TEST SELECTION AND PARAMETRIZATION +# ************************************************************************** +# ************************************************************************** + +print (Fore.YELLOW + '\nStep 2 - TEST SELECTION') +print (Fore.YELLOW + '-------------------------------------------------') + +print (Fore.WHITE + " Parsing test case list for test selection...") +print (Fore.WHITE + " - TestCaseExclusionList : "+TestCaseExclusionList) +print (Fore.WHITE + " - testcasegroup : "+testcasegroup) + + + + +testcaseList=xmlRoot.findall('testCase') + +nb_total_testcases = 0 +nb_total_testcases_softmodem = 0 +nb_total_testcases_softmodem_noS1 = 0 +nb_total_testcases_compilation = 0 +nb_total_testcases_execution = 0 + +nb_run_testcases = 0 +nb_run_testcases_softmodem = 0 +nb_run_testcases_softmodem_noS1 = 0 +nb_run_testcases_compilation = 0 +nb_run_testcases_execution = 0 + + +for testcase in testcaseList: + try: + testcasename = testcase.get('id') + testcaseclass = testcase.findtext('class',default='') + desc = testcase.findtext('desc',default='') + nb_total_testcases+=1 + + run_flag = search_test_case_group(testcasename, testcasegroup, TestCaseExclusionList) + if (run_flag): + nb_run_testcases+=1 + + if testcaseclass == 'lte-softmodem' : + nb_total_testcases_softmodem+=1 + if (run_flag): nb_run_testcases_softmodem+=1 + elif testcaseclass == 'lte-softmodem-noS1': + nb_total_testcases_softmodem_noS1+=1 + if (run_flag): nb_run_testcases_softmodem_noS1+=1 + elif testcaseclass == 'compilation': + nb_total_testcases_compilation+=1 + if (run_flag): nb_run_testcases_compilation+=1 + elif testcaseclass == 'execution': + nb_total_testcases_execution+=1 + if (run_flag): nb_run_testcases_execution+=1 + else : + print "Unknown test case class: " + testcaseclass + sys.exit() + + except Exception, e: + error='' + error = error + ' In function: ' + sys._getframe().f_code.co_name + ': *** Caught exception: ' + str(e.__class__) + " : " + str( e) + error = error + '\n testcasename = ' + testcasename + '\n testcaseclass = ' + testcaseclass + '\n desc = ' + 'desc' + '\n' + error = error + traceback.format_exc() + print error + print "Continuing to next test case..." + +print (Fore.WHITE + " Parsing done...") + +print (Fore.WHITE + " - Total number of test cases : "+str(nb_total_testcases)) +print (Fore.WHITE + " - Total number class softmodem : "+str(nb_total_testcases_softmodem)) +print (Fore.WHITE + " - Total number class softmodem-noS1 : "+str(nb_total_testcases_softmodem_noS1)) +print (Fore.WHITE + " - Total number class compilation : "+str(nb_total_testcases_compilation)) +print (Fore.WHITE + " - Total number class execution : "+str(nb_total_testcases_execution)) +print +print (Fore.WHITE + " - Selected number of test cases : "+str(nb_run_testcases)) +print (Fore.WHITE + " - Selected class softmodem : "+str(nb_run_testcases_softmodem)) +print (Fore.WHITE + " - Selected class softmodem_noS1 : "+str(nb_run_testcases_softmodem_noS1)) +print (Fore.WHITE + " - Selected class compilation : "+str(nb_run_testcases_compilation)) +print (Fore.WHITE + " - Selected class execution : "+str(nb_run_testcases_execution)) + +# ************************************************************************** +# ************************************************************************** +# STEP 3 - TEST CAMPAIGNS +# ************************************************************************** +# ************************************************************************** + +test_results = [] + + +print (Fore.YELLOW + '\nStep 3 - TEST CAMPAIGNS') +print (Fore.YELLOW + '-------------------------------------------------') + +print (Fore.WHITE + " Start test campaign...") + +run_count = 0 +for testcase in testcaseList: + try: + testcasename = testcase.get('id') + testcaseclass = testcase.findtext('class',default='') + + if (search_test_case_group(testcasename, testcasegroup, TestCaseExclusionList)): + run_count+=1 + print (Fore.WHITE + " ("+str(run_count).zfill(3)+"/"+str(nb_run_testcases).zfill(3)+") - test case "+testcasename+" : "), + if testcaseclass == 'lte-softmodem' : + print (Fore.RED + "skipped - lte-softmodem class not supported") + elif testcaseclass == 'lte-softmodem-noS1': + print + handle_testcaseclass_softmodem_noS1 (testcase, CleanUpOldProgs, logdirOAI5GRepo, logdirOpenaircnRepo, MachineList, user, pw, CleanUpAluLteBox, ExmimoRfStop, nruns_lte_softmodem, Timeout_cmd ) + elif testcaseclass == 'compilation': + print (Fore.RED + "skipped - compilation class not supported") + elif testcaseclass == 'execution': + print (Fore.RED + "skipped - execution class not supported") + else : + print (Fore.RED + "Unknown test case class: " + testcaseclass) + sys.exit() + + except Exception, e: + error='' + error = error + ' In function: ' + sys._getframe().f_code.co_name + ': *** Caught exception: ' + str(e.__class__) + " : " + str( e) + error = error + '\n testcasename = ' + testcasename + '\n testcaseclass = ' + testcaseclass + '\n desc = ' + 'desc' + '\n' + error = error + traceback.format_exc() + print error + print "Continuing to next test case..." + +threadListGlobal=[] + + +# ************************************************************************** +# ************************************************************************** +# STEP 4 - TEST REPORT PRODUCTION +# ************************************************************************** +# ************************************************************************** + + + +test_session_stop_time = datetime.datetime.now() + +print (Fore.YELLOW + '\nStep 4 - TEST REPORT PRODUCTION') +print (Fore.YELLOW + '-------------------------------------------------') + +report_dir = reportdir + '/'+ test_session_start_time.strftime("%Y-%m-%d_%H-%M")+"_"+host + +cmd = 'mkdir -p ' + report_dir +result = os.system(cmd) + +cmd = 'cp -r '+locallogdir+' '+report_dir +result = os.system(cmd) + +context = { + 'report_path' : report_dir, + 'test_session_start_time' : test_session_start_time, + 'test_session_stop_time' : test_session_stop_time, + 'test_session_duration' : test_session_stop_time-test_session_start_time, + 'mtc_host' : host, + 'user' : user, + 'password' : pw, + 'test_results' : test_results, +} + +for test_result in test_results: + cmd = 'mkdir -p ' + report_dir + '/'+ test_result['testcase_name'] + result = os.system(cmd) + + report_file = report_dir + '/'+ test_result['testcase_name'] + '/'+ test_result['testcase_name']+ '_report.html' + + analyser.create_test_report_detailed_html(test_result, report_file ) + + print test_result + + +analyser.create_report_html(context) + +exit_prog(0) + +#print testcaseList +for testcase in testcaseList: + try: + testcasename = testcase.get('id') + testcaseclass = testcase.findtext('class',default='') + desc = testcase.findtext('desc',default='') + #print "Machine list top level = " + ','.join(MachineList) + if search_test_case_group(testcasename, testcasegroup, TestCaseExclusionList) == True: + if testcaseclass == 'lte-softmodem' : + eNBMachine = testcase.findtext('eNB',default='') + UEMachine = testcase.findtext('UE',default='') + EPCMachine = testcase.findtext('EPC',default='') + #index_eNBMachine = MachineList.index(eNBMachine) + #index_UEMachine = MachineList.index(UEMachine) + #index_EPCMachine = MachineList.index(EPCMachine) + if (eNBMachine not in MachineList)|(UEMachine not in MachineList)|(UEMachine not in MachineList): + print "One of the machines is not in the machine list" + print "eNBMachine : " + eNBMachine + "UEMachine : " + UEMachine + "EPCMachine : " + EPCMachine + "MachineList : " + ','.join(MachineList) + print "testcasename = " + testcasename + " class = " + testcaseclass + threadListGlobal = wait_testcaseclass_generic_threads(threadListGlobal, Timeout_execution) + #cleanOldProgramsAllMachines(oai_list, CleanUpOldProgs, CleanUpAluLteBox, ExmimoRfStop) + #handle_testcaseclass_softmodem (testcase, CleanUpOldProgs, logdirOAI5GRepo, logdirOpenaircnRepo, MachineList, user, pw, CleanUpAluLteBox, ExmimoRfStop, nruns_lte_softmodem, Timeout_cmd ) + + #The lines below are copied from below to trace the failure of some of the machines in test setup. These lines below need to be removed in long term +# print "Creating xml file for overall results..." +# cmd = "cat $OPENAIR_DIR/cmake_targets/autotests/log/*/*.xml > $OPENAIR_DIR/cmake_targets/autotests/log/results_autotests.xml " +# res=os.system(cmd) +# os.system('sync') +# print "Now copying files to NFS Share" +# oai_localhost = openair('localdomain','localhost') +# oai_localhost.connect(user,pw) +# cmd = ' mkdir -p ' + NFSTestsResultsDir +# print cmd +# res = oai_localhost.send_recv(cmd) +# print res + + # print "Copying files from GilabCI Runner Machine : " + host + " .locallogdir = " + locallogdir + ", NFSTestsResultsDir = " + NFSTestsResultsDir + # SSHSessionWrapper('localhost', user, None, pw , NFSTestsResultsDir , locallogdir, "put_all") + # oai_localhost.disconnect() + + elif (testcaseclass == 'compilation'): + threadListGlobal = handle_testcaseclass_generic (testcasename, threadListGlobal, CleanUpOldProgs, logdirOAI5GRepo, MachineListGeneric, user, pw, CleanUpAluLteBox,Timeout_execution, ExmimoRfStop) + elif (testcaseclass == 'execution'): + threadListGlobal = handle_testcaseclass_generic (testcasename, threadListGlobal, CleanUpOldProgs, logdirOAI5GRepo, MachineListGeneric, user, pw, CleanUpAluLteBox, Timeout_execution, ExmimoRfStop) + else : + print "Unknown test case class: " + testcaseclass + sys.exit() + + except Exception, e: + error='' + error = error + ' In function: ' + sys._getframe().f_code.co_name + ': *** Caught exception: ' + str(e.__class__) + " : " + str( e) + error = error + '\n testcasename = ' + testcasename + '\n testcaseclass = ' + testcaseclass + '\n desc = ' + 'desc' + '\n' + error = error + traceback.format_exc() + print error + print "Continuing to next test case..." + #sys.exit(1) + + +print "Exiting the test cases execution now. Waiting for existing threads to complete..." + +for param in threadListGlobal: + thread_id = param["thread_id"] + thread_id.join() + +print "Creating xml file for overall results..." +cmd = "cat $OPENAIR_DIR/cmake_targets/autotests/log/*/*.xml > $OPENAIR_DIR/cmake_targets/autotests/log/results_autotests.xml " +res=os.system(cmd) + +print "Now copying files to NFS Share" +oai_localhost = openair('localdomain','localhost') +oai_localhost.connect(user,pw) +cmd = 'mkdir -p ' + NFSTestsResultsDir +print cmd +res = oai_localhost.send_recv(cmd) +print res + +print "Copying files from GilabCI Runner Machine : " + host + " .locallogdir = " + locallogdir + ", NFSTestsResultsDir = " + NFSTestsResultsDir +SSHSessionWrapper('localhost', user, None, pw , NFSTestsResultsDir , locallogdir, "put_all") + +cmd = "cat " + NFSTestsResultsDir + "/log/*/*.xml > " + NFSTestsResultsDir + "/log/results_autotests.xml" +res = oai_localhost.send_recv(cmd) + +oai_localhost.disconnect() + +sys.exit() + + + + + + + +run_count = 0 +for testcase in testcaseList: + try: + testcasename = testcase.get('id') + testcaseclass = testcase.findtext('class',default='') + + if (search_test_case_group(testcasename, testcasegroup, TestCaseExclusionList)): + run_count+=1 + print (Fore.WHITE + " ("+str(run_count).zfill(3)+"/"+str(nb_run_testcases).zfill(3)+") - test case "+testcasename+" : "), + if testcaseclass == 'lte-softmodem' : + print (Fore.RED + "skipped - lte-softmodem class not supported") + elif testcaseclass == 'lte-softmodem-noS1': + print + + testcase_verdict = 'PASS' + testcase_time_start = datetime.datetime.now() + testcase_name = testcase.get('id') + testcase_desc = testcase.findtext('desc',default='') + timeout_cmd = testcase.findtext('TimeOut_cmd',default='') + timeout_cmd = int(float(timeout_cmd)) + timeout_thread = timeout_cmd + 300 #Timeout_thread is more than that of cmd to have room for compilation time, etc + if nruns_lte_softmodem == '': + nruns = testcase.findtext('nruns',default='') + else: + nruns = nruns_lte_softmodem + nruns = int(float(nruns)) + tags = testcase.findtext('tags',default='') + testcase_time_stop = datetime.datetime.now() + + test_result = dict(testcase_name=testcase_name, + testcaseclass=testcaseclass, + testcase_verdict = testcase_verdict, + testcase_time_start=testcase_time_start, + testcase_time_stop=testcase_time_stop, + tags=tags, + nruns=nruns, + testcase_timeout=timeout_cmd, + testcase_duration = testcase_time_stop-testcase_time_start, + testcase_eNBMachine ="TOTO", + testcase_UEMachine ="TITI") + test_results.append(test_result) + + + elif testcaseclass == 'compilation': + print (Fore.RED + "skipped - compilation class not supported") + elif testcaseclass == 'execution': + print (Fore.RED + "skipped - execution class not supported") + else : + print (Fore.RED + "Unknown test case class: " + testcaseclass) + sys.exit() + + except Exception, e: + error='' + error = error + ' In function: ' + sys._getframe().f_code.co_name + ': *** Caught exception: ' + str(e.__class__) + " : " + str( e) + error = error + '\n testcasename = ' + testcasename + '\n testcaseclass = ' + testcaseclass + '\n desc = ' + 'desc' + '\n' + error = error + traceback.format_exc() + print error + print "Continuing to next test case..." diff --git a/cmake_targets/autotests/testsuite_ue_noS1_eurecom.xml b/cmake_targets/autotests/testsuite_ue_noS1_eurecom.xml new file mode 100644 index 0000000000..25a4a652e5 --- /dev/null +++ b/cmake_targets/autotests/testsuite_ue_noS1_eurecom.xml @@ -0,0 +1,3214 @@ + + +imb182-desktop yanbo-M4HM87P-00 + /mnt/sradio/TEST_RESULTS/ + https://gitlab.eurecom.fr/oai/openairinterface5g.git + https://gitlab.eurecom.fr/oai/openair-cn.git --> + develop + + + + + + + + + develop + oaisim oaisim_nos1 lte-softmodem lte-softmodem-nos1 mme_gw run_epc auth_request run_hss oai_hss mme spgw hss hss_sim configure_cots* wvdial iperf iperf_script iperf_script_phone ping tshark rrh_gw iperf3 iperf3_script iperf3_script_phone pppd + sudo -S -E /opt/ltebox/tools/stop_ltebox +$OPENAIR_DIR/cmake_targets/build_oai -w EXMIMO -c; sudo -S -E $OPENAIR_DIR/cmake_targets/tools/stop_exmimo2; sudo -E $OPENAIR_DIR/cmake_targets/autotests/tools/configure_cots_bandrich_ue.py --reset-ue; sudo -E $OPENAIR_DIR/cmake_targets/autotests/tools/configure_cots_huaweiE398_ue.py --reset-ue; sudo -E $OPENAIR_DIR/cmake_targets/autotests/tools/configure_cots_sony_experia_m4_ue.py --stop-ue; uname -a; sudo -E dmesg + 36000 + + + yanbo-M4HM87P-00 + + + + + + lte-softmodem-noS1 + + imb182-desktop + yanbo-M4HM87P-00 + 300 + /tmp + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tracking_area_code \"1\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_country_code \"208\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_network_code \"95\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf N_RB_DL 25 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mme_ip_address "ipv4=\"192.168.12.26\";ipv6=\"192:168:30::17\";active=\"yes\";preference=\"ipv4\";" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf downlink_frequency 2685000000L + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf uplink_frequency_offset -120000000 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tx_gain 90 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf rx_gain 125 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf frame_type \"FDD\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_rx 1 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_tx 1 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1_MME \"eth5\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1_MME \"192.168.12.82/24\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1U \"eth5\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1U \"192.168.12.82/24\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_PORT_FOR_S1U 2152 + $OPENAIR_DIR/cmake_targets/build_oai + -c -w USRP --eNB --noS1 + source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB + + $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 + -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 0 --phy-test + + + + + False + + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c --UE -w USRP --noS1 --eNB + source ./targets/bin/init_nas_nos1 UE + + sleep 50; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C2685004636. -r25 --ue-scan-carrier --ue-txgain 90 -A 20 --ue-rxgain 125 -S --phy-test -g 4 + + + + + + False + + UE_USRP.NOS1.PHYTEST_PERF.BAND7.5MHZ.MCS00 + 36 + + + + lte-softmodem-noS1 + + imb182-desktop + ued-PRM-130 + 300 + /tmp + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tracking_area_code \"1\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_country_code \"208\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_network_code \"95\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf N_RB_DL 25 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mme_ip_address "ipv4=\"192.168.12.26\";ipv6=\"192:168:30::17\";active=\"yes\";preference=\"ipv4\";" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf downlink_frequency 2685000000L + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf uplink_frequency_offset -120000000 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tx_gain 90 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf rx_gain 125 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf frame_type \"FDD\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_rx 1 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_tx 1 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1_MME \"eth5\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1_MME \"192.168.12.82/24\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1U \"eth5\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1U \"192.168.12.82/24\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_PORT_FOR_S1U 2152 + $OPENAIR_DIR/cmake_targets/build_oai + -c -w USRP --eNB --noS1 + source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB + + $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 + -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 0 --phy-test + + + + + False + + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c --UE -w EXMIMO --noS1 + source ./targets/bin/init_nas_nos1 UE + + sleep 50; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C 2685000000 -r25 --ue-scan-carrier --ue-txgain 0 --ue-rxgain 5 -S -A 6 -F myriadRF_FMX --ue-max-power -25 --phy-test -g 4 + + + + + + False + + UE_UEDV1.NOS1.PHYTEST_PERF.BAND7.5MHZ.MCS00 + 36 + + + + lte-softmodem-noS1 + + imb182-desktop + yanbo-M4HM87P-00 + 300 + /tmp + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tracking_area_code \"1\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_country_code \"208\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_network_code \"95\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf N_RB_DL 25 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mme_ip_address "ipv4=\"192.168.12.26\";ipv6=\"192:168:30::17\";active=\"yes\";preference=\"ipv4\";" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf downlink_frequency 2685000000L + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf uplink_frequency_offset -120000000 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tx_gain 90 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf rx_gain 125 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf frame_type \"FDD\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_rx 1 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_tx 1 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1_MME \"eth5\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1_MME \"192.168.12.82/24\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1U \"eth5\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1U \"192.168.12.82/24\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_PORT_FOR_S1U 2152 + $OPENAIR_DIR/cmake_targets/build_oai + -c -w USRP --eNB --noS1 + source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB + + $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 + -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 1 --phy-test + + + + + False + + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c --UE -w USRP --noS1 --eNB + source ./targets/bin/init_nas_nos1 UE + + sleep 50; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C2685004636. -r25 --ue-scan-carrier --ue-txgain 90 -A 20 --ue-rxgain 125 -S --phy-test -g 4 + + + + + + False + + UE_USRP.NOS1.PHYTEST_PERF.BAND7.5MHZ.MCS01 + 36 + + + + lte-softmodem-noS1 + + imb182-desktop + ued-PRM-130 + 300 + /tmp + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tracking_area_code \"1\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_country_code \"208\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_network_code \"95\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf N_RB_DL 25 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mme_ip_address "ipv4=\"192.168.12.26\";ipv6=\"192:168:30::17\";active=\"yes\";preference=\"ipv4\";" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf downlink_frequency 2685000000L + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf uplink_frequency_offset -120000000 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tx_gain 90 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf rx_gain 125 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf frame_type \"FDD\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_rx 1 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_tx 1 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1_MME \"eth5\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1_MME \"192.168.12.82/24\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1U \"eth5\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1U \"192.168.12.82/24\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_PORT_FOR_S1U 2152 + $OPENAIR_DIR/cmake_targets/build_oai + -c -w USRP --eNB --noS1 + source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB + + $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 + -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 1 --phy-test + + + + + False + + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c --UE -w EXMIMO --noS1 + source ./targets/bin/init_nas_nos1 UE + + sleep 50; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C 2685000000 -r25 --ue-scan-carrier --ue-txgain 0 --ue-rxgain 5 -S -A 6 -F myriadRF_FMX --ue-max-power -25 --phy-test -g 4 + + + + + + False + + UE_UEDV1.NOS1.PHYTEST_PERF.BAND7.5MHZ.MCS01 + 36 + + + + + + + + + lte-softmodem-noS1 + + imb182-desktop + yanbo-M4HM87P-00 + 300 + /tmp + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tracking_area_code \"1\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_country_code \"208\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_network_code \"95\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf N_RB_DL 25 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mme_ip_address "ipv4=\"192.168.12.26\";ipv6=\"192:168:30::17\";active=\"yes\";preference=\"ipv4\";" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf downlink_frequency 2685000000L + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf uplink_frequency_offset -120000000 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tx_gain 90 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf rx_gain 125 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf frame_type \"FDD\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_rx 1 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_tx 1 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1_MME \"eth5\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1_MME \"192.168.12.82/24\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1U \"eth5\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1U \"192.168.12.82/24\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_PORT_FOR_S1U 2152 + $OPENAIR_DIR/cmake_targets/build_oai + -c -w USRP --eNB --noS1 + source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB + + $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 + -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 9 --phy-test + + + + + False + + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c --UE -w USRP --noS1 --eNB + source ./targets/bin/init_nas_nos1 UE + + sleep 50; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C2685004636. -r25 --ue-scan-carrier --ue-txgain 90 -A 20 --ue-rxgain 125 -S --phy-test -g 4 + + + + + + False + + UE_USRP.NOS1.PHYTEST_PERF.BAND7.5MHZ.MCS09 + 36 + + + + lte-softmodem-noS1 + + imb182-desktop + ued-PRM-130 + 300 + /tmp + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tracking_area_code \"1\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_country_code \"208\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_network_code \"95\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf N_RB_DL 25 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mme_ip_address "ipv4=\"192.168.12.26\";ipv6=\"192:168:30::17\";active=\"yes\";preference=\"ipv4\";" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf downlink_frequency 2685000000L + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf uplink_frequency_offset -120000000 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tx_gain 90 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf rx_gain 125 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf frame_type \"FDD\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_rx 1 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_tx 1 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1_MME \"eth5\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1_MME \"192.168.12.82/24\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1U \"eth5\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1U \"192.168.12.82/24\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_PORT_FOR_S1U 2152 + $OPENAIR_DIR/cmake_targets/build_oai + -c -w USRP --eNB --noS1 + source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB + + $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 + -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 9 --phy-test + + + + + False + + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c --UE -w EXMIMO --noS1 + source ./targets/bin/init_nas_nos1 UE + + sleep 50; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C 2685000000 -r25 --ue-scan-carrier --ue-txgain 0 --ue-rxgain 5 -S -A 6 -F myriadRF_FMX --ue-max-power -25 --phy-test -g 4 + + + + + + False + + UE_UEDV1.NOS1.PHYTEST_PERF.BAND7.5MHZ.MCS09 + 36 + + + + lte-softmodem-noS1 + + imb182-desktop + yanbo-M4HM87P-00 + 300 + /tmp + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tracking_area_code \"1\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_country_code \"208\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_network_code \"95\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf N_RB_DL 25 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mme_ip_address "ipv4=\"192.168.12.26\";ipv6=\"192:168:30::17\";active=\"yes\";preference=\"ipv4\";" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf downlink_frequency 2685000000L + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf uplink_frequency_offset -120000000 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tx_gain 90 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf rx_gain 125 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf frame_type \"FDD\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_rx 1 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_tx 1 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1_MME \"eth5\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1_MME \"192.168.12.82/24\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1U \"eth5\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1U \"192.168.12.82/24\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_PORT_FOR_S1U 2152 + $OPENAIR_DIR/cmake_targets/build_oai + -c -w USRP --eNB --noS1 + source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB + + $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 + -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 16 --phy-test + + + + + False + + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c --UE -w USRP --noS1 --eNB + source ./targets/bin/init_nas_nos1 UE + + sleep 50; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C2685004636. -r25 --ue-scan-carrier --ue-txgain 90 -A 20 --ue-rxgain 125 -S --phy-test -g 4 + + + + + + False + + UE_USRP.NOS1.PHYTEST_PERF.BAND7.5MHZ.MCS16 + 36 + + + + lte-softmodem-noS1 + + imb182-desktop + ued-PRM-130 + 300 + /tmp + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tracking_area_code \"1\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_country_code \"208\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_network_code \"95\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf N_RB_DL 25 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mme_ip_address "ipv4=\"192.168.12.26\";ipv6=\"192:168:30::17\";active=\"yes\";preference=\"ipv4\";" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf downlink_frequency 2685000000L + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf uplink_frequency_offset -120000000 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tx_gain 90 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf rx_gain 125 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf frame_type \"FDD\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_rx 1 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_tx 1 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1_MME \"eth5\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1_MME \"192.168.12.82/24\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1U \"eth5\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1U \"192.168.12.82/24\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_PORT_FOR_S1U 2152 + $OPENAIR_DIR/cmake_targets/build_oai + -c -w USRP --eNB --noS1 + source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB + + $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 + -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 16 --phy-test + + + + + False + + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c --UE -w EXMIMO --noS1 + source ./targets/bin/init_nas_nos1 UE + + sleep 50; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C 2685000000 -r25 --ue-scan-carrier --ue-txgain 0 --ue-rxgain 5 -S -A 6 -F myriadRF_FMX --ue-max-power -25 --phy-test -g 4 + + + + + + False + + UE_UEDV1.NOS1.PHYTEST_PERF.BAND7.5MHZ.MCS16 + 36 + + + + lte-softmodem-noS1 + + imb182-desktop + yanbo-M4HM87P-00 + 300 + /tmp + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tracking_area_code \"1\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_country_code \"208\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_network_code \"95\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf N_RB_DL 25 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mme_ip_address "ipv4=\"192.168.12.26\";ipv6=\"192:168:30::17\";active=\"yes\";preference=\"ipv4\";" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf downlink_frequency 2685000000L + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf uplink_frequency_offset -120000000 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tx_gain 90 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf rx_gain 125 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf frame_type \"FDD\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_rx 1 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_tx 1 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1_MME \"eth5\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1_MME \"192.168.12.82/24\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1U \"eth5\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1U \"192.168.12.82/24\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_PORT_FOR_S1U 2152 + $OPENAIR_DIR/cmake_targets/build_oai + -c -w USRP --eNB --noS1 + source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB + + $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 + -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 10 --phy-test + + + + + False + + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c --UE -w USRP --noS1 --eNB + source ./targets/bin/init_nas_nos1 UE + + sleep 50; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C2685004636. -r25 --ue-scan-carrier --ue-txgain 90 -A 20 --ue-rxgain 125 -S --phy-test -g 4 + + + + + + False + UE_USRP.NOS1.PHYTEST_PERF.BAND7.5MHZ.MCS10 + + 36 + + + + lte-softmodem-noS1 + + imb182-desktop + ued-PRM-130 + 300 + /tmp + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tracking_area_code \"1\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_country_code \"208\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_network_code \"95\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf N_RB_DL 25 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mme_ip_address "ipv4=\"192.168.12.26\";ipv6=\"192:168:30::17\";active=\"yes\";preference=\"ipv4\";" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf downlink_frequency 2685000000L + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf uplink_frequency_offset -120000000 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tx_gain 90 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf rx_gain 125 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf frame_type \"FDD\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_rx 1 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_tx 1 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1_MME \"eth5\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1_MME \"192.168.12.82/24\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1U \"eth5\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1U \"192.168.12.82/24\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_PORT_FOR_S1U 2152 + $OPENAIR_DIR/cmake_targets/build_oai + -c -w USRP --eNB --noS1 + source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB + + $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 + -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 10 --phy-test + + + + + False + + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c --UE -w EXMIMO --noS1 + source ./targets/bin/init_nas_nos1 UE + + sleep 50; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C 2685000000 -r25 --ue-scan-carrier --ue-txgain 0 --ue-rxgain 5 -S -A 6 -F myriadRF_FMX --ue-max-power -25 --phy-test -g 4 + + + + + + False + UE_UEDV1.NOS1.PHYTEST_PERF.BAND7.5MHZ.MCS10 + 36 + + + + + lte-softmodem-noS1 + + imb182-desktop + yanbo-M4HM87P-00 + 300 + /tmp + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tracking_area_code \"1\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_country_code \"208\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_network_code \"95\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf N_RB_DL 25 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mme_ip_address "ipv4=\"192.168.12.26\";ipv6=\"192:168:30::17\";active=\"yes\";preference=\"ipv4\";" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf downlink_frequency 2685000000L + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf uplink_frequency_offset -120000000 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tx_gain 90 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf rx_gain 125 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf frame_type \"FDD\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_rx 1 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_tx 1 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1_MME \"eth5\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1_MME \"192.168.12.82/24\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1U \"eth5\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1U \"192.168.12.82/24\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_PORT_FOR_S1U 2152 + $OPENAIR_DIR/cmake_targets/build_oai + -c -w USRP --eNB --noS1 + source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB + + $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 + -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 17 --phy-test + + + + + False + + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c --UE -w USRP --noS1 --eNB + source ./targets/bin/init_nas_nos1 UE + + sleep 50; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C2685004636. -r25 --ue-scan-carrier --ue-txgain 90 -A 20 --ue-rxgain 125 -S --phy-test -g 4 + + + + + + False + UE_USRP.NOS1.PHYTEST_PERF.BAND7.5MHZ.MCS17 + + 36 + + + + lte-softmodem-noS1 + + imb182-desktop + ued-PRM-130 + 300 + /tmp + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tracking_area_code \"1\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_country_code \"208\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_network_code \"95\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf N_RB_DL 25 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mme_ip_address "ipv4=\"192.168.12.26\";ipv6=\"192:168:30::17\";active=\"yes\";preference=\"ipv4\";" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf downlink_frequency 2685000000L + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf uplink_frequency_offset -120000000 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tx_gain 90 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf rx_gain 125 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf frame_type \"FDD\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_rx 1 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_tx 1 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1_MME \"eth5\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1_MME \"192.168.12.82/24\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1U \"eth5\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1U \"192.168.12.82/24\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_PORT_FOR_S1U 2152 + $OPENAIR_DIR/cmake_targets/build_oai + -c -w USRP --eNB --noS1 + source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB + + $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 + -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 17 --phy-test + + + + + False + + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c --UE -w EXMIMO --noS1 + source ./targets/bin/init_nas_nos1 UE + + sleep 50; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C 2685000000 -r25 --ue-scan-carrier --ue-txgain 0 --ue-rxgain 5 -S -A 6 -F myriadRF_FMX --ue-max-power -25 --phy-test -g 4 + + + + + + False + UE_UEDV1.NOS1.PHYTEST_PERF.BAND7.5MHZ.MCS17 + 36 + + + + + lte-softmodem-noS1 + + imb182-desktop + yanbo-M4HM87P-00 + 300 + /tmp + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tracking_area_code \"1\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_country_code \"208\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_network_code \"95\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf N_RB_DL 25 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mme_ip_address "ipv4=\"192.168.12.26\";ipv6=\"192:168:30::17\";active=\"yes\";preference=\"ipv4\";" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf downlink_frequency 2685000000L + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf uplink_frequency_offset -120000000 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tx_gain 90 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf rx_gain 125 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf frame_type \"FDD\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_rx 1 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_tx 1 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1_MME \"eth5\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1_MME \"192.168.12.82/24\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1U \"eth5\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1U \"192.168.12.82/24\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_PORT_FOR_S1U 2152 + $OPENAIR_DIR/cmake_targets/build_oai + -c -w USRP --eNB --noS1 + source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB + + $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 + -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 18 --phy-test + + + + + False + + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c --UE -w USRP --noS1 --eNB + source ./targets/bin/init_nas_nos1 UE + + sleep 50; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C2685004636. -r25 --ue-scan-carrier --ue-txgain 90 -A 20 --ue-rxgain 125 -S --phy-test -g 4 + + + + + + False + UE_USRP.NOS1.PHYTEST_PERF.BAND7.5MHZ.MCS18 + + 36 + + + + lte-softmodem-noS1 + + imb182-desktop + ued-PRM-130 + 300 + /tmp + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tracking_area_code \"1\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_country_code \"208\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_network_code \"95\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf N_RB_DL 25 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mme_ip_address "ipv4=\"192.168.12.26\";ipv6=\"192:168:30::17\";active=\"yes\";preference=\"ipv4\";" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf downlink_frequency 2685000000L + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf uplink_frequency_offset -120000000 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tx_gain 90 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf rx_gain 125 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf frame_type \"FDD\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_rx 1 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_tx 1 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1_MME \"eth5\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1_MME \"192.168.12.82/24\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1U \"eth5\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1U \"192.168.12.82/24\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_PORT_FOR_S1U 2152 + $OPENAIR_DIR/cmake_targets/build_oai + -c -w USRP --eNB --noS1 + source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB + + $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 + -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 18 --phy-test + + + + + False + + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c --UE -w EXMIMO --noS1 + source ./targets/bin/init_nas_nos1 UE + + sleep 50; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C 2685000000 -r25 --ue-scan-carrier --ue-txgain 0 --ue-rxgain 5 -S -A 6 -F myriadRF_FMX --ue-max-power -25 --phy-test -g 4 + + + + + + False + UE_UEDV1.NOS1.PHYTEST_PERF.BAND7.5MHZ.MCS18 + 36 + + + + + lte-softmodem-noS1 + + imb182-desktop + yanbo-M4HM87P-00 + 300 + /tmp + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tracking_area_code \"1\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_country_code \"208\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_network_code \"95\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf N_RB_DL 25 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mme_ip_address "ipv4=\"192.168.12.26\";ipv6=\"192:168:30::17\";active=\"yes\";preference=\"ipv4\";" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf downlink_frequency 2685000000L + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf uplink_frequency_offset -120000000 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tx_gain 90 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf rx_gain 125 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf frame_type \"FDD\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_rx 1 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_tx 1 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1_MME \"eth5\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1_MME \"192.168.12.82/24\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1U \"eth5\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1U \"192.168.12.82/24\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_PORT_FOR_S1U 2152 + $OPENAIR_DIR/cmake_targets/build_oai + -c -w USRP --eNB --noS1 + source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB + + $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 + -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 19 --phy-test + + + + + False + + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c --UE -w USRP --noS1 --eNB + source ./targets/bin/init_nas_nos1 UE + + sleep 50; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C2685004636. -r25 --ue-scan-carrier --ue-txgain 90 -A 20 --ue-rxgain 125 -S --phy-test -g 4 + + + + + + False + UE_USRP.NOS1.PHYTEST_PERF.BAND7.5MHZ.MCS19 + + 36 + + + + lte-softmodem-noS1 + + imb182-desktop + ued-PRM-130 + 300 + /tmp + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tracking_area_code \"1\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_country_code \"208\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_network_code \"95\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf N_RB_DL 25 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mme_ip_address "ipv4=\"192.168.12.26\";ipv6=\"192:168:30::17\";active=\"yes\";preference=\"ipv4\";" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf downlink_frequency 2685000000L + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf uplink_frequency_offset -120000000 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tx_gain 90 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf rx_gain 125 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf frame_type \"FDD\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_rx 1 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_tx 1 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1_MME \"eth5\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1_MME \"192.168.12.82/24\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1U \"eth5\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1U \"192.168.12.82/24\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_PORT_FOR_S1U 2152 + $OPENAIR_DIR/cmake_targets/build_oai + -c -w USRP --eNB --noS1 + source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB + + $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 + -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 19 --phy-test + + + + + False + + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c --UE -w EXMIMO --noS1 + source ./targets/bin/init_nas_nos1 UE + + sleep 50; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C 2685000000 -r25 --ue-scan-carrier --ue-txgain 0 --ue-rxgain 5 -S -A 6 -F myriadRF_FMX --ue-max-power -25 --phy-test -g 4 + + + + + + False + UE_UEDV1.NOS1.PHYTEST_PERF.BAND7.5MHZ.MCS19 + 36 + + + + + + lte-softmodem-noS1 + + imb182-desktop + yanbo-M4HM87P-00 + 300 + /tmp + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tracking_area_code \"1\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_country_code \"208\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_network_code \"95\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf N_RB_DL 25 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mme_ip_address "ipv4=\"192.168.12.26\";ipv6=\"192:168:30::17\";active=\"yes\";preference=\"ipv4\";" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf downlink_frequency 2685000000L + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf uplink_frequency_offset -120000000 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tx_gain 90 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf rx_gain 125 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf frame_type \"FDD\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_rx 1 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_tx 1 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1_MME \"eth5\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1_MME \"192.168.12.82/24\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1U \"eth5\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1U \"192.168.12.82/24\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_PORT_FOR_S1U 2152 + $OPENAIR_DIR/cmake_targets/build_oai + -c -w USRP --eNB --noS1 + source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB + + $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 + -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 20 --phy-test + + + + + False + + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c --UE -w USRP --noS1 --eNB + source ./targets/bin/init_nas_nos1 UE + + sleep 50; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C2685004636. -r25 --ue-scan-carrier --ue-txgain 90 -A 20 --ue-rxgain 125 -S --phy-test -g 4 + + + + + + False + UE_USRP.NOS1.PHYTEST_PERF.BAND7.5MHZ.MCS20 + + 36 + + + + lte-softmodem-noS1 + + imb182-desktop + ued-PRM-130 + 300 + /tmp + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tracking_area_code \"1\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_country_code \"208\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_network_code \"95\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf N_RB_DL 25 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mme_ip_address "ipv4=\"192.168.12.26\";ipv6=\"192:168:30::17\";active=\"yes\";preference=\"ipv4\";" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf downlink_frequency 2685000000L + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf uplink_frequency_offset -120000000 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tx_gain 90 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf rx_gain 125 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf frame_type \"FDD\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_rx 1 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_tx 1 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1_MME \"eth5\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1_MME \"192.168.12.82/24\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1U \"eth5\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1U \"192.168.12.82/24\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_PORT_FOR_S1U 2152 + $OPENAIR_DIR/cmake_targets/build_oai + -c -w USRP --eNB --noS1 + source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB + + $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 + -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 20 --phy-test + + + + + False + + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c --UE -w EXMIMO --noS1 + source ./targets/bin/init_nas_nos1 UE + + sleep 50; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C 2685000000 -r25 --ue-scan-carrier --ue-txgain 0 --ue-rxgain 5 -S -A 6 -F myriadRF_FMX --ue-max-power -25 --phy-test -g 4 + + + + + + False + UE_UEDV1.NOS1.PHYTEST_PERF.BAND7.5MHZ.MCS20 + 36 + + + + + lte-softmodem-noS1 + + imb182-desktop + yanbo-M4HM87P-00 + 300 + /tmp + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tracking_area_code \"1\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_country_code \"208\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_network_code \"95\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf N_RB_DL 25 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mme_ip_address "ipv4=\"192.168.12.26\";ipv6=\"192:168:30::17\";active=\"yes\";preference=\"ipv4\";" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf downlink_frequency 2685000000L + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf uplink_frequency_offset -120000000 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tx_gain 90 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf rx_gain 125 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf frame_type \"FDD\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_rx 1 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_tx 1 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1_MME \"eth5\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1_MME \"192.168.12.82/24\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1U \"eth5\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1U \"192.168.12.82/24\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_PORT_FOR_S1U 2152 + $OPENAIR_DIR/cmake_targets/build_oai + -c -w USRP --eNB --noS1 + source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB + + $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 + -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 21 --phy-test + + + + + False + + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c --UE -w USRP --noS1 --eNB + source ./targets/bin/init_nas_nos1 UE + + sleep 50; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C2685004636. -r25 --ue-scan-carrier --ue-txgain 90 -A 20 --ue-rxgain 125 -S --phy-test -g 4 + + + + + + False + UE_USRP.NOS1.PHYTEST_PERF.BAND7.5MHZ.MCS21 + 36 + + + + + lte-softmodem-noS1 + + imb182-desktop + ued-PRM-130 + 300 + /tmp + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tracking_area_code \"1\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_country_code \"208\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_network_code \"95\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf N_RB_DL 25 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mme_ip_address "ipv4=\"192.168.12.26\";ipv6=\"192:168:30::17\";active=\"yes\";preference=\"ipv4\";" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf downlink_frequency 2685000000L + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf uplink_frequency_offset -120000000 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tx_gain 90 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf rx_gain 125 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf frame_type \"FDD\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_rx 1 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_tx 1 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1_MME \"eth5\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1_MME \"192.168.12.82/24\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1U \"eth5\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1U \"192.168.12.82/24\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_PORT_FOR_S1U 2152 + $OPENAIR_DIR/cmake_targets/build_oai + -c -w USRP --eNB --noS1 + source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB + + $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 + -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 21 --phy-test + + + + + False + + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c --UE -w EXMIMO --noS1 + source ./targets/bin/init_nas_nos1 UE + + sleep 50; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C 2685000000 -r25 --ue-scan-carrier --ue-txgain 0 --ue-rxgain 5 -S -A 6 -F myriadRF_FMX --ue-max-power -25 --phy-test -g 4 + + + + + + False + UE_UEDV1.NOS1.PHYTEST_PERF.BAND7.5MHZ.MCS21 + 36 + + + + + lte-softmodem-noS1 + + imb182-desktop + yanbo-M4HM87P-00 + 300 + /tmp + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tracking_area_code \"1\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_country_code \"208\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_network_code \"95\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf N_RB_DL 25 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mme_ip_address "ipv4=\"192.168.12.26\";ipv6=\"192:168:30::17\";active=\"yes\";preference=\"ipv4\";" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf downlink_frequency 2685000000L + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf uplink_frequency_offset -120000000 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tx_gain 90 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf rx_gain 125 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf frame_type \"FDD\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_rx 1 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_tx 1 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1_MME \"eth5\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1_MME \"192.168.12.82/24\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1U \"eth5\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1U \"192.168.12.82/24\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_PORT_FOR_S1U 2152 + $OPENAIR_DIR/cmake_targets/build_oai + -c -w USRP --eNB --noS1 + source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB + + $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 + -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 22 --phy-test + + + + + False + + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c --UE -w USRP --noS1 --eNB + source ./targets/bin/init_nas_nos1 UE + + sleep 50; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C2685004636. -r25 --ue-scan-carrier --ue-txgain 90 -A 20 --ue-rxgain 125 -S --phy-test -g 4 + + + + + + False + UE_USRP.NOS1.PHYTEST_PERF.BAND7.5MHZ.MCS22 + + 36 + + + + lte-softmodem-noS1 + + imb182-desktop + ued-PRM-130 + 300 + /tmp + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tracking_area_code \"1\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_country_code \"208\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_network_code \"95\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf N_RB_DL 25 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mme_ip_address "ipv4=\"192.168.12.26\";ipv6=\"192:168:30::17\";active=\"yes\";preference=\"ipv4\";" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf downlink_frequency 2685000000L + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf uplink_frequency_offset -120000000 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tx_gain 90 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf rx_gain 125 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf frame_type \"FDD\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_rx 1 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_tx 1 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1_MME \"eth5\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1_MME \"192.168.12.82/24\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1U \"eth5\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1U \"192.168.12.82/24\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_PORT_FOR_S1U 2152 + $OPENAIR_DIR/cmake_targets/build_oai + -c -w USRP --eNB --noS1 + source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB + + $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 + -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 22 --phy-test + + + + + False + + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c --UE -w EXMIMO --noS1 + source ./targets/bin/init_nas_nos1 UE + + sleep 50; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C 2685000000 -r25 --ue-scan-carrier --ue-txgain 0 --ue-rxgain 5 -S -A 6 -F myriadRF_FMX --ue-max-power -25 --phy-test -g 4 + + + + + + False + UE_UEDV1.NOS1.PHYTEST_PERF.BAND7.5MHZ.MCS22 + 36 + + + + + lte-softmodem-noS1 + + imb182-desktop + yanbo-M4HM87P-00 + 300 + /tmp + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tracking_area_code \"1\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_country_code \"208\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_network_code \"95\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf N_RB_DL 25 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mme_ip_address "ipv4=\"192.168.12.26\";ipv6=\"192:168:30::17\";active=\"yes\";preference=\"ipv4\";" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf downlink_frequency 2685000000L + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf uplink_frequency_offset -120000000 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tx_gain 90 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf rx_gain 125 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf frame_type \"FDD\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_rx 1 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_tx 1 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1_MME \"eth5\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1_MME \"192.168.12.82/24\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1U \"eth5\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1U \"192.168.12.82/24\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_PORT_FOR_S1U 2152 + $OPENAIR_DIR/cmake_targets/build_oai + -c -w USRP --eNB --noS1 + source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB + + $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 + -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 23 --phy-test + + + + + False + + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c --UE -w USRP --noS1 --eNB + source ./targets/bin/init_nas_nos1 UE + + sleep 50; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C2685004636. -r25 --ue-scan-carrier --ue-txgain 90 -A 20 --ue-rxgain 125 -S --phy-test -g 4 + + + + + + False + UE_USRP.NOS1.PHYTEST_PERF.BAND7.5MHZ.MCS23 + 36 + + + + + lte-softmodem-noS1 + + imb182-desktop + ued-PRM-130 + 300 + /tmp + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tracking_area_code \"1\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_country_code \"208\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_network_code \"95\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf N_RB_DL 25 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mme_ip_address "ipv4=\"192.168.12.26\";ipv6=\"192:168:30::17\";active=\"yes\";preference=\"ipv4\";" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf downlink_frequency 2685000000L + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf uplink_frequency_offset -120000000 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tx_gain 90 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf rx_gain 125 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf frame_type \"FDD\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_rx 1 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_tx 1 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1_MME \"eth5\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1_MME \"192.168.12.82/24\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1U \"eth5\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1U \"192.168.12.82/24\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_PORT_FOR_S1U 2152 + $OPENAIR_DIR/cmake_targets/build_oai + -c -w USRP --eNB --noS1 + source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB + + $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 + -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 23 --phy-test + + + + + False + + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c --UE -w EXMIMO --noS1 + source ./targets/bin/init_nas_nos1 UE + + sleep 50; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C 2685000000 -r25 --ue-scan-carrier --ue-txgain 0 --ue-rxgain 5 -S -A 6 -F myriadRF_FMX --ue-max-power -25 --phy-test -g 4 + + + + + + False + UE_UEDV1.NOS1.PHYTEST_PERF.BAND7.5MHZ.MCS23 + 36 + + + + + lte-softmodem-noS1 + + imb182-desktop + yanbo-M4HM87P-00 + 300 + /tmp + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tracking_area_code \"1\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_country_code \"208\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_network_code \"95\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf N_RB_DL 25 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mme_ip_address "ipv4=\"192.168.12.26\";ipv6=\"192:168:30::17\";active=\"yes\";preference=\"ipv4\";" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf downlink_frequency 2685000000L + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf uplink_frequency_offset -120000000 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tx_gain 90 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf rx_gain 125 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf frame_type \"FDD\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_rx 1 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_tx 1 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1_MME \"eth5\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1_MME \"192.168.12.82/24\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1U \"eth5\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1U \"192.168.12.82/24\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_PORT_FOR_S1U 2152 + $OPENAIR_DIR/cmake_targets/build_oai + -c -w USRP --eNB --noS1 + source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB + + $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 + -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 24 --phy-test + + + + + False + + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c --UE -w USRP --noS1 --eNB + source ./targets/bin/init_nas_nos1 UE + + sleep 50; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C2685004636. -r25 --ue-scan-carrier --ue-txgain 90 -A 20 --ue-rxgain 125 -S --phy-test -g 4 + + + + + + False + UE_USRP.NOS1.PHYTEST_PERF.BAND7.5MHZ.MCS24 + 36 + + + + + lte-softmodem-noS1 + + imb182-desktop + ued-PRM-130 + 300 + /tmp + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tracking_area_code \"1\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_country_code \"208\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_network_code \"95\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf N_RB_DL 25 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mme_ip_address "ipv4=\"192.168.12.26\";ipv6=\"192:168:30::17\";active=\"yes\";preference=\"ipv4\";" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf downlink_frequency 2685000000L + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf uplink_frequency_offset -120000000 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tx_gain 90 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf rx_gain 125 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf frame_type \"FDD\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_rx 1 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_tx 1 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1_MME \"eth5\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1_MME \"192.168.12.82/24\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1U \"eth5\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1U \"192.168.12.82/24\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_PORT_FOR_S1U 2152 + $OPENAIR_DIR/cmake_targets/build_oai + -c -w USRP --eNB --noS1 + source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB + + $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 + -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 24 --phy-test + + + + + False + + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c --UE -w EXMIMO --noS1 + source ./targets/bin/init_nas_nos1 UE + + sleep 50; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C 2685000000 -r25 --ue-scan-carrier --ue-txgain 0 --ue-rxgain 5 -S -A 6 -F myriadRF_FMX --ue-max-power -25 --phy-test -g 4 + + + + + + False + UE_UEDV1.NOS1.PHYTEST_PERF.BAND7.5MHZ.MCS24 + 36 + + + + + + lte-softmodem-noS1 + + imb182-desktop + yanbo-M4HM87P-00 + 300 + /tmp + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tracking_area_code \"1\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_country_code \"208\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_network_code \"95\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf N_RB_DL 25 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mme_ip_address "ipv4=\"192.168.12.26\";ipv6=\"192:168:30::17\";active=\"yes\";preference=\"ipv4\";" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf downlink_frequency 2685000000L + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf uplink_frequency_offset -120000000 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tx_gain 90 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf rx_gain 125 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf frame_type \"FDD\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_rx 1 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_tx 1 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1_MME \"eth5\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1_MME \"192.168.12.82/24\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1U \"eth5\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1U \"192.168.12.82/24\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_PORT_FOR_S1U 2152 + $OPENAIR_DIR/cmake_targets/build_oai + -c -w USRP --eNB --noS1 + source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB + + $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 + -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 25 --phy-test + + + + + False + + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c --UE -w USRP --noS1 --eNB + source ./targets/bin/init_nas_nos1 UE + + sleep 50; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C2685004636. -r25 --ue-scan-carrier --ue-txgain 90 -A 20 --ue-rxgain 125 -S --phy-test -g 4 + + + + + + False + UE_USRP.NOS1.PHYTEST_PERF.BAND7.5MHZ.MCS25 + 36 + + + + + lte-softmodem-noS1 + + imb182-desktop + ued-PRM-130 + 300 + /tmp + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tracking_area_code \"1\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_country_code \"208\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_network_code \"95\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf N_RB_DL 25 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mme_ip_address "ipv4=\"192.168.12.26\";ipv6=\"192:168:30::17\";active=\"yes\";preference=\"ipv4\";" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf downlink_frequency 2685000000L + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf uplink_frequency_offset -120000000 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tx_gain 90 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf rx_gain 125 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf frame_type \"FDD\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_rx 1 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_tx 1 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1_MME \"eth5\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1_MME \"192.168.12.82/24\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1U \"eth5\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1U \"192.168.12.82/24\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_PORT_FOR_S1U 2152 + $OPENAIR_DIR/cmake_targets/build_oai + -c -w USRP --eNB --noS1 + source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB + + $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 + -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 25 --phy-test + + + + + False + + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c --UE -w EXMIMO --noS1 + source ./targets/bin/init_nas_nos1 UE + + sleep 50; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C 2685000000 -r25 --ue-scan-carrier --ue-txgain 0 --ue-rxgain 5 -S -A 6 -F myriadRF_FMX --ue-max-power -25 --phy-test -g 4 + + + + + + False + UE_UEDV1.NOS1.PHYTEST_PERF.BAND7.5MHZ.MCS25 + 36 + + + + + lte-softmodem-noS1 + + imb182-desktop + yanbo-M4HM87P-00 + 300 + /tmp + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tracking_area_code \"1\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_country_code \"208\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_network_code \"95\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf N_RB_DL 25 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mme_ip_address "ipv4=\"192.168.12.26\";ipv6=\"192:168:30::17\";active=\"yes\";preference=\"ipv4\";" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf downlink_frequency 2685000000L + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf uplink_frequency_offset -120000000 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tx_gain 90 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf rx_gain 125 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf frame_type \"FDD\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_rx 1 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_tx 1 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1_MME \"eth5\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1_MME \"192.168.12.82/24\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1U \"eth5\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1U \"192.168.12.82/24\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_PORT_FOR_S1U 2152 + $OPENAIR_DIR/cmake_targets/build_oai + -c -w USRP --eNB --noS1 + source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB + + $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 + -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 26 --phy-test + + + + + False + + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c --UE -w USRP --noS1 --eNB + source ./targets/bin/init_nas_nos1 UE + + sleep 50; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C2685004636. -r25 --ue-scan-carrier --ue-txgain 90 -A 20 --ue-rxgain 125 -S --phy-test -g 4 + + + + + + False + UE_USRP.NOS1.PHYTEST_PERF.BAND7.5MHZ.MCS26 + 36 + + + + + lte-softmodem-noS1 + + imb182-desktop + ued-PRM-130 + 300 + /tmp + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tracking_area_code \"1\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_country_code \"208\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_network_code \"95\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf N_RB_DL 25 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mme_ip_address "ipv4=\"192.168.12.26\";ipv6=\"192:168:30::17\";active=\"yes\";preference=\"ipv4\";" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf downlink_frequency 2685000000L + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf uplink_frequency_offset -120000000 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tx_gain 90 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf rx_gain 125 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf frame_type \"FDD\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_rx 1 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_tx 1 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1_MME \"eth5\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1_MME \"192.168.12.82/24\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1U \"eth5\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1U \"192.168.12.82/24\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_PORT_FOR_S1U 2152 + $OPENAIR_DIR/cmake_targets/build_oai + -c -w USRP --eNB --noS1 + source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB + + $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 + -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 26 --phy-test + + + + + False + + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c --UE -w EXMIMO --noS1 + source ./targets/bin/init_nas_nos1 UE + + sleep 50; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C 2685000000 -r25 --ue-scan-carrier --ue-txgain 0 --ue-rxgain 5 -S -A 6 -F myriadRF_FMX --ue-max-power -25 --phy-test -g 4 + + + + + + False + UE_UEDV1.NOS1.PHYTEST_PERF.BAND7.5MHZ.MCS26 + 36 + + + + + lte-softmodem-noS1 + + imb182-desktop + yanbo-M4HM87P-00 + 300 + /tmp + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tracking_area_code \"1\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_country_code \"208\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_network_code \"95\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf N_RB_DL 25 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mme_ip_address "ipv4=\"192.168.12.26\";ipv6=\"192:168:30::17\";active=\"yes\";preference=\"ipv4\";" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf downlink_frequency 2685000000L + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf uplink_frequency_offset -120000000 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tx_gain 90 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf rx_gain 125 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf frame_type \"FDD\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_rx 1 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_tx 1 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1_MME \"eth5\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1_MME \"192.168.12.82/24\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1U \"eth5\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1U \"192.168.12.82/24\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_PORT_FOR_S1U 2152 + $OPENAIR_DIR/cmake_targets/build_oai + -c -w USRP --eNB --noS1 + source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB + + $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 + -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 27 --phy-test + + + + + False + + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c --UE -w USRP --noS1 --eNB + source ./targets/bin/init_nas_nos1 UE + + sleep 50; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C2685004636. -r25 --ue-scan-carrier --ue-txgain 90 -A 20 --ue-rxgain 125 -S --phy-test -g 4 + + + + + + False + UE_USRP.NOS1.PHYTEST_PERF.BAND7.5MHZ.MCS27 + 36 + + + + + lte-softmodem-noS1 + + imb182-desktop + ued-PRM-130 + 300 + /tmp + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tracking_area_code \"1\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_country_code \"208\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_network_code \"95\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf N_RB_DL 25 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mme_ip_address "ipv4=\"192.168.12.26\";ipv6=\"192:168:30::17\";active=\"yes\";preference=\"ipv4\";" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf downlink_frequency 2685000000L + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf uplink_frequency_offset -120000000 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tx_gain 90 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf rx_gain 125 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf frame_type \"FDD\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_rx 1 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_tx 1 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1_MME \"eth5\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1_MME \"192.168.12.82/24\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1U \"eth5\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1U \"192.168.12.82/24\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_PORT_FOR_S1U 2152 + $OPENAIR_DIR/cmake_targets/build_oai + -c -w USRP --eNB --noS1 + source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB + + $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 + -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 27 --phy-test + + + + + False + + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c --UE -w EXMIMO --noS1 + source ./targets/bin/init_nas_nos1 UE + + sleep 50; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C 2685000000 -r25 --ue-scan-carrier --ue-txgain 0 --ue-rxgain 5 -S -A 6 -F myriadRF_FMX --ue-max-power -25 --phy-test -g 4 + + + + + + False + UE_UEDV1.NOS1.PHYTEST_PERF.BAND7.5MHZ.MCS27 + 36 + + + + + lte-softmodem-noS1 + + imb182-desktop + yanbo-M4HM87P-00 + 300 + /tmp + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tracking_area_code \"1\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_country_code \"208\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_network_code \"95\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf N_RB_DL 25 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mme_ip_address "ipv4=\"192.168.12.26\";ipv6=\"192:168:30::17\";active=\"yes\";preference=\"ipv4\";" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf downlink_frequency 2685000000L + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf uplink_frequency_offset -120000000 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tx_gain 90 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf rx_gain 125 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf frame_type \"FDD\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_rx 1 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_tx 1 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1_MME \"eth5\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1_MME \"192.168.12.82/24\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1U \"eth5\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1U \"192.168.12.82/24\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_PORT_FOR_S1U 2152 + $OPENAIR_DIR/cmake_targets/build_oai + -c -w USRP --eNB --noS1 + source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB + + $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 + -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 28 --phy-test + + + + + False + + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c --UE -w USRP --noS1 --eNB + source ./targets/bin/init_nas_nos1 UE + + sleep 50; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C2685004636. -r25 --ue-scan-carrier --ue-txgain 90 -A 20 --ue-rxgain 125 -S --phy-test -g 4 + + + + + + False + UE_USRP.NOS1.PHYTEST_PERF.BAND7.5MHZ.MCS28 + 36 + + + + + lte-softmodem-noS1 + + imb182-desktop + ued-PRM-130 + 300 + /tmp + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tracking_area_code \"1\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_country_code \"208\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_network_code \"95\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf N_RB_DL 25 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mme_ip_address "ipv4=\"192.168.12.26\";ipv6=\"192:168:30::17\";active=\"yes\";preference=\"ipv4\";" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf downlink_frequency 2685000000L + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf uplink_frequency_offset -120000000 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tx_gain 90 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf rx_gain 125 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf frame_type \"FDD\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_rx 1 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_tx 1 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1_MME \"eth5\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1_MME \"192.168.12.82/24\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1U \"eth5\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1U \"192.168.12.82/24\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_PORT_FOR_S1U 2152 + $OPENAIR_DIR/cmake_targets/build_oai + -c -w USRP --eNB --noS1 + source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB + + $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 + -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 28 --phy-test + + + + + False + + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c --UE -w EXMIMO --noS1 + source ./targets/bin/init_nas_nos1 UE + + sleep 50; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C 2685000000 -r25 --ue-scan-carrier --ue-txgain 0 --ue-rxgain 5 -S -A 6 -F myriadRF_FMX --ue-max-power -25 --phy-test -g 4 + + + + + + False + UE_UEDV1.NOS1.PHYTEST_PERF.BAND7.5MHZ.MCS28 + 36 + + + + + + lte-softmodem-noS1 + + imb182-desktop + yanbo-M4HM87P-00 + 18000 + /tmp + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tracking_area_code \"1\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_country_code \"208\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_network_code \"95\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf N_RB_DL 25 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mme_ip_address "ipv4=\"192.168.12.26\";ipv6=\"192:168:30::17\";active=\"yes\";preference=\"ipv4\";" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf downlink_frequency 2685000000L + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf uplink_frequency_offset -120000000 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tx_gain 90 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf rx_gain 125 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf frame_type \"FDD\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_rx 1 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_tx 1 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1_MME \"eth5\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1_MME \"192.168.12.82/24\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1U \"eth5\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1U \"192.168.12.82/24\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_PORT_FOR_S1U 2152 + $OPENAIR_DIR/cmake_targets/build_oai + -c -w USRP --eNB --noS1 + source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB + + $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 + -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 27 --phy-test + + + + + False + + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c --UE -w USRP --noS1 --eNB + source ./targets/bin/init_nas_nos1 UE + + sleep 50; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C2685004636. -r25 --ue-scan-carrier --ue-txgain 90 -A 20 --ue-rxgain 125 -S --phy-test -g 4 + + + + + + False + UE_USRP.NOS1.PHYTEST_STAB.BAND7.5MHZ.MCS27 + 36 + + + + + lte-softmodem-noS1 + + imb182-desktop + ued-PRM-130 + 300 + /tmp + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tracking_area_code \"1\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_country_code \"208\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_network_code \"95\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf N_RB_DL 25 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mme_ip_address "ipv4=\"192.168.12.26\";ipv6=\"192:168:30::17\";active=\"yes\";preference=\"ipv4\";" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf downlink_frequency 2685000000L + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf uplink_frequency_offset -120000000 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tx_gain 90 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf rx_gain 125 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf frame_type \"FDD\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_rx 1 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_tx 1 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1_MME \"eth5\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1_MME \"192.168.12.82/24\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1U \"eth5\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1U \"192.168.12.82/24\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_PORT_FOR_S1U 2152 + $OPENAIR_DIR/cmake_targets/build_oai + -c -w USRP --eNB --noS1 + source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB + + $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 + -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 27 --phy-test + + + + + False + + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c --UE -w EXMIMO --noS1 + source ./targets/bin/init_nas_nos1 UE + + sleep 50; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C 2685000000 -r25 --ue-scan-carrier --ue-txgain 0 --ue-rxgain 5 -S -A 6 -F myriadRF_FMX --ue-max-power -25 --phy-test -g 4 + + + + + + False + UE_UEDV1.NOS1.PHYTEST_STAB.BAND7.5MHZ.MCS27 + 36 + + + + + + lte-softmodem-noS1 + + imb182-desktop + yanbo-M4HM87P-00 + 300 + /tmp + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tracking_area_code \"1\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_country_code \"208\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_network_code \"95\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf N_RB_DL 50 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mme_ip_address "ipv4=\"192.168.12.26\";ipv6=\"192:168:30::17\";active=\"yes\";preference=\"ipv4\";" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf downlink_frequency 2685000000L + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf uplink_frequency_offset -120000000 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tx_gain 90 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf rx_gain 125 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf frame_type \"FDD\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_rx 1 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_tx 1 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1_MME \"eth5\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1_MME \"192.168.12.82/24\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1U \"eth5\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1U \"192.168.12.82/24\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_PORT_FOR_S1U 2152 + $OPENAIR_DIR/cmake_targets/build_oai + -c -w USRP --eNB --noS1 + source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB + + $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 + -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 27 --phy-test + + + + + False + + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c --UE -w USRP --noS1 --eNB + source ./targets/bin/init_nas_nos1 UE + + sleep 50; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C2685004636. -r50 --ue-scan-carrier --ue-txgain 90 -A 20 --ue-rxgain 125 -S --phy-test -g 4 + + + + + + False + UE_USRP.NOS1.PHYTEST_PERF.BAND7.10MHZ.MCS27 + 36 + + + + + lte-softmodem-noS1 + + imb182-desktop + ued-PRM-130 + 300 + /tmp + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tracking_area_code \"1\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_country_code \"208\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_network_code \"95\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf N_RB_DL 50 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mme_ip_address "ipv4=\"192.168.12.26\";ipv6=\"192:168:30::17\";active=\"yes\";preference=\"ipv4\";" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf downlink_frequency 2685000000L + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf uplink_frequency_offset -120000000 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tx_gain 90 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf rx_gain 125 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf frame_type \"FDD\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_rx 1 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_tx 1 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1_MME \"eth5\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1_MME \"192.168.12.82/24\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1U \"eth5\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1U \"192.168.12.82/24\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_PORT_FOR_S1U 2152 + $OPENAIR_DIR/cmake_targets/build_oai + -c -w USRP --eNB --noS1 + source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB + + $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 + -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 27 --phy-test + + + + + False + + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c --UE -w EXMIMO --noS1 + source ./targets/bin/init_nas_nos1 UE + + sleep 50; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C 2685000000 -r50 --ue-scan-carrier --ue-txgain 0 --ue-rxgain 5 -S -A 6 -F myriadRF_FMX --ue-max-power -25 --phy-test -g 4 + + + + + + False + UE_UEDV1.NOS1.PHYTEST_PERF.BAND7.10MHZ.MCS27 + 36 + + + + + + lte-softmodem-noS1 + + imb182-desktop + yanbo-M4HM87P-00 + 300 + /tmp + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tracking_area_code \"1\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_country_code \"208\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_network_code \"95\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf N_RB_DL 50 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mme_ip_address "ipv4=\"192.168.12.26\";ipv6=\"192:168:30::17\";active=\"yes\";preference=\"ipv4\";" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf downlink_frequency 2685000000L + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf uplink_frequency_offset -120000000 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tx_gain 90 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf rx_gain 125 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf frame_type \"FDD\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_rx 1 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_tx 1 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1_MME \"eth5\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1_MME \"192.168.12.82/24\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1U \"eth5\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1U \"192.168.12.82/24\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_PORT_FOR_S1U 2152 + $OPENAIR_DIR/cmake_targets/build_oai + -c -w USRP --eNB --noS1 + source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB + + $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 + -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 28 --phy-test + + + + + False + + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c --UE -w USRP --noS1 --eNB + source ./targets/bin/init_nas_nos1 UE + + sleep 50; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C2685004636. -r50 --ue-scan-carrier --ue-txgain 90 -A 20 --ue-rxgain 125 -S --phy-test -g 4 + + + + + + False + UE_USRP.NOS1.PHYTEST_PERF.BAND7.10MHZ.MCS28 + 36 + + + + + + + lte-softmodem-noS1 + + imb182-desktop + ued-PRM-130 + 300 + /tmp + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tracking_area_code \"1\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_country_code \"208\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_network_code \"95\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf N_RB_DL 50 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mme_ip_address "ipv4=\"192.168.12.26\";ipv6=\"192:168:30::17\";active=\"yes\";preference=\"ipv4\";" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf downlink_frequency 2685000000L + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf uplink_frequency_offset -120000000 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tx_gain 90 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf rx_gain 125 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf frame_type \"FDD\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_rx 1 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_tx 1 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1_MME \"eth5\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1_MME \"192.168.12.82/24\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1U \"eth5\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1U \"192.168.12.82/24\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_PORT_FOR_S1U 2152 + $OPENAIR_DIR/cmake_targets/build_oai + -c -w USRP --eNB --noS1 + source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB + + $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 + -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 19 --phy-test + + + + + False + + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c --UE -w EXMIMO --noS1 + source ./targets/bin/init_nas_nos1 UE + + sleep 50; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C 2685000000 -r50 --ue-scan-carrier --ue-txgain 0 --ue-rxgain 5 -S -A 6 -F myriadRF_FMX --ue-max-power -25 --phy-test -g 4 + + + + + + False + UE_UEDV1.NOS1.PHYTEST_PERF.BAND7.10MHZ.MCS19 + 36 + + + + + + lte-softmodem-noS1 + + imb182-desktop + yanbo-M4HM87P-00 + 300 + /tmp + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tracking_area_code \"1\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_country_code \"208\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_network_code \"95\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf N_RB_DL 25 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mme_ip_address "ipv4=\"192.168.12.26\";ipv6=\"192:168:30::17\";active=\"yes\";preference=\"ipv4\";" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf downlink_frequency 2685000000L + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf uplink_frequency_offset -120000000 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tx_gain 90 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf rx_gain 125 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf frame_type \"FDD\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_rx 1 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_tx 1 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1_MME \"eth5\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1_MME \"192.168.12.82/24\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1U \"eth5\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1U \"192.168.12.82/24\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_PORT_FOR_S1U 2152 + $OPENAIR_DIR/cmake_targets/build_oai + -c -w USRP --eNB --noS1 + source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB + + $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 + -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 0 + sleep 80;iperf -c 10.0.1.9 -i 1 -u -b 512K + + + + False + + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c --UE -w USRP --noS1 --eNB + source ./targets/bin/init_nas_nos1 UE + + sleep 50; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C2685004636 -r25 --ue-scan-carrier --ue-txgain 90 -A 20 --ue-rxgain 125 -S -g 4 + + iperf -s -i 1 -u + + 200 + + False + UE_USRP.NOS1.DATA_IPERF.BAND7.5MHZ.MCS00 + 36 + + + + + lte-softmodem-noS1 + + imb182-desktop + ued-PRM-130 + 300 + /tmp + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tracking_area_code \"1\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_country_code \"208\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_network_code \"95\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf N_RB_DL 25 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mme_ip_address "ipv4=\"192.168.12.26\";ipv6=\"192:168:30::17\";active=\"yes\";preference=\"ipv4\";" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf downlink_frequency 2685000000L + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf uplink_frequency_offset -120000000 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tx_gain 90 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf rx_gain 125 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf frame_type \"FDD\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_rx 1 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_tx 1 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1_MME \"eth5\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1_MME \"192.168.12.82/24\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1U \"eth5\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1U \"192.168.12.82/24\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_PORT_FOR_S1U 2152 + $OPENAIR_DIR/cmake_targets/build_oai + -c -w USRP --eNB --noS1 + source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB + + $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 + -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 0 + sleep 80;iperf -c 10.0.1.9 -i 1 -u -b 512K + + + + False + + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c --UE -w EXMIMO --noS1 + source ./targets/bin/init_nas_nos1 UE + + sleep 50; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C 2685000000 -r25 --ue-scan-carrier --ue-txgain 15 --ue-rxgain 5 -S -A 6 -F myriadRF_FMX --ue-max-power -25 -g 4 + + iperf -s -i 1 -u + + 200 + + False + UE_UEDV1.NOS1.DATA_IPERF.BAND7.5MHZ.MCS00 + 36 + + + + lte-softmodem-noS1 + + imb182-desktop + yanbo-M4HM87P-00 + 300 + /tmp + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tracking_area_code \"1\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_country_code \"208\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_network_code \"95\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf N_RB_DL 25 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mme_ip_address "ipv4=\"192.168.12.26\";ipv6=\"192:168:30::17\";active=\"yes\";preference=\"ipv4\";" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf downlink_frequency 2685000000L + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf uplink_frequency_offset -120000000 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tx_gain 90 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf rx_gain 125 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf frame_type \"FDD\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_rx 1 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_tx 1 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1_MME \"eth5\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1_MME \"192.168.12.82/24\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1U \"eth5\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1U \"192.168.12.82/24\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_PORT_FOR_S1U 2152 + $OPENAIR_DIR/cmake_targets/build_oai + -c -w USRP --eNB --noS1 + source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB + + $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 + -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 9 + sleep 80;iperf -c 10.0.1.9 -i 1 -u -b 2M + + + + False + + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c --UE -w USRP --noS1 --eNB + source ./targets/bin/init_nas_nos1 UE + + sleep 50; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C2685004636 -r25 --ue-scan-carrier --ue-txgain 90 -A 20 --ue-rxgain 125 -S -g 4 + + iperf -s -i 1 -u + + 200 + + False + UE_USRP.NOS1.DATA_IPERF.BAND7.5MHZ.MCS09 + 36 + + + + + lte-softmodem-noS1 + + imb182-desktop + ued-PRM-130 + 300 + /tmp + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tracking_area_code \"1\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_country_code \"208\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_network_code \"95\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf N_RB_DL 25 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mme_ip_address "ipv4=\"192.168.12.26\";ipv6=\"192:168:30::17\";active=\"yes\";preference=\"ipv4\";" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf downlink_frequency 2685000000L + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf uplink_frequency_offset -120000000 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tx_gain 90 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf rx_gain 125 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf frame_type \"FDD\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_rx 1 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_tx 1 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1_MME \"eth5\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1_MME \"192.168.12.82/24\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1U \"eth5\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1U \"192.168.12.82/24\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_PORT_FOR_S1U 2152 + $OPENAIR_DIR/cmake_targets/build_oai + -c -w USRP --eNB --noS1 + source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB + + $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 + -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 9 + sleep 80;iperf -c 10.0.1.9 -i 1 -u -b 2M + + + + False + + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c --UE -w EXMIMO --noS1 + source ./targets/bin/init_nas_nos1 UE + + sleep 50; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C 2685000000 -r25 --ue-scan-carrier --ue-txgain 15 --ue-rxgain 5 -S -A 6 -F myriadRF_FMX --ue-max-power -25 -g 4 + + iperf -s -i 1 -u + + 200 + + False + UE_UEDV1.NOS1.DATA_IPERF.BAND7.5MHZ.MCS09 + 36 + + + + + lte-softmodem-noS1 + + imb182-desktop + yanbo-M4HM87P-00 + 300 + /tmp + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tracking_area_code \"1\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_country_code \"208\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_network_code \"95\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf N_RB_DL 25 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mme_ip_address "ipv4=\"192.168.12.26\";ipv6=\"192:168:30::17\";active=\"yes\";preference=\"ipv4\";" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf downlink_frequency 2685000000L + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf uplink_frequency_offset -120000000 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tx_gain 90 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf rx_gain 125 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf frame_type \"FDD\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_rx 1 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_tx 1 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1_MME \"eth5\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1_MME \"192.168.12.82/24\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1U \"eth5\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1U \"192.168.12.82/24\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_PORT_FOR_S1U 2152 + $OPENAIR_DIR/cmake_targets/build_oai + -c -w USRP --eNB --noS1 + source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB + + $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 + -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 10 + sleep 80;iperf -c 10.0.1.9 -i 1 -u -b 2M + + + + False + + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c --UE -w USRP --noS1 --eNB + source ./targets/bin/init_nas_nos1 UE + + sleep 50; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C2685004636 -r25 --ue-scan-carrier --ue-txgain 90 -A 20 --ue-rxgain 125 -S -g 4 + + iperf -s -i 1 -u + + 200 + + False + UE_USRP.NOS1.DATA_IPERF.BAND7.5MHZ.MCS10 + 36 + + + + + lte-softmodem-noS1 + + imb182-desktop + ued-PRM-130 + 300 + /tmp + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tracking_area_code \"1\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_country_code \"208\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_network_code \"95\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf N_RB_DL 25 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mme_ip_address "ipv4=\"192.168.12.26\";ipv6=\"192:168:30::17\";active=\"yes\";preference=\"ipv4\";" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf downlink_frequency 2685000000L + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf uplink_frequency_offset -120000000 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tx_gain 90 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf rx_gain 125 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf frame_type \"FDD\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_rx 1 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_tx 1 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1_MME \"eth5\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1_MME \"192.168.12.82/24\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1U \"eth5\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1U \"192.168.12.82/24\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_PORT_FOR_S1U 2152 + $OPENAIR_DIR/cmake_targets/build_oai + -c -w USRP --eNB --noS1 + source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB + + $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 + -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 10 + sleep 80;iperf -c 10.0.1.9 -i 1 -u -b 2M + + + + False + + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c --UE -w EXMIMO --noS1 + source ./targets/bin/init_nas_nos1 UE + + sleep 50; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C 2685000000 -r25 --ue-scan-carrier --ue-txgain 15 --ue-rxgain 5 -S -A 6 -F myriadRF_FMX --ue-max-power -25 -g 4 + + iperf -s -i 1 -u + + 200 + + False + UE_UEDV1.NOS1.DATA_IPERF.BAND7.5MHZ.MCS10 + 36 + + + + + + lte-softmodem-noS1 + + imb182-desktop + yanbo-M4HM87P-00 + 300 + /tmp + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tracking_area_code \"1\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_country_code \"208\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_network_code \"95\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf N_RB_DL 25 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mme_ip_address "ipv4=\"192.168.12.26\";ipv6=\"192:168:30::17\";active=\"yes\";preference=\"ipv4\";" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf downlink_frequency 2685000000L + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf uplink_frequency_offset -120000000 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tx_gain 90 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf rx_gain 125 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf frame_type \"FDD\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_rx 1 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_tx 1 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1_MME \"eth5\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1_MME \"192.168.12.82/24\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1U \"eth5\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1U \"192.168.12.82/24\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_PORT_FOR_S1U 2152 + $OPENAIR_DIR/cmake_targets/build_oai + -c -w USRP --eNB --noS1 + source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB + + $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 + -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 16 + sleep 80;iperf -c 10.0.1.9 -i 1 -u -b 2M + + + + False + + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c --UE -w USRP --noS1 --eNB + source ./targets/bin/init_nas_nos1 UE + + sleep 50; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C2685004636 -r25 --ue-scan-carrier --ue-txgain 90 -A 20 --ue-rxgain 125 -S -g 4 + + iperf -s -i 1 -u + + 200 + + False + UE_USRP.NOS1.DATA_IPERF.BAND7.5MHZ.MCS16 + 36 + + + + + lte-softmodem-noS1 + + imb182-desktop + ued-PRM-130 + 300 + /tmp + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tracking_area_code \"1\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_country_code \"208\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_network_code \"95\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf N_RB_DL 25 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mme_ip_address "ipv4=\"192.168.12.26\";ipv6=\"192:168:30::17\";active=\"yes\";preference=\"ipv4\";" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf downlink_frequency 2685000000L + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf uplink_frequency_offset -120000000 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tx_gain 90 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf rx_gain 125 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf frame_type \"FDD\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_rx 1 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_tx 1 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1_MME \"eth5\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1_MME \"192.168.12.82/24\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1U \"eth5\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1U \"192.168.12.82/24\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_PORT_FOR_S1U 2152 + $OPENAIR_DIR/cmake_targets/build_oai + -c -w USRP --eNB --noS1 + source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB + + $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 + -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 16 + sleep 80;iperf -c 10.0.1.9 -i 1 -u -b 2M + + + + False + + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c --UE -w EXMIMO --noS1 + source ./targets/bin/init_nas_nos1 UE + + sleep 50; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C 2685000000 -r25 --ue-scan-carrier --ue-txgain 15 --ue-rxgain 5 -S -A 6 -F myriadRF_FMX --ue-max-power -25 -g 4 + + iperf -s -i 1 -u + + 200 + + False + UE_UEDV1.NOS1.DATA_IPERF.BAND7.5MHZ.MCS16 + 36 + + + + + + lte-softmodem-noS1 + + imb182-desktop + yanbo-M4HM87P-00 + 300 + /tmp + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tracking_area_code \"1\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_country_code \"208\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_network_code \"95\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf N_RB_DL 25 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mme_ip_address "ipv4=\"192.168.12.26\";ipv6=\"192:168:30::17\";active=\"yes\";preference=\"ipv4\";" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf downlink_frequency 2685000000L + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf uplink_frequency_offset -120000000 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tx_gain 90 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf rx_gain 125 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf frame_type \"FDD\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_rx 1 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_tx 1 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1_MME \"eth5\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1_MME \"192.168.12.82/24\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1U \"eth5\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1U \"192.168.12.82/24\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_PORT_FOR_S1U 2152 + $OPENAIR_DIR/cmake_targets/build_oai + -c -w USRP --eNB --noS1 + source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB + + $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 + -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 17 + sleep 80;iperf -c 10.0.1.9 -i 1 -u -b 2M + + + + False + + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c --UE -w USRP --noS1 --eNB + source ./targets/bin/init_nas_nos1 UE + + sleep 50; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C2685004636 -r25 --ue-scan-carrier --ue-txgain 90 -A 20 --ue-rxgain 125 -S -g 4 + + iperf -s -i 1 -u + + 200 + + False + UE_USRP.NOS1.DATA_IPERF.BAND7.5MHZ.MCS17 + 36 + + + + + lte-softmodem-noS1 + + imb182-desktop + ued-PRM-130 + 300 + /tmp + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tracking_area_code \"1\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_country_code \"208\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_network_code \"95\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf N_RB_DL 25 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mme_ip_address "ipv4=\"192.168.12.26\";ipv6=\"192:168:30::17\";active=\"yes\";preference=\"ipv4\";" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf downlink_frequency 2685000000L + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf uplink_frequency_offset -120000000 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tx_gain 90 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf rx_gain 125 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf frame_type \"FDD\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_rx 1 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_tx 1 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1_MME \"eth5\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1_MME \"192.168.12.82/24\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1U \"eth5\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1U \"192.168.12.82/24\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_PORT_FOR_S1U 2152 + $OPENAIR_DIR/cmake_targets/build_oai + -c -w USRP --eNB --noS1 + source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB + + $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 + -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 17 + sleep 80;iperf -c 10.0.1.9 -i 1 -u -b 2M + + + + False + + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c --UE -w EXMIMO --noS1 + source ./targets/bin/init_nas_nos1 UE + + sleep 50; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C 2685000000 -r25 --ue-scan-carrier --ue-txgain 15 --ue-rxgain 5 -S -A 6 -F myriadRF_FMX --ue-max-power -25 -g 4 + + iperf -s -i 1 -u + + 200 + + False + UE_UEDV1.NOS1.DATA_IPERF.BAND7.5MHZ.MCS17 + 36 + + + + + + + + lte-softmodem-noS1 + + imb182-desktop + yanbo-M4HM87P-00 + 300 + /tmp + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tracking_area_code \"1\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_country_code \"208\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_network_code \"95\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf N_RB_DL 25 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mme_ip_address "ipv4=\"192.168.12.26\";ipv6=\"192:168:30::17\";active=\"yes\";preference=\"ipv4\";" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf downlink_frequency 2685000000L + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf uplink_frequency_offset -120000000 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tx_gain 90 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf rx_gain 125 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf frame_type \"FDD\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_rx 1 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_tx 1 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1_MME \"eth5\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1_MME \"192.168.12.82/24\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1U \"eth5\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1U \"192.168.12.82/24\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_PORT_FOR_S1U 2152 + $OPENAIR_DIR/cmake_targets/build_oai + -c -w USRP --eNB --noS1 + source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB + + $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 + -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 19 + sleep 80;iperf -c 10.0.1.9 -i 1 -u -b 2M + + + + False + + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c --UE -w USRP --noS1 --eNB + source ./targets/bin/init_nas_nos1 UE + + sleep 50; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C2685004636 -r25 --ue-scan-carrier --ue-txgain 90 -A 20 --ue-rxgain 125 -S -g 4 + + iperf -s -i 1 -u + + 200 + + False + UE_USRP.NOS1.DATA_IPERF.BAND7.5MHZ.MCS19 + 36 + + + + + lte-softmodem-noS1 + + imb182-desktop + ued-PRM-130 + 300 + /tmp + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tracking_area_code \"1\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_country_code \"208\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_network_code \"95\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf N_RB_DL 25 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mme_ip_address "ipv4=\"192.168.12.26\";ipv6=\"192:168:30::17\";active=\"yes\";preference=\"ipv4\";" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf downlink_frequency 2685000000L + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf uplink_frequency_offset -120000000 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tx_gain 90 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf rx_gain 125 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf frame_type \"FDD\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_rx 1 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_tx 1 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1_MME \"eth5\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1_MME \"192.168.12.82/24\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1U \"eth5\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1U \"192.168.12.82/24\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_PORT_FOR_S1U 2152 + $OPENAIR_DIR/cmake_targets/build_oai + -c -w USRP --eNB --noS1 + source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB + + $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 + -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 19 + sleep 80;iperf -c 10.0.1.9 -i 1 -u -b 2M + + + + False + + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c --UE -w EXMIMO --noS1 + source ./targets/bin/init_nas_nos1 UE + + sleep 50; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C 2685000000 -r25 --ue-scan-carrier --ue-txgain 15 --ue-rxgain 5 -S -A 6 -F myriadRF_FMX --ue-max-power -25 -g 4 + + iperf -s -i 1 -u + + 200 + + False + UE_UEDV1.NOS1.DATA_IPERF.BAND7.5MHZ.MCS19 + 36 + + + + + lte-softmodem-noS1 + + imb182-desktop + yanbo-M4HM87P-00 + 300 + /tmp + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tracking_area_code \"1\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_country_code \"208\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_network_code \"95\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf N_RB_DL 25 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mme_ip_address "ipv4=\"192.168.12.26\";ipv6=\"192:168:30::17\";active=\"yes\";preference=\"ipv4\";" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf downlink_frequency 2685000000L + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf uplink_frequency_offset -120000000 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tx_gain 90 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf rx_gain 125 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf frame_type \"FDD\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_rx 1 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_tx 1 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1_MME \"eth5\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1_MME \"192.168.12.82/24\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1U \"eth5\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1U \"192.168.12.82/24\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_PORT_FOR_S1U 2152 + $OPENAIR_DIR/cmake_targets/build_oai + -c -w USRP --eNB --noS1 + source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB + + $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 + -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 27 + sleep 80;iperf -c 10.0.1.9 -i 1 -u -b 2M + + + + False + + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c --UE -w USRP --noS1 --eNB + source ./targets/bin/init_nas_nos1 UE + + sleep 50; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C2685004636 -r25 --ue-scan-carrier --ue-txgain 90 -A 20 --ue-rxgain 125 -S -g 4 + + iperf -s -i 1 -u + + 200 + + False + UE_USRP.NOS1.DATA_IPERF.BAND7.5MHZ.MCS27 + 36 + + + + + lte-softmodem-noS1 + + imb182-desktop + yanbo-M4HM87P-00 + 3600 + /tmp + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tracking_area_code \"1\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_country_code \"208\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_network_code \"95\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf N_RB_DL 25 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mme_ip_address "ipv4=\"192.168.12.26\";ipv6=\"192:168:30::17\";active=\"yes\";preference=\"ipv4\";" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf downlink_frequency 2685000000L + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf uplink_frequency_offset -120000000 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tx_gain 90 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf rx_gain 125 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf frame_type \"FDD\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_rx 1 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_tx 1 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1_MME \"eth5\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1_MME \"192.168.12.82/24\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1U \"eth5\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1U \"192.168.12.82/24\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_PORT_FOR_S1U 2152 + $OPENAIR_DIR/cmake_targets/build_oai + -c -w USRP --eNB --noS1 + source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB + + $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 + -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 27 + sleep 80;iperf -c 10.0.1.9 -i 1 -u -b 2M + + + + False + + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c --UE -w USRP --noS1 --eNB + source ./targets/bin/init_nas_nos1 UE + + sleep 50; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C2685004636 -r25 --ue-scan-carrier --ue-txgain 90 -A 20 --ue-rxgain 125 -S -g 4 + + iperf -s -i 1 -u + + 2800 + + False + UE_USRP.NOS1.DATA_IPERF_STAB.BAND7.5MHZ.MCS27 + 16 + + + + + lte-softmodem-noS1 + + imb182-desktop + ued-PRM-130 + 300 + /tmp + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tracking_area_code \"1\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_country_code \"208\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_network_code \"95\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf N_RB_DL 25 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mme_ip_address "ipv4=\"192.168.12.26\";ipv6=\"192:168:30::17\";active=\"yes\";preference=\"ipv4\";" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf downlink_frequency 2685000000L + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf uplink_frequency_offset -120000000 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tx_gain 90 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf rx_gain 125 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf frame_type \"FDD\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_rx 1 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_tx 1 + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1_MME \"eth5\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1_MME \"192.168.12.82/24\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1U \"eth5\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1U \"192.168.12.82/24\" + targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_PORT_FOR_S1U 2152 + $OPENAIR_DIR/cmake_targets/build_oai + -c -w USRP --eNB --noS1 + source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB + + $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 + -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 27 + sleep 80;iperf -c 10.0.1.9 -i 1 -u -b 2M + + + + False + + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c --UE -w EXMIMO --noS1 + source ./targets/bin/init_nas_nos1 UE + + sleep 50; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C 2685000000 -r25 --ue-scan-carrier --ue-txgain 15 --ue-rxgain 5 -S -A 6 -F myriadRF_FMX --ue-max-power -25 -g 4 + + iperf -s -i 1 -u + + 200 + + False + UE_UEDV1.NOS1.DATA_IPERF.BAND7.5MHZ.MCS27 + 36 + + + From 0277475bef1d06cc8926a7d7ec740fff70823c2b Mon Sep 17 00:00:00 2001 From: ROBERT Benoit Date: Tue, 25 Oct 2016 17:47:58 +0200 Subject: [PATCH 244/349] during 'harmony' developments initialisation of some --phy-test parameters were removed --- targets/RT/USER/lte-softmodem.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/targets/RT/USER/lte-softmodem.c b/targets/RT/USER/lte-softmodem.c index 117beb68d7..1692c2164f 100644 --- a/targets/RT/USER/lte-softmodem.c +++ b/targets/RT/USER/lte-softmodem.c @@ -1608,6 +1608,11 @@ int main( int argc, char **argv ) PHY_vars_eNB_g[0][CC_id] = init_lte_eNB(frame_parms[CC_id],0,frame_parms[CC_id]->Nid_cell,abstraction_flag); PHY_vars_eNB_g[0][CC_id]->CC_id = CC_id; + PHY_vars_eNB_g[0][CC_id]->ue_dl_rb_alloc=0x1fff; + PHY_vars_eNB_g[0][CC_id]->target_ue_dl_mcs=target_dl_mcs; + PHY_vars_eNB_g[0][CC_id]->ue_ul_nb_rb=6; + PHY_vars_eNB_g[0][CC_id]->target_ue_ul_mcs=target_ul_mcs; + if (phy_test==1) PHY_vars_eNB_g[0][CC_id]->mac_enabled = 0; else PHY_vars_eNB_g[0][CC_id]->mac_enabled = 1; From 2ace4029f37a323c0238cd0bfd87b2b4cdf1b226 Mon Sep 17 00:00:00 2001 From: ROBERT Benoit Date: Tue, 25 Oct 2016 18:09:59 +0200 Subject: [PATCH 245/349] Update 3gpplte_turbo_decoder_sse_8bit.c maximum frame length is 6144 --- openair1/PHY/CODING/3gpplte_turbo_decoder_sse_8bit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openair1/PHY/CODING/3gpplte_turbo_decoder_sse_8bit.c b/openair1/PHY/CODING/3gpplte_turbo_decoder_sse_8bit.c index b56aae4598..1343aee07c 100644 --- a/openair1/PHY/CODING/3gpplte_turbo_decoder_sse_8bit.c +++ b/openair1/PHY/CODING/3gpplte_turbo_decoder_sse_8bit.c @@ -486,7 +486,7 @@ void compute_beta8(llr_t* alpha,llr_t* beta,llr_t *m_11,llr_t* m_10,unsigned sho #endif - if (frame_length > 6143) { + if (frame_length > 6144) { LOG_E(PHY,"compute_beta: frame_length %d\n",frame_length); return; } From 7e6a74d5be20128ab47cc9bfc8a1fd647b7e83d4 Mon Sep 17 00:00:00 2001 From: calvin wang Date: Wed, 26 Oct 2016 13:21:26 +0800 Subject: [PATCH 246/349] change debug info --- openair2/LAYER2/MAC/ue_procedures.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/openair2/LAYER2/MAC/ue_procedures.c b/openair2/LAYER2/MAC/ue_procedures.c index 97b7e433c4..8773186382 100644 --- a/openair2/LAYER2/MAC/ue_procedures.c +++ b/openair2/LAYER2/MAC/ue_procedures.c @@ -1422,6 +1422,12 @@ void ue_get_sdu(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_t subf bsr_l->Buffer_size2 = UE_mac_inst[module_idP].scheduling_info.BSR[LCGID2]; bsr_l->Buffer_size3 = UE_mac_inst[module_idP].scheduling_info.BSR[LCGID3]; + LOG_D(MAC, "[UE %d] Frame %d report long BSR (level LCGID0 %d,level LCGID1 %d,level LCGID2 %d,level LCGID3 %d)\n", module_idP,frameP, + UE_mac_inst[module_idP].scheduling_info.BSR[LCGID0], + UE_mac_inst[module_idP].scheduling_info.BSR[LCGID1], + UE_mac_inst[module_idP].scheduling_info.BSR[LCGID2], + UE_mac_inst[module_idP].scheduling_info.BSR[LCGID3]); + UE_mac_inst[module_idP].scheduling_info.BSR_bytes[LCGID0] = 0; UE_mac_inst[module_idP].scheduling_info.BSR_bytes[LCGID1] = 0; UE_mac_inst[module_idP].scheduling_info.BSR_bytes[LCGID2] = 0; @@ -1430,12 +1436,6 @@ void ue_get_sdu(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_t subf UE_mac_inst[module_idP].scheduling_info.BSR[LCGID1] = 0; UE_mac_inst[module_idP].scheduling_info.BSR[LCGID2] = 0; UE_mac_inst[module_idP].scheduling_info.BSR[LCGID3] = 0; - - LOG_D(MAC, "[UE %d] Frame %d report long BSR (level LCGID0 %d,level LCGID1 %d,level LCGID2 %d,level LCGID3 %d)\n", module_idP,frameP, - UE_mac_inst[module_idP].scheduling_info.BSR[LCGID0], - UE_mac_inst[module_idP].scheduling_info.BSR[LCGID1], - UE_mac_inst[module_idP].scheduling_info.BSR[LCGID2], - UE_mac_inst[module_idP].scheduling_info.BSR[LCGID3]); } else if (bsr_ce_len == sizeof(BSR_SHORT)) { bsr_l = NULL; bsr_s->LCGID = lcgid; From 6644204765a129610a4b8ec035c5ff90250d077c Mon Sep 17 00:00:00 2001 From: calvin wang Date: Thu, 27 Oct 2016 11:47:17 +0800 Subject: [PATCH 247/349] add BSR trigger code for interoperability test --- openair2/LAYER2/MAC/defs.h | 4 ++++ openair2/LAYER2/MAC/ue_procedures.c | 17 +++++++++++++++-- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/openair2/LAYER2/MAC/defs.h b/openair2/LAYER2/MAC/defs.h index e3be4bad6d..d38ca05362 100644 --- a/openair2/LAYER2/MAC/defs.h +++ b/openair2/LAYER2/MAC/defs.h @@ -947,6 +947,10 @@ typedef struct { uint8_t BSR[MAX_NUM_LCGID]; // should be more for mesh topology /// keep the number of bytes in rlc buffer for each lcgid uint16_t BSR_bytes[MAX_NUM_LCGID]; +#if 0 //calvin for BSR test,current buffer greater then previous one, or buffer from 0 to !0 + /// after multiplexing buffer remain for each lcid + uint16_t LCID_buffer_remain[MAX_NUM_LCID]; +#endif /// buffer status for each lcid uint8_t LCID_status[MAX_NUM_LCID]; /// SR pending as defined in 36.321 diff --git a/openair2/LAYER2/MAC/ue_procedures.c b/openair2/LAYER2/MAC/ue_procedures.c index 082b61445f..c24702b3b5 100644 --- a/openair2/LAYER2/MAC/ue_procedures.c +++ b/openair2/LAYER2/MAC/ue_procedures.c @@ -1356,6 +1356,9 @@ void ue_get_sdu(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_t subf //update_bsr(module_idP, frameP, eNB_index, DCCH, UE_mac_inst[module_idP].scheduling_info.LCGID[DCCH]); //header_len +=2; UE_mac_inst[module_idP].scheduling_info.LCID_status[DCCH] = LCID_EMPTY; +#if 0 //calvin for BSR test,current buffer greater then previous one, or buffer from 0 to !0 + UE_mac_inst[module_idP].scheduling_info.LCID_buffer_remain[DCCH] = rlc_status.bytes_in_buffer-sdu_lengths[0]; +#endif } else { dcch_header_len=0; num_sdus = 0; @@ -1391,10 +1394,13 @@ void ue_get_sdu(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_t subf sdu_length_total += sdu_lengths[num_sdus]; sdu_lcids[num_sdus] = DCCH1; LOG_D(MAC,"[UE %d] TX Got %d bytes for DCCH1\n",module_idP,sdu_lengths[num_sdus]); - num_sdus++; //update_bsr(module_idP, frameP, DCCH1); //dcch_header_len +=2; // include dcch1 UE_mac_inst[module_idP].scheduling_info.LCID_status[DCCH1] = LCID_EMPTY; +#if 0 //calvin for BSR test,current buffer greater then previous one, or buffer from 0 to !0 + UE_mac_inst[module_idP].scheduling_info.LCID_buffer_remain[DCCH1] = rlc_status.bytes_in_buffer-sdu_lengths[num_sdus]; +#endif + num_sdus++; } else { dcch1_header_len =0; } @@ -1449,6 +1455,9 @@ void ue_get_sdu(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_t subf dtch_header_len --; dtch_header_len_last --; } +#if 0 //calvin for BSR test,current buffer greater then previous one, or buffer from 0 to !0 + UE_mac_inst[module_idP].scheduling_info.LCID_buffer_remain[lcid] = rlc_status.bytes_in_buffer-sdu_lengths[num_sdus]; +#endif num_sdus++; //UE_mac_inst[module_idP].ul_active = update_bsr(module_idP, frameP, eNB_index,lcid, UE_mac_inst[module_idP].scheduling_info.LCGID[lcid]); } else { @@ -2077,7 +2086,11 @@ boolean_t update_bsr(module_id_t module_idP, frame_t frameP, eNB_index_t eNB_in lcid, 0); - if (rlc_status.bytes_in_buffer > 0 ) { + if ((rlc_status.bytes_in_buffer > 0 ) +#if 0 //calvin for BSR test,current buffer greater then previous one, or buffer from 0 to !0 + && (rlc_status.bytes_in_buffer > UE_mac_inst[module_idP].scheduling_info.LCID_buffer_remain[lcid]) +#endif + ){ //BSR trigger SR sr_pending = TRUE; UE_mac_inst[module_idP].scheduling_info.LCID_status[lcid] = LCID_NOT_EMPTY; From 4eb3774a743dc17c1d746f21de0290bb0553c22b Mon Sep 17 00:00:00 2001 From: hbilel Date: Fri, 28 Oct 2016 09:56:31 +0200 Subject: [PATCH 248/349] [OAI-UE] add featureGroup to UeCapability (only for usim test mode) --- openair2/RRC/LITE/MESSAGES/asn1_msg.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/openair2/RRC/LITE/MESSAGES/asn1_msg.c b/openair2/RRC/LITE/MESSAGES/asn1_msg.c index fb8f2a426f..d212415461 100644 --- a/openair2/RRC/LITE/MESSAGES/asn1_msg.c +++ b/openair2/RRC/LITE/MESSAGES/asn1_msg.c @@ -2663,6 +2663,21 @@ OAI_UECapability_t *fill_ue_capability(char *UE_EUTRA_Capability_xer_fname) // UE_EUTRA_Capability->measParameters.bandListEUTRA.list.count = 0; // no measurements on other bands // UE_EUTRA_Capability->featureGroupIndicators // null + + // featureGroup is mandatory for CMW tests + // featureGroup is filled only for usim-test mode + BIT_STRING_t *bit_string; + uint32_t featrG; + bit_string = CALLOC(1, sizeof(*bit_string)); + featrG = 0x04000800; + if(usim_test == 0) + { + bit_string->buf = &featrG; + bit_string->size = 4; + bit_string->bits_unused = 0; + UE_EUTRA_Capability->featureGroupIndicators = bit_string; + } + // UE_EUTRA_Capability->interRAT_Parameters // null } else { From 81837312cb54fcab47fdb0952728f9c063985c33 Mon Sep 17 00:00:00 2001 From: hbilel Date: Thu, 3 Nov 2016 15:29:33 +0100 Subject: [PATCH 249/349] [OAI-UE] RRCConnectionReconf fixes 1- SRB2 fix 2- attach accept, support type of list 0 with number of element = 1 --- openair2/RRC/LITE/MESSAGES/asn1_msg.c | 2 +- openair2/RRC/LITE/rrc_UE.c | 242 ++++++++++++++++++++++++-- openair3/NAS/UE/EMM/SAP/emm_recv.c | 11 +- 3 files changed, 238 insertions(+), 17 deletions(-) diff --git a/openair2/RRC/LITE/MESSAGES/asn1_msg.c b/openair2/RRC/LITE/MESSAGES/asn1_msg.c index d212415461..7d2fc3a3d8 100644 --- a/openair2/RRC/LITE/MESSAGES/asn1_msg.c +++ b/openair2/RRC/LITE/MESSAGES/asn1_msg.c @@ -2670,7 +2670,7 @@ OAI_UECapability_t *fill_ue_capability(char *UE_EUTRA_Capability_xer_fname) uint32_t featrG; bit_string = CALLOC(1, sizeof(*bit_string)); featrG = 0x04000800; - if(usim_test == 0) + if(usim_test == 1) { bit_string->buf = &featrG; bit_string->size = 4; diff --git a/openair2/RRC/LITE/rrc_UE.c b/openair2/RRC/LITE/rrc_UE.c index a41a664c18..1b22ae5d0b 100644 --- a/openair2/RRC/LITE/rrc_UE.c +++ b/openair2/RRC/LITE/rrc_UE.c @@ -817,6 +817,7 @@ rrc_ue_process_measConfig( } } + LOG_I(RRC,"call rrc_mac_config_req \n"); rrc_mac_config_req(ctxt_pP->module_id,0,ENB_FLAG_NO,0,eNB_index, (RadioResourceConfigCommonSIB_t *)NULL, (struct PhysicalConfigDedicated *)NULL, @@ -963,6 +964,199 @@ rrc_ue_process_measConfig( } } + +void +rrc_ue_update_radioResourceConfigDedicated(RadioResourceConfigDedicated_t* radioResourceConfigDedicated, + const protocol_ctxt_t* const ctxt_pP, + uint8_t eNB_index) +{ + PhysicalConfigDedicated_t* physicalConfigDedicated2 = NULL; + + physicalConfigDedicated2 = CALLOC(1,sizeof(*physicalConfigDedicated2)); + physicalConfigDedicated2->pdsch_ConfigDedicated = CALLOC(1,sizeof(*physicalConfigDedicated2->pdsch_ConfigDedicated)); + physicalConfigDedicated2->pusch_ConfigDedicated = CALLOC(1,sizeof(*physicalConfigDedicated2->pusch_ConfigDedicated)); + physicalConfigDedicated2->pucch_ConfigDedicated = CALLOC(1,sizeof(*physicalConfigDedicated2->pucch_ConfigDedicated)); + physicalConfigDedicated2->cqi_ReportConfig = CALLOC(1,sizeof(*physicalConfigDedicated2->cqi_ReportConfig)); + physicalConfigDedicated2->soundingRS_UL_ConfigDedicated = CALLOC(1,sizeof(*physicalConfigDedicated2->soundingRS_UL_ConfigDedicated)); + physicalConfigDedicated2->schedulingRequestConfig = CALLOC(1,sizeof(*physicalConfigDedicated2->schedulingRequestConfig)); + physicalConfigDedicated2->antennaInfo = CALLOC(1,sizeof(*physicalConfigDedicated2->antennaInfo)); + + physicalConfigDedicated2->uplinkPowerControlDedicated = CALLOC(1,sizeof(*physicalConfigDedicated2->uplinkPowerControlDedicated)); + physicalConfigDedicated2->tpc_PDCCH_ConfigPUSCH = CALLOC(1,sizeof(*physicalConfigDedicated2->tpc_PDCCH_ConfigPUSCH)); + physicalConfigDedicated2->tpc_PDCCH_ConfigPUCCH = CALLOC(1,sizeof(*physicalConfigDedicated2->tpc_PDCCH_ConfigPUCCH)); + + // Update pdsch_ConfigDedicated + if(radioResourceConfigDedicated->physicalConfigDedicated->pdsch_ConfigDedicated != NULL) + { + LOG_I(RRC,"Update pdsch_ConfigDedicated config \n"); + + if(UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->pdsch_ConfigDedicated == NULL) + UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->pdsch_ConfigDedicated = CALLOC(1,sizeof(PDSCH_ConfigDedicated_t)); + + memcpy((char*)UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->pdsch_ConfigDedicated, + (char*)radioResourceConfigDedicated->physicalConfigDedicated->pdsch_ConfigDedicated, + sizeof(physicalConfigDedicated2->pdsch_ConfigDedicated)); + } + else + { + LOG_I(RRC,"Keep old config for pdsch_ConfigDedicated\n"); + } + + // Update pusch_ConfigDedicated + if(radioResourceConfigDedicated->physicalConfigDedicated->pusch_ConfigDedicated != NULL) + { + LOG_I(RRC,"Update pusch_ConfigDedicated config \n"); + + if(UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->pusch_ConfigDedicated == NULL) + UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->pusch_ConfigDedicated = CALLOC(1,sizeof(PUSCH_ConfigDedicated_t)); + + memcpy((char*)UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->pusch_ConfigDedicated, + (char*)radioResourceConfigDedicated->physicalConfigDedicated->pusch_ConfigDedicated, + sizeof(physicalConfigDedicated2->pusch_ConfigDedicated)); + } + else + { + LOG_I(RRC,"Keep old config for pusch_ConfigDedicated\n"); + } + + // Update pucch_ConfigDedicated + if(radioResourceConfigDedicated->physicalConfigDedicated->pucch_ConfigDedicated != NULL) + { + LOG_I(RRC,"Update pucch_ConfigDedicated config \n"); + if(UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->pucch_ConfigDedicated == NULL) + UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->pucch_ConfigDedicated = CALLOC(1,sizeof(PUCCH_ConfigDedicated_t)); + + memcpy((char*)UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->pucch_ConfigDedicated, + (char*)radioResourceConfigDedicated->physicalConfigDedicated->pucch_ConfigDedicated, + sizeof(physicalConfigDedicated2->pucch_ConfigDedicated)); + } + else + { + LOG_I(RRC,"Keep old config for pucch_ConfigDedicated\n"); + } + + // Update cqi_ReportConfig + if(radioResourceConfigDedicated->physicalConfigDedicated->cqi_ReportConfig != NULL) + { + LOG_I(RRC,"Update cqi_ReportConfig config \n"); + + if(UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->cqi_ReportConfig == NULL) + UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->cqi_ReportConfig = CALLOC(1,sizeof(CQI_ReportConfig_t)); + + memcpy((char*)UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->cqi_ReportConfig, + (char*)radioResourceConfigDedicated->physicalConfigDedicated->cqi_ReportConfig, + sizeof(physicalConfigDedicated2->cqi_ReportConfig)); + } + else + { + LOG_I(RRC,"Keep old config for cqi_ReportConfig\n"); + } + + // Update schedulingRequestConfig + if(radioResourceConfigDedicated->physicalConfigDedicated->schedulingRequestConfig != NULL) + { + LOG_I(RRC,"Update schedulingRequestConfig config \n"); + + if(UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->schedulingRequestConfig == NULL) + UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->schedulingRequestConfig = CALLOC(1,sizeof(SchedulingRequestConfig_t)); + + memcpy((char*)UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->schedulingRequestConfig, + (char*)radioResourceConfigDedicated->physicalConfigDedicated->schedulingRequestConfig, + sizeof(physicalConfigDedicated2->schedulingRequestConfig)); + } + else + { + LOG_I(RRC,"Keep old config for schedulingRequestConfig\n"); + } + + // Update soundingRS_UL_ConfigDedicated + if(radioResourceConfigDedicated->physicalConfigDedicated->soundingRS_UL_ConfigDedicated != NULL) + { + LOG_I(RRC,"Update soundingRS_UL_ConfigDedicated config \n"); + + if(UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->soundingRS_UL_ConfigDedicated == NULL) + UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->soundingRS_UL_ConfigDedicated = CALLOC(1,sizeof(SoundingRS_UL_ConfigDedicated_t)); + + memcpy((char*)UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->soundingRS_UL_ConfigDedicated, + (char*)radioResourceConfigDedicated->physicalConfigDedicated->soundingRS_UL_ConfigDedicated, + sizeof(physicalConfigDedicated2->soundingRS_UL_ConfigDedicated)); + } + else + { + LOG_I(RRC,"Keep old config for soundingRS_UL_ConfigDedicated\n"); + } + + // Update antennaInfo + if(radioResourceConfigDedicated->physicalConfigDedicated->antennaInfo != NULL) + { + LOG_I(RRC,"Update antennaInfo config \n"); + + if(UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->antennaInfo == NULL) + UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->antennaInfo = CALLOC(1,sizeof(struct PhysicalConfigDedicated__antennaInfo)); + + memcpy((char*)UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->antennaInfo, + (char*)radioResourceConfigDedicated->physicalConfigDedicated->antennaInfo, + sizeof(physicalConfigDedicated2->antennaInfo)); + } + else + { + LOG_I(RRC,"Keep old config for antennaInfo\n"); + } + + + // Update uplinkPowerControlDedicated + if(radioResourceConfigDedicated->physicalConfigDedicated->uplinkPowerControlDedicated != NULL) + { + LOG_I(RRC,"Update uplinkPowerControlDedicated config \n"); + + if(UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->uplinkPowerControlDedicated == NULL) + UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->uplinkPowerControlDedicated = CALLOC(1,sizeof(UplinkPowerControlDedicated_t)); + + memcpy((char*)UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->uplinkPowerControlDedicated, + (char*)radioResourceConfigDedicated->physicalConfigDedicated->uplinkPowerControlDedicated, + sizeof(physicalConfigDedicated2->uplinkPowerControlDedicated)); + } + else + { + LOG_I(RRC,"Keep old config for uplinkPowerControlDedicated\n"); + } + + // Update tpc_PDCCH_ConfigPUCCH + if(radioResourceConfigDedicated->physicalConfigDedicated->tpc_PDCCH_ConfigPUCCH != NULL) + { + LOG_I(RRC,"Update tpc_PDCCH_ConfigPUCCH config \n"); + + if(UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->tpc_PDCCH_ConfigPUCCH == NULL) + UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->tpc_PDCCH_ConfigPUCCH = CALLOC(1,sizeof(TPC_PDCCH_Config_t)); + + memcpy((char*)UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->tpc_PDCCH_ConfigPUCCH, + (char*)radioResourceConfigDedicated->physicalConfigDedicated->tpc_PDCCH_ConfigPUCCH, + sizeof(physicalConfigDedicated2->tpc_PDCCH_ConfigPUCCH)); + } + else + { + LOG_I(RRC,"Keep old config for tpc_PDCCH_ConfigPUCCH\n"); + } + + // Update tpc_PDCCH_ConfigPUSCH + if(radioResourceConfigDedicated->physicalConfigDedicated->tpc_PDCCH_ConfigPUSCH != NULL) + { + LOG_I(RRC,"Update tpc_PDCCH_ConfigPUSCH config \n"); + + if(UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->tpc_PDCCH_ConfigPUSCH == NULL) + UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->tpc_PDCCH_ConfigPUSCH = CALLOC(1,sizeof(TPC_PDCCH_Config_t)); + + memcpy((char*)UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->tpc_PDCCH_ConfigPUSCH, + (char*)radioResourceConfigDedicated->physicalConfigDedicated->tpc_PDCCH_ConfigPUSCH, + sizeof(physicalConfigDedicated2->tpc_PDCCH_ConfigPUSCH)); + + } + else + { + LOG_I(RRC,"Keep old config for tpc_PDCCH_ConfigPUSCH\n"); + } + +} //----------------------------------------------------------------------------- void rrc_ue_process_radioResourceConfigDedicated( @@ -983,11 +1177,17 @@ rrc_ue_process_radioResourceConfigDedicated( // Save physicalConfigDedicated if present if (radioResourceConfigDedicated->physicalConfigDedicated) { + LOG_I(RRC,"Save physicalConfigDedicated if present \n"); + if (UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]) { +#if 1 + rrc_ue_update_radioResourceConfigDedicated(radioResourceConfigDedicated, ctxt_pP, eNB_index); +#else memcpy((char*)UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index],(char*)radioResourceConfigDedicated->physicalConfigDedicated, sizeof(struct PhysicalConfigDedicated)); - +#endif } else { + LOG_I(RRC,"Init physicalConfigDedicated UE_rrc_inst to radioResourceConfigDedicated->physicalConfigDedicated\n"); UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index] = radioResourceConfigDedicated->physicalConfigDedicated; } } @@ -1105,7 +1305,7 @@ rrc_ue_process_radioResourceConfigDedicated( SRB1_logicalChannelConfig = &SRB1_logicalChannelConfig_defaultValue; } - LOG_D(RRC, "[FRAME %05d][RRC_UE][MOD %02d][][--- MAC_CONFIG_REQ (SRB1 eNB %d) --->][MAC_UE][MOD %02d][]\n", + LOG_I(RRC, "[FRAME %05d][RRC_UE][MOD %02d][][--- MAC_CONFIG_REQ (SRB1 eNB %d) --->][MAC_UE][MOD %02d][]\n", ctxt_pP->frame, ctxt_pP->module_id, eNB_index, ctxt_pP->module_id); rrc_mac_config_req(ctxt_pP->module_id,0,ENB_FLAG_NO,0,eNB_index, (RadioResourceConfigCommonSIB_t *)NULL, @@ -1160,7 +1360,7 @@ rrc_ue_process_radioResourceConfigDedicated( SRB2_logicalChannelConfig = &SRB2_logicalChannelConfig_defaultValue; } - LOG_D(RRC, "[FRAME %05d][RRC_UE][MOD %02d][][--- MAC_CONFIG_REQ (SRB2 eNB %d) --->][MAC_UE][MOD %02d][]\n", + LOG_I(RRC, "[FRAME %05d][RRC_UE][MOD %02d][][--- MAC_CONFIG_REQ (SRB2 eNB %d) --->][MAC_UE][MOD %02d][]\n", ctxt_pP->frame, ctxt_pP->module_id, eNB_index, @@ -1267,7 +1467,7 @@ rrc_ue_process_radioResourceConfigDedicated( UE_rrc_inst[ctxt_pP->module_id].DRB_config[eNB_index][DRB_id] = radioResourceConfigDedicated->drb_ToAddModList->list.array[i]; rrc_ue_establish_drb(ctxt_pP->module_id,ctxt_pP->frame,eNB_index,radioResourceConfigDedicated->drb_ToAddModList->list.array[i]); // MAC/PHY Configuration - LOG_D(RRC, "[FRAME %05d][RRC_UE][MOD %02d][][--- MAC_CONFIG_REQ (DRB %d eNB %d) --->][MAC_UE][MOD %02d][]\n", + LOG_I(RRC, "[FRAME %05d][RRC_UE][MOD %02d][][--- MAC_CONFIG_REQ (DRB %d eNB %d) --->][MAC_UE][MOD %02d][]\n", ctxt_pP->frame, ctxt_pP->module_id, radioResourceConfigDedicated->drb_ToAddModList->list.array[i]->drb_Identity, eNB_index, @@ -1825,7 +2025,7 @@ rrc_ue_process_mobilityControlInfo( UE_rrc_inst[ue_mod_idP].DRB_config[eNB_index][0] = NULL; */ //Synchronisation to DL of target cell - LOG_D(RRC, + LOG_I(RRC, "HO: Reset PDCP and RLC for configured RBs.. \n[FRAME %05d][RRC_UE][MOD %02d][][--- MAC_CONFIG_REQ (SRB2 eNB %d) --->][MAC_UE][MOD %02d][]\n", ctxt_pP->frame, ctxt_pP->module_id, eNB_index, ctxt_pP->module_id); @@ -2685,7 +2885,7 @@ static int decode_SIB1( const protocol_ctxt_t* const ctxt_pP, const uint8_t eNB_ UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIperiod = siPeriod_int[sib1->schedulingInfoList.list.array[0]->si_Periodicity]; UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIwindowsize = siWindowLength_int[sib1->si_WindowLength]; - LOG_D( RRC, "[FRAME unknown][RRC_UE][MOD %02"PRIu8"][][--- MAC_CONFIG_REQ (SIB1 params eNB %"PRIu8") --->][MAC_UE][MOD %02"PRIu8"][]\n", + LOG_I( RRC, "[FRAME unknown][RRC_UE][MOD %02"PRIu8"][][--- MAC_CONFIG_REQ (SIB1 params eNB %"PRIu8") --->][MAC_UE][MOD %02"PRIu8"][]\n", ctxt_pP->module_id, eNB_index, ctxt_pP->module_id ); rrc_mac_config_req(ctxt_pP->module_id, 0, ENB_FLAG_NO, 0, eNB_index, @@ -3499,7 +3699,7 @@ static int decode_SI( const protocol_ctxt_t* const ctxt_pP, const uint8_t eNB_in LOG_I( RRC, "[UE %"PRIu8"] Frame %"PRIu32" Found SIB13 from eNB %"PRIu8"\n", ctxt_pP->module_id, ctxt_pP->frame, eNB_index ); dump_sib13( UE_rrc_inst[ctxt_pP->module_id].sib13[eNB_index] ); // adding here function to store necessary parameters for using in decode_MCCH_Message + maybe transfer to PHY layer - LOG_D( RRC, "[FRAME %05"PRIu32"][RRC_UE][MOD %02"PRIu8"][][--- MAC_CONFIG_REQ (SIB13 params eNB %"PRIu8") --->][MAC_UE][MOD %02"PRIu8"][]\n", + LOG_I( RRC, "[FRAME %05"PRIu32"][RRC_UE][MOD %02"PRIu8"][][--- MAC_CONFIG_REQ (SIB13 params eNB %"PRIu8") --->][MAC_UE][MOD %02"PRIu8"][]\n", ctxt_pP->frame, ctxt_pP->module_id, eNB_index, ctxt_pP->module_id); rrc_mac_config_req(ctxt_pP->module_id,0,ENB_FLAG_NO,0,eNB_index, (RadioResourceConfigCommonSIB_t *)NULL, @@ -3956,7 +4156,7 @@ static void decode_MBSFNAreaConfiguration( module_id_t ue_mod_idP, uint8_t eNB_i { protocol_ctxt_t ctxt; - LOG_D(RRC,"[UE %d] Frame %d : Number of MCH(s) in the MBSFN Sync Area %d is %d\n", + LOG_I(RRC,"[UE %d] Frame %d : Number of MCH(s) in the MBSFN Sync Area %d is %d\n", ue_mod_idP, frameP, mbsfn_sync_area, UE_rrc_inst[ue_mod_idP].mcch_message[eNB_index]->pmch_InfoList_r9.list.count); // store to MAC/PHY necessary parameters for receiving MTCHs rrc_mac_config_req(ue_mod_idP,0,ENB_FLAG_NO,0,eNB_index, @@ -4301,12 +4501,26 @@ void *rrc_ue_task( void *args_p ) /* Transfer data to PDCP */ PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, ue_mod_id, ENB_FLAG_NO, UE_rrc_inst[ue_mod_id].Info[0].rnti, 0, 0,0); - rrc_data_req (&ctxt, - DCCH, - rrc_mui++, - SDU_CONFIRM_NO, - length, buffer, - PDCP_TRANSMISSION_MODE_CONTROL); + + // check if SRB2 is created, if yes request data_req on DCCH1 (SRB2) + if(UE_rrc_inst[ue_mod_id].SRB2_config[0] == NULL) + { + rrc_data_req (&ctxt, + DCCH, + rrc_mui++, + SDU_CONFIRM_NO, + length, buffer, + PDCP_TRANSMISSION_MODE_CONTROL); + } + else + { + rrc_data_req (&ctxt, + DCCH1, + rrc_mui++, + SDU_CONFIRM_NO, + length, buffer, + PDCP_TRANSMISSION_MODE_CONTROL); + } break; } diff --git a/openair3/NAS/UE/EMM/SAP/emm_recv.c b/openair3/NAS/UE/EMM/SAP/emm_recv.c index 32e8e1ec30..6162b5ea2b 100644 --- a/openair3/NAS/UE/EMM/SAP/emm_recv.c +++ b/openair3/NAS/UE/EMM/SAP/emm_recv.c @@ -137,8 +137,15 @@ int emm_recv_attach_accept(attach_accept_msg *msg, int *emm_cause) /* * Message checking */ - if (msg->tailist.typeoflist != - TRACKING_AREA_IDENTITY_LIST_ONE_PLMN_CONSECUTIVE_TACS) { + // supported cases: + // typeoflist = 1 Or + // typeoflist = 0 and numberofelements = 1 (ie numberofelements equal to zero see 3gpp 24.301 9.9.3.33.1) + LOG_D(NAS,"attach accept type of list: %d, number of element: %d\n",msg->tailist.typeoflist, msg->tailist.numberofelements); + if (!( (msg->tailist.typeoflist == TRACKING_AREA_IDENTITY_LIST_ONE_PLMN_CONSECUTIVE_TACS) || + ((msg->tailist.typeoflist == 0) && ( (msg->tailist.numberofelements + 1) == 1)) + ) + ) + { /* Only list of TACs belonging to one PLMN with consecutive * TAC values is supported */ *emm_cause = EMM_CAUSE_IE_NOT_IMPLEMENTED; From 9fbbd0678a236ea9e7878f83fe7327dd29b26854 Mon Sep 17 00:00:00 2001 From: hbilel Date: Thu, 3 Nov 2016 15:53:06 +0100 Subject: [PATCH 250/349] [OAI-UE] attach accept fix --- openair3/NAS/UE/EMM/SAP/emm_recv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openair3/NAS/UE/EMM/SAP/emm_recv.c b/openair3/NAS/UE/EMM/SAP/emm_recv.c index 6162b5ea2b..a79a14d9c1 100644 --- a/openair3/NAS/UE/EMM/SAP/emm_recv.c +++ b/openair3/NAS/UE/EMM/SAP/emm_recv.c @@ -142,7 +142,7 @@ int emm_recv_attach_accept(attach_accept_msg *msg, int *emm_cause) // typeoflist = 0 and numberofelements = 1 (ie numberofelements equal to zero see 3gpp 24.301 9.9.3.33.1) LOG_D(NAS,"attach accept type of list: %d, number of element: %d\n",msg->tailist.typeoflist, msg->tailist.numberofelements); if (!( (msg->tailist.typeoflist == TRACKING_AREA_IDENTITY_LIST_ONE_PLMN_CONSECUTIVE_TACS) || - ((msg->tailist.typeoflist == 0) && ( (msg->tailist.numberofelements + 1) == 1)) + ((msg->tailist.typeoflist == 0) && ( msg->tailist.numberofelements == 0)) ) ) { From 5bbdefeee84373eab2215fb40454cbce9d0cfdc5 Mon Sep 17 00:00:00 2001 From: Rohit Gupta Date: Thu, 3 Nov 2016 21:32:12 +0100 Subject: [PATCH 251/349] add installation of colorama --- cmake_targets/tools/build_helper | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake_targets/tools/build_helper b/cmake_targets/tools/build_helper index ac9739e589..388fcfeba9 100755 --- a/cmake_targets/tools/build_helper +++ b/cmake_targets/tools/build_helper @@ -229,7 +229,7 @@ check_install_additional_tools (){ ntp $SUDO pip install paramiko - $SUDO pip install pyroute2 + $SUDO pip install pyroute2 colorama $SUDO rm -fr /opt/ssh $SUDO GIT_SSL_NO_VERIFY=true git clone https://gitlab.eurecom.fr/oai/ssh.git /opt/ssh From 65f047094cd996ef09c809318b3557a93614a01f Mon Sep 17 00:00:00 2001 From: Rohit Gupta Date: Thu, 3 Nov 2016 21:40:04 +0100 Subject: [PATCH 252/349] [Gitlab CI]: additional packages for pylab support for autotest --- cmake_targets/tools/build_helper | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/cmake_targets/tools/build_helper b/cmake_targets/tools/build_helper index 388fcfeba9..c5f2b87704 100755 --- a/cmake_targets/tools/build_helper +++ b/cmake_targets/tools/build_helper @@ -223,10 +223,12 @@ check_install_additional_tools (){ android-tools-adb \ wvdial \ python-numpy \ - sshpass \ - nscd \ - bc \ - ntp + sshpass \ + nscd \ + bc \ + ntp \ + python-scipy \ + python-matplotlib $SUDO pip install paramiko $SUDO pip install pyroute2 colorama From eff2887d9289c6e863a0c89326560bdd3403aadb Mon Sep 17 00:00:00 2001 From: Rohit Gupta Date: Thu, 3 Nov 2016 23:27:08 +0100 Subject: [PATCH 253/349] [Gitlab CI]: Move autotest library to tools --- cmake_targets/autotests/{ => tools}/autotest_analyser.py | 0 cmake_targets/autotests/{ => tools}/lib_autotest_analyser.py | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename cmake_targets/autotests/{ => tools}/autotest_analyser.py (100%) rename cmake_targets/autotests/{ => tools}/lib_autotest_analyser.py (100%) diff --git a/cmake_targets/autotests/autotest_analyser.py b/cmake_targets/autotests/tools/autotest_analyser.py similarity index 100% rename from cmake_targets/autotests/autotest_analyser.py rename to cmake_targets/autotests/tools/autotest_analyser.py diff --git a/cmake_targets/autotests/lib_autotest_analyser.py b/cmake_targets/autotests/tools/lib_autotest_analyser.py similarity index 100% rename from cmake_targets/autotests/lib_autotest_analyser.py rename to cmake_targets/autotests/tools/lib_autotest_analyser.py From 92fda18ab6313eedde9287af92d4f024995ee2ff Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Fri, 4 Nov 2016 12:40:37 +0200 Subject: [PATCH 254/349] Added brief documentation of agent API functions --- openair2/ENB_APP/enb_agent.c | 26 +- openair2/ENB_APP/enb_agent.h | 7 +- openair2/ENB_APP/enb_agent_async.h | 4 + openair2/ENB_APP/enb_agent_common.c | 456 +++++++++++--------------- openair2/ENB_APP/enb_agent_common.h | 115 ++++++- openair2/ENB_APP/enb_agent_extern.h | 3 + openair2/ENB_APP/enb_agent_mac.c | 68 ++-- openair2/ENB_APP/enb_agent_mac.h | 10 +- openair2/ENB_APP/enb_agent_net_comm.h | 1 - 9 files changed, 347 insertions(+), 343 deletions(-) diff --git a/openair2/ENB_APP/enb_agent.c b/openair2/ENB_APP/enb_agent.c index 8286771104..179392b3a2 100644 --- a/openair2/ENB_APP/enb_agent.c +++ b/openair2/ENB_APP/enb_agent.c @@ -138,16 +138,12 @@ void *receive_thread(void *args) { Protocol__FlexranMessage *msg; while (1) { - //if (enb_agent_msg_recv(d->enb_id, ENB_AGENT_DEFAULT, &data, &size, &priority)) { - // err_code = PROTOCOL__FLEXRAN_ERR__MSG_DEQUEUING; - // goto error; - //} while (enb_agent_msg_recv(d->enb_id, ENB_AGENT_DEFAULT, &data, &size, &priority) == 0) { LOG_D(ENB_AGENT,"received message with size %d\n", size); - + // Invoke the message handler msg=enb_agent_handle_message(d->enb_id, data, size); free(data); @@ -317,26 +313,6 @@ error: } - - -/* int enb_agent_stop(mid_t mod_id){ */ - -/* int i=0; */ - -/* enb_agent_destroy_timers(); */ -/* for ( i =0; i < enb_agent_info.nb_modules; i++) { */ - -/* destroy_link_manager(enb_agent[i].manager); */ - -/* destroy_message_queue(enb_agent[i].send_queue); */ -/* destroy_message_queue(enb_agent[i].receive_queue); */ - -/* close_link(enb_agent[i].link); */ -/* } */ -/* } */ - - - Protocol__FlexranMessage *enb_agent_timeout(void* args){ // enb_agent_timer_args_t *timer_args = calloc(1, sizeof(*timer_args)); diff --git a/openair2/ENB_APP/enb_agent.h b/openair2/ENB_APP/enb_agent.h index 1a53841d45..a75790d8b0 100644 --- a/openair2/ENB_APP/enb_agent.h +++ b/openair2/ENB_APP/enb_agent.h @@ -41,10 +41,15 @@ #include "enb_config.h" // for enb properties #include "enb_agent_common.h" -int enb_agent_start(mid_t mod_id, const Enb_properties_array_t* enb_properties); +/* Initiation and termination of the eNodeB agent */ +int enb_agent_start(mid_t mod_id, const Enb_properties_array_t* enb_properties); int enb_agent_stop(mid_t mod_id); +/* + * enb agent task mainly wakes up the tx thread for periodic and oneshot messages to the controller + * and can interact with other itti tasks +*/ void *enb_agent_task(void *args); #endif diff --git a/openair2/ENB_APP/enb_agent_async.h b/openair2/ENB_APP/enb_agent_async.h index d722f92a8e..a8c4ae90fe 100644 --- a/openair2/ENB_APP/enb_agent_async.h +++ b/openair2/ENB_APP/enb_agent_async.h @@ -47,12 +47,16 @@ typedef struct { link_manager_t *manager; } enb_agent_async_channel_t; +/* Create a new channel for a given destination ip and destination port */ enb_agent_async_channel_t * enb_agent_async_channel_info(mid_t mod_id, char *dst_ip, uint16_t dst_port); +/* Send a message to the given channel */ int enb_agent_async_msg_send(void *data, int size, int priority, void *channel_info); +/* Receive a message from a given channel */ int enb_agent_async_msg_recv(void **data, int *size, int *priority, void *channel_info); +/* Release a channel */ void enb_agent_async_release(enb_agent_channel_t *channel); diff --git a/openair2/ENB_APP/enb_agent_common.c b/openair2/ENB_APP/enb_agent_common.c index 2baecd6041..51ade8d851 100644 --- a/openair2/ENB_APP/enb_agent_common.c +++ b/openair2/ENB_APP/enb_agent_common.c @@ -51,6 +51,7 @@ void * enb[NUM_MAX_ENB]; void * enb_ue[NUM_MAX_ENB]; void * enb_rrc[NUM_MAX_ENB]; + /* * message primitives */ @@ -446,6 +447,7 @@ int enb_agent_destroy_agent_reconfiguration(Protocol__FlexranMessage *msg) { /*TODO: Dealocate memory for a dynamically allocated agent reconfiguration message*/ } + /* * get generic info from RAN */ @@ -541,7 +543,7 @@ int get_num_ues (mid_t mod_id){ return ((UE_list_t *)enb_ue[mod_id])->num_UEs; } -int get_ue_crnti (mid_t mod_id, mid_t ue_id){ +int get_ue_crnti (mid_t mod_id, mid_t ue_id) { return UE_RNTI(mod_id, ue_id); } @@ -608,13 +610,12 @@ int get_MAC_CE_bitmap_TA(mid_t mod_id, mid_t ue_id,int CC_id) else return 0; } -int get_active_CC(mid_t mod_id, mid_t ue_id) -{ + +int get_active_CC(mid_t mod_id, mid_t ue_id) { return ((UE_list_t *)enb_ue[mod_id])->numactiveCCs[ue_id]; } -int get_current_RI(mid_t mod_id, mid_t ue_id, int CC_id) -{ +int get_current_RI(mid_t mod_id, mid_t ue_id, int CC_id) { LTE_eNB_UE_stats *eNB_UE_stats = NULL; int pCCid = UE_PCCID(mod_id,ue_id); @@ -629,8 +630,7 @@ int get_current_RI(mid_t mod_id, mid_t ue_id, int CC_id) return eNB_UE_stats[CC_id].rank; } -int get_tpc(mid_t mod_id, mid_t ue_id) -{ +int get_tpc(mid_t mod_id, mid_t ue_id) { LTE_eNB_UE_stats *eNB_UE_stats = NULL; int32_t normalized_rx_power, target_rx_power; int tpc = 1; @@ -660,8 +660,7 @@ int get_tpc(mid_t mod_id, mid_t ue_id) return tpc; } -int get_harq(const mid_t mod_id, const uint8_t CC_id, const mid_t ue_id, const int frame, const uint8_t subframe, int *id, int *status) //flag_id_status = 0 then id, else status -{ +int get_harq(const mid_t mod_id, const uint8_t CC_id, const mid_t ue_id, const int frame, const uint8_t subframe, int *id, int *status) { //flag_id_status = 0 then id, else status /*TODO: Add int TB in function parameters to get the status of the second TB. This can be done to by editing in * get_ue_active_harq_pid function in line 272 file: phy_procedures_lte_eNB.c to add * DLSCH_ptr = PHY_vars_eNB_g[Mod_id][CC_id]->dlsch_eNB[(uint32_t)UE_id][1];*/ @@ -684,8 +683,7 @@ int get_harq(const mid_t mod_id, const uint8_t CC_id, const mid_t ue_id, const i return 0; } -int get_p0_pucch_dbm(mid_t mod_id, mid_t ue_id, int CC_id) -{ +int get_p0_pucch_dbm(mid_t mod_id, mid_t ue_id, int CC_id) { LTE_eNB_UE_stats *eNB_UE_stats = NULL; uint32_t rnti = get_ue_crnti(mod_id,ue_id); @@ -703,8 +701,7 @@ int get_p0_pucch_dbm(mid_t mod_id, mid_t ue_id, int CC_id) return -1; } -int get_p0_nominal_pucch(mid_t mod_id, int CC_id) -{ +int get_p0_nominal_pucch(mid_t mod_id, int CC_id) { int32_t pucch_rx_received = mac_xface->get_target_pucch_rx_power(mod_id, CC_id); return pucch_rx_received; } @@ -716,43 +713,42 @@ int get_p0_nominal_pucch(mid_t mod_id, int CC_id) * ************************************ */ -int get_hopping_offset(mid_t mod_id, int CC_id) -{ +int get_hopping_offset(mid_t mod_id, int CC_id) { LTE_DL_FRAME_PARMS *frame_parms; frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id); return frame_parms->pusch_config_common.pusch_HoppingOffset; } -int get_hopping_mode(mid_t mod_id, int CC_id) -{ + +int get_hopping_mode(mid_t mod_id, int CC_id) { LTE_DL_FRAME_PARMS *frame_parms; frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id); return frame_parms->pusch_config_common.hoppingMode; } -int get_n_SB(mid_t mod_id, int CC_id) -{ + +int get_n_SB(mid_t mod_id, int CC_id) { LTE_DL_FRAME_PARMS *frame_parms; frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id); return frame_parms->pusch_config_common.n_SB; } -int get_enable64QAM(mid_t mod_id, int CC_id) -{ + +int get_enable64QAM(mid_t mod_id, int CC_id) { LTE_DL_FRAME_PARMS *frame_parms; frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id); return frame_parms->pusch_config_common.enable64QAM; } -int get_phich_duration(mid_t mod_id, int CC_id) -{ + +int get_phich_duration(mid_t mod_id, int CC_id) { LTE_DL_FRAME_PARMS *frame_parms; frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id); return frame_parms->phich_config_common.phich_duration; } -int get_phich_resource(mid_t mod_id, int CC_id) -{ + +int get_phich_resource(mid_t mod_id, int CC_id) { LTE_DL_FRAME_PARMS *frame_parms; frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id); @@ -767,132 +763,132 @@ int get_phich_resource(mid_t mod_id, int CC_id) return -1; } -int get_n1pucch_an(mid_t mod_id, int CC_id) -{ + +int get_n1pucch_an(mid_t mod_id, int CC_id) { LTE_DL_FRAME_PARMS *frame_parms; frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id); return frame_parms->pucch_config_common.n1PUCCH_AN; } -int get_nRB_CQI(mid_t mod_id, int CC_id) -{ + +int get_nRB_CQI(mid_t mod_id, int CC_id) { LTE_DL_FRAME_PARMS *frame_parms; frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id); return frame_parms->pucch_config_common.nRB_CQI; } -int get_deltaPUCCH_Shift(mid_t mod_id, int CC_id) -{ + +int get_deltaPUCCH_Shift(mid_t mod_id, int CC_id) { LTE_DL_FRAME_PARMS *frame_parms; frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id); return frame_parms->pucch_config_common.deltaPUCCH_Shift; } -int get_prach_ConfigIndex(mid_t mod_id, int CC_id) -{ + +int get_prach_ConfigIndex(mid_t mod_id, int CC_id) { LTE_DL_FRAME_PARMS *frame_parms; frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id); return frame_parms->prach_config_common.prach_ConfigInfo.prach_ConfigIndex; } -int get_prach_FreqOffset(mid_t mod_id, int CC_id) -{ + +int get_prach_FreqOffset(mid_t mod_id, int CC_id) { LTE_DL_FRAME_PARMS *frame_parms; frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id); return frame_parms->prach_config_common.prach_ConfigInfo.prach_FreqOffset; } -int get_maxHARQ_Msg3Tx(mid_t mod_id, int CC_id) -{ + +int get_maxHARQ_Msg3Tx(mid_t mod_id, int CC_id) { LTE_DL_FRAME_PARMS *frame_parms; frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id); return frame_parms->maxHARQ_Msg3Tx; } -int get_ul_cyclic_prefix_length(mid_t mod_id, int CC_id) -{ + +int get_ul_cyclic_prefix_length(mid_t mod_id, int CC_id) { LTE_DL_FRAME_PARMS *frame_parms; frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id); return frame_parms->Ncp_UL; } -int get_dl_cyclic_prefix_length(mid_t mod_id, int CC_id) -{ + +int get_dl_cyclic_prefix_length(mid_t mod_id, int CC_id) { LTE_DL_FRAME_PARMS *frame_parms; frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id); return frame_parms->Ncp; } -int get_cell_id(mid_t mod_id, int CC_id) -{ + +int get_cell_id(mid_t mod_id, int CC_id) { LTE_DL_FRAME_PARMS *frame_parms; frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id); return frame_parms->Nid_cell; } -int get_srs_BandwidthConfig(mid_t mod_id, int CC_id) -{ + +int get_srs_BandwidthConfig(mid_t mod_id, int CC_id) { LTE_DL_FRAME_PARMS *frame_parms; frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id); return frame_parms->soundingrs_ul_config_common.srs_BandwidthConfig; } -int get_srs_SubframeConfig(mid_t mod_id, int CC_id) -{ + +int get_srs_SubframeConfig(mid_t mod_id, int CC_id) { LTE_DL_FRAME_PARMS *frame_parms; frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id); return frame_parms->soundingrs_ul_config_common.srs_SubframeConfig; } -int get_srs_MaxUpPts(mid_t mod_id, int CC_id) -{ + +int get_srs_MaxUpPts(mid_t mod_id, int CC_id) { LTE_DL_FRAME_PARMS *frame_parms; frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id); return frame_parms->soundingrs_ul_config_common.srs_MaxUpPts; } -int get_N_RB_DL(mid_t mod_id, int CC_id) -{ + +int get_N_RB_DL(mid_t mod_id, int CC_id) { LTE_DL_FRAME_PARMS *frame_parms; frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id); return frame_parms->N_RB_DL; } -int get_N_RB_UL(mid_t mod_id, int CC_id) -{ + +int get_N_RB_UL(mid_t mod_id, int CC_id) { LTE_DL_FRAME_PARMS *frame_parms; frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id); return frame_parms->N_RB_UL; } -int get_subframe_assignment(mid_t mod_id, int CC_id) -{ + +int get_subframe_assignment(mid_t mod_id, int CC_id) { LTE_DL_FRAME_PARMS *frame_parms; frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id); return frame_parms->tdd_config; } -int get_special_subframe_assignment(mid_t mod_id, int CC_id) -{ + +int get_special_subframe_assignment(mid_t mod_id, int CC_id) { LTE_DL_FRAME_PARMS *frame_parms; frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id); return frame_parms->tdd_config_S; } -int get_ra_ResponseWindowSize(mid_t mod_id, int CC_id) -{ + +int get_ra_ResponseWindowSize(mid_t mod_id, int CC_id) { Enb_properties_array_t *enb_properties; enb_properties = enb_config_get(); return enb_properties->properties[mod_id]->rach_raResponseWindowSize[CC_id]; } -int get_mac_ContentionResolutionTimer(mid_t mod_id, int CC_id) -{ + +int get_mac_ContentionResolutionTimer(mid_t mod_id, int CC_id) { Enb_properties_array_t *enb_properties; enb_properties = enb_config_get(); return enb_properties->properties[mod_id]->rach_macContentionResolutionTimer[CC_id]; } -int get_duplex_mode(mid_t mod_id, int CC_id) -{ + +int get_duplex_mode(mid_t mod_id, int CC_id) { LTE_DL_FRAME_PARMS *frame_parms; frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id); @@ -903,21 +899,23 @@ int get_duplex_mode(mid_t mod_id, int CC_id) return -1; } -long get_si_window_length(mid_t mod_id, int CC_id) -{ + +long get_si_window_length(mid_t mod_id, int CC_id) { return ((eNB_RRC_INST *)enb_rrc[mod_id])->carrier[CC_id].sib1->si_WindowLength; } -int get_sib1_length(mid_t mod_id, int CC_id) -{ + +int get_sib1_length(mid_t mod_id, int CC_id) { return ((eNB_RRC_INST *)enb_rrc[mod_id])->carrier[CC_id].sizeof_SIB1; } -int get_num_pdcch_symb(mid_t mod_id, int CC_id) -{ + +int get_num_pdcch_symb(mid_t mod_id, int CC_id) { /* TODO: This should return the number of PDCCH symbols initially used by the cell CC_id */ return 0; //(PHY_vars_UE_g[mod_id][CC_id]->lte_ue_pdcch_vars[mod_id]->num_pdcch_symbols); } + + /* * ************************************ * Get Messages for UE Configuration Reply @@ -925,8 +923,7 @@ int get_num_pdcch_symb(mid_t mod_id, int CC_id) */ -int get_time_alignment_timer(mid_t mod_id, mid_t ue_id) -{ +int get_time_alignment_timer(mid_t mod_id, mid_t ue_id) { struct rrc_eNB_ue_context_s* ue_context_p = NULL; uint32_t rntiP = get_ue_crnti(mod_id,ue_id); @@ -982,18 +979,16 @@ int get_meas_gap_config_offset(mid_t mod_id, mid_t ue_id) { return -1; } -int get_ue_aggregated_max_bitrate_dl (mid_t mod_id, mid_t ue_id) -{ +int get_ue_aggregated_max_bitrate_dl (mid_t mod_id, mid_t ue_id) { return ((UE_list_t *)enb_ue[mod_id])->UE_sched_ctrl[ue_id].ue_AggregatedMaximumBitrateDL; } -int get_ue_aggregated_max_bitrate_ul (mid_t mod_id, mid_t ue_id) -{ +int get_ue_aggregated_max_bitrate_ul (mid_t mod_id, mid_t ue_id) { return ((UE_list_t *)enb_ue[mod_id])->UE_sched_ctrl[ue_id].ue_AggregatedMaximumBitrateUL; } -int get_half_duplex(mid_t ue_id) -{ +int get_half_duplex(mid_t ue_id) { + // TODO //int halfduplex = 0; //int bands_to_scan = ((UE_RRC_INST *)enb_ue_rrc[ue_id])->UECap->UE_EUTRA_Capability->rf_Parameters.supportedBandListEUTRA.list.count; //for (int i =0; i < bands_to_scan; i++){ @@ -1003,37 +998,32 @@ int get_half_duplex(mid_t ue_id) //return halfduplex; } -int get_intra_sf_hopping(mid_t ue_id) -{ +int get_intra_sf_hopping(mid_t ue_id) { //TODO:Get proper value //temp = (((UE_RRC_INST *)enb_ue_rrc[ue_id])->UECap->UE_EUTRA_Capability->featureGroupIndicators->buf); //return (0 & ( 1 << (31))); } -int get_type2_sb_1(mid_t ue_id) -{ +int get_type2_sb_1(mid_t ue_id) { //TODO:Get proper value //uint8_t temp = 0; //temp = (((UE_RRC_INST *)enb_ue_rrc[ue_id])->UECap->UE_EUTRA_Capability->featureGroupIndicators->buf); //return (temp & ( 1 << (11))); } -int get_ue_category(mid_t ue_id) -{ +int get_ue_category(mid_t ue_id) { //TODO:Get proper value //return (((UE_RRC_INST *)enb_ue_rrc[ue_id])->UECap->UE_EUTRA_Capability->ue_Category); } -int get_res_alloc_type1(mid_t ue_id) -{ +int get_res_alloc_type1(mid_t ue_id) { //TODO:Get proper value //uint8_t temp = 0; //temp = (((UE_RRC_INST *)enb_ue_rrc[ue_id])->UECap->UE_EUTRA_Capability->featureGroupIndicators->buf); //return (temp & ( 1 << (30))); } -int get_ue_transmission_mode(mid_t mod_id, mid_t ue_id) -{ +int get_ue_transmission_mode(mid_t mod_id, mid_t ue_id) { struct rrc_eNB_ue_context_s* ue_context_p = NULL; uint32_t rntiP = get_ue_crnti(mod_id,ue_id); @@ -1049,8 +1039,7 @@ int get_ue_transmission_mode(mid_t mod_id, mid_t ue_id) return -1; } -int get_tti_bundling(mid_t mod_id, mid_t ue_id) -{ +int get_tti_bundling(mid_t mod_id, mid_t ue_id) { struct rrc_eNB_ue_context_s* ue_context_p = NULL; uint32_t rntiP = get_ue_crnti(mod_id,ue_id); @@ -1078,8 +1067,7 @@ int get_maxHARQ_TX(mid_t mod_id, mid_t ue_id) { return -1; } -int get_beta_offset_ack_index(mid_t mod_id, mid_t ue_id) -{ +int get_beta_offset_ack_index(mid_t mod_id, mid_t ue_id) { struct rrc_eNB_ue_context_s* ue_context_p = NULL; uint32_t rntiP = get_ue_crnti(mod_id,ue_id); @@ -1094,8 +1082,7 @@ int get_beta_offset_ack_index(mid_t mod_id, mid_t ue_id) return -1; } -int get_beta_offset_ri_index(mid_t mod_id, mid_t ue_id) -{ +int get_beta_offset_ri_index(mid_t mod_id, mid_t ue_id) { struct rrc_eNB_ue_context_s* ue_context_p = NULL; uint32_t rntiP = get_ue_crnti(mod_id,ue_id); @@ -1110,8 +1097,7 @@ int get_beta_offset_ri_index(mid_t mod_id, mid_t ue_id) return -1; } -int get_beta_offset_cqi_index(mid_t mod_id, mid_t ue_id) -{ +int get_beta_offset_cqi_index(mid_t mod_id, mid_t ue_id) { struct rrc_eNB_ue_context_s* ue_context_p = NULL; uint32_t rntiP = get_ue_crnti(mod_id,ue_id); @@ -1126,8 +1112,7 @@ int get_beta_offset_cqi_index(mid_t mod_id, mid_t ue_id) return -1; } -int get_simultaneous_ack_nack_cqi(mid_t mod_id, mid_t ue_id) -{ +int get_simultaneous_ack_nack_cqi(mid_t mod_id, mid_t ue_id) { struct rrc_eNB_ue_context_s* ue_context_p = NULL; uint32_t rntiP = get_ue_crnti(mod_id,ue_id); @@ -1142,8 +1127,7 @@ int get_simultaneous_ack_nack_cqi(mid_t mod_id, mid_t ue_id) return -1; } -int get_ack_nack_simultaneous_trans(mid_t mod_id,mid_t ue_id) -{ +int get_ack_nack_simultaneous_trans(mid_t mod_id,mid_t ue_id) { return (&eNB_rrc_inst[mod_id])->carrier[0].sib2->radioResourceConfigCommon.soundingRS_UL_ConfigCommon.choice.setup.ackNackSRS_SimultaneousTransmission; } @@ -1161,8 +1145,7 @@ int get_aperiodic_cqi_rep_mode(mid_t mod_id,mid_t ue_id) { return -1; } -int get_tdd_ack_nack_feedback(mid_t mod_id, mid_t ue_id) -{ +int get_tdd_ack_nack_feedback(mid_t mod_id, mid_t ue_id) { struct rrc_eNB_ue_context_s* ue_context_p = NULL; uint32_t rntiP = get_ue_crnti(mod_id,ue_id); @@ -1178,8 +1161,7 @@ int get_tdd_ack_nack_feedback(mid_t mod_id, mid_t ue_id) return -1; } -int get_ack_nack_repetition_factor(mid_t mod_id, mid_t ue_id) -{ +int get_ack_nack_repetition_factor(mid_t mod_id, mid_t ue_id) { struct rrc_eNB_ue_context_s* ue_context_p = NULL; uint32_t rntiP = get_ue_crnti(mod_id,ue_id); @@ -1213,8 +1195,7 @@ int get_extended_bsr_size(mid_t mod_id, mid_t ue_id) { return -1; } -int get_ue_transmission_antenna(mid_t mod_id, mid_t ue_id) -{ +int get_ue_transmission_antenna(mid_t mod_id, mid_t ue_id) { struct rrc_eNB_ue_context_s* ue_context_p = NULL; uint32_t rntiP = get_ue_crnti(mod_id,ue_id); @@ -1235,8 +1216,7 @@ int get_ue_transmission_antenna(mid_t mod_id, mid_t ue_id) return -1; } -int get_lcg(mid_t ue_id, mid_t lc_id) -{ +int get_lcg(mid_t ue_id, mid_t lc_id) { if (UE_mac_inst == NULL) { return -1; } @@ -1247,8 +1227,7 @@ int get_lcg(mid_t ue_id, mid_t lc_id) } } -int get_direction(mid_t ue_id, mid_t lc_id) -{ +int get_direction(mid_t ue_id, mid_t lc_id) { /*TODO: fill with the value for the rest of LCID*/ if(lc_id == DCCH | lc_id == DCCH1) return 2; @@ -1293,43 +1272,37 @@ int enb_agent_ue_state_change(mid_t mod_id, uint32_t rnti, uint8_t state_change) int i =find_UE_id(mod_id,rnti); config->has_rnti = 1; config->rnti = rnti; - //TODO: Set the time_alignment_timer if(get_time_alignment_timer(mod_id,i) != -1){ config->time_alignment_timer = get_time_alignment_timer(mod_id,i); config->has_time_alignment_timer = 1; } - //TODO: Set the measurement gap configuration pattern if(get_meas_gap_config(mod_id,i) != -1){ config->meas_gap_config_pattern = get_meas_gap_config(mod_id,i); config->has_meas_gap_config_pattern = 1; } - //TODO: Set the measurement gap offset if applicable if(config->has_meas_gap_config_pattern == 1 && config->meas_gap_config_pattern != PROTOCOL__FLEX_MEAS_GAP_CONFIG_PATTERN__FLMGCP_OFF) { config->meas_gap_config_sf_offset = get_meas_gap_config_offset(mod_id,i); config->has_meas_gap_config_sf_offset = 1; } //TODO: Set the SPS configuration (Optional) - //Not supported for noe, so we do not set it + //Not supported for now, so we do not set it //TODO: Set the SR configuration (Optional) //We do not set it for now //TODO: Set the CQI configuration (Optional) //We do not set it for now - - //TODO: Set the transmission mode - if(get_ue_transmission_mode(mod_id,i) != -1){ + + if(get_ue_transmission_mode(mod_id,i) != -1){ config->transmission_mode = get_ue_transmission_mode(mod_id,i); config->has_transmission_mode = 1; } - //TODO: Set the aggregated bit-rate of the non-gbr bearer (UL) - config->ue_aggregated_max_bitrate_ul = get_ue_aggregated_max_bitrate_ul(mod_id,i); + config->ue_aggregated_max_bitrate_ul = get_ue_aggregated_max_bitrate_ul(mod_id,i); config->has_ue_aggregated_max_bitrate_ul = 1; - //TODO: Set the aggregated bit-rate of the non-gbr bearer (DL) - config->ue_aggregated_max_bitrate_dl = get_ue_aggregated_max_bitrate_dl(mod_id,i); + config->ue_aggregated_max_bitrate_dl = get_ue_aggregated_max_bitrate_dl(mod_id,i); config->has_ue_aggregated_max_bitrate_dl = 1; //TODO: Set the UE capabilities @@ -1337,63 +1310,63 @@ int enb_agent_ue_state_change(mid_t mod_id, uint32_t rnti, uint8_t state_change) c_capabilities = malloc(sizeof(Protocol__FlexUeCapabilities)); protocol__flex_ue_capabilities__init(c_capabilities); //TODO: Set half duplex (FDD operation) - c_capabilities->has_half_duplex = 1; + c_capabilities->has_half_duplex = 0; c_capabilities->half_duplex = 1;//get_half_duplex(i); //TODO: Set intra-frame hopping flag - c_capabilities->has_intra_sf_hopping = 1; + c_capabilities->has_intra_sf_hopping = 0; c_capabilities->intra_sf_hopping = 1;//get_intra_sf_hopping(i); //TODO: Set support for type 2 hopping with n_sb > 1 - c_capabilities->has_type2_sb_1 = 1; + c_capabilities->has_type2_sb_1 = 0; c_capabilities->type2_sb_1 = 1;//get_type2_sb_1(i); //TODO: Set ue category - c_capabilities->has_ue_category = 1; + c_capabilities->has_ue_category = 0; c_capabilities->ue_category = 1;//get_ue_category(i); //TODO: Set UE support for resource allocation type 1 - c_capabilities->has_res_alloc_type1 = 1; + c_capabilities->has_res_alloc_type1 = 0; c_capabilities->res_alloc_type1 = 1;//get_res_alloc_type1(i); //Set the capabilites to the message config->capabilities = c_capabilities; - //TODO: Set UE transmission antenna. One of the FLUTA_* values + if(get_ue_transmission_antenna(mod_id,i) != -1){ config->has_ue_transmission_antenna = 1; config->ue_transmission_antenna = get_ue_transmission_antenna(mod_id,i); } - //TODO: Set tti bundling flag (See ts 36.321) + if(get_tti_bundling(mod_id,i) != -1){ config->has_tti_bundling = 1; config->tti_bundling = get_tti_bundling(mod_id,i); } - //TODO: Set the max HARQ retransmission for the UL + if(get_maxHARQ_TX(mod_id,i) != -1){ config->has_max_harq_tx = 1; config->max_harq_tx = get_maxHARQ_TX(mod_id,i); } - //TODO: Fill beta_offset_ack_index (TS 36.213) + if(get_beta_offset_ack_index(mod_id,i) != -1){ config->has_beta_offset_ack_index = 1; config->beta_offset_ack_index = get_beta_offset_ack_index(mod_id,i); } - //TODO: Fill beta_offset_ri_index (TS 36.213) + if(get_beta_offset_ri_index(mod_id,i) != -1){ config->has_beta_offset_ri_index = 1; config->beta_offset_ri_index = get_beta_offset_ri_index(mod_id,i); } - //TODO: Fill beta_offset_cqi_index (TS 36.213) + if(get_beta_offset_cqi_index(mod_id,i) != -1){ config->has_beta_offset_cqi_index = 1; config->beta_offset_cqi_index = get_beta_offset_cqi_index(mod_id,i); } - //TODO: Fill ack_nack_simultaneous_trans (TS 36.213) + if(get_ack_nack_simultaneous_trans(mod_id,i) != -1){ config->has_ack_nack_simultaneous_trans = 1; config->ack_nack_simultaneous_trans = get_ack_nack_simultaneous_trans(mod_id,i); } - //TODO: Fill simultaneous_ack_nack_cqi (TS 36.213) + if(get_simultaneous_ack_nack_cqi(mod_id,i) != -1){ config->has_simultaneous_ack_nack_cqi = 1; config->simultaneous_ack_nack_cqi = get_simultaneous_ack_nack_cqi(mod_id,i); } - //TODO: Set PRACRM_* value regarding aperiodic cqi report mode + if(get_aperiodic_cqi_rep_mode(mod_id,i) != -1){ config->has_aperiodic_cqi_rep_mode = 1; int mode = get_aperiodic_cqi_rep_mode(mod_id,i); @@ -1403,22 +1376,22 @@ int enb_agent_ue_state_change(mid_t mod_id, uint32_t rnti, uint8_t state_change) config->aperiodic_cqi_rep_mode = mode; } } - //TODO: Set tdd_ack_nack_feedback + if(get_tdd_ack_nack_feedback(mod_id, i) != -1){ config->has_tdd_ack_nack_feedback = 1; config->tdd_ack_nack_feedback = get_tdd_ack_nack_feedback(mod_id,i); } - //TODO: Set ack_nack_repetition factor + if(get_ack_nack_repetition_factor(mod_id, i) != -1){ config->has_ack_nack_repetition_factor = 1; config->ack_nack_repetition_factor = get_ack_nack_repetition_factor(mod_id,i); } - //TODO: Set extended BSR size + if(get_extended_bsr_size(mod_id, i) != -1){ config->has_extended_bsr_size = 1; config->extended_bsr_size = get_extended_bsr_size(mod_id,i); } - //TODO: Set index of primary cell + config->has_pcell_carrier_index = 1; config->pcell_carrier_index = UE_PCCID(mod_id, i); //TODO: Set carrier aggregation support (boolean) @@ -1432,8 +1405,8 @@ int enb_agent_ue_state_change(mid_t mod_id, uint32_t rnti, uint8_t state_change) // We do not set it for now. No carrier aggregation support //TODO: Set deactivation timer for secondary cell - config->has_scell_deactivation_timer = 1; - config->scell_deactivation_timer = 1; + config->has_scell_deactivation_timer = 0; + config->scell_deactivation_timer = 0; } } else if (state_change == PROTOCOL__FLEX_UE_STATE_CHANGE_TYPE__FLUESC_MOVED) { // TODO: Not supported for now. Leave blank @@ -1462,9 +1435,7 @@ int enb_agent_ue_state_change(mid_t mod_id, uint32_t rnti, uint8_t state_change) LOG_D(ENB_AGENT, "Could not send UE state message\n"); } -/* - * timer primitives - */ + int enb_agent_lc_config_reply(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg) { @@ -1485,7 +1456,6 @@ int enb_agent_lc_config_reply(mid_t mod_id, const void *params, Protocol__Flexra protocol__flex_lc_config_reply__init(lc_config_reply_msg); lc_config_reply_msg->header = header; - //TODO: Fill in the actual number of UEs that we are going to report LC configs about lc_config_reply_msg->n_lc_ue_config = get_num_ues(mod_id); Protocol__FlexLcUeConfig **lc_ue_config; @@ -1498,9 +1468,10 @@ int enb_agent_lc_config_reply(mid_t mod_id, const void *params, Protocol__Flexra for (i = 0; i < lc_config_reply_msg->n_lc_ue_config; i++) { lc_ue_config[i] = malloc(sizeof(Protocol__FlexLcUeConfig)); protocol__flex_lc_ue_config__init(lc_ue_config[i]); - //TODO: Set the RNTI of the UE + lc_ue_config[i]->has_rnti = 1; lc_ue_config[i]->rnti = get_ue_crnti(mod_id,i); + //TODO: Set the number of LC configurations that will be reported for this UE //Set this according to the current state of the UE. This is only a temporary fix int status = 0; @@ -1512,6 +1483,7 @@ int enb_agent_lc_config_reply(mid_t mod_id, const void *params, Protocol__Flexra } else { lc_ue_config[i]->n_lc_config = 3; } + Protocol__FlexLcConfig **lc_config; if (lc_ue_config[i]->n_lc_config > 0) { lc_config = malloc(sizeof(Protocol__FlexLcConfig *) * lc_ue_config[i]->n_lc_config); @@ -1521,38 +1493,39 @@ int enb_agent_lc_config_reply(mid_t mod_id, const void *params, Protocol__Flexra for (j = 0; j < lc_ue_config[i]->n_lc_config; j++) { lc_config[j] = malloc(sizeof(Protocol__FlexLcConfig)); protocol__flex_lc_config__init(lc_config[j]); - //TODO: Set the LC id + lc_config[j]->has_lcid = 1; lc_config[j]->lcid = j+1; - //TODO: Set the LCG of the channel + int lcg = get_lcg(i, j+1); if (lcg >= 0 && lcg <= 3) { lc_config[j]->has_lcg = 1; lc_config[j]->lcg = get_lcg(i,j+1); } - //TODO: Set the LC direction + lc_config[j]->has_direction = 1; lc_config[j]->direction = get_direction(i,j+1); - //TODO: Bearer type. One of FLQBT_* values + //TODO: Bearer type. One of FLQBT_* values. Currently only default bearer supported lc_config[j]->has_qos_bearer_type = 1; lc_config[j]->qos_bearer_type = PROTOCOL__FLEX_QOS_BEARER_TYPE__FLQBT_NON_GBR; + //TODO: Set the QCI defined in TS 23.203, coded as defined in TS 36.413 - // One less than the actual QCI value + // One less than the actual QCI value. Needs to be generalized lc_config[j]->has_qci = 1; lc_config[j]->qci = 1; if (lc_config[j]->direction == PROTOCOL__FLEX_QOS_BEARER_TYPE__FLQBT_GBR) { //TODO: Set the max bitrate (UL) - lc_config[j]->has_e_rab_max_bitrate_ul = 1; - lc_config[j]->e_rab_max_bitrate_ul = 1; + lc_config[j]->has_e_rab_max_bitrate_ul = 0; + lc_config[j]->e_rab_max_bitrate_ul = 0; //TODO: Set the max bitrate (DL) - lc_config[j]->has_e_rab_max_bitrate_dl = 1; - lc_config[j]->e_rab_max_bitrate_dl = 1; + lc_config[j]->has_e_rab_max_bitrate_dl = 0; + lc_config[j]->e_rab_max_bitrate_dl = 0; //TODO: Set the guaranteed bitrate (UL) - lc_config[j]->has_e_rab_guaranteed_bitrate_ul = 1; - lc_config[j]->e_rab_guaranteed_bitrate_ul = 1; + lc_config[j]->has_e_rab_guaranteed_bitrate_ul = 0; + lc_config[j]->e_rab_guaranteed_bitrate_ul = 0; //TODO: Set the guaranteed bitrate (DL) - lc_config[j]->has_e_rab_guaranteed_bitrate_dl = 1; - lc_config[j]->e_rab_guaranteed_bitrate_dl = 1; + lc_config[j]->has_e_rab_guaranteed_bitrate_dl = 0; + lc_config[j]->e_rab_guaranteed_bitrate_dl = 0; } } lc_ue_config[i]->lc_config = lc_config; @@ -1608,7 +1581,6 @@ int enb_agent_ue_config_reply(mid_t mod_id, const void *params, Protocol__Flexra protocol__flex_ue_config_reply__init(ue_config_reply_msg); ue_config_reply_msg->header = header; - //TODO: Fill in the actual number of UEs that are currently connected ue_config_reply_msg->n_ue_config = get_num_ues(mod_id); Protocol__FlexUeConfig **ue_config; @@ -1620,23 +1592,22 @@ int enb_agent_ue_config_reply(mid_t mod_id, const void *params, Protocol__Flexra for (i = 0; i < ue_config_reply_msg->n_ue_config; i++) { ue_config[i] = malloc(sizeof(Protocol__FlexUeConfig)); protocol__flex_ue_config__init(ue_config[i]); - //TODO: Set the RNTI of the ue with id i + ue_config[i]->rnti = get_ue_crnti(mod_id,i); ue_config[i]->has_rnti = 1; //TODO: Set the DRX configuration (optional) //Not supported for now, so we do not set it - //TODO: Set the time_alignment_timer if(get_time_alignment_timer(mod_id,i) != -1){ ue_config[i]->time_alignment_timer = get_time_alignment_timer(mod_id,i); ue_config[i]->has_time_alignment_timer = 1; } - //TODO: Set the measurement gap configuration pattern + if(get_meas_gap_config(mod_id,i) != -1){ ue_config[i]->meas_gap_config_pattern = get_meas_gap_config(mod_id,i); ue_config[i]->has_meas_gap_config_pattern = 1; } - //TODO: Set the measurement gap offset if applicable + if(ue_config[i]->has_meas_gap_config_pattern == 1 && ue_config[i]->meas_gap_config_pattern != PROTOCOL__FLEX_MEAS_GAP_CONFIG_PATTERN__FLMGCP_OFF) { ue_config[i]->meas_gap_config_sf_offset = get_meas_gap_config_offset(mod_id,i); @@ -1651,82 +1622,78 @@ int enb_agent_ue_config_reply(mid_t mod_id, const void *params, Protocol__Flexra //TODO: Set the CQI configuration (Optional) //We do not set it for now - //TODO: Set the transmission mode if(get_ue_transmission_mode(mod_id,i) != -1){ ue_config[i]->transmission_mode = get_ue_transmission_mode(mod_id,i); ue_config[i]->has_transmission_mode = 1; } - //TODO: Set the aggregated bit-rate of the non-gbr bearer (UL) ue_config[i]->ue_aggregated_max_bitrate_ul = get_ue_aggregated_max_bitrate_ul(mod_id,i); ue_config[i]->has_ue_aggregated_max_bitrate_ul = 1; - //TODO: Set the aggregated bit-rate of the non-gbr bearer (DL) ue_config[i]->ue_aggregated_max_bitrate_dl = get_ue_aggregated_max_bitrate_dl(mod_id,i); ue_config[i]->has_ue_aggregated_max_bitrate_dl = 1; - //TODO: Set the UE capabilities Protocol__FlexUeCapabilities *capabilities; capabilities = malloc(sizeof(Protocol__FlexUeCapabilities)); protocol__flex_ue_capabilities__init(capabilities); //TODO: Set half duplex (FDD operation) - capabilities->has_half_duplex = 1; - capabilities->half_duplex = 1;//get_half_duplex(i); + capabilities->has_half_duplex = 0; + capabilities->half_duplex = 0;//get_half_duplex(i); //TODO: Set intra-frame hopping flag - capabilities->has_intra_sf_hopping = 1; + capabilities->has_intra_sf_hopping = 0; capabilities->intra_sf_hopping = 1;//get_intra_sf_hopping(i); //TODO: Set support for type 2 hopping with n_sb > 1 - capabilities->has_type2_sb_1 = 1; + capabilities->has_type2_sb_1 = 0; capabilities->type2_sb_1 = 1;//get_type2_sb_1(i); //TODO: Set ue category - capabilities->has_ue_category = 1; + capabilities->has_ue_category = 0; capabilities->ue_category = 1;//get_ue_category(i); //TODO: Set UE support for resource allocation type 1 - capabilities->has_res_alloc_type1 = 1; + capabilities->has_res_alloc_type1 = 0; capabilities->res_alloc_type1 = 1;//get_res_alloc_type1(i); //Set the capabilites to the message ue_config[i]->capabilities = capabilities; - //TODO: Set UE transmission antenna. One of the FLUTA_* values + if(get_ue_transmission_antenna(mod_id,i) != -1){ ue_config[i]->has_ue_transmission_antenna = 1; ue_config[i]->ue_transmission_antenna = get_ue_transmission_antenna(mod_id,i); } - //TODO: Set tti bundling flag (See ts 36.321) + if(get_tti_bundling(mod_id,i) != -1){ ue_config[i]->has_tti_bundling = 1; ue_config[i]->tti_bundling = get_tti_bundling(mod_id,i); } - //TODO: Set the max HARQ retransmission for the UL + if(get_maxHARQ_TX(mod_id,i) != -1){ ue_config[i]->has_max_harq_tx = 1; ue_config[i]->max_harq_tx = get_maxHARQ_TX(mod_id,i); } - //TODO: Fill beta_offset_ack_index (TS 36.213) + if(get_beta_offset_ack_index(mod_id,i) != -1){ ue_config[i]->has_beta_offset_ack_index = 1; ue_config[i]->beta_offset_ack_index = get_beta_offset_ack_index(mod_id,i); } - //TODO: Fill beta_offset_ri_index (TS 36.213) + if(get_beta_offset_ri_index(mod_id,i) != -1){ ue_config[i]->has_beta_offset_ri_index = 1; ue_config[i]->beta_offset_ri_index = get_beta_offset_ri_index(mod_id,i); } - //TODO: Fill beta_offset_cqi_index (TS 36.213) + if(get_beta_offset_cqi_index(mod_id,i) != -1){ ue_config[i]->has_beta_offset_cqi_index = 1; ue_config[i]->beta_offset_cqi_index = get_beta_offset_cqi_index(mod_id,i); - } - //TODO: Fill ack_nack_simultaneous_trans (TS 36.213) + } + if(get_ack_nack_simultaneous_trans(mod_id,i) != -1){ ue_config[i]->has_ack_nack_simultaneous_trans = 1; ue_config[i]->ack_nack_simultaneous_trans = get_ack_nack_simultaneous_trans(mod_id,i); } - //TODO: Fill simultaneous_ack_nack_cqi (TS 36.213) + if(get_simultaneous_ack_nack_cqi(mod_id,i) != -1){ ue_config[i]->has_simultaneous_ack_nack_cqi = 1; ue_config[i]->simultaneous_ack_nack_cqi = get_simultaneous_ack_nack_cqi(mod_id,i); } - //TODO: Set FLACRM_* value regarding aperiodic cqi report mode + if(get_aperiodic_cqi_rep_mode(mod_id,i) != -1){ ue_config[i]->has_aperiodic_cqi_rep_mode = 1; int mode = get_aperiodic_cqi_rep_mode(mod_id,i); @@ -1736,17 +1703,17 @@ int enb_agent_ue_config_reply(mid_t mod_id, const void *params, Protocol__Flexra ue_config[i]->aperiodic_cqi_rep_mode = mode; } } - //TODO: Set tdd_ack_nack_feedback + if(get_tdd_ack_nack_feedback(mod_id, i) != -1){ ue_config[i]->has_tdd_ack_nack_feedback = 1; ue_config[i]->tdd_ack_nack_feedback = get_tdd_ack_nack_feedback(mod_id,i); } - //TODO: Set ack_nack_repetition factor + if(get_ack_nack_repetition_factor(mod_id, i) != -1){ ue_config[i]->has_ack_nack_repetition_factor = 1; ue_config[i]->ack_nack_repetition_factor = get_ack_nack_repetition_factor(mod_id,i); } - //TODO: Set extended BSR size + if(get_extended_bsr_size(mod_id, i) != -1){ ue_config[i]->has_extended_bsr_size = 1; ue_config[i]->extended_bsr_size = get_extended_bsr_size(mod_id,i); @@ -1754,18 +1721,18 @@ int enb_agent_ue_config_reply(mid_t mod_id, const void *params, Protocol__Flexra //TODO: Set carrier aggregation support (boolean) ue_config[i]->has_ca_support = 0; ue_config[i]->ca_support = 0; - //TODO: Set index of primary cell + ue_config[i]->has_pcell_carrier_index = 1; ue_config[i]->pcell_carrier_index = UE_PCCID(mod_id, i); if(ue_config[i]->has_ca_support){ //TODO: Set cross carrier scheduling support (boolean) - ue_config[i]->has_cross_carrier_sched_support = 1; + ue_config[i]->has_cross_carrier_sched_support = 0; ue_config[i]->cross_carrier_sched_support = 0; //TODO: Set secondary cells configuration // We do not set it for now. No carrier aggregation support //TODO: Set deactivation timer for secondary cell - ue_config[i]->has_scell_deactivation_timer = 1; - ue_config[i]->scell_deactivation_timer = 1; + ue_config[i]->has_scell_deactivation_timer = 0; + ue_config[i]->scell_deactivation_timer = 0; } } ue_config_reply_msg->ue_config = ue_config; @@ -1871,26 +1838,26 @@ int enb_agent_enb_config_reply(mid_t mod_id, const void *params, Protocol__Flexr for(i = 0; i < enb_config_reply_msg->n_cell_config; i++){ cell_conf[i] = malloc(sizeof(Protocol__FlexCellConfig)); protocol__flex_cell_config__init(cell_conf[i]); - //TODO: Fill in with actual value, the PCI of this cell + cell_conf[i]->phy_cell_id = 1; cell_conf[i]->has_phy_cell_id = get_cell_id(enb_id,i); - //TODO: Fill in with actual value, the PLMN cell id of this cell + cell_conf[i]->cell_id = i; cell_conf[i]->has_cell_id = 1; - //TODO: Fill in with actual value, PUSCH resources in RBs for hopping + cell_conf[i]->pusch_hopping_offset = get_hopping_offset(enb_id,i); cell_conf[i]->has_pusch_hopping_offset = 1; - //TODO: Fill in with actual value + if(get_hopping_mode(enb_id,i) == 0){ cell_conf[i]->hopping_mode = PROTOCOL__FLEX_HOPPING_MODE__FLHM_INTER; }else if(get_hopping_mode(enb_id,i) == 1){ cell_conf[i]->hopping_mode = PROTOCOL__FLEX_HOPPING_MODE__FLHM_INTERINTRA; } cell_conf[i]->has_hopping_mode = 1; - //TODO: Fill in with actual value, the number of subbands + cell_conf[i]->n_sb = get_n_SB(enb_id,i); cell_conf[i]->has_n_sb = 1; - //TODO: Fill in with actual value, The number of resource element groups used for PHICH. One of FLPR_ + if(get_phich_resource(enb_id,i) == 0){ cell_conf[i]->phich_resource = PROTOCOL__FLEX_PHICH_RESOURCE__FLPR_ONE_SIXTH; //0 }else if (get_phich_resource(enb_id,i) == 1){ @@ -1901,7 +1868,7 @@ int enb_agent_enb_config_reply(mid_t mod_id, const void *params, Protocol__Flexr cell_conf[i]->phich_resource = PROTOCOL__FLEX_PHICH_RESOURCE__FLPR_TWO;//3 } cell_conf[i]->has_phich_resource = 1; - //TODO: Fill in with actual value, one of the FLPD_ values + if(get_phich_duration(enb_id,i) == 0){ cell_conf[i]->phich_duration = PROTOCOL__FLEX_PHICH_DURATION__FLPD_NORMAL; }else if(get_phich_duration(enb_id,i) == 1){ @@ -1910,7 +1877,7 @@ int enb_agent_enb_config_reply(mid_t mod_id, const void *params, Protocol__Flexr cell_conf[i]->has_phich_duration = 1; //TODO: Fill in with actual value, See TS 36.211, section 6.9 cell_conf[i]->init_nr_pdcch_ofdm_sym = get_num_pdcch_symb(enb_id,i); - cell_conf[i]->has_init_nr_pdcch_ofdm_sym = 1; + cell_conf[i]->has_init_nr_pdcch_ofdm_sym = 0; //TODO: Fill in with actual value /* Protocol__FlexSiConfig *si_config; */ /* si_config = malloc(sizeof(Protocol__FlexSiConfig)); */ @@ -1949,20 +1916,19 @@ int enb_agent_enb_config_reply(mid_t mod_id, const void *params, Protocol__Flexr /* } */ /* cell_conf[i]->si_config = si_config; */ - //TODO: Fill in with actual value, the DL transmission bandwidth in RBs cell_conf[i]->dl_bandwidth = get_N_RB_DL(enb_id,i); cell_conf[i]->has_dl_bandwidth = 1; - //TODO: Fill in with actual value, the UL transmission bandwidth in RBs + cell_conf[i]->ul_bandwidth = get_N_RB_UL(enb_id,i); cell_conf[i]->has_ul_bandwidth = 1; - //TODO: Fill in with actual value, one of FLUCPL values + if(get_ul_cyclic_prefix_length(enb_id,i) == 0){ cell_conf[i]->ul_cyclic_prefix_length = PROTOCOL__FLEX_UL_CYCLIC_PREFIX_LENGTH__FLUCPL_NORMAL; }else if(get_ul_cyclic_prefix_length(enb_id,i) == 1){ cell_conf[i]->ul_cyclic_prefix_length = PROTOCOL__FLEX_UL_CYCLIC_PREFIX_LENGTH__FLUCPL_EXTENDED; } cell_conf[i]->has_ul_cyclic_prefix_length = 1; - //TODO: Fill in with actual value, one of FLUCPL values + if(get_ul_cyclic_prefix_length(enb_id,i) == 0){ cell_conf[i]->ul_cyclic_prefix_length = PROTOCOL__FLEX_DL_CYCLIC_PREFIX_LENGTH__FLDCPL_NORMAL; }else if(get_ul_cyclic_prefix_length(enb_id,i) == 1){ @@ -1970,10 +1936,10 @@ int enb_agent_enb_config_reply(mid_t mod_id, const void *params, Protocol__Flexr } cell_conf[i]->has_dl_cyclic_prefix_length = 1; - //TODO: Fill in with actual value, number of cell specific antenna ports + //TODO: Fill in with actual value, number of cell specific antenna ports. Currently single port support cell_conf[i]->antenna_ports_count = 1; cell_conf[i]->has_antenna_ports_count = 1; - //TODO: Fill in with actual value, one of FLDM values + if(get_duplex_mode(enb_id,i) == 1){ cell_conf[i]->duplex_mode = PROTOCOL__FLEX_DUPLEX_MODE__FLDM_FDD; }else if(get_duplex_mode(enb_id,i) == 0){ @@ -1982,10 +1948,10 @@ int enb_agent_enb_config_reply(mid_t mod_id, const void *params, Protocol__Flexr cell_conf[i]->has_duplex_mode = 1; //TODO: Fill in with actual value, DL/UL subframe assignment. TDD only cell_conf[i]->subframe_assignment = get_subframe_assignment(enb_id,i); - cell_conf[i]->has_subframe_assignment = 1; + cell_conf[i]->has_subframe_assignment = 0; //TODO: Fill in with actual value, TDD only. See TS 36.211, table 4.2.1 cell_conf[i]->special_subframe_patterns = get_special_subframe_assignment(enb_id,i); - cell_conf[i]->has_special_subframe_patterns = 1; + cell_conf[i]->has_special_subframe_patterns = 0; //TODO: Fill in with actual value, The MBSFN radio frame period cell_conf[i]->n_mbsfn_subframe_config_rfperiod = 5; uint32_t *elem_rfperiod; @@ -2019,47 +1985,46 @@ int enb_agent_enb_config_reply(mid_t mod_id, const void *params, Protocol__Flexr } cell_conf[i]->mbsfn_subframe_config_sfalloc = elem_sfalloc; - //TODO: Fill in with actual value, See TS 36.211, section 5.7.1 cell_conf[i]->prach_config_index = get_prach_ConfigIndex(enb_id,i); cell_conf[i]->has_prach_config_index = 1; - //TODO: Fill in with actual value, See TS 36.211, section 5.7.1 + cell_conf[i]->prach_freq_offset = get_prach_FreqOffset(enb_id,i); cell_conf[i]->has_prach_freq_offset = 1; - //TODO: Fill in with actual value, Duration of RA response window in SF + cell_conf[i]->ra_response_window_size = get_ra_ResponseWindowSize(enb_id,i); cell_conf[i]->has_ra_response_window_size = 1; - //TODO: Fill in with actual value, Timer used for RA + cell_conf[i]->mac_contention_resolution_timer = get_mac_ContentionResolutionTimer(enb_id,i); cell_conf[i]->has_mac_contention_resolution_timer = 1; - //TODO: Fill in with actual value, See TS 36.321 + cell_conf[i]->max_harq_msg3tx = get_maxHARQ_Msg3Tx(enb_id,i); cell_conf[i]->has_max_harq_msg3tx = 1; - //TODO: Fill in with actual value, See TS 36.213, section 10.1 + cell_conf[i]->n1pucch_an = get_n1pucch_an(enb_id,i); cell_conf[i]->has_n1pucch_an = 1; - //TODO: Fill in with actual value, See TS 36.211, section 5.4 + cell_conf[i]->deltapucch_shift = get_deltaPUCCH_Shift(enb_id,i); cell_conf[i]->has_deltapucch_shift = 1; - //TODO: Fill in with actual value, See TS 36.211, section 5.4 + cell_conf[i]->nrb_cqi = get_nRB_CQI(enb_id,i); cell_conf[i]->has_nrb_cqi = 1; - //TODO: Fill in with actual value, See TS 36.211, table 5.5.3.3-1 and 2 + cell_conf[i]->srs_subframe_config = get_srs_SubframeConfig(enb_id,i); cell_conf[i]->has_srs_subframe_config = 1; - //TODO: Fill in with actual value, See TS 36.211, section 5.5.3.2 + cell_conf[i]->srs_bw_config = get_srs_BandwidthConfig(enb_id,i); cell_conf[i]->has_srs_bw_config = 1; - //TODO: Fill in with actual value, Boolean value. See TS 36.211, section 5.5.3.2. TDD only + cell_conf[i]->srs_mac_up_pts = get_srs_MaxUpPts(enb_id,i); cell_conf[i]->has_srs_mac_up_pts = 1; - //TODO: Fill in with actual value, One of the FLEQ_ values + if(get_enable64QAM(enb_id,i) == 0){ cell_conf[i]->enable_64qam = PROTOCOL__FLEX_QAM__FLEQ_MOD_16QAM; }else if(get_enable64QAM(enb_id,i) == 1){ cell_conf[i]->enable_64qam = PROTOCOL__FLEX_QAM__FLEQ_MOD_64QAM; } cell_conf[i]->has_enable_64qam = 1; - //TODO: Fill in with actual value, Carrier component index + cell_conf[i]->carrier_index = i; cell_conf[i]->has_carrier_index = 1; } @@ -2088,6 +2053,11 @@ int enb_agent_enb_config_reply(mid_t mod_id, const void *params, Protocol__Flexr } + +/* + * timer primitives + */ + //struct enb_agent_map agent_map; enb_agent_timer_instance_t timer_instance; int agent_timer_init = 0; @@ -2099,11 +2069,6 @@ err_code_t enb_agent_init_timer(void){ agent_timer_init = 1; } - /* - struct enb_agent_timer_element_s e; - memset(&e, 0, sizeof(enb_agent_timer_element_t)); - RB_INSERT(enb_agent_map, &agent_map, &e); - */ return PROTOCOL__FLEXRAN_ERR__NO_ERR; } @@ -2249,13 +2214,6 @@ void enb_agent_sleep_until(struct timespec *ts, int delay) { clock_nanosleep(CLOCK_MONOTONIC, TIMER_ABSTIME, ts, NULL); } -/* - int i =0; - RB_FOREACH(e, enb_agent_map, &enb_agent_head) { - printf("%d: %p\n", i, e); i++; - } -*/ - err_code_t enb_agent_stop_timer(long timer_id){ @@ -2283,39 +2241,3 @@ struct enb_agent_timer_element_s * get_timer_entry(long timer_id) { return RB_FIND(enb_agent_map, &timer_instance.enb_agent_head, &search); } - -/* -// this will change the timer_id -err_code_t enb_agent_restart_timer(uint32_t *timer_id){ - - struct enb_agent_timer_element_s *e=NULL; - - RB_FOREACH(e, enb_agent_map, &enb_agent_head) { - if (e->timer_id == timer_id) - break; - } - - if (e != NULL ) { - e->state = ENB_AGENT_TIMER_STATE_ACTIVE; - } - - ret = timer_setup(e->interval_sec, - e->interval_usec, - e->agent_id, - e->instance, - e->type, - e->timer_args, - &timer_id); - - } - - if (ret < 0 ) { - return PROTOCOL__FLEXRAN_ERR__TIMER_SETUP_FAILED; - } - - return 0; - -} - -*/ - diff --git a/openair2/ENB_APP/enb_agent_common.h b/openair2/ENB_APP/enb_agent_common.h index b5a35ec338..6664958ed9 100644 --- a/openair2/ENB_APP/enb_agent_common.h +++ b/openair2/ENB_APP/enb_agent_common.h @@ -73,54 +73,75 @@ typedef int (*enb_agent_message_destruction_callback)( * functions and generic handlers **********************************/ +/* Helper functions for message (de)serialization */ int enb_agent_serialize_message(Protocol__FlexranMessage *msg, void **buf, int *size); int enb_agent_deserialize_message(void *data, int size, Protocol__FlexranMessage **msg); +/* Serialize message and then destroy the input flexran msg. Should be called when protocol + message is created dynamically */ void * enb_agent_pack_message(Protocol__FlexranMessage *msg, uint32_t * size); +/* Calls destructor of the given message */ err_code_t enb_agent_destroy_flexran_message(Protocol__FlexranMessage *msg); +/* Function to create the header for any FlexRAN protocol message */ int flex_create_header(xid_t xid, Protocol__FlexType type, Protocol__FlexHeader **header); +/* Hello protocol message constructor and destructor */ int enb_agent_hello(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg); int enb_agent_destroy_hello(Protocol__FlexranMessage *msg); +/* Echo request protocol message constructor and destructor */ int enb_agent_echo_request(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg); int enb_agent_destroy_echo_request(Protocol__FlexranMessage *msg); +/* Echo reply protocol message constructor and destructor */ int enb_agent_echo_reply(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg); int enb_agent_destroy_echo_reply(Protocol__FlexranMessage *msg); +/* eNodeB configuration reply message constructor and destructor */ int enb_agent_enb_config_reply(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg); int enb_agent_destroy_enb_config_reply(Protocol__FlexranMessage *msg); +/* UE configuration reply message constructor and destructor */ int enb_agent_ue_config_reply(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg); int enb_agent_destroy_ue_config_reply(Protocol__FlexranMessage *msg); +/* Logical channel reply configuration message constructor and destructor */ int enb_agent_lc_config_reply(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg); int enb_agent_destroy_lc_config_reply(Protocol__FlexranMessage *msg); +/* eNodeB configuration request message constructor and destructor */ int enb_agent_enb_config_request(mid_t mod_id, const void* params, Protocol__FlexranMessage **msg); int enb_agent_destroy_enb_config_request(Protocol__FlexranMessage *msg); +/* UE configuration request message constructor */ +/* TODO: Need to define and implement destructor */ int enb_agent_destroy_ue_config_request(Protocol__FlexranMessage *msg); +/* Logical channel configuration request message constructor */ +/* TODO: Need to define and implement destructor */ int enb_agent_destroy_lc_config_request(Protocol__FlexranMessage *msg); +/* UE state change message constructor and destructor */ int enb_agent_ue_state_change(mid_t mod_id, uint32_t rnti, uint8_t state_change); int enb_agent_destroy_ue_state_change(Protocol__FlexranMessage *msg); +/* Control delegation message constructor and destructor */ int enb_agent_control_delegation(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg); int enb_agent_destroy_control_delegation(Protocol__FlexranMessage *msg); +/* Policy reconfiguration message constructor and destructor */ int enb_agent_reconfiguration(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg); int enb_agent_destroy_agent_reconfiguration(Protocol__FlexranMessage *msg); +/* FlexRAN protocol message dispatcher function */ Protocol__FlexranMessage* enb_agent_handle_message (mid_t mod_id, uint8_t *data, uint32_t size); +/* Function to be used to send a message to a dispatcher once the appropriate event is triggered. */ Protocol__FlexranMessage *enb_agent_handle_timed_task(void *args); @@ -148,73 +169,113 @@ unsigned int get_current_subframe(mid_t mod_id); Bits 0-3 subframe, rest for frame. Required by FlexRAN protocol*/ uint16_t get_sfn_sf (mid_t mod_id); +/* Return a future frame and subframe number that is ahead_of_time + subframes later in compact 16-bit format. Bits 0-3 subframe, + rest for frame */ uint16_t get_future_sfn_sf(mid_t mod_id, int ahead_of_time); +/* Return the number of attached UEs */ int get_num_ues(mid_t mod_id); +/* Get the rnti of a UE with id ue_id */ int get_ue_crnti (mid_t mod_id, mid_t ue_id); +/* Get the RLC buffer status report of a ue for a designated + logical channel id */ int get_ue_bsr (mid_t mod_id, mid_t ue_id, lcid_t lcid); +/* Get power headroom of UE with id ue_id */ int get_ue_phr (mid_t mod_id, mid_t ue_id); +/* Get the UE wideband CQI */ int get_ue_wcqi (mid_t mod_id, mid_t ue_id); +/* Get the transmission queue size for a UE with a channel_id logical channel id */ int get_tx_queue_size(mid_t mod_id, mid_t ue_id, logical_chan_id_t channel_id); +/* Return timing advance MAC control element for a designated cell and UE */ int get_MAC_CE_bitmap_TA(mid_t mod_id, mid_t ue_id, int CC_id); +/* Get the number of active component carriers for a specific UE */ int get_active_CC(mid_t mod_id, mid_t ue_id); +/* Get the rank indicator for a designated cell and UE */ int get_current_RI(mid_t mod_id, mid_t ue_id, int CC_id); +/* See TS 36.213, section 10.1 */ int get_n1pucch_an(mid_t mod_id, int CC_id); +/* See TS 36.211, section 5.4 */ int get_nRB_CQI(mid_t mod_id, int CC_id); +/* See TS 36.211, section 5.4 */ int get_deltaPUCCH_Shift(mid_t mod_id, int CC_id); +/* See TS 36.211, section 5.7.1 */ int get_prach_ConfigIndex(mid_t mod_id, int CC_id); +/* See TS 36.211, section 5.7.1 */ int get_prach_FreqOffset(mid_t mod_id, int CC_id); +/* See TS 36.321 */ int get_maxHARQ_Msg3Tx(mid_t mod_id, int CC_id); +/* Get the length of the UL cyclic prefix */ int get_ul_cyclic_prefix_length(mid_t mod_id, int CC_id); +/* Get the length of the DL cyclic prefix */ int get_dl_cyclic_prefix_length(mid_t mod_id, int CC_id); +/* Get the physical cell id of a cell */ int get_cell_id(mid_t mod_id, int CC_id); +/* See TS 36.211, section 5.5.3.2 */ int get_srs_BandwidthConfig(mid_t mod_id, int CC_id); +/* See TS 36.211, table 5.5.3.3-1 and 2 */ int get_srs_SubframeConfig(mid_t mod_id, int CC_id); +/* Boolean value. See TS 36.211, + section 5.5.3.2. TDD only */ int get_srs_MaxUpPts(mid_t mod_id, int CC_id); +/* Get number of DL resource blocks */ int get_N_RB_DL(mid_t mod_id, int CC_id); +/* Get number of UL resource blocks */ int get_N_RB_UL(mid_t mod_id, int CC_id); +/* Get DL/UL subframe assignment. TDD only */ int get_subframe_assignment(mid_t mod_id, int CC_id); +/* TDD only. See TS 36.211, table 4.2.1 */ int get_special_subframe_assignment(mid_t mod_id, int CC_id); +/* Get the duration of the random access response window in subframes */ int get_ra_ResponseWindowSize(mid_t mod_id, int CC_id); +/* Get timer used for random access */ int get_mac_ContentionResolutionTimer(mid_t mod_id, int CC_id); +/* Get type of duplex mode (FDD/TDD) */ int get_duplex_mode(mid_t mod_id, int CC_id); +/* Get the SI window length */ long get_si_window_length(mid_t mod_id, int CC_id); +/* Get the number of PDCCH symbols configured for the cell */ int get_num_pdcch_symb(mid_t mod_id, int CC_id); +/* See TS 36.213, sec 5.1.1.1 */ int get_tpc(mid_t mod_id, mid_t ue_id); +/* Get the first available HARQ process for a specific cell and UE during + a designated frame and subframe. Returns 0 for success. The id and the + status of the HARQ process are stored in id and status respectively */ int get_harq(const mid_t mod_id, const uint8_t CC_id, const mid_t ue_id, const int frame, const uint8_t subframe, int *id, int *status); +/* Reported values for uplink power control */ int get_p0_pucch_dbm(mid_t mod_id, mid_t ue_id, int CC_id); int get_p0_nominal_pucch(mid_t mod_id, int CC_id); @@ -225,54 +286,88 @@ int get_p0_nominal_pucch(mid_t mod_id, int CC_id); * ************************************ */ +/* Get timer in subframes. Controls the synchronization + status of the UE, not the actual timing + advance procedure. See TS 36.321 */ int get_time_alignment_timer(mid_t mod_id, mid_t ue_id); +/* Get measurement gap configuration. See TS 36.133 */ int get_meas_gap_config(mid_t mod_id, mid_t ue_id); +/* Get measurement gap configuration offset if applicable */ int get_meas_gap_config_offset(mid_t mod_id, mid_t ue_id); +/* DL aggregated bit-rate of non-gbr bearer + per UE. See TS 36.413 */ int get_ue_aggregated_max_bitrate_dl (mid_t mod_id, mid_t ue_id); +/* UL aggregated bit-rate of non-gbr bearer + per UE. See TS 36.413 */ int get_ue_aggregated_max_bitrate_ul (mid_t mod_id, mid_t ue_id); +/* Only half-duplex support. FDD + operation. Boolean value */ int get_half_duplex(mid_t ue_id); +/* Support of intra-subframe hopping. + Boolean value */ int get_intra_sf_hopping(mid_t ue_id); +/* UE support for type 2 hopping with + n_sb>1 */ int get_type2_sb_1(mid_t ue_id); +/* Get the UE category */ int get_ue_category(mid_t ue_id); +/* UE support for resource allocation + type 1 */ int get_res_alloc_type1(mid_t ue_id); +/* Get UE transmission mode */ int get_ue_transmission_mode(mid_t mod_id, mid_t ue_id); +/* Boolean value. See TS 36.321 */ int get_tti_bundling(mid_t mod_id, mid_t ue_id); +/* The max HARQ retransmission for UL. + See TS 36.321 */ int get_maxHARQ_TX(mid_t mod_id, mid_t ue_id); +/* See TS 36.213 */ int get_beta_offset_ack_index(mid_t mod_id, mid_t ue_id); +/* See TS 36.213 */ int get_beta_offset_ri_index(mid_t mod_id, mid_t ue_id); +/* See TS 36.213 */ int get_beta_offset_cqi_index(mid_t mod_id, mid_t ue_id); +/* Boolean. See TS36.213, Section 10.1 */ int get_simultaneous_ack_nack_cqi(mid_t mod_id, mid_t ue_id); +/* Boolean. See TS 36.213, Section 8.2 */ int get_ack_nack_simultaneous_trans(mid_t mod_id,mid_t ue_id); +/* Get aperiodic CQI report mode */ int get_aperiodic_cqi_rep_mode(mid_t mod_id,mid_t ue_id); +/* Get ACK/NACK feedback mode. TDD only */ int get_tdd_ack_nack_feedback(mid_t mod_id, mid_t ue_id); +/* See TS36.213, section 10.1 */ int get_ack_nack_repetition_factor(mid_t mod_id, mid_t ue_id); +/* Boolean. Extended buffer status report size */ int get_extended_bsr_size(mid_t mod_id, mid_t ue_id); +/* Get number of UE transmission antennas */ int get_ue_transmission_antenna(mid_t mod_id, mid_t ue_id); +/* Get logical channel group of a channel with id lc_id */ int get_lcg(mid_t ue_id, mid_t lc_id); +/* Get direction of logical channel with id lc_id */ int get_direction(mid_t ue_id, mid_t lc_id); /******************* @@ -349,8 +444,11 @@ typedef struct enb_agent_timer_instance_s{ RB_HEAD(enb_agent_map, enb_agent_timer_element_s) enb_agent_head; }enb_agent_timer_instance_t; + err_code_t enb_agent_init_timer(void); +/* Create a timer for some agent related event with id xid. Will store the id + of the generated timer in timer_id */ err_code_t enb_agent_create_timer(uint32_t interval_sec, uint32_t interval_usec, agent_id_t agent_id, @@ -361,18 +459,28 @@ err_code_t enb_agent_create_timer(uint32_t interval_sec, void* timer_args, long *timer_id); +/* Destroy all existing timers */ err_code_t enb_agent_destroy_timers(void); + +/* Destroy the timer with the given timer_id */ err_code_t enb_agent_destroy_timer(long timer_id); + +/* Destroy the timer for task with id xid */ err_code_t enb_agent_destroy_timer_by_task_id(xid_t xid); +/* Stop a timer */ err_code_t enb_agent_stop_timer(long timer_id); +/* Restart the given timer */ err_code_t enb_agent_restart_timer(long *timer_id); +/* Find the timer with the given timer_id */ struct enb_agent_timer_element_s * get_timer_entry(long timer_id); +/* Obtain the protocol message stored in the given expired timer */ Protocol__FlexranMessage * enb_agent_process_timeout(long timer_id, void* timer_args); +/* Comparator function comparing two timers. Decides the ordering of the timers */ int enb_agent_compare_timer(struct enb_agent_timer_element_s *a, struct enb_agent_timer_element_s *b); /*Specify a delay in nanoseconds to timespec and sleep until then*/ @@ -383,10 +491,3 @@ RB_PROTOTYPE(enb_agent_map, enb_agent_timer_element_s, entry, enb_agent_compare_ #endif - - - - - - - diff --git a/openair2/ENB_APP/enb_agent_extern.h b/openair2/ENB_APP/enb_agent_extern.h index 0dd7cfb90f..58f86dfe15 100644 --- a/openair2/ENB_APP/enb_agent_extern.h +++ b/openair2/ENB_APP/enb_agent_extern.h @@ -44,10 +44,13 @@ //extern msg_context_t shared_ctxt[NUM_MAX_ENB][ENB_AGENT_MAX]; +/* full path of the local cache for storing VSFs */ extern char local_cache[40]; +/* Control module interface for the communication of the MAC Control Module with the agent */ extern AGENT_MAC_xface *agent_mac_xface[NUM_MAX_ENB]; +/* Flag indicating whether the VSFs for the MAC control module have been registered */ extern unsigned int mac_agent_registered[NUM_MAX_ENB]; #endif diff --git a/openair2/ENB_APP/enb_agent_mac.c b/openair2/ENB_APP/enb_agent_mac.c index d040622a02..330dafad3a 100644 --- a/openair2/ENB_APP/enb_agent_mac.c +++ b/openair2/ENB_APP/enb_agent_mac.c @@ -422,62 +422,55 @@ int enb_agent_mac_stats_reply(mid_t mod_id, /* Check flag for creation of buffer status report */ if (report_config->ue_report_type[i].ue_report_flags & PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_BSR) { - //TODO: Create a report for each LCG (4 elements). See flex_ue_stats_report of - // FlexRAN specifications for more details ue_report[i]->n_bsr = 4; uint32_t *elem; elem = (uint32_t *) malloc(sizeof(uint32_t)*ue_report[i]->n_bsr); if (elem == NULL) goto error; for (j = 0; j++; j < ue_report[i]->n_bsr) { - // Set the actual BSR for LCG j of the current UE // NN: we need to know the cc_id here, consider the first one - elem[j] = get_ue_bsr (enb_id, i, j); //eNB_UE_list->UE_template[UE_PCCID(enb_id,i)][i].bsr_info[j]; + elem[j] = get_ue_bsr (enb_id, i, j); } ue_report[i]->bsr = elem; } /* Check flag for creation of PRH report */ if (report_config->ue_report_type[i].ue_report_flags & PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_PRH) { - // TODO: Fill in the actual power headroom value for the RNTI ue_report[i]->phr = get_ue_phr (enb_id, i); // eNB_UE_list->UE_template[UE_PCCID(enb_id,i)][i].phr_info; ue_report[i]->has_phr = 1; } /* Check flag for creation of RLC buffer status report */ if (report_config->ue_report_type[i].ue_report_flags & PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_RLC_BS) { - // TODO: Fill in the actual RLC buffer status reports - ue_report[i]->n_rlc_report = 3; // Set this to the number of LCs for this UE + ue_report[i]->n_rlc_report = 3; // Set this to the number of LCs for this UE. This needs to be generalized for for LCs Protocol__FlexRlcBsr ** rlc_reports; rlc_reports = malloc(sizeof(Protocol__FlexRlcBsr *) * ue_report[i]->n_rlc_report); if (rlc_reports == NULL) goto error; - // Fill the buffer status report for each logical channel of the UE // NN: see LAYER2/openair2_proc.c for rlc status for (j = 0; j < ue_report[i]->n_rlc_report; j++) { rlc_reports[j] = malloc(sizeof(Protocol__FlexRlcBsr)); if (rlc_reports[j] == NULL) goto error; protocol__flex_rlc_bsr__init(rlc_reports[j]); - //TODO:Set logical channel id rlc_reports[j]->lc_id = j+1; rlc_reports[j]->has_lc_id = 1; - //TODO:Set tx queue size in bytes rlc_reports[j]->tx_queue_size = get_tx_queue_size(enb_id,i,j+1); rlc_reports[j]->has_tx_queue_size = 1; + //TODO:Set tx queue head of line delay in ms rlc_reports[j]->tx_queue_hol_delay = 100; - rlc_reports[j]->has_tx_queue_hol_delay = 1; + rlc_reports[j]->has_tx_queue_hol_delay = 0; //TODO:Set retransmission queue size in bytes rlc_reports[j]->retransmission_queue_size = 10; - rlc_reports[j]->has_retransmission_queue_size = 1; + rlc_reports[j]->has_retransmission_queue_size = 0; //TODO:Set retransmission queue head of line delay in ms rlc_reports[j]->retransmission_queue_hol_delay = 100; - rlc_reports[j]->has_retransmission_queue_hol_delay = 1; + rlc_reports[j]->has_retransmission_queue_hol_delay = 0; //TODO:Set current size of the pending message in bytes rlc_reports[j]->status_pdu_size = 100; - rlc_reports[j]->has_status_pdu_size = 1; + rlc_reports[j]->has_status_pdu_size = 0; } // Add RLC buffer status reports to the full report if (ue_report[i]->n_rlc_report > 0) @@ -502,12 +495,13 @@ int enb_agent_mac_stats_reply(mid_t mod_id, if (dl_report == NULL) goto error; protocol__flex_dl_cqi_report__init(dl_report); - //TODO:Set the SFN and SF of the last report held in the agent. + dl_report->sfn_sn = get_sfn_sf(enb_id); dl_report->has_sfn_sn = 1; - //TODO:Set the number of DL CQI reports for this UE. One for each CC + //Set the number of DL CQI reports for this UE. One for each CC dl_report->n_csi_report = get_active_CC(enb_id,i); - //TODO:Create the actual CSI reports. + + //Create the actual CSI reports. Protocol__FlexDlCsi **csi_reports; csi_reports = malloc(sizeof(Protocol__FlexDlCsi *)*dl_report->n_csi_report); if (csi_reports == NULL) @@ -517,14 +511,14 @@ int enb_agent_mac_stats_reply(mid_t mod_id, if (csi_reports[j] == NULL) goto error; protocol__flex_dl_csi__init(csi_reports[j]); - //TODO: the servCellIndex for this report + //The servCellIndex for this report csi_reports[j]->serv_cell_index = j; csi_reports[j]->has_serv_cell_index = 1; - //TODO: the rank indicator value for this cc + //The rank indicator value for this cc csi_reports[j]->ri = get_current_RI(enb_id,i,j); csi_reports[j]->has_ri = 1; //TODO: the type of CSI report based on the configuration of the UE - //For this example we use type P10, which only needs a wideband value + //For now we only support type P10, which only needs a wideband value //The full set of types can be found in stats_common.pb-c.h and //in the FlexRAN specifications csi_reports[j]->type = PROTOCOL__FLEX_CSI_TYPE__FLCSIT_P10; @@ -598,16 +592,16 @@ int enb_agent_mac_stats_reply(mid_t mod_id, //TODO: Set paging index. This index is the same that will be used for the scheduling of the //paging message by the controller p_info[j]->paging_index = 10; - p_info[j]->has_paging_index = 1; + p_info[j]->has_paging_index = 0; //TODO:Set the paging message size p_info[j]->paging_message_size = 100; - p_info[j]->has_paging_message_size = 1; + p_info[j]->has_paging_message_size = 0; //TODO: Set the paging subframe p_info[j]->paging_subframe = 10; - p_info[j]->has_paging_subframe = 1; + p_info[j]->has_paging_subframe = 0; //TODO: Set the carrier index for the pending paging message p_info[j]->carrier_index = 0; - p_info[j]->has_carrier_index = 1; + p_info[j]->has_carrier_index = 0; } //Add all paging info to the paging buffer rerport paging_report->paging_info = p_info; @@ -645,7 +639,7 @@ int enb_agent_mac_stats_reply(mid_t mod_id, ul_report[j]->has_type = 1; //TODO:Set the number of SINR measurements based on the report type //See struct flex_ul_cqi in FlexRAN specification for more details - ul_report[j]->n_sinr = 100; + ul_report[j]->n_sinr = 0; uint32_t *sinr_meas; sinr_meas = (uint32_t *) malloc(sizeof(uint32_t) * ul_report[j]->n_sinr); if (sinr_meas == NULL) @@ -712,12 +706,12 @@ int enb_agent_mac_stats_reply(mid_t mod_id, // Current frame and subframe number ni_report->sfn_sf = get_sfn_sf(enb_id); ni_report->has_sfn_sf = 1; - // Received interference power in dbm + //TODO:Received interference power in dbm ni_report->rip = 0; - ni_report->has_rip = 1; - // Thermal noise power in dbm + ni_report->has_rip = 0; + //TODO:Thermal noise power in dbm ni_report->tnp = 0; - ni_report->has_tnp = 1; + ni_report->has_tnp = 0; ni_report->p0_nominal_pucch = get_p0_nominal_pucch(enb_id, 0); ni_report->has_p0_nominal_pucch = 1; @@ -988,13 +982,13 @@ int enb_agent_mac_sf_trigger(mid_t mod_id, const void *params, Protocol__Flexran protocol__flex_dl_info__init(dl_info[i]); dl_info[i]->rnti = get_ue_crnti(mod_id, i); dl_info[i]->has_rnti = 1; - /*TODO: fill in the right id of this round's HARQ process for this UE*/ + /*Fill in the right id of this round's HARQ process for this UE*/ int harq_id; int harq_status; get_harq(mod_id, UE_PCCID(mod_id,i), i, frame, subframe, &harq_id, &harq_status); dl_info[i]->harq_process_id = harq_id; dl_info[i]->has_harq_process_id = 1; - /*TODO: fill in the status of the HARQ process (2 TBs)*/ + /* Fill in the status of the HARQ process (2 TBs)*/ dl_info[i]->n_harq_status = 2; dl_info[i]->harq_status = malloc(sizeof(uint32_t) * dl_info[i]->n_harq_status); for (j = 0; j < dl_info[i]->n_harq_status; j++) { @@ -1004,7 +998,7 @@ int enb_agent_mac_sf_trigger(mid_t mod_id, const void *params, Protocol__Flexran else if (harq_status == 1) dl_info[i]->harq_status[j] = PROTOCOL__FLEX_HARQ_STATUS__FLHS_NACK; } - /*TODO: fill in the serving cell index for this UE */ + /*Fill in the serving cell index for this UE */ dl_info[i]->serv_cell_index = UE_PCCID(mod_id,i); dl_info[i]->has_serv_cell_index = 1; } @@ -1012,8 +1006,8 @@ int enb_agent_mac_sf_trigger(mid_t mod_id, const void *params, Protocol__Flexran sf_trigger_msg->dl_info = dl_info; - /*TODO: Fill in the number of UL reception status related info, based on the number of currently - *transmitting UEs + /* Fill in the number of UL reception status related info, based on the number of currently + * transmitting UEs */ sf_trigger_msg->n_ul_info = get_num_ues(mod_id); @@ -1031,7 +1025,7 @@ int enb_agent_mac_sf_trigger(mid_t mod_id, const void *params, Protocol__Flexran protocol__flex_ul_info__init(ul_info[i]); ul_info[i]->rnti = get_ue_crnti(mod_id, i); ul_info[i]->has_rnti = 1; - /*TODO: fill in the Tx power control command for this UE (if available)*/ + /*Fill in the Tx power control command for this UE (if available)*/ if(get_tpc(mod_id,i) != 1){ ul_info[i]->tpc = get_tpc(mod_id,i); ul_info[i]->has_tpc = 1; @@ -1042,7 +1036,7 @@ int enb_agent_mac_sf_trigger(mid_t mod_id, const void *params, Protocol__Flexran } /*TODO: fill in the amount of data in bytes in the MAC SDU received in this subframe for the given logical channel*/ - ul_info[i]->n_ul_reception = 11; + ul_info[i]->n_ul_reception = 0; ul_info[i]->ul_reception = malloc(sizeof(uint32_t) * ul_info[i]->n_ul_reception); for (j = 0; j < ul_info[i]->n_ul_reception; j++) { ul_info[i]->ul_reception[j] = 100; @@ -1050,7 +1044,7 @@ int enb_agent_mac_sf_trigger(mid_t mod_id, const void *params, Protocol__Flexran /*TODO: Fill in the reception status for each UEs data*/ ul_info[i]->reception_status = PROTOCOL__FLEX_RECEPTION_STATUS__FLRS_OK; ul_info[i]->has_reception_status = 1; - /*TODO: fill in the serving cell index for this UE */ + /*Fill in the serving cell index for this UE */ ul_info[i]->serv_cell_index = UE_PCCID(mod_id,i); ul_info[i]->has_serv_cell_index = 1; } diff --git a/openair2/ENB_APP/enb_agent_mac.h b/openair2/ENB_APP/enb_agent_mac.h index a6b9a0fe80..c5b257394b 100644 --- a/openair2/ENB_APP/enb_agent_mac.h +++ b/openair2/ENB_APP/enb_agent_mac.h @@ -81,24 +81,24 @@ void enb_agent_init_mac_agent(mid_t mod_id); int enb_agent_mac_handle_stats(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg); +/* Statistics request protocol message constructor and destructor */ int enb_agent_mac_stats_request(mid_t mod_id, xid_t xid, const stats_request_config_t *report_config, Protocol__FlexranMessage **msg); - int enb_agent_mac_destroy_stats_request(Protocol__FlexranMessage *msg); +/* Statistics reply protocol message constructor and destructor */ int enb_agent_mac_stats_reply(mid_t mod_id, xid_t xid, const report_config_t *report_config, Protocol__FlexranMessage **msg); - int enb_agent_mac_destroy_stats_reply(Protocol__FlexranMessage *msg); +/* Scheduling request information protocol message constructor and estructor */ int enb_agent_mac_sr_info(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg); - int enb_agent_mac_destroy_sr_info(Protocol__FlexranMessage *msg); +/* Subframe trigger protocol msssage constructor and destructor */ int enb_agent_mac_sf_trigger(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg); - int enb_agent_mac_destroy_sf_trigger(Protocol__FlexranMessage *msg); +/* int enb_agent_mac_create_empty_dl_config(mid_t mod_id, Protocol__FlexranMessage **msg); - int enb_agent_mac_destroy_dl_config(Protocol__FlexranMessage *msg); int enb_agent_mac_handle_dl_mac_config(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg); diff --git a/openair2/ENB_APP/enb_agent_net_comm.h b/openair2/ENB_APP/enb_agent_net_comm.h index ab42bdc34f..2a2268dc80 100644 --- a/openair2/ENB_APP/enb_agent_net_comm.h +++ b/openair2/ENB_APP/enb_agent_net_comm.h @@ -57,7 +57,6 @@ typedef struct enb_agent_channel_instance_s{ /*Send and receive messages using the channel registered for a specific agent*/ int enb_agent_msg_send(mid_t mod_id, agent_id_t agent_id, void *data, int size, int priority); - int enb_agent_msg_recv(mid_t mod_id, agent_id_t agent_id, void **data, int *size, int *priority); /*Register a channel to an agent. Use ENB_AGENT_MAX to register the From 0cee514c7316dbe7706e18ecd96e5bc61ea7e2f0 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Fri, 4 Nov 2016 13:19:08 +0200 Subject: [PATCH 255/349] Fixed problem with comment causing a bug in compilation --- openair2/ENB_APP/enb_agent_mac.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openair2/ENB_APP/enb_agent_mac.h b/openair2/ENB_APP/enb_agent_mac.h index c5b257394b..0716b739e5 100644 --- a/openair2/ENB_APP/enb_agent_mac.h +++ b/openair2/ENB_APP/enb_agent_mac.h @@ -97,7 +97,7 @@ int enb_agent_mac_destroy_sr_info(Protocol__FlexranMessage *msg); int enb_agent_mac_sf_trigger(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg); int enb_agent_mac_destroy_sf_trigger(Protocol__FlexranMessage *msg); -/* +/* DL MAC scheduling decision protocol message constructor (empty command) and destructor */ int enb_agent_mac_create_empty_dl_config(mid_t mod_id, Protocol__FlexranMessage **msg); int enb_agent_mac_destroy_dl_config(Protocol__FlexranMessage *msg); From 8baf3e7e5786039e9c10e4c6579de15d13bf7b35 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Fri, 4 Nov 2016 17:28:04 +0200 Subject: [PATCH 256/349] Changed naming convention for flexran related calls --- cmake_targets/CMakeLists.txt | 42 +- openair1/SCHED/phy_procedures_lte_eNb.c | 8 +- openair2/COMMON/tasks_def.h | 2 +- openair2/ENB_APP/enb_app.c | 8 +- openair2/ENB_APP/enb_config.c | 56 +- openair2/ENB_APP/enb_config.h | 8 +- .../ENB_APP/{enb_agent.c => flexran_agent.c} | 138 +-- .../ENB_APP/{enb_agent.h => flexran_agent.h} | 16 +- ...nb_agent_async.c => flexran_agent_async.c} | 34 +- ...nb_agent_async.h => flexran_agent_async.h} | 20 +- ..._agent_common.c => flexran_agent_common.c} | 920 +++++++++--------- ..._agent_common.h => flexran_agent_common.h} | 276 +++--- ...rnal.c => flexran_agent_common_internal.c} | 6 +- ...rnal.h => flexran_agent_common_internal.h} | 8 +- ...{enb_agent_defs.h => flexran_agent_defs.h} | 58 +- ..._agent_extern.h => flexran_agent_extern.h} | 12 +- ...gent_handler.c => flexran_agent_handler.c} | 110 +-- .../{enb_agent_mac.c => flexran_agent_mac.c} | 246 ++--- .../{enb_agent_mac.h => flexran_agent_mac.h} | 52 +- ...nt_mac_defs.h => flexran_agent_mac_defs.h} | 32 +- ...nternal.c => flexran_agent_mac_internal.c} | 12 +- ...nternal.h => flexran_agent_mac_internal.h} | 26 +- ...nt_net_comm.c => flexran_agent_net_comm.c} | 90 +- ...nt_net_comm.h => flexran_agent_net_comm.h} | 56 +- ...manager.c => flexran_agent_task_manager.c} | 75 +- ...manager.h => flexran_agent_task_manager.h} | 53 +- openair2/LAYER2/MAC/eNB_scheduler.c | 546 +++++------ ..._mac_proto.h => flexran_agent_mac_proto.h} | 24 +- ....c => flexran_agent_scheduler_dataplane.c} | 30 +- ...e.c => flexran_agent_scheduler_dlsch_ue.c} | 22 +- ...flexran_agent_scheduler_dlsch_ue_remote.c} | 30 +- ...flexran_agent_scheduler_dlsch_ue_remote.h} | 14 +- openair2/LAYER2/MAC/flexran_dci_conversions.h | 2 +- openair2/RRC/LITE/rrc_eNB.c | 6 +- openair2/UTIL/LOG/log.c | 14 +- openair2/UTIL/LOG/log.h | 2 +- .../enb.band5.flexran.50PRB.usrpb210.conf | 182 ++++ .../CONF/enb.band5.flexran.usrpb210.conf | 182 ++++ .../enb.band7.flexran.50PRB.usrpb210.conf | 8 +- .../CONF/enb.band7.flexran.usrpb210.conf | 8 +- targets/SIMU/USER/oaisim.c | 8 +- 41 files changed, 1898 insertions(+), 1544 deletions(-) rename openair2/ENB_APP/{enb_agent.c => flexran_agent.c} (56%) rename openair2/ENB_APP/{enb_agent.h => flexran_agent.h} (83%) rename openair2/ENB_APP/{enb_agent_async.c => flexran_agent_async.c} (70%) rename openair2/ENB_APP/{enb_agent_async.h => flexran_agent_async.h} (75%) rename openair2/ENB_APP/{enb_agent_common.c => flexran_agent_common.c} (64%) rename openair2/ENB_APP/{enb_agent_common.h => flexran_agent_common.h} (51%) rename openair2/ENB_APP/{enb_agent_common_internal.c => flexran_agent_common_internal.c} (98%) rename openair2/ENB_APP/{enb_agent_common_internal.h => flexran_agent_common_internal.h} (94%) rename openair2/ENB_APP/{enb_agent_defs.h => flexran_agent_defs.h} (70%) rename openair2/ENB_APP/{enb_agent_extern.h => flexran_agent_extern.h} (87%) rename openair2/ENB_APP/{enb_agent_handler.c => flexran_agent_handler.c} (54%) rename openair2/ENB_APP/{enb_agent_mac.c => flexran_agent_mac.c} (84%) rename openair2/ENB_APP/{enb_agent_mac.h => flexran_agent_mac.h} (64%) rename openair2/ENB_APP/{enb_agent_mac_defs.h => flexran_agent_mac_defs.h} (75%) rename openair2/ENB_APP/{enb_agent_mac_internal.c => flexran_agent_mac_internal.c} (98%) rename openair2/ENB_APP/{enb_agent_mac_internal.h => flexran_agent_mac_internal.h} (82%) rename openair2/ENB_APP/{enb_agent_net_comm.c => flexran_agent_net_comm.c} (52%) rename openair2/ENB_APP/{enb_agent_net_comm.h => flexran_agent_net_comm.h} (54%) rename openair2/ENB_APP/{enb_agent_task_manager.c => flexran_agent_task_manager.c} (74%) rename openair2/ENB_APP/{enb_agent_task_manager.h => flexran_agent_task_manager.h} (68%) rename openair2/LAYER2/MAC/{enb_agent_mac_proto.h => flexran_agent_mac_proto.h} (68%) rename openair2/LAYER2/MAC/{eNB_agent_scheduler_dataplane.c => flexran_agent_scheduler_dataplane.c} (96%) rename openair2/LAYER2/MAC/{eNB_agent_scheduler_dlsch_ue.c => flexran_agent_scheduler_dlsch_ue.c} (98%) rename openair2/LAYER2/MAC/{eNB_agent_scheduler_dlsch_ue_remote.c => flexran_agent_scheduler_dlsch_ue_remote.c} (86%) rename openair2/LAYER2/MAC/{eNB_agent_scheduler_dlsch_ue_remote.h => flexran_agent_scheduler_dlsch_ue_remote.h} (85%) create mode 100644 targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band5.flexran.50PRB.usrpb210.conf create mode 100644 targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band5.flexran.usrpb210.conf diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index 196baf166b..8f696ed653 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -621,7 +621,7 @@ add_boolean_option(MESSAGE_CHART_GENERATOR False "For generating sequenc add_boolean_option(MESSAGE_CHART_GENERATOR_RLC_MAC False "trace RLC-MAC exchanges in sequence diagrams") add_boolean_option(MESSAGE_CHART_GENERATOR_PHY False "trace some PHY exchanges in sequence diagrams") -add_boolean_option(ENB_AGENT_SB_IF True "enable eNB agent to inteface with a SDN contrller") +add_boolean_option(FLEXRAN_AGENT_SB_IF True "enable FlexRAN agent to inteface with a SDN contrller") ######################## # Include order @@ -838,7 +838,7 @@ include_directories("${OPENAIR_DIR}") # Utilities Library ################ -if (ENB_AGENT_SB_IF) +if (FLEXRAN_AGENT_SB_IF) # set the version of protobuf messages, V3 not supported yet add_list1_option(FLPT_VERSION V2 "FLPT MSG protobuf grammar version" V2 V3) @@ -899,18 +899,18 @@ if (ENB_AGENT_SB_IF) set(ASYNC_IF_LIB ASYNC_IF) include_directories(${OPENAIR2_DIR}/UTIL/ASYNC_IF) - add_library(ENB_AGENT - ${OPENAIR2_DIR}/ENB_APP/enb_agent_handler.c - ${OPENAIR2_DIR}/ENB_APP/enb_agent_common.c - ${OPENAIR2_DIR}/ENB_APP/enb_agent_common_internal.c - ${OPENAIR2_DIR}/ENB_APP/enb_agent_mac.c - ${OPENAIR2_DIR}/ENB_APP/enb_agent.c - ${OPENAIR2_DIR}/ENB_APP/enb_agent_task_manager.c - ${OPENAIR2_DIR}/ENB_APP/enb_agent_net_comm.c - ${OPENAIR2_DIR}/ENB_APP/enb_agent_async.c - ${OPENAIR2_DIR}/ENB_APP/enb_agent_mac_internal.c + add_library(FLEXRAN_AGENT + ${OPENAIR2_DIR}/ENB_APP/flexran_agent_handler.c + ${OPENAIR2_DIR}/ENB_APP/flexran_agent_common.c + ${OPENAIR2_DIR}/ENB_APP/flexran_agent_common_internal.c + ${OPENAIR2_DIR}/ENB_APP/flexran_agent_mac.c + ${OPENAIR2_DIR}/ENB_APP/flexran_agent.c + ${OPENAIR2_DIR}/ENB_APP/flexran_agent_task_manager.c + ${OPENAIR2_DIR}/ENB_APP/flexran_agent_net_comm.c + ${OPENAIR2_DIR}/ENB_APP/flexran_agent_async.c + ${OPENAIR2_DIR}/ENB_APP/flexran_agent_mac_internal.c ) - set(ENB_AGENT_LIB ENB_AGENT) + set(FLEXRAN_AGENT_LIB FLEXRAN_AGENT) #include_directories(${OPENAIR2_DIR}/ENB_APP) set(PROTOBUF_LIB "protobuf-c") @@ -1184,9 +1184,9 @@ set (MAC_SRC ${MAC_DIR}/eNB_scheduler_RA.c ${MAC_DIR}/pre_processor.c ${MAC_DIR}/config.c - ${MAC_DIR}/eNB_agent_scheduler_dlsch_ue.c - ${MAC_DIR}/eNB_agent_scheduler_dataplane.c - ${MAC_DIR}/eNB_agent_scheduler_dlsch_ue_remote.c + ${MAC_DIR}/flexran_agent_scheduler_dlsch_ue.c + ${MAC_DIR}/flexran_agent_scheduler_dataplane.c + ${MAC_DIR}/flexran_agent_scheduler_dlsch_ue_remote.c ) set (ENB_APP_SRC @@ -1201,8 +1201,8 @@ add_library(L2 # ${OPENAIR2_DIR}/RRC/L2_INTERFACE/openair_rrc_L2_interface.c) #Test for adding a shared library -add_library(default_sched SHARED ${MAC_DIR}/eNB_agent_scheduler_dlsch_ue.c) -add_library(remote_sched SHARED ${MAC_DIR}/eNB_agent_scheduler_dlsch_ue_remote.c) +add_library(default_sched SHARED ${MAC_DIR}/flexran_agent_scheduler_dlsch_ue.c) +add_library(remote_sched SHARED ${MAC_DIR}/flexran_agent_scheduler_dlsch_ue_remote.c) # L3 Libs ########################## @@ -1757,7 +1757,7 @@ add_executable(lte-softmodem target_link_libraries (lte-softmodem -ldl -Wl,--start-group - RRC_LIB S1AP_LIB S1AP_ENB GTPV1U SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT UDP SCHED_LIB PHY LFDS L2 ${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} ${ITTI_LIB} ${MIH_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${ENB_AGENT_LIB} LFDS7 + RRC_LIB S1AP_LIB S1AP_ENB GTPV1U SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT UDP SCHED_LIB PHY LFDS L2 ${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} ${ITTI_LIB} ${MIH_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${FLEXRAN_AGENT_LIB} LFDS7 -Wl,--end-group ) target_link_libraries (lte-softmodem ${LIBXML2_LIBRARIES}) @@ -1791,7 +1791,7 @@ add_executable(lte-softmodem-nos1 ) target_link_libraries (lte-softmodem-nos1 -Wl,--start-group - RRC_LIB SECU_CN SECU_OSA UTIL HASHTABLE SCHED_LIB PHY LFDS L2 ${MSC_LIB} ${RAL_LIB} ${ITTI_LIB} ${MIH_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${ENB_AGENT_LIB} LFDS7 + RRC_LIB SECU_CN SECU_OSA UTIL HASHTABLE SCHED_LIB PHY LFDS L2 ${MSC_LIB} ${RAL_LIB} ${ITTI_LIB} ${MIH_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${FLEXRAN_AGENT_LIB} LFDS7 -Wl,--end-group ) target_link_libraries (lte-softmodem-nos1 ${LIBXML2_LIBRARIES}) @@ -1936,7 +1936,7 @@ add_executable(oaisim_nos1 target_include_directories(oaisim_nos1 PUBLIC ${OPENAIR_TARGETS}/SIMU/USER) target_link_libraries (oaisim_nos1 -Wl,--start-group - RRC_LIB X2AP_LIB SECU_CN UTIL HASHTABLE SCHED_LIB PHY LFDS ${MSC_LIB} L2 ${RAL_LIB} SIMU SIMU_ETH SECU_OSA ${ITTI_LIB} ${MIH_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${ENB_AGENT_LIB} LFDS7 + RRC_LIB X2AP_LIB SECU_CN UTIL HASHTABLE SCHED_LIB PHY LFDS ${MSC_LIB} L2 ${RAL_LIB} SIMU SIMU_ETH SECU_OSA ${ITTI_LIB} ${MIH_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${FLEXRAN_AGENT_LIB} LFDS7 -Wl,--end-group ) target_link_libraries (oaisim_nos1 ${LIBXML2_LIBRARIES} ${LAPACK_LIBRARIES}) diff --git a/openair1/SCHED/phy_procedures_lte_eNb.c b/openair1/SCHED/phy_procedures_lte_eNb.c index c9eaa0d4af..b5fd7efd70 100644 --- a/openair1/SCHED/phy_procedures_lte_eNb.c +++ b/openair1/SCHED/phy_procedures_lte_eNb.c @@ -63,9 +63,9 @@ //Agent-related headers -#include "ENB_APP/enb_agent_extern.h" -#include "ENB_APP/enb_agent_mac.h" -#include "LAYER2/MAC/enb_agent_mac_proto.h" +#include "ENB_APP/flexran_agent_extern.h" +#include "ENB_APP/flexran_agent_mac.h" +#include "LAYER2/MAC/flexran_agent_mac_proto.h" //#define DIAG_PHY @@ -1372,7 +1372,7 @@ void phy_procedures_eNB_TX(PHY_VARS_eNB *eNB, #ifndef DISABLE_SF_TRIGGER //Send subframe trigger to the controller if (mac_agent_registered[eNB->Mod_id]) { - agent_mac_xface[eNB->Mod_id]->enb_agent_send_sf_trigger(eNB->Mod_id); + agent_mac_xface[eNB->Mod_id]->flexran_agent_send_sf_trigger(eNB->Mod_id); } #endif diff --git a/openair2/COMMON/tasks_def.h b/openair2/COMMON/tasks_def.h index 7d093c4400..c9e210fd1f 100644 --- a/openair2/COMMON/tasks_def.h +++ b/openair2/COMMON/tasks_def.h @@ -56,7 +56,7 @@ TASK_DEF(TASK_SCTP, TASK_PRIORITY_MED, 200) /// eNB APP task TASK_DEF(TASK_ENB_APP, TASK_PRIORITY_MED, 200) /// eNB Agent task -TASK_DEF(TASK_ENB_AGENT, TASK_PRIORITY_MED, 200) +TASK_DEF(TASK_FLEXRAN_AGENT, TASK_PRIORITY_MED, 200) // UE tasks and sub-tasks: //// Layer 2 and Layer 1 sub-tasks diff --git a/openair2/ENB_APP/enb_app.c b/openair2/ENB_APP/enb_app.c index ce3b288388..3734bc4a2b 100644 --- a/openair2/ENB_APP/enb_app.c +++ b/openair2/ENB_APP/enb_app.c @@ -49,8 +49,8 @@ # include "gtpv1u_eNB_task.h" # endif -#if defined(ENB_AGENT_SB_IF) -# include "enb_agent.h" +#if defined(FLEXRAN_AGENT_SB_IF) +# include "flexran_agent.h" #endif extern unsigned char NB_eNB_INST; @@ -314,11 +314,11 @@ void *eNB_app_task(void *args_p) configure_rrc(enb_id, enb_properties_p); } -#if defined (ENB_AGENT_SB_IF) +#if defined (FLEXRAN_AGENT_SB_IF) for (enb_id = enb_id_start; (enb_id < enb_id_end) ; enb_id++) { printf("\n start enb agent %d\n", enb_id); - enb_agent_start(enb_id, enb_properties_p); + flexran_agent_start(enb_id, enb_properties_p); } #endif diff --git a/openair2/ENB_APP/enb_config.c b/openair2/ENB_APP/enb_config.c index 92eefce7b0..fdf953597e 100644 --- a/openair2/ENB_APP/enb_config.c +++ b/openair2/ENB_APP/enb_config.c @@ -191,10 +191,10 @@ #define ENB_CONFIG_STRING_ENB_PORT_FOR_S1U "ENB_PORT_FOR_S1U" #define ENB_CONFIG_STRING_NETWORK_CONTROLLER_CONFIG "NETWORK_CONTROLLER" -#define ENB_CONFIG_STRING_ENB_AGENT_INTERFACE_NAME "ENB_AGENT_INTERFACE_NAME" -#define ENB_CONFIG_STRING_ENB_AGENT_IPV4_ADDRESS "ENB_AGENT_IPV4_ADDRESS" -#define ENB_CONFIG_STRING_ENB_AGENT_PORT "ENB_AGENT_PORT" -#define ENB_CONFIG_STRING_ENB_AGENT_CACHE "ENB_AGENT_CACHE" +#define ENB_CONFIG_STRING_FLEXRAN_AGENT_INTERFACE_NAME "FLEXRAN_AGENT_INTERFACE_NAME" +#define ENB_CONFIG_STRING_FLEXRAN_AGENT_IPV4_ADDRESS "FLEXRAN_AGENT_IPV4_ADDRESS" +#define ENB_CONFIG_STRING_FLEXRAN_AGENT_PORT "FLEXRAN_AGENT_PORT" +#define ENB_CONFIG_STRING_FLEXRAN_AGENT_CACHE "FLEXRAN_AGENT_CACHE" #define ENB_CONFIG_STRING_RRH_GW_CONFIG "rrh_gw_config" #define ENB_CONFIG_STRING_RRH_GW_LOCAL_IF_NAME "local_if_name" @@ -341,12 +341,12 @@ void enb_config_display(void) } } -#if defined(ENB_AGENT_SB_IF) - printf( "\nENB AGENT CONFIG : \n\n"); - printf( "\tInterface name: \t%s:\n",enb_properties.properties[i]->enb_agent_interface_name); - printf( "\tInterface IP Address: \t%s:\n",enb_properties.properties[i]->enb_agent_ipv4_address); - printf( "\tInterface PORT: \t%d:\n\n",enb_properties.properties[i]->enb_agent_port); - printf( "\tCache directory: \t%s:\n",enb_properties.properties[i]->enb_agent_cache); +#if defined(FLEXRAN_AGENT_SB_IF) + printf( "\nFLEXRAN AGENT CONFIG : \n\n"); + printf( "\tInterface name: \t%s:\n",enb_properties.properties[i]->flexran_agent_interface_name); + printf( "\tInterface IP Address: \t%s:\n",enb_properties.properties[i]->flexran_agent_ipv4_address); + printf( "\tInterface PORT: \t%d:\n\n",enb_properties.properties[i]->flexran_agent_port); + printf( "\tCache directory: \t%s:\n",enb_properties.properties[i]->flexran_agent_cache); #endif @@ -674,10 +674,10 @@ const Enb_properties_array_t *enb_config_init(char* lib_config_file_name_pP) char *address = NULL; char *cidr = NULL; char *astring = NULL; - char* enb_agent_interface_name = NULL; - char* enb_agent_ipv4_address = NULL; - libconfig_int enb_agent_port = 0; - char* enb_agent_cache = NULL; + char* flexran_agent_interface_name = NULL; + char* flexran_agent_ipv4_address = NULL; + libconfig_int flexran_agent_port = 0; + char* flexran_agent_cache = NULL; libconfig_int otg_ue_id = 0; char* otg_app_type = NULL; char* otg_bg_traffic = NULL; @@ -2481,26 +2481,26 @@ const Enb_properties_array_t *enb_config_init(char* lib_config_file_name_pP) if (subsetting != NULL) { if ( ( - config_setting_lookup_string( subsetting, ENB_CONFIG_STRING_ENB_AGENT_INTERFACE_NAME, - (const char **)&enb_agent_interface_name) - && config_setting_lookup_string( subsetting, ENB_CONFIG_STRING_ENB_AGENT_IPV4_ADDRESS, - (const char **)&enb_agent_ipv4_address) - && config_setting_lookup_int(subsetting, ENB_CONFIG_STRING_ENB_AGENT_PORT, - &enb_agent_port) - && config_setting_lookup_string( subsetting, ENB_CONFIG_STRING_ENB_AGENT_CACHE, - (const char **)&enb_agent_cache) + config_setting_lookup_string( subsetting, ENB_CONFIG_STRING_FLEXRAN_AGENT_INTERFACE_NAME, + (const char **)&flexran_agent_interface_name) + && config_setting_lookup_string( subsetting, ENB_CONFIG_STRING_FLEXRAN_AGENT_IPV4_ADDRESS, + (const char **)&flexran_agent_ipv4_address) + && config_setting_lookup_int(subsetting, ENB_CONFIG_STRING_FLEXRAN_AGENT_PORT, + &flexran_agent_port) + && config_setting_lookup_string( subsetting, ENB_CONFIG_STRING_FLEXRAN_AGENT_CACHE, + (const char **)&flexran_agent_cache) ) ) { - enb_properties.properties[enb_properties_index]->enb_agent_interface_name = strdup(enb_agent_interface_name); - cidr = enb_agent_ipv4_address; + enb_properties.properties[enb_properties_index]->flexran_agent_interface_name = strdup(flexran_agent_interface_name); + cidr = flexran_agent_ipv4_address; address = strtok(cidr, "/"); - enb_properties.properties[enb_properties_index]->enb_agent_ipv4_address = strdup(address); + enb_properties.properties[enb_properties_index]->flexran_agent_ipv4_address = strdup(address); /* if (address) { - IPV4_STR_ADDR_TO_INT_NWBO (address, enb_properties.properties[enb_properties_index]->enb_agent_ipv4_address, "BAD IP ADDRESS FORMAT FOR eNB Agent !\n" ); + IPV4_STR_ADDR_TO_INT_NWBO (address, enb_properties.properties[enb_properties_index]->flexran_agent_ipv4_address, "BAD IP ADDRESS FORMAT FOR eNB Agent !\n" ); }*/ - enb_properties.properties[enb_properties_index]->enb_agent_port = enb_agent_port; - enb_properties.properties[enb_properties_index]->enb_agent_cache = strdup(enb_agent_cache); + enb_properties.properties[enb_properties_index]->flexran_agent_port = flexran_agent_port; + enb_properties.properties[enb_properties_index]->flexran_agent_cache = strdup(flexran_agent_cache); } } diff --git a/openair2/ENB_APP/enb_config.h b/openair2/ENB_APP/enb_config.h index 594db77a1f..fd53395311 100644 --- a/openair2/ENB_APP/enb_config.h +++ b/openair2/ENB_APP/enb_config.h @@ -228,10 +228,10 @@ typedef struct Enb_properties_s { char *enb_interface_name_for_S1_MME; in_addr_t enb_ipv4_address_for_S1_MME; - char *enb_agent_interface_name; - in_addr_t enb_agent_ipv4_address; - tcp_udp_port_t enb_agent_port; - char *enb_agent_cache; + char *flexran_agent_interface_name; + in_addr_t flexran_agent_ipv4_address; + tcp_udp_port_t flexran_agent_port; + char *flexran_agent_cache; /* Nb of RRH to connect to */ uint8_t nb_rrh_gw; diff --git a/openair2/ENB_APP/enb_agent.c b/openair2/ENB_APP/flexran_agent.c similarity index 56% rename from openair2/ENB_APP/enb_agent.c rename to openair2/ENB_APP/flexran_agent.c index 179392b3a2..8984e39971 100644 --- a/openair2/ENB_APP/enb_agent.c +++ b/openair2/ENB_APP/flexran_agent.c @@ -27,28 +27,28 @@ *******************************************************************************/ -/*! \file enb_agent.h - * \brief top level enb agent receive thread and itti task +/*! \file flexran_agent.h + * \brief top level flexran agent receive thread and itti task * \author Xenofon Foukas and Navid Nikaein * \date 2016 * \version 0.1 */ -#include "enb_agent_common.h" +#include "flexran_agent_common.h" #include "log.h" -#include "enb_agent.h" -#include "enb_agent_mac_defs.h" +#include "flexran_agent.h" +#include "flexran_agent_mac_defs.h" -#include "enb_agent_extern.h" +#include "flexran_agent_extern.h" #include "assertions.h" -#include "enb_agent_net_comm.h" -#include "enb_agent_async.h" +#include "flexran_agent_net_comm.h" +#include "flexran_agent_async.h" //#define TEST_TIMER -enb_agent_instance_t enb_agent[NUM_MAX_ENB]; +flexran_agent_instance_t flexran_agent[NUM_MAX_ENB]; char in_ip[40]; static uint16_t in_port; @@ -57,7 +57,7 @@ char local_cache[40]; void *send_thread(void *args); void *receive_thread(void *args); pthread_t new_thread(void *(*f)(void *), void *b); -Protocol__FlexranMessage *enb_agent_timeout(void* args); +Protocol__FlexranMessage *flexran_agent_timeout(void* args); int agent_task_created = 0; @@ -65,9 +65,9 @@ int agent_task_created = 0; * enb agent task mainly wakes up the tx thread for periodic and oneshot messages to the controller * and can interact with other itti tasks */ -void *enb_agent_task(void *args){ +void *flexran_agent_task(void *args){ - //enb_agent_instance_t *d = (enb_agent_instance_t *) args; + //flexran_agent_instance_t *d = (flexran_agent_instance_t *) args; Protocol__FlexranMessage *msg; void *data; int size; @@ -78,13 +78,13 @@ void *enb_agent_task(void *args){ const char *msg_name = NULL; instance_t instance; int result; - struct enb_agent_timer_element_s * elem = NULL; + struct flexran_agent_timer_element_s * elem = NULL; - itti_mark_task_ready(TASK_ENB_AGENT); + itti_mark_task_ready(TASK_FLEXRAN_AGENT); do { // Wait for a message - itti_receive_msg (TASK_ENB_AGENT, &msg_p); + itti_receive_msg (TASK_FLEXRAN_AGENT, &msg_p); DevAssert(msg_p != NULL); msg_name = ITTI_MSG_NAME (msg_p); instance = ITTI_MSG_INSTANCE (msg_p); @@ -95,25 +95,25 @@ void *enb_agent_task(void *args){ break; case MESSAGE_TEST: - LOG_I(ENB_AGENT, "Received %s\n", ITTI_MSG_NAME(msg_p)); + LOG_I(FLEXRAN_AGENT, "Received %s\n", ITTI_MSG_NAME(msg_p)); break; case TIMER_HAS_EXPIRED: - msg = enb_agent_process_timeout(msg_p->ittiMsg.timer_has_expired.timer_id, msg_p->ittiMsg.timer_has_expired.arg); + msg = flexran_agent_process_timeout(msg_p->ittiMsg.timer_has_expired.timer_id, msg_p->ittiMsg.timer_has_expired.arg); if (msg != NULL){ - data=enb_agent_pack_message(msg,&size); + data=flexran_agent_pack_message(msg,&size); elem = get_timer_entry(msg_p->ittiMsg.timer_has_expired.timer_id); - if (enb_agent_msg_send(elem->agent_id, ENB_AGENT_DEFAULT, data, size, priority)) { + if (flexran_agent_msg_send(elem->agent_id, FLEXRAN_AGENT_DEFAULT, data, size, priority)) { err_code = PROTOCOL__FLEXRAN_ERR__MSG_ENQUEUING; goto error; } - LOG_D(ENB_AGENT,"sent message with size %d\n", size); + LOG_D(FLEXRAN_AGENT,"sent message with size %d\n", size); } break; default: - LOG_E(ENB_AGENT, "Received unexpected message %s\n", msg_name); + LOG_E(FLEXRAN_AGENT, "Received unexpected message %s\n", msg_name); break; } @@ -121,7 +121,7 @@ void *enb_agent_task(void *args){ AssertFatal (result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result); continue; error: - LOG_E(ENB_AGENT,"enb_agent_task: error %d occured\n",err_code); + LOG_E(FLEXRAN_AGENT,"flexran_agent_task: error %d occured\n",err_code); } while (1); return NULL; @@ -129,7 +129,7 @@ void *enb_agent_task(void *args){ void *receive_thread(void *args) { - enb_agent_instance_t *d = args; + flexran_agent_instance_t *d = args; void *data; int size; int priority; @@ -139,25 +139,25 @@ void *receive_thread(void *args) { while (1) { - while (enb_agent_msg_recv(d->enb_id, ENB_AGENT_DEFAULT, &data, &size, &priority) == 0) { + while (flexran_agent_msg_recv(d->enb_id, FLEXRAN_AGENT_DEFAULT, &data, &size, &priority) == 0) { - LOG_D(ENB_AGENT,"received message with size %d\n", size); + LOG_D(FLEXRAN_AGENT,"received message with size %d\n", size); // Invoke the message handler - msg=enb_agent_handle_message(d->enb_id, data, size); + msg=flexran_agent_handle_message(d->enb_id, data, size); free(data); // check if there is something to send back to the controller if (msg != NULL){ - data=enb_agent_pack_message(msg,&size); + data=flexran_agent_pack_message(msg,&size); - if (enb_agent_msg_send(d->enb_id, ENB_AGENT_DEFAULT, data, size, priority)) { + if (flexran_agent_msg_send(d->enb_id, FLEXRAN_AGENT_DEFAULT, data, size, priority)) { err_code = PROTOCOL__FLEXRAN_ERR__MSG_ENQUEUING; goto error; } - LOG_D(ENB_AGENT,"sent message with size %d\n", size); + LOG_D(FLEXRAN_AGENT,"sent message with size %d\n", size); } } } @@ -165,7 +165,7 @@ void *receive_thread(void *args) { return NULL; error: - LOG_E(ENB_AGENT,"receive_thread: error %d occured\n",err_code); + LOG_E(FLEXRAN_AGENT,"receive_thread: error %d occured\n",err_code); return NULL; } @@ -203,37 +203,37 @@ pthread_t new_thread(void *(*f)(void *), void *b) { } int channel_container_init = 0; -int enb_agent_start(mid_t mod_id, const Enb_properties_array_t* enb_properties){ +int flexran_agent_start(mid_t mod_id, const Enb_properties_array_t* enb_properties){ int channel_id; - set_enb_vars(mod_id, RAN_LTE_OAI); - enb_agent[mod_id].enb_id = mod_id; + flexran_set_enb_vars(mod_id, RAN_LTE_OAI); + flexran_agent[mod_id].enb_id = mod_id; /* * check the configuration */ - if (enb_properties->properties[mod_id]->enb_agent_cache != NULL) { - strncpy(local_cache, enb_properties->properties[mod_id]->enb_agent_cache, sizeof(local_cache)); + if (enb_properties->properties[mod_id]->flexran_agent_cache != NULL) { + strncpy(local_cache, enb_properties->properties[mod_id]->flexran_agent_cache, sizeof(local_cache)); local_cache[sizeof(local_cache) - 1] = 0; } else { - strcpy(local_cache, DEFAULT_ENB_AGENT_CACHE); + strcpy(local_cache, DEFAULT_FLEXRAN_AGENT_CACHE); } - if (enb_properties->properties[mod_id]->enb_agent_ipv4_address != NULL) { - strncpy(in_ip, enb_properties->properties[mod_id]->enb_agent_ipv4_address, sizeof(in_ip) ); + if (enb_properties->properties[mod_id]->flexran_agent_ipv4_address != NULL) { + strncpy(in_ip, enb_properties->properties[mod_id]->flexran_agent_ipv4_address, sizeof(in_ip) ); in_ip[sizeof(in_ip) - 1] = 0; // terminate string } else { - strcpy(in_ip, DEFAULT_ENB_AGENT_IPv4_ADDRESS ); + strcpy(in_ip, DEFAULT_FLEXRAN_AGENT_IPv4_ADDRESS ); } - if (enb_properties->properties[mod_id]->enb_agent_port != 0 ) { - in_port = enb_properties->properties[mod_id]->enb_agent_port; + if (enb_properties->properties[mod_id]->flexran_agent_port != 0 ) { + in_port = enb_properties->properties[mod_id]->flexran_agent_port; } else { - in_port = DEFAULT_ENB_AGENT_PORT ; + in_port = DEFAULT_FLEXRAN_AGENT_PORT ; } - LOG_I(ENB_AGENT,"starting enb agent client for module id %d on ipv4 %s, port %d\n", - enb_agent[mod_id].enb_id, + LOG_I(FLEXRAN_AGENT,"starting enb agent client for module id %d on ipv4 %s, port %d\n", + flexran_agent[mod_id].enb_id, in_ip, in_port); @@ -241,87 +241,87 @@ int enb_agent_start(mid_t mod_id, const Enb_properties_array_t* enb_properties){ * Initialize the channel container */ if (!channel_container_init) { - enb_agent_init_channel_container(); + flexran_agent_init_channel_container(); channel_container_init = 1; } /*Create the async channel info*/ - enb_agent_instance_t *channel_info = enb_agent_async_channel_info(mod_id, in_ip, in_port); + flexran_agent_instance_t *channel_info = flexran_agent_async_channel_info(mod_id, in_ip, in_port); /*Create a channel using the async channel info*/ - channel_id = enb_agent_create_channel((void *) channel_info, - enb_agent_async_msg_send, - enb_agent_async_msg_recv, - enb_agent_async_release); + channel_id = flexran_agent_create_channel((void *) channel_info, + flexran_agent_async_msg_send, + flexran_agent_async_msg_recv, + flexran_agent_async_release); if (channel_id <= 0) { goto error; } - enb_agent_channel_t *channel = get_channel(channel_id); + flexran_agent_channel_t *channel = get_channel(channel_id); if (channel == NULL) { goto error; } - /*Register the channel for all underlying agents (use ENB_AGENT_MAX)*/ - enb_agent_register_channel(mod_id, channel, ENB_AGENT_MAX); + /*Register the channel for all underlying agents (use FLEXRAN_AGENT_MAX)*/ + flexran_agent_register_channel(mod_id, channel, FLEXRAN_AGENT_MAX); /*Example of registration for a specific agent(MAC): - *enb_agent_register_channel(mod_id, channel, ENB_AGENT_MAC); + *flexran_agent_register_channel(mod_id, channel, FLEXRAN_AGENT_MAC); */ /*Initialize the continuous MAC stats update mechanism*/ - enb_agent_init_cont_mac_stats_update(mod_id); + flexran_agent_init_cont_mac_stats_update(mod_id); - new_thread(receive_thread, &enb_agent[mod_id]); + new_thread(receive_thread, &flexran_agent[mod_id]); /*Initialize and register the mac xface. Must be modified later *for more flexibility in agent management */ AGENT_MAC_xface *mac_agent_xface = (AGENT_MAC_xface *) malloc(sizeof(AGENT_MAC_xface)); - enb_agent_register_mac_xface(mod_id, mac_agent_xface); + flexran_agent_register_mac_xface(mod_id, mac_agent_xface); /* * initilize a timer */ - enb_agent_init_timer(); + flexran_agent_init_timer(); /* * Initialize the mac agent */ - enb_agent_init_mac_agent(mod_id); + flexran_agent_init_mac_agent(mod_id); /* * start the enb agent task for tx and interaction with the underlying network function */ if (!agent_task_created) { - if (itti_create_task (TASK_ENB_AGENT, enb_agent_task, (void *) &enb_agent[mod_id]) < 0) { - LOG_E(ENB_AGENT, "Create task for eNB Agent failed\n"); + if (itti_create_task (TASK_FLEXRAN_AGENT, flexran_agent_task, (void *) &flexran_agent[mod_id]) < 0) { + LOG_E(FLEXRAN_AGENT, "Create task for FlexRAN Agent failed\n"); return -1; } agent_task_created = 1; } - LOG_I(ENB_AGENT,"client ends\n"); + LOG_I(FLEXRAN_AGENT,"client ends\n"); return 0; error: - LOG_I(ENB_AGENT,"there was an error\n"); + LOG_I(FLEXRAN_AGENT,"there was an error\n"); return 1; } -Protocol__FlexranMessage *enb_agent_timeout(void* args){ +Protocol__FlexranMessage *flexran_agent_timeout(void* args){ - // enb_agent_timer_args_t *timer_args = calloc(1, sizeof(*timer_args)); + // flexran_agent_timer_args_t *timer_args = calloc(1, sizeof(*timer_args)); //memcpy (timer_args, args, sizeof(*timer_args)); - enb_agent_timer_args_t *timer_args = (enb_agent_timer_args_t *) args; + flexran_agent_timer_args_t *timer_args = (flexran_agent_timer_args_t *) args; - LOG_I(ENB_AGENT, "enb_agent %d timeout\n", timer_args->mod_id); - //LOG_I(ENB_AGENT, "eNB action %d ENB flags %d \n", timer_args->cc_actions,timer_args->cc_report_flags); - //LOG_I(ENB_AGENT, "UE action %d UE flags %d \n", timer_args->ue_actions,timer_args->ue_report_flags); + LOG_I(FLEXRAN_AGENT, "flexran_agent %d timeout\n", timer_args->mod_id); + //LOG_I(FLEXRAN_AGENT, "eNB action %d ENB flags %d \n", timer_args->cc_actions,timer_args->cc_report_flags); + //LOG_I(FLEXRAN_AGENT, "UE action %d UE flags %d \n", timer_args->ue_actions,timer_args->ue_report_flags); return NULL; } diff --git a/openair2/ENB_APP/enb_agent.h b/openair2/ENB_APP/flexran_agent.h similarity index 83% rename from openair2/ENB_APP/enb_agent.h rename to openair2/ENB_APP/flexran_agent.h index a75790d8b0..beed4b9885 100644 --- a/openair2/ENB_APP/enb_agent.h +++ b/openair2/ENB_APP/flexran_agent.h @@ -28,28 +28,28 @@ *******************************************************************************/ -/*! \file enb_agent.h - * \brief top level enb agent +/*! \file flexran_agent.h + * \brief top level flexran agent * \author Navid Nikaein and Xenofon Foukas * \date 2016 * \version 0.1 */ -#ifndef ENB_AGENT_H_ -#define ENB_AGENT_H_ +#ifndef FLEXRAN_AGENT_H_ +#define FLEXRAN_AGENT_H_ #include "enb_config.h" // for enb properties -#include "enb_agent_common.h" +#include "flexran_agent_common.h" /* Initiation and termination of the eNodeB agent */ -int enb_agent_start(mid_t mod_id, const Enb_properties_array_t* enb_properties); -int enb_agent_stop(mid_t mod_id); +int flexran_agent_start(mid_t mod_id, const Enb_properties_array_t* enb_properties); +int flexran_agent_stop(mid_t mod_id); /* * enb agent task mainly wakes up the tx thread for periodic and oneshot messages to the controller * and can interact with other itti tasks */ -void *enb_agent_task(void *args); +void *flexran_agent_task(void *args); #endif diff --git a/openair2/ENB_APP/enb_agent_async.c b/openair2/ENB_APP/flexran_agent_async.c similarity index 70% rename from openair2/ENB_APP/enb_agent_async.c rename to openair2/ENB_APP/flexran_agent_async.c index a626566a8d..ae0273a668 100644 --- a/openair2/ENB_APP/enb_agent_async.c +++ b/openair2/ENB_APP/flexran_agent_async.c @@ -27,22 +27,22 @@ *******************************************************************************/ -/*! \file enb_agent_async.c +/*! \file flexran_agent_async.c * \brief channel implementation for async interface * \author Xenofon Foukas * \date 2016 * \version 0.1 */ -#include "enb_agent_async.h" -#include "enb_agent_defs.h" +#include "flexran_agent_async.h" +#include "flexran_agent_defs.h" #include "log.h" -enb_agent_async_channel_t * enb_agent_async_channel_info(mid_t mod_id, char *dst_ip, uint16_t dst_port) { +flexran_agent_async_channel_t * flexran_agent_async_channel_info(mid_t mod_id, char *dst_ip, uint16_t dst_port) { - enb_agent_async_channel_t *channel; - channel = (enb_agent_async_channel_t *) malloc(sizeof(enb_agent_channel_t)); + flexran_agent_async_channel_t *channel; + channel = (flexran_agent_async_channel_t *) malloc(sizeof(flexran_agent_channel_t)); if (channel == NULL) goto error; @@ -52,7 +52,7 @@ enb_agent_async_channel_t * enb_agent_async_channel_info(mid_t mod_id, char *dst channel->link = new_link_client(dst_ip, dst_port); if (channel->link == NULL) goto error; - LOG_I(ENB_AGENT,"starting enb agent client for module id %d on ipv4 %s, port %d\n", + LOG_I(FLEXRAN_AGENT,"starting enb agent client for module id %d on ipv4 %s, port %d\n", channel->enb_id, dst_ip, dst_port); @@ -75,27 +75,27 @@ enb_agent_async_channel_t * enb_agent_async_channel_info(mid_t mod_id, char *dst return channel; error: - LOG_I(ENB_AGENT,"there was an error\n"); + LOG_I(FLEXRAN_AGENT,"there was an error\n"); return 1; } -int enb_agent_async_msg_send(void *data, int size, int priority, void *channel_info) { - enb_agent_async_channel_t *channel; - channel = (enb_agent_channel_t *)channel_info; +int flexran_agent_async_msg_send(void *data, int size, int priority, void *channel_info) { + flexran_agent_async_channel_t *channel; + channel = (flexran_agent_channel_t *)channel_info; return message_put(channel->send_queue, data, size, priority); } -int enb_agent_async_msg_recv(void **data, int *size, int *priority, void *channel_info) { - enb_agent_async_channel_t *channel; - channel = (enb_agent_async_channel_t *)channel_info; +int flexran_agent_async_msg_recv(void **data, int *size, int *priority, void *channel_info) { + flexran_agent_async_channel_t *channel; + channel = (flexran_agent_async_channel_t *)channel_info; return message_get(channel->receive_queue, data, size, priority); } -void enb_agent_async_release(enb_agent_channel_t *channel) { - enb_agent_async_channel_t *channel_info; - channel_info = (enb_agent_async_channel_t *) channel->channel_info; +void flexran_agent_async_release(flexran_agent_channel_t *channel) { + flexran_agent_async_channel_t *channel_info; + channel_info = (flexran_agent_async_channel_t *) channel->channel_info; destroy_link_manager(channel_info->manager); diff --git a/openair2/ENB_APP/enb_agent_async.h b/openair2/ENB_APP/flexran_agent_async.h similarity index 75% rename from openair2/ENB_APP/enb_agent_async.h rename to openair2/ENB_APP/flexran_agent_async.h index a8c4ae90fe..3e5c21463a 100644 --- a/openair2/ENB_APP/enb_agent_async.h +++ b/openair2/ENB_APP/flexran_agent_async.h @@ -27,17 +27,17 @@ *******************************************************************************/ -/*! \file enb_agent_async.h +/*! \file flexran_agent_async.h * \brief channel implementation for async interface * \author Xenofon Foukas * \date 2016 * \version 0.1 */ -#ifndef ENB_AGENT_ASYNC_H_ -#define ENB_AGENT_ASYNC_H_ +#ifndef FLEXRAN_AGENT_ASYNC_H_ +#define FLEXRAN_AGENT_ASYNC_H_ -#include "enb_agent_net_comm.h" +#include "flexran_agent_net_comm.h" typedef struct { mid_t enb_id; @@ -45,19 +45,19 @@ typedef struct { message_queue_t *send_queue; message_queue_t *receive_queue; link_manager_t *manager; -} enb_agent_async_channel_t; +} flexran_agent_async_channel_t; /* Create a new channel for a given destination ip and destination port */ -enb_agent_async_channel_t * enb_agent_async_channel_info(mid_t mod_id, char *dst_ip, uint16_t dst_port); +flexran_agent_async_channel_t * flexran_agent_async_channel_info(mid_t mod_id, char *dst_ip, uint16_t dst_port); /* Send a message to the given channel */ -int enb_agent_async_msg_send(void *data, int size, int priority, void *channel_info); +int flexran_agent_async_msg_send(void *data, int size, int priority, void *channel_info); /* Receive a message from a given channel */ -int enb_agent_async_msg_recv(void **data, int *size, int *priority, void *channel_info); +int flexran_agent_async_msg_recv(void **data, int *size, int *priority, void *channel_info); /* Release a channel */ -void enb_agent_async_release(enb_agent_channel_t *channel); +void flexran_agent_async_release(flexran_agent_channel_t *channel); -#endif /*ENB_AGENT_ASYNC_H_*/ +#endif /*FLEXRAN_AGENT_ASYNC_H_*/ diff --git a/openair2/ENB_APP/enb_agent_common.c b/openair2/ENB_APP/flexran_agent_common.c similarity index 64% rename from openair2/ENB_APP/enb_agent_common.c rename to openair2/ENB_APP/flexran_agent_common.c index 51ade8d851..302c792771 100644 --- a/openair2/ENB_APP/enb_agent_common.c +++ b/openair2/ENB_APP/flexran_agent_common.c @@ -27,7 +27,7 @@ *******************************************************************************/ -/*! \file enb_agent_common.c +/*! \file flexran_agent_common.c * \brief common primitives for all agents * \author Xenofon Foukas, Mohamed Kassem and Navid Nikaein * \date 2016 @@ -37,9 +37,9 @@ #include #include -#include "enb_agent_common.h" -#include "enb_agent_common_internal.h" -#include "enb_agent_extern.h" +#include "flexran_agent_common.h" +#include "flexran_agent_common_internal.h" +#include "flexran_agent_extern.h" #include "PHY/extern.h" #include "log.h" @@ -56,7 +56,7 @@ void * enb_rrc[NUM_MAX_ENB]; * message primitives */ -int enb_agent_serialize_message(Protocol__FlexranMessage *msg, void **buf, int *size) { +int flexran_agent_serialize_message(Protocol__FlexranMessage *msg, void **buf, int *size) { *size = protocol__flexran_message__get_packed_size(msg); @@ -69,7 +69,7 @@ int enb_agent_serialize_message(Protocol__FlexranMessage *msg, void **buf, int * return 0; error: - LOG_E(ENB_AGENT, "an error occured\n"); // change the com + LOG_E(FLEXRAN_AGENT, "an error occured\n"); // change the com return -1; } @@ -77,7 +77,7 @@ int enb_agent_serialize_message(Protocol__FlexranMessage *msg, void **buf, int * /* We assume that the buffer size is equal to the message size. Should be chekced durint Tx/Rx */ -int enb_agent_deserialize_message(void *data, int size, Protocol__FlexranMessage **msg) { +int flexran_agent_deserialize_message(void *data, int size, Protocol__FlexranMessage **msg) { *msg = protocol__flexran_message__unpack(NULL, size, data); if (*msg == NULL) goto error; @@ -91,7 +91,7 @@ int enb_agent_deserialize_message(void *data, int size, Protocol__FlexranMessage -int flex_create_header(xid_t xid, Protocol__FlexType type, Protocol__FlexHeader **header) { +int flexran_create_header(xid_t xid, Protocol__FlexType type, Protocol__FlexHeader **header) { *header = malloc(sizeof(Protocol__FlexHeader)); if(*header == NULL) @@ -108,17 +108,17 @@ int flex_create_header(xid_t xid, Protocol__FlexType type, Protocol__FlexHeader return 0; error: - LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); + LOG_E(FLEXRAN_AGENT, "%s: an error occured\n", __FUNCTION__); return -1; } -int enb_agent_hello(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg) { +int flexran_agent_hello(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg) { Protocol__FlexHeader *header; /*TODO: Need to set random xid or xid from received hello message*/ xid_t xid = 1; - if (flex_create_header(xid, PROTOCOL__FLEX_TYPE__FLPT_HELLO, &header) != 0) + if (flexran_create_header(xid, PROTOCOL__FLEX_TYPE__FLPT_HELLO, &header) != 0) goto error; Protocol__FlexHello *hello_msg; @@ -146,12 +146,12 @@ int enb_agent_hello(mid_t mod_id, const void *params, Protocol__FlexranMessage * free(hello_msg); if(*msg != NULL) free(*msg); - LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); + LOG_E(FLEXRAN_AGENT, "%s: an error occured\n", __FUNCTION__); return -1; } -int enb_agent_destroy_hello(Protocol__FlexranMessage *msg) { +int flexran_agent_destroy_hello(Protocol__FlexranMessage *msg) { if(msg->msg_case != PROTOCOL__FLEXRAN_MESSAGE__MSG_HELLO_MSG) goto error; @@ -162,16 +162,16 @@ int enb_agent_destroy_hello(Protocol__FlexranMessage *msg) { return 0; error: - LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); + LOG_E(FLEXRAN_AGENT, "%s: an error occured\n", __FUNCTION__); return -1; } -int enb_agent_echo_request(mid_t mod_id, const void* params, Protocol__FlexranMessage **msg) { +int flexran_agent_echo_request(mid_t mod_id, const void* params, Protocol__FlexranMessage **msg) { Protocol__FlexHeader *header; /*TODO: Need to set a random xid*/ xid_t xid = 1; - if (flex_create_header(xid, PROTOCOL__FLEX_TYPE__FLPT_ECHO_REQUEST, &header) != 0) + if (flexran_create_header(xid, PROTOCOL__FLEX_TYPE__FLPT_ECHO_REQUEST, &header) != 0) goto error; Protocol__FlexEchoRequest *echo_request_msg; @@ -202,7 +202,7 @@ int enb_agent_echo_request(mid_t mod_id, const void* params, Protocol__FlexranMe } -int enb_agent_destroy_echo_request(Protocol__FlexranMessage *msg) { +int flexran_agent_destroy_echo_request(Protocol__FlexranMessage *msg) { if(msg->msg_case != PROTOCOL__FLEXRAN_MESSAGE__MSG_ECHO_REQUEST_MSG) goto error; @@ -212,13 +212,13 @@ int enb_agent_destroy_echo_request(Protocol__FlexranMessage *msg) { return 0; error: - LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); + LOG_E(FLEXRAN_AGENT, "%s: an error occured\n", __FUNCTION__); return -1; } -int enb_agent_echo_reply(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg) { +int flexran_agent_echo_reply(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg) { xid_t xid; Protocol__FlexranMessage *input = (Protocol__FlexranMessage *)params; @@ -226,7 +226,7 @@ int enb_agent_echo_reply(mid_t mod_id, const void *params, Protocol__FlexranMess xid = (echo_req->header)->xid; Protocol__FlexHeader *header; - if (flex_create_header(xid, PROTOCOL__FLEX_TYPE__FLPT_ECHO_REPLY, &header) != 0) + if (flexran_create_header(xid, PROTOCOL__FLEX_TYPE__FLPT_ECHO_REPLY, &header) != 0) goto error; Protocol__FlexEchoReply *echo_reply_msg; @@ -253,12 +253,12 @@ int enb_agent_echo_reply(mid_t mod_id, const void *params, Protocol__FlexranMess free(echo_reply_msg); if(*msg != NULL) free(*msg); - LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); + LOG_E(FLEXRAN_AGENT, "%s: an error occured\n", __FUNCTION__); return -1; } -int enb_agent_destroy_echo_reply(Protocol__FlexranMessage *msg) { +int flexran_agent_destroy_echo_reply(Protocol__FlexranMessage *msg) { if(msg->msg_case != PROTOCOL__FLEXRAN_MESSAGE__MSG_ECHO_REPLY_MSG) goto error; @@ -268,19 +268,19 @@ int enb_agent_destroy_echo_reply(Protocol__FlexranMessage *msg) { return 0; error: - LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); + LOG_E(FLEXRAN_AGENT, "%s: an error occured\n", __FUNCTION__); return -1; } -int enb_agent_destroy_enb_config_reply(Protocol__FlexranMessage *msg) { +int flexran_agent_destroy_enb_config_reply(Protocol__FlexranMessage *msg) { if(msg->msg_case != PROTOCOL__FLEXRAN_MESSAGE__MSG_ENB_CONFIG_REPLY_MSG) goto error; free(msg->enb_config_reply_msg->header); int i, j; Protocol__FlexEnbConfigReply *reply = msg->enb_config_reply_msg; - for(i = 0; i < reply->n_cell_config;i++){ + for(i = 0; i < reply->n_cell_config;i++) { free(reply->cell_config[i]->mbsfn_subframe_config_rfoffset); free(reply->cell_config[i]->mbsfn_subframe_config_rfperiod); free(reply->cell_config[i]->mbsfn_subframe_config_sfalloc); @@ -299,11 +299,11 @@ int enb_agent_destroy_enb_config_reply(Protocol__FlexranMessage *msg) { return 0; error: - //LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); + //LOG_E(FLEXRAN_AGENT, "%s: an error occured\n", __FUNCTION__); return -1; } -int enb_agent_destroy_ue_config_reply(Protocol__FlexranMessage *msg) { +int flexran_agent_destroy_ue_config_reply(Protocol__FlexranMessage *msg) { if(msg->msg_case != PROTOCOL__FLEXRAN_MESSAGE__MSG_UE_CONFIG_REPLY_MSG) goto error; free(msg->ue_config_reply_msg->header); @@ -320,11 +320,11 @@ int enb_agent_destroy_ue_config_reply(Protocol__FlexranMessage *msg) { return 0; error: - //LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); + //LOG_E(FLEXRAN_AGENT, "%s: an error occured\n", __FUNCTION__); return -1; } -int enb_agent_destroy_lc_config_reply(Protocol__FlexranMessage *msg) { +int flexran_agent_destroy_lc_config_reply(Protocol__FlexranMessage *msg) { if(msg->msg_case != PROTOCOL__FLEXRAN_MESSAGE__MSG_LC_CONFIG_REPLY_MSG) goto error; @@ -342,11 +342,11 @@ int enb_agent_destroy_lc_config_reply(Protocol__FlexranMessage *msg) { free(msg); return 0; error: - //LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); + //LOG_E(FLEXRAN_AGENT, "%s: an error occured\n", __FUNCTION__); return -1; } -int enb_agent_destroy_ue_state_change(Protocol__FlexranMessage *msg) { +int flexran_agent_destroy_ue_state_change(Protocol__FlexranMessage *msg) { if(msg->msg_case != PROTOCOL__FLEXRAN_MESSAGE__MSG_UE_STATE_CHANGE_MSG) goto error; free(msg->ue_state_change_msg->header); @@ -360,7 +360,7 @@ int enb_agent_destroy_ue_state_change(Protocol__FlexranMessage *msg) { return -1; } -int enb_agent_destroy_enb_config_request(Protocol__FlexranMessage *msg) { +int flexran_agent_destroy_enb_config_request(Protocol__FlexranMessage *msg) { if(msg->msg_case != PROTOCOL__FLEXRAN_MESSAGE__MSG_ENB_CONFIG_REQUEST_MSG) goto error; free(msg->enb_config_request_msg->header); @@ -369,16 +369,16 @@ int enb_agent_destroy_enb_config_request(Protocol__FlexranMessage *msg) { return 0; error: - //LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); + //LOG_E(FLEXRAN_AGENT, "%s: an error occured\n", __FUNCTION__); return -1; } -int enb_agent_destroy_ue_config_request(Protocol__FlexranMessage *msg) { +int flexran_agent_destroy_ue_config_request(Protocol__FlexranMessage *msg) { /* TODO: Deallocate memory for a dynamically allocated UE config message */ return 0; } -int enb_agent_destroy_lc_config_request(Protocol__FlexranMessage *msg) { +int flexran_agent_destroy_lc_config_request(Protocol__FlexranMessage *msg) { /* TODO: Deallocate memory for a dynamically allocated LC config message */ return 0; } @@ -398,7 +398,7 @@ long timer_end(struct timespec start_time){ return diffInNanos; } -int enb_agent_control_delegation(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg) { +int flexran_agent_control_delegation(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg) { Protocol__FlexranMessage *input = (Protocol__FlexranMessage *)params; Protocol__FlexControlDelegation *control_delegation_msg = input->control_delegation_msg; @@ -429,11 +429,11 @@ int enb_agent_control_delegation(mid_t mod_id, const void *params, Protocol__Fle return -1; } -int enb_agent_destroy_control_delegation(Protocol__FlexranMessage *msg) { +int flexran_agent_destroy_control_delegation(Protocol__FlexranMessage *msg) { /*TODO: Dealocate memory for a dynamically allocated control delegation message*/ } -int enb_agent_reconfiguration(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg) { +int flexran_agent_reconfiguration(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg) { Protocol__FlexranMessage *input = (Protocol__FlexranMessage *)params; Protocol__FlexAgentReconfiguration *agent_reconfiguration_msg = input->agent_reconfiguration_msg; @@ -443,7 +443,7 @@ int enb_agent_reconfiguration(mid_t mod_id, const void *params, Protocol__Flexra return 0; } -int enb_agent_destroy_agent_reconfiguration(Protocol__FlexranMessage *msg) { +int flexran_agent_destroy_agent_reconfiguration(Protocol__FlexranMessage *msg) { /*TODO: Dealocate memory for a dynamically allocated agent reconfiguration message*/ } @@ -452,7 +452,7 @@ int enb_agent_destroy_agent_reconfiguration(Protocol__FlexranMessage *msg) { * get generic info from RAN */ -void set_enb_vars(mid_t mod_id, ran_name_t ran){ +void flexran_set_enb_vars(mid_t mod_id, ran_name_t ran){ switch (ran){ case RAN_LTE_OAI : @@ -467,10 +467,10 @@ void set_enb_vars(mid_t mod_id, ran_name_t ran){ return; error: - LOG_E(ENB_AGENT, "unknown RAN name %d\n", ran); + LOG_E(FLEXRAN_AGENT, "unknown RAN name %d\n", ran); } -int get_current_time_ms (mid_t mod_id, int subframe_flag){ +int flexran_get_current_time_ms (mid_t mod_id, int subframe_flag){ if (subframe_flag == 1){ return ((eNB_MAC_INST *)enb[mod_id])->frame*10 + ((eNB_MAC_INST *)enb[mod_id])->subframe; @@ -480,31 +480,31 @@ int get_current_time_ms (mid_t mod_id, int subframe_flag){ } -unsigned int get_current_frame (mid_t mod_id) { +unsigned int flexran_get_current_frame (mid_t mod_id) { #warning "SFN will not be in [0-1023] when oaisim is used" return ((eNB_MAC_INST *)enb[mod_id])->frame; } -unsigned int get_current_system_frame_num(mid_t mod_id) { - return (get_current_frame(mod_id) %1024); +unsigned int flexran_get_current_system_frame_num(mid_t mod_id) { + return (flexran_get_current_frame(mod_id) %1024); } -unsigned int get_current_subframe (mid_t mod_id) { +unsigned int flexran_get_current_subframe (mid_t mod_id) { return ((eNB_MAC_INST *)enb[mod_id])->subframe; } -uint16_t get_sfn_sf (mid_t mod_id) { +uint16_t flexran_get_sfn_sf (mid_t mod_id) { frame_t frame; sub_frame_t subframe; uint16_t sfn_sf, frame_mask, sf_mask; - frame = (frame_t) get_current_system_frame_num(mod_id); - subframe = (sub_frame_t) get_current_subframe(mod_id); + frame = (frame_t) flexran_get_current_system_frame_num(mod_id); + subframe = (sub_frame_t) flexran_get_current_subframe(mod_id); frame_mask = ((1<<12) - 1); sf_mask = ((1<<4) - 1); sfn_sf = (subframe & sf_mask) | ((frame & frame_mask) << 4); @@ -512,14 +512,14 @@ uint16_t get_sfn_sf (mid_t mod_id) { return sfn_sf; } -uint16_t get_future_sfn_sf (mid_t mod_id, int ahead_of_time) { +uint16_t flexran_get_future_sfn_sf (mid_t mod_id, int ahead_of_time) { frame_t frame; sub_frame_t subframe; uint16_t sfn_sf, frame_mask, sf_mask; - frame = (frame_t) get_current_system_frame_num(mod_id); - subframe = (sub_frame_t) get_current_subframe(mod_id); + frame = (frame_t) flexran_get_current_system_frame_num(mod_id); + subframe = (sub_frame_t) flexran_get_current_subframe(mod_id); subframe = ((subframe + ahead_of_time) % 10); @@ -527,7 +527,7 @@ uint16_t get_future_sfn_sf (mid_t mod_id, int ahead_of_time) { frame = frame + full_frames_ahead; - if (subframe < get_current_subframe(mod_id)) { + if (subframe < flexran_get_current_subframe(mod_id)) { frame++; } @@ -538,40 +538,40 @@ uint16_t get_future_sfn_sf (mid_t mod_id, int ahead_of_time) { return sfn_sf; } -int get_num_ues (mid_t mod_id){ +int flexran_get_num_ues (mid_t mod_id){ return ((UE_list_t *)enb_ue[mod_id])->num_UEs; } -int get_ue_crnti (mid_t mod_id, mid_t ue_id) { +int flexran_get_ue_crnti (mid_t mod_id, mid_t ue_id) { return UE_RNTI(mod_id, ue_id); } -int get_ue_bsr (mid_t mod_id, mid_t ue_id, lcid_t lcid) { +int flexran_get_ue_bsr (mid_t mod_id, mid_t ue_id, lcid_t lcid) { return ((UE_list_t *)enb_ue[mod_id])->UE_template[UE_PCCID(mod_id,ue_id)][ue_id].bsr_info[lcid]; } -int get_ue_phr (mid_t mod_id, mid_t ue_id) { +int flexran_get_ue_phr (mid_t mod_id, mid_t ue_id) { return ((UE_list_t *)enb_ue[mod_id])->UE_template[UE_PCCID(mod_id,ue_id)][ue_id].phr_info; } -int get_ue_wcqi (mid_t mod_id, mid_t ue_id) { +int flexran_get_ue_wcqi (mid_t mod_id, mid_t ue_id) { return ((UE_list_t *)enb_ue[mod_id])->eNB_UE_stats[UE_PCCID(mod_id,ue_id)][ue_id].dl_cqi; } -int get_tx_queue_size(mid_t mod_id, mid_t ue_id, logical_chan_id_t channel_id) -{ - rnti_t rnti = get_ue_crnti(mod_id,ue_id); - uint16_t frame = (uint16_t) get_current_frame(mod_id); + +int flexran_get_tx_queue_size(mid_t mod_id, mid_t ue_id, logical_chan_id_t channel_id) { + rnti_t rnti = flexran_get_ue_crnti(mod_id,ue_id); + uint16_t frame = (uint16_t) flexran_get_current_frame(mod_id); mac_rlc_status_resp_t rlc_status = mac_rlc_status_ind(mod_id,rnti, mod_id,frame,ENB_FLAG_YES,MBMS_FLAG_NO,channel_id,0); return rlc_status.bytes_in_buffer; } -int get_MAC_CE_bitmap_TA(mid_t mod_id, mid_t ue_id,int CC_id) +int flexran_get_MAC_CE_bitmap_TA(mid_t mod_id, mid_t ue_id,int CC_id) { - rnti_t rnti = get_ue_crnti(mod_id,ue_id); + rnti_t rnti = flexran_get_ue_crnti(mod_id,ue_id); LTE_eNB_UE_stats *eNB_UE_stats = mac_xface->get_eNB_UE_stats(mod_id,CC_id,rnti); if (eNB_UE_stats == NULL) { @@ -611,15 +611,15 @@ int get_MAC_CE_bitmap_TA(mid_t mod_id, mid_t ue_id,int CC_id) return 0; } -int get_active_CC(mid_t mod_id, mid_t ue_id) { +int flexran_get_active_CC(mid_t mod_id, mid_t ue_id) { return ((UE_list_t *)enb_ue[mod_id])->numactiveCCs[ue_id]; } -int get_current_RI(mid_t mod_id, mid_t ue_id, int CC_id) { +int flexran_get_current_RI(mid_t mod_id, mid_t ue_id, int CC_id) { LTE_eNB_UE_stats *eNB_UE_stats = NULL; int pCCid = UE_PCCID(mod_id,ue_id); - rnti_t rnti = get_ue_crnti(mod_id,ue_id); + rnti_t rnti = flexran_get_ue_crnti(mod_id,ue_id); eNB_UE_stats = mac_xface->get_eNB_UE_stats(mod_id,CC_id,rnti); @@ -630,13 +630,13 @@ int get_current_RI(mid_t mod_id, mid_t ue_id, int CC_id) { return eNB_UE_stats[CC_id].rank; } -int get_tpc(mid_t mod_id, mid_t ue_id) { +int flexran_get_tpc(mid_t mod_id, mid_t ue_id) { LTE_eNB_UE_stats *eNB_UE_stats = NULL; int32_t normalized_rx_power, target_rx_power; int tpc = 1; int pCCid = UE_PCCID(mod_id,ue_id); - rnti_t rnti = get_ue_crnti(mod_id,ue_id); + rnti_t rnti = flexran_get_ue_crnti(mod_id,ue_id); eNB_UE_stats = mac_xface->get_eNB_UE_stats(mod_id, pCCid, rnti); @@ -660,7 +660,7 @@ int get_tpc(mid_t mod_id, mid_t ue_id) { return tpc; } -int get_harq(const mid_t mod_id, const uint8_t CC_id, const mid_t ue_id, const int frame, const uint8_t subframe, int *id, int *status) { //flag_id_status = 0 then id, else status +int flexran_get_harq(const mid_t mod_id, const uint8_t CC_id, const mid_t ue_id, const int frame, const uint8_t subframe, int *id, int *status) { //flag_id_status = 0 then id, else status /*TODO: Add int TB in function parameters to get the status of the second TB. This can be done to by editing in * get_ue_active_harq_pid function in line 272 file: phy_procedures_lte_eNB.c to add * DLSCH_ptr = PHY_vars_eNB_g[Mod_id][CC_id]->dlsch_eNB[(uint32_t)UE_id][1];*/ @@ -669,7 +669,7 @@ int get_harq(const mid_t mod_id, const uint8_t CC_id, const mid_t ue_id, const i uint8_t round; - uint16_t rnti = get_ue_crnti(mod_id,ue_id); + uint16_t rnti = flexran_get_ue_crnti(mod_id,ue_id); mac_xface->get_ue_active_harq_pid(mod_id,CC_id,rnti,frame,subframe,&harq_pid,&round,openair_harq_DL); @@ -683,9 +683,9 @@ int get_harq(const mid_t mod_id, const uint8_t CC_id, const mid_t ue_id, const i return 0; } -int get_p0_pucch_dbm(mid_t mod_id, mid_t ue_id, int CC_id) { +int flexran_get_p0_pucch_dbm(mid_t mod_id, mid_t ue_id, int CC_id) { LTE_eNB_UE_stats *eNB_UE_stats = NULL; - uint32_t rnti = get_ue_crnti(mod_id,ue_id); + uint32_t rnti = flexran_get_ue_crnti(mod_id,ue_id); eNB_UE_stats = mac_xface->get_eNB_UE_stats(mod_id, CC_id, rnti); @@ -693,15 +693,14 @@ int get_p0_pucch_dbm(mid_t mod_id, mid_t ue_id, int CC_id) { return -1; } - if(eNB_UE_stats->Po_PUCCH_update == 1) - { + if(eNB_UE_stats->Po_PUCCH_update == 1) { return eNB_UE_stats->Po_PUCCH_dBm; } else return -1; } -int get_p0_nominal_pucch(mid_t mod_id, int CC_id) { +int flexran_get_p0_nominal_pucch(mid_t mod_id, int CC_id) { int32_t pucch_rx_received = mac_xface->get_target_pucch_rx_power(mod_id, CC_id); return pucch_rx_received; } @@ -713,42 +712,42 @@ int get_p0_nominal_pucch(mid_t mod_id, int CC_id) { * ************************************ */ -int get_hopping_offset(mid_t mod_id, int CC_id) { +int flexran_get_hopping_offset(mid_t mod_id, int CC_id) { LTE_DL_FRAME_PARMS *frame_parms; frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id); return frame_parms->pusch_config_common.pusch_HoppingOffset; } -int get_hopping_mode(mid_t mod_id, int CC_id) { +int flexran_get_hopping_mode(mid_t mod_id, int CC_id) { LTE_DL_FRAME_PARMS *frame_parms; frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id); return frame_parms->pusch_config_common.hoppingMode; } -int get_n_SB(mid_t mod_id, int CC_id) { +int flexran_get_n_SB(mid_t mod_id, int CC_id) { LTE_DL_FRAME_PARMS *frame_parms; frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id); return frame_parms->pusch_config_common.n_SB; } -int get_enable64QAM(mid_t mod_id, int CC_id) { +int flexran_get_enable64QAM(mid_t mod_id, int CC_id) { LTE_DL_FRAME_PARMS *frame_parms; frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id); return frame_parms->pusch_config_common.enable64QAM; } -int get_phich_duration(mid_t mod_id, int CC_id) { +int flexran_get_phich_duration(mid_t mod_id, int CC_id) { LTE_DL_FRAME_PARMS *frame_parms; frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id); return frame_parms->phich_config_common.phich_duration; } -int get_phich_resource(mid_t mod_id, int CC_id) { +int flexran_get_phich_resource(mid_t mod_id, int CC_id) { LTE_DL_FRAME_PARMS *frame_parms; frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id); @@ -764,131 +763,131 @@ int get_phich_resource(mid_t mod_id, int CC_id) { return -1; } -int get_n1pucch_an(mid_t mod_id, int CC_id) { +int flexran_get_n1pucch_an(mid_t mod_id, int CC_id) { LTE_DL_FRAME_PARMS *frame_parms; frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id); return frame_parms->pucch_config_common.n1PUCCH_AN; } -int get_nRB_CQI(mid_t mod_id, int CC_id) { +int flexran_get_nRB_CQI(mid_t mod_id, int CC_id) { LTE_DL_FRAME_PARMS *frame_parms; frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id); return frame_parms->pucch_config_common.nRB_CQI; } -int get_deltaPUCCH_Shift(mid_t mod_id, int CC_id) { +int flexran_get_deltaPUCCH_Shift(mid_t mod_id, int CC_id) { LTE_DL_FRAME_PARMS *frame_parms; frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id); return frame_parms->pucch_config_common.deltaPUCCH_Shift; } -int get_prach_ConfigIndex(mid_t mod_id, int CC_id) { +int flexran_get_prach_ConfigIndex(mid_t mod_id, int CC_id) { LTE_DL_FRAME_PARMS *frame_parms; frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id); return frame_parms->prach_config_common.prach_ConfigInfo.prach_ConfigIndex; } -int get_prach_FreqOffset(mid_t mod_id, int CC_id) { +int flexran_get_prach_FreqOffset(mid_t mod_id, int CC_id) { LTE_DL_FRAME_PARMS *frame_parms; frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id); return frame_parms->prach_config_common.prach_ConfigInfo.prach_FreqOffset; } -int get_maxHARQ_Msg3Tx(mid_t mod_id, int CC_id) { +int flexran_get_maxHARQ_Msg3Tx(mid_t mod_id, int CC_id) { LTE_DL_FRAME_PARMS *frame_parms; frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id); return frame_parms->maxHARQ_Msg3Tx; } -int get_ul_cyclic_prefix_length(mid_t mod_id, int CC_id) { +int flexran_get_ul_cyclic_prefix_length(mid_t mod_id, int CC_id) { LTE_DL_FRAME_PARMS *frame_parms; frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id); return frame_parms->Ncp_UL; } -int get_dl_cyclic_prefix_length(mid_t mod_id, int CC_id) { +int flexran_get_dl_cyclic_prefix_length(mid_t mod_id, int CC_id) { LTE_DL_FRAME_PARMS *frame_parms; frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id); return frame_parms->Ncp; } -int get_cell_id(mid_t mod_id, int CC_id) { +int flexran_get_cell_id(mid_t mod_id, int CC_id) { LTE_DL_FRAME_PARMS *frame_parms; frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id); return frame_parms->Nid_cell; } -int get_srs_BandwidthConfig(mid_t mod_id, int CC_id) { +int flexran_get_srs_BandwidthConfig(mid_t mod_id, int CC_id) { LTE_DL_FRAME_PARMS *frame_parms; frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id); return frame_parms->soundingrs_ul_config_common.srs_BandwidthConfig; } -int get_srs_SubframeConfig(mid_t mod_id, int CC_id) { +int flexran_get_srs_SubframeConfig(mid_t mod_id, int CC_id) { LTE_DL_FRAME_PARMS *frame_parms; frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id); return frame_parms->soundingrs_ul_config_common.srs_SubframeConfig; } -int get_srs_MaxUpPts(mid_t mod_id, int CC_id) { +int flexran_get_srs_MaxUpPts(mid_t mod_id, int CC_id) { LTE_DL_FRAME_PARMS *frame_parms; frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id); return frame_parms->soundingrs_ul_config_common.srs_MaxUpPts; } -int get_N_RB_DL(mid_t mod_id, int CC_id) { +int flexran_get_N_RB_DL(mid_t mod_id, int CC_id) { LTE_DL_FRAME_PARMS *frame_parms; frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id); return frame_parms->N_RB_DL; } -int get_N_RB_UL(mid_t mod_id, int CC_id) { +int flexran_get_N_RB_UL(mid_t mod_id, int CC_id) { LTE_DL_FRAME_PARMS *frame_parms; frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id); return frame_parms->N_RB_UL; } -int get_subframe_assignment(mid_t mod_id, int CC_id) { +int flexran_get_subframe_assignment(mid_t mod_id, int CC_id) { LTE_DL_FRAME_PARMS *frame_parms; frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id); return frame_parms->tdd_config; } -int get_special_subframe_assignment(mid_t mod_id, int CC_id) { +int flexran_get_special_subframe_assignment(mid_t mod_id, int CC_id) { LTE_DL_FRAME_PARMS *frame_parms; frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id); return frame_parms->tdd_config_S; } -int get_ra_ResponseWindowSize(mid_t mod_id, int CC_id) { +int flexran_get_ra_ResponseWindowSize(mid_t mod_id, int CC_id) { Enb_properties_array_t *enb_properties; enb_properties = enb_config_get(); return enb_properties->properties[mod_id]->rach_raResponseWindowSize[CC_id]; } -int get_mac_ContentionResolutionTimer(mid_t mod_id, int CC_id) { +int flexran_get_mac_ContentionResolutionTimer(mid_t mod_id, int CC_id) { Enb_properties_array_t *enb_properties; enb_properties = enb_config_get(); return enb_properties->properties[mod_id]->rach_macContentionResolutionTimer[CC_id]; } -int get_duplex_mode(mid_t mod_id, int CC_id) { +int flexran_get_duplex_mode(mid_t mod_id, int CC_id) { LTE_DL_FRAME_PARMS *frame_parms; frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id); @@ -900,15 +899,15 @@ int get_duplex_mode(mid_t mod_id, int CC_id) { return -1; } -long get_si_window_length(mid_t mod_id, int CC_id) { +long flexran_get_si_window_length(mid_t mod_id, int CC_id) { return ((eNB_RRC_INST *)enb_rrc[mod_id])->carrier[CC_id].sib1->si_WindowLength; } -int get_sib1_length(mid_t mod_id, int CC_id) { +int flexran_get_sib1_length(mid_t mod_id, int CC_id) { return ((eNB_RRC_INST *)enb_rrc[mod_id])->carrier[CC_id].sizeof_SIB1; } -int get_num_pdcch_symb(mid_t mod_id, int CC_id) { +int flexran_get_num_pdcch_symb(mid_t mod_id, int CC_id) { /* TODO: This should return the number of PDCCH symbols initially used by the cell CC_id */ return 0; //(PHY_vars_UE_g[mod_id][CC_id]->lte_ue_pdcch_vars[mod_id]->num_pdcch_symbols); @@ -923,27 +922,26 @@ int get_num_pdcch_symb(mid_t mod_id, int CC_id) { */ -int get_time_alignment_timer(mid_t mod_id, mid_t ue_id) { +int flexran_get_time_alignment_timer(mid_t mod_id, mid_t ue_id) { struct rrc_eNB_ue_context_s* ue_context_p = NULL; - uint32_t rntiP = get_ue_crnti(mod_id,ue_id); + uint32_t rntiP = flexran_get_ue_crnti(mod_id,ue_id); ue_context_p = rrc_eNB_get_ue_context(&eNB_rrc_inst[mod_id],rntiP); - if(ue_context_p != NULL) - { - if(ue_context_p->ue_context.mac_MainConfig != NULL) - return ue_context_p->ue_context.mac_MainConfig->timeAlignmentTimerDedicated; + if(ue_context_p != NULL) { + if(ue_context_p->ue_context.mac_MainConfig != NULL) + return ue_context_p->ue_context.mac_MainConfig->timeAlignmentTimerDedicated; } else - return -1; + return -1; } -int get_meas_gap_config(mid_t mod_id, mid_t ue_id) { +int flexran_get_meas_gap_config(mid_t mod_id, mid_t ue_id) { struct rrc_eNB_ue_context_s* ue_context_p = NULL; - uint32_t rntiP = get_ue_crnti(mod_id,ue_id); + uint32_t rntiP = flexran_get_ue_crnti(mod_id,ue_id); ue_context_p = rrc_eNB_get_ue_context(&eNB_rrc_inst[mod_id],rntiP); if(ue_context_p != NULL) { - if(ue_context_p->ue_context.measGapConfig != NULL){ + if(ue_context_p->ue_context.measGapConfig != NULL) { if(ue_context_p->ue_context.measGapConfig->present == MeasGapConfig_PR_setup) { if (ue_context_p->ue_context.measGapConfig->choice.setup.gapOffset.present == MeasGapConfig__setup__gapOffset_PR_gp0) { return PROTOCOL__FLEX_MEAS_GAP_CONFIG_PATTERN__FLMGCP_GP1; @@ -959,9 +957,9 @@ int get_meas_gap_config(mid_t mod_id, mid_t ue_id) { } -int get_meas_gap_config_offset(mid_t mod_id, mid_t ue_id) { +int flexran_get_meas_gap_config_offset(mid_t mod_id, mid_t ue_id) { struct rrc_eNB_ue_context_s* ue_context_p = NULL; - uint32_t rntiP = get_ue_crnti(mod_id,ue_id); + uint32_t rntiP = flexran_get_ue_crnti(mod_id,ue_id); ue_context_p = rrc_eNB_get_ue_context(&eNB_rrc_inst[mod_id],rntiP); @@ -979,15 +977,15 @@ int get_meas_gap_config_offset(mid_t mod_id, mid_t ue_id) { return -1; } -int get_ue_aggregated_max_bitrate_dl (mid_t mod_id, mid_t ue_id) { +int flexran_get_ue_aggregated_max_bitrate_dl (mid_t mod_id, mid_t ue_id) { return ((UE_list_t *)enb_ue[mod_id])->UE_sched_ctrl[ue_id].ue_AggregatedMaximumBitrateDL; } -int get_ue_aggregated_max_bitrate_ul (mid_t mod_id, mid_t ue_id) { +int flexran_get_ue_aggregated_max_bitrate_ul (mid_t mod_id, mid_t ue_id) { return ((UE_list_t *)enb_ue[mod_id])->UE_sched_ctrl[ue_id].ue_AggregatedMaximumBitrateUL; } -int get_half_duplex(mid_t ue_id) { +int flexran_get_half_duplex(mid_t ue_id) { // TODO //int halfduplex = 0; //int bands_to_scan = ((UE_RRC_INST *)enb_ue_rrc[ue_id])->UECap->UE_EUTRA_Capability->rf_Parameters.supportedBandListEUTRA.list.count; @@ -998,65 +996,63 @@ int get_half_duplex(mid_t ue_id) { //return halfduplex; } -int get_intra_sf_hopping(mid_t ue_id) { +int flexran_get_intra_sf_hopping(mid_t ue_id) { //TODO:Get proper value //temp = (((UE_RRC_INST *)enb_ue_rrc[ue_id])->UECap->UE_EUTRA_Capability->featureGroupIndicators->buf); //return (0 & ( 1 << (31))); } -int get_type2_sb_1(mid_t ue_id) { +int flexran_get_type2_sb_1(mid_t ue_id) { //TODO:Get proper value //uint8_t temp = 0; //temp = (((UE_RRC_INST *)enb_ue_rrc[ue_id])->UECap->UE_EUTRA_Capability->featureGroupIndicators->buf); //return (temp & ( 1 << (11))); } -int get_ue_category(mid_t ue_id) { +int flexran_get_ue_category(mid_t ue_id) { //TODO:Get proper value //return (((UE_RRC_INST *)enb_ue_rrc[ue_id])->UECap->UE_EUTRA_Capability->ue_Category); } -int get_res_alloc_type1(mid_t ue_id) { +int flexran_get_res_alloc_type1(mid_t ue_id) { //TODO:Get proper value //uint8_t temp = 0; //temp = (((UE_RRC_INST *)enb_ue_rrc[ue_id])->UECap->UE_EUTRA_Capability->featureGroupIndicators->buf); //return (temp & ( 1 << (30))); } -int get_ue_transmission_mode(mid_t mod_id, mid_t ue_id) { +int flexran_get_ue_transmission_mode(mid_t mod_id, mid_t ue_id) { struct rrc_eNB_ue_context_s* ue_context_p = NULL; - uint32_t rntiP = get_ue_crnti(mod_id,ue_id); + uint32_t rntiP = flexran_get_ue_crnti(mod_id,ue_id); ue_context_p = rrc_eNB_get_ue_context(&eNB_rrc_inst[mod_id],rntiP); - if(ue_context_p != NULL) - { - if(ue_context_p->ue_context.physicalConfigDedicated != NULL){ - return ue_context_p->ue_context.physicalConfigDedicated->antennaInfo->choice.explicitValue.transmissionMode; - } + if(ue_context_p != NULL) { + if(ue_context_p->ue_context.physicalConfigDedicated != NULL){ + return ue_context_p->ue_context.physicalConfigDedicated->antennaInfo->choice.explicitValue.transmissionMode; + } } else - return -1; + return -1; } -int get_tti_bundling(mid_t mod_id, mid_t ue_id) { +int flexran_get_tti_bundling(mid_t mod_id, mid_t ue_id) { struct rrc_eNB_ue_context_s* ue_context_p = NULL; - uint32_t rntiP = get_ue_crnti(mod_id,ue_id); + uint32_t rntiP = flexran_get_ue_crnti(mod_id,ue_id); ue_context_p = rrc_eNB_get_ue_context(&eNB_rrc_inst[mod_id],rntiP); - if(ue_context_p != NULL) - { - if(ue_context_p->ue_context.mac_MainConfig != NULL){ - return ue_context_p->ue_context.mac_MainConfig->ul_SCH_Config->ttiBundling; - } + if(ue_context_p != NULL) { + if(ue_context_p->ue_context.mac_MainConfig != NULL){ + return ue_context_p->ue_context.mac_MainConfig->ul_SCH_Config->ttiBundling; + } } else - return -1; + return -1; } -int get_maxHARQ_TX(mid_t mod_id, mid_t ue_id) { +int flexran_get_maxHARQ_TX(mid_t mod_id, mid_t ue_id) { struct rrc_eNB_ue_context_s* ue_context_p = NULL; - uint32_t rntiP = get_ue_crnti(mod_id,ue_id); + uint32_t rntiP = flexran_get_ue_crnti(mod_id,ue_id); ue_context_p = rrc_eNB_get_ue_context(&eNB_rrc_inst[mod_id],rntiP); if(ue_context_p != NULL) { @@ -1067,54 +1063,51 @@ int get_maxHARQ_TX(mid_t mod_id, mid_t ue_id) { return -1; } -int get_beta_offset_ack_index(mid_t mod_id, mid_t ue_id) { +int flexran_get_beta_offset_ack_index(mid_t mod_id, mid_t ue_id) { struct rrc_eNB_ue_context_s* ue_context_p = NULL; - uint32_t rntiP = get_ue_crnti(mod_id,ue_id); + uint32_t rntiP = flexran_get_ue_crnti(mod_id,ue_id); ue_context_p = rrc_eNB_get_ue_context(&eNB_rrc_inst[mod_id],rntiP); - if(ue_context_p != NULL) - { - if(ue_context_p->ue_context.physicalConfigDedicated != NULL){ - return ue_context_p->ue_context.physicalConfigDedicated->pusch_ConfigDedicated->betaOffset_ACK_Index; - } + if(ue_context_p != NULL) { + if(ue_context_p->ue_context.physicalConfigDedicated != NULL){ + return ue_context_p->ue_context.physicalConfigDedicated->pusch_ConfigDedicated->betaOffset_ACK_Index; + } } else - return -1; + return -1; } -int get_beta_offset_ri_index(mid_t mod_id, mid_t ue_id) { +int flexran_get_beta_offset_ri_index(mid_t mod_id, mid_t ue_id) { struct rrc_eNB_ue_context_s* ue_context_p = NULL; - uint32_t rntiP = get_ue_crnti(mod_id,ue_id); + uint32_t rntiP = flexran_get_ue_crnti(mod_id,ue_id); ue_context_p = rrc_eNB_get_ue_context(&eNB_rrc_inst[mod_id],rntiP); - if(ue_context_p != NULL) - { - if(ue_context_p->ue_context.physicalConfigDedicated != NULL){ - return ue_context_p->ue_context.physicalConfigDedicated->pusch_ConfigDedicated->betaOffset_RI_Index; - } + if(ue_context_p != NULL) { + if(ue_context_p->ue_context.physicalConfigDedicated != NULL){ + return ue_context_p->ue_context.physicalConfigDedicated->pusch_ConfigDedicated->betaOffset_RI_Index; + } } else - return -1; + return -1; } -int get_beta_offset_cqi_index(mid_t mod_id, mid_t ue_id) { +int flexran_get_beta_offset_cqi_index(mid_t mod_id, mid_t ue_id) { struct rrc_eNB_ue_context_s* ue_context_p = NULL; - uint32_t rntiP = get_ue_crnti(mod_id,ue_id); + uint32_t rntiP = flexran_get_ue_crnti(mod_id,ue_id); ue_context_p = rrc_eNB_get_ue_context(&eNB_rrc_inst[mod_id],rntiP); - if(ue_context_p != NULL) - { - if(ue_context_p->ue_context.physicalConfigDedicated != NULL){ - return ue_context_p->ue_context.physicalConfigDedicated->pusch_ConfigDedicated->betaOffset_CQI_Index; - } + if(ue_context_p != NULL) { + if(ue_context_p->ue_context.physicalConfigDedicated != NULL){ + return ue_context_p->ue_context.physicalConfigDedicated->pusch_ConfigDedicated->betaOffset_CQI_Index; + } } else - return -1; + return -1; } -int get_simultaneous_ack_nack_cqi(mid_t mod_id, mid_t ue_id) { +int flexran_get_simultaneous_ack_nack_cqi(mid_t mod_id, mid_t ue_id) { struct rrc_eNB_ue_context_s* ue_context_p = NULL; - uint32_t rntiP = get_ue_crnti(mod_id,ue_id); + uint32_t rntiP = flexran_get_ue_crnti(mod_id,ue_id); ue_context_p = rrc_eNB_get_ue_context(&eNB_rrc_inst[mod_id],rntiP); if(ue_context_p != NULL) { @@ -1127,13 +1120,13 @@ int get_simultaneous_ack_nack_cqi(mid_t mod_id, mid_t ue_id) { return -1; } -int get_ack_nack_simultaneous_trans(mid_t mod_id,mid_t ue_id) { +int flexran_get_ack_nack_simultaneous_trans(mid_t mod_id,mid_t ue_id) { return (&eNB_rrc_inst[mod_id])->carrier[0].sib2->radioResourceConfigCommon.soundingRS_UL_ConfigCommon.choice.setup.ackNackSRS_SimultaneousTransmission; } -int get_aperiodic_cqi_rep_mode(mid_t mod_id,mid_t ue_id) { +int flexran_get_aperiodic_cqi_rep_mode(mid_t mod_id,mid_t ue_id) { struct rrc_eNB_ue_context_s* ue_context_p = NULL; - uint32_t rntiP = get_ue_crnti(mod_id,ue_id); + uint32_t rntiP = flexran_get_ue_crnti(mod_id,ue_id); ue_context_p = rrc_eNB_get_ue_context(&eNB_rrc_inst[mod_id],rntiP); @@ -1145,41 +1138,39 @@ int get_aperiodic_cqi_rep_mode(mid_t mod_id,mid_t ue_id) { return -1; } -int get_tdd_ack_nack_feedback(mid_t mod_id, mid_t ue_id) { +int flexran_get_tdd_ack_nack_feedback(mid_t mod_id, mid_t ue_id) { struct rrc_eNB_ue_context_s* ue_context_p = NULL; - uint32_t rntiP = get_ue_crnti(mod_id,ue_id); + uint32_t rntiP = flexran_get_ue_crnti(mod_id,ue_id); ue_context_p = rrc_eNB_get_ue_context(&eNB_rrc_inst[mod_id],rntiP); - if(ue_context_p != NULL) - { - if(ue_context_p->ue_context.physicalConfigDedicated != NULL){ - return ue_context_p->ue_context.physicalConfigDedicated->pucch_ConfigDedicated->tdd_AckNackFeedbackMode; - } + if(ue_context_p != NULL) { + if(ue_context_p->ue_context.physicalConfigDedicated != NULL){ + return ue_context_p->ue_context.physicalConfigDedicated->pucch_ConfigDedicated->tdd_AckNackFeedbackMode; + } } else - return -1; + return -1; } -int get_ack_nack_repetition_factor(mid_t mod_id, mid_t ue_id) { +int flexran_get_ack_nack_repetition_factor(mid_t mod_id, mid_t ue_id) { struct rrc_eNB_ue_context_s* ue_context_p = NULL; - uint32_t rntiP = get_ue_crnti(mod_id,ue_id); + uint32_t rntiP = flexran_get_ue_crnti(mod_id,ue_id); ue_context_p = rrc_eNB_get_ue_context(&eNB_rrc_inst[mod_id],rntiP); - if(ue_context_p != NULL) - { - if(ue_context_p->ue_context.physicalConfigDedicated != NULL){ - return ue_context_p->ue_context.physicalConfigDedicated->pucch_ConfigDedicated->ackNackRepetition.choice.setup.repetitionFactor; - } + if(ue_context_p != NULL) { + if(ue_context_p->ue_context.physicalConfigDedicated != NULL){ + return ue_context_p->ue_context.physicalConfigDedicated->pucch_ConfigDedicated->ackNackRepetition.choice.setup.repetitionFactor; + } } else - return -1; + return -1; } -int get_extended_bsr_size(mid_t mod_id, mid_t ue_id) { +int flexran_get_extended_bsr_size(mid_t mod_id, mid_t ue_id) { //TODO: need to double check struct rrc_eNB_ue_context_s* ue_context_p = NULL; - uint32_t rntiP = get_ue_crnti(mod_id,ue_id); + uint32_t rntiP = flexran_get_ue_crnti(mod_id,ue_id); ue_context_p = rrc_eNB_get_ue_context(&eNB_rrc_inst[mod_id],rntiP); if(ue_context_p != NULL) { @@ -1195,28 +1186,27 @@ int get_extended_bsr_size(mid_t mod_id, mid_t ue_id) { return -1; } -int get_ue_transmission_antenna(mid_t mod_id, mid_t ue_id) { +int flexran_get_ue_transmission_antenna(mid_t mod_id, mid_t ue_id) { struct rrc_eNB_ue_context_s* ue_context_p = NULL; - uint32_t rntiP = get_ue_crnti(mod_id,ue_id); + uint32_t rntiP = flexran_get_ue_crnti(mod_id,ue_id); ue_context_p = rrc_eNB_get_ue_context(&eNB_rrc_inst[mod_id],rntiP); - if(ue_context_p != NULL) - { - if(ue_context_p->ue_context.physicalConfigDedicated != NULL){ - if(ue_context_p->ue_context.physicalConfigDedicated->antennaInfo->choice.explicitValue.ue_TransmitAntennaSelection.choice.setup == AntennaInfoDedicated__ue_TransmitAntennaSelection__setup_closedLoop) - return 2; - else if(ue_context_p->ue_context.physicalConfigDedicated->antennaInfo->choice.explicitValue.ue_TransmitAntennaSelection.choice.setup == AntennaInfoDedicated__ue_TransmitAntennaSelection__setup_openLoop) - return 1; - else - return 0; - } + if(ue_context_p != NULL) { + if(ue_context_p->ue_context.physicalConfigDedicated != NULL){ + if(ue_context_p->ue_context.physicalConfigDedicated->antennaInfo->choice.explicitValue.ue_TransmitAntennaSelection.choice.setup == AntennaInfoDedicated__ue_TransmitAntennaSelection__setup_closedLoop) + return 2; + else if(ue_context_p->ue_context.physicalConfigDedicated->antennaInfo->choice.explicitValue.ue_TransmitAntennaSelection.choice.setup == AntennaInfoDedicated__ue_TransmitAntennaSelection__setup_openLoop) + return 1; + else + return 0; + } } else - return -1; + return -1; } -int get_lcg(mid_t ue_id, mid_t lc_id) { +int flexran_get_lcg(mid_t ue_id, mid_t lc_id) { if (UE_mac_inst == NULL) { return -1; } @@ -1227,15 +1217,15 @@ int get_lcg(mid_t ue_id, mid_t lc_id) { } } -int get_direction(mid_t ue_id, mid_t lc_id) { +int flexran_get_direction(mid_t ue_id, mid_t lc_id) { /*TODO: fill with the value for the rest of LCID*/ - if(lc_id == DCCH | lc_id == DCCH1) - return 2; - else if(lc_id == DTCH) - return 1; + if(lc_id == DCCH | lc_id == DCCH1) + return 2; + else if(lc_id == DTCH) + return 1; } -int enb_agent_ue_state_change(mid_t mod_id, uint32_t rnti, uint8_t state_change) { +int flexran_agent_ue_state_change(mid_t mod_id, uint32_t rnti, uint8_t state_change) { int size; Protocol__FlexranMessage *msg; Protocol__FlexHeader *header; @@ -1245,7 +1235,7 @@ int enb_agent_ue_state_change(mid_t mod_id, uint32_t rnti, uint8_t state_change) int xid = 0; - if (flex_create_header(xid, PROTOCOL__FLEX_TYPE__FLPT_UE_STATE_CHANGE, &header) != 0) + if (flexran_create_header(xid, PROTOCOL__FLEX_TYPE__FLPT_UE_STATE_CHANGE, &header) != 0) goto error; Protocol__FlexUeStateChange *ue_state_change_msg; @@ -1269,20 +1259,20 @@ int enb_agent_ue_state_change(mid_t mod_id, uint32_t rnti, uint8_t state_change) config->rnti = rnti; } else if (state_change == PROTOCOL__FLEX_UE_STATE_CHANGE_TYPE__FLUESC_UPDATED || state_change == PROTOCOL__FLEX_UE_STATE_CHANGE_TYPE__FLUESC_ACTIVATED) { - int i =find_UE_id(mod_id,rnti); - config->has_rnti = 1; - config->rnti = rnti; - if(get_time_alignment_timer(mod_id,i) != -1){ - config->time_alignment_timer = get_time_alignment_timer(mod_id,i); + int i = find_UE_id(mod_id, rnti); + config->has_rnti = 1; + config->rnti = rnti; + if(flexran_get_time_alignment_timer(mod_id,i) != -1) { + config->time_alignment_timer = flexran_get_time_alignment_timer(mod_id,i); config->has_time_alignment_timer = 1; } - if(get_meas_gap_config(mod_id,i) != -1){ - config->meas_gap_config_pattern = get_meas_gap_config(mod_id,i); + if(flexran_get_meas_gap_config(mod_id,i) != -1){ + config->meas_gap_config_pattern = flexran_get_meas_gap_config(mod_id,i); config->has_meas_gap_config_pattern = 1; } if(config->has_meas_gap_config_pattern == 1 && config->meas_gap_config_pattern != PROTOCOL__FLEX_MEAS_GAP_CONFIG_PATTERN__FLMGCP_OFF) { - config->meas_gap_config_sf_offset = get_meas_gap_config_offset(mod_id,i); + config->meas_gap_config_sf_offset = flexran_get_meas_gap_config_offset(mod_id,i); config->has_meas_gap_config_sf_offset = 1; } //TODO: Set the SPS configuration (Optional) @@ -1294,15 +1284,15 @@ int enb_agent_ue_state_change(mid_t mod_id, uint32_t rnti, uint8_t state_change) //TODO: Set the CQI configuration (Optional) //We do not set it for now - if(get_ue_transmission_mode(mod_id,i) != -1){ - config->transmission_mode = get_ue_transmission_mode(mod_id,i); + if(flexran_get_ue_transmission_mode(mod_id,i) != -1) { + config->transmission_mode = flexran_get_ue_transmission_mode(mod_id,i); config->has_transmission_mode = 1; } - config->ue_aggregated_max_bitrate_ul = get_ue_aggregated_max_bitrate_ul(mod_id,i); + config->ue_aggregated_max_bitrate_ul = flexran_get_ue_aggregated_max_bitrate_ul(mod_id,i); config->has_ue_aggregated_max_bitrate_ul = 1; - config->ue_aggregated_max_bitrate_dl = get_ue_aggregated_max_bitrate_dl(mod_id,i); + config->ue_aggregated_max_bitrate_dl = flexran_get_ue_aggregated_max_bitrate_dl(mod_id,i); config->has_ue_aggregated_max_bitrate_dl = 1; //TODO: Set the UE capabilities @@ -1311,85 +1301,85 @@ int enb_agent_ue_state_change(mid_t mod_id, uint32_t rnti, uint8_t state_change) protocol__flex_ue_capabilities__init(c_capabilities); //TODO: Set half duplex (FDD operation) c_capabilities->has_half_duplex = 0; - c_capabilities->half_duplex = 1;//get_half_duplex(i); + c_capabilities->half_duplex = 1;//flexran_get_half_duplex(i); //TODO: Set intra-frame hopping flag c_capabilities->has_intra_sf_hopping = 0; - c_capabilities->intra_sf_hopping = 1;//get_intra_sf_hopping(i); + c_capabilities->intra_sf_hopping = 1;//flexran_get_intra_sf_hopping(i); //TODO: Set support for type 2 hopping with n_sb > 1 c_capabilities->has_type2_sb_1 = 0; - c_capabilities->type2_sb_1 = 1;//get_type2_sb_1(i); + c_capabilities->type2_sb_1 = 1;//flexran_get_type2_sb_1(i); //TODO: Set ue category c_capabilities->has_ue_category = 0; - c_capabilities->ue_category = 1;//get_ue_category(i); + c_capabilities->ue_category = 1;//flexran_get_ue_category(i); //TODO: Set UE support for resource allocation type 1 c_capabilities->has_res_alloc_type1 = 0; - c_capabilities->res_alloc_type1 = 1;//get_res_alloc_type1(i); + c_capabilities->res_alloc_type1 = 1;//flexran_get_res_alloc_type1(i); //Set the capabilites to the message config->capabilities = c_capabilities; - if(get_ue_transmission_antenna(mod_id,i) != -1){ - config->has_ue_transmission_antenna = 1; - config->ue_transmission_antenna = get_ue_transmission_antenna(mod_id,i); + if(flexran_get_ue_transmission_antenna(mod_id,i) != -1) { + config->has_ue_transmission_antenna = 1; + config->ue_transmission_antenna = flexran_get_ue_transmission_antenna(mod_id,i); } - if(get_tti_bundling(mod_id,i) != -1){ - config->has_tti_bundling = 1; - config->tti_bundling = get_tti_bundling(mod_id,i); + if(flexran_get_tti_bundling(mod_id,i) != -1) { + config->has_tti_bundling = 1; + config->tti_bundling = flexran_get_tti_bundling(mod_id,i); } - if(get_maxHARQ_TX(mod_id,i) != -1){ - config->has_max_harq_tx = 1; - config->max_harq_tx = get_maxHARQ_TX(mod_id,i); + if(flexran_get_maxHARQ_TX(mod_id,i) != -1){ + config->has_max_harq_tx = 1; + config->max_harq_tx = flexran_get_maxHARQ_TX(mod_id,i); } - if(get_beta_offset_ack_index(mod_id,i) != -1){ - config->has_beta_offset_ack_index = 1; - config->beta_offset_ack_index = get_beta_offset_ack_index(mod_id,i); + if(flexran_get_beta_offset_ack_index(mod_id,i) != -1) { + config->has_beta_offset_ack_index = 1; + config->beta_offset_ack_index = flexran_get_beta_offset_ack_index(mod_id,i); } - if(get_beta_offset_ri_index(mod_id,i) != -1){ - config->has_beta_offset_ri_index = 1; - config->beta_offset_ri_index = get_beta_offset_ri_index(mod_id,i); + if(flexran_get_beta_offset_ri_index(mod_id,i) != -1) { + config->has_beta_offset_ri_index = 1; + config->beta_offset_ri_index = flexran_get_beta_offset_ri_index(mod_id,i); } - if(get_beta_offset_cqi_index(mod_id,i) != -1){ - config->has_beta_offset_cqi_index = 1; - config->beta_offset_cqi_index = get_beta_offset_cqi_index(mod_id,i); + if(flexran_get_beta_offset_cqi_index(mod_id,i) != -1) { + config->has_beta_offset_cqi_index = 1; + config->beta_offset_cqi_index = flexran_get_beta_offset_cqi_index(mod_id,i); } - if(get_ack_nack_simultaneous_trans(mod_id,i) != -1){ - config->has_ack_nack_simultaneous_trans = 1; - config->ack_nack_simultaneous_trans = get_ack_nack_simultaneous_trans(mod_id,i); + if(flexran_get_ack_nack_simultaneous_trans(mod_id,i) != -1) { + config->has_ack_nack_simultaneous_trans = 1; + config->ack_nack_simultaneous_trans = flexran_get_ack_nack_simultaneous_trans(mod_id,i); } - if(get_simultaneous_ack_nack_cqi(mod_id,i) != -1){ - config->has_simultaneous_ack_nack_cqi = 1; - config->simultaneous_ack_nack_cqi = get_simultaneous_ack_nack_cqi(mod_id,i); + if(flexran_get_simultaneous_ack_nack_cqi(mod_id,i) != -1) { + config->has_simultaneous_ack_nack_cqi = 1; + config->simultaneous_ack_nack_cqi = flexran_get_simultaneous_ack_nack_cqi(mod_id,i); } - if(get_aperiodic_cqi_rep_mode(mod_id,i) != -1){ - config->has_aperiodic_cqi_rep_mode = 1; - int mode = get_aperiodic_cqi_rep_mode(mod_id,i); - if (mode > 4) { - config->aperiodic_cqi_rep_mode = PROTOCOL__FLEX_APERIODIC_CQI_REPORT_MODE__FLACRM_NONE; - } else { - config->aperiodic_cqi_rep_mode = mode; - } + if(flexran_get_aperiodic_cqi_rep_mode(mod_id,i) != -1) { + config->has_aperiodic_cqi_rep_mode = 1; + int mode = flexran_get_aperiodic_cqi_rep_mode(mod_id,i); + if (mode > 4) { + config->aperiodic_cqi_rep_mode = PROTOCOL__FLEX_APERIODIC_CQI_REPORT_MODE__FLACRM_NONE; + } else { + config->aperiodic_cqi_rep_mode = mode; + } } - if(get_tdd_ack_nack_feedback(mod_id, i) != -1){ - config->has_tdd_ack_nack_feedback = 1; - config->tdd_ack_nack_feedback = get_tdd_ack_nack_feedback(mod_id,i); + if(flexran_get_tdd_ack_nack_feedback(mod_id, i) != -1) { + config->has_tdd_ack_nack_feedback = 1; + config->tdd_ack_nack_feedback = flexran_get_tdd_ack_nack_feedback(mod_id,i); } - if(get_ack_nack_repetition_factor(mod_id, i) != -1){ - config->has_ack_nack_repetition_factor = 1; - config->ack_nack_repetition_factor = get_ack_nack_repetition_factor(mod_id,i); + if(flexran_get_ack_nack_repetition_factor(mod_id, i) != -1) { + config->has_ack_nack_repetition_factor = 1; + config->ack_nack_repetition_factor = flexran_get_ack_nack_repetition_factor(mod_id,i); } - if(get_extended_bsr_size(mod_id, i) != -1){ - config->has_extended_bsr_size = 1; - config->extended_bsr_size = get_extended_bsr_size(mod_id,i); + if(flexran_get_extended_bsr_size(mod_id, i) != -1) { + config->has_extended_bsr_size = 1; + config->extended_bsr_size = flexran_get_extended_bsr_size(mod_id,i); } config->has_pcell_carrier_index = 1; @@ -1398,15 +1388,15 @@ int enb_agent_ue_state_change(mid_t mod_id, uint32_t rnti, uint8_t state_change) config->has_ca_support = 0; config->ca_support = 0; if(config->has_ca_support){ - //TODO: Set cross carrier scheduling support (boolean) - config->has_cross_carrier_sched_support = 1; - config->cross_carrier_sched_support = 0; - //TODO: Set secondary cells configuration - // We do not set it for now. No carrier aggregation support - - //TODO: Set deactivation timer for secondary cell - config->has_scell_deactivation_timer = 0; - config->scell_deactivation_timer = 0; + //TODO: Set cross carrier scheduling support (boolean) + config->has_cross_carrier_sched_support = 1; + config->cross_carrier_sched_support = 0; + //TODO: Set secondary cells configuration + // We do not set it for now. No carrier aggregation support + + //TODO: Set deactivation timer for secondary cell + config->has_scell_deactivation_timer = 0; + config->scell_deactivation_timer = 0; } } else if (state_change == PROTOCOL__FLEX_UE_STATE_CHANGE_TYPE__FLUESC_MOVED) { // TODO: Not supported for now. Leave blank @@ -1422,22 +1412,22 @@ int enb_agent_ue_state_change(mid_t mod_id, uint32_t rnti, uint8_t state_change) msg->msg_dir = PROTOCOL__FLEXRAN_DIRECTION__INITIATING_MESSAGE; msg->ue_state_change_msg = ue_state_change_msg; - data = enb_agent_pack_message(msg, &size); + data = flexran_agent_pack_message(msg, &size); /*Send sr info using the MAC channel of the eNB*/ - if (enb_agent_msg_send(mod_id, ENB_AGENT_DEFAULT, data, size, priority)) { + if (flexran_agent_msg_send(mod_id, FLEXRAN_AGENT_DEFAULT, data, size, priority)) { err_code = PROTOCOL__FLEXRAN_ERR__MSG_ENQUEUING; goto error; } - LOG_D(ENB_AGENT,"sent message with size %d\n", size); + LOG_D(FLEXRAN_AGENT,"sent message with size %d\n", size); return; error: - LOG_D(ENB_AGENT, "Could not send UE state message\n"); + LOG_D(FLEXRAN_AGENT, "Could not send UE state message\n"); } -int enb_agent_lc_config_reply(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg) { +int flexran_agent_lc_config_reply(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg) { xid_t xid; Protocol__FlexranMessage *input = (Protocol__FlexranMessage *)params; @@ -1446,7 +1436,7 @@ int enb_agent_lc_config_reply(mid_t mod_id, const void *params, Protocol__Flexra int i, j; Protocol__FlexHeader *header; - if(flex_create_header(xid, PROTOCOL__FLEX_TYPE__FLPT_GET_LC_CONFIG_REPLY, &header) != 0) + if(flexran_create_header(xid, PROTOCOL__FLEX_TYPE__FLPT_GET_LC_CONFIG_REPLY, &header) != 0) goto error; Protocol__FlexLcConfigReply *lc_config_reply_msg; @@ -1456,7 +1446,7 @@ int enb_agent_lc_config_reply(mid_t mod_id, const void *params, Protocol__Flexra protocol__flex_lc_config_reply__init(lc_config_reply_msg); lc_config_reply_msg->header = header; - lc_config_reply_msg->n_lc_ue_config = get_num_ues(mod_id); + lc_config_reply_msg->n_lc_ue_config = flexran_get_num_ues(mod_id); Protocol__FlexLcUeConfig **lc_ue_config; if (lc_config_reply_msg->n_lc_ue_config > 0) { @@ -1470,12 +1460,12 @@ int enb_agent_lc_config_reply(mid_t mod_id, const void *params, Protocol__Flexra protocol__flex_lc_ue_config__init(lc_ue_config[i]); lc_ue_config[i]->has_rnti = 1; - lc_ue_config[i]->rnti = get_ue_crnti(mod_id,i); + lc_ue_config[i]->rnti = flexran_get_ue_crnti(mod_id,i); //TODO: Set the number of LC configurations that will be reported for this UE //Set this according to the current state of the UE. This is only a temporary fix int status = 0; - status = mac_eNB_get_rrc_status(mod_id, get_ue_crnti(mod_id, i)); + status = mac_eNB_get_rrc_status(mod_id, flexran_get_ue_crnti(mod_id, i)); if (status < RRC_CONNECTED) { lc_ue_config[i]->n_lc_config = 0; } else if (status == RRC_CONNECTED) { @@ -1497,14 +1487,14 @@ int enb_agent_lc_config_reply(mid_t mod_id, const void *params, Protocol__Flexra lc_config[j]->has_lcid = 1; lc_config[j]->lcid = j+1; - int lcg = get_lcg(i, j+1); + int lcg = flexran_get_lcg(i, j+1); if (lcg >= 0 && lcg <= 3) { lc_config[j]->has_lcg = 1; - lc_config[j]->lcg = get_lcg(i,j+1); + lc_config[j]->lcg = flexran_get_lcg(i,j+1); } lc_config[j]->has_direction = 1; - lc_config[j]->direction = get_direction(i,j+1); + lc_config[j]->direction = flexran_get_direction(i,j+1); //TODO: Bearer type. One of FLQBT_* values. Currently only default bearer supported lc_config[j]->has_qos_bearer_type = 1; lc_config[j]->qos_bearer_type = PROTOCOL__FLEX_QOS_BEARER_TYPE__FLQBT_NON_GBR; @@ -1551,7 +1541,7 @@ int enb_agent_lc_config_reply(mid_t mod_id, const void *params, Protocol__Flexra free(lc_config_reply_msg); if(*msg != NULL) free(*msg); - //LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); + //LOG_E(FLEXRAN_AGENT, "%s: an error occured\n", __FUNCTION__); return -1; } @@ -1561,7 +1551,7 @@ int enb_agent_lc_config_reply(mid_t mod_id, const void *params, Protocol__Flexra * ************************************ */ -int enb_agent_ue_config_reply(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg) { +int flexran_agent_ue_config_reply(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg) { xid_t xid; Protocol__FlexranMessage *input = (Protocol__FlexranMessage *)params; @@ -1571,7 +1561,7 @@ int enb_agent_ue_config_reply(mid_t mod_id, const void *params, Protocol__Flexra int i; Protocol__FlexHeader *header; - if(flex_create_header(xid, PROTOCOL__FLEX_TYPE__FLPT_GET_UE_CONFIG_REPLY, &header) != 0) + if(flexran_create_header(xid, PROTOCOL__FLEX_TYPE__FLPT_GET_UE_CONFIG_REPLY, &header) != 0) goto error; Protocol__FlexUeConfigReply *ue_config_reply_msg; @@ -1581,7 +1571,7 @@ int enb_agent_ue_config_reply(mid_t mod_id, const void *params, Protocol__Flexra protocol__flex_ue_config_reply__init(ue_config_reply_msg); ue_config_reply_msg->header = header; - ue_config_reply_msg->n_ue_config = get_num_ues(mod_id); + ue_config_reply_msg->n_ue_config = flexran_get_num_ues(mod_id); Protocol__FlexUeConfig **ue_config; if (ue_config_reply_msg->n_ue_config > 0) { @@ -1593,24 +1583,24 @@ int enb_agent_ue_config_reply(mid_t mod_id, const void *params, Protocol__Flexra ue_config[i] = malloc(sizeof(Protocol__FlexUeConfig)); protocol__flex_ue_config__init(ue_config[i]); - ue_config[i]->rnti = get_ue_crnti(mod_id,i); + ue_config[i]->rnti = flexran_get_ue_crnti(mod_id,i); ue_config[i]->has_rnti = 1; //TODO: Set the DRX configuration (optional) //Not supported for now, so we do not set it - if(get_time_alignment_timer(mod_id,i) != -1){ - ue_config[i]->time_alignment_timer = get_time_alignment_timer(mod_id,i); + if (flexran_get_time_alignment_timer(mod_id,i) != -1) { + ue_config[i]->time_alignment_timer = flexran_get_time_alignment_timer(mod_id,i); ue_config[i]->has_time_alignment_timer = 1; - } + } - if(get_meas_gap_config(mod_id,i) != -1){ - ue_config[i]->meas_gap_config_pattern = get_meas_gap_config(mod_id,i); + if (flexran_get_meas_gap_config(mod_id,i) != -1) { + ue_config[i]->meas_gap_config_pattern = flexran_get_meas_gap_config(mod_id,i); ue_config[i]->has_meas_gap_config_pattern = 1; - } + } - if(ue_config[i]->has_meas_gap_config_pattern == 1 && + if (ue_config[i]->has_meas_gap_config_pattern == 1 && ue_config[i]->meas_gap_config_pattern != PROTOCOL__FLEX_MEAS_GAP_CONFIG_PATTERN__FLMGCP_OFF) { - ue_config[i]->meas_gap_config_sf_offset = get_meas_gap_config_offset(mod_id,i); + ue_config[i]->meas_gap_config_sf_offset = flexran_get_meas_gap_config_offset(mod_id,i); ue_config[i]->has_meas_gap_config_sf_offset = 1; } //TODO: Set the SPS configuration (Optional) @@ -1622,15 +1612,15 @@ int enb_agent_ue_config_reply(mid_t mod_id, const void *params, Protocol__Flexra //TODO: Set the CQI configuration (Optional) //We do not set it for now - if(get_ue_transmission_mode(mod_id,i) != -1){ - ue_config[i]->transmission_mode = get_ue_transmission_mode(mod_id,i); - ue_config[i]->has_transmission_mode = 1; - } + if (flexran_get_ue_transmission_mode(mod_id,i) != -1) { + ue_config[i]->transmission_mode = flexran_get_ue_transmission_mode(mod_id,i); + ue_config[i]->has_transmission_mode = 1; + } - ue_config[i]->ue_aggregated_max_bitrate_ul = get_ue_aggregated_max_bitrate_ul(mod_id,i); + ue_config[i]->ue_aggregated_max_bitrate_ul = flexran_get_ue_aggregated_max_bitrate_ul(mod_id,i); ue_config[i]->has_ue_aggregated_max_bitrate_ul = 1; - ue_config[i]->ue_aggregated_max_bitrate_dl = get_ue_aggregated_max_bitrate_dl(mod_id,i); + ue_config[i]->ue_aggregated_max_bitrate_dl = flexran_get_ue_aggregated_max_bitrate_dl(mod_id,i); ue_config[i]->has_ue_aggregated_max_bitrate_dl = 1; Protocol__FlexUeCapabilities *capabilities; @@ -1638,85 +1628,85 @@ int enb_agent_ue_config_reply(mid_t mod_id, const void *params, Protocol__Flexra protocol__flex_ue_capabilities__init(capabilities); //TODO: Set half duplex (FDD operation) capabilities->has_half_duplex = 0; - capabilities->half_duplex = 0;//get_half_duplex(i); + capabilities->half_duplex = 0;//flexran_get_half_duplex(i); //TODO: Set intra-frame hopping flag capabilities->has_intra_sf_hopping = 0; - capabilities->intra_sf_hopping = 1;//get_intra_sf_hopping(i); + capabilities->intra_sf_hopping = 1;//flexran_get_intra_sf_hopping(i); //TODO: Set support for type 2 hopping with n_sb > 1 capabilities->has_type2_sb_1 = 0; - capabilities->type2_sb_1 = 1;//get_type2_sb_1(i); + capabilities->type2_sb_1 = 1;//flexran_get_type2_sb_1(i); //TODO: Set ue category capabilities->has_ue_category = 0; - capabilities->ue_category = 1;//get_ue_category(i); + capabilities->ue_category = 1;//flexran_get_ue_category(i); //TODO: Set UE support for resource allocation type 1 capabilities->has_res_alloc_type1 = 0; - capabilities->res_alloc_type1 = 1;//get_res_alloc_type1(i); + capabilities->res_alloc_type1 = 1;//flexran_get_res_alloc_type1(i); //Set the capabilites to the message ue_config[i]->capabilities = capabilities; - if(get_ue_transmission_antenna(mod_id,i) != -1){ - ue_config[i]->has_ue_transmission_antenna = 1; - ue_config[i]->ue_transmission_antenna = get_ue_transmission_antenna(mod_id,i); - } + if (flexran_get_ue_transmission_antenna(mod_id,i) != -1) { + ue_config[i]->has_ue_transmission_antenna = 1; + ue_config[i]->ue_transmission_antenna = flexran_get_ue_transmission_antenna(mod_id,i); + } - if(get_tti_bundling(mod_id,i) != -1){ - ue_config[i]->has_tti_bundling = 1; - ue_config[i]->tti_bundling = get_tti_bundling(mod_id,i); - } + if (flexran_get_tti_bundling(mod_id,i) != -1) { + ue_config[i]->has_tti_bundling = 1; + ue_config[i]->tti_bundling = flexran_get_tti_bundling(mod_id,i); + } - if(get_maxHARQ_TX(mod_id,i) != -1){ - ue_config[i]->has_max_harq_tx = 1; - ue_config[i]->max_harq_tx = get_maxHARQ_TX(mod_id,i); - } + if (flexran_get_maxHARQ_TX(mod_id,i) != -1) { + ue_config[i]->has_max_harq_tx = 1; + ue_config[i]->max_harq_tx = flexran_get_maxHARQ_TX(mod_id,i); + } - if(get_beta_offset_ack_index(mod_id,i) != -1){ - ue_config[i]->has_beta_offset_ack_index = 1; - ue_config[i]->beta_offset_ack_index = get_beta_offset_ack_index(mod_id,i); - } + if (flexran_get_beta_offset_ack_index(mod_id,i) != -1) { + ue_config[i]->has_beta_offset_ack_index = 1; + ue_config[i]->beta_offset_ack_index = flexran_get_beta_offset_ack_index(mod_id,i); + } - if(get_beta_offset_ri_index(mod_id,i) != -1){ - ue_config[i]->has_beta_offset_ri_index = 1; - ue_config[i]->beta_offset_ri_index = get_beta_offset_ri_index(mod_id,i); - } + if (flexran_get_beta_offset_ri_index(mod_id,i) != -1) { + ue_config[i]->has_beta_offset_ri_index = 1; + ue_config[i]->beta_offset_ri_index = flexran_get_beta_offset_ri_index(mod_id,i); + } - if(get_beta_offset_cqi_index(mod_id,i) != -1){ - ue_config[i]->has_beta_offset_cqi_index = 1; - ue_config[i]->beta_offset_cqi_index = get_beta_offset_cqi_index(mod_id,i); + if (flexran_get_beta_offset_cqi_index(mod_id,i) != -1) { + ue_config[i]->has_beta_offset_cqi_index = 1; + ue_config[i]->beta_offset_cqi_index = flexran_get_beta_offset_cqi_index(mod_id,i); } - if(get_ack_nack_simultaneous_trans(mod_id,i) != -1){ - ue_config[i]->has_ack_nack_simultaneous_trans = 1; - ue_config[i]->ack_nack_simultaneous_trans = get_ack_nack_simultaneous_trans(mod_id,i); - } - - if(get_simultaneous_ack_nack_cqi(mod_id,i) != -1){ - ue_config[i]->has_simultaneous_ack_nack_cqi = 1; - ue_config[i]->simultaneous_ack_nack_cqi = get_simultaneous_ack_nack_cqi(mod_id,i); - } - - if(get_aperiodic_cqi_rep_mode(mod_id,i) != -1){ - ue_config[i]->has_aperiodic_cqi_rep_mode = 1; - int mode = get_aperiodic_cqi_rep_mode(mod_id,i); - if (mode > 4) { - ue_config[i]->aperiodic_cqi_rep_mode = PROTOCOL__FLEX_APERIODIC_CQI_REPORT_MODE__FLACRM_NONE; - } else { - ue_config[i]->aperiodic_cqi_rep_mode = mode; - } + if (flexran_get_ack_nack_simultaneous_trans(mod_id,i) != -1) { + ue_config[i]->has_ack_nack_simultaneous_trans = 1; + ue_config[i]->ack_nack_simultaneous_trans = flexran_get_ack_nack_simultaneous_trans(mod_id,i); } - if(get_tdd_ack_nack_feedback(mod_id, i) != -1){ + if (flexran_get_simultaneous_ack_nack_cqi(mod_id,i) != -1) { + ue_config[i]->has_simultaneous_ack_nack_cqi = 1; + ue_config[i]->simultaneous_ack_nack_cqi = flexran_get_simultaneous_ack_nack_cqi(mod_id,i); + } + + if (flexran_get_aperiodic_cqi_rep_mode(mod_id,i) != -1) { + ue_config[i]->has_aperiodic_cqi_rep_mode = 1; + int mode = flexran_get_aperiodic_cqi_rep_mode(mod_id,i); + if (mode > 4) { + ue_config[i]->aperiodic_cqi_rep_mode = PROTOCOL__FLEX_APERIODIC_CQI_REPORT_MODE__FLACRM_NONE; + } else { + ue_config[i]->aperiodic_cqi_rep_mode = mode; + } + } + + if (flexran_get_tdd_ack_nack_feedback(mod_id, i) != -1) { ue_config[i]->has_tdd_ack_nack_feedback = 1; - ue_config[i]->tdd_ack_nack_feedback = get_tdd_ack_nack_feedback(mod_id,i); + ue_config[i]->tdd_ack_nack_feedback = flexran_get_tdd_ack_nack_feedback(mod_id,i); } - if(get_ack_nack_repetition_factor(mod_id, i) != -1){ + if(flexran_get_ack_nack_repetition_factor(mod_id, i) != -1) { ue_config[i]->has_ack_nack_repetition_factor = 1; - ue_config[i]->ack_nack_repetition_factor = get_ack_nack_repetition_factor(mod_id,i); + ue_config[i]->ack_nack_repetition_factor = flexran_get_ack_nack_repetition_factor(mod_id,i); } - if(get_extended_bsr_size(mod_id, i) != -1){ + if (flexran_get_extended_bsr_size(mod_id, i) != -1) { ue_config[i]->has_extended_bsr_size = 1; - ue_config[i]->extended_bsr_size = get_extended_bsr_size(mod_id,i); + ue_config[i]->extended_bsr_size = flexran_get_extended_bsr_size(mod_id,i); } //TODO: Set carrier aggregation support (boolean) ue_config[i]->has_ca_support = 0; @@ -1754,7 +1744,7 @@ int enb_agent_ue_config_reply(mid_t mod_id, const void *params, Protocol__Flexra free(ue_config_reply_msg); if(*msg != NULL) free(*msg); - //LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); + //LOG_E(FLEXRAN_AGENT, "%s: an error occured\n", __FUNCTION__); return -1; } @@ -1765,25 +1755,25 @@ int enb_agent_ue_config_reply(mid_t mod_id, const void *params, Protocol__Flexra * ************************************ */ -int enb_agent_enb_config_request(mid_t mod_id, const void* params, Protocol__FlexranMessage **msg) { +int flexran_agent_enb_config_request(mid_t mod_id, const void* params, Protocol__FlexranMessage **msg) { Protocol__FlexHeader *header; xid_t xid = 1; - if(flex_create_header(xid,PROTOCOL__FLEX_TYPE__FLPT_GET_ENB_CONFIG_REQUEST, &header) != 0) - goto error; + if(flexran_create_header(xid,PROTOCOL__FLEX_TYPE__FLPT_GET_ENB_CONFIG_REQUEST, &header) != 0) + goto error; Protocol__FlexEnbConfigRequest *enb_config_request_msg; enb_config_request_msg = malloc(sizeof(Protocol__FlexEnbConfigRequest)); if(enb_config_request_msg == NULL) - goto error; + goto error; protocol__flex_enb_config_request__init(enb_config_request_msg); enb_config_request_msg->header = header; *msg = malloc(sizeof(Protocol__FlexranMessage)); if(*msg == NULL) - goto error; + goto error; protocol__flexran_message__init(*msg); (*msg)->msg_case = PROTOCOL__FLEXRAN_MESSAGE__MSG_ENB_CONFIG_REQUEST_MSG; @@ -1803,7 +1793,7 @@ int enb_agent_enb_config_request(mid_t mod_id, const void* params, Protocol__Fle return -1; } -int enb_agent_enb_config_reply(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg) { +int flexran_agent_enb_config_reply(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg) { xid_t xid; Protocol__FlexranMessage *input = (Protocol__FlexranMessage *)params; @@ -1815,10 +1805,10 @@ int enb_agent_enb_config_reply(mid_t mod_id, const void *params, Protocol__Flexr int enb_id = mod_id; Protocol__FlexHeader *header; - if(flex_create_header(xid, PROTOCOL__FLEX_TYPE__FLPT_GET_ENB_CONFIG_REPLY, &header) != 0) + if(flexran_create_header(xid, PROTOCOL__FLEX_TYPE__FLPT_GET_ENB_CONFIG_REPLY, &header) != 0) goto error; - Protocol__FlexEnbConfigReply *enb_config_reply_msg; + Protocol__FlexEnbConfigReply *enb_config_reply_msg; enb_config_reply_msg = malloc(sizeof(Protocol__FlexEnbConfigReply)); if(enb_config_reply_msg == NULL) goto error; @@ -1840,43 +1830,43 @@ int enb_agent_enb_config_reply(mid_t mod_id, const void *params, Protocol__Flexr protocol__flex_cell_config__init(cell_conf[i]); cell_conf[i]->phy_cell_id = 1; - cell_conf[i]->has_phy_cell_id = get_cell_id(enb_id,i); + cell_conf[i]->has_phy_cell_id = flexran_get_cell_id(enb_id,i); cell_conf[i]->cell_id = i; cell_conf[i]->has_cell_id = 1; - cell_conf[i]->pusch_hopping_offset = get_hopping_offset(enb_id,i); + cell_conf[i]->pusch_hopping_offset = flexran_get_hopping_offset(enb_id,i); cell_conf[i]->has_pusch_hopping_offset = 1; - if(get_hopping_mode(enb_id,i) == 0){ - cell_conf[i]->hopping_mode = PROTOCOL__FLEX_HOPPING_MODE__FLHM_INTER; - }else if(get_hopping_mode(enb_id,i) == 1){ + if (flexran_get_hopping_mode(enb_id,i) == 0) { + cell_conf[i]->hopping_mode = PROTOCOL__FLEX_HOPPING_MODE__FLHM_INTER; + } else if(flexran_get_hopping_mode(enb_id,i) == 1) { cell_conf[i]->hopping_mode = PROTOCOL__FLEX_HOPPING_MODE__FLHM_INTERINTRA; } cell_conf[i]->has_hopping_mode = 1; - cell_conf[i]->n_sb = get_n_SB(enb_id,i); + cell_conf[i]->n_sb = flexran_get_n_SB(enb_id,i); cell_conf[i]->has_n_sb = 1; - if(get_phich_resource(enb_id,i) == 0){ + if (flexran_get_phich_resource(enb_id,i) == 0) { cell_conf[i]->phich_resource = PROTOCOL__FLEX_PHICH_RESOURCE__FLPR_ONE_SIXTH; //0 - }else if (get_phich_resource(enb_id,i) == 1){ + } else if (flexran_get_phich_resource(enb_id,i) == 1) { cell_conf[i]->phich_resource = PROTOCOL__FLEX_PHICH_RESOURCE__FLPR_HALF; //1 - }else if (get_phich_resource(enb_id,i) == 2){ + } else if (flexran_get_phich_resource(enb_id,i) == 2) { cell_conf[i]->phich_resource = PROTOCOL__FLEX_PHICH_RESOURCE__FLPR_ONE; // 2 - }else if (get_phich_resource(enb_id,i) == 3){ + } else if (flexran_get_phich_resource(enb_id,i) == 3) { cell_conf[i]->phich_resource = PROTOCOL__FLEX_PHICH_RESOURCE__FLPR_TWO;//3 } cell_conf[i]->has_phich_resource = 1; - if(get_phich_duration(enb_id,i) == 0){ + if (flexran_get_phich_duration(enb_id,i) == 0) { cell_conf[i]->phich_duration = PROTOCOL__FLEX_PHICH_DURATION__FLPD_NORMAL; - }else if(get_phich_duration(enb_id,i) == 1){ + } else if(flexran_get_phich_duration(enb_id,i) == 1) { cell_conf[i]->phich_duration = PROTOCOL__FLEX_PHICH_DURATION__FLPD_EXTENDED; } cell_conf[i]->has_phich_duration = 1; //TODO: Fill in with actual value, See TS 36.211, section 6.9 - cell_conf[i]->init_nr_pdcch_ofdm_sym = get_num_pdcch_symb(enb_id,i); + cell_conf[i]->init_nr_pdcch_ofdm_sym = flexran_get_num_pdcch_symb(enb_id,i); cell_conf[i]->has_init_nr_pdcch_ofdm_sym = 0; //TODO: Fill in with actual value /* Protocol__FlexSiConfig *si_config; */ @@ -1916,23 +1906,23 @@ int enb_agent_enb_config_reply(mid_t mod_id, const void *params, Protocol__Flexr /* } */ /* cell_conf[i]->si_config = si_config; */ - cell_conf[i]->dl_bandwidth = get_N_RB_DL(enb_id,i); + cell_conf[i]->dl_bandwidth = flexran_get_N_RB_DL(enb_id,i); cell_conf[i]->has_dl_bandwidth = 1; - cell_conf[i]->ul_bandwidth = get_N_RB_UL(enb_id,i); + cell_conf[i]->ul_bandwidth = flexran_get_N_RB_UL(enb_id,i); cell_conf[i]->has_ul_bandwidth = 1; - if(get_ul_cyclic_prefix_length(enb_id,i) == 0){ - cell_conf[i]->ul_cyclic_prefix_length = PROTOCOL__FLEX_UL_CYCLIC_PREFIX_LENGTH__FLUCPL_NORMAL; - }else if(get_ul_cyclic_prefix_length(enb_id,i) == 1){ + if (flexran_get_ul_cyclic_prefix_length(enb_id, i) == 0) { + cell_conf[i]->ul_cyclic_prefix_length = PROTOCOL__FLEX_UL_CYCLIC_PREFIX_LENGTH__FLUCPL_NORMAL; + } else if(flexran_get_ul_cyclic_prefix_length(enb_id, i) == 1) { cell_conf[i]->ul_cyclic_prefix_length = PROTOCOL__FLEX_UL_CYCLIC_PREFIX_LENGTH__FLUCPL_EXTENDED; } cell_conf[i]->has_ul_cyclic_prefix_length = 1; - if(get_ul_cyclic_prefix_length(enb_id,i) == 0){ - cell_conf[i]->ul_cyclic_prefix_length = PROTOCOL__FLEX_DL_CYCLIC_PREFIX_LENGTH__FLDCPL_NORMAL; - }else if(get_ul_cyclic_prefix_length(enb_id,i) == 1){ - cell_conf[i]->ul_cyclic_prefix_length = PROTOCOL__FLEX_DL_CYCLIC_PREFIX_LENGTH__FLDCPL_EXTENDED; + if (flexran_get_ul_cyclic_prefix_length(enb_id,i) == 0) { + cell_conf[i]->ul_cyclic_prefix_length = PROTOCOL__FLEX_DL_CYCLIC_PREFIX_LENGTH__FLDCPL_NORMAL; + } else if (flexran_get_ul_cyclic_prefix_length(enb_id,i) == 1) { + cell_conf[i]->ul_cyclic_prefix_length = PROTOCOL__FLEX_DL_CYCLIC_PREFIX_LENGTH__FLDCPL_EXTENDED; } cell_conf[i]->has_dl_cyclic_prefix_length = 1; @@ -1940,20 +1930,20 @@ int enb_agent_enb_config_reply(mid_t mod_id, const void *params, Protocol__Flexr cell_conf[i]->antenna_ports_count = 1; cell_conf[i]->has_antenna_ports_count = 1; - if(get_duplex_mode(enb_id,i) == 1){ + if (flexran_get_duplex_mode(enb_id,i) == 1) { cell_conf[i]->duplex_mode = PROTOCOL__FLEX_DUPLEX_MODE__FLDM_FDD; - }else if(get_duplex_mode(enb_id,i) == 0){ + } else if(flexran_get_duplex_mode(enb_id,i) == 0) { cell_conf[i]->duplex_mode = PROTOCOL__FLEX_DUPLEX_MODE__FLDM_TDD; } cell_conf[i]->has_duplex_mode = 1; //TODO: Fill in with actual value, DL/UL subframe assignment. TDD only - cell_conf[i]->subframe_assignment = get_subframe_assignment(enb_id,i); + cell_conf[i]->subframe_assignment = flexran_get_subframe_assignment(enb_id, i); cell_conf[i]->has_subframe_assignment = 0; //TODO: Fill in with actual value, TDD only. See TS 36.211, table 4.2.1 - cell_conf[i]->special_subframe_patterns = get_special_subframe_assignment(enb_id,i); + cell_conf[i]->special_subframe_patterns = flexran_get_special_subframe_assignment(enb_id,i); cell_conf[i]->has_special_subframe_patterns = 0; //TODO: Fill in with actual value, The MBSFN radio frame period - cell_conf[i]->n_mbsfn_subframe_config_rfperiod = 5; + cell_conf[i]->n_mbsfn_subframe_config_rfperiod = 0; uint32_t *elem_rfperiod; elem_rfperiod = (uint32_t *) malloc(sizeof(uint32_t) *cell_conf[i]->n_mbsfn_subframe_config_rfperiod); if(elem_rfperiod == NULL) @@ -1964,7 +1954,7 @@ int enb_agent_enb_config_reply(mid_t mod_id, const void *params, Protocol__Flexr cell_conf[i]->mbsfn_subframe_config_rfperiod = elem_rfperiod; //TODO: Fill in with actual value, The MBSFN radio frame offset - cell_conf[i]->n_mbsfn_subframe_config_rfoffset = 5; + cell_conf[i]->n_mbsfn_subframe_config_rfoffset = 0; uint32_t *elem_rfoffset; elem_rfoffset = (uint32_t *) malloc(sizeof(uint32_t) *cell_conf[i]->n_mbsfn_subframe_config_rfoffset); if(elem_rfoffset == NULL) @@ -1975,7 +1965,7 @@ int enb_agent_enb_config_reply(mid_t mod_id, const void *params, Protocol__Flexr cell_conf[i]->mbsfn_subframe_config_rfoffset = elem_rfoffset; //TODO: Fill in with actual value, Bitmap indicating the MBSFN subframes - cell_conf[i]->n_mbsfn_subframe_config_sfalloc = 5; + cell_conf[i]->n_mbsfn_subframe_config_sfalloc = 0; uint32_t *elem_sfalloc; elem_sfalloc = (uint32_t *) malloc(sizeof(uint32_t) *cell_conf[i]->n_mbsfn_subframe_config_sfalloc); if(elem_sfalloc == NULL) @@ -1985,46 +1975,46 @@ int enb_agent_enb_config_reply(mid_t mod_id, const void *params, Protocol__Flexr } cell_conf[i]->mbsfn_subframe_config_sfalloc = elem_sfalloc; - cell_conf[i]->prach_config_index = get_prach_ConfigIndex(enb_id,i); + cell_conf[i]->prach_config_index = flexran_get_prach_ConfigIndex(enb_id,i); cell_conf[i]->has_prach_config_index = 1; - cell_conf[i]->prach_freq_offset = get_prach_FreqOffset(enb_id,i); + cell_conf[i]->prach_freq_offset = flexran_get_prach_FreqOffset(enb_id,i); cell_conf[i]->has_prach_freq_offset = 1; - cell_conf[i]->ra_response_window_size = get_ra_ResponseWindowSize(enb_id,i); + cell_conf[i]->ra_response_window_size = flexran_get_ra_ResponseWindowSize(enb_id,i); cell_conf[i]->has_ra_response_window_size = 1; - cell_conf[i]->mac_contention_resolution_timer = get_mac_ContentionResolutionTimer(enb_id,i); + cell_conf[i]->mac_contention_resolution_timer = flexran_get_mac_ContentionResolutionTimer(enb_id,i); cell_conf[i]->has_mac_contention_resolution_timer = 1; - cell_conf[i]->max_harq_msg3tx = get_maxHARQ_Msg3Tx(enb_id,i); + cell_conf[i]->max_harq_msg3tx = flexran_get_maxHARQ_Msg3Tx(enb_id,i); cell_conf[i]->has_max_harq_msg3tx = 1; - cell_conf[i]->n1pucch_an = get_n1pucch_an(enb_id,i); + cell_conf[i]->n1pucch_an = flexran_get_n1pucch_an(enb_id,i); cell_conf[i]->has_n1pucch_an = 1; - cell_conf[i]->deltapucch_shift = get_deltaPUCCH_Shift(enb_id,i); + cell_conf[i]->deltapucch_shift = flexran_get_deltaPUCCH_Shift(enb_id,i); cell_conf[i]->has_deltapucch_shift = 1; - cell_conf[i]->nrb_cqi = get_nRB_CQI(enb_id,i); + cell_conf[i]->nrb_cqi = flexran_get_nRB_CQI(enb_id,i); cell_conf[i]->has_nrb_cqi = 1; - cell_conf[i]->srs_subframe_config = get_srs_SubframeConfig(enb_id,i); + cell_conf[i]->srs_subframe_config = flexran_get_srs_SubframeConfig(enb_id,i); cell_conf[i]->has_srs_subframe_config = 1; - cell_conf[i]->srs_bw_config = get_srs_BandwidthConfig(enb_id,i); + cell_conf[i]->srs_bw_config = flexran_get_srs_BandwidthConfig(enb_id,i); cell_conf[i]->has_srs_bw_config = 1; - cell_conf[i]->srs_mac_up_pts = get_srs_MaxUpPts(enb_id,i); + cell_conf[i]->srs_mac_up_pts = flexran_get_srs_MaxUpPts(enb_id,i); cell_conf[i]->has_srs_mac_up_pts = 1; - if(get_enable64QAM(enb_id,i) == 0){ + if (flexran_get_enable64QAM(enb_id,i) == 0) { cell_conf[i]->enable_64qam = PROTOCOL__FLEX_QAM__FLEQ_MOD_16QAM; - }else if(get_enable64QAM(enb_id,i) == 1){ + } else if(flexran_get_enable64QAM(enb_id,i) == 1) { cell_conf[i]->enable_64qam = PROTOCOL__FLEX_QAM__FLEQ_MOD_64QAM; } cell_conf[i]->has_enable_64qam = 1; - + cell_conf[i]->carrier_index = i; cell_conf[i]->has_carrier_index = 1; } @@ -2048,7 +2038,7 @@ int enb_agent_enb_config_reply(mid_t mod_id, const void *params, Protocol__Flexr free(enb_config_reply_msg); if(*msg != NULL) free(*msg); - //LOG_E(MAC, "%s: an error occured\n", __FUNCTION__); + //LOG_E(FLEXRAN_AGENT, "%s: an error occured\n", __FUNCTION__); return -1; } @@ -2058,24 +2048,24 @@ int enb_agent_enb_config_reply(mid_t mod_id, const void *params, Protocol__Flexr * timer primitives */ -//struct enb_agent_map agent_map; -enb_agent_timer_instance_t timer_instance; +//struct flexran_agent_map agent_map; +flexran_agent_timer_instance_t timer_instance; int agent_timer_init = 0; -err_code_t enb_agent_init_timer(void){ +err_code_t flexran_agent_init_timer(void){ - LOG_I(ENB_AGENT, "init RB tree\n"); + LOG_I(FLEXRAN_AGENT, "init RB tree\n"); if (!agent_timer_init) { - RB_INIT(&timer_instance.enb_agent_head); + RB_INIT(&timer_instance.flexran_agent_head); agent_timer_init = 1; } return PROTOCOL__FLEXRAN_ERR__NO_ERR; } -RB_GENERATE(enb_agent_map,enb_agent_timer_element_s, entry, enb_agent_compare_timer); +RB_GENERATE(flexran_agent_map, flexran_agent_timer_element_s, entry, flexran_agent_compare_timer); /* The timer_id might not be the best choice for the comparison */ -int enb_agent_compare_timer(struct enb_agent_timer_element_s *a, struct enb_agent_timer_element_s *b){ +int flexran_agent_compare_timer(struct flexran_agent_timer_element_s *a, struct flexran_agent_timer_element_s *b){ if (a->timer_id < b->timer_id) return -1; if (a->timer_id > b->timer_id) return 1; @@ -2084,17 +2074,17 @@ int enb_agent_compare_timer(struct enb_agent_timer_element_s *a, struct enb_agen return 0; } -err_code_t enb_agent_create_timer(uint32_t interval_sec, - uint32_t interval_usec, - agent_id_t agent_id, - instance_t instance, - uint32_t timer_type, - xid_t xid, - enb_agent_timer_callback_t cb, - void* timer_args, - long *timer_id){ +err_code_t flexran_agent_create_timer(uint32_t interval_sec, + uint32_t interval_usec, + agent_id_t agent_id, + instance_t instance, + uint32_t timer_type, + xid_t xid, + flexran_agent_timer_callback_t cb, + void* timer_args, + long *timer_id){ - struct enb_agent_timer_element_s *e = calloc(1, sizeof(*e)); + struct flexran_agent_timer_element_s *e = calloc(1, sizeof(*e)); DevAssert(e != NULL); //uint32_t timer_id; @@ -2103,13 +2093,13 @@ err_code_t enb_agent_create_timer(uint32_t interval_sec, if ((interval_sec == 0) && (interval_usec == 0 )) return TIMER_NULL; - if (timer_type >= ENB_AGENT_TIMER_TYPE_MAX) + if (timer_type >= FLEXRAN_AGENT_TIMER_TYPE_MAX) return TIMER_TYPE_INVALIDE; - if (timer_type == ENB_AGENT_TIMER_TYPE_ONESHOT){ + if (timer_type == FLEXRAN_AGENT_TIMER_TYPE_ONESHOT){ ret = timer_setup(interval_sec, interval_usec, - TASK_ENB_AGENT, + TASK_FLEXRAN_AGENT, instance, TIMER_ONE_SHOT, timer_args, @@ -2117,10 +2107,10 @@ err_code_t enb_agent_create_timer(uint32_t interval_sec, e->type = TIMER_ONE_SHOT; } - else if (timer_type == ENB_AGENT_TIMER_TYPE_PERIODIC ){ + else if (timer_type == FLEXRAN_AGENT_TIMER_TYPE_PERIODIC ){ ret = timer_setup(interval_sec, interval_usec, - TASK_ENB_AGENT, + TASK_FLEXRAN_AGENT, instance, TIMER_PERIODIC, timer_args, @@ -2135,27 +2125,27 @@ err_code_t enb_agent_create_timer(uint32_t interval_sec, e->agent_id = agent_id; e->instance = instance; - e->state = ENB_AGENT_TIMER_STATE_ACTIVE; + e->state = FLEXRAN_AGENT_TIMER_STATE_ACTIVE; e->timer_id = *timer_id; e->xid = xid; e->timer_args = timer_args; e->cb = cb; /*element should be a real pointer*/ - RB_INSERT(enb_agent_map, &timer_instance.enb_agent_head, e); + RB_INSERT(flexran_agent_map, &timer_instance.flexran_agent_head, e); - LOG_I(ENB_AGENT,"Created a new timer with id 0x%lx for agent %d, instance %d \n", + LOG_I(FLEXRAN_AGENT,"Created a new timer with id 0x%lx for agent %d, instance %d \n", e->timer_id, e->agent_id, e->instance); - + return 0; } -err_code_t enb_agent_destroy_timer(long timer_id){ +err_code_t flexran_agent_destroy_timer(long timer_id){ - struct enb_agent_timer_element_s *e = get_timer_entry(timer_id); + struct flexran_agent_timer_element_s *e = get_timer_entry(timer_id); if (e != NULL ) { - RB_REMOVE(enb_agent_map, &timer_instance.enb_agent_head, e); - enb_agent_destroy_flexran_message(e->timer_args->msg); + RB_REMOVE(flexran_agent_map, &timer_instance.flexran_agent_head, e); + flexran_agent_destroy_flexran_message(e->timer_args->msg); free(e); } @@ -2165,18 +2155,18 @@ err_code_t enb_agent_destroy_timer(long timer_id){ return 0; error: - LOG_E(ENB_AGENT, "timer can't be removed\n"); + LOG_E(FLEXRAN_AGENT, "timer can't be removed\n"); return TIMER_REMOVED_FAILED ; } -err_code_t enb_agent_destroy_timer_by_task_id(xid_t xid) { - struct enb_agent_timer_element_s *e = NULL; +err_code_t flexran_agent_destroy_timer_by_task_id(xid_t xid) { + struct flexran_agent_timer_element_s *e = NULL; long timer_id; - RB_FOREACH(e, enb_agent_map, &timer_instance.enb_agent_head) { + RB_FOREACH(e, flexran_agent_map, &timer_instance.flexran_agent_head) { if (e->xid == xid) { timer_id = e->timer_id; - RB_REMOVE(enb_agent_map, &timer_instance.enb_agent_head, e); - enb_agent_destroy_flexran_message(e->timer_args->msg); + RB_REMOVE(flexran_agent_map, &timer_instance.flexran_agent_head, e); + flexran_agent_destroy_flexran_message(e->timer_args->msg); free(e); if (timer_remove(timer_id) < 0 ) { goto error; @@ -2186,18 +2176,18 @@ err_code_t enb_agent_destroy_timer_by_task_id(xid_t xid) { return 0; error: - LOG_E(ENB_AGENT, "timer can't be removed\n"); + LOG_E(FLEXRAN_AGENT, "timer can't be removed\n"); return TIMER_REMOVED_FAILED ; } -err_code_t enb_agent_destroy_timers(void){ +err_code_t flexran_agent_destroy_timers(void){ - struct enb_agent_timer_element_s *e = NULL; + struct flexran_agent_timer_element_s *e = NULL; - RB_FOREACH(e, enb_agent_map, &timer_instance.enb_agent_head) { - RB_REMOVE(enb_agent_map, &timer_instance.enb_agent_head, e); + RB_FOREACH(e, flexran_agent_map, &timer_instance.flexran_agent_head) { + RB_REMOVE(flexran_agent_map, &timer_instance.flexran_agent_head, e); timer_remove(e->timer_id); - enb_agent_destroy_flexran_message(e->timer_args->msg); + flexran_agent_destroy_flexran_message(e->timer_args->msg); free(e); } @@ -2205,7 +2195,7 @@ err_code_t enb_agent_destroy_timers(void){ } -void enb_agent_sleep_until(struct timespec *ts, int delay) { +void flexran_agent_sleep_until(struct timespec *ts, int delay) { ts->tv_nsec += delay; if(ts->tv_nsec >= 1000*1000*1000){ ts->tv_nsec -= 1000*1000*1000; @@ -2215,17 +2205,17 @@ void enb_agent_sleep_until(struct timespec *ts, int delay) { } -err_code_t enb_agent_stop_timer(long timer_id){ +err_code_t flexran_agent_stop_timer(long timer_id){ - struct enb_agent_timer_element_s *e=NULL; - struct enb_agent_timer_element_s search; - memset(&search, 0, sizeof(struct enb_agent_timer_element_s)); + struct flexran_agent_timer_element_s *e=NULL; + struct flexran_agent_timer_element_s search; + memset(&search, 0, sizeof(struct flexran_agent_timer_element_s)); search.timer_id = timer_id; - e = RB_FIND(enb_agent_map, &timer_instance.enb_agent_head, &search); + e = RB_FIND(flexran_agent_map, &timer_instance.flexran_agent_head, &search); if (e != NULL ) { - e->state = ENB_AGENT_TIMER_STATE_STOPPED; + e->state = FLEXRAN_AGENT_TIMER_STATE_STOPPED; } timer_remove(timer_id); @@ -2233,11 +2223,11 @@ err_code_t enb_agent_stop_timer(long timer_id){ return 0; } -struct enb_agent_timer_element_s * get_timer_entry(long timer_id) { +struct flexran_agent_timer_element_s * get_timer_entry(long timer_id) { - struct enb_agent_timer_element_s search; - memset(&search, 0, sizeof(struct enb_agent_timer_element_s)); + struct flexran_agent_timer_element_s search; + memset(&search, 0, sizeof(struct flexran_agent_timer_element_s)); search.timer_id = timer_id; - return RB_FIND(enb_agent_map, &timer_instance.enb_agent_head, &search); + return RB_FIND(flexran_agent_map, &timer_instance.flexran_agent_head, &search); } diff --git a/openair2/ENB_APP/enb_agent_common.h b/openair2/ENB_APP/flexran_agent_common.h similarity index 51% rename from openair2/ENB_APP/enb_agent_common.h rename to openair2/ENB_APP/flexran_agent_common.h index 6664958ed9..2156d50a0d 100644 --- a/openair2/ENB_APP/enb_agent_common.h +++ b/openair2/ENB_APP/flexran_agent_common.h @@ -27,7 +27,7 @@ *******************************************************************************/ -/*! \file enb_agent_common.h +/*! \file flexran_agent_common.h * \brief common message primitves and utilities * \author Xenofon Foukas, Mohamed Kassem and Navid Nikaein * \date 2016 @@ -36,8 +36,8 @@ -#ifndef ENB_AGENT_COMMON_H_ -#define ENB_AGENT_COMMON_H_ +#ifndef FLEXRAN_AGENT_COMMON_H_ +#define FLEXRAN_AGENT_COMMON_H_ #include @@ -46,7 +46,7 @@ #include "stats_messages.pb-c.h" #include "stats_common.pb-c.h" -# include "enb_agent_defs.h" +#include "flexran_agent_defs.h" #include "enb_config.h" #include "LAYER2/MAC/extern.h" @@ -58,13 +58,13 @@ #define FLEXRAN_VERSION 0 -typedef int (*enb_agent_message_decoded_callback)( +typedef int (*flexran_agent_message_decoded_callback)( mid_t mod_id, const void *params, Protocol__FlexranMessage **msg ); -typedef int (*enb_agent_message_destruction_callback)( +typedef int (*flexran_agent_message_destruction_callback)( Protocol__FlexranMessage *msg ); @@ -74,75 +74,75 @@ typedef int (*enb_agent_message_destruction_callback)( **********************************/ /* Helper functions for message (de)serialization */ -int enb_agent_serialize_message(Protocol__FlexranMessage *msg, void **buf, int *size); -int enb_agent_deserialize_message(void *data, int size, Protocol__FlexranMessage **msg); +int flexran_agent_serialize_message(Protocol__FlexranMessage *msg, void **buf, int *size); +int flexran_agent_deserialize_message(void *data, int size, Protocol__FlexranMessage **msg); /* Serialize message and then destroy the input flexran msg. Should be called when protocol message is created dynamically */ -void * enb_agent_pack_message(Protocol__FlexranMessage *msg, +void * flexran_agent_pack_message(Protocol__FlexranMessage *msg, uint32_t * size); /* Calls destructor of the given message */ -err_code_t enb_agent_destroy_flexran_message(Protocol__FlexranMessage *msg); +err_code_t flexran_agent_destroy_flexran_message(Protocol__FlexranMessage *msg); /* Function to create the header for any FlexRAN protocol message */ -int flex_create_header(xid_t xid, Protocol__FlexType type, Protocol__FlexHeader **header); +int flexran_create_header(xid_t xid, Protocol__FlexType type, Protocol__FlexHeader **header); /* Hello protocol message constructor and destructor */ -int enb_agent_hello(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg); -int enb_agent_destroy_hello(Protocol__FlexranMessage *msg); +int flexran_agent_hello(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg); +int flexran_agent_destroy_hello(Protocol__FlexranMessage *msg); /* Echo request protocol message constructor and destructor */ -int enb_agent_echo_request(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg); -int enb_agent_destroy_echo_request(Protocol__FlexranMessage *msg); +int flexran_agent_echo_request(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg); +int flexran_agent_destroy_echo_request(Protocol__FlexranMessage *msg); /* Echo reply protocol message constructor and destructor */ -int enb_agent_echo_reply(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg); -int enb_agent_destroy_echo_reply(Protocol__FlexranMessage *msg); +int flexran_agent_echo_reply(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg); +int flexran_agent_destroy_echo_reply(Protocol__FlexranMessage *msg); /* eNodeB configuration reply message constructor and destructor */ -int enb_agent_enb_config_reply(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg); -int enb_agent_destroy_enb_config_reply(Protocol__FlexranMessage *msg); +int flexran_agent_enb_config_reply(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg); +int flexran_agent_destroy_enb_config_reply(Protocol__FlexranMessage *msg); /* UE configuration reply message constructor and destructor */ -int enb_agent_ue_config_reply(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg); -int enb_agent_destroy_ue_config_reply(Protocol__FlexranMessage *msg); +int flexran_agent_ue_config_reply(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg); +int flexran_agent_destroy_ue_config_reply(Protocol__FlexranMessage *msg); /* Logical channel reply configuration message constructor and destructor */ -int enb_agent_lc_config_reply(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg); -int enb_agent_destroy_lc_config_reply(Protocol__FlexranMessage *msg); +int flexran_agent_lc_config_reply(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg); +int flexran_agent_destroy_lc_config_reply(Protocol__FlexranMessage *msg); /* eNodeB configuration request message constructor and destructor */ -int enb_agent_enb_config_request(mid_t mod_id, const void* params, Protocol__FlexranMessage **msg); -int enb_agent_destroy_enb_config_request(Protocol__FlexranMessage *msg); +int flexran_agent_enb_config_request(mid_t mod_id, const void* params, Protocol__FlexranMessage **msg); +int flexran_agent_destroy_enb_config_request(Protocol__FlexranMessage *msg); /* UE configuration request message constructor */ /* TODO: Need to define and implement destructor */ -int enb_agent_destroy_ue_config_request(Protocol__FlexranMessage *msg); +int flexran_agent_destroy_ue_config_request(Protocol__FlexranMessage *msg); /* Logical channel configuration request message constructor */ /* TODO: Need to define and implement destructor */ -int enb_agent_destroy_lc_config_request(Protocol__FlexranMessage *msg); +int flexran_agent_destroy_lc_config_request(Protocol__FlexranMessage *msg); /* UE state change message constructor and destructor */ -int enb_agent_ue_state_change(mid_t mod_id, uint32_t rnti, uint8_t state_change); -int enb_agent_destroy_ue_state_change(Protocol__FlexranMessage *msg); +int flexran_agent_ue_state_change(mid_t mod_id, uint32_t rnti, uint8_t state_change); +int flexran_agent_destroy_ue_state_change(Protocol__FlexranMessage *msg); /* Control delegation message constructor and destructor */ -int enb_agent_control_delegation(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg); -int enb_agent_destroy_control_delegation(Protocol__FlexranMessage *msg); +int flexran_agent_control_delegation(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg); +int flexran_agent_destroy_control_delegation(Protocol__FlexranMessage *msg); /* Policy reconfiguration message constructor and destructor */ -int enb_agent_reconfiguration(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg); -int enb_agent_destroy_agent_reconfiguration(Protocol__FlexranMessage *msg); +int flexran_agent_reconfiguration(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg); +int flexran_agent_destroy_agent_reconfiguration(Protocol__FlexranMessage *msg); /* FlexRAN protocol message dispatcher function */ -Protocol__FlexranMessage* enb_agent_handle_message (mid_t mod_id, +Protocol__FlexranMessage* flexran_agent_handle_message (mid_t mod_id, uint8_t *data, uint32_t size); /* Function to be used to send a message to a dispatcher once the appropriate event is triggered. */ -Protocol__FlexranMessage *enb_agent_handle_timed_task(void *args); +Protocol__FlexranMessage *flexran_agent_handle_timed_task(void *args); @@ -151,134 +151,134 @@ Protocol__FlexranMessage *enb_agent_handle_timed_task(void *args); * get generic info from RAN ****************************/ -void set_enb_vars(mid_t mod_id, ran_name_t ran); +void flexran_set_enb_vars(mid_t mod_id, ran_name_t ran); -int get_current_time_ms (mid_t mod_id, int subframe_flag); +int flexran_get_current_time_ms (mid_t mod_id, int subframe_flag); /*Return the current frame number *Could be using implementation specific numbering of frames */ -unsigned int get_current_frame(mid_t mod_id); +unsigned int flexran_get_current_frame(mid_t mod_id); /*Return the current SFN (0-1023)*/ -unsigned int get_current_system_frame_num(mid_t mod_id); +unsigned int flexran_get_current_system_frame_num(mid_t mod_id); -unsigned int get_current_subframe(mid_t mod_id); +unsigned int flexran_get_current_subframe(mid_t mod_id); /*Return the frame and subframe number in compact 16-bit format. Bits 0-3 subframe, rest for frame. Required by FlexRAN protocol*/ -uint16_t get_sfn_sf (mid_t mod_id); +uint16_t flexran_get_sfn_sf (mid_t mod_id); /* Return a future frame and subframe number that is ahead_of_time subframes later in compact 16-bit format. Bits 0-3 subframe, rest for frame */ -uint16_t get_future_sfn_sf(mid_t mod_id, int ahead_of_time); +uint16_t flexran_get_future_sfn_sf(mid_t mod_id, int ahead_of_time); /* Return the number of attached UEs */ -int get_num_ues(mid_t mod_id); +int flexran_get_num_ues(mid_t mod_id); /* Get the rnti of a UE with id ue_id */ -int get_ue_crnti (mid_t mod_id, mid_t ue_id); +int flexran_get_ue_crnti (mid_t mod_id, mid_t ue_id); /* Get the RLC buffer status report of a ue for a designated logical channel id */ -int get_ue_bsr (mid_t mod_id, mid_t ue_id, lcid_t lcid); +int flexran_get_ue_bsr (mid_t mod_id, mid_t ue_id, lcid_t lcid); /* Get power headroom of UE with id ue_id */ -int get_ue_phr (mid_t mod_id, mid_t ue_id); +int flexran_get_ue_phr (mid_t mod_id, mid_t ue_id); /* Get the UE wideband CQI */ -int get_ue_wcqi (mid_t mod_id, mid_t ue_id); +int flexran_get_ue_wcqi (mid_t mod_id, mid_t ue_id); /* Get the transmission queue size for a UE with a channel_id logical channel id */ -int get_tx_queue_size(mid_t mod_id, mid_t ue_id, logical_chan_id_t channel_id); +int flexran_get_tx_queue_size(mid_t mod_id, mid_t ue_id, logical_chan_id_t channel_id); /* Return timing advance MAC control element for a designated cell and UE */ -int get_MAC_CE_bitmap_TA(mid_t mod_id, mid_t ue_id, int CC_id); +int flexran_get_MAC_CE_bitmap_TA(mid_t mod_id, mid_t ue_id, int CC_id); /* Get the number of active component carriers for a specific UE */ -int get_active_CC(mid_t mod_id, mid_t ue_id); +int flexran_get_active_CC(mid_t mod_id, mid_t ue_id); /* Get the rank indicator for a designated cell and UE */ -int get_current_RI(mid_t mod_id, mid_t ue_id, int CC_id); +int flexran_get_current_RI(mid_t mod_id, mid_t ue_id, int CC_id); /* See TS 36.213, section 10.1 */ -int get_n1pucch_an(mid_t mod_id, int CC_id); +int flexran_get_n1pucch_an(mid_t mod_id, int CC_id); /* See TS 36.211, section 5.4 */ -int get_nRB_CQI(mid_t mod_id, int CC_id); +int flexran_get_nRB_CQI(mid_t mod_id, int CC_id); /* See TS 36.211, section 5.4 */ -int get_deltaPUCCH_Shift(mid_t mod_id, int CC_id); +int flexran_get_deltaPUCCH_Shift(mid_t mod_id, int CC_id); /* See TS 36.211, section 5.7.1 */ -int get_prach_ConfigIndex(mid_t mod_id, int CC_id); +int flexran_get_prach_ConfigIndex(mid_t mod_id, int CC_id); /* See TS 36.211, section 5.7.1 */ -int get_prach_FreqOffset(mid_t mod_id, int CC_id); +int flexran_get_prach_FreqOffset(mid_t mod_id, int CC_id); /* See TS 36.321 */ -int get_maxHARQ_Msg3Tx(mid_t mod_id, int CC_id); +int flexran_get_maxHARQ_Msg3Tx(mid_t mod_id, int CC_id); /* Get the length of the UL cyclic prefix */ -int get_ul_cyclic_prefix_length(mid_t mod_id, int CC_id); +int flexran_get_ul_cyclic_prefix_length(mid_t mod_id, int CC_id); /* Get the length of the DL cyclic prefix */ -int get_dl_cyclic_prefix_length(mid_t mod_id, int CC_id); +int flexran_get_dl_cyclic_prefix_length(mid_t mod_id, int CC_id); /* Get the physical cell id of a cell */ -int get_cell_id(mid_t mod_id, int CC_id); +int flexran_get_cell_id(mid_t mod_id, int CC_id); /* See TS 36.211, section 5.5.3.2 */ -int get_srs_BandwidthConfig(mid_t mod_id, int CC_id); +int flexran_get_srs_BandwidthConfig(mid_t mod_id, int CC_id); /* See TS 36.211, table 5.5.3.3-1 and 2 */ -int get_srs_SubframeConfig(mid_t mod_id, int CC_id); +int flexran_get_srs_SubframeConfig(mid_t mod_id, int CC_id); /* Boolean value. See TS 36.211, section 5.5.3.2. TDD only */ -int get_srs_MaxUpPts(mid_t mod_id, int CC_id); +int flexran_get_srs_MaxUpPts(mid_t mod_id, int CC_id); /* Get number of DL resource blocks */ -int get_N_RB_DL(mid_t mod_id, int CC_id); +int flexran_get_N_RB_DL(mid_t mod_id, int CC_id); /* Get number of UL resource blocks */ -int get_N_RB_UL(mid_t mod_id, int CC_id); +int flexran_get_N_RB_UL(mid_t mod_id, int CC_id); /* Get DL/UL subframe assignment. TDD only */ -int get_subframe_assignment(mid_t mod_id, int CC_id); +int flexran_get_subframe_assignment(mid_t mod_id, int CC_id); /* TDD only. See TS 36.211, table 4.2.1 */ -int get_special_subframe_assignment(mid_t mod_id, int CC_id); +int flexran_get_special_subframe_assignment(mid_t mod_id, int CC_id); /* Get the duration of the random access response window in subframes */ -int get_ra_ResponseWindowSize(mid_t mod_id, int CC_id); +int flexran_get_ra_ResponseWindowSize(mid_t mod_id, int CC_id); /* Get timer used for random access */ -int get_mac_ContentionResolutionTimer(mid_t mod_id, int CC_id); +int flexran_get_mac_ContentionResolutionTimer(mid_t mod_id, int CC_id); /* Get type of duplex mode (FDD/TDD) */ -int get_duplex_mode(mid_t mod_id, int CC_id); +int flexran_get_duplex_mode(mid_t mod_id, int CC_id); /* Get the SI window length */ -long get_si_window_length(mid_t mod_id, int CC_id); +long flexran_get_si_window_length(mid_t mod_id, int CC_id); /* Get the number of PDCCH symbols configured for the cell */ -int get_num_pdcch_symb(mid_t mod_id, int CC_id); +int flexran_get_num_pdcch_symb(mid_t mod_id, int CC_id); /* See TS 36.213, sec 5.1.1.1 */ -int get_tpc(mid_t mod_id, mid_t ue_id); +int flexran_get_tpc(mid_t mod_id, mid_t ue_id); /* Get the first available HARQ process for a specific cell and UE during a designated frame and subframe. Returns 0 for success. The id and the status of the HARQ process are stored in id and status respectively */ -int get_harq(const mid_t mod_id, const uint8_t CC_id, const mid_t ue_id, - const int frame, const uint8_t subframe, int *id, int *status); +int flexran_get_harq(const mid_t mod_id, const uint8_t CC_id, const mid_t ue_id, + const int frame, const uint8_t subframe, int *id, int *status); /* Reported values for uplink power control */ -int get_p0_pucch_dbm(mid_t mod_id, mid_t ue_id, int CC_id); +int flexran_get_p0_pucch_dbm(mid_t mod_id, mid_t ue_id, int CC_id); -int get_p0_nominal_pucch(mid_t mod_id, int CC_id); +int flexran_get_p0_nominal_pucch(mid_t mod_id, int CC_id); /* * ************************************ @@ -289,86 +289,86 @@ int get_p0_nominal_pucch(mid_t mod_id, int CC_id); /* Get timer in subframes. Controls the synchronization status of the UE, not the actual timing advance procedure. See TS 36.321 */ -int get_time_alignment_timer(mid_t mod_id, mid_t ue_id); +int flexran_get_time_alignment_timer(mid_t mod_id, mid_t ue_id); /* Get measurement gap configuration. See TS 36.133 */ -int get_meas_gap_config(mid_t mod_id, mid_t ue_id); +int flexran_get_meas_gap_config(mid_t mod_id, mid_t ue_id); /* Get measurement gap configuration offset if applicable */ -int get_meas_gap_config_offset(mid_t mod_id, mid_t ue_id); +int flexran_get_meas_gap_config_offset(mid_t mod_id, mid_t ue_id); /* DL aggregated bit-rate of non-gbr bearer per UE. See TS 36.413 */ -int get_ue_aggregated_max_bitrate_dl (mid_t mod_id, mid_t ue_id); +int flexran_get_ue_aggregated_max_bitrate_dl (mid_t mod_id, mid_t ue_id); /* UL aggregated bit-rate of non-gbr bearer per UE. See TS 36.413 */ -int get_ue_aggregated_max_bitrate_ul (mid_t mod_id, mid_t ue_id); +int flexran_get_ue_aggregated_max_bitrate_ul (mid_t mod_id, mid_t ue_id); /* Only half-duplex support. FDD operation. Boolean value */ -int get_half_duplex(mid_t ue_id); +int flexran_get_half_duplex(mid_t ue_id); /* Support of intra-subframe hopping. Boolean value */ -int get_intra_sf_hopping(mid_t ue_id); +int flexran_get_intra_sf_hopping(mid_t ue_id); /* UE support for type 2 hopping with n_sb>1 */ -int get_type2_sb_1(mid_t ue_id); +int flexran_get_type2_sb_1(mid_t ue_id); /* Get the UE category */ -int get_ue_category(mid_t ue_id); +int flexran_get_ue_category(mid_t ue_id); /* UE support for resource allocation type 1 */ -int get_res_alloc_type1(mid_t ue_id); +int flexran_get_res_alloc_type1(mid_t ue_id); /* Get UE transmission mode */ -int get_ue_transmission_mode(mid_t mod_id, mid_t ue_id); +int flexran_get_ue_transmission_mode(mid_t mod_id, mid_t ue_id); /* Boolean value. See TS 36.321 */ -int get_tti_bundling(mid_t mod_id, mid_t ue_id); +int flexran_get_tti_bundling(mid_t mod_id, mid_t ue_id); /* The max HARQ retransmission for UL. See TS 36.321 */ -int get_maxHARQ_TX(mid_t mod_id, mid_t ue_id); +int flexran_get_maxHARQ_TX(mid_t mod_id, mid_t ue_id); /* See TS 36.213 */ -int get_beta_offset_ack_index(mid_t mod_id, mid_t ue_id); +int flexran_get_beta_offset_ack_index(mid_t mod_id, mid_t ue_id); /* See TS 36.213 */ -int get_beta_offset_ri_index(mid_t mod_id, mid_t ue_id); +int flexran_get_beta_offset_ri_index(mid_t mod_id, mid_t ue_id); /* See TS 36.213 */ -int get_beta_offset_cqi_index(mid_t mod_id, mid_t ue_id); +int flexran_get_beta_offset_cqi_index(mid_t mod_id, mid_t ue_id); /* Boolean. See TS36.213, Section 10.1 */ -int get_simultaneous_ack_nack_cqi(mid_t mod_id, mid_t ue_id); +int flexran_get_simultaneous_ack_nack_cqi(mid_t mod_id, mid_t ue_id); /* Boolean. See TS 36.213, Section 8.2 */ -int get_ack_nack_simultaneous_trans(mid_t mod_id,mid_t ue_id); +int flexran_get_ack_nack_simultaneous_trans(mid_t mod_id,mid_t ue_id); /* Get aperiodic CQI report mode */ -int get_aperiodic_cqi_rep_mode(mid_t mod_id,mid_t ue_id); +int flexran_get_aperiodic_cqi_rep_mode(mid_t mod_id,mid_t ue_id); /* Get ACK/NACK feedback mode. TDD only */ -int get_tdd_ack_nack_feedback(mid_t mod_id, mid_t ue_id); +int flexran_get_tdd_ack_nack_feedback(mid_t mod_id, mid_t ue_id); /* See TS36.213, section 10.1 */ -int get_ack_nack_repetition_factor(mid_t mod_id, mid_t ue_id); +int flexran_get_ack_nack_repetition_factor(mid_t mod_id, mid_t ue_id); /* Boolean. Extended buffer status report size */ -int get_extended_bsr_size(mid_t mod_id, mid_t ue_id); +int flexran_get_extended_bsr_size(mid_t mod_id, mid_t ue_id); /* Get number of UE transmission antennas */ -int get_ue_transmission_antenna(mid_t mod_id, mid_t ue_id); +int flexran_get_ue_transmission_antenna(mid_t mod_id, mid_t ue_id); /* Get logical channel group of a channel with id lc_id */ -int get_lcg(mid_t ue_id, mid_t lc_id); +int flexran_get_lcg(mid_t ue_id, mid_t lc_id); /* Get direction of logical channel with id lc_id */ -int get_direction(mid_t ue_id, mid_t lc_id); +int flexran_get_direction(mid_t ue_id, mid_t lc_id); /******************* * timer primitves @@ -382,51 +382,51 @@ int get_direction(mid_t ue_id, mid_t lc_id); /* Type of the callback executed when the timer expired */ -typedef Protocol__FlexranMessage *(*enb_agent_timer_callback_t)(void*); +typedef Protocol__FlexranMessage *(*flexran_agent_timer_callback_t)(void*); typedef enum { /* oneshot timer: */ - ENB_AGENT_TIMER_TYPE_ONESHOT = 0x0, + FLEXRAN_AGENT_TIMER_TYPE_ONESHOT = 0x0, /* periodic timer */ - ENB_AGENT_TIMER_TYPE_PERIODIC = 0x1, + FLEXRAN_AGENT_TIMER_TYPE_PERIODIC = 0x1, /* Inactive state: initial state for any timer. */ - ENB_AGENT_TIMER_TYPE_EVENT_DRIVEN = 0x2, + FLEXRAN_AGENT_TIMER_TYPE_EVENT_DRIVEN = 0x2, /* Max number of states available */ - ENB_AGENT_TIMER_TYPE_MAX, -} eNB_agent_timer_type_t; + FLEXRAN_AGENT_TIMER_TYPE_MAX, +} flexran_agent_timer_type_t; typedef enum { /* Inactive state: initial state for any timer. */ - ENB_AGENT_TIMER_STATE_INACTIVE = 0x0, + FLEXRAN_AGENT_TIMER_STATE_INACTIVE = 0x0, /* Inactive state: initial state for any timer. */ - ENB_AGENT_TIMER_STATE_ACTIVE = 0x1, + FLEXRAN_AGENT_TIMER_STATE_ACTIVE = 0x1, /* Inactive state: initial state for any timer. */ - ENB_AGENT_TIMER_STATE_STOPPED = 0x2, + FLEXRAN_AGENT_TIMER_STATE_STOPPED = 0x2, /* Max number of states available */ - ENB_AGENT_TIMER_STATE_MAX, -} eNB_agent_timer_state_t; + FLEXRAN_AGENT_TIMER_STATE_MAX, +} flexran_agent_timer_state_t; -typedef struct enb_agent_timer_args_s{ +typedef struct flexran_agent_timer_args_s{ mid_t mod_id; Protocol__FlexranMessage *msg; -} enb_agent_timer_args_t; +} flexran_agent_timer_args_t; -typedef struct enb_agent_timer_element_s{ - RB_ENTRY(enb_agent_timer_element_s) entry; +typedef struct flexran_agent_timer_element_s{ + RB_ENTRY(flexran_agent_timer_element_s) entry; agent_id_t agent_id; instance_t instance; - eNB_agent_timer_type_t type; - eNB_agent_timer_state_t state; + flexran_agent_timer_type_t type; + flexran_agent_timer_state_t state; uint32_t interval_sec; uint32_t interval_usec; @@ -435,59 +435,59 @@ typedef struct enb_agent_timer_element_s{ xid_t xid; /*The id of the task as received by the controller message*/ - enb_agent_timer_callback_t cb; - enb_agent_timer_args_t *timer_args; + flexran_agent_timer_callback_t cb; + flexran_agent_timer_args_t *timer_args; -} enb_agent_timer_element_t; +} flexran_agent_timer_element_t; -typedef struct enb_agent_timer_instance_s{ - RB_HEAD(enb_agent_map, enb_agent_timer_element_s) enb_agent_head; -}enb_agent_timer_instance_t; +typedef struct flexran_agent_timer_instance_s{ + RB_HEAD(flexran_agent_map, flexran_agent_timer_element_s) flexran_agent_head; +}flexran_agent_timer_instance_t; -err_code_t enb_agent_init_timer(void); +err_code_t flexran_agent_init_timer(void); /* Create a timer for some agent related event with id xid. Will store the id of the generated timer in timer_id */ -err_code_t enb_agent_create_timer(uint32_t interval_sec, +err_code_t flexran_agent_create_timer(uint32_t interval_sec, uint32_t interval_usec, agent_id_t agent_id, instance_t instance, uint32_t timer_type, xid_t xid, - enb_agent_timer_callback_t cb, + flexran_agent_timer_callback_t cb, void* timer_args, long *timer_id); /* Destroy all existing timers */ -err_code_t enb_agent_destroy_timers(void); +err_code_t flexran_agent_destroy_timers(void); /* Destroy the timer with the given timer_id */ -err_code_t enb_agent_destroy_timer(long timer_id); +err_code_t flexran_agent_destroy_timer(long timer_id); /* Destroy the timer for task with id xid */ -err_code_t enb_agent_destroy_timer_by_task_id(xid_t xid); +err_code_t flexran_agent_destroy_timer_by_task_id(xid_t xid); /* Stop a timer */ -err_code_t enb_agent_stop_timer(long timer_id); +err_code_t flexran_agent_stop_timer(long timer_id); /* Restart the given timer */ -err_code_t enb_agent_restart_timer(long *timer_id); +err_code_t flexran_agent_restart_timer(long *timer_id); /* Find the timer with the given timer_id */ -struct enb_agent_timer_element_s * get_timer_entry(long timer_id); +struct flexran_agent_timer_element_s * get_timer_entry(long timer_id); /* Obtain the protocol message stored in the given expired timer */ -Protocol__FlexranMessage * enb_agent_process_timeout(long timer_id, void* timer_args); +Protocol__FlexranMessage * flexran_agent_process_timeout(long timer_id, void* timer_args); /* Comparator function comparing two timers. Decides the ordering of the timers */ -int enb_agent_compare_timer(struct enb_agent_timer_element_s *a, struct enb_agent_timer_element_s *b); +int flexran_agent_compare_timer(struct flexran_agent_timer_element_s *a, struct flexran_agent_timer_element_s *b); /*Specify a delay in nanoseconds to timespec and sleep until then*/ -void enb_agent_sleep_until(struct timespec *ts, int delay); +void flexran_agent_sleep_until(struct timespec *ts, int delay); /* RB_PROTOTYPE is for .h files */ -RB_PROTOTYPE(enb_agent_map, enb_agent_timer_element_s, entry, enb_agent_compare_timer); +RB_PROTOTYPE(flexran_agent_map, flexran_agent_timer_element_s, entry, flexran_agent_compare_timer); #endif diff --git a/openair2/ENB_APP/enb_agent_common_internal.c b/openair2/ENB_APP/flexran_agent_common_internal.c similarity index 98% rename from openair2/ENB_APP/enb_agent_common_internal.c rename to openair2/ENB_APP/flexran_agent_common_internal.c index ca61a96609..f35cd8666f 100644 --- a/openair2/ENB_APP/enb_agent_common_internal.c +++ b/openair2/ENB_APP/flexran_agent_common_internal.c @@ -27,7 +27,7 @@ *******************************************************************************/ -/*! \file enb_agent_common_internal.c +/*! \file flexran_agent_common_internal.c * \brief internal functions for common message primitves and utilities * \author Xenofon Foukas * \date 2016 @@ -37,8 +37,8 @@ #include #include -#include "enb_agent_common_internal.h" -#include "enb_agent_mac_internal.h" +#include "flexran_agent_common_internal.h" +#include "flexran_agent_mac_internal.h" int apply_reconfiguration_policy(mid_t mod_id, const char *policy, size_t policy_length) { diff --git a/openair2/ENB_APP/enb_agent_common_internal.h b/openair2/ENB_APP/flexran_agent_common_internal.h similarity index 94% rename from openair2/ENB_APP/enb_agent_common_internal.h rename to openair2/ENB_APP/flexran_agent_common_internal.h index 30fd51c5c8..45f4a73ffb 100644 --- a/openair2/ENB_APP/enb_agent_common_internal.h +++ b/openair2/ENB_APP/flexran_agent_common_internal.h @@ -27,19 +27,19 @@ *******************************************************************************/ -/*! \file enb_agent_common_internal.h +/*! \file flexran_agent_common_internal.h * \brief internal agent functions for common message primitves and utilities * \author Xenofon Foukas * \date 2016 * \version 0.1 */ -#ifndef ENB_AGENT_COMMON_INTERNAL_H_ -#define ENB_AGENT_COMMON_INTERNAL_H_ +#ifndef FLEXRAN_AGENT_COMMON_INTERNAL_H_ +#define FLEXRAN_AGENT_COMMON_INTERNAL_H_ #include -#include "enb_agent_defs.h" +#include "flexran_agent_defs.h" int apply_reconfiguration_policy(mid_t mod_id, const char *policy, size_t policy_length); diff --git a/openair2/ENB_APP/enb_agent_defs.h b/openair2/ENB_APP/flexran_agent_defs.h similarity index 70% rename from openair2/ENB_APP/enb_agent_defs.h rename to openair2/ENB_APP/flexran_agent_defs.h index 8d71aa2db3..7da0487120 100644 --- a/openair2/ENB_APP/enb_agent_defs.h +++ b/openair2/ENB_APP/flexran_agent_defs.h @@ -27,14 +27,14 @@ *******************************************************************************/ -/*! \file enb_agent_defs.h - * \brief enb agent common definitions +/*! \file flexran_agent_defs.h + * \brief FlexRAN agent common definitions * \author Navid Nikaein and Xenofon Foukas * \date 2016 * \version 0.1 */ -#ifndef ENB_AGENT_DEFS_H_ -#define ENB_AGENT_DEFS_H_ +#ifndef FLEXRAN_AGENT_DEFS_H_ +#define FLEXRAN_AGENT_DEFS_H_ #include #include @@ -45,54 +45,54 @@ #define NUM_MAX_ENB 2 #define NUM_MAX_UE 2048 -#define DEFAULT_ENB_AGENT_IPv4_ADDRESS "127.0.0.1" -#define DEFAULT_ENB_AGENT_PORT 2210 -#define DEFAULT_ENB_AGENT_CACHE "/mnt/oai_agent_cache" +#define DEFAULT_FLEXRAN_AGENT_IPv4_ADDRESS "127.0.0.1" +#define DEFAULT_FLEXRAN_AGENT_PORT 2210 +#define DEFAULT_FLEXRAN_AGENT_CACHE "/mnt/oai_agent_cache" typedef enum { - ENB_AGENT_DEFAULT=0, + FLEXRAN_AGENT_DEFAULT=0, - ENB_AGENT_PHY=1, - ENB_AGENT_MAC=2, - ENB_AGENT_RLC=3, - ENB_AGENT_PDCP=4, - ENB_AGENT_RRC=5, - ENB_AGENT_S1AP=6, - ENB_AGENT_GTP=7, - ENB_AGENT_X2AP=8, + FLEXRAN_AGENT_PHY=1, + FLEXRAN_AGENT_MAC=2, + FLEXRAN_AGENT_RLC=3, + FLEXRAN_AGENT_PDCP=4, + FLEXRAN_AGENT_RRC=5, + FLEXRAN_AGENT_S1AP=6, + FLEXRAN_AGENT_GTP=7, + FLEXRAN_AGENT_X2AP=8, - ENB_AGENT_MAX=9, + FLEXRAN_AGENT_MAX=9, } agent_id_t; typedef enum { /* no action */ - ENB_AGENT_ACTION_NONE = 0x0, + FLEXRAN_AGENT_ACTION_NONE = 0x0, /* send action */ - ENB_AGENT_ACTION_SEND = 0x1, + FLEXRAN_AGENT_ACTION_SEND = 0x1, /* apply action */ - ENB_AGENT_ACTION_APPLY = 0x2, + FLEXRAN_AGENT_ACTION_APPLY = 0x2, /* clear action */ - ENB_AGENT_ACTION_CLEAR = 0x4, + FLEXRAN_AGENT_ACTION_CLEAR = 0x4, /* write action */ - ENB_AGENT_ACTION_WRITE = 0x8, + FLEXRAN_AGENT_ACTION_WRITE = 0x8, /* filter action */ - ENB_AGENT_ACTION_FILTER = 0x10, + FLEXRAN_AGENT_ACTION_FILTER = 0x10, /* preprocess action */ - ENB_AGENT_ACTION_PREPROCESS = 0x20, + FLEXRAN_AGENT_ACTION_PREPROCESS = 0x20, /* meter action */ - ENB_AGENT_ACTION_METER = 0x40, + FLEXRAN_AGENT_ACTION_METER = 0x40, /* Max number of states available */ - ENB_AGENT_ACTION_MAX = 0x7f, + FLEXRAN_AGENT_ACTION_MAX = 0x7f, } agent_action_t; @@ -122,12 +122,12 @@ typedef struct { uint32_t rx_msg[NUM_MAX_ENB]; uint32_t tx_msg[NUM_MAX_ENB]; -}enb_agent_info_t; +} flexran_agent_info_t; typedef struct { mid_t enb_id; - enb_agent_info_t agent_info; + flexran_agent_info_t agent_info; -}enb_agent_instance_t; +} flexran_agent_instance_t; #endif diff --git a/openair2/ENB_APP/enb_agent_extern.h b/openair2/ENB_APP/flexran_agent_extern.h similarity index 87% rename from openair2/ENB_APP/enb_agent_extern.h rename to openair2/ENB_APP/flexran_agent_extern.h index 58f86dfe15..602b1d6ce3 100644 --- a/openair2/ENB_APP/enb_agent_extern.h +++ b/openair2/ENB_APP/flexran_agent_extern.h @@ -28,21 +28,21 @@ *******************************************************************************/ /*! \file ENB_APP/extern.h - * \brief enb agent - mac interface primitives + * \brief FlexRAN agent - mac interface primitives * \author Xenofon Foukas * \date 2016 * \version 0.1 * \mail x.foukas@sms.ed.ac.uk */ -#ifndef __ENB_AGENT_EXTERN_H__ -#define __ENB_AGENT_EXTERN_H__ +#ifndef __FLEXRAN_AGENT_EXTERN_H__ +#define __FLEXRAN_AGENT_EXTERN_H__ -#include "enb_agent_defs.h" -#include "enb_agent_mac_defs.h" +#include "flexran_agent_defs.h" +#include "flexran_agent_mac_defs.h" -//extern msg_context_t shared_ctxt[NUM_MAX_ENB][ENB_AGENT_MAX]; +//extern msg_context_t shared_ctxt[NUM_MAX_ENB][FLEXRAN_AGENT_MAX]; /* full path of the local cache for storing VSFs */ extern char local_cache[40]; diff --git a/openair2/ENB_APP/enb_agent_handler.c b/openair2/ENB_APP/flexran_agent_handler.c similarity index 54% rename from openair2/ENB_APP/enb_agent_handler.c rename to openair2/ENB_APP/flexran_agent_handler.c index 46459f98bc..c077827c66 100644 --- a/openair2/ENB_APP/enb_agent_handler.c +++ b/openair2/ENB_APP/flexran_agent_handler.c @@ -27,61 +27,61 @@ *******************************************************************************/ -/*! \file enb_agent_handler.c - * \brief enb agent tx and rx message handler +/*! \file flexran_agent_handler.c + * \brief FlexRAN agent tx and rx message handler * \author Xenofon Foukas and Navid Nikaein * \date 2016 * \version 0.1 */ -#include "enb_agent_common.h" -#include "enb_agent_mac.h" +#include "flexran_agent_common.h" +#include "flexran_agent_mac.h" #include "log.h" #include "assertions.h" -enb_agent_message_decoded_callback agent_messages_callback[][3] = { - {enb_agent_hello, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_HELLO_MSG*/ - {enb_agent_echo_reply, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_ECHO_REQUEST_MSG*/ +flexran_agent_message_decoded_callback agent_messages_callback[][3] = { + {flexran_agent_hello, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_HELLO_MSG*/ + {flexran_agent_echo_reply, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_ECHO_REQUEST_MSG*/ {0, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_ECHO_REPLY_MSG*/ //Must add handler when receiving echo reply - {enb_agent_mac_handle_stats, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_STATS_REQUEST_MSG*/ + {flexran_agent_mac_handle_stats, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_STATS_REQUEST_MSG*/ {0, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_STATS_REPLY_MSG*/ {0, 0, 0}, /*PROTOCOK__FLEXRAN_MESSAGE__MSG_SF_TRIGGER_MSG*/ {0, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_UL_SR_INFO_MSG*/ - {enb_agent_enb_config_reply, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_ENB_CONFIG_REQUEST_MSG*/ + {flexran_agent_enb_config_reply, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_ENB_CONFIG_REQUEST_MSG*/ {0, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_ENB_CONFIG_REPLY_MSG*/ - {enb_agent_ue_config_reply, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_UE_CONFIG_REQUEST_MSG*/ + {flexran_agent_ue_config_reply, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_UE_CONFIG_REQUEST_MSG*/ {0, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_UE_CONFIG_REPLY_MSG*/ - {enb_agent_lc_config_reply, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_LC_CONFIG_REQUEST_MSG*/ + {flexran_agent_lc_config_reply, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_LC_CONFIG_REQUEST_MSG*/ {0, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_LC_CONFIG_REPLY_MSG*/ - {enb_agent_mac_handle_dl_mac_config, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_DL_MAC_CONFIG_MSG*/ + {flexran_agent_mac_handle_dl_mac_config, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_DL_MAC_CONFIG_MSG*/ {0, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_UE_STATE_CHANGE_MSG*/ - {enb_agent_control_delegation, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_CONTROL_DELEGATION_MSG*/ - {enb_agent_reconfiguration, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_AGENT_RECONFIGURATION_MSG*/ + {flexran_agent_control_delegation, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_CONTROL_DELEGATION_MSG*/ + {flexran_agent_reconfiguration, 0, 0}, /*PROTOCOL__FLEXRAN_MESSAGE__MSG_AGENT_RECONFIGURATION_MSG*/ }; -enb_agent_message_destruction_callback message_destruction_callback[] = { - enb_agent_destroy_hello, - enb_agent_destroy_echo_request, - enb_agent_destroy_echo_reply, - enb_agent_mac_destroy_stats_request, - enb_agent_mac_destroy_stats_reply, - enb_agent_mac_destroy_sf_trigger, - enb_agent_mac_destroy_sr_info, - enb_agent_destroy_enb_config_request, - enb_agent_destroy_enb_config_reply, - enb_agent_destroy_ue_config_request, - enb_agent_destroy_ue_config_reply, - enb_agent_destroy_lc_config_request, - enb_agent_destroy_lc_config_reply, - enb_agent_mac_destroy_dl_config, - enb_agent_destroy_ue_state_change, - enb_agent_destroy_control_delegation, - enb_agent_destroy_agent_reconfiguration, +flexran_agent_message_destruction_callback message_destruction_callback[] = { + flexran_agent_destroy_hello, + flexran_agent_destroy_echo_request, + flexran_agent_destroy_echo_reply, + flexran_agent_mac_destroy_stats_request, + flexran_agent_mac_destroy_stats_reply, + flexran_agent_mac_destroy_sf_trigger, + flexran_agent_mac_destroy_sr_info, + flexran_agent_destroy_enb_config_request, + flexran_agent_destroy_enb_config_reply, + flexran_agent_destroy_ue_config_request, + flexran_agent_destroy_ue_config_reply, + flexran_agent_destroy_lc_config_request, + flexran_agent_destroy_lc_config_reply, + flexran_agent_mac_destroy_dl_config, + flexran_agent_destroy_ue_state_change, + flexran_agent_destroy_control_delegation, + flexran_agent_destroy_agent_reconfiguration, }; -static const char *enb_agent_direction2String[] = { +static const char *flexran_agent_direction2String[] = { "", /* not_set */ "originating message", /* originating message */ "successfull outcome", /* successfull outcome */ @@ -89,23 +89,23 @@ static const char *enb_agent_direction2String[] = { }; -Protocol__FlexranMessage* enb_agent_handle_message (mid_t mod_id, - uint8_t *data, - uint32_t size){ +Protocol__FlexranMessage* flexran_agent_handle_message (mid_t mod_id, + uint8_t *data, + uint32_t size){ Protocol__FlexranMessage *decoded_message, *reply_message; err_code_t err_code; DevAssert(data != NULL); - if (enb_agent_deserialize_message(data, size, &decoded_message) < 0) { + if (flexran_agent_deserialize_message(data, size, &decoded_message) < 0) { err_code= PROTOCOL__FLEXRAN_ERR__MSG_DECODING; goto error; } - if ((decoded_message->msg_case > sizeof(agent_messages_callback) / (3*sizeof(enb_agent_message_decoded_callback))) || + if ((decoded_message->msg_case > sizeof(agent_messages_callback) / (3 * sizeof(flexran_agent_message_decoded_callback))) || (decoded_message->msg_dir > PROTOCOL__FLEXRAN_DIRECTION__UNSUCCESSFUL_OUTCOME)){ err_code= PROTOCOL__FLEXRAN_ERR__MSG_NOT_HANDLED; - goto error; + goto error; } if (agent_messages_callback[decoded_message->msg_case-1][decoded_message->msg_dir-1] == NULL) { @@ -123,20 +123,20 @@ Protocol__FlexranMessage* enb_agent_handle_message (mid_t mod_id, return reply_message; error: - LOG_E(ENB_AGENT,"errno %d occured\n",err_code); + LOG_E(FLEXRAN_AGENT,"errno %d occured\n",err_code); return NULL; } -void * enb_agent_pack_message(Protocol__FlexranMessage *msg, - uint32_t * size){ +void * flexran_agent_pack_message(Protocol__FlexranMessage *msg, + uint32_t * size){ void * buffer; err_code_t err_code = PROTOCOL__FLEXRAN_ERR__NO_ERR; - if (enb_agent_serialize_message(msg, &buffer, size) < 0 ) { + if (flexran_agent_serialize_message(msg, &buffer, size) < 0 ) { err_code = PROTOCOL__FLEXRAN_ERR__MSG_ENCODING; goto error; } @@ -147,23 +147,23 @@ void * enb_agent_pack_message(Protocol__FlexranMessage *msg, DevAssert(buffer !=NULL); - LOG_D(ENB_AGENT,"Serilized the enb mac stats reply (size %d)\n", *size); + LOG_D(FLEXRAN_AGENT,"Serilized the enb mac stats reply (size %d)\n", *size); return buffer; error : - LOG_E(ENB_AGENT,"errno %d occured\n",err_code); + LOG_E(FLEXRAN_AGENT,"errno %d occured\n",err_code); return NULL; } -Protocol__FlexranMessage *enb_agent_handle_timed_task(void *args) { +Protocol__FlexranMessage *flexran_agent_handle_timed_task(void *args) { err_code_t err_code; - enb_agent_timer_args_t *timer_args = (enb_agent_timer_args_t *) args; + flexran_agent_timer_args_t *timer_args = (flexran_agent_timer_args_t *) args; Protocol__FlexranMessage *timed_task, *reply_message; timed_task = timer_args->msg; - err_code = ((*agent_messages_callback[timed_task->msg_case-1][timed_task->msg_dir-1])(timer_args->mod_id, (void *) timed_task, &reply_message)); + err_code = ((*agent_messages_callback[timed_task->msg_case-1][timed_task->msg_dir-1])(timer_args->mod_id, (void *) timed_task, &reply_message)); if ( err_code < 0 ){ goto error; } @@ -171,27 +171,27 @@ Protocol__FlexranMessage *enb_agent_handle_timed_task(void *args) { return reply_message; error: - LOG_E(ENB_AGENT,"errno %d occured\n",err_code); + LOG_E(FLEXRAN_AGENT,"errno %d occured\n",err_code); return NULL; } -Protocol__FlexranMessage* enb_agent_process_timeout(long timer_id, void* timer_args){ +Protocol__FlexranMessage* flexran_agent_process_timeout(long timer_id, void* timer_args){ - struct enb_agent_timer_element_s *found = get_timer_entry(timer_id); + struct flexran_agent_timer_element_s *found = get_timer_entry(timer_id); if (found == NULL ) goto error; - LOG_I(ENB_AGENT, "Found the entry (%p): timer_id is 0x%lx 0x%lx\n", found, timer_id, found->timer_id); + LOG_I(FLEXRAN_AGENT, "Found the entry (%p): timer_id is 0x%lx 0x%lx\n", found, timer_id, found->timer_id); if (timer_args == NULL) - LOG_W(ENB_AGENT,"null timer args\n"); + LOG_W(FLEXRAN_AGENT,"null timer args\n"); return found->cb(timer_args); error: - LOG_E(ENB_AGENT, "can't get the timer element\n"); + LOG_E(FLEXRAN_AGENT, "can't get the timer element\n"); return TIMER_ELEMENT_NOT_FOUND; } -err_code_t enb_agent_destroy_flexran_message(Protocol__FlexranMessage *msg) { +err_code_t flexran_agent_destroy_flexran_message(Protocol__FlexranMessage *msg) { return ((*message_destruction_callback[msg->msg_case-1])(msg)); } diff --git a/openair2/ENB_APP/enb_agent_mac.c b/openair2/ENB_APP/flexran_agent_mac.c similarity index 84% rename from openair2/ENB_APP/enb_agent_mac.c rename to openair2/ENB_APP/flexran_agent_mac.c index 330dafad3a..c85ec6c4eb 100644 --- a/openair2/ENB_APP/enb_agent_mac.c +++ b/openair2/ENB_APP/flexran_agent_mac.c @@ -27,21 +27,21 @@ *******************************************************************************/ -/*! \file enb_agent_mac.c - * \brief enb agent message handler for MAC layer +/*! \file flexran_agent_mac.c + * \brief FlexRAN agent message handler for MAC layer * \author Xenofon Foukas, Mohamed Kassem and Navid Nikaein * \date 2016 * \version 0.1 */ -#include "enb_agent_mac.h" -#include "enb_agent_extern.h" -#include "enb_agent_common.h" -#include "enb_agent_mac_internal.h" +#include "flexran_agent_mac.h" +#include "flexran_agent_extern.h" +#include "flexran_agent_common.h" +#include "flexran_agent_mac_internal.h" #include "LAYER2/MAC/proto.h" -#include "LAYER2/MAC/enb_agent_mac_proto.h" -#include "LAYER2/MAC/eNB_agent_scheduler_dlsch_ue_remote.h" +#include "LAYER2/MAC/flexran_agent_mac_proto.h" +#include "LAYER2/MAC/flexran_agent_scheduler_dlsch_ue_remote.h" #include "liblfds700.h" @@ -61,7 +61,7 @@ struct lfds700_ringbuffer_element *dl_mac_config_array[NUM_MAX_ENB]; struct lfds700_ringbuffer_state ringbuffer_state[NUM_MAX_ENB]; -int enb_agent_mac_handle_stats(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg){ +int flexran_agent_mac_handle_stats(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg){ // TODO: Must deal with sanitization of input // TODO: Must check if RNTIs and cell ids of the request actually exist @@ -97,8 +97,8 @@ int enb_agent_mac_handle_stats(mid_t mod_id, const void *params, Protocol__Flexr Protocol__FlexCompleteStatsRequest *comp_req = stats_req->complete_stats_request; if (comp_req->report_frequency == PROTOCOL__FLEX_STATS_REPORT_FREQ__FLSRF_OFF) { /*Disable both periodic and continuous updates*/ - enb_agent_disable_cont_mac_stats_update(mod_id); - enb_agent_destroy_timer_by_task_id(xid); + flexran_agent_disable_cont_mac_stats_update(mod_id); + flexran_agent_destroy_timer_by_task_id(xid); *msg = NULL; return 0; } else { //One-off, periodical or continuous reporting @@ -108,7 +108,7 @@ int enb_agent_mac_handle_stats(mid_t mod_id, const void *params, Protocol__Flexr //Create a list of all eNB RNTIs and cells //Set the number of UEs and create list with their RNTIs stats configs - report_config.nr_ue = get_num_ues(mod_id); //eNB_UE_list->num_UEs + report_config.nr_ue = flexran_get_num_ues(mod_id); //eNB_UE_list->num_UEs report_config.ue_report_type = (ue_report_type_t *) malloc(sizeof(ue_report_type_t) * report_config.nr_ue); if (report_config.ue_report_type == NULL) { // TODO: Add appropriate error code @@ -116,7 +116,7 @@ int enb_agent_mac_handle_stats(mid_t mod_id, const void *params, Protocol__Flexr goto error; } for (i = 0; i < report_config.nr_ue; i++) { - report_config.ue_report_type[i].ue_rnti = get_ue_crnti(enb_id, i); //eNB_UE_list->eNB_UE_stats[UE_PCCID(enb_id,i)][i].crnti; + report_config.ue_report_type[i].ue_rnti = flexran_get_ue_crnti(enb_id, i); //eNB_UE_list->eNB_UE_stats[UE_PCCID(enb_id,i)][i].crnti; report_config.ue_report_type[i].ue_report_flags = ue_flags; } //Set the number of CCs and create a list with the cell stats configs @@ -153,12 +153,12 @@ int enb_agent_mac_handle_stats(mid_t mod_id, const void *params, Protocol__Flexr report_config.ue_report_type[0].ue_report_flags = ue_flags; } request_config.config = &report_config; - enb_agent_mac_stats_request(enb_id, xid, &request_config, &timer_msg); + flexran_agent_mac_stats_request(enb_id, xid, &request_config, &timer_msg); /* Create a timer */ long timer_id = 0; - enb_agent_timer_args_t *timer_args; - timer_args = malloc(sizeof(enb_agent_timer_args_t)); - memset (timer_args, 0, sizeof(enb_agent_timer_args_t)); + flexran_agent_timer_args_t *timer_args; + timer_args = malloc(sizeof(flexran_agent_timer_args_t)); + memset (timer_args, 0, sizeof(flexran_agent_timer_args_t)); timer_args->mod_id = enb_id; timer_args->msg = timer_msg; /*Convert subframes to usec time*/ @@ -169,11 +169,11 @@ int enb_agent_mac_handle_stats(mid_t mod_id, const void *params, Protocol__Flexr sec_interval = usec_interval/(1000*1000); usec_interval = usec_interval%(1000*1000); } - enb_agent_create_timer(sec_interval, usec_interval, ENB_AGENT_DEFAULT, enb_id, ENB_AGENT_TIMER_TYPE_PERIODIC, xid, enb_agent_handle_timed_task,(void*) timer_args, &timer_id); + flexran_agent_create_timer(sec_interval, usec_interval, FLEXRAN_AGENT_DEFAULT, enb_id, FLEXRAN_AGENT_TIMER_TYPE_PERIODIC, xid, flexran_agent_handle_timed_task,(void*) timer_args, &timer_id); } else if (comp_req->report_frequency == PROTOCOL__FLEX_STATS_REPORT_FREQ__FLSRF_CONTINUOUS) { /*If request was for continuous updates, disable the previous configuration and set up a new one*/ - enb_agent_disable_cont_mac_stats_update(mod_id); + flexran_agent_disable_cont_mac_stats_update(mod_id); stats_request_config_t request_config; request_config.report_type = PROTOCOL__FLEX_STATS_TYPE__FLST_COMPLETE_STATS; request_config.report_frequency = PROTOCOL__FLEX_STATS_REPORT_FREQ__FLSRF_ONCE; @@ -191,7 +191,7 @@ int enb_agent_mac_handle_stats(mid_t mod_id, const void *params, Protocol__Flexr report_config.ue_report_type[0].ue_report_flags = ue_flags; } request_config.config = &report_config; - enb_agent_enable_cont_mac_stats_update(enb_id, xid, &request_config); + flexran_agent_enable_cont_mac_stats_update(enb_id, xid, &request_config); } } break; @@ -236,7 +236,7 @@ int enb_agent_mac_handle_stats(mid_t mod_id, const void *params, Protocol__Flexr goto error; } - if (enb_agent_mac_stats_reply(enb_id, xid, &report_config, msg) < 0 ){ + if (flexran_agent_mac_stats_reply(enb_id, xid, &report_config, msg) < 0 ){ err_code = PROTOCOL__FLEXRAN_ERR__MSG_BUILD; goto error; } @@ -247,18 +247,18 @@ int enb_agent_mac_handle_stats(mid_t mod_id, const void *params, Protocol__Flexr return 0; error : - LOG_E(ENB_AGENT, "errno %d occured\n", err_code); + LOG_E(FLEXRAN_AGENT, "errno %d occured\n", err_code); return err_code; } -int enb_agent_mac_stats_request(mid_t mod_id, - xid_t xid, - const stats_request_config_t *report_config, - Protocol__FlexranMessage **msg) { +int flexran_agent_mac_stats_request(mid_t mod_id, + xid_t xid, + const stats_request_config_t *report_config, + Protocol__FlexranMessage **msg) { Protocol__FlexHeader *header; int i; - if (flex_create_header(xid, PROTOCOL__FLEX_TYPE__FLPT_STATS_REQUEST, &header) != 0) + if (flexran_create_header(xid, PROTOCOL__FLEX_TYPE__FLPT_STATS_REQUEST, &header) != 0) goto error; Protocol__FlexStatsRequest *stats_request_msg; @@ -358,7 +358,7 @@ int enb_agent_mac_stats_request(mid_t mod_id, return -1; } -int enb_agent_mac_destroy_stats_request(Protocol__FlexranMessage *msg) { +int flexran_agent_mac_destroy_stats_request(Protocol__FlexranMessage *msg) { if(msg->msg_case != PROTOCOL__FLEXRAN_MESSAGE__MSG_STATS_REQUEST_MSG) goto error; free(msg->stats_request_msg->header); @@ -377,10 +377,10 @@ int enb_agent_mac_destroy_stats_request(Protocol__FlexranMessage *msg) { return -1; } -int enb_agent_mac_stats_reply(mid_t mod_id, - xid_t xid, - const report_config_t *report_config, - Protocol__FlexranMessage **msg) { +int flexran_agent_mac_stats_reply(mid_t mod_id, + xid_t xid, + const report_config_t *report_config, + Protocol__FlexranMessage **msg) { Protocol__FlexHeader *header; int i, j, k; int cc_id = 0; @@ -389,7 +389,7 @@ int enb_agent_mac_stats_reply(mid_t mod_id, //UE_list_t *eNB_UE_list= &eNB->UE_list; - if (flex_create_header(xid, PROTOCOL__FLEX_TYPE__FLPT_STATS_REPLY, &header) != 0) + if (flexran_create_header(xid, PROTOCOL__FLEX_TYPE__FLPT_STATS_REPLY, &header) != 0) goto error; Protocol__FlexStatsReply *stats_reply_msg; @@ -429,14 +429,14 @@ int enb_agent_mac_stats_reply(mid_t mod_id, goto error; for (j = 0; j++; j < ue_report[i]->n_bsr) { // NN: we need to know the cc_id here, consider the first one - elem[j] = get_ue_bsr (enb_id, i, j); + elem[j] = flexran_get_ue_bsr (enb_id, i, j); } ue_report[i]->bsr = elem; } /* Check flag for creation of PRH report */ if (report_config->ue_report_type[i].ue_report_flags & PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_PRH) { - ue_report[i]->phr = get_ue_phr (enb_id, i); // eNB_UE_list->UE_template[UE_PCCID(enb_id,i)][i].phr_info; + ue_report[i]->phr = flexran_get_ue_phr (enb_id, i); // eNB_UE_list->UE_template[UE_PCCID(enb_id,i)][i].phr_info; ue_report[i]->has_phr = 1; } @@ -456,7 +456,7 @@ int enb_agent_mac_stats_reply(mid_t mod_id, protocol__flex_rlc_bsr__init(rlc_reports[j]); rlc_reports[j]->lc_id = j+1; rlc_reports[j]->has_lc_id = 1; - rlc_reports[j]->tx_queue_size = get_tx_queue_size(enb_id,i,j+1); + rlc_reports[j]->tx_queue_size = flexran_get_tx_queue_size(enb_id,i,j+1); rlc_reports[j]->has_tx_queue_size = 1; //TODO:Set tx queue head of line delay in ms @@ -480,7 +480,7 @@ int enb_agent_mac_stats_reply(mid_t mod_id, /* Check flag for creation of MAC CE buffer status report */ if (report_config->ue_report_type[i].ue_report_flags & PROTOCOL__FLEX_UE_STATS_TYPE__FLUST_MAC_CE_BS) { // TODO: Fill in the actual MAC CE buffer status report - ue_report[i]->pending_mac_ces = (get_MAC_CE_bitmap_TA(enb_id,i,0) | (0 << 1) | (0 << 2) | (0 << 3)) & 15; /* Use as bitmap. Set one or more of the; /* Use as bitmap. Set one or more of the + ue_report[i]->pending_mac_ces = (flexran_get_MAC_CE_bitmap_TA(enb_id,i,0) | (0 << 1) | (0 << 2) | (0 << 3)) & 15; /* Use as bitmap. Set one or more of the; /* Use as bitmap. Set one or more of the PROTOCOL__FLEX_CE_TYPE__FLPCET_ values found in stats_common.pb-c.h. See flex_ce_type in FlexRAN specification */ @@ -496,10 +496,10 @@ int enb_agent_mac_stats_reply(mid_t mod_id, goto error; protocol__flex_dl_cqi_report__init(dl_report); - dl_report->sfn_sn = get_sfn_sf(enb_id); + dl_report->sfn_sn = flexran_get_sfn_sf(enb_id); dl_report->has_sfn_sn = 1; //Set the number of DL CQI reports for this UE. One for each CC - dl_report->n_csi_report = get_active_CC(enb_id,i); + dl_report->n_csi_report = flexran_get_active_CC(enb_id,i); //Create the actual CSI reports. Protocol__FlexDlCsi **csi_reports; @@ -515,7 +515,7 @@ int enb_agent_mac_stats_reply(mid_t mod_id, csi_reports[j]->serv_cell_index = j; csi_reports[j]->has_serv_cell_index = 1; //The rank indicator value for this cc - csi_reports[j]->ri = get_current_RI(enb_id,i,j); + csi_reports[j]->ri = flexran_get_current_RI(enb_id,i,j); csi_reports[j]->has_ri = 1; //TODO: the type of CSI report based on the configuration of the UE //For now we only support type P10, which only needs a wideband value @@ -532,7 +532,7 @@ int enb_agent_mac_stats_reply(mid_t mod_id, protocol__flex_csi_p10__init(csi10); //TODO: set the wideband value // NN: this is also depends on cc_id - csi10->wb_cqi = get_ue_wcqi (enb_id, i); //eNB_UE_list->eNB_UE_stats[UE_PCCID(enb_id,i)][i].dl_cqi; + csi10->wb_cqi = flexran_get_ue_wcqi (enb_id, i); //eNB_UE_list->eNB_UE_stats[UE_PCCID(enb_id,i)][i].dl_cqi; csi10->has_wb_cqi = 1; //Add the type of measurements to the csi report in the proper union type csi_reports[j]->p10csi = csi10; @@ -618,7 +618,7 @@ int enb_agent_mac_stats_reply(mid_t mod_id, goto error; protocol__flex_ul_cqi_report__init(full_ul_report); //TODO:Set the SFN and SF of the generated report - full_ul_report->sfn_sn = get_sfn_sf(enb_id); + full_ul_report->sfn_sn = flexran_get_sfn_sf(enb_id); full_ul_report->has_sfn_sn = 1; //TODO:Set the number of UL measurement reports based on the types of measurements //configured for this UE and on the servCellIndex @@ -664,8 +664,8 @@ int enb_agent_mac_stats_reply(mid_t mod_id, protocol__flex_pucch_dbm__init(full_ul_report->pucch_dbm[j]); full_ul_report->pucch_dbm[j]->has_serv_cell_index = 1; full_ul_report->pucch_dbm[j]->serv_cell_index = j; - if(get_p0_pucch_dbm(enb_id,i, j) != -1){ - full_ul_report->pucch_dbm[j]->p0_pucch_dbm = get_p0_pucch_dbm(enb_id,i,j); + if(flexran_get_p0_pucch_dbm(enb_id,i, j) != -1){ + full_ul_report->pucch_dbm[j]->p0_pucch_dbm = flexran_get_p0_pucch_dbm(enb_id,i,j); full_ul_report->pucch_dbm[j]->has_p0_pucch_dbm = 1; } } @@ -704,7 +704,7 @@ int enb_agent_mac_stats_reply(mid_t mod_id, goto error; protocol__flex_noise_interference_report__init(ni_report); // Current frame and subframe number - ni_report->sfn_sf = get_sfn_sf(enb_id); + ni_report->sfn_sf = flexran_get_sfn_sf(enb_id); ni_report->has_sfn_sf = 1; //TODO:Received interference power in dbm ni_report->rip = 0; @@ -713,7 +713,7 @@ int enb_agent_mac_stats_reply(mid_t mod_id, ni_report->tnp = 0; ni_report->has_tnp = 0; - ni_report->p0_nominal_pucch = get_p0_nominal_pucch(enb_id, 0); + ni_report->p0_nominal_pucch = flexran_get_p0_nominal_pucch(enb_id, 0); ni_report->has_p0_nominal_pucch = 1; cell_report[i]->noise_inter_report = ni_report; } @@ -743,7 +743,7 @@ int enb_agent_mac_stats_reply(mid_t mod_id, return -1; } -int enb_agent_mac_destroy_stats_reply(Protocol__FlexranMessage *msg) { +int flexran_agent_mac_destroy_stats_reply(Protocol__FlexranMessage *msg) { //TODO: Need to deallocate memory for the stats reply message if(msg->msg_case != PROTOCOL__FLEXRAN_MESSAGE__MSG_STATS_REPLY_MSG) goto error; @@ -860,11 +860,11 @@ int enb_agent_mac_destroy_stats_reply(Protocol__FlexranMessage *msg) { return -1; } -int enb_agent_mac_sr_info(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg) { +int flexran_agent_mac_sr_info(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg) { Protocol__FlexHeader *header; int i; const int xid = *((int *)params); - if (flex_create_header(xid, PROTOCOL__FLEX_TYPE__FLPT_UL_SR_INFO, &header) != 0) + if (flexran_create_header(xid, PROTOCOL__FLEX_TYPE__FLPT_UL_SR_INFO, &header) != 0) goto error; Protocol__FlexUlSrInfo *ul_sr_info_msg; @@ -876,7 +876,7 @@ int enb_agent_mac_sr_info(mid_t mod_id, const void *params, Protocol__FlexranMes ul_sr_info_msg->header = header; ul_sr_info_msg->has_sfn_sf = 1; - ul_sr_info_msg->sfn_sf = get_sfn_sf(mod_id); + ul_sr_info_msg->sfn_sf = flexran_get_sfn_sf(mod_id); /*TODO: Set the number of UEs that sent an SR */ ul_sr_info_msg->n_rnti = 1; ul_sr_info_msg->rnti = (uint32_t *) malloc(ul_sr_info_msg->n_rnti * sizeof(uint32_t)); @@ -912,7 +912,7 @@ int enb_agent_mac_sr_info(mid_t mod_id, const void *params, Protocol__FlexranMes return -1; } -int enb_agent_mac_destroy_sr_info(Protocol__FlexranMessage *msg) { +int flexran_agent_mac_destroy_sr_info(Protocol__FlexranMessage *msg) { if(msg->msg_case != PROTOCOL__FLEXRAN_MESSAGE__MSG_UL_SR_INFO_MSG) goto error; @@ -927,11 +927,11 @@ int enb_agent_mac_destroy_sr_info(Protocol__FlexranMessage *msg) { return -1; } -int enb_agent_mac_sf_trigger(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg) { +int flexran_agent_mac_sf_trigger(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg) { Protocol__FlexHeader *header; int i,j; const int xid = *((int *)params); - if (flex_create_header(xid, PROTOCOL__FLEX_TYPE__FLPT_SF_TRIGGER, &header) != 0) + if (flexran_create_header(xid, PROTOCOL__FLEX_TYPE__FLPT_SF_TRIGGER, &header) != 0) goto error; Protocol__FlexSfTrigger *sf_trigger_msg; @@ -946,8 +946,8 @@ int enb_agent_mac_sf_trigger(mid_t mod_id, const void *params, Protocol__Flexran int ahead_of_time = 1; - frame = (frame_t) get_current_system_frame_num(mod_id); - subframe = (sub_frame_t) get_current_subframe(mod_id); + frame = (frame_t) flexran_get_current_system_frame_num(mod_id); + subframe = (sub_frame_t) flexran_get_current_subframe(mod_id); subframe = ((subframe + ahead_of_time) % 10); @@ -955,18 +955,18 @@ int enb_agent_mac_sf_trigger(mid_t mod_id, const void *params, Protocol__Flexran frame = frame + full_frames_ahead; - if (subframe < get_current_subframe(mod_id)) { + if (subframe < flexran_get_current_subframe(mod_id)) { frame++; } sf_trigger_msg->header = header; sf_trigger_msg->has_sfn_sf = 1; - sf_trigger_msg->sfn_sf = get_future_sfn_sf(mod_id, 1); + sf_trigger_msg->sfn_sf = flexran_get_future_sfn_sf(mod_id, 1); /*TODO: Fill in the number of dl HARQ related info, based on the number of currently *transmitting UEs */ - sf_trigger_msg->n_dl_info = get_num_ues(mod_id); + sf_trigger_msg->n_dl_info = flexran_get_num_ues(mod_id); Protocol__FlexDlInfo **dl_info = NULL; @@ -980,12 +980,12 @@ int enb_agent_mac_sf_trigger(mid_t mod_id, const void *params, Protocol__Flexran if(dl_info[i] == NULL) goto error; protocol__flex_dl_info__init(dl_info[i]); - dl_info[i]->rnti = get_ue_crnti(mod_id, i); + dl_info[i]->rnti = flexran_get_ue_crnti(mod_id, i); dl_info[i]->has_rnti = 1; /*Fill in the right id of this round's HARQ process for this UE*/ int harq_id; int harq_status; - get_harq(mod_id, UE_PCCID(mod_id,i), i, frame, subframe, &harq_id, &harq_status); + flexran_get_harq(mod_id, UE_PCCID(mod_id,i), i, frame, subframe, &harq_id, &harq_status); dl_info[i]->harq_process_id = harq_id; dl_info[i]->has_harq_process_id = 1; /* Fill in the status of the HARQ process (2 TBs)*/ @@ -1009,7 +1009,7 @@ int enb_agent_mac_sf_trigger(mid_t mod_id, const void *params, Protocol__Flexran /* Fill in the number of UL reception status related info, based on the number of currently * transmitting UEs */ - sf_trigger_msg->n_ul_info = get_num_ues(mod_id); + sf_trigger_msg->n_ul_info = flexran_get_num_ues(mod_id); Protocol__FlexUlInfo **ul_info = NULL; @@ -1023,15 +1023,15 @@ int enb_agent_mac_sf_trigger(mid_t mod_id, const void *params, Protocol__Flexran if(ul_info[i] == NULL) goto error; protocol__flex_ul_info__init(ul_info[i]); - ul_info[i]->rnti = get_ue_crnti(mod_id, i); + ul_info[i]->rnti = flexran_get_ue_crnti(mod_id, i); ul_info[i]->has_rnti = 1; /*Fill in the Tx power control command for this UE (if available)*/ - if(get_tpc(mod_id,i) != 1){ - ul_info[i]->tpc = get_tpc(mod_id,i); + if(flexran_get_tpc(mod_id,i) != 1){ + ul_info[i]->tpc = flexran_get_tpc(mod_id,i); ul_info[i]->has_tpc = 1; } else{ - ul_info[i]->tpc = get_tpc(mod_id,i); + ul_info[i]->tpc = flexran_get_tpc(mod_id,i); ul_info[i]->has_tpc = 0; } /*TODO: fill in the amount of data in bytes in the MAC SDU received in this subframe for the @@ -1081,7 +1081,7 @@ int enb_agent_mac_sf_trigger(mid_t mod_id, const void *params, Protocol__Flexran return -1; } -int enb_agent_mac_destroy_sf_trigger(Protocol__FlexranMessage *msg) { +int flexran_agent_mac_destroy_sf_trigger(Protocol__FlexranMessage *msg) { int i; if(msg->msg_case != PROTOCOL__FLEXRAN_MESSAGE__MSG_SF_TRIGGER_MSG) goto error; @@ -1107,11 +1107,11 @@ int enb_agent_mac_destroy_sf_trigger(Protocol__FlexranMessage *msg) { return -1; } -int enb_agent_mac_create_empty_dl_config(mid_t mod_id, Protocol__FlexranMessage **msg) { +int flexran_agent_mac_create_empty_dl_config(mid_t mod_id, Protocol__FlexranMessage **msg) { int xid = 0; Protocol__FlexHeader *header; - if (flex_create_header(xid, PROTOCOL__FLEX_TYPE__FLPT_DL_MAC_CONFIG, &header) != 0) + if (flexran_create_header(xid, PROTOCOL__FLEX_TYPE__FLPT_DL_MAC_CONFIG, &header) != 0) goto error; Protocol__FlexDlMacConfig *dl_mac_config_msg; @@ -1123,7 +1123,7 @@ int enb_agent_mac_create_empty_dl_config(mid_t mod_id, Protocol__FlexranMessage dl_mac_config_msg->header = header; dl_mac_config_msg->has_sfn_sf = 1; - dl_mac_config_msg->sfn_sf = get_sfn_sf(mod_id); + dl_mac_config_msg->sfn_sf = flexran_get_sfn_sf(mod_id); *msg = malloc(sizeof(Protocol__FlexranMessage)); if(*msg == NULL) @@ -1139,7 +1139,7 @@ int enb_agent_mac_create_empty_dl_config(mid_t mod_id, Protocol__FlexranMessage return -1; } -int enb_agent_mac_destroy_dl_config(Protocol__FlexranMessage *msg) { +int flexran_agent_mac_destroy_dl_config(Protocol__FlexranMessage *msg) { int i,j, k; if(msg->msg_case != PROTOCOL__FLEXRAN_MESSAGE__MSG_DL_MAC_CONFIG_MSG) goto error; @@ -1202,7 +1202,7 @@ int enb_agent_mac_destroy_dl_config(Protocol__FlexranMessage *msg) { return -1; } -void enb_agent_get_pending_dl_mac_config(mid_t mod_id, Protocol__FlexranMessage **msg) { +void flexran_agent_get_pending_dl_mac_config(mid_t mod_id, Protocol__FlexranMessage **msg) { struct lfds700_misc_prng_state ls; @@ -1214,7 +1214,7 @@ void enb_agent_get_pending_dl_mac_config(mid_t mod_id, Protocol__FlexranMessage } } -int enb_agent_mac_handle_dl_mac_config(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg) { +int flexran_agent_mac_handle_dl_mac_config(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg) { struct lfds700_misc_prng_state ls; enum lfds700_misc_flag overwrite_occurred_flag; @@ -1233,7 +1233,7 @@ int enb_agent_mac_handle_dl_mac_config(mid_t mod_id, const void *params, Protoco if (overwrite_occurred_flag == LFDS700_MISC_FLAG_RAISED) { // Delete unmanaged dl_config - enb_agent_mac_destroy_dl_config(overwritten_dl_config); + flexran_agent_mac_destroy_dl_config(overwritten_dl_config); } *msg = NULL; return 2; @@ -1243,7 +1243,7 @@ int enb_agent_mac_handle_dl_mac_config(mid_t mod_id, const void *params, Protoco return -1; } -void enb_agent_init_mac_agent(mid_t mod_id) { +void flexran_agent_init_mac_agent(mid_t mod_id) { lfds700_misc_library_init_valid_on_current_logical_core(); lfds700_misc_prng_init(&ps[mod_id]); int num_elements = RINGBUFFER_SIZE + 1; @@ -1253,10 +1253,10 @@ void enb_agent_init_mac_agent(mid_t mod_id) { } /*********************************************** - * eNB agent - technology mac API implementation + * FlexRAN agent - technology mac API implementation ***********************************************/ -void enb_agent_send_sr_info(mid_t mod_id) { +void flexran_agent_send_sr_info(mid_t mod_id) { int size; Protocol__FlexranMessage *msg; void *data; @@ -1266,27 +1266,27 @@ void enb_agent_send_sr_info(mid_t mod_id) { int xid = 0; /*TODO: Must use a proper xid*/ - err_code = enb_agent_mac_sr_info(mod_id, (void *) &xid, &msg); + err_code = flexran_agent_mac_sr_info(mod_id, (void *) &xid, &msg); if (err_code < 0) { goto error; } if (msg != NULL){ - data=enb_agent_pack_message(msg, &size); + data=flexran_agent_pack_message(msg, &size); /*Send sr info using the MAC channel of the eNB*/ - if (enb_agent_msg_send(mod_id, ENB_AGENT_MAC, data, size, priority)) { + if (flexran_agent_msg_send(mod_id, FLEXRAN_AGENT_MAC, data, size, priority)) { err_code = PROTOCOL__FLEXRAN_ERR__MSG_ENQUEUING; goto error; } - LOG_D(ENB_AGENT,"sent message with size %d\n", size); + LOG_D(FLEXRAN_AGENT,"sent message with size %d\n", size); return; } error: - LOG_D(ENB_AGENT, "Could not send sr message\n"); + LOG_D(FLEXRAN_AGENT, "Could not send sr message\n"); } -void enb_agent_send_sf_trigger(mid_t mod_id) { +void flexran_agent_send_sf_trigger(mid_t mod_id) { int size; Protocol__FlexranMessage *msg; void *data; @@ -1296,27 +1296,27 @@ void enb_agent_send_sf_trigger(mid_t mod_id) { int xid = 0; /*TODO: Must use a proper xid*/ - err_code = enb_agent_mac_sf_trigger(mod_id, (void *) &xid, &msg); + err_code = flexran_agent_mac_sf_trigger(mod_id, (void *) &xid, &msg); if (err_code < 0) { goto error; } if (msg != NULL){ - data=enb_agent_pack_message(msg, &size); + data=flexran_agent_pack_message(msg, &size); /*Send sr info using the MAC channel of the eNB*/ - if (enb_agent_msg_send(mod_id, ENB_AGENT_MAC, data, size, priority)) { + if (flexran_agent_msg_send(mod_id, FLEXRAN_AGENT_MAC, data, size, priority)) { err_code = PROTOCOL__FLEXRAN_ERR__MSG_ENQUEUING; goto error; } - LOG_D(ENB_AGENT,"sent message with size %d\n", size); + LOG_D(FLEXRAN_AGENT,"sent message with size %d\n", size); return; } error: - LOG_D(ENB_AGENT, "Could not send sf trigger message\n"); + LOG_D(FLEXRAN_AGENT, "Could not send sf trigger message\n"); } -void enb_agent_send_update_mac_stats(mid_t mod_id) { +void flexran_agent_send_update_mac_stats(mid_t mod_id) { Protocol__FlexranMessage *current_report = NULL, *msg; void *data; @@ -1333,7 +1333,7 @@ void enb_agent_send_update_mac_stats(mid_t mod_id) { if (mac_stats_context[mod_id].cont_update == 1) { /*Create a fresh report with the required flags*/ - err_code = enb_agent_mac_handle_stats(mod_id, (void *) mac_stats_context[mod_id].stats_req, ¤t_report); + err_code = flexran_agent_mac_handle_stats(mod_id, (void *) mac_stats_context[mod_id].stats_req, ¤t_report); if (err_code < 0) { goto error; } @@ -1343,10 +1343,10 @@ void enb_agent_send_update_mac_stats(mid_t mod_id) { /* *respecting the thresholds. Otherwise send the new report*\/ */ /* if (mac_stats_context[mod_id].prev_stats_reply != NULL) { */ - /* msg = enb_agent_generate_diff_mac_stats_report(current_report, mac_stats_context[mod_id].prev_stats_reply); */ + /* msg = flexran_agent_generate_diff_mac_stats_report(current_report, mac_stats_context[mod_id].prev_stats_reply); */ /* /\*Destroy the old stats*\/ */ - /* enb_agent_destroy_flexran_message(mac_stats_context[mod_id].prev_stats_reply); */ + /* flexran_agent_destroy_flexran_message(mac_stats_context[mod_id].prev_stats_reply); */ /* } */ /* /\*Use the current report for future comparissons*\/ */ /* mac_stats_context[mod_id].prev_stats_reply = current_report; */ @@ -1357,34 +1357,34 @@ void enb_agent_send_update_mac_stats(mid_t mod_id) { } if (current_report != NULL){ - data=enb_agent_pack_message(current_report, &size); + data=flexran_agent_pack_message(current_report, &size); /*Send any stats updates using the MAC channel of the eNB*/ - if (enb_agent_msg_send(mod_id, ENB_AGENT_MAC, data, size, priority)) { + if (flexran_agent_msg_send(mod_id, FLEXRAN_AGENT_MAC, data, size, priority)) { err_code = PROTOCOL__FLEXRAN_ERR__MSG_ENQUEUING; goto error; } - LOG_D(ENB_AGENT,"sent message with size %d\n", size); + LOG_D(FLEXRAN_AGENT,"sent message with size %d\n", size); return; } error: - LOG_D(ENB_AGENT, "Could not send sf trigger message\n"); + LOG_D(FLEXRAN_AGENT, "Could not send sf trigger message\n"); } -int enb_agent_register_mac_xface(mid_t mod_id, AGENT_MAC_xface *xface) { +int flexran_agent_register_mac_xface(mid_t mod_id, AGENT_MAC_xface *xface) { if (mac_agent_registered[mod_id]) { LOG_E(MAC, "MAC agent for eNB %d is already registered\n", mod_id); return -1; } //xface->agent_ctxt = &shared_ctxt[mod_id]; - xface->enb_agent_send_sr_info = enb_agent_send_sr_info; - xface->enb_agent_send_sf_trigger = enb_agent_send_sf_trigger; - xface->enb_agent_send_update_mac_stats = enb_agent_send_update_mac_stats; - //xface->enb_agent_schedule_ue_spec = schedule_ue_spec_default; - xface->enb_agent_schedule_ue_spec = schedule_ue_spec_remote; - xface->enb_agent_get_pending_dl_mac_config = enb_agent_get_pending_dl_mac_config; - xface->enb_agent_notify_ue_state_change = enb_agent_ue_state_change; + xface->flexran_agent_send_sr_info = flexran_agent_send_sr_info; + xface->flexran_agent_send_sf_trigger = flexran_agent_send_sf_trigger; + xface->flexran_agent_send_update_mac_stats = flexran_agent_send_update_mac_stats; + xface->flexran_agent_schedule_ue_spec = flexran_schedule_ue_spec_default; + //xface->flexran_agent_schedule_ue_spec = flexran_schedule_ue_spec_remote; + xface->flexran_agent_get_pending_dl_mac_config = flexran_agent_get_pending_dl_mac_config; + xface->flexran_agent_notify_ue_state_change = flexran_agent_ue_state_change; xface->dl_scheduler_loaded_lib = NULL; @@ -1394,15 +1394,15 @@ int enb_agent_register_mac_xface(mid_t mod_id, AGENT_MAC_xface *xface) { return 0; } -int enb_agent_unregister_mac_xface(mid_t mod_id, AGENT_MAC_xface *xface) { +int flexran_agent_unregister_mac_xface(mid_t mod_id, AGENT_MAC_xface *xface) { //xface->agent_ctxt = NULL; - xface->enb_agent_send_sr_info = NULL; - xface->enb_agent_send_sf_trigger = NULL; - xface->enb_agent_send_update_mac_stats = NULL; - xface->enb_agent_schedule_ue_spec = NULL; - xface->enb_agent_get_pending_dl_mac_config = NULL; - xface->enb_agent_notify_ue_state_change = NULL; + xface->flexran_agent_send_sr_info = NULL; + xface->flexran_agent_send_sf_trigger = NULL; + xface->flexran_agent_send_update_mac_stats = NULL; + xface->flexran_agent_schedule_ue_spec = NULL; + xface->flexran_agent_get_pending_dl_mac_config = NULL; + xface->flexran_agent_notify_ue_state_change = NULL; xface->dl_scheduler_loaded_lib = NULL; @@ -1414,10 +1414,10 @@ int enb_agent_unregister_mac_xface(mid_t mod_id, AGENT_MAC_xface *xface) { /****************************************************** - *Implementations of enb_agent_mac_internal.h functions + *Implementations of flexran_agent_mac_internal.h functions ******************************************************/ -err_code_t enb_agent_init_cont_mac_stats_update(mid_t mod_id) { +err_code_t flexran_agent_init_cont_mac_stats_update(mid_t mod_id) { /*Initialize the Mac stats update structure*/ /*Initially the continuous update is set to false*/ @@ -1437,12 +1437,12 @@ err_code_t enb_agent_init_cont_mac_stats_update(mid_t mod_id) { return -1; } -err_code_t enb_agent_destroy_cont_mac_stats_update(mid_t mod_id) { +err_code_t flexran_agent_destroy_cont_mac_stats_update(mid_t mod_id) { /*Disable the continuous updates for the MAC*/ mac_stats_context[mod_id].cont_update = 0; mac_stats_context[mod_id].is_initialized = 0; - enb_agent_destroy_flexran_message(mac_stats_context[mod_id].stats_req); - enb_agent_destroy_flexran_message(mac_stats_context[mod_id].prev_stats_reply); + flexran_agent_destroy_flexran_message(mac_stats_context[mod_id].stats_req); + flexran_agent_destroy_flexran_message(mac_stats_context[mod_id].prev_stats_reply); free(mac_stats_context[mod_id].mutex); mac_agent_registered[mod_id] = NULL; @@ -1450,8 +1450,8 @@ err_code_t enb_agent_destroy_cont_mac_stats_update(mid_t mod_id) { } -err_code_t enb_agent_enable_cont_mac_stats_update(mid_t mod_id, - xid_t xid, stats_request_config_t *stats_req) { +err_code_t flexran_agent_enable_cont_mac_stats_update(mid_t mod_id, + xid_t xid, stats_request_config_t *stats_req) { /*Enable the continuous updates for the MAC*/ if (pthread_mutex_lock(mac_stats_context[mod_id].mutex)) { goto error; @@ -1459,7 +1459,7 @@ err_code_t enb_agent_enable_cont_mac_stats_update(mid_t mod_id, Protocol__FlexranMessage *req_msg; - enb_agent_mac_stats_request(mod_id, xid, stats_req, &req_msg); + flexran_agent_mac_stats_request(mod_id, xid, stats_req, &req_msg); mac_stats_context[mod_id].stats_req = req_msg; mac_stats_context[mod_id].prev_stats_reply = NULL; @@ -1472,11 +1472,11 @@ err_code_t enb_agent_enable_cont_mac_stats_update(mid_t mod_id, return 0; error: - LOG_E(ENB_AGENT, "mac_stats_context for eNB %d is not initialized\n", mod_id); + LOG_E(FLEXRAN_AGENT, "mac_stats_context for eNB %d is not initialized\n", mod_id); return -1; } -err_code_t enb_agent_disable_cont_mac_stats_update(mid_t mod_id) { +err_code_t flexran_agent_disable_cont_mac_stats_update(mid_t mod_id) { /*Disable the continuous updates for the MAC*/ if (pthread_mutex_lock(mac_stats_context[mod_id].mutex)) { goto error; @@ -1484,10 +1484,10 @@ err_code_t enb_agent_disable_cont_mac_stats_update(mid_t mod_id) { mac_stats_context[mod_id].cont_update = 0; mac_stats_context[mod_id].xid = 0; if (mac_stats_context[mod_id].stats_req != NULL) { - enb_agent_destroy_flexran_message(mac_stats_context[mod_id].stats_req); + flexran_agent_destroy_flexran_message(mac_stats_context[mod_id].stats_req); } if (mac_stats_context[mod_id].prev_stats_reply != NULL) { - enb_agent_destroy_flexran_message(mac_stats_context[mod_id].prev_stats_reply); + flexran_agent_destroy_flexran_message(mac_stats_context[mod_id].prev_stats_reply); } if (pthread_mutex_unlock(mac_stats_context[mod_id].mutex)) { goto error; @@ -1495,7 +1495,7 @@ err_code_t enb_agent_disable_cont_mac_stats_update(mid_t mod_id) { return 0; error: - LOG_E(ENB_AGENT, "mac_stats_context for eNB %d is not initialized\n", mod_id); + LOG_E(FLEXRAN_AGENT, "mac_stats_context for eNB %d is not initialized\n", mod_id); return -1; } diff --git a/openair2/ENB_APP/enb_agent_mac.h b/openair2/ENB_APP/flexran_agent_mac.h similarity index 64% rename from openair2/ENB_APP/enb_agent_mac.h rename to openair2/ENB_APP/flexran_agent_mac.h index 0716b739e5..fbb13ceca9 100644 --- a/openair2/ENB_APP/enb_agent_mac.h +++ b/openair2/ENB_APP/flexran_agent_mac.h @@ -27,23 +27,23 @@ *******************************************************************************/ -/*! \file enb_agent_mac.h - * \brief enb agent message handler APIs for MAC layer +/*! \file flexran_agent_mac.h + * \brief FlexRAN agent message handler APIs for MAC layer * \author Xenofon Foukas, Mohamed Kassem and Navid Nikaein * \date 2016 * \version 0.1 */ -#ifndef ENB_AGENT_MAC_H_ -#define ENB_AGENT_MAC_H_ +#ifndef FLEXRAN_AGENT_MAC_H_ +#define FLEXRAN_AGENT_MAC_H_ #include "header.pb-c.h" #include "flexran.pb-c.h" #include "stats_messages.pb-c.h" #include "stats_common.pb-c.h" -#include "enb_agent_common.h" -#include "enb_agent_extern.h" +#include "flexran_agent_common.h" +#include "flexran_agent_extern.h" /* These types will be used to give instructions for the type of stats reports @@ -77,54 +77,54 @@ typedef struct stats_request_config_s{ } stats_request_config_t; /* Initialization function for the agent structures etc */ -void enb_agent_init_mac_agent(mid_t mod_id); +void flexran_agent_init_mac_agent(mid_t mod_id); -int enb_agent_mac_handle_stats(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg); +int flexran_agent_mac_handle_stats(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg); /* Statistics request protocol message constructor and destructor */ -int enb_agent_mac_stats_request(mid_t mod_id, xid_t xid, const stats_request_config_t *report_config, Protocol__FlexranMessage **msg); -int enb_agent_mac_destroy_stats_request(Protocol__FlexranMessage *msg); +int flexran_agent_mac_stats_request(mid_t mod_id, xid_t xid, const stats_request_config_t *report_config, Protocol__FlexranMessage **msg); +int flexran_agent_mac_destroy_stats_request(Protocol__FlexranMessage *msg); /* Statistics reply protocol message constructor and destructor */ -int enb_agent_mac_stats_reply(mid_t mod_id, xid_t xid, const report_config_t *report_config, Protocol__FlexranMessage **msg); -int enb_agent_mac_destroy_stats_reply(Protocol__FlexranMessage *msg); +int flexran_agent_mac_stats_reply(mid_t mod_id, xid_t xid, const report_config_t *report_config, Protocol__FlexranMessage **msg); +int flexran_agent_mac_destroy_stats_reply(Protocol__FlexranMessage *msg); /* Scheduling request information protocol message constructor and estructor */ -int enb_agent_mac_sr_info(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg); -int enb_agent_mac_destroy_sr_info(Protocol__FlexranMessage *msg); +int flexran_agent_mac_sr_info(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg); +int flexran_agent_mac_destroy_sr_info(Protocol__FlexranMessage *msg); /* Subframe trigger protocol msssage constructor and destructor */ -int enb_agent_mac_sf_trigger(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg); -int enb_agent_mac_destroy_sf_trigger(Protocol__FlexranMessage *msg); +int flexran_agent_mac_sf_trigger(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg); +int flexran_agent_mac_destroy_sf_trigger(Protocol__FlexranMessage *msg); /* DL MAC scheduling decision protocol message constructor (empty command) and destructor */ -int enb_agent_mac_create_empty_dl_config(mid_t mod_id, Protocol__FlexranMessage **msg); -int enb_agent_mac_destroy_dl_config(Protocol__FlexranMessage *msg); +int flexran_agent_mac_create_empty_dl_config(mid_t mod_id, Protocol__FlexranMessage **msg); +int flexran_agent_mac_destroy_dl_config(Protocol__FlexranMessage *msg); -int enb_agent_mac_handle_dl_mac_config(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg); +int flexran_agent_mac_handle_dl_mac_config(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg); /********************************** - * eNB agent - technology mac API + * FlexRAN agent - technology mac API **********************************/ /*Inform controller about received scheduling requests during a subframe*/ -void enb_agent_send_sr_info(mid_t mod_id); +void flexran_agent_send_sr_info(mid_t mod_id); /*Inform the controller about the current UL/DL subframe*/ -void enb_agent_send_sf_trigger(mid_t mod_id); +void flexran_agent_send_sf_trigger(mid_t mod_id); /// Send to the controller all the mac stat updates that occured during this subframe /// based on the stats request configuration -void enb_agent_send_update_mac_stats(mid_t mod_id); +void flexran_agent_send_update_mac_stats(mid_t mod_id); /// Provide to the scheduler a pending dl_mac_config message -void enb_agent_get_pending_dl_mac_config(mid_t mod_id, Protocol__FlexranMessage **msg); +void flexran_agent_get_pending_dl_mac_config(mid_t mod_id, Protocol__FlexranMessage **msg); /*Register technology specific interface callbacks*/ -int enb_agent_register_mac_xface(mid_t mod_id, AGENT_MAC_xface *xface); +int flexran_agent_register_mac_xface(mid_t mod_id, AGENT_MAC_xface *xface); /*Unregister technology specific callbacks*/ -int enb_agent_unregister_mac_xface(mid_t mod_id, AGENT_MAC_xface*xface); +int flexran_agent_unregister_mac_xface(mid_t mod_id, AGENT_MAC_xface*xface); #endif diff --git a/openair2/ENB_APP/enb_agent_mac_defs.h b/openair2/ENB_APP/flexran_agent_mac_defs.h similarity index 75% rename from openair2/ENB_APP/enb_agent_mac_defs.h rename to openair2/ENB_APP/flexran_agent_mac_defs.h index cf473cae7d..e42847c371 100644 --- a/openair2/ENB_APP/enb_agent_mac_defs.h +++ b/openair2/ENB_APP/flexran_agent_mac_defs.h @@ -27,52 +27,52 @@ *******************************************************************************/ -/*! \file enb_agent_mac_defs.h - * \brief enb agent - mac interface primitives +/*! \file flexran_agent_mac_defs.h + * \brief FlexRAN agent - mac interface primitives * \author Xenofon Foukas * \date 2016 * \version 0.1 * \mail x.foukas@sms.ed.ac.uk */ -#ifndef __ENB_AGENT_MAC_PRIMITIVES_H__ -#define __ENB_AGENT_MAC_PRIMITIVES_H__ +#ifndef __FLEXRAN_AGENT_MAC_PRIMITIVES_H__ +#define __FLEXRAN_AGENT_MAC_PRIMITIVES_H__ -#include "enb_agent_defs.h" +#include "flexran_agent_defs.h" #include "flexran.pb-c.h" #include "header.pb-c.h" #define RINGBUFFER_SIZE 100 -/* ENB AGENT-MAC Interface */ +/* FLEXRAN AGENT-MAC Interface */ typedef struct { //msg_context_t *agent_ctxt; /// Inform the controller about the scheduling requests received during the subframe - void (*enb_agent_send_sr_info)(mid_t mod_id); + void (*flexran_agent_send_sr_info)(mid_t mod_id); /// Inform the controller about the current UL/DL subframe - void (*enb_agent_send_sf_trigger)(mid_t mod_id); + void (*flexran_agent_send_sf_trigger)(mid_t mod_id); /// Send to the controller all the mac stat updates that occured during this subframe /// based on the stats request configuration - void (*enb_agent_send_update_mac_stats)(mid_t mod_id); + void (*flexran_agent_send_update_mac_stats)(mid_t mod_id); /// Provide to the scheduler a pending dl_mac_config message - void (*enb_agent_get_pending_dl_mac_config)(mid_t mod_id, - Protocol__FlexranMessage **msg); + void (*flexran_agent_get_pending_dl_mac_config)(mid_t mod_id, + Protocol__FlexranMessage **msg); /// Run the UE DL scheduler and fill the Protocol__FlexranMessage. Assumes that /// dl_info is already initialized as flex_dl_mac_config and fills the /// flex_dl_data part of it - void (*enb_agent_schedule_ue_spec)(mid_t mod_id, uint32_t frame, uint32_t subframe, - int *mbsfn_flag, Protocol__FlexranMessage **dl_info); - + void (*flexran_agent_schedule_ue_spec)(mid_t mod_id, uint32_t frame, uint32_t subframe, + int *mbsfn_flag, Protocol__FlexranMessage **dl_info); + /// Notify the controller for a state change of a particular UE, by sending the proper /// UE state change message (ACTIVATION, DEACTIVATION, HANDOVER) - void (*enb_agent_notify_ue_state_change)(mid_t mod_id, uint32_t rnti, - uint32_t state_change); + void (*flexran_agent_notify_ue_state_change)(mid_t mod_id, uint32_t rnti, + uint32_t state_change); void *dl_scheduler_loaded_lib; diff --git a/openair2/ENB_APP/enb_agent_mac_internal.c b/openair2/ENB_APP/flexran_agent_mac_internal.c similarity index 98% rename from openair2/ENB_APP/enb_agent_mac_internal.c rename to openair2/ENB_APP/flexran_agent_mac_internal.c index b42b3ac79b..7bfed81b48 100644 --- a/openair2/ENB_APP/enb_agent_mac_internal.c +++ b/openair2/ENB_APP/flexran_agent_mac_internal.c @@ -27,7 +27,7 @@ *******************************************************************************/ -/*! \file enb_agent_mac_internal.c +/*! \file flexran_agent_mac_internal.c * \brief Helper functions for the MAC agent * \author Xenofon Foukas * \date 2016 @@ -37,10 +37,10 @@ #include #include -#include "enb_agent_mac_internal.h" +#include "flexran_agent_mac_internal.h" -Protocol__FlexranMessage * enb_agent_generate_diff_mac_stats_report(Protocol__FlexranMessage *new_message, - Protocol__FlexranMessage *old_message) { +Protocol__FlexranMessage * flexran_agent_generate_diff_mac_stats_report(Protocol__FlexranMessage *new_message, + Protocol__FlexranMessage *old_message) { int i, j; @@ -131,7 +131,7 @@ Protocol__FlexranMessage * enb_agent_generate_diff_mac_stats_report(Protocol__Fl /*Create header*/ int xid = old_report->header->xid; Protocol__FlexHeader *header; - if (flex_create_header(xid, PROTOCOL__FLEX_TYPE__FLPT_STATS_REPLY, &header) != 0) { + if (flexran_create_header(xid, PROTOCOL__FLEX_TYPE__FLPT_STATS_REPLY, &header) != 0) { goto error; } stats_reply_msg = malloc(sizeof(Protocol__FlexStatsReply)); @@ -780,7 +780,7 @@ int load_dl_scheduler_function(mid_t mod_id, const char *function_name) { void *loaded_scheduler = dlsym(lib, function_name); if (loaded_scheduler) { if (mac_agent_registered[mod_id]) { - agent_mac_xface[mod_id]->enb_agent_schedule_ue_spec = loaded_scheduler; + agent_mac_xface[mod_id]->flexran_agent_schedule_ue_spec = loaded_scheduler; if (agent_mac_xface[mod_id]->dl_scheduler_loaded_lib != NULL) { dlclose(agent_mac_xface[mod_id]->dl_scheduler_loaded_lib); } diff --git a/openair2/ENB_APP/enb_agent_mac_internal.h b/openair2/ENB_APP/flexran_agent_mac_internal.h similarity index 82% rename from openair2/ENB_APP/enb_agent_mac_internal.h rename to openair2/ENB_APP/flexran_agent_mac_internal.h index 86a021f946..e7a922d503 100644 --- a/openair2/ENB_APP/enb_agent_mac_internal.h +++ b/openair2/ENB_APP/flexran_agent_mac_internal.h @@ -27,23 +27,23 @@ *******************************************************************************/ -/*! \file enb_agent_mac_internal.h - * \brief Implementation specific definitions for the eNB MAC agent +/*! \file flexran_agent_mac_internal.h + * \brief Implementation specific definitions for the FlexRAN MAC agent * \author Xenofon Foukas * \date 2016 * \version 0.1 */ -#ifndef ENB_AGENT_MAC_INTERNAL_H_ -#define ENB_AGENT_MAC_INTERNAL_H_ +#ifndef FLEXRAN_AGENT_MAC_INTERNAL_H_ +#define FLEXRAN_AGENT_MAC_INTERNAL_H_ #include #include -#include "enb_agent_mac.h" -#include "enb_agent_common.h" -#include "enb_agent_defs.h" +#include "flexran_agent_mac.h" +#include "flexran_agent_common.h" +#include "flexran_agent_defs.h" /*This will be used for producing continuous status updates for the MAC *Needs to be thread-safe @@ -64,18 +64,18 @@ mac_stats_updates_context_t mac_stats_context[NUM_MAX_ENB]; /*Functions to initialize and destroy the struct required for the *continuous stats update report*/ -err_code_t enb_agent_init_cont_mac_stats_update(mid_t mod_id); +err_code_t flexran_agent_init_cont_mac_stats_update(mid_t mod_id); -err_code_t enb_agent_destroy_cont_mac_stats_update(mid_t mod_id); +err_code_t flexran_agent_destroy_cont_mac_stats_update(mid_t mod_id); /*Enable/Disable the continuous stats update service for the MAC*/ -err_code_t enb_agent_enable_cont_mac_stats_update(mid_t mod_id, xid_t xid, +err_code_t flexran_agent_enable_cont_mac_stats_update(mid_t mod_id, xid_t xid, stats_request_config_t *stats_req); -err_code_t enb_agent_disable_cont_mac_stats_update(mid_t mod_id); +err_code_t flexran_agent_disable_cont_mac_stats_update(mid_t mod_id); -Protocol__FlexranMessage * enb_agent_generate_diff_mac_stats_report(Protocol__FlexranMessage *new_report, +Protocol__FlexranMessage * flexran_agent_generate_diff_mac_stats_report(Protocol__FlexranMessage *new_report, Protocol__FlexranMessage *old_report); Protocol__FlexUeStatsReport * copy_ue_stats_report(Protocol__FlexUeStatsReport * original); @@ -111,4 +111,4 @@ int parse_dl_scheduler_parameters(mid_t mod_id, yaml_parser_t *parser); int load_dl_scheduler_function(mid_t mod_id, const char *function_name); -#endif /*ENB_AGENT_MAC_INTERNAL_H_*/ +#endif /*FLEXRAN_AGENT_MAC_INTERNAL_H_*/ diff --git a/openair2/ENB_APP/enb_agent_net_comm.c b/openair2/ENB_APP/flexran_agent_net_comm.c similarity index 52% rename from openair2/ENB_APP/enb_agent_net_comm.c rename to openair2/ENB_APP/flexran_agent_net_comm.c index e180d7affd..986c819fb0 100644 --- a/openair2/ENB_APP/enb_agent_net_comm.c +++ b/openair2/ENB_APP/flexran_agent_net_comm.c @@ -27,26 +27,26 @@ *******************************************************************************/ -/*! \file enb_agent_net_comm.c - * \brief enb agent network interface abstraction +/*! \file flexran_agent_net_comm.c + * \brief FlexRAN agent network interface abstraction * \author Xenofon Foukas * \date 2016 * \version 0.1 */ -#include "enb_agent_net_comm.h" +#include "flexran_agent_net_comm.h" #include "log.h" -enb_agent_channel_t *agent_channel[NUM_MAX_ENB][ENB_AGENT_MAX]; -enb_agent_channel_instance_t channel_instance; -int enb_agent_channel_id = 0; +flexran_agent_channel_t *agent_channel[NUM_MAX_ENB][FLEXRAN_AGENT_MAX]; +flexran_agent_channel_instance_t channel_instance; +int flexran_agent_channel_id = 0; -int enb_agent_msg_send(mid_t mod_id, agent_id_t agent_id, void *data, int size, int priority) { +int flexran_agent_msg_send(mid_t mod_id, agent_id_t agent_id, void *data, int size, int priority) { /*Check if agent id is valid*/ - if (agent_id >= ENB_AGENT_MAX || agent_id < 0) { + if (agent_id >= FLEXRAN_AGENT_MAX || agent_id < 0) { goto error; } - enb_agent_channel_t *channel; + flexran_agent_channel_t *channel; channel = agent_channel[mod_id][agent_id]; /*Check if agent has a channel registered*/ @@ -57,16 +57,16 @@ int enb_agent_msg_send(mid_t mod_id, agent_id_t agent_id, void *data, int size, return channel->msg_send(data, size, priority, channel->channel_info); error: - LOG_E(ENB_AGENT, "No channel registered for agent with id %d\n", agent_id); + LOG_E(FLEXRAN_AGENT, "No channel registered for agent with id %d\n", agent_id); return -1; } -int enb_agent_msg_recv(mid_t mod_id, agent_id_t agent_id, void **data, int *size, int *priority) { +int flexran_agent_msg_recv(mid_t mod_id, agent_id_t agent_id, void **data, int *size, int *priority) { /*Check if agent id is valid*/ - if (agent_id >= ENB_AGENT_MAX || agent_id < 0) { + if (agent_id >= FLEXRAN_AGENT_MAX || agent_id < 0) { goto error; } - enb_agent_channel_t *channel; + flexran_agent_channel_t *channel; channel = agent_channel[mod_id][agent_id]; /*Check if agent has a channel registered*/ @@ -77,19 +77,19 @@ int enb_agent_msg_recv(mid_t mod_id, agent_id_t agent_id, void **data, int *size return channel->msg_recv(data, size, priority, channel->channel_info); error: - LOG_E(ENB_AGENT, "No channel registered for agent with id %d\n", agent_id); + LOG_E(FLEXRAN_AGENT, "No channel registered for agent with id %d\n", agent_id); return -1; } -int enb_agent_register_channel(mid_t mod_id, enb_agent_channel_t *channel, agent_id_t agent_id) { +int flexran_agent_register_channel(mid_t mod_id, flexran_agent_channel_t *channel, agent_id_t agent_id) { int i; if (channel == NULL) { return -1; } - if (agent_id == ENB_AGENT_MAX) { - for (i = 0; i < ENB_AGENT_MAX; i++) { + if (agent_id == FLEXRAN_AGENT_MAX) { + for (i = 0; i < FLEXRAN_AGENT_MAX; i++) { agent_channel[mod_id][i] = channel; } } else { @@ -98,11 +98,11 @@ int enb_agent_register_channel(mid_t mod_id, enb_agent_channel_t *channel, agent return 0; } -void enb_agent_unregister_channel(mid_t mod_id, agent_id_t agent_id) { +void flexran_agent_unregister_channel(mid_t mod_id, agent_id_t agent_id) { int i; - if (agent_id == ENB_AGENT_MAX) { - for (i = 0; i < ENB_AGENT_MAX; i++) { + if (agent_id == FLEXRAN_AGENT_MAX) { + for (i = 0; i < FLEXRAN_AGENT_MAX; i++) { agent_channel[mod_id][i] = NULL; } } else { @@ -110,13 +110,13 @@ void enb_agent_unregister_channel(mid_t mod_id, agent_id_t agent_id) { } } -int enb_agent_create_channel(void *channel_info, - int (*msg_send)(void *data, int size, int priority, void *channel_info), - int (*msg_recv)(void **data, int *size, int *priority, void *channel_info), - void (*release)(enb_agent_channel_t *channel)) { +int flexran_agent_create_channel(void *channel_info, + int (*msg_send)(void *data, int size, int priority, void *channel_info), + int (*msg_recv)(void **data, int *size, int *priority, void *channel_info), + void (*release)(flexran_agent_channel_t *channel)) { - int channel_id = ++enb_agent_channel_id; - enb_agent_channel_t *channel = (enb_agent_channel_t *) malloc(sizeof(enb_agent_channel_t)); + int channel_id = ++flexran_agent_channel_id; + flexran_agent_channel_t *channel = (flexran_agent_channel_t *) malloc(sizeof(flexran_agent_channel_t)); channel->channel_id = channel_id; channel->channel_info = channel_info; channel->msg_send = msg_send; @@ -124,22 +124,22 @@ int enb_agent_create_channel(void *channel_info, channel->release = release; /*element should be a real pointer*/ - RB_INSERT(enb_agent_channel_map, &channel_instance.enb_agent_head, channel); + RB_INSERT(flexran_agent_channel_map, &channel_instance.flexran_agent_head, channel); - LOG_I(ENB_AGENT,"Created a new channel with id 0x%lx\n", channel->channel_id); + LOG_I(FLEXRAN_AGENT,"Created a new channel with id 0x%lx\n", channel->channel_id); return channel_id; } -int enb_agent_destroy_channel(int channel_id) { +int flexran_agent_destroy_channel(int channel_id) { int i, j; /*Check to see if channel exists*/ - struct enb_agent_channel_s *e = NULL; - struct enb_agent_channel_s search; - memset(&search, 0, sizeof(struct enb_agent_channel_s)); + struct flexran_agent_channel_s *e = NULL; + struct flexran_agent_channel_s search; + memset(&search, 0, sizeof(struct flexran_agent_channel_s)); - e = RB_FIND(enb_agent_channel_map, &channel_instance.enb_agent_head, &search); + e = RB_FIND(flexran_agent_channel_map, &channel_instance.flexran_agent_head, &search); if (e == NULL) { return -1; @@ -147,7 +147,7 @@ int enb_agent_destroy_channel(int channel_id) { /*Unregister the channel from all agents*/ for (i = 0; i < NUM_MAX_ENB; i++) { - for (j = 0; j < ENB_AGENT_MAX; j++) { + for (j = 0; j < FLEXRAN_AGENT_MAX; j++) { if (agent_channel[i][j] != NULL) { if (agent_channel[i][j]->channel_id == e->channel_id) { agent_channel[i][j] == NULL; @@ -157,21 +157,21 @@ int enb_agent_destroy_channel(int channel_id) { } /*Remove the channel from the tree and free memory*/ - RB_REMOVE(enb_agent_channel_map, &channel_instance.enb_agent_head, e); + RB_REMOVE(flexran_agent_channel_map, &channel_instance.flexran_agent_head, e); e->release(e); free(e); return 0; } -err_code_t enb_agent_init_channel_container(void) { +err_code_t flexran_agent_init_channel_container(void) { int i, j; - LOG_I(ENB_AGENT, "init RB tree for channel container\n"); + LOG_I(FLEXRAN_AGENT, "init RB tree for channel container\n"); - RB_INIT(&channel_instance.enb_agent_head); + RB_INIT(&channel_instance.flexran_agent_head); for (i = 0; i < NUM_MAX_ENB; i++) { - for (j = 0; j < ENB_AGENT_MAX; j++) { + for (j = 0; j < FLEXRAN_AGENT_MAX; j++) { agent_channel[i][j] == NULL; } } @@ -179,9 +179,9 @@ err_code_t enb_agent_init_channel_container(void) { return 0; } -RB_GENERATE(enb_agent_channel_map,enb_agent_channel_s, entry, enb_agent_compare_channel); +RB_GENERATE(flexran_agent_channel_map, flexran_agent_channel_s, entry, flexran_agent_compare_channel); -int enb_agent_compare_channel(struct enb_agent_channel_s *a, struct enb_agent_channel_s *b) { +int flexran_agent_compare_channel(struct flexran_agent_channel_s *a, struct flexran_agent_channel_s *b) { if (a->channel_id < b->channel_id) return -1; if (a->channel_id > b->channel_id) return 1; @@ -189,12 +189,12 @@ int enb_agent_compare_channel(struct enb_agent_channel_s *a, struct enb_agent_ch return 0; } -enb_agent_channel_t * get_channel(int channel_id) { +flexran_agent_channel_t * get_channel(int channel_id) { - struct enb_agent_channel_s search; - memset(&search, 0, sizeof(struct enb_agent_channel_s)); + struct flexran_agent_channel_s search; + memset(&search, 0, sizeof(struct flexran_agent_channel_s)); search.channel_id = channel_id; - return RB_FIND(enb_agent_channel_map, &channel_instance.enb_agent_head, &search); + return RB_FIND(flexran_agent_channel_map, &channel_instance.flexran_agent_head, &search); } diff --git a/openair2/ENB_APP/enb_agent_net_comm.h b/openair2/ENB_APP/flexran_agent_net_comm.h similarity index 54% rename from openair2/ENB_APP/enb_agent_net_comm.h rename to openair2/ENB_APP/flexran_agent_net_comm.h index 2a2268dc80..ca26de7c16 100644 --- a/openair2/ENB_APP/enb_agent_net_comm.h +++ b/openair2/ENB_APP/flexran_agent_net_comm.h @@ -27,63 +27,63 @@ *******************************************************************************/ -/*! \file enb_agent_net_comm.h - * \brief enb agent network interface abstraction +/*! \file flexran_agent_net_comm.h + * \brief FlexRAN agent network interface abstraction * \autho Xenofon Foukas * \date 2016 * \version 0.1 */ -#ifndef ENB_AGENT_NET_COMM_H_ -#define ENB_AGENT_NET_COMM_H_ +#ifndef FLEXRAN_AGENT_NET_COMM_H_ +#define FLEXRAN_AGENT_NET_COMM_H_ -#include "enb_agent_defs.h" +#include "flexran_agent_defs.h" #include "tree.h" /*Channel related information used for Tx/Rx of protocol messages*/ -typedef struct enb_agent_channel_s { - RB_ENTRY(enb_agent_channel_s) entry; +typedef struct flexran_agent_channel_s { + RB_ENTRY(flexran_agent_channel_s) entry; int channel_id; void *channel_info; /*Callbacks for channel message Tx and Rx*/ int (*msg_send)(void *data, int size, int priority, void *channel_info); int (*msg_recv)(void **data, int *size, int *priority, void *channel_info); -void (*release)(struct enb_agent_channel_s *channel); -} enb_agent_channel_t; +void (*release)(struct flexran_agent_channel_s *channel); +} flexran_agent_channel_t; -typedef struct enb_agent_channel_instance_s{ - RB_HEAD(enb_agent_channel_map, enb_agent_channel_s) enb_agent_head; -} enb_agent_channel_instance_t; +typedef struct flexran_agent_channel_instance_s{ + RB_HEAD(flexran_agent_channel_map, flexran_agent_channel_s) flexran_agent_head; +} flexran_agent_channel_instance_t; /*Send and receive messages using the channel registered for a specific agent*/ -int enb_agent_msg_send(mid_t mod_id, agent_id_t agent_id, void *data, int size, int priority); -int enb_agent_msg_recv(mid_t mod_id, agent_id_t agent_id, void **data, int *size, int *priority); +int flexran_agent_msg_send(mid_t mod_id, agent_id_t agent_id, void *data, int size, int priority); +int flexran_agent_msg_recv(mid_t mod_id, agent_id_t agent_id, void **data, int *size, int *priority); -/*Register a channel to an agent. Use ENB_AGENT_MAX to register the +/*Register a channel to an agent. Use FLEXRAN_AGENT_MAX to register the *same channel to all agents*/ -int enb_agent_register_channel(mid_t mod_id, enb_agent_channel_t *channel, agent_id_t agent_id); +int flexran_agent_register_channel(mid_t mod_id, flexran_agent_channel_t *channel, agent_id_t agent_id); -/*Unregister the current channel of an agent. Use ENB_AGENT_MAX to unregister all channels*/ -void enb_agent_unregister_channel(mid_t mod_id, agent_id_t agent_id); +/*Unregister the current channel of an agent. Use FLEXRAN_AGENT_MAX to unregister all channels*/ +void flexran_agent_unregister_channel(mid_t mod_id, agent_id_t agent_id); /*Create a new channel. Returns the id of the new channel or negative number otherwise*/ -int enb_agent_create_channel(void *channel_info, - int (*msg_send)(void *data, int size, int priority, void *channel_info), - int (*msg_recv)(void **data, int *size, int *priority, void *channel_info), - void (*release)(enb_agent_channel_t *channel)); +int flexran_agent_create_channel(void *channel_info, + int (*msg_send)(void *data, int size, int priority, void *channel_info), + int (*msg_recv)(void **data, int *size, int *priority, void *channel_info), + void (*release)(flexran_agent_channel_t *channel)); /*Unregister a channel from all agents and destroy it. Returns 0 in case of success*/ -int enb_agent_destroy_channel(int channel_id); +int flexran_agent_destroy_channel(int channel_id); /*Return an agent communication channel based on its id*/ -enb_agent_channel_t * get_channel(int channel_id); +flexran_agent_channel_t * get_channel(int channel_id); /*Should be called before performing any channel operations*/ -err_code_t enb_agent_init_channel_container(void); +err_code_t flexran_agent_init_channel_container(void); -int enb_agent_compare_channel(struct enb_agent_channel_s *a, struct enb_agent_channel_s *b); +int flexran_agent_compare_channel(struct flexran_agent_channel_s *a, struct flexran_agent_channel_s *b); /* RB_PROTOTYPE is for .h files */ -RB_PROTOTYPE(enb_agent_channel_map, enb_agent_channel_s, entry, enb_agent_compare_channel); +RB_PROTOTYPE(flexran_agent_channel_map, flexran_agent_channel_s, entry, flexran_agent_compare_channel); -#endif /*ENB_AGENT_COMM_H_*/ +#endif /*FLEXRAN_AGENT_COMM_H_*/ diff --git a/openair2/ENB_APP/enb_agent_task_manager.c b/openair2/ENB_APP/flexran_agent_task_manager.c similarity index 74% rename from openair2/ENB_APP/enb_agent_task_manager.c rename to openair2/ENB_APP/flexran_agent_task_manager.c index 9b4be2ff6a..e278386ba4 100644 --- a/openair2/ENB_APP/enb_agent_task_manager.c +++ b/openair2/ENB_APP/flexran_agent_task_manager.c @@ -26,8 +26,8 @@ Address : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE *******************************************************************************/ -/*! \file enb_agent_task_manager.h - * \brief Implementation of scheduled tasks manager for the enb agent +/*! \file flexran_agent_task_manager.h + * \brief Implementation of scheduled tasks manager for the FlexRAN agent * \author Xenofon Foukas * \date January 2016 * \version 0.1 @@ -39,8 +39,8 @@ #include #include -#include "enb_agent_task_manager.h" -#include "enb_agent_common.c" +#include "flexran_agent_task_manager.h" +#include "flexran_agent_common.c" /* Util macros */ @@ -48,10 +48,10 @@ #define RIGHT(x) (2 * (x) + 2) #define PARENT(x) ((x - 1) / 2) -enb_agent_task_t *enb_agent_task_create(Protocol__FlexranMessage *msg, - uint16_t frame_num, uint8_t subframe_num) { - enb_agent_task_t *task = NULL; - task = malloc(sizeof(enb_agent_task_t)); +flexran_agent_task_t *flexran_agent_task_create(Protocol__FlexranMessage *msg, + uint16_t frame_num, uint8_t subframe_num) { + flexran_agent_task_t *task = NULL; + task = malloc(sizeof(flexran_agent_task_t)); if (task == NULL) goto error; @@ -66,7 +66,7 @@ enb_agent_task_t *enb_agent_task_create(Protocol__FlexranMessage *msg, return NULL; } -void enb_agent_task_destroy(enb_agent_task_t *task) { +void flexran_agent_task_destroy(flexran_agent_task_t *task) { if (task == NULL) return; @@ -75,26 +75,27 @@ void enb_agent_task_destroy(enb_agent_task_t *task) { free(task); } -enb_agent_task_queue_t *enb_agent_task_queue_init(mid_t mod_id, size_t capacity, - int (*cmp)(mid_t mod_id, const enb_agent_task_t *t1, const enb_agent_task_t *t2)) { - enb_agent_task_queue_t *queue = NULL; +flexran_agent_task_queue_t *flexran_agent_task_queue_init(mid_t mod_id, size_t capacity, + int (*cmp)(mid_t mod_id, const flexran_agent_task_t *t1, + const flexran_agent_task_t *t2)) { + flexran_agent_task_queue_t *queue = NULL; - queue = malloc(sizeof(enb_agent_task_queue_t)); + queue = malloc(sizeof(flexran_agent_task_queue_t)); if (queue == NULL) goto error; /* If no comparator was given, use the default one */ if (cmp == NULL) - queue->cmp = _enb_agent_task_queue_cmp; + queue->cmp = _flexran_agent_task_queue_cmp; else queue->cmp = cmp; - + queue->mod_id = mod_id; queue->first_frame = 0; queue->first_subframe = 0; - queue->task = malloc(capacity * sizeof(enb_agent_task_t *)); + queue->task = malloc(capacity * sizeof(flexran_agent_task_t *)); if (queue->task == NULL) goto error; @@ -118,27 +119,27 @@ enb_agent_task_queue_t *enb_agent_task_queue_init(mid_t mod_id, size_t capacity, return NULL; } -enb_agent_task_queue_t *enb_agent_task_queue_default_init(mid_t mod_id) { - return enb_agent_task_queue_init(mod_id, DEFAULT_CAPACITY, NULL); +flexran_agent_task_queue_t *flexran_agent_task_queue_default_init(mid_t mod_id) { + return flexran_agent_task_queue_init(mod_id, DEFAULT_CAPACITY, NULL); } -void enb_agent_task_queue_destroy(enb_agent_task_queue_t *queue) { +void flexran_agent_task_queue_destroy(flexran_agent_task_queue_t *queue) { int i; if (queue == NULL) return; for (i = 0; i < queue->count; i++) { - enb_agent_task_destroy(queue->task[i]); + flexran_agent_task_destroy(queue->task[i]); } free(queue->task); free(queue->mutex); free(queue); } -int enb_agent_task_queue_put(enb_agent_task_queue_t *queue, enb_agent_task_t *task) { +int flexran_agent_task_queue_put(flexran_agent_task_queue_t *queue, flexran_agent_task_t *task) { size_t i; - enb_agent_task_t *tmp = NULL; + flexran_agent_task_t *tmp = NULL; int realloc_status, err_code; if (pthread_mutex_lock(queue->mutex)) { @@ -149,7 +150,7 @@ int enb_agent_task_queue_put(enb_agent_task_queue_t *queue, enb_agent_task_t *ta if (queue->count >= queue->capacity) { /*TODO: need to call realloc heap*/ - realloc_status = _enb_agent_task_queue_realloc_heap(queue); + realloc_status = _flexran_agent_task_queue_realloc_heap(queue); if (realloc_status != HEAP_OK) { err_code = realloc_status; goto error; @@ -179,7 +180,7 @@ int enb_agent_task_queue_put(enb_agent_task_queue_t *queue, enb_agent_task_t *ta } -int enb_agent_task_queue_get_current_task(enb_agent_task_queue_t *queue, enb_agent_task_t **task) { +int flexran_agent_task_queue_get_current_task(flexran_agent_task_queue_t *queue, flexran_agent_task_t **task) { int err_code; if (pthread_mutex_lock(queue->mutex)) { @@ -195,8 +196,8 @@ int enb_agent_task_queue_get_current_task(enb_agent_task_queue_t *queue, enb_age } /* Find current frame and subframe number */ - uint16_t curr_frame=get_current_frame(queue->mod_id); - uint8_t curr_subframe=get_current_subframe(queue->mod_id); + uint16_t curr_frame = flexran_get_current_frame(queue->mod_id); + uint8_t curr_subframe = flexran_get_current_subframe(queue->mod_id); /* If no task is scheduled for the current subframe, return without any task */ if(queue->task[0]->frame_num != curr_frame || queue->task[0]->subframe_num != curr_subframe) { @@ -208,7 +209,7 @@ int enb_agent_task_queue_get_current_task(enb_agent_task_queue_t *queue, enb_age queue->task[0] = queue->task[queue->count-1]; queue->count--; /* Restore heap property */ - _enb_agent_task_queue_heapify(queue, 0); + _flexran_agent_task_queue_heapify(queue, 0); /*If queue has no element*/ if (queue->count < 1) { @@ -231,9 +232,9 @@ int enb_agent_task_queue_get_current_task(enb_agent_task_queue_t *queue, enb_age } /*Warning: Internal function. Should not be called as API function. Not thread safe*/ -void _enb_agent_task_queue_heapify(enb_agent_task_queue_t *queue, size_t idx) { +void _flexran_agent_task_queue_heapify(flexran_agent_task_queue_t *queue, size_t idx) { /* left index, right index, largest */ - enb_agent_task_t *tmp = NULL; + flexran_agent_task_t *tmp = NULL; size_t l_idx, r_idx, lrg_idx; l_idx = LEFT(idx); @@ -258,32 +259,32 @@ void _enb_agent_task_queue_heapify(enb_agent_task_queue_t *queue, size_t idx) { queue->task[lrg_idx] = queue->task[idx]; queue->task[idx] = tmp; /* Heapify again */ - _enb_agent_task_queue_heapify(queue, lrg_idx); + _flexran_agent_task_queue_heapify(queue, lrg_idx); } } /*Warning: Internal function. Should not be called as API function. Not thread safe*/ -int _enb_agent_task_queue_realloc_heap(enb_agent_task_queue_t *queue) { - enb_agent_task_t **resized_task_heap; +int _flexran_agent_task_queue_realloc_heap(flexran_agent_task_queue_t *queue) { + flexran_agent_task_t **resized_task_heap; if (queue->count >= queue->capacity) { - size_t task_size = sizeof(enb_agent_task_t); + size_t task_size = sizeof(flexran_agent_task_t); resized_task_heap = realloc(queue->task, (2*queue->capacity) * task_size); if (resized_task_heap != NULL) { queue->capacity *= 2; - queue->task = (enb_agent_task_t **) resized_task_heap; + queue->task = (flexran_agent_task_t **) resized_task_heap; return HEAP_OK; } else return HEAP_REALLOCERROR; } return HEAP_NOREALLOC; } -int _enb_agent_task_queue_cmp(mid_t mod_id, const enb_agent_task_t *t1, const enb_agent_task_t *t2) { +int _flexran_agent_task_queue_cmp(mid_t mod_id, const flexran_agent_task_t *t1, const flexran_agent_task_t *t2) { if ((t1->frame_num == t2->frame_num) && (t1->subframe_num == t2->subframe_num)) return 0; - uint16_t curr_frame = get_current_frame(mod_id); - uint8_t curr_subframe = get_current_subframe(mod_id); + uint16_t curr_frame = flexran_get_current_frame(mod_id); + uint8_t curr_subframe = flexran_get_current_subframe(mod_id); int f_offset, sf_offset, tmp1, tmp2; diff --git a/openair2/ENB_APP/enb_agent_task_manager.h b/openair2/ENB_APP/flexran_agent_task_manager.h similarity index 68% rename from openair2/ENB_APP/enb_agent_task_manager.h rename to openair2/ENB_APP/flexran_agent_task_manager.h index 0c458061cf..9faa0e3db7 100644 --- a/openair2/ENB_APP/enb_agent_task_manager.h +++ b/openair2/ENB_APP/flexran_agent_task_manager.h @@ -26,8 +26,8 @@ Address : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE *******************************************************************************/ -/*! \file enb_agent_task_manager.h - * \brief Implementation of scheduled tasks manager for the enb agent +/*! \file flexran_agent_task_manager.h + * \brief Implementation of scheduled tasks manager for the FlexRAN agent * \author Xenofon Foukas * \date January 2016 * \version 0.1 @@ -35,15 +35,15 @@ * @ingroup _mac */ -#ifndef ENB_AGENT_TASK_MANAGER_ -#define ENB_AGENT_TASK_MANAGER_ +#ifndef FLEXRAN_AGENT_TASK_MANAGER_ +#define FLEXRAN_AGENT_TASK_MANAGER_ #include #include #include "flexran.pb-c.h" -#include "enb_agent_common.h" +#include "flexran_agent_common.h" #ifdef __cplusplus extern "C" { @@ -54,19 +54,19 @@ extern "C" { /** * The structure containing the enb agent task to be executed */ -typedef struct enb_agent_task_s { +typedef struct flexran_agent_task_s { /* The frame in which the task needs to be executed */ uint16_t frame_num; /* The subframe in which the task needs to be executed */ uint8_t subframe_num; /* The task to be executed in the form of a Protocol__FlexranMessage */ Protocol__FlexranMessage *task; -} enb_agent_task_t; +} flexran_agent_task_t; /** * Priority Queue Structure for tasks */ -typedef struct enb_agent_task_queue_s { +typedef struct flexran_agent_task_queue_s { mid_t mod_id; /* The amount of allocated memory for agent tasks in the heap*/ volatile size_t capacity; @@ -77,11 +77,11 @@ typedef struct enb_agent_task_queue_s { /* The earliest subframe within the frame that has a pending task */ volatile uint8_t first_subframe; /* An array of prioritized tasks stored in a heap */ - enb_agent_task_t **task; + flexran_agent_task_t **task; /* A pointer to a comparator function, used to prioritize elements */ - int (*cmp)(mid_t mod_id, const enb_agent_task_t *t1, const enb_agent_task_t *t2); + int (*cmp)(mid_t mod_id, const flexran_agent_task_t *t1, const flexran_agent_task_t *t2); pthread_mutex_t *mutex; -} enb_agent_task_queue_t; +} flexran_agent_task_queue_t; typedef enum { HEAP_OK = 0, @@ -95,56 +95,57 @@ typedef enum { /** * Allocate memory for a task in the queue */ -enb_agent_task_t *enb_agent_task_create(Protocol__FlexranMessage *msg, - uint16_t frame_num, uint8_t subframe_num); +flexran_agent_task_t *flexran_agent_task_create(Protocol__FlexranMessage *msg, + uint16_t frame_num, uint8_t subframe_num); /** * Free memory for a task of the queue */ -void enb_agent_task_destroy(enb_agent_task_t *task); +void flexran_agent_task_destroy(flexran_agent_task_t *task); /** * Allocate initial memory for storing the tasks */ - enb_agent_task_queue_t *enb_agent_task_queue_init(mid_t mod_id, size_t capacity, - int (*cmp)(mid_t mod_id, const enb_agent_task_t *t1, const enb_agent_task_t *t2)); + flexran_agent_task_queue_t *flexran_agent_task_queue_init(mid_t mod_id, size_t capacity, + int (*cmp)(mid_t mod_id, const flexran_agent_task_t *t1, + const flexran_agent_task_t *t2)); /** * Allocate initial memory for storing the tasks using default parameters */ -enb_agent_task_queue_t *enb_agent_task_queue_default_init(mid_t mod_id); +flexran_agent_task_queue_t *flexran_agent_task_queue_default_init(mid_t mod_id); /** * De-allocate memory for the tasks queue */ -void enb_agent_task_queue_destroy(enb_agent_task_queue_t *queue); +void flexran_agent_task_queue_destroy(flexran_agent_task_queue_t *queue); /** * Insert task into the queue */ -int enb_agent_task_queue_put(enb_agent_task_queue_t *queue, enb_agent_task_t *task); +int flexran_agent_task_queue_put(flexran_agent_task_queue_t *queue, flexran_agent_task_t *task); /** * Remove the task with the highest priority from the queue * task becomes NULL if there is no task for the current frame and subframe */ -int enb_agent_task_queue_get_current_task(enb_agent_task_queue_t *queue, enb_agent_task_t **task); +int flexran_agent_task_queue_get_current_task(flexran_agent_task_queue_t *queue, flexran_agent_task_t **task); /** * Check if the top priority task is for a specific frame and subframe */ -int enb_agent_task_queue_has_upcoming_task (enb_agent_task_queue_t *queue, - const uint16_t frame, const uint8_t subframe); +int flexran_agent_task_queue_has_upcoming_task (flexran_agent_task_queue_t *queue, + const uint16_t frame, const uint8_t subframe); /** * Restructure heap after modifications */ -void _enb_agent_task_queue_heapify(enb_agent_task_queue_t *queue, size_t idx); +void _flexran_agent_task_queue_heapify(flexran_agent_task_queue_t *queue, size_t idx); /** * Reallocate memory once the heap reaches max size */ -int _enb_agent_task_queue_realloc_heap(enb_agent_task_queue_t *queue); +int _flexran_agent_task_queue_realloc_heap(flexran_agent_task_queue_t *queue); /** * Compare two agent tasks based on frame and subframe @@ -153,10 +154,10 @@ int _enb_agent_task_queue_realloc_heap(enb_agent_task_queue_t *queue); * return positive value if t1 preceeds t2 * Need to give eNB id for the comparisson based on the current frame-subframe */ - int _enb_agent_task_queue_cmp(mid_t mod_id, const enb_agent_task_t *t1, const enb_agent_task_t *t2); + int _flexran_agent_task_queue_cmp(mid_t mod_id, const flexran_agent_task_t *t1, const flexran_agent_task_t *t2); #ifdef __cplusplus } #endif -#endif /*ENB_AGENT_TASK_MANAGER_*/ +#endif /*FLEXRAN_AGENT_TASK_MANAGER_*/ diff --git a/openair2/LAYER2/MAC/eNB_scheduler.c b/openair2/LAYER2/MAC/eNB_scheduler.c index b57f5e965b..d24ac7c5d9 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler.c +++ b/openair2/LAYER2/MAC/eNB_scheduler.c @@ -53,9 +53,9 @@ #include "pdcp.h" //Agent-related headers -#include "enb_agent_extern.h" -#include "enb_agent_mac.h" -#include "enb_agent_mac_proto.h" +#include "flexran_agent_extern.h" +#include "flexran_agent_mac.h" +#include "flexran_agent_mac_proto.h" #if defined(ENABLE_ITTI) # include "intertask_interface.h" @@ -141,9 +141,9 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, //mac_remove_ue(module_idP, i, frameP, subframeP); //Inform the controller about the UE deactivation. Should be moved to RRC agent in the future if (mac_agent_registered[module_idP]) { - agent_mac_xface[module_idP]->enb_agent_notify_ue_state_change(module_idP, - rnti, - PROTOCOL__FLEX_UE_STATE_CHANGE_TYPE__FLUESC_DEACTIVATED); + agent_mac_xface[module_idP]->flexran_agent_notify_ue_state_change(module_idP, + rnti, + PROTOCOL__FLEX_UE_STATE_CHANGE_TYPE__FLUESC_DEACTIVATED); } } else { @@ -330,7 +330,7 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, /* #ifndef DISABLE_SF_TRIGGER */ /* //Send subframe trigger to the controller */ /* if (mac_agent_registered[module_idP]) { */ -/* agent_mac_xface[module_idP]->enb_agent_send_sf_trigger(module_idP); */ +/* agent_mac_xface[module_idP]->flexran_agent_send_sf_trigger(module_idP); */ /* } */ /* #endif */ @@ -392,19 +392,19 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); #else if (mac_agent_registered[module_idP]) { - agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( - module_idP, - frameP, - subframeP, - mbsfn_status, - &msg); + agent_mac_xface[module_idP]->flexran_agent_schedule_ue_spec( + module_idP, + frameP, + subframeP, + mbsfn_status, + &msg); - apply_dl_scheduling_decisions(module_idP, - frameP, - subframeP, - mbsfn_status, - msg); - enb_agent_mac_destroy_dl_config(msg); + flexran_apply_dl_scheduling_decisions(module_idP, + frameP, + subframeP, + mbsfn_status, + msg); + flexran_agent_mac_destroy_dl_config(msg); } #endif break; @@ -440,19 +440,19 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); #else if (mac_agent_registered[module_idP]) { - agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( - module_idP, - frameP, - subframeP, - mbsfn_status, - &msg); + agent_mac_xface[module_idP]->flexran_agent_schedule_ue_spec( + module_idP, + frameP, + subframeP, + mbsfn_status, + &msg); - apply_dl_scheduling_decisions(module_idP, - frameP, - subframeP, - mbsfn_status, - msg); - enb_agent_mac_destroy_dl_config(msg); + flexran_apply_dl_scheduling_decisions(module_idP, + frameP, + subframeP, + mbsfn_status, + msg); + flexran_agent_mac_destroy_dl_config(msg); } #endif } @@ -470,19 +470,19 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); #else if (mac_agent_registered[module_idP]) { - agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( - module_idP, - frameP, - subframeP, - mbsfn_status, - &msg); + agent_mac_xface[module_idP]->flexran_agent_schedule_ue_spec( + module_idP, + frameP, + subframeP, + mbsfn_status, + &msg); - apply_dl_scheduling_decisions(module_idP, - frameP, - subframeP, - mbsfn_status, - msg); - enb_agent_mac_destroy_dl_config(msg); + flexran_apply_dl_scheduling_decisions(module_idP, + frameP, + subframeP, + mbsfn_status, + msg); + flexran_agent_mac_destroy_dl_config(msg); } #endif } @@ -506,19 +506,19 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); #else if (mac_agent_registered[module_idP]) { - agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( - module_idP, - frameP, - subframeP, - mbsfn_status, - &msg); + agent_mac_xface[module_idP]->flexran_agent_schedule_ue_spec( + module_idP, + frameP, + subframeP, + mbsfn_status, + &msg); - apply_dl_scheduling_decisions(module_idP, - frameP, - subframeP, - mbsfn_status, - msg); - enb_agent_mac_destroy_dl_config(msg); + flexran_apply_dl_scheduling_decisions(module_idP, + frameP, + subframeP, + mbsfn_status, + msg); + flexran_agent_mac_destroy_dl_config(msg); } #endif break; @@ -534,20 +534,20 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); #else if (mac_agent_registered[module_idP]) { - agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( - module_idP, - frameP, - subframeP, - mbsfn_status, - &msg); + agent_mac_xface[module_idP]->flexran_agent_schedule_ue_spec( + module_idP, + frameP, + subframeP, + mbsfn_status, + &msg); - apply_dl_scheduling_decisions(module_idP, - frameP, - subframeP, - mbsfn_status, - msg); - enb_agent_mac_destroy_dl_config(msg); - } + flexran_apply_dl_scheduling_decisions(module_idP, + frameP, + subframeP, + mbsfn_status, + msg); + flexran_agent_mac_destroy_dl_config(msg); + } #endif } @@ -577,19 +577,19 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); #else if (mac_agent_registered[module_idP]) { - agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( - module_idP, - frameP, - subframeP, - mbsfn_status, - &msg); + agent_mac_xface[module_idP]->flexran_agent_schedule_ue_spec( + module_idP, + frameP, + subframeP, + mbsfn_status, + &msg); - apply_dl_scheduling_decisions(module_idP, - frameP, - subframeP, - mbsfn_status, - msg); - enb_agent_mac_destroy_dl_config(msg); + flexran_apply_dl_scheduling_decisions(module_idP, + frameP, + subframeP, + mbsfn_status, + msg); + flexran_agent_mac_destroy_dl_config(msg); } #endif break; @@ -606,19 +606,19 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, fill_DLSCH_dci(module_idP, frameP, subframeP, mbsfn_status); #else if (mac_agent_registered[module_idP]) { - agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( - module_idP, - frameP, - subframeP, - mbsfn_status, - &msg); + agent_mac_xface[module_idP]->flexran_agent_schedule_ue_spec( + module_idP, + frameP, + subframeP, + mbsfn_status, + &msg); - apply_dl_scheduling_decisions(module_idP, - frameP, - subframeP, - mbsfn_status, - msg); - enb_agent_mac_destroy_dl_config(msg); + flexran_apply_dl_scheduling_decisions(module_idP, + frameP, + subframeP, + mbsfn_status, + msg); + flexran_agent_mac_destroy_dl_config(msg); } #endif } @@ -642,19 +642,19 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); #else if (mac_agent_registered[module_idP]) { - agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( - module_idP, - frameP, - subframeP, - mbsfn_status, - &msg); + agent_mac_xface[module_idP]->flexran_agent_schedule_ue_spec( + module_idP, + frameP, + subframeP, + mbsfn_status, + &msg); - apply_dl_scheduling_decisions(module_idP, - frameP, - subframeP, - mbsfn_status, - msg); - enb_agent_mac_destroy_dl_config(msg); + flexran_apply_dl_scheduling_decisions(module_idP, + frameP, + subframeP, + mbsfn_status, + msg); + flexran_agent_mac_destroy_dl_config(msg); } #endif } else if ((mac_xface->frame_parms->tdd_config == 0) || // TDD Config 0 @@ -669,19 +669,19 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); #else if (mac_agent_registered[module_idP]) { - agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( - module_idP, - frameP, - subframeP, - mbsfn_status, - &msg); + agent_mac_xface[module_idP]->flexran_agent_schedule_ue_spec( + module_idP, + frameP, + subframeP, + mbsfn_status, + &msg); - apply_dl_scheduling_decisions(module_idP, - frameP, - subframeP, - mbsfn_status, - msg); - enb_agent_mac_destroy_dl_config(msg); + flexran_apply_dl_scheduling_decisions(module_idP, + frameP, + subframeP, + mbsfn_status, + msg); + flexran_agent_mac_destroy_dl_config(msg); } #endif } @@ -721,19 +721,19 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); #else if (mac_agent_registered[module_idP]) { - agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( - module_idP, - frameP, - subframeP, - mbsfn_status, - &msg); + agent_mac_xface[module_idP]->flexran_agent_schedule_ue_spec( + module_idP, + frameP, + subframeP, + mbsfn_status, + &msg); - apply_dl_scheduling_decisions(module_idP, - frameP, - subframeP, - mbsfn_status, - msg); - enb_agent_mac_destroy_dl_config(msg); + flexran_apply_dl_scheduling_decisions(module_idP, + frameP, + subframeP, + mbsfn_status, + msg); + flexran_agent_mac_destroy_dl_config(msg); } #endif break; @@ -745,19 +745,19 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); #else if (mac_agent_registered[module_idP]) { - agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( - module_idP, - frameP, - subframeP, - mbsfn_status, - &msg); + agent_mac_xface[module_idP]->flexran_agent_schedule_ue_spec( + module_idP, + frameP, + subframeP, + mbsfn_status, + &msg); - apply_dl_scheduling_decisions(module_idP, - frameP, - subframeP, - mbsfn_status, - msg); - enb_agent_mac_destroy_dl_config(msg); + flexran_apply_dl_scheduling_decisions(module_idP, + frameP, + subframeP, + mbsfn_status, + msg); + flexran_agent_mac_destroy_dl_config(msg); } #endif break; @@ -772,19 +772,19 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); #else if (mac_agent_registered[module_idP]) { - agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( - module_idP, - frameP, - subframeP, - mbsfn_status, - &msg); + agent_mac_xface[module_idP]->flexran_agent_schedule_ue_spec( + module_idP, + frameP, + subframeP, + mbsfn_status, + &msg); - apply_dl_scheduling_decisions(module_idP, - frameP, - subframeP, - mbsfn_status, - msg); - enb_agent_mac_destroy_dl_config(msg); + flexran_apply_dl_scheduling_decisions(module_idP, + frameP, + subframeP, + mbsfn_status, + msg); + flexran_agent_mac_destroy_dl_config(msg); } #endif } @@ -805,19 +805,19 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); #else if (mac_agent_registered[module_idP]) { - agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( - module_idP, - frameP, - subframeP, - mbsfn_status, - &msg); + agent_mac_xface[module_idP]->flexran_agent_schedule_ue_spec( + module_idP, + frameP, + subframeP, + mbsfn_status, + &msg); - apply_dl_scheduling_decisions(module_idP, - frameP, - subframeP, - mbsfn_status, - msg); - enb_agent_mac_destroy_dl_config(msg); + flexran_apply_dl_scheduling_decisions(module_idP, + frameP, + subframeP, + mbsfn_status, + msg); + flexran_agent_mac_destroy_dl_config(msg); } #endif break; @@ -828,19 +828,19 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); #else if (mac_agent_registered[module_idP]) { - agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( - module_idP, - frameP, - subframeP, - mbsfn_status, - &msg); + agent_mac_xface[module_idP]->flexran_agent_schedule_ue_spec( + module_idP, + frameP, + subframeP, + mbsfn_status, + &msg); - apply_dl_scheduling_decisions(module_idP, - frameP, - subframeP, - mbsfn_status, - msg); - enb_agent_mac_destroy_dl_config(msg); + flexran_apply_dl_scheduling_decisions(module_idP, + frameP, + subframeP, + mbsfn_status, + msg); + flexran_agent_mac_destroy_dl_config(msg); } #endif break; @@ -855,19 +855,19 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); #else if (mac_agent_registered[module_idP]) { - agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( - module_idP, - frameP, - subframeP, - mbsfn_status, - &msg); + agent_mac_xface[module_idP]->flexran_agent_schedule_ue_spec( + module_idP, + frameP, + subframeP, + mbsfn_status, + &msg); - apply_dl_scheduling_decisions(module_idP, - frameP, - subframeP, - mbsfn_status, - msg); - enb_agent_mac_destroy_dl_config(msg); + flexran_apply_dl_scheduling_decisions(module_idP, + frameP, + subframeP, + mbsfn_status, + msg); + flexran_agent_mac_destroy_dl_config(msg); } #endif } @@ -893,19 +893,19 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); #else if (mac_agent_registered[module_idP]) { - agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( - module_idP, - frameP, - subframeP, - mbsfn_status, - &msg); + agent_mac_xface[module_idP]->flexran_agent_schedule_ue_spec( + module_idP, + frameP, + subframeP, + mbsfn_status, + &msg); - apply_dl_scheduling_decisions(module_idP, - frameP, - subframeP, - mbsfn_status, - msg); - enb_agent_mac_destroy_dl_config(msg); + flexran_apply_dl_scheduling_decisions(module_idP, + frameP, + subframeP, + mbsfn_status, + msg); + flexran_agent_mac_destroy_dl_config(msg); } #endif break; @@ -920,19 +920,19 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); #else if (mac_agent_registered[module_idP]) { - agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( - module_idP, - frameP, - subframeP, - mbsfn_status, - &msg); + agent_mac_xface[module_idP]->flexran_agent_schedule_ue_spec( + module_idP, + frameP, + subframeP, + mbsfn_status, + &msg); - apply_dl_scheduling_decisions(module_idP, - frameP, - subframeP, - mbsfn_status, - msg); - enb_agent_mac_destroy_dl_config(msg); + flexran_apply_dl_scheduling_decisions(module_idP, + frameP, + subframeP, + mbsfn_status, + msg); + flexran_agent_mac_destroy_dl_config(msg); } #endif } @@ -952,19 +952,19 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); #else if (mac_agent_registered[module_idP]) { - agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( - module_idP, - frameP, - subframeP, - mbsfn_status, - &msg); + agent_mac_xface[module_idP]->flexran_agent_schedule_ue_spec( + module_idP, + frameP, + subframeP, + mbsfn_status, + &msg); - apply_dl_scheduling_decisions(module_idP, - frameP, - subframeP, - mbsfn_status, - msg); - enb_agent_mac_destroy_dl_config(msg); + flexran_apply_dl_scheduling_decisions(module_idP, + frameP, + subframeP, + mbsfn_status, + msg); + flexran_agent_mac_destroy_dl_config(msg); } #endif break; @@ -977,19 +977,19 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); #else if (mac_agent_registered[module_idP]) { - agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( - module_idP, - frameP, - subframeP, - mbsfn_status, - &msg); + agent_mac_xface[module_idP]->flexran_agent_schedule_ue_spec( + module_idP, + frameP, + subframeP, + mbsfn_status, + &msg); - apply_dl_scheduling_decisions(module_idP, - frameP, - subframeP, - mbsfn_status, - msg); - enb_agent_mac_destroy_dl_config(msg); + flexran_apply_dl_scheduling_decisions(module_idP, + frameP, + subframeP, + mbsfn_status, + msg); + flexran_agent_mac_destroy_dl_config(msg); } #endif break; @@ -1002,19 +1002,19 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); #else if (mac_agent_registered[module_idP]) { - agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( - module_idP, - frameP, - subframeP, - mbsfn_status, - &msg); + agent_mac_xface[module_idP]->flexran_agent_schedule_ue_spec( + module_idP, + frameP, + subframeP, + mbsfn_status, + &msg); - apply_dl_scheduling_decisions(module_idP, - frameP, - subframeP, - mbsfn_status, - msg); - enb_agent_mac_destroy_dl_config(msg); + flexran_apply_dl_scheduling_decisions(module_idP, + frameP, + subframeP, + mbsfn_status, + msg); + flexran_agent_mac_destroy_dl_config(msg); } #endif break; @@ -1027,19 +1027,19 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); #else if (mac_agent_registered[module_idP]) { - agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( - module_idP, - frameP, - subframeP, - mbsfn_status, - &msg); + agent_mac_xface[module_idP]->flexran_agent_schedule_ue_spec( + module_idP, + frameP, + subframeP, + mbsfn_status, + &msg); - apply_dl_scheduling_decisions(module_idP, - frameP, - subframeP, - mbsfn_status, - msg); - enb_agent_mac_destroy_dl_config(msg); + flexran_apply_dl_scheduling_decisions(module_idP, + frameP, + subframeP, + mbsfn_status, + msg); + flexran_agent_mac_destroy_dl_config(msg); } #endif break; @@ -1054,19 +1054,19 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); #else if (mac_agent_registered[module_idP]) { - agent_mac_xface[module_idP]->enb_agent_schedule_ue_spec( - module_idP, - frameP, - subframeP, - mbsfn_status, - &msg); + agent_mac_xface[module_idP]->flexran_agent_schedule_ue_spec( + module_idP, + frameP, + subframeP, + mbsfn_status, + &msg); - apply_dl_scheduling_decisions(module_idP, - frameP, - subframeP, - mbsfn_status, - msg); - enb_agent_mac_destroy_dl_config(msg); + flexran_apply_dl_scheduling_decisions(module_idP, + frameP, + subframeP, + mbsfn_status, + msg); + flexran_agent_mac_destroy_dl_config(msg); } #endif } @@ -1084,7 +1084,7 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, #ifndef DISABLE_CONT_STATS //Send subframe trigger to the controller if (mac_agent_registered[module_idP]) { - agent_mac_xface[module_idP]->enb_agent_send_update_mac_stats(module_idP); + agent_mac_xface[module_idP]->flexran_agent_send_update_mac_stats(module_idP); } #endif diff --git a/openair2/LAYER2/MAC/enb_agent_mac_proto.h b/openair2/LAYER2/MAC/flexran_agent_mac_proto.h similarity index 68% rename from openair2/LAYER2/MAC/enb_agent_mac_proto.h rename to openair2/LAYER2/MAC/flexran_agent_mac_proto.h index 3c2d36e678..9e46e0904a 100644 --- a/openair2/LAYER2/MAC/enb_agent_mac_proto.h +++ b/openair2/LAYER2/MAC/flexran_agent_mac_proto.h @@ -27,8 +27,8 @@ *******************************************************************************/ -/*! \file enb_agent_mac_proto.h - * \brief MAC functions for eNB agent +/*! \file flexran_agent_mac_proto.h + * \brief MAC functions for FlexRAN agent * \author Xenofon Foukas * \date 2016 * \email: x.foukas@sms.ed.ac.uk @@ -37,34 +37,34 @@ */ -#ifndef __LAYER2_MAC_ENB_AGENT_MAC_PROTO_H__ -#define __LAYER2_MAC_ENB_AGENT_MAC_PROTO_H__ +#ifndef __LAYER2_MAC_FLEXRAN_AGENT_MAC_PROTO_H__ +#define __LAYER2_MAC_FLEXRAN_AGENT_MAC_PROTO_H__ -#include "enb_agent_defs.h" +#include "flexran_agent_defs.h" #include "header.pb-c.h" #include "flexran.pb-c.h" /* * Default scheduler used by the eNB agent */ -void schedule_ue_spec_default(mid_t mod_id, uint32_t frame, uint32_t subframe, - int *mbsfn_flag, Protocol__FlexranMessage **dl_info); +void flexran_schedule_ue_spec_default(mid_t mod_id, uint32_t frame, uint32_t subframe, + int *mbsfn_flag, Protocol__FlexranMessage **dl_info); /* * Data plane function for applying the DL decisions of the scheduler */ -void apply_dl_scheduling_decisions(mid_t mod_id, uint32_t frame, uint32_t subframe, int *mbsfn_flag, - const Protocol__FlexranMessage *dl_scheduling_info); +void flexran_apply_dl_scheduling_decisions(mid_t mod_id, uint32_t frame, uint32_t subframe, int *mbsfn_flag, + const Protocol__FlexranMessage *dl_scheduling_info); /* * Data plane function for applying the UE specific DL decisions of the scheduler */ -void apply_ue_spec_scheduling_decisions(mid_t mod_id, uint32_t frame, uint32_t subframe, int *mbsfn_flag, - uint32_t n_dl_ue_data, const Protocol__FlexDlData **dl_ue_data); +void flexran_apply_ue_spec_scheduling_decisions(mid_t mod_id, uint32_t frame, uint32_t subframe, int *mbsfn_flag, + uint32_t n_dl_ue_data, const Protocol__FlexDlData **dl_ue_data); /* * Data plane function for filling the DCI structure */ -void fill_oai_dci(mid_t mod_id, uint32_t CC_id, uint32_t rnti, const Protocol__FlexDlDci *dl_dci); +void flexran_fill_oai_dci(mid_t mod_id, uint32_t CC_id, uint32_t rnti, const Protocol__FlexDlDci *dl_dci); #endif diff --git a/openair2/LAYER2/MAC/eNB_agent_scheduler_dataplane.c b/openair2/LAYER2/MAC/flexran_agent_scheduler_dataplane.c similarity index 96% rename from openair2/LAYER2/MAC/eNB_agent_scheduler_dataplane.c rename to openair2/LAYER2/MAC/flexran_agent_scheduler_dataplane.c index a4d4d79250..aff196681e 100644 --- a/openair2/LAYER2/MAC/eNB_agent_scheduler_dataplane.c +++ b/openair2/LAYER2/MAC/flexran_agent_scheduler_dataplane.c @@ -27,7 +27,7 @@ *******************************************************************************/ -/*! \file eNB_agent_scheduler_dataplane.c +/*! \file flexran_agent_scheduler_dataplane.c * \brief data plane procedures related to eNB scheduling * \author Xenofon Foukas * \date 2016 @@ -44,7 +44,7 @@ #include "SCHED/defs.h" #include "SCHED/extern.h" -#include "LAYER2/MAC/enb_agent_mac_proto.h" +#include "LAYER2/MAC/flexran_agent_mac_proto.h" #include "LAYER2/MAC/defs.h" #include "LAYER2/MAC/proto.h" #include "LAYER2/MAC/extern.h" @@ -65,11 +65,11 @@ #include "SIMULATION/TOOLS/defs.h" // for taus -void apply_dl_scheduling_decisions(mid_t mod_id, - uint32_t frame, - uint32_t subframe, - int *mbsfn_flag, - const Protocol__FlexranMessage *dl_scheduling_info) { +void flexran_apply_dl_scheduling_decisions(mid_t mod_id, + uint32_t frame, + uint32_t subframe, + int *mbsfn_flag, + const Protocol__FlexranMessage *dl_scheduling_info) { Protocol__FlexDlMacConfig *mac_config = dl_scheduling_info->dl_mac_config_msg; @@ -85,19 +85,19 @@ void apply_dl_scheduling_decisions(mid_t mod_id, // Check if there is anything to schedule for the UEs if (mac_config->n_dl_ue_data > 0) { - apply_ue_spec_scheduling_decisions(mod_id, frame, subframe, mbsfn_flag, - mac_config->n_dl_ue_data, mac_config->dl_ue_data); + flexran_apply_ue_spec_scheduling_decisions(mod_id, frame, subframe, mbsfn_flag, + mac_config->n_dl_ue_data, mac_config->dl_ue_data); } } -void apply_ue_spec_scheduling_decisions(mid_t mod_id, - uint32_t frame, - uint32_t subframe, - int *mbsfn_flag, - uint32_t n_dl_ue_data, - const Protocol__FlexDlData **dl_ue_data) { +void flexran_apply_ue_spec_scheduling_decisions(mid_t mod_id, + uint32_t frame, + uint32_t subframe, + int *mbsfn_flag, + uint32_t n_dl_ue_data, + const Protocol__FlexDlData **dl_ue_data) { uint8_t CC_id; int UE_id; diff --git a/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c b/openair2/LAYER2/MAC/flexran_agent_scheduler_dlsch_ue.c similarity index 98% rename from openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c rename to openair2/LAYER2/MAC/flexran_agent_scheduler_dlsch_ue.c index 4572e73def..cf033959d3 100644 --- a/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue.c +++ b/openair2/LAYER2/MAC/flexran_agent_scheduler_dlsch_ue.c @@ -27,7 +27,7 @@ *******************************************************************************/ -/*! \file eNB_agent_scheduler_dlsch_ue.c +/*! \file flexran_agent_scheduler_dlsch_ue.c * \brief procedures related to eNB for the DLSCH transport channel * \author Xenofon Foukas * \date 2016 @@ -44,7 +44,7 @@ #include "SCHED/defs.h" #include "SCHED/extern.h" -#include "LAYER2/MAC/enb_agent_mac_proto.h" +#include "LAYER2/MAC/flexran_agent_mac_proto.h" #include "LAYER2/MAC/defs.h" #include "LAYER2/MAC/proto.h" #include "LAYER2/MAC/extern.h" @@ -57,14 +57,14 @@ #include "RRC/LITE/extern.h" #include "RRC/L2_INTERFACE/openair_rrc_L2_interface.h" -#include "ENB_APP/enb_agent_defs.h" +#include "ENB_APP/flexran_agent_defs.h" //#include "LAYER2/MAC/pre_processor.c" #include "pdcp.h" #include "header.pb-c.h" #include "flexran.pb-c.h" -#include "enb_agent_mac.h" +#include "flexran_agent_mac.h" #include "SIMULATION/TOOLS/defs.h" // for taus @@ -76,13 +76,11 @@ //------------------------------------------------------------------------------ void -schedule_ue_spec_default( - mid_t mod_id, - uint32_t frame, - uint32_t subframe, - int *mbsfn_flag, - Protocol__FlexranMessage **dl_info -) +flexran_schedule_ue_spec_default(mid_t mod_id, + uint32_t frame, + uint32_t subframe, + int *mbsfn_flag, + Protocol__FlexranMessage **dl_info) //------------------------------------------------------------------------------ { uint8_t CC_id; @@ -127,7 +125,7 @@ schedule_ue_spec_default( uint8_t ue_has_transmission = 0; uint32_t ndi; - enb_agent_mac_create_empty_dl_config(mod_id, dl_info); + flexran_agent_mac_create_empty_dl_config(mod_id, dl_info); if (UE_list->head==-1) { return; diff --git a/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue_remote.c b/openair2/LAYER2/MAC/flexran_agent_scheduler_dlsch_ue_remote.c similarity index 86% rename from openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue_remote.c rename to openair2/LAYER2/MAC/flexran_agent_scheduler_dlsch_ue_remote.c index b5882c84e3..78b093c27d 100644 --- a/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue_remote.c +++ b/openair2/LAYER2/MAC/flexran_agent_scheduler_dlsch_ue_remote.c @@ -27,7 +27,7 @@ *******************************************************************************/ -/*! \file eNB_agent_scheduler_dlsch_ue_remote.c +/*! \file flexran_agent_scheduler_dlsch_ue_remote.c * \brief procedures related to remote scheduling in the DLSCH transport channel * \author Xenofon Foukas * \date 2016 @@ -37,9 +37,9 @@ */ -#include "enb_agent_common_internal.h" +#include "flexran_agent_common_internal.h" -#include "eNB_agent_scheduler_dlsch_ue_remote.h" +#include "flexran_agent_scheduler_dlsch_ue_remote.h" #include "LAYER2/MAC/defs.h" #include "LAYER2/MAC/extern.h" @@ -52,8 +52,8 @@ int queue_initialized = 0; //uint32_t period = 10; //uint32_t sched [] = {1, 2, 3}; -void schedule_ue_spec_remote(mid_t mod_id, uint32_t frame, uint32_t subframe, - int *mbsfn_flag, Protocol__FlexranMessage **dl_info) { +void flexran_schedule_ue_spec_remote(mid_t mod_id, uint32_t frame, uint32_t subframe, + int *mbsfn_flag, Protocol__FlexranMessage **dl_info) { //if ((subframe == skip_subframe) && (frame % period == 0)) { @@ -97,19 +97,19 @@ void schedule_ue_spec_remote(mid_t mod_id, uint32_t frame, uint32_t subframe, } else if (diff < 0) { //previous subframe , delete message and free memory LOG_D(MAC, "Found a decision for a previous subframe in the queue. Let's get rid of it\n"); TAILQ_REMOVE(&queue_head, queue_head.tqh_first, configs); - enb_agent_mac_destroy_dl_config(dl_config_elem->dl_info); + flexran_agent_mac_destroy_dl_config(dl_config_elem->dl_info); free(dl_config_elem); eNB->eNB_stats[mod_id].sched_decisions++; eNB->eNB_stats[mod_id].missed_deadlines++; } else { // next subframe, nothing to do now LOG_D(MAC, "Found a decision for a future subframe in the queue. Nothing to do now\n"); - enb_agent_mac_create_empty_dl_config(mod_id, dl_info); + flexran_agent_mac_create_empty_dl_config(mod_id, dl_info); return; } } //Done with the local cache. Now we need to check if something new arrived - enb_agent_get_pending_dl_mac_config(mod_id, dl_info); + flexran_agent_get_pending_dl_mac_config(mod_id, dl_info); while (*dl_info != NULL) { diff = get_sf_difference(mod_id, (*dl_info)->dl_mac_config_msg->sfn_sf); @@ -119,9 +119,9 @@ void schedule_ue_spec_remote(mid_t mod_id, uint32_t frame, uint32_t subframe, return; } else if (diff < 0) { LOG_D(MAC, "Found a decision for a previous subframe. Let's get rid of it\n"); - enb_agent_mac_destroy_dl_config(*dl_info); + flexran_agent_mac_destroy_dl_config(*dl_info); *dl_info = NULL; - enb_agent_get_pending_dl_mac_config(mod_id, dl_info); + flexran_agent_get_pending_dl_mac_config(mod_id, dl_info); eNB->eNB_stats[mod_id].sched_decisions++; eNB->eNB_stats[mod_id].missed_deadlines++; } else { // Intended for future subframe. Store it in local cache @@ -129,22 +129,22 @@ void schedule_ue_spec_remote(mid_t mod_id, uint32_t frame, uint32_t subframe, dl_mac_config_element_t *e = malloc(sizeof(dl_mac_config_element_t)); e->dl_info = *dl_info; TAILQ_INSERT_TAIL(&queue_head, e, configs); - enb_agent_mac_create_empty_dl_config(mod_id, dl_info); + flexran_agent_mac_create_empty_dl_config(mod_id, dl_info); // No need to look for another. Messages arrive ordered return; } } // We found no pending command, so we will simply pass an empty one - enb_agent_mac_create_empty_dl_config(mod_id, dl_info); + flexran_agent_mac_create_empty_dl_config(mod_id, dl_info); } int get_sf_difference(mid_t mod_id, uint32_t sfn_sf) { int diff_in_subframes; - uint16_t current_frame = get_current_system_frame_num(mod_id); - uint16_t current_subframe = get_current_subframe(mod_id); - uint32_t current_sfn_sf = get_sfn_sf(mod_id); + uint16_t current_frame = flexran_get_current_system_frame_num(mod_id); + uint16_t current_subframe = flexran_get_current_subframe(mod_id); + uint32_t current_sfn_sf = flexran_get_sfn_sf(mod_id); if (sfn_sf == current_sfn_sf) { return 0; diff --git a/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue_remote.h b/openair2/LAYER2/MAC/flexran_agent_scheduler_dlsch_ue_remote.h similarity index 85% rename from openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue_remote.h rename to openair2/LAYER2/MAC/flexran_agent_scheduler_dlsch_ue_remote.h index 9ff750969b..2cfad85771 100644 --- a/openair2/LAYER2/MAC/eNB_agent_scheduler_dlsch_ue_remote.h +++ b/openair2/LAYER2/MAC/flexran_agent_scheduler_dlsch_ue_remote.h @@ -27,7 +27,7 @@ *******************************************************************************/ -/*! \file eNB_agent_scheduler_dlsch_ue_remote.h +/*! \file flexran_agent_scheduler_dlsch_ue_remote.h * \brief Local stub for remote scheduler used by the controller * \author Xenofon Foukas * \date 2016 @@ -37,15 +37,15 @@ */ -#ifndef __LAYER2_MAC_ENB_AGENT_SCHEDULER_DLSCH_UE_REMOTE_H__ -#define __LAYER2_MAC_ENB_AGENT_SCHEDULER_DLSCH_UE_REMOTE_H___ +#ifndef __LAYER2_MAC_FLEXRAN_AGENT_SCHEDULER_DLSCH_UE_REMOTE_H__ +#define __LAYER2_MAC_FLEXRAN_AGENT_SCHEDULER_DLSCH_UE_REMOTE_H___ #include "flexran.pb-c.h" #include "header.pb-c.h" -#include "ENB_APP/enb_agent_defs.h" -#include "enb_agent_mac.h" -#include "LAYER2/MAC/enb_agent_mac_proto.h" +#include "ENB_APP/flexran_agent_defs.h" +#include "flexran_agent_mac.h" +#include "LAYER2/MAC/flexran_agent_mac_proto.h" #include @@ -63,7 +63,7 @@ TAILQ_HEAD(DlMacConfigHead, dl_mac_config_element_s); /* * Default scheduler used by the eNB agent */ -void schedule_ue_spec_remote(mid_t mod_id, uint32_t frame, uint32_t subframe, +void flexran_schedule_ue_spec_remote(mid_t mod_id, uint32_t frame, uint32_t subframe, int *mbsfn_flag, Protocol__FlexranMessage **dl_info); diff --git a/openair2/LAYER2/MAC/flexran_dci_conversions.h b/openair2/LAYER2/MAC/flexran_dci_conversions.h index e9d9494a1a..038290d1b2 100644 --- a/openair2/LAYER2/MAC/flexran_dci_conversions.h +++ b/openair2/LAYER2/MAC/flexran_dci_conversions.h @@ -27,7 +27,7 @@ *******************************************************************************/ -/*! \file dci_conversions.h +/*! \file flexran_dci_conversions.h * \brief Conversion helpers from flexran messages to OAI formats DCI * \author Xenofon Foukas * \date 2016 diff --git a/openair2/RRC/LITE/rrc_eNB.c b/openair2/RRC/LITE/rrc_eNB.c index 2b075a7ed3..3f8e7c5f83 100644 --- a/openair2/RRC/LITE/rrc_eNB.c +++ b/openair2/RRC/LITE/rrc_eNB.c @@ -93,7 +93,7 @@ #include "SIMULATION/TOOLS/defs.h" // for taus -#include "enb_agent_extern.h" +#include "flexran_agent_extern.h" #define XER_PRINT #ifdef PHY_EMUL @@ -4543,7 +4543,7 @@ rrc_eNB_decode_dcch( //WARNING:Inform the controller about the UE activation. Should be moved to RRC agent in the future if (mac_agent_registered[ctxt_pP->module_id]) { - agent_mac_xface[ctxt_pP->eNB_index]->enb_agent_notify_ue_state_change(ctxt_pP->module_id, + agent_mac_xface[ctxt_pP->eNB_index]->flexran_agent_notify_ue_state_change(ctxt_pP->module_id, ue_context_p->ue_id_rnti, PROTOCOL__FLEX_UE_STATE_CHANGE_TYPE__FLUESC_UPDATED); } @@ -4644,7 +4644,7 @@ rrc_eNB_decode_dcch( PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP)); //WARNING:Inform the controller about the UE activation. Should be moved to RRC agent in the future if (mac_agent_registered[ctxt_pP->module_id]) { - agent_mac_xface[ctxt_pP->eNB_index]->enb_agent_notify_ue_state_change(ctxt_pP->module_id, + agent_mac_xface[ctxt_pP->eNB_index]->flexran_agent_notify_ue_state_change(ctxt_pP->module_id, ue_context_p->ue_id_rnti, PROTOCOL__FLEX_UE_STATE_CHANGE_TYPE__FLUESC_ACTIVATED); } diff --git a/openair2/UTIL/LOG/log.c b/openair2/UTIL/LOG/log.c index 0a5b0a8ccd..49f00325f8 100644 --- a/openair2/UTIL/LOG/log.c +++ b/openair2/UTIL/LOG/log.c @@ -325,13 +325,13 @@ int logInit (void) g_log->log_component[ENB_APP].filelog = 0; g_log->log_component[ENB_APP].filelog_name = ""; - g_log->log_component[ENB_AGENT].name = "ENB_AGENT"; - g_log->log_component[ENB_AGENT].level = LOG_DEBUG; - g_log->log_component[ENB_AGENT].flag = LOG_MED; - g_log->log_component[ENB_AGENT].interval = 1; - g_log->log_component[ENB_AGENT].fd = 0; - g_log->log_component[ENB_AGENT].filelog = 0; - g_log->log_component[ENB_AGENT].filelog_name = ""; + g_log->log_component[FLEXRAN_AGENT].name = "FLEXRAN_AGENT"; + g_log->log_component[FLEXRAN_AGENT].level = LOG_DEBUG; + g_log->log_component[FLEXRAN_AGENT].flag = LOG_MED; + g_log->log_component[FLEXRAN_AGENT].interval = 1; + g_log->log_component[FLEXRAN_AGENT].fd = 0; + g_log->log_component[FLEXRAN_AGENT].filelog = 0; + g_log->log_component[FLEXRAN_AGENT].filelog_name = ""; g_log->log_component[TMR].name = "TMR"; g_log->log_component[TMR].level = LOG_EMERG; diff --git a/openair2/UTIL/LOG/log.h b/openair2/UTIL/LOG/log.h index 442fbd749e..6a6569c1a5 100644 --- a/openair2/UTIL/LOG/log.h +++ b/openair2/UTIL/LOG/log.h @@ -270,7 +270,7 @@ typedef enum { RAL_ENB, RAL_UE, ENB_APP, - ENB_AGENT, + FLEXRAN_AGENT, TMR, USIM, LOCALIZE, diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band5.flexran.50PRB.usrpb210.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band5.flexran.50PRB.usrpb210.conf new file mode 100644 index 0000000000..2e39b934e4 --- /dev/null +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band5.flexran.50PRB.usrpb210.conf @@ -0,0 +1,182 @@ +Active_eNBs = ( "eNB_Eurecom_LTEBox"); +# Asn1_verbosity, choice in: none, info, annoying +Asn1_verbosity = "none"; + +eNBs = +( + { + ////////// Identification parameters: + eNB_ID = 0xe00; + + cell_type = "CELL_MACRO_ENB"; + + eNB_name = "eNB_Eurecom_LTEBox"; + + // Tracking area code, 0x0000 and 0xfffe are reserved values + tracking_area_code = "1"; + + mobile_country_code = "208"; + + mobile_network_code = "95"; + + ////////// Physical parameters: + + component_carriers = ( + { + node_function = "eNodeB_3GPP"; + node_timing = "synch_to_ext_device"; + node_synch_ref = 0; + frame_type = "FDD"; + tdd_config = 3; + tdd_config_s = 0; + prefix_type = "NORMAL"; + eutra_band = 5; + downlink_frequency = 879000000L; + uplink_frequency_offset = -45000000; + Nid_cell = 0; + N_RB_DL = 50; + Nid_cell_mbsfn = 0; + nb_antenna_ports = 1; + nb_antennas_tx = 1; + nb_antennas_rx = 1; + tx_gain = 90; + rx_gain = 115; + prach_root = 0; + prach_config_index = 0; + prach_high_speed = "DISABLE"; + prach_zero_correlation = 1; + prach_freq_offset = 2; + pucch_delta_shift = 1; + pucch_nRB_CQI = 1; + pucch_nCS_AN = 0; + pucch_n1_AN = 32; + pdsch_referenceSignalPower = -26; + pdsch_p_b = 0; + pusch_n_SB = 1; + pusch_enable64QAM = "DISABLE"; + pusch_hoppingMode = "interSubFrame"; + pusch_hoppingOffset = 0; + pusch_groupHoppingEnabled = "ENABLE"; + pusch_groupAssignment = 0; + pusch_sequenceHoppingEnabled = "DISABLE"; + pusch_nDMRS1 = 1; + phich_duration = "NORMAL"; + phich_resource = "ONESIXTH"; + srs_enable = "DISABLE"; + /* srs_BandwidthConfig =; + srs_SubframeConfig =; + srs_ackNackST =; + srs_MaxUpPts =;*/ + + pusch_p0_Nominal = -90; + pusch_alpha = "AL1"; + pucch_p0_Nominal = -108; + msg3_delta_Preamble = 6; + pucch_deltaF_Format1 = "deltaF2"; + pucch_deltaF_Format1b = "deltaF3"; + pucch_deltaF_Format2 = "deltaF0"; + pucch_deltaF_Format2a = "deltaF0"; + pucch_deltaF_Format2b = "deltaF0"; + + rach_numberOfRA_Preambles = 64; + rach_preamblesGroupAConfig = "DISABLE"; + /* + rach_sizeOfRA_PreamblesGroupA = ; + rach_messageSizeGroupA = ; + rach_messagePowerOffsetGroupB = ; + */ + rach_powerRampingStep = 4; + rach_preambleInitialReceivedTargetPower = -108; + rach_preambleTransMax = 10; + rach_raResponseWindowSize = 10; + rach_macContentionResolutionTimer = 48; + rach_maxHARQ_Msg3Tx = 4; + + pcch_default_PagingCycle = 128; + pcch_nB = "oneT"; + bcch_modificationPeriodCoeff = 2; + ue_TimersAndConstants_t300 = 1000; + ue_TimersAndConstants_t301 = 1000; + ue_TimersAndConstants_t310 = 1000; + ue_TimersAndConstants_t311 = 10000; + ue_TimersAndConstants_n310 = 20; + ue_TimersAndConstants_n311 = 1; + + ue_TransmissionMode = 1; + } + ); + + srb1_parameters : + { + # timer_poll_retransmit = (ms) [5, 10, 15, 20,... 250, 300, 350, ... 500] + timer_poll_retransmit = 80; + + # timer_reordering = (ms) [0,5, ... 100, 110, 120, ... ,200] + timer_reordering = 35; + + # timer_reordering = (ms) [0,5, ... 250, 300, 350, ... ,500] + timer_status_prohibit = 0; + + # poll_pdu = [4, 8, 16, 32 , 64, 128, 256, infinity(>10000)] + poll_pdu = 4; + + # poll_byte = (kB) [25,50,75,100,125,250,375,500,750,1000,1250,1500,2000,3000,infinity(>10000)] + poll_byte = 99999; + + # max_retx_threshold = [1, 2, 3, 4 , 6, 8, 16, 32] + max_retx_threshold = 4; + } + + # ------- SCTP definitions + SCTP : + { + # Number of streams to use in input/output + SCTP_INSTREAMS = 2; + SCTP_OUTSTREAMS = 2; + }; + + ////////// MME parameters: + mme_ip_address = ( { ipv4 = "192.168.100.101"; + ipv6 = "192:168:100::17"; + active = "yes"; + preference = "ipv4"; + } + ); + + NETWORK_INTERFACES : + { + ENB_INTERFACE_NAME_FOR_S1_MME = "eth0"; + ENB_IPV4_ADDRESS_FOR_S1_MME = "192.168.100.106/24"; + + ENB_INTERFACE_NAME_FOR_S1U = "eth0"; + ENB_IPV4_ADDRESS_FOR_S1U = "192.168.100.106/24"; + ENB_PORT_FOR_S1U = 2152; # Spec 2152 + }; + + NETWORK_CONTROLLER : + { + FLEXRAN_AGENT_INTERFACE_NAME = "eth1"; + FLEXRAN_AGENT_IPV4_ADDRESS = "10.0.2.5/30"; + FLEXRAN_AGENT_PORT = 2210; + FLEXRAN_AGENT_CACHE = "/mnt/oai_agent_cache"; + }; + + log_config : + { + global_log_level ="info"; + global_log_verbosity ="medium"; + hw_log_level ="info"; + hw_log_verbosity ="medium"; + phy_log_level ="info"; + phy_log_verbosity ="medium"; + mac_log_level ="info"; + mac_log_verbosity ="high"; + rlc_log_level ="info"; + rlc_log_verbosity ="medium"; + pdcp_log_level ="info"; + pdcp_log_verbosity ="medium"; + rrc_log_level ="info"; + rrc_log_verbosity ="medium"; + }; + } +); diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band5.flexran.usrpb210.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band5.flexran.usrpb210.conf new file mode 100644 index 0000000000..66e7ef433d --- /dev/null +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band5.flexran.usrpb210.conf @@ -0,0 +1,182 @@ +Active_eNBs = ( "eNB_Eurecom_LTEBox"); +# Asn1_verbosity, choice in: none, info, annoying +Asn1_verbosity = "none"; + +eNBs = +( + { + ////////// Identification parameters: + eNB_ID = 0xe00; + + cell_type = "CELL_MACRO_ENB"; + + eNB_name = "eNB_Eurecom_LTEBox"; + + // Tracking area code, 0x0000 and 0xfffe are reserved values + tracking_area_code = "1"; + + mobile_country_code = "208"; + + mobile_network_code = "95"; + + ////////// Physical parameters: + + component_carriers = ( + { + node_function = "eNodeB_3GPP"; + node_timing = "synch_to_ext_device"; + node_synch_ref = 0; + frame_type = "FDD"; + tdd_config = 3; + tdd_config_s = 0; + prefix_type = "NORMAL"; + eutra_band = 5; + downlink_frequency = 879000000L; + uplink_frequency_offset = -45000000; + Nid_cell = 0; + N_RB_DL = 25; + Nid_cell_mbsfn = 0; + nb_antenna_ports = 1; + nb_antennas_tx = 1; + nb_antennas_rx = 1; + tx_gain = 90; + rx_gain = 115; + prach_root = 0; + prach_config_index = 0; + prach_high_speed = "DISABLE"; + prach_zero_correlation = 1; + prach_freq_offset = 2; + pucch_delta_shift = 1; + pucch_nRB_CQI = 1; + pucch_nCS_AN = 0; + pucch_n1_AN = 32; + pdsch_referenceSignalPower = -26; + pdsch_p_b = 0; + pusch_n_SB = 1; + pusch_enable64QAM = "DISABLE"; + pusch_hoppingMode = "interSubFrame"; + pusch_hoppingOffset = 0; + pusch_groupHoppingEnabled = "ENABLE"; + pusch_groupAssignment = 0; + pusch_sequenceHoppingEnabled = "DISABLE"; + pusch_nDMRS1 = 1; + phich_duration = "NORMAL"; + phich_resource = "ONESIXTH"; + srs_enable = "DISABLE"; + /* srs_BandwidthConfig =; + srs_SubframeConfig =; + srs_ackNackST =; + srs_MaxUpPts =;*/ + + pusch_p0_Nominal = -90; + pusch_alpha = "AL1"; + pucch_p0_Nominal = -108; + msg3_delta_Preamble = 6; + pucch_deltaF_Format1 = "deltaF2"; + pucch_deltaF_Format1b = "deltaF3"; + pucch_deltaF_Format2 = "deltaF0"; + pucch_deltaF_Format2a = "deltaF0"; + pucch_deltaF_Format2b = "deltaF0"; + + rach_numberOfRA_Preambles = 64; + rach_preamblesGroupAConfig = "DISABLE"; + /* + rach_sizeOfRA_PreamblesGroupA = ; + rach_messageSizeGroupA = ; + rach_messagePowerOffsetGroupB = ; + */ + rach_powerRampingStep = 4; + rach_preambleInitialReceivedTargetPower = -108; + rach_preambleTransMax = 10; + rach_raResponseWindowSize = 10; + rach_macContentionResolutionTimer = 48; + rach_maxHARQ_Msg3Tx = 4; + + pcch_default_PagingCycle = 128; + pcch_nB = "oneT"; + bcch_modificationPeriodCoeff = 2; + ue_TimersAndConstants_t300 = 1000; + ue_TimersAndConstants_t301 = 1000; + ue_TimersAndConstants_t310 = 1000; + ue_TimersAndConstants_t311 = 10000; + ue_TimersAndConstants_n310 = 20; + ue_TimersAndConstants_n311 = 1; + + ue_TransmissionMode = 1; + } + ); + + srb1_parameters : + { + # timer_poll_retransmit = (ms) [5, 10, 15, 20,... 250, 300, 350, ... 500] + timer_poll_retransmit = 80; + + # timer_reordering = (ms) [0,5, ... 100, 110, 120, ... ,200] + timer_reordering = 35; + + # timer_reordering = (ms) [0,5, ... 250, 300, 350, ... ,500] + timer_status_prohibit = 0; + + # poll_pdu = [4, 8, 16, 32 , 64, 128, 256, infinity(>10000)] + poll_pdu = 4; + + # poll_byte = (kB) [25,50,75,100,125,250,375,500,750,1000,1250,1500,2000,3000,infinity(>10000)] + poll_byte = 99999; + + # max_retx_threshold = [1, 2, 3, 4 , 6, 8, 16, 32] + max_retx_threshold = 4; + } + + # ------- SCTP definitions + SCTP : + { + # Number of streams to use in input/output + SCTP_INSTREAMS = 2; + SCTP_OUTSTREAMS = 2; + }; + + ////////// MME parameters: + mme_ip_address = ( { ipv4 = "192.168.100.101"; + ipv6 = "192:168:100::17"; + active = "yes"; + preference = "ipv4"; + } + ); + + NETWORK_INTERFACES : + { + ENB_INTERFACE_NAME_FOR_S1_MME = "eth0"; + ENB_IPV4_ADDRESS_FOR_S1_MME = "192.168.100.106/24"; + + ENB_INTERFACE_NAME_FOR_S1U = "eth0"; + ENB_IPV4_ADDRESS_FOR_S1U = "192.168.100.106/24"; + ENB_PORT_FOR_S1U = 2152; # Spec 2152 + }; + + NETWORK_CONTROLLER : + { + FLEXRAN_AGENT_INTERFACE_NAME = "eth1"; + FLEXRAN_AGENT_IPV4_ADDRESS = "10.0.2.5/30"; + FLEXRAN_AGENT_PORT = 2210; + FLEXRAN_AGENT_CACHE = "/mnt/oai_agent_cache"; + }; + + log_config : + { + global_log_level ="info"; + global_log_verbosity ="medium"; + hw_log_level ="info"; + hw_log_verbosity ="medium"; + phy_log_level ="info"; + phy_log_verbosity ="medium"; + mac_log_level ="info"; + mac_log_verbosity ="high"; + rlc_log_level ="info"; + rlc_log_verbosity ="medium"; + pdcp_log_level ="info"; + pdcp_log_verbosity ="medium"; + rrc_log_level ="info"; + rrc_log_verbosity ="medium"; + }; + } +); diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.flexran.50PRB.usrpb210.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.flexran.50PRB.usrpb210.conf index f73a78b3b0..7e68b5d84b 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.flexran.50PRB.usrpb210.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.flexran.50PRB.usrpb210.conf @@ -155,10 +155,10 @@ eNBs = NETWORK_CONTROLLER : { - ENB_AGENT_INTERFACE_NAME = "eth1"; - ENB_AGENT_IPV4_ADDRESS = "10.0.2.5/30"; - ENB_AGENT_PORT = 2210; - ENB_AGENT_CACHE = "/mnt/oai_agent_cache"; + FLEXRAN_AGENT_INTERFACE_NAME = "eth1"; + FLEXRAN_AGENT_IPV4_ADDRESS = "10.0.2.5/30"; + FLEXRAN_AGENT_PORT = 2210; + FLEXRAN_AGENT_CACHE = "/mnt/oai_agent_cache"; }; log_config : diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.flexran.usrpb210.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.flexran.usrpb210.conf index e5bd9455e3..4ee429f45e 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.flexran.usrpb210.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.flexran.usrpb210.conf @@ -155,10 +155,10 @@ eNBs = NETWORK_CONTROLLER : { - ENB_AGENT_INTERFACE_NAME = "eth1"; - ENB_AGENT_IPV4_ADDRESS = "10.0.2.5/30"; - ENB_AGENT_PORT = 2210; - ENB_AGENT_CACHE = "/mnt/oai_agent_cache"; + FLEXRAN_AGENT_INTERFACE_NAME = "eth1"; + FLEXRAN_AGENT_IPV4_ADDRESS = "10.0.2.5/30"; + FLEXRAN_AGENT_PORT = 2210; + FLEXRAN_AGENT_CACHE = "/mnt/oai_agent_cache"; }; log_config : diff --git a/targets/SIMU/USER/oaisim.c b/targets/SIMU/USER/oaisim.c index 438f1f9efd..9253c2c50d 100644 --- a/targets/SIMU/USER/oaisim.c +++ b/targets/SIMU/USER/oaisim.c @@ -75,8 +75,8 @@ uint8_t config_smbv = 0; char smbv_ip[16]; #endif -#if defined(ENB_AGENT_SB_IF) -# include "enb_agent.h" +#if defined(FLEXRAN_AGENT_SB_IF) +# include "flexran_agent.h" #endif @@ -1301,8 +1301,8 @@ main (int argc, char **argv) smbv_write_config_from_frame_parms(smbv_fname, &PHY_vars_eNB_g[0][0]->frame_parms); #endif - /* #if defined (ENB_AGENT_SB_IF) - enb_agent_start(); + /* #if defined (FLEXRAN_AGENT_SB_IF) + flexran_agent_start(); #endif */ // add events to future event list: Currently not used From 92ef1739b1526c1af72b54198089b468b4ad99b8 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Fri, 4 Nov 2016 17:36:45 +0200 Subject: [PATCH 257/349] Restructured FlexRAN agent file hierarchy --- cmake_targets/CMakeLists.txt | 5 +++-- openair1/SCHED/phy_procedures_lte_eNb.c | 2 +- .../ENB_APP/{ => CONTROL_MODULES/MAC}/flexran_agent_mac.c | 0 .../ENB_APP/{ => CONTROL_MODULES/MAC}/flexran_agent_mac.h | 0 .../{ => CONTROL_MODULES/MAC}/flexran_agent_mac_defs.h | 0 .../{ => CONTROL_MODULES/MAC}/flexran_agent_mac_internal.c | 0 .../{ => CONTROL_MODULES/MAC}/flexran_agent_mac_internal.h | 0 7 files changed, 4 insertions(+), 3 deletions(-) rename openair2/ENB_APP/{ => CONTROL_MODULES/MAC}/flexran_agent_mac.c (100%) rename openair2/ENB_APP/{ => CONTROL_MODULES/MAC}/flexran_agent_mac.h (100%) rename openair2/ENB_APP/{ => CONTROL_MODULES/MAC}/flexran_agent_mac_defs.h (100%) rename openair2/ENB_APP/{ => CONTROL_MODULES/MAC}/flexran_agent_mac_internal.c (100%) rename openair2/ENB_APP/{ => CONTROL_MODULES/MAC}/flexran_agent_mac_internal.h (100%) diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index 8f696ed653..da90efdaee 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -817,6 +817,7 @@ include_directories("${OPENAIR_DIR}/targets/ARCH/COMMON") include_directories("${OPENAIR_DIR}/targets/ARCH/EXMIMO/USERSPACE/LIB/") include_directories("${OPENAIR_DIR}/targets/ARCH/EXMIMO/DEFS") include_directories("${OPENAIR2_DIR}/ENB_APP") +include_directories("${OPENAIR2_DIR}/ENB_APP/CONTROL_MODULES/MAC") include_directories("${OPENAIR2_DIR}/UTIL/OSA") include_directories("${OPENAIR2_DIR}/UTIL/LFDS/liblfds6.1.1/liblfds611/inc") include_directories("${OPENAIR2_DIR}/UTIL/LFDS/liblfds7.0.0/liblfds700/inc") @@ -903,12 +904,12 @@ if (FLEXRAN_AGENT_SB_IF) ${OPENAIR2_DIR}/ENB_APP/flexran_agent_handler.c ${OPENAIR2_DIR}/ENB_APP/flexran_agent_common.c ${OPENAIR2_DIR}/ENB_APP/flexran_agent_common_internal.c - ${OPENAIR2_DIR}/ENB_APP/flexran_agent_mac.c + ${OPENAIR2_DIR}/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c ${OPENAIR2_DIR}/ENB_APP/flexran_agent.c ${OPENAIR2_DIR}/ENB_APP/flexran_agent_task_manager.c ${OPENAIR2_DIR}/ENB_APP/flexran_agent_net_comm.c ${OPENAIR2_DIR}/ENB_APP/flexran_agent_async.c - ${OPENAIR2_DIR}/ENB_APP/flexran_agent_mac_internal.c + ${OPENAIR2_DIR}/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac_internal.c ) set(FLEXRAN_AGENT_LIB FLEXRAN_AGENT) #include_directories(${OPENAIR2_DIR}/ENB_APP) diff --git a/openair1/SCHED/phy_procedures_lte_eNb.c b/openair1/SCHED/phy_procedures_lte_eNb.c index b5fd7efd70..d6f5a40da7 100644 --- a/openair1/SCHED/phy_procedures_lte_eNb.c +++ b/openair1/SCHED/phy_procedures_lte_eNb.c @@ -64,7 +64,7 @@ //Agent-related headers #include "ENB_APP/flexran_agent_extern.h" -#include "ENB_APP/flexran_agent_mac.h" +#include "ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.h" #include "LAYER2/MAC/flexran_agent_mac_proto.h" //#define DIAG_PHY diff --git a/openair2/ENB_APP/flexran_agent_mac.c b/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c similarity index 100% rename from openair2/ENB_APP/flexran_agent_mac.c rename to openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c diff --git a/openair2/ENB_APP/flexran_agent_mac.h b/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.h similarity index 100% rename from openair2/ENB_APP/flexran_agent_mac.h rename to openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.h diff --git a/openair2/ENB_APP/flexran_agent_mac_defs.h b/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac_defs.h similarity index 100% rename from openair2/ENB_APP/flexran_agent_mac_defs.h rename to openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac_defs.h diff --git a/openair2/ENB_APP/flexran_agent_mac_internal.c b/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac_internal.c similarity index 100% rename from openair2/ENB_APP/flexran_agent_mac_internal.c rename to openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac_internal.c diff --git a/openair2/ENB_APP/flexran_agent_mac_internal.h b/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac_internal.h similarity index 100% rename from openair2/ENB_APP/flexran_agent_mac_internal.h rename to openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac_internal.h From 5864cc08cdad829039bb80465fe27603ba092626 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Fri, 4 Nov 2016 17:49:39 +0200 Subject: [PATCH 258/349] Integrated scheduler to overall FlexRAN agent functionality --- openair2/LAYER2/MAC/eNB_scheduler.c | 56 ++++++++++++++--------------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/openair2/LAYER2/MAC/eNB_scheduler.c b/openair2/LAYER2/MAC/eNB_scheduler.c index d24ac7c5d9..386efec596 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler.c +++ b/openair2/LAYER2/MAC/eNB_scheduler.c @@ -63,7 +63,7 @@ #define ENABLE_MAC_PAYLOAD_DEBUG #define DEBUG_eNB_SCHEDULER 1 -#define ENABLE_ENB_AGENT_DL_SCHEDULER +//efine ENABLE_ENB_AGENT_DL_SCHEDULER //#define DISABLE_SF_TRIGGER //#define DISABLE_CONT_STATS @@ -387,7 +387,7 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, (mac_xface->frame_parms->tdd_config == 6)) { //schedule_ulsch(module_idP,frameP,cooperation_flag,subframeP,4);//,calibration_flag); } -#ifndef ENABLE_ENB_AGENT_DL_SCHEDULER +#ifndef FLEXRAN_AGENT_SB_IF schedule_ue_spec(module_idP,frameP,subframeP,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); #else @@ -418,14 +418,14 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, case 0: case 1: schedule_ulsch(module_idP,frameP,cooperation_flag,subframeP,7); -#ifndef ENABLE_ENB_AGENT_DL_SCHEDULER +#ifndef FLEXRAN_AGENT_SB_IF fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); #endif break; case 6: schedule_ulsch(module_idP,frameP,cooperation_flag,subframeP,8); -#ifndef ENABLE_ENB_AGENT_DL_SCHEDULER +#ifndef FLEXRAN_AGENT_SB_IF fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); #endif break; @@ -435,7 +435,7 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, } } else { //FDD schedule_ulsch(module_idP,frameP,cooperation_flag,1,5); -#ifndef ENABLE_ENB_AGENT_DL_SCHEDULER +#ifndef FLEXRAN_AGENT_SB_IF schedule_ue_spec(module_idP,frameP,subframeP,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); #else @@ -465,7 +465,7 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, // FDD, normal UL/DLSCH if (mac_xface->frame_parms->frame_type == FDD) { //FDD schedule_ulsch(module_idP,frameP,cooperation_flag,2,6); -#ifndef ENABLE_ENB_AGENT_DL_SCHEDULER +#ifndef FLEXRAN_AGENT_SB_IF schedule_ue_spec(module_idP,frameP,subframeP,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); #else @@ -501,7 +501,7 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, // no break here! case 5: -#ifndef ENABLE_ENB_AGENT_DL_SCHEDULER +#ifndef FLEXRAN_AGENT_SB_IF schedule_ue_spec(module_idP,frameP,subframeP,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); #else @@ -529,7 +529,7 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, } else { //FDD schedule_ulsch(module_idP,frameP,cooperation_flag,3,7); -#ifndef ENABLE_ENB_AGENT_DL_SCHEDULER +#ifndef FLEXRAN_AGENT_SB_IF schedule_ue_spec(module_idP,frameP,subframeP,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); #else @@ -572,7 +572,7 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, // no break here! case 5: -#ifndef ENABLE_ENB_AGENT_DL_SCHEDULER +#ifndef FLEXRAN_AGENT_SB_IF schedule_ue_spec(module_idP,frameP,subframeP,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); #else @@ -601,7 +601,7 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, if (mac_xface->frame_parms->frame_type == FDD) { //FDD schedule_ulsch(module_idP, frameP, cooperation_flag, 4, 8); -#ifndef ENABLE_ENB_AGENT_DL_SCHEDULER +#ifndef FLEXRAN_AGENT_SB_IF schedule_ue_spec(module_idP, frameP, subframeP, mbsfn_status); fill_DLSCH_dci(module_idP, frameP, subframeP, mbsfn_status); #else @@ -637,7 +637,7 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, if (mac_xface->frame_parms->frame_type == FDD) { schedule_RA(module_idP,frameP,subframeP,1); schedule_ulsch(module_idP,frameP,cooperation_flag,5,9); -#ifndef ENABLE_ENB_AGENT_DL_SCHEDULER +#ifndef FLEXRAN_AGENT_SB_IF schedule_ue_spec(module_idP, frameP, subframeP, mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); #else @@ -660,11 +660,11 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, } else if ((mac_xface->frame_parms->tdd_config == 0) || // TDD Config 0 (mac_xface->frame_parms->tdd_config == 6)) { // TDD Config 6 //schedule_ulsch(module_idP,cooperation_flag,subframeP); -#ifndef ENABLE_ENB_AGENT_DL_SCHEDULER +#ifndef FLEXRAN_AGENT_SB_IF fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); #endif } else { -#ifndef ENABLE_ENB_AGENT_DL_SCHEDULER +#ifndef FLEXRAN_AGENT_SB_IF schedule_ue_spec(module_idP,frameP,subframeP,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); #else @@ -701,7 +701,7 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, case 1: schedule_ulsch(module_idP,frameP,cooperation_flag,subframeP,2); // schedule_ue_spec(module_idP,frameP,subframeP,mbsfn_status); -#ifndef ENABLE_ENB_AGENT_DL_SCHEDULER +#ifndef FLEXRAN_AGENT_SB_IF fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); #endif break; @@ -709,14 +709,14 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, case 6: schedule_ulsch(module_idP,frameP,cooperation_flag,subframeP,3); // schedule_ue_spec(module_idP,frameP,subframeP,mbsfn_status); -#ifndef ENABLE_ENB_AGENT_DL_SCHEDULER +#ifndef FLEXRAN_AGENT_SB_IF fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); #endif break; case 5: schedule_RA(module_idP,frameP,subframeP,2); -#ifndef ENABLE_ENB_AGENT_DL_SCHEDULER +#ifndef FLEXRAN_AGENT_SB_IF schedule_ue_spec(module_idP,frameP,subframeP,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); #else @@ -740,7 +740,7 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, case 3: case 4: -#ifndef ENABLE_ENB_AGENT_DL_SCHEDULER +#ifndef FLEXRAN_AGENT_SB_IF schedule_ue_spec(module_idP,frameP,subframeP,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); #else @@ -767,7 +767,7 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, } } else { //FDD schedule_ulsch(module_idP,frameP,cooperation_flag,6,0); -#ifndef ENABLE_ENB_AGENT_DL_SCHEDULER +#ifndef FLEXRAN_AGENT_SB_IF schedule_ue_spec(module_idP,frameP,subframeP,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); #else @@ -800,7 +800,7 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, case 3: case 4: schedule_RA(module_idP,frameP,subframeP,3); // 3 = Msg3 subframeP, not -#ifndef ENABLE_ENB_AGENT_DL_SCHEDULER +#ifndef FLEXRAN_AGENT_SB_IF schedule_ue_spec(module_idP,frameP,subframeP,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); #else @@ -823,7 +823,7 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, break; case 5: -#ifndef ENABLE_ENB_AGENT_DL_SCHEDULER +#ifndef FLEXRAN_AGENT_SB_IF schedule_ue_spec(module_idP,frameP,subframeP,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); #else @@ -850,7 +850,7 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, } } else { //FDD schedule_ulsch(module_idP,frameP,cooperation_flag,7,1); -#ifndef ENABLE_ENB_AGENT_DL_SCHEDULER +#ifndef FLEXRAN_AGENT_SB_IF schedule_ue_spec(module_idP,frameP,subframeP,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); #else @@ -888,7 +888,7 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, // schedule_RA(module_idP,subframeP); schedule_ulsch(module_idP,frameP,cooperation_flag,subframeP,2); -#ifndef ENABLE_ENB_AGENT_DL_SCHEDULER +#ifndef FLEXRAN_AGENT_SB_IF schedule_ue_spec(module_idP,frameP,subframeP,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); #else @@ -915,7 +915,7 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, } } else { //FDD schedule_ulsch(module_idP,frameP,cooperation_flag,8,2); -#ifndef ENABLE_ENB_AGENT_DL_SCHEDULER +#ifndef FLEXRAN_AGENT_SB_IF schedule_ue_spec(module_idP,frameP,subframeP,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); #else @@ -947,7 +947,7 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, case 1: schedule_ulsch(module_idP,frameP,cooperation_flag,subframeP,3); schedule_RA(module_idP,frameP,subframeP,7); // 7 = Msg3 subframeP, not -#ifndef ENABLE_ENB_AGENT_DL_SCHEDULER +#ifndef FLEXRAN_AGENT_SB_IF schedule_ue_spec(module_idP,frameP,subframeP,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); #else @@ -972,7 +972,7 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, case 3: case 4: schedule_ulsch(module_idP,frameP,cooperation_flag,subframeP,3); -#ifndef ENABLE_ENB_AGENT_DL_SCHEDULER +#ifndef FLEXRAN_AGENT_SB_IF schedule_ue_spec(module_idP,frameP,subframeP,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); #else @@ -997,7 +997,7 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, case 6: schedule_ulsch(module_idP,frameP,cooperation_flag,subframeP,4); //schedule_RA(module_idP,frameP,subframeP); -#ifndef ENABLE_ENB_AGENT_DL_SCHEDULER +#ifndef FLEXRAN_AGENT_SB_IF schedule_ue_spec(module_idP,frameP,subframeP,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); #else @@ -1022,7 +1022,7 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, case 2: case 5: //schedule_RA(module_idP,frameP,subframeP); -#ifndef ENABLE_ENB_AGENT_DL_SCHEDULER +#ifndef FLEXRAN_AGENT_SB_IF schedule_ue_spec(module_idP,frameP,subframeP,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); #else @@ -1049,7 +1049,7 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, } } else { //FDD schedule_ulsch(module_idP,frameP,cooperation_flag,9,3); -#ifndef ENABLE_ENB_AGENT_DL_SCHEDULER +#ifndef FLEXRAN_AGENT_SB_IF schedule_ue_spec(module_idP,frameP,subframeP,mbsfn_status); fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_status); #else From 83929d42f2a38f96d7f2f1af544fd982c410d5e9 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Sat, 5 Nov 2016 14:09:48 +0200 Subject: [PATCH 259/349] Refactored local FlexRAN scheduler to make further use of FlexRAN API --- .../CONTROL_MODULES/MAC/flexran_agent_mac.c | 2 +- openair2/ENB_APP/flexran_agent_common.c | 172 ++-- openair2/ENB_APP/flexran_agent_common.h | 15 +- .../MAC/flexran_agent_scheduler_dlsch_ue.c | 765 ++++++++++++++++-- 4 files changed, 819 insertions(+), 135 deletions(-) diff --git a/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c b/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c index c85ec6c4eb..34b6ef345f 100644 --- a/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c +++ b/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c @@ -995,7 +995,7 @@ int flexran_agent_mac_sf_trigger(mid_t mod_id, const void *params, Protocol__Fle // TODO: This should be different per TB if(harq_status == 0) dl_info[i]->harq_status[j] = PROTOCOL__FLEX_HARQ_STATUS__FLHS_ACK; - else if (harq_status == 1) + else if (harq_status > 0) dl_info[i]->harq_status[j] = PROTOCOL__FLEX_HARQ_STATUS__FLHS_NACK; } /*Fill in the serving cell index for this UE */ diff --git a/openair2/ENB_APP/flexran_agent_common.c b/openair2/ENB_APP/flexran_agent_common.c index 302c792771..00f938f4fb 100644 --- a/openair2/ENB_APP/flexran_agent_common.c +++ b/openair2/ENB_APP/flexran_agent_common.c @@ -569,46 +569,73 @@ int flexran_get_tx_queue_size(mid_t mod_id, mid_t ue_id, logical_chan_id_t chann return rlc_status.bytes_in_buffer; } -int flexran_get_MAC_CE_bitmap_TA(mid_t mod_id, mid_t ue_id,int CC_id) -{ - rnti_t rnti = flexran_get_ue_crnti(mod_id,ue_id); - LTE_eNB_UE_stats *eNB_UE_stats = mac_xface->get_eNB_UE_stats(mod_id,CC_id,rnti); - - if (eNB_UE_stats == NULL) { - return 0; - } +int flexran_update_TA(mid_t mod_id, mid_t ue_id, int CC_id) { + + UE_list_t *UE_list=&eNB_mac_inst[mod_id].UE_list; + UE_sched_ctrl *ue_sched_ctl = &UE_list->UE_sched_ctrl[ue_id]; + int rnti; - int32_t time_advance; - switch (PHY_vars_eNB_g[mod_id][CC_id]->frame_parms.N_RB_DL) { - case 6: - time_advance = eNB_UE_stats->timing_advance_update; - break; + rnti = flexran_get_ue_crnti(mod_id, ue_id); + if (ue_sched_ctl->ta_timer == 0) { - case 15: - time_advance = eNB_UE_stats->timing_advance_update/2; - break; + // WE SHOULD PROTECT the eNB_UE_stats with a mutex here ... + LTE_eNB_UE_stats *eNB_UE_stats = mac_xface->get_eNB_UE_stats(mod_id, CC_id, rnti); + ue_sched_ctl->ta_timer = 20; // wait 20 subframes before taking TA measurement from PHY + switch (PHY_vars_eNB_g[mod_id][CC_id]->frame_parms.N_RB_DL) { + case 6: + ue_sched_ctl->ta_update = eNB_UE_stats->timing_advance_update; + break; - case 25: - time_advance = eNB_UE_stats->timing_advance_update/4; - break; + case 15: + ue_sched_ctl->ta_update = eNB_UE_stats->timing_advance_update/2; + break; - case 50: - time_advance = eNB_UE_stats->timing_advance_update/8; - break; + case 25: + ue_sched_ctl->ta_update = eNB_UE_stats->timing_advance_update/4; + break; - case 75: - time_advance = eNB_UE_stats->timing_advance_update/12; - break; + case 50: + ue_sched_ctl->ta_update = eNB_UE_stats->timing_advance_update/8; + break; - case 100: - time_advance = eNB_UE_stats->timing_advance_update/16; - break; - } + case 75: + ue_sched_ctl->ta_update = eNB_UE_stats->timing_advance_update/12; + break; + + case 100: + ue_sched_ctl->ta_update = eNB_UE_stats->timing_advance_update/16; + break; + } + // clear the update in case PHY does not have a new measurement after timer expiry + eNB_UE_stats->timing_advance_update = 0; + } + else { + ue_sched_ctl->ta_timer--; + ue_sched_ctl->ta_update = 0; // don't trigger a timing advance command + } + + return ue_sched_ctl->ta_update = 0; + +} + +int flexran_get_MAC_CE_bitmap_TA(mid_t mod_id, mid_t ue_id,int CC_id) { + + UE_list_t *UE_list = &eNB_mac_inst[mod_id].UE_list; + UE_sched_ctrl *ue_sched_ctl = &UE_list->UE_sched_ctrl[ue_id]; + + rnti_t rnti = flexran_get_ue_crnti(mod_id,ue_id); + LTE_eNB_UE_stats *eNB_UE_stats = mac_xface->get_eNB_UE_stats(mod_id,CC_id,rnti); + + if (eNB_UE_stats == NULL) { + return 0; + } + + if (ue_sched_ctl->ta_update == 0) { + return 1; + } else { + return 0; + } - if(time_advance > 0) - return 1; - else - return 0; } int flexran_get_active_CC(mid_t mod_id, mid_t ue_id) { @@ -616,12 +643,12 @@ int flexran_get_active_CC(mid_t mod_id, mid_t ue_id) { } int flexran_get_current_RI(mid_t mod_id, mid_t ue_id, int CC_id) { - LTE_eNB_UE_stats *eNB_UE_stats = NULL; + LTE_eNB_UE_stats *eNB_UE_stats = NULL; - int pCCid = UE_PCCID(mod_id,ue_id); - rnti_t rnti = flexran_get_ue_crnti(mod_id,ue_id); + int pCCid = UE_PCCID(mod_id,ue_id); + rnti_t rnti = flexran_get_ue_crnti(mod_id,ue_id); - eNB_UE_stats = mac_xface->get_eNB_UE_stats(mod_id,CC_id,rnti); + eNB_UE_stats = mac_xface->get_eNB_UE_stats(mod_id,CC_id,rnti); if (eNB_UE_stats == NULL) { return 0; @@ -631,14 +658,14 @@ int flexran_get_current_RI(mid_t mod_id, mid_t ue_id, int CC_id) { } int flexran_get_tpc(mid_t mod_id, mid_t ue_id) { - LTE_eNB_UE_stats *eNB_UE_stats = NULL; - int32_t normalized_rx_power, target_rx_power; - int tpc = 1; + LTE_eNB_UE_stats *eNB_UE_stats = NULL; + int32_t normalized_rx_power, target_rx_power; + int tpc = 1; - int pCCid = UE_PCCID(mod_id,ue_id); - rnti_t rnti = flexran_get_ue_crnti(mod_id,ue_id); + int pCCid = UE_PCCID(mod_id,ue_id); + rnti_t rnti = flexran_get_ue_crnti(mod_id,ue_id); - eNB_UE_stats = mac_xface->get_eNB_UE_stats(mod_id, pCCid, rnti); + eNB_UE_stats = mac_xface->get_eNB_UE_stats(mod_id, pCCid, rnti); target_rx_power = mac_xface->get_target_pusch_rx_power(mod_id,pCCid); @@ -651,36 +678,38 @@ int flexran_get_tpc(mid_t mod_id, mid_t ue_id) { } if (normalized_rx_power>(target_rx_power+1)) { - tpc = 0; //-1 + tpc = 0; //-1 } else if (normalized_rx_power<(target_rx_power-1)) { - tpc = 2; //+1 + tpc = 2; //+1 } else { - tpc = 1; //0 + tpc = 1; //0 } return tpc; } -int flexran_get_harq(const mid_t mod_id, const uint8_t CC_id, const mid_t ue_id, const int frame, const uint8_t subframe, int *id, int *status) { //flag_id_status = 0 then id, else status +int flexran_get_harq(const mid_t mod_id, const uint8_t CC_id, const mid_t ue_id, const int frame, const uint8_t subframe, int *id, int *round) { //flag_id_status = 0 then id, else status /*TODO: Add int TB in function parameters to get the status of the second TB. This can be done to by editing in * get_ue_active_harq_pid function in line 272 file: phy_procedures_lte_eNB.c to add * DLSCH_ptr = PHY_vars_eNB_g[Mod_id][CC_id]->dlsch_eNB[(uint32_t)UE_id][1];*/ uint8_t harq_pid; - uint8_t round; + uint8_t harq_round; uint16_t rnti = flexran_get_ue_crnti(mod_id,ue_id); - mac_xface->get_ue_active_harq_pid(mod_id,CC_id,rnti,frame,subframe,&harq_pid,&round,openair_harq_DL); + mac_xface->get_ue_active_harq_pid(mod_id,CC_id,rnti,frame,subframe,&harq_pid,&harq_round,openair_harq_DL); *id = harq_pid; - if (round > 0) { - *status = 1; - } else { - *status = 0; - } + *round = harq_round; + /* if (round > 0) { */ + /* *status = 1; */ + /* } else { */ + /* *status = 0; */ + /* } */ - return 0; + /* return 0; */ + return round; } int flexran_get_p0_pucch_dbm(mid_t mod_id, mid_t ue_id, int CC_id) { @@ -705,6 +734,24 @@ int flexran_get_p0_nominal_pucch(mid_t mod_id, int CC_id) { return pucch_rx_received; } +int flexran_get_p0_pucch_status(mid_t mod_id, mid_t ue_id, int CC_id) { + LTE_eNB_UE_stats *eNB_UE_stats = NULL; + uint32_t rnti = flexran_get_ue_crnti(mod_id,ue_id); + + eNB_UE_stats = mac_xface->get_eNB_UE_stats(mod_id, CC_id, rnti); + return eNB_UE_stats->Po_PUCCH_update; +} + +int flexran_update_p0_pucch(mid_t mod_id, mid_t ue_id, int CC_id) { + LTE_eNB_UE_stats *eNB_UE_stats = NULL; + uint32_t rnti = flexran_get_ue_crnti(mod_id,ue_id); + + eNB_UE_stats = mac_xface->get_eNB_UE_stats(mod_id, CC_id, rnti); + eNB_UE_stats->Po_PUCCH_update = 0; + + return 0; +} + /* * ************************************ @@ -861,6 +908,13 @@ int flexran_get_N_RB_UL(mid_t mod_id, int CC_id) { return frame_parms->N_RB_UL; } +int flexran_get_N_RBG(mid_t mod_id, int CC_id) { + LTE_DL_FRAME_PARMS *frame_parms; + + frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id); + return frame_parms->N_RBG; +} + int flexran_get_subframe_assignment(mid_t mod_id, int CC_id) { LTE_DL_FRAME_PARMS *frame_parms; @@ -891,10 +945,10 @@ int flexran_get_duplex_mode(mid_t mod_id, int CC_id) { LTE_DL_FRAME_PARMS *frame_parms; frame_parms = mac_xface->get_lte_frame_parms(mod_id, CC_id); - if(frame_parms->frame_type == 0) - return 1; - else if (frame_parms->frame_type == 1) - return 0; + if(frame_parms->frame_type == TDD) + return PROTOCOL__FLEX_DUPLEX_MODE__FLDM_TDD; + else if (frame_parms->frame_type == FDD) + return PROTOCOL__FLEX_DUPLEX_MODE__FLDM_FDD; return -1; } diff --git a/openair2/ENB_APP/flexran_agent_common.h b/openair2/ENB_APP/flexran_agent_common.h index 2156d50a0d..caa2eeb900 100644 --- a/openair2/ENB_APP/flexran_agent_common.h +++ b/openair2/ENB_APP/flexran_agent_common.h @@ -193,6 +193,9 @@ int flexran_get_ue_wcqi (mid_t mod_id, mid_t ue_id); /* Get the transmission queue size for a UE with a channel_id logical channel id */ int flexran_get_tx_queue_size(mid_t mod_id, mid_t ue_id, logical_chan_id_t channel_id); +/* Update the timing advance status (find out whether a timing advance command is required) */ +int flexran_update_TA(mid_t mod_id, mid_t ue_id, int CC_id); + /* Return timing advance MAC control element for a designated cell and UE */ int flexran_get_MAC_CE_bitmap_TA(mid_t mod_id, mid_t ue_id, int CC_id); @@ -245,6 +248,9 @@ int flexran_get_N_RB_DL(mid_t mod_id, int CC_id); /* Get number of UL resource blocks */ int flexran_get_N_RB_UL(mid_t mod_id, int CC_id); +/* Get number of resource block groups */ +int flexran_get_N_RBG(mid_t mod_id, int CC_id); + /* Get DL/UL subframe assignment. TDD only */ int flexran_get_subframe_assignment(mid_t mod_id, int CC_id); @@ -273,13 +279,18 @@ int flexran_get_tpc(mid_t mod_id, mid_t ue_id); a designated frame and subframe. Returns 0 for success. The id and the status of the HARQ process are stored in id and status respectively */ int flexran_get_harq(const mid_t mod_id, const uint8_t CC_id, const mid_t ue_id, - const int frame, const uint8_t subframe, int *id, int *status); + const int frame, const uint8_t subframe, int *id, int *round); -/* Reported values for uplink power control */ +/* Uplink power control management*/ int flexran_get_p0_pucch_dbm(mid_t mod_id, mid_t ue_id, int CC_id); int flexran_get_p0_nominal_pucch(mid_t mod_id, int CC_id); +int flexran_get_p0_pucch_status(mid_t mod_id, mid_t ue_id, int CC_id); + +int flexran_update_p0_pucch(mid_t mod_id, mid_t ue_id, int CC_id); + + /* * ************************************ * Get Messages for UE Configuration Reply diff --git a/openair2/LAYER2/MAC/flexran_agent_scheduler_dlsch_ue.c b/openair2/LAYER2/MAC/flexran_agent_scheduler_dlsch_ue.c index cf033959d3..73d82507a5 100644 --- a/openair2/LAYER2/MAC/flexran_agent_scheduler_dlsch_ue.c +++ b/openair2/LAYER2/MAC/flexran_agent_scheduler_dlsch_ue.c @@ -29,7 +29,7 @@ /*! \file flexran_agent_scheduler_dlsch_ue.c * \brief procedures related to eNB for the DLSCH transport channel - * \author Xenofon Foukas + * \author Xenofon Foukas, Navid Nikaein and Raymond Knopp * \date 2016 * \email: x.foukas@sms.ed.ac.uk * \version 0.1 @@ -59,7 +59,6 @@ #include "ENB_APP/flexran_agent_defs.h" -//#include "LAYER2/MAC/pre_processor.c" #include "pdcp.h" #include "header.pb-c.h" @@ -74,6 +73,7 @@ #define ENABLE_MAC_PAYLOAD_DEBUG + //------------------------------------------------------------------------------ void flexran_schedule_ue_spec_default(mid_t mod_id, @@ -88,22 +88,20 @@ flexran_schedule_ue_spec_default(mid_t mod_id, int N_RBG[MAX_NUM_CCs]; unsigned char aggregation; mac_rlc_status_resp_t rlc_status; - unsigned char header_len_dcch=0, header_len_dcch_tmp=0, header_len_dtch=0, header_len_dtch_tmp=0, ta_len=0; - unsigned char header_len = 0, header_len_tmp = 0; + unsigned char header_len = 0, header_len_tmp = 0, ta_len = 0; uint16_t nb_rb, nb_rb_temp, total_nb_available_rb[MAX_NUM_CCs], nb_available_rb; uint16_t TBS, j, rnti, padding=0, post_padding=0; unsigned char round = 0; unsigned char harq_pid = 0; void *DLSCH_dci = NULL; - LTE_eNB_UE_stats *eNB_UE_stats = NULL; uint16_t sdu_length_total = 0; int mcs, mcs_tmp; uint16_t min_rb_unit[MAX_NUM_CCs]; eNB_MAC_INST *eNB = &eNB_mac_inst[mod_id]; + /* TODO: Must move the helper structs to scheduler implementation */ UE_list_t *UE_list = &eNB->UE_list; - LTE_DL_FRAME_PARMS *frame_parms[MAX_NUM_CCs]; int32_t normalized_rx_power, target_rx_power; - int32_t tpc=1; + int32_t tpc = 1; static int32_t tpc_accumulated=0; UE_sched_ctrl *ue_sched_ctl; @@ -139,14 +137,13 @@ flexran_schedule_ue_spec_default(mid_t mod_id, for (CC_id=0; CC_idget_lte_frame_parms(mod_id, CC_id); // get number of PRBs less those used by common channels - total_nb_available_rb[CC_id] = frame_parms[CC_id]->N_RB_DL; - for (i=0;iN_RB_DL;i++) - if (eNB->common_channels[CC_id].vrb_map[i]!=0) + total_nb_available_rb[CC_id] = flexran_get_N_RB_DL(mod_id, CC_id); + for (i=0;i < flexran_get_N_RB_DL(mod_id, CC_id); i++) + if (eNB->common_channels[CC_id].vrb_map[i] != 0) total_nb_available_rb[CC_id]--; - N_RBG[CC_id] = frame_parms[CC_id]->N_RBG; + N_RBG[CC_id] = flexran_get_N_RBG(mod_id, CC_id); // store the global enb stats: eNB->eNB_stats[CC_id].num_dlactive_UEs = UE_list->num_UEs; @@ -159,7 +156,7 @@ flexran_schedule_ue_spec_default(mid_t mod_id, VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_PREPROCESSOR,VCD_FUNCTION_IN); start_meas(&eNB->schedule_dlsch_preprocessor); - dlsch_scheduler_pre_processor(mod_id, + _dlsch_scheduler_pre_processor(mod_id, frame, subframe, N_RBG, @@ -174,25 +171,23 @@ flexran_schedule_ue_spec_default(mid_t mod_id, continue; for (UE_id=UE_list->head; UE_id>=0; UE_id=UE_list->next[UE_id]) { - rnti = UE_RNTI(mod_id, UE_id); - eNB_UE_stats = mac_xface->get_eNB_UE_stats(mod_id, CC_id, rnti); + rnti = flexran_get_ue_crnti(mod_id, UE_id); ue_sched_ctl = &UE_list->UE_sched_ctrl[UE_id]; if (rnti==NOT_A_RNTI) { - LOG_D(MAC,"Cannot find rnti for UE_id %d (num_UEs %d)\n",UE_id,UE_list->num_UEs); + LOG_D(MAC,"Cannot find rnti for UE_id %d (num_UEs %d)\n", UE_id,UE_list->num_UEs); // mac_xface->macphy_exit("Cannot find rnti for UE_id"); continue; } - if (eNB_UE_stats==NULL) { - LOG_D(MAC,"[eNB] Cannot find eNB_UE_stats\n"); + if (flexran_get_ue_crnti(mod_id, UE_id) == NOT_A_RNTI) { + LOG_D(MAC,"[eNB] Cannot find UE\n"); // mac_xface->macphy_exit("[MAC][eNB] Cannot find eNB_UE_stats\n"); continue; } if ((ue_sched_ctl->pre_nb_available_rbs[CC_id] == 0) || // no RBs allocated - CCE_allocation_infeasible(mod_id, CC_id, 0, subframe, aggregation, rnti) - ) { + CCE_allocation_infeasible(mod_id, CC_id, 0, subframe, aggregation, rnti)) { LOG_D(MAC,"[eNB %d] Frame %d : no RB allocated for UE %d on CC_id %d: continue \n", mod_id, frame, UE_id, CC_id); //if(mac_xface->get_transmission_mode(module_idP,rnti)==5) @@ -201,14 +196,14 @@ flexran_schedule_ue_spec_default(mid_t mod_id, // break; } - if (frame_parms[CC_id]->frame_type == TDD) { + if (flexran_get_duplex_mode(mod_id, CC_id) == PROTOCOL__FLEX_DUPLEX_MODE__FLDM_TDD) { set_ue_dai (subframe, - frame_parms[CC_id]->tdd_config, + flexran_get_subframe_assignment(mod_id, CC_id), UE_id, CC_id, UE_list); - // update UL DAI after DLSCH scheduling - set_ul_DAI(mod_id, UE_id, CC_id, frame, subframe,frame_parms); + //TODO: update UL DAI after DLSCH scheduling + //set_ul_DAI(mod_id, UE_id, CC_id, frame, subframe,frame_parms); } channels_added = 0; @@ -223,38 +218,29 @@ flexran_schedule_ue_spec_default(mid_t mod_id, dl_data[num_ues_added]->serv_cell_index = CC_id; nb_available_rb = ue_sched_ctl->pre_nb_available_rbs[CC_id]; - harq_pid = ue_sched_ctl->harq_pid[CC_id]; - round = ue_sched_ctl->round[CC_id]; - + flexran_get_harq(mod_id, CC_id, UE_id, frame, subframe, &harq_pid, &round); sdu_length_total=0; - - /* - DevCheck(((eNB_UE_stats->DL_cqi[0] < MIN_CQI_VALUE) || (eNB_UE_stats->DL_cqi[0] > MAX_CQI_VALUE)), - eNB_UE_stats->DL_cqi[0], MIN_CQI_VALUE, MAX_CQI_VALUE); - */ - - mcs = cqi_to_mcs[eNB_UE_stats->DL_cqi[0]]; - // mcs = cmin(mcs, openair_daq_vars.target_ue_dl_mcs); + mcs = cqi_to_mcs[flexran_get_ue_wcqi(mod_id, UE_id)]; #ifdef EXMIMO if (mac_xface->get_transmission_mode(mod_id, CC_id, rnti) == 5) { - mcs = cqi_to_mcs[eNB_UE_stats->DL_cqi[0]]; + mcs = cqi_to_mcs[flexran_get_ue_wcqi(mod_id, UE_id)]; mcs = cmin(mcs,16); } #endif // initializing the rb allocation indicator for each UE - for(j = 0; j < frame_parms[CC_id]->N_RBG; j++) { + for(j = 0; j < flexran_get_N_RBG(mod_id, CC_id); j++) { UE_list->UE_template[CC_id][UE_id].rballoc_subband[harq_pid][j] = 0; rballoc_sub[j] = 0; } - LOG_D(MAC,"[eNB %d] Frame %d: Scheduling UE %d on CC_id %d (rnti %x, harq_pid %d, round %d, rb %d, cqi %d, mcs %d, rrc %d)\n", - mod_id, frame, UE_id, CC_id, rnti, harq_pid, round, nb_available_rb, - eNB_UE_stats->DL_cqi[0], mcs, - UE_list->eNB_UE_stats[CC_id][UE_id].rrc_status); + /* LOG_D(MAC,"[eNB %d] Frame %d: Scheduling UE %d on CC_id %d (rnti %x, harq_pid %d, round %d, rb %d, cqi %d, mcs %d, rrc %d)\n", */ + /* mod_id, frame, UE_id, CC_id, rnti, harq_pid, round, nb_available_rb, */ + /* eNB_UE_stats->DL_cqi[0], mcs, */ + /* UE_list->eNB_UE_stats[CC_id][UE_id].rrc_status); */ dl_dci = (Protocol__FlexDlDci*) malloc(sizeof(Protocol__FlexDlDci)); protocol__flex_dl_dci__init(dl_dci); @@ -270,7 +256,7 @@ flexran_schedule_ue_spec_default(mid_t mod_id, if (round > 0) { - if (frame_parms[CC_id]->frame_type == TDD) { + if (flexran_get_duplex_mode(mod_id, CC_id) == PROTOCOL__FLEX_DUPLEX_MODE__FLDM_TDD) { UE_list->UE_template[CC_id][UE_id].DAI++; update_ul_dci(mod_id, CC_id, rnti, UE_list->UE_template[CC_id][UE_id].DAI); LOG_D(MAC,"DAI update: CC_id %d subframeP %d: UE %d, DAI %d\n", @@ -282,25 +268,26 @@ flexran_schedule_ue_spec_default(mid_t mod_id, // get freq_allocation nb_rb = UE_list->UE_template[CC_id][UE_id].nb_rb[harq_pid]; + /*TODO: Must add this to FlexRAN agent API */ dci_tbs = mac_xface->get_TBS_DL(mcs, nb_rb); if (nb_rb <= nb_available_rb) { if(nb_rb == ue_sched_ctl->pre_nb_available_rbs[CC_id]) { - for(j = 0; j < frame_parms[CC_id]->N_RBG; j++) { // for indicating the rballoc for each sub-band + for(j = 0; j < flexran_get_N_RBG(mod_id, CC_id); j++) { // for indicating the rballoc for each sub-band UE_list->UE_template[CC_id][UE_id].rballoc_subband[harq_pid][j] = ue_sched_ctl->rballoc_sub_UE[CC_id][j]; } } else { nb_rb_temp = nb_rb; j = 0; - while((nb_rb_temp > 0) && (j < frame_parms[CC_id]->N_RBG)) { + while((nb_rb_temp > 0) && (j < flexran_get_N_RBG(mod_id, CC_id))) { if(ue_sched_ctl->rballoc_sub_UE[CC_id][j] == 1) { UE_list->UE_template[CC_id][UE_id].rballoc_subband[harq_pid][j] = ue_sched_ctl->rballoc_sub_UE[CC_id][j]; - if((j == frame_parms[CC_id]->N_RBG-1) && - ((frame_parms[CC_id]->N_RB_DL == 25)|| - (frame_parms[CC_id]->N_RB_DL == 50))) { + if((j == flexran_get_N_RBG(mod_id, CC_id) - 1) && + ((flexran_get_N_RB_DL(mod_id, CC_id) == 25)|| + (flexran_get_N_RB_DL(mod_id, CC_id) == 50))) { nb_rb_temp = nb_rb_temp - min_rb_unit[CC_id]+1; } else { nb_rb_temp = nb_rb_temp - min_rb_unit[CC_id]; @@ -316,7 +303,7 @@ flexran_schedule_ue_spec_default(mid_t mod_id, PHY_vars_eNB_g[mod_id][CC_id]->mu_mimo_mode[UE_id].pre_nb_available_rbs = nb_rb; PHY_vars_eNB_g[mod_id][CC_id]->mu_mimo_mode[UE_id].dl_pow_off = ue_sched_ctl->dl_pow_off[CC_id]; - for(j=0; jN_RBG; j++) { + for(j=0; j < flexran_get_N_RBG(mod_id, CC_id); j++) { PHY_vars_eNB_g[mod_id][CC_id]->mu_mimo_mode[UE_id].rballoc_sub[j] = UE_list->UE_template[CC_id][UE_id].rballoc_subband[harq_pid][j]; rballoc_sub[j] = UE_list->UE_template[CC_id][UE_id].rballoc_subband[harq_pid][j]; } @@ -360,8 +347,6 @@ flexran_schedule_ue_spec_default(mid_t mod_id, dl_data[num_ues_added]->ce_bitmap[0] = ce_flags; dl_data[num_ues_added]->ce_bitmap[1] = ce_flags; - header_len_dcch = 2; // 2 bytes DCCH SDU subheader - // TODO : Need to prioritize DRBs // Loop through the UE logical channels (DCCH, DCCH1, DTCH for now) for (j = 1; j < NB_RB_MAX; j++) { @@ -467,20 +452,20 @@ flexran_schedule_ue_spec_default(mid_t mod_id, if(nb_rb == ue_sched_ctl->pre_nb_available_rbs[CC_id]) { LOG_D(MAC, "[TEST]We had the exact number of rbs. Time to fill the rballoc subband\n"); - for(j = 0; j < frame_parms[CC_id]->N_RBG; j++) { // for indicating the rballoc for each sub-band + for(j = 0; j < flexran_get_N_RBG(mod_id, CC_id); j++) { // for indicating the rballoc for each sub-band UE_list->UE_template[CC_id][UE_id].rballoc_subband[harq_pid][j] = ue_sched_ctl->rballoc_sub_UE[CC_id][j]; } } else { nb_rb_temp = nb_rb; j = 0; LOG_D(MAC, "[TEST]Will only partially fill the bitmap\n"); - while((nb_rb_temp > 0) && (j < frame_parms[CC_id]->N_RBG)) { + while((nb_rb_temp > 0) && (j < flexran_get_N_RBG(mod_id, CC_id))) { if(ue_sched_ctl->rballoc_sub_UE[CC_id][j] == 1) { UE_list->UE_template[CC_id][UE_id].rballoc_subband[harq_pid][j] = ue_sched_ctl->rballoc_sub_UE[CC_id][j]; - if ((j == frame_parms[CC_id]->N_RBG-1) && - ((frame_parms[CC_id]->N_RB_DL == 25)|| - (frame_parms[CC_id]->N_RB_DL == 50))) { - nb_rb_temp = nb_rb_temp - min_rb_unit[CC_id]+1; + if ((j == flexran_get_N_RBG(mod_id, CC_id) - 1) && + ((flexran_get_N_RB_DL(mod_id, CC_id) == 25)|| + (flexran_get_N_RB_DL(mod_id, CC_id) == 50))) { + nb_rb_temp = nb_rb_temp - min_rb_unit[CC_id] + 1; } else { nb_rb_temp = nb_rb_temp - min_rb_unit[CC_id]; } @@ -492,7 +477,7 @@ flexran_schedule_ue_spec_default(mid_t mod_id, PHY_vars_eNB_g[mod_id][CC_id]->mu_mimo_mode[UE_id].pre_nb_available_rbs = nb_rb; PHY_vars_eNB_g[mod_id][CC_id]->mu_mimo_mode[UE_id].dl_pow_off = ue_sched_ctl->dl_pow_off[CC_id]; - for(j = 0; j < frame_parms[CC_id]->N_RBG; j++) { + for(j = 0; j < flexran_get_N_RBG(mod_id, CC_id); j++) { PHY_vars_eNB_g[mod_id][CC_id]->mu_mimo_mode[UE_id].rballoc_sub[j] = UE_list->UE_template[CC_id][UE_id].rballoc_subband[harq_pid][j]; } @@ -518,7 +503,7 @@ flexran_schedule_ue_spec_default(mid_t mod_id, UE_list->UE_template[CC_id][UE_id].nb_rb[harq_pid] = nb_rb; - if (frame_parms[CC_id]->frame_type == TDD) { + if (flexran_get_duplex_mode(mod_id, CC_id) == PROTOCOL__FLEX_DUPLEX_MODE__FLDM_TDD) { UE_list->UE_template[CC_id][UE_id].DAI++; // printf("DAI update: subframeP %d: UE %d, DAI %d\n",subframeP,UE_id,UE_list->UE_template[CC_id][UE_id].DAI); //#warning only for 5MHz channel @@ -527,9 +512,8 @@ flexran_schedule_ue_spec_default(mid_t mod_id, // do PUCCH power control // this is the normalized RX power - eNB_UE_stats = mac_xface->get_eNB_UE_stats(mod_id, CC_id, rnti); - normalized_rx_power = eNB_UE_stats->Po_PUCCH_dBm; - target_rx_power = mac_xface->get_target_pucch_rx_power(mod_id, CC_id) + 10; + normalized_rx_power = flexran_get_p0_pucch_dbm(mod_id,UE_id, CC_id); //eNB_UE_stats->Po_PUCCH_dBm; + target_rx_power = flexran_get_p0_nominal_pucch(mod_id, CC_id) + 10; //mac_xface->get_target_pucch_rx_power(mod_id, CC_id) + 10; // this assumes accumulated tpc // make sure that we are only sending a tpc update once a frame, otherwise the control loop will freak out @@ -537,11 +521,11 @@ flexran_schedule_ue_spec_default(mid_t mod_id, if (((framex10psubframe+10)<=(frame*10+subframe)) || //normal case ((framex10psubframe>(frame*10+subframe)) && (((10240-framex10psubframe+frame*10+subframe)>=10)))) //frame wrap-around - if (eNB_UE_stats->Po_PUCCH_update == 1) { - eNB_UE_stats->Po_PUCCH_update = 0; - - UE_list->UE_template[CC_id][UE_id].pucch_tpc_tx_frame=frame; - UE_list->UE_template[CC_id][UE_id].pucch_tpc_tx_subframe=subframe; + if (flexran_get_p0_pucch_status(mod_id, UE_id, CC_id) == 1) { + flexran_update_p0_pucch(mod_id, UE_id, CC_id); + + UE_list->UE_template[CC_id][UE_id].pucch_tpc_tx_frame = frame; + UE_list->UE_template[CC_id][UE_id].pucch_tpc_tx_subframe = subframe; if (normalized_rx_power>(target_rx_power+1)) { tpc = 0; //-1 tpc_accumulated--; @@ -614,7 +598,7 @@ flexran_schedule_ue_spec_default(mid_t mod_id, dl_dci->n_tbs_size = 1; dl_dci->tbs_size = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_tbs_size); dl_dci->tbs_size[0] = dci_tbs; - if (frame_parms[CC_id]->frame_type == TDD) { + if (flexran_get_duplex_mode(mod_id, CC_id) == PROTOCOL__FLEX_DUPLEX_MODE__FLDM_TDD) { dl_dci->has_dai = 1; dl_dci->dai = (UE_list->UE_template[CC_id][UE_id].DAI-1)&3; } @@ -648,7 +632,7 @@ flexran_schedule_ue_spec_default(mid_t mod_id, dl_dci->tbs_size = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_tbs_size); dl_dci->tbs_size[0] = dci_tbs; dl_dci->tbs_size[1] = dci_tbs; - if (frame_parms[CC_id]->frame_type == TDD) { + if (flexran_get_duplex_mode(mod_id, CC_id) == PROTOCOL__FLEX_DUPLEX_MODE__FLDM_TDD) { dl_dci->has_dai = 1; dl_dci->dai = (UE_list->UE_template[CC_id][UE_id].DAI-1)&3; } @@ -682,7 +666,7 @@ flexran_schedule_ue_spec_default(mid_t mod_id, dl_dci->tbs_size = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_tbs_size); dl_dci->tbs_size[0] = dci_tbs; dl_dci->tbs_size[1] = dci_tbs; - if (frame_parms[CC_id]->frame_type == TDD) { + if (flexran_get_duplex_mode(mod_id, CC_id) == PROTOCOL__FLEX_DUPLEX_MODE__FLDM_TDD) { dl_dci->has_dai = 1; dl_dci->dai = (UE_list->UE_template[CC_id][UE_id].DAI-1)&3; } @@ -712,7 +696,7 @@ flexran_schedule_ue_spec_default(mid_t mod_id, dl_dci->n_tbs_size = 1; dl_dci->tbs_size = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_tbs_size); dl_dci->tbs_size[0] = dci_tbs; - if (frame_parms[CC_id]->frame_type == TDD) { + if (flexran_get_duplex_mode(mod_id, CC_id) == PROTOCOL__FLEX_DUPLEX_MODE__FLDM_TDD) { dl_dci->has_dai = 1; dl_dci->dai = (UE_list->UE_template[CC_id][UE_id].DAI-1)&3; } @@ -749,7 +733,7 @@ flexran_schedule_ue_spec_default(mid_t mod_id, dl_dci->n_mcs = 1; dl_dci->mcs = (uint32_t *) malloc(sizeof(uint32_t) * dl_dci->n_mcs); dl_dci->mcs[0] = mcs; - if (frame_parms[CC_id]->frame_type == TDD) { + if (flexran_get_duplex_mode(mod_id, CC_id) == PROTOCOL__FLEX_DUPLEX_MODE__FLDM_TDD) { dl_dci->has_dai = 1; dl_dci->dai = (UE_list->UE_template[CC_id][UE_id].DAI-1)&3; } @@ -762,8 +746,10 @@ flexran_schedule_ue_spec_default(mid_t mod_id, } } - if (frame_parms[CC_id]->frame_type == TDD) { - set_ul_DAI(mod_id, UE_id, CC_id, frame, subframe, frame_parms); + if (flexran_get_duplex_mode(mod_id, CC_id) == PROTOCOL__FLEX_DUPLEX_MODE__FLDM_TDD) { + + /* TODO */ + //set_ul_DAI(mod_id, UE_id, CC_id, frame, subframe, frame_parms); } } // UE_id loop } // CC_id loop @@ -778,3 +764,636 @@ flexran_schedule_ue_spec_default(mid_t mod_id, stop_meas(&eNB->schedule_dlsch); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_SCHEDULE_DLSCH,VCD_FUNCTION_OUT); } + +// This function stores the downlink buffer for all the logical channels +void _store_dlsch_buffer (module_id_t Mod_id, + frame_t frameP, + sub_frame_t subframeP) +{ + + int UE_id,i; + rnti_t rnti; + mac_rlc_status_resp_t rlc_status; + UE_list_t *UE_list = &eNB_mac_inst[Mod_id].UE_list; + UE_TEMPLATE *UE_template; + + for (UE_id=UE_list->head; UE_id>=0; UE_id=UE_list->next[UE_id]) { + + UE_template = &UE_list->UE_template[UE_PCCID(Mod_id,UE_id)][UE_id]; + + // clear logical channel interface variables + UE_template->dl_buffer_total = 0; + UE_template->dl_pdus_total = 0; + + for(i=0; i< MAX_NUM_LCID; i++) { + UE_template->dl_buffer_info[i]=0; + UE_template->dl_pdus_in_buffer[i]=0; + UE_template->dl_buffer_head_sdu_creation_time[i]=0; + UE_template->dl_buffer_head_sdu_remaining_size_to_send[i]=0; + } + + rnti = UE_RNTI(Mod_id,UE_id); + + for(i=0; i< MAX_NUM_LCID; i++) { // loop over all the logical channels + + rlc_status = mac_rlc_status_ind(Mod_id,rnti, Mod_id,frameP,ENB_FLAG_YES,MBMS_FLAG_NO,i,0 ); + UE_template->dl_buffer_info[i] = rlc_status.bytes_in_buffer; //storing the dlsch buffer for each logical channel + UE_template->dl_pdus_in_buffer[i] = rlc_status.pdus_in_buffer; + UE_template->dl_buffer_head_sdu_creation_time[i] = rlc_status.head_sdu_creation_time ; + UE_template->dl_buffer_head_sdu_creation_time_max = cmax(UE_template->dl_buffer_head_sdu_creation_time_max, + rlc_status.head_sdu_creation_time ); + UE_template->dl_buffer_head_sdu_remaining_size_to_send[i] = rlc_status.head_sdu_remaining_size_to_send; + UE_template->dl_buffer_head_sdu_is_segmented[i] = rlc_status.head_sdu_is_segmented; + UE_template->dl_buffer_total += UE_template->dl_buffer_info[i];//storing the total dlsch buffer + UE_template->dl_pdus_total += UE_template->dl_pdus_in_buffer[i]; + +#ifdef DEBUG_eNB_SCHEDULER + + /* note for dl_buffer_head_sdu_remaining_size_to_send[i] : + * 0 if head SDU has not been segmented (yet), else remaining size not already segmented and sent + */ + if (UE_template->dl_buffer_info[i]>0) + LOG_D(MAC, + "[eNB %d] Frame %d Subframe %d : RLC status for UE %d in LCID%d: total of %d pdus and size %d, head sdu queuing time %d, remaining size %d, is segmeneted %d \n", + Mod_id, frameP, subframeP, UE_id, + i, UE_template->dl_pdus_in_buffer[i],UE_template->dl_buffer_info[i], + UE_template->dl_buffer_head_sdu_creation_time[i], + UE_template->dl_buffer_head_sdu_remaining_size_to_send[i], + UE_template->dl_buffer_head_sdu_is_segmented[i] + ); + +#endif + + } + + //#ifdef DEBUG_eNB_SCHEDULER + if ( UE_template->dl_buffer_total>0) + LOG_D(MAC,"[eNB %d] Frame %d Subframe %d : RLC status for UE %d : total DL buffer size %d and total number of pdu %d \n", + Mod_id, frameP, subframeP, UE_id, + UE_template->dl_buffer_total, + UE_template->dl_pdus_total + ); + + //#endif + } +} + + +// This function returns the estimated number of RBs required by each UE for downlink scheduling +void _assign_rbs_required (module_id_t Mod_id, + frame_t frameP, + sub_frame_t subframe, + uint16_t nb_rbs_required[MAX_NUM_CCs][NUMBER_OF_UE_MAX], + int min_rb_unit[MAX_NUM_CCs]) +{ + + + rnti_t rnti; + uint16_t TBS = 0; + LTE_eNB_UE_stats *eNB_UE_stats[MAX_NUM_CCs]; + int UE_id,n,i,j,CC_id,pCCid,tmp; + UE_list_t *UE_list = &eNB_mac_inst[Mod_id].UE_list; + // UE_TEMPLATE *UE_template; + + // clear rb allocations across all CC_ids + for (UE_id=UE_list->head; UE_id>=0; UE_id=UE_list->next[UE_id]) { + pCCid = UE_PCCID(Mod_id,UE_id); + rnti = UE_list->UE_template[pCCid][UE_id].rnti; + + //update CQI information across component carriers + for (n=0; nnumactiveCCs[UE_id]; n++) { + CC_id = UE_list->ordered_CCids[n][UE_id]; + eNB_UE_stats[CC_id] = mac_xface->get_eNB_UE_stats(Mod_id,CC_id,rnti); + eNB_UE_stats[CC_id]->dlsch_mcs1=cqi_to_mcs[flexran_get_ue_wcqi(Mod_id, UE_id)]; + } + + // provide the list of CCs sorted according to MCS + for (i=0; inumactiveCCs[UE_id]; i++) { + for (j=i+1; jnumactiveCCs[UE_id]; j++) { + DevAssert( j < MAX_NUM_CCs ); + + if (eNB_UE_stats[UE_list->ordered_CCids[i][UE_id]]->dlsch_mcs1 > + eNB_UE_stats[UE_list->ordered_CCids[j][UE_id]]->dlsch_mcs1) { + tmp = UE_list->ordered_CCids[i][UE_id]; + UE_list->ordered_CCids[i][UE_id] = UE_list->ordered_CCids[j][UE_id]; + UE_list->ordered_CCids[j][UE_id] = tmp; + } + } + } + + /* NN --> RK + * check the index of UE_template" + */ + if (UE_list->UE_template[pCCid][UE_id].dl_buffer_total> 0) { + LOG_D(MAC,"[preprocessor] assign RB for UE %d\n",UE_id); + + for (i=0; inumactiveCCs[UE_id]; i++) { + CC_id = UE_list->ordered_CCids[i][UE_id]; + eNB_UE_stats[CC_id] = mac_xface->get_eNB_UE_stats(Mod_id,CC_id,rnti); + + if (eNB_UE_stats[CC_id]->dlsch_mcs1==0) { + nb_rbs_required[CC_id][UE_id] = 4; // don't let the TBS get too small + } else { + nb_rbs_required[CC_id][UE_id] = min_rb_unit[CC_id]; + } + + TBS = mac_xface->get_TBS_DL(eNB_UE_stats[CC_id]->dlsch_mcs1,nb_rbs_required[CC_id][UE_id]); + + LOG_D(MAC,"[preprocessor] start RB assignement for UE %d CC_id %d dl buffer %d (RB unit %d, MCS %d, TBS %d) \n", + UE_id, CC_id, UE_list->UE_template[pCCid][UE_id].dl_buffer_total, + nb_rbs_required[CC_id][UE_id],eNB_UE_stats[CC_id]->dlsch_mcs1,TBS); + + /* calculating required number of RBs for each UE */ + while (TBS < UE_list->UE_template[pCCid][UE_id].dl_buffer_total) { + nb_rbs_required[CC_id][UE_id] += min_rb_unit[CC_id]; + + if (nb_rbs_required[CC_id][UE_id] > flexran_get_N_RB_DL(Mod_id, CC_id)) { + TBS = mac_xface->get_TBS_DL(eNB_UE_stats[CC_id]->dlsch_mcs1, flexran_get_N_RB_DL(Mod_id, CC_id)); + nb_rbs_required[CC_id][UE_id] = flexran_get_N_RB_DL(Mod_id, CC_id); + break; + } + + TBS = mac_xface->get_TBS_DL(eNB_UE_stats[CC_id]->dlsch_mcs1,nb_rbs_required[CC_id][UE_id]); + } // end of while + + LOG_D(MAC,"[eNB %d] Frame %d: UE %d on CC %d: RB unit %d, nb_required RB %d (TBS %d, mcs %d)\n", + Mod_id, frameP,UE_id, CC_id, min_rb_unit[CC_id], nb_rbs_required[CC_id][UE_id], TBS, eNB_UE_stats[CC_id]->dlsch_mcs1); + } + } + } +} + +// This function scans all CC_ids for a particular UE to find the maximum round index of its HARQ processes +int _maxround(module_id_t Mod_id,uint16_t rnti,int frame,sub_frame_t subframe,uint8_t ul_flag ) +{ + + uint8_t round,round_max=0,UE_id; + int CC_id; + UE_list_t *UE_list = &eNB_mac_inst[Mod_id].UE_list; + + for (CC_id=0; CC_idUE_sched_ctrl[UE_id].round[CC_id]; + if (round > round_max) { + round_max = round; + } + } + + return round_max; +} + +// This function scans all CC_ids for a particular UE to find the maximum DL CQI +int _maxcqi(module_id_t Mod_id,int32_t UE_id) +{ + + LTE_eNB_UE_stats *eNB_UE_stats = NULL; + UE_list_t *UE_list = &eNB_mac_inst[Mod_id].UE_list; + int CC_id,n; + int CQI = 0; + + for (n=0; nnumactiveCCs[UE_id]; n++) { + CC_id = UE_list->ordered_CCids[n][UE_id]; + eNB_UE_stats = mac_xface->get_eNB_UE_stats(Mod_id,CC_id,UE_RNTI(Mod_id,UE_id)); + + if (eNB_UE_stats==NULL) { + mac_xface->macphy_exit("maxcqi: could not get eNB_UE_stats\n"); + return 0; // not reached + } + + if (eNB_UE_stats->DL_cqi[0] > CQI) { + CQI = eNB_UE_stats->DL_cqi[0]; + } + } + + return(CQI); +} + + +// This fuction sorts the UE in order their dlsch buffer and CQI +void _sort_UEs (module_id_t Mod_idP, + int frameP, + sub_frame_t subframeP) +{ + + + int UE_id1,UE_id2; + int pCC_id1,pCC_id2; + int cqi1,cqi2,round1,round2; + int i=0,ii=0;//,j=0; + rnti_t rnti1,rnti2; + + UE_list_t *UE_list = &eNB_mac_inst[Mod_idP].UE_list; + + for (i=UE_list->head; i>=0; i=UE_list->next[i]) { + + for(ii=UE_list->next[i]; ii>=0; ii=UE_list->next[ii]) { + + UE_id1 = i; + rnti1 = UE_RNTI(Mod_idP,UE_id1); + if(rnti1 == NOT_A_RNTI) + continue; + if (UE_list->UE_sched_ctrl[UE_id1].ul_out_of_sync == 1) + continue; + pCC_id1 = UE_PCCID(Mod_idP,UE_id1); + cqi1 = _maxcqi(Mod_idP,UE_id1); // + round1 = _maxround(Mod_idP,rnti1,frameP,subframeP,0); + + UE_id2 = ii; + rnti2 = UE_RNTI(Mod_idP,UE_id2); + if(rnti2 == NOT_A_RNTI) + continue; + if (UE_list->UE_sched_ctrl[UE_id2].ul_out_of_sync == 1) + continue; + cqi2 = _maxcqi(Mod_idP,UE_id2); + round2 = _maxround(Mod_idP,rnti2,frameP,subframeP,0); //mac_xface->get_ue_active_harq_pid(Mod_id,rnti2,subframe,&harq_pid2,&round2,0); + pCC_id2 = UE_PCCID(Mod_idP,UE_id2); + + if(round2 > round1) { // Check first if one of the UEs has an active HARQ process which needs service and swap order + swap_UEs(UE_list,UE_id1,UE_id2,0); + } else if (round2 == round1) { + // RK->NN : I guess this is for fairness in the scheduling. This doesn't make sense unless all UEs have the same configuration of logical channels. This should be done on the sum of all information that has to be sent. And still it wouldn't ensure fairness. It should be based on throughput seen by each UE or maybe using the head_sdu_creation_time, i.e. swap UEs if one is waiting longer for service. + + // first check the buffer status for SRB1 and SRB2 + if ( (UE_list->UE_template[pCC_id1][UE_id1].dl_buffer_info[1] + UE_list->UE_template[pCC_id1][UE_id1].dl_buffer_info[2]) < + (UE_list->UE_template[pCC_id2][UE_id2].dl_buffer_info[1] + UE_list->UE_template[pCC_id2][UE_id2].dl_buffer_info[2]) ) { + swap_UEs(UE_list,UE_id1,UE_id2,0); + } else if (UE_list->UE_template[pCC_id1][UE_id1].dl_buffer_head_sdu_creation_time_max < + UE_list->UE_template[pCC_id2][UE_id2].dl_buffer_head_sdu_creation_time_max ) { + swap_UEs(UE_list,UE_id1,UE_id2,0); + } else if (UE_list->UE_template[pCC_id1][UE_id1].dl_buffer_total < + UE_list->UE_template[pCC_id2][UE_id2].dl_buffer_total ) { + swap_UEs(UE_list,UE_id1,UE_id2,0); + } else if (cqi1 < cqi2) { + swap_UEs(UE_list,UE_id1,UE_id2,0); + } + } + } + } +} + +// This function assigns pre-available RBS to each UE in specified sub-bands before scheduling is done +void _dlsch_scheduler_pre_processor (module_id_t Mod_id, + frame_t frameP, + sub_frame_t subframeP, + int N_RBG[MAX_NUM_CCs], + int *mbsfn_flag) +{ + + unsigned char rballoc_sub[MAX_NUM_CCs][N_RBG_MAX], harq_pid=0, total_ue_count; + unsigned char MIMO_mode_indicator[MAX_NUM_CCs][N_RBG_MAX]; + int UE_id, i; + unsigned char round = 0; + uint16_t ii,j; + uint16_t nb_rbs_required[MAX_NUM_CCs][NUMBER_OF_UE_MAX]; + uint16_t nb_rbs_required_remaining[MAX_NUM_CCs][NUMBER_OF_UE_MAX]; + uint16_t nb_rbs_required_remaining_1[MAX_NUM_CCs][NUMBER_OF_UE_MAX]; + uint16_t average_rbs_per_user[MAX_NUM_CCs] = {0}; + rnti_t rnti; + int min_rb_unit[MAX_NUM_CCs]; + uint16_t r1=0; + uint8_t CC_id; + UE_list_t *UE_list = &eNB_mac_inst[Mod_id].UE_list; + LTE_DL_FRAME_PARMS *frame_parms[MAX_NUM_CCs] = {0}; + + int transmission_mode = 0; + UE_sched_ctrl *ue_sched_ctl; + + for (CC_id=0; CC_id0) // If this CC is allocated for MBSFN skip it here + continue; + + frame_parms[CC_id] = mac_xface->get_lte_frame_parms(Mod_id,CC_id); + + + min_rb_unit[CC_id]=get_min_rb_unit(Mod_id,CC_id); + + for (i=UE_list->head; i>=0; i=UE_list->next[i]) { + UE_id = i; + // Initialize scheduling information for all active UEs + + + _dlsch_scheduler_pre_processor_reset(Mod_id, + UE_id, + CC_id, + frameP, + subframeP, + N_RBG[CC_id], + nb_rbs_required, + nb_rbs_required_remaining, + rballoc_sub, + MIMO_mode_indicator); + + } + } + + // Store the DLSCH buffer for each logical channel + _store_dlsch_buffer (Mod_id,frameP,subframeP); + + // Calculate the number of RBs required by each UE on the basis of logical channel's buffer + _assign_rbs_required (Mod_id,frameP,subframeP,nb_rbs_required,min_rb_unit); + + // Sorts the user on the basis of dlsch logical channel buffer and CQI + _sort_UEs (Mod_id,frameP,subframeP); + + total_ue_count = 0; + + // loop over all active UEs + for (i=UE_list->head; i>=0; i=UE_list->next[i]) { + rnti = flexran_get_ue_crnti(Mod_id, i); + if(rnti == NOT_A_RNTI) + continue; + if (UE_list->UE_sched_ctrl[i].ul_out_of_sync == 1) + continue; + UE_id = i; + + // if there is no available harq_process, skip the UE + if (UE_list->UE_sched_ctrl[UE_id].harq_pid[CC_id]<0) + continue; + + for (ii=0; ii < UE_num_active_CC(UE_list,UE_id); ii++) { + CC_id = UE_list->ordered_CCids[ii][UE_id]; + ue_sched_ctl = &UE_list->UE_sched_ctrl[UE_id]; + flexran_get_harq(Mod_id, CC_id, UE_id, frameP, subframeP, &harq_pid, &round); + + average_rbs_per_user[CC_id]=0; + + frame_parms[CC_id] = mac_xface->get_lte_frame_parms(Mod_id,CC_id); + + // mac_xface->get_ue_active_harq_pid(Mod_id,CC_id,rnti,frameP,subframeP,&harq_pid,&round,0); + + if(round>0) { + nb_rbs_required[CC_id][UE_id] = UE_list->UE_template[CC_id][UE_id].nb_rb[harq_pid]; + } + + //nb_rbs_required_remaining[UE_id] = nb_rbs_required[UE_id]; + if (nb_rbs_required[CC_id][UE_id] > 0) { + total_ue_count = total_ue_count + 1; + } + + + // hypotetical assignement + /* + * If schedule is enabled and if the priority of the UEs is modified + * The average rbs per logical channel per user will depend on the level of + * priority. Concerning the hypothetical assignement, we should assign more + * rbs to prioritized users. Maybe, we can do a mapping between the + * average rbs per user and the level of priority or multiply the average rbs + * per user by a coefficient which represents the degree of priority. + */ + + if (total_ue_count == 0) { + average_rbs_per_user[CC_id] = 0; + } else if( (min_rb_unit[CC_id] * total_ue_count) <= (frame_parms[CC_id]->N_RB_DL) ) { + average_rbs_per_user[CC_id] = (uint16_t) floor(frame_parms[CC_id]->N_RB_DL/total_ue_count); + } else { + average_rbs_per_user[CC_id] = min_rb_unit[CC_id]; // consider the total number of use that can be scheduled UE + } + } + } + + // note: nb_rbs_required is assigned according to total_buffer_dl + // extend nb_rbs_required to capture per LCID RB required + for(i=UE_list->head; i>=0; i=UE_list->next[i]) { + rnti = UE_RNTI(Mod_id,i); + + for (ii=0; iiordered_CCids[ii][i]; + + // control channel + if (mac_eNB_get_rrc_status(Mod_id,rnti) < RRC_RECONFIGURED) { + nb_rbs_required_remaining_1[CC_id][i] = nb_rbs_required[CC_id][i]; + } else { + nb_rbs_required_remaining_1[CC_id][i] = cmin(average_rbs_per_user[CC_id],nb_rbs_required[CC_id][i]); + + } + } + } + + //Allocation to UEs is done in 2 rounds, + // 1st stage: average number of RBs allocated to each UE + // 2nd stage: remaining RBs are allocated to high priority UEs + for(r1=0; r1<2; r1++) { + + for(i=UE_list->head; i>=0; i=UE_list->next[i]) { + for (ii=0; iiordered_CCids[ii][i]; + + if(r1 == 0) { + nb_rbs_required_remaining[CC_id][i] = nb_rbs_required_remaining_1[CC_id][i]; + } else { // rb required based only on the buffer - rb allloctaed in the 1st round + extra reaming rb form the 1st round + nb_rbs_required_remaining[CC_id][i] = nb_rbs_required[CC_id][i]-nb_rbs_required_remaining_1[CC_id][i]+nb_rbs_required_remaining[CC_id][i]; + } + + if (nb_rbs_required[CC_id][i]> 0 ) + LOG_D(MAC,"round %d : nb_rbs_required_remaining[%d][%d]= %d (remaining_1 %d, required %d, pre_nb_available_rbs %d, N_RBG %d, rb_unit %d)\n", + r1, CC_id, i, + nb_rbs_required_remaining[CC_id][i], + nb_rbs_required_remaining_1[CC_id][i], + nb_rbs_required[CC_id][i], + UE_list->UE_sched_ctrl[i].pre_nb_available_rbs[CC_id], + N_RBG[CC_id], + min_rb_unit[CC_id]); + + } + } + + if (total_ue_count > 0 ) { + for(i=UE_list->head; i>=0; i=UE_list->next[i]) { + UE_id = i; + + for (ii=0; iiordered_CCids[ii][UE_id]; + ue_sched_ctl = &UE_list->UE_sched_ctrl[UE_id]; + flexran_get_harq(Mod_id, CC_id, UE_id, frameP, subframeP, &harq_pid, &round); + rnti = UE_RNTI(Mod_id,UE_id); + + // LOG_D(MAC,"UE %d rnti 0x\n", UE_id, rnti ); + if(rnti == NOT_A_RNTI) + continue; + if (UE_list->UE_sched_ctrl[UE_id].ul_out_of_sync == 1) + continue; + + transmission_mode = mac_xface->get_transmission_mode(Mod_id,CC_id,rnti); + //rrc_status = mac_eNB_get_rrc_status(Mod_id,rnti); + /* 1st allocate for the retx */ + + // retransmission in data channels + // control channel in the 1st transmission + // data channel for all TM + LOG_T(MAC,"calling dlsch_scheduler_pre_processor_allocate .. \n "); + _dlsch_scheduler_pre_processor_allocate (Mod_id, + UE_id, + CC_id, + N_RBG[CC_id], + transmission_mode, + min_rb_unit[CC_id], + frame_parms[CC_id]->N_RB_DL, + nb_rbs_required, + nb_rbs_required_remaining, + rballoc_sub, + MIMO_mode_indicator); + } + } + } // total_ue_count + } // end of for for r1 and r2 + + for(i=UE_list->head; i>=0; i=UE_list->next[i]) { + UE_id = i; + ue_sched_ctl = &UE_list->UE_sched_ctrl[UE_id]; + + for (ii=0; iiordered_CCids[ii][UE_id]; + //PHY_vars_eNB_g[Mod_id]->mu_mimo_mode[UE_id].dl_pow_off = dl_pow_off[UE_id]; + + if (ue_sched_ctl->pre_nb_available_rbs[CC_id] > 0 ) { + LOG_D(MAC,"******************DL Scheduling Information for UE%d ************************\n",UE_id); + LOG_D(MAC,"dl power offset UE%d = %d \n",UE_id,ue_sched_ctl->dl_pow_off[CC_id]); + LOG_D(MAC,"***********RB Alloc for every subband for UE%d ***********\n",UE_id); + + for(j=0; jmu_mimo_mode[UE_id].rballoc_sub[i] = rballoc_sub_UE[CC_id][UE_id][i]; + LOG_D(MAC,"RB Alloc for UE%d and Subband%d = %d\n",UE_id,j,ue_sched_ctl->rballoc_sub_UE[CC_id][j]); + } + + //PHY_vars_eNB_g[Mod_id]->mu_mimo_mode[UE_id].pre_nb_available_rbs = pre_nb_available_rbs[CC_id][UE_id]; + LOG_D(MAC,"Total RBs allocated for UE%d = %d\n",UE_id,ue_sched_ctl->pre_nb_available_rbs[CC_id]); + } + } + } +} + +#define SF05_LIMIT 1 + +void _dlsch_scheduler_pre_processor_reset (int module_idP, + int UE_id, + uint8_t CC_id, + int frameP, + int subframeP, + int N_RBG, + uint16_t nb_rbs_required[MAX_NUM_CCs][NUMBER_OF_UE_MAX], + uint16_t nb_rbs_required_remaining[MAX_NUM_CCs][NUMBER_OF_UE_MAX], + unsigned char rballoc_sub[MAX_NUM_CCs][N_RBG_MAX], + unsigned char MIMO_mode_indicator[MAX_NUM_CCs][N_RBG_MAX]) { + int i,j; + UE_list_t *UE_list=&eNB_mac_inst[module_idP].UE_list; + UE_sched_ctrl *ue_sched_ctl = &UE_list->UE_sched_ctrl[UE_id]; + rnti_t rnti = UE_RNTI(module_idP,UE_id); + uint8_t *vrb_map = eNB_mac_inst[module_idP].common_channels[CC_id].vrb_map; + int RBGsize = PHY_vars_eNB_g[module_idP][CC_id]->frame_parms.N_RB_DL/N_RBG; +#ifdef SF05_LIMIT + //int subframe05_limit=0; + int sf05_upper=-1,sf05_lower=-1; +#endif + LTE_eNB_UE_stats *eNB_UE_stats = mac_xface->get_eNB_UE_stats(module_idP,CC_id,rnti); + + flexran_update_TA(module_idP, UE_id, CC_id); + + if (UE_id==0) { + VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_UE0_TIMING_ADVANCE,ue_sched_ctl->ta_update); + } + nb_rbs_required[CC_id][UE_id]=0; + ue_sched_ctl->pre_nb_available_rbs[CC_id] = 0; + ue_sched_ctl->dl_pow_off[CC_id] = 2; + nb_rbs_required_remaining[CC_id][UE_id] = 0; + +#ifdef SF05_LIMIT + switch (N_RBG) { + case 6: + sf05_lower=0; + sf05_upper=5; + break; + case 8: + sf05_lower=2; + sf05_upper=5; + break; + case 13: + sf05_lower=4; + sf05_upper=7; + break; + case 17: + sf05_lower=7; + sf05_upper=9; + break; + case 25: + sf05_lower=11; + sf05_upper=13; + break; + } +#endif + // Initialize Subbands according to VRB map + for (i=0; irballoc_sub_UE[CC_id][i] = 0; + rballoc_sub[CC_id][i] = 0; +#ifdef SF05_LIMIT + // for avoiding 6+ PRBs around DC in subframe 0-5 (avoid excessive errors) + + if ((subframeP==0 || subframeP==5) && + (i>=sf05_lower && i<=sf05_upper)) + rballoc_sub[CC_id][i]=1; +#endif + // for SI-RNTI,RA-RNTI and P-RNTI allocations + for (j=0;jUE_sched_ctrl[UE_id]; + + for(i=0; irballoc_sub_UE[CC_id][i] == 0) && + (nb_rbs_required_remaining[CC_id][UE_id]>0) && + (ue_sched_ctl->pre_nb_available_rbs[CC_id] < nb_rbs_required[CC_id][UE_id])) { + + // if this UE is not scheduled for TM5 + if (ue_sched_ctl->dl_pow_off[CC_id] != 0 ) { + + if ((i == N_RBG-1) && ((N_RB_DL == 25) || (N_RB_DL == 50))) { + rballoc_sub[CC_id][i] = 1; + ue_sched_ctl->rballoc_sub_UE[CC_id][i] = 1; + MIMO_mode_indicator[CC_id][i] = 1; + if (transmission_mode == 5 ) { + ue_sched_ctl->dl_pow_off[CC_id] = 1; + } + nb_rbs_required_remaining[CC_id][UE_id] = nb_rbs_required_remaining[CC_id][UE_id] - min_rb_unit+1; + ue_sched_ctl->pre_nb_available_rbs[CC_id] = ue_sched_ctl->pre_nb_available_rbs[CC_id] + min_rb_unit - 1; + } else { + if (nb_rbs_required_remaining[CC_id][UE_id] >= min_rb_unit){ + rballoc_sub[CC_id][i] = 1; + ue_sched_ctl->rballoc_sub_UE[CC_id][i] = 1; + MIMO_mode_indicator[CC_id][i] = 1; + if (transmission_mode == 5 ) { + ue_sched_ctl->dl_pow_off[CC_id] = 1; + } + nb_rbs_required_remaining[CC_id][UE_id] = nb_rbs_required_remaining[CC_id][UE_id] - min_rb_unit; + ue_sched_ctl->pre_nb_available_rbs[CC_id] = ue_sched_ctl->pre_nb_available_rbs[CC_id] + min_rb_unit; + } + } + } // dl_pow_off[CC_id][UE_id] ! = 0 + } + } +} From 8750acebbcf3c13de3d35a21f196b2f4e0f89c09 Mon Sep 17 00:00:00 2001 From: GabrirelCouturier Date: Mon, 7 Nov 2016 10:50:05 +0100 Subject: [PATCH 260/349] [OAI-UE] fix for issue#14: segmentation fault in turbo decoder --- openair1/PHY/LTE_TRANSPORT/dci_tools.c | 33 +++++++++++++++++++++ openair1/PHY/LTE_TRANSPORT/dlsch_decoding.c | 12 +++++++- openair1/SCHED/phy_procedures_lte_ue.c | 4 +-- openair1/SCHED/pucch_pc.c | 4 +-- 4 files changed, 48 insertions(+), 5 deletions(-) diff --git a/openair1/PHY/LTE_TRANSPORT/dci_tools.c b/openair1/PHY/LTE_TRANSPORT/dci_tools.c index aa2daf8ebb..3624d67af1 100644 --- a/openair1/PHY/LTE_TRANSPORT/dci_tools.c +++ b/openair1/PHY/LTE_TRANSPORT/dci_tools.c @@ -1260,6 +1260,11 @@ int generate_eNB_dlsch_params_from_dci(int frame, dlsch0_harq->TBS = TBStable[get_I_TBS(dlsch0_harq->mcs)][NPRB-1]; } + else + { + LOG_E(PHY,"DL Received HarqReTx round=%d mcs=%d rballoc=%d rv=%d \n", + dlsch0_harq->round,mcs,rballoc,rv); + } dlsch[0]->current_harq_pid = harq_pid; @@ -4143,6 +4148,20 @@ int generate_ue_dlsch_params_from_dci(int frame, dlsch0_harq->DCINdi = ndi; + // this a retransmission + if(dlsch0_harq->round) + { + // compare old TBS to new TBS + if(dlsch0_harq->TBS != TBStable[get_I_TBS(mcs)][NPRB-1]) + { + // this is an eNB issue + // retransmisison but old and new TBS are different !!! + // work around, consider it as a new transmission + LOG_E(PHY,"Format1A Retransmission but TBS are different: consider it as new transmission !!! \n"); + dlsch0_harq->round = 0; + } + } + dlsch0_harq->mcs = mcs; if ((rnti==si_rnti) || (rnti==p_rnti) || (rnti==ra_rnti)) { dlsch0_harq->TBS = TBStable[mcs][NPRB-1]; @@ -4452,6 +4471,20 @@ int generate_ue_dlsch_params_from_dci(int frame, dlsch0_harq->mcs = mcs; + // this a retransmission + if(dlsch0_harq->round) + { + // compare old TBS to new TBS + if(dlsch0_harq->TBS != TBStable[get_I_TBS(mcs)][NPRB-1]) + { + // this is an eNB issue + // retransmisison but old and new TBS are different !!! + // work around, consider it as a new transmission + LOG_E(PHY,"Format1 Retransmission but TBS are different: consider it as new transmission !!! \n"); + dlsch0_harq->round = 0; + } + } + dlsch0_harq->TBS = TBStable[get_I_TBS(mcs)][NPRB-1]; if (mcs <= 28) dlsch0_harq->Qm = get_Qm(mcs); diff --git a/openair1/PHY/LTE_TRANSPORT/dlsch_decoding.c b/openair1/PHY/LTE_TRANSPORT/dlsch_decoding.c index f4ab4c0924..c7cd5ab52f 100644 --- a/openair1/PHY/LTE_TRANSPORT/dlsch_decoding.c +++ b/openair1/PHY/LTE_TRANSPORT/dlsch_decoding.c @@ -249,7 +249,12 @@ uint32_t dlsch_decoding(PHY_VARS_UE *phy_vars_ue, tc = phy_threegpplte_turbo_decoder16; } else - tc = phy_threegpplte_turbo_decoder8; + { + AssertFatal (harq_process->TBS >= 256 , "Mismatch flag nbRB=%d TBS=%d mcs=%d Qm=%d RIV=%d round=%d \n", + harq_process->nb_rb, harq_process->TBS,harq_process->mcs,harq_process->Qm,harq_process->rvidx,harq_process->round); + tc = phy_threegpplte_turbo_decoder8; + } + // nb_rb = dlsch->nb_rb; @@ -448,6 +453,11 @@ uint32_t dlsch_decoding(PHY_VARS_UE *phy_vars_ue, #if 1 if (err_flag == 0) { + if (llr8_flag) { + AssertFatal (Kr >= 256, "turbo algo issue Kr=%d cb_cnt=%d C=%d nbRB=%d TBSInput=%d TBSHarq=%d TBSplus24=%d mcs=%d Qm=%d RIV=%d round=%d\n", + Kr,r,harq_process->C,harq_process->nb_rb,A,harq_process->TBS,harq_process->B,harq_process->mcs,harq_process->Qm,harq_process->rvidx,harq_process->round); + } + start_meas(dlsch_turbo_decoding_stats); ret = tc (&harq_process->d[r][96], diff --git a/openair1/SCHED/phy_procedures_lte_ue.c b/openair1/SCHED/phy_procedures_lte_ue.c index 756f13f923..55e7686462 100644 --- a/openair1/SCHED/phy_procedures_lte_ue.c +++ b/openair1/SCHED/phy_procedures_lte_ue.c @@ -2579,7 +2579,7 @@ int ue_pdcch_procedures(uint8_t eNB_id,PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint if (generate_ue_dlsch_params_from_dci(frame_rx, subframe_rx, (void *)&dci_alloc_rx[i].dci_pdu, - SI_RNTI, + P_RNTI, dci_alloc_rx[i].format, &ue->dlsch_SI[eNB_id], &ue->frame_parms, @@ -3072,7 +3072,7 @@ void ue_dlsch_procedures(PHY_VARS_UE *ue, subframe_rx, harq_pid, pdsch==PDSCH?1:0, - dlsch0->harq_processes[harq_pid]->nb_rb>10?1:0); + dlsch0->harq_processes[harq_pid]->TBS>256?1:0); stop_meas(&ue->dlsch_decoding_stats); } diff --git a/openair1/SCHED/pucch_pc.c b/openair1/SCHED/pucch_pc.c index 5afd57e6a0..2795fe65a9 100644 --- a/openair1/SCHED/pucch_pc.c +++ b/openair1/SCHED/pucch_pc.c @@ -88,7 +88,7 @@ int8_t pucch_power_cntl(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t subframe,ui } if (pucch_fmt!=pucch_format1) { - LOG_I(PHY,"[UE %d][PDSCH %x] frame %d, subframe %d: Po_PUCCH %d dBm : Po_NOMINAL_PUCCH %d dBm, PL %d dB, g_pucch %d dB\n", + LOG_D(PHY,"[UE %d][PDSCH %x] frame %d, subframe %d: Po_PUCCH %d dBm : Po_NOMINAL_PUCCH %d dBm, PL %d dB, g_pucch %d dB\n", ue->Mod_id, ue->dlsch[eNB_id][0]->rnti,proc->frame_tx,subframe, Po_PUCCH, @@ -96,7 +96,7 @@ int8_t pucch_power_cntl(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t subframe,ui get_PL(ue->Mod_id,ue->CC_id,eNB_id), ue->dlsch[eNB_id][0]->g_pucch); } else { - LOG_I(PHY,"[UE %d][SR %x] frame %d, subframe %d: Po_PUCCH %d dBm : Po_NOMINAL_PUCCH %d dBm, PL %d dB g_pucch %d dB\n", + LOG_D(PHY,"[UE %d][SR %x] frame %d, subframe %d: Po_PUCCH %d dBm : Po_NOMINAL_PUCCH %d dBm, PL %d dB g_pucch %d dB\n", ue->Mod_id, ue->dlsch[eNB_id][0]->rnti,proc->frame_tx,subframe, Po_PUCCH, From 5e94d108a194506e62b5d95bde4b0faf4398be41 Mon Sep 17 00:00:00 2001 From: GabrirelCouturier Date: Mon, 7 Nov 2016 11:01:25 +0100 Subject: [PATCH 261/349] [OAI-UE] fix for issue#18: Cell sync issue --- openair1/PHY/LTE_ESTIMATION/lte_est_freq_offset.c | 15 ++++++++------- openair1/PHY/LTE_TRANSPORT/initial_sync.c | 7 +++++++ 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/openair1/PHY/LTE_ESTIMATION/lte_est_freq_offset.c b/openair1/PHY/LTE_ESTIMATION/lte_est_freq_offset.c index 6ebd8948cf..d713cc0163 100644 --- a/openair1/PHY/LTE_ESTIMATION/lte_est_freq_offset.c +++ b/openair1/PHY/LTE_ESTIMATION/lte_est_freq_offset.c @@ -102,7 +102,7 @@ int lte_est_freq_offset(int **dl_ch_estimates, { int ch_offset, omega, dl_ch_shift; - struct complex16 *omega_cpx; + struct complex16 omega_cpx; double phase_offset; int freq_offset_est; unsigned char aa; @@ -142,9 +142,8 @@ int lte_est_freq_offset(int **dl_ch_estimates, // printf("Computing freq_offset\n"); omega = dot_product(dl_ch,dl_ch_prev,(frame_parms->N_RB_DL/2 - 1)*12,dl_ch_shift); //omega = dot_product(dl_ch,dl_ch_prev,frame_parms->ofdm_symbol_size,15); - omega_cpx = (struct complex16*) ω - - // printf("omega (%d,%d)\n",omega_cpx->r,omega_cpx->i); + omega_cpx.r = ((struct complex16*) &omega)->r; + omega_cpx.i = ((struct complex16*) &omega)->i; dl_ch = (int16_t *)&dl_ch_estimates[aa][(((frame_parms->N_RB_DL/2) + 1)*12) + ch_offset]; @@ -155,10 +154,12 @@ int lte_est_freq_offset(int **dl_ch_estimates, // calculate omega = angle(conj(dl_ch)*dl_ch_prev)) omega = dot_product(dl_ch,dl_ch_prev,((frame_parms->N_RB_DL/2) - 1)*12,dl_ch_shift); - omega_cpx->r += ((struct complex16*) &omega)->r; - omega_cpx->i += ((struct complex16*) &omega)->i; + + omega_cpx.r += ((struct complex16*) &omega)->r; + omega_cpx.i += ((struct complex16*) &omega)->i; + // phase_offset += atan2((double)omega_cpx->i,(double)omega_cpx->r); - phase_offset += atan2((double)omega_cpx->i,(double)omega_cpx->r); + phase_offset += atan2((double)omega_cpx.i,(double)omega_cpx.r); // LOG_I(PHY,"omega (%d,%d) -> %f\n",omega_cpx->r,omega_cpx->i,phase_offset); } diff --git a/openair1/PHY/LTE_TRANSPORT/initial_sync.c b/openair1/PHY/LTE_TRANSPORT/initial_sync.c index 661fe96be8..91374078c0 100644 --- a/openair1/PHY/LTE_TRANSPORT/initial_sync.c +++ b/openair1/PHY/LTE_TRANSPORT/initial_sync.c @@ -462,6 +462,13 @@ int initial_sync(PHY_VARS_UE *ue, runmode_t mode) } } + /* Consider this is a false detection if the offset is > 1000 Hz */ + if( (abs(ue->common_vars.freq_offset) > 1000) && (ret == 0) ) + { + ret=-1; + LOG_E(HW,"Ignore MIB with high freq offset [%d Hz] estimation \n",ue->common_vars.freq_offset); + } + if (ret==0) { // PBCH found so indicate sync to higher layers and configure frame parameters //#ifdef DEBUG_INITIAL_SYNCH From 048b5384dd30aec8246020f0e1c30d5b8dd1970a Mon Sep 17 00:00:00 2001 From: fnabet Date: Mon, 7 Nov 2016 11:22:11 +0100 Subject: [PATCH 262/349] [OAI-UE] revert commit 8236206c and 9672b410 "BSR-stabilization + rebase from oai1B" --- openair2/LAYER2/MAC/config.c | 25 +--- openair2/LAYER2/MAC/defs.h | 14 +-- openair2/LAYER2/MAC/extern.h | 2 - openair2/LAYER2/MAC/proto.h | 6 +- openair2/LAYER2/MAC/ra_procedures.c | 2 +- openair2/LAYER2/MAC/ue_procedures.c | 184 +++++++++------------------- openair2/LAYER2/MAC/vars.h | 9 -- 7 files changed, 66 insertions(+), 176 deletions(-) diff --git a/openair2/LAYER2/MAC/config.c b/openair2/LAYER2/MAC/config.c index d46b761bd0..3fbcadafbb 100644 --- a/openair2/LAYER2/MAC/config.c +++ b/openair2/LAYER2/MAC/config.c @@ -69,7 +69,6 @@ void ue_mac_reset(module_id_t module_idP,uint8_t eNB_index) // cancel all pending SRs UE_mac_inst[module_idP].scheduling_info.SR_pending=0; UE_mac_inst[module_idP].scheduling_info.SR_COUNTER=0; - UE_mac_inst[module_idP].BSR_reporting_active=0; // stop ongoing RACH procedure @@ -226,34 +225,13 @@ rrc_mac_config_req( if (mac_MainConfig->ext1 && mac_MainConfig->ext1->sr_ProhibitTimer_r9) { UE_mac_inst[Mod_idP].scheduling_info.sr_ProhibitTimer = (uint16_t) *mac_MainConfig->ext1->sr_ProhibitTimer_r9; } else { - UE_mac_inst[Mod_idP].scheduling_info.sr_ProhibitTimer = 0; + UE_mac_inst[Mod_idP].scheduling_info.sr_ProhibitTimer = (uint16_t) 0; } - if (mac_MainConfig->ext2 && mac_MainConfig->ext2->mac_MainConfig_v1020) { - if (mac_MainConfig->ext2->mac_MainConfig_v1020->extendedBSR_Sizes_r10) { - UE_mac_inst[Mod_idP].scheduling_info.extendedBSR_Sizes_r10 = (uint16_t) *mac_MainConfig->ext2->mac_MainConfig_v1020->extendedBSR_Sizes_r10; - } else { - UE_mac_inst[Mod_idP].scheduling_info.extendedBSR_Sizes_r10 = (uint16_t)0; - } - if (mac_MainConfig->ext2->mac_MainConfig_v1020->extendedPHR_r10) { - UE_mac_inst[Mod_idP].scheduling_info.extendedPHR_r10 = (uint16_t) *mac_MainConfig->ext2->mac_MainConfig_v1020->extendedPHR_r10; - } else { - UE_mac_inst[Mod_idP].scheduling_info.extendedPHR_r10 = (uint16_t)0; - } - } else { - UE_mac_inst[Mod_idP].scheduling_info.extendedBSR_Sizes_r10 = (uint16_t)0; - UE_mac_inst[Mod_idP].scheduling_info.extendedPHR_r10 = (uint16_t)0; - } #endif UE_mac_inst[Mod_idP].scheduling_info.periodicBSR_SF = get_sf_periodicBSRTimer(UE_mac_inst[Mod_idP].scheduling_info.periodicBSR_Timer); UE_mac_inst[Mod_idP].scheduling_info.retxBSR_SF = get_sf_retxBSRTimer(UE_mac_inst[Mod_idP].scheduling_info.retxBSR_Timer); - UE_mac_inst[Mod_idP].BSR_reporting_active = 0; - LOG_D(MAC,"[UE %d]: periodic BSR %d (SF), retx BSR %d (SF)\n", - Mod_idP, - UE_mac_inst[Mod_idP].scheduling_info.periodicBSR_SF, - UE_mac_inst[Mod_idP].scheduling_info.retxBSR_SF); - UE_mac_inst[Mod_idP].scheduling_info.drx_config = mac_MainConfig->drx_Config; UE_mac_inst[Mod_idP].scheduling_info.phr_config = mac_MainConfig->phr_Config; @@ -274,7 +252,6 @@ rrc_mac_config_req( UE_mac_inst[Mod_idP].scheduling_info.periodicPHR_SF = get_sf_perioidicPHR_Timer(UE_mac_inst[Mod_idP].scheduling_info.periodicPHR_Timer); UE_mac_inst[Mod_idP].scheduling_info.prohibitPHR_SF = get_sf_prohibitPHR_Timer(UE_mac_inst[Mod_idP].scheduling_info.prohibitPHR_Timer); UE_mac_inst[Mod_idP].scheduling_info.PathlossChange_db = get_db_dl_PathlossChange(UE_mac_inst[Mod_idP].scheduling_info.PathlossChange); - UE_mac_inst[Mod_idP].PHR_reporting_active = 0; LOG_D(MAC,"[UE %d] config PHR (%d): periodic %d (SF) prohibit %d (SF) pathlosschange %d (db) \n", Mod_idP, (mac_MainConfig->phr_Config)?mac_MainConfig->phr_Config->present:-1, diff --git a/openair2/LAYER2/MAC/defs.h b/openair2/LAYER2/MAC/defs.h index d38ca05362..2235c3e1c4 100644 --- a/openair2/LAYER2/MAC/defs.h +++ b/openair2/LAYER2/MAC/defs.h @@ -945,12 +945,8 @@ typedef enum { typedef struct { /// buffer status for each lcgid uint8_t BSR[MAX_NUM_LCGID]; // should be more for mesh topology - /// keep the number of bytes in rlc buffer for each lcgid + /// keep the number of bytes in rlc buffer for each lcid uint16_t BSR_bytes[MAX_NUM_LCGID]; -#if 0 //calvin for BSR test,current buffer greater then previous one, or buffer from 0 to !0 - /// after multiplexing buffer remain for each lcid - uint16_t LCID_buffer_remain[MAX_NUM_LCID]; -#endif /// buffer status for each lcid uint8_t LCID_status[MAX_NUM_LCID]; /// SR pending as defined in 36.321 @@ -991,12 +987,6 @@ typedef struct { int16_t prohibitPHR_SF; ///DL Pathloss Change in db uint16_t PathlossChange_db; - - /// default value is false - uint16_t extendedBSR_Sizes_r10; - /// default value is false - uint16_t extendedPHR_r10; - //Bj bucket usage per lcid int16_t Bj[MAX_NUM_LCID]; // Bucket size per lcid @@ -1084,8 +1074,6 @@ typedef struct { uint8_t PHR_reporting_active; /// power backoff due to power management (as allowed by P-MPRc) for this cell uint8_t power_backoff_db[NUMBER_OF_eNB_MAX]; - /// BSR report falg management - uint8_t BSR_reporting_active; /// MBSFN_Subframe Configuration struct MBSFN_SubframeConfig *mbsfn_SubframeConfig[8]; // FIXME replace 8 by MAX_MBSFN_AREA? /// number of subframe allocation pattern available for MBSFN sync area diff --git a/openair2/LAYER2/MAC/extern.h b/openair2/LAYER2/MAC/extern.h index 4276c342cf..8726cb1349 100644 --- a/openair2/LAYER2/MAC/extern.h +++ b/openair2/LAYER2/MAC/extern.h @@ -46,8 +46,6 @@ extern const uint32_t BSR_TABLE[BSR_TABLE_SIZE]; //extern uint32_t EBSR_Level[63]; -extern const uint32_t Extended_BSR_TABLE[BSR_TABLE_SIZE]; -//extern uint32_t Extended_BSR_TABLE[63]; ----currently not used extern UE_MAC_INST *UE_mac_inst; extern eNB_MAC_INST *eNB_mac_inst; diff --git a/openair2/LAYER2/MAC/proto.h b/openair2/LAYER2/MAC/proto.h index 248f918dc1..59d6c352fe 100644 --- a/openair2/LAYER2/MAC/proto.h +++ b/openair2/LAYER2/MAC/proto.h @@ -551,7 +551,7 @@ int get_bsr_lcgid (module_id_t module_idP); \param[in] bufflen size of phy transport block \param[out] bsr_len size of bsr control element */ -uint8_t get_bsr_len (module_id_t module_idP, uint8_t eNB_index,frame_t frameP,uint16_t buflen); +uint8_t get_bsr_len (module_id_t module_idP, uint16_t buflen); /*! \fn BSR_SHORT * get_bsr_short(module_id_t module_idP, uint8_t bsr_len) \brief get short bsr level @@ -577,14 +577,14 @@ BSR_LONG * get_bsr_long(module_id_t module_idP, uint8_t bsr_len); */ boolean_t update_bsr(module_id_t module_idP, frame_t frameP, eNB_index_t eNB_index, uint8_t lcid, uint8_t lcgid); -/*! \fn locate_BsrIndexByBufferSize (int *table, int size, int value) +/*! \fn locate (int *table, int size, int value) \brief locate the BSR level in the table as defined in 36.321. This function requires that he values in table to be monotonic, either increasing or decreasing. The returned value is not less than 0, nor greater than n-1, where n is the size of table. \param[in] *table Pointer to BSR table \param[in] size Size of the table \param[in] value Value of the buffer \return the index in the BSR_LEVEL table */ -uint8_t locate_BsrIndexByBufferSize (const uint32_t *table, int size, int value); +uint8_t locate (const uint32_t *table, int size, int value); /*! \fn int get_sf_periodicBSRTimer(uint8_t periodicBSR_Timer) diff --git a/openair2/LAYER2/MAC/ra_procedures.c b/openair2/LAYER2/MAC/ra_procedures.c index 3b5734756d..30137fab33 100644 --- a/openair2/LAYER2/MAC/ra_procedures.c +++ b/openair2/LAYER2/MAC/ra_procedures.c @@ -391,7 +391,7 @@ PRACH_RESOURCES_t *ue_get_rach(module_id_t module_idP,int CC_id,frame_t frameP, 1); //post_padding return(&UE_mac_inst[module_idP].RA_prach_resources); - } else if (UE_mac_inst[module_idP].scheduling_info.BSR_bytes[UE_mac_inst[module_idP].scheduling_info.LCGID[DCCH]] > 0) { + } else if (UE_mac_inst[module_idP].scheduling_info.BSR_bytes[DCCH] > 0) { // This is for triggering a transmission on DCCH using PRACH (during handover, or sending SR for example) dcch_header_len = 2 + 2; /// SHORT Subheader + C-RNTI control element rlc_status = mac_rlc_status_ind(module_idP,UE_mac_inst[module_idP].crnti, eNB_indexP,frameP,ENB_FLAG_NO,MBMS_FLAG_NO, diff --git a/openair2/LAYER2/MAC/ue_procedures.c b/openair2/LAYER2/MAC/ue_procedures.c index c24702b3b5..d5958f6e5e 100644 --- a/openair2/LAYER2/MAC/ue_procedures.c +++ b/openair2/LAYER2/MAC/ue_procedures.c @@ -102,17 +102,13 @@ void ue_init_mac(module_id_t module_idP) UE_mac_inst[module_idP].scheduling_info.sr_ProhibitTimer_Running=0; UE_mac_inst[module_idP].scheduling_info.maxHARQ_Tx=MAC_MainConfig__ul_SCH_Config__maxHARQ_Tx_n5; UE_mac_inst[module_idP].scheduling_info.ttiBundling=0; - UE_mac_inst[module_idP].scheduling_info.extendedBSR_Sizes_r10=0; - UE_mac_inst[module_idP].scheduling_info.extendedPHR_r10=0; UE_mac_inst[module_idP].scheduling_info.drx_config=NULL; UE_mac_inst[module_idP].scheduling_info.phr_config=NULL; UE_mac_inst[module_idP].scheduling_info.periodicBSR_SF = get_sf_periodicBSRTimer(UE_mac_inst[module_idP].scheduling_info.periodicBSR_Timer); UE_mac_inst[module_idP].scheduling_info.retxBSR_SF = get_sf_retxBSRTimer(UE_mac_inst[module_idP].scheduling_info.retxBSR_Timer); - UE_mac_inst[module_idP].BSR_reporting_active = 0; UE_mac_inst[module_idP].scheduling_info.periodicPHR_SF = get_sf_perioidicPHR_Timer(UE_mac_inst[module_idP].scheduling_info.periodicPHR_Timer); UE_mac_inst[module_idP].scheduling_info.prohibitPHR_SF = get_sf_prohibitPHR_Timer(UE_mac_inst[module_idP].scheduling_info.prohibitPHR_Timer); UE_mac_inst[module_idP].scheduling_info.PathlossChange_db = get_db_dl_PathlossChange(UE_mac_inst[module_idP].scheduling_info.PathlossChange); - UE_mac_inst[module_idP].PHR_reporting_active = 0; for (i=0; i < MAX_NUM_LCID; i++) { LOG_D(MAC,"[UE%d] Applying default logical channel config for LCGID %d\n",module_idP,i); @@ -125,7 +121,7 @@ void ue_init_mac(module_id_t module_idP) UE_mac_inst[module_idP].scheduling_info.LCGID[i]=1; } - UE_mac_inst[module_idP].scheduling_info.LCID_status[i]=LCID_EMPTY; + UE_mac_inst[module_idP].scheduling_info.LCID_status[i]=0; } #ifdef CBA @@ -310,28 +306,18 @@ uint32_t ue_get_SR(module_id_t module_idP,int CC_id,frame_t frameP,uint8_t eNB_i // initiate RA UE_mac_inst[module_idP].scheduling_info.SR_pending=0; UE_mac_inst[module_idP].scheduling_info.SR_COUNTER=0; - // release all pucch resource - UE_mac_inst[module_idP].physicalConfigDedicated = NULL; - UE_mac_inst[module_idP].ul_active=0; - UE_mac_inst[module_idP].BSR_reporting_active=0; - - LOG_T(MAC,"[UE %d] Release all SRs \n", module_idP); return(0); } } //------------------------------------------------------------------------------ void -ue_send_sdu( - module_id_t module_idP, - uint8_t CC_id, - frame_t frameP, - uint8_t* sdu, - uint16_t sdu_len, - uint8_t eNB_index -) -//------------------------------------------------------------------------------ -{ +ue_send_sdu(module_id_t module_idP, + uint8_t CC_id, + frame_t frameP, + uint8_t* sdu, + uint16_t sdu_len, + uint8_t eNB_index) { unsigned char rx_ces[MAX_NUM_CE],num_ce,num_sdu,i,*payload_ptr; unsigned char rx_lcids[NB_RB_MAX]; @@ -1258,12 +1244,11 @@ void ue_get_sdu(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_t subf BSR_LONG *bsr_l=&bsr_long; POWER_HEADROOM_CMD phr; POWER_HEADROOM_CMD *phr_p=&phr; - unsigned short short_padding=0, post_padding=0, padding_len=0; + unsigned short short_padding=0, post_padding=0; int lcgid; int j; // used for padding // Compute header length - int all_pdu_len; - + if (CC_id>0) { LOG_E(MAC,"Transmission on secondary CCs is not supported yet\n"); mac_xface->macphy_exit("MAC FATAL CC_id>0"); @@ -1297,10 +1282,19 @@ void ue_get_sdu(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_t subf dtch_header_len=(buflen > 128 ) ? 3 : 2 ; //sizeof(SCH_SUBHEADER_LONG)-1 : sizeof(SCH_SUBHEADER_SHORT); bsr_header_len = 1;//sizeof(SCH_SUBHEADER_FIXED); phr_header_len = 1;//sizeof(SCH_SUBHEADER_FIXED); + phr_ce_len = (UE_mac_inst[module_idP].PHR_reporting_active == 1) ? 1 /* sizeof(POWER_HEADROOM_CMD)*/: 0; - bsr_ce_len = get_bsr_len (module_idP, eNB_index, frameP, buflen); - // retxBSR-Timer expires or periodicBSR-Timer expires and Regular BSR trigger - if ((bsr_ce_len > 0 ) && (UE_mac_inst[module_idP].BSR_reporting_active > 0)) { + if (phr_ce_len > 0) { + phr_len = phr_ce_len + phr_header_len; + LOG_D(MAC,"[UE %d] header size info: PHR len %d (ce%d,hdr%d) buff_len %d\n", + module_idP, phr_len, phr_ce_len, phr_header_len, buflen); + } else { + phr_len=0; + } + + bsr_ce_len = get_bsr_len (module_idP, buflen-phr_len); + + if (bsr_ce_len > 0 ) { bsr_len = bsr_ce_len + bsr_header_len; LOG_D(MAC,"[UE %d] header size info: dcch %d, dcch1 %d, dtch %d, bsr (ce%d,hdr%d) buff_len %d\n", module_idP, dcch_header_len,dcch1_header_len,dtch_header_len, bsr_ce_len, bsr_header_len, buflen); @@ -1311,15 +1305,6 @@ void ue_get_sdu(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_t subf //bsr_len = bsr_ce_len + bsr_header_len; } - phr_ce_len = (UE_mac_inst[module_idP].PHR_reporting_active == 1) ? 1 /* sizeof(POWER_HEADROOM_CMD)*/: 0; - if (phr_ce_len > 0) { - phr_len = phr_ce_len + phr_header_len; - LOG_D(MAC,"[UE %d] header size info: PHR len %d (ce%d,hdr%d) buff_len %d\n", - module_idP, phr_len, phr_ce_len, phr_header_len, buflen); - } else { - phr_len=0; - } - // check for UL bandwidth requests and add SR control element // check for UL bandwidth requests and add SR control element @@ -1353,12 +1338,8 @@ void ue_get_sdu(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_t subf sdu_lcids[0] = DCCH; LOG_D(MAC,"[UE %d] TX Got %d bytes for DCCH\n",module_idP,sdu_lengths[0]); num_sdus = 1; - //update_bsr(module_idP, frameP, eNB_index, DCCH, UE_mac_inst[module_idP].scheduling_info.LCGID[DCCH]); + update_bsr(module_idP, frameP, eNB_index, DCCH, UE_mac_inst[module_idP].scheduling_info.LCGID[DCCH]); //header_len +=2; - UE_mac_inst[module_idP].scheduling_info.LCID_status[DCCH] = LCID_EMPTY; -#if 0 //calvin for BSR test,current buffer greater then previous one, or buffer from 0 to !0 - UE_mac_inst[module_idP].scheduling_info.LCID_buffer_remain[DCCH] = rlc_status.bytes_in_buffer-sdu_lengths[0]; -#endif } else { dcch_header_len=0; num_sdus = 0; @@ -1394,13 +1375,9 @@ void ue_get_sdu(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_t subf sdu_length_total += sdu_lengths[num_sdus]; sdu_lcids[num_sdus] = DCCH1; LOG_D(MAC,"[UE %d] TX Got %d bytes for DCCH1\n",module_idP,sdu_lengths[num_sdus]); + num_sdus++; //update_bsr(module_idP, frameP, DCCH1); //dcch_header_len +=2; // include dcch1 - UE_mac_inst[module_idP].scheduling_info.LCID_status[DCCH1] = LCID_EMPTY; -#if 0 //calvin for BSR test,current buffer greater then previous one, or buffer from 0 to !0 - UE_mac_inst[module_idP].scheduling_info.LCID_buffer_remain[DCCH1] = rlc_status.bytes_in_buffer-sdu_lengths[num_sdus]; -#endif - num_sdus++; } else { dcch1_header_len =0; } @@ -1411,9 +1388,8 @@ void ue_get_sdu(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_t subf dtch_header_len+=3; dtch_header_len_last=3; - all_pdu_len = bsr_len+phr_len+dcch_header_len+dcch1_header_len+dtch_header_len+sdu_length_total; if ((UE_mac_inst[module_idP].scheduling_info.LCID_status[lcid] == LCID_NOT_EMPTY) && - (all_pdu_len <= buflen)) { + ((bsr_len+phr_len+dcch_header_len+dcch1_header_len+dtch_header_len+sdu_length_total) <= buflen)) { // optimize the dtch header lenght //if ((UE_mac_inst[module_idP].scheduling_info.BSR_bytes[DTCH] > 128) && @@ -1431,11 +1407,11 @@ void ue_get_sdu(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_t subf ENB_FLAG_NO, MBMS_FLAG_NO, // eNB_index lcid, - buflen-all_pdu_len); + buflen-bsr_len-phr_len-dcch_header_len-dcch1_header_len-dtch_header_len-sdu_length_total); LOG_D(MAC,"[UE %d] Frame %d : UL-DTCH -> ULSCH%d, %d bytes to send (Transport Block size %d, mac header len %d, BSR byte[%d] %d)\n", module_idP,frameP, lcid, rlc_status.bytes_in_buffer,buflen,dtch_header_len, - lcid, UE_mac_inst[module_idP].scheduling_info.BSR_bytes[UE_mac_inst[module_idP].scheduling_info.LCGID[lcid]]); + lcid, UE_mac_inst[module_idP].scheduling_info.BSR_bytes[lcid]); if (rlc_status.bytes_in_buffer > 0) { sdu_lengths[num_sdus] = mac_rlc_data_req(module_idP, @@ -1455,20 +1431,16 @@ void ue_get_sdu(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_t subf dtch_header_len --; dtch_header_len_last --; } -#if 0 //calvin for BSR test,current buffer greater then previous one, or buffer from 0 to !0 - UE_mac_inst[module_idP].scheduling_info.LCID_buffer_remain[lcid] = rlc_status.bytes_in_buffer-sdu_lengths[num_sdus]; -#endif num_sdus++; - //UE_mac_inst[module_idP].ul_active = update_bsr(module_idP, frameP, eNB_index,lcid, UE_mac_inst[module_idP].scheduling_info.LCGID[lcid]); + UE_mac_inst[module_idP].ul_active = update_bsr(module_idP, frameP, eNB_index,lcid, UE_mac_inst[module_idP].scheduling_info.LCGID[lcid]); } else { dtch_header_len -= 3; } - UE_mac_inst[module_idP].scheduling_info.LCID_status[lcid] = LCID_EMPTY; } else { // no rlc pdu : generate the dummy header dtch_header_len -= 3; } } - + lcgid= get_bsr_lcgid(module_idP); if (lcgid < 0 ) { @@ -1480,29 +1452,15 @@ void ue_get_sdu(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_t subf bsr_l->Buffer_size1 = UE_mac_inst[module_idP].scheduling_info.BSR[LCGID1]; bsr_l->Buffer_size2 = UE_mac_inst[module_idP].scheduling_info.BSR[LCGID2]; bsr_l->Buffer_size3 = UE_mac_inst[module_idP].scheduling_info.BSR[LCGID3]; - LOG_D(MAC, "[UE %d] Frame %d report long BSR (level LCGID0 %d,level LCGID1 %d,level LCGID2 %d,level LCGID3 %d)\n", module_idP,frameP, UE_mac_inst[module_idP].scheduling_info.BSR[LCGID0], UE_mac_inst[module_idP].scheduling_info.BSR[LCGID1], UE_mac_inst[module_idP].scheduling_info.BSR[LCGID2], UE_mac_inst[module_idP].scheduling_info.BSR[LCGID3]); - - UE_mac_inst[module_idP].scheduling_info.BSR_bytes[LCGID0] = 0; - UE_mac_inst[module_idP].scheduling_info.BSR_bytes[LCGID1] = 0; - UE_mac_inst[module_idP].scheduling_info.BSR_bytes[LCGID2] = 0; - UE_mac_inst[module_idP].scheduling_info.BSR_bytes[LCGID3] = 0; - UE_mac_inst[module_idP].scheduling_info.BSR[LCGID0] = 0; - UE_mac_inst[module_idP].scheduling_info.BSR[LCGID1] = 0; - UE_mac_inst[module_idP].scheduling_info.BSR[LCGID2] = 0; - UE_mac_inst[module_idP].scheduling_info.BSR[LCGID3] = 0; } else if (bsr_ce_len == sizeof(BSR_SHORT)) { bsr_l = NULL; bsr_s->LCGID = lcgid; bsr_s->Buffer_size = UE_mac_inst[module_idP].scheduling_info.BSR[lcgid]; - - UE_mac_inst[module_idP].scheduling_info.BSR_bytes[lcgid] = 0; - UE_mac_inst[module_idP].scheduling_info.BSR[lcgid] = 0; - LOG_D(MAC,"[UE %d] Frame %d report SHORT BSR with level %d for LCGID %d\n", module_idP, frameP, UE_mac_inst[module_idP].scheduling_info.BSR[lcgid],lcgid); } else { @@ -1536,14 +1494,12 @@ void ue_get_sdu(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_t subf dtch_header_len_last-=1; dtch_header_len= (dtch_header_len >0)? dtch_header_len - dtch_header_len_last : dtch_header_len; } - // 1-bit padding or 2-bit padding special padding subheader - padding_len = buflen-bsr_len-phr_len-dcch_header_len-dcch1_header_len-dtch_header_len-sdu_length_total; - if (padding_len <= 2) { - short_padding = padding_len; - // only add padding header + + if ((buflen-bsr_len-phr_len-dcch_header_len-dcch1_header_len-dtch_header_len-sdu_length_total) <= 2) { + short_padding = buflen-bsr_len-phr_len-dcch_header_len-dcch1_header_len-dtch_header_len-sdu_length_total; post_padding = 0; } else { - if (padding_len == buflen) {// nona mac pdu + if ((buflen-bsr_len-phr_len-dcch_header_len-dcch1_header_len-dtch_header_len-sdu_length_total) == buflen) { *access_mode=CANCELED_ACCESS; } @@ -1588,9 +1544,6 @@ void ue_get_sdu(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_t subf module_idP,payload_offset, sdu_length_total); UE_mac_inst[module_idP].scheduling_info.SR_pending=0; UE_mac_inst[module_idP].scheduling_info.SR_COUNTER=0; - UE_mac_inst[module_idP].BSR_reporting_active=0; - UE_mac_inst[module_idP].scheduling_info.periodicBSR_SF = get_sf_periodicBSRTimer(UE_mac_inst[module_idP].scheduling_info.periodicBSR_Timer); - UE_mac_inst[module_idP].scheduling_info.retxBSR_SF = get_sf_retxBSRTimer(UE_mac_inst[module_idP].scheduling_info.retxBSR_Timer); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_GET_SDU, VCD_FUNCTION_OUT); stop_meas(&UE_mac_inst[module_idP].tx_ulsch_sdu); @@ -1752,25 +1705,10 @@ ue_scheduler( // call SR procedure to generate pending SR and BSR for next PUCCH/PUSCH TxOp. This should implement the procedures // outlined in Sections 5.4.4 an 5.4.5 of 36.321 - // Call BSR procedure as described in Section 5.4.5 in 36.321 - if (UE_mac_inst[module_idP].scheduling_info.periodicBSR_SF == get_sf_periodicBSRTimer(MAC_MainConfig__ul_SCH_Config__periodicBSR_Timer_infinity)) { - UE_mac_inst[module_idP].BSR_reporting_active = 1; - } else if (UE_mac_inst[module_idP].scheduling_info.periodicBSR_SF <= 0 ){ - // trigger BSR and reset the timer later when the BSR report is sent - UE_mac_inst[module_idP].BSR_reporting_active = 1; - } else if (UE_mac_inst[module_idP].BSR_reporting_active == 0 ) { - UE_mac_inst[module_idP].scheduling_info.periodicBSR_SF--; - } - - if (UE_mac_inst[module_idP].scheduling_info.retxBSR_SF <= 0){ - // trigger BSR and reset the timer later when the BSR report is sent - UE_mac_inst[module_idP].BSR_reporting_active = 1; - } else if (UE_mac_inst[module_idP].BSR_reporting_active == 0 ) { - UE_mac_inst[module_idP].scheduling_info.retxBSR_SF--; - } + // Put this in another function // Get RLC status info and update Bj for all lcids that are active - for (lcid=DCCH; lcid < MAX_NUM_LCID; lcid++ ) { + for (lcid=DCCH; lcid <= DTCH; lcid++ ) { if ((lcid == 0) ||(UE_mac_inst[module_idP].logicalChannelConfig[lcid])) { // meausre the Bj if ((directionP == SF_UL)&& (UE_mac_inst[module_idP].scheduling_info.Bj[lcid] >= 0)) { @@ -1791,8 +1729,6 @@ ue_scheduler( if (update_bsr(module_idP,frameP, eNB_indexP, lcid, UE_mac_inst[module_idP].scheduling_info.LCGID[lcid])) { UE_mac_inst[module_idP].scheduling_info.SR_pending= 1; - // Regular BSR trigger - UE_mac_inst[module_idP].BSR_reporting_active = 1; LOG_D(MAC,"[UE %d][SR] Frame %d subframe %d SR for PUSCH is pending for LCGID %d with BSR level %d (%d bytes in RLC)\n", module_idP, frameP,subframeP,UE_mac_inst[module_idP].scheduling_info.LCGID[lcid], UE_mac_inst[module_idP].scheduling_info.BSR[UE_mac_inst[module_idP].scheduling_info.LCGID[lcid]], @@ -2034,26 +1970,31 @@ int get_bsr_lcgid (module_id_t module_idP) } } -uint8_t get_bsr_len (module_id_t module_idP, uint8_t eNB_index,frame_t frameP,uint16_t buflen) +uint8_t get_bsr_len (module_id_t module_idP, uint16_t buflen) { - int lcid; - uint8_t bsr_len=0, num_lcid=0; - int pdu = 0; - mac_rlc_status_resp_t rlc_status; - for (lcid=DCCH; lcid 0 ) { - pdu += rlc_status.bytes_in_buffer + sizeof(SCH_SUBHEADER_SHORT) + bsr_len; - if (rlc_status.bytes_in_buffer > 128 ) { - pdu += 1; //sizeof(SCH_SUBHEADER_LONG) - } + int lcgid=0; + uint8_t bsr_len=0, num_lcgid=0; + int pdu = 0; + + + for (lcgid=0; lcgid < MAX_NUM_LCGID; lcgid++ ) { + if (UE_mac_inst[module_idP].scheduling_info.BSR_bytes[lcgid] > 0 ) { + pdu += (UE_mac_inst[module_idP].scheduling_info.BSR_bytes[lcgid] + bsr_len + 2); //2 = sizeof(SCH_SUBHEADER_SHORT) } - if ( (pdu > buflen) && (rlc_status.bytes_in_buffer > 0 ) ) { - num_lcid +=1; - bsr_len = (num_lcid >= 2 ) ? sizeof(BSR_LONG) : sizeof(BSR_SHORT) ; + + if (UE_mac_inst[module_idP].scheduling_info.BSR_bytes[lcgid] > 128 ) { // long header size: adjust the header size + pdu += 1; } - LOG_D(MAC,"LC buffer Bytes %d for lcid %d bsr len %d num lcid %d\n", rlc_status.bytes_in_buffer, lcid, bsr_len, num_lcid); + + // current phy buff can not transport all sdu for this lcgid -> transmit a bsr for this lcgid + + if ( (pdu > buflen) && (UE_mac_inst[module_idP].scheduling_info.BSR_bytes[lcgid] > 0 ) ) { + num_lcgid +=1; + bsr_len = (num_lcgid >= 2 ) ? sizeof(BSR_LONG) : sizeof(BSR_SHORT) ; + } + + LOG_D(MAC,"BSR Bytes %d for lcgid %d bsr len %d num lcgid %d\n", UE_mac_inst[module_idP].scheduling_info.BSR_bytes[lcgid], lcgid, bsr_len, num_lcgid); } if ( bsr_len > 0 ) @@ -2063,6 +2004,7 @@ uint8_t get_bsr_len (module_id_t module_idP, uint8_t eNB_index,frame_t frameP,ui return bsr_len; } + boolean_t update_bsr(module_id_t module_idP, frame_t frameP, eNB_index_t eNB_index, uint8_t lcid, uint8_t lcg_id) { @@ -2086,17 +2028,11 @@ boolean_t update_bsr(module_id_t module_idP, frame_t frameP, eNB_index_t eNB_in lcid, 0); - if ((rlc_status.bytes_in_buffer > 0 ) -#if 0 //calvin for BSR test,current buffer greater then previous one, or buffer from 0 to !0 - && (rlc_status.bytes_in_buffer > UE_mac_inst[module_idP].scheduling_info.LCID_buffer_remain[lcid]) -#endif - ){ - //BSR trigger SR + if (rlc_status.bytes_in_buffer > 0 ) { sr_pending = TRUE; UE_mac_inst[module_idP].scheduling_info.LCID_status[lcid] = LCID_NOT_EMPTY; - // sum lcid buffer which has same lcgid + UE_mac_inst[module_idP].scheduling_info.BSR[lcg_id] += locate (BSR_TABLE,BSR_TABLE_SIZE, rlc_status.bytes_in_buffer); UE_mac_inst[module_idP].scheduling_info.BSR_bytes[lcg_id] += rlc_status.bytes_in_buffer; - UE_mac_inst[module_idP].scheduling_info.BSR[lcg_id] = locate_BsrIndexByBufferSize(BSR_TABLE, BSR_TABLE_SIZE, UE_mac_inst[module_idP].scheduling_info.BSR_bytes[lcg_id]); // UE_mac_inst[module_idP].scheduling_info.BSR_short_lcid = lcid; // only applicable to short bsr LOG_D(MAC,"[UE %d] BSR level %d (LCGID %d, rlc buffer %d byte)\n", module_idP, UE_mac_inst[module_idP].scheduling_info.BSR[lcg_id],lcg_id, UE_mac_inst[module_idP].scheduling_info.BSR_bytes[lcg_id]); @@ -2109,7 +2045,7 @@ boolean_t update_bsr(module_id_t module_idP, frame_t frameP, eNB_index_t eNB_in return sr_pending; } -uint8_t locate_BsrIndexByBufferSize (const uint32_t *table, int size, int value) +uint8_t locate (const uint32_t *table, int size, int value) { uint8_t ju, jm, jl; @@ -2140,7 +2076,7 @@ uint8_t locate_BsrIndexByBufferSize (const uint32_t *table, int size, int value) if (value == table[jl]) { return jl; - } else { + } else { return jl+1; //equally ju } diff --git a/openair2/LAYER2/MAC/vars.h b/openair2/LAYER2/MAC/vars.h index 236439c6e5..83d159f910 100644 --- a/openair2/LAYER2/MAC/vars.h +++ b/openair2/LAYER2/MAC/vars.h @@ -45,15 +45,6 @@ const uint32_t BSR_TABLE[BSR_TABLE_SIZE]= {0,10,12,14,17,19,22,26,31,36,42,49,57 1326,1552,1817,2127,2490,2915,3413,3995,4677,5467,6411,7505,8787,10287,12043,14099, 16507,19325,22624,26487,31009,36304,42502,49759,58255,68201,79846,93479,109439, 128125,150000, 300000 }; -// extended bsr table--currently not used -const uint32_t Extended_BSR_TABLE[BSR_TABLE_SIZE] = {0,10,13,16,19,23,29,35,43,53,65,80,98,120,147, - 181,223,274,337,414,509,625,769,945,1162,1429, - 1757,2161,2657,3267,4017,4940,6074,7469,9185, - 11294,13888,17077,20999,25822,31752,39045,48012, - 59039,72598,89272,109774,134986,165989,204111, - 250990,308634,379519,466683,573866,705666,867737, - 1067031,1312097,1613447,1984009,2439678,3000000, - 6000000}; //uint32_t EBSR_Level[63]={0,10,13,16,19,23,29,35,43,53,65,80,98,120,147,181}; From d56c651081874c69a42bba2956356514e3f847b2 Mon Sep 17 00:00:00 2001 From: fnabet Date: Mon, 7 Nov 2016 11:57:02 +0100 Subject: [PATCH 263/349] Reapply BSR changes --- openair2/LAYER2/MAC/config.c | 25 +++- openair2/LAYER2/MAC/defs.h | 14 ++- openair2/LAYER2/MAC/extern.h | 2 + openair2/LAYER2/MAC/proto.h | 6 +- openair2/LAYER2/MAC/ra_procedures.c | 2 +- openair2/LAYER2/MAC/ue_procedures.c | 182 +++++++++++++++++++--------- openair2/LAYER2/MAC/vars.h | 9 ++ 7 files changed, 175 insertions(+), 65 deletions(-) diff --git a/openair2/LAYER2/MAC/config.c b/openair2/LAYER2/MAC/config.c index 3fbcadafbb..d46b761bd0 100644 --- a/openair2/LAYER2/MAC/config.c +++ b/openair2/LAYER2/MAC/config.c @@ -69,6 +69,7 @@ void ue_mac_reset(module_id_t module_idP,uint8_t eNB_index) // cancel all pending SRs UE_mac_inst[module_idP].scheduling_info.SR_pending=0; UE_mac_inst[module_idP].scheduling_info.SR_COUNTER=0; + UE_mac_inst[module_idP].BSR_reporting_active=0; // stop ongoing RACH procedure @@ -225,13 +226,34 @@ rrc_mac_config_req( if (mac_MainConfig->ext1 && mac_MainConfig->ext1->sr_ProhibitTimer_r9) { UE_mac_inst[Mod_idP].scheduling_info.sr_ProhibitTimer = (uint16_t) *mac_MainConfig->ext1->sr_ProhibitTimer_r9; } else { - UE_mac_inst[Mod_idP].scheduling_info.sr_ProhibitTimer = (uint16_t) 0; + UE_mac_inst[Mod_idP].scheduling_info.sr_ProhibitTimer = 0; } + if (mac_MainConfig->ext2 && mac_MainConfig->ext2->mac_MainConfig_v1020) { + if (mac_MainConfig->ext2->mac_MainConfig_v1020->extendedBSR_Sizes_r10) { + UE_mac_inst[Mod_idP].scheduling_info.extendedBSR_Sizes_r10 = (uint16_t) *mac_MainConfig->ext2->mac_MainConfig_v1020->extendedBSR_Sizes_r10; + } else { + UE_mac_inst[Mod_idP].scheduling_info.extendedBSR_Sizes_r10 = (uint16_t)0; + } + if (mac_MainConfig->ext2->mac_MainConfig_v1020->extendedPHR_r10) { + UE_mac_inst[Mod_idP].scheduling_info.extendedPHR_r10 = (uint16_t) *mac_MainConfig->ext2->mac_MainConfig_v1020->extendedPHR_r10; + } else { + UE_mac_inst[Mod_idP].scheduling_info.extendedPHR_r10 = (uint16_t)0; + } + } else { + UE_mac_inst[Mod_idP].scheduling_info.extendedBSR_Sizes_r10 = (uint16_t)0; + UE_mac_inst[Mod_idP].scheduling_info.extendedPHR_r10 = (uint16_t)0; + } #endif UE_mac_inst[Mod_idP].scheduling_info.periodicBSR_SF = get_sf_periodicBSRTimer(UE_mac_inst[Mod_idP].scheduling_info.periodicBSR_Timer); UE_mac_inst[Mod_idP].scheduling_info.retxBSR_SF = get_sf_retxBSRTimer(UE_mac_inst[Mod_idP].scheduling_info.retxBSR_Timer); + UE_mac_inst[Mod_idP].BSR_reporting_active = 0; + LOG_D(MAC,"[UE %d]: periodic BSR %d (SF), retx BSR %d (SF)\n", + Mod_idP, + UE_mac_inst[Mod_idP].scheduling_info.periodicBSR_SF, + UE_mac_inst[Mod_idP].scheduling_info.retxBSR_SF); + UE_mac_inst[Mod_idP].scheduling_info.drx_config = mac_MainConfig->drx_Config; UE_mac_inst[Mod_idP].scheduling_info.phr_config = mac_MainConfig->phr_Config; @@ -252,6 +274,7 @@ rrc_mac_config_req( UE_mac_inst[Mod_idP].scheduling_info.periodicPHR_SF = get_sf_perioidicPHR_Timer(UE_mac_inst[Mod_idP].scheduling_info.periodicPHR_Timer); UE_mac_inst[Mod_idP].scheduling_info.prohibitPHR_SF = get_sf_prohibitPHR_Timer(UE_mac_inst[Mod_idP].scheduling_info.prohibitPHR_Timer); UE_mac_inst[Mod_idP].scheduling_info.PathlossChange_db = get_db_dl_PathlossChange(UE_mac_inst[Mod_idP].scheduling_info.PathlossChange); + UE_mac_inst[Mod_idP].PHR_reporting_active = 0; LOG_D(MAC,"[UE %d] config PHR (%d): periodic %d (SF) prohibit %d (SF) pathlosschange %d (db) \n", Mod_idP, (mac_MainConfig->phr_Config)?mac_MainConfig->phr_Config->present:-1, diff --git a/openair2/LAYER2/MAC/defs.h b/openair2/LAYER2/MAC/defs.h index 2235c3e1c4..d38ca05362 100644 --- a/openair2/LAYER2/MAC/defs.h +++ b/openair2/LAYER2/MAC/defs.h @@ -945,8 +945,12 @@ typedef enum { typedef struct { /// buffer status for each lcgid uint8_t BSR[MAX_NUM_LCGID]; // should be more for mesh topology - /// keep the number of bytes in rlc buffer for each lcid + /// keep the number of bytes in rlc buffer for each lcgid uint16_t BSR_bytes[MAX_NUM_LCGID]; +#if 0 //calvin for BSR test,current buffer greater then previous one, or buffer from 0 to !0 + /// after multiplexing buffer remain for each lcid + uint16_t LCID_buffer_remain[MAX_NUM_LCID]; +#endif /// buffer status for each lcid uint8_t LCID_status[MAX_NUM_LCID]; /// SR pending as defined in 36.321 @@ -987,6 +991,12 @@ typedef struct { int16_t prohibitPHR_SF; ///DL Pathloss Change in db uint16_t PathlossChange_db; + + /// default value is false + uint16_t extendedBSR_Sizes_r10; + /// default value is false + uint16_t extendedPHR_r10; + //Bj bucket usage per lcid int16_t Bj[MAX_NUM_LCID]; // Bucket size per lcid @@ -1074,6 +1084,8 @@ typedef struct { uint8_t PHR_reporting_active; /// power backoff due to power management (as allowed by P-MPRc) for this cell uint8_t power_backoff_db[NUMBER_OF_eNB_MAX]; + /// BSR report falg management + uint8_t BSR_reporting_active; /// MBSFN_Subframe Configuration struct MBSFN_SubframeConfig *mbsfn_SubframeConfig[8]; // FIXME replace 8 by MAX_MBSFN_AREA? /// number of subframe allocation pattern available for MBSFN sync area diff --git a/openair2/LAYER2/MAC/extern.h b/openair2/LAYER2/MAC/extern.h index 8726cb1349..4276c342cf 100644 --- a/openair2/LAYER2/MAC/extern.h +++ b/openair2/LAYER2/MAC/extern.h @@ -46,6 +46,8 @@ extern const uint32_t BSR_TABLE[BSR_TABLE_SIZE]; //extern uint32_t EBSR_Level[63]; +extern const uint32_t Extended_BSR_TABLE[BSR_TABLE_SIZE]; +//extern uint32_t Extended_BSR_TABLE[63]; ----currently not used extern UE_MAC_INST *UE_mac_inst; extern eNB_MAC_INST *eNB_mac_inst; diff --git a/openair2/LAYER2/MAC/proto.h b/openair2/LAYER2/MAC/proto.h index 59d6c352fe..248f918dc1 100644 --- a/openair2/LAYER2/MAC/proto.h +++ b/openair2/LAYER2/MAC/proto.h @@ -551,7 +551,7 @@ int get_bsr_lcgid (module_id_t module_idP); \param[in] bufflen size of phy transport block \param[out] bsr_len size of bsr control element */ -uint8_t get_bsr_len (module_id_t module_idP, uint16_t buflen); +uint8_t get_bsr_len (module_id_t module_idP, uint8_t eNB_index,frame_t frameP,uint16_t buflen); /*! \fn BSR_SHORT * get_bsr_short(module_id_t module_idP, uint8_t bsr_len) \brief get short bsr level @@ -577,14 +577,14 @@ BSR_LONG * get_bsr_long(module_id_t module_idP, uint8_t bsr_len); */ boolean_t update_bsr(module_id_t module_idP, frame_t frameP, eNB_index_t eNB_index, uint8_t lcid, uint8_t lcgid); -/*! \fn locate (int *table, int size, int value) +/*! \fn locate_BsrIndexByBufferSize (int *table, int size, int value) \brief locate the BSR level in the table as defined in 36.321. This function requires that he values in table to be monotonic, either increasing or decreasing. The returned value is not less than 0, nor greater than n-1, where n is the size of table. \param[in] *table Pointer to BSR table \param[in] size Size of the table \param[in] value Value of the buffer \return the index in the BSR_LEVEL table */ -uint8_t locate (const uint32_t *table, int size, int value); +uint8_t locate_BsrIndexByBufferSize (const uint32_t *table, int size, int value); /*! \fn int get_sf_periodicBSRTimer(uint8_t periodicBSR_Timer) diff --git a/openair2/LAYER2/MAC/ra_procedures.c b/openair2/LAYER2/MAC/ra_procedures.c index 30137fab33..3b5734756d 100644 --- a/openair2/LAYER2/MAC/ra_procedures.c +++ b/openair2/LAYER2/MAC/ra_procedures.c @@ -391,7 +391,7 @@ PRACH_RESOURCES_t *ue_get_rach(module_id_t module_idP,int CC_id,frame_t frameP, 1); //post_padding return(&UE_mac_inst[module_idP].RA_prach_resources); - } else if (UE_mac_inst[module_idP].scheduling_info.BSR_bytes[DCCH] > 0) { + } else if (UE_mac_inst[module_idP].scheduling_info.BSR_bytes[UE_mac_inst[module_idP].scheduling_info.LCGID[DCCH]] > 0) { // This is for triggering a transmission on DCCH using PRACH (during handover, or sending SR for example) dcch_header_len = 2 + 2; /// SHORT Subheader + C-RNTI control element rlc_status = mac_rlc_status_ind(module_idP,UE_mac_inst[module_idP].crnti, eNB_indexP,frameP,ENB_FLAG_NO,MBMS_FLAG_NO, diff --git a/openair2/LAYER2/MAC/ue_procedures.c b/openair2/LAYER2/MAC/ue_procedures.c index d5958f6e5e..c24702b3b5 100644 --- a/openair2/LAYER2/MAC/ue_procedures.c +++ b/openair2/LAYER2/MAC/ue_procedures.c @@ -102,13 +102,17 @@ void ue_init_mac(module_id_t module_idP) UE_mac_inst[module_idP].scheduling_info.sr_ProhibitTimer_Running=0; UE_mac_inst[module_idP].scheduling_info.maxHARQ_Tx=MAC_MainConfig__ul_SCH_Config__maxHARQ_Tx_n5; UE_mac_inst[module_idP].scheduling_info.ttiBundling=0; + UE_mac_inst[module_idP].scheduling_info.extendedBSR_Sizes_r10=0; + UE_mac_inst[module_idP].scheduling_info.extendedPHR_r10=0; UE_mac_inst[module_idP].scheduling_info.drx_config=NULL; UE_mac_inst[module_idP].scheduling_info.phr_config=NULL; UE_mac_inst[module_idP].scheduling_info.periodicBSR_SF = get_sf_periodicBSRTimer(UE_mac_inst[module_idP].scheduling_info.periodicBSR_Timer); UE_mac_inst[module_idP].scheduling_info.retxBSR_SF = get_sf_retxBSRTimer(UE_mac_inst[module_idP].scheduling_info.retxBSR_Timer); + UE_mac_inst[module_idP].BSR_reporting_active = 0; UE_mac_inst[module_idP].scheduling_info.periodicPHR_SF = get_sf_perioidicPHR_Timer(UE_mac_inst[module_idP].scheduling_info.periodicPHR_Timer); UE_mac_inst[module_idP].scheduling_info.prohibitPHR_SF = get_sf_prohibitPHR_Timer(UE_mac_inst[module_idP].scheduling_info.prohibitPHR_Timer); UE_mac_inst[module_idP].scheduling_info.PathlossChange_db = get_db_dl_PathlossChange(UE_mac_inst[module_idP].scheduling_info.PathlossChange); + UE_mac_inst[module_idP].PHR_reporting_active = 0; for (i=0; i < MAX_NUM_LCID; i++) { LOG_D(MAC,"[UE%d] Applying default logical channel config for LCGID %d\n",module_idP,i); @@ -121,7 +125,7 @@ void ue_init_mac(module_id_t module_idP) UE_mac_inst[module_idP].scheduling_info.LCGID[i]=1; } - UE_mac_inst[module_idP].scheduling_info.LCID_status[i]=0; + UE_mac_inst[module_idP].scheduling_info.LCID_status[i]=LCID_EMPTY; } #ifdef CBA @@ -306,18 +310,28 @@ uint32_t ue_get_SR(module_id_t module_idP,int CC_id,frame_t frameP,uint8_t eNB_i // initiate RA UE_mac_inst[module_idP].scheduling_info.SR_pending=0; UE_mac_inst[module_idP].scheduling_info.SR_COUNTER=0; + // release all pucch resource + UE_mac_inst[module_idP].physicalConfigDedicated = NULL; + UE_mac_inst[module_idP].ul_active=0; + UE_mac_inst[module_idP].BSR_reporting_active=0; + + LOG_T(MAC,"[UE %d] Release all SRs \n", module_idP); return(0); } } //------------------------------------------------------------------------------ void -ue_send_sdu(module_id_t module_idP, - uint8_t CC_id, - frame_t frameP, - uint8_t* sdu, - uint16_t sdu_len, - uint8_t eNB_index) { +ue_send_sdu( + module_id_t module_idP, + uint8_t CC_id, + frame_t frameP, + uint8_t* sdu, + uint16_t sdu_len, + uint8_t eNB_index +) +//------------------------------------------------------------------------------ +{ unsigned char rx_ces[MAX_NUM_CE],num_ce,num_sdu,i,*payload_ptr; unsigned char rx_lcids[NB_RB_MAX]; @@ -1244,11 +1258,12 @@ void ue_get_sdu(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_t subf BSR_LONG *bsr_l=&bsr_long; POWER_HEADROOM_CMD phr; POWER_HEADROOM_CMD *phr_p=&phr; - unsigned short short_padding=0, post_padding=0; + unsigned short short_padding=0, post_padding=0, padding_len=0; int lcgid; int j; // used for padding // Compute header length - + int all_pdu_len; + if (CC_id>0) { LOG_E(MAC,"Transmission on secondary CCs is not supported yet\n"); mac_xface->macphy_exit("MAC FATAL CC_id>0"); @@ -1282,19 +1297,10 @@ void ue_get_sdu(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_t subf dtch_header_len=(buflen > 128 ) ? 3 : 2 ; //sizeof(SCH_SUBHEADER_LONG)-1 : sizeof(SCH_SUBHEADER_SHORT); bsr_header_len = 1;//sizeof(SCH_SUBHEADER_FIXED); phr_header_len = 1;//sizeof(SCH_SUBHEADER_FIXED); - phr_ce_len = (UE_mac_inst[module_idP].PHR_reporting_active == 1) ? 1 /* sizeof(POWER_HEADROOM_CMD)*/: 0; - if (phr_ce_len > 0) { - phr_len = phr_ce_len + phr_header_len; - LOG_D(MAC,"[UE %d] header size info: PHR len %d (ce%d,hdr%d) buff_len %d\n", - module_idP, phr_len, phr_ce_len, phr_header_len, buflen); - } else { - phr_len=0; - } - - bsr_ce_len = get_bsr_len (module_idP, buflen-phr_len); - - if (bsr_ce_len > 0 ) { + bsr_ce_len = get_bsr_len (module_idP, eNB_index, frameP, buflen); + // retxBSR-Timer expires or periodicBSR-Timer expires and Regular BSR trigger + if ((bsr_ce_len > 0 ) && (UE_mac_inst[module_idP].BSR_reporting_active > 0)) { bsr_len = bsr_ce_len + bsr_header_len; LOG_D(MAC,"[UE %d] header size info: dcch %d, dcch1 %d, dtch %d, bsr (ce%d,hdr%d) buff_len %d\n", module_idP, dcch_header_len,dcch1_header_len,dtch_header_len, bsr_ce_len, bsr_header_len, buflen); @@ -1305,6 +1311,15 @@ void ue_get_sdu(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_t subf //bsr_len = bsr_ce_len + bsr_header_len; } + phr_ce_len = (UE_mac_inst[module_idP].PHR_reporting_active == 1) ? 1 /* sizeof(POWER_HEADROOM_CMD)*/: 0; + if (phr_ce_len > 0) { + phr_len = phr_ce_len + phr_header_len; + LOG_D(MAC,"[UE %d] header size info: PHR len %d (ce%d,hdr%d) buff_len %d\n", + module_idP, phr_len, phr_ce_len, phr_header_len, buflen); + } else { + phr_len=0; + } + // check for UL bandwidth requests and add SR control element // check for UL bandwidth requests and add SR control element @@ -1338,8 +1353,12 @@ void ue_get_sdu(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_t subf sdu_lcids[0] = DCCH; LOG_D(MAC,"[UE %d] TX Got %d bytes for DCCH\n",module_idP,sdu_lengths[0]); num_sdus = 1; - update_bsr(module_idP, frameP, eNB_index, DCCH, UE_mac_inst[module_idP].scheduling_info.LCGID[DCCH]); + //update_bsr(module_idP, frameP, eNB_index, DCCH, UE_mac_inst[module_idP].scheduling_info.LCGID[DCCH]); //header_len +=2; + UE_mac_inst[module_idP].scheduling_info.LCID_status[DCCH] = LCID_EMPTY; +#if 0 //calvin for BSR test,current buffer greater then previous one, or buffer from 0 to !0 + UE_mac_inst[module_idP].scheduling_info.LCID_buffer_remain[DCCH] = rlc_status.bytes_in_buffer-sdu_lengths[0]; +#endif } else { dcch_header_len=0; num_sdus = 0; @@ -1375,9 +1394,13 @@ void ue_get_sdu(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_t subf sdu_length_total += sdu_lengths[num_sdus]; sdu_lcids[num_sdus] = DCCH1; LOG_D(MAC,"[UE %d] TX Got %d bytes for DCCH1\n",module_idP,sdu_lengths[num_sdus]); - num_sdus++; //update_bsr(module_idP, frameP, DCCH1); //dcch_header_len +=2; // include dcch1 + UE_mac_inst[module_idP].scheduling_info.LCID_status[DCCH1] = LCID_EMPTY; +#if 0 //calvin for BSR test,current buffer greater then previous one, or buffer from 0 to !0 + UE_mac_inst[module_idP].scheduling_info.LCID_buffer_remain[DCCH1] = rlc_status.bytes_in_buffer-sdu_lengths[num_sdus]; +#endif + num_sdus++; } else { dcch1_header_len =0; } @@ -1388,8 +1411,9 @@ void ue_get_sdu(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_t subf dtch_header_len+=3; dtch_header_len_last=3; + all_pdu_len = bsr_len+phr_len+dcch_header_len+dcch1_header_len+dtch_header_len+sdu_length_total; if ((UE_mac_inst[module_idP].scheduling_info.LCID_status[lcid] == LCID_NOT_EMPTY) && - ((bsr_len+phr_len+dcch_header_len+dcch1_header_len+dtch_header_len+sdu_length_total) <= buflen)) { + (all_pdu_len <= buflen)) { // optimize the dtch header lenght //if ((UE_mac_inst[module_idP].scheduling_info.BSR_bytes[DTCH] > 128) && @@ -1407,11 +1431,11 @@ void ue_get_sdu(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_t subf ENB_FLAG_NO, MBMS_FLAG_NO, // eNB_index lcid, - buflen-bsr_len-phr_len-dcch_header_len-dcch1_header_len-dtch_header_len-sdu_length_total); + buflen-all_pdu_len); LOG_D(MAC,"[UE %d] Frame %d : UL-DTCH -> ULSCH%d, %d bytes to send (Transport Block size %d, mac header len %d, BSR byte[%d] %d)\n", module_idP,frameP, lcid, rlc_status.bytes_in_buffer,buflen,dtch_header_len, - lcid, UE_mac_inst[module_idP].scheduling_info.BSR_bytes[lcid]); + lcid, UE_mac_inst[module_idP].scheduling_info.BSR_bytes[UE_mac_inst[module_idP].scheduling_info.LCGID[lcid]]); if (rlc_status.bytes_in_buffer > 0) { sdu_lengths[num_sdus] = mac_rlc_data_req(module_idP, @@ -1431,16 +1455,20 @@ void ue_get_sdu(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_t subf dtch_header_len --; dtch_header_len_last --; } +#if 0 //calvin for BSR test,current buffer greater then previous one, or buffer from 0 to !0 + UE_mac_inst[module_idP].scheduling_info.LCID_buffer_remain[lcid] = rlc_status.bytes_in_buffer-sdu_lengths[num_sdus]; +#endif num_sdus++; - UE_mac_inst[module_idP].ul_active = update_bsr(module_idP, frameP, eNB_index,lcid, UE_mac_inst[module_idP].scheduling_info.LCGID[lcid]); + //UE_mac_inst[module_idP].ul_active = update_bsr(module_idP, frameP, eNB_index,lcid, UE_mac_inst[module_idP].scheduling_info.LCGID[lcid]); } else { dtch_header_len -= 3; } + UE_mac_inst[module_idP].scheduling_info.LCID_status[lcid] = LCID_EMPTY; } else { // no rlc pdu : generate the dummy header dtch_header_len -= 3; } } - + lcgid= get_bsr_lcgid(module_idP); if (lcgid < 0 ) { @@ -1452,15 +1480,29 @@ void ue_get_sdu(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_t subf bsr_l->Buffer_size1 = UE_mac_inst[module_idP].scheduling_info.BSR[LCGID1]; bsr_l->Buffer_size2 = UE_mac_inst[module_idP].scheduling_info.BSR[LCGID2]; bsr_l->Buffer_size3 = UE_mac_inst[module_idP].scheduling_info.BSR[LCGID3]; + LOG_D(MAC, "[UE %d] Frame %d report long BSR (level LCGID0 %d,level LCGID1 %d,level LCGID2 %d,level LCGID3 %d)\n", module_idP,frameP, UE_mac_inst[module_idP].scheduling_info.BSR[LCGID0], UE_mac_inst[module_idP].scheduling_info.BSR[LCGID1], UE_mac_inst[module_idP].scheduling_info.BSR[LCGID2], UE_mac_inst[module_idP].scheduling_info.BSR[LCGID3]); + + UE_mac_inst[module_idP].scheduling_info.BSR_bytes[LCGID0] = 0; + UE_mac_inst[module_idP].scheduling_info.BSR_bytes[LCGID1] = 0; + UE_mac_inst[module_idP].scheduling_info.BSR_bytes[LCGID2] = 0; + UE_mac_inst[module_idP].scheduling_info.BSR_bytes[LCGID3] = 0; + UE_mac_inst[module_idP].scheduling_info.BSR[LCGID0] = 0; + UE_mac_inst[module_idP].scheduling_info.BSR[LCGID1] = 0; + UE_mac_inst[module_idP].scheduling_info.BSR[LCGID2] = 0; + UE_mac_inst[module_idP].scheduling_info.BSR[LCGID3] = 0; } else if (bsr_ce_len == sizeof(BSR_SHORT)) { bsr_l = NULL; bsr_s->LCGID = lcgid; bsr_s->Buffer_size = UE_mac_inst[module_idP].scheduling_info.BSR[lcgid]; + + UE_mac_inst[module_idP].scheduling_info.BSR_bytes[lcgid] = 0; + UE_mac_inst[module_idP].scheduling_info.BSR[lcgid] = 0; + LOG_D(MAC,"[UE %d] Frame %d report SHORT BSR with level %d for LCGID %d\n", module_idP, frameP, UE_mac_inst[module_idP].scheduling_info.BSR[lcgid],lcgid); } else { @@ -1494,12 +1536,14 @@ void ue_get_sdu(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_t subf dtch_header_len_last-=1; dtch_header_len= (dtch_header_len >0)? dtch_header_len - dtch_header_len_last : dtch_header_len; } - - if ((buflen-bsr_len-phr_len-dcch_header_len-dcch1_header_len-dtch_header_len-sdu_length_total) <= 2) { - short_padding = buflen-bsr_len-phr_len-dcch_header_len-dcch1_header_len-dtch_header_len-sdu_length_total; + // 1-bit padding or 2-bit padding special padding subheader + padding_len = buflen-bsr_len-phr_len-dcch_header_len-dcch1_header_len-dtch_header_len-sdu_length_total; + if (padding_len <= 2) { + short_padding = padding_len; + // only add padding header post_padding = 0; } else { - if ((buflen-bsr_len-phr_len-dcch_header_len-dcch1_header_len-dtch_header_len-sdu_length_total) == buflen) { + if (padding_len == buflen) {// nona mac pdu *access_mode=CANCELED_ACCESS; } @@ -1544,6 +1588,9 @@ void ue_get_sdu(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_t subf module_idP,payload_offset, sdu_length_total); UE_mac_inst[module_idP].scheduling_info.SR_pending=0; UE_mac_inst[module_idP].scheduling_info.SR_COUNTER=0; + UE_mac_inst[module_idP].BSR_reporting_active=0; + UE_mac_inst[module_idP].scheduling_info.periodicBSR_SF = get_sf_periodicBSRTimer(UE_mac_inst[module_idP].scheduling_info.periodicBSR_Timer); + UE_mac_inst[module_idP].scheduling_info.retxBSR_SF = get_sf_retxBSRTimer(UE_mac_inst[module_idP].scheduling_info.retxBSR_Timer); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_GET_SDU, VCD_FUNCTION_OUT); stop_meas(&UE_mac_inst[module_idP].tx_ulsch_sdu); @@ -1705,10 +1752,25 @@ ue_scheduler( // call SR procedure to generate pending SR and BSR for next PUCCH/PUSCH TxOp. This should implement the procedures // outlined in Sections 5.4.4 an 5.4.5 of 36.321 - // Put this in another function + // Call BSR procedure as described in Section 5.4.5 in 36.321 + if (UE_mac_inst[module_idP].scheduling_info.periodicBSR_SF == get_sf_periodicBSRTimer(MAC_MainConfig__ul_SCH_Config__periodicBSR_Timer_infinity)) { + UE_mac_inst[module_idP].BSR_reporting_active = 1; + } else if (UE_mac_inst[module_idP].scheduling_info.periodicBSR_SF <= 0 ){ + // trigger BSR and reset the timer later when the BSR report is sent + UE_mac_inst[module_idP].BSR_reporting_active = 1; + } else if (UE_mac_inst[module_idP].BSR_reporting_active == 0 ) { + UE_mac_inst[module_idP].scheduling_info.periodicBSR_SF--; + } + + if (UE_mac_inst[module_idP].scheduling_info.retxBSR_SF <= 0){ + // trigger BSR and reset the timer later when the BSR report is sent + UE_mac_inst[module_idP].BSR_reporting_active = 1; + } else if (UE_mac_inst[module_idP].BSR_reporting_active == 0 ) { + UE_mac_inst[module_idP].scheduling_info.retxBSR_SF--; + } // Get RLC status info and update Bj for all lcids that are active - for (lcid=DCCH; lcid <= DTCH; lcid++ ) { + for (lcid=DCCH; lcid < MAX_NUM_LCID; lcid++ ) { if ((lcid == 0) ||(UE_mac_inst[module_idP].logicalChannelConfig[lcid])) { // meausre the Bj if ((directionP == SF_UL)&& (UE_mac_inst[module_idP].scheduling_info.Bj[lcid] >= 0)) { @@ -1729,6 +1791,8 @@ ue_scheduler( if (update_bsr(module_idP,frameP, eNB_indexP, lcid, UE_mac_inst[module_idP].scheduling_info.LCGID[lcid])) { UE_mac_inst[module_idP].scheduling_info.SR_pending= 1; + // Regular BSR trigger + UE_mac_inst[module_idP].BSR_reporting_active = 1; LOG_D(MAC,"[UE %d][SR] Frame %d subframe %d SR for PUSCH is pending for LCGID %d with BSR level %d (%d bytes in RLC)\n", module_idP, frameP,subframeP,UE_mac_inst[module_idP].scheduling_info.LCGID[lcid], UE_mac_inst[module_idP].scheduling_info.BSR[UE_mac_inst[module_idP].scheduling_info.LCGID[lcid]], @@ -1970,31 +2034,26 @@ int get_bsr_lcgid (module_id_t module_idP) } } -uint8_t get_bsr_len (module_id_t module_idP, uint16_t buflen) +uint8_t get_bsr_len (module_id_t module_idP, uint8_t eNB_index,frame_t frameP,uint16_t buflen) { - - int lcgid=0; - uint8_t bsr_len=0, num_lcgid=0; + int lcid; + uint8_t bsr_len=0, num_lcid=0; int pdu = 0; + mac_rlc_status_resp_t rlc_status; - - for (lcgid=0; lcgid < MAX_NUM_LCGID; lcgid++ ) { - if (UE_mac_inst[module_idP].scheduling_info.BSR_bytes[lcgid] > 0 ) { - pdu += (UE_mac_inst[module_idP].scheduling_info.BSR_bytes[lcgid] + bsr_len + 2); //2 = sizeof(SCH_SUBHEADER_SHORT) + for (lcid=DCCH; lcid 0 ) { + pdu += rlc_status.bytes_in_buffer + sizeof(SCH_SUBHEADER_SHORT) + bsr_len; + if (rlc_status.bytes_in_buffer > 128 ) { + pdu += 1; //sizeof(SCH_SUBHEADER_LONG) + } } - - if (UE_mac_inst[module_idP].scheduling_info.BSR_bytes[lcgid] > 128 ) { // long header size: adjust the header size - pdu += 1; + if ( (pdu > buflen) && (rlc_status.bytes_in_buffer > 0 ) ) { + num_lcid +=1; + bsr_len = (num_lcid >= 2 ) ? sizeof(BSR_LONG) : sizeof(BSR_SHORT) ; } - - // current phy buff can not transport all sdu for this lcgid -> transmit a bsr for this lcgid - - if ( (pdu > buflen) && (UE_mac_inst[module_idP].scheduling_info.BSR_bytes[lcgid] > 0 ) ) { - num_lcgid +=1; - bsr_len = (num_lcgid >= 2 ) ? sizeof(BSR_LONG) : sizeof(BSR_SHORT) ; - } - - LOG_D(MAC,"BSR Bytes %d for lcgid %d bsr len %d num lcgid %d\n", UE_mac_inst[module_idP].scheduling_info.BSR_bytes[lcgid], lcgid, bsr_len, num_lcgid); + LOG_D(MAC,"LC buffer Bytes %d for lcid %d bsr len %d num lcid %d\n", rlc_status.bytes_in_buffer, lcid, bsr_len, num_lcid); } if ( bsr_len > 0 ) @@ -2004,7 +2063,6 @@ uint8_t get_bsr_len (module_id_t module_idP, uint16_t buflen) return bsr_len; } - boolean_t update_bsr(module_id_t module_idP, frame_t frameP, eNB_index_t eNB_index, uint8_t lcid, uint8_t lcg_id) { @@ -2028,11 +2086,17 @@ boolean_t update_bsr(module_id_t module_idP, frame_t frameP, eNB_index_t eNB_in lcid, 0); - if (rlc_status.bytes_in_buffer > 0 ) { + if ((rlc_status.bytes_in_buffer > 0 ) +#if 0 //calvin for BSR test,current buffer greater then previous one, or buffer from 0 to !0 + && (rlc_status.bytes_in_buffer > UE_mac_inst[module_idP].scheduling_info.LCID_buffer_remain[lcid]) +#endif + ){ + //BSR trigger SR sr_pending = TRUE; UE_mac_inst[module_idP].scheduling_info.LCID_status[lcid] = LCID_NOT_EMPTY; - UE_mac_inst[module_idP].scheduling_info.BSR[lcg_id] += locate (BSR_TABLE,BSR_TABLE_SIZE, rlc_status.bytes_in_buffer); + // sum lcid buffer which has same lcgid UE_mac_inst[module_idP].scheduling_info.BSR_bytes[lcg_id] += rlc_status.bytes_in_buffer; + UE_mac_inst[module_idP].scheduling_info.BSR[lcg_id] = locate_BsrIndexByBufferSize(BSR_TABLE, BSR_TABLE_SIZE, UE_mac_inst[module_idP].scheduling_info.BSR_bytes[lcg_id]); // UE_mac_inst[module_idP].scheduling_info.BSR_short_lcid = lcid; // only applicable to short bsr LOG_D(MAC,"[UE %d] BSR level %d (LCGID %d, rlc buffer %d byte)\n", module_idP, UE_mac_inst[module_idP].scheduling_info.BSR[lcg_id],lcg_id, UE_mac_inst[module_idP].scheduling_info.BSR_bytes[lcg_id]); @@ -2045,7 +2109,7 @@ boolean_t update_bsr(module_id_t module_idP, frame_t frameP, eNB_index_t eNB_in return sr_pending; } -uint8_t locate (const uint32_t *table, int size, int value) +uint8_t locate_BsrIndexByBufferSize (const uint32_t *table, int size, int value) { uint8_t ju, jm, jl; @@ -2076,7 +2140,7 @@ uint8_t locate (const uint32_t *table, int size, int value) if (value == table[jl]) { return jl; - } else { + } else { return jl+1; //equally ju } diff --git a/openair2/LAYER2/MAC/vars.h b/openair2/LAYER2/MAC/vars.h index 83d159f910..236439c6e5 100644 --- a/openair2/LAYER2/MAC/vars.h +++ b/openair2/LAYER2/MAC/vars.h @@ -45,6 +45,15 @@ const uint32_t BSR_TABLE[BSR_TABLE_SIZE]= {0,10,12,14,17,19,22,26,31,36,42,49,57 1326,1552,1817,2127,2490,2915,3413,3995,4677,5467,6411,7505,8787,10287,12043,14099, 16507,19325,22624,26487,31009,36304,42502,49759,58255,68201,79846,93479,109439, 128125,150000, 300000 }; +// extended bsr table--currently not used +const uint32_t Extended_BSR_TABLE[BSR_TABLE_SIZE] = {0,10,13,16,19,23,29,35,43,53,65,80,98,120,147, + 181,223,274,337,414,509,625,769,945,1162,1429, + 1757,2161,2657,3267,4017,4940,6074,7469,9185, + 11294,13888,17077,20999,25822,31752,39045,48012, + 59039,72598,89272,109774,134986,165989,204111, + 250990,308634,379519,466683,573866,705666,867737, + 1067031,1312097,1613447,1984009,2439678,3000000, + 6000000}; //uint32_t EBSR_Level[63]={0,10,13,16,19,23,29,35,43,53,65,80,98,120,147,181}; From cf59e0d891fa0d940f2a7f8ba71b5b56f8c793d9 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Tue, 8 Nov 2016 14:40:34 +0200 Subject: [PATCH 264/349] Added notification messages for control delegation in dl_scheduler VSF --- .../CONTROL_MODULES/MAC/flexran_agent_mac_internal.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac_internal.c b/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac_internal.c index 7bfed81b48..04a90250eb 100644 --- a/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac_internal.c +++ b/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac_internal.c @@ -771,12 +771,15 @@ int load_dl_scheduler_function(mid_t mod_id, const char *function_name) { snprintf(lib_name, sizeof(lib_name), "/%s.so", function_name); strcpy(target, local_cache); strcat(target, lib_name); - + + LOG_I(FLEXRAN_AGENT, "Opening pushed code: %s\n", target); lib = dlopen(target, RTLD_NOW); if (lib == NULL) { + LOG_I(FLEXRAN_AGENT, "Could not load library\n"); goto error; } + LOG_I(FLEXRAN_AGENT, "Loading function: %s\n", function_name); void *loaded_scheduler = dlsym(lib, function_name); if (loaded_scheduler) { if (mac_agent_registered[mod_id]) { @@ -785,8 +788,10 @@ int load_dl_scheduler_function(mid_t mod_id, const char *function_name) { dlclose(agent_mac_xface[mod_id]->dl_scheduler_loaded_lib); } agent_mac_xface[mod_id]->dl_scheduler_loaded_lib = lib; - LOG_D(ENB_APP, "Delegated control for DL UE scheduler succesfully\n"); + LOG_I(FLEXRAN_AGENT, "New DL UE scheduler: %s\n", function_name); } + } else { + LOG_I(FLEXRAN_AGENT, "Scheduler could not be loaded\n"); } return 0; From 2078a9e57cedac81b105afa2814fb401a3dfafb2 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Wed, 9 Nov 2016 12:09:02 +0200 Subject: [PATCH 265/349] Added macros for enabling FlexRAN agent operation --- openair1/SCHED/phy_procedures_lte_eNb.c | 4 ++++ openair2/LAYER2/MAC/eNB_scheduler.c | 9 +++++++++ openair2/RRC/LITE/rrc_eNB.c | 7 +++++++ 3 files changed, 20 insertions(+) diff --git a/openair1/SCHED/phy_procedures_lte_eNb.c b/openair1/SCHED/phy_procedures_lte_eNb.c index d6f5a40da7..dbc90b34d9 100644 --- a/openair1/SCHED/phy_procedures_lte_eNb.c +++ b/openair1/SCHED/phy_procedures_lte_eNb.c @@ -62,10 +62,12 @@ #endif +#if defined(FLEXRAN_AGENT_SB_IF) //Agent-related headers #include "ENB_APP/flexran_agent_extern.h" #include "ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.h" #include "LAYER2/MAC/flexran_agent_mac_proto.h" +#endif //#define DIAG_PHY @@ -1369,11 +1371,13 @@ void phy_procedures_eNB_TX(PHY_VARS_eNB *eNB, eNB->dlsch_ra->active = 0; } +#if defined(FLEXRAN_AGENT_SB_IF) #ifndef DISABLE_SF_TRIGGER //Send subframe trigger to the controller if (mac_agent_registered[eNB->Mod_id]) { agent_mac_xface[eNB->Mod_id]->flexran_agent_send_sf_trigger(eNB->Mod_id); } +#endif #endif // Now scan UE specific DLSCH diff --git a/openair2/LAYER2/MAC/eNB_scheduler.c b/openair2/LAYER2/MAC/eNB_scheduler.c index 386efec596..c5dc8c88b0 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler.c +++ b/openair2/LAYER2/MAC/eNB_scheduler.c @@ -52,10 +52,12 @@ //#include "LAYER2/MAC/pre_processor.c" #include "pdcp.h" +#if defined(FLEXRAN_AGENT_SB_IF) //Agent-related headers #include "flexran_agent_extern.h" #include "flexran_agent_mac.h" #include "flexran_agent_mac_proto.h" +#endif #if defined(ENABLE_ITTI) # include "intertask_interface.h" @@ -103,7 +105,9 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, void *DLSCH_dci=NULL; int size_bits=0,size_bytes=0; +#if defined(FLEXRAN_AGENT_SB_IF) Protocol__FlexranMessage *msg; +#endif LOG_D(MAC,"[eNB %d] Frame %d, Subframe %d, entering MAC scheduler (UE_list->head %d)\n",module_idP, frameP, subframeP,UE_list->head); @@ -137,14 +141,17 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, eNB_mac_inst[module_idP].UE_list.UE_sched_ctrl[i].cqi_req_timer++; + if (mac_xface->get_eNB_UE_stats(module_idP, CC_id, rnti)==NULL) { //mac_remove_ue(module_idP, i, frameP, subframeP); //Inform the controller about the UE deactivation. Should be moved to RRC agent in the future +#if defined(FLEXRAN_AGENT_SB_IF) if (mac_agent_registered[module_idP]) { agent_mac_xface[module_idP]->flexran_agent_notify_ue_state_change(module_idP, rnti, PROTOCOL__FLEX_UE_STATE_CHANGE_TYPE__FLUESC_DEACTIVATED); } +#endif } else { // check uplink failure @@ -1081,11 +1088,13 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, for (CC_id=0;CC_idflexran_agent_send_update_mac_stats(module_idP); } +#endif #endif /* diff --git a/openair2/RRC/LITE/rrc_eNB.c b/openair2/RRC/LITE/rrc_eNB.c index 3f8e7c5f83..2ce94ba26c 100644 --- a/openair2/RRC/LITE/rrc_eNB.c +++ b/openair2/RRC/LITE/rrc_eNB.c @@ -93,7 +93,9 @@ #include "SIMULATION/TOOLS/defs.h" // for taus +#if defined(FLEXRAN_AGENT_SB_IF) #include "flexran_agent_extern.h" +#endif #define XER_PRINT #ifdef PHY_EMUL @@ -4541,12 +4543,14 @@ rrc_eNB_decode_dcch( ue_context_p, ul_dcch_msg->message.choice.c1.choice.rrcConnectionReconfigurationComplete.rrc_TransactionIdentifier); +#if defined(FLEXRAN_AGENT_SB_IF) //WARNING:Inform the controller about the UE activation. Should be moved to RRC agent in the future if (mac_agent_registered[ctxt_pP->module_id]) { agent_mac_xface[ctxt_pP->eNB_index]->flexran_agent_notify_ue_state_change(ctxt_pP->module_id, ue_context_p->ue_id_rnti, PROTOCOL__FLEX_UE_STATE_CHANGE_TYPE__FLUESC_UPDATED); } +#endif } #if defined(ENABLE_ITTI) # if defined(ENABLE_USE_MME) @@ -4642,12 +4646,15 @@ rrc_eNB_decode_dcch( ue_context_p->ue_context.Status = RRC_CONNECTED; LOG_I(RRC, PROTOCOL_RRC_CTXT_UE_FMT" UE State = RRC_CONNECTED \n", PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP)); + +#if defined(FLEXRAN_AGENT_SB_IF) //WARNING:Inform the controller about the UE activation. Should be moved to RRC agent in the future if (mac_agent_registered[ctxt_pP->module_id]) { agent_mac_xface[ctxt_pP->eNB_index]->flexran_agent_notify_ue_state_change(ctxt_pP->module_id, ue_context_p->ue_id_rnti, PROTOCOL__FLEX_UE_STATE_CHANGE_TYPE__FLUESC_ACTIVATED); } +#endif } } From bb5b90eab0029cc273720516943cce490eaac376 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Wed, 9 Nov 2016 12:09:44 +0200 Subject: [PATCH 266/349] Added compilation options for enabling/disabling FlexRAN agent --- cmake_targets/CMakeLists.txt | 15 +++++++++++++-- cmake_targets/build_oai | 16 ++++++++++++++++ 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index da90efdaee..b5279de5e2 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -621,7 +621,7 @@ add_boolean_option(MESSAGE_CHART_GENERATOR False "For generating sequenc add_boolean_option(MESSAGE_CHART_GENERATOR_RLC_MAC False "trace RLC-MAC exchanges in sequence diagrams") add_boolean_option(MESSAGE_CHART_GENERATOR_PHY False "trace some PHY exchanges in sequence diagrams") -add_boolean_option(FLEXRAN_AGENT_SB_IF True "enable FlexRAN agent to inteface with a SDN contrller") +add_boolean_option(FLEXRAN_AGENT_SB_IF False "enable FlexRAN agent to inteface with a SDN controller") ######################## # Include order @@ -1185,10 +1185,17 @@ set (MAC_SRC ${MAC_DIR}/eNB_scheduler_RA.c ${MAC_DIR}/pre_processor.c ${MAC_DIR}/config.c + ) + +if (FLEXRAN_AGENT_SB_IF) + +set (MAC_SRC ${MAC_SRC} ${MAC_DIR}/flexran_agent_scheduler_dlsch_ue.c ${MAC_DIR}/flexran_agent_scheduler_dataplane.c ${MAC_DIR}/flexran_agent_scheduler_dlsch_ue_remote.c - ) +) + +endif() set (ENB_APP_SRC ${OPENAIR2_DIR}/ENB_APP/enb_app.c @@ -1201,10 +1208,14 @@ add_library(L2 ${ENB_APP_SRC}) # ${OPENAIR2_DIR}/RRC/L2_INTERFACE/openair_rrc_L2_interface.c) +if (FLEXRAN_AGENT_SB_IF) + #Test for adding a shared library add_library(default_sched SHARED ${MAC_DIR}/flexran_agent_scheduler_dlsch_ue.c) add_library(remote_sched SHARED ${MAC_DIR}/flexran_agent_scheduler_dlsch_ue_remote.c) +endif() + # L3 Libs ########################## diff --git a/cmake_targets/build_oai b/cmake_targets/build_oai index b77a9baa56..25e9a1ccc8 100755 --- a/cmake_targets/build_oai +++ b/cmake_targets/build_oai @@ -35,6 +35,7 @@ source $THIS_SCRIPT_PATH/tools/build_helper MSC_GEN="False" XFORMS="True" +FLEXRAN_AGENT_SB_IF="True" PRINT_STATS="False" VCD_TIMING="False" DEADLINE_SCHEDULER_FLAG_USER="False" @@ -83,6 +84,8 @@ Options Makes the UE specific parts (ue_ip, usim, nvram) --RRH Makes the RRH +-a | --agent + Enables agent for software-defined control of the eNB -r | --3gpp-release default is Rel10, Rel8 limits the implementation to 3GPP Release 8 version @@ -169,6 +172,10 @@ function main() { eNB=1 echo_info "Will compile eNB" shift;; + -a | --agent) + FLEXRAN_AGENT=1 + echo_info "Will compile eNB with agent support" + shift;; --UE) UE=1 echo_info "Will compile UE" @@ -439,6 +446,9 @@ function main() { echo "set ( CMAKE_BUILD_TYPE $CMAKE_BUILD_TYPE )" >> $cmake_file echo "set ( CFLAGS_PROCESSOR_USER \"$CFLAGS_PROCESSOR_USER\" )" >> $cmake_file echo "set ( XFORMS $XFORMS )" >> $cmake_file + if [ "$FLEXRAN_AGENT" = "1" ] ; then + echo "set ( FLEXRAN_AGENT_SB_IF $FLEXRAN_AGENT_SB_IF )" >> $cmake_file + fi echo "set ( RRC_ASN1_VERSION \"${REL}\")" >> $cmake_file echo "set ( ENABLE_VCD_FIFO $VCD_TIMING )" >> $cmake_file echo "set ( RF_BOARD \"${HW}\")" >> $cmake_file @@ -581,6 +591,9 @@ function main() { echo "set ( CMAKE_BUILD_TYPE $CMAKE_BUILD_TYPE )" >> $cmake_file echo "set ( CFLAGS_PROCESSOR_USER \"$CFLAGS_PROCESSOR_USER\" )" >> $cmake_file echo "set ( XFORMS $XFORMS )" >> $cmake_file + if [ "$FLEXRAN_AGENT" = "1" ] ; then + echo "set ( FLEXRAN_AGENT_SB_IF $FLEXRAN_AGENT_SB_IF )" >> $cmake_file + fi echo "set ( PRINT_STATS $PRINT_STATS )" >> $cmake_file echo "set ( RRC_ASN1_VERSION \"${REL}\")" >> $cmake_file echo "set ( ENABLE_VCD_FIFO $VCD_TIMING )" >> $cmake_file @@ -649,6 +662,9 @@ function main() { cp $DIR/oaisim_mme_build_oai/CMakeLists.template $cmake_file echo "set ( CMAKE_BUILD_TYPE $CMAKE_BUILD_TYPE )" >> $cmake_file echo "set ( XFORMS $XFORMS )" >> $cmake_file + if [ "$FLEXRAN_AGENT" = "1" ] ; then + echo "set ( FLEXRAN_AGENT_SB_IF $FLEXRAN_AGENT_SB_IF )" >> $cmake_file + fi echo "set ( RRC_ASN1_VERSION \"${REL}\")" >> $cmake_file echo "set ( ENABLE_VCD_FIFO $VCD_TIMING )" >> $cmake_file echo "set ( T_TRACER $T_TRACER )" >> $cmake_file From 985dcdc38cbb7f03ddf12ba801e996355564a8a8 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Wed, 9 Nov 2016 12:11:26 +0200 Subject: [PATCH 267/349] Removed deprecated configuration files for FlexRAN agent --- .../CONF/enb.band5.agent.usrpb210.conf | 180 ----------- .../enb.band5.agent.usrpb210.epc.remote.conf | 176 ---------- .../CONF/enb.band7.agent.oaisim.2.enb.conf | 302 ------------------ .../enb.band7.agent.oaisim.local_no_mme.conf | 154 --------- .../enb.band7.agent.usrpb210.epc.remote.conf | 174 ---------- 5 files changed, 986 deletions(-) delete mode 100644 targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band5.agent.usrpb210.conf delete mode 100644 targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band5.agent.usrpb210.epc.remote.conf delete mode 100644 targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.agent.oaisim.2.enb.conf delete mode 100644 targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.agent.oaisim.local_no_mme.conf delete mode 100644 targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.agent.usrpb210.epc.remote.conf diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band5.agent.usrpb210.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band5.agent.usrpb210.conf deleted file mode 100644 index caf54b5541..0000000000 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band5.agent.usrpb210.conf +++ /dev/null @@ -1,180 +0,0 @@ -Active_eNBs = ( "eNB_Eurecom_LTEBox"); -# Asn1_verbosity, choice in: none, info, annoying -Asn1_verbosity = "none"; - -eNBs = -( - { - ////////// Identification parameters: - eNB_ID = 0xe00; - - cell_type = "CELL_MACRO_ENB"; - - eNB_name = "eNB_Eurecom_LTEBox"; - - // Tracking area code, 0x0000 and 0xfffe are reserved values - tracking_area_code = "1"; - - mobile_country_code = "208"; - - mobile_network_code = "95"; - - ////////// Physical parameters: - - component_carriers = ( - { - frame_type = "FDD"; - tdd_config = 3; - tdd_config_s = 0; - prefix_type = "NORMAL"; - eutra_band = 5; - downlink_frequency = 879000000L; - uplink_frequency_offset = -45000000; - Nid_cell = 0; - N_RB_DL = 25; - Nid_cell_mbsfn = 0; - nb_antenna_ports = 1; - nb_antennas_tx = 1; - nb_antennas_rx = 1; - tx_gain = 90; - rx_gain = 125; - prach_root = 0; - prach_config_index = 0; - prach_high_speed = "DISABLE"; - prach_zero_correlation = 1; - prach_freq_offset = 2; - pucch_delta_shift = 1; - pucch_nRB_CQI = 1; - pucch_nCS_AN = 0; - pucch_n1_AN = 32; - pdsch_referenceSignalPower = -29; - pdsch_p_b = 0; - pusch_n_SB = 1; - pusch_enable64QAM = "DISABLE"; - pusch_hoppingMode = "interSubFrame"; - pusch_hoppingOffset = 0; - pusch_groupHoppingEnabled = "ENABLE"; - pusch_groupAssignment = 0; - pusch_sequenceHoppingEnabled = "DISABLE"; - pusch_nDMRS1 = 1; - phich_duration = "NORMAL"; - phich_resource = "ONESIXTH"; - srs_enable = "DISABLE"; - /* srs_BandwidthConfig =; - srs_SubframeConfig =; - srs_ackNackST =; - srs_MaxUpPts =;*/ - - pusch_p0_Nominal = -90; - pusch_alpha = "AL1"; - pucch_p0_Nominal = -96; - msg3_delta_Preamble = 6; - pucch_deltaF_Format1 = "deltaF2"; - pucch_deltaF_Format1b = "deltaF3"; - pucch_deltaF_Format2 = "deltaF0"; - pucch_deltaF_Format2a = "deltaF0"; - pucch_deltaF_Format2b = "deltaF0"; - - rach_numberOfRA_Preambles = 64; - rach_preamblesGroupAConfig = "DISABLE"; - /* - rach_sizeOfRA_PreamblesGroupA = ; - rach_messageSizeGroupA = ; - rach_messagePowerOffsetGroupB = ; - */ - rach_powerRampingStep = 4; - rach_preambleInitialReceivedTargetPower = -108; - rach_preambleTransMax = 10; - rach_raResponseWindowSize = 10; - rach_macContentionResolutionTimer = 48; - rach_maxHARQ_Msg3Tx = 4; - - pcch_default_PagingCycle = 128; - pcch_nB = "oneT"; - bcch_modificationPeriodCoeff = 2; - ue_TimersAndConstants_t300 = 1000; - ue_TimersAndConstants_t301 = 1000; - ue_TimersAndConstants_t310 = 1000; - ue_TimersAndConstants_t311 = 10000; - ue_TimersAndConstants_n310 = 20; - ue_TimersAndConstants_n311 = 1; - - ue_TransmissionMode = 1; - } - ); - - srb1_parameters : - { - # timer_poll_retransmit = (ms) [5, 10, 15, 20,... 250, 300, 350, ... 500] - timer_poll_retransmit = 80; - - # timer_reordering = (ms) [0,5, ... 100, 110, 120, ... ,200] - timer_reordering = 35; - - # timer_reordering = (ms) [0,5, ... 250, 300, 350, ... ,500] - timer_status_prohibit = 0; - - # poll_pdu = [4, 8, 16, 32 , 64, 128, 256, infinity(>10000)] - poll_pdu = 4; - - # poll_byte = (kB) [25,50,75,100,125,250,375,500,750,1000,1250,1500,2000,3000,infinity(>10000)] - poll_byte = 99999; - - # max_retx_threshold = [1, 2, 3, 4 , 6, 8, 16, 32] - max_retx_threshold = 4; - } - - # ------- SCTP definitions - SCTP : - { - # Number of streams to use in input/output - SCTP_INSTREAMS = 2; - SCTP_OUTSTREAMS = 2; - }; - - ////////// MME parameters: - mme_ip_address = ( { ipv4 = "192.168.100.101"; - ipv6 = "192:168:100::17"; - active = "yes"; - preference = "ipv4"; - } - ); - - NETWORK_INTERFACES : - { - ENB_INTERFACE_NAME_FOR_S1_MME = "eth0"; - ENB_IPV4_ADDRESS_FOR_S1_MME = "192.168.100.106/24"; - - ENB_INTERFACE_NAME_FOR_S1U = "eth0"; - ENB_IPV4_ADDRESS_FOR_S1U = "192.168.100.106/24"; - ENB_PORT_FOR_S1U = 2152; # Spec 2152 - }; - - NETWORK_CONTROLLER : - { - ENB_AGENT_INTERFACE_NAME = "eth1"; - ENB_AGENT_IPV4_ADDRESS = "10.0.2.5/30"; - ENB_AGENT_PORT = 2210; - ENB_AGENT_CACHE = "/mnt/oai_agent_cache"; - }; - - - log_config : - { - global_log_level ="info"; - global_log_verbosity ="medium"; - hw_log_level ="info"; - hw_log_verbosity ="medium"; - phy_log_level ="info"; - phy_log_verbosity ="medium"; - mac_log_level ="info"; - mac_log_verbosity ="high"; - rlc_log_level ="info"; - rlc_log_verbosity ="medium"; - pdcp_log_level ="info"; - pdcp_log_verbosity ="medium"; - rrc_log_level ="info"; - rrc_log_verbosity ="medium"; - }; - } -); diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band5.agent.usrpb210.epc.remote.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band5.agent.usrpb210.epc.remote.conf deleted file mode 100644 index e8bb16f2c8..0000000000 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band5.agent.usrpb210.epc.remote.conf +++ /dev/null @@ -1,176 +0,0 @@ -Active_eNBs = ( "eNB_Eurecom_LTEBox"); -# Asn1_verbosity, choice in: none, info, annoying -Asn1_verbosity = "none"; - -eNBs = -( - { - ////////// Identification parameters: - eNB_ID = 0xe00; - - cell_type = "CELL_MACRO_ENB"; - - eNB_name = "eNB_Eurecom_LTEBox"; - - // Tracking area code, 0x0000 and 0xfffe are reserved values - tracking_area_code = "10"; - - mobile_country_code = "208"; - mobile_network_code = "95"; - - ////////// Physical parameters: - - component_carriers = ( - { - frame_type = "FDD"; - tdd_config = 3; - tdd_config_s = 0; - prefix_type = "NORMAL"; - eutra_band = 5; - downlink_frequency = 879000000L; - uplink_frequency_offset = -45000000; - Nid_cell = 0; - N_RB_DL = 25; - Nid_cell_mbsfn = 0; - nb_antennas_tx = 1; - nb_antennas_rx = 1; - tx_gain = 90; - rx_gain = 115; - prach_root = 0; - prach_config_index = 0; - prach_high_speed = "DISABLE"; - prach_zero_correlation = 1; - prach_freq_offset = 2; - pucch_delta_shift = 1; - pucch_nRB_CQI = 1; - pucch_nCS_AN = 0; - pucch_n1_AN = 32; - pdsch_referenceSignalPower = -26; - pdsch_p_b = 0; - pusch_n_SB = 1; - pusch_enable64QAM = "DISABLE"; - pusch_hoppingMode = "interSubFrame"; - pusch_hoppingOffset = 0; - pusch_groupHoppingEnabled = "ENABLE"; - pusch_groupAssignment = 0; - pusch_sequenceHoppingEnabled = "DISABLE"; - pusch_nDMRS1 = 1; - phich_duration = "NORMAL"; - phich_resource = "ONESIXTH"; - srs_enable = "DISABLE"; - /* srs_BandwidthConfig =; - srs_SubframeConfig =; - srs_ackNackST =; - srs_MaxUpPts =;*/ - - pusch_p0_Nominal = -90; - pusch_alpha = "AL1"; - pucch_p0_Nominal = -108; - msg3_delta_Preamble = 6; - pucch_deltaF_Format1 = "deltaF2"; - pucch_deltaF_Format1b = "deltaF3"; - pucch_deltaF_Format2 = "deltaF0"; - pucch_deltaF_Format2a = "deltaF0"; - pucch_deltaF_Format2b = "deltaF0"; - - rach_numberOfRA_Preambles = 64; - rach_preamblesGroupAConfig = "DISABLE"; -/* - rach_sizeOfRA_PreamblesGroupA = ; - rach_messageSizeGroupA = ; - rach_messagePowerOffsetGroupB = ; -*/ - rach_powerRampingStep = 4; - rach_preambleInitialReceivedTargetPower = -108; - rach_preambleTransMax = 10; - rach_raResponseWindowSize = 10; - rach_macContentionResolutionTimer = 48; - rach_maxHARQ_Msg3Tx = 4; - - pcch_default_PagingCycle = 128; - pcch_nB = "oneT"; - bcch_modificationPeriodCoeff = 2; - ue_TimersAndConstants_t300 = 1000; - ue_TimersAndConstants_t301 = 1000; - ue_TimersAndConstants_t310 = 1000; - ue_TimersAndConstants_t311 = 10000; - ue_TimersAndConstants_n310 = 20; - ue_TimersAndConstants_n311 = 1; - - } - ); - - - srb1_parameters : - { - # timer_poll_retransmit = (ms) [5, 10, 15, 20,... 250, 300, 350, ... 500] - timer_poll_retransmit = 80; - - # timer_reordering = (ms) [0,5, ... 100, 110, 120, ... ,200] - timer_reordering = 35; - - # timer_reordering = (ms) [0,5, ... 250, 300, 350, ... ,500] - timer_status_prohibit = 0; - - # poll_pdu = [4, 8, 16, 32 , 64, 128, 256, infinity(>10000)] - poll_pdu = 4; - - # poll_byte = (kB) [25,50,75,100,125,250,375,500,750,1000,1250,1500,2000,3000,infinity(>10000)] - poll_byte = 99999; - - # max_retx_threshold = [1, 2, 3, 4 , 6, 8, 16, 32] - max_retx_threshold = 4; - } - - # ------- SCTP definitions - SCTP : - { - # Number of streams to use in input/output - SCTP_INSTREAMS = 2; - SCTP_OUTSTREAMS = 2; - }; - - ////////// MME parameters: - mme_ip_address = ( {ipv4 = "192.168.100.102"; - ipv6="192:168:30::17"; - active="yes"; - preference="ipv4";}); - - NETWORK_INTERFACES : - { - ENB_INTERFACE_NAME_FOR_S1_MME = "eth2:1"; - ENB_IPV4_ADDRESS_FOR_S1_MME = "192.168.100.103/24"; - - ENB_INTERFACE_NAME_FOR_S1U = "eth2:1"; - ENB_IPV4_ADDRESS_FOR_S1U = "192.168.100.103/24"; - ENB_PORT_FOR_S1U = 2152; # Spec 2152 - }; - - NETWORK_CONTROLLER : - { - ENB_AGENT_INTERFACE_NAME = "eth0"; - ENB_AGENT_IPV4_ADDRESS = "10.0.0.5/30"; - ENB_AGENT_PORT = 2210; - ENB_AGENT_CACHE = "/mnt/oai_agent_cache"; - }; - - log_config : - { - global_log_level ="info"; - global_log_verbosity ="medium"; - hw_log_level ="info"; - hw_log_verbosity ="medium"; - phy_log_level ="info"; - phy_log_verbosity ="medium"; - mac_log_level ="debug"; - mac_log_verbosity ="high"; - rlc_log_level ="info"; - rlc_log_verbosity ="medium"; - pdcp_log_level ="info"; - pdcp_log_verbosity ="medium"; - rrc_log_level ="info"; - rrc_log_verbosity ="medium"; - }; - - } -); diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.agent.oaisim.2.enb.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.agent.oaisim.2.enb.conf deleted file mode 100644 index c792961a18..0000000000 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.agent.oaisim.2.enb.conf +++ /dev/null @@ -1,302 +0,0 @@ -Active_eNBs = ( "eNB_Eurecom_LTEBox1", "eNB_Eurecom_LTEBox"); -# Asn1_verbosity, choice in: none, info, annoying -Asn1_verbosity = "none"; - -eNBs = -( - { - ////////// Identification parameters: - eNB_ID = 0x00; - - cell_type = "CELL_MACRO_ENB"; - - eNB_name = "eNB_Eurecom_LTEBox"; - - // Tracking area code, 0x0000 and 0xfffe are reserved values - tracking_area_code = "1"; - - mobile_country_code = "208"; - - mobile_network_code = "10"; - - ////////// Physical parameters: - - component_carriers = ( - { - frame_type = "FDD"; - tdd_config = 3; - tdd_config_s = 0; - prefix_type = "NORMAL"; - eutra_band = 7; - downlink_frequency = 2680000000L; - uplink_frequency_offset = -120000000; - Nid_cell = 0; - N_RB_DL = 50; - Nid_cell_mbsfn = 0; - nb_antennas_tx = 1; - nb_antennas_rx = 1; - tx_gain = 25; - rx_gain = 20; - prach_root = 0; - prach_config_index = 0; - prach_high_speed = "DISABLE"; - prach_zero_correlation = 1; - prach_freq_offset = 2; - pucch_delta_shift = 1; - pucch_nRB_CQI = 1; - pucch_nCS_AN = 0; - pucch_n1_AN = 32; - pdsch_referenceSignalPower = 0; - pdsch_p_b = 0; - pusch_n_SB = 1; - pusch_enable64QAM = "DISABLE"; - pusch_hoppingMode = "interSubFrame"; - pusch_hoppingOffset = 0; - pusch_groupHoppingEnabled = "ENABLE"; - pusch_groupAssignment = 0; - pusch_sequenceHoppingEnabled = "DISABLE"; - pusch_nDMRS1 = 0; - phich_duration = "NORMAL"; - phich_resource = "ONESIXTH"; - srs_enable = "DISABLE"; - /* srs_BandwidthConfig =; - srs_SubframeConfig =; - srs_ackNackST =; - srs_MaxUpPts =;*/ - - pusch_p0_Nominal = -108; - pusch_alpha = "AL1"; - pucch_p0_Nominal = -108; - msg3_delta_Preamble = 6; - pucch_deltaF_Format1 = "deltaF2"; - pucch_deltaF_Format1b = "deltaF3"; - pucch_deltaF_Format2 = "deltaF0"; - pucch_deltaF_Format2a = "deltaF0"; - pucch_deltaF_Format2b = "deltaF0"; - - rach_numberOfRA_Preambles = 64; - rach_preamblesGroupAConfig = "DISABLE"; - /* - rach_sizeOfRA_PreamblesGroupA = ; - rach_messageSizeGroupA = ; - rach_messagePowerOffsetGroupB = ; - */ - rach_powerRampingStep = 2; - rach_preambleInitialReceivedTargetPower = -100; - rach_preambleTransMax = 10; - rach_raResponseWindowSize = 10; - rach_macContentionResolutionTimer = 48; - rach_maxHARQ_Msg3Tx = 4; - - pcch_default_PagingCycle = 128; - pcch_nB = "oneT"; - bcch_modificationPeriodCoeff = 2; - ue_TimersAndConstants_t300 = 1000; - ue_TimersAndConstants_t301 = 1000; - ue_TimersAndConstants_t310 = 1000; - ue_TimersAndConstants_t311 = 10000; - ue_TimersAndConstants_n310 = 20; - ue_TimersAndConstants_n311 = 1; - } - ); - - ////////// MME parameters: - mme_ip_address = ( { ipv4 = "192.168.100.102"; - ipv6 = "0::0"; - active = "yes"; - preference = "ipv4"; - } - ); - - NETWORK_INTERFACES : - { - ENB_INTERFACE_NAME_FOR_S1_MME = "eth2:1"; - ENB_IPV4_ADDRESS_FOR_S1_MME = "192.168.100.103/24"; - - ENB_INTERFACE_NAME_FOR_S1U = "eth2:1"; - ENB_IPV4_ADDRESS_FOR_S1U = "192.168.100.103/24"; - ENB_PORT_FOR_S1U = 2153; # Spec 2152 - }; - - NETWORK_CONTROLLER : - { - ENB_AGENT_INTERFACE_NAME = "eth0"; - ENB_AGENT_IPV4_ADDRESS = "10.0.0.5/30"; - ENB_AGENT_PORT = 2210; - ENB_AGENT_CACHE = "/mnt/oai_agent_cache"; - }; - - log_config : - { - global_log_level ="trace"; - global_log_verbosity ="medium"; - hw_log_level ="info"; - hw_log_verbosity ="medium"; - phy_log_level ="trace"; - phy_log_verbosity ="medium"; - mac_log_level ="trace"; - mac_log_verbosity ="medium"; - rlc_log_level ="trace"; - rlc_log_verbosity ="medium"; - pdcp_log_level ="trace"; - pdcp_log_verbosity ="medium"; - rrc_log_level ="trace"; - rrc_log_verbosity ="medium"; - gtpu_log_level ="debug"; - gtpu_log_verbosity ="medium"; - udp_log_level ="debug"; - udp_log_verbosity ="medium"; - osa_log_level ="debug"; - osa_log_verbosity ="low"; - }; - - }, - - { - ////////// Identification parameters: - eNB_ID = 0x01; - - cell_type = "CELL_MACRO_ENB"; - - eNB_name = "eNB_Eurecom_LTEBox1"; - - // Tracking area code, 0x0000 and 0xfffe are reserved values - tracking_area_code = "1"; - - mobile_country_code = "208"; - - mobile_network_code = "10"; - - ////////// Physical parameters: - - component_carriers = ( - { - frame_type = "FDD"; - tdd_config = 3; - tdd_config_s = 0; - prefix_type = "NORMAL"; - eutra_band = 7; - downlink_frequency = 2680000000L; - uplink_frequency_offset = -120000000; - Nid_cell = 10; - N_RB_DL = 25; - Nid_cell_mbsfn = 0; - nb_antennas_tx = 1; - nb_antennas_rx = 1; - tx_gain = 25; - rx_gain = 20; - prach_root = 0; - prach_config_index = 0; - prach_high_speed = "DISABLE"; - prach_zero_correlation = 1; - prach_freq_offset = 2; - pucch_delta_shift = 1; - pucch_nRB_CQI = 1; - pucch_nCS_AN = 0; - pucch_n1_AN = 32; - pdsch_referenceSignalPower = 0; - pdsch_p_b = 0; - pusch_n_SB = 1; - pusch_enable64QAM = "DISABLE"; - pusch_hoppingMode = "interSubFrame"; - pusch_hoppingOffset = 0; - pusch_groupHoppingEnabled = "ENABLE"; - pusch_groupAssignment = 0; - pusch_sequenceHoppingEnabled = "DISABLE"; - pusch_nDMRS1 = 0; - phich_duration = "NORMAL"; - phich_resource = "ONESIXTH"; - srs_enable = "DISABLE"; - /* srs_BandwidthConfig =; - srs_SubframeConfig =; - srs_ackNackST =; - srs_MaxUpPts =;*/ - - pusch_p0_Nominal = -108; - pusch_alpha = "AL1"; - pucch_p0_Nominal = -108; - msg3_delta_Preamble = 6; - pucch_deltaF_Format1 = "deltaF2"; - pucch_deltaF_Format1b = "deltaF3"; - pucch_deltaF_Format2 = "deltaF0"; - pucch_deltaF_Format2a = "deltaF0"; - pucch_deltaF_Format2b = "deltaF0"; - - rach_numberOfRA_Preambles = 64; - rach_preamblesGroupAConfig = "DISABLE"; - /* - rach_sizeOfRA_PreamblesGroupA = ; - rach_messageSizeGroupA = ; - rach_messagePowerOffsetGroupB = ; - */ - rach_powerRampingStep = 2; - rach_preambleInitialReceivedTargetPower = -100; - rach_preambleTransMax = 10; - rach_raResponseWindowSize = 10; - rach_macContentionResolutionTimer = 48; - rach_maxHARQ_Msg3Tx = 4; - - pcch_default_PagingCycle = 128; - pcch_nB = "oneT"; - bcch_modificationPeriodCoeff = 2; - ue_TimersAndConstants_t300 = 1000; - ue_TimersAndConstants_t301 = 1000; - ue_TimersAndConstants_t310 = 1000; - ue_TimersAndConstants_t311 = 10000; - ue_TimersAndConstants_n310 = 20; - ue_TimersAndConstants_n311 = 1; - } - ); - - ////////// MME parameters: - mme_ip_address = ( { ipv4 = "192.168.100.102"; - ipv6 = "0::0"; - active = "yes"; - preference = "ipv4"; - } - ); - - NETWORK_INTERFACES : - { - ENB_INTERFACE_NAME_FOR_S1_MME = "eth2:2"; - ENB_IPV4_ADDRESS_FOR_S1_MME = "192.168.100.104/24"; - - ENB_INTERFACE_NAME_FOR_S1U = "eth2:2"; - ENB_IPV4_ADDRESS_FOR_S1U = "192.168.100.104/24"; - ENB_PORT_FOR_S1U = 2153; # Spec 2152 - }; - - NETWORK_CONTROLLER : - { - ENB_AGENT_INTERFACE_NAME = "eth0"; - ENB_AGENT_IPV4_ADDRESS = "10.0.0.5/30"; - ENB_AGENT_PORT = 2210; - ENB_AGENT_CACHE = "/mnt/oai_agent_cache"; - }; - - log_config : - { - global_log_level ="trace"; - global_log_verbosity ="medium"; - hw_log_level ="info"; - hw_log_verbosity ="medium"; - phy_log_level ="trace"; - phy_log_verbosity ="medium"; - mac_log_level ="trace"; - mac_log_verbosity ="medium"; - rlc_log_level ="trace"; - rlc_log_verbosity ="medium"; - pdcp_log_level ="trace"; - pdcp_log_verbosity ="medium"; - rrc_log_level ="trace"; - rrc_log_verbosity ="medium"; - gtpu_log_level ="debug"; - gtpu_log_verbosity ="medium"; - udp_log_level ="debug"; - udp_log_verbosity ="medium"; - osa_log_level ="debug"; - osa_log_verbosity ="low"; - }; - - } -); diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.agent.oaisim.local_no_mme.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.agent.oaisim.local_no_mme.conf deleted file mode 100644 index f95cfd9389..0000000000 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.agent.oaisim.local_no_mme.conf +++ /dev/null @@ -1,154 +0,0 @@ -Active_eNBs = ( "eNB_Eurecom_LTEBox"); -# Asn1_verbosity, choice in: none, info, annoying -Asn1_verbosity = "none"; - -eNBs = -( - { - ////////// Identification parameters: - eNB_ID = 0xe00; - - cell_type = "CELL_MACRO_ENB"; - - eNB_name = "eNB_Eurecom_LTEBox"; - - // Tracking area code, 0x0000 and 0xfffe are reserved values - tracking_area_code = "1"; - - mobile_country_code = "208"; - - mobile_network_code = "10"; - - ////////// Physical parameters: - - component_carriers = ( - { - frame_type = "FDD"; - tdd_config = 3; - tdd_config_s = 0; - prefix_type = "NORMAL"; - eutra_band = 7; - downlink_frequency = 2680000000L; - uplink_frequency_offset = -120000000; - Nid_cell = 0; - N_RB_DL = 25; - Nid_cell_mbsfn = 0; - nb_antennas_tx = 1; - nb_antennas_rx = 1; - tx_gain = 25; - rx_gain = 20; - prach_root = 0; - prach_config_index = 0; - prach_high_speed = "DISABLE"; - prach_zero_correlation = 1; - prach_freq_offset = 2; - pucch_delta_shift = 1; - pucch_nRB_CQI = 1; - pucch_nCS_AN = 0; - pucch_n1_AN = 32; - pdsch_referenceSignalPower = 0; - pdsch_p_b = 0; - pusch_n_SB = 1; - pusch_enable64QAM = "DISABLE"; - pusch_hoppingMode = "interSubFrame"; - pusch_hoppingOffset = 0; - pusch_groupHoppingEnabled = "ENABLE"; - pusch_groupAssignment = 0; - pusch_sequenceHoppingEnabled = "DISABLE"; - pusch_nDMRS1 = 0; - phich_duration = "NORMAL"; - phich_resource = "ONESIXTH"; - srs_enable = "DISABLE"; - /* srs_BandwidthConfig =; - srs_SubframeConfig =; - srs_ackNackST =; - srs_MaxUpPts =;*/ - - pusch_p0_Nominal = -108; - pusch_alpha = "AL1"; - pucch_p0_Nominal = -108; - msg3_delta_Preamble = 6; - pucch_deltaF_Format1 = "deltaF2"; - pucch_deltaF_Format1b = "deltaF3"; - pucch_deltaF_Format2 = "deltaF0"; - pucch_deltaF_Format2a = "deltaF0"; - pucch_deltaF_Format2b = "deltaF0"; - - rach_numberOfRA_Preambles = 64; - rach_preamblesGroupAConfig = "DISABLE"; - /* - rach_sizeOfRA_PreamblesGroupA = ; - rach_messageSizeGroupA = ; - rach_messagePowerOffsetGroupB = ; - */ - rach_powerRampingStep = 2; - rach_preambleInitialReceivedTargetPower = -100; - rach_preambleTransMax = 10; - rach_raResponseWindowSize = 10; - rach_macContentionResolutionTimer = 48; - rach_maxHARQ_Msg3Tx = 4; - - pcch_default_PagingCycle = 128; - pcch_nB = "oneT"; - bcch_modificationPeriodCoeff = 2; - ue_TimersAndConstants_t300 = 1000; - ue_TimersAndConstants_t301 = 1000; - ue_TimersAndConstants_t310 = 1000; - ue_TimersAndConstants_t311 = 10000; - ue_TimersAndConstants_n310 = 20; - ue_TimersAndConstants_n311 = 1; - } - ); - - ////////// MME parameters: - mme_ip_address = ( { ipv4 = "0.0.0.0"; - ipv6 = "0::0"; - active = "yes"; - preference = "ipv4"; - } - ); - - NETWORK_INTERFACES : - { - ENB_INTERFACE_NAME_FOR_S1_MME = "none"; - ENB_IPV4_ADDRESS_FOR_S1_MME = "0.0.0.0/24"; - - ENB_INTERFACE_NAME_FOR_S1U = "none"; - ENB_IPV4_ADDRESS_FOR_S1U = "0.0.0.0/24"; - ENB_PORT_FOR_S1U = 2153; # Spec 2152 - }; - - NETWORK_CONTROLLER : - { - ENB_AGENT_INTERFACE_NAME = "eth0"; - ENB_AGENT_IPV4_ADDRESS = "127.0.0.1/24"; - ENB_AGENT_PORT = 2210; - ENB_AGENT_CACHE = "/mnt/oai_agent_cache"; - }; - - log_config : - { - global_log_level ="trace"; - global_log_verbosity ="medium"; - hw_log_level ="info"; - hw_log_verbosity ="medium"; - phy_log_level ="trace"; - phy_log_verbosity ="medium"; - mac_log_level ="trace"; - mac_log_verbosity ="medium"; - rlc_log_level ="trace"; - rlc_log_verbosity ="medium"; - pdcp_log_level ="trace"; - pdcp_log_verbosity ="medium"; - rrc_log_level ="trace"; - rrc_log_verbosity ="medium"; - gtpu_log_level ="debug"; - gtpu_log_verbosity ="medium"; - udp_log_level ="debug"; - udp_log_verbosity ="medium"; - osa_log_level ="debug"; - osa_log_verbosity ="low"; - }; - - } -); diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.agent.usrpb210.epc.remote.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.agent.usrpb210.epc.remote.conf deleted file mode 100644 index 939832af45..0000000000 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.agent.usrpb210.epc.remote.conf +++ /dev/null @@ -1,174 +0,0 @@ -Active_eNBs = ( "eNB_Eurecom_LTEBox"); -# Asn1_verbosity, choice in: none, info, annoying -Asn1_verbosity = "none"; - -eNBs = -( - { - ////////// Identification parameters: - eNB_ID = 0xe00; - - cell_type = "CELL_MACRO_ENB"; - - eNB_name = "eNB_Eurecom_LTEBox"; - - // Tracking area code, 0x0000 and 0xfffe are reserved values - tracking_area_code = "10"; - - mobile_country_code = "208"; - mobile_network_code = "95"; - - ////////// Physical parameters: - - component_carriers = ( - { - frame_type = "FDD"; - tdd_config = 3; - tdd_config_s = 0; - prefix_type = "NORMAL"; - eutra_band = 7; - downlink_frequency = 2660000000L; - uplink_frequency_offset = -120000000; - Nid_cell = 0; - N_RB_DL = 50; - Nid_cell_mbsfn = 0; - nb_antennas_tx = 1; - nb_antennas_rx = 1; - tx_gain = 90; - rx_gain = 125; - prach_root = 0; - prach_config_index = 0; - prach_high_speed = "DISABLE"; - prach_zero_correlation = 1; - prach_freq_offset = 2; - pucch_delta_shift = 1; - pucch_nRB_CQI = 1; - pucch_nCS_AN = 0; - pucch_n1_AN = 32; - pdsch_referenceSignalPower = -26; - pdsch_p_b = 0; - pusch_n_SB = 1; - pusch_enable64QAM = "DISABLE"; - pusch_hoppingMode = "interSubFrame"; - pusch_hoppingOffset = 0; - pusch_groupHoppingEnabled = "ENABLE"; - pusch_groupAssignment = 0; - pusch_sequenceHoppingEnabled = "DISABLE"; - pusch_nDMRS1 = 1; - phich_duration = "NORMAL"; - phich_resource = "ONESIXTH"; - srs_enable = "DISABLE"; - /* srs_BandwidthConfig =; - srs_SubframeConfig =; - srs_ackNackST =; - srs_MaxUpPts =;*/ - - pusch_p0_Nominal = -90; - pusch_alpha = "AL1"; - pucch_p0_Nominal = -108; - msg3_delta_Preamble = 6; - pucch_deltaF_Format1 = "deltaF2"; - pucch_deltaF_Format1b = "deltaF3"; - pucch_deltaF_Format2 = "deltaF0"; - pucch_deltaF_Format2a = "deltaF0"; - pucch_deltaF_Format2b = "deltaF0"; - - rach_numberOfRA_Preambles = 64; - rach_preamblesGroupAConfig = "DISABLE"; - /* - rach_sizeOfRA_PreamblesGroupA = ; - rach_messageSizeGroupA = ; - rach_messagePowerOffsetGroupB = ; - */ - rach_powerRampingStep = 4; - rach_preambleInitialReceivedTargetPower = -108; - rach_preambleTransMax = 10; - rach_raResponseWindowSize = 10; - rach_macContentionResolutionTimer = 48; - rach_maxHARQ_Msg3Tx = 4; - - pcch_default_PagingCycle = 128; - pcch_nB = "oneT"; - bcch_modificationPeriodCoeff = 2; - ue_TimersAndConstants_t300 = 1000; - ue_TimersAndConstants_t301 = 1000; - ue_TimersAndConstants_t310 = 1000; - ue_TimersAndConstants_t311 = 10000; - ue_TimersAndConstants_n310 = 20; - ue_TimersAndConstants_n311 = 1; - } - ); - - srb1_parameters : - { - # timer_poll_retransmit = (ms) [5, 10, 15, 20,... 250, 300, 350, ... 500] - timer_poll_retransmit = 80; - - # timer_reordering = (ms) [0,5, ... 100, 110, 120, ... ,200] - timer_reordering = 35; - - # timer_reordering = (ms) [0,5, ... 250, 300, 350, ... ,500] - timer_status_prohibit = 0; - - # poll_pdu = [4, 8, 16, 32 , 64, 128, 256, infinity(>10000)] - poll_pdu = 4; - - # poll_byte = (kB) [25,50,75,100,125,250,375,500,750,1000,1250,1500,2000,3000,infinity(>10000)] - poll_byte = 99999; - - # max_retx_threshold = [1, 2, 3, 4 , 6, 8, 16, 32] - max_retx_threshold = 4; - } - - # ------- SCTP definitions - SCTP : - { - # Number of streams to use in input/output - SCTP_INSTREAMS = 2; - SCTP_OUTSTREAMS = 2; - }; - - ////////// MME parameters: - mme_ip_address = ( {ipv4 = "192.168.100.102"; - ipv6="192:168:30::17"; - active="yes"; - preference="ipv4";}); - - NETWORK_INTERFACES : - { - ENB_INTERFACE_NAME_FOR_S1_MME = "eth2:1"; - ENB_IPV4_ADDRESS_FOR_S1_MME = "192.168.100.103/24"; - - ENB_INTERFACE_NAME_FOR_S1U = "eth2:1"; - ENB_IPV4_ADDRESS_FOR_S1U = "192.168.100.103/24"; - ENB_PORT_FOR_S1U = 2152; # Spec 2152 - }; - - NETWORK_CONTROLLER : - { - ENB_AGENT_INTERFACE_NAME = "eth0"; - ENB_AGENT_IPV4_ADDRESS = "10.0.0.5/30"; - ENB_AGENT_PORT = 2210; - ENB_AGENT_CACHE = "/mnt/oai_agent_cache"; - }; - - log_config : - { - global_log_level ="info"; - global_log_verbosity ="medium"; - hw_log_level ="info"; - hw_log_verbosity ="medium"; - phy_log_level ="info"; - phy_log_verbosity ="medium"; - mac_log_level ="debug"; - mac_log_verbosity ="high"; - rlc_log_level ="info"; - rlc_log_verbosity ="medium"; - pdcp_log_level ="info"; - pdcp_log_verbosity ="medium"; - rrc_log_level ="info"; - rrc_log_verbosity ="medium"; - }; - - } -); From ea4f2948fd87cfe61477b3637e83c5069fd931de Mon Sep 17 00:00:00 2001 From: GabrirelCouturier Date: Wed, 9 Nov 2016 16:58:11 +0100 Subject: [PATCH 268/349] [OAI-UE] fix for issue#19: DCI0 detction with wrong RIV --- openair1/PHY/LTE_TRANSPORT/dci_tools.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/openair1/PHY/LTE_TRANSPORT/dci_tools.c b/openair1/PHY/LTE_TRANSPORT/dci_tools.c index 3624d67af1..fc307655dd 100644 --- a/openair1/PHY/LTE_TRANSPORT/dci_tools.c +++ b/openair1/PHY/LTE_TRANSPORT/dci_tools.c @@ -6384,8 +6384,10 @@ int generate_ue_ulsch_params_from_dci(void *dci_pdu, if (rballoc > RIV_max) { - LOG_E(PHY,"frame %d, subframe %d, rnti %x, format %d: FATAL ERROR: generate_ue_ulsch_params_from_dci, rb_alloc > RIV_max\n", - proc->frame_rx, subframe, rnti, dci_format); + LOG_E(PHY,"frame %d, subframe %d, rnti %x, format %d: FATAL ERROR: generate_ue_ulsch_params_from_dci, rb_alloc[%d] > RIV_max[%d]\n", + proc->frame_rx, subframe, rnti, dci_format,rballoc,RIV_max); + LOG_E(PHY,"Wrong DCI0 detection, do not transmit PUSCH for HARQID: %d\n",harq_pid); + ulsch->harq_processes[harq_pid]->subframe_scheduling_flag = 0; return(-1); } From 09f149d86b44ffccf956879ed2988446339ae572 Mon Sep 17 00:00:00 2001 From: calvin wang Date: Fri, 11 Nov 2016 18:01:39 +0800 Subject: [PATCH 269/349] Stabilization UE BSR feature --- openair2/LAYER2/MAC/config.c | 34 ++- openair2/LAYER2/MAC/defs.h | 27 ++- openair2/LAYER2/MAC/extern.h | 2 + openair2/LAYER2/MAC/proto.h | 4 +- openair2/LAYER2/MAC/ra_procedures.c | 2 +- openair2/LAYER2/MAC/ue_procedures.c | 341 +++++++++++++++++++++------- openair2/LAYER2/MAC/vars.h | 9 + 7 files changed, 329 insertions(+), 90 deletions(-) diff --git a/openair2/LAYER2/MAC/config.c b/openair2/LAYER2/MAC/config.c index 3fbcadafbb..2a6390740c 100644 --- a/openair2/LAYER2/MAC/config.c +++ b/openair2/LAYER2/MAC/config.c @@ -69,7 +69,10 @@ void ue_mac_reset(module_id_t module_idP,uint8_t eNB_index) // cancel all pending SRs UE_mac_inst[module_idP].scheduling_info.SR_pending=0; UE_mac_inst[module_idP].scheduling_info.SR_COUNTER=0; - + UE_mac_inst[module_idP].BSR_reporting_active[REGULAR_BSR]=0; + UE_mac_inst[module_idP].BSR_reporting_active[PADDING_BSR]=0; + UE_mac_inst[module_idP].BSR_reporting_active[PERIODIC_BSR]=0; + UE_mac_inst[module_idP].retxBSRTimer_expires_flag = 0; // stop ongoing RACH procedure // discard explicitly signaled ra_PreambleIndex and ra_RACH_MaskIndex, if any @@ -228,10 +231,34 @@ rrc_mac_config_req( UE_mac_inst[Mod_idP].scheduling_info.sr_ProhibitTimer = (uint16_t) 0; } + if (mac_MainConfig->ext2 && mac_MainConfig->ext2->mac_MainConfig_v1020) { + if (mac_MainConfig->ext2->mac_MainConfig_v1020->extendedBSR_Sizes_r10) { + UE_mac_inst[Mod_idP].scheduling_info.extendedBSR_Sizes_r10 = (uint16_t) *mac_MainConfig->ext2->mac_MainConfig_v1020->extendedBSR_Sizes_r10; + } else { + UE_mac_inst[Mod_idP].scheduling_info.extendedBSR_Sizes_r10 = (uint16_t)0; + } + if (mac_MainConfig->ext2->mac_MainConfig_v1020->extendedPHR_r10) { + UE_mac_inst[Mod_idP].scheduling_info.extendedPHR_r10 = (uint16_t) *mac_MainConfig->ext2->mac_MainConfig_v1020->extendedPHR_r10; + } else { + UE_mac_inst[Mod_idP].scheduling_info.extendedPHR_r10 = (uint16_t)0; + } + } else { + UE_mac_inst[Mod_idP].scheduling_info.extendedBSR_Sizes_r10 = (uint16_t)0; + UE_mac_inst[Mod_idP].scheduling_info.extendedPHR_r10 = (uint16_t)0; + } #endif - UE_mac_inst[Mod_idP].scheduling_info.periodicBSR_SF = get_sf_periodicBSRTimer(UE_mac_inst[Mod_idP].scheduling_info.periodicBSR_Timer); - UE_mac_inst[Mod_idP].scheduling_info.retxBSR_SF = get_sf_retxBSRTimer(UE_mac_inst[Mod_idP].scheduling_info.retxBSR_Timer); + UE_mac_inst[Mod_idP].scheduling_info.periodicBSR_SF = 0xFFFF; + UE_mac_inst[Mod_idP].scheduling_info.retxBSR_SF = 0xFFFF; + UE_mac_inst[Mod_idP].BSR_reporting_active[REGULAR_BSR]=0; + UE_mac_inst[Mod_idP].BSR_reporting_active[PADDING_BSR]=0; + UE_mac_inst[Mod_idP].BSR_reporting_active[PERIODIC_BSR]=0; + UE_mac_inst[Mod_idP].retxBSRTimer_expires_flag = 0; + LOG_D(MAC,"[UE %d]: periodic BSR %d (SF), retx BSR %d (SF)\n", + Mod_idP, + UE_mac_inst[Mod_idP].scheduling_info.periodicBSR_SF, + UE_mac_inst[Mod_idP].scheduling_info.retxBSR_SF); + UE_mac_inst[Mod_idP].scheduling_info.drx_config = mac_MainConfig->drx_Config; UE_mac_inst[Mod_idP].scheduling_info.phr_config = mac_MainConfig->phr_Config; @@ -252,6 +279,7 @@ rrc_mac_config_req( UE_mac_inst[Mod_idP].scheduling_info.periodicPHR_SF = get_sf_perioidicPHR_Timer(UE_mac_inst[Mod_idP].scheduling_info.periodicPHR_Timer); UE_mac_inst[Mod_idP].scheduling_info.prohibitPHR_SF = get_sf_prohibitPHR_Timer(UE_mac_inst[Mod_idP].scheduling_info.prohibitPHR_Timer); UE_mac_inst[Mod_idP].scheduling_info.PathlossChange_db = get_db_dl_PathlossChange(UE_mac_inst[Mod_idP].scheduling_info.PathlossChange); + UE_mac_inst[Mod_idP].PHR_reporting_active = 0; LOG_D(MAC,"[UE %d] config PHR (%d): periodic %d (SF) prohibit %d (SF) pathlosschange %d (db) \n", Mod_idP, (mac_MainConfig->phr_Config)?mac_MainConfig->phr_Config->present:-1, diff --git a/openair2/LAYER2/MAC/defs.h b/openair2/LAYER2/MAC/defs.h index 2235c3e1c4..bfaaa3ca1d 100644 --- a/openair2/LAYER2/MAC/defs.h +++ b/openair2/LAYER2/MAC/defs.h @@ -336,6 +336,14 @@ typedef struct { #define SHORT_BSR 29 /*!\brief LCID of long BSR for ULSCH */ #define LONG_BSR 30 +/*!\brief first level bsr type for ULSCH: Regular BSR,Padding BSR,Periodic BSR*/ +#define BSR_TYPE_FIRST_LEVEL 3 +/*!\brief first level bsr type states*/ +typedef enum { + REGULAR_BSR =0, + PADDING_BSR, + PERIODIC_BSR +} UE_FIRST_LEVEL_BSR_TYPE; /*! \brief Downlink SCH PDU Structure */ typedef struct { @@ -945,8 +953,10 @@ typedef enum { typedef struct { /// buffer status for each lcgid uint8_t BSR[MAX_NUM_LCGID]; // should be more for mesh topology - /// keep the number of bytes in rlc buffer for each lcid + /// keep the number of bytes in rlc buffer for each lcgid uint16_t BSR_bytes[MAX_NUM_LCGID]; + /// after multiplexing buffer remain for each lcid + uint16_t LCID_buffer_remain[MAX_NUM_LCID]; /// buffer status for each lcid uint8_t LCID_status[MAX_NUM_LCID]; /// SR pending as defined in 36.321 @@ -958,11 +968,11 @@ typedef struct { /// retxBSR-Timer, default value is sf2560 uint16_t retxBSR_Timer; /// retxBSR_SF, number of subframe before triggering a regular BSR - int16_t retxBSR_SF; + int16_t retxBSR_SF; // if value equal oxFFFF means counters are NOT active /// periodicBSR-Timer, default to infinity uint16_t periodicBSR_Timer; /// periodicBSR_SF, number of subframe before triggering a periodic BSR - int16_t periodicBSR_SF; + int16_t periodicBSR_SF; // if value equal oxFFFF means counters are NOT active /// default value is 0: not configured uint16_t sr_ProhibitTimer; /// sr ProhibitTime running @@ -987,6 +997,12 @@ typedef struct { int16_t prohibitPHR_SF; ///DL Pathloss Change in db uint16_t PathlossChange_db; + + /// default value is false + uint16_t extendedBSR_Sizes_r10; + /// default value is false + uint16_t extendedPHR_r10; + //Bj bucket usage per lcid int16_t Bj[MAX_NUM_LCID]; // Bucket size per lcid @@ -1074,6 +1090,11 @@ typedef struct { uint8_t PHR_reporting_active; /// power backoff due to power management (as allowed by P-MPRc) for this cell uint8_t power_backoff_db[NUMBER_OF_eNB_MAX]; + /// BSR report falg management + uint8_t BSR_reporting_active[BSR_TYPE_FIRST_LEVEL]; + /// retxBSR-Timer expires flag + uint8_t retxBSRTimer_expires_flag; + /// MBSFN_Subframe Configuration struct MBSFN_SubframeConfig *mbsfn_SubframeConfig[8]; // FIXME replace 8 by MAX_MBSFN_AREA? /// number of subframe allocation pattern available for MBSFN sync area diff --git a/openair2/LAYER2/MAC/extern.h b/openair2/LAYER2/MAC/extern.h index 8726cb1349..4276c342cf 100644 --- a/openair2/LAYER2/MAC/extern.h +++ b/openair2/LAYER2/MAC/extern.h @@ -46,6 +46,8 @@ extern const uint32_t BSR_TABLE[BSR_TABLE_SIZE]; //extern uint32_t EBSR_Level[63]; +extern const uint32_t Extended_BSR_TABLE[BSR_TABLE_SIZE]; +//extern uint32_t Extended_BSR_TABLE[63]; ----currently not used extern UE_MAC_INST *UE_mac_inst; extern eNB_MAC_INST *eNB_mac_inst; diff --git a/openair2/LAYER2/MAC/proto.h b/openair2/LAYER2/MAC/proto.h index 59d6c352fe..94f1d3448c 100644 --- a/openair2/LAYER2/MAC/proto.h +++ b/openair2/LAYER2/MAC/proto.h @@ -545,13 +545,13 @@ int cba_access(module_id_t module_idP,frame_t frameP,sub_frame_t subframe, uint8 */ int get_bsr_lcgid (module_id_t module_idP); -/*! \fn uint8_t get_bsr_len (module_id_t module_idP,uint16_t bufflen); +/*! \fn int get_bsr_type (module_id_t module_idP,uint16_t bufflen); \brief determine whether the bsr is short or long assuming that the MAC pdu is built \param[in] Mod_id instance of the UE \param[in] bufflen size of phy transport block \param[out] bsr_len size of bsr control element */ -uint8_t get_bsr_len (module_id_t module_idP, uint16_t buflen); +int get_bsr_type (module_id_t module_idP, uint8_t eNB_index,frame_t frameP,uint16_t buflen); /*! \fn BSR_SHORT * get_bsr_short(module_id_t module_idP, uint8_t bsr_len) \brief get short bsr level diff --git a/openair2/LAYER2/MAC/ra_procedures.c b/openair2/LAYER2/MAC/ra_procedures.c index 30137fab33..3b5734756d 100644 --- a/openair2/LAYER2/MAC/ra_procedures.c +++ b/openair2/LAYER2/MAC/ra_procedures.c @@ -391,7 +391,7 @@ PRACH_RESOURCES_t *ue_get_rach(module_id_t module_idP,int CC_id,frame_t frameP, 1); //post_padding return(&UE_mac_inst[module_idP].RA_prach_resources); - } else if (UE_mac_inst[module_idP].scheduling_info.BSR_bytes[DCCH] > 0) { + } else if (UE_mac_inst[module_idP].scheduling_info.BSR_bytes[UE_mac_inst[module_idP].scheduling_info.LCGID[DCCH]] > 0) { // This is for triggering a transmission on DCCH using PRACH (during handover, or sending SR for example) dcch_header_len = 2 + 2; /// SHORT Subheader + C-RNTI control element rlc_status = mac_rlc_status_ind(module_idP,UE_mac_inst[module_idP].crnti, eNB_indexP,frameP,ENB_FLAG_NO,MBMS_FLAG_NO, diff --git a/openair2/LAYER2/MAC/ue_procedures.c b/openair2/LAYER2/MAC/ue_procedures.c index d5958f6e5e..56d4524d7d 100644 --- a/openair2/LAYER2/MAC/ue_procedures.c +++ b/openair2/LAYER2/MAC/ue_procedures.c @@ -102,13 +102,22 @@ void ue_init_mac(module_id_t module_idP) UE_mac_inst[module_idP].scheduling_info.sr_ProhibitTimer_Running=0; UE_mac_inst[module_idP].scheduling_info.maxHARQ_Tx=MAC_MainConfig__ul_SCH_Config__maxHARQ_Tx_n5; UE_mac_inst[module_idP].scheduling_info.ttiBundling=0; + UE_mac_inst[module_idP].scheduling_info.extendedBSR_Sizes_r10=0; + UE_mac_inst[module_idP].scheduling_info.extendedPHR_r10=0; UE_mac_inst[module_idP].scheduling_info.drx_config=NULL; UE_mac_inst[module_idP].scheduling_info.phr_config=NULL; - UE_mac_inst[module_idP].scheduling_info.periodicBSR_SF = get_sf_periodicBSRTimer(UE_mac_inst[module_idP].scheduling_info.periodicBSR_Timer); - UE_mac_inst[module_idP].scheduling_info.retxBSR_SF = get_sf_retxBSRTimer(UE_mac_inst[module_idP].scheduling_info.retxBSR_Timer); + // set init value 0xFFFF, make sure periodic timer and retx time counters are NOT active, after bsr transmission set the value configured by the NW. + UE_mac_inst[module_idP].scheduling_info.periodicBSR_SF = 0xFFFF; + UE_mac_inst[module_idP].scheduling_info.retxBSR_SF = 0xFFFF; + + UE_mac_inst[module_idP].BSR_reporting_active[REGULAR_BSR]=0; + UE_mac_inst[module_idP].BSR_reporting_active[PADDING_BSR]=0; + UE_mac_inst[module_idP].BSR_reporting_active[PERIODIC_BSR]=0; + UE_mac_inst[module_idP].retxBSRTimer_expires_flag = 0; UE_mac_inst[module_idP].scheduling_info.periodicPHR_SF = get_sf_perioidicPHR_Timer(UE_mac_inst[module_idP].scheduling_info.periodicPHR_Timer); UE_mac_inst[module_idP].scheduling_info.prohibitPHR_SF = get_sf_prohibitPHR_Timer(UE_mac_inst[module_idP].scheduling_info.prohibitPHR_Timer); UE_mac_inst[module_idP].scheduling_info.PathlossChange_db = get_db_dl_PathlossChange(UE_mac_inst[module_idP].scheduling_info.PathlossChange); + UE_mac_inst[module_idP].PHR_reporting_active = 0; for (i=0; i < MAX_NUM_LCID; i++) { LOG_D(MAC,"[UE%d] Applying default logical channel config for LCGID %d\n",module_idP,i); @@ -121,7 +130,7 @@ void ue_init_mac(module_id_t module_idP) UE_mac_inst[module_idP].scheduling_info.LCGID[i]=1; } - UE_mac_inst[module_idP].scheduling_info.LCID_status[i]=0; + UE_mac_inst[module_idP].scheduling_info.LCID_status[i]=LCID_EMPTY; } #ifdef CBA @@ -306,6 +315,14 @@ uint32_t ue_get_SR(module_id_t module_idP,int CC_id,frame_t frameP,uint8_t eNB_i // initiate RA UE_mac_inst[module_idP].scheduling_info.SR_pending=0; UE_mac_inst[module_idP].scheduling_info.SR_COUNTER=0; + // release all pucch resource + UE_mac_inst[module_idP].physicalConfigDedicated = NULL; + UE_mac_inst[module_idP].ul_active=0; + UE_mac_inst[module_idP].BSR_reporting_active[REGULAR_BSR]=0; + UE_mac_inst[module_idP].BSR_reporting_active[PADDING_BSR]=0; + UE_mac_inst[module_idP].BSR_reporting_active[PERIODIC_BSR]=0; + UE_mac_inst[module_idP].retxBSRTimer_expires_flag = 0; + LOG_T(MAC,"[UE %d] Release all SRs \n", module_idP); return(0); } } @@ -1230,7 +1247,7 @@ void ue_get_sdu(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_t subf mac_rlc_status_resp_t rlc_status; uint8_t dcch_header_len=0,dcch1_header_len=0,dtch_header_len=0,dtch_header_len_last=0; uint8_t dcch_header_len_tmp=0, dtch_header_len_tmp=0; - uint8_t bsr_header_len=0, bsr_ce_len=0, bsr_len=0; + uint8_t bsr_len=0; uint8_t phr_header_len=0, phr_ce_len=0,phr_len=0; uint8_t lcid=0; uint16_t sdu_lengths[8] = { 0, 0, 0, 0, 0, 0, 0, 0 }; @@ -1238,17 +1255,20 @@ void ue_get_sdu(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_t subf uint8_t payload_offset=0,num_sdus=0; uint8_t ulsch_buff[MAX_ULSCH_PAYLOAD_BYTES]; uint16_t sdu_length_total=0; - BSR_SHORT bsr_short; + BSR_SHORT bsr_short,bsr_truncated; BSR_LONG bsr_long; BSR_SHORT *bsr_s=&bsr_short; BSR_LONG *bsr_l=&bsr_long; + BSR_SHORT *bsr_t=&bsr_truncated; POWER_HEADROOM_CMD phr; POWER_HEADROOM_CMD *phr_p=&phr; - unsigned short short_padding=0, post_padding=0; + unsigned short short_padding=0, post_padding=0, padding_len=0; int lcgid; int j; // used for padding // Compute header length - + int all_pdu_len; + int bsr_type=0; + if (CC_id>0) { LOG_E(MAC,"Transmission on secondary CCs is not supported yet\n"); mac_xface->macphy_exit("MAC FATAL CC_id>0"); @@ -1280,10 +1300,9 @@ void ue_get_sdu(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_t subf dcch1_header_len=2;//sizeof(SCH_SUBHEADER_SHORT); // hypo length,in case of long header skip the padding byte dtch_header_len=(buflen > 128 ) ? 3 : 2 ; //sizeof(SCH_SUBHEADER_LONG)-1 : sizeof(SCH_SUBHEADER_SHORT); - bsr_header_len = 1;//sizeof(SCH_SUBHEADER_FIXED); phr_header_len = 1;//sizeof(SCH_SUBHEADER_FIXED); - phr_ce_len = (UE_mac_inst[module_idP].PHR_reporting_active == 1) ? 1 /* sizeof(POWER_HEADROOM_CMD)*/: 0; + phr_ce_len = (UE_mac_inst[module_idP].PHR_reporting_active == 1) ? 1 /* sizeof(POWER_HEADROOM_CMD)*/: 0; if (phr_ce_len > 0) { phr_len = phr_ce_len + phr_header_len; LOG_D(MAC,"[UE %d] header size info: PHR len %d (ce%d,hdr%d) buff_len %d\n", @@ -1292,19 +1311,21 @@ void ue_get_sdu(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_t subf phr_len=0; } - bsr_ce_len = get_bsr_len (module_idP, buflen-phr_len); - - if (bsr_ce_len > 0 ) { - bsr_len = bsr_ce_len + bsr_header_len; - LOG_D(MAC,"[UE %d] header size info: dcch %d, dcch1 %d, dtch %d, bsr (ce%d,hdr%d) buff_len %d\n", - module_idP, dcch_header_len,dcch1_header_len,dtch_header_len, bsr_ce_len, bsr_header_len, buflen); + bsr_type = get_bsr_type(module_idP, eNB_index, frameP, buflen-phr_len); + if (bsr_type == LONG_BSR) { + bsr_len = sizeof(SCH_SUBHEADER_FIXED)+sizeof(BSR_LONG);; + LOG_D(MAC,"[UE %d] header size info: dcch %d, dcch1 %d, dtch %d, bsr (bsr_type%d) buff_len %d\n", + module_idP, dcch_header_len,dcch1_header_len,dtch_header_len, bsr_type, buflen); + } else if ((bsr_type == SHORT_BSR) || (bsr_type == TRUNCATED_BSR)) { + bsr_len = sizeof(SCH_SUBHEADER_FIXED)+sizeof(BSR_SHORT);; + LOG_D(MAC,"[UE %d] header size info: dcch %d, dcch1 %d, dtch %d, bsr (bsr_type%d) buff_len %d\n", + module_idP, dcch_header_len,dcch1_header_len,dtch_header_len, bsr_type, buflen); } else { bsr_len=0; //LOG_D(MAC,"[UE %d] Empty buffers, send a long BSR to reset the bsr at eNB \n ",Mod_id); // bsr_ce_len = sizeof(BSR_LONG); //bsr_len = bsr_ce_len + bsr_header_len; } - // check for UL bandwidth requests and add SR control element // check for UL bandwidth requests and add SR control element @@ -1338,8 +1359,14 @@ void ue_get_sdu(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_t subf sdu_lcids[0] = DCCH; LOG_D(MAC,"[UE %d] TX Got %d bytes for DCCH\n",module_idP,sdu_lengths[0]); num_sdus = 1; - update_bsr(module_idP, frameP, eNB_index, DCCH, UE_mac_inst[module_idP].scheduling_info.LCGID[DCCH]); + //update_bsr(module_idP, frameP, eNB_index, DCCH, UE_mac_inst[module_idP].scheduling_info.LCGID[DCCH]); //header_len +=2; + UE_mac_inst[module_idP].scheduling_info.LCID_status[DCCH] = LCID_EMPTY; + if (rlc_status.bytes_in_buffer > sdu_lengths[0]) { + UE_mac_inst[module_idP].scheduling_info.LCID_buffer_remain[DCCH] = rlc_status.bytes_in_buffer-sdu_lengths[0]; + } else { + UE_mac_inst[module_idP].scheduling_info.LCID_buffer_remain[DCCH] = 0; + } } else { dcch_header_len=0; num_sdus = 0; @@ -1375,9 +1402,16 @@ void ue_get_sdu(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_t subf sdu_length_total += sdu_lengths[num_sdus]; sdu_lcids[num_sdus] = DCCH1; LOG_D(MAC,"[UE %d] TX Got %d bytes for DCCH1\n",module_idP,sdu_lengths[num_sdus]); - num_sdus++; //update_bsr(module_idP, frameP, DCCH1); //dcch_header_len +=2; // include dcch1 + UE_mac_inst[module_idP].scheduling_info.LCID_status[DCCH1] = LCID_EMPTY; + if (rlc_status.bytes_in_buffer > sdu_lengths[num_sdus]) { + UE_mac_inst[module_idP].scheduling_info.LCID_buffer_remain[DCCH1] = rlc_status.bytes_in_buffer-sdu_lengths[num_sdus]; + } else { + UE_mac_inst[module_idP].scheduling_info.LCID_buffer_remain[DCCH1] = 0; + } + + num_sdus++; } else { dcch1_header_len =0; } @@ -1388,8 +1422,9 @@ void ue_get_sdu(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_t subf dtch_header_len+=3; dtch_header_len_last=3; + all_pdu_len = bsr_len+phr_len+dcch_header_len+dcch1_header_len+dtch_header_len+sdu_length_total; if ((UE_mac_inst[module_idP].scheduling_info.LCID_status[lcid] == LCID_NOT_EMPTY) && - ((bsr_len+phr_len+dcch_header_len+dcch1_header_len+dtch_header_len+sdu_length_total) <= buflen)) { + (all_pdu_len <= buflen)) { // optimize the dtch header lenght //if ((UE_mac_inst[module_idP].scheduling_info.BSR_bytes[DTCH] > 128) && @@ -1407,65 +1442,99 @@ void ue_get_sdu(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_t subf ENB_FLAG_NO, MBMS_FLAG_NO, // eNB_index lcid, - buflen-bsr_len-phr_len-dcch_header_len-dcch1_header_len-dtch_header_len-sdu_length_total); + buflen-all_pdu_len); LOG_D(MAC,"[UE %d] Frame %d : UL-DTCH -> ULSCH%d, %d bytes to send (Transport Block size %d, mac header len %d, BSR byte[%d] %d)\n", module_idP,frameP, lcid, rlc_status.bytes_in_buffer,buflen,dtch_header_len, - lcid, UE_mac_inst[module_idP].scheduling_info.BSR_bytes[lcid]); + lcid, UE_mac_inst[module_idP].scheduling_info.BSR_bytes[UE_mac_inst[module_idP].scheduling_info.LCGID[lcid]]); if (rlc_status.bytes_in_buffer > 0) { - sdu_lengths[num_sdus] = mac_rlc_data_req(module_idP, - UE_mac_inst[module_idP].crnti, - eNB_index, - frameP, - ENB_FLAG_NO, - MBMS_FLAG_NO, // eNB_index - lcid, - (char *)&ulsch_buff[sdu_length_total]); - - //adjust dtch header - LOG_D(MAC,"[UE %d] TX Got %d bytes for DTCH\n",module_idP,sdu_lengths[num_sdus]); - sdu_lcids[num_sdus] = lcid; - sdu_length_total += sdu_lengths[num_sdus]; - if (sdu_lengths[num_sdus] < 128) { - dtch_header_len --; - dtch_header_len_last --; - } - num_sdus++; - UE_mac_inst[module_idP].ul_active = update_bsr(module_idP, frameP, eNB_index,lcid, UE_mac_inst[module_idP].scheduling_info.LCGID[lcid]); + sdu_lengths[num_sdus] = mac_rlc_data_req(module_idP, + UE_mac_inst[module_idP].crnti, + eNB_index, + frameP, + ENB_FLAG_NO, + MBMS_FLAG_NO, // eNB_index + lcid, + (char *)&ulsch_buff[sdu_length_total]); + + //adjust dtch header + LOG_D(MAC,"[UE %d] TX Got %d bytes for DTCH\n",module_idP,sdu_lengths[num_sdus]); + sdu_lcids[num_sdus] = lcid; + sdu_length_total += sdu_lengths[num_sdus]; + if (sdu_lengths[num_sdus] < 128) { + dtch_header_len --; + dtch_header_len_last --; + } + if (rlc_status.bytes_in_buffer > sdu_lengths[num_sdus]) { + UE_mac_inst[module_idP].scheduling_info.LCID_buffer_remain[lcid] = rlc_status.bytes_in_buffer-sdu_lengths[num_sdus]; + } else { + UE_mac_inst[module_idP].scheduling_info.LCID_buffer_remain[lcid] = 0; + } + + //UE_mac_inst[module_idP].ul_active = update_bsr(module_idP, frameP, eNB_index,lcid, UE_mac_inst[module_idP].scheduling_info.LCGID[lcid]); + num_sdus++; } else { - dtch_header_len -= 3; + dtch_header_len -= 3; } + UE_mac_inst[module_idP].scheduling_info.LCID_status[lcid] = LCID_EMPTY; } else { // no rlc pdu : generate the dummy header dtch_header_len -= 3; } } - + lcgid= get_bsr_lcgid(module_idP); if (lcgid < 0 ) { bsr_s = NULL; - bsr_l = NULL ; - } else if ((lcgid ==MAX_NUM_LCGID) && (bsr_ce_len == sizeof(BSR_LONG))) { + bsr_l = NULL; + bsr_t = NULL; + } else if ((lcgid ==MAX_NUM_LCGID) && (bsr_type == LONG_BSR)) { bsr_s = NULL; + bsr_t = NULL; bsr_l->Buffer_size0 = UE_mac_inst[module_idP].scheduling_info.BSR[LCGID0]; bsr_l->Buffer_size1 = UE_mac_inst[module_idP].scheduling_info.BSR[LCGID1]; bsr_l->Buffer_size2 = UE_mac_inst[module_idP].scheduling_info.BSR[LCGID2]; bsr_l->Buffer_size3 = UE_mac_inst[module_idP].scheduling_info.BSR[LCGID3]; + LOG_D(MAC, "[UE %d] Frame %d report long BSR (level LCGID0 %d,level LCGID1 %d,level LCGID2 %d,level LCGID3 %d)\n", module_idP,frameP, UE_mac_inst[module_idP].scheduling_info.BSR[LCGID0], UE_mac_inst[module_idP].scheduling_info.BSR[LCGID1], UE_mac_inst[module_idP].scheduling_info.BSR[LCGID2], UE_mac_inst[module_idP].scheduling_info.BSR[LCGID3]); - } else if (bsr_ce_len == sizeof(BSR_SHORT)) { + + UE_mac_inst[module_idP].scheduling_info.BSR_bytes[LCGID0] = 0; + UE_mac_inst[module_idP].scheduling_info.BSR_bytes[LCGID1] = 0; + UE_mac_inst[module_idP].scheduling_info.BSR_bytes[LCGID2] = 0; + UE_mac_inst[module_idP].scheduling_info.BSR_bytes[LCGID3] = 0; + UE_mac_inst[module_idP].scheduling_info.BSR[LCGID0] = 0; + UE_mac_inst[module_idP].scheduling_info.BSR[LCGID1] = 0; + UE_mac_inst[module_idP].scheduling_info.BSR[LCGID2] = 0; + UE_mac_inst[module_idP].scheduling_info.BSR[LCGID3] = 0; + } else if (bsr_type == SHORT_BSR) { bsr_l = NULL; + bsr_t = NULL; bsr_s->LCGID = lcgid; bsr_s->Buffer_size = UE_mac_inst[module_idP].scheduling_info.BSR[lcgid]; + LOG_D(MAC,"[UE %d] Frame %d report SHORT BSR with level %d for LCGID %d\n", module_idP, frameP, UE_mac_inst[module_idP].scheduling_info.BSR[lcgid],lcgid); + UE_mac_inst[module_idP].scheduling_info.BSR_bytes[lcgid] = 0; + UE_mac_inst[module_idP].scheduling_info.BSR[lcgid] = 0; + } else if (bsr_type == TRUNCATED_BSR) { + bsr_l = NULL; + bsr_s = NULL; + bsr_t->LCGID = lcgid; + bsr_t->Buffer_size = UE_mac_inst[module_idP].scheduling_info.BSR[lcgid]; + + LOG_D(MAC,"[UE %d] Frame %d report SHORT BSR with level %d for LCGID %d\n", + module_idP, frameP, UE_mac_inst[module_idP].scheduling_info.BSR[lcgid],lcgid); + UE_mac_inst[module_idP].scheduling_info.BSR_bytes[lcgid] = 0; + UE_mac_inst[module_idP].scheduling_info.BSR[lcgid] = 0; } else { bsr_s = NULL; bsr_l = NULL; + bsr_t = NULL; } // build PHR and update the timers @@ -1494,12 +1563,14 @@ void ue_get_sdu(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_t subf dtch_header_len_last-=1; dtch_header_len= (dtch_header_len >0)? dtch_header_len - dtch_header_len_last : dtch_header_len; } - - if ((buflen-bsr_len-phr_len-dcch_header_len-dcch1_header_len-dtch_header_len-sdu_length_total) <= 2) { - short_padding = buflen-bsr_len-phr_len-dcch_header_len-dcch1_header_len-dtch_header_len-sdu_length_total; + // 1-bit padding or 2-bit padding special padding subheader + padding_len = buflen-bsr_len-phr_len-dcch_header_len-dcch1_header_len-dtch_header_len-sdu_length_total; + if (padding_len <= 2) { + short_padding = padding_len; + // only add padding header post_padding = 0; } else { - if ((buflen-bsr_len-phr_len-dcch_header_len-dcch1_header_len-dtch_header_len-sdu_length_total) == buflen) { + if (padding_len == buflen) {// nona mac pdu *access_mode=CANCELED_ACCESS; } @@ -1524,7 +1595,7 @@ void ue_get_sdu(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_t subf sdu_lcids, // sdu lcid phr_p, // power headroom NULL, // crnti - NULL, // truncated bsr + bsr_t, // truncated bsr bsr_s, // short bsr bsr_l, post_padding); // long_bsr @@ -1544,6 +1615,14 @@ void ue_get_sdu(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_t subf module_idP,payload_offset, sdu_length_total); UE_mac_inst[module_idP].scheduling_info.SR_pending=0; UE_mac_inst[module_idP].scheduling_info.SR_COUNTER=0; + UE_mac_inst[module_idP].BSR_reporting_active[REGULAR_BSR]=0; + UE_mac_inst[module_idP].BSR_reporting_active[PADDING_BSR]=0; + UE_mac_inst[module_idP].BSR_reporting_active[PERIODIC_BSR]=0; + if (bsr_type > 0) { //if bsr trigger, reset two timer + UE_mac_inst[module_idP].scheduling_info.periodicBSR_SF = get_sf_periodicBSRTimer(UE_mac_inst[module_idP].scheduling_info.periodicBSR_Timer); + UE_mac_inst[module_idP].scheduling_info.retxBSR_SF = get_sf_retxBSRTimer(UE_mac_inst[module_idP].scheduling_info.retxBSR_Timer); + UE_mac_inst[module_idP].retxBSRTimer_expires_flag = 0; + } VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_GET_SDU, VCD_FUNCTION_OUT); stop_meas(&UE_mac_inst[module_idP].tx_ulsch_sdu); @@ -1572,7 +1651,7 @@ ue_scheduler( const int CC_id) //------------------------------------------------------------------------------ { - + int periodicBSR_Timer_infinity_value; int lcid; // lcid index int TTI= 1; int bucketsizeduration = -1; @@ -1705,10 +1784,35 @@ ue_scheduler( // call SR procedure to generate pending SR and BSR for next PUCCH/PUSCH TxOp. This should implement the procedures // outlined in Sections 5.4.4 an 5.4.5 of 36.321 - // Put this in another function + // Call BSR procedure as described in Section 5.4.5 in 36.321 + periodicBSR_Timer_infinity_value = get_sf_periodicBSRTimer(MAC_MainConfig__ul_SCH_Config__periodicBSR_Timer_infinity); + if (UE_mac_inst[module_idP].scheduling_info.periodicBSR_SF != (int16_t)periodicBSR_Timer_infinity_value) { + if (UE_mac_inst[module_idP].scheduling_info.periodicBSR_SF <= 0 ) { + /* + periodicBSR-Timer expires, in which case the BSR is referred below to as "Periodic BSR". + */ + UE_mac_inst[module_idP].BSR_reporting_active[PERIODIC_BSR] = 1; + UE_mac_inst[module_idP].scheduling_info.periodicBSR_SF = periodicBSR_Timer_infinity_value; + } else { + UE_mac_inst[module_idP].scheduling_info.periodicBSR_SF--; + } + } + + if (UE_mac_inst[module_idP].scheduling_info.retxBSR_SF != (int16_t)0xFFFF) { + if (UE_mac_inst[module_idP].scheduling_info.retxBSR_SF <= 0){ + /* retxBSR-Timer expires and the UE has data available for transmission for any of the logical channels which belong + to a LCG, in which case the BSR is referred below to as "Regular BSR" + */ + UE_mac_inst[module_idP].retxBSRTimer_expires_flag = 1; + UE_mac_inst[module_idP].scheduling_info.retxBSR_SF = (int16_t)0xFFFF; + + } else { + UE_mac_inst[module_idP].scheduling_info.retxBSR_SF--; + } + } // Get RLC status info and update Bj for all lcids that are active - for (lcid=DCCH; lcid <= DTCH; lcid++ ) { + for (lcid=DCCH; lcid < MAX_NUM_LCID; lcid++ ) { if ((lcid == 0) ||(UE_mac_inst[module_idP].logicalChannelConfig[lcid])) { // meausre the Bj if ((directionP == SF_UL)&& (UE_mac_inst[module_idP].scheduling_info.Bj[lcid] >= 0)) { @@ -1727,6 +1831,12 @@ ue_scheduler( } } + if (lcid == DCCH) { + LOG_D(MAC,"[UE %d][SR] Frame %d subframe %d Pending data for SRB1=%d for LCGID %d \n", + module_idP, frameP,subframeP,UE_mac_inst[module_idP].scheduling_info.BSR[UE_mac_inst[module_idP].scheduling_info.LCGID[lcid]], + UE_mac_inst[module_idP].scheduling_info.LCGID[lcid]); + } + if (update_bsr(module_idP,frameP, eNB_indexP, lcid, UE_mac_inst[module_idP].scheduling_info.LCGID[lcid])) { UE_mac_inst[module_idP].scheduling_info.SR_pending= 1; LOG_D(MAC,"[UE %d][SR] Frame %d subframe %d SR for PUSCH is pending for LCGID %d with BSR level %d (%d bytes in RLC)\n", @@ -1970,41 +2080,108 @@ int get_bsr_lcgid (module_id_t module_idP) } } -uint8_t get_bsr_len (module_id_t module_idP, uint16_t buflen) +int get_bsr_type (module_id_t module_idP, uint8_t eNB_index,frame_t frameP,uint16_t buflen) { - - int lcgid=0; - uint8_t bsr_len=0, num_lcgid=0; + int bsr_type=0; + int lcid,lcgid; int pdu = 0; - - + mac_rlc_status_resp_t rlc_status; + int long_bsr_size=sizeof(SCH_SUBHEADER_FIXED)+sizeof(BSR_LONG); + int short_bsr_size=sizeof(SCH_SUBHEADER_FIXED)+sizeof(BSR_SHORT); + int bsr_group_id[MAX_NUM_LCGID]; + int lcg_report_num=0; + for (lcgid=0; lcgid < MAX_NUM_LCGID; lcgid++ ) { - if (UE_mac_inst[module_idP].scheduling_info.BSR_bytes[lcgid] > 0 ) { - pdu += (UE_mac_inst[module_idP].scheduling_info.BSR_bytes[lcgid] + bsr_len + 2); //2 = sizeof(SCH_SUBHEADER_SHORT) + bsr_group_id[lcgid] = 0; + } + + for (lcid=DCCH; lcid 0 ) { + /* retxBSR-Timer expires and the UE has data available for transmission for any of the logical channels which belong + to a LCG, in which case the BSR is referred below to as "Regular BSR" + */ + if (UE_mac_inst[module_idP].retxBSRTimer_expires_flag == 1) { + UE_mac_inst[module_idP].BSR_reporting_active[REGULAR_BSR] = 1; + } + pdu += rlc_status.bytes_in_buffer + sizeof(SCH_SUBHEADER_SHORT); + if (rlc_status.bytes_in_buffer > 128 ) { + pdu += 1; //sizeof(SCH_SUBHEADER_LONG) + } + /* UL data, for a logical channel which belongs to a LCG, becomes available for transmission in the RLC entity + either the data belongs to a logical channel with higher priority than the priorities of the logical channels + which belong to any LCG and for which data is already available for transmission + */ + if (rlc_status.bytes_in_buffer > UE_mac_inst[module_idP].scheduling_info.LCID_buffer_remain[lcid]) { + bsr_group_id[UE_mac_inst[module_idP].scheduling_info.LCGID[lcid]] ++; + UE_mac_inst[module_idP].BSR_reporting_active[REGULAR_BSR] = 1; + } } - - if (UE_mac_inst[module_idP].scheduling_info.BSR_bytes[lcgid] > 128 ) { // long header size: adjust the header size - pdu += 1; + } + + /* or there is no data available for transmission for any of the logical channels which belong to a LCG, + in which case the BSR is referred below to as "Regular BSR" + if (pdu == 0) { + UE_mac_inst[module_idP].BSR_reporting_active[REGULAR_BSR] = 1; + } + */ + + // computed how many LCG has data available for transmission + for (lcgid=0; lcgid < MAX_NUM_LCGID; lcgid++ ) { + if (bsr_group_id[lcgid] > 0) { + lcg_report_num ++; } - - // current phy buff can not transport all sdu for this lcgid -> transmit a bsr for this lcgid - - if ( (pdu > buflen) && (UE_mac_inst[module_idP].scheduling_info.BSR_bytes[lcgid] > 0 ) ) { - num_lcgid +=1; - bsr_len = (num_lcgid >= 2 ) ? sizeof(BSR_LONG) : sizeof(BSR_SHORT) ; - } - - LOG_D(MAC,"BSR Bytes %d for lcgid %d bsr len %d num lcgid %d\n", UE_mac_inst[module_idP].scheduling_info.BSR_bytes[lcgid], lcgid, bsr_len, num_lcgid); + } + /* + UL resources are allocated and number of padding bits is equal to or larger than the size of the Buffer Status + Report MAC control element plus its subheader, in which case the BSR is referred below to as "Padding BSR" + */ + if ((pdu > 0) && ((pdu+long_bsr_size) <= buflen)) { + UE_mac_inst[module_idP].BSR_reporting_active[PADDING_BSR] = 1; } - if ( bsr_len > 0 ) - LOG_D(MAC,"[UE %d] Prepare a %s (Transport Block Size %d, MAC pdu Size %d) \n", - module_idP, map_int_to_str(BSR_names, bsr_len), buflen, pdu); + /* For Regular and Periodic BSR + - if more than one LCG has data available for transmission in the TTI where the BSR is transmitted: report Long BSR; + - else report Short BSR. + */ + if ((UE_mac_inst[module_idP].BSR_reporting_active[REGULAR_BSR] == 1) + || (UE_mac_inst[module_idP].BSR_reporting_active[PERIODIC_BSR] == 1)) { + if (lcg_report_num > 1) { + bsr_type = LONG_BSR; + } else { + bsr_type = SHORT_BSR; + } + } + /* For Padding BSR: + - if the number of padding bits is equal to or larger than the size of the Short BSR plus its subheader but smaller than the size of the Long BSR plus its subheader: + - if more than one LCG has data available for transmission in the TTI where the BSR is transmitted: report Truncated BSR of the LCG with the highest priority logical channel with data available for transmission; + - else report Short BSR. + - else if the number of padding bits is equal to or larger than the size of the Long BSR plus its subheader, report Long BSR. + */ + if (UE_mac_inst[module_idP].BSR_reporting_active[PADDING_BSR] == 1) { + if (((pdu + short_bsr_size) <= buflen)&&(buflen<(pdu + long_bsr_size))) { + if (lcg_report_num > 1) { + bsr_type = TRUNCATED_BSR; + } else { + bsr_type = SHORT_BSR; + } + } else if ((pdu + long_bsr_size) <= buflen) { + if (lcg_report_num > 1) { + bsr_type = LONG_BSR; + } else { + bsr_type = SHORT_BSR; + } + } + } - return bsr_len; + if ( bsr_type > 0 ) { + LOG_D(MAC, "[UE %d] bsr_type %d (Transport Block Size %d, MAC pdu len %d) lcg_report_num %d\n", + module_idP, bsr_type, buflen, pdu, lcg_report_num); + } + + return bsr_type; } - boolean_t update_bsr(module_id_t module_idP, frame_t frameP, eNB_index_t eNB_index, uint8_t lcid, uint8_t lcg_id) { @@ -2029,10 +2206,12 @@ boolean_t update_bsr(module_id_t module_idP, frame_t frameP, eNB_index_t eNB_in 0); if (rlc_status.bytes_in_buffer > 0 ) { + //BSR trigger SR sr_pending = TRUE; UE_mac_inst[module_idP].scheduling_info.LCID_status[lcid] = LCID_NOT_EMPTY; - UE_mac_inst[module_idP].scheduling_info.BSR[lcg_id] += locate (BSR_TABLE,BSR_TABLE_SIZE, rlc_status.bytes_in_buffer); + // sum lcid buffer which has same lcgid UE_mac_inst[module_idP].scheduling_info.BSR_bytes[lcg_id] += rlc_status.bytes_in_buffer; + UE_mac_inst[module_idP].scheduling_info.BSR[lcg_id] = locate_BsrIndexByBufferSize(BSR_TABLE, BSR_TABLE_SIZE, UE_mac_inst[module_idP].scheduling_info.BSR_bytes[lcg_id]); // UE_mac_inst[module_idP].scheduling_info.BSR_short_lcid = lcid; // only applicable to short bsr LOG_D(MAC,"[UE %d] BSR level %d (LCGID %d, rlc buffer %d byte)\n", module_idP, UE_mac_inst[module_idP].scheduling_info.BSR[lcg_id],lcg_id, UE_mac_inst[module_idP].scheduling_info.BSR_bytes[lcg_id]); @@ -2045,7 +2224,7 @@ boolean_t update_bsr(module_id_t module_idP, frame_t frameP, eNB_index_t eNB_in return sr_pending; } -uint8_t locate (const uint32_t *table, int size, int value) +uint8_t locate_BsrIndexByBufferSize (const uint32_t *table, int size, int value) { uint8_t ju, jm, jl; @@ -2144,7 +2323,7 @@ int get_sf_periodicBSRTimer(uint8_t sf_offset) case MAC_MainConfig__ul_SCH_Config__periodicBSR_Timer_infinity: default: - return -1; + return 0xFFFF; break; } } diff --git a/openair2/LAYER2/MAC/vars.h b/openair2/LAYER2/MAC/vars.h index 83d159f910..236439c6e5 100644 --- a/openair2/LAYER2/MAC/vars.h +++ b/openair2/LAYER2/MAC/vars.h @@ -45,6 +45,15 @@ const uint32_t BSR_TABLE[BSR_TABLE_SIZE]= {0,10,12,14,17,19,22,26,31,36,42,49,57 1326,1552,1817,2127,2490,2915,3413,3995,4677,5467,6411,7505,8787,10287,12043,14099, 16507,19325,22624,26487,31009,36304,42502,49759,58255,68201,79846,93479,109439, 128125,150000, 300000 }; +// extended bsr table--currently not used +const uint32_t Extended_BSR_TABLE[BSR_TABLE_SIZE] = {0,10,13,16,19,23,29,35,43,53,65,80,98,120,147, + 181,223,274,337,414,509,625,769,945,1162,1429, + 1757,2161,2657,3267,4017,4940,6074,7469,9185, + 11294,13888,17077,20999,25822,31752,39045,48012, + 59039,72598,89272,109774,134986,165989,204111, + 250990,308634,379519,466683,573866,705666,867737, + 1067031,1312097,1613447,1984009,2439678,3000000, + 6000000}; //uint32_t EBSR_Level[63]={0,10,13,16,19,23,29,35,43,53,65,80,98,120,147,181}; From 6097e0516f44f018b15b412944a9c18c38daa8f4 Mon Sep 17 00:00:00 2001 From: calvin wang Date: Mon, 14 Nov 2016 11:10:33 +0800 Subject: [PATCH 270/349] fix build error --- openair2/LAYER2/MAC/proto.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openair2/LAYER2/MAC/proto.h b/openair2/LAYER2/MAC/proto.h index 94f1d3448c..3733b27336 100644 --- a/openair2/LAYER2/MAC/proto.h +++ b/openair2/LAYER2/MAC/proto.h @@ -577,14 +577,14 @@ BSR_LONG * get_bsr_long(module_id_t module_idP, uint8_t bsr_len); */ boolean_t update_bsr(module_id_t module_idP, frame_t frameP, eNB_index_t eNB_index, uint8_t lcid, uint8_t lcgid); -/*! \fn locate (int *table, int size, int value) +/*! \fn locate_BsrIndexByBufferSize (int *table, int size, int value) \brief locate the BSR level in the table as defined in 36.321. This function requires that he values in table to be monotonic, either increasing or decreasing. The returned value is not less than 0, nor greater than n-1, where n is the size of table. \param[in] *table Pointer to BSR table \param[in] size Size of the table \param[in] value Value of the buffer \return the index in the BSR_LEVEL table */ -uint8_t locate (const uint32_t *table, int size, int value); +uint8_t locate_BsrIndexByBufferSize (const uint32_t *table, int size, int value); /*! \fn int get_sf_periodicBSRTimer(uint8_t periodicBSR_Timer) From 3bd591bfec6abfb7939595b188a826488bd33bf5 Mon Sep 17 00:00:00 2001 From: calvin wang Date: Tue, 15 Nov 2016 18:41:46 +0800 Subject: [PATCH 271/349] change bsr trigger --- openair2/LAYER2/MAC/defs.h | 2 ++ openair2/LAYER2/MAC/ue_procedures.c | 39 +++++++++++++++++++---------- 2 files changed, 28 insertions(+), 13 deletions(-) diff --git a/openair2/LAYER2/MAC/defs.h b/openair2/LAYER2/MAC/defs.h index bfaaa3ca1d..c44144d8e7 100644 --- a/openair2/LAYER2/MAC/defs.h +++ b/openair2/LAYER2/MAC/defs.h @@ -957,6 +957,8 @@ typedef struct { uint16_t BSR_bytes[MAX_NUM_LCGID]; /// after multiplexing buffer remain for each lcid uint16_t LCID_buffer_remain[MAX_NUM_LCID]; + /// sum of all lcid buffer size + uint16_t All_lcid_buffer_size_lastTTI; /// buffer status for each lcid uint8_t LCID_status[MAX_NUM_LCID]; /// SR pending as defined in 36.321 diff --git a/openair2/LAYER2/MAC/ue_procedures.c b/openair2/LAYER2/MAC/ue_procedures.c index 56d4524d7d..d9888b0ba5 100644 --- a/openair2/LAYER2/MAC/ue_procedures.c +++ b/openair2/LAYER2/MAC/ue_procedures.c @@ -316,8 +316,6 @@ uint32_t ue_get_SR(module_id_t module_idP,int CC_id,frame_t frameP,uint8_t eNB_i UE_mac_inst[module_idP].scheduling_info.SR_pending=0; UE_mac_inst[module_idP].scheduling_info.SR_COUNTER=0; // release all pucch resource - UE_mac_inst[module_idP].physicalConfigDedicated = NULL; - UE_mac_inst[module_idP].ul_active=0; UE_mac_inst[module_idP].BSR_reporting_active[REGULAR_BSR]=0; UE_mac_inst[module_idP].BSR_reporting_active[PADDING_BSR]=0; UE_mac_inst[module_idP].BSR_reporting_active[PERIODIC_BSR]=0; @@ -1313,11 +1311,11 @@ void ue_get_sdu(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_t subf bsr_type = get_bsr_type(module_idP, eNB_index, frameP, buflen-phr_len); if (bsr_type == LONG_BSR) { - bsr_len = sizeof(SCH_SUBHEADER_FIXED)+sizeof(BSR_LONG);; + bsr_len = sizeof(SCH_SUBHEADER_FIXED)+sizeof(BSR_LONG); LOG_D(MAC,"[UE %d] header size info: dcch %d, dcch1 %d, dtch %d, bsr (bsr_type%d) buff_len %d\n", module_idP, dcch_header_len,dcch1_header_len,dtch_header_len, bsr_type, buflen); } else if ((bsr_type == SHORT_BSR) || (bsr_type == TRUNCATED_BSR)) { - bsr_len = sizeof(SCH_SUBHEADER_FIXED)+sizeof(BSR_SHORT);; + bsr_len = sizeof(SCH_SUBHEADER_FIXED)+sizeof(BSR_SHORT); LOG_D(MAC,"[UE %d] header size info: dcch %d, dcch1 %d, dtch %d, bsr (bsr_type%d) buff_len %d\n", module_idP, dcch_header_len,dcch1_header_len,dtch_header_len, bsr_type, buflen); } else { @@ -1457,7 +1455,7 @@ void ue_get_sdu(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_t subf MBMS_FLAG_NO, // eNB_index lcid, (char *)&ulsch_buff[sdu_length_total]); - + //adjust dtch header LOG_D(MAC,"[UE %d] TX Got %d bytes for DTCH\n",module_idP,sdu_lengths[num_sdus]); sdu_lcids[num_sdus] = lcid; @@ -1517,8 +1515,8 @@ void ue_get_sdu(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_t subf bsr_s->LCGID = lcgid; bsr_s->Buffer_size = UE_mac_inst[module_idP].scheduling_info.BSR[lcgid]; - LOG_D(MAC,"[UE %d] Frame %d report SHORT BSR with level %d for LCGID %d\n", - module_idP, frameP, UE_mac_inst[module_idP].scheduling_info.BSR[lcgid],lcgid); + LOG_I(MAC,"%%%%%%%%%%%%%%%%%%%%%%%%%%%%%[UE %d] Frame %d SubFrame %d,report SHORT BSR with level %d for LCGID %d\n", + module_idP, frameP, subframe, UE_mac_inst[module_idP].scheduling_info.BSR[lcgid],lcgid); UE_mac_inst[module_idP].scheduling_info.BSR_bytes[lcgid] = 0; UE_mac_inst[module_idP].scheduling_info.BSR[lcgid] = 0; } else if (bsr_type == TRUNCATED_BSR) { @@ -2068,6 +2066,7 @@ int get_bsr_lcgid (module_id_t module_idP) if (UE_mac_inst[module_idP].scheduling_info.BSR[lcgid] > 0 ) { lcgid_tmp = lcgid; num_active_lcgid+=1; + printf("////////////////////////////////lcgid %d, BSR %d\n",lcgid,UE_mac_inst[module_idP].scheduling_info.BSR[lcgid]); } } @@ -2090,7 +2089,8 @@ int get_bsr_type (module_id_t module_idP, uint8_t eNB_index,frame_t frameP,uint1 int short_bsr_size=sizeof(SCH_SUBHEADER_FIXED)+sizeof(BSR_SHORT); int bsr_group_id[MAX_NUM_LCGID]; int lcg_report_num=0; - + int new_data_arrived_flag=0; + for (lcgid=0; lcgid < MAX_NUM_LCGID; lcgid++ ) { bsr_group_id[lcgid] = 0; } @@ -2112,13 +2112,23 @@ int get_bsr_type (module_id_t module_idP, uint8_t eNB_index,frame_t frameP,uint1 either the data belongs to a logical channel with higher priority than the priorities of the logical channels which belong to any LCG and for which data is already available for transmission */ - if (rlc_status.bytes_in_buffer > UE_mac_inst[module_idP].scheduling_info.LCID_buffer_remain[lcid]) { + if (rlc_status.bytes_in_buffer > UE_mac_inst[module_idP].scheduling_info.LCID_buffer_remain[lcid]) { bsr_group_id[UE_mac_inst[module_idP].scheduling_info.LCGID[lcid]] ++; + new_data_arrived_flag = 1; UE_mac_inst[module_idP].BSR_reporting_active[REGULAR_BSR] = 1; } } } - + +/* + // one lcid buffer increased and all lcid buffer increased + if ((new_data_arrived_flag == 1) && (pdu > UE_mac_inst[module_idP].scheduling_info.All_lcid_buffer_size_lastTTI)) { + UE_mac_inst[module_idP].BSR_reporting_active[REGULAR_BSR] = 1; + } +*/ + + UE_mac_inst[module_idP].scheduling_info.All_lcid_buffer_size_lastTTI = pdu; + /* or there is no data available for transmission for any of the logical channels which belong to a LCG, in which case the BSR is referred below to as "Regular BSR" if (pdu == 0) { @@ -2130,6 +2140,7 @@ int get_bsr_type (module_id_t module_idP, uint8_t eNB_index,frame_t frameP,uint1 for (lcgid=0; lcgid < MAX_NUM_LCGID; lcgid++ ) { if (bsr_group_id[lcgid] > 0) { lcg_report_num ++; + printf("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@lcgid bsr %d > 0\n",lcgid); } } /* @@ -2150,6 +2161,7 @@ int get_bsr_type (module_id_t module_idP, uint8_t eNB_index,frame_t frameP,uint1 bsr_type = LONG_BSR; } else { bsr_type = SHORT_BSR; + printf("-----------------------------------REGULAR_BSR or PERIODIC_BSR bsr trigger short bsr\n"); } } /* For Padding BSR: @@ -2170,12 +2182,13 @@ int get_bsr_type (module_id_t module_idP, uint8_t eNB_index,frame_t frameP,uint1 bsr_type = LONG_BSR; } else { bsr_type = SHORT_BSR; + printf("+++++++++++++++++++++++++++++++++++padding bsr trigger short bsr\n"); } } } if ( bsr_type > 0 ) { - LOG_D(MAC, "[UE %d] bsr_type %d (Transport Block Size %d, MAC pdu len %d) lcg_report_num %d\n", + LOG_I(MAC, "[UE %d] bsr_type %d (Transport Block Size %d, MAC pdu len %d) lcg_report_num %d\n", module_idP, bsr_type, buflen, pdu, lcg_report_num); } @@ -2213,8 +2226,8 @@ boolean_t update_bsr(module_id_t module_idP, frame_t frameP, eNB_index_t eNB_in UE_mac_inst[module_idP].scheduling_info.BSR_bytes[lcg_id] += rlc_status.bytes_in_buffer; UE_mac_inst[module_idP].scheduling_info.BSR[lcg_id] = locate_BsrIndexByBufferSize(BSR_TABLE, BSR_TABLE_SIZE, UE_mac_inst[module_idP].scheduling_info.BSR_bytes[lcg_id]); // UE_mac_inst[module_idP].scheduling_info.BSR_short_lcid = lcid; // only applicable to short bsr - LOG_D(MAC,"[UE %d] BSR level %d (LCGID %d, rlc buffer %d byte)\n", - module_idP, UE_mac_inst[module_idP].scheduling_info.BSR[lcg_id],lcg_id, UE_mac_inst[module_idP].scheduling_info.BSR_bytes[lcg_id]); + LOG_D(MAC,"[UE %d] BSR level %d (LCGID %d,lcid %d rlc buffer %d byte)\n", + module_idP, UE_mac_inst[module_idP].scheduling_info.BSR[lcg_id],lcg_id, lcid,UE_mac_inst[module_idP].scheduling_info.BSR_bytes[lcg_id]); } else { UE_mac_inst[module_idP].scheduling_info.LCID_status[lcid]=LCID_EMPTY; } From f0f34c029b4718069ea3ed2379df0f309ac7b4a2 Mon Sep 17 00:00:00 2001 From: hbilel Date: Tue, 15 Nov 2016 16:13:24 +0100 Subject: [PATCH 272/349] BSR fixes with CMW500 --- openair2/LAYER2/MAC/config.c | 4 +- openair2/LAYER2/MAC/defs.h | 5 +- openair2/LAYER2/MAC/ue_procedures.c | 219 +++++++++++++++++++++++----- 3 files changed, 191 insertions(+), 37 deletions(-) diff --git a/openair2/LAYER2/MAC/config.c b/openair2/LAYER2/MAC/config.c index d46b761bd0..bca0149791 100644 --- a/openair2/LAYER2/MAC/config.c +++ b/openair2/LAYER2/MAC/config.c @@ -245,8 +245,8 @@ rrc_mac_config_req( UE_mac_inst[Mod_idP].scheduling_info.extendedPHR_r10 = (uint16_t)0; } #endif - UE_mac_inst[Mod_idP].scheduling_info.periodicBSR_SF = get_sf_periodicBSRTimer(UE_mac_inst[Mod_idP].scheduling_info.periodicBSR_Timer); - UE_mac_inst[Mod_idP].scheduling_info.retxBSR_SF = get_sf_retxBSRTimer(UE_mac_inst[Mod_idP].scheduling_info.retxBSR_Timer); + UE_mac_inst[Mod_idP].scheduling_info.periodicBSR_SF = MAC_UE_BSR_TIMER_NOT_RUNNING; + UE_mac_inst[Mod_idP].scheduling_info.retxBSR_SF = MAC_UE_BSR_TIMER_NOT_RUNNING; UE_mac_inst[Mod_idP].BSR_reporting_active = 0; LOG_D(MAC,"[UE %d]: periodic BSR %d (SF), retx BSR %d (SF)\n", diff --git a/openair2/LAYER2/MAC/defs.h b/openair2/LAYER2/MAC/defs.h index d38ca05362..336f3f1039 100644 --- a/openair2/LAYER2/MAC/defs.h +++ b/openair2/LAYER2/MAC/defs.h @@ -133,6 +133,7 @@ /*!\brief maximum value for channel quality indicator */ #define MAX_CQI_VALUE 15 +#define MAC_UE_BSR_TIMER_NOT_RUNNING (0xFFFF) #define LCID_EMPTY 0 #define LCID_NOT_EMPTY 1 @@ -962,11 +963,11 @@ typedef struct { /// retxBSR-Timer, default value is sf2560 uint16_t retxBSR_Timer; /// retxBSR_SF, number of subframe before triggering a regular BSR - int16_t retxBSR_SF; + uint16_t retxBSR_SF; /// periodicBSR-Timer, default to infinity uint16_t periodicBSR_Timer; /// periodicBSR_SF, number of subframe before triggering a periodic BSR - int16_t periodicBSR_SF; + uint16_t periodicBSR_SF; /// default value is 0: not configured uint16_t sr_ProhibitTimer; /// sr ProhibitTime running diff --git a/openair2/LAYER2/MAC/ue_procedures.c b/openair2/LAYER2/MAC/ue_procedures.c index c24702b3b5..c2701c5f39 100644 --- a/openair2/LAYER2/MAC/ue_procedures.c +++ b/openair2/LAYER2/MAC/ue_procedures.c @@ -91,7 +91,7 @@ void ue_init_mac(module_id_t module_idP) // default values as deined in 36.331 sec 9.2.2 LOG_I(MAC,"[UE%d] Applying default macMainConfig\n",module_idP); //UE_mac_inst[module_idP].scheduling_info.macConfig=NULL; - UE_mac_inst[module_idP].scheduling_info.retxBSR_Timer= MAC_MainConfig__ul_SCH_Config__retxBSR_Timer_sf2560; + UE_mac_inst[module_idP].scheduling_info.retxBSR_Timer= MAC_MainConfig__ul_SCH_Config__retxBSR_Timer_sf10240; UE_mac_inst[module_idP].scheduling_info.periodicBSR_Timer=MAC_MainConfig__ul_SCH_Config__periodicBSR_Timer_infinity; UE_mac_inst[module_idP].scheduling_info.periodicPHR_Timer = MAC_MainConfig__phr_Config__setup__periodicPHR_Timer_sf20; UE_mac_inst[module_idP].scheduling_info.prohibitPHR_Timer = MAC_MainConfig__phr_Config__setup__prohibitPHR_Timer_sf20; @@ -106,8 +106,8 @@ void ue_init_mac(module_id_t module_idP) UE_mac_inst[module_idP].scheduling_info.extendedPHR_r10=0; UE_mac_inst[module_idP].scheduling_info.drx_config=NULL; UE_mac_inst[module_idP].scheduling_info.phr_config=NULL; - UE_mac_inst[module_idP].scheduling_info.periodicBSR_SF = get_sf_periodicBSRTimer(UE_mac_inst[module_idP].scheduling_info.periodicBSR_Timer); - UE_mac_inst[module_idP].scheduling_info.retxBSR_SF = get_sf_retxBSRTimer(UE_mac_inst[module_idP].scheduling_info.retxBSR_Timer); + UE_mac_inst[module_idP].scheduling_info.periodicBSR_SF = MAC_UE_BSR_TIMER_NOT_RUNNING; + UE_mac_inst[module_idP].scheduling_info.retxBSR_SF = MAC_UE_BSR_TIMER_NOT_RUNNING; UE_mac_inst[module_idP].BSR_reporting_active = 0; UE_mac_inst[module_idP].scheduling_info.periodicPHR_SF = get_sf_perioidicPHR_Timer(UE_mac_inst[module_idP].scheduling_info.periodicPHR_Timer); UE_mac_inst[module_idP].scheduling_info.prohibitPHR_SF = get_sf_prohibitPHR_Timer(UE_mac_inst[module_idP].scheduling_info.prohibitPHR_Timer); @@ -308,14 +308,16 @@ uint32_t ue_get_SR(module_id_t module_idP,int CC_id,frame_t frameP,uint8_t eNB_i // notify RRC to relase PUCCH/SRS // clear any configured dl/ul // initiate RA + if (UE_mac_inst[module_idP].scheduling_info.SR_pending){ + // release all pucch resource + UE_mac_inst[module_idP].physicalConfigDedicated = NULL; + UE_mac_inst[module_idP].ul_active=0; + UE_mac_inst[module_idP].BSR_reporting_active=0; + + LOG_I(MAC,"[UE %d] Release all SRs \n", module_idP); + } UE_mac_inst[module_idP].scheduling_info.SR_pending=0; UE_mac_inst[module_idP].scheduling_info.SR_COUNTER=0; - // release all pucch resource - UE_mac_inst[module_idP].physicalConfigDedicated = NULL; - UE_mac_inst[module_idP].ul_active=0; - UE_mac_inst[module_idP].BSR_reporting_active=0; - - LOG_T(MAC,"[UE %d] Release all SRs \n", module_idP); return(0); } } @@ -1259,10 +1261,16 @@ void ue_get_sdu(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_t subf POWER_HEADROOM_CMD phr; POWER_HEADROOM_CMD *phr_p=&phr; unsigned short short_padding=0, post_padding=0, padding_len=0; - int lcgid; int j; // used for padding // Compute header length int all_pdu_len; + int lcg_id = 0; + int lcg_id_bsr_short = 0; + int num_lcg_id_with_data = 0; + + LOG_D(MAC,"[UE %d] MAC PROCESS UL TRANSPORT BLOCK at frame%d subframe %d TBS=%d\n", + module_idP, frameP, subframe, buflen); + if (CC_id>0) { LOG_E(MAC,"Transmission on secondary CCs is not supported yet\n"); @@ -1295,10 +1303,83 @@ void ue_get_sdu(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_t subf dcch1_header_len=2;//sizeof(SCH_SUBHEADER_SHORT); // hypo length,in case of long header skip the padding byte dtch_header_len=(buflen > 128 ) ? 3 : 2 ; //sizeof(SCH_SUBHEADER_LONG)-1 : sizeof(SCH_SUBHEADER_SHORT); - bsr_header_len = 1;//sizeof(SCH_SUBHEADER_FIXED); + bsr_header_len = 0; phr_header_len = 1;//sizeof(SCH_SUBHEADER_FIXED); + while (lcg_id < MAX_NUM_LCGID) { + if (UE_mac_inst[module_idP].scheduling_info.BSR_bytes[lcg_id]){ + num_lcg_id_with_data ++; + lcg_id_bsr_short = lcg_id; + } + lcg_id ++; + } + + if (num_lcg_id_with_data){ + LOG_I(MAC,"[UE %d] MAC Tx data pending at frame%d subframe %d nb LCG =%d LCG0 bytes=%d BSR Trigger status =%d TBS=%d\n", + module_idP, frameP, subframe, num_lcg_id_with_data, UE_mac_inst[module_idP].scheduling_info.BSR_bytes[0],UE_mac_inst[module_idP].BSR_reporting_active, buflen); + + } + // ReTxBSR-Timer expires, trigger BSR + if ((num_lcg_id_with_data) && (UE_mac_inst[module_idP].scheduling_info.retxBSR_SF == 0)){ + + // If the UE has data to transmit, trigger a BSR + UE_mac_inst[module_idP].BSR_reporting_active = 1; + + LOG_I(MAC,"[UE %d] MAC BSR Triggered ReTxBSR Timer expiry at frame%d subframe %d TBS=%d\n", + module_idP, frameP, subframe, buflen); + + } + // periodicBSR-Timer expires, trigger BSR + if ((UE_mac_inst[module_idP].scheduling_info.periodicBSR_Timer != MAC_MainConfig__ul_SCH_Config__periodicBSR_Timer_infinity) + && (UE_mac_inst[module_idP].scheduling_info.periodicBSR_SF == 0)){ + // Trigger BSR + UE_mac_inst[module_idP].BSR_reporting_active = 1; + + LOG_I(MAC,"[UE %d] MAC BSR Triggered PeriodicBSR Timer expiry at frame%d subframe %d TBS=%d\n", + module_idP, frameP, subframe, buflen); + + } + + //Compute BSR Length + if (UE_mac_inst[module_idP].BSR_reporting_active){ + if (buflen >= 4){ + if (num_lcg_id_with_data <= 1){ + bsr_ce_len = sizeof(BSR_SHORT); //1 byte + } + else{ + bsr_ce_len = sizeof(BSR_LONG); //3 bytes + } + + bsr_header_len = 1;//sizeof(SCH_SUBHEADER_FIXED); + // Reset Periodic and ReTx BSR Timer + UE_mac_inst[module_idP].scheduling_info.retxBSR_SF = get_sf_retxBSRTimer(UE_mac_inst[module_idP].scheduling_info.retxBSR_Timer); + + LOG_I(MAC,"[UE %d] MAC ReTx BSR Timer Reset =%d\n", + UE_mac_inst[module_idP].scheduling_info.retxBSR_SF); + + if (UE_mac_inst[module_idP].scheduling_info.periodicBSR_Timer != MAC_MainConfig__ul_SCH_Config__periodicBSR_Timer_infinity){ + UE_mac_inst[module_idP].scheduling_info.periodicBSR_SF = get_sf_periodicBSRTimer(UE_mac_inst[module_idP].scheduling_info.periodicBSR_Timer); + + LOG_I(MAC,"[UE %d] MAC Periodic BSR Timer Reset =%d\n", + UE_mac_inst[module_idP].scheduling_info.periodicBSR_SF); + + } + + LOG_I(MAC,"[UE %d] MAC BSR Triggered !! bsr (ce%d,hdr%d) buff_len %d\n", + module_idP, bsr_ce_len, bsr_header_len, buflen); + + } + else { + // Cancel Regular and Periodic BSR if Grant is smaller than 4 bytes + UE_mac_inst[module_idP].BSR_reporting_active = 0; + bsr_header_len = 0; + } + } + bsr_len = bsr_ce_len + bsr_header_len; +#if 0 bsr_ce_len = get_bsr_len (module_idP, eNB_index, frameP, buflen); + + // retxBSR-Timer expires or periodicBSR-Timer expires and Regular BSR trigger if ((bsr_ce_len > 0 ) && (UE_mac_inst[module_idP].BSR_reporting_active > 0)) { bsr_len = bsr_ce_len + bsr_header_len; @@ -1310,6 +1391,7 @@ void ue_get_sdu(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_t subf // bsr_ce_len = sizeof(BSR_LONG); //bsr_len = bsr_ce_len + bsr_header_len; } +#endif phr_ce_len = (UE_mac_inst[module_idP].PHR_reporting_active == 1) ? 1 /* sizeof(POWER_HEADROOM_CMD)*/: 0; if (phr_ce_len > 0) { @@ -1336,9 +1418,22 @@ void ue_get_sdu(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_t subf MBMS_FLAG_NO, // eNB_index DCCH, (buflen-dcch_header_len-bsr_len-phr_len)); - LOG_D(MAC, "[UE %d] Frame %d : UL-DCCH -> ULSCH, RRC message has %d bytes to " - "send (Transport Block size %d, mac header len %d)\n", - module_idP,frameP, rlc_status.bytes_in_buffer,buflen,dcch_header_len); + LOG_D(MAC, "[UE %d] Frame %d : UL-DCCH -> ULSCH, RLC SRB1 has %d bytes to " + "send (Transport Block size %d BSR size=%d PHR=%d SDU Length Total %d , mac header len %d)\n", + module_idP,frameP, rlc_status.bytes_in_buffer,buflen,bsr_len,phr_len,sdu_length_total,dcch_header_len); + + /* Update BSR : substract transmitted data */ + if (UE_mac_inst[module_idP].scheduling_info.BSR_bytes[UE_mac_inst[module_idP].scheduling_info.LCGID[DCCH]] >= rlc_status.bytes_in_buffer){ + UE_mac_inst[module_idP].scheduling_info.BSR_bytes[UE_mac_inst[module_idP].scheduling_info.LCGID[DCCH]] -= rlc_status.bytes_in_buffer; + } + else if (rlc_status.bytes_in_buffer){ + LOG_I(MAC, "[UE %d] Frame %d Subframe%d: WARNING Buffer occupancy =%d for LCGID%d is lower than data to transmit=%d for LCID%d\n", + module_idP,frameP,subframe, + UE_mac_inst[module_idP].scheduling_info.BSR_bytes[UE_mac_inst[module_idP].scheduling_info.LCGID[DCCH]], + UE_mac_inst[module_idP].scheduling_info.LCGID[DCCH], + rlc_status.bytes_in_buffer,DCCH); + UE_mac_inst[module_idP].scheduling_info.BSR_bytes[UE_mac_inst[module_idP].scheduling_info.LCGID[DCCH]] = 0; + } sdu_lengths[0] += mac_rlc_data_req(module_idP, UE_mac_inst[module_idP].crnti, @@ -1351,7 +1446,7 @@ void ue_get_sdu(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_t subf sdu_length_total += sdu_lengths[0]; sdu_lcids[0] = DCCH; - LOG_D(MAC,"[UE %d] TX Got %d bytes for DCCH\n",module_idP,sdu_lengths[0]); + LOG_D(MAC,"[UE %d] TX Multiplex RLC PDU TX Got %d bytes for SRB1\n",module_idP,sdu_lengths[0]); num_sdus = 1; //update_bsr(module_idP, frameP, eNB_index, DCCH, UE_mac_inst[module_idP].scheduling_info.LCGID[DCCH]); //header_len +=2; @@ -1379,9 +1474,22 @@ void ue_get_sdu(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_t subf DCCH1, (buflen-bsr_len-phr_len-dcch_header_len-dcch1_header_len-sdu_length_total)); - LOG_D(MAC,"[UE %d] Frame %d : UL-DCCH1 -> ULSCH, RRC message has %d bytes to" - " send (Transport Block size %d, mac header len %d)\n", - module_idP,frameP, rlc_status.bytes_in_buffer,buflen,dcch1_header_len); + LOG_D(MAC,"[UE %d] Frame %d subframe %d: UL-DCCH1 -> ULSCH, RLC SRB2 has %d bytes to" + " send (Transport Block size %d BSR size=%d PHR=%d SRB1 Hdr %d SDU Length Total %d , mac header len %d)\n", + module_idP,frameP, subframe, rlc_status.bytes_in_buffer,buflen,bsr_len,phr_len,dcch_header_len,sdu_length_total,dcch1_header_len); + + /* Update BSR : substract transmitted data */ + if (UE_mac_inst[module_idP].scheduling_info.BSR_bytes[UE_mac_inst[module_idP].scheduling_info.LCGID[DCCH1]] >= rlc_status.bytes_in_buffer){ + UE_mac_inst[module_idP].scheduling_info.BSR_bytes[UE_mac_inst[module_idP].scheduling_info.LCGID[DCCH1]] -= rlc_status.bytes_in_buffer; + } + else if (rlc_status.bytes_in_buffer){ + LOG_I(MAC, "[UE %d] Frame %d Subframe%d: WARNING Buffer occupancy =%d for LCGID%d is lower than data to transmit=%d for LCID%d\n", + module_idP,frameP,subframe, + UE_mac_inst[module_idP].scheduling_info.BSR_bytes[UE_mac_inst[module_idP].scheduling_info.LCGID[DCCH1]], + UE_mac_inst[module_idP].scheduling_info.LCGID[DCCH1], + rlc_status.bytes_in_buffer,DCCH1); + UE_mac_inst[module_idP].scheduling_info.BSR_bytes[UE_mac_inst[module_idP].scheduling_info.LCGID[DCCH1]] = 0; + } sdu_lengths[num_sdus] = mac_rlc_data_req(module_idP, UE_mac_inst[module_idP].crnti, @@ -1393,7 +1501,7 @@ void ue_get_sdu(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_t subf (char *)&ulsch_buff[sdu_lengths[num_sdus]]); sdu_length_total += sdu_lengths[num_sdus]; sdu_lcids[num_sdus] = DCCH1; - LOG_D(MAC,"[UE %d] TX Got %d bytes for DCCH1\n",module_idP,sdu_lengths[num_sdus]); + LOG_D(MAC,"[UE %d] TX Multiplex RLC PDU Got %d bytes for SRB2\n",module_idP,sdu_lengths[num_sdus]); //update_bsr(module_idP, frameP, DCCH1); //dcch_header_len +=2; // include dcch1 UE_mac_inst[module_idP].scheduling_info.LCID_status[DCCH1] = LCID_EMPTY; @@ -1438,6 +1546,19 @@ void ue_get_sdu(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_t subf lcid, UE_mac_inst[module_idP].scheduling_info.BSR_bytes[UE_mac_inst[module_idP].scheduling_info.LCGID[lcid]]); if (rlc_status.bytes_in_buffer > 0) { + /* Update BSR : substract transmitted data */ + if (UE_mac_inst[module_idP].scheduling_info.BSR_bytes[UE_mac_inst[module_idP].scheduling_info.LCGID[lcid]] >= rlc_status.bytes_in_buffer){ + UE_mac_inst[module_idP].scheduling_info.BSR_bytes[UE_mac_inst[module_idP].scheduling_info.LCGID[lcid]] -= rlc_status.bytes_in_buffer; + } + else { + LOG_I(MAC, "[UE %d] Frame %d Subframe%d: WARNING Buffer occupancy =%d for LCGID%d is lower than data to transmit=%d for LCID%d\n", + module_idP,frameP,subframe, + UE_mac_inst[module_idP].scheduling_info.BSR_bytes[UE_mac_inst[module_idP].scheduling_info.LCGID[lcid]], + UE_mac_inst[module_idP].scheduling_info.LCGID[lcid], + rlc_status.bytes_in_buffer,lcid); + UE_mac_inst[module_idP].scheduling_info.BSR_bytes[UE_mac_inst[module_idP].scheduling_info.LCGID[lcid]] = 0; + } + sdu_lengths[num_sdus] = mac_rlc_data_req(module_idP, UE_mac_inst[module_idP].crnti, eNB_index, @@ -1469,12 +1590,18 @@ void ue_get_sdu(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_t subf } } - lcgid= get_bsr_lcgid(module_idP); + //lcgid= get_bsr_lcgid(module_idP); - if (lcgid < 0 ) { + // Compute BSR Values + for (lcg_id=0;lcg_idBuffer_size0 = UE_mac_inst[module_idP].scheduling_info.BSR[LCGID0]; bsr_l->Buffer_size1 = UE_mac_inst[module_idP].scheduling_info.BSR[LCGID1]; @@ -1497,14 +1624,14 @@ void ue_get_sdu(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_t subf UE_mac_inst[module_idP].scheduling_info.BSR[LCGID3] = 0; } else if (bsr_ce_len == sizeof(BSR_SHORT)) { bsr_l = NULL; - bsr_s->LCGID = lcgid; - bsr_s->Buffer_size = UE_mac_inst[module_idP].scheduling_info.BSR[lcgid]; + bsr_s->LCGID = lcg_id_bsr_short; + bsr_s->Buffer_size = UE_mac_inst[module_idP].scheduling_info.BSR[lcg_id_bsr_short]; - UE_mac_inst[module_idP].scheduling_info.BSR_bytes[lcgid] = 0; - UE_mac_inst[module_idP].scheduling_info.BSR[lcgid] = 0; + UE_mac_inst[module_idP].scheduling_info.BSR_bytes[lcg_id_bsr_short] = 0; + UE_mac_inst[module_idP].scheduling_info.BSR[lcg_id_bsr_short] = 0; LOG_D(MAC,"[UE %d] Frame %d report SHORT BSR with level %d for LCGID %d\n", - module_idP, frameP, UE_mac_inst[module_idP].scheduling_info.BSR[lcgid],lcgid); + module_idP, frameP, UE_mac_inst[module_idP].scheduling_info.BSR[lcg_id_bsr_short],lcg_id_bsr_short); } else { bsr_s = NULL; bsr_l = NULL; @@ -1589,8 +1716,6 @@ void ue_get_sdu(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_t subf UE_mac_inst[module_idP].scheduling_info.SR_pending=0; UE_mac_inst[module_idP].scheduling_info.SR_COUNTER=0; UE_mac_inst[module_idP].BSR_reporting_active=0; - UE_mac_inst[module_idP].scheduling_info.periodicBSR_SF = get_sf_periodicBSRTimer(UE_mac_inst[module_idP].scheduling_info.periodicBSR_Timer); - UE_mac_inst[module_idP].scheduling_info.retxBSR_SF = get_sf_retxBSRTimer(UE_mac_inst[module_idP].scheduling_info.retxBSR_Timer); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_GET_SDU, VCD_FUNCTION_OUT); stop_meas(&UE_mac_inst[module_idP].tx_ulsch_sdu); @@ -1753,6 +1878,23 @@ ue_scheduler( // call SR procedure to generate pending SR and BSR for next PUCCH/PUSCH TxOp. This should implement the procedures // outlined in Sections 5.4.4 an 5.4.5 of 36.321 // Call BSR procedure as described in Section 5.4.5 in 36.321 + + // TODO : Fix Periodic and ReTx BSR Timers + // First check ReTxBSR Timer because it is always configured +#if 1 + // Decrement ReTxBSR Timer if it is running and not null + if ((UE_mac_inst[module_idP].scheduling_info.retxBSR_SF != MAC_UE_BSR_TIMER_NOT_RUNNING) + && (UE_mac_inst[module_idP].scheduling_info.retxBSR_SF != 0)){ + UE_mac_inst[module_idP].scheduling_info.retxBSR_SF --; + } + + // Decrement Periodic Timer if it is running and not null + if ((UE_mac_inst[module_idP].scheduling_info.periodicBSR_SF != MAC_UE_BSR_TIMER_NOT_RUNNING) + && (UE_mac_inst[module_idP].scheduling_info.periodicBSR_SF != 0)){ + UE_mac_inst[module_idP].scheduling_info.periodicBSR_SF --; + } + +#else if (UE_mac_inst[module_idP].scheduling_info.periodicBSR_SF == get_sf_periodicBSRTimer(MAC_MainConfig__ul_SCH_Config__periodicBSR_Timer_infinity)) { UE_mac_inst[module_idP].BSR_reporting_active = 1; } else if (UE_mac_inst[module_idP].scheduling_info.periodicBSR_SF <= 0 ){ @@ -1768,6 +1910,7 @@ ue_scheduler( } else if (UE_mac_inst[module_idP].BSR_reporting_active == 0 ) { UE_mac_inst[module_idP].scheduling_info.retxBSR_SF--; } +#endif // Get RLC status info and update Bj for all lcids that are active for (lcid=DCCH; lcid < MAX_NUM_LCID; lcid++ ) { @@ -2053,12 +2196,22 @@ uint8_t get_bsr_len (module_id_t module_idP, uint8_t eNB_index,frame_t frameP,ui num_lcid +=1; bsr_len = (num_lcid >= 2 ) ? sizeof(BSR_LONG) : sizeof(BSR_SHORT) ; } + else if (rlc_status.bytes_in_buffer) { + LOG_I(MAC,"pdu smaller than TBS! pdu=%d TBS=%d lcid=%d rlc buffer=%d bsr len=%d num lcid=%d\n",pdu,buflen,lcid,rlc_status.bytes_in_buffer,bsr_len, num_lcid); + } LOG_D(MAC,"LC buffer Bytes %d for lcid %d bsr len %d num lcid %d\n", rlc_status.bytes_in_buffer, lcid, bsr_len, num_lcid); } if ( bsr_len > 0 ) - LOG_D(MAC,"[UE %d] Prepare a %s (Transport Block Size %d, MAC pdu Size %d) \n", - module_idP, map_int_to_str(BSR_names, bsr_len), buflen, pdu); + { + LOG_D(MAC,"[UE %d] Prepare a %s (Transport Block Size %d, MAC pdu Size %d) \n", + module_idP, map_int_to_str(BSR_names, bsr_len), buflen, pdu); + } + else if (rlc_status.bytes_in_buffer){ + LOG_I(MAC,"[UE %d] UL Transport Block size is 0 while RLC has pending data=%d pdu=%d\n", + module_idP, rlc_status.bytes_in_buffer,pdu); + + } return bsr_len; } @@ -2098,8 +2251,8 @@ boolean_t update_bsr(module_id_t module_idP, frame_t frameP, eNB_index_t eNB_in UE_mac_inst[module_idP].scheduling_info.BSR_bytes[lcg_id] += rlc_status.bytes_in_buffer; UE_mac_inst[module_idP].scheduling_info.BSR[lcg_id] = locate_BsrIndexByBufferSize(BSR_TABLE, BSR_TABLE_SIZE, UE_mac_inst[module_idP].scheduling_info.BSR_bytes[lcg_id]); // UE_mac_inst[module_idP].scheduling_info.BSR_short_lcid = lcid; // only applicable to short bsr - LOG_D(MAC,"[UE %d] BSR level %d (LCGID %d, rlc buffer %d byte)\n", - module_idP, UE_mac_inst[module_idP].scheduling_info.BSR[lcg_id],lcg_id, UE_mac_inst[module_idP].scheduling_info.BSR_bytes[lcg_id]); + LOG_D(MAC,"[UE %d] SR Triggered BSR level %d (LCID %d LCGID %d, rlc buffer=%d byte Total BO=%d)\n", + module_idP, UE_mac_inst[module_idP].scheduling_info.BSR[lcg_id],lcid,lcg_id, rlc_status.bytes_in_buffer, UE_mac_inst[module_idP].scheduling_info.BSR_bytes[lcg_id]); } else { UE_mac_inst[module_idP].scheduling_info.LCID_status[lcid]=LCID_EMPTY; } From c0ad88e537b457685cbeefab0c8771a27ce8893b Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Wed, 16 Nov 2016 16:12:30 +0200 Subject: [PATCH 273/349] Fixed bug in the creation of MAC PDUs in the local flexran scheduler --- openair2/LAYER2/MAC/flexran_agent_scheduler_dlsch_ue.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openair2/LAYER2/MAC/flexran_agent_scheduler_dlsch_ue.c b/openair2/LAYER2/MAC/flexran_agent_scheduler_dlsch_ue.c index 73d82507a5..bc0187cd56 100644 --- a/openair2/LAYER2/MAC/flexran_agent_scheduler_dlsch_ue.c +++ b/openair2/LAYER2/MAC/flexran_agent_scheduler_dlsch_ue.c @@ -353,7 +353,7 @@ flexran_schedule_ue_spec_default(mid_t mod_id, header_len+=3; // Need to see if we have space for data from this channel - if (dci_tbs - ta_len - header_len > 0) { + if (dci_tbs - ta_len - header_len - sdu_length_total > 0) { LOG_D(MAC, "[TEST]Requested %d bytes from RLC buffer on channel %d during first call\n", dci_tbs-ta_len-header_len); //If we have space, we need to see how much data we can request at most (if any available) rlc_status = mac_rlc_status_ind(mod_id, @@ -396,7 +396,7 @@ flexran_schedule_ue_spec_default(mid_t mod_id, dl_data[num_ues_added]->n_rlc_pdu++; channels_added++; //Set this to the max value that we might request - sdu_length_total = data_to_request; + sdu_length_total += data_to_request; } else { //Take back the assumption of a header for this channel header_len -= 3; From 69ccc900e89ddea4711d86861aec4d7452d9dfbb Mon Sep 17 00:00:00 2001 From: fnabet Date: Wed, 16 Nov 2016 18:24:04 +0100 Subject: [PATCH 274/349] fix BSR long size and fill --- openair2/LAYER2/MAC/defs.h | 9 ++++----- openair2/LAYER2/MAC/ue_procedures.c | 8 +++----- targets/SIMU/USER/oaisim.c | 2 ++ 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/openair2/LAYER2/MAC/defs.h b/openair2/LAYER2/MAC/defs.h index 336f3f1039..82907eb40a 100644 --- a/openair2/LAYER2/MAC/defs.h +++ b/openair2/LAYER2/MAC/defs.h @@ -223,11 +223,10 @@ typedef struct { typedef BSR_SHORT BSR_TRUNCATED; /*!\brief mac control element: long buffer status report for all logical channel group ID*/ typedef struct { - uint32_t Buffer_size3:6; - uint32_t Buffer_size2:6; - uint32_t Buffer_size1:6; - uint32_t Buffer_size0:6; - uint32_t padding:8; + uint8_t Buffer_size3:6; + uint8_t Buffer_size2:6; + uint8_t Buffer_size1:6; + uint8_t Buffer_size0:6; } __attribute__((__packed__))BSR_LONG; #define BSR_LONG_SIZE (sizeof(BSR_LONG)) diff --git a/openair2/LAYER2/MAC/ue_procedures.c b/openair2/LAYER2/MAC/ue_procedures.c index c2701c5f39..65bb4c09aa 100644 --- a/openair2/LAYER2/MAC/ue_procedures.c +++ b/openair2/LAYER2/MAC/ue_procedures.c @@ -1147,8 +1147,6 @@ unsigned char generate_ulsch_header(uint8_t *mac_header, *(ce_ptr) = (long_bsr->Buffer_size0 << 2) | ((long_bsr->Buffer_size1 & 0x30) >> 4); *(ce_ptr + 1) = ((long_bsr->Buffer_size1 & 0x0F) << 4) | ((long_bsr->Buffer_size2 & 0x3C) >> 2); *(ce_ptr + 2) = ((long_bsr->Buffer_size2 & 0x03) << 2) | (long_bsr->Buffer_size3 & 0x3F); - /* Padding */ - *(ce_ptr + 3) = 0; ce_ptr += BSR_LONG_SIZE; // printf("(cont_res) : offset %d\n",ce_ptr-mac_header_control_elements); @@ -1347,7 +1345,7 @@ void ue_get_sdu(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_t subf bsr_ce_len = sizeof(BSR_SHORT); //1 byte } else{ - bsr_ce_len = sizeof(BSR_LONG); //3 bytes + bsr_ce_len = BSR_LONG_SIZE; //3 bytes } bsr_header_len = 1;//sizeof(SCH_SUBHEADER_FIXED); @@ -1601,7 +1599,7 @@ void ue_get_sdu(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_t subf bsr_s = NULL; bsr_l = NULL ; //TO DO : compute padding or truncated BSR - } else if (bsr_ce_len == sizeof(BSR_LONG)) { + } else if (bsr_ce_len == BSR_LONG_SIZE) { bsr_s = NULL; bsr_l->Buffer_size0 = UE_mac_inst[module_idP].scheduling_info.BSR[LCGID0]; bsr_l->Buffer_size1 = UE_mac_inst[module_idP].scheduling_info.BSR[LCGID1]; @@ -2194,7 +2192,7 @@ uint8_t get_bsr_len (module_id_t module_idP, uint8_t eNB_index,frame_t frameP,ui } if ( (pdu > buflen) && (rlc_status.bytes_in_buffer > 0 ) ) { num_lcid +=1; - bsr_len = (num_lcid >= 2 ) ? sizeof(BSR_LONG) : sizeof(BSR_SHORT) ; + bsr_len = (num_lcid >= 2 ) ? BSR_LONG_SIZE : sizeof(BSR_SHORT) ; } else if (rlc_status.bytes_in_buffer) { LOG_I(MAC,"pdu smaller than TBS! pdu=%d TBS=%d lcid=%d rlc buffer=%d bsr len=%d num lcid=%d\n",pdu,buflen,lcid,rlc_status.bytes_in_buffer,bsr_len, num_lcid); diff --git a/targets/SIMU/USER/oaisim.c b/targets/SIMU/USER/oaisim.c index 79cd2fcc38..f136c605f8 100644 --- a/targets/SIMU/USER/oaisim.c +++ b/targets/SIMU/USER/oaisim.c @@ -122,6 +122,8 @@ char smbv_ip[16]; //#define K 2 /* averaging coefficient */ //#define TARGET_SF_TIME_NS 1000000 /* 1ms = 1000000 ns */ +uint8_t usim_test = 0; + frame_t frame = 0; char stats_buffer[16384]; channel_desc_t *eNB2UE[NUMBER_OF_eNB_MAX][NUMBER_OF_UE_MAX][MAX_NUM_CCs]; From 319ae6fbbf7034c96e600dabde81fcd0ef474a51 Mon Sep 17 00:00:00 2001 From: calvin wang Date: Fri, 18 Nov 2016 16:44:18 +0800 Subject: [PATCH 275/349] fix bsr report inaccurate value --- openair2/LAYER2/MAC/config.c | 53 +++++++------ openair2/LAYER2/MAC/defs.h | 8 +- openair2/LAYER2/MAC/proto.h | 6 +- openair2/LAYER2/MAC/ue_procedures.c | 115 +++++++++++++++++----------- 4 files changed, 109 insertions(+), 73 deletions(-) diff --git a/openair2/LAYER2/MAC/config.c b/openair2/LAYER2/MAC/config.c index 2a6390740c..86062edfa9 100644 --- a/openair2/LAYER2/MAC/config.c +++ b/openair2/LAYER2/MAC/config.c @@ -1,24 +1,31 @@ -/* - * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The OpenAirInterface Software Alliance licenses this file to You under - * the OAI Public License, Version 1.0 (the "License"); you may not use this file - * except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.openairinterface.org/?page_id=698 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *------------------------------------------------------------------------------- - * For more information about the OpenAirInterface (OAI) Software Alliance: - * contact@openairinterface.org - */ +/******************************************************************************* + OpenAirInterface + Copyright(c) 1999 - 2014 Eurecom + OpenAirInterface is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + + OpenAirInterface is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with OpenAirInterface.The full GNU General Public License is + included in this distribution in the file called "COPYING". If not, + see . + + Contact Information + OpenAirInterface Admin: openair_admin@eurecom.fr + OpenAirInterface Tech : openair_tech@eurecom.fr + OpenAirInterface Dev : openair4g-devel@lists.eurecom.fr + + Address : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE + +*******************************************************************************/ /*! \file config.c * \brief UE and eNB configuration performed by RRC or as a consequence of RRC procedures * \author Navid Nikaein and Raymond Knopp @@ -73,6 +80,7 @@ void ue_mac_reset(module_id_t module_idP,uint8_t eNB_index) UE_mac_inst[module_idP].BSR_reporting_active[PADDING_BSR]=0; UE_mac_inst[module_idP].BSR_reporting_active[PERIODIC_BSR]=0; UE_mac_inst[module_idP].retxBSRTimer_expires_flag = 0; + UE_mac_inst[module_idP].periodBSRTimer_expires_flag = 0; // stop ongoing RACH procedure // discard explicitly signaled ra_PreambleIndex and ra_RACH_MaskIndex, if any @@ -247,12 +255,13 @@ rrc_mac_config_req( UE_mac_inst[Mod_idP].scheduling_info.extendedPHR_r10 = (uint16_t)0; } #endif - UE_mac_inst[Mod_idP].scheduling_info.periodicBSR_SF = 0xFFFF; - UE_mac_inst[Mod_idP].scheduling_info.retxBSR_SF = 0xFFFF; + UE_mac_inst[Mod_idP].scheduling_info.periodicBSR_SF = MAC_UE_BSR_TIMER_NOT_RUNNING; + UE_mac_inst[Mod_idP].scheduling_info.retxBSR_SF = MAC_UE_BSR_TIMER_NOT_RUNNING; UE_mac_inst[Mod_idP].BSR_reporting_active[REGULAR_BSR]=0; UE_mac_inst[Mod_idP].BSR_reporting_active[PADDING_BSR]=0; UE_mac_inst[Mod_idP].BSR_reporting_active[PERIODIC_BSR]=0; UE_mac_inst[Mod_idP].retxBSRTimer_expires_flag = 0; + UE_mac_inst[Mod_idP].periodBSRTimer_expires_flag = 0; LOG_D(MAC,"[UE %d]: periodic BSR %d (SF), retx BSR %d (SF)\n", Mod_idP, diff --git a/openair2/LAYER2/MAC/defs.h b/openair2/LAYER2/MAC/defs.h index c44144d8e7..426ebc610e 100644 --- a/openair2/LAYER2/MAC/defs.h +++ b/openair2/LAYER2/MAC/defs.h @@ -133,6 +133,8 @@ /*!\brief maximum value for channel quality indicator */ #define MAX_CQI_VALUE 15 +//if value equal oxFFFF means counters are NOT active +#define MAC_UE_BSR_TIMER_NOT_RUNNING (0xFFFF) #define LCID_EMPTY 0 #define LCID_NOT_EMPTY 1 @@ -226,7 +228,6 @@ typedef struct { uint32_t Buffer_size2:6; uint32_t Buffer_size1:6; uint32_t Buffer_size0:6; - uint32_t padding:8; } __attribute__((__packed__))BSR_LONG; #define BSR_LONG_SIZE (sizeof(BSR_LONG)) @@ -345,6 +346,7 @@ typedef enum { PERIODIC_BSR } UE_FIRST_LEVEL_BSR_TYPE; + /*! \brief Downlink SCH PDU Structure */ typedef struct { int8_t payload[8][SCH_PAYLOAD_SIZE_MAX]; @@ -1096,7 +1098,9 @@ typedef struct { uint8_t BSR_reporting_active[BSR_TYPE_FIRST_LEVEL]; /// retxBSR-Timer expires flag uint8_t retxBSRTimer_expires_flag; - + /// periodBSR-Timer expires flag + uint8_t periodBSRTimer_expires_flag; + /// MBSFN_Subframe Configuration struct MBSFN_SubframeConfig *mbsfn_SubframeConfig[8]; // FIXME replace 8 by MAX_MBSFN_AREA? /// number of subframe allocation pattern available for MBSFN sync area diff --git a/openair2/LAYER2/MAC/proto.h b/openair2/LAYER2/MAC/proto.h index 3733b27336..69dc7baade 100644 --- a/openair2/LAYER2/MAC/proto.h +++ b/openair2/LAYER2/MAC/proto.h @@ -538,14 +538,14 @@ UE_L2_STATE_t ue_scheduler( */ int cba_access(module_id_t module_idP,frame_t frameP,sub_frame_t subframe, uint8_t eNB_index,uint16_t buflen); -/*! \fn int get_bsr_lcgid (module_id_t module_idP); +/*! \fn int update_bsr_and_get_bsr_lcgid (module_id_t module_idP); \brief determine the lcgid for the bsr \param[in] Mod_id instance of the UE \param[out] lcgid */ -int get_bsr_lcgid (module_id_t module_idP); +int update_bsr_and_get_bsr_lcgid (module_id_t module_idP); -/*! \fn int get_bsr_type (module_id_t module_idP,uint16_t bufflen); +/*! \fn int get_bsr_type (module_id_t module_idP, uint8_t eNB_index,frame_t frameP,uint16_t buflen); \brief determine whether the bsr is short or long assuming that the MAC pdu is built \param[in] Mod_id instance of the UE \param[in] bufflen size of phy transport block diff --git a/openair2/LAYER2/MAC/ue_procedures.c b/openair2/LAYER2/MAC/ue_procedures.c index d9888b0ba5..4d21762924 100644 --- a/openair2/LAYER2/MAC/ue_procedures.c +++ b/openair2/LAYER2/MAC/ue_procedures.c @@ -91,7 +91,7 @@ void ue_init_mac(module_id_t module_idP) // default values as deined in 36.331 sec 9.2.2 LOG_I(MAC,"[UE%d] Applying default macMainConfig\n",module_idP); //UE_mac_inst[module_idP].scheduling_info.macConfig=NULL; - UE_mac_inst[module_idP].scheduling_info.retxBSR_Timer= MAC_MainConfig__ul_SCH_Config__retxBSR_Timer_sf2560; + UE_mac_inst[module_idP].scheduling_info.retxBSR_Timer= MAC_MainConfig__ul_SCH_Config__retxBSR_Timer_sf10240; UE_mac_inst[module_idP].scheduling_info.periodicBSR_Timer=MAC_MainConfig__ul_SCH_Config__periodicBSR_Timer_infinity; UE_mac_inst[module_idP].scheduling_info.periodicPHR_Timer = MAC_MainConfig__phr_Config__setup__periodicPHR_Timer_sf20; UE_mac_inst[module_idP].scheduling_info.prohibitPHR_Timer = MAC_MainConfig__phr_Config__setup__prohibitPHR_Timer_sf20; @@ -107,13 +107,14 @@ void ue_init_mac(module_id_t module_idP) UE_mac_inst[module_idP].scheduling_info.drx_config=NULL; UE_mac_inst[module_idP].scheduling_info.phr_config=NULL; // set init value 0xFFFF, make sure periodic timer and retx time counters are NOT active, after bsr transmission set the value configured by the NW. - UE_mac_inst[module_idP].scheduling_info.periodicBSR_SF = 0xFFFF; - UE_mac_inst[module_idP].scheduling_info.retxBSR_SF = 0xFFFF; + UE_mac_inst[module_idP].scheduling_info.periodicBSR_SF = MAC_UE_BSR_TIMER_NOT_RUNNING; + UE_mac_inst[module_idP].scheduling_info.retxBSR_SF = MAC_UE_BSR_TIMER_NOT_RUNNING; UE_mac_inst[module_idP].BSR_reporting_active[REGULAR_BSR]=0; UE_mac_inst[module_idP].BSR_reporting_active[PADDING_BSR]=0; UE_mac_inst[module_idP].BSR_reporting_active[PERIODIC_BSR]=0; UE_mac_inst[module_idP].retxBSRTimer_expires_flag = 0; + UE_mac_inst[module_idP].periodBSRTimer_expires_flag = 0; UE_mac_inst[module_idP].scheduling_info.periodicPHR_SF = get_sf_perioidicPHR_Timer(UE_mac_inst[module_idP].scheduling_info.periodicPHR_Timer); UE_mac_inst[module_idP].scheduling_info.prohibitPHR_SF = get_sf_prohibitPHR_Timer(UE_mac_inst[module_idP].scheduling_info.prohibitPHR_Timer); UE_mac_inst[module_idP].scheduling_info.PathlossChange_db = get_db_dl_PathlossChange(UE_mac_inst[module_idP].scheduling_info.PathlossChange); @@ -320,6 +321,7 @@ uint32_t ue_get_SR(module_id_t module_idP,int CC_id,frame_t frameP,uint8_t eNB_i UE_mac_inst[module_idP].BSR_reporting_active[PADDING_BSR]=0; UE_mac_inst[module_idP].BSR_reporting_active[PERIODIC_BSR]=0; UE_mac_inst[module_idP].retxBSRTimer_expires_flag = 0; + UE_mac_inst[module_idP].periodBSRTimer_expires_flag = 0; LOG_T(MAC,"[UE %d] Release all SRs \n", module_idP); return(0); } @@ -1359,12 +1361,25 @@ void ue_get_sdu(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_t subf num_sdus = 1; //update_bsr(module_idP, frameP, eNB_index, DCCH, UE_mac_inst[module_idP].scheduling_info.LCGID[DCCH]); //header_len +=2; + // update LCID remain buffer UE_mac_inst[module_idP].scheduling_info.LCID_status[DCCH] = LCID_EMPTY; if (rlc_status.bytes_in_buffer > sdu_lengths[0]) { UE_mac_inst[module_idP].scheduling_info.LCID_buffer_remain[DCCH] = rlc_status.bytes_in_buffer-sdu_lengths[0]; } else { UE_mac_inst[module_idP].scheduling_info.LCID_buffer_remain[DCCH] = 0; } + // update LCGID buffer, in order to get right BSR value + if (UE_mac_inst[module_idP].scheduling_info.BSR_bytes[UE_mac_inst[module_idP].scheduling_info.LCGID[DCCH]] > sdu_lengths[0]) { + UE_mac_inst[module_idP].scheduling_info.BSR_bytes[UE_mac_inst[module_idP].scheduling_info.LCGID[DCCH]] -= sdu_lengths[0]; + } else { + UE_mac_inst[module_idP].scheduling_info.BSR_bytes[UE_mac_inst[module_idP].scheduling_info.LCGID[DCCH]] = 0; + LOG_I(MAC, "[UE %d] Frame %d Subframe%d: WARNING Buffer occupancy =%d for LCGID%d is lower than data to transmit=%d for LCID%d\n", + module_idP,frameP,subframe, + UE_mac_inst[module_idP].scheduling_info.BSR_bytes[UE_mac_inst[module_idP].scheduling_info.LCGID[DCCH]], + UE_mac_inst[module_idP].scheduling_info.LCGID[DCCH], + rlc_status.bytes_in_buffer,DCCH); + } + } else { dcch_header_len=0; num_sdus = 0; @@ -1408,7 +1423,11 @@ void ue_get_sdu(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_t subf } else { UE_mac_inst[module_idP].scheduling_info.LCID_buffer_remain[DCCH1] = 0; } - + if (UE_mac_inst[module_idP].scheduling_info.BSR_bytes[UE_mac_inst[module_idP].scheduling_info.LCGID[DCCH1]] > sdu_lengths[num_sdus]) { + UE_mac_inst[module_idP].scheduling_info.BSR_bytes[UE_mac_inst[module_idP].scheduling_info.LCGID[DCCH1]] -= sdu_lengths[num_sdus]; + } else { + UE_mac_inst[module_idP].scheduling_info.BSR_bytes[UE_mac_inst[module_idP].scheduling_info.LCGID[DCCH1]] = 0; + } num_sdus++; } else { dcch1_header_len =0; @@ -1416,7 +1435,7 @@ void ue_get_sdu(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_t subf dtch_header_len=0; dtch_header_len_last=0; - for (lcid=NB_RB_MAX-1; lcid>=DTCH ; lcid--){ + for (lcid=MAX_NUM_LCID-1; lcid>=DTCH ; lcid--){ dtch_header_len+=3; dtch_header_len_last=3; @@ -1469,7 +1488,13 @@ void ue_get_sdu(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_t subf } else { UE_mac_inst[module_idP].scheduling_info.LCID_buffer_remain[lcid] = 0; } - + if (UE_mac_inst[module_idP].scheduling_info.BSR_bytes[UE_mac_inst[module_idP].scheduling_info.LCGID[lcid]] > sdu_lengths[num_sdus]) { + UE_mac_inst[module_idP].scheduling_info.BSR_bytes[UE_mac_inst[module_idP].scheduling_info.LCGID[lcid]] -= sdu_lengths[num_sdus]; + } else { + UE_mac_inst[module_idP].scheduling_info.BSR_bytes[UE_mac_inst[module_idP].scheduling_info.LCGID[lcid]] = 0; + } + printf("~~~~~~~~~~~~~~~~~~~~~~~~~~~~rlc_status.bytes_in_buffer %d,sdu_lengths[num_sdus] %d buflen %d all_pdu_len %d\n" + ,rlc_status.bytes_in_buffer ,sdu_lengths[num_sdus],buflen, all_pdu_len); //UE_mac_inst[module_idP].ul_active = update_bsr(module_idP, frameP, eNB_index,lcid, UE_mac_inst[module_idP].scheduling_info.LCGID[lcid]); num_sdus++; } else { @@ -1481,13 +1506,13 @@ void ue_get_sdu(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_t subf } } - lcgid= get_bsr_lcgid(module_idP); + lcgid= update_bsr_and_get_bsr_lcgid(module_idP); if (lcgid < 0 ) { bsr_s = NULL; bsr_l = NULL; bsr_t = NULL; - } else if ((lcgid ==MAX_NUM_LCGID) && (bsr_type == LONG_BSR)) { + } else if (bsr_type == LONG_BSR) { bsr_s = NULL; bsr_t = NULL; bsr_l->Buffer_size0 = UE_mac_inst[module_idP].scheduling_info.BSR[LCGID0]; @@ -1500,15 +1525,6 @@ void ue_get_sdu(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_t subf UE_mac_inst[module_idP].scheduling_info.BSR[LCGID1], UE_mac_inst[module_idP].scheduling_info.BSR[LCGID2], UE_mac_inst[module_idP].scheduling_info.BSR[LCGID3]); - - UE_mac_inst[module_idP].scheduling_info.BSR_bytes[LCGID0] = 0; - UE_mac_inst[module_idP].scheduling_info.BSR_bytes[LCGID1] = 0; - UE_mac_inst[module_idP].scheduling_info.BSR_bytes[LCGID2] = 0; - UE_mac_inst[module_idP].scheduling_info.BSR_bytes[LCGID3] = 0; - UE_mac_inst[module_idP].scheduling_info.BSR[LCGID0] = 0; - UE_mac_inst[module_idP].scheduling_info.BSR[LCGID1] = 0; - UE_mac_inst[module_idP].scheduling_info.BSR[LCGID2] = 0; - UE_mac_inst[module_idP].scheduling_info.BSR[LCGID3] = 0; } else if (bsr_type == SHORT_BSR) { bsr_l = NULL; bsr_t = NULL; @@ -1517,8 +1533,6 @@ void ue_get_sdu(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_t subf LOG_I(MAC,"%%%%%%%%%%%%%%%%%%%%%%%%%%%%%[UE %d] Frame %d SubFrame %d,report SHORT BSR with level %d for LCGID %d\n", module_idP, frameP, subframe, UE_mac_inst[module_idP].scheduling_info.BSR[lcgid],lcgid); - UE_mac_inst[module_idP].scheduling_info.BSR_bytes[lcgid] = 0; - UE_mac_inst[module_idP].scheduling_info.BSR[lcgid] = 0; } else if (bsr_type == TRUNCATED_BSR) { bsr_l = NULL; bsr_s = NULL; @@ -1527,8 +1541,6 @@ void ue_get_sdu(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_t subf LOG_D(MAC,"[UE %d] Frame %d report SHORT BSR with level %d for LCGID %d\n", module_idP, frameP, UE_mac_inst[module_idP].scheduling_info.BSR[lcgid],lcgid); - UE_mac_inst[module_idP].scheduling_info.BSR_bytes[lcgid] = 0; - UE_mac_inst[module_idP].scheduling_info.BSR[lcgid] = 0; } else { bsr_s = NULL; bsr_l = NULL; @@ -1620,6 +1632,7 @@ void ue_get_sdu(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_t subf UE_mac_inst[module_idP].scheduling_info.periodicBSR_SF = get_sf_periodicBSRTimer(UE_mac_inst[module_idP].scheduling_info.periodicBSR_Timer); UE_mac_inst[module_idP].scheduling_info.retxBSR_SF = get_sf_retxBSRTimer(UE_mac_inst[module_idP].scheduling_info.retxBSR_Timer); UE_mac_inst[module_idP].retxBSRTimer_expires_flag = 0; + UE_mac_inst[module_idP].periodBSRTimer_expires_flag = 0; } VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_GET_SDU, VCD_FUNCTION_OUT); stop_meas(&UE_mac_inst[module_idP].tx_ulsch_sdu); @@ -1789,7 +1802,7 @@ ue_scheduler( /* periodicBSR-Timer expires, in which case the BSR is referred below to as "Periodic BSR". */ - UE_mac_inst[module_idP].BSR_reporting_active[PERIODIC_BSR] = 1; + UE_mac_inst[module_idP].periodBSRTimer_expires_flag = 1; UE_mac_inst[module_idP].scheduling_info.periodicBSR_SF = periodicBSR_Timer_infinity_value; } else { UE_mac_inst[module_idP].scheduling_info.periodicBSR_SF--; @@ -2057,16 +2070,18 @@ int cba_access(module_id_t module_idP,frame_t frameP,sub_frame_t subframe, uint8 } #endif -int get_bsr_lcgid (module_id_t module_idP) +//AFTER transmission update BSR value, and get witch LCGID have BSR +int update_bsr_and_get_bsr_lcgid (module_id_t module_idP) { int lcgid, lcgid_tmp=-1; int num_active_lcgid = 0; for (lcgid = 0 ; lcgid < MAX_NUM_LCGID; lcgid++) { + // update BSR value, then ue can reprot correct value + UE_mac_inst[module_idP].scheduling_info.BSR[lcgid] = locate_BsrIndexByBufferSize(BSR_TABLE, BSR_TABLE_SIZE, UE_mac_inst[module_idP].scheduling_info.BSR_bytes[lcgid]); if (UE_mac_inst[module_idP].scheduling_info.BSR[lcgid] > 0 ) { lcgid_tmp = lcgid; num_active_lcgid+=1; - printf("////////////////////////////////lcgid %d, BSR %d\n",lcgid,UE_mac_inst[module_idP].scheduling_info.BSR[lcgid]); } } @@ -2087,12 +2102,12 @@ int get_bsr_type (module_id_t module_idP, uint8_t eNB_index,frame_t frameP,uint1 mac_rlc_status_resp_t rlc_status; int long_bsr_size=sizeof(SCH_SUBHEADER_FIXED)+sizeof(BSR_LONG); int short_bsr_size=sizeof(SCH_SUBHEADER_FIXED)+sizeof(BSR_SHORT); - int bsr_group_id[MAX_NUM_LCGID]; - int lcg_report_num=0; + int lcgid_have_bsr_report_flag[MAX_NUM_LCGID]; + int num_lcg_id_with_data=0; int new_data_arrived_flag=0; for (lcgid=0; lcgid < MAX_NUM_LCGID; lcgid++ ) { - bsr_group_id[lcgid] = 0; + lcgid_have_bsr_report_flag[lcgid] = 0; } for (lcid=DCCH; lcid 128 ) { @@ -2113,43 +2133,46 @@ int get_bsr_type (module_id_t module_idP, uint8_t eNB_index,frame_t frameP,uint1 which belong to any LCG and for which data is already available for transmission */ if (rlc_status.bytes_in_buffer > UE_mac_inst[module_idP].scheduling_info.LCID_buffer_remain[lcid]) { - bsr_group_id[UE_mac_inst[module_idP].scheduling_info.LCGID[lcid]] ++; + lcgid_have_bsr_report_flag[UE_mac_inst[module_idP].scheduling_info.LCGID[lcid]] = 1; new_data_arrived_flag = 1; - UE_mac_inst[module_idP].BSR_reporting_active[REGULAR_BSR] = 1; } } } -/* // one lcid buffer increased and all lcid buffer increased if ((new_data_arrived_flag == 1) && (pdu > UE_mac_inst[module_idP].scheduling_info.All_lcid_buffer_size_lastTTI)) { UE_mac_inst[module_idP].BSR_reporting_active[REGULAR_BSR] = 1; } -*/ - UE_mac_inst[module_idP].scheduling_info.All_lcid_buffer_size_lastTTI = pdu; - - /* or there is no data available for transmission for any of the logical channels which belong to a LCG, - in which case the BSR is referred below to as "Regular BSR" - if (pdu == 0) { + /* empty buffer, report 0 bsr reset eNB buffer + */ + if ((pdu == 0) && (UE_mac_inst[module_idP].scheduling_info.All_lcid_buffer_size_lastTTI > 0)) { UE_mac_inst[module_idP].BSR_reporting_active[REGULAR_BSR] = 1; } - */ - // computed how many LCG has data available for transmission + UE_mac_inst[module_idP].scheduling_info.All_lcid_buffer_size_lastTTI = pdu; + + // computed how many LCGID has data available for transmission for (lcgid=0; lcgid < MAX_NUM_LCGID; lcgid++ ) { - if (bsr_group_id[lcgid] > 0) { - lcg_report_num ++; - printf("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@lcgid bsr %d > 0\n",lcgid); + if (lcgid_have_bsr_report_flag[lcgid] == 1) { + num_lcg_id_with_data ++; + printf("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@lcgid %d have bsr report\n",lcgid); } } /* UL resources are allocated and number of padding bits is equal to or larger than the size of the Buffer Status Report MAC control element plus its subheader, in which case the BSR is referred below to as "Padding BSR" - */ if ((pdu > 0) && ((pdu+long_bsr_size) <= buflen)) { UE_mac_inst[module_idP].BSR_reporting_active[PADDING_BSR] = 1; } + */ + + if ((pdu+long_bsr_size) <= buflen) { + UE_mac_inst[module_idP].BSR_reporting_active[PADDING_BSR] = 0; + UE_mac_inst[module_idP].BSR_reporting_active[REGULAR_BSR] = 0; + UE_mac_inst[module_idP].BSR_reporting_active[REGULAR_BSR] = 0; + //printf("&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&ping test\n"); + } /* For Regular and Periodic BSR - if more than one LCG has data available for transmission in the TTI where the BSR is transmitted: report Long BSR; @@ -2157,7 +2180,7 @@ int get_bsr_type (module_id_t module_idP, uint8_t eNB_index,frame_t frameP,uint1 */ if ((UE_mac_inst[module_idP].BSR_reporting_active[REGULAR_BSR] == 1) || (UE_mac_inst[module_idP].BSR_reporting_active[PERIODIC_BSR] == 1)) { - if (lcg_report_num > 1) { + if (num_lcg_id_with_data > 1) { bsr_type = LONG_BSR; } else { bsr_type = SHORT_BSR; @@ -2172,13 +2195,13 @@ int get_bsr_type (module_id_t module_idP, uint8_t eNB_index,frame_t frameP,uint1 */ if (UE_mac_inst[module_idP].BSR_reporting_active[PADDING_BSR] == 1) { if (((pdu + short_bsr_size) <= buflen)&&(buflen<(pdu + long_bsr_size))) { - if (lcg_report_num > 1) { + if (num_lcg_id_with_data > 1) { bsr_type = TRUNCATED_BSR; } else { bsr_type = SHORT_BSR; } } else if ((pdu + long_bsr_size) <= buflen) { - if (lcg_report_num > 1) { + if (num_lcg_id_with_data > 1) { bsr_type = LONG_BSR; } else { bsr_type = SHORT_BSR; @@ -2189,7 +2212,7 @@ int get_bsr_type (module_id_t module_idP, uint8_t eNB_index,frame_t frameP,uint1 if ( bsr_type > 0 ) { LOG_I(MAC, "[UE %d] bsr_type %d (Transport Block Size %d, MAC pdu len %d) lcg_report_num %d\n", - module_idP, bsr_type, buflen, pdu, lcg_report_num); + module_idP, bsr_type, buflen, pdu, num_lcg_id_with_data); } return bsr_type; From 7f74065484a6f30e82116fc65e0931698b0cfb38 Mon Sep 17 00:00:00 2001 From: GabrirelCouturier Date: Fri, 18 Nov 2016 15:22:11 +0100 Subject: [PATCH 276/349] BSR fixes for ping --- openair2/LAYER2/MAC/ue_procedures.c | 162 +++++++++++++++++----------- 1 file changed, 102 insertions(+), 60 deletions(-) diff --git a/openair2/LAYER2/MAC/ue_procedures.c b/openair2/LAYER2/MAC/ue_procedures.c index 65bb4c09aa..cad41c86a5 100644 --- a/openair2/LAYER2/MAC/ue_procedures.c +++ b/openair2/LAYER2/MAC/ue_procedures.c @@ -1313,20 +1313,23 @@ void ue_get_sdu(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_t subf } if (num_lcg_id_with_data){ - LOG_I(MAC,"[UE %d] MAC Tx data pending at frame%d subframe %d nb LCG =%d LCG0 bytes=%d BSR Trigger status =%d TBS=%d\n", - module_idP, frameP, subframe, num_lcg_id_with_data, UE_mac_inst[module_idP].scheduling_info.BSR_bytes[0],UE_mac_inst[module_idP].BSR_reporting_active, buflen); + LOG_D(MAC,"[UE %d] MAC Tx data pending at frame%d subframe %d nb LCG =%d Bytes for LCG0=%d LCG1=%d LCG2=%d LCG3=%d BSR Trigger status =%d TBS=%d\n", + module_idP, + frameP, + subframe, + num_lcg_id_with_data, + UE_mac_inst[module_idP].scheduling_info.BSR_bytes[0], + UE_mac_inst[module_idP].scheduling_info.BSR_bytes[1], + UE_mac_inst[module_idP].scheduling_info.BSR_bytes[2], + UE_mac_inst[module_idP].scheduling_info.BSR_bytes[3], + UE_mac_inst[module_idP].BSR_reporting_active, buflen); } - // ReTxBSR-Timer expires, trigger BSR - if ((num_lcg_id_with_data) && (UE_mac_inst[module_idP].scheduling_info.retxBSR_SF == 0)){ - - // If the UE has data to transmit, trigger a BSR - UE_mac_inst[module_idP].BSR_reporting_active = 1; - - LOG_I(MAC,"[UE %d] MAC BSR Triggered ReTxBSR Timer expiry at frame%d subframe %d TBS=%d\n", - module_idP, frameP, subframe, buflen); - + //Restart ReTxBSR Timer at new grant indication (36.321) + if (UE_mac_inst[module_idP].scheduling_info.retxBSR_SF != MAC_UE_BSR_TIMER_NOT_RUNNING){ + UE_mac_inst[module_idP].scheduling_info.retxBSR_SF = get_sf_retxBSRTimer(UE_mac_inst[module_idP].scheduling_info.retxBSR_Timer); } + // periodicBSR-Timer expires, trigger BSR if ((UE_mac_inst[module_idP].scheduling_info.periodicBSR_Timer != MAC_MainConfig__ul_SCH_Config__periodicBSR_Timer_infinity) && (UE_mac_inst[module_idP].scheduling_info.periodicBSR_SF == 0)){ @@ -1342,6 +1345,17 @@ void ue_get_sdu(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_t subf if (UE_mac_inst[module_idP].BSR_reporting_active){ if (buflen >= 4){ if (num_lcg_id_with_data <= 1){ + + // If there are no data to transmit Set LCGID short to the group of the first DTCH configured else it will be SRB + if (num_lcg_id_with_data == 0) { + for (lcid=DTCH; lcid < MAX_NUM_LCID; lcid++) { + if (UE_mac_inst[module_idP].logicalChannelConfig[lcid] != NULL) { + lcg_id_bsr_short = UE_mac_inst[module_idP].scheduling_info.LCGID[lcid]; + break; + } + } + } + bsr_ce_len = sizeof(BSR_SHORT); //1 byte } else{ @@ -1417,31 +1431,33 @@ void ue_get_sdu(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_t subf DCCH, (buflen-dcch_header_len-bsr_len-phr_len)); LOG_D(MAC, "[UE %d] Frame %d : UL-DCCH -> ULSCH, RLC SRB1 has %d bytes to " - "send (Transport Block size %d BSR size=%d PHR=%d SDU Length Total %d , mac header len %d)\n", - module_idP,frameP, rlc_status.bytes_in_buffer,buflen,bsr_len,phr_len,sdu_length_total,dcch_header_len); + "send (Transport Block size %d BSR size=%d PHR=%d SDU Length Total %d , mac header len %d BSR byte before Tx=%d)\n", + module_idP,frameP, rlc_status.bytes_in_buffer,buflen,bsr_len,phr_len,sdu_length_total,dcch_header_len,UE_mac_inst[module_idP].scheduling_info.BSR_bytes[UE_mac_inst[module_idP].scheduling_info.LCGID[DCCH]]); - /* Update BSR : substract transmitted data */ - if (UE_mac_inst[module_idP].scheduling_info.BSR_bytes[UE_mac_inst[module_idP].scheduling_info.LCGID[DCCH]] >= rlc_status.bytes_in_buffer){ - UE_mac_inst[module_idP].scheduling_info.BSR_bytes[UE_mac_inst[module_idP].scheduling_info.LCGID[DCCH]] -= rlc_status.bytes_in_buffer; - } - else if (rlc_status.bytes_in_buffer){ - LOG_I(MAC, "[UE %d] Frame %d Subframe%d: WARNING Buffer occupancy =%d for LCGID%d is lower than data to transmit=%d for LCID%d\n", - module_idP,frameP,subframe, - UE_mac_inst[module_idP].scheduling_info.BSR_bytes[UE_mac_inst[module_idP].scheduling_info.LCGID[DCCH]], - UE_mac_inst[module_idP].scheduling_info.LCGID[DCCH], - rlc_status.bytes_in_buffer,DCCH); - UE_mac_inst[module_idP].scheduling_info.BSR_bytes[UE_mac_inst[module_idP].scheduling_info.LCGID[DCCH]] = 0; - } - sdu_lengths[0] += mac_rlc_data_req(module_idP, + sdu_lengths[0] += mac_rlc_data_req(module_idP, UE_mac_inst[module_idP].crnti, eNB_index, frameP, - ENB_FLAG_NO, + ENB_FLAG_NO, MBMS_FLAG_NO, DCCH, (char *)&ulsch_buff[sdu_lengths[0]]); + /* Update BSR : substract transmitted data */ + if (UE_mac_inst[module_idP].scheduling_info.BSR_bytes[UE_mac_inst[module_idP].scheduling_info.LCGID[DCCH]] >= sdu_lengths[0]){ + UE_mac_inst[module_idP].scheduling_info.BSR_bytes[UE_mac_inst[module_idP].scheduling_info.LCGID[DCCH]] -= sdu_lengths[0]; + } + else { + LOG_I(MAC, "[UE %d] Frame %d Subframe%d: WARNING Buffer occupancy =%d for LCGID%d is lower than data transmitted=%d for LCID%d\n", + module_idP,frameP,subframe, + UE_mac_inst[module_idP].scheduling_info.BSR_bytes[UE_mac_inst[module_idP].scheduling_info.LCGID[DCCH]], + UE_mac_inst[module_idP].scheduling_info.LCGID[DCCH], + sdu_lengths[0],DCCH); + UE_mac_inst[module_idP].scheduling_info.BSR_bytes[UE_mac_inst[module_idP].scheduling_info.LCGID[DCCH]] = 0; + } + + sdu_length_total += sdu_lengths[0]; sdu_lcids[0] = DCCH; LOG_D(MAC,"[UE %d] TX Multiplex RLC PDU TX Got %d bytes for SRB1\n",module_idP,sdu_lengths[0]); @@ -1473,23 +1489,10 @@ void ue_get_sdu(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_t subf (buflen-bsr_len-phr_len-dcch_header_len-dcch1_header_len-sdu_length_total)); LOG_D(MAC,"[UE %d] Frame %d subframe %d: UL-DCCH1 -> ULSCH, RLC SRB2 has %d bytes to" - " send (Transport Block size %d BSR size=%d PHR=%d SRB1 Hdr %d SDU Length Total %d , mac header len %d)\n", - module_idP,frameP, subframe, rlc_status.bytes_in_buffer,buflen,bsr_len,phr_len,dcch_header_len,sdu_length_total,dcch1_header_len); + " send (Transport Block size %d BSR size=%d PHR=%d SRB1 Hdr %d SDU Length Total %d , mac header len %d BSR byte before Tx=%d)\n", + module_idP,frameP, subframe, rlc_status.bytes_in_buffer,buflen,bsr_len,phr_len,dcch_header_len,sdu_length_total,dcch1_header_len,UE_mac_inst[module_idP].scheduling_info.BSR_bytes[UE_mac_inst[module_idP].scheduling_info.LCGID[DCCH1]]); - /* Update BSR : substract transmitted data */ - if (UE_mac_inst[module_idP].scheduling_info.BSR_bytes[UE_mac_inst[module_idP].scheduling_info.LCGID[DCCH1]] >= rlc_status.bytes_in_buffer){ - UE_mac_inst[module_idP].scheduling_info.BSR_bytes[UE_mac_inst[module_idP].scheduling_info.LCGID[DCCH1]] -= rlc_status.bytes_in_buffer; - } - else if (rlc_status.bytes_in_buffer){ - LOG_I(MAC, "[UE %d] Frame %d Subframe%d: WARNING Buffer occupancy =%d for LCGID%d is lower than data to transmit=%d for LCID%d\n", - module_idP,frameP,subframe, - UE_mac_inst[module_idP].scheduling_info.BSR_bytes[UE_mac_inst[module_idP].scheduling_info.LCGID[DCCH1]], - UE_mac_inst[module_idP].scheduling_info.LCGID[DCCH1], - rlc_status.bytes_in_buffer,DCCH1); - UE_mac_inst[module_idP].scheduling_info.BSR_bytes[UE_mac_inst[module_idP].scheduling_info.LCGID[DCCH1]] = 0; - } - - sdu_lengths[num_sdus] = mac_rlc_data_req(module_idP, + sdu_lengths[num_sdus] = mac_rlc_data_req(module_idP, UE_mac_inst[module_idP].crnti, eNB_index, frameP, @@ -1497,6 +1500,20 @@ void ue_get_sdu(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_t subf MBMS_FLAG_NO, DCCH1, (char *)&ulsch_buff[sdu_lengths[num_sdus]]); + + /* Update BSR : substract transmitted data */ + if (UE_mac_inst[module_idP].scheduling_info.BSR_bytes[UE_mac_inst[module_idP].scheduling_info.LCGID[DCCH1]] >= sdu_lengths[num_sdus]){ + UE_mac_inst[module_idP].scheduling_info.BSR_bytes[UE_mac_inst[module_idP].scheduling_info.LCGID[DCCH1]] -= sdu_lengths[num_sdus]; + } + else { + LOG_I(MAC, "[UE %d] Frame %d Subframe%d: WARNING Buffer occupancy =%d for LCGID%d is lower than data transmitted=%d for LCID%d\n", + module_idP,frameP,subframe, + UE_mac_inst[module_idP].scheduling_info.BSR_bytes[UE_mac_inst[module_idP].scheduling_info.LCGID[DCCH1]], + UE_mac_inst[module_idP].scheduling_info.LCGID[DCCH1], + sdu_lengths[num_sdus],DCCH1); + UE_mac_inst[module_idP].scheduling_info.BSR_bytes[UE_mac_inst[module_idP].scheduling_info.LCGID[DCCH1]] = 0; + } + sdu_length_total += sdu_lengths[num_sdus]; sdu_lcids[num_sdus] = DCCH1; LOG_D(MAC,"[UE %d] TX Multiplex RLC PDU Got %d bytes for SRB2\n",module_idP,sdu_lengths[num_sdus]); @@ -1513,7 +1530,7 @@ void ue_get_sdu(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_t subf dtch_header_len=0; dtch_header_len_last=0; - for (lcid=NB_RB_MAX-1; lcid>=DTCH ; lcid--){ + for (lcid=MAX_NUM_LCID-1; lcid>=DTCH ; lcid--){ dtch_header_len+=3; dtch_header_len_last=3; @@ -1521,6 +1538,8 @@ void ue_get_sdu(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_t subf if ((UE_mac_inst[module_idP].scheduling_info.LCID_status[lcid] == LCID_NOT_EMPTY) && (all_pdu_len <= buflen)) { + AssertFatal (UE_mac_inst[module_idP].logicalChannelConfig[lcid] != NULL, "LCID (%d) is not active!\n", lcid); + // optimize the dtch header lenght //if ((UE_mac_inst[module_idP].scheduling_info.BSR_bytes[DTCH] > 128) && /* if (((UE_mac_inst[module_idP].scheduling_info.BSR_bytes[DTCH] >= 128) && @@ -1539,23 +1558,10 @@ void ue_get_sdu(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_t subf lcid, buflen-all_pdu_len); - LOG_D(MAC,"[UE %d] Frame %d : UL-DTCH -> ULSCH%d, %d bytes to send (Transport Block size %d, mac header len %d, BSR byte[%d] %d)\n", - module_idP,frameP, lcid, rlc_status.bytes_in_buffer,buflen,dtch_header_len, - lcid, UE_mac_inst[module_idP].scheduling_info.BSR_bytes[UE_mac_inst[module_idP].scheduling_info.LCGID[lcid]]); + LOG_D(MAC,"[UE %d] Frame %d subframe %d: UL-DTCH -> ULSCH%d, %d bytes to send (Transport Block size %d, mac header len %d, BSR byte before Tx=%d)\n", + module_idP,frameP, subframe,lcid, rlc_status.bytes_in_buffer,buflen,dtch_header_len, UE_mac_inst[module_idP].scheduling_info.BSR_bytes[UE_mac_inst[module_idP].scheduling_info.LCGID[lcid]]); if (rlc_status.bytes_in_buffer > 0) { - /* Update BSR : substract transmitted data */ - if (UE_mac_inst[module_idP].scheduling_info.BSR_bytes[UE_mac_inst[module_idP].scheduling_info.LCGID[lcid]] >= rlc_status.bytes_in_buffer){ - UE_mac_inst[module_idP].scheduling_info.BSR_bytes[UE_mac_inst[module_idP].scheduling_info.LCGID[lcid]] -= rlc_status.bytes_in_buffer; - } - else { - LOG_I(MAC, "[UE %d] Frame %d Subframe%d: WARNING Buffer occupancy =%d for LCGID%d is lower than data to transmit=%d for LCID%d\n", - module_idP,frameP,subframe, - UE_mac_inst[module_idP].scheduling_info.BSR_bytes[UE_mac_inst[module_idP].scheduling_info.LCGID[lcid]], - UE_mac_inst[module_idP].scheduling_info.LCGID[lcid], - rlc_status.bytes_in_buffer,lcid); - UE_mac_inst[module_idP].scheduling_info.BSR_bytes[UE_mac_inst[module_idP].scheduling_info.LCGID[lcid]] = 0; - } sdu_lengths[num_sdus] = mac_rlc_data_req(module_idP, UE_mac_inst[module_idP].crnti, @@ -1566,8 +1572,21 @@ void ue_get_sdu(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_t subf lcid, (char *)&ulsch_buff[sdu_length_total]); + /* Update BSR : substract transmitted data */ + if (UE_mac_inst[module_idP].scheduling_info.BSR_bytes[UE_mac_inst[module_idP].scheduling_info.LCGID[lcid]] >= sdu_lengths[num_sdus]){ + UE_mac_inst[module_idP].scheduling_info.BSR_bytes[UE_mac_inst[module_idP].scheduling_info.LCGID[lcid]] -= sdu_lengths[num_sdus]; + } + else { + LOG_I(MAC, "[UE %d] Frame %d Subframe %d: WARNING Buffer occupancy =%d for LCGID%d is lower than data transmitted=%d for LCID%d\n", + module_idP,frameP,subframe, + UE_mac_inst[module_idP].scheduling_info.BSR_bytes[UE_mac_inst[module_idP].scheduling_info.LCGID[lcid]], + UE_mac_inst[module_idP].scheduling_info.LCGID[lcid], + sdu_lengths[num_sdus],lcid); + UE_mac_inst[module_idP].scheduling_info.BSR_bytes[UE_mac_inst[module_idP].scheduling_info.LCGID[lcid]] = 0; + } + //adjust dtch header - LOG_D(MAC,"[UE %d] TX Got %d bytes for DTCH\n",module_idP,sdu_lengths[num_sdus]); + LOG_D(MAC,"[UE %d] Frame %d Subframe %d TX Got %d bytes for DTCH%d New BSR bytes=%d\n",module_idP,frameP,subframe,sdu_lengths[num_sdus],lcid,UE_mac_inst[module_idP].scheduling_info.BSR_bytes[UE_mac_inst[module_idP].scheduling_info.LCGID[lcid]]); sdu_lcids[num_sdus] = lcid; sdu_length_total += sdu_lengths[num_sdus]; if (sdu_lengths[num_sdus] < 128) { @@ -1595,6 +1614,15 @@ void ue_get_sdu(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_t subf UE_mac_inst[module_idP].scheduling_info.BSR[lcg_id] = locate_BsrIndexByBufferSize(BSR_TABLE, BSR_TABLE_SIZE, UE_mac_inst[module_idP].scheduling_info.BSR_bytes[lcg_id]); } + if (bsr_ce_len) { + //Print updated BSR when sent + LOG_D(MAC,"[UE %d] Frame %d Subframe %d TX BSR size=%d BSR0=%d BSR1=%d BSR2=%d BSR3=%d\n",module_idP,frameP,subframe,bsr_ce_len, + UE_mac_inst[module_idP].scheduling_info.BSR[0], + UE_mac_inst[module_idP].scheduling_info.BSR[1], + UE_mac_inst[module_idP].scheduling_info.BSR[2], + UE_mac_inst[module_idP].scheduling_info.BSR[3]); + } + if (bsr_ce_len == 0 ) { bsr_s = NULL; bsr_l = NULL ; @@ -1751,6 +1779,8 @@ ue_scheduler( // int8_t lcg_id; struct RACH_ConfigCommon *rach_ConfigCommon = (struct RACH_ConfigCommon *)NULL; protocol_ctxt_t ctxt; + int num_lcid_with_data = 0; + #if defined(ENABLE_ITTI) MessageDef *msg_p; const char *msg_name; @@ -1931,6 +1961,8 @@ ue_scheduler( } if (update_bsr(module_idP,frameP, eNB_indexP, lcid, UE_mac_inst[module_idP].scheduling_info.LCGID[lcid])) { + // TO DO: implement first BSR trigger criteria based on new data become available + num_lcid_with_data ++; UE_mac_inst[module_idP].scheduling_info.SR_pending= 1; // Regular BSR trigger UE_mac_inst[module_idP].BSR_reporting_active = 1; @@ -1942,6 +1974,16 @@ ue_scheduler( } } + // Trigger Regular BSR if ReTxBSR Timer has expired and UE has data for transmission + if ((num_lcid_with_data) && (UE_mac_inst[module_idP].scheduling_info.retxBSR_SF == 0)) { + + UE_mac_inst[module_idP].BSR_reporting_active = 1; + + LOG_D(MAC,"[UE %d] PDCCH Tick : MAC BSR Triggered ReTxBSR Timer expiry at frame %d subframe %d\n", + module_idP, frameP, subframeP); + + } + // UE has no valid phy config dedicated || no valid/released SR if ((UE_mac_inst[module_idP].physicalConfigDedicated == NULL)) { // cancel all pending SRs From 12f1cb9c7ceb53c9b4f2a9c50427a9d2a66b7a04 Mon Sep 17 00:00:00 2001 From: Florian Kaltenberger Date: Fri, 18 Nov 2016 16:23:01 +0100 Subject: [PATCH 277/349] fixing original dlsim from develop --- cmake_targets/CMakeLists.txt | 3 ++- openair1/PHY/MODULATION/defs.h | 2 +- openair1/PHY/MODULATION/ofdm_mod.c | 2 +- openair1/SIMULATION/LTE_PHY/dlsim.c | 32 ++++++++++++++++--------- openair1/SIMULATION/LTE_PHY/dlsim_tm7.c | 4 ++-- targets/RT/USER/lte-enb.c | 4 ++-- 6 files changed, 29 insertions(+), 18 deletions(-) diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index 0619d4af7f..3f3b4f2fbe 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -1840,7 +1840,7 @@ target_link_libraries (oaisim_nos1 ${T_LIB}) # Unitary tests for each piece of L1: example, mbmssim is MBMS L1 simulator ##################################### -foreach(myExe dlsim_tm7 ulsim pbchsim scansim mbmssim pdcchsim pucchsim prachsim syncsim) +foreach(myExe dlsim dlsim_tm7 ulsim pbchsim scansim mbmssim pdcchsim pucchsim prachsim syncsim) add_executable(${myExe} ${OPENAIR_BIN_DIR}/messages_xml.h ${OPENAIR1_DIR}/SIMULATION/LTE_PHY/${myExe}.c @@ -1920,6 +1920,7 @@ if (${T_TRACER}) add_dependencies(rrh_gw generate_T) add_dependencies(oaisim generate_T) add_dependencies(oaisim_nos1 generate_T) + add_dependencies(dlsim generate_T) add_dependencies(dlsim_tm7 generate_T) add_dependencies(ulsim generate_T) add_dependencies(pbchsim generate_T) diff --git a/openair1/PHY/MODULATION/defs.h b/openair1/PHY/MODULATION/defs.h index ce73d0461d..289b1edd43 100644 --- a/openair1/PHY/MODULATION/defs.h +++ b/openair1/PHY/MODULATION/defs.h @@ -82,7 +82,7 @@ void normal_prefix_mod(int32_t *txdataF,int32_t *txdata,uint8_t nsymb,LTE_DL_FRA void do_OFDM_mod(int32_t **txdataF, int32_t **txdata, uint32_t frame,uint16_t next_slot, LTE_DL_FRAME_PARMS *frame_parms); -void do_OFDM_mod_l(LTE_eNB_COMMON *eNB_common_vars, int eNB_id, uint16_t next_slot, LTE_DL_FRAME_PARMS *frame_parms); +void do_OFDM_mod_symbol(LTE_eNB_COMMON *eNB_common_vars, int eNB_id, uint16_t next_slot, LTE_DL_FRAME_PARMS *frame_parms); void remove_7_5_kHz(PHY_VARS_eNB *phy_vars_eNB,uint8_t subframe); diff --git a/openair1/PHY/MODULATION/ofdm_mod.c b/openair1/PHY/MODULATION/ofdm_mod.c index 6a4e72180b..2fd7fd88a3 100644 --- a/openair1/PHY/MODULATION/ofdm_mod.c +++ b/openair1/PHY/MODULATION/ofdm_mod.c @@ -285,7 +285,7 @@ void do_OFDM_mod(int32_t **txdataF, int32_t **txdata, uint32_t frame,uint16_t ne } // OFDM modulation for each symbol -void do_OFDM_mod_l(LTE_eNB_COMMON *eNB_common_vars, int eNB_id, uint16_t next_slot, LTE_DL_FRAME_PARMS *frame_parms) +void do_OFDM_mod_symbol(LTE_eNB_COMMON *eNB_common_vars, int eNB_id, uint16_t next_slot, LTE_DL_FRAME_PARMS *frame_parms) { int aa, l, slot_offset; diff --git a/openair1/SIMULATION/LTE_PHY/dlsim.c b/openair1/SIMULATION/LTE_PHY/dlsim.c index 40faf1049f..2e9a04def3 100644 --- a/openair1/SIMULATION/LTE_PHY/dlsim.c +++ b/openair1/SIMULATION/LTE_PHY/dlsim.c @@ -403,7 +403,8 @@ void fill_DCI(PHY_VARS_eNB *eNB, SI_RNTI, 0, P_RNTI, - eNB->UE_stats[0].DL_pmi_single); + eNB->UE_stats[0].DL_pmi_single, + transmission_mode>=7?transmission_mode:0); *num_dci = *num_dci+1; *num_ue_spec_dci = *num_ue_spec_dci+1; @@ -543,7 +544,8 @@ void fill_DCI(PHY_VARS_eNB *eNB, SI_RNTI, 0, P_RNTI, - eNB->UE_stats[0].DL_pmi_single); + eNB->UE_stats[0].DL_pmi_single, + transmission_mode>=7?transmission_mode:0); *num_common_dci=*num_common_dci+1; *num_dci = *num_dci + 1; @@ -710,7 +712,8 @@ void fill_DCI(PHY_VARS_eNB *eNB, SI_RNTI, 0, P_RNTI, - eNB->UE_stats[0].DL_pmi_single); + eNB->UE_stats[0].DL_pmi_single, + transmission_mode>=7?transmission_mode:0); *num_dci = *num_dci + 1; *num_ue_spec_dci = *num_ue_spec_dci + 1; @@ -850,7 +853,8 @@ void fill_DCI(PHY_VARS_eNB *eNB, SI_RNTI, 0, P_RNTI, - eNB->UE_stats[0].DL_pmi_single); + eNB->UE_stats[0].DL_pmi_single, + transmission_mode>=7?transmission_mode:0); *num_common_dci = *num_common_dci + 1; *num_dci = *num_dci + 1; @@ -1018,7 +1022,8 @@ void fill_DCI(PHY_VARS_eNB *eNB, SI_RNTI, 0, P_RNTI, - eNB->UE_stats[0].DL_pmi_single); + eNB->UE_stats[0].DL_pmi_single, + transmission_mode>=7?transmission_mode:0); *num_dci = *num_dci + 1; *num_ue_spec_dci = *num_ue_spec_dci + 1; @@ -1158,7 +1163,8 @@ void fill_DCI(PHY_VARS_eNB *eNB, SI_RNTI, 0, P_RNTI, - eNB->UE_stats[0].DL_pmi_single); + eNB->UE_stats[0].DL_pmi_single, + transmission_mode>=7?transmission_mode:0); *num_common_dci = *num_common_dci + 1; *num_dci = *num_dci + 1; @@ -1187,7 +1193,8 @@ void fill_DCI(PHY_VARS_eNB *eNB, SI_RNTI, 0, P_RNTI, - eNB->UE_stats[k].DL_pmi_single); + eNB->UE_stats[k].DL_pmi_single, + transmission_mode>=7?transmission_mode:0); dump_dci(&eNB->frame_parms,&dci_alloc[*num_dci]); *num_ue_spec_dci = *num_ue_spec_dci + 1; @@ -1762,7 +1769,8 @@ int main(int argc, char **argv) printf("dual_stream_UE=%d\n", dual_stream_UE); } - lte_param_init(n_tx, + lte_param_init(transmission_mode==1?1:2, + n_tx, n_rx, transmission_mode, extended_prefix_flag, @@ -2042,7 +2050,7 @@ int main(int argc, char **argv) for (k=0; kdlsch[k][i] = new_eNB_dlsch(Kmimo,8,Nsoft,N_RB_DL,0); + eNB->dlsch[k][i] = new_eNB_dlsch(Kmimo,8,Nsoft,N_RB_DL,0,&eNB->frame_parms); if (!eNB->dlsch[k][i]) { printf("Can't get eNB dlsch structures\n"); @@ -2065,7 +2073,7 @@ int main(int argc, char **argv) } // structure for SIC at UE - UE->dlsch_eNB[0] = new_eNB_dlsch(Kmimo,8,Nsoft,N_RB_DL,0); + UE->dlsch_eNB[0] = new_eNB_dlsch(Kmimo,8,Nsoft,N_RB_DL,0,&eNB->frame_parms); if (DLSCH_alloc_pdu2_1E[0].tpmi == 5) { @@ -2159,7 +2167,9 @@ int main(int argc, char **argv) get_Qm(eNB->dlsch[0][0]->harq_processes[0]->mcs), eNB->dlsch[0][0]->harq_processes[0]->Nl, num_pdcch_symbols, - 0,subframe); + 0, + subframe, + transmission_mode>=7?transmission_mode:0); uncoded_ber_bit = (short*) malloc(sizeof(short)*coded_bits_per_codeword); printf("uncoded_ber_bit=%p\n",uncoded_ber_bit); diff --git a/openair1/SIMULATION/LTE_PHY/dlsim_tm7.c b/openair1/SIMULATION/LTE_PHY/dlsim_tm7.c index 691287171f..0d5dcd63ce 100644 --- a/openair1/SIMULATION/LTE_PHY/dlsim_tm7.c +++ b/openair1/SIMULATION/LTE_PHY/dlsim_tm7.c @@ -2830,12 +2830,12 @@ PMI_FEEDBACK: } */ - do_OFDM_mod_l(&eNB->common_vars, + do_OFDM_mod_symbol(&eNB->common_vars, eNB_id, (subframe*2), &eNB->frame_parms); - do_OFDM_mod_l(&eNB->common_vars, + do_OFDM_mod_symbol(&eNB->common_vars, eNB_id, (subframe*2)+1, &eNB->frame_parms); diff --git a/targets/RT/USER/lte-enb.c b/targets/RT/USER/lte-enb.c index 7d50da5ddc..af06979efd 100644 --- a/targets/RT/USER/lte-enb.c +++ b/targets/RT/USER/lte-enb.c @@ -295,14 +295,14 @@ void do_OFDM_mod_rt(int subframe,PHY_VARS_eNB *phy_vars_eNB) VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_OFDM_MODULATION,1); - do_OFDM_mod_l(&phy_vars_eNB->lte_eNB_common_vars, + do_OFDM_mod_symbol(&phy_vars_eNB->lte_eNB_common_vars, 0, subframe<<1, &phy_vars_eNB->lte_frame_parms); // if S-subframe generate first slot only if (subframe_select(&phy_vars_eNB->lte_frame_parms,subframe) == SF_DL) { - do_OFDM_mod_l(&phy_vars_eNB->lte_eNB_common_vars, + do_OFDM_mod_symbol(&phy_vars_eNB->lte_eNB_common_vars, 0, 1+(subframe<<1), &phy_vars_eNB->lte_frame_parms); From 0b1050c14934a6a2fda7d95f2549ff1f44c951fb Mon Sep 17 00:00:00 2001 From: ROBERT Benoit Date: Fri, 18 Nov 2016 18:31:57 +0100 Subject: [PATCH 278/349] Add following functionnalities to OAI UE autotest framework - add progess bar report - reduce ssh max_tries to 10 - cleanOldPrograms -> change kill cmd line to be able to run autotest on same machine than lte-softmodem (thanks Rohit & Gabriel) - Cleanning output prints - add --skip-machine-preparation on cmd line - add --skip-sanity-check on cmd line - add HTML REPORT (no-S1 only) - add XML detailled report (no-S1 only) --- cmake_targets/CMakeLists.txt | 1 + cmake_targets/autotests/openair.py | 10 +- .../3gpplte_turbo_decoder_sse_8bit.patch | 25 - .../autotest_ue_cell_synch_event.patch | 16 +- .../patches/phy_test__target_dl_mcs.patch | 17 - .../autotests/run_exec_lte-softmodem_tests.py | 925 ++++-- .../autotests/run_lte-softmodem-nos1_tests.py | 754 ++--- cmake_targets/autotests/testsuite_ue_noS1.xml | 2898 +++++++++++++++++ .../autotests/tools/autotest_analyser.py | 125 +- .../autotests/tools/lib_autotest_analyser.py | 164 +- cmake_targets/build_oai | 8 + .../CODING/3gpplte_turbo_decoder_sse_8bit.c | 7 +- openair1/PHY/LTE_TRANSPORT/initial_sync.c | 9 + openair1/SCHED/phy_procedures_lte_ue.c | 7 + targets/RT/USER/lte-softmodem.c | 5 + 15 files changed, 4082 insertions(+), 889 deletions(-) delete mode 100644 cmake_targets/autotests/patches/3gpplte_turbo_decoder_sse_8bit.patch delete mode 100644 cmake_targets/autotests/patches/phy_test__target_dl_mcs.patch create mode 100644 cmake_targets/autotests/testsuite_ue_noS1.xml diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index 3169c6cc98..eaf541713f 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -235,6 +235,7 @@ add_boolean_option(DEBUG_OMG False "???") add_boolean_option(XFORMS False "This adds the possibility to see the signal oscilloscope") add_boolean_option(PRINT_STATS False "This adds the possibility to see the status") add_boolean_option(T_TRACER False "Activate the T tracer, a debugging/monitoring framework" ) +add_boolean_option(UE_AUTOTEST_TRACE False "Activate UE autotest specific logs") add_boolean_option(DEBUG_CONSOLE False "makes debugging easier, disables stdout/stderr buffering") diff --git a/cmake_targets/autotests/openair.py b/cmake_targets/autotests/openair.py index 5cea3aa121..7ad118ef1b 100644 --- a/cmake_targets/autotests/openair.py +++ b/cmake_targets/autotests/openair.py @@ -75,7 +75,7 @@ class openair(core): return (stdout, stderr) def connect(self, username, password, prompt='PEXPECT_OAI'): - max_retries=100 + max_retries=10 i=0 while i <= max_retries: self.prompt1 = prompt @@ -97,9 +97,9 @@ class openair(core): # need to look for twice the string of the prompt self.oai.prompt() self.oai.prompt() - self.oai.sendline('uptime') - self.oai.prompt() - print self.oai.before +# self.oai.sendline('uptime') +# self.oai.prompt() +# print self.oai.before break except Exception, e: error='' @@ -171,7 +171,7 @@ class openair(core): sys.exit(1) def disconnect(self): - print 'disconnecting the ssh connection to ' + self.address + '\n' +# print 'disconnecting the ssh connection to ' + self.address + '\n' self.oai.send('exit') # self.cancel() diff --git a/cmake_targets/autotests/patches/3gpplte_turbo_decoder_sse_8bit.patch b/cmake_targets/autotests/patches/3gpplte_turbo_decoder_sse_8bit.patch deleted file mode 100644 index 957778f332..0000000000 --- a/cmake_targets/autotests/patches/3gpplte_turbo_decoder_sse_8bit.patch +++ /dev/null @@ -1,25 +0,0 @@ -diff --git a/openair1/PHY/CODING/3gpplte_turbo_decoder_sse_8bit.c b/openair1/PHY/CODING/3gpplte_turbo_decoder_sse_8bit.c -index d2c7ac6..0853373 100644 ---- a/openair1/PHY/CODING/3gpplte_turbo_decoder_sse_8bit.c -+++ b/openair1/PHY/CODING/3gpplte_turbo_decoder_sse_8bit.c -@@ -493,7 +493,7 @@ void compute_beta8(llr_t* alpha,llr_t* beta,llr_t *m_11,llr_t* m_10,unsigned sho - - #endif - -- if (frame_length > 6143) { -+ if (frame_length > 6144) { - LOG_E(PHY,"compute_beta: frame_length %d\n",frame_length); - return; - } -@@ -979,6 +979,11 @@ unsigned char phy_threegpplte_turbo_decoder8(short *y, - } else - n2 = n; - -+ if(n2<256) -+ { -+ printf("phy_threegpplte_turbo_decoder8 : frame length < 256\n"); -+ return 255; -+ } - - for (iind=0; iind < 188 && f1f2mat[iind].nb_bits != n; iind++); - diff --git a/cmake_targets/autotests/patches/autotest_ue_cell_synch_event.patch b/cmake_targets/autotests/patches/autotest_ue_cell_synch_event.patch index 8c80d55871..33f5ac339f 100644 --- a/cmake_targets/autotests/patches/autotest_ue_cell_synch_event.patch +++ b/cmake_targets/autotests/patches/autotest_ue_cell_synch_event.patch @@ -1,17 +1,19 @@ diff --git a/openair1/PHY/LTE_TRANSPORT/initial_sync.c b/openair1/PHY/LTE_TRANSPORT/initial_sync.c -index 71372d9..763397b 100644 +index 661fe96..782305d 100644 --- a/openair1/PHY/LTE_TRANSPORT/initial_sync.c +++ b/openair1/PHY/LTE_TRANSPORT/initial_sync.c -@@ -477,6 +477,13 @@ int initial_sync(PHY_VARS_UE *ue, runmode_t mode) +@@ -469,6 +469,15 @@ int initial_sync(PHY_VARS_UE *ue, runmode_t mode) //#endif if (ue->UE_scan_carrier == 0) { + -+ /* SYRTEM */ -+ printf("AUTOTEST Cell Sync : frame = %d, rx_offset %d, freq_offset %d \n", -+ ue->proc.proc_rxtx[0].frame_rx, -+ ue->rx_offset, -+ ue->common_vars.freq_offset ); ++ #if UE_AUTOTEST_TRACE ++ LOG_I(PHY,"[UE %d] AUTOTEST Cell Sync : frame = %d, rx_offset %d, freq_offset %d \n", ++ ue->Mod_id, ++ ue->proc.proc_rxtx[0].frame_rx, ++ ue->rx_offset, ++ ue->common_vars.freq_offset ); ++ #endif + if (ue->mac_enabled==1) { LOG_I(PHY,"[UE%d] Sending synch status to higher layers\n",ue->Mod_id); diff --git a/cmake_targets/autotests/patches/phy_test__target_dl_mcs.patch b/cmake_targets/autotests/patches/phy_test__target_dl_mcs.patch deleted file mode 100644 index ec8c43cb72..0000000000 --- a/cmake_targets/autotests/patches/phy_test__target_dl_mcs.patch +++ /dev/null @@ -1,17 +0,0 @@ - -diff --git a/targets/RT/USER/lte-softmodem.c b/targets/RT/USER/lte-softmodem.c -index 96645f8..a7f1dfb 100644 ---- a/targets/RT/USER/lte-softmodem.c -+++ b/targets/RT/USER/lte-softmodem.c -@@ -1602,6 +1602,11 @@ int main( int argc, char **argv ) - PHY_vars_eNB_g[0][CC_id] = init_lte_eNB(frame_parms[CC_id],0,frame_parms[CC_id]->Nid_cell,abstraction_flag); - PHY_vars_eNB_g[0][CC_id]->CC_id = CC_id; - -+ PHY_vars_eNB_g[0][CC_id]->ue_dl_rb_alloc=0x1fff; -+ PHY_vars_eNB_g[0][CC_id]->target_ue_dl_mcs=target_dl_mcs; -+ PHY_vars_eNB_g[0][CC_id]->ue_ul_nb_rb=6; -+ PHY_vars_eNB_g[0][CC_id]->target_ue_ul_mcs=target_ul_mcs; -+ - if (phy_test==1) PHY_vars_eNB_g[0][CC_id]->mac_enabled = 0; - else PHY_vars_eNB_g[0][CC_id]->mac_enabled = 1; - diff --git a/cmake_targets/autotests/run_exec_lte-softmodem_tests.py b/cmake_targets/autotests/run_exec_lte-softmodem_tests.py index 796235a77f..69a3eab7c5 100755 --- a/cmake_targets/autotests/run_exec_lte-softmodem_tests.py +++ b/cmake_targets/autotests/run_exec_lte-softmodem_tests.py @@ -20,10 +20,14 @@ # * contact@openairinterface.org # */ -# \author Rohit Gupta +# \author Rohit Gupta - Benoit ROBERT (benoit.robert@syrtem.com) # \version 0.1 # @ingroup _test +# \Changelog +# 2016-11-18 : +# - Add progess bar during test execution update_progress() + import tempfile import threading import sys @@ -37,6 +41,8 @@ import math #from time import clock import xml.etree.ElementTree as ET import re +#from dict2xml import dict2xml as xmlify + from colorama import Fore, Back, Style import numpy as np @@ -57,6 +63,36 @@ import ssh from ssh import SSHSession import argparse + +# update_progress() : Displays or updates a console progress bar +## Accepts a float between 0 and 1. Any int will be converted to a float. +## A value under 0 represents a 'halt'. +## A value at 1 or bigger represents 100% +def update_progress(progress, prefix_string): + barLength = 20 # Modify this to change the length of the progress bar + status = "" + #print "progress = "+ str(progress) + if isinstance(progress, int): + progress = float(progress) + if not isinstance(progress, float): + progress = 0 + status = "error: progress var must be float\r\n" + if progress < 0: + progress = 0 + status = "Halt...\r\n" + if progress >= 1: + progress = 1 + status = "Done...\r\n" + block = int(round(barLength*progress)) + text = "\r"+prefix_string+" [{0}] {1}% {2}".format( "="*block + " "*(barLength-block), progress*100, status) + sys.stdout.write(text) + sys.stdout.flush() + + +def exit_prog(exit_val): + print(Style.RESET_ALL), + sys.exit(exit_val) + # \brief write a string to a file # \param filename name of file # \param string string to write @@ -271,7 +307,7 @@ def update_config_file(oai, config_string, logdirRepo, python_script): # \param logdir_local_base local directory # \param operation operation to perform (get_all, put_all) transfers recursively for directories def SSHSessionWrapper(machine, username, key_file, password, logdir_remote, logdir_local_base, operation): - max_tries = 100 + max_tries = 10 i=0 while i <= max_tries: i = i +1 @@ -306,30 +342,50 @@ def SSHSessionWrapper(machine, username, key_file, password, logdir_remote, logd # \param CleanUpAluLteBox program to terminate AlU Bell Labs LTE Box # \param ExmimoRfStop String to stop EXMIMO card (specified in test_case_list.xml) def cleanOldPrograms(oai, programList, CleanUpAluLteBox, ExmimoRfStop, logdir, logdirOAI5GRepo): - cmd = 'sudo -E killall -s INT -q -r ' + programList + ' ; sleep 5 ; sudo -E killall -9 -q -r ' + programList + cmd = 'killall -9 ' + programList result = oai.send(cmd, True) - print "Killing old programs..." + result +# print "\t\t > "+cmd +# print "\t\t < "+result + +# print "Killing old programs on ..." + result programArray = programList.split() programListJoin = '|'.join(programArray) cmd = " ( date ;echo \"Starting cleaning old programs.. \" ; dmesg|tail ; echo \"Current disk space.. \" ; df -h )>& " + logdir + "/oai_test_setup_cleanup.log.`hostname` 2>&1 ; sync" result=oai.send_recv(cmd) +# print "\t\t > "+cmd +# print "\t\t < "+result + cmd = cleanupOldProgramsScript + ' ' + '\''+programListJoin+'\'' #result = oai.send_recv(cmd) #print result result = oai.send_expect_false(cmd, 'Match found', False) - print "Looking for old programs..." + result +# print "\t\t > "+cmd +# print "\t\t < "+result + +# print "Looking for old programs..." + result res=oai.send_recv(CleanUpAluLteBox, True) +# print "\t\t > "+CleanUpAluLteBox +# print "\t\t < "+res cmd= " echo \"Starting EXmimoRF Stop... \" >> " + logdir + "/oai_test_setup_cleanup.log.`hostname` 2>&1 ; sync "; - oai.send_recv(cmd) + result = oai.send_recv(cmd) +# print "\t\t > "+cmd +# print "\t\t < "+result cmd = "( " + "cd " + logdirOAI5GRepo + " ; source oaienv ; " + ExmimoRfStop + " ) >> " + logdir + "/oai_test_setup_cleanup.log.`hostname` 2>&1 ; sync " - print "cleanoldprograms cmd = " + cmd +# print "cleanoldprograms cmd = " + cmd res=oai.send_recv(cmd, False, timeout=600) +# print "\t\t > "+cmd +# print "\t\t < "+res + cmd= " echo \"Stopping EXmimoRF Stop... \" >> " + logdir + "/oai_test_setup_cleanup.log.`hostname` 2>&1 ; sync "; - oai.send_recv(cmd) + result = oai.send_recv(cmd) +# print "\t\t > "+cmd +# print "\t\t < "+result #res = oai.send_recv(ExmimoRfStop, False) cmd = " ( date ;echo \"Finished cleaning old programs.. \" ; dmesg | tail)>> $HOME/.oai_test_setup_cleanup.log.`hostname` 2>&1 ; sync" res=oai.send_recv(cmd) +# print "\t\t > "+cmd +# print "\t\t < "+res # \brief Class thread to launch a generic command on remote machine # \param threadID number of thread (for book keeping) @@ -355,10 +411,10 @@ class oaiThread (threading.Thread): try: oai = openair('localdomain',self.machine) oai.connect(self.username, self.password) - print "Starting " + self.threadname + " on machine " + self.machine + # print "Starting " + self.threadname + " on machine " + self.machine result = oai.send_recv(self.cmd, self.sudo, self.timeout) - print "result = " + result - print "Exiting " + self.threadname + #print "result = " + result + #print "Exiting " + self.threadname oai.disconnect() except Exception, e: error='' @@ -1262,6 +1318,8 @@ def handle_testcaseclass_softmodem_noS1 (testcase, oldprogramList, logdirOAI5GRe if testcase_verdict != 'PASS': # if something went wrong to not run test cases max_ntries=0 + indent="\t\t" + runs_results = [] nb_runs = 0 nb_run_pass = 0 @@ -1281,9 +1339,11 @@ def handle_testcaseclass_softmodem_noS1 (testcase, oldprogramList, logdirOAI5GRe # # RUN initialization # ---------------------------------------------------- - print (Fore.WHITE + indent + "> RUN_"+str(run).zfill(2)+" : " ), - - sys.stdout.flush() + + prefix_string = Fore.WHITE + indent + "> RUN_"+str(run).zfill(2)+" :" + +# print (Fore.WHITE + indent + "> RUN_"+str(run).zfill(2)+" : " ), +# sys.stdout.flush() run_start_time=datetime.datetime.now() @@ -1399,8 +1459,34 @@ def handle_testcaseclass_softmodem_noS1 (testcase, oldprogramList, logdirOAI5GRe threads.append(thread_UE) thread_eNB.start() thread_UE.start() + + run_work_inprogress_flag = True + progress_step = timeout_thread/20 + progress_count = 0 + + while (run_work_inprogress_flag): + + + update_progress(float(progress_count)/float(timeout_thread),prefix_string) + + time.sleep(progress_step) + + progress_count += progress_step + +# sys.stdout.write ('#') +# sys.stdout.flush() + + run_work_inprogress_flag = False + for t in threads: + if t.isAlive(): + run_work_inprogress_flag = True + + + update_progress(1,prefix_string) + for t in threads: - t.join() + t.join() + # # @@ -1415,10 +1501,12 @@ def handle_testcaseclass_softmodem_noS1 (testcase, oldprogramList, logdirOAI5GRe fname = logdir_local_run+ '/UE_exec' + '_' + str(run) + '_.log' cell_synch_status = analyser.check_cell_synchro(fname) + print (Fore.WHITE + indent + "> Check Cell synchro :"), + if cell_synch_status == 'CELL_SYNCH': - print '!!!!!!!!!!!!!! Cell synchronized !!!!!!!!!!!' + print ( Fore.GREEN + cell_synch_status) else : - print '!!!!!!!!!!!!!! Cell NOT NOT synchronized !!!!!!!!!!!' + print ( Fore.RED + cell_synch_status) metric_checks_flag = 0 ue_seg_fault_status = analyser.check_exec_seg_fault(fname) @@ -1437,6 +1525,9 @@ def handle_testcaseclass_softmodem_noS1 (testcase, oldprogramList, logdirOAI5GRe # UE side metrics metricList=testcase.findall('UE_metric') for metric in metricList: + + metric_verdict = 'PASS' + metric_def = {} metric_def['id'] = metric.get('id') metric_def['description'] = metric.get('description') @@ -1457,15 +1548,19 @@ def handle_testcaseclass_softmodem_noS1 (testcase, oldprogramList, logdirOAI5GRe metric_extracted = analyser.do_extract_metrics(args) - print "\t > Metric "+metric_def['id']+" :" - print "\t\t> min = "+ str( metric_extracted['metric_min'] ) - print "\t\t> min_index = "+ str( metric_extracted['metric_min_index'] ) - print "\t\t> max = "+ str( metric_extracted['metric_max'] ) - print "\t\t> max_index = "+ str( metric_extracted['metric_max_index'] ) - print "\t\t> mean = "+ str( metric_extracted['metric_mean'] ) - print "\t\t> median = "+ str( metric_extracted['metric_median'] ) + print (Fore.WHITE + indent + "> Metric : "+metric_def['id']), + print ("(min="+str( metric_extracted['metric_min'])+", max="+str( metric_extracted['metric_max'])+", mean="+str( metric_extracted['metric_mean'])+", median="+str( metric_extracted['metric_median'])+")") - verdict = analyser.do_check_verdict(metric_def, metric_extracted) +# print "\t > Metric "+metric_def['id']+" :" +# print "\t\t> min = "+ str( metric_extracted['metric_min'] ) +# print "\t\t> min_index = "+ str( metric_extracted['metric_min_index'] ) +# print "\t\t> max = "+ str( metric_extracted['metric_max'] ) +# print "\t\t> max_index = "+ str( metric_extracted['metric_max_index'] ) +# print "\t\t> mean = "+ str( metric_extracted['metric_mean'] ) +# print "\t\t> median = "+ str( metric_extracted['metric_median'] ) + + if metric_def['pass_fail_stat'] : + metric_verdict = analyser.do_check_verdict(metric_def, metric_extracted) metric_fig = logdir_local_run+ '/UE_metric_'+ metric_def['id']+'_' + str(run) + '_.png' analyser.do_img_metrics(metric_def, metric_extracted, metric_fig) @@ -1493,6 +1588,13 @@ def handle_testcaseclass_softmodem_noS1 (testcase, oldprogramList, logdirOAI5GRe runs_metrics.append(run_metrics) + if metric_verdict != 'PASS': + verdict = metric_verdict + + # End Metrics LOOP + # --------------------- + + # Traffic analysis if UE_traffic_exec != "": @@ -1546,9 +1648,9 @@ def handle_testcaseclass_softmodem_noS1 (testcase, oldprogramList, logdirOAI5GRe run_stop_time=datetime.datetime.now() run_duration = run_stop_time-run_start_time # print (Fore.WHITE + ("duration=" :"), - print (Fore.WHITE + indent + "> RUN duration : "+ str(run_duration) +"s" ) + print (Fore.WHITE + indent + "> RUN duration : "+ str(run_duration) +"s" ) - print (Fore.WHITE + indent + "> RUN verdict :"), + print (Fore.WHITE + indent + "> RUN verdict :"), if verdict == 'PASS': nb_run_pass += 1 @@ -1578,6 +1680,8 @@ def handle_testcaseclass_softmodem_noS1 (testcase, oldprogramList, logdirOAI5GRe # END RUN LOOP #---------------------------------------------------- + indent="\t" + # Test case duration # ---------------------------------- testcase_time_stop = datetime.datetime.now() @@ -1617,11 +1721,9 @@ def handle_testcaseclass_softmodem_noS1 (testcase, oldprogramList, logdirOAI5GRe else: print (Fore.YELLOW+'INCONCLUSIVE') - duration= testcase_time_stop - testcase_time_start - xmlFile = logdir_local_testcase + '/test.' + testcasename + '.xml' - xml="\n \n" - write_file(xmlFile, xml, mode="w") + print(Style.RESET_ALL) + duration= testcase_time_stop - testcase_time_start test_result = dict(testcase_name=testcasename, testcaseclass=testcaseclass, @@ -1640,7 +1742,17 @@ def handle_testcaseclass_softmodem_noS1 (testcase, oldprogramList, logdirOAI5GRe testcase_eNBMachine =eNBMachine, testcase_UEMachine =UEMachine, runs_results = runs_results) - #test_results.append(test_result) + test_results.append(test_result) + + xmlFile = logdir_local_testcase + '/test.' + testcasename + '.xml' + xml="\n \n" + write_file(xmlFile, xml, mode="w") + +# xmlFile_ng = logdir_local_testcase + '/test.' + testcasename + '_ng.xml' +# xml_ng = xmlify(test_result, wrap=testcasename, indent=" ") +# write_file(xmlFile_ng, xml_ng, mode="w") + + return testcase_verdict @@ -1659,12 +1771,12 @@ def search_test_case_group(testcasename, testcasegroup, test_case_exclude): if entry.find('+') >=0: match = re.search(entry, testcasename) if match: - print "\nSkipping test case as it is found in black list: " + testcasename + #print "\nSkipping test case as it is found in black list: " + testcasename return False else: match = entry.find(testcasename) if match >=0: - print "\nSkipping test case as it is found in black list: " + testcasename + #print "\nSkipping test case as it is found in black list: " + testcasename return False if testcasegroup == '': return True @@ -1752,6 +1864,7 @@ if openairdir_local is None: print "Environment variable OPENAIR_DIR not set correctly" sys.exit() locallogdir = openairdir_local + '/cmake_targets/autotests/log' +reportdir = openairdir_local + '/cmake_targets/autotests/report' MachineList = '' MachineListGeneric='' MachineDescDic={} @@ -1760,12 +1873,19 @@ flag_start_testcase=False nruns_lte_softmodem='' flag_skip_git_head_check=False flag_skip_oai_install=False +flag_skip_machine_preparation=False +flag_skip_sanity_check=False +flag_generate_html_report = False Timeout_cmd='' xmlInputFile='' -print "Number of arguments argc = " + str(len(sys.argv)) + +#print "Number of arguments argc = " + str(len(sys.argv)) #for index in range(1,len(sys.argv) ): # print "argv_" + str(index) + " : " + sys.argv[index] +oai_list = [] + + i=1 while i < len (sys.argv): arg=sys.argv[i] @@ -1825,9 +1945,15 @@ while i < len (sys.argv): i = i +1 elif arg == '--skip-oai-install': flag_skip_oai_install=True + elif arg == '--skip-machine-preparation': + flag_skip_machine_preparation=True + elif arg == '--skip-sanity-check': + flag_skip_sanity_check=True elif arg == '--test-suite' : xmlInputFile = sys.argv[i+1] i = i +1 + elif arg == '--generate-html-report': + flag_generate_html_report=True elif arg == '-h' : print "-s: This flag *MUST* be set to start the test cases" print "-r: Remove the log directory in autotests" @@ -1845,90 +1971,65 @@ while i < len (sys.argv): print "--skip-git-head-check: skip checking of GitHead remote/local branch (only for debugging)" print "--timeout_cmd: Override the default parameter (timeout_cmd) in test_case_list.xml. This parameter is in seconds and should be > 120" print "--skip-oai-install: Skips the openairinterface5g installer" + print "--skip-machine-preparation: skipp the whole system preparation -> direct to test cases" + print "--skip-sanity-check: skipp the machine sanity checks" print "--test-suite: Select a XML test-suite file" + print "--generate-html-report: Generate an HTML report of the test campaign (supported only for noS1 testsuite !!)" sys.exit() else : print "Unrecongnized Option: <" + arg + ">. Use -h to see valid options" sys.exit() i= i + 1 -try: - os.environ["OPENAIR1_DIR"] -except KeyError: - print "Please set the environment variable OPENAIR1_DIR in the .bashrc" - sys.exit(1) - -try: - os.environ["OPENAIR2_DIR"] -except KeyError: - print "Please set the environment variable OPENAIR2_DIR in the .bashrc" - sys.exit(1) - -try: - os.environ["OPENAIR_TARGETS"] -except KeyError: - print "Please set the environment variable OPENAIR_TARGETS in the .bashrc" - sys.exit(1) - -print "Killing zombie ssh sessions from earlier sessions..." -cmd='ps aux |grep \"/usr/bin/ssh -q -l guptar\"| awk \'{print $2}\' | sudo xargs kill -9 ' - -os.system(cmd) - -try: - analyser = __import__("lib_autotest_analyser") -except ImportError as err: - print('Import error: ' + str(err)) - exit(0) - - -if flag_start_testcase == False: - print "You need to start the testcase by passing option -s. Use -h to see all options. Aborting now..." - sys.exit(1) - -# get the oai object -host = os.uname()[1] -#oai = openair('localdomain','calisson') -oai_list = [] - -#start_time = time.time() # datetime.datetime.now() -if user=='': - user = getpass.getuser() -if pw=='': - pw = getpass.getpass() - -print "Killing zombie ssh sessions from earlier sessions..." -cmd='ps aux |grep \"/usr/bin/ssh -q -l guptar\"|tr -s \" \" :|cut -f 2 -d :|xargs kill -9 ' -cmd = cmd + '; ps aux |grep \"/usr/bin/ssh -q -l ' + user + '\"|tr -s \" \" :|cut -f 2 -d :|xargs kill -9 ' -os.system(cmd) - -print "host = " + host -print "user = " + user -if xmlInputFile == '': - xmlInputFile=os.environ.get('OPENAIR_DIR')+"/cmake_targets/autotests/test_case_list.xml" -NFSResultsDir = '/mnt/sradio' -cleanupOldProgramsScript = '$OPENAIR_DIR/cmake_targets/autotests/tools/remove_old_programs.bash' logdir = '/tmp/' + 'OAITestFrameWork-' + user + '/' logdirOAI5GRepo = logdir + 'openairinterface5g/' logdirOpenaircnRepo = logdir + 'openair-cn/' patchdir = logdirOAI5GRepo + 'cmake_targets/autotests/patches/' - -if flag_remove_logdir == True: - print "Removing directory: " + locallogdir - os.system(' rm -fr ' + locallogdir + '; mkdir -p ' + locallogdir ) -else: - os.system('mkdir -p ' + locallogdir) - -paramiko_logfile = os.path.expandvars('$OPENAIR_DIR/cmake_targets/autotests/log/paramiko.log') -res=os.system(' echo > ' + paramiko_logfile) -paramiko.util.log_to_file(paramiko_logfile) - -#pw=getpass.getpass() +NFSResultsDir = '/mnt/sradio' +cleanupOldProgramsScript = '$OPENAIR_DIR/cmake_targets/autotests/tools/remove_old_programs.bash' #Now we parse the xml file for basic configuration +if xmlInputFile == '': + xmlInputFile=os.environ.get('OPENAIR_DIR')+"/cmake_targets/autotests/test_case_list.xml" xmlTree = ET.parse(xmlInputFile) xmlRoot = xmlTree.getroot() +# +# Read test session configuration +# --------------------------------------------------------------------------------- +print (Fore.YELLOW + '\nStep 0.1 - Read test session configuration') +print (Fore.YELLOW + '-------------------------------------------------') + +test_session_start_time = datetime.datetime.now() +print (Fore.WHITE + ' - start time : '+ str(test_session_start_time)) + +host = os.uname()[1] +print (Fore.WHITE + ' - MTC host : '+host) + + +if user=='': + user = getpass.getuser() +print (Fore.WHITE + ' - user : '+user) + +if pw=='': + pw = getpass.getpass() +print (Fore.WHITE + ' - password : '+pw) + +print (Fore.WHITE + ' - cmd line flags : ') +print (Fore.WHITE + ' + -s : '+str(flag_start_testcase)) +print (Fore.WHITE + ' + -r : '+str(flag_remove_logdir)) +print (Fore.WHITE + ' + -c : '+str(cleanUpRemoteMachines)) +print (Fore.WHITE + ' + --skip-git-head-check : '+str(flag_skip_git_head_check)) +print (Fore.WHITE + ' + --skip-oai-install : '+str(flag_skip_oai_install)) +print (Fore.WHITE + ' + --skip-machine-preparation : '+str(flag_skip_machine_preparation)) +print (Fore.WHITE + ' + --skip-sanity-check : '+str(flag_skip_sanity_check)) + + +print (Fore.WHITE + ' - Test setup basic config : (* -> overwrite by cmd line parameter)') +print (Fore.WHITE + ' + test setup config file : '+str(xmlInputFile)) +print (Fore.WHITE + ' + remote setup dir : '+str(logdir)) +print (Fore.WHITE + ' + remote OAI5G repo : '+str(logdirOAI5GRepo)) +print (Fore.WHITE + ' + remote OpenAirCN repo : '+str(logdirOpenaircnRepo)) if MachineList =='': @@ -1941,6 +2042,8 @@ if GitOAI5GRepo == '': if GitOAI5GRepoBranch == '': GitOAI5GRepoBranch = xmlRoot.findtext('GitOAI5GRepoBranch',default='') +if GitOAI5GHeadVersion == '': + GitOAI5GHeadVersion = xmlRoot.findtext('GitOAI5GHeadVersion',default='') GitOpenaircnRepoBranch = xmlRoot.findtext('GitOpenair-cnRepoBranch',default='') CleanUpOldProgs = xmlRoot.findtext('CleanUpOldProgs',default='') @@ -1953,25 +2056,27 @@ ExmimoRfStop = xmlRoot.findtext('ExmimoRfStop',default='') if nruns_lte_softmodem == '': nruns_lte_softmodem = xmlRoot.findtext('nruns_lte-softmodem',default='') -OAI5GpatchFileList=xmlRoot.findall('OAI5GPatchFile') +print (Fore.WHITE + ' + MachineList : '+ MachineList) +print (Fore.WHITE + ' + GitOpenair-cnRepo : '+ GitOpenaircnRepo) +print (Fore.WHITE + ' + GitOAI5GRepo : '+ GitOAI5GRepo) +print (Fore.WHITE + ' + GitOAI5GBranch : '+ GitOAI5GRepoBranch) +print (Fore.WHITE + ' + GitOpenaircnRepoBranch : '+ GitOpenaircnRepoBranch) +print (Fore.WHITE + ' + NFSResultsShare : '+ NFSResultsShare) +print (Fore.WHITE + ' + nruns_lte_softmodem : '+ nruns_lte_softmodem) +print (Fore.WHITE + ' + Timeout_cmd : '+ Timeout_cmd) -print "MachineList = " + MachineList -print "GitOpenair-cnRepo = " + GitOpenaircnRepo -print "GitOAI5GRepo = " + GitOAI5GRepo -print "GitOAI5GBranch = " + GitOAI5GRepoBranch -print "GitOpenaircnRepoBranch = " + GitOpenaircnRepoBranch -print "NFSResultsShare = " + NFSResultsShare -print "nruns_lte_softmodem = " + nruns_lte_softmodem -print "Timeout_cmd = " + Timeout_cmd if GitOAI5GHeadVersion == '': - cmd = "git show-ref --heads -s "+ GitOAI5GRepoBranch + cmd = "git log --pretty=format:\'%H\' -n 1" # origin/"+ GitOAI5GRepoBranch +# cmd = "git show-ref --heads -s "+ GitOAI5GRepoBranch GitOAI5GHeadVersion = subprocess.check_output ([cmd], shell=True) GitOAI5GHeadVersion=GitOAI5GHeadVersion.replace("\n","") -print "GitOAI5GHeadVersion = " + GitOAI5GHeadVersion -print "CleanUpOldProgs = " + CleanUpOldProgs -print "Timeout_execution = " + str(Timeout_execution) + # Print commiter and date : git log -1 --pretty=format:"%an %ad" + +print (Fore.WHITE + ' + GitOAI5GHeadVersion : '+ GitOAI5GHeadVersion) +#print "CleanUpOldProgs = " + CleanUpOldProgs +print (Fore.WHITE + ' + Timeout_execution (s) : '+ str(Timeout_execution)) if GitOAI5GHeadVersion == '': print "Error getting the OAI5GBranch Head version...Exiting" @@ -1979,214 +2084,401 @@ if GitOAI5GHeadVersion == '': NFSTestsResultsDir = NFSResultsShare + '/'+ GitOAI5GRepoBranch + '/' + GitOAI5GHeadVersion -print "NFSTestsResultsDir = " + NFSTestsResultsDir +#print "NFSTestsResultsDir = " + NFSTestsResultsDir + +OAI5GpatchFileList=xmlRoot.findall('OAI5GPatchFile') + + MachineList = MachineList.split() MachineListGeneric = MachineListGeneric.split() -#index=0 + +MachineDescDic + + +# +# 'Check Mater Test Controller sanity (MTC)' +# --------------------------------------------------------------------------------- +print (Fore.YELLOW + '\nStep 0.2 - Check Mater Test Controller sanity (MTC)') +print (Fore.YELLOW + '-------------------------------------------------') + +try: + print (Fore.WHITE + ' - check OpenAirInterface environment variable OPENAIR1_DIR... '), + os.environ["OPENAIR1_DIR"] +except KeyError: + print (Fore.RED + 'FAILED') + print "Please set the environment variable OPENAIR1_DIR in the .bashrc or run 'source oaienv' " + exit_prog(1) +print (Fore.GREEN + 'OK') + +try: + print (Fore.WHITE + ' - check OpenAirInterface environment variable OPENAIR2_DIR... '), + os.environ["OPENAIR2_DIR"] +except KeyError: + print (Fore.RED + 'FAILED') + print "Please set the environment variable OPENAIR2_DIR in the .bashrc or run 'source oaienv' " + exit_prog(1) +print (Fore.GREEN + 'OK') + +try: + os.environ["OPENAIR_TARGETS"] +except KeyError: + print "Please set the environment variable OPENAIR_TARGETS in the .bashrc or run 'source oaienv' " + sexit_prog(1) + +print (Fore.WHITE + ' - kill zombie ssh sessions from earlier sessions... '), +cmd='ps aux |grep \"/usr/bin/ssh -q -l ' + user + '\"| tr -s \" \" :| cut -f 2 -d :| xargs kill -9 ' +os.system(cmd) +print (Fore.GREEN + 'DONE') + +if flag_start_testcase == False: + print "You need to start the testcase by passing option -s. Use -h to see all options. Aborting now..." + exit_prog(1) + + +#print "Killing zombie ssh sessions from earlier sessions..." +#cmd='ps aux |grep \"/usr/bin/ssh -q -l guptar\"|tr -s \" \" :|cut -f 2 -d :|xargs kill -9 ' +#cmd = cmd + '; ps aux |grep \"/usr/bin/ssh -q -l ' + user + '\"| tr -s \" \" :| cut -f 2 -d :| xargs kill -9 ' +#os.system(cmd) +#print cmd + +try: + analyser = __import__("lib_autotest_analyser") +except ImportError as err: + print('Import error: ' + str(err)) + exit(0) + +if flag_remove_logdir == True: + print "Removing directory: " + locallogdir + os.system(' rm -fr ' + locallogdir + '; mkdir -p ' + locallogdir ) + +if not os.path.exists(locallogdir): + os.system('mkdir -p ' + locallogdir ) + + +paramiko_logfile = os.path.expandvars('$OPENAIR_DIR/cmake_targets/autotests/log/paramiko.log') +res=os.system(' echo > ' + paramiko_logfile) +paramiko.util.log_to_file(paramiko_logfile) + + +# +# 'REMOTE MACHINE SANITY CHEKS' +# --------------------------------------------------------------------------------- +print (Fore.YELLOW + '\nStep 0.3 - REMOTE MACHINE SANITY CHEKS') +print (Fore.YELLOW + '-------------------------------------------------') + + for machine in MachineList: oai_list.append( openair('localdomain',machine)) MachineDescDic[machine]={} - #index = index + 1 -print "\nTesting the sanity of machines used for testing..." -if localshell == 0: +if not flag_skip_sanity_check: + + if localshell == 0: try: - index=0 - for machine in MachineList: - print '\n******* Note that the user <'+user+'> should be a sudoer *******\n' - print '******* Connecting to the machine <'+machine+'> to perform the test *******\n' - if not pw : - print "username: " + user - #pw = getpass.getpass() - #print "password: " + pw - else : - print "username: " + user - #print "password: " + pw - # issues in ubuntu 12.04 - oai_list[index].connect(user,pw) - print '\nChecking for sudo permissions on machine <'+machine+'>...' - result = oai_list[index].send_expect_false('sudo -S -v','may not run sudo',True) - print "Sudo permissions..." + result - - print '\nCleaning Older running programs : ' + CleanUpOldProgs - cleanOldPrograms(oai_list[index], CleanUpOldProgs, CleanUpAluLteBox, ExmimoRfStop, '$HOME', '/tmp') + index=0 + for machine in MachineList: + print (Fore.WHITE + " - Check sanity for remote machine "+machine) - #result = oai_list[index].send('mount ' + NFSResultsDir, True) - #print "Mounting NFS Share " + NFSResultsDir + "..." + result + oai_list[index].connect(user,pw) + print (Fore.WHITE + " > Checking for sudo permissions for user "+user+ " : "), + result = oai_list[index].send_expect_false('sudo -S -v','may not run sudo',True) + if (result == 'OK'): + print (Fore.GREEN + result ) + else: + print (Fore.RED + result ) + + print (Fore.WHITE + " > Cleaning Older running programs : "), + cleanOldPrograms(oai_list[index], CleanUpOldProgs, CleanUpAluLteBox, ExmimoRfStop, '$HOME', '/tmp') + print (Fore.WHITE + " Done") - # Check if NFS share is mounted correctly. - #print 'Checking if NFS Share<' + NFSResultsDir + '> is mounted correctly...' - #cmd = 'if grep -qs '+NFSResultsDir+ ' /proc/mounts; then echo \'' + NFSResultsDir + ' is mounted\' ; fi' - #search_expr = NFSResultsDir + ' is mounted' - #print "cmd = " + cmd - #print "search_expr = " + search_expr - #result = oai_list[index].send_expect(cmd, search_expr) - #print "Mount NFS_Results_Dir..." + result - index = index + 1 - - #oai.connect2(user,pw) - #oai.get_shell() + #result = oai_list[index].send('mount ' + NFSResultsDir, True) + #print "Mounting NFS Share " + NFSResultsDir + "..." + result + + # Check if NFS share is mounted correctly. + #print 'Checking if NFS Share<' + NFSResultsDir + '> is mounted correctly...' + #cmd = 'if grep -qs '+NFSResultsDir+ ' /proc/mounts; then echo \'' + NFSResultsDir + ' is mounted\' ; fi' + #search_expr = NFSResultsDir + ' is mounted' + #print "cmd = " + cmd + #print "search_expr = " + search_expr + #result = oai_list[index].send_expect(cmd, search_expr) + #print "Mount NFS_Results_Dir..." + result + index = index + 1 + + #oai.connect2(user,pw) + #oai.get_shell() except : print 'Fail to connect to the machine: '+ machine sys.exit(1) + else: + pw = '' + oai_list[0].connect_localshell() else: - pw = '' - oai_list[0].connect_localshell() + print (Fore.RED + " Skipping Machine sanity check...") -#We now prepare the machines for testing -index=0 -threads_init_setup=[] -for oai in oai_list: - try: - print "setting up machine: " + MachineList[index] - #print oai_list[oai].send_recv('echo \''+pw+'\' |sudo -S -v') - #print oai_list[oai].send_recv('sudo su') - #print oai_list[oai].send_recv('who am i') - #cleanUpPrograms(oai_list[oai] - cmd = 'sudo -S -E rm -fr ' + logdir + ' ; mkdir -p ' + logdir - result = oai.send_recv(cmd) +# +# 'REMOTE MACHINE TEST SETUP CONFIGURATION' +# --------------------------------------------------------------------------------- +print (Fore.YELLOW + '\nStep 0.4 - REMOTE MACHINE PREPARATION') +print (Fore.YELLOW + '-------------------------------------------------') + +if not flag_skip_machine_preparation: + index=0 + threads_init_setup=[] + for oai in oai_list: + try: + print "setting up machine: " + MachineList[index] + #print oai_list[oai].send_recv('echo \''+pw+'\' |sudo -S -v') + #print oai_list[oai].send_recv('sudo su') + #print oai_list[oai].send_recv('who am i') + #cleanUpPrograms(oai_list[oai] + cmd = 'sudo -S -E rm -fr ' + logdir + ' ; mkdir -p ' + logdir + result = oai.send_recv(cmd) + print cmd + + setuplogfile = logdir + '/setup_log_' + MachineList[index] + '_.txt' + setup_script = locallogdir + '/setup_script_' + MachineList[index] + '_.txt' + + #Sometimes git fails so the script below retries in that case + localfile = os.path.expandvars('$OPENAIR_DIR/cmake_targets/autotests/tools/git-retry.sh') + remotefile = logdir + '/git-retry.sh' + paramList=[] + port=22 + paramList.append ( {"operation":'put', "localfile":localfile, "remotefile":remotefile} ) + sftp_log = os.path.expandvars(locallogdir + '/sftp_module.log') + sftp_module (user, pw, MachineList[index], port, paramList, sftp_log) + + cmd = ' ( \n' + #cmd = cmd + 'rm -fR ' + logdir + '\n' + #cmd = cmd + 'mkdir -p ' + logdir + '\n' + cmd = cmd + 'cd '+ logdir + '\n' + cmd = cmd + 'sudo apt-get install -y git \n' + cmd = cmd + 'chmod 700 ' + logdir + '/git-retry.sh \n' + cmd = cmd + logdir + '/git-retry.sh clone '+ GitOAI5GRepo +' \n' + cmd = cmd + logdir + '/git-retry.sh clone '+ GitOpenaircnRepo + ' \n' + cmd = cmd + 'cd ' + logdirOAI5GRepo + '\n' + cmd = cmd + 'git checkout ' + GitOAI5GRepoBranch + '\n' + if GitOAI5GHeadVersion : + cmd = cmd + 'git checkout ' + GitOAI5GHeadVersion + '\n' + cmd = cmd + 'git_head=`git ls-remote |grep \'' + GitOAI5GRepoBranch + '\'` \n' + cmd = cmd + 'git_head=($git_head) \n' + cmd = cmd + 'git_head=${git_head[0]} \n' + cmd = cmd + 'echo \"GitOAI5GHeadVersion_remote = $git_head\" \n' + cmd = cmd + 'echo \"GitOAI5GHeadVersion_local = ' + GitOAI5GHeadVersion + '\" \n' + if flag_skip_git_head_check==True: + cmd = cmd + 'echo \"skipping GitHead check...\" \n ' + else: + cmd = cmd + 'if [ \"$git_head\" != \"'+ GitOAI5GHeadVersion + '\" ]; then echo \"error: Git openairinterface5g head version does not match\" ; fi \n' + cmd = cmd + 'source oaienv' + '\n' + if flag_skip_oai_install == False: + cmd = cmd + 'source $OPENAIR_DIR/cmake_targets/tools/build_helper \n' + cmd = cmd + 'echo \"Installing core OAI dependencies...Start\" \n' + cmd = cmd + '$OPENAIR_DIR/cmake_targets/build_oai -I --install-optional-packages \n' + cmd = cmd + 'echo \"Installing core OAI dependencies...Finished\" \n' + #cmd = cmd + 'echo \"Installing BLADERF OAI dependencies...Start\" \n' + #cmd = cmd + 'check_install_bladerf_driver \n' + #cmd = cmd + 'echo \"Installing BLADERF OAI dependencies...Finished\" \n' + #cmd = cmd + 'echo \"Installing USRP OAI dependencies...Start\" \n' + #cmd = cmd + 'check_install_usrp_uhd_driver \n' + #cmd = cmd + 'echo \"Installing USRP OAI dependencies...Finished\" \n' + cmd = cmd + 'cd ' + logdirOpenaircnRepo + '\n' + cmd = cmd + 'git checkout ' + GitOpenaircnRepoBranch + '\n' + cmd = cmd + 'env |grep OPENAIR' + '\n' + cmd = cmd + ' cd ' + logdir + '\n' + cmd = cmd + 'mkdir -p ' + patchdir + '\n' + cmd = cmd + ' ) > ' + setuplogfile + ' 2>&1 \n' + #cmd = cmd + 'echo \' ' + cmd + '\' > ' + setup_script + ' 2>&1 \n ' + #result = oai_list[index].send_recv(cmd, False, 300 ) + write_file(setup_script, cmd, mode="w") + tempThread = oaiThread(index, 'thread_setup_'+str(index)+'_' + MachineList[index] , MachineList[index] , user, pw, cmd, False, 3000) + threads_init_setup.append(tempThread ) + tempThread.start() + index = index + 1 + except Exception, e: + print 'There is error in one of the commands to setup the machine '+ MachineList[index] + error='' + error = error + ' In function: ' + sys._getframe().f_code.co_name + ': *** Caught exception: ' + str(e.__class__) + " : " + str( e) + error = error + traceback.format_exc() + print error + sys.exit(1) + + #Now we wait for all the threads to complete + index = 0 + for t in threads_init_setup: + t.join() + + port = 22 + paramList=[] + sftp_log = os.path.expandvars(locallogdir + '/sftp_module.log') + + #Now we copy patch files and apply them + print( Fore.WHITE + " - Installating patch files on machine " + MachineList[index]) + for patchFile in OAI5GpatchFileList: + localfile = os.path.expandvars('$OPENAIR_DIR/cmake_targets/autotests/patches/')+patchFile.get('name') + remotefile = logdirOAI5GRepo + '/cmake_targets/autotests/patches/'+patchFile.get('name') + if patchFile.get('machine') == MachineList[index] or patchFile.get('machine') == None: + if os.path.isfile(localfile): + print( Fore.WHITE + "\t> PATCH FILE :"+localfile) + paramList=[] + paramList.append ( {"operation":'put', "localfile":localfile, "remotefile":remotefile} ) + sftp_module (user, pw, MachineList[index], port, paramList, sftp_log) + cmd = ' cd ' + logdirOAI5GRepo + ' ;git apply cmake_targets/autotests/patches/'+patchFile.get('name') + res = oai_list[index].send_recv(cmd) + #print res - setuplogfile = logdir + '/setup_log_' + MachineList[index] + '_.txt' - setup_script = locallogdir + '/setup_script_' + MachineList[index] + '_.txt' + paramList=[] - #Sometimes git fails so the script below retries in that case - localfile = os.path.expandvars('$OPENAIR_DIR/cmake_targets/autotests/tools/git-retry.sh') - remotefile = logdir + '/git-retry.sh' - paramList=[] - port=22 - paramList.append ( {"operation":'put', "localfile":localfile, "remotefile":remotefile} ) - sftp_log = os.path.expandvars(locallogdir + '/sftp_module.log') - sftp_module (user, pw, MachineList[index], port, paramList, sftp_log) + setuplogfile = logdir + '/setup_log_' + MachineList[index] + '_.txt' + setup_script = locallogdir + '/setup_script_' + MachineList[index] + '_.txt' + localfile = locallogdir + '/setup_log_' + MachineList[index] + '_.txt' + remotefile = logdir + '/setup_log_' + MachineList[index] + '_.txt' + sftp_log = os.path.expandvars(locallogdir + '/sftp_module.log') + paramList.append ( {"operation":'get', "localfile":localfile, "remotefile":remotefile} ) + #sftp_module (user, pw, MachineList[index], port, localfile, remotefile, sftp_log, "get") + + #Now we copy test_case_list.xml on the remote machines + localfile = os.path.expandvars('$OPENAIR_DIR/cmake_targets/autotests/test_case_list.xml') + remotefile = logdirOAI5GRepo + '/cmake_targets/autotests/test_case_list.xml' + # paramList.append ( {"operation":'put', "localfile":localfile, "remotefile":remotefile} ) + # sftp_module (user, pw, MachineList[index], port, paramList, sftp_log) + + sftp_module (user, pw, MachineList[index], port, paramList, sftp_log) - cmd = ' ( \n' - #cmd = cmd + 'rm -fR ' + logdir + '\n' - #cmd = cmd + 'mkdir -p ' + logdir + '\n' - cmd = cmd + 'cd '+ logdir + '\n' - cmd = cmd + 'sudo apt-get install -y git \n' - cmd = cmd + 'chmod 700 ' + logdir + '/git-retry.sh \n' - cmd = cmd + logdir + '/git-retry.sh clone '+ GitOAI5GRepo +' \n' - cmd = cmd + logdir + '/git-retry.sh clone '+ GitOpenaircnRepo + ' \n' - cmd = cmd + 'cd ' + logdirOAI5GRepo + '\n' - cmd = cmd + 'git checkout ' + GitOAI5GRepoBranch + '\n' - #cmd = cmd + 'git checkout ' + GitOAI5GHeadVersion + '\n' - cmd = cmd + 'git_head=`git ls-remote |grep \'' + GitOAI5GRepoBranch + '\'` \n' - cmd = cmd + 'git_head=($git_head) \n' - cmd = cmd + 'git_head=${git_head[0]} \n' - cmd = cmd + 'echo \"GitOAI5GHeadVersion_remote = $git_head\" \n' - cmd = cmd + 'echo \"GitOAI5GHeadVersion_local = ' + GitOAI5GHeadVersion + '\" \n' - if flag_skip_git_head_check==True: - cmd = cmd + 'echo \"skipping GitHead check...\" \n ' - else: - cmd = cmd + 'if [ \"$git_head\" != \"'+ GitOAI5GHeadVersion + '\" ]; then echo \"error: Git openairinterface5g head version does not match\" ; fi \n' - cmd = cmd + 'source oaienv' + '\n' - if flag_skip_oai_install == False: - cmd = cmd + 'source $OPENAIR_DIR/cmake_targets/tools/build_helper \n' - cmd = cmd + 'echo \"Installing core OAI dependencies...Start\" \n' - cmd = cmd + '$OPENAIR_DIR/cmake_targets/build_oai -I --install-optional-packages \n' - cmd = cmd + 'echo \"Installing core OAI dependencies...Finished\" \n' - #cmd = cmd + 'echo \"Installing BLADERF OAI dependencies...Start\" \n' - #cmd = cmd + 'check_install_bladerf_driver \n' - #cmd = cmd + 'echo \"Installing BLADERF OAI dependencies...Finished\" \n' - #cmd = cmd + 'echo \"Installing USRP OAI dependencies...Start\" \n' - #cmd = cmd + 'check_install_usrp_uhd_driver \n' - #cmd = cmd + 'echo \"Installing USRP OAI dependencies...Finished\" \n' - cmd = cmd + 'cd ' + logdirOpenaircnRepo + '\n' - cmd = cmd + 'git checkout ' + GitOpenaircnRepoBranch + '\n' - cmd = cmd + 'env |grep OPENAIR' + '\n' - cmd = cmd + ' cd ' + logdir + '\n' - cmd = cmd + 'mkdir -p ' + patchdir + '\n' - cmd = cmd + ' ) > ' + setuplogfile + ' 2>&1 \n' - #cmd = cmd + 'echo \' ' + cmd + '\' > ' + setup_script + ' 2>&1 \n ' - #result = oai_list[index].send_recv(cmd, False, 300 ) - write_file(setup_script, cmd, mode="w") - tempThread = oaiThread(index, 'thread_setup_'+str(index)+'_' + MachineList[index] , MachineList[index] , user, pw, cmd, False, 3000) - threads_init_setup.append(tempThread ) - tempThread.start() - index = index + 1 - except Exception, e: - print 'There is error in one of the commands to setup the machine '+ MachineList[index] - error='' - error = error + ' In function: ' + sys._getframe().f_code.co_name + ': *** Caught exception: ' + str(e.__class__) + " : " + str( e) - error = error + traceback.format_exc() - print error - sys.exit(1) - -#Now we wait for all the threads to complete -index = 0 -for t in threads_init_setup: - t.join() - setuplogfile = logdir + '/setup_log_' + MachineList[index] + '_.txt' - setup_script = locallogdir + '/setup_script_' + MachineList[index] + '_.txt' - localfile = locallogdir + '/setup_log_' + MachineList[index] + '_.txt' - remotefile = logdir + '/setup_log_' + MachineList[index] + '_.txt' - port = 22 - - #Now we copy patch files and apply them - print "Installating patch files on machine " + MachineList[index] - for patchFile in OAI5GpatchFileList: - localfile = os.path.expandvars('$OPENAIR_DIR/cmake_targets/autotests/patches/')+patchFile.get('name') - remotefile = logdirOAI5GRepo + '/cmake_targets/autotests/patches/'+patchFile.get('name') - if patchFile.get('machine') == MachineList[index] or patchFile.get('machine') == None: - if os.path.isfile(localfile): - print "\t> PATCH FILE :"+localfile - paramList=[] - paramList.append ( {"operation":'put', "localfile":localfile, "remotefile":remotefile} ) - sftp_module (user, pw, MachineList[index], port, paramList, sftp_log) - cmd = ' cd ' + logdirOAI5GRepo + ' ;git apply cmake_targets/autotests/patches/'+patchFile.get('name') - res = oai_list[index].send_recv(cmd) - - paramList=[] - - setuplogfile = logdir + '/setup_log_' + MachineList[index] + '_.txt' - setup_script = locallogdir + '/setup_script_' + MachineList[index] + '_.txt' - localfile = locallogdir + '/setup_log_' + MachineList[index] + '_.txt' - remotefile = logdir + '/setup_log_' + MachineList[index] + '_.txt' - sftp_log = os.path.expandvars(locallogdir + '/sftp_module.log') - paramList.append ( {"operation":'get', "localfile":localfile, "remotefile":remotefile} ) - #sftp_module (user, pw, MachineList[index], port, localfile, remotefile, sftp_log, "get") - - #Now we copy test_case_list.xml on the remote machines - localfile = os.path.expandvars('$OPENAIR_DIR/cmake_targets/autotests/test_case_list.xml') - remotefile = logdirOAI5GRepo + '/cmake_targets/autotests/test_case_list.xml' - paramList.append ( {"operation":'put', "localfile":localfile, "remotefile":remotefile} ) - sftp_log = os.path.expandvars(locallogdir + '/sftp_module.log') - sftp_module (user, pw, MachineList[index], port, paramList, sftp_log) - - cmd = ' cd ' + logdirOAI5GRepo + ' ; source oaienv ; env|grep OPENAIR \n' - res = oai_list[index].send_recv(cmd) - index = index +1 - if os.path.exists(localfile) == 0: + cmd = ' cd ' + logdirOAI5GRepo + ' ; source oaienv ; env|grep OPENAIR \n' + res = oai_list[index].send_recv(cmd) + index = index +1 + if os.path.exists(localfile) == 0: print "Setup log file <" + localfile + "> missing for machine <" + MachineList[index] + ">. Please check the setup log files. Exiting now" sys.exit(1) -#Now we process all the test cases -#Now we check if there was error in setup files + #Now we process all the test cases + #Now we check if there was error in setup files -status, out = commands.getstatusoutput('grep ' + ' -il \'error\' ' + locallogdir + '/setup_log*') -if (out != '') : - print "There is error in setup of machines" - print "status = " + str(status) + "\n Check files for error = " + out - print "Exiting now..." - sys.exit(1) + status, out = commands.getstatusoutput('grep ' + ' -il \'error\' ' + locallogdir + '/setup_log*') + if (out != '') : + print "There is error in setup of machines" + print "status = " + str(status) + "\n Check files for error = " + out + print "Exiting now..." + sys.exit(1) -cleanOldProgramsAllMachines(oai_list, CleanUpOldProgs, CleanUpAluLteBox, ExmimoRfStop, '$HOME' , logdirOAI5GRepo) -if cleanUpRemoteMachines == True: - sys.exit(0) + cleanOldProgramsAllMachines(oai_list, CleanUpOldProgs, CleanUpAluLteBox, ExmimoRfStop, '$HOME' , logdirOAI5GRepo) + if cleanUpRemoteMachines == True: + print "Error while cleaning Remote machines" + print "Exiting now..." + sys.exit(0) + + +else: + print (Fore.RED + " Skipping Machine preparation...") + +# ************************************************************************** +# ************************************************************************** +# STEP 2 - TEST SELECTION AND PARAMETRIZATION +# ************************************************************************** +# ************************************************************************** + +print (Fore.YELLOW + '\nStep 2 - TEST SELECTION') +print (Fore.YELLOW + '-------------------------------------------------') + +print (Fore.WHITE + " Parsing test case list for test selection...") +print (Fore.WHITE + " - TestCaseExclusionList : "+TestCaseExclusionList) +print (Fore.WHITE + " - testcasegroup : "+testcasegroup) + + +testcaseList=xmlRoot.findall('testCase') + +nb_total_testcases = 0 +nb_total_testcases_softmodem = 0 +nb_total_testcases_softmodem_noS1 = 0 +nb_total_testcases_compilation = 0 +nb_total_testcases_execution = 0 + +nb_run_testcases = 0 +nb_run_testcases_softmodem = 0 +nb_run_testcases_softmodem_noS1 = 0 +nb_run_testcases_compilation = 0 +nb_run_testcases_execution = 0 + + +for testcase in testcaseList: + try: + testcasename = testcase.get('id') + testcaseclass = testcase.findtext('class',default='') + desc = testcase.findtext('desc',default='') + nb_total_testcases+=1 + + run_flag = search_test_case_group(testcasename, testcasegroup, TestCaseExclusionList) + if (run_flag): + nb_run_testcases+=1 + + if testcaseclass == 'lte-softmodem' : + nb_total_testcases_softmodem+=1 + if (run_flag): nb_run_testcases_softmodem+=1 + elif testcaseclass == 'lte-softmodem-noS1': + nb_total_testcases_softmodem_noS1+=1 + if (run_flag): nb_run_testcases_softmodem_noS1+=1 + elif testcaseclass == 'compilation': + nb_total_testcases_compilation+=1 + if (run_flag): nb_run_testcases_compilation+=1 + elif testcaseclass == 'execution': + nb_total_testcases_execution+=1 + if (run_flag): nb_run_testcases_execution+=1 + else : + print "Unknown test case class: " + testcaseclass + sys.exit() + + except Exception, e: + error='' + error = error + ' In function: ' + sys._getframe().f_code.co_name + ': *** Caught exception: ' + str(e.__class__) + " : " + str( e) + error = error + '\n testcasename = ' + testcasename + '\n testcaseclass = ' + testcaseclass + '\n desc = ' + 'desc' + '\n' + error = error + traceback.format_exc() + print error + print "Continuing to next test case..." + +print (Fore.WHITE + " Parsing done...") + +print (Fore.WHITE + " - Total number of test cases : "+str(nb_total_testcases)) +print (Fore.WHITE + " - Total number class softmodem : "+str(nb_total_testcases_softmodem)) +print (Fore.WHITE + " - Total number class softmodem-noS1 : "+str(nb_total_testcases_softmodem_noS1)) +print (Fore.WHITE + " - Total number class compilation : "+str(nb_total_testcases_compilation)) +print (Fore.WHITE + " - Total number class execution : "+str(nb_total_testcases_execution)) +print +print (Fore.WHITE + " - Selected number of test cases : "+str(nb_run_testcases)) +print (Fore.WHITE + " - Selected class softmodem : "+str(nb_run_testcases_softmodem)) +print (Fore.WHITE + " - Selected class softmodem_noS1 : "+str(nb_run_testcases_softmodem_noS1)) +print (Fore.WHITE + " - Selected class compilation : "+str(nb_run_testcases_compilation)) +print (Fore.WHITE + " - Selected class execution : "+str(nb_run_testcases_execution)) + + +# ************************************************************************** +# ************************************************************************** +# STEP 3 - TEST CAMPAIGNS +# ************************************************************************** +# ************************************************************************** + +test_results = [] + + +print (Fore.YELLOW + '\nStep 3 - TEST CAMPAIGNS') +print (Fore.YELLOW + '-------------------------------------------------') + +print (Fore.WHITE + " Start test campaign...") threadListGlobal=[] -testcaseList=xmlRoot.findall('testCase') -#print testcaseList +run_count = 0 for testcase in testcaseList: try: testcasename = testcase.get('id') testcaseclass = testcase.findtext('class',default='') desc = testcase.findtext('desc',default='') #print "Machine list top level = " + ','.join(MachineList) + if search_test_case_group(testcasename, testcasegroup, TestCaseExclusionList) == True: + run_count+=1 + print (Fore.WHITE + " ("+str(run_count).zfill(3)+"/"+str(nb_run_testcases).zfill(3)+") - test case "+testcasename+" : "), if testcaseclass == 'lte-softmodem' : eNBMachine = testcase.findtext('eNB',default='') UEMachine = testcase.findtext('UE',default='') @@ -2258,6 +2550,22 @@ for param in threadListGlobal: thread_id = param["thread_id"] thread_id.join() + +# ************************************************************************** +# ************************************************************************** +# STEP 4 - TEST REPORT PRODUCTION +# ************************************************************************** +# ************************************************************************** + + + +test_session_stop_time = datetime.datetime.now() + +print (Fore.YELLOW + '\nStep 4 - TEST REPORT PRODUCTION') +print (Fore.YELLOW + '-------------------------------------------------') + +# XML test report +# -------------------------------------------------------------------- print "Creating xml file for overall results..." cmd = "cat $OPENAIR_DIR/cmake_targets/autotests/log/*/*.xml > $OPENAIR_DIR/cmake_targets/autotests/log/results_autotests.xml " res=os.system(cmd) @@ -2276,4 +2584,43 @@ res = oai_localhost.send_recv(cmd) oai_localhost.disconnect() + +# HTML test report +# -------------------------------------------------------------------- +if flag_generate_html_report: + + print "Creating html test report..." + + report_dir = reportdir + '/'+ test_session_start_time.strftime("%Y-%m-%d_%H-%M")+"_"+host + + cmd = 'mkdir -p ' + report_dir + result = os.system(cmd) + + cmd = 'cp -r '+locallogdir+' '+report_dir + result = os.system(cmd) + + context = { + 'report_path' : report_dir, + 'test_session_start_time' : test_session_start_time, + 'test_session_stop_time' : test_session_stop_time, + 'test_session_duration' : test_session_stop_time-test_session_start_time, + 'mtc_host' : host, + 'user' : user, + 'password' : pw, + 'test_results' : test_results, + } + + for test_result in test_results: + cmd = 'mkdir -p ' + report_dir + '/'+ test_result['testcase_name'] + result = os.system(cmd) + + report_file = report_dir + '/'+ test_result['testcase_name'] + '/'+ test_result['testcase_name']+ '_report.html' + + analyser.create_test_report_detailed_html(test_result, report_file ) + + # print test_result + + analyser.create_report_html(context) + + sys.exit() diff --git a/cmake_targets/autotests/run_lte-softmodem-nos1_tests.py b/cmake_targets/autotests/run_lte-softmodem-nos1_tests.py index 19939f0d5c..2ece62ae16 100755 --- a/cmake_targets/autotests/run_lte-softmodem-nos1_tests.py +++ b/cmake_targets/autotests/run_lte-softmodem-nos1_tests.py @@ -1,70 +1,32 @@ #! /usr/bin/python -#****************************************************************************** +#/* +# * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more +# * contributor license agreements. See the NOTICE file distributed with +# * this work for additional information regarding copyright ownership. +# * The OpenAirInterface Software Alliance licenses this file to You under +# * the OAI Public License, Version 1.0 (the "License"); you may not use this file +# * except in compliance with the License. +# * You may obtain a copy of the License at +# * +# * http://www.openairinterface.org/?page_id=698 +# * +# * Unless required by applicable law or agreed to in writing, software +# * distributed under the License is distributed on an "AS IS" BASIS, +# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# * See the License for the specific language governing permissions and +# * limitations under the License. +# *------------------------------------------------------------------------------- +# * For more information about the OpenAirInterface (OAI) Software Alliance: +# * contact@openairinterface.org +# */ -# OpenAirInterface -# Copyright(c) 1999 - 2014 Eurecom - -# OpenAirInterface is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. - - -# OpenAirInterface is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with OpenAirInterface.The full GNU General Public License is -# included in this distribution in the file called "COPYING". If not, -# see . - -# Contact Information -# OpenAirInterface Admin: openair_admin@eurecom.fr -# OpenAirInterface Tech : openair_tech@eurecom.fr -# OpenAirInterface Dev : openair4g-devel@lists.eurecom.fr - -# Address : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE - -# *******************************************************************************/ -# \author Rohit Gupta +# \author Rohit Gupta - Benoit ROBERT (benoit.robert@syrtem.com) # \version 0.1 # @ingroup _test - -#****************************************************************************** -# -# \file run_lte-softmodem-nos1_tests.py -# -# \par Informations -# - \b Project : UED Autotest Framework -# - \b Software : -# -# \date 16 september 2016 -# -# \version 0.1 -# -# \brief master test script to run test class 'handle_testcaseclass_softmodem_noS1' -# This script is largely inspired by 'run_exec_lte-softmodem_tests.py', and -# reused parts of it. -# -# \author Benoit ROBERT (benoit.robert@syrtem.com) -# -# \par Statement of Ownership -# COPYRIGHT (c) 2016 BY SYRTEM S.A.R.L -# This software is furnished under license and may be used and copied -# only in accordance with the terms of such license and with the inclusion -# of the above COPYRIGHT notice. This SOFTWARE or any other copies thereof -# may not be provided or otherwise made available to any other person. -# No title to and ownership of the SOFTWARE is hereby transferred. -# -# The information in this SOFTWARE is subject to change without notice -# and should not be constructed as a commitment by SYRTEM. -# SYRTEM assumes no responsibility for the use or reliability of its -# SOFTWARE on equipment or platform not explicitly validated by SYRTEM. -# -# ******************************************************************************* +# \Changelog +# 2016-11-18 : +# - Add progess bar during test execution update_progress() import tempfile import threading @@ -79,6 +41,8 @@ import math #from time import clock import xml.etree.ElementTree as ET import re +#from dict2xml import dict2xml as xmlify + from colorama import Fore, Back, Style import numpy as np @@ -100,6 +64,31 @@ from ssh import SSHSession import argparse +# update_progress() : Displays or updates a console progress bar +## Accepts a float between 0 and 1. Any int will be converted to a float. +## A value under 0 represents a 'halt'. +## A value at 1 or bigger represents 100% +def update_progress(progress, prefix_string): + barLength = 20 # Modify this to change the length of the progress bar + status = "" + #print "progress = "+ str(progress) + if isinstance(progress, int): + progress = float(progress) + if not isinstance(progress, float): + progress = 0 + status = "error: progress var must be float\r\n" + if progress < 0: + progress = 0 + status = "Halt...\r\n" + if progress >= 1: + progress = 1 + status = "Done...\r\n" + block = int(round(barLength*progress)) + text = "\r"+prefix_string+" [{0}] {1}% {2}".format( "="*block + " "*(barLength-block), progress*100, status) + sys.stdout.write(text) + sys.stdout.flush() + + def exit_prog(exit_val): print(Style.RESET_ALL), sys.exit(exit_val) @@ -318,7 +307,7 @@ def update_config_file(oai, config_string, logdirRepo, python_script): # \param logdir_local_base local directory # \param operation operation to perform (get_all, put_all) transfers recursively for directories def SSHSessionWrapper(machine, username, key_file, password, logdir_remote, logdir_local_base, operation): - max_tries = 100 + max_tries = 10 i=0 while i <= max_tries: i = i +1 @@ -648,7 +637,7 @@ def handle_testcaseclass_softmodem (testcase, oldprogramList, logdirOAI5GRepo , RRH_pre_exec_args = testcase.findtext('RRH_pre_exec_args',default='') RRH_main_exec = testcase.findtext('RRH_main_exec',default='') RRH_main_exec_args = testcase.findtext('RRH_main_exec_args',default='') - RRH_terminate_missing_procs = testcase.findtext('RRH_terminate_missing_procs',default='True') + RRH_terminate_missing_procs = testcase.findtext('RRH_terminate_missing_procs',default='False') eNBMachine = testcase.findtext('eNB',default='') @@ -661,7 +650,7 @@ def handle_testcaseclass_softmodem (testcase, oldprogramList, logdirOAI5GRepo , eNB_main_exec_args = testcase.findtext('eNB_main_exec_args',default='') eNB_traffic_exec = testcase.findtext('eNB_traffic_exec',default='') eNB_traffic_exec_args = testcase.findtext('eNB_traffic_exec_args',default='') - eNB_terminate_missing_procs = testcase.findtext('eNB_terminate_missing_procs',default='True') + eNB_terminate_missing_procs = testcase.findtext('eNB_terminate_missing_procs',default='False') eNB_search_expr_true = testcase.findtext('eNB_search_expr_true','') if re.compile('\w+').match(eNB_search_expr_true) != None: eNB_search_expr_true = eNB_search_expr_true + ' duration=' + str(timeout_cmd-90) + 's' @@ -676,7 +665,7 @@ def handle_testcaseclass_softmodem (testcase, oldprogramList, logdirOAI5GRepo , UE_main_exec_args = testcase.findtext('UE_main_exec_args',default='') UE_traffic_exec = testcase.findtext('UE_traffic_exec',default='') UE_traffic_exec_args = testcase.findtext('UE_traffic_exec_args',default='') - UE_terminate_missing_procs = testcase.findtext('UE_terminate_missing_procs',default='True') + UE_terminate_missing_procs = testcase.findtext('UE_terminate_missing_procs',default='False') UE_search_expr_true = testcase.findtext('UE_search_expr_true','') UE_stop_script = testcase.findtext('UE_stop_script','') if re.compile('\w+').match(UE_search_expr_true) != None: @@ -697,25 +686,23 @@ def handle_testcaseclass_softmodem (testcase, oldprogramList, logdirOAI5GRepo , HSS_main_exec_args = testcase.findtext('HSS_main_exec_args',default='') EPC_traffic_exec = testcase.findtext('EPC_traffic_exec',default='') EPC_traffic_exec_args = testcase.findtext('EPC_traffic_exec_args',default='') - EPC_terminate_missing_procs = testcase.findtext('EPC_terminate_missing_procs',default='True') + EPC_terminate_missing_procs = testcase.findtext('EPC_terminate_missing_procs',default='False') EPC_search_expr_true = testcase.findtext('EPC_search_expr_true','') if re.compile('\w+').match(EPC_search_expr_true) != None: EPC_search_expr_true = EPC_search_expr_true + ' duration=' + str(timeout_cmd-90) + 's' index_eNBMachine = MachineList.index(eNBMachine) index_UEMachine = MachineList.index(UEMachine) -# index_EPCMachine = MachineList.index(EPCMachine) + index_EPCMachine = MachineList.index(EPCMachine) cmd = 'cd ' + logdirOAI5GRepo + '; source oaienv ; env|grep OPENAIR' oai_eNB = openair('localdomain', eNBMachine) oai_eNB.connect(user, password) res= oai_eNB.send_recv(cmd) oai_UE = openair('localdomain', UEMachine) oai_UE.connect(user, password) -# print cmd - res = oai_UE.send_recv(cmd) -# print res -# oai_EPC = openair('localdomain', EPCMfachine) -# oai_EPC.connect(user, password) + res = oai_eNB.send_recv(cmd) + oai_EPC = openair('localdomain', EPCMachine) + oai_EPC.connect(user, password) res = oai_eNB.send_recv(cmd) if RRHMachine != '': cmd = 'cd ' + logdirOAI5GRepo + '; source oaienv ; env|grep OPENAIR' @@ -735,9 +722,7 @@ def handle_testcaseclass_softmodem (testcase, oldprogramList, logdirOAI5GRepo , #cmd = 'mkdir -p ' + logdir_eNB #result = oai_eNB.send_recv(cmd) #cmd = 'mkdir -p ' + logdir_UE - #print cmd #result = oai_UE.send_recv(cmd) - #print result #cmd = 'mkdir -p ' + logdir_EPC #result = oai_EPC.send_recv(cmd) @@ -764,11 +749,9 @@ def handle_testcaseclass_softmodem (testcase, oldprogramList, logdirOAI5GRepo , cmd = 'rm -fr ' + logdir_eNB + ' ; mkdir -p ' + logdir_eNB result = oai_eNB.send_recv(cmd) cmd = 'rm -fr ' + logdir_UE + ' ; mkdir -p ' + logdir_UE -# print cmd result = oai_UE.send_recv(cmd) - # print result cmd = 'rm -fr ' + logdir_EPC + '; mkdir -p ' + logdir_EPC -# result = oai_EPC.send_recv(cmd) + result = oai_EPC.send_recv(cmd) cmd = ' rm -fr ' + logdir_local_testcase + ' ; mkdir -p ' + logdir_local_testcase result = os.system(cmd) @@ -919,17 +902,17 @@ def handle_testcaseclass_softmodem (testcase, oldprogramList, logdirOAI5GRepo , logfile_task_EPC_compile = logdir_local_testcase + '/EPC_task_compile' + '_' + str(run) + '_.log' logfile_local_traffic_EPC_out = logdir_local_testcase + '/EPC_traffic' + '_' + str(run) + '_.log' -# task_EPC_compile = ' ( uname -a ; date \n' -# task_EPC_compile = task_EPC_compile + 'array_exec_pid=()' + '\n' -# task_EPC_compile = task_EPC_compile + 'cd ' + logdirOpenaircnRepo + ' ; source oaienv \n' -# task_EPC_compile = task_EPC_compile + update_config_file(oai_EPC, EPC_config_file, logdirOpenaircnRepo, logdirOpenaircnRepo+'/TEST/autotests/tools/search_repl.py') + '\n' -# task_EPC_compile = task_EPC_compile + 'source BUILD/TOOLS/build_helper \n' -# if EPC_compile_prog != "": -# task_EPC_compile = task_EPC_compile + '(' + EPC_compile_prog + ' ' + EPC_compile_prog_args + ' ) > ' + logfile_compile_EPC + ' 2>&1 \n' -# if HSS_compile_prog != "": -# task_EPC_compile = task_EPC_compile + '(' + HSS_compile_prog + ' ' + HSS_compile_prog_args + ' ) > ' + logfile_compile_HSS + ' 2>&1 \n' -# task_EPC_compile = task_EPC_compile + ' ) > ' + logfile_task_EPC_compile_out + ' 2>&1 ' -# write_file(logfile_task_EPC_compile, task_EPC_compile, mode="w") + task_EPC_compile = ' ( uname -a ; date \n' + task_EPC_compile = task_EPC_compile + 'array_exec_pid=()' + '\n' + task_EPC_compile = task_EPC_compile + 'cd ' + logdirOpenaircnRepo + ' ; source oaienv \n' + task_EPC_compile = task_EPC_compile + update_config_file(oai_EPC, EPC_config_file, logdirOpenaircnRepo, logdirOpenaircnRepo+'/TEST/autotests/tools/search_repl.py') + '\n' + task_EPC_compile = task_EPC_compile + 'source BUILD/TOOLS/build_helper \n' + if EPC_compile_prog != "": + task_EPC_compile = task_EPC_compile + '(' + EPC_compile_prog + ' ' + EPC_compile_prog_args + ' ) > ' + logfile_compile_EPC + ' 2>&1 \n' + if HSS_compile_prog != "": + task_EPC_compile = task_EPC_compile + '(' + HSS_compile_prog + ' ' + HSS_compile_prog_args + ' ) > ' + logfile_compile_HSS + ' 2>&1 \n' + task_EPC_compile = task_EPC_compile + ' ) > ' + logfile_task_EPC_compile_out + ' 2>&1 ' + write_file(logfile_task_EPC_compile, task_EPC_compile, mode="w") task_EPC = ' ( uname -a ; date \n' task_EPC = task_EPC + ' export OPENAIRCN_TESTDIR=' + logdir_EPC + '\n' @@ -960,30 +943,31 @@ def handle_testcaseclass_softmodem (testcase, oldprogramList, logdirOAI5GRepo , task_EPC = task_EPC + ' ) > ' + logfile_task_EPC_out + ' 2>&1 ' write_file(logfile_task_EPC, task_EPC, mode="w") - #first we compile all the programs -# thread_EPC = oaiThread(1, "EPC_thread", EPCMachine, user, password , task_EPC_compile, False, timeout_thread) - thread_eNB = oaiThread(2, "eNB_thread", eNBMachine, user, password , task_eNB_compile, False, timeout_thread) - thread_UE = oaiThread(3, "UE_thread", UEMachine, user, password , task_UE_compile, False, timeout_thread) - if RRHMachine != '': - thread_RRH = oaiThread(4, "RRH_thread", RRHMachine, user, password , task_RRH_compile, False, timeout_thread) - threads=[] - threads.append(thread_eNB) - threads.append(thread_UE) -# threads.append(thread_EPC) - if RRHMachine != '': - threads.append(thread_RRH) - # Start new Threads - thread_eNB.start() - thread_UE.start() -# thread_EPC.start() - if RRHMachine != '': - thread_RRH.start() - #Wait for all the compile threads to complete - for t in threads: - t.join() + #first we compile all the programs but only for run_0 + if run == 0: + thread_EPC = oaiThread(1, "EPC_thread", EPCMachine, user, password , task_EPC_compile, False, timeout_thread) + thread_eNB = oaiThread(2, "eNB_thread", eNBMachine, user, password , task_eNB_compile, False, timeout_thread) + thread_UE = oaiThread(3, "UE_thread", UEMachine, user, password , task_UE_compile, False, timeout_thread) + if RRHMachine != '': + thread_RRH = oaiThread(4, "RRH_thread", RRHMachine, user, password , task_RRH_compile, False, timeout_thread) + threads=[] + threads.append(thread_eNB) + threads.append(thread_UE) + threads.append(thread_EPC) + if RRHMachine != '': + threads.append(thread_RRH) + # Start new Threads + thread_eNB.start() + thread_UE.start() + thread_EPC.start() + if RRHMachine != '': + thread_RRH.start() + #Wait for all the compile threads to complete + for t in threads: + t.join() #Now we execute all the threads -# thread_EPC = oaiThread(1, "EPC_thread", EPCMachine, user, password , task_EPC, False, timeout_thread) + thread_EPC = oaiThread(1, "EPC_thread", EPCMachine, user, password , task_EPC, False, timeout_thread) thread_eNB = oaiThread(2, "eNB_thread", eNBMachine, user, password , task_eNB, False, timeout_thread) thread_UE = oaiThread(3, "UE_thread", UEMachine, user, password , task_UE, False, timeout_thread) if RRHMachine != '': @@ -991,14 +975,14 @@ def handle_testcaseclass_softmodem (testcase, oldprogramList, logdirOAI5GRepo , threads=[] threads.append(thread_eNB) threads.append(thread_UE) -# threads.append(thread_EPC) + threads.append(thread_EPC) if RRHMachine != '': threads.append(thread_RRH) # Start new Threads thread_eNB.start() thread_UE.start() -# thread_EPC.start() + thread_EPC.start() if RRHMachine != '': thread_RRH.start() #Wait for all the compile threads to complete @@ -1008,8 +992,7 @@ def handle_testcaseclass_softmodem (testcase, oldprogramList, logdirOAI5GRepo , if RRHMachine != '': cleanOldProgramsAllMachines([oai_eNB, oai_UE, oai_EPC, oai_RRH] , oldprogramList, CleanUpAluLteBox, ExmimoRfStop, [logdir_eNB, logdir_UE, logdir_EPC, logdir_RRH], logdirOAI5GRepo) else: - cleanOldProgramsAllMachines([oai_eNB, oai_UE] , oldprogramList, CleanUpAluLteBox, ExmimoRfStop, [logdir_eNB, logdir_UE, logdir_EPC], logdirOAI5GRepo) -# cleanOldProgramsAllMachines([oai_eNB, oai_UE, oai_EPC] , oldprogramList, CleanUpAluLteBox, ExmimoRfStop, [logdir_eNB, logdir_UE, logdir_EPC], logdirOAI5GRepo) + cleanOldProgramsAllMachines([oai_eNB, oai_UE, oai_EPC] , oldprogramList, CleanUpAluLteBox, ExmimoRfStop, [logdir_eNB, logdir_UE, logdir_EPC], logdirOAI5GRepo) logfile_UE_stop_script_out = logdir_UE + '/UE_stop_script_out' + '_' + str(run) + '_.log' logfile_UE_stop_script = logdir_local_testcase + '/UE_stop_script' + '_' + str(run) + '_.log' @@ -1020,32 +1003,30 @@ def handle_testcaseclass_softmodem (testcase, oldprogramList, logdirOAI5GRepo , cmd = cmd + UE_stop_script + '\n' cmd = cmd + ') > ' + logfile_UE_stop_script_out + ' 2>&1 ' write_file(logfile_UE_stop_script , cmd, mode="w") -# thread_UE = oaiThread(4, "UE_thread", UEMachine, user, password , cmd, False, timeout_thread) -# thread_UE.start() -# thread_UE.join() + thread_UE = oaiThread(4, "UE_thread", UEMachine, user, password , cmd, False, timeout_thread) + thread_UE.start() + thread_UE.join() #Now we change the permissions of the logfiles to avoid some of them being with root permissions cmd = 'sudo -E chown -R ' + user + ' ' + logdir_eNB res= oai_eNB.send_recv(cmd) -# print "Changing permissions of logdir <" + logdir_eNB + "> in eNB machine..." + res + print "Changing permissions of logdir <" + logdir_eNB + "> in eNB machine..." + res cmd = 'sudo -E chown -R ' + user + ' ' + logdir_UE -# print cmd res= oai_UE.send_recv(cmd) -# print res -# print "Changing permissions of logdir <" + logdir_UE + "> in UE machine..." + res + print "Changing permissions of logdir <" + logdir_UE + "> in UE machine..." + res cmd = 'sudo -E chown -R ' + user + ' ' + logdir_EPC -# res= oai_EPC.send_recv(cmd) -# print "Changing permissions of logdir <" + logdir_EPC + "> in EPC machine..." + res + res= oai_EPC.send_recv(cmd) + print "Changing permissions of logdir <" + logdir_EPC + "> in EPC machine..." + res if RRHMachine != '': cmd = 'sudo -E chown -R ' + user + ' ' + logdir_RRH res= oai_RRH.send_recv(cmd) -# print "Changing permissions of logdir <" + logdir_RRH + "> in RRH machine..." + res + print "Changing permissions of logdir <" + logdir_RRH + "> in RRH machine..." + res print "Copying files from EPCMachine : " + EPCMachine + "logdir_EPC = " + logdir_EPC -# SSHSessionWrapper(EPCMachine, user, None, password, logdir_EPC, logdir_local + '/cmake_targets/autotests/log/'+ testcasename, "get_all") + SSHSessionWrapper(EPCMachine, user, None, password, logdir_EPC, logdir_local + '/cmake_targets/autotests/log/'+ testcasename, "get_all") print "Copying files from eNBMachine " + eNBMachine + "logdir_eNB = " + logdir_eNB SSHSessionWrapper(eNBMachine, user, None, password, logdir_eNB, logdir_local + '/cmake_targets/autotests/log/'+ testcasename, "get_all") @@ -1089,6 +1070,13 @@ def handle_testcaseclass_softmodem (testcase, oldprogramList, logdirOAI5GRepo , run_result=0 run_result_string = ' RUN_'+str(run) + ' = FAIL(Thread_Busy)' + #If there is Segmentation fault, we mark the test case as failure as most likely eNB crashed + cmd = "grep -ilr \"segmentation fault\" " + logdir_local_testcase + " | cat " + cmd_out = subprocess.check_output ([cmd], shell=True) + if len(cmd_out) !=0: + run_result=0 + run_result_string = ' RUN_'+str(run) + ' = FAIL(SEGFAULT)' + run_result_string = run_result_string + tput_run_string test_result=test_result & run_result @@ -1096,7 +1084,7 @@ def handle_testcaseclass_softmodem (testcase, oldprogramList, logdirOAI5GRepo , oai_eNB.disconnect() oai_UE.disconnect() -# oai_EPC.disconnect() + oai_EPC.disconnect() #We need to close the new ssh session that was created #if index_eNBMachine == index_EPCMachine: # oai_EPC.disconnect() @@ -1113,6 +1101,7 @@ def handle_testcaseclass_softmodem (testcase, oldprogramList, logdirOAI5GRepo , + # \brief handler for executing test cases (lte-softmodem-noS1) # \param testcase name of testcase # \param oldprogramList list of programs which must be terminated before running a test case @@ -1329,6 +1318,8 @@ def handle_testcaseclass_softmodem_noS1 (testcase, oldprogramList, logdirOAI5GRe if testcase_verdict != 'PASS': # if something went wrong to not run test cases max_ntries=0 + indent="\t\t" + runs_results = [] nb_runs = 0 nb_run_pass = 0 @@ -1348,9 +1339,11 @@ def handle_testcaseclass_softmodem_noS1 (testcase, oldprogramList, logdirOAI5GRe # # RUN initialization # ---------------------------------------------------- - print (Fore.WHITE + indent + "> RUN_"+str(run).zfill(2)+" : " ), - - sys.stdout.flush() + + prefix_string = Fore.WHITE + indent + "> RUN_"+str(run).zfill(2)+" :" + +# print (Fore.WHITE + indent + "> RUN_"+str(run).zfill(2)+" : " ), +# sys.stdout.flush() run_start_time=datetime.datetime.now() @@ -1466,8 +1459,34 @@ def handle_testcaseclass_softmodem_noS1 (testcase, oldprogramList, logdirOAI5GRe threads.append(thread_UE) thread_eNB.start() thread_UE.start() + + run_work_inprogress_flag = True + progress_step = timeout_thread/20 + progress_count = 0 + + while (run_work_inprogress_flag): + + + update_progress(float(progress_count)/float(timeout_thread),prefix_string) + + time.sleep(progress_step) + + progress_count += progress_step + +# sys.stdout.write ('#') +# sys.stdout.flush() + + run_work_inprogress_flag = False + for t in threads: + if t.isAlive(): + run_work_inprogress_flag = True + + + update_progress(1,prefix_string) + for t in threads: - t.join() + t.join() + # # @@ -1482,10 +1501,12 @@ def handle_testcaseclass_softmodem_noS1 (testcase, oldprogramList, logdirOAI5GRe fname = logdir_local_run+ '/UE_exec' + '_' + str(run) + '_.log' cell_synch_status = analyser.check_cell_synchro(fname) + print (Fore.WHITE + indent + "> Check Cell synchro :"), + if cell_synch_status == 'CELL_SYNCH': - print '!!!!!!!!!!!!!! Cell synchronized !!!!!!!!!!!' + print ( Fore.GREEN + cell_synch_status) else : - print '!!!!!!!!!!!!!! Cell NOT NOT synchronized !!!!!!!!!!!' + print ( Fore.RED + cell_synch_status) metric_checks_flag = 0 ue_seg_fault_status = analyser.check_exec_seg_fault(fname) @@ -1504,6 +1525,9 @@ def handle_testcaseclass_softmodem_noS1 (testcase, oldprogramList, logdirOAI5GRe # UE side metrics metricList=testcase.findall('UE_metric') for metric in metricList: + + metric_verdict = 'PASS' + metric_def = {} metric_def['id'] = metric.get('id') metric_def['description'] = metric.get('description') @@ -1524,15 +1548,19 @@ def handle_testcaseclass_softmodem_noS1 (testcase, oldprogramList, logdirOAI5GRe metric_extracted = analyser.do_extract_metrics(args) - print "\t > Metric "+metric_def['id']+" :" - print "\t\t> min = "+ str( metric_extracted['metric_min'] ) - print "\t\t> min_index = "+ str( metric_extracted['metric_min_index'] ) - print "\t\t> max = "+ str( metric_extracted['metric_max'] ) - print "\t\t> max_index = "+ str( metric_extracted['metric_max_index'] ) - print "\t\t> mean = "+ str( metric_extracted['metric_mean'] ) - print "\t\t> median = "+ str( metric_extracted['metric_median'] ) + print (Fore.WHITE + indent + "> Metric : "+metric_def['id']), + print ("(min="+str( metric_extracted['metric_min'])+", max="+str( metric_extracted['metric_max'])+", mean="+str( metric_extracted['metric_mean'])+", median="+str( metric_extracted['metric_median'])+")") - verdict = analyser.do_check_verdict(metric_def, metric_extracted) +# print "\t > Metric "+metric_def['id']+" :" +# print "\t\t> min = "+ str( metric_extracted['metric_min'] ) +# print "\t\t> min_index = "+ str( metric_extracted['metric_min_index'] ) +# print "\t\t> max = "+ str( metric_extracted['metric_max'] ) +# print "\t\t> max_index = "+ str( metric_extracted['metric_max_index'] ) +# print "\t\t> mean = "+ str( metric_extracted['metric_mean'] ) +# print "\t\t> median = "+ str( metric_extracted['metric_median'] ) + + if metric_def['pass_fail_stat'] : + metric_verdict = analyser.do_check_verdict(metric_def, metric_extracted) metric_fig = logdir_local_run+ '/UE_metric_'+ metric_def['id']+'_' + str(run) + '_.png' analyser.do_img_metrics(metric_def, metric_extracted, metric_fig) @@ -1560,6 +1588,13 @@ def handle_testcaseclass_softmodem_noS1 (testcase, oldprogramList, logdirOAI5GRe runs_metrics.append(run_metrics) + if metric_verdict != 'PASS': + verdict = metric_verdict + + # End Metrics LOOP + # --------------------- + + # Traffic analysis if UE_traffic_exec != "": @@ -1613,9 +1648,9 @@ def handle_testcaseclass_softmodem_noS1 (testcase, oldprogramList, logdirOAI5GRe run_stop_time=datetime.datetime.now() run_duration = run_stop_time-run_start_time # print (Fore.WHITE + ("duration=" :"), - print (Fore.WHITE + indent + "> RUN duration : "+ str(run_duration) +"s" ) + print (Fore.WHITE + indent + "> RUN duration : "+ str(run_duration) +"s" ) - print (Fore.WHITE + indent + "> RUN verdict :"), + print (Fore.WHITE + indent + "> RUN verdict :"), if verdict == 'PASS': nb_run_pass += 1 @@ -1645,6 +1680,8 @@ def handle_testcaseclass_softmodem_noS1 (testcase, oldprogramList, logdirOAI5GRe # END RUN LOOP #---------------------------------------------------- + indent="\t" + # Test case duration # ---------------------------------- testcase_time_stop = datetime.datetime.now() @@ -1684,11 +1721,9 @@ def handle_testcaseclass_softmodem_noS1 (testcase, oldprogramList, logdirOAI5GRe else: print (Fore.YELLOW+'INCONCLUSIVE') - duration= testcase_time_stop - testcase_time_start - xmlFile = logdir_local_testcase + '/test.' + testcasename + '.xml' - xml="\n \n" - write_file(xmlFile, xml, mode="w") + print(Style.RESET_ALL) + duration= testcase_time_stop - testcase_time_start test_result = dict(testcase_name=testcasename, testcaseclass=testcaseclass, @@ -1709,161 +1744,20 @@ def handle_testcaseclass_softmodem_noS1 (testcase, oldprogramList, logdirOAI5GRe runs_results = runs_results) test_results.append(test_result) + xmlFile = logdir_local_testcase + '/test.' + testcasename + '.xml' + xml="\n \n" + write_file(xmlFile, xml, mode="w") + + xmlFile_ng = logdir_local_testcase + '/test.' + testcasename + '_ng.xml' + xml_ng = xmlify(test_result, wrap=testcasename, indent=" ") + write_file(xmlFile_ng, xml_ng, mode="w") + + + return testcase_verdict -# mypassword='' -# #addsudo = 'echo \'' + mypassword + '\' | sudo -S -E ' -# addpass = 'echo \'' + mypassword + '\' | ' -# #user = getpass.getuser() - - - - - - - -# eNB_traffic_exec = testcase.findtext('eNB_traffic_exec',default='') -# eNB_traffic_exec_args = testcase.findtext('eNB_traffic_exec_args',default='') -# eNB_terminate_missing_procs = testcase.findtext('eNB_terminate_missing_procs',default='True') -# eNB_search_expr_true = testcase.findtext('eNB_search_expr_true','') -# if re.compile('\w+').match(eNB_search_expr_true) != None: -# eNB_search_expr_true = eNB_search_expr_true + ' duration=' + str(timeout_cmd-90) + 's' - - - -# UE_traffic_exec = testcase.findtext('UE_traffic_exec',default='') -# UE_traffic_exec_args = testcase.findtext('UE_traffic_exec_args',default='') -# -# UE_search_expr_true = testcase.findtext('UE_search_expr_true','') -# UE_stop_script = testcase.findtext('UE_stop_script','') -# if re.compile('\w+').match(UE_search_expr_true) != None: -# UE_search_expr_true = UE_search_expr_true + ' duration=' + str(timeout_cmd-90) + 's' - - - -# #cleanOldPrograms(oai_eNB, oldprogramList, CleanUpAluLteBox, ExmimoRfStop) -# #cleanOldPrograms(oai_UE, oldprogramList, CleanUpAluLteBox, ExmimoRfStop) -# #cleanOldPrograms(oai_EPC, oldprogramList, CleanUpAluLteBox, ExmimoRfStop) -# logdir_local = os.environ.get('OPENAIR_DIR') -# if logdir_local is None: -# print "Environment variable OPENAIR_DIR not set correctly" -# sys.exit() - - -# print "Updating the config files for ENB/UE/EPC..." -# #updating the eNB/UE/EPC configuration file from the test case -# #update_config_file(oai_eNB, eNB_config_file, logdirOAI5GRepo) -# #update_config_file(oai_UE, UE_config_file, logdirOAI5GRepo) -# #update_config_file(oai_EPC, EPC_config_file, logdirOpenaircnRepo) - -# test_result=1 -# test_result_string='' -# start_time=time.time() - -# for run in range(0,nruns): -# run_result=1 -# run_result_string='' -# logdir_eNB = logdirOAI5GRepo+'/cmake_targets/autotests/log/'+ testcasename + '/run_' + str(run) -# logdir_UE = logdirOAI5GRepo+'/cmake_targets/autotests/log/'+ testcasename + - - - - -# logfile_traffic_eNB = logdir_eNB + '/eNB_traffic' + '_' + str(run) + '_.log' - - -# logfile_local_traffic_eNB_out = logdir_local_testcase + '/eNB_traffic' + '_' + str(run) + '_.log' -# logfile_tshark_eNB = logdir_eNB + '/eNB_tshark' + '_' + str(run) + '_.log' -# logfile_pcap_eNB = logdir_eNB + '/eNB_tshark' + '_' + str(run) + '_.pcap' -# logfile_pcap_zip_eNB = logdir_eNB + '/eNB_tshark' + '_' + str(run) + '_.pcap.zip' -# logfile_pcap_tmp_eNB = '/tmp/' + '/eNB_tshark' + '_' + str(run) + '_.pcap' - -# task_eNB_compile = ' ( uname -a ; date \n' -# task_eNB_compile = task_eNB_compile + 'cd ' + logdirOAI5GRepo + ' ; source oaienv ; source cmake_targets/tools/build_helper \n' -# task_eNB_compile = task_eNB_compile + 'env |grep OPENAIR \n' -# task_eNB_compile = task_eNB_compile + update_config_file(oai_eNB, eNB_config_file, logdirOAI5GRepo, '$OPENAIR_DIR/cmake_targets/autotests/tools/search_repl.py') + '\n' -# if eNB_compile_prog != "": -# task_eNB_compile = task_eNB_compile + ' ( ' + eNB_compile_prog + ' '+ eNB_compile_prog_args + ' ) > ' + logfile_compile_eNB + ' 2>&1 \n' -# task_eNB_compile = task_eNB_compile + ' date ) > ' + logfile_task_eNB_compile_out + ' 2>&1 ' -# write_file(logfile_task_eNB_compile, task_eNB_compile, mode="w") - - - -# #task_eNB = 'echo \" ' + task_eNB + '\" > ' + logfile_script_eNB + ' 2>&1 ; ' + task_eNB -# logfile_compile_UE = logdir_UE + '/UE_compile' + '_' + str(run) + '_.log' -# logfile_exec_UE = logdir_UE + '/UE_exec' + '_' + str(run) + '_.log' - - - - -# #Now we execute all the threads - - -# #Now we get the log files from remote machines on the local machine -# cleanOldProgramsAllMachines([oai_eNB, oai_UE] , oldprogramList, CleanUpAluLteBox, ExmimoRfStop, [logdir_eNB, logdir_UE, logdir_EPC], logdirOAI5GRepo) - -# logfile_UE_stop_script_out = logdir_UE + '/UE_stop_script_out' + '_' + str(run) + '_.log' -# logfile_UE_stop_script = logdir_local_testcase + '/UE_stop_script' + '_' + str(run) + '_.log' - -# if UE_stop_script != "": -# cmd = ' ( uname -a ; date \n' -# cmd = cmd + 'cd ' + logdirOAI5GRepo + ' ; source oaienv ; source cmake_targets/tools/build_helper \n' -# cmd = cmd + 'env |grep OPENAIR \n' + 'array_exec_pid=() \n' -# cmd = cmd + UE_stop_script + '\n' -# cmd = cmd + ') > ' + logfile_UE_stop_script_out + ' 2>&1 ' -# write_file(logfile_UE_stop_script , cmd, mode="w") -# # thread_UE = oaiThread(4, "UE_thread", UEMachine, user, password , cmd, False, timeout_thread) -# # thread_UE.start() -# # thread_UE.join() - - - - -# #Currently we only perform throughput tests -# tput_run_string='' -# result, tput_string = tput_test_search_expr(eNB_search_expr_true, logfile_local_traffic_eNB_out) -# tput_run_string = tput_run_string + tput_string -# run_result=run_result&result -# result, tput_string = tput_test_search_expr(EPC_search_expr_true, logfile_local_traffic_EPC_out) -# run_result=run_result&result -# tput_run_string = tput_run_string + tput_string -# result, tput_string = tput_test_search_expr(UE_search_expr_true, logfile_local_traffic_UE_out) -# run_result=run_result&result -# tput_run_string = tput_run_string + tput_string - -# if run_result == 1: -# run_result_string = ' RUN_'+str(run) + ' = PASS' -# else: -# run_result_string = ' RUN_'+str(run) + ' = FAIL' - -# #If there is assertion, we mark the test case as failure as most likely eNB crashed -# cmd = "grep -ilr \"assertion\" " + logdir_local_testcase + " | cat " -# cmd_out = subprocess.check_output ([cmd], shell=True) -# if len(cmd_out) !=0 : -# run_result=0 -# run_result_string = ' RUN_'+str(run) + ' = FAIL(Assert)' - -# #If there is thread busy error, we mark the test case as failure as most likely eNB crashed -# cmd = "grep -ilr \"thread busy\" " + logdir_local_testcase + " | cat " -# cmd_out = subprocess.check_output ([cmd], shell=True) -# if len(cmd_out) !=0: -# run_result=0 -# run_result_string = ' RUN_'+str(run) + ' = FAIL(Thread_Busy)' - -# run_result_string = run_result_string + tput_run_string - -# test_result=test_result & run_result -# test_result_string=test_result_string + run_result_string - - - - - - - - # \brief This function searches if test case is present in list of test cases that need to be executed by user # \param testcasename the test case to search for @@ -1982,7 +1876,7 @@ flag_skip_oai_install=False flag_skip_machine_preparation=False flag_skip_sanity_check=False Timeout_cmd='' -xmlInputFile=os.environ.get('OPENAIR_DIR')+"/cmake_targets/autotests/testsuite_ue_noS1.xml" +xmlInputFile='' #print "Number of arguments argc = " + str(len(sys.argv)) #for index in range(1,len(sys.argv) ): @@ -2054,6 +1948,9 @@ while i < len (sys.argv): flag_skip_machine_preparation=True elif arg == '--skip-sanity-check': flag_skip_sanity_check=True + elif arg == '--test-suite' : + xmlInputFile = sys.argv[i+1] + i = i +1 elif arg == '-h' : print "-s: This flag *MUST* be set to start the test cases" print "-r: Remove the log directory in autotests" @@ -2073,6 +1970,7 @@ while i < len (sys.argv): print "--skip-oai-install: Skips the openairinterface5g installer" print "--skip-machine-preparation: skipp the whole system preparation -> direct to test cases" print "--skip-sanity-check: skipp the machine sanity checks" + print "--test-suite: Select a XML test-suite file" sys.exit() else : print "Unrecongnized Option: <" + arg + ">. Use -h to see valid options" @@ -2163,7 +2061,7 @@ print (Fore.WHITE + ' + Timeout_cmd : '+ Timeout_cmd) if GitOAI5GHeadVersion == '': - cmd = "git log --pretty=format:\'%H\' -n 1 origin/"+ GitOAI5GRepoBranch + cmd = "git log --pretty=format:\'%H\' -n 1" # origin/"+ GitOAI5GRepoBranch # cmd = "git show-ref --heads -s "+ GitOAI5GRepoBranch GitOAI5GHeadVersion = subprocess.check_output ([cmd], shell=True) GitOAI5GHeadVersion=GitOAI5GHeadVersion.replace("\n","") @@ -2337,13 +2235,24 @@ if not flag_skip_machine_preparation: setuplogfile = logdir + '/setup_log_' + MachineList[index] + '_.txt' setup_script = locallogdir + '/setup_script_' + MachineList[index] + '_.txt' + + #Sometimes git fails so the script below retries in that case + localfile = os.path.expandvars('$OPENAIR_DIR/cmake_targets/autotests/tools/git-retry.sh') + remotefile = logdir + '/git-retry.sh' + paramList=[] + port=22 + paramList.append ( {"operation":'put', "localfile":localfile, "remotefile":remotefile} ) + sftp_log = os.path.expandvars(locallogdir + '/sftp_module.log') + sftp_module (user, pw, MachineList[index], port, paramList, sftp_log) + cmd = ' ( \n' #cmd = cmd + 'rm -fR ' + logdir + '\n' #cmd = cmd + 'mkdir -p ' + logdir + '\n' cmd = cmd + 'cd '+ logdir + '\n' - cmd = cmd + 'git config --global http.sslVerify false \n' - cmd = cmd + 'git clone '+ GitOAI5GRepo +' \n' - cmd = cmd + 'git clone '+ GitOpenaircnRepo + ' \n' + cmd = cmd + 'sudo apt-get install -y git \n' + cmd = cmd + 'chmod 700 ' + logdir + '/git-retry.sh \n' + cmd = cmd + logdir + '/git-retry.sh clone '+ GitOAI5GRepo +' \n' + cmd = cmd + logdir + '/git-retry.sh clone '+ GitOpenaircnRepo + ' \n' cmd = cmd + 'cd ' + logdirOAI5GRepo + '\n' cmd = cmd + 'git checkout ' + GitOAI5GRepoBranch + '\n' if GitOAI5GHeadVersion : @@ -2399,9 +2308,8 @@ if not flag_skip_machine_preparation: paramList=[] sftp_log = os.path.expandvars(locallogdir + '/sftp_module.log') - #Now we copy patch files for u + #Now we copy patch files and apply them print( Fore.WHITE + " - Installating patch files on machine " + MachineList[index]) - #Now we copy patch files for u for patchFile in OAI5GpatchFileList: localfile = os.path.expandvars('$OPENAIR_DIR/cmake_targets/autotests/patches/')+patchFile.get('name') remotefile = logdirOAI5GRepo + '/cmake_targets/autotests/patches/'+patchFile.get('name') @@ -2417,19 +2325,20 @@ if not flag_skip_machine_preparation: paramList=[] + setuplogfile = logdir + '/setup_log_' + MachineList[index] + '_.txt' + setup_script = locallogdir + '/setup_script_' + MachineList[index] + '_.txt' + localfile = locallogdir + '/setup_log_' + MachineList[index] + '_.txt' + remotefile = logdir + '/setup_log_' + MachineList[index] + '_.txt' + sftp_log = os.path.expandvars(locallogdir + '/sftp_module.log') + paramList.append ( {"operation":'get', "localfile":localfile, "remotefile":remotefile} ) + #sftp_module (user, pw, MachineList[index], port, localfile, remotefile, sftp_log, "get") + #Now we copy test_case_list.xml on the remote machines localfile = os.path.expandvars('$OPENAIR_DIR/cmake_targets/autotests/test_case_list.xml') remotefile = logdirOAI5GRepo + '/cmake_targets/autotests/test_case_list.xml' # paramList.append ( {"operation":'put', "localfile":localfile, "remotefile":remotefile} ) # sftp_module (user, pw, MachineList[index], port, paramList, sftp_log) - setuplogfile = logdir + '/setup_log_' + MachineList[index] + '_.txt' - setup_script = locallogdir + '/setup_script_' + MachineList[index] + '_.txt' - localfile = locallogdir + '/setup_log_' + MachineList[index] + '_.txt' - remotefile = logdir + '/setup_log_' + MachineList[index] + '_.txt' - - sftp_log = os.path.expandvars(locallogdir + '/sftp_module.log') - paramList.append ( {"operation":'get', "localfile":localfile, "remotefile":remotefile} ) sftp_module (user, pw, MachineList[index], port, paramList, sftp_log) @@ -2456,6 +2365,7 @@ if not flag_skip_machine_preparation: print "Exiting now..." sys.exit(0) + else: print (Fore.RED + " Skipping Machine preparation...") @@ -2558,21 +2468,65 @@ for testcase in testcaseList: try: testcasename = testcase.get('id') testcaseclass = testcase.findtext('class',default='') + desc = testcase.findtext('desc',default='') + #print "Machine list top level = " + ','.join(MachineList) - if (search_test_case_group(testcasename, testcasegroup, TestCaseExclusionList)): + if search_test_case_group(testcasename, testcasegroup, TestCaseExclusionList) == True: run_count+=1 print (Fore.WHITE + " ("+str(run_count).zfill(3)+"/"+str(nb_run_testcases).zfill(3)+") - test case "+testcasename+" : "), if testcaseclass == 'lte-softmodem' : - print (Fore.RED + "skipped - lte-softmodem class not supported") - elif testcaseclass == 'lte-softmodem-noS1': - print + eNBMachine = testcase.findtext('eNB',default='') + UEMachine = testcase.findtext('UE',default='') + EPCMachine = testcase.findtext('EPC',default='') + #index_eNBMachine = MachineList.index(eNBMachine) + #index_UEMachine = MachineList.index(UEMachine) + #index_EPCMachine = MachineList.index(EPCMachine) + if (eNBMachine not in MachineList)|(UEMachine not in MachineList)|(UEMachine not in MachineList): + print "One of the machines is not in the machine list" + print "eNBMachine : " + eNBMachine + "UEMachine : " + UEMachine + "EPCMachine : " + EPCMachine + "MachineList : " + ','.join(MachineList) + print "testcasename = " + testcasename + " class = " + testcaseclass + threadListGlobal = wait_testcaseclass_generic_threads(threadListGlobal, Timeout_execution) + #cleanOldProgramsAllMachines(oai_list, CleanUpOldProgs, CleanUpAluLteBox, ExmimoRfStop) + handle_testcaseclass_softmodem (testcase, CleanUpOldProgs, logdirOAI5GRepo, logdirOpenaircnRepo, MachineList, user, pw, CleanUpAluLteBox, ExmimoRfStop, nruns_lte_softmodem, Timeout_cmd ) + + #The lines below are copied from below to trace the failure of some of the machines in test setup. These lines below need to be removed in long term + print "Creating xml file for overall results..." + cmd = "cat $OPENAIR_DIR/cmake_targets/autotests/log/*/*.xml > $OPENAIR_DIR/cmake_targets/autotests/log/results_autotests.xml " + res=os.system(cmd) + os.system('sync') + print "Now copying files to NFS Share" + oai_localhost = openair('localdomain','localhost') + oai_localhost.connect(user,pw) + cmd = ' mkdir -p ' + NFSTestsResultsDir + res = oai_localhost.send_recv(cmd) + + print "Copying files from GilabCI Runner Machine : " + host + " .locallogdir = " + locallogdir + ", NFSTestsResultsDir = " + NFSTestsResultsDir + SSHSessionWrapper('localhost', user, None, pw , NFSTestsResultsDir , locallogdir, "put_all") + oai_localhost.disconnect() + + elif testcaseclass == 'lte-softmodem-noS1' : + eNBMachine = testcase.findtext('eNB',default='') + UEMachine = testcase.findtext('UE',default='') + if (eNBMachine not in MachineList)|(UEMachine not in MachineList): + print "One of the machines is not in the machine list" + print "eNBMachine : " + eNBMachine + "UEMachine : " + UEMachine + "MachineList : " + ','.join(MachineList) + print "testcasename = " + testcasename + " class = " + testcaseclass + threadListGlobal = wait_testcaseclass_generic_threads(threadListGlobal, Timeout_execution) + handle_testcaseclass_softmodem_noS1 (testcase, CleanUpOldProgs, logdirOAI5GRepo, logdirOpenaircnRepo, MachineList, user, pw, CleanUpAluLteBox, ExmimoRfStop, nruns_lte_softmodem, Timeout_cmd ) - elif testcaseclass == 'compilation': - print (Fore.RED + "skipped - compilation class not supported") - elif testcaseclass == 'execution': - print (Fore.RED + "skipped - execution class not supported") + + #The lines below are copied from below to trace the failure of some of the machines in test setup. These lines below need to be removed in long term + print "Creating xml file for overall results..." + cmd = "cat $OPENAIR_DIR/cmake_targets/autotests/log/*/*.xml > $OPENAIR_DIR/cmake_targets/autotests/log/results_autotests.xml " + res=os.system(cmd) + os.system('sync') + + elif (testcaseclass == 'compilation'): + threadListGlobal = handle_testcaseclass_generic (testcasename, threadListGlobal, CleanUpOldProgs, logdirOAI5GRepo, MachineListGeneric, user, pw, CleanUpAluLteBox,Timeout_execution, ExmimoRfStop) + elif (testcaseclass == 'execution'): + threadListGlobal = handle_testcaseclass_generic (testcasename, threadListGlobal, CleanUpOldProgs, logdirOAI5GRepo, MachineListGeneric, user, pw, CleanUpAluLteBox, Timeout_execution, ExmimoRfStop) else : - print (Fore.RED + "Unknown test case class: " + testcaseclass) + print "Unknown test case class: " + testcaseclass sys.exit() except Exception, e: @@ -2582,8 +2536,14 @@ for testcase in testcaseList: error = error + traceback.format_exc() print error print "Continuing to next test case..." + #sys.exit(1) -threadListGlobal=[] + +print "Exiting the test cases execution now. Waiting for existing threads to complete..." + +for param in threadListGlobal: + thread_id = param["thread_id"] + thread_id.join() # ************************************************************************** @@ -2633,153 +2593,3 @@ analyser.create_report_html(context) exit_prog(0) -#print testcaseList -for testcase in testcaseList: - try: - testcasename = testcase.get('id') - testcaseclass = testcase.findtext('class',default='') - desc = testcase.findtext('desc',default='') - #print "Machine list top level = " + ','.join(MachineList) - if search_test_case_group(testcasename, testcasegroup, TestCaseExclusionList) == True: - if testcaseclass == 'lte-softmodem' : - eNBMachine = testcase.findtext('eNB',default='') - UEMachine = testcase.findtext('UE',default='') - EPCMachine = testcase.findtext('EPC',default='') - #index_eNBMachine = MachineList.index(eNBMachine) - #index_UEMachine = MachineList.index(UEMachine) - #index_EPCMachine = MachineList.index(EPCMachine) - if (eNBMachine not in MachineList)|(UEMachine not in MachineList)|(UEMachine not in MachineList): - print "One of the machines is not in the machine list" - print "eNBMachine : " + eNBMachine + "UEMachine : " + UEMachine + "EPCMachine : " + EPCMachine + "MachineList : " + ','.join(MachineList) - print "testcasename = " + testcasename + " class = " + testcaseclass - threadListGlobal = wait_testcaseclass_generic_threads(threadListGlobal, Timeout_execution) - #cleanOldProgramsAllMachines(oai_list, CleanUpOldProgs, CleanUpAluLteBox, ExmimoRfStop) - #handle_testcaseclass_softmodem (testcase, CleanUpOldProgs, logdirOAI5GRepo, logdirOpenaircnRepo, MachineList, user, pw, CleanUpAluLteBox, ExmimoRfStop, nruns_lte_softmodem, Timeout_cmd ) - - #The lines below are copied from below to trace the failure of some of the machines in test setup. These lines below need to be removed in long term -# print "Creating xml file for overall results..." -# cmd = "cat $OPENAIR_DIR/cmake_targets/autotests/log/*/*.xml > $OPENAIR_DIR/cmake_targets/autotests/log/results_autotests.xml " -# res=os.system(cmd) -# os.system('sync') -# print "Now copying files to NFS Share" -# oai_localhost = openair('localdomain','localhost') -# oai_localhost.connect(user,pw) -# cmd = ' mkdir -p ' + NFSTestsResultsDir -# print cmd -# res = oai_localhost.send_recv(cmd) -# print res - - # print "Copying files from GilabCI Runner Machine : " + host + " .locallogdir = " + locallogdir + ", NFSTestsResultsDir = " + NFSTestsResultsDir - # SSHSessionWrapper('localhost', user, None, pw , NFSTestsResultsDir , locallogdir, "put_all") - # oai_localhost.disconnect() - - elif (testcaseclass == 'compilation'): - threadListGlobal = handle_testcaseclass_generic (testcasename, threadListGlobal, CleanUpOldProgs, logdirOAI5GRepo, MachineListGeneric, user, pw, CleanUpAluLteBox,Timeout_execution, ExmimoRfStop) - elif (testcaseclass == 'execution'): - threadListGlobal = handle_testcaseclass_generic (testcasename, threadListGlobal, CleanUpOldProgs, logdirOAI5GRepo, MachineListGeneric, user, pw, CleanUpAluLteBox, Timeout_execution, ExmimoRfStop) - else : - print "Unknown test case class: " + testcaseclass - sys.exit() - - except Exception, e: - error='' - error = error + ' In function: ' + sys._getframe().f_code.co_name + ': *** Caught exception: ' + str(e.__class__) + " : " + str( e) - error = error + '\n testcasename = ' + testcasename + '\n testcaseclass = ' + testcaseclass + '\n desc = ' + 'desc' + '\n' - error = error + traceback.format_exc() - print error - print "Continuing to next test case..." - #sys.exit(1) - - -print "Exiting the test cases execution now. Waiting for existing threads to complete..." - -for param in threadListGlobal: - thread_id = param["thread_id"] - thread_id.join() - -print "Creating xml file for overall results..." -cmd = "cat $OPENAIR_DIR/cmake_targets/autotests/log/*/*.xml > $OPENAIR_DIR/cmake_targets/autotests/log/results_autotests.xml " -res=os.system(cmd) - -print "Now copying files to NFS Share" -oai_localhost = openair('localdomain','localhost') -oai_localhost.connect(user,pw) -cmd = 'mkdir -p ' + NFSTestsResultsDir -print cmd -res = oai_localhost.send_recv(cmd) -print res - -print "Copying files from GilabCI Runner Machine : " + host + " .locallogdir = " + locallogdir + ", NFSTestsResultsDir = " + NFSTestsResultsDir -SSHSessionWrapper('localhost', user, None, pw , NFSTestsResultsDir , locallogdir, "put_all") - -cmd = "cat " + NFSTestsResultsDir + "/log/*/*.xml > " + NFSTestsResultsDir + "/log/results_autotests.xml" -res = oai_localhost.send_recv(cmd) - -oai_localhost.disconnect() - -sys.exit() - - - - - - - -run_count = 0 -for testcase in testcaseList: - try: - testcasename = testcase.get('id') - testcaseclass = testcase.findtext('class',default='') - - if (search_test_case_group(testcasename, testcasegroup, TestCaseExclusionList)): - run_count+=1 - print (Fore.WHITE + " ("+str(run_count).zfill(3)+"/"+str(nb_run_testcases).zfill(3)+") - test case "+testcasename+" : "), - if testcaseclass == 'lte-softmodem' : - print (Fore.RED + "skipped - lte-softmodem class not supported") - elif testcaseclass == 'lte-softmodem-noS1': - print - - testcase_verdict = 'PASS' - testcase_time_start = datetime.datetime.now() - testcase_name = testcase.get('id') - testcase_desc = testcase.findtext('desc',default='') - timeout_cmd = testcase.findtext('TimeOut_cmd',default='') - timeout_cmd = int(float(timeout_cmd)) - timeout_thread = timeout_cmd + 300 #Timeout_thread is more than that of cmd to have room for compilation time, etc - if nruns_lte_softmodem == '': - nruns = testcase.findtext('nruns',default='') - else: - nruns = nruns_lte_softmodem - nruns = int(float(nruns)) - tags = testcase.findtext('tags',default='') - testcase_time_stop = datetime.datetime.now() - - test_result = dict(testcase_name=testcase_name, - testcaseclass=testcaseclass, - testcase_verdict = testcase_verdict, - testcase_time_start=testcase_time_start, - testcase_time_stop=testcase_time_stop, - tags=tags, - nruns=nruns, - testcase_timeout=timeout_cmd, - testcase_duration = testcase_time_stop-testcase_time_start, - testcase_eNBMachine ="TOTO", - testcase_UEMachine ="TITI") - test_results.append(test_result) - - - elif testcaseclass == 'compilation': - print (Fore.RED + "skipped - compilation class not supported") - elif testcaseclass == 'execution': - print (Fore.RED + "skipped - execution class not supported") - else : - print (Fore.RED + "Unknown test case class: " + testcaseclass) - sys.exit() - - except Exception, e: - error='' - error = error + ' In function: ' + sys._getframe().f_code.co_name + ': *** Caught exception: ' + str(e.__class__) + " : " + str( e) - error = error + '\n testcasename = ' + testcasename + '\n testcaseclass = ' + testcaseclass + '\n desc = ' + 'desc' + '\n' - error = error + traceback.format_exc() - print error - print "Continuing to next test case..." diff --git a/cmake_targets/autotests/testsuite_ue_noS1.xml b/cmake_targets/autotests/testsuite_ue_noS1.xml new file mode 100644 index 0000000000..c2f87b881f --- /dev/null +++ b/cmake_targets/autotests/testsuite_ue_noS1.xml @@ -0,0 +1,2898 @@ + + +imb182-desktop yanbo-M4HM87P-00 + /mnt/sradio/TEST_RESULTS/ + https://gitlab.eurecom.fr/oai1B/openairinterface5g.git + + + https://gitlab.eurecom.fr/oai/openair-cn.git --> + develop1B + + + + + + + + develop + oaisim oaisim_nos1 lte-softmodem lte-softmodem-nos1 mme_gw run_epc auth_request run_hss oai_hss mme spgw hss hss_sim configure_cots* wvdial iperf iperf_script iperf_script_phone ping tshark rrh_gw iperf3 iperf3_script iperf3_script_phone pppd + sudo -S -E /opt/ltebox/tools/stop_ltebox +$OPENAIR_DIR/cmake_targets/build_oai -w EXMIMO -c; sudo -S -E $OPENAIR_DIR/cmake_targets/tools/stop_exmimo2; sudo -E $OPENAIR_DIR/cmake_targets/autotests/tools/configure_cots_bandrich_ue.py --reset-ue; sudo -E $OPENAIR_DIR/cmake_targets/autotests/tools/configure_cots_huaweiE398_ue.py --reset-ue; sudo -E $OPENAIR_DIR/cmake_targets/autotests/tools/configure_cots_sony_experia_m4_ue.py --stop-ue; uname -a; sudo -E dmesg + 36000 + + + yanbo-M4HM87P-00 + + + + + + + + + + lte-softmodem-noS1 + + imb182-desktop + yanbo-M4HM87P-00 + 300 + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c -w USRP --eNB --noS1 + source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB + + $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 + -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 0 --single-thread-disable --phy-test + + + + + False + + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c --UE -w USRP --noS1 --eNB --ue-autotest-trace + source ./targets/bin/init_nas_nos1 UE + + sleep 20; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C2660000000 -r25 --ue-scan-carrier --ue-txgain 90 -A 20 --ue-rxgain 125 -S --phy-test + + + + + + False + + UE_USRP.NOS1.PHYTEST_PERF.BAND7.5MHZ.MCS00 + 36 + + + + + + lte-softmodem-noS1 + + imb182-desktop + ued-PRM-130 + 300 + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c -w USRP --eNB --noS1 + source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB + + $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 + -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 0 --single-thread-disable --phy-test + + + + + False + + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c --UE -w EXMIMO --noS1 --ue-autotest-trace + source ./targets/bin/init_nas_nos1 UE + + sleep 20; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C 2660000000 -r25 --ue-scan-carrier --ue-txgain 0 --ue-rxgain 5 -S -A 6 -F myriadRF_FMX --ue-max-power -25 --phy-test + + + + + + False + + UE_UEDV1.NOS1.PHYTEST_PERF.BAND7.5MHZ.MCS00 + 36 + + + + + + lte-softmodem-noS1 + + imb182-desktop + yanbo-M4HM87P-00 + 300 + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c -w USRP --eNB --noS1 + source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB + + $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 + -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 1 --single-thread-disable --phy-test + + + + + False + + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c --UE -w USRP --noS1 --eNB --ue-autotest-trace + source ./targets/bin/init_nas_nos1 UE + + sleep 20; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C2660000000 -r25 --ue-scan-carrier --ue-txgain 90 -A 20 --ue-rxgain 125 -S --phy-test + + + + + + False + + UE_USRP.NOS1.PHYTEST_PERF.BAND7.5MHZ.MCS01 + 36 + + + + + + lte-softmodem-noS1 + + imb182-desktop + ued-PRM-130 + 300 + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c -w USRP --eNB --noS1 + source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB + + $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 + -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 1 --single-thread-disable --phy-test + + + + + False + + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c --UE -w EXMIMO --noS1 --ue-autotest-trace + source ./targets/bin/init_nas_nos1 UE + + sleep 20; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C 2660000000 -r25 --ue-scan-carrier --ue-txgain 0 --ue-rxgain 5 -S -A 6 -F myriadRF_FMX --ue-max-power -25 --phy-test + + + + + + False + + UE_UEDV1.NOS1.PHYTEST_PERF.BAND7.5MHZ.MCS01 + 36 + + + + + + + + + + + lte-softmodem-noS1 + + imb182-desktop + yanbo-M4HM87P-00 + 300 + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c -w USRP --eNB --noS1 + source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB + + $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 + -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 9 --single-thread-disable --phy-test + + + + + False + + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c --UE -w USRP --noS1 --eNB --ue-autotest-trace + source ./targets/bin/init_nas_nos1 UE + + sleep 20; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C2660000000 -r25 --ue-scan-carrier --ue-txgain 90 -A 20 --ue-rxgain 125 -S --phy-test + + + + + + False + + UE_USRP.NOS1.PHYTEST_PERF.BAND7.5MHZ.MCS09 + 36 + + + + + + lte-softmodem-noS1 + + imb182-desktop + ued-PRM-130 + 300 + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c -w USRP --eNB --noS1 + source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB + + $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 + -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 9 --single-thread-disable --phy-test + + + + + False + + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c --UE -w EXMIMO --noS1 --ue-autotest-trace + source ./targets/bin/init_nas_nos1 UE + + sleep 20; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C 2660000000 -r25 --ue-scan-carrier --ue-txgain 0 --ue-rxgain 5 -S -A 6 -F myriadRF_FMX --ue-max-power -25 --phy-test + + + + + + False + + UE_UEDV1.NOS1.PHYTEST_PERF.BAND7.5MHZ.MCS09 + 36 + + + + + + lte-softmodem-noS1 + + imb182-desktop + yanbo-M4HM87P-00 + 300 + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c -w USRP --eNB --noS1 + source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB + + $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 + -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 16 --single-thread-disable --phy-test + + + + + False + + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c --UE -w USRP --noS1 --eNB --ue-autotest-trace + source ./targets/bin/init_nas_nos1 UE + + sleep 20; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C2660000000 -r25 --ue-scan-carrier --ue-txgain 90 -A 20 --ue-rxgain 125 -S --phy-test + + + + + + False + + UE_USRP.NOS1.PHYTEST_PERF.BAND7.5MHZ.MCS16 + 36 + + + + + + lte-softmodem-noS1 + + imb182-desktop + ued-PRM-130 + 300 + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c -w USRP --eNB --noS1 + source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB + + $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 + -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 16 --single-thread-disable --phy-test + + + + + False + + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c --UE -w EXMIMO --noS1 --ue-autotest-trace + source ./targets/bin/init_nas_nos1 UE + + sleep 20; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C 2660000000 -r25 --ue-scan-carrier --ue-txgain 0 --ue-rxgain 5 -S -A 6 -F myriadRF_FMX --ue-max-power -25 --phy-test + + + + + + False + + UE_UEDV1.NOS1.PHYTEST_PERF.BAND7.5MHZ.MCS16 + 36 + + + + + + lte-softmodem-noS1 + + imb182-desktop + yanbo-M4HM87P-00 + 300 + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c -w USRP --eNB --noS1 + source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB + + $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 + -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 10 --single-thread-disable --phy-test + + + + + False + + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c --UE -w USRP --noS1 --eNB --ue-autotest-trace + source ./targets/bin/init_nas_nos1 UE + + sleep 20; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C2660000000 -r25 --ue-scan-carrier --ue-txgain 90 -A 20 --ue-rxgain 125 -S --phy-test + + + + + + False + UE_USRP.NOS1.PHYTEST_PERF.BAND7.5MHZ.MCS10 + + 36 + + + + + + lte-softmodem-noS1 + + imb182-desktop + ued-PRM-130 + 300 + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c -w USRP --eNB --noS1 + source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB + + $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 + -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 10 --single-thread-disable --phy-test + + + + + False + + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c --UE -w EXMIMO --noS1 --ue-autotest-trace + source ./targets/bin/init_nas_nos1 UE + + sleep 20; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C 2660000000 -r25 --ue-scan-carrier --ue-txgain 0 --ue-rxgain 5 -S -A 6 -F myriadRF_FMX --ue-max-power -25 --phy-test + + + + + + False + UE_UEDV1.NOS1.PHYTEST_PERF.BAND7.5MHZ.MCS10 + 36 + + + + + + + lte-softmodem-noS1 + + imb182-desktop + yanbo-M4HM87P-00 + 300 + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c -w USRP --eNB --noS1 + source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB + + $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 + -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 17 --single-thread-disable --phy-test + + + + + False + + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c --UE -w USRP --noS1 --eNB --ue-autotest-trace + source ./targets/bin/init_nas_nos1 UE + + sleep 20; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C2660000000 -r25 --ue-scan-carrier --ue-txgain 90 -A 20 --ue-rxgain 125 -S --phy-test + + + + + + False + UE_USRP.NOS1.PHYTEST_PERF.BAND7.5MHZ.MCS17 + + 36 + + + + + + lte-softmodem-noS1 + + imb182-desktop + ued-PRM-130 + 300 + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c -w USRP --eNB --noS1 + source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB + + $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 + -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 17 --single-thread-disable --phy-test + + + + + False + + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c --UE -w EXMIMO --noS1 --ue-autotest-trace + source ./targets/bin/init_nas_nos1 UE + + sleep 20; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C 2660000000 -r25 --ue-scan-carrier --ue-txgain 0 --ue-rxgain 5 -S -A 6 -F myriadRF_FMX --ue-max-power -25 --phy-test + + + + + + False + UE_UEDV1.NOS1.PHYTEST_PERF.BAND7.5MHZ.MCS17 + 36 + + + + + + + lte-softmodem-noS1 + + imb182-desktop + yanbo-M4HM87P-00 + 300 + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c -w USRP --eNB --noS1 + source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB + + $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 + -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 18 --single-thread-disable --phy-test + + + + + False + + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c --UE -w USRP --noS1 --eNB --ue-autotest-trace + source ./targets/bin/init_nas_nos1 UE + + sleep 20; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C2660000000 -r25 --ue-scan-carrier --ue-txgain 90 -A 20 --ue-rxgain 125 -S --phy-test + + + + + + False + UE_USRP.NOS1.PHYTEST_PERF.BAND7.5MHZ.MCS18 + + 36 + + + + + + lte-softmodem-noS1 + + imb182-desktop + ued-PRM-130 + 300 + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c -w USRP --eNB --noS1 + source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB + + $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 + -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 18 --single-thread-disable --phy-test + + + + + False + + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c --UE -w EXMIMO --noS1 --ue-autotest-trace + source ./targets/bin/init_nas_nos1 UE + + sleep 20; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C 2660000000 -r25 --ue-scan-carrier --ue-txgain 0 --ue-rxgain 5 -S -A 6 -F myriadRF_FMX --ue-max-power -25 --phy-test + + + + + + False + UE_UEDV1.NOS1.PHYTEST_PERF.BAND7.5MHZ.MCS18 + 36 + + + + + + + lte-softmodem-noS1 + + imb182-desktop + yanbo-M4HM87P-00 + 300 + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c -w USRP --eNB --noS1 + source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB + + $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 + -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 19 --single-thread-disable --phy-test + + + + + False + + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c --UE -w USRP --noS1 --eNB --ue-autotest-trace + source ./targets/bin/init_nas_nos1 UE + + sleep 20; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C2660000000 -r25 --ue-scan-carrier --ue-txgain 90 -A 20 --ue-rxgain 125 -S --phy-test + + + + + + False + UE_USRP.NOS1.PHYTEST_PERF.BAND7.5MHZ.MCS19 + + 36 + + + + + + lte-softmodem-noS1 + + imb182-desktop + ued-PRM-130 + 300 + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c -w USRP --eNB --noS1 + source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB + + $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 + -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 19 --single-thread-disable --phy-test + + + + + False + + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c --UE -w EXMIMO --noS1 --ue-autotest-trace + source ./targets/bin/init_nas_nos1 UE + + sleep 20; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C 2660000000 -r25 --ue-scan-carrier --ue-txgain 0 --ue-rxgain 5 -S -A 6 -F myriadRF_FMX --ue-max-power -25 --phy-test + + + + + + False + UE_UEDV1.NOS1.PHYTEST_PERF.BAND7.5MHZ.MCS19 + 36 + + + + + + + + lte-softmodem-noS1 + + imb182-desktop + yanbo-M4HM87P-00 + 300 + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c -w USRP --eNB --noS1 + source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB + + $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 + -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 20 --single-thread-disable --phy-test + + + + + False + + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c --UE -w USRP --noS1 --eNB --ue-autotest-trace + source ./targets/bin/init_nas_nos1 UE + + sleep 20; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C2660000000 -r25 --ue-scan-carrier --ue-txgain 90 -A 20 --ue-rxgain 125 -S --phy-test + + + + + + False + UE_USRP.NOS1.PHYTEST_PERF.BAND7.5MHZ.MCS20 + + 36 + + + + + + lte-softmodem-noS1 + + imb182-desktop + ued-PRM-130 + 300 + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c -w USRP --eNB --noS1 + source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB + + $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 + -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 20 --single-thread-disable --phy-test + + + + + False + + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c --UE -w EXMIMO --noS1 --ue-autotest-trace + source ./targets/bin/init_nas_nos1 UE + + sleep 20; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C 2660000000 -r25 --ue-scan-carrier --ue-txgain 0 --ue-rxgain 5 -S -A 6 -F myriadRF_FMX --ue-max-power -25 --phy-test + + + + + + False + UE_UEDV1.NOS1.PHYTEST_PERF.BAND7.5MHZ.MCS20 + 36 + + + + + + + lte-softmodem-noS1 + + imb182-desktop + yanbo-M4HM87P-00 + 300 + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c -w USRP --eNB --noS1 + source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB + + $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 + -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 21 --single-thread-disable --phy-test + + + + + False + + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c --UE -w USRP --noS1 --eNB --ue-autotest-trace + source ./targets/bin/init_nas_nos1 UE + + sleep 20; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C2660000000 -r25 --ue-scan-carrier --ue-txgain 90 -A 20 --ue-rxgain 125 -S --phy-test + + + + + + False + UE_USRP.NOS1.PHYTEST_PERF.BAND7.5MHZ.MCS21 + 36 + + + + + + + lte-softmodem-noS1 + + imb182-desktop + ued-PRM-130 + 300 + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c -w USRP --eNB --noS1 + source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB + + $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 + -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 21 --single-thread-disable --phy-test + + + + + False + + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c --UE -w EXMIMO --noS1 --ue-autotest-trace + source ./targets/bin/init_nas_nos1 UE + + sleep 20; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C 2660000000 -r25 --ue-scan-carrier --ue-txgain 0 --ue-rxgain 5 -S -A 6 -F myriadRF_FMX --ue-max-power -25 --phy-test + + + + + + False + UE_UEDV1.NOS1.PHYTEST_PERF.BAND7.5MHZ.MCS21 + 36 + + + + + + + lte-softmodem-noS1 + + imb182-desktop + yanbo-M4HM87P-00 + 300 + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c -w USRP --eNB --noS1 + source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB + + $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 + -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 22 --single-thread-disable --phy-test + + + + + False + + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c --UE -w USRP --noS1 --eNB --ue-autotest-trace + source ./targets/bin/init_nas_nos1 UE + + sleep 20; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C2660000000 -r25 --ue-scan-carrier --ue-txgain 90 -A 20 --ue-rxgain 125 -S --phy-test + + + + + + False + UE_USRP.NOS1.PHYTEST_PERF.BAND7.5MHZ.MCS22 + + 36 + + + + + + lte-softmodem-noS1 + + imb182-desktop + ued-PRM-130 + 300 + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c -w USRP --eNB --noS1 + source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB + + $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 + -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 22 --single-thread-disable --phy-test + + + + + False + + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c --UE -w EXMIMO --noS1 --ue-autotest-trace + source ./targets/bin/init_nas_nos1 UE + + sleep 20; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C 2660000000 -r25 --ue-scan-carrier --ue-txgain 0 --ue-rxgain 5 -S -A 6 -F myriadRF_FMX --ue-max-power -25 --phy-test + + + + + + False + UE_UEDV1.NOS1.PHYTEST_PERF.BAND7.5MHZ.MCS22 + 36 + + + + + + + lte-softmodem-noS1 + + imb182-desktop + yanbo-M4HM87P-00 + 300 + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c -w USRP --eNB --noS1 + source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB + + $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 + -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 23 --single-thread-disable --phy-test + + + + + False + + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c --UE -w USRP --noS1 --eNB --ue-autotest-trace + source ./targets/bin/init_nas_nos1 UE + + sleep 20; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C2660000000 -r25 --ue-scan-carrier --ue-txgain 90 -A 20 --ue-rxgain 125 -S --phy-test + + + + + + False + UE_USRP.NOS1.PHYTEST_PERF.BAND7.5MHZ.MCS23 + 36 + + + + + + + lte-softmodem-noS1 + + imb182-desktop + ued-PRM-130 + 300 + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c -w USRP --eNB --noS1 + source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB + + $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 + -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 23 --single-thread-disable --phy-test + + + + + False + + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c --UE -w EXMIMO --noS1 --ue-autotest-trace + source ./targets/bin/init_nas_nos1 UE + + sleep 20; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C 2660000000 -r25 --ue-scan-carrier --ue-txgain 0 --ue-rxgain 5 -S -A 6 -F myriadRF_FMX --ue-max-power -25 --phy-test + + + + + + False + UE_UEDV1.NOS1.PHYTEST_PERF.BAND7.5MHZ.MCS23 + 36 + + + + + + + lte-softmodem-noS1 + + imb182-desktop + yanbo-M4HM87P-00 + 300 + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c -w USRP --eNB --noS1 + source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB + + $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 + -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 24 --single-thread-disable --phy-test + + + + + False + + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c --UE -w USRP --noS1 --eNB --ue-autotest-trace + source ./targets/bin/init_nas_nos1 UE + + sleep 20; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C2660000000 -r25 --ue-scan-carrier --ue-txgain 90 -A 20 --ue-rxgain 125 -S --phy-test + + + + + + False + UE_USRP.NOS1.PHYTEST_PERF.BAND7.5MHZ.MCS24 + 36 + + + + + + + lte-softmodem-noS1 + + imb182-desktop + ued-PRM-130 + 300 + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c -w USRP --eNB --noS1 + source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB + + $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 + -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 24 --single-thread-disable --phy-test + + + + + False + + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c --UE -w EXMIMO --noS1 --ue-autotest-trace + source ./targets/bin/init_nas_nos1 UE + + sleep 20; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C 2660000000 -r25 --ue-scan-carrier --ue-txgain 0 --ue-rxgain 5 -S -A 6 -F myriadRF_FMX --ue-max-power -25 --phy-test + + + + + + False + UE_UEDV1.NOS1.PHYTEST_PERF.BAND7.5MHZ.MCS24 + 36 + + + + + + + + lte-softmodem-noS1 + + imb182-desktop + yanbo-M4HM87P-00 + 300 + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c -w USRP --eNB --noS1 + source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB + + $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 + -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 25 --single-thread-disable --phy-test + + + + + False + + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c --UE -w USRP --noS1 --eNB --ue-autotest-trace + source ./targets/bin/init_nas_nos1 UE + + sleep 20; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C2660000000 -r25 --ue-scan-carrier --ue-txgain 90 -A 20 --ue-rxgain 125 -S --phy-test + + + + + + False + UE_USRP.NOS1.PHYTEST_PERF.BAND7.5MHZ.MCS25 + 36 + + + + + + + lte-softmodem-noS1 + + imb182-desktop + ued-PRM-130 + 300 + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c -w USRP --eNB --noS1 + source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB + + $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 + -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 25 --single-thread-disable --phy-test + + + + + False + + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c --UE -w EXMIMO --noS1 --ue-autotest-trace + source ./targets/bin/init_nas_nos1 UE + + sleep 20; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C 2660000000 -r25 --ue-scan-carrier --ue-txgain 0 --ue-rxgain 5 -S -A 6 -F myriadRF_FMX --ue-max-power -25 --phy-test + + + + + + False + UE_UEDV1.NOS1.PHYTEST_PERF.BAND7.5MHZ.MCS25 + 36 + + + + + + + lte-softmodem-noS1 + + imb182-desktop + yanbo-M4HM87P-00 + 300 + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c -w USRP --eNB --noS1 + source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB + + $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 + -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 26 --single-thread-disable --phy-test + + + + + False + + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c --UE -w USRP --noS1 --eNB --ue-autotest-trace + source ./targets/bin/init_nas_nos1 UE + + sleep 20; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C2660000000 -r25 --ue-scan-carrier --ue-txgain 90 -A 20 --ue-rxgain 125 -S --phy-test + + + + + + False + UE_USRP.NOS1.PHYTEST_PERF.BAND7.5MHZ.MCS26 + 36 + + + + + + + lte-softmodem-noS1 + + imb182-desktop + ued-PRM-130 + 300 + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c -w USRP --eNB --noS1 + source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB + + $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 + -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 26 --single-thread-disable --phy-test + + + + + False + + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c --UE -w EXMIMO --noS1 --ue-autotest-trace + source ./targets/bin/init_nas_nos1 UE + + sleep 20; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C 2660000000 -r25 --ue-scan-carrier --ue-txgain 0 --ue-rxgain 5 -S -A 6 -F myriadRF_FMX --ue-max-power -25 --phy-test + + + + + + False + UE_UEDV1.NOS1.PHYTEST_PERF.BAND7.5MHZ.MCS26 + 36 + + + + + + + lte-softmodem-noS1 + + imb182-desktop + yanbo-M4HM87P-00 + 300 + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c -w USRP --eNB --noS1 + source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB + + $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 + -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 27 --single-thread-disable --phy-test + + + + + False + + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c --UE -w USRP --noS1 --eNB --ue-autotest-trace + source ./targets/bin/init_nas_nos1 UE + + sleep 20; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C2660000000 -r25 --ue-scan-carrier --ue-txgain 90 -A 20 --ue-rxgain 125 -S --phy-test + + + + + + False + UE_USRP.NOS1.PHYTEST_PERF.BAND7.5MHZ.MCS27 + 36 + + + + + + + lte-softmodem-noS1 + + imb182-desktop + ued-PRM-130 + 300 + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c -w USRP --eNB --noS1 + source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB + + $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 + -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 27 --single-thread-disable --phy-test + + + + + False + + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c --UE -w EXMIMO --noS1 --ue-autotest-trace + source ./targets/bin/init_nas_nos1 UE + + sleep 20; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C 2660000000 -r25 --ue-scan-carrier --ue-txgain 0 --ue-rxgain 5 -S -A 6 -F myriadRF_FMX --ue-max-power -25 --phy-test + + + + + + False + UE_UEDV1.NOS1.PHYTEST_PERF.BAND7.5MHZ.MCS27 + 36 + + + + + + + lte-softmodem-noS1 + + imb182-desktop + yanbo-M4HM87P-00 + 300 + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c -w USRP --eNB --noS1 + source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB + + $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 + -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 28 --single-thread-disable --phy-test + + + + + False + + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c --UE -w USRP --noS1 --eNB --ue-autotest-trace + source ./targets/bin/init_nas_nos1 UE + + sleep 20; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C2660000000 -r25 --ue-scan-carrier --ue-txgain 90 -A 20 --ue-rxgain 125 -S --phy-test + + + + + + False + UE_USRP.NOS1.PHYTEST_PERF.BAND7.5MHZ.MCS28 + 36 + + + + + + + lte-softmodem-noS1 + + imb182-desktop + ued-PRM-130 + 300 + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c -w USRP --eNB --noS1 + source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB + + $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 + -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 28 --single-thread-disable --phy-test + + + + + False + + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c --UE -w EXMIMO --noS1 --ue-autotest-trace + source ./targets/bin/init_nas_nos1 UE + + sleep 20; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C 2660000000 -r25 --ue-scan-carrier --ue-txgain 0 --ue-rxgain 5 -S -A 6 -F myriadRF_FMX --ue-max-power -25 --phy-test + + + + + + False + UE_UEDV1.NOS1.PHYTEST_PERF.BAND7.5MHZ.MCS28 + 36 + + + + + + + + lte-softmodem-noS1 + + imb182-desktop + yanbo-M4HM87P-00 + 3600 + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c -w USRP --eNB --noS1 + source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB + + $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 + -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 27 --single-thread-disable --phy-test + + + + + False + + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c --UE -w USRP --noS1 --eNB --ue-autotest-trace + source ./targets/bin/init_nas_nos1 UE + + sleep 20; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C2660000000 -r25 --ue-scan-carrier --ue-txgain 90 -A 20 --ue-rxgain 125 -S --phy-test + + + + + + False + UE_USRP.NOS1.PHYTEST_STAB.BAND7.5MHZ.MCS27 + 16 + + + + + + + lte-softmodem-noS1 + + imb182-desktop + ued-PRM-130 + 300 + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c -w USRP --eNB --noS1 + source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB + + $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 + -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 27 --single-thread-disable --phy-test + + + + + False + + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c --UE -w EXMIMO --noS1 --ue-autotest-trace + source ./targets/bin/init_nas_nos1 UE + + sleep 20; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C 2660000000 -r25 --ue-scan-carrier --ue-txgain 0 --ue-rxgain 5 -S -A 6 -F myriadRF_FMX --ue-max-power -25 --phy-test + + + + + + False + UE_UEDV1.NOS1.PHYTEST_STAB.BAND7.5MHZ.MCS27 + 36 + + + + + + + + lte-softmodem-noS1 + + imb182-desktop + yanbo-M4HM87P-00 + 300 + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c -w USRP --eNB --noS1 + source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB + + $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 + -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.50PRB.usrpb210.conf -W -m 27 --single-thread-disable --phy-test + + + + + False + + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c --UE -w USRP --noS1 --eNB --ue-autotest-trace + source ./targets/bin/init_nas_nos1 UE + + sleep 20; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C2660000000 -r50 --ue-scan-carrier --ue-txgain 90 -A 20 --ue-rxgain 125 -S --phy-test + + + + + + False + UE_USRP.NOS1.PHYTEST_PERF.BAND7.10MHZ.MCS27 + 36 + + + + + + + lte-softmodem-noS1 + + imb182-desktop + ued-PRM-130 + 300 + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c -w USRP --eNB --noS1 + source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB + + $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 + -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.50PRB.usrpb210.conf -W -m 27 --single-thread-disable --phy-test + + + + + False + + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c --UE -w EXMIMO --noS1 --ue-autotest-trace + source ./targets/bin/init_nas_nos1 UE + + sleep 20; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C 2660000000 -r50 --ue-scan-carrier --ue-txgain 0 --ue-rxgain 5 -S -A 6 -F myriadRF_FMX --ue-max-power -25 --phy-test + + + + + + False + UE_UEDV1.NOS1.PHYTEST_PERF.BAND7.10MHZ.MCS27 + 36 + + + + + + + + lte-softmodem-noS1 + + imb182-desktop + yanbo-M4HM87P-00 + 300 + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c -w USRP --eNB --noS1 + source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB + + $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 + -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.50PRB.usrpb210.conf -W -m 28 --single-thread-disable --phy-test + + + + + False + + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c --UE -w USRP --noS1 --eNB --ue-autotest-trace + source ./targets/bin/init_nas_nos1 UE + + sleep 20; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C2660000000 -r50 --ue-scan-carrier --ue-txgain 90 -A 20 --ue-rxgain 125 -S --phy-test + + + + + + False + UE_USRP.NOS1.PHYTEST_PERF.BAND7.10MHZ.MCS28 + 36 + + + + + + + + + lte-softmodem-noS1 + + imb182-desktop + ued-PRM-130 + 300 + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c -w USRP --eNB --noS1 + source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB + + $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 + -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.50PRB.usrpb210.conf -W -m 19 --single-thread-disable --phy-test + + + + + False + + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c --UE -w EXMIMO --noS1 --ue-autotest-trace + source ./targets/bin/init_nas_nos1 UE + + sleep 20; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C 2660000000 -r50 --ue-scan-carrier --ue-txgain 0 --ue-rxgain 5 -S -A 6 -F myriadRF_FMX --ue-max-power -25 --phy-test + + + + + + False + UE_UEDV1.NOS1.PHYTEST_PERF.BAND7.10MHZ.MCS19 + 36 + + + + + + + + lte-softmodem-noS1 + + imb182-desktop + yanbo-M4HM87P-00 + 300 + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c -w USRP --eNB --noS1 + source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB + + $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 + -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 0 + sleep 80;iperf -c 10.0.1.9 -i 1 -u -b 512K + + + + False + + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c --UE -w USRP --noS1 --eNB --ue-autotest-trace + source ./targets/bin/init_nas_nos1 UE + + sleep 20; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C2660000000 -r25 --ue-scan-carrier --ue-txgain 90 -A 20 --ue-rxgain 125 -S + + iperf -s -i 1 -u + + 200 + + False + UE_USRP.NOS1.DATA_IPERF.BAND7.5MHZ.MCS00 + 36 + + + + + + + lte-softmodem-noS1 + + imb182-desktop + yanbo-M4HM87P-00 + 300 + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c -w USRP --eNB --noS1 + source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB + + $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 + -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.50PRB.usrpb210.conf -W -m 28 + sleep 80;iperf -c 10.0.1.9 -i 1 -u -b 6M + + + + False + + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c --UE -w USRP --noS1 --eNB --ue-autotest-trace + source ./targets/bin/init_nas_nos1 UE + + sleep 20; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C2660000000 -r50 --ue-scan-carrier --ue-txgain 90 -A 20 --ue-rxgain 125 -S + + iperf -s -i 1 -u + + 200 + + False + UE_USRP.NOS1.DATA_IPERF.BAND7.10MHZ.MCS28 + 36 + + + + + + + + + + + lte-softmodem-noS1 + + imb182-desktop + ued-PRM-130 + 300 + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c -w USRP --eNB --noS1 + source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB + + $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 + -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 0 + sleep 80;iperf -c 10.0.1.9 -i 1 -u -b 512K + + + + False + + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c --UE -w EXMIMO --noS1 --ue-autotest-trace + source ./targets/bin/init_nas_nos1 UE + + sleep 20; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C 2660000000 -r25 --ue-scan-carrier --ue-txgain 15 --ue-rxgain 5 -S -A 6 -F myriadRF_FMX --ue-max-power -25 + + iperf -s -i 1 -u + + 200 + + False + UE_UEDV1.NOS1.DATA_IPERF.BAND7.5MHZ.MCS00 + 36 + + + + + + + lte-softmodem-noS1 + + imb182-desktop + yanbo-M4HM87P-00 + 300 + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c -w USRP --eNB --noS1 + source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB + + $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 + -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 9 + sleep 80;iperf -c 10.0.1.9 -i 1 -u -b 2M + + + + False + + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c --UE -w USRP --noS1 --eNB --ue-autotest-trace + source ./targets/bin/init_nas_nos1 UE + + sleep 20; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C2660000000 -r25 --ue-scan-carrier --ue-txgain 90 -A 20 --ue-rxgain 125 -S + + iperf -s -i 1 -u + + 200 + + False + UE_USRP.NOS1.DATA_IPERF.BAND7.5MHZ.MCS09 + 36 + + + + + + + + lte-softmodem-noS1 + + imb182-desktop + ued-PRM-130 + 300 + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c -w USRP --eNB --noS1 + source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB + + $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 + -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 9 + sleep 80;iperf -c 10.0.1.9 -i 1 -u -b 2M + + + + False + + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c --UE -w EXMIMO --noS1 --ue-autotest-trace + source ./targets/bin/init_nas_nos1 UE + + sleep 20; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C 2660000000 -r25 --ue-scan-carrier --ue-txgain 15 --ue-rxgain 5 -S -A 6 -F myriadRF_FMX --ue-max-power -25 + + iperf -s -i 1 -u + + 200 + + False + UE_UEDV1.NOS1.DATA_IPERF.BAND7.5MHZ.MCS09 + 36 + + + + + + + + lte-softmodem-noS1 + + imb182-desktop + yanbo-M4HM87P-00 + 300 + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c -w USRP --eNB --noS1 + source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB + + $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 + -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 10 + sleep 80;iperf -c 10.0.1.9 -i 1 -u -b 2M + + + + False + + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c --UE -w USRP --noS1 --eNB --ue-autotest-trace + source ./targets/bin/init_nas_nos1 UE + + sleep 20; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C2660000000 -r25 --ue-scan-carrier --ue-txgain 90 -A 20 --ue-rxgain 125 -S + + iperf -s -i 1 -u + + 200 + + False + UE_USRP.NOS1.DATA_IPERF.BAND7.5MHZ.MCS10 + 36 + + + + + + + + lte-softmodem-noS1 + + imb182-desktop + ued-PRM-130 + 300 + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c -w USRP --eNB --noS1 + source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB + + $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 + -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 10 + sleep 80;iperf -c 10.0.1.9 -i 1 -u -b 2M + + + + False + + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c --UE -w EXMIMO --noS1 --ue-autotest-trace + source ./targets/bin/init_nas_nos1 UE + + sleep 20; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C 2660000000 -r25 --ue-scan-carrier --ue-txgain 15 --ue-rxgain 5 -S -A 6 -F myriadRF_FMX --ue-max-power -25 + + iperf -s -i 1 -u + + 200 + + False + UE_UEDV1.NOS1.DATA_IPERF.BAND7.5MHZ.MCS10 + 36 + + + + + + + + + lte-softmodem-noS1 + + imb182-desktop + yanbo-M4HM87P-00 + 300 + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c -w USRP --eNB --noS1 + source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB + + $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 + -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 16 + sleep 80;iperf -c 10.0.1.9 -i 1 -u -b 2M + + + + False + + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c --UE -w USRP --noS1 --eNB --ue-autotest-trace + source ./targets/bin/init_nas_nos1 UE + + sleep 20; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C2660000000 -r25 --ue-scan-carrier --ue-txgain 90 -A 20 --ue-rxgain 125 -S + + iperf -s -i 1 -u + + 200 + + False + UE_USRP.NOS1.DATA_IPERF.BAND7.5MHZ.MCS16 + 36 + + + + + + + + lte-softmodem-noS1 + + imb182-desktop + ued-PRM-130 + 300 + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c -w USRP --eNB --noS1 + source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB + + $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 + -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 16 + sleep 80;iperf -c 10.0.1.9 -i 1 -u -b 2M + + + + False + + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c --UE -w EXMIMO --noS1 --ue-autotest-trace + source ./targets/bin/init_nas_nos1 UE + + sleep 20; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C 2660000000 -r25 --ue-scan-carrier --ue-txgain 15 --ue-rxgain 5 -S -A 6 -F myriadRF_FMX --ue-max-power -25 + + iperf -s -i 1 -u + + 200 + + False + UE_UEDV1.NOS1.DATA_IPERF.BAND7.5MHZ.MCS16 + 36 + + + + + + + + + lte-softmodem-noS1 + + imb182-desktop + yanbo-M4HM87P-00 + 300 + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c -w USRP --eNB --noS1 + source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB + + $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 + -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 17 + sleep 80;iperf -c 10.0.1.9 -i 1 -u -b 2M + + + + False + + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c --UE -w USRP --noS1 --eNB --ue-autotest-trace + source ./targets/bin/init_nas_nos1 UE + + sleep 20; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C2660000000 -r25 --ue-scan-carrier --ue-txgain 90 -A 20 --ue-rxgain 125 -S + + iperf -s -i 1 -u + + 200 + + False + UE_USRP.NOS1.DATA_IPERF.BAND7.5MHZ.MCS17 + 36 + + + + + + + + lte-softmodem-noS1 + + imb182-desktop + ued-PRM-130 + 300 + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c -w USRP --eNB --noS1 + source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB + + $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 + -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 17 + sleep 80;iperf -c 10.0.1.9 -i 1 -u -b 2M + + + + False + + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c --UE -w EXMIMO --noS1 --ue-autotest-trace + source ./targets/bin/init_nas_nos1 UE + + sleep 20; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C 2660000000 -r25 --ue-scan-carrier --ue-txgain 15 --ue-rxgain 5 -S -A 6 -F myriadRF_FMX --ue-max-power -25 + + iperf -s -i 1 -u + + 200 + + False + UE_UEDV1.NOS1.DATA_IPERF.BAND7.5MHZ.MCS17 + 36 + + + + + + + + + + + lte-softmodem-noS1 + + imb182-desktop + yanbo-M4HM87P-00 + 300 + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c -w USRP --eNB --noS1 + source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB + + $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 + -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 19 + sleep 80;iperf -c 10.0.1.9 -i 1 -u -b 2M + + + + False + + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c --UE -w USRP --noS1 --eNB --ue-autotest-trace + source ./targets/bin/init_nas_nos1 UE + + sleep 20; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C2660000000 -r25 --ue-scan-carrier --ue-txgain 90 -A 20 --ue-rxgain 125 -S + + iperf -s -i 1 -u + + 200 + + False + UE_USRP.NOS1.DATA_IPERF.BAND7.5MHZ.MCS19 + 36 + + + + + + + + lte-softmodem-noS1 + + imb182-desktop + ued-PRM-130 + 300 + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c -w USRP --eNB --noS1 + source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB + + $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 + -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 19 + sleep 80;iperf -c 10.0.1.9 -i 1 -u -b 10M + + + + False + + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c --UE -w EXMIMO --noS1 --ue-autotest-trace + source ./targets/bin/init_nas_nos1 UE + + sleep 20; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C 2660000000 -r25 --ue-scan-carrier --ue-txgain 15 --ue-rxgain 5 -S -A 6 -F myriadRF_FMX --ue-max-power -25 + + iperf -s -i 1 -u + + 200 + + False + UE_UEDV1.NOS1.DATA_IPERF.BAND7.5MHZ.MCS19 + 36 + + + + + + + + lte-softmodem-noS1 + + imb182-desktop + yanbo-M4HM87P-00 + 300 + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c -w USRP --eNB --noS1 + source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB + + $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 + -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 27 + sleep 30;iperf -c 10.0.1.9 -i 1 -u -b 10M + + + + False + + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c --UE -w USRP --noS1 --eNB --ue-autotest-trace + source ./targets/bin/init_nas_nos1 UE + + sleep 5; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C2660000000 -r25 --ue-scan-carrier --ue-txgain 85 -A 20 --ue-rxgain 125 -S + + iperf -s -i 1 -u + + 200 + + False + UE_USRP.NOS1.DATA_IPERF.BAND7.5MHZ.MCS27 + 36 + + + + + + + + lte-softmodem-noS1 + + imb182-desktop + yanbo-M4HM87P-00 + 3600 + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c -w USRP --eNB --noS1 + source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB + + $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 + -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 27 + sleep 80;iperf -c 10.0.1.9 -i 1 -u -b 2M + + + + False + + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c --UE -w USRP --noS1 --eNB --ue-autotest-trace + source ./targets/bin/init_nas_nos1 UE + + sleep 20; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C2660000000 -r25 --ue-scan-carrier --ue-txgain 90 -A 20 --ue-rxgain 125 -S + + iperf -s -i 1 -u + + 2800 + + False + UE_USRP.NOS1.DATA_IPERF_STAB.BAND7.5MHZ.MCS27 + 16 + + + + + + + + lte-softmodem-noS1 + + imb182-desktop + ued-PRM-130 + 300 + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c -w USRP --eNB --noS1 + source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB + + $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 + -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 27 + sleep 80;iperf -c 10.0.1.9 -i 1 -u -b 2M + + + + False + + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c --UE -w EXMIMO --noS1 --ue-autotest-trace + source ./targets/bin/init_nas_nos1 UE + + sleep 20; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C 2660000000 -r25 --ue-scan-carrier --ue-txgain 15 --ue-rxgain 5 -S -A 6 -F myriadRF_FMX --ue-max-power -25 + + iperf -s -i 1 -u + + 200 + + False + UE_UEDV1.NOS1.DATA_IPERF.BAND7.5MHZ.MCS27 + 36 + + + + + + + diff --git a/cmake_targets/autotests/tools/autotest_analyser.py b/cmake_targets/autotests/tools/autotest_analyser.py index a75727ad65..61759a1545 100755 --- a/cmake_targets/autotests/tools/autotest_analyser.py +++ b/cmake_targets/autotests/tools/autotest_analyser.py @@ -35,12 +35,15 @@ import getopt import sys from subprocess import call +import encoder + +sys.path.append(os.path.expandvars('$OPENAIR_DIR/cmake_targets/autotests/tools/')) #test_cases = ('030001', '030901', '031001', '031601', '031701', '031801', '031901', '032001', '032101', '032201', '032301', '032501', '032601', '032801') -test_cases = ('030030' , '030030' ) +test_cases = ('032800' , '032730' ) -nb_run = 3 +nb_run = 2 def error_opt(msg): print("Option error: " + msg) @@ -58,14 +61,27 @@ def main(args): + # metric = {} + # metric['id'] = 'UE_DLSCH_BITRATE' + # metric['description'] = 'UE downlink physical throughput' + # metric['regex'] = '(UE_DLSCH_BITRATE) =\s+(\d+\.\d+) kbps.+frame = (\d+)\)' + # metric['unit_of_meas'] = 'kbps' + # metric['min_limit'] = 14668.8 + + +#AUTOTEST Metric : RRC Measurments RSRP[0]=-97.60 dBm/RE, RSSI=-72.83 dBm, RSRQ[0] 9.03 dB, N0 -125 dBm/RE, NF 7.2 dB (frame = 4490) + metric = {} - metric['id'] = 'UE_DLSCH_BITRATE' - metric['description'] = 'UE downlink physical throughput' - metric['regex'] = '(UE_DLSCH_BITRATE) =\s+(\d+\.\d+) kbps.+frame = (\d+)\)' + metric['id'] = 'UE_DL_RRC_MEAS' + metric['description'] = 'UE downlink RRC Measurments' + metric['nb_metric'] = 5 +# metric['regex'] = 'AUTOTEST Metric : RRC Measurments (RSRP\[0\])=(-?\d+\.?\d*)\s+(.+),\s+(RSRQ\[0\])=(-?\d+\.?\d*)\s+(.+),,\s+(N0)=(-?\d+\.?\d*)\s+(.+),,\s+(NF)=(-?\d+\.?\d*)\s+(.+)\s+\(frame = (\d+)\) ' + metric['regex'] = 'AUTOTEST Metric : RRC Measurments (RSRP\[0\])=(-?\d+\.?\d*)\s+(.+)\,\s+(RSSI)=(-?\d+\.?\d*)\s+(.+)\,\s+(RSRQ\[0\])=(-?\d+\.?\d*)\s+(.+)\,\s+(N0)=(-?\d+\.?\d*)\s+(.+)\,\s+(NF)=(-?\d+\.?\d*)\s+(.+)\s+\(frame = (\d+)\)' metric['unit_of_meas'] = 'kbps' metric['min_limit'] = 14668.8 + #report_path = log_path+'/report/' #os.system(' mkdir -p ' + report_path) @@ -74,58 +90,44 @@ def main(args): #return(0) + test_results = [] + for test_case in test_cases: -# print test_case - if test_case == '030001': - metric['min_limit'] = 500.0 - if test_case == '030901': - metric['min_limit'] = 640.0 - if test_case == '031001': - metric['min_limit'] = 3200.0 - if test_case == '031601': - metric['min_limit'] = 5920.0 - if test_case == '031701': - metric['min_limit'] = 6000.0 - if test_case == '031801': - metric['min_limit'] = 6200.0 - if test_case == '031901': - metric['min_limit'] = 7000.0 - if test_case == '032001': - metric['min_limit'] = 7800.0 - if test_case == '032101': - metric['min_limit'] = 8000.0 - if test_case == '032201': - metric['min_limit'] = 9000.0 - if test_case == '032301': - metric['min_limit'] = 10000.0 - if test_case == '032501': - metric['min_limit'] = 11000.0 - if test_case == '032601': - metric['min_limit'] = 12000.0 - if test_case == '032801': - metric['min_limit'] = 12500.0 - - if test_case == '035201': - metric['min_limit'] = 14668.8 - if test_case == '036001': - metric['min_limit'] = 25363.2 - - - for i in range(0, nb_run): - fname = 'log//'+test_case+'/run_'+str(i)+'/UE_exec_'+str(i)+'_.log' + fname = '..//log//'+test_case+'/run_'+str(i)+'/UE_exec_'+str(i)+'_.log' args = {'metric' : metric, 'file' : fname } - cell_synch_status = analyser.check_cell_synchro(fname) - if cell_synch_status == 'CELL_SYNCH': - print '!!!!!!!!!!!!!! Cell synchronized !!!!!!!!!!!' - metric_checks_flag = 0 - else : - print '!!!!!!!!!!!!!! Cell NOT NOT synchronized !!!!!!!!!!!' + # cell_synch_status = analyser.check_cell_synchro(fname) + # if cell_synch_status == 'CELL_SYNCH': + # print '!!!!!!!!!!!!!! Cell synchronized !!!!!!!!!!!' + # metric_checks_flag = 0 + # else : + # print '!!!!!!!!!!!!!! Cell NOT NOT synchronized !!!!!!!!!!!' -# metric_extracted = analyser.do_extract_metrics(args) +# metrics_extracted = analyser.do_extract_metrics_new(args) + + + # de-xmlfy test report + xml_file = '..//log//'+test_case+'/test.'+test_case+'_ng.xml' + print xml_file + + # test_result = + + + # test_results.append(test_result) + + # xmlFile = logdir_local_testcase + '/test.' + testcasename + '.xml' + # xml="\n \n" + # write_file(xmlFile, xml, mode="w") + + # xmlFile_ng = logdir_local_testcase + '/test.' + testcasename + '_ng.xml' + # xml_ng = xmlify(test_result, wrap=testcasename, indent=" ") + # write_file(xmlFile_ng, xml_ng, mode="w") + + + # print "min = "+ str( metric_extracted['metric_min'] ) # print "min_index = "+ str( metric_extracted['metric_min_index'] ) @@ -143,16 +145,27 @@ def main(args): # print fname # analyser.do_img_metrics(metric, metric_extracted, fname) -# fname = 'log//'+test_case+'/run_'+str(i)+'/UE_traffic_'+str(i)+'_.log' + # fname = 'log//'+test_case+'/run_'+str(i)+'/UE_traffic_'+str(i)+'_.log' -# args = {'file' : fname } + # args = {'file' : fname } -# traffic_metrics = analyser.do_extract_traffic_metrics(args) + # traffic_metrics = analyser.do_extract_traffic_metrics(args) -# fname= 'report/iperf_'+test_case+'_'+str(i)+'.png' + # fname= 'report/iperf_'+test_case+'_'+str(i)+'.png' -# print fname -# analyser.do_img_traffic(traffic_metrics, fname) + # print fname + # analyser.do_img_traffic(traffic_metrics, fname) + + + for test_result in test_results: + cmd = 'mkdir -p ' + report_dir + '/'+ test_result['testcase_name'] + result = os.system(cmd) + + report_file = report_dir + '/'+ test_result['testcase_name'] + '/'+ test_result['testcase_name']+ '_report.html' + + analyser.create_test_report_detailed_html(test_result, report_file ) + + print test_result diff --git a/cmake_targets/autotests/tools/lib_autotest_analyser.py b/cmake_targets/autotests/tools/lib_autotest_analyser.py index 92dcc31e48..333bbd656e 100644 --- a/cmake_targets/autotests/tools/lib_autotest_analyser.py +++ b/cmake_targets/autotests/tools/lib_autotest_analyser.py @@ -41,7 +41,7 @@ from jinja2 import Environment, FileSystemLoader PATH = os.path.dirname(os.path.abspath(__file__)) TEMPLATE_ENVIRONMENT = Environment( autoescape=False, - loader=FileSystemLoader(os.path.join(PATH, 'templates')), + loader=FileSystemLoader(os.path.join(PATH, '../templates')), trim_blocks=False) @@ -103,6 +103,129 @@ def do_extract_metrics(args): } return(ret) + +def do_extract_metrics_new(args): + +# print "" +# print "do_extract_metrics ... " + + fname = args['file'] + metric = args['metric'] + print(fname) + print 'metric id = ' + metric['id'] + print 'metric regex = ' + metric['regex'] + + + + count = 0 + mmin = 0 + mmin_index = 0 + mmax = 0 + mmax_index = 0 + mean = 0 + median = 0 + + toto = [('id', 'S20'), ('metric', np.float), ('frame', np.int)] + print toto + + + np_format = [] + + for x in range(0, metric['nb_metric']): + np_format.append( ('id'+str(x), 'S20') ) + np_format.append( ('metric'+str(x), np.float) ) + np_format.append( ('uom'+str(x), 'S20') ) + np_format.append( ('frame', np.int)) + + print np_format + + output = np.fromregex(fname,metric['regex'], np_format) + print output + count = output['frame'].size + print count + if count > 0: + + + fontP = FontProperties() + fontP.set_size('small') + + fig = plt.figure(1) + plt.figure(figsize=(10,10)) + + plot_xmax = np.amax(output['frame'])+np.amin(output['frame']) + + for x in range(0, metric['nb_metric']): + + metric_name = output['id'+str(x)][0] + metric_uom = output['uom'+str(x)][0] + + mmin = np.amin(output['metric'+str(x)]) + mmax = np.amax(output['metric'+str(x)]) + mmean = np.mean(output['metric'+str(x)]) + mmedian = np.median(output['metric'+str(x)]) + + plot_loc = 100*metric['nb_metric']+10+x+1 + + sbplt = plt.subplot(plot_loc) + sbplt.plot(output['frame'], output['metric'+str(x)], color='b' ) + sbplt.set_title( metric_name+' ('+metric_uom+')') + if mmin < 0: + sbplot_ymin=mmin+mmin/10 + else: + sbplot_ymin=0 + sbplt.set_ylim(ymin=sbplot_ymin) + if mmax > 0: + sbplot_ymax=mmax+mmax/10 + else: + sbplot_ymax=0 + sbplt.set_ylim(ymax=sbplot_ymax) + + sbplt.set_xlim(xmax=plot_xmax) + sbplt.set_xlim(xmin=0) + text='min: '+str(mmin)+'\nmax: '+str(mmax)+'\nmean: '+str(mmean)+'\nmedian: '+str(mmedian) + sbplt.text( plot_xmax+10,sbplot_ymin,text) + sbplt.set_xlabel('frame') + sbplt.set_ylabel(metric_name) + + plt.tight_layout() + + fname = "toto.png" + +# lgd = plt.legend(prop=fontP, bbox_to_anchor=(1.05, 1), loc=2, borderaxespad=0.) + mng = plt.get_current_fig_manager() + plt.savefig(fname, bbox_inches='tight') + plt.close() + + + + + + + + + + mmin = np.amin(output['metric']); + mmin_index = np.argmin(output['metric']); + mmax = np.amax(output['metric']); + mmax_index = np.argmax(output['metric']); + mean = np.mean(output['metric']); + median = np.median(output['metric']); + +# print ( ( (metric['min_limit'] > output['metric']).sum() / float(output['metric'].size) ) * 100 ) + + ret = { 'metric_count' : count, + 'metric_buf' : output, + + + 'metric_min' : mmin, + 'metric_min_index' : mmin_index, + 'metric_max' : mmax, + 'metric_max_index' : mmax_index, + 'metric_mean' : mean, + 'metric_median' : median, + } + return(ret) + # # # @@ -182,24 +305,30 @@ def do_img_metrics(metric_def, metric_data, fname): # print output['metric'].size plt.scatter(output['frame'], output['metric'], color='b', alpha=0.33, s = 1 , label=metric_def['id']) - plt.plot([0, output['frame'][metric_data['metric_count']-1]],[ metric_def['min_limit'],metric_def['min_limit']], 'r-', lw=2, label='min limit') # Red straight line + + if 'min_limit' in metric_def: + plt.plot([0, output['frame'][metric_data['metric_count']-1]],[ metric_def['min_limit'],metric_def['min_limit']], 'r-', lw=2, label='min limit') # Red straight line - plt.title('Physical throughput ('+metric_def['unit_of_meas']+')') + plt.title(metric_def['id'] +' ('+metric_def['unit_of_meas']+')') plt.xlabel('frame') plt.ylabel(metric_def['id']) # Set graphic minimum Y axis # ------------------------- - if metric_data['metric_min'] == 0 : - plt.ylim(ymin=-metric_def['min_limit']/10) + if metric_data['metric_min'] < 0: + plt.ylim(ymin=metric_data['metric_min']+metric_data['metric_min']/10) else : plt.ylim(ymin=0) y_axis_max = 0 - if metric_data['metric_max'] > metric_def['min_limit']: - y_axis_max =metric_data['metric_max']+metric_data['metric_max']/10 + if 'min_limit' in metric_def: + if metric_data['metric_max'] > metric_def['min_limit']: + y_axis_max =metric_data['metric_max']+metric_data['metric_max']/10 + else: + y_axis_max =metric_def['min_limit']+metric_def['min_limit']/10 else: - y_axis_max =metric_def['min_limit']+metric_def['min_limit']/10 + y_axis_max =metric_data['metric_max']+metric_data['metric_max']/10 + plt.ylim(ymax=y_axis_max) @@ -219,9 +348,6 @@ def do_img_metrics(metric_def, metric_data, fname): def do_extract_traffic_metrics(args): - print "" - print "do_extract_traffic_metrics ... " - fname = args['file'] # print(fname) @@ -325,7 +451,8 @@ def do_img_traffic(traffic_data, fname): ax1.set_xlim(xmax=np.amax(output['interval_stop'])) text='min: '+str(traffic_data['bw_min'])+'\nmax: '+str(traffic_data['bw_max'])+'\nmean: '+str(traffic_data['bw_mean'])+'\nmedian: '+str(traffic_data['bw_median']) ax1.text( np.amax(output['interval_stop'])+10,0,text) - + ax1.set_xlabel('time (s)') + ax1.set_ylabel(' ') ax2=plt.subplot(312) plt.plot(output['interval_stop'], output['jitter'], color='b' ) @@ -334,6 +461,8 @@ def do_img_traffic(traffic_data, fname): ax2.set_ylim(ymin=-1) text='min: '+str(traffic_data['jitter_min'])+'\nmax: '+str(traffic_data['jitter_max'])+'\nmean: '+str(traffic_data['jitter_mean'])+'\nmedian: '+str(traffic_data['jitter_median']) ax2.text( np.amax(output['interval_stop'])+10,0,text) + ax2.set_xlabel('time (s)') + ax2.set_ylabel(' ') ax3=plt.subplot(313) plt.plot(output['interval_stop'], output['rate_lost'], color='b') @@ -342,10 +471,11 @@ def do_img_traffic(traffic_data, fname): ax3.set_ylim(ymin=-1) text='min: '+str(traffic_data['rl_min'])+'\nmax: '+str(traffic_data['rl_max'])+'\nmean: '+str(traffic_data['rl_mean'])+'\nmedian: '+str(traffic_data['rl_median']) ax3.text( np.amax(output['interval_stop'])+10,0,text) - + ax3.set_xlabel('time (s)') + ax3.set_ylabel(' ') # plt.title('Physical throughput ('+metric_def['unit_of_meas']+')') - plt.xlabel('time (s)') +# plt.xlabel('time (s)') # plt.ylabel(metric_def['id']) # Set graphic minimum Y axis @@ -365,7 +495,7 @@ def do_img_traffic(traffic_data, fname): plt.tight_layout() - lgd = plt.legend(prop=fontP, bbox_to_anchor=(1.05, 1), loc=2, borderaxespad=0.) +# lgd = plt.legend(prop=fontP, bbox_to_anchor=(1.05, 1), loc=2, borderaxespad=0.) mng = plt.get_current_fig_manager() plt.savefig(fname, bbox_inches='tight') plt.close() @@ -395,7 +525,7 @@ def check_cell_synchro(fname): m = re.search('AUTOTEST Cell Sync \:', line) if m : - print line + #print line return 'CELL_SYNCH' return 'CELL_NOT_SYNCH' @@ -407,7 +537,7 @@ def check_exec_seg_fault(fname): for line in f: m = re.search('Segmentation fault', line) if m : - print line + #print line return 'SEG_FAULT' return 'NO_SEG_FAULT' diff --git a/cmake_targets/build_oai b/cmake_targets/build_oai index b77a9baa56..8e3021d0b0 100755 --- a/cmake_targets/build_oai +++ b/cmake_targets/build_oai @@ -53,6 +53,7 @@ BUILD_DOXYGEN=0 T_TRACER="False" DISABLE_HARDWARE_DEPENDENCY="False" CMAKE_BUILD_TYPE="" +UE_AUTOTEST_TRACE="False" trap handle_ctrl_c INT function print_help() { @@ -127,6 +128,8 @@ Options Enables the T tracer. --disable-hardware-dependency Disable HW dependency during installation +--ue-autotest-trace + Enable specific traces for UE autotest framework Usage (first build): oaisim (eNB + UE): ./build_oai -I --oaisim -x --install-system-files Eurecom EXMIMO + COTS UE : ./build_oai -I --eNB -x --install-system-files @@ -278,6 +281,10 @@ function main() { echo_info "Disabling hardware dependency for compiling software" DISABLE_HARDWARE_DEPENDENCY="True" shift 1;; + --ue-autotest-trace) + UE_AUTOTEST_TRACE="True" + echo_info "Enabling autotest specific trace for UE" + shift 1;; -h | --help) print_help exit 1;; @@ -447,6 +454,7 @@ function main() { echo "set (DEADLINE_SCHEDULER \"${DEADLINE_SCHEDULER_FLAG_USER}\" )" >>$cmake_file echo "set (CPU_AFFINITY \"${CPU_AFFINITY_FLAG_USER}\" )" >>$cmake_file echo "set ( T_TRACER $T_TRACER )" >> $cmake_file + echo "set (UE_AUTOTEST_TRACE $UE_AUTOTEST_TRACE)" >> $cmake_file echo 'include(${CMAKE_CURRENT_SOURCE_DIR}/../CMakeLists.txt)' >> $cmake_file cd $DIR/$lte_build_dir/build cmake .. diff --git a/openair1/PHY/CODING/3gpplte_turbo_decoder_sse_8bit.c b/openair1/PHY/CODING/3gpplte_turbo_decoder_sse_8bit.c index 4cdfb4f794..5ae2ec2ecd 100644 --- a/openair1/PHY/CODING/3gpplte_turbo_decoder_sse_8bit.c +++ b/openair1/PHY/CODING/3gpplte_turbo_decoder_sse_8bit.c @@ -486,7 +486,7 @@ void compute_beta8(llr_t* alpha,llr_t* beta,llr_t *m_11,llr_t* m_10,unsigned sho #endif - if (frame_length > 6143) { + if (frame_length > 6144) { LOG_E(PHY,"compute_beta: frame_length %d\n",frame_length); return; } @@ -972,6 +972,11 @@ unsigned char phy_threegpplte_turbo_decoder8(short *y, } else n2 = n; + if(n2<256) + { + printf("phy_threegpplte_turbo_decoder8 : frame length < 256\n"); + return 255; + } for (iind=0; iind < 188 && f1f2mat[iind].nb_bits != n; iind++); diff --git a/openair1/PHY/LTE_TRANSPORT/initial_sync.c b/openair1/PHY/LTE_TRANSPORT/initial_sync.c index 661fe96be8..782305d2fd 100644 --- a/openair1/PHY/LTE_TRANSPORT/initial_sync.c +++ b/openair1/PHY/LTE_TRANSPORT/initial_sync.c @@ -469,6 +469,15 @@ int initial_sync(PHY_VARS_UE *ue, runmode_t mode) //#endif if (ue->UE_scan_carrier == 0) { + + #if UE_AUTOTEST_TRACE + LOG_I(PHY,"[UE %d] AUTOTEST Cell Sync : frame = %d, rx_offset %d, freq_offset %d \n", + ue->Mod_id, + ue->proc.proc_rxtx[0].frame_rx, + ue->rx_offset, + ue->common_vars.freq_offset ); + #endif + if (ue->mac_enabled==1) { LOG_I(PHY,"[UE%d] Sending synch status to higher layers\n",ue->Mod_id); //mac_resynch(); diff --git a/openair1/SCHED/phy_procedures_lte_ue.c b/openair1/SCHED/phy_procedures_lte_ue.c index 3ed4c79ea3..6023886315 100644 --- a/openair1/SCHED/phy_procedures_lte_ue.c +++ b/openair1/SCHED/phy_procedures_lte_ue.c @@ -2944,6 +2944,13 @@ int phy_procedures_UE_RX(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uin LOG_D(PHY,"[UE %d] Calculating bitrate Frame %d: total_TBS = %d, total_TBS_last = %d, bitrate %f kbits\n", ue->Mod_id,frame_rx,ue->total_TBS[eNB_id], ue->total_TBS_last[eNB_id],(float) ue->bitrate[eNB_id]/1000.0); + + #if UE_AUTOTEST_TRACE + if ((frame_rx % 100 == 0)) { + LOG_I(PHY,"[UE %d] AUTOTEST Metric : UE_DLSCH_BITRATE = %5.2f kbps (frame = %d) \n", ue->Mod_id, (float) ue->bitrate[eNB_id]/1000.0, frame_rx); + } + #endif + } diff --git a/targets/RT/USER/lte-softmodem.c b/targets/RT/USER/lte-softmodem.c index 40b9255936..de5be6913c 100644 --- a/targets/RT/USER/lte-softmodem.c +++ b/targets/RT/USER/lte-softmodem.c @@ -1601,6 +1601,11 @@ int main( int argc, char **argv ) PHY_vars_eNB_g[0][CC_id] = init_lte_eNB(frame_parms[CC_id],0,frame_parms[CC_id]->Nid_cell,abstraction_flag); PHY_vars_eNB_g[0][CC_id]->CC_id = CC_id; + PHY_vars_eNB_g[0][CC_id]->ue_dl_rb_alloc=0x1fff; + PHY_vars_eNB_g[0][CC_id]->target_ue_dl_mcs=target_dl_mcs; + PHY_vars_eNB_g[0][CC_id]->ue_ul_nb_rb=6; + PHY_vars_eNB_g[0][CC_id]->target_ue_ul_mcs=target_ul_mcs; + if (phy_test==1) PHY_vars_eNB_g[0][CC_id]->mac_enabled = 0; else PHY_vars_eNB_g[0][CC_id]->mac_enabled = 1; From 9c4cee34f0778222c8fffc75e19f6bccfc9b7150 Mon Sep 17 00:00:00 2001 From: GabrirelCouturier Date: Mon, 21 Nov 2016 11:30:24 +0100 Subject: [PATCH 279/349] [OAI-UE] several fixes in OAI-UE 1- implement max harq retrans 2- bug in harqId > 1 for dci format 1A 3- wrong G computation 4- bug in harq UL for scheduling flag 5- initial sync, limit freq offset to 150Hz --- openair1/PHY/LTE_TRANSPORT/dci_tools.c | 74 ++++++++++++++++--- openair1/PHY/LTE_TRANSPORT/defs.h | 7 +- openair1/PHY/LTE_TRANSPORT/dlsch_decoding.c | 11 ++- openair1/PHY/LTE_TRANSPORT/initial_sync.c | 2 +- openair1/PHY/LTE_TRANSPORT/phich.c | 42 +++++++++-- openair1/PHY/LTE_TRANSPORT/ulsch_coding.c | 15 ++++ openair1/PHY/LTE_TRANSPORT/ulsch_modulation.c | 8 +- openair1/SCHED/phy_procedures_lte_ue.c | 20 ++++- openair2/UTIL/LOG/vcd_signal_dumper.c | 4 + openair2/UTIL/LOG/vcd_signal_dumper.h | 4 + 10 files changed, 161 insertions(+), 26 deletions(-) diff --git a/openair1/PHY/LTE_TRANSPORT/dci_tools.c b/openair1/PHY/LTE_TRANSPORT/dci_tools.c index da678088fd..c55290adf8 100644 --- a/openair1/PHY/LTE_TRANSPORT/dci_tools.c +++ b/openair1/PHY/LTE_TRANSPORT/dci_tools.c @@ -36,7 +36,10 @@ #include "PHY/vars.h" #endif #include "assertions.h" - + +#include "LAYER2/MAC/extern.h" +#include "LAYER2/MAC/defs.h" + //#define DEBUG_DCI uint32_t localRIV2alloc_LUT6[32]; @@ -3922,10 +3925,10 @@ int generate_ue_dlsch_params_from_dci(int frame, dlsch0_harq = dlsch[0]->harq_processes[harq_pid]; } else { - if (harq_pid>1) { - LOG_E(PHY,"Format 1A: harq_pid > 1\n"); - return(-1); - } + //if (harq_pid>1) { + // LOG_E(PHY,"Format 1A: harq_pid > 1\n"); + // return(-1); + //} dlsch0_harq = dlsch[0]->harq_processes[harq_pid]; NPRB = RIV2nb_rb_LUT25[rballoc]; @@ -5552,7 +5555,8 @@ int generate_ue_dlsch_params_from_dci(int frame, #ifdef DEBUG_DCI - if (dlsch[0]) { + if (dlsch[0] && (dlsch[0]->rnti != 0xffff)) { + printf("dci_format:%d \n",dci_format); printf("PDSCH dlsch0 UE: rnti %x\n",dlsch[0]->rnti); printf("PDSCH dlsch0 UE: NBRB %d\n",dlsch0_harq->nb_rb); printf("PDSCH dlsch0 UE: rballoc %x\n",dlsch0_harq->rb_alloc_even[0]); @@ -6396,7 +6400,11 @@ int generate_ue_ulsch_params_from_dci(void *dci_pdu, if ((rnti >= cba_rnti) && (rnti < p_rnti)) ulsch->harq_processes[harq_pid]->subframe_cba_scheduling_flag = 1; //+=1 this indicates the number of dci / cba group: not supported in the data struct else - ulsch->harq_processes[harq_pid]->subframe_scheduling_flag = 1; + { + ulsch->harq_processes[harq_pid]->subframe_scheduling_flag = 1; + //LOG_I(PHY,"[HARQ-UL harqId: %d] DCI0 ==> subframe_scheduling_flag = %d round: %d\n", harq_pid, ulsch->harq_processes[harq_pid]->subframe_scheduling_flag, ulsch->harq_processes[harq_pid]->round); + + } ulsch->harq_processes[harq_pid]->TPC = TPC; @@ -6426,7 +6434,41 @@ int generate_ue_ulsch_params_from_dci(void *dci_pdu, ulsch->harq_processes[harq_pid]->round = 0; } else { // ulsch->harq_processes[harq_pid]->Ndi = 0; - // ulsch->harq_processes[harq_pid]->round++; // This is done in phich RX + //ulsch->harq_processes[harq_pid]->round++; // This is done in phich RX + + //#ifdef DEBUG_PHICH + //LOG_I(PHY,"[UE %d][PUSCH %d] Frame %d subframe %d Adaptative Retrans, NDI not toggled => Nack. maxHARQ_Tx %d \n", + // ue->Mod_id,harq_pid, + // proc->frame_rx, + // subframe, + // UE_mac_inst[eNB_id].scheduling_info.maxHARQ_Tx); + //#endif + + + ulsch->harq_processes[harq_pid] = ulsch->harq_processes[8]; + ulsch->harq_processes[harq_pid]->round++; + //LOG_I(PHY," Adaptative retransmission - copy temporary harq Process to current harq process. [harqId %d round %d] \n",harq_pid, ulsch->harq_processes[8]->round); + + + if (ulsch->harq_processes[harq_pid]->round >= UE_mac_inst[eNB_id].scheduling_info.maxHARQ_Tx) + { + ulsch->harq_processes[harq_pid]->subframe_scheduling_flag = 0; + ulsch->harq_processes[harq_pid]->round = 0; + ulsch->harq_processes[harq_pid]->status = IDLE; + //LOG_I(PHY," PUSCH MAX Retransmission acheived ==> flush harq buff (%d) \n",harq_pid); + //LOG_I(PHY," [HARQ-UL harqId: %d] Adaptative retransmission NACK MAX RETRANS(%d) ==> subframe_scheduling_flag = %d round: %d\n", harq_pid, UE_mac_inst[eNB_id].scheduling_info.maxHARQ_Tx, ulsch->harq_processes[harq_pid]->subframe_scheduling_flag, ulsch->harq_processes[harq_pid]->round); + } + else + { + // ulsch->harq_processes[harq_pid]->subframe_scheduling_flag = 1; + uint8_t rv_table[4] = {0, 2, 3, 1}; + ulsch->harq_processes[harq_pid]->rvidx = rv_table[ulsch->harq_processes[harq_pid]->round&3]; + ulsch->O_RI = 0; + ulsch->O = 0; + ulsch->uci_format = HLC_subband_cqi_nopmi; + //LOG_I(PHY," [HARQ-UL harqId: %d] Adaptative retransmission NACK ==> subframe_scheduling_flag = %d round: %d\n", harq_pid, ulsch->harq_processes[harq_pid]->subframe_scheduling_flag,ulsch->harq_processes[harq_pid]->round); + } + } } @@ -6476,7 +6518,16 @@ int generate_ue_ulsch_params_from_dci(void *dci_pdu, if (cqi_req == 1) { - ulsch->O_RI = 1; //we only support 2 antenna ports, so this is always 1 according to 3GPP 36.213 Table + + if( (AntennaInfoDedicated__transmissionMode_tm3 == transmission_mode) || (AntennaInfoDedicated__transmissionMode_tm4 == transmission_mode) ) + { + ulsch->O_RI = 1; + } + else + { + ulsch->O_RI = 0; + } + //ulsch->O_RI = 0; //we only support 2 antenna ports, so this is always 1 according to 3GPP 36.213 Table switch(transmission_mode) { // The aperiodic CQI reporting mode is fixed for every transmission mode instead of being configured by higher layer signaling @@ -7039,12 +7090,15 @@ int generate_ue_ulsch_params_from_dci(void *dci_pdu, #ifdef DEBUG_DCI printf("Format 0 DCI : ulsch (ue): NBRB %d\n",ulsch->harq_processes[harq_pid]->nb_rb); printf("Format 0 DCI :ulsch (ue): first_rb %d\n",ulsch->harq_processes[harq_pid]->first_rb); + printf("Format 0 DCI :ulsch (ue): rballoc %d\n",rballoc); printf("Format 0 DCI :ulsch (ue): harq_pid %d\n",harq_pid); + printf("Format 0 DCI :ulsch (ue): first_tx %d\n",ulsch->harq_processes[harq_pid]->first_tx); + printf("Format 0 DCI :ulsch (ue): DCINdi %d\n",ulsch->harq_processes[harq_pid]->DCINdi); printf("Format 0 DCI :ulsch (ue): round %d\n",ulsch->harq_processes[harq_pid]->round); printf("Format 0 DCI :ulsch (ue): TBS %d\n",ulsch->harq_processes[harq_pid]->TBS); printf("Format 0 DCI :ulsch (ue): mcs %d\n",ulsch->harq_processes[harq_pid]->mcs); printf("Format 0 DCI :ulsch (ue): O %d\n",ulsch->O); - + printf("Format 0 DCI :ulsch (ue): cqiReq %d\n",cqi_req); if (frame_parms->frame_type == TDD) printf("Format 0 DCI :ulsch (ue): O_ACK/DAI %d/%d\n",ulsch->harq_processes[harq_pid]->O_ACK,dai); else diff --git a/openair1/PHY/LTE_TRANSPORT/defs.h b/openair1/PHY/LTE_TRANSPORT/defs.h index 026ba40340..f8d36d3bd4 100644 --- a/openair1/PHY/LTE_TRANSPORT/defs.h +++ b/openair1/PHY/LTE_TRANSPORT/defs.h @@ -227,6 +227,11 @@ typedef struct { uint8_t control_only; /// Flag to indicate that this is a calibration ULSCH (i.e. no MAC SDU and filled with TDD calibration information) // int calibration_flag; + /// Number of soft channel bits + uint32_t G; + + // decode phich + uint8_t decode_phich; } LTE_UL_UE_HARQ_t; typedef struct { @@ -278,7 +283,7 @@ typedef struct { /// SRS active flag uint8_t srs_active; /// Pointers to 8 HARQ processes for the ULSCH - LTE_UL_UE_HARQ_t *harq_processes[8]; + LTE_UL_UE_HARQ_t *harq_processes[9]; /// Pointer to CQI data uint8_t o[MAX_CQI_BYTES]; /// Length of CQI data (bits) diff --git a/openair1/PHY/LTE_TRANSPORT/dlsch_decoding.c b/openair1/PHY/LTE_TRANSPORT/dlsch_decoding.c index c7cd5ab52f..4a80110b22 100644 --- a/openair1/PHY/LTE_TRANSPORT/dlsch_decoding.c +++ b/openair1/PHY/LTE_TRANSPORT/dlsch_decoding.c @@ -619,7 +619,11 @@ uint32_t dlsch_decoding(PHY_VARS_UE *phy_vars_ue, harq_process->errors[harq_process->round]++; harq_process->round++; - // LOG_D(PHY,"[UE %d] DLSCH: Setting NACK for subframe %d (pid %d, round %d)\n",phy_vars_ue->Mod_id,subframe,harq_pid,harq_process->round); + + if(is_crnti) + { + LOG_D(PHY,"[UE %d] DLSCH: Setting NACK for subframe %d (pid %d, round %d, TBS %d)\n",phy_vars_ue->Mod_id,subframe,harq_pid,harq_process->round,harq_process->TBS); + } // printf("Rate: [UE %d] DLSCH: Setting NACK for subframe %d (pid %d, round %d)\n",phy_vars_ue->Mod_id,subframe,harq_pid,harq_process->round); if (harq_process->round >= dlsch->Mdlharq) { harq_process->status = SCH_IDLE; @@ -632,7 +636,10 @@ uint32_t dlsch_decoding(PHY_VARS_UE *phy_vars_ue, dlsch->harq_ack[subframe].ack = 1; dlsch->harq_ack[subframe].harq_id = harq_pid; dlsch->harq_ack[subframe].send_harq_status = 1; - LOG_D(PHY,"[UE %d] DLSCH: Setting ACK for subframe %d (pid %d, round %d)\n",phy_vars_ue->Mod_id,subframe,harq_pid,harq_process->round); + if(is_crnti) + { + LOG_D(PHY,"[UE %d] DLSCH: Setting ACK for subframe %d (pid %d, round %d, TBS %d)\n",phy_vars_ue->Mod_id,subframe,harq_pid,harq_process->round,harq_process->TBS); + } } diff --git a/openair1/PHY/LTE_TRANSPORT/initial_sync.c b/openair1/PHY/LTE_TRANSPORT/initial_sync.c index 91374078c0..663978e92c 100644 --- a/openair1/PHY/LTE_TRANSPORT/initial_sync.c +++ b/openair1/PHY/LTE_TRANSPORT/initial_sync.c @@ -463,7 +463,7 @@ int initial_sync(PHY_VARS_UE *ue, runmode_t mode) } /* Consider this is a false detection if the offset is > 1000 Hz */ - if( (abs(ue->common_vars.freq_offset) > 1000) && (ret == 0) ) + if( (abs(ue->common_vars.freq_offset) > 150) && (ret == 0) ) { ret=-1; LOG_E(HW,"Ignore MIB with high freq offset [%d Hz] estimation \n",ue->common_vars.freq_offset); diff --git a/openair1/PHY/LTE_TRANSPORT/phich.c b/openair1/PHY/LTE_TRANSPORT/phich.c index 6b66ee0282..dc46f0505c 100644 --- a/openair1/PHY/LTE_TRANSPORT/phich.c +++ b/openair1/PHY/LTE_TRANSPORT/phich.c @@ -34,6 +34,10 @@ #include "PHY/extern.h" #include "SCHED/defs.h" #include "defs.h" + +#include "LAYER2/MAC/extern.h" +#include "LAYER2/MAC/defs.h" + #ifndef USER_MODE #include "ARCH/CBMIMO1/DEVICE_DRIVER/extern.h" #endif @@ -1375,15 +1379,30 @@ void rx_phich(PHY_VARS_UE *ue, subframe, HI16, nseq_PHICH, - ngroup_PHICH); + ngroup_PHICH, + UE_mac_inst[eNB_id].scheduling_info.maxHARQ_Tx); //#endif - ulsch->harq_processes[harq_pid]->subframe_scheduling_flag = 1; + // ulsch->harq_processes[harq_pid]->Ndi = 0; ulsch->harq_processes[harq_pid]->round++; - ulsch->harq_processes[harq_pid]->rvidx = rv_table[ulsch->harq_processes[harq_pid]->round&3]; - ulsch->O_RI = 0; - ulsch->O = 0; - ulsch->uci_format = HLC_subband_cqi_nopmi; + + if (ulsch->harq_processes[harq_pid]->round >= UE_mac_inst[eNB_id].scheduling_info.maxHARQ_Tx) + { + ulsch->harq_processes[harq_pid]->subframe_scheduling_flag = 0; + ulsch->harq_processes[harq_pid]->round = 0; + ulsch->harq_processes[harq_pid]->status = IDLE; + //LOG_I(PHY,"PUSCH MAX Retransmission acheived ==> flush harq buff (%d) \n",harq_pid); + //LOG_I(PHY,"[HARQ-UL harqId: %d] PHICH NACK MAX RETRANS(%d) ==> subframe_scheduling_flag = %d round: %d\n", harq_pid, UE_mac_inst[eNB_id].scheduling_info.maxHARQ_Tx, ulsch->harq_processes[harq_pid]->subframe_scheduling_flag, ulsch->harq_processes[harq_pid]->round); + } + else + { + // ulsch->harq_processes[harq_pid]->subframe_scheduling_flag = 1; + ulsch->harq_processes[harq_pid]->rvidx = rv_table[ulsch->harq_processes[harq_pid]->round&3]; + ulsch->O_RI = 0; + ulsch->O = 0; + ulsch->uci_format = HLC_subband_cqi_nopmi; + //LOG_I(PHY,"[HARQ-UL harqId: %d] PHICH NACK ==> subframe_scheduling_flag = %d round: %d\n", harq_pid, ulsch->harq_processes[harq_pid]->subframe_scheduling_flag,ulsch->harq_processes[harq_pid]->round); + } } @@ -1405,11 +1424,22 @@ void rx_phich(PHY_VARS_UE *ue, //#endif } + // LOG_I(PHY,"[HARQ-UL harqId: %d] subframe_scheduling_flag = %d \n",harq_pid, ulsch->harq_processes[harq_pid]->subframe_scheduling_flag); + + // Incase of adaptive retransmission, PHICH is always decoded as ACK (at least with OAI-eNB) + // Workaround: + // rely only on DCI0 decoding and check if NDI has toggled + // save current harq_processes content in temporary struct + // harqId-8 corresponds to the temporary struct. In total we have 8 harq process(0 ..7) + 1 temporary harq process() + ulsch->harq_processes[8] = ulsch->harq_processes[harq_pid]; + ulsch->harq_processes[harq_pid]->subframe_scheduling_flag =0; ulsch->harq_processes[harq_pid]->status = IDLE; ulsch->harq_processes[harq_pid]->round = 0; // inform MAC? ue->ulsch_Msg3_active[eNB_id] = 0; + + //LOG_I(PHY,"[HARQ-UL harqId: %d] PHICH ACK ==> subframe_scheduling_flag = %d round: %d\n", harq_pid, ulsch->harq_processes[harq_pid]->subframe_scheduling_flag, ulsch->harq_processes[harq_pid]->round); } } diff --git a/openair1/PHY/LTE_TRANSPORT/ulsch_coding.c b/openair1/PHY/LTE_TRANSPORT/ulsch_coding.c index 53eaa849fd..48048bf5de 100644 --- a/openair1/PHY/LTE_TRANSPORT/ulsch_coding.c +++ b/openair1/PHY/LTE_TRANSPORT/ulsch_coding.c @@ -498,6 +498,21 @@ uint32_t ulsch_encoding(uint8_t *a, G = G - Q_RI - Q_CQI; + ulsch->harq_processes[harq_pid]->G = G; + +/* + LOG_I(PHY,"ULSCH Encoding G %d, Q_RI %d (O_RI%d, Msc_initial %d, Nsymb_initial%d, beta_offset_ri_times8 %d), Q_CQI %d \n",G,Q_RI,ulsch->O_RI,ulsch->harq_processes[harq_pid]->Msc_initial,ulsch->harq_processes[harq_pid]->Nsymb_initial,ulsch->beta_offset_ri_times8,Q_CQI); + + LOG_I(PHY,"ulsch_decoding (Nid_cell %d, rnti %x): harq_pid %d round %d, RV %d, mcs %d, O_RI %d, O_ACK %d, G %d\n", + frame_parms->Nid_cell,ulsch->rnti, + harq_pid, + ulsch->harq_processes[harq_pid]->round, + ulsch->harq_processes[harq_pid]->rvidx, + ulsch->harq_processes[harq_pid]->mcs, + ulsch->O_RI, + ulsch->harq_processes[harq_pid]->O_ACK, + G); +*/ if ((int)G < 0) { LOG_E(PHY,"FATAL: ulsch_coding.c G < 0 (%d) : Q_RI %d, Q_CQI %d, O %d, betaCQI_times8 %d)\n",G,Q_RI,Q_CQI,ulsch->O,ulsch->beta_offset_cqi_times8); diff --git a/openair1/PHY/LTE_TRANSPORT/ulsch_modulation.c b/openair1/PHY/LTE_TRANSPORT/ulsch_modulation.c index 80168dd3c5..02323d6ccd 100644 --- a/openair1/PHY/LTE_TRANSPORT/ulsch_modulation.c +++ b/openair1/PHY/LTE_TRANSPORT/ulsch_modulation.c @@ -424,15 +424,17 @@ void ulsch_modulation(int32_t **txdataF, Q_m = get_Qm_ul(ulsch->harq_processes[harq_pid]->mcs); - G = (int)ulsch->harq_processes[harq_pid]->nb_rb * (12 * Q_m) * (ulsch->Nsymb_pusch); + //G = (int)ulsch->harq_processes[harq_pid]->nb_rb * (12 * Q_m) * (ulsch->Nsymb_pusch); + + G = ulsch->harq_processes[harq_pid]->G; // Mapping nsymb = (frame_parms->Ncp==0) ? 14:12; Msc_PUSCH = ulsch->harq_processes[harq_pid]->nb_rb*12; #ifdef DEBUG_ULSCH_MODULATION - printf("ulsch_modulation.c: Doing modulation (rnti %x,x2 %x) for G=%d bits, harq_pid %d , nb_rb %d, Q_m %d, Nsymb_pusch %d (nsymb %d), subframe %d\n", - ulsch->rnti,x2,G,harq_pid,ulsch->harq_processes[harq_pid]->nb_rb,Q_m, ulsch->Nsymb_pusch,nsymb,subframe); + LOG_D(PHY,"ulsch_modulation.c: Doing modulation (rnti %x,x2 %x) for G=%d bits, harq_pid %d , nb_rb %d, Q_m %d, Nsymb_pusch %d (nsymb %d), subframe %d\n", + ulsch->rnti,x2,G,harq_pid,ulsch->harq_processes[harq_pid]->nb_rb,Q_m, ulsch->Nsymb_pusch,nsymb,subframe); #endif // scrambling (Note the placeholding bits are handled in ulsch_coding.c directly!) diff --git a/openair1/SCHED/phy_procedures_lte_ue.c b/openair1/SCHED/phy_procedures_lte_ue.c index 55e7686462..92eee4a99d 100644 --- a/openair1/SCHED/phy_procedures_lte_ue.c +++ b/openair1/SCHED/phy_procedures_lte_ue.c @@ -1213,7 +1213,7 @@ void ue_ulsch_uespec_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB ue->generate_ul_signal[eNB_id] = 1; // deactivate service request - ue->ulsch[eNB_id]->harq_processes[harq_pid]->subframe_scheduling_flag = 0; + // ue->ulsch[eNB_id]->harq_processes[harq_pid]->subframe_scheduling_flag = 0; ack_status = get_ack(&ue->frame_parms, ue->dlsch[eNB_id][0]->harq_ack, @@ -3089,22 +3089,27 @@ void ue_dlsch_procedures(PHY_VARS_UE *ue, if (ret == (1+dlsch0->max_turbo_iterations)) { *dlsch_errors=*dlsch_errors+1; - + if(dlsch0->rnti != 0xffff) + { LOG_D(PHY,"[UE %d][PDSCH %x/%d] Frame %d subframe %d DLSCH in error (rv %d,mcs %d,TBS %d)\n", ue->Mod_id,dlsch0->rnti, harq_pid,frame_rx,subframe_rx, dlsch0->harq_processes[harq_pid]->rvidx, dlsch0->harq_processes[harq_pid]->mcs, dlsch0->harq_processes[harq_pid]->TBS); + } } else { + if(dlsch0->rnti != 0xffff) + { LOG_D(PHY,"[UE %d][PDSCH %x/%d] Frame %d subframe %d: Received DLSCH (rv %d,mcs %d,TBS %d)\n", ue->Mod_id,dlsch0->rnti, harq_pid,frame_rx,subframe_rx, dlsch0->harq_processes[harq_pid]->rvidx, dlsch0->harq_processes[harq_pid]->mcs, dlsch0->harq_processes[harq_pid]->TBS); + } #ifdef DEBUG_DLSCH int j; @@ -3293,6 +3298,7 @@ int phy_procedures_UE_RX(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uin // do procedures for C-RNTI if (ue->dlsch[eNB_id][0]->active == 1) { + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_PROC, VCD_FUNCTION_IN); ue_pdsch_procedures(ue, proc, eNB_id, @@ -3302,9 +3308,11 @@ int phy_procedures_UE_RX(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uin ue->pdcch_vars[eNB_id]->num_pdcch_symbols, ue->frame_parms.symbols_per_tti>>1, abstraction_flag); + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_PROC, VCD_FUNCTION_OUT); } // do procedures for SI-RNTI if ((ue->dlsch_SI[eNB_id]) && (ue->dlsch_SI[eNB_id]->active == 1)) { + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_PROC_SI, VCD_FUNCTION_IN); ue_pdsch_procedures(ue, proc, eNB_id, @@ -3314,10 +3322,12 @@ int phy_procedures_UE_RX(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uin ue->pdcch_vars[eNB_id]->num_pdcch_symbols, ue->frame_parms.symbols_per_tti>>1, abstraction_flag); + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_PROC_SI, VCD_FUNCTION_OUT); } // do procedures for SI-RNTI if ((ue->dlsch_p[eNB_id]) && (ue->dlsch_p[eNB_id]->active == 1)) { + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_PROC_P, VCD_FUNCTION_IN); ue_pdsch_procedures(ue, proc, eNB_id, @@ -3327,10 +3337,12 @@ int phy_procedures_UE_RX(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uin ue->pdcch_vars[eNB_id]->num_pdcch_symbols, ue->frame_parms.symbols_per_tti>>1, abstraction_flag); + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_PROC_P, VCD_FUNCTION_OUT); } // do procedures for RA-RNTI if ((ue->dlsch_ra[eNB_id]) && (ue->dlsch_ra[eNB_id]->active == 1)) { + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_PROC_RA, VCD_FUNCTION_IN); ue_pdsch_procedures(ue, proc, eNB_id, @@ -3340,6 +3352,7 @@ int phy_procedures_UE_RX(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uin ue->pdcch_vars[eNB_id]->num_pdcch_symbols, ue->frame_parms.symbols_per_tti>>1, abstraction_flag); + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_PROC_RA, VCD_FUNCTION_OUT); } if (subframe_select(&ue->frame_parms,subframe_rx) != SF_S) { // do front-end processing for second slot, and first symbol of next subframe @@ -3375,6 +3388,7 @@ int phy_procedures_UE_RX(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uin // do procedures for C-RNTI if (ue->dlsch[eNB_id][0]->active == 1) { + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_PROC, VCD_FUNCTION_IN); ue_pdsch_procedures(ue, proc, eNB_id, @@ -3393,7 +3407,7 @@ int phy_procedures_UE_RX(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uin &ue->dlsch_errors[eNB_id], mode, abstraction_flag); - + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_PROC, VCD_FUNCTION_OUT); } else { diff --git a/openair2/UTIL/LOG/vcd_signal_dumper.c b/openair2/UTIL/LOG/vcd_signal_dumper.c index 226f8f0754..d367ec7766 100644 --- a/openair2/UTIL/LOG/vcd_signal_dumper.c +++ b/openair2/UTIL/LOG/vcd_signal_dumper.c @@ -240,6 +240,10 @@ const char* eurecomFunctionsNames[] = { "rx_pdcch", "dci_decoding", "rx_phich", + "pdsch_procedures", + "pdsch_procedures_si", + "pdsch_procedures_p", + "pdsch_procedures_ra", "phy_ue_config_sib2", "macxface_phy_config_sib1_eNB", "macxface_phy_config_sib2_eNB", diff --git a/openair2/UTIL/LOG/vcd_signal_dumper.h b/openair2/UTIL/LOG/vcd_signal_dumper.h index 81a5fb083d..1e03e95002 100644 --- a/openair2/UTIL/LOG/vcd_signal_dumper.h +++ b/openair2/UTIL/LOG/vcd_signal_dumper.h @@ -214,6 +214,10 @@ typedef enum { VCD_SIGNAL_DUMPER_FUNCTIONS_RX_PDCCH, VCD_SIGNAL_DUMPER_FUNCTIONS_DCI_DECODING, VCD_SIGNAL_DUMPER_FUNCTIONS_RX_PHICH, + VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_PROC, + VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_PROC_SI, + VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_PROC_P, + VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_PROC_RA, VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_UE_CONFIG_SIB2, VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_CONFIG_SIB1_ENB, VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_CONFIG_SIB2_ENB, From e86b3e31c79bcc489b67f55e3cbadd035e706fbf Mon Sep 17 00:00:00 2001 From: Florian Kaltenberger Date: Mon, 26 Sep 2016 14:51:52 +0200 Subject: [PATCH 280/349] changing some config files --- .../CONF/enb.band4.exmimo2.conf | 147 ++++++++++++++++++ .../CONF/enb.band7.usrpb210.conf | 2 +- 2 files changed, 148 insertions(+), 1 deletion(-) create mode 100644 targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band4.exmimo2.conf diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band4.exmimo2.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band4.exmimo2.conf new file mode 100644 index 0000000000..bf7861f66d --- /dev/null +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band4.exmimo2.conf @@ -0,0 +1,147 @@ +Active_eNBs = ( "eNB_Eurecom_LTEBox"); +# Asn1_verbosity, choice in: none, info, annoying +Asn1_verbosity = "none"; + +eNBs = +( + { + # real_time choice in {hard, rt-preempt, no} + real_time = "no"; + ////////// Identification parameters: + eNB_ID = 0xe00; + + cell_type = "CELL_MACRO_ENB"; + + eNB_name = "eNB_Eurecom_LTEBox"; + + // Tracking area code, 0x0000 and 0xfffe are reserved values + tracking_area_code = "1"; + + mobile_country_code = "208"; + + mobile_network_code = "94"; + + ////////// Physical parameters: + + component_carriers = ( + { + frame_type = "FDD"; + tdd_config = 3; + tdd_config_s = 0; + prefix_type = "NORMAL"; + eutra_band = 4; + downlink_frequency = 2112500000L; + uplink_frequency_offset = -400000000; + + Nid_cell = 0; + N_RB_DL = 25; + Nid_cell_mbsfn = 0; + nb_antennas_tx = 1; + nb_antennas_rx = 1; + nb_antenna_ports = 1; + tx_gain = 20; + rx_gain = 20; + prach_root = 22; + prach_config_index = 0; + prach_high_speed = "DISABLE"; + prach_zero_correlation = 1; + prach_freq_offset = 2; + pucch_delta_shift = 1; + pucch_nRB_CQI = 1; + pucch_nCS_AN = 0; + pucch_n1_AN = 32; + pdsch_referenceSignalPower = -25; + pdsch_p_b = 0; + pusch_n_SB = 1; + pusch_enable64QAM = "DISABLE"; + pusch_hoppingMode = "interSubFrame"; + pusch_hoppingOffset = 1; + pusch_groupHoppingEnabled = "ENABLE"; + pusch_groupAssignment = 0; + pusch_sequenceHoppingEnabled = "DISABLE"; + pusch_nDMRS1 = 0; + phich_duration = "NORMAL"; + phich_resource = "ONESIXTH"; + srs_enable = "DISABLE"; + /* srs_BandwidthConfig =; + srs_SubframeConfig =; + srs_ackNackST =; + srs_MaxUpPts =;*/ + + pusch_p0_Nominal = -85; + pusch_alpha = "AL1"; + pucch_p0_Nominal = -96; + msg3_delta_Preamble = 6; + pucch_deltaF_Format1 = "deltaF2"; + pucch_deltaF_Format1b = "deltaF3"; + pucch_deltaF_Format2 = "deltaF0"; + pucch_deltaF_Format2a = "deltaF0"; + pucch_deltaF_Format2b = "deltaF0"; + + rach_numberOfRA_Preambles = 64; + rach_preamblesGroupAConfig = "DISABLE"; +/* + rach_sizeOfRA_PreamblesGroupA = ; + rach_messageSizeGroupA = ; + rach_messagePowerOffsetGroupB = ; +*/ + rach_powerRampingStep = 2; + rach_preambleInitialReceivedTargetPower = -100; + rach_preambleTransMax = 10; + rach_raResponseWindowSize = 10; + rach_macContentionResolutionTimer = 48; + rach_maxHARQ_Msg3Tx = 4; + + pcch_default_PagingCycle = 128; + pcch_nB = "oneT"; + bcch_modificationPeriodCoeff = 2; + ue_TimersAndConstants_t300 = 1000; + ue_TimersAndConstants_t301 = 1000; + ue_TimersAndConstants_t310 = 1000; + ue_TimersAndConstants_t311 = 20000; //10000; + ue_TimersAndConstants_n310 = 20; + ue_TimersAndConstants_n311 = 1; + + ue_TransmissionMode = 1; + + } + ); + + ////////// MME parameters: + mme_ip_address = ( { ipv4 = "192.168.12.70"; + ipv6 = "192:168:30::17"; + active = "yes"; + preference = "ipv4"; + } + ); + + NETWORK_INTERFACES : + { + ENB_INTERFACE_NAME_FOR_S1_MME = "eth0"; + ENB_IPV4_ADDRESS_FOR_S1_MME = "192.168.12.212/24"; + + ENB_INTERFACE_NAME_FOR_S1U = "eth0"; + ENB_IPV4_ADDRESS_FOR_S1U = "192.168.12.212/24"; + ENB_PORT_FOR_S1U = 2152; # Spec 2152 + }; + + log_config : + { + global_log_level ="info"; + global_log_verbosity ="high"; + hw_log_level ="info"; + hw_log_verbosity ="high"; + phy_log_level ="info"; + phy_log_verbosity ="high"; + mac_log_level ="debug"; + mac_log_verbosity ="high"; + rlc_log_level ="info"; + rlc_log_verbosity ="high"; + pdcp_log_level ="info"; + pdcp_log_verbosity ="high"; + rrc_log_level ="info"; + rrc_log_verbosity ="high"; + }; + + } +); diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.usrpb210.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.usrpb210.conf index 7941441d1d..1fe3beae0e 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.usrpb210.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.usrpb210.conf @@ -135,7 +135,7 @@ eNBs = }; ////////// MME parameters: - mme_ip_address = ( { ipv4 = "192.168.12.171"; + mme_ip_address = ( { ipv4 = "192.168.12.70"; ipv6 = "192:168:30::17"; active = "yes"; preference = "ipv4"; From 5c5c336300924ed66beb6b4946117314ee8a4b64 Mon Sep 17 00:00:00 2001 From: Florian Kaltenberger Date: Mon, 21 Nov 2016 11:55:36 +0100 Subject: [PATCH 281/349] fixes to make lte-softmodem compile again --- targets/ARCH/EXMIMO/DEFS/openair_device.h | 6 +- .../ARCH/EXMIMO/USERSPACE/LIB/openair0_lib.c | 8 +- targets/RT/USER/lte-enb.c | 98 +++++++++---------- targets/RT/USER/lte-softmodem.c | 8 +- 4 files changed, 59 insertions(+), 61 deletions(-) diff --git a/targets/ARCH/EXMIMO/DEFS/openair_device.h b/targets/ARCH/EXMIMO/DEFS/openair_device.h index 6c1c8708db..b4916490e2 100644 --- a/targets/ARCH/EXMIMO/DEFS/openair_device.h +++ b/targets/ARCH/EXMIMO/DEFS/openair_device.h @@ -24,9 +24,9 @@ // Maximum number of concurrently supported cards -// -#define MAX_CARDS 16 -#define INIT_ZEROS {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; +// defined in openair_common_lib.h +//#define MAX_CARDS 16 +//#define INIT_ZEROS {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; /** PCIe subsystem configuration Space diff --git a/targets/ARCH/EXMIMO/USERSPACE/LIB/openair0_lib.c b/targets/ARCH/EXMIMO/USERSPACE/LIB/openair0_lib.c index 2d0146b3f1..4db108b3c8 100644 --- a/targets/ARCH/EXMIMO/USERSPACE/LIB/openair0_lib.c +++ b/targets/ARCH/EXMIMO/USERSPACE/LIB/openair0_lib.c @@ -63,7 +63,7 @@ exmimo_pci_interface_bot_virtual_t openair0_exmimo_pci[MAX_CARDS]; // contains userspace pointers for each card -char *bigshm_top[MAX_CARDS] = INIT_ZEROS; +char *bigshm_top[MAX_CARDS]; int openair0_fd; int openair0_num_antennas[MAX_CARDS]; @@ -126,7 +126,8 @@ int openair0_open(void) //printf("bigshm_top_kvirtptr (MAX_CARDS %d): %p %p %p %p\n", MAX_CARDS,bigshm_top_kvirtptr[0], bigshm_top_kvirtptr[1], bigshm_top_kvirtptr[2], bigshm_top_kvirtptr[3]); - + for( card=0; card < MAX_CARDS; card++) + bigshm_top[card] = NULL; for( card=0; card < openair0_num_detected_cards; card++) { bigshm_top[card] = (char *)mmap( NULL, @@ -530,6 +531,7 @@ int trx_exmimo_read(openair0_device *device, openair0_timestamp *ptimestamp, voi return(0); } + ret = pthread_mutex_lock(&exm->watchdog_mutex); switch (ret) { case EINVAL: @@ -558,8 +560,6 @@ int trx_exmimo_read(openair0_device *device, openair0_timestamp *ptimestamp, voi break; } - ret = pthread_mutex_lock(&exm->watchdog_mutex); - ts = exm->ts; if (exm->wait_first_read==1) { exm->wait_first_read=0; diff --git a/targets/RT/USER/lte-enb.c b/targets/RT/USER/lte-enb.c index af06979efd..965894cac0 100644 --- a/targets/RT/USER/lte-enb.c +++ b/targets/RT/USER/lte-enb.c @@ -277,75 +277,73 @@ static inline void wait_sync(char *thread_name) { void do_OFDM_mod_rt(int subframe,PHY_VARS_eNB *phy_vars_eNB) { - unsigned int aa,slot_offset, slot_offset_F; - int dummy_tx_b[7680*4] __attribute__((aligned(32))); + unsigned int aa,slot_offset; + //int dummy_tx_b[7680*4] __attribute__((aligned(32))); int i, tx_offset; - int slot_sizeF = (phy_vars_eNB->lte_frame_parms.ofdm_symbol_size)* - ((phy_vars_eNB->lte_frame_parms.Ncp==1) ? 6 : 7); + //int slot_sizeF = (phy_vars_eNB->frame_parms.ofdm_symbol_size)* ((phy_vars_eNB->frame_parms.Ncp==1) ? 6 : 7); int len; + //int slot_offset_F = (subframe<<1)*slot_sizeF; - slot_offset_F = (subframe<<1)*slot_sizeF; - - slot_offset = subframe*phy_vars_eNB->lte_frame_parms.samples_per_tti; + slot_offset = subframe*phy_vars_eNB->frame_parms.samples_per_tti; - if ((subframe_select(&phy_vars_eNB->lte_frame_parms,subframe)==SF_DL)|| - ((subframe_select(&phy_vars_eNB->lte_frame_parms,subframe)==SF_S))) { + if ((subframe_select(&phy_vars_eNB->frame_parms,subframe)==SF_DL)|| + ((subframe_select(&phy_vars_eNB->frame_parms,subframe)==SF_S))) { // LOG_D(HW,"Frame %d: Generating slot %d\n",frame,next_slot); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_OFDM_MODULATION,1); - do_OFDM_mod_symbol(&phy_vars_eNB->lte_eNB_common_vars, + do_OFDM_mod_symbol(&phy_vars_eNB->common_vars, 0, subframe<<1, - &phy_vars_eNB->lte_frame_parms); + &phy_vars_eNB->frame_parms); // if S-subframe generate first slot only - if (subframe_select(&phy_vars_eNB->lte_frame_parms,subframe) == SF_DL) { - do_OFDM_mod_symbol(&phy_vars_eNB->lte_eNB_common_vars, + if (subframe_select(&phy_vars_eNB->frame_parms,subframe) == SF_DL) { + do_OFDM_mod_symbol(&phy_vars_eNB->common_vars, 0, 1+(subframe<<1), - &phy_vars_eNB->lte_frame_parms); + &phy_vars_eNB->frame_parms); } VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_OFDM_MODULATION,0); /* - for (aa=0; aalte_frame_parms.nb_antennas_tx; aa++) { - if (phy_vars_eNB->lte_frame_parms.Ncp == EXTENDED) { - PHY_ofdm_mod(&phy_vars_eNB->lte_eNB_common_vars.txdataF[0][aa][slot_offset_F], + for (aa=0; aaframe_parms.nb_antennas_tx; aa++) { + if (phy_vars_eNB->frame_parms.Ncp == EXTENDED) { + PHY_ofdm_mod(&phy_vars_eNB->common_vars.txdataF[0][aa][slot_offset_F], dummy_tx_b, - phy_vars_eNB->lte_frame_parms.ofdm_symbol_size, + phy_vars_eNB->frame_parms.ofdm_symbol_size, 6, - phy_vars_eNB->lte_frame_parms.nb_prefix_samples, + phy_vars_eNB->frame_parms.nb_prefix_samples, CYCLIC_PREFIX); - PHY_ofdm_mod(&phy_vars_eNB->lte_eNB_common_vars.txdataF[0][aa][slot_offset_F+slot_sizeF], - dummy_tx_b+(phy_vars_eNB->lte_frame_parms.samples_per_tti>>1), - phy_vars_eNB->lte_frame_parms.ofdm_symbol_size, + PHY_ofdm_mod(&phy_vars_eNB->common_vars.txdataF[0][aa][slot_offset_F+slot_sizeF], + dummy_tx_b+(phy_vars_eNB->frame_parms.samples_per_tti>>1), + phy_vars_eNB->frame_parms.ofdm_symbol_size, 6, - phy_vars_eNB->lte_frame_parms.nb_prefix_samples, + phy_vars_eNB->frame_parms.nb_prefix_samples, CYCLIC_PREFIX); } else { - normal_prefix_mod(&phy_vars_eNB->lte_eNB_common_vars.txdataF[0][aa][slot_offset_F], + normal_prefix_mod(&phy_vars_eNB->common_vars.txdataF[0][aa][slot_offset_F], dummy_tx_b, 7, - &(phy_vars_eNB->lte_frame_parms)); + &(phy_vars_eNB->frame_parms)); // if S-subframe generate first slot only - if (subframe_select(&phy_vars_eNB->lte_frame_parms,subframe) == SF_DL) - normal_prefix_mod(&phy_vars_eNB->lte_eNB_common_vars.txdataF[0][aa][slot_offset_F+slot_sizeF], - dummy_tx_b+(phy_vars_eNB->lte_frame_parms.samples_per_tti>>1), + if (subframe_select(&phy_vars_eNB->frame_parms,subframe) == SF_DL) + normal_prefix_mod(&phy_vars_eNB->common_vars.txdataF[0][aa][slot_offset_F+slot_sizeF], + dummy_tx_b+(phy_vars_eNB->frame_parms.samples_per_tti>>1), 7, - &(phy_vars_eNB->lte_frame_parms)); + &(phy_vars_eNB->frame_parms)); } } */ - for (aa=0; aalte_frame_parms.nb_antennas_tx; aa++) { + for (aa=0; aaframe_parms.nb_antennas_tx; aa++) { // if S-subframe generate first slot only - if (subframe_select(&phy_vars_eNB->lte_frame_parms,subframe) == SF_S) - len = phy_vars_eNB->lte_frame_parms.samples_per_tti>>1; + if (subframe_select(&phy_vars_eNB->frame_parms,subframe) == SF_S) + len = phy_vars_eNB->frame_parms.samples_per_tti>>1; else - len = phy_vars_eNB->lte_frame_parms.samples_per_tti; + len = phy_vars_eNB->frame_parms.samples_per_tti; /* for (i=0;ilte_frame_parms.samples_per_tti; + tx_offset += LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*phy_vars_eNB->frame_parms.samples_per_tti; - if (tx_offset>=(LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*phy_vars_eNB->lte_frame_parms.samples_per_tti)) - tx_offset -= LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*phy_vars_eNB->lte_frame_parms.samples_per_tti; + if (tx_offset>=(LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*phy_vars_eNB->frame_parms.samples_per_tti)) + tx_offset -= LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*phy_vars_eNB->frame_parms.samples_per_tti; -/* ((short*)&phy_vars_eNB->lte_eNB_common_vars.txdata[0][aa][tx_offset])[0] = ((short*)dummy_tx_b)[2*i]<common_vars.txdata[0][aa][tx_offset])[0] = ((short*)dummy_tx_b)[2*i]<lte_eNB_common_vars.txdata[0][aa][tx_offset])[1] = ((short*)dummy_tx_b)[2*i+1]<common_vars.txdata[0][aa][tx_offset])[1] = ((short*)dummy_tx_b)[2*i+1]<lte_eNB_common_vars.txdata[0][aa][tx_offset])[0] = ((short*)&phy_vars_eNB->lte_eNB_common_vars.txdata[0][aa][tx_offset])[0]<common_vars.txdata[0][aa][tx_offset])[0] = ((short*)&phy_vars_eNB->common_vars.txdata[0][aa][tx_offset])[0]<lte_eNB_common_vars.txdata[0][aa][tx_offset])[1] = ((short*)&phy_vars_eNB->lte_eNB_common_vars.txdata[0][aa][tx_offset])[1]<common_vars.txdata[0][aa][tx_offset])[1] = ((short*)&phy_vars_eNB->common_vars.txdata[0][aa][tx_offset])[1]<lte_frame_parms,subframe) == SF_S) { + if (subframe_select(&phy_vars_eNB->frame_parms,subframe) == SF_S) { for (i=0; ilte_eNB_common_vars.txdata[0][aa][tx_offset++] = 0x00010001; + phy_vars_eNB->common_vars.txdata[0][aa][tx_offset++] = 0x00010001; } } - if ((((phy_vars_eNB->lte_frame_parms.tdd_config==0) || - (phy_vars_eNB->lte_frame_parms.tdd_config==1) || - (phy_vars_eNB->lte_frame_parms.tdd_config==2) || - (phy_vars_eNB->lte_frame_parms.tdd_config==6)) && + if ((((phy_vars_eNB->frame_parms.tdd_config==0) || + (phy_vars_eNB->frame_parms.tdd_config==1) || + (phy_vars_eNB->frame_parms.tdd_config==2) || + (phy_vars_eNB->frame_parms.tdd_config==6)) && (subframe==0)) || (subframe==5)) { // turn on tx switch N_TA_offset before //LOG_D(HW,"subframe %d, time to switch to tx (N_TA_offset %d, slot_offset %d) \n",subframe,phy_vars_eNB->N_TA_offset,slot_offset); for (i=0; iN_TA_offset; i++) { tx_offset = (int)slot_offset+time_offset[aa]+i-phy_vars_eNB->N_TA_offset/2; if (tx_offset<0) - tx_offset += LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*phy_vars_eNB->lte_frame_parms.samples_per_tti; + tx_offset += LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*phy_vars_eNB->frame_parms.samples_per_tti; - if (tx_offset>=(LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*phy_vars_eNB->lte_frame_parms.samples_per_tti)) - tx_offset -= LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*phy_vars_eNB->lte_frame_parms.samples_per_tti; + if (tx_offset>=(LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*phy_vars_eNB->frame_parms.samples_per_tti)) + tx_offset -= LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*phy_vars_eNB->frame_parms.samples_per_tti; - phy_vars_eNB->lte_eNB_common_vars.txdata[0][aa][tx_offset] = 0x00000000; + phy_vars_eNB->common_vars.txdata[0][aa][tx_offset] = 0x00000000; } } } diff --git a/targets/RT/USER/lte-softmodem.c b/targets/RT/USER/lte-softmodem.c index 40b9255936..0cca7b6379 100644 --- a/targets/RT/USER/lte-softmodem.c +++ b/targets/RT/USER/lte-softmodem.c @@ -1121,13 +1121,13 @@ static void get_options (int argc, char **argv) frame_parms[CC_id]->N_RB_DL = enb_properties->properties[i]->N_RB_DL[CC_id]; frame_parms[CC_id]->N_RB_UL = enb_properties->properties[i]->N_RB_DL[CC_id]; frame_parms[CC_id]->nb_antennas_tx = enb_properties->properties[i]->nb_antennas_tx[CC_id]; - frame_parms[CC_id]->nb_antennas_tx_eNB = enb_properties->properties[i]->nb_antenna_ports[CC_id]; + frame_parms[CC_id]->nb_antenna_ports_eNB = enb_properties->properties[i]->nb_antenna_ports[CC_id]; frame_parms[CC_id]->nb_antennas_rx = enb_properties->properties[i]->nb_antennas_rx[CC_id]; frame_parms[CC_id]->prach_config_common.prach_ConfigInfo.prach_ConfigIndex = enb_properties->properties[i]->prach_config_index[CC_id]; frame_parms[CC_id]->prach_config_common.prach_ConfigInfo.prach_FreqOffset = enb_properties->properties[i]->prach_freq_offset[CC_id]; - frame_parms[CC_id]->mode1_flag = (frame_parms[CC_id]->nb_antennas_tx_eNB == 1) ? 1 : 0; + frame_parms[CC_id]->mode1_flag = (frame_parms[CC_id]->nb_antenna_ports_eNB == 1) ? 1 : 0; frame_parms[CC_id]->threequarter_fs = threequarter_fs; //} // j @@ -1225,7 +1225,7 @@ void set_default_frame_parms(LTE_DL_FRAME_PARMS *frame_parms[MAX_NUM_CCs]) { frame_parms[CC_id]->Ncp_UL = NORMAL; frame_parms[CC_id]->Nid_cell = 0; frame_parms[CC_id]->num_MBSFN_config = 0; - frame_parms[CC_id]->nb_antennas_tx_eNB = 1; + frame_parms[CC_id]->nb_antenna_ports_eNB = 1; frame_parms[CC_id]->nb_antennas_tx = 1; frame_parms[CC_id]->nb_antennas_rx = 1; @@ -1524,7 +1524,7 @@ int main( int argc, char **argv ) if (UE_flag==1) { frame_parms[CC_id]->nb_antennas_tx = 1; frame_parms[CC_id]->nb_antennas_rx = 1; - frame_parms[CC_id]->nb_antennas_tx_eNB = 1; //initial value overwritten by initial sync later + frame_parms[CC_id]->nb_antenna_ports_eNB = 1; //initial value overwritten by initial sync later } init_ul_hopping(frame_parms[CC_id]); From 040afd4800c4e0e401ab9743a1c5612c65c5bf46 Mon Sep 17 00:00:00 2001 From: ROBERT Benoit Date: Mon, 21 Nov 2016 16:02:00 +0100 Subject: [PATCH 282/349] Add missing template files for HTML report generation --- cmake_targets/autotests/templates/index.html | 87 +++++++++++ .../autotests/templates/testcase_report.html | 142 ++++++++++++++++++ 2 files changed, 229 insertions(+) create mode 100644 cmake_targets/autotests/templates/index.html create mode 100644 cmake_targets/autotests/templates/testcase_report.html diff --git a/cmake_targets/autotests/templates/index.html b/cmake_targets/autotests/templates/index.html new file mode 100644 index 0000000000..10a15fb53d --- /dev/null +++ b/cmake_targets/autotests/templates/index.html @@ -0,0 +1,87 @@ + + + + + OAI5G UE Autotest Report + + + + +
+

OAI5G UE Autotest Report

+
+ +

+ + + + + + + + +
Test session configuration
Start time{{test_session_start_time}}
Stop time{{test_session_stop_time}}
Duration{{test_session_duration}}
MTC host{{mtc_host}}
User{{user}}
Password{{password}}
+

+ + +

Test Setup

+To be complete + +

+

UE phy-test performances tests results

+

Objectives

+

Checks that OAI UE can achieve at least 75 percent of the theoretical throughput.

+

Tests are done for all MCS (0 to 28) for 5MHz and 10MHz bandwidth.

+

Results

+ + + +{% for result in test_results|sort(attribute='testcase_name') %} + + + + {% if result.testcase_verdict == "PASS" %} + + {% elif result.testcase_verdict == "FAIL" %} + + {% else %} + + {% endif %} + + + + + + + + + + + + +{% endfor %} +
IDTAGVERDICTNB RUNSPASSFAILEDINCONSKIPPEDSEG FAULTTC TimeoutStartStopDurationDetails
{{result.testcase_name}}{{result.tags}}{{result.testcase_verdict}}{{result.testcase_verdict}}{{result.testcase_verdict}}{{result.nruns}}{{result.nb_run_pass}}{{result.nb_run_failed}}{{result.nb_run_inc}}{{result.nb_run_skip}}{{result.nb_seg_fault}}{{result.testcase_timeout}}{{result.testcase_time_start.strftime('%Y-%m-%d %H:%M:%S')}}{{result.testcase_time_stop.strftime('%Y-%m-%d %H:%M:%S')}}{{result.testcase_duration}}{{ result.testcase_name }}_report.html
+ + +

+

UE phy-test stability tests results

+

Objectives

+

To be complete

+

Results

+To be complete + + + + + diff --git a/cmake_targets/autotests/templates/testcase_report.html b/cmake_targets/autotests/templates/testcase_report.html new file mode 100644 index 0000000000..007ab56909 --- /dev/null +++ b/cmake_targets/autotests/templates/testcase_report.html @@ -0,0 +1,142 @@ + + + + + OAI5G UE test case report + + + + +
+

OAI5G UE test case report details

+
+ +

Test Case description

+

+ + + + + + + + + + + +
ID{{testcase_name}}
TAG{{tags}}
class{{testcaseclass}}
description
timeout{{testcase_timeout}}
number of runs{{nruns}}
eNB machine{{testcase_eNBMachine}}
UE machine{{testcase_UEMachine}}
+

+ + +

Test Case execution

+

+ + + + + + + + + + + + {% if testcase_verdict == "PASS" %} + + {% elif testcase_verdict == "FAIL" %} + + {% else %} + + {% endif %} + + + +
testcase_time_start{{testcase_time_start}}
testcase_time_stop{{testcase_time_stop}}
testcase_duration{{testcase_duration}}
Nb runs{{nruns}}
Nb PASS{{nb_run_pass}}
Nb FAILED{{nb_run_failed}}
Nb INCONCLUSIVE{{nb_run_inc}}
testcase_verdict{{testcase_verdict}}{{testcase_verdict}}{{testcase_verdict}}
Nb Seg Fault{{nb_seg_fault}}
+

+ + + +

Test Case runs results

+ +{% for run_results in runs_results|sort(attribute='run_id') %} +

RUN {{run_results.run_id}}

+ + + + + + + {% if run_results.run_verdict == "PASS" %} + + {% elif run_results.run_verdict == "FAIL" %} + + {% else %} + + {% endif %} + + + {% if run_results.ue_seg_fault_status == "NO_SEG_FAULT" %} + + {% elif run_results.ue_seg_fault_status == "SEG_FAULT" %} + + {% else %} + + {% endif %} + +
run_start_time {{run_results.run_start_time}}
run_stop_time{{run_results.run_stop_time}}
run_duration{{run_results.run_duration}}
run_verdict{{run_results.run_verdict}}{{run_results.run_verdict}}{{run_results.run_verdict}}
Seg Fault Satus{{run_results.ue_seg_fault_status}}{{run_results.ue_seg_fault_status}}unknown
+ + {% for run_metrics in run_results.runs_metrics %} +

+ + + + + + + + + + {% if run_metrics.pass_fail_stat is defined %} + + {% endif %} + {% if run_metrics.pass_fail_min_limit is defined %} + + {% endif %} + {% if run_metrics.pass_fail_max_limit is defined %} + + {% endif %} + + +
metric_id{{run_metrics.metric_id}}
Description{{run_metrics.metric_desc}}
Unit of measure{{run_metrics.metric_uom}}
metric_min{{run_metrics.metric_min}}
metric_max{{run_metrics.metric_max}}
metric_mean{{run_metrics.metric_mean}}
metric_median{{run_metrics.metric_median}}
Pass/fail stat{{run_metrics.pass_fail_stat}}
Pass/fail min limit{{run_metrics.pass_fail_min_limit}}
Pass/fail max limit{{run_metrics.pass_fail_max_limit}}
metric_fig
+ + {% endfor %} + + {% if run_results.run_traffic.traffic_count != 0 %} +

+ + + + + + + + + +
Iperf metricminmaxmeanmedian
Bandwidth {{run_results.run_traffic.bw_min}}{{run_results.run_traffic.bw_max}}{{run_results.run_traffic.bw_mean}}{{run_results.run_traffic.bw_median}}
Jitter{{run_results.run_traffic.jitter_min}}{{run_results.run_traffic.jitter_max}}{{run_results.run_traffic.jitter_mean}}{{run_results.run_traffic.jitter_median}}
Loss rate{{run_results.run_traffic.rl_min}}{{run_results.run_traffic.rl_max}}{{run_results.run_traffic.rl_mean}}{{run_results.run_traffic.rl_median}}
Iperf duration{{run_results.run_traffic.iperf_duration}}Pass/Fail criteria (min duration){{run_results.run_traffic.dur_pass_fail_crit}}
traffic_fig
+ {% endif %} + +{% endfor %} + + + From 1a8069b9243f90b02031933a2e0e5de1b7fd614e Mon Sep 17 00:00:00 2001 From: Xiwen JIANG Date: Tue, 22 Nov 2016 11:19:23 +0100 Subject: [PATCH 283/349] bug fixed for DEBUG_PHY in lte_init.c --- openair1/PHY/INIT/lte_init.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/openair1/PHY/INIT/lte_init.c b/openair1/PHY/INIT/lte_init.c index 0009dbfefe..7e6cc39ac7 100644 --- a/openair1/PHY/INIT/lte_init.c +++ b/openair1/PHY/INIT/lte_init.c @@ -1226,23 +1226,23 @@ int phy_init_lte_eNB(PHY_VARS_eNB *eNB, common_vars->txdataF_BF[eNB_id] = (int32_t **)malloc16(fp->nb_antennas_tx*sizeof(int32_t*)); for (i=0; i<14; i++) { - common_vars->txdataF[eNB_id][i] = (int32_t*)malloc16_clear( fp->ofdm_symbol_size*fp->symbols_per_tti*10*sizeof(int32_t) ); + common_vars->txdataF[eNB_id][i] = (int32_t*)malloc16_clear(fp->ofdm_symbol_size*fp->symbols_per_tti*10*sizeof(int32_t) ); #ifdef DEBUG_PHY msg("[openair][LTE_PHY][INIT] lte_common_vars->txdataF[%d][%d] = %p (%d bytes)\n", eNB_id,i,common_vars->txdataF[eNB_id][i], - FRAME_LENGTH_COMPLEX_SAMPLES_NO_PREFIX*sizeof(int32_t)); + fp->ofdm_symbol_size*fp->symbols_per_tti*10*sizeof(int32_t)); #endif } for (i=0; inb_antennas_tx; i++) { - common_vars->txdataF_BF[eNB_id][i] = (int32_t*)malloc16_clear( fp->ofdm_symbol_size*sizeof(int32_t) ); + common_vars->txdataF_BF[eNB_id][i] = (int32_t*)malloc16_clear(fp->ofdm_symbol_size*sizeof(int32_t) ); if (eNB->node_function != NGFI_RCC_IF4p5) - common_vars->txdata[eNB_id][i] = (int32_t*)malloc16_clear( fp->samples_per_tti*10*sizeof(int32_t) ); + common_vars->txdata[eNB_id][i] = (int32_t*)malloc16_clear(fp->samples_per_tti*10*sizeof(int32_t) ); #ifdef DEBUG_PHY msg("[openair][LTE_PHY][INIT] lte_common_vars->txdataF_BF[%d][%d][%d] = %p (%d bytes)\n", eNB_id,i,j,common_vars->txdataF_BF[eNB_id][i][j], - OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES*sizeof(int32_t)); + fp->ofdm_symbol_size*sizeof(int32_t)); msg("[openair][LTE_PHY][INIT] lte_common_vars->txdata[%d][%d] = %p\n",eNB_id,i,common_vars->txdata[eNB_id][i]); #endif } @@ -1256,7 +1256,7 @@ int phy_init_lte_eNB(PHY_VARS_eNB *eNB, #ifdef DEBUG_PUY msg("[openair][LTE_PHY][INIT] lte_common_vars->beam_weights[%d][%d][%d] = %p (%d bytes)\n", eNB_id,i,j,common_vars->beam_weights[eNB_id][i][j], - OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES*sizeof(int32_t)); + fp->ofdm_symbol_size*sizeof(int32_t)); #endif } } From 60a1f34a5aa8831363edbd8e98a00a3dfeee620d Mon Sep 17 00:00:00 2001 From: Xiwen JIANG Date: Tue, 22 Nov 2016 12:29:18 +0100 Subject: [PATCH 284/349] cosmetic changes --- openair1/PHY/INIT/lte_init.c | 6 +++--- openair1/PHY/LTE_TRANSPORT/dlsch_modulation.c | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/openair1/PHY/INIT/lte_init.c b/openair1/PHY/INIT/lte_init.c index 7e6cc39ac7..44d9e65dc8 100644 --- a/openair1/PHY/INIT/lte_init.c +++ b/openair1/PHY/INIT/lte_init.c @@ -29,7 +29,7 @@ #include "LAYER2/MAC/extern.h" #include "MBSFN-SubframeConfigList.h" #include "UTIL/LOG/vcd_signal_dumper.h" -//#define DEBUG_PHY +#define DEBUG_PHY #include "assertions.h" #include @@ -1240,8 +1240,8 @@ int phy_init_lte_eNB(PHY_VARS_eNB *eNB, common_vars->txdata[eNB_id][i] = (int32_t*)malloc16_clear(fp->samples_per_tti*10*sizeof(int32_t) ); #ifdef DEBUG_PHY - msg("[openair][LTE_PHY][INIT] lte_common_vars->txdataF_BF[%d][%d][%d] = %p (%d bytes)\n", - eNB_id,i,j,common_vars->txdataF_BF[eNB_id][i][j], + msg("[openair][LTE_PHY][INIT] lte_common_vars->txdataF_BF[%d][%d] = %p (%d bytes)\n", + eNB_id,i,common_vars->txdataF_BF[eNB_id][i], fp->ofdm_symbol_size*sizeof(int32_t)); msg("[openair][LTE_PHY][INIT] lte_common_vars->txdata[%d][%d] = %p\n",eNB_id,i,common_vars->txdata[eNB_id][i]); #endif diff --git a/openair1/PHY/LTE_TRANSPORT/dlsch_modulation.c b/openair1/PHY/LTE_TRANSPORT/dlsch_modulation.c index 9bf01400e3..7914437a53 100644 --- a/openair1/PHY/LTE_TRANSPORT/dlsch_modulation.c +++ b/openair1/PHY/LTE_TRANSPORT/dlsch_modulation.c @@ -2039,8 +2039,8 @@ int dlsch_modulation(PHY_VARS_eNB* phy_vars_eNB, P1_SHIFT, P2_SHIFT); - if ((mimo_mode == TM7) && (lprime>=0)) - mprime +=3+frame_parms->Ncp; + if ((mimo_mode == TM7) && (lprime>=0)) + mprime +=3+frame_parms->Ncp; } else { From eab744f6f990c417e2f5041dccdaeeb524267a69 Mon Sep 17 00:00:00 2001 From: Xiwen JIANG Date: Tue, 22 Nov 2016 14:57:11 +0100 Subject: [PATCH 285/349] add in allocate_REs_in_RB the TM7 case --- openair1/PHY/LTE_TRANSPORT/dlsch_modulation.c | 116 +++++++++++++++++- 1 file changed, 115 insertions(+), 1 deletion(-) diff --git a/openair1/PHY/LTE_TRANSPORT/dlsch_modulation.c b/openair1/PHY/LTE_TRANSPORT/dlsch_modulation.c index 7914437a53..84e4bddec2 100644 --- a/openair1/PHY/LTE_TRANSPORT/dlsch_modulation.c +++ b/openair1/PHY/LTE_TRANSPORT/dlsch_modulation.c @@ -619,10 +619,21 @@ int allocate_REs_in_RB(PHY_VARS_eNB* phy_vars_eNB, int32_t tmp_sample1,tmp_sample2; int16_t tmp_amp=amp; int s=1; + int mprime2 = mprime,ind,ind_dword,ind_qpsk_symb; gain_lin_QPSK = (int16_t)((amp*ONE_OVER_SQRT2_Q15)>>15); // if (mimo_mode == LARGE_CDD) gain_lin_QPSK>>=1; + int32_t qpsk[4]; + ((int16_t *)&qpsk[0])[0] = gain_lin_QPSK; + ((int16_t *)&qpsk[0])[1] = gain_lin_QPSK; + ((int16_t *)&qpsk[1])[0] = -gain_lin_QPSK; + ((int16_t *)&qpsk[1])[1] = gain_lin_QPSK;; + ((int16_t *)&qpsk[2])[0] = gain_lin_QPSK;; + ((int16_t *)&qpsk[2])[1] = -gain_lin_QPSK;; + ((int16_t *)&qpsk[3])[0] = -gain_lin_QPSK;; + ((int16_t *)&qpsk[3])[1] = -gain_lin_QPSK; + if (dlsch1_harq) { x1 = dlsch1_harq->e; // Fill these in later for TM8-10 @@ -1285,8 +1296,111 @@ x0[1+*jj]); *re_allocated = *re_allocated + 1; } } + + if (mimo_mode == TM7) { + *re_allocated = *re_allocated + 1; - if (mimo_mode >= TM8) { //TM8,TM9,TM10 + if (is_not_UEspecRS(lprime,re,frame_parms->Nid_cell%3,frame_parms->Ncp,7)) { + + switch (mod_order0){ + case 2: //QPSK + + ((int16_t*)&txdataF[5][tti_offset])[0] = (x0[*jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK; + *jj = *jj + 1; + ((int16_t*)&txdataF[5][tti_offset])[1] = (x0[*jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK; + *jj = *jj + 1; + + //printf("%d(%d) : %d,%d => + //",tti_offset,*jj,((int16_t*)&tmp_sample1)[0],((int16_t*)&tmp_sample1)[1]); + break; + + case 4: //16QAM + + qam16_table_offset_re = 0; + qam16_table_offset_im = 0; + + if (x0[*jj] == 1) + qam16_table_offset_re+=2; + + *jj=*jj+1; + + if (x0[*jj] == 1) + qam16_table_offset_im+=2; + + *jj=*jj+1; + + + if (x0[*jj] == 1) + qam16_table_offset_re+=1; + + *jj=*jj+1; + + if (x0[*jj] == 1) + qam16_table_offset_im+=1; + + *jj=*jj+1; + + ((int16_t*)&txdataF[5][tti_offset])[0] = (int16_t)(((int32_t)amp*qam16_table[qam16_table_offset_re])>>15); + ((int16_t*)&txdataF[5][tti_offset])[1] = (int16_t)(((int32_t)amp*qam16_table[qam16_table_offset_im])>>15); + + break; + + case 6: //64QAM + + + qam64_table_offset_re = 0; + qam64_table_offset_im = 0; + + if (x0[*jj] == 1) + qam64_table_offset_re+=4; + + *jj=*jj+1; + + if (x0[*jj] == 1) + qam64_table_offset_im+=4; + + *jj=*jj+1; + + if (x0[*jj] == 1) + qam64_table_offset_re+=2; + + *jj=*jj+1; + + if (x0[*jj] == 1) + qam64_table_offset_im+=2; + + *jj=*jj+1; + + if (x0[*jj] == 1) + qam64_table_offset_re+=1; + + *jj=*jj+1; + + if (x0[*jj] == 1) + qam64_table_offset_im+=1; + + *jj=*jj+1; + + ((int16_t*)&txdataF[5][tti_offset])[0] = (int16_t)(((int32_t)amp*qam64_table[qam64_table_offset_re])>>15); + ((int16_t*)&txdataF[5][tti_offset])[1] = (int16_t)(((int32_t)amp*qam64_table[qam64_table_offset_im])>>15); + + break; + + } + } else { + //precoding UE spec RS + //printf("precoding UE spec RS\n"); + + ind = 3*lprime*dlsch0_harq->nb_rb+mprime2; + ind_dword = ind>>4; + ind_qpsk_symb = ind&0xf; + + txdataF[5][tti_offset] = qpsk[(phy_vars_eNB->lte_gold_uespec_port5_table[0][Ns][ind_dword]>>(2*ind_qpsk_symb))&3]; + mprime2++; + + } + + } else if (mimo_mode >= TM8) { //TM8,TM9,TM10 //uint8_t is_not_UEspecRS(int8_t lprime, uint8_t re, uint8_t nushift, uint8_t Ncp, uint8_t beamforming_mode) if (is_not_UEspecRS(lprime,re,frame_parms->nushift,frame_parms->Ncp,8)) { From 7dbc59c830ae9521ff1bad8ff0ae479e7cdd2b3b Mon Sep 17 00:00:00 2001 From: Xiwen JIANG Date: Tue, 22 Nov 2016 18:34:57 +0100 Subject: [PATCH 286/349] adapt dlsim to TM7 --- openair1/SIMULATION/LTE_PHY/dlsim.c | 95 ++++++++++++++++++++++------- 1 file changed, 73 insertions(+), 22 deletions(-) diff --git a/openair1/SIMULATION/LTE_PHY/dlsim.c b/openair1/SIMULATION/LTE_PHY/dlsim.c index 2e9a04def3..1ba2196eb6 100644 --- a/openair1/SIMULATION/LTE_PHY/dlsim.c +++ b/openair1/SIMULATION/LTE_PHY/dlsim.c @@ -275,6 +275,8 @@ void fill_DCI(PHY_VARS_eNB *eNB, case 1: case 2: + + case 7: if (common_flag == 0) { if (eNB->frame_parms.frame_type == TDD) { @@ -1259,6 +1261,7 @@ int main(int argc, char **argv) int c; int k,i,aa; + int re; int s,Kr,Kr_bytes; @@ -1275,9 +1278,12 @@ int main(int argc, char **argv) double forgetting_factor=0.0; //in [0,1] 0 means a new channel every time, 1 means keep the same channel - uint8_t extended_prefix_flag=0,transmission_mode=1,n_tx=1,n_rx=2; + uint8_t extended_prefix_flag=0,transmission_mode=1,n_tx_port=1,n_tx_phy=1,n_rx=2; uint16_t Nid_cell=0; + int32_t **cell_spec_bf_weights; + int32_t *ue_spec_bf_weights; + int eNB_id = 0; unsigned char mcs1=0,mcs2=0,mcs_i=0,dual_stream_UE = 0,awgn_flag=0,round; unsigned char i_mod = 2; @@ -1416,7 +1422,7 @@ int main(int argc, char **argv) // num_layers = 1; perfect_ce = 0; - while ((c = getopt (argc, argv, "ahdpZDe:Em:n:o:s:f:t:c:g:r:F:x:y:z:AM:N:I:i:O:R:S:C:T:b:u:v:w:B:Pl:WXY")) != -1) { + while ((c = getopt (argc, argv, "ahdpZDe:Em:n:o:s:f:t:c:g:r:F:x:q:y:z:AM:N:I:i:O:R:S:C:T:b:u:v:w:B:Pl:WXY")) != -1) { switch (c) { case 'a': awgn_flag = 1; @@ -1617,7 +1623,7 @@ int main(int argc, char **argv) dual_stream_UE=1; UE->use_ia_receiver = 1; - if ((n_tx!=2) || (transmission_mode!=5)) { + if ((n_tx_port!=2) || (transmission_mode!=5)) { msg("IA receiver only supported for TM5!"); exit(-1); } @@ -1638,6 +1644,17 @@ int main(int argc, char **argv) print_perf=1; break; + case 'q': + n_tx_port=atoi(optarg); + + if ((n_tx_port==0) || ((n_tx_port>2))) { + msg("Unsupported number of cell specific antennas ports %d\n",n_tx_port); + exit(-1); + } + + break; + + case 'x': transmission_mode=atoi(optarg); @@ -1646,25 +1663,37 @@ int main(int argc, char **argv) (transmission_mode!=3) && (transmission_mode!=4) && (transmission_mode!=5) && - (transmission_mode!=6)) { + (transmission_mode!=6) && + (transmission_mode!=7)) { msg("Unsupported transmission mode %d\n",transmission_mode); exit(-1); } - if (transmission_mode>1) { - n_tx = 2; + if (transmission_mode>1 && transmission_mode<7) { + n_tx_port = 2; } break; case 'y': - n_tx=atoi(optarg); + n_tx_phy=atoi(optarg); - if ((n_tx==0) || (n_tx>2)) { - msg("Unsupported number of tx antennas %d\n",n_tx); + if (n_tx_phy < n_tx_port) { + msg("n_tx_phy mush not be smaller than n_tx_port"); exit(-1); } + if ((transmission_mode>1 && transmission_mode<7) && n_tx_port<2) { + msg("n_tx_port must be >1 for transmission_mode %d\n",transmission_mode); + exit(-1); + } + + if (transmission_mode==7 && (n_tx_phy!=1 && n_tx_phy!=2 && n_tx_phy!=4 && n_tx_phy!=8 && n_tx_phy!=16 && n_tx_phy!=64 && n_tx_phy!=128)) { + msg("Physical number of antennas not supported for TM7.\n"); + exit(-1); + } + + break; break; case 'X': @@ -1693,7 +1722,7 @@ int main(int argc, char **argv) case 'h': default: - printf("%s -h(elp) -a(wgn on) -d(ci decoding on) -p(extended prefix on) -m mcs1 -M mcs2 -n n_frames -s snr0 -x transmission mode (1,2,5,6) -y TXant -z RXant -I trch_file\n",argv[0]); + printf("%s -h(elp) -a(wgn on) -d(ci decoding on) -p(extended prefix on) -m mcs1 -M mcs2 -n n_frames -s snr0 -x transmission mode (1,2,5,6,7) -y TXant -z RXant -I trch_file\n",argv[0]); printf("-h This message\n"); printf("-a Use AWGN channel and not multipath\n"); printf("-c Number of PDCCH symbols\n"); @@ -1708,7 +1737,8 @@ int main(int argc, char **argv) printf("-r ressource block allocation (see section 7.1.6.3 in 36.213\n"); printf("-g [A:M] Use 3GPP 25.814 SCM-A/B/C/D('A','B','C','D') or 36-101 EPA('E'), EVA ('F'),ETU('G') models (ignores delay spread and Ricean factor), Rayghleigh8 ('H'), Rayleigh1('I'), Rayleigh1_corr('J'), Rayleigh1_anticorr ('K'), Rice8('L'), Rice1('M')\n"); printf("-F forgetting factor (0 new channel every trial, 1 channel constant\n"); - printf("-x Transmission mode (1,2,6 for the moment)\n"); + printf("-x Transmission mode (1,2,6,7 for the moment)\n"); + printf("-q Number of TX antennas ports used in eNB\n"); printf("-y Number of TX antennas used in eNB\n"); printf("-z Number of RX antennas used in UE\n"); printf("-t MCS of interfering UE\n"); @@ -1747,9 +1777,6 @@ int main(int argc, char **argv) } else NB_RB = 4; - if ((transmission_mode > 1) && (n_tx != 2)) - printf("n_tx must be >1 for transmission_mode %d\n",transmission_mode); - if (xforms==1) { fl_initialize (&argc, argv, NULL, 0, 0); form_ue = create_lte_phy_scope_ue(); @@ -1769,8 +1796,8 @@ int main(int argc, char **argv) printf("dual_stream_UE=%d\n", dual_stream_UE); } - lte_param_init(transmission_mode==1?1:2, - n_tx, + lte_param_init(n_tx_port, + n_tx_phy, n_rx, transmission_mode, extended_prefix_flag, @@ -1782,6 +1809,26 @@ int main(int argc, char **argv) osf, perfect_ce); + /* Check if really needed */ + /*cell_spec_bf_weights = eNB->common_vars.beam_weights[0][0]; + for(aa=0;aaofdm_symbol_size;re++) { + if (n_tx_phy==1 || n_tx_phy==2) + cell_spec_bf_weights[aa][re] = 0x00007fff; + else if (n_tx_phy==4 || n_tx_phy==8) + cell_spec_bf_weights[aa][re] = 0x00007fff>>1; + else if (n_tx_phy==16) + cell_spec_bf_weights[aa][re] = 0x00007fff>>2; + else if (n_tx_phy==64) + cell_spec_bf_weights[aa][re] = 0x00007fff>>4; + } + } + + if (transmission_mode==7) { + lte_gold_ue_spec_port5(eNB->lte_gold_uespec_port5_table[0],Nid_cell,n_rnti); + lte_gold_ue_spec_port5(UE->lte_gold_uespec_port5_table,Nid_cell,n_rnti); + }*/ + eNB->mac_enabled=1; if (two_thread_flag == 0) { eNB->te = dlsch_encoding; @@ -1803,7 +1850,7 @@ int main(int argc, char **argv) printf("Setting mcs2 = %d\n",mcs2); printf("NPRB = %d\n",NB_RB); printf("n_frames = %d\n",n_frames); - printf("Transmission mode %d with %dx%d antenna configuration, Extended Prefix %d\n",transmission_mode,n_tx,n_rx,extended_prefix_flag); + printf("Transmission mode %d with %dx%d antenna configuration, Extended Prefix %d\n",transmission_mode,n_tx_phy,n_rx,extended_prefix_flag); snr1 = snr0+snr_int; printf("SNR0 %f, SNR1 %f\n",snr0,snr1); @@ -1838,7 +1885,7 @@ int main(int argc, char **argv) //char dirname[FILENAME_MAX]; //sprintf(dirname, "%s/SIMU/USER/pre-ci-logs-%s", getenv("OPENAIR_TARGETS"),hostname ); sprintf(time_meas_fname,"time_meas_prb%d_mcs%d_anttx%d_antrx%d_pdcch%d_channel%s_tx%d.csv", - N_RB_DL,mcs1,n_tx,n_rx,num_pdcch_symbols,channel_model_input,transmission_mode); + N_RB_DL,mcs1,n_tx_phy,n_rx,num_pdcch_symbols,channel_model_input,transmission_mode); //mkdir(dirname,0777); time_meas_fd = fopen(time_meas_fname,"w"); if (time_meas_fd==NULL) { @@ -2403,11 +2450,15 @@ int main(int argc, char **argv) if (n_frames==1) { printf("tx_lev = %d (%d dB)\n",tx_lev,tx_lev_dB); - write_output("txsig0.m","txs0", &eNB->common_vars.txdata[eNB_id][0][subframe* eNB->frame_parms.samples_per_tti], - eNB->frame_parms.samples_per_tti,1,1); - write_output("txsigF0.m","txsF0", &eNB->common_vars.txdataF[eNB_id][0][subframe*nsymb*eNB->frame_parms.ofdm_symbol_size], - nsymb*eNB->frame_parms.ofdm_symbol_size,1,1); + write_output("txsig0.m","txs0", &eNB->common_vars.txdata[eNB_id][0][subframe* eNB->frame_parms.samples_per_tti], eNB->frame_parms.samples_per_tti,1,1); + + if (transmission_mode<7) { + write_output("txsigF0.m","txsF0", &eNB->common_vars.txdataF[eNB_id][0][subframe*nsymb*eNB->frame_parms.ofdm_symbol_size],nsymb*eNB->frame_parms.ofdm_symbol_size,1,1); + } else if (transmission_mode == 7) { + write_output("txsigF0.m","txsF0", &eNB->common_vars.txdataF[eNB_id][5][subframe*nsymb*eNB->frame_parms.ofdm_symbol_size],nsymb*eNB->frame_parms.ofdm_symbol_size,1,1); + write_output("txsigF0_BF.m","txsF0_BF", &eNB->common_vars.txdataF_BF[eNB_id][0][0],eNB->frame_parms.ofdm_symbol_size,1,1); + } } } From 263254408df04af4babd86cbdc10f0e8f21fa172 Mon Sep 17 00:00:00 2001 From: Xiwen JIANG Date: Wed, 23 Nov 2016 10:41:00 +0100 Subject: [PATCH 287/349] use symbol based OFDM modulation in dlsim --- openair1/SIMULATION/LTE_PHY/dlsim.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/openair1/SIMULATION/LTE_PHY/dlsim.c b/openair1/SIMULATION/LTE_PHY/dlsim.c index 1ba2196eb6..b94b757adf 100644 --- a/openair1/SIMULATION/LTE_PHY/dlsim.c +++ b/openair1/SIMULATION/LTE_PHY/dlsim.c @@ -1282,7 +1282,6 @@ int main(int argc, char **argv) uint16_t Nid_cell=0; int32_t **cell_spec_bf_weights; - int32_t *ue_spec_bf_weights; int eNB_id = 0; unsigned char mcs1=0,mcs2=0,mcs_i=0,dual_stream_UE = 0,awgn_flag=0,round; @@ -2411,6 +2410,7 @@ int main(int argc, char **argv) start_meas(&eNB->ofdm_mod_stats); + /* do_OFDM_mod_l(eNB->common_vars.txdataF[eNB_id], eNB->common_vars.txdata[eNB_id], (subframe*2), @@ -2420,7 +2420,19 @@ int main(int argc, char **argv) eNB->common_vars.txdata[eNB_id], (subframe*2)+1, &eNB->frame_parms); - + */ + + do_OFDM_mod_symbol(&eNB->common_vars, + eNB_id, + (subframe*2), + &eNB->frame_parms); + + do_OFDM_mod_symbol(&eNB->common_vars, + eNB_id, + (subframe*2)+1, + &eNB->frame_parms); + + stop_meas(&eNB->ofdm_mod_stats); // generate next subframe for channel estimation From b4a6e0305349f8c4b08ee18b4acefa406f1fa2ec Mon Sep 17 00:00:00 2001 From: Xiwen JIANG Date: Wed, 23 Nov 2016 11:48:18 +0100 Subject: [PATCH 288/349] error message disply fixed in dl bf ch est --- .../LTE_ESTIMATION/lte_dl_bf_channel_estimation.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/openair1/PHY/LTE_ESTIMATION/lte_dl_bf_channel_estimation.c b/openair1/PHY/LTE_ESTIMATION/lte_dl_bf_channel_estimation.c index 7f4a14f197..0b220c2c39 100644 --- a/openair1/PHY/LTE_ESTIMATION/lte_dl_bf_channel_estimation.c +++ b/openair1/PHY/LTE_ESTIMATION/lte_dl_bf_channel_estimation.c @@ -205,7 +205,7 @@ int lte_dl_bf_channel_estimation(PHY_VARS_UE *phy_vars_ue, } //estimation and interpolation - if ((frame_parms->N_RB_DL&1) == 0) // even number of RBs + if ((frame_parms->N_RB_DL&1) == 0) { // even number of RBs for (rb=0; rbN_RB_DL; rb++) { if (rb < 32) @@ -240,14 +240,13 @@ int lte_dl_bf_channel_estimation(PHY_VARS_UE *phy_vars_ue, ch[0] = (short)(((int)pil[0]*rxF[16] - (int)pil[1]*rxF[17])>>15); ch[1] = (short)(((int)pil[0]*rxF[17] + (int)pil[1]*rxF[16])>>15); multadd_real_vector_complex_scalar(fr,ch,dl_bf_ch,16); + } else { + msg("lte_dl_bf_channel_estimation(lte_dl_bf_channel_estimation.c):TM7 beamgforming channel estimation not supported for extented CP\n"); + exit(-1); } } else { - msg("lte_dl_bf_channel_estimation(lte_dl_bf_channel_estimation.c):TM7 beamgforming channel estimation not supported for extented CP\n"); - exit(-1); + msg("lte_dl_bf_channel_estimation(lte_dl_bf_channel_estimation.c): transmission mode not supported.\n"); } - - } else { - msg("lte_dl_bf_channel_estimation(lte_dl_bf_channel_estimation.c): transmission mode not supported.\n"); } nb_rb++; } @@ -255,7 +254,7 @@ int lte_dl_bf_channel_estimation(PHY_VARS_UE *phy_vars_ue, rxF+=24; dl_bf_ch+=24; } - else { // Odd number of RBs + } else { // Odd number of RBs for (rb=0; rbN_RB_DL>>1; rb++) { skip_half=0; From 441b062e3affb72d78f75dd02d70ceb22f401121 Mon Sep 17 00:00:00 2001 From: Florian Kaltenberger Date: Wed, 23 Nov 2016 15:15:56 +0100 Subject: [PATCH 289/349] changing config files --- .../CONF/enb.band7.tm1.usrpb210.conf | 14 +- .../CONF/enb.band7.usrpb210.conf | 232 +++++++++--------- 2 files changed, 123 insertions(+), 123 deletions(-) diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf index 01cd014afc..5ef5a4f50b 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf @@ -68,9 +68,9 @@ eNBs = srs_ackNackST =; srs_MaxUpPts =;*/ - pusch_p0_Nominal = -96; + pusch_p0_Nominal = -90; pusch_alpha = "AL1"; - pucch_p0_Nominal = -103; + pucch_p0_Nominal = -96; msg3_delta_Preamble = 6; pucch_deltaF_Format1 = "deltaF2"; pucch_deltaF_Format1b = "deltaF3"; @@ -137,7 +137,7 @@ eNBs = ////////// MME parameters: - mme_ip_address = ( { ipv4 = "127.0.0.3"; + mme_ip_address = ( { ipv4 = "192.168.12.70"; ipv6 = "192:168:30::17"; active = "yes"; preference = "ipv4"; @@ -147,10 +147,10 @@ eNBs = NETWORK_INTERFACES : { - ENB_INTERFACE_NAME_FOR_S1_MME = "lo"; - ENB_IPV4_ADDRESS_FOR_S1_MME = "127.0.0.2/24"; - ENB_INTERFACE_NAME_FOR_S1U = "lo"; - ENB_IPV4_ADDRESS_FOR_S1U = "127.0.0.4/24"; + ENB_INTERFACE_NAME_FOR_S1_MME = "eth1"; + ENB_IPV4_ADDRESS_FOR_S1_MME = "192.168.12.147/24"; + ENB_INTERFACE_NAME_FOR_S1U = "eth1"; + ENB_IPV4_ADDRESS_FOR_S1U = "192.168.12.147/24"; ENB_PORT_FOR_S1U = 2152; # Spec 2152 }; diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.usrpb210.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.usrpb210.conf index 1fe3beae0e..540edcd5b9 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.usrpb210.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.usrpb210.conf @@ -7,125 +7,126 @@ eNBs = { ////////// Identification parameters: eNB_ID = 0xe00; - + cell_type = "CELL_MACRO_ENB"; - + eNB_name = "eNB_Eurecom_LTEBox"; - + // Tracking area code, 0x0000 and 0xfffe are reserved values tracking_area_code = "1"; - + mobile_country_code = "208"; - + mobile_network_code = "94"; - + ////////// Physical parameters: - + component_carriers = ( - { - frame_type = "FDD"; - tdd_config = 3; - tdd_config_s = 0; - prefix_type = "NORMAL"; - eutra_band = 7; - downlink_frequency = 2680000000L; - uplink_frequency_offset = -120000000; - Nid_cell = 0; - N_RB_DL = 25; - Nid_cell_mbsfn = 0; - nb_antenna_ports = 2; - nb_antennas_tx = 2; - nb_antennas_rx = 2; - tx_gain = 90; - rx_gain = 125; - prach_root = 0; - prach_config_index = 0; - prach_high_speed = "DISABLE"; - prach_zero_correlation = 1; - prach_freq_offset = 2; - pucch_delta_shift = 1; - pucch_nRB_CQI = 1; - pucch_nCS_AN = 0; - pucch_n1_AN = 32; - pdsch_referenceSignalPower = -26; - pdsch_p_b = 0; - pusch_n_SB = 1; - pusch_enable64QAM = "DISABLE"; - pusch_hoppingMode = "interSubFrame"; - pusch_hoppingOffset = 0; - pusch_groupHoppingEnabled = "ENABLE"; - pusch_groupAssignment = 0; - pusch_sequenceHoppingEnabled = "DISABLE"; - pusch_nDMRS1 = 1; - phich_duration = "NORMAL"; - phich_resource = "ONESIXTH"; - srs_enable = "DISABLE"; - /* srs_BandwidthConfig =; - srs_SubframeConfig =; - srs_ackNackST =; - srs_MaxUpPts =;*/ + { + node_function = "eNodeB_3GPP"; + node_timing = "synch_to_ext_device"; + node_synch_ref = 0; + frame_type = "FDD"; + tdd_config = 3; + tdd_config_s = 0; + prefix_type = "NORMAL"; + eutra_band = 7; + downlink_frequency = 2660000000L; + uplink_frequency_offset = -120000000; + Nid_cell = 0; + N_RB_DL = 25; + Nid_cell_mbsfn = 0; + nb_antenna_ports = 2; + nb_antennas_tx = 2; + nb_antennas_rx = 2; + tx_gain = 90; + rx_gain = 125; + prach_root = 0; + prach_config_index = 0; + prach_high_speed = "DISABLE"; + prach_zero_correlation = 1; + prach_freq_offset = 2; + pucch_delta_shift = 1; + pucch_nRB_CQI = 1; + pucch_nCS_AN = 0; + pucch_n1_AN = 32; + pdsch_referenceSignalPower = -24; + pdsch_p_b = 1; + pusch_n_SB = 1; + pusch_enable64QAM = "DISABLE"; + pusch_hoppingMode = "interSubFrame"; + pusch_hoppingOffset = 0; + pusch_groupHoppingEnabled = "ENABLE"; + pusch_groupAssignment = 0; + pusch_sequenceHoppingEnabled = "DISABLE"; + pusch_nDMRS1 = 1; + phich_duration = "NORMAL"; + phich_resource = "ONESIXTH"; + srs_enable = "DISABLE"; + /* srs_BandwidthConfig =; + srs_SubframeConfig =; + srs_ackNackST =; + srs_MaxUpPts =;*/ - pusch_p0_Nominal = -90; - pusch_alpha = "AL1"; - pucch_p0_Nominal = -96; - msg3_delta_Preamble = 6; - pucch_deltaF_Format1 = "deltaF2"; - pucch_deltaF_Format1b = "deltaF3"; - pucch_deltaF_Format2 = "deltaF0"; - pucch_deltaF_Format2a = "deltaF0"; - pucch_deltaF_Format2b = "deltaF0"; - - rach_numberOfRA_Preambles = 64; - rach_preamblesGroupAConfig = "DISABLE"; -/* - rach_sizeOfRA_PreamblesGroupA = ; - rach_messageSizeGroupA = ; - rach_messagePowerOffsetGroupB = ; -*/ - rach_powerRampingStep = 4; - rach_preambleInitialReceivedTargetPower = -108; - rach_preambleTransMax = 10; - rach_raResponseWindowSize = 10; - rach_macContentionResolutionTimer = 48; - rach_maxHARQ_Msg3Tx = 4; + pusch_p0_Nominal = -90; + pusch_alpha = "AL1"; + pucch_p0_Nominal = -96; + msg3_delta_Preamble = 6; + pucch_deltaF_Format1 = "deltaF2"; + pucch_deltaF_Format1b = "deltaF3"; + pucch_deltaF_Format2 = "deltaF0"; + pucch_deltaF_Format2a = "deltaF0"; + pucch_deltaF_Format2b = "deltaF0"; - pcch_default_PagingCycle = 128; - pcch_nB = "oneT"; - bcch_modificationPeriodCoeff = 2; - ue_TimersAndConstants_t300 = 1000; - ue_TimersAndConstants_t301 = 1000; - ue_TimersAndConstants_t310 = 1000; - ue_TimersAndConstants_t311 = 10000; - ue_TimersAndConstants_n310 = 20; - ue_TimersAndConstants_n311 = 1; + rach_numberOfRA_Preambles = 64; + rach_preamblesGroupAConfig = "DISABLE"; + /* + rach_sizeOfRA_PreamblesGroupA = ; + rach_messageSizeGroupA = ; + rach_messagePowerOffsetGroupB = ; + */ + rach_powerRampingStep = 4; + rach_preambleInitialReceivedTargetPower = -104; + rach_preambleTransMax = 10; + rach_raResponseWindowSize = 10; + rach_macContentionResolutionTimer = 48; + rach_maxHARQ_Msg3Tx = 4; - ue_TransmissionMode = 2; - - } - ); + pcch_default_PagingCycle = 128; + pcch_nB = "oneT"; + bcch_modificationPeriodCoeff = 2; + ue_TimersAndConstants_t300 = 1000; + ue_TimersAndConstants_t301 = 1000; + ue_TimersAndConstants_t310 = 1000; + ue_TimersAndConstants_t311 = 10000; + ue_TimersAndConstants_n310 = 20; + ue_TimersAndConstants_n311 = 1; + ue_TransmissionMode = 2; + } + ); srb1_parameters : { - # timer_poll_retransmit = (ms) [5, 10, 15, 20,... 250, 300, 350, ... 500] + # timer_poll_retransmit = (ms) [5, 10, 15, 20,... 250, 300, 350, ... 500] timer_poll_retransmit = 80; - + # timer_reordering = (ms) [0,5, ... 100, 110, 120, ... ,200] timer_reordering = 35; - + # timer_reordering = (ms) [0,5, ... 250, 300, 350, ... ,500] timer_status_prohibit = 0; - + # poll_pdu = [4, 8, 16, 32 , 64, 128, 256, infinity(>10000)] poll_pdu = 4; - + # poll_byte = (kB) [25,50,75,100,125,250,375,500,750,1000,1250,1500,2000,3000,infinity(>10000)] poll_byte = 99999; - + # max_retx_threshold = [1, 2, 3, 4 , 6, 8, 16, 32] max_retx_threshold = 4; } - + # ------- SCTP definitions SCTP : { @@ -133,7 +134,7 @@ eNBs = SCTP_INSTREAMS = 2; SCTP_OUTSTREAMS = 2; }; - + ////////// MME parameters: mme_ip_address = ( { ipv4 = "192.168.12.70"; ipv6 = "192:168:30::17"; @@ -142,33 +143,32 @@ eNBs = } ); - NETWORK_INTERFACES : + NETWORK_INTERFACES : { - ENB_INTERFACE_NAME_FOR_S1_MME = "eth0"; - ENB_IPV4_ADDRESS_FOR_S1_MME = "192.168.12.150/24"; - ENB_INTERFACE_NAME_FOR_S1U = "eth0"; - ENB_IPV4_ADDRESS_FOR_S1U = "192.168.12.150/24"; + ENB_INTERFACE_NAME_FOR_S1_MME = "eth1"; + ENB_IPV4_ADDRESS_FOR_S1_MME = "192.168.12.147/24"; + ENB_INTERFACE_NAME_FOR_S1U = "eth1"; + ENB_IPV4_ADDRESS_FOR_S1U = "192.168.12.147/24"; ENB_PORT_FOR_S1U = 2152; # Spec 2152 }; - - log_config : + + log_config : { - global_log_level ="info"; - global_log_verbosity ="medium"; - hw_log_level ="info"; - hw_log_verbosity ="medium"; - phy_log_level ="info"; - phy_log_verbosity ="medium"; - mac_log_level ="info"; - mac_log_verbosity ="high"; - rlc_log_level ="info"; - rlc_log_verbosity ="medium"; - pdcp_log_level ="info"; - pdcp_log_verbosity ="medium"; - rrc_log_level ="info"; - rrc_log_verbosity ="medium"; - }; - + global_log_level ="info"; + global_log_verbosity ="medium"; + hw_log_level ="info"; + hw_log_verbosity ="medium"; + phy_log_level ="debug"; + phy_log_verbosity ="medium"; + mac_log_level ="info"; + mac_log_verbosity ="high"; + rlc_log_level ="info"; + rlc_log_verbosity ="medium"; + pdcp_log_level ="info"; + pdcp_log_verbosity ="medium"; + rrc_log_level ="info"; + rrc_log_verbosity ="medium"; + }; } ); From 7133633997f39d048121d4104794e53158c3f813 Mon Sep 17 00:00:00 2001 From: Florian Kaltenberger Date: Wed, 23 Nov 2016 15:17:01 +0100 Subject: [PATCH 290/349] bugfixes in precoder --- openair1/PHY/INIT/lte_init.c | 13 +++++++------ openair1/PHY/MODULATION/beamforming.c | 14 ++++++++------ 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/openair1/PHY/INIT/lte_init.c b/openair1/PHY/INIT/lte_init.c index 0009dbfefe..1c0ed16e0f 100644 --- a/openair1/PHY/INIT/lte_init.c +++ b/openair1/PHY/INIT/lte_init.c @@ -1251,12 +1251,13 @@ int phy_init_lte_eNB(PHY_VARS_eNB *eNB, common_vars->beam_weights[eNB_id][i] = (int32_t **)malloc16_clear(fp->nb_antennas_tx*sizeof(int32_t*)); for (j=0; jnb_antennas_tx; j++) { common_vars->beam_weights[eNB_id][i][j] = (int32_t *)malloc16_clear(fp->ofdm_symbol_size*sizeof(int32_t)); - for (re=0; reofdm_symbol_size; re++) - common_vars->beam_weights[eNB_id][i][j][re] = 0x00007fff; -#ifdef DEBUG_PUY - msg("[openair][LTE_PHY][INIT] lte_common_vars->beam_weights[%d][%d][%d] = %p (%d bytes)\n", - eNB_id,i,j,common_vars->beam_weights[eNB_id][i][j], - OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES*sizeof(int32_t)); + if (i==j) + for (re=0; reofdm_symbol_size; re++) + common_vars->beam_weights[eNB_id][i][j][re] = 0x00007fff; +#ifdef DEBUG_PHY + msg("[openair][LTE_PHY][INIT] lte_common_vars->beam_weights[%d][%d][%d] = %p (%d bytes)\n", + eNB_id,i,j,common_vars->beam_weights[eNB_id][i][j], + OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES*sizeof(int32_t)); #endif } } diff --git a/openair1/PHY/MODULATION/beamforming.c b/openair1/PHY/MODULATION/beamforming.c index 3aa7810aec..5e4660f034 100644 --- a/openair1/PHY/MODULATION/beamforming.c +++ b/openair1/PHY/MODULATION/beamforming.c @@ -61,18 +61,19 @@ int beam_precoding(int32_t **txdataF, // clear txdata_BF[aa][re] for each call of ue_spec_beamforming for(aa=0;aanb_antennas_tx;aa++) - memset(txdataF_BF[aa],0,4*(frame_parms->ofdm_symbol_size)); + memset(txdataF_BF[aa],0,sizeof(int32_t)*(frame_parms->ofdm_symbol_size)); for (re=0;reofdm_symbol_size;re++) { for (p=0; p<2; p++) { if (txdataF[p][slot_offset_F+symbol*frame_parms->ofdm_symbol_size+re]!=0) { for (aa=0;aanb_antennas_tx;aa++) { - ((int16_t*)&txdataF_BF[aa][re])[0] = (int16_t)((((int16_t*)&txdataF[p][slot_offset_F+symbol*frame_parms->ofdm_symbol_size+re])[0]*((int16_t*)&beam_weights[p][aa][re])[0])>>15); + ((int16_t*)&txdataF_BF[aa][re])[0] += (int16_t)((((int16_t*)&txdataF[p][slot_offset_F+symbol*frame_parms->ofdm_symbol_size+re])[0]*((int16_t*)&beam_weights[p][aa][re])[0])>>15); ((int16_t*)&txdataF_BF[aa][re])[0] -= (int16_t)((((int16_t*)&txdataF[p][slot_offset_F+symbol*frame_parms->ofdm_symbol_size+re])[1]*((int16_t*)&beam_weights[p][aa][re])[1])>>15); - ((int16_t*)&txdataF_BF[aa][re])[1] = (int16_t)((((int16_t*)&txdataF[p][slot_offset_F+symbol*frame_parms->ofdm_symbol_size+re])[0]*((int16_t*)&beam_weights[p][aa][re])[1])>>15); - ((int16_t*)&txdataF_BF[aa][re])[1] += (int16_t)((((int16_t*)&txdataF[p][slot_offset_F+symbol*frame_parms->ofdm_symbol_size+re])[1]*((int16_t*)&beam_weights[0][aa][re])[0])>>15); + ((int16_t*)&txdataF_BF[aa][re])[1] += (int16_t)((((int16_t*)&txdataF[p][slot_offset_F+symbol*frame_parms->ofdm_symbol_size+re])[0]*((int16_t*)&beam_weights[p][aa][re])[1])>>15); + ((int16_t*)&txdataF_BF[aa][re])[1] += (int16_t)((((int16_t*)&txdataF[p][slot_offset_F+symbol*frame_parms->ofdm_symbol_size+re])[1]*((int16_t*)&beam_weights[p][aa][re])[0])>>15); - /*printf("beamforming.c:txdata[%d][%d]=%d+j%d, beam_weights[%d][%d][%d]=%d+j%d,txdata_BF[%d][%d]=%d+j%d\n", + /* + printf("beamforming.c:txdataF[%d][%d]=%d+j%d, beam_weights[%d][%d][%d]=%d+j%d,txdata_BF[%d][%d]=%d+j%d\n", p,slot_offset_F+symbol*frame_parms->ofdm_symbol_size+re, ((int16_t*)&txdataF[p][slot_offset_F+symbol*frame_parms->ofdm_symbol_size+re])[0], ((int16_t*)&txdataF[p][slot_offset_F+symbol*frame_parms->ofdm_symbol_size+re])[1], @@ -80,7 +81,8 @@ int beam_precoding(int32_t **txdataF, ((int16_t*)&beam_weights[p][aa][re])[0],((int16_t*)&beam_weights[p][aa][re])[1], aa,re, ((int16_t*)&txdataF_BF[aa][re])[0], - ((int16_t*)&txdataF_BF[aa][re])[1]); */ + ((int16_t*)&txdataF_BF[aa][re])[1]); + */ } } From f216bacb1142dccda5a6df7b1340958c6895ca6c Mon Sep 17 00:00:00 2001 From: Xiwen JIANG Date: Wed, 23 Nov 2016 17:01:22 +0100 Subject: [PATCH 291/349] fix the dlsim for TM7 --- openair1/PHY/INIT/lte_init.c | 2 +- openair1/SCHED/phy_procedures_lte_ue.c | 2 +- openair1/SIMULATION/LTE_PHY/dlsim.c | 20 -------------------- openair1/SIMULATION/LTE_PHY/dlsim_tm7.c | 3 ++- 4 files changed, 4 insertions(+), 23 deletions(-) diff --git a/openair1/PHY/INIT/lte_init.c b/openair1/PHY/INIT/lte_init.c index 0a212db27b..16a608f4e9 100644 --- a/openair1/PHY/INIT/lte_init.c +++ b/openair1/PHY/INIT/lte_init.c @@ -1251,7 +1251,7 @@ int phy_init_lte_eNB(PHY_VARS_eNB *eNB, common_vars->beam_weights[eNB_id][i] = (int32_t **)malloc16_clear(fp->nb_antennas_tx*sizeof(int32_t*)); for (j=0; jnb_antennas_tx; j++) { common_vars->beam_weights[eNB_id][i][j] = (int32_t *)malloc16_clear(fp->ofdm_symbol_size*sizeof(int32_t)); - if (i==j) + if (((i<=4) && (i==j)) || (i>=5)) for (re=0; reofdm_symbol_size; re++) common_vars->beam_weights[eNB_id][i][j][re] = 0x00007fff; #ifdef DEBUG_PHY diff --git a/openair1/SCHED/phy_procedures_lte_ue.c b/openair1/SCHED/phy_procedures_lte_ue.c index 6dfdc7297d..bcf6507e20 100644 --- a/openair1/SCHED/phy_procedures_lte_ue.c +++ b/openair1/SCHED/phy_procedures_lte_ue.c @@ -2354,7 +2354,7 @@ void ue_pdsch_procedures(PHY_VARS_UE *ue, UE_rxtx_proc_t *proc, int eNB_id, PDSC //TM7 UE specific channel estimation here!!! if (ue->transmission_mode[eNB_id]==7) { if (ue->frame_parms.Ncp==0) { - if ((m==3) || (m==6) || (m==8) || (m==11)) + if ((m==3) || (m==6) || (m==9) || (m==12)) //LOG_D(PHY,"[UE %d] dlsch->active in subframe %d => %d, l=%d\n",phy_vars_ue->Mod_id,subframe_rx,phy_vars_ue->dlsch_ue[eNB_id][0]->active, l); lte_dl_bf_channel_estimation(ue,eNB_id,0,subframe_rx*2+(m>6?1:0),5,m); } else { diff --git a/openair1/SIMULATION/LTE_PHY/dlsim.c b/openair1/SIMULATION/LTE_PHY/dlsim.c index b94b757adf..c657069e46 100644 --- a/openair1/SIMULATION/LTE_PHY/dlsim.c +++ b/openair1/SIMULATION/LTE_PHY/dlsim.c @@ -1808,26 +1808,6 @@ int main(int argc, char **argv) osf, perfect_ce); - /* Check if really needed */ - /*cell_spec_bf_weights = eNB->common_vars.beam_weights[0][0]; - for(aa=0;aaofdm_symbol_size;re++) { - if (n_tx_phy==1 || n_tx_phy==2) - cell_spec_bf_weights[aa][re] = 0x00007fff; - else if (n_tx_phy==4 || n_tx_phy==8) - cell_spec_bf_weights[aa][re] = 0x00007fff>>1; - else if (n_tx_phy==16) - cell_spec_bf_weights[aa][re] = 0x00007fff>>2; - else if (n_tx_phy==64) - cell_spec_bf_weights[aa][re] = 0x00007fff>>4; - } - } - - if (transmission_mode==7) { - lte_gold_ue_spec_port5(eNB->lte_gold_uespec_port5_table[0],Nid_cell,n_rnti); - lte_gold_ue_spec_port5(UE->lte_gold_uespec_port5_table,Nid_cell,n_rnti); - }*/ - eNB->mac_enabled=1; if (two_thread_flag == 0) { eNB->te = dlsch_encoding; diff --git a/openair1/SIMULATION/LTE_PHY/dlsim_tm7.c b/openair1/SIMULATION/LTE_PHY/dlsim_tm7.c index 0d5dcd63ce..66dea185de 100644 --- a/openair1/SIMULATION/LTE_PHY/dlsim_tm7.c +++ b/openair1/SIMULATION/LTE_PHY/dlsim_tm7.c @@ -636,6 +636,7 @@ int main(int argc, char **argv) frame_parms = &eNB->frame_parms; + /* cell_spec_bf_weights = eNB->common_vars.beam_weights[0][0]; for(aa=0;aaofdm_symbol_size;re++) { @@ -653,7 +654,7 @@ int main(int argc, char **argv) if (transmission_mode==7){ lte_gold_ue_spec_port5(eNB->lte_gold_uespec_port5_table[0],Nid_cell,n_rnti); lte_gold_ue_spec_port5(UE->lte_gold_uespec_port5_table,Nid_cell,n_rnti); - } + }*/ eNB_id_i = UE->n_connected_eNB; From 953de398a31f0ee1b57b80b51541c5263dcf441b Mon Sep 17 00:00:00 2001 From: Xiwen JIANG Date: Thu, 24 Nov 2016 10:46:20 +0100 Subject: [PATCH 292/349] adapt the tm7 configuration file --- .../GENERIC-LTE-EPC/CONF/enb.band7.tm7.exmimo2.conf | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm7.exmimo2.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm7.exmimo2.conf index d26ebbe735..52a8d8ee50 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm7.exmimo2.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm7.exmimo2.conf @@ -23,6 +23,9 @@ eNBs = component_carriers = ( { + node_function = "eNodeB_3GPP"; + node_timing = "synch_to_ext_device"; + node_synch_ref = 0; frame_type = "FDD"; tdd_config = 3; tdd_config_s = 0; @@ -34,8 +37,8 @@ eNBs = N_RB_DL = 25; Nid_cell_mbsfn = 0; nb_antenna_ports = 1; - nb_antennas_tx = 2; - nb_antennas_rx = 2; + nb_antennas_tx = 1; + nb_antennas_rx = 1; tx_gain = 25; rx_gain = 20; prach_root = 0; From 33e89e3e9f41c8fa1e83c5f7591b3d66a8e0b085 Mon Sep 17 00:00:00 2001 From: GabrirelCouturier Date: Thu, 24 Nov 2016 10:54:37 +0100 Subject: [PATCH 293/349] [OAI-UE] fix for issue#32 1- timing Advance fix 2- harq UL fix --- openair1/PHY/LTE_TRANSPORT/dci_tools.c | 49 ++++++++++--------- openair1/PHY/LTE_TRANSPORT/phich.c | 15 ++++-- openair1/PHY/LTE_TRANSPORT/ulsch_coding.c | 2 +- openair1/PHY/LTE_TRANSPORT/ulsch_modulation.c | 3 +- openair1/SCHED/phy_procedures_lte_ue.c | 22 +++++++-- 5 files changed, 59 insertions(+), 32 deletions(-) diff --git a/openair1/PHY/LTE_TRANSPORT/dci_tools.c b/openair1/PHY/LTE_TRANSPORT/dci_tools.c index c55290adf8..107fa042a6 100644 --- a/openair1/PHY/LTE_TRANSPORT/dci_tools.c +++ b/openair1/PHY/LTE_TRANSPORT/dci_tools.c @@ -6444,29 +6444,30 @@ int generate_ue_ulsch_params_from_dci(void *dci_pdu, // UE_mac_inst[eNB_id].scheduling_info.maxHARQ_Tx); //#endif - - ulsch->harq_processes[harq_pid] = ulsch->harq_processes[8]; - ulsch->harq_processes[harq_pid]->round++; - //LOG_I(PHY," Adaptative retransmission - copy temporary harq Process to current harq process. [harqId %d round %d] \n",harq_pid, ulsch->harq_processes[8]->round); - - - if (ulsch->harq_processes[harq_pid]->round >= UE_mac_inst[eNB_id].scheduling_info.maxHARQ_Tx) + if (ulsch->harq_processes[harq_pid]->round > 0) // NACK detected on phich { - ulsch->harq_processes[harq_pid]->subframe_scheduling_flag = 0; - ulsch->harq_processes[harq_pid]->round = 0; - ulsch->harq_processes[harq_pid]->status = IDLE; - //LOG_I(PHY," PUSCH MAX Retransmission acheived ==> flush harq buff (%d) \n",harq_pid); - //LOG_I(PHY," [HARQ-UL harqId: %d] Adaptative retransmission NACK MAX RETRANS(%d) ==> subframe_scheduling_flag = %d round: %d\n", harq_pid, UE_mac_inst[eNB_id].scheduling_info.maxHARQ_Tx, ulsch->harq_processes[harq_pid]->subframe_scheduling_flag, ulsch->harq_processes[harq_pid]->round); - } - else - { - // ulsch->harq_processes[harq_pid]->subframe_scheduling_flag = 1; - uint8_t rv_table[4] = {0, 2, 3, 1}; - ulsch->harq_processes[harq_pid]->rvidx = rv_table[ulsch->harq_processes[harq_pid]->round&3]; - ulsch->O_RI = 0; - ulsch->O = 0; - ulsch->uci_format = HLC_subband_cqi_nopmi; - //LOG_I(PHY," [HARQ-UL harqId: %d] Adaptative retransmission NACK ==> subframe_scheduling_flag = %d round: %d\n", harq_pid, ulsch->harq_processes[harq_pid]->subframe_scheduling_flag,ulsch->harq_processes[harq_pid]->round); + // ulsch->harq_processes[harq_pid]->round++; already done on phich_rx + ulsch->harq_processes[harq_pid] = ulsch->harq_processes[8]; + // LOG_I(PHY," Adaptative retransmission - copy temporary harq Process to current harq process. [harqId %d round %d] \n",harq_pid, ulsch->harq_processes[8]->round); + + if (ulsch->harq_processes[harq_pid]->round >= UE_mac_inst[eNB_id].scheduling_info.maxHARQ_Tx) + { + ulsch->harq_processes[harq_pid]->subframe_scheduling_flag = 0; + ulsch->harq_processes[harq_pid]->round = 0; + ulsch->harq_processes[harq_pid]->status = IDLE; + //LOG_I(PHY," PUSCH MAX Retransmission acheived ==> flush harq buff (%d) \n",harq_pid); + //LOG_I(PHY," [HARQ-UL harqId: %d] Adaptative retransmission NACK MAX RETRANS(%d) ==> subframe_scheduling_flag = %d round: %d\n", harq_pid, UE_mac_inst[eNB_id].scheduling_info.maxHARQ_Tx, ulsch->harq_processes[harq_pid]->subframe_scheduling_flag, ulsch->harq_processes[harq_pid]->round); + } + else + { + // ulsch->harq_processes[harq_pid]->subframe_scheduling_flag = 1; + uint8_t rv_table[4] = {0, 2, 3, 1}; + ulsch->harq_processes[harq_pid]->rvidx = rv_table[ulsch->harq_processes[harq_pid]->round&3]; + ulsch->O_RI = 0; + ulsch->O = 0; + ulsch->uci_format = HLC_subband_cqi_nopmi; + //LOG_I(PHY," [HARQ-UL harqId: %d] Adaptative retransmission NACK ==> subframe_scheduling_flag = %d round: %d\n", harq_pid, ulsch->harq_processes[harq_pid]->subframe_scheduling_flag,ulsch->harq_processes[harq_pid]->round); + } } } @@ -7087,7 +7088,8 @@ int generate_ue_ulsch_params_from_dci(void *dci_pdu, // ulsch->n_DMRS2 = ((DCI0_5MHz_TDD_1_6_t *)dci_pdu)->cshift; -#ifdef DEBUG_DCI + #ifdef DEBUG_DCI + printf("Format 0 DCI : ulsch (ue): AbsSubframe %d.%d\n",proc->frame_rx,subframe); printf("Format 0 DCI : ulsch (ue): NBRB %d\n",ulsch->harq_processes[harq_pid]->nb_rb); printf("Format 0 DCI :ulsch (ue): first_rb %d\n",ulsch->harq_processes[harq_pid]->first_rb); printf("Format 0 DCI :ulsch (ue): rballoc %d\n",rballoc); @@ -7106,6 +7108,7 @@ int generate_ue_ulsch_params_from_dci(void *dci_pdu, printf("Format 0 DCI :ulsch (ue): Nsymb_pusch %d\n",ulsch->Nsymb_pusch); printf("Format 0 DCI :ulsch (ue): cshift %d\n",ulsch->harq_processes[harq_pid]->n_DMRS2); + printf("Format 0 DCI :ulsch (ue): phich status %d\n",ulsch->harq_processes[harq_pid]->status); #else UNUSED_VARIABLE(dai); #endif diff --git a/openair1/PHY/LTE_TRANSPORT/phich.c b/openair1/PHY/LTE_TRANSPORT/phich.c index dc46f0505c..2d07ba948a 100644 --- a/openair1/PHY/LTE_TRANSPORT/phich.c +++ b/openair1/PHY/LTE_TRANSPORT/phich.c @@ -1386,11 +1386,20 @@ void rx_phich(PHY_VARS_UE *ue, // ulsch->harq_processes[harq_pid]->Ndi = 0; ulsch->harq_processes[harq_pid]->round++; - if (ulsch->harq_processes[harq_pid]->round >= UE_mac_inst[eNB_id].scheduling_info.maxHARQ_Tx) + if ( ulsch->harq_processes[harq_pid]->round >= (UE_mac_inst[eNB_id].scheduling_info.maxHARQ_Tx - 1) ) { - ulsch->harq_processes[harq_pid]->subframe_scheduling_flag = 0; - ulsch->harq_processes[harq_pid]->round = 0; + // this is last push re transmission + ulsch->harq_processes[harq_pid]->rvidx = rv_table[ulsch->harq_processes[harq_pid]->round&3]; + ulsch->O_RI = 0; + ulsch->O = 0; + ulsch->uci_format = HLC_subband_cqi_nopmi; + + // disable phich decoding since it is the last retransmission ulsch->harq_processes[harq_pid]->status = IDLE; + + //ulsch->harq_processes[harq_pid]->subframe_scheduling_flag = 0; + //ulsch->harq_processes[harq_pid]->round = 0; + //LOG_I(PHY,"PUSCH MAX Retransmission acheived ==> flush harq buff (%d) \n",harq_pid); //LOG_I(PHY,"[HARQ-UL harqId: %d] PHICH NACK MAX RETRANS(%d) ==> subframe_scheduling_flag = %d round: %d\n", harq_pid, UE_mac_inst[eNB_id].scheduling_info.maxHARQ_Tx, ulsch->harq_processes[harq_pid]->subframe_scheduling_flag, ulsch->harq_processes[harq_pid]->round); } diff --git a/openair1/PHY/LTE_TRANSPORT/ulsch_coding.c b/openair1/PHY/LTE_TRANSPORT/ulsch_coding.c index 48048bf5de..6d2d6232cb 100644 --- a/openair1/PHY/LTE_TRANSPORT/ulsch_coding.c +++ b/openair1/PHY/LTE_TRANSPORT/ulsch_coding.c @@ -503,7 +503,7 @@ uint32_t ulsch_encoding(uint8_t *a, /* LOG_I(PHY,"ULSCH Encoding G %d, Q_RI %d (O_RI%d, Msc_initial %d, Nsymb_initial%d, beta_offset_ri_times8 %d), Q_CQI %d \n",G,Q_RI,ulsch->O_RI,ulsch->harq_processes[harq_pid]->Msc_initial,ulsch->harq_processes[harq_pid]->Nsymb_initial,ulsch->beta_offset_ri_times8,Q_CQI); - LOG_I(PHY,"ulsch_decoding (Nid_cell %d, rnti %x): harq_pid %d round %d, RV %d, mcs %d, O_RI %d, O_ACK %d, G %d\n", + LOG_I(PHY,"ULSCH Encoding (Nid_cell %d, rnti %x): harq_pid %d round %d, RV %d, mcs %d, O_RI %d, O_ACK %d, G %d\n", frame_parms->Nid_cell,ulsch->rnti, harq_pid, ulsch->harq_processes[harq_pid]->round, diff --git a/openair1/PHY/LTE_TRANSPORT/ulsch_modulation.c b/openair1/PHY/LTE_TRANSPORT/ulsch_modulation.c index 02323d6ccd..ee9bfc53cd 100644 --- a/openair1/PHY/LTE_TRANSPORT/ulsch_modulation.c +++ b/openair1/PHY/LTE_TRANSPORT/ulsch_modulation.c @@ -424,9 +424,8 @@ void ulsch_modulation(int32_t **txdataF, Q_m = get_Qm_ul(ulsch->harq_processes[harq_pid]->mcs); - //G = (int)ulsch->harq_processes[harq_pid]->nb_rb * (12 * Q_m) * (ulsch->Nsymb_pusch); + G = (int)ulsch->harq_processes[harq_pid]->nb_rb * (12 * Q_m) * (ulsch->Nsymb_pusch); - G = ulsch->harq_processes[harq_pid]->G; // Mapping nsymb = (frame_parms->Ncp==0) ? 14:12; diff --git a/openair1/SCHED/phy_procedures_lte_ue.c b/openair1/SCHED/phy_procedures_lte_ue.c index 92eee4a99d..6e7354f883 100644 --- a/openair1/SCHED/phy_procedures_lte_ue.c +++ b/openair1/SCHED/phy_procedures_lte_ue.c @@ -944,9 +944,18 @@ void ulsch_common_procedures(PHY_VARS_UE *ue, UE_rxtx_proc_t *proc) { #if defined(EXMIMO) || defined(OAI_USRP) || defined(OAI_BLADERF) || defined(OAI_LMSSDR)//this is the EXPRESS MIMO case ulsch_start = (ue->rx_offset+subframe_tx*frame_parms->samples_per_tti- - ue->hw_timing_advance- - ue->timing_advance- - ue->N_TA_offset+5)%(LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*frame_parms->samples_per_tti); + ue->hw_timing_advance- + ue->timing_advance- + ue->N_TA_offset+5); + //LOG_E(PHY,"ul-signal [subframe: %d, ulsch_start %d]\n",subframe_tx, ulsch_start); + + 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); + + //LOG_E(PHY,"ul-signal [subframe: %d, ulsch_start %d]\n",subframe_tx, ulsch_start); #else //this is the normal case ulsch_start = (frame_parms->samples_per_tti*subframe_tx)-ue->N_TA_offset; //-ue->timing_advance; #endif //else EXMIMO @@ -1214,6 +1223,13 @@ void ue_ulsch_uespec_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB // deactivate service request // ue->ulsch[eNB_id]->harq_processes[harq_pid]->subframe_scheduling_flag = 0; + LOG_D(PHY,"Generating PUSCH (Abssubframe: %d.%d): harq-Id: %d, round: %d, MaxReTrans: %d \n",frame_tx,subframe_tx,harq_pid,ue->ulsch[eNB_id]->harq_processes[harq_pid]->round,UE_mac_inst[eNB_id].scheduling_info.maxHARQ_Tx); + if (ue->ulsch[eNB_id]->harq_processes[harq_pid]->round >= (UE_mac_inst[eNB_id].scheduling_info.maxHARQ_Tx - 1)) + { + LOG_D(PHY,"PUSCH MAX Retransmission acheived ==> send last pusch (%d) \n"); + ue->ulsch[eNB_id]->harq_processes[harq_pid]->subframe_scheduling_flag = 0; + ue->ulsch[eNB_id]->harq_processes[harq_pid]->round = 0; + } ack_status = get_ack(&ue->frame_parms, ue->dlsch[eNB_id][0]->harq_ack, From 7715900222394b7c98f772913748e0346bd1a793 Mon Sep 17 00:00:00 2001 From: Florian Kaltenberger Date: Thu, 24 Nov 2016 14:42:06 +0100 Subject: [PATCH 294/349] some more bugfixes (old and introcuded by merge) plus ability too use phy-test for tm7 --- openair1/PHY/INIT/lte_init.c | 10 +++++- openair1/PHY/LTE_TRANSPORT/dlsch_modulation.c | 34 +++++++------------ openair1/PHY/MODULATION/beamforming.c | 9 +++-- openair1/SCHED/phy_mac_stub.c | 2 ++ .../CONF/enb.band7.tm1.usrpb210.conf | 4 +-- targets/RT/USER/lte-enb.c | 15 ++++++-- targets/RT/USER/lte-softmodem.c | 20 +++++++++-- 7 files changed, 61 insertions(+), 33 deletions(-) diff --git a/openair1/PHY/INIT/lte_init.c b/openair1/PHY/INIT/lte_init.c index 16a608f4e9..5dd747de92 100644 --- a/openair1/PHY/INIT/lte_init.c +++ b/openair1/PHY/INIT/lte_init.c @@ -1251,9 +1251,17 @@ int phy_init_lte_eNB(PHY_VARS_eNB *eNB, common_vars->beam_weights[eNB_id][i] = (int32_t **)malloc16_clear(fp->nb_antennas_tx*sizeof(int32_t*)); for (j=0; jnb_antennas_tx; j++) { common_vars->beam_weights[eNB_id][i][j] = (int32_t *)malloc16_clear(fp->ofdm_symbol_size*sizeof(int32_t)); - if (((i<=4) && (i==j)) || (i>=5)) + // antenna ports 0-3 are mapped on antennas 0-3 + // antenna port 4 is mapped on antenna 0 + // antenna ports 5-14 are mapped on all antennas + if (((i<4) && (i==j)) || ((i==4) && (j==0))) { for (re=0; reofdm_symbol_size; re++) common_vars->beam_weights[eNB_id][i][j][re] = 0x00007fff; + } + else if (i>4) { + for (re=0; reofdm_symbol_size; re++) + common_vars->beam_weights[eNB_id][i][j][re] = 0x00007fff/fp->nb_antennas_tx; + } #ifdef DEBUG_PHY msg("[openair][LTE_PHY][INIT] lte_common_vars->beam_weights[%d][%d][%d] = %p (%d bytes)\n", eNB_id,i,j,common_vars->beam_weights[eNB_id][i][j], diff --git a/openair1/PHY/LTE_TRANSPORT/dlsch_modulation.c b/openair1/PHY/LTE_TRANSPORT/dlsch_modulation.c index 84e4bddec2..d6e680344b 100644 --- a/openair1/PHY/LTE_TRANSPORT/dlsch_modulation.c +++ b/openair1/PHY/LTE_TRANSPORT/dlsch_modulation.c @@ -678,15 +678,11 @@ x0[1+*jj]); case 2: //QPSK // printf("re %d %d(%d) : %d,%d => ",re,tti_offset,*jj,((int16_t*)&txdataF[0][tti_offset])[0],((int16_t*)&txdataF[0][tti_offset])[1]); - for (aa=0; aanb_antennas_tx; aa++) { - ((int16_t*)&txdataF[aa][tti_offset])[0] += (x0[*jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK; //I //b_i - } + ((int16_t*)&txdataF[0][tti_offset])[0] += (x0[*jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK; //I //b_i *jj = *jj + 1; - for (aa=0; aanb_antennas_tx; aa++) { - ((int16_t*)&txdataF[aa][tti_offset])[1] += (x0[*jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK; //Q //b_{i+1} - } + ((int16_t*)&txdataF[0][tti_offset])[1] += (x0[*jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK; //Q //b_{i+1} *jj = *jj + 1; @@ -719,12 +715,10 @@ x0[1+*jj]); *jj=*jj+1; - for (aa=0; aanb_antennas_tx; aa++) { - ((int16_t *)&txdataF[aa][tti_offset])[0]+=qam_table_s0[qam16_table_offset_re]; - ((int16_t *)&txdataF[aa][tti_offset])[1]+=qam_table_s0[qam16_table_offset_im]; - // ((int16_t *)&txdataF[aa][tti_offset])[0]+=(int16_t)(((int32_t)amp*qam16_table[qam16_table_offset_re])>>15); - // ((int16_t *)&txdataF[aa][tti_offset])[1]+=(int16_t)(((int32_t)amp*qam16_table[qam16_table_offset_im])>>15); - } + ((int16_t *)&txdataF[0][tti_offset])[0]+=qam_table_s0[qam16_table_offset_re]; + ((int16_t *)&txdataF[0][tti_offset])[1]+=qam_table_s0[qam16_table_offset_im]; + // ((int16_t *)&txdataF[aa][tti_offset])[0]+=(int16_t)(((int32_t)amp*qam16_table[qam16_table_offset_re])>>15); + // ((int16_t *)&txdataF[aa][tti_offset])[1]+=(int16_t)(((int32_t)amp*qam16_table[qam16_table_offset_im])>>15); break; @@ -764,10 +758,8 @@ x0[1+*jj]); *jj=*jj+1; - for (aa=0; aanb_antennas_tx; aa++) { - ((int16_t *)&txdataF[aa][tti_offset])[0]+=qam_table_s0[qam64_table_offset_re]; - ((int16_t *)&txdataF[aa][tti_offset])[1]+=qam_table_s0[qam64_table_offset_im]; - } + ((int16_t *)&txdataF[0][tti_offset])[0]+=qam_table_s0[qam64_table_offset_re]; + ((int16_t *)&txdataF[0][tti_offset])[1]+=qam_table_s0[qam64_table_offset_im]; break; @@ -970,7 +962,7 @@ x0[1+*jj]); *re_allocated = *re_allocated + 1; - if (frame_parms->nb_antennas_tx == 2) { + if (frame_parms->nb_antenna_ports_eNB == 2) { switch (mod_order0) { default: LOG_E(PHY,"Unknown mod_order0 %d\n",mod_order0); @@ -1186,7 +1178,7 @@ x0[1+*jj]); ((int16_t*)&txdataF[0][tti_offset])[0] += (int16_t)((((int16_t*)&tmp_sample1)[0]*ONE_OVER_SQRT2_Q15)>>15); ((int16_t*)&txdataF[0][tti_offset])[1] += (int16_t)((((int16_t*)&tmp_sample1)[1]*ONE_OVER_SQRT2_Q15)>>15); - if (frame_parms->nb_antennas_tx == 2) { + if (frame_parms->nb_antenna_ports_eNB == 2) { layer1prec2A(&tmp_sample1,&tmp_sample2,precoder_index); ((int16_t*)&txdataF[1][tti_offset])[0] += (int16_t)((((int16_t*)&tmp_sample2)[0]*ONE_OVER_SQRT2_Q15)>>15); ((int16_t*)&txdataF[1][tti_offset])[1] += (int16_t)((((int16_t*)&tmp_sample2)[1]*ONE_OVER_SQRT2_Q15)>>15); @@ -1226,7 +1218,7 @@ x0[1+*jj]); ((int16_t *)&txdataF[0][tti_offset])[0] += ((int16_t*)&tmp_sample1)[0]; ((int16_t *)&txdataF[0][tti_offset])[1] += ((int16_t*)&tmp_sample1)[1]; - if (frame_parms->nb_antennas_tx == 2) { + if (frame_parms->nb_antenna_ports_eNB == 2) { layer1prec2A(&tmp_sample1,&tmp_sample2,precoder_index); ((int16_t*)&txdataF[1][tti_offset])[0] += ((int16_t*)&tmp_sample2)[0]; ((int16_t*)&txdataF[1][tti_offset])[1] += ((int16_t*)&tmp_sample2)[1]; @@ -1276,7 +1268,7 @@ x0[1+*jj]); ((int16_t *)&txdataF[0][tti_offset])[0] += ((int16_t*)&tmp_sample1)[0]; ((int16_t *)&txdataF[0][tti_offset])[1] += ((int16_t*)&tmp_sample1)[1]; - if (frame_parms->nb_antennas_tx == 2) { + if (frame_parms->nb_antenna_ports_eNB == 2) { layer1prec2A(&tmp_sample1,&tmp_sample2,precoder_index); ((int16_t*)&txdataF[1][tti_offset])[0] += ((int16_t*)&tmp_sample2)[0]; ((int16_t*)&txdataF[1][tti_offset])[1] += ((int16_t*)&tmp_sample2)[1]; @@ -1284,7 +1276,7 @@ x0[1+*jj]); break; - } + } } if (mimo_mode == ALAMOUTI) { diff --git a/openair1/PHY/MODULATION/beamforming.c b/openair1/PHY/MODULATION/beamforming.c index 5e4660f034..75321daee0 100644 --- a/openair1/PHY/MODULATION/beamforming.c +++ b/openair1/PHY/MODULATION/beamforming.c @@ -84,14 +84,13 @@ int beam_precoding(int32_t **txdataF, ((int16_t*)&txdataF_BF[aa][re])[1]); */ } - } } if (txdataF[5][slot_offset_F+symbol*frame_parms->ofdm_symbol_size+re]!=0) { //that means this RE is actually using TM7 for (aa=0;aanb_antennas_tx;aa++) { - ((int16_t*)&txdataF_BF[aa][re])[0] = (int16_t)((((int16_t*)&txdataF[5][slot_offset_F+symbol*frame_parms->ofdm_symbol_size+re])[0]*((int16_t*)&beam_weights[5][aa][re])[0])>>15); + ((int16_t*)&txdataF_BF[aa][re])[0] += (int16_t)((((int16_t*)&txdataF[5][slot_offset_F+symbol*frame_parms->ofdm_symbol_size+re])[0]*((int16_t*)&beam_weights[5][aa][re])[0])>>15); ((int16_t*)&txdataF_BF[aa][re])[0] -= (int16_t)((((int16_t*)&txdataF[5][slot_offset_F+symbol*frame_parms->ofdm_symbol_size+re])[1]*((int16_t*)&beam_weights[5][aa][re])[1])>>15); - ((int16_t*)&txdataF_BF[aa][re])[1] = (int16_t)((((int16_t*)&txdataF[5][slot_offset_F+symbol*frame_parms->ofdm_symbol_size+re])[0]*((int16_t*)&beam_weights[5][aa][re])[1])>>15); + ((int16_t*)&txdataF_BF[aa][re])[1] += (int16_t)((((int16_t*)&txdataF[5][slot_offset_F+symbol*frame_parms->ofdm_symbol_size+re])[0]*((int16_t*)&beam_weights[5][aa][re])[1])>>15); ((int16_t*)&txdataF_BF[aa][re])[1] += (int16_t)((((int16_t*)&txdataF[5][slot_offset_F+symbol*frame_parms->ofdm_symbol_size+re])[1]*((int16_t*)&beam_weights[5][aa][re])[0])>>15); /* printf("beamforming.c:txdata[5][%d]=%d+j%d, beam_weights[5][%d][%d]=%d+j%d,txdata_BF[%d][%d]=%d+j%d\n", @@ -112,9 +111,9 @@ int beam_precoding(int32_t **txdataF, for (p=7;p<15;p++) { if (txdataF[p][slot_offset_F+symbol*frame_parms->ofdm_symbol_size+re]!=0) { //that means this RE is actually allocated for (aa=0;aanb_antennas_tx;aa++) { - ((int16_t*)&txdataF_BF[aa][re])[0] = (int16_t)((((int16_t*)&txdataF[p][slot_offset_F+symbol*frame_parms->ofdm_symbol_size+re])[0]*((int16_t*)&beam_weights[p][aa][re])[0])>>15); + ((int16_t*)&txdataF_BF[aa][re])[0] += (int16_t)((((int16_t*)&txdataF[p][slot_offset_F+symbol*frame_parms->ofdm_symbol_size+re])[0]*((int16_t*)&beam_weights[p][aa][re])[0])>>15); ((int16_t*)&txdataF_BF[aa][re])[0] -= (int16_t)((((int16_t*)&txdataF[p][slot_offset_F+symbol*frame_parms->ofdm_symbol_size+re])[1]*((int16_t*)&beam_weights[p][aa][re])[1])>>15); - ((int16_t*)&txdataF_BF[aa][re])[1] = (int16_t)((((int16_t*)&txdataF[p][slot_offset_F+symbol*frame_parms->ofdm_symbol_size+re])[0]*((int16_t*)&beam_weights[p][aa][re])[1])>>15); + ((int16_t*)&txdataF_BF[aa][re])[1] += (int16_t)((((int16_t*)&txdataF[p][slot_offset_F+symbol*frame_parms->ofdm_symbol_size+re])[0]*((int16_t*)&beam_weights[p][aa][re])[1])>>15); ((int16_t*)&txdataF_BF[aa][re])[1] += (int16_t)((((int16_t*)&txdataF[p][slot_offset_F+symbol*frame_parms->ofdm_symbol_size+re])[1]*((int16_t*)&beam_weights[p][aa][re])[0])>>15); } } diff --git a/openair1/SCHED/phy_mac_stub.c b/openair1/SCHED/phy_mac_stub.c index cae8b8c82e..9051127dbf 100644 --- a/openair1/SCHED/phy_mac_stub.c +++ b/openair1/SCHED/phy_mac_stub.c @@ -63,6 +63,8 @@ void fill_dci(DCI_PDU *DCI_pdu,PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc) uint32_t bcch_pdu; uint64_t dlsch_pdu; + LOG_I(PHY,"frame %d, subframe %d, transmission_mode %d\n",proc->frame_tx,proc->subframe_tx,transmission_mode); + DCI_pdu->Num_common_dci = 0; DCI_pdu->Num_ue_spec_dci=0; diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf index 5ef5a4f50b..2942832d94 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf @@ -37,8 +37,8 @@ eNBs = N_RB_DL = 25; Nid_cell_mbsfn = 0; nb_antenna_ports = 1; - nb_antennas_tx = 1; - nb_antennas_rx = 1; + nb_antennas_tx = 2; + nb_antennas_rx = 2; tx_gain = 90; rx_gain = 125; prach_root = 0; diff --git a/targets/RT/USER/lte-enb.c b/targets/RT/USER/lte-enb.c index 965894cac0..3eef00ef29 100644 --- a/targets/RT/USER/lte-enb.c +++ b/targets/RT/USER/lte-enb.c @@ -128,6 +128,8 @@ extern pthread_cond_t sync_cond; extern pthread_mutex_t sync_mutex; extern int sync_var; +extern transmission_mode; + //pthread_t main_eNB_thread; time_stats_t softmodem_stats_mt; // main thread @@ -467,8 +469,17 @@ void proc_tx_full(PHY_VARS_eNB *eNB, // if TX fronthaul go ahead if (eNB->tx_fh) eNB->tx_fh(eNB,proc); - - + /* + if (proc->frame_tx>1000) { + write_output("/tmp/txsig0.m","txs0", &eNB->common_vars.txdata[eNB->Mod_id][0][0], eNB->frame_parms.samples_per_tti*10,1,1); + write_output("/tmp/txsigF0.m","txsF0", &eNB->common_vars.txdataF[eNB->Mod_id][0][0],eNB->frame_parms.symbols_per_tti*eNB->frame_parms.ofdm_symbol_size*10,1,1); + write_output("/tmp/txsig1.m","txs1", &eNB->common_vars.txdata[eNB->Mod_id][1][0], eNB->frame_parms.samples_per_tti*10,1,1); + write_output("/tmp/txsigF1.m","txsF1", &eNB->common_vars.txdataF[eNB->Mod_id][1][0],eNB->frame_parms.symbols_per_tti*eNB->frame_parms.ofdm_symbol_size*10,1,1); + if (transmission_mode == 7) + write_output("/tmp/txsigF5.m","txsF5", &eNB->common_vars.txdataF[eNB->Mod_id][5][0],eNB->frame_parms.symbols_per_tti*eNB->frame_parms.ofdm_symbol_size*10,1,1); + exit_fun(""); + } + */ } void proc_tx_rru_if4p5(PHY_VARS_eNB *eNB, diff --git a/targets/RT/USER/lte-softmodem.c b/targets/RT/USER/lte-softmodem.c index d2362081de..3cb01c876a 100644 --- a/targets/RT/USER/lte-softmodem.c +++ b/targets/RT/USER/lte-softmodem.c @@ -234,7 +234,7 @@ uint64_t num_missed_slots=0; // counter for the number of missed slots extern void reset_opp_meas(void); extern void print_opp_meas(void); -//int transmission_mode=1; +int transmission_mode=1; int16_t glog_level = LOG_INFO; int16_t glog_verbosity = LOG_MED; @@ -1189,8 +1189,13 @@ static void get_options (int argc, char **argv) printf("Downlink frequency/ uplink offset of CC_id %d set to %ju/%d\n", CC_id, enb_properties->properties[i]->downlink_frequency[CC_id], enb_properties->properties[i]->uplink_frequency_offset[CC_id]); + } // CC_id }// i + + //this is needed for phy-test option + transmission_mode = enb_properties->properties[0]->ue_TransmissionMode[0]+1; + } else if (UE_flag == 1) { if (conf_config_file_name != NULL) { @@ -1363,7 +1368,7 @@ void init_openair0() { int main( int argc, char **argv ) { - int i,aa; + int i,j,k,aa,re; #if defined (XFORMS) void *status; #endif @@ -1606,6 +1611,17 @@ int main( int argc, char **argv ) PHY_vars_eNB_g[0][CC_id]->ue_ul_nb_rb=6; PHY_vars_eNB_g[0][CC_id]->target_ue_ul_mcs=target_ul_mcs; + // initialization for phy-test + for (k=0;ktransmission_mode[k] = transmission_mode; + if (transmission_mode==7) + lte_gold_ue_spec_port5(PHY_vars_eNB_g[0][CC_id]->lte_gold_uespec_port5_table[k],frame_parms[CC_id]->Nid_cell,0x1235+k); + } + if ((transmission_mode==1) || (transmission_mode==7)) { + for (j=0; jnb_antennas_tx; j++) + for (re=0; reofdm_symbol_size; re++) + PHY_vars_eNB_g[0][CC_id]->common_vars.beam_weights[0][0][j][re] = 0x00007fff/frame_parms[CC_id]->nb_antennas_tx; + } if (phy_test==1) PHY_vars_eNB_g[0][CC_id]->mac_enabled = 0; else PHY_vars_eNB_g[0][CC_id]->mac_enabled = 1; From 41fd001b3181a8ddaf362bb6ab4901b9123f386e Mon Sep 17 00:00:00 2001 From: Xiwen JIANG Date: Thu, 24 Nov 2016 17:57:52 +0100 Subject: [PATCH 295/349] delete redundant code in beamforming.c --- openair1/PHY/MODULATION/beamforming.c | 63 ++++++--------------------- openair1/PHY/MODULATION/defs.h | 6 ++- openair1/PHY/MODULATION/ofdm_mod.c | 11 +++-- openair1/SIMULATION/LTE_PHY/dlsim.c | 8 +++- 4 files changed, 29 insertions(+), 59 deletions(-) diff --git a/openair1/PHY/MODULATION/beamforming.c b/openair1/PHY/MODULATION/beamforming.c index 75321daee0..6557a47ee7 100644 --- a/openair1/PHY/MODULATION/beamforming.c +++ b/openair1/PHY/MODULATION/beamforming.c @@ -51,26 +51,27 @@ int beam_precoding(int32_t **txdataF, LTE_DL_FRAME_PARMS *frame_parms, int32_t ***beam_weights, int slot, - int symbol) + int symbol, + int aa) { - uint8_t p,aa; + uint8_t p; uint16_t re=0; int slot_offset_F; slot_offset_F = slot*(frame_parms->ofdm_symbol_size)*((frame_parms->Ncp==1) ? 6 : 7); // clear txdata_BF[aa][re] for each call of ue_spec_beamforming - for(aa=0;aanb_antennas_tx;aa++) - memset(txdataF_BF[aa],0,sizeof(int32_t)*(frame_parms->ofdm_symbol_size)); + memset(txdataF_BF[aa],0,sizeof(int32_t)*(frame_parms->ofdm_symbol_size)); - for (re=0;reofdm_symbol_size;re++) { - for (p=0; p<2; p++) { - if (txdataF[p][slot_offset_F+symbol*frame_parms->ofdm_symbol_size+re]!=0) { - for (aa=0;aanb_antennas_tx;aa++) { - ((int16_t*)&txdataF_BF[aa][re])[0] += (int16_t)((((int16_t*)&txdataF[p][slot_offset_F+symbol*frame_parms->ofdm_symbol_size+re])[0]*((int16_t*)&beam_weights[p][aa][re])[0])>>15); - ((int16_t*)&txdataF_BF[aa][re])[0] -= (int16_t)((((int16_t*)&txdataF[p][slot_offset_F+symbol*frame_parms->ofdm_symbol_size+re])[1]*((int16_t*)&beam_weights[p][aa][re])[1])>>15); - ((int16_t*)&txdataF_BF[aa][re])[1] += (int16_t)((((int16_t*)&txdataF[p][slot_offset_F+symbol*frame_parms->ofdm_symbol_size+re])[0]*((int16_t*)&beam_weights[p][aa][re])[1])>>15); - ((int16_t*)&txdataF_BF[aa][re])[1] += (int16_t)((((int16_t*)&txdataF[p][slot_offset_F+symbol*frame_parms->ofdm_symbol_size+re])[1]*((int16_t*)&beam_weights[p][aa][re])[0])>>15); + for (p=0; p<14; p++) { + //if (p==0 || p==1 || p==5 || p>7) + // mult_cpx_conj_vector((int16_t*)txdataF[p], (int16_t*)beam_weights[p][aa], (int16_t*)txdataF_BF[aa], frame_parms->ofdm_symbol_size, 15); + for (re=0;reofdm_symbol_size;re++) { + if ((p==0 || p==1 || p==5 || p>=7) && txdataF[p][slot_offset_F+symbol*frame_parms->ofdm_symbol_size+re]!=0) { + ((int16_t*)&txdataF_BF[aa][re])[0] += (int16_t)((((int16_t*)&txdataF[p][slot_offset_F+symbol*frame_parms->ofdm_symbol_size+re])[0]*((int16_t*)&beam_weights[p][aa][re])[0])>>15); + ((int16_t*)&txdataF_BF[aa][re])[0] -= (int16_t)((((int16_t*)&txdataF[p][slot_offset_F+symbol*frame_parms->ofdm_symbol_size+re])[1]*((int16_t*)&beam_weights[p][aa][re])[1])>>15); + ((int16_t*)&txdataF_BF[aa][re])[1] += (int16_t)((((int16_t*)&txdataF[p][slot_offset_F+symbol*frame_parms->ofdm_symbol_size+re])[0]*((int16_t*)&beam_weights[p][aa][re])[1])>>15); + ((int16_t*)&txdataF_BF[aa][re])[1] += (int16_t)((((int16_t*)&txdataF[p][slot_offset_F+symbol*frame_parms->ofdm_symbol_size+re])[1]*((int16_t*)&beam_weights[p][aa][re])[0])>>15); /* printf("beamforming.c:txdataF[%d][%d]=%d+j%d, beam_weights[%d][%d][%d]=%d+j%d,txdata_BF[%d][%d]=%d+j%d\n", @@ -83,44 +84,8 @@ int beam_precoding(int32_t **txdataF, ((int16_t*)&txdataF_BF[aa][re])[0], ((int16_t*)&txdataF_BF[aa][re])[1]); */ - } } } - if (txdataF[5][slot_offset_F+symbol*frame_parms->ofdm_symbol_size+re]!=0) { //that means this RE is actually using TM7 - for (aa=0;aanb_antennas_tx;aa++) { - ((int16_t*)&txdataF_BF[aa][re])[0] += (int16_t)((((int16_t*)&txdataF[5][slot_offset_F+symbol*frame_parms->ofdm_symbol_size+re])[0]*((int16_t*)&beam_weights[5][aa][re])[0])>>15); - ((int16_t*)&txdataF_BF[aa][re])[0] -= (int16_t)((((int16_t*)&txdataF[5][slot_offset_F+symbol*frame_parms->ofdm_symbol_size+re])[1]*((int16_t*)&beam_weights[5][aa][re])[1])>>15); - ((int16_t*)&txdataF_BF[aa][re])[1] += (int16_t)((((int16_t*)&txdataF[5][slot_offset_F+symbol*frame_parms->ofdm_symbol_size+re])[0]*((int16_t*)&beam_weights[5][aa][re])[1])>>15); - ((int16_t*)&txdataF_BF[aa][re])[1] += (int16_t)((((int16_t*)&txdataF[5][slot_offset_F+symbol*frame_parms->ofdm_symbol_size+re])[1]*((int16_t*)&beam_weights[5][aa][re])[0])>>15); - - /* printf("beamforming.c:txdata[5][%d]=%d+j%d, beam_weights[5][%d][%d]=%d+j%d,txdata_BF[%d][%d]=%d+j%d\n", - slot_offset_F+symbol*frame_parms->ofdm_symbol_size+re, - ((int16_t*)&txdataF[5][slot_offset_F+symbol*frame_parms->ofdm_symbol_size+re])[0], - ((int16_t*)&txdataF[5][slot_offset_F+symbol*frame_parms->ofdm_symbol_size+re])[1], - aa,re, - ((int16_t*)&beam_weights[5][aa][re])[0], - ((int16_t*)&beam_weights[5][aa][re])[1], - aa,re, - ((int16_t*)&txdataF_BF[aa][re])[0], - ((int16_t*)&txdataF_BF[aa][re])[1]); */ - - } - } - - if (txdataF[7][slot_offset_F+symbol*frame_parms->ofdm_symbol_size+re]!=0) { //that means this RE is actually using TM8-10 - for (p=7;p<15;p++) { - if (txdataF[p][slot_offset_F+symbol*frame_parms->ofdm_symbol_size+re]!=0) { //that means this RE is actually allocated - for (aa=0;aanb_antennas_tx;aa++) { - ((int16_t*)&txdataF_BF[aa][re])[0] += (int16_t)((((int16_t*)&txdataF[p][slot_offset_F+symbol*frame_parms->ofdm_symbol_size+re])[0]*((int16_t*)&beam_weights[p][aa][re])[0])>>15); - ((int16_t*)&txdataF_BF[aa][re])[0] -= (int16_t)((((int16_t*)&txdataF[p][slot_offset_F+symbol*frame_parms->ofdm_symbol_size+re])[1]*((int16_t*)&beam_weights[p][aa][re])[1])>>15); - ((int16_t*)&txdataF_BF[aa][re])[1] += (int16_t)((((int16_t*)&txdataF[p][slot_offset_F+symbol*frame_parms->ofdm_symbol_size+re])[0]*((int16_t*)&beam_weights[p][aa][re])[1])>>15); - ((int16_t*)&txdataF_BF[aa][re])[1] += (int16_t)((((int16_t*)&txdataF[p][slot_offset_F+symbol*frame_parms->ofdm_symbol_size+re])[1]*((int16_t*)&beam_weights[p][aa][re])[0])>>15); - } - } - } - } } - -return 0; - + return 0; } diff --git a/openair1/PHY/MODULATION/defs.h b/openair1/PHY/MODULATION/defs.h index 289b1edd43..6937db6d9b 100644 --- a/openair1/PHY/MODULATION/defs.h +++ b/openair1/PHY/MODULATION/defs.h @@ -103,13 +103,15 @@ after beamforming @param beam_weights Beamforming weights applied on each antenna element and each carrier @param slot Slot number - @param symbol Symbol index on which to act*/ + @param symbol Symbol index on which to act + @param aa physical antenna index*/ int beam_precoding(int32_t **txdataF, int32_t **txdataF_BF, LTE_DL_FRAME_PARMS *frame_parms, int32_t ***beam_weights, int slot, - int symbol); + int symbol, + int aa); int f_read(char *calibF_fname, int nb_ant, int nb_freq, int32_t **tdd_calib_coeffs); diff --git a/openair1/PHY/MODULATION/ofdm_mod.c b/openair1/PHY/MODULATION/ofdm_mod.c index 2fd7fd88a3..74037b4a6e 100644 --- a/openair1/PHY/MODULATION/ofdm_mod.c +++ b/openair1/PHY/MODULATION/ofdm_mod.c @@ -298,14 +298,13 @@ void do_OFDM_mod_symbol(LTE_eNB_COMMON *eNB_common_vars, int eNB_id, uint16_t ne //printf("Thread %d starting ... aa %d (%llu)\n",omp_get_thread_num(),aa,rdtsc()); for (l=0; lsymbols_per_tti>>1; l++) { - //printf("do_OFDM_mod_l, slot=%d, l=%d, NUMBER_OF_OFDM_CARRIERS=%d,OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES=%d\n",next_slot, l,NUMBER_OF_OFDM_CARRIERS,OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES); - - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_BEAM_PRECODING,1); - beam_precoding(txdataF,txdataF_BF,frame_parms,eNB_common_vars->beam_weights[eNB_id],next_slot,l); - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_BEAM_PRECODING,0); - for (aa=0; aanb_antennas_tx; aa++) { + //printf("do_OFDM_mod_l, slot=%d, l=%d, NUMBER_OF_OFDM_CARRIERS=%d,OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES=%d\n",next_slot, l,NUMBER_OF_OFDM_CARRIERS,OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES); + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_BEAM_PRECODING,1); + beam_precoding(txdataF,txdataF_BF,frame_parms,eNB_common_vars->beam_weights[eNB_id],next_slot,l,aa); + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_BEAM_PRECODING,0); + //PMCH case not implemented... if (frame_parms->Ncp == 1) diff --git a/openair1/SIMULATION/LTE_PHY/dlsim.c b/openair1/SIMULATION/LTE_PHY/dlsim.c index c657069e46..f3804f0f70 100644 --- a/openair1/SIMULATION/LTE_PHY/dlsim.c +++ b/openair1/SIMULATION/LTE_PHY/dlsim.c @@ -1281,8 +1281,6 @@ int main(int argc, char **argv) uint8_t extended_prefix_flag=0,transmission_mode=1,n_tx_port=1,n_tx_phy=1,n_rx=2; uint16_t Nid_cell=0; - int32_t **cell_spec_bf_weights; - int eNB_id = 0; unsigned char mcs1=0,mcs2=0,mcs_i=0,dual_stream_UE = 0,awgn_flag=0,round; unsigned char i_mod = 2; @@ -1808,6 +1806,12 @@ int main(int argc, char **argv) osf, perfect_ce); + if ((transmission_mode==1) || (transmission_mode==7)) { + for (aa=0; aaframe_parms.nb_antennas_tx; aa++) + for (re=0; reframe_parms.ofdm_symbol_size; re++) + eNB->common_vars.beam_weights[0][0][aa][re] = 0x00007fff/eNB->frame_parms.nb_antennas_tx; + } + eNB->mac_enabled=1; if (two_thread_flag == 0) { eNB->te = dlsch_encoding; From b0b472e035c9eb5a95b29f1917777c1c750f7505 Mon Sep 17 00:00:00 2001 From: hbilel Date: Thu, 24 Nov 2016 18:17:21 +0100 Subject: [PATCH 296/349] BSR fixes on CMW500 --- openair2/LAYER2/MAC/config.c | 1 + openair2/LAYER2/MAC/ue_procedures.c | 33 +++++++++++++++++++++++------ 2 files changed, 28 insertions(+), 6 deletions(-) diff --git a/openair2/LAYER2/MAC/config.c b/openair2/LAYER2/MAC/config.c index 46ded848b1..2ec37a423e 100644 --- a/openair2/LAYER2/MAC/config.c +++ b/openair2/LAYER2/MAC/config.c @@ -188,6 +188,7 @@ rrc_mac_config_req( else { UE_mac_inst[Mod_idP].scheduling_info.LCGID[logicalChannelIdentity] = MAX_NUM_LCGID; } + UE_mac_inst[Mod_idP].scheduling_info.LCID_buffer_remain[logicalChannelIdentity] = 0; } else { LOG_E(MAC,"[CONFIG][UE %d] LCID %d NULL ul_SpecificParameters\n",Mod_idP,logicalChannelIdentity); mac_xface->macphy_exit("NULL ul_SpecificParameters"); diff --git a/openair2/LAYER2/MAC/ue_procedures.c b/openair2/LAYER2/MAC/ue_procedures.c index b25aab9442..a4c77c2cda 100644 --- a/openair2/LAYER2/MAC/ue_procedures.c +++ b/openair2/LAYER2/MAC/ue_procedures.c @@ -128,6 +128,7 @@ void ue_init_mac(module_id_t module_idP) } UE_mac_inst[module_idP].scheduling_info.LCID_status[i]=LCID_EMPTY; + UE_mac_inst[module_idP].scheduling_info.LCID_buffer_remain[i] = 0; } #ifdef CBA @@ -1504,6 +1505,7 @@ void ue_get_sdu(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_t subf LOG_D(MAC,"[UE %d] TX Multiplex RLC PDU Got %d bytes for SRB2\n",module_idP,sdu_lengths[num_sdus]); //dcch_header_len +=2; // include dcch1 UE_mac_inst[module_idP].scheduling_info.LCID_status[DCCH1] = LCID_EMPTY; + UE_mac_inst[module_idP].scheduling_info.LCID_buffer_remain[DCCH1] -= sdu_lengths[num_sdus]; /* Update BSR : substract transmitted data */ if (UE_mac_inst[module_idP].scheduling_info.BSR_bytes[UE_mac_inst[module_idP].scheduling_info.LCGID[DCCH1]] >= sdu_lengths[num_sdus]){ UE_mac_inst[module_idP].scheduling_info.BSR_bytes[UE_mac_inst[module_idP].scheduling_info.LCGID[DCCH1]] -= sdu_lengths[num_sdus]; @@ -1653,7 +1655,18 @@ void ue_get_sdu(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_t subf if (bsr_ce_len) { //Print updated BSR when sent - LOG_D(MAC,"[UE %d] Frame %d Subframe %d TX BSR size=%d BSR0=%d BSR1=%d BSR2=%d BSR3=%d\n",module_idP,frameP,subframe,bsr_ce_len, + LOG_D(MAC,"[UE %d] Remaining Buffer after Tx frame%d subframe %d nb LCG =%d Bytes for LCG0=%d LCG1=%d LCG2=%d LCG3=%d BSR Trigger status =%d TBS=%d\n", + module_idP, + frameP, + subframe, + num_lcg_id_with_data, + UE_mac_inst[module_idP].scheduling_info.BSR_bytes[0], + UE_mac_inst[module_idP].scheduling_info.BSR_bytes[1], + UE_mac_inst[module_idP].scheduling_info.BSR_bytes[2], + UE_mac_inst[module_idP].scheduling_info.BSR_bytes[3], + UE_mac_inst[module_idP].BSR_reporting_active, buflen); + + LOG_D(MAC,"[UE %d] Frame %d Subframe %d TX BSR Regular or Periodic size=%d BSR0=%d BSR1=%d BSR2=%d BSR3=%d\n",module_idP,frameP,subframe,bsr_ce_len, UE_mac_inst[module_idP].scheduling_info.BSR[0], UE_mac_inst[module_idP].scheduling_info.BSR[1], UE_mac_inst[module_idP].scheduling_info.BSR[2], @@ -2309,6 +2322,7 @@ boolean_t update_bsr(module_id_t module_idP, frame_t frameP, sub_frame_t subfra uint8_t array_index = 0; // Reset All BSR Infos + lcid_bytes_in_buffer[0] = 0; for (lcid=DCCH; lcid < MAX_NUM_LCID; lcid++) { // Reset transmission status @@ -2316,7 +2330,7 @@ boolean_t update_bsr(module_id_t module_idP, frame_t frameP, sub_frame_t subfra UE_mac_inst[module_idP].scheduling_info.LCID_status[lcid]=LCID_EMPTY; } - for (lcgid=0; lcid < MAX_NUM_LCGID; lcgid++) + for (lcgid=0; lcgid < MAX_NUM_LCGID; lcgid++) { // Reset Buffer Info UE_mac_inst[module_idP].scheduling_info.BSR[lcgid]=0; @@ -2344,6 +2358,8 @@ boolean_t update_bsr(module_id_t module_idP, frame_t frameP, sub_frame_t subfra if (rlc_status.bytes_in_buffer > 0) { + LOG_D(MAC,"[UE %d] PDCCH Tick : LCID%d LCGID%d has data to transmit =%d bytes at frame %d subframe %d\n", + module_idP, lcid,lcgid,rlc_status.bytes_in_buffer,frameP,subframeP); UE_mac_inst[module_idP].scheduling_info.LCID_status[lcid] = LCID_NOT_EMPTY; //Update BSR_bytes and position in lcid_reordered_array only if Group is defined @@ -2381,6 +2397,9 @@ boolean_t update_bsr(module_id_t module_idP, frame_t frameP, sub_frame_t subfra // Check whether a regular BSR can be triggered according to the first cases in 36.321 if (num_lcid_with_data) { + LOG_D(MAC,"[UE %d] PDCCH Tick at frame %d subframe %d: NumLCID with data=%d Reordered LCID0=%d LCID1=%d LCID2=%d\n", + module_idP, frameP, subframeP,num_lcid_with_data,lcid_reordered_array[0],lcid_reordered_array[1],lcid_reordered_array[2]); + for (array_index=0; array_index < num_lcid_with_data; array_index++) { lcid = lcid_reordered_array[array_index]; @@ -2395,8 +2414,8 @@ boolean_t update_bsr(module_id_t module_idP, frame_t frameP, sub_frame_t subfra { bsr_regular_triggered = TRUE; - LOG_D(MAC,"[UE %d] PDCCH Tick : MAC BSR Triggered LCID%d data become available at frame %d subframe %d\n", - module_idP, lcid,frameP, subframeP); + LOG_D(MAC,"[UE %d] PDCCH Tick : MAC BSR Triggered LCID%d LCGID%d data become available at frame %d subframe %d\n", + module_idP, lcid,UE_mac_inst[module_idP].scheduling_info.LCGID[lcid],frameP, subframeP); break; } @@ -2407,8 +2426,10 @@ boolean_t update_bsr(module_id_t module_idP, frame_t frameP, sub_frame_t subfra { bsr_regular_triggered = TRUE; - LOG_D(MAC,"[UE %d] PDCCH Tick : MAC BSR Triggered ReTxBSR Timer expiry at frame %d subframe %d\n", - module_idP, frameP, subframeP); + if ((UE_mac_inst[module_idP].BSR_reporting_active & BSR_TRIGGER_REGULAR) == 0) { + LOG_I(MAC,"[UE %d] PDCCH Tick : MAC BSR Triggered ReTxBSR Timer expiry at frame %d subframe %d\n", + module_idP, frameP, subframeP); + } } } From eb711645d0a5530c19fbb33126f4d2881ff97843 Mon Sep 17 00:00:00 2001 From: hbilel Date: Thu, 24 Nov 2016 18:26:23 +0100 Subject: [PATCH 297/349] fix issue#33 : RLC AM BO --- openair2/LAYER2/RLC/AM_v9.3.0/rlc_am.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am.c b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am.c index 427d7c8a02..85104b940c 100644 --- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am.c +++ b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am.c @@ -53,6 +53,7 @@ rlc_am_get_buffer_occupancy_in_bytes ( uint32_t header_overhead; // priority of control trafic + rlc_pP->status_buffer_occupancy = 0; if (rlc_pP->status_requested) { if (rlc_pP->t_status_prohibit.running == 0) { #if TRACE_RLC_AM_BO @@ -64,7 +65,7 @@ rlc_am_get_buffer_occupancy_in_bytes ( } #endif - return ((15 + rlc_pP->num_nack_sn*(10+1) + rlc_pP->num_nack_so*(15+15+1) + 7) >> 3); + rlc_pP->status_buffer_occupancy = ((15 + rlc_pP->num_nack_sn*(10+1) + rlc_pP->num_nack_so*(15+15+1) + 7) >> 3); } } From 7f1bef9b650aa99ac6780d7c226c6b68f700a1b3 Mon Sep 17 00:00:00 2001 From: Rohit Gupta Date: Fri, 25 Nov 2016 10:53:26 +0100 Subject: [PATCH 298/349] minor fix to Google Protobuf logging in installation --- cmake_targets/tools/build_helper | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/cmake_targets/tools/build_helper b/cmake_targets/tools/build_helper index 7cde2811c8..448d54f334 100755 --- a/cmake_targets/tools/build_helper +++ b/cmake_targets/tools/build_helper @@ -164,6 +164,9 @@ compilations() { ############################################ install_protobuf_from_source(){ + protobuf_install_log=$OPENAIR_DIR/cmake_targets/log/protobuf_install_log.txt + echo_info "\nInstalling Google Protobuf from sources. The log file for Protobuf installation is here: $protobuf_install_log " + ( cd /tmp echo "Downloading protobuf" rm -rf /tmp/protobuf-2.6.1.tar.gz* /tmp/protobuf-2.6.1 @@ -174,11 +177,14 @@ install_protobuf_from_source(){ echo "Compiling protobuf" make -j`nproc` $SUDO make install - rm -rf /tmp/protobuf-2.6.1.tar.gz /tmp/protobuf-2.6.1 $SUDO ldconfig + ) >& $protobuf_install_log } install_protobuf_c_from_source(){ + protobuf_c_install_log=$OPENAIR_DIR/cmake_targets/log/protobuf_c_install_log.txt + echo_info "\nInstalling Google Protobuf_C from sources. The log file for Protobuf_C installation is here: $protobuf_c_install_log " + ( cd /tmp echo "Downloading protobuf-c" rm -rf /tmp/protobuf-c @@ -189,8 +195,8 @@ install_protobuf_c_from_source(){ echo "Compiling protobuf-c" make -j`nproc` $SUDO make install - rm -rf /tmp/protobuf-c $SUDO ldconfig + ) >& $protobuf_c_install_log } check_install_usrp_uhd_driver(){ @@ -396,6 +402,7 @@ remove_nettle_from_source() { cd nettle-2.5/ ./configure --disable-openssl --enable-shared --prefix=/usr $SUDO make uninstall || true + $SUDO ldconfig ) >& $nettle_uninstall_log } @@ -419,6 +426,7 @@ remove_gnutls_from_source(){ cd gnutls-3.1.23/ ./configure --prefix=/usr $SUDO make uninstall || true + $SUDO ldconfig )>& $gnutls_uninstall_log } @@ -433,6 +441,7 @@ install_asn1c_from_source(){ make -j`nproc` $SUDO make install cd - + $SUDO ldconfig ) > $asn1_install_log 2>&1 } From 0579d471546a4d9667b989492bedfb3262d01893 Mon Sep 17 00:00:00 2001 From: ROBERT Benoit Date: Fri, 25 Nov 2016 14:43:28 +0100 Subject: [PATCH 299/349] Complete autotest patch files set for OAI1B autotest setup --- .../autotests/patches/CmakeLists.patch | 12 ++++++ .../autotest_ue_dlsch_bitrate_metric.patch | 11 +++-- .../patches/autotest_ue_offsets_metric.patch | 31 ++++++++++++++ .../autotests/patches/build_oai.patch | 40 +++++++++++++++++++ cmake_targets/autotests/testsuite_ue_noS1.xml | 6 +-- 5 files changed, 91 insertions(+), 9 deletions(-) create mode 100644 cmake_targets/autotests/patches/CmakeLists.patch create mode 100644 cmake_targets/autotests/patches/autotest_ue_offsets_metric.patch create mode 100644 cmake_targets/autotests/patches/build_oai.patch diff --git a/cmake_targets/autotests/patches/CmakeLists.patch b/cmake_targets/autotests/patches/CmakeLists.patch new file mode 100644 index 0000000000..9f2731ca73 --- /dev/null +++ b/cmake_targets/autotests/patches/CmakeLists.patch @@ -0,0 +1,12 @@ +diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt +index 3169c6c..eaf5417 100644 +--- a/cmake_targets/CMakeLists.txt ++++ b/cmake_targets/CMakeLists.txt +@@ -235,6 +235,7 @@ add_boolean_option(DEBUG_OMG False "???") + add_boolean_option(XFORMS False "This adds the possibility to see the signal oscilloscope") + add_boolean_option(PRINT_STATS False "This adds the possibility to see the status") + add_boolean_option(T_TRACER False "Activate the T tracer, a debugging/monitoring framework" ) ++add_boolean_option(UE_AUTOTEST_TRACE False "Activate UE autotest specific logs") + + add_boolean_option(DEBUG_CONSOLE False "makes debugging easier, disables stdout/stderr buffering") + diff --git a/cmake_targets/autotests/patches/autotest_ue_dlsch_bitrate_metric.patch b/cmake_targets/autotests/patches/autotest_ue_dlsch_bitrate_metric.patch index e8213960e1..b7a7dbfa02 100644 --- a/cmake_targets/autotests/patches/autotest_ue_dlsch_bitrate_metric.patch +++ b/cmake_targets/autotests/patches/autotest_ue_dlsch_bitrate_metric.patch @@ -1,18 +1,17 @@ diff --git a/openair1/SCHED/phy_procedures_lte_ue.c b/openair1/SCHED/phy_procedures_lte_ue.c -index 3ed4c79..da88000 100644 +index 3ed4c79..6023886 100644 --- a/openair1/SCHED/phy_procedures_lte_ue.c +++ b/openair1/SCHED/phy_procedures_lte_ue.c -@@ -2944,6 +2944,14 @@ int phy_procedures_UE_RX(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uin +@@ -2944,6 +2944,13 @@ int phy_procedures_UE_RX(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uin LOG_D(PHY,"[UE %d] Calculating bitrate Frame %d: total_TBS = %d, total_TBS_last = %d, bitrate %f kbits\n", ue->Mod_id,frame_rx,ue->total_TBS[eNB_id], ue->total_TBS_last[eNB_id],(float) ue->bitrate[eNB_id]/1000.0); + -+ /* SYRTEM */ ++ #if UE_AUTOTEST_TRACE + if ((frame_rx % 100 == 0)) { -+ printf("AUTOTEST Metric : UE_DLSCH_BITRATE = %5.2f kbps (frame = %d) \n", (float) ue->bitrate[eNB_id]/1000.0, frame_rx); -+ /* End of SYRTEM */ ++ LOG_I(PHY,"[UE %d] AUTOTEST Metric : UE_DLSCH_BITRATE = %5.2f kbps (frame = %d) \n", ue->Mod_id, (float) ue->bitrate[eNB_id]/1000.0, frame_rx); + } -+ ++ #endif + } diff --git a/cmake_targets/autotests/patches/autotest_ue_offsets_metric.patch b/cmake_targets/autotests/patches/autotest_ue_offsets_metric.patch new file mode 100644 index 0000000000..3fca1a70fd --- /dev/null +++ b/cmake_targets/autotests/patches/autotest_ue_offsets_metric.patch @@ -0,0 +1,31 @@ +diff --git a/openair1/SCHED/phy_procedures_lte_ue.c b/openair1/SCHED/phy_procedures_lte_ue.c +index 3ed4c79..7185e5a 100644 +--- a/openair1/SCHED/phy_procedures_lte_ue.c ++++ b/openair1/SCHED/phy_procedures_lte_ue.c +@@ -2748,7 +2748,25 @@ int phy_procedures_UE_RX(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uin + 0); + + // first slot has been processed (FFTs + Channel Estimation, PCFICH/PHICH/PDCCH) +- ++ ++ /* SYRTEM */ ++ if ( (frame_rx % 10 == 0) && (subframe_rx == 0)) { ++ printf("AUTOTEST Metric : UE_FREQ_OFFSET = %d Hz (frame = %d) \n", ue->common_vars.freq_offset, frame_rx); ++ printf("AUTOTEST Metric : UE_RX_OFFSET = %d (frame = %d) \n", ue->rx_offset, frame_rx); ++ ++ printf("AUTOTEST Metric : RRC Measurments RSRP[0] %.2f dBm/RE, RSSI %.2f dBm, RSRQ[0] %.2f dB, N0 %d dBm/RE, NF %.1f dB (frame = %d)\n", ++ 10*log10(ue->measurements.rsrp[0])-ue->rx_total_gain_dB, ++ 10*log10(ue->measurements.rssi)-ue->rx_total_gain_dB, ++ 10*log10(ue->measurements.rsrq[0]), ++ ue->measurements.n0_power_tot_dBm, ++ (double)ue->measurements.n0_power_tot_dBm+132.24, ++ frame_rx); ++ } ++ ++ ++ ++ ++ + // do procedures for C-RNTI + if (ue->dlsch[eNB_id][0]->active == 1) { + ue_pdsch_procedures(ue, diff --git a/cmake_targets/autotests/patches/build_oai.patch b/cmake_targets/autotests/patches/build_oai.patch new file mode 100644 index 0000000000..d6cecda6e5 --- /dev/null +++ b/cmake_targets/autotests/patches/build_oai.patch @@ -0,0 +1,40 @@ +diff --git a/cmake_targets/build_oai b/cmake_targets/build_oai +index b77a9ba..8e3021d 100755 +--- a/cmake_targets/build_oai ++++ b/cmake_targets/build_oai +@@ -53,6 +53,7 @@ BUILD_DOXYGEN=0 + T_TRACER="False" + DISABLE_HARDWARE_DEPENDENCY="False" + CMAKE_BUILD_TYPE="" ++UE_AUTOTEST_TRACE="False" + trap handle_ctrl_c INT + + function print_help() { +@@ -127,6 +128,8 @@ Options + Enables the T tracer. + --disable-hardware-dependency + Disable HW dependency during installation ++--ue-autotest-trace ++ Enable specific traces for UE autotest framework + Usage (first build): + oaisim (eNB + UE): ./build_oai -I --oaisim -x --install-system-files + Eurecom EXMIMO + COTS UE : ./build_oai -I --eNB -x --install-system-files +@@ -278,6 +281,10 @@ function main() { + echo_info "Disabling hardware dependency for compiling software" + DISABLE_HARDWARE_DEPENDENCY="True" + shift 1;; ++ --ue-autotest-trace) ++ UE_AUTOTEST_TRACE="True" ++ echo_info "Enabling autotest specific trace for UE" ++ shift 1;; + -h | --help) + print_help + exit 1;; +@@ -447,6 +454,7 @@ function main() { + echo "set (DEADLINE_SCHEDULER \"${DEADLINE_SCHEDULER_FLAG_USER}\" )" >>$cmake_file + echo "set (CPU_AFFINITY \"${CPU_AFFINITY_FLAG_USER}\" )" >>$cmake_file + echo "set ( T_TRACER $T_TRACER )" >> $cmake_file ++ echo "set (UE_AUTOTEST_TRACE $UE_AUTOTEST_TRACE)" >> $cmake_file + echo 'include(${CMAKE_CURRENT_SOURCE_DIR}/../CMakeLists.txt)' >> $cmake_file + cd $DIR/$lte_build_dir/build + cmake .. diff --git a/cmake_targets/autotests/testsuite_ue_noS1.xml b/cmake_targets/autotests/testsuite_ue_noS1.xml index c2f87b881f..19b945dc28 100644 --- a/cmake_targets/autotests/testsuite_ue_noS1.xml +++ b/cmake_targets/autotests/testsuite_ue_noS1.xml @@ -2,11 +2,11 @@ imb182-desktop yanbo-M4HM87P-00 /mnt/sradio/TEST_RESULTS/ - https://gitlab.eurecom.fr/oai1B/openairinterface5g.git - + + https://gitlab.eurecom.fr/oai/openairinterface5g.git --> https://gitlab.eurecom.fr/oai/openair-cn.git --> - develop1B + Enhancement-142-OAI_UE_autotest_framework From 6e21152facb0eb5b6498ec59d9af1aa69b5bb7a4 Mon Sep 17 00:00:00 2001 From: GabrirelCouturier Date: Mon, 28 Nov 2016 10:21:01 +0100 Subject: [PATCH 300/349] [OAI-UE] fixes for issue#35 issue#36 issue#37 1-issue#35: miss dci detection 2-issue#36: ack/nack on pusch are badly encoded 3-issue#37: ack/nack are sent on pucch instead of pusch --- openair1/PHY/CODING/lte_segmentation.c | 2 +- openair1/PHY/LTE_TRANSPORT/dci.c | 8 ++-- openair1/PHY/LTE_TRANSPORT/dci_tools.c | 14 +++++- openair1/PHY/LTE_TRANSPORT/phich.c | 5 ++- openair1/PHY/LTE_TRANSPORT/ulsch_coding.c | 2 +- openair1/SCHED/phy_procedures_lte_ue.c | 53 +++++++++++++++++++---- 6 files changed, 65 insertions(+), 19 deletions(-) diff --git a/openair1/PHY/CODING/lte_segmentation.c b/openair1/PHY/CODING/lte_segmentation.c index 746344a6ac..04056c4c9e 100644 --- a/openair1/PHY/CODING/lte_segmentation.c +++ b/openair1/PHY/CODING/lte_segmentation.c @@ -60,7 +60,7 @@ int lte_segmentation(unsigned char *input_buffer, } if ((*C)>MAX_NUM_DLSCH_SEGMENTS) { - msg("lte_segmentation.c: too many segments %d\n",*C); + LOG_E(PHY,"lte_segmentation.c: too many segments %d, B %d, L %d, Bprime %d\n",*C,B,L,Bprime); return(-1); } diff --git a/openair1/PHY/LTE_TRANSPORT/dci.c b/openair1/PHY/LTE_TRANSPORT/dci.c index bd2f162312..38cfc2c8c9 100644 --- a/openair1/PHY/LTE_TRANSPORT/dci.c +++ b/openair1/PHY/LTE_TRANSPORT/dci.c @@ -3248,7 +3248,7 @@ uint16_t dci_decoding_procedure(PHY_VARS_UE *ue, SI_RNTI, ra_rnti, P_RNTI, - 3, + 0, format1A, format1A, format1A, @@ -3277,7 +3277,7 @@ uint16_t dci_decoding_procedure(PHY_VARS_UE *ue, SI_RNTI, ra_rnti, P_RNTI, - 2, + 1, format1A, format1A, format1A, @@ -3310,7 +3310,7 @@ uint16_t dci_decoding_procedure(PHY_VARS_UE *ue, SI_RNTI, ra_rnti, P_RNTI, - 1, + 2, format1A, format1A, format1A, @@ -3339,7 +3339,7 @@ uint16_t dci_decoding_procedure(PHY_VARS_UE *ue, SI_RNTI, ra_rnti, P_RNTI, - 0, + 3, format1A, format1A, format1A, diff --git a/openair1/PHY/LTE_TRANSPORT/dci_tools.c b/openair1/PHY/LTE_TRANSPORT/dci_tools.c index 107fa042a6..92836ebcf9 100644 --- a/openair1/PHY/LTE_TRANSPORT/dci_tools.c +++ b/openair1/PHY/LTE_TRANSPORT/dci_tools.c @@ -4456,6 +4456,7 @@ int generate_ue_dlsch_params_from_dci(int frame, dlsch0_harq->status = ACTIVE; dlsch0_harq->DCINdi = ndi; + dlsch[0]->harq_ack[subframe].send_harq_status = 1; if (dlsch0_harq->first_tx==1) { LOG_D(PHY,"[PDSCH %x/%d] Format 1 DCI First TX: Clearing flag\n"); dlsch0_harq->first_tx = 0; @@ -5556,7 +5557,7 @@ int generate_ue_dlsch_params_from_dci(int frame, #ifdef DEBUG_DCI if (dlsch[0] && (dlsch[0]->rnti != 0xffff)) { - printf("dci_format:%d \n",dci_format); + printf("dci_format:%d Abssubframe: %d.%d \n",dci_format,frame,subframe); printf("PDSCH dlsch0 UE: rnti %x\n",dlsch[0]->rnti); printf("PDSCH dlsch0 UE: NBRB %d\n",dlsch0_harq->nb_rb); printf("PDSCH dlsch0 UE: rballoc %x\n",dlsch0_harq->rb_alloc_even[0]); @@ -6231,13 +6232,22 @@ int generate_ue_ulsch_params_from_dci(void *dci_pdu, uint8_t harq_pid; uint8_t transmission_mode = ue->transmission_mode[eNB_id]; - ANFBmode_t AckNackFBMode = ue->pucch_config_dedicated[eNB_id].tdd_AckNackFeedbackMode; + ANFBmode_t AckNackFBMode; LTE_UE_ULSCH_t *ulsch = ue->ulsch[eNB_id]; // LTE_UE_DLSCH_t **dlsch = ue->dlsch[0]; PHY_MEASUREMENTS *meas = &ue->measurements; LTE_DL_FRAME_PARMS *frame_parms = &ue->frame_parms; // uint32_t current_dlsch_cqi = ue->current_dlsch_cqi[eNB_id]; + if(frame_parms->frame_type == TDD) + { + AckNackFBMode = ue->pucch_config_dedicated[eNB_id].tdd_AckNackFeedbackMode; + } + else + { + AckNackFBMode = 1; // 1: multiplexing for FDD + } + uint32_t cqi_req; uint32_t dai=0; uint32_t cshift; diff --git a/openair1/PHY/LTE_TRANSPORT/phich.c b/openair1/PHY/LTE_TRANSPORT/phich.c index 2d07ba948a..9a32876602 100644 --- a/openair1/PHY/LTE_TRANSPORT/phich.c +++ b/openair1/PHY/LTE_TRANSPORT/phich.c @@ -1050,7 +1050,6 @@ void generate_phich(LTE_DL_FRAME_PARMS *frame_parms, // This routine demodulates the PHICH and updates PUSCH/ULSCH parameters - void rx_phich(PHY_VARS_UE *ue, UE_rxtx_proc_t *proc, uint8_t subframe, @@ -1085,8 +1084,10 @@ void rx_phich(PHY_VARS_UE *ue, if (!ulsch) return; + LOG_D(PHY,"[UE %d][PUSCH %d] Frame %d subframe %d PHICH RX Status: %d \n",ue->Mod_id,harq_pid,proc->frame_rx,subframe, ulsch->harq_processes[harq_pid]->status); + if (ulsch->harq_processes[harq_pid]->status == ACTIVE) { - LOG_D(PHY,"[UE %d][PUSCH %d] Frame %d subframe %d PHICH RX ACTIVE\n",ue->Mod_id,harq_pid,proc->frame_rx,subframe); + LOG_D(PHY,"[UE %d][PUSCH %d] Frame %d subframe %d PHICH RX ACTIVE\n",ue->Mod_id,harq_pid,proc->frame_rx,subframe); Ngroup_PHICH = (frame_parms->phich_config_common.phich_resource*frame_parms->N_RB_DL)/48; if (((frame_parms->phich_config_common.phich_resource*frame_parms->N_RB_DL)%48) > 0) diff --git a/openair1/PHY/LTE_TRANSPORT/ulsch_coding.c b/openair1/PHY/LTE_TRANSPORT/ulsch_coding.c index 6d2d6232cb..fe4e05747a 100644 --- a/openair1/PHY/LTE_TRANSPORT/ulsch_coding.c +++ b/openair1/PHY/LTE_TRANSPORT/ulsch_coding.c @@ -501,7 +501,7 @@ uint32_t ulsch_encoding(uint8_t *a, ulsch->harq_processes[harq_pid]->G = G; /* - LOG_I(PHY,"ULSCH Encoding G %d, Q_RI %d (O_RI%d, Msc_initial %d, Nsymb_initial%d, beta_offset_ri_times8 %d), Q_CQI %d \n",G,Q_RI,ulsch->O_RI,ulsch->harq_processes[harq_pid]->Msc_initial,ulsch->harq_processes[harq_pid]->Nsymb_initial,ulsch->beta_offset_ri_times8,Q_CQI); + LOG_I(PHY,"ULSCH Encoding G %d, Q_RI %d (O_RI%d, Msc_initial %d, Nsymb_initial%d, beta_offset_ri_times8 %d), Q_CQI %d, Q_ACK %d \n",G,Q_RI,ulsch->O_RI,ulsch->harq_processes[harq_pid]->Msc_initial,ulsch->harq_processes[harq_pid]->Nsymb_initial,ulsch->beta_offset_ri_times8,Q_CQI,Q_ACK); LOG_I(PHY,"ULSCH Encoding (Nid_cell %d, rnti %x): harq_pid %d round %d, RV %d, mcs %d, O_RI %d, O_ACK %d, G %d\n", frame_parms->Nid_cell,ulsch->rnti, diff --git a/openair1/SCHED/phy_procedures_lte_ue.c b/openair1/SCHED/phy_procedures_lte_ue.c index 6e7354f883..5dc629b90b 100644 --- a/openair1/SCHED/phy_procedures_lte_ue.c +++ b/openair1/SCHED/phy_procedures_lte_ue.c @@ -61,6 +61,9 @@ fifo_dump_emos_UE emos_dump_UE; # include "intertask_interface.h" #endif +#include "PHY/defs.h" + +#include "PHY/CODING/extern.h" #define DLSCH_RB_ALLOC 0x1fbf // skip DC RB (total 23/25 RBs) #define DLSCH_RB_ALLOC_12 0x0aaa // skip DC RB (total 23/25 RBs) @@ -1026,6 +1029,15 @@ void ulsch_common_procedures(PHY_VARS_UE *ue, UE_rxtx_proc_t *proc) { } #endif #endif + /* + only for debug + LOG_I(PHY,"ul-signal [subframe: %d, ulsch_start %d, TA: %d, rxOffset: %d, timing_advance: %d, hw_timing_advance: %d]\n",subframe_tx, ulsch_start, ue->N_TA_offset, ue->rx_offset, ue->timing_advance, ue->hw_timing_advance); + if( (crash == 1) && (subframe_tx == 0) ) + { + LOG_E(PHY,"***** DUMP TX Signal [ulsch_start %d] *****\n",ulsch_start); + write_output("txBuff.m","txSignal",&ue->common_vars.txdata[aa][ulsch_start],frame_parms->samples_per_tti,1,1); + } + */ } //nb_antennas_tx @@ -1242,6 +1254,27 @@ void ue_ulsch_uespec_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB + + if (ack_status > 0) { + + // check if we received a PDSCH at subframe_tx - 4 + // ==> send ACK/NACK on PUSCH + if( (ue->dlsch[eNB_id][0]->harq_ack[proc->subframe_rx].send_harq_status) == 1) + { + ue->ulsch[eNB_id]->harq_processes[harq_pid]->O_ACK = 1; + } + else + { + ue->ulsch[eNB_id]->harq_processes[harq_pid]->O_ACK = 0; + } + LOG_D(PHY,"[UE %d][PDSCH %x] Frame %d subframe %d Generating ACK (%d,%d) for %d bits on PUSCH\n", + Mod_id, + ue->ulsch[eNB_id]->rnti, + frame_tx,subframe_tx, + ue->ulsch[eNB_id]->o_ACK[0],ue->ulsch[eNB_id]->o_ACK[1], + ue->ulsch[eNB_id]->harq_processes[harq_pid]->O_ACK); + } + #ifdef DEBUG_PHY_PROC LOG_D(PHY, "[UE %d][PUSCH %d] Frame %d subframe %d Generating PUSCH : first_rb %d, nb_rb %d, round %d, mcs %d, rv %d, cyclic_shift %d (cyclic_shift_common %d,n_DMRS2 %d,n_PRS %d), ACK (%d,%d), O_ACK %d\n", @@ -1260,15 +1293,6 @@ void ue_ulsch_uespec_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB ue->ulsch[eNB_id]->harq_processes[harq_pid]->O_ACK); #endif - if (ack_status > 0) { - LOG_D(PHY,"[UE %d][PDSCH %x] Frame %d subframe %d Generating ACK (%d,%d) for %d bits on PUSCH\n", - Mod_id, - ue->ulsch[eNB_id]->rnti, - frame_tx,subframe_tx, - ue->ulsch[eNB_id]->o_ACK[0],ue->ulsch[eNB_id]->o_ACK[1], - ue->ulsch[eNB_id]->harq_processes[harq_pid]->O_ACK); - } - @@ -1535,6 +1559,17 @@ void ue_pucch_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uin ACK/NACK and SR using the shortened PUCCH format. This shortened PUCCH format shall be used in a cell specific SRS subframe even if the UE does not transmit SRS in that subframe */ + + int harq_pid = subframe2harq_pid(&ue->frame_parms, + frame_tx, + subframe_tx); + + if(ue->ulsch[eNB_id]->harq_processes[harq_pid]->subframe_scheduling_flag) + { + LOG_D(PHY,"PUSCH is programmed on this subframe [pid %d] AbsSuframe %d.%d ==> Skip PUCCH transmission \n",harq_pid,frame_tx,subframe_tx); + return; + } + uint8_t isShortenPucch = (pSoundingrs_ul_config_dedicated->srsCellSubframe && frame_parms->soundingrs_ul_config_common.ackNackSRS_SimultaneousTransmission); bundling_flag = ue->pucch_config_dedicated[eNB_id].tdd_AckNackFeedbackMode; From ca2aeaccb87894f36d51a59ac5fb0da90f160d02 Mon Sep 17 00:00:00 2001 From: hbilel Date: Mon, 28 Nov 2016 10:36:46 +0100 Subject: [PATCH 301/349] BSR and MAC multiplexing fixes --- openair2/LAYER2/MAC/defs.h | 8 +- openair2/LAYER2/MAC/ue_procedures.c | 524 ++++++++++++------------- openair2/LAYER2/RLC/AM_v9.3.0/rlc_am.c | 1 + 3 files changed, 261 insertions(+), 272 deletions(-) diff --git a/openair2/LAYER2/MAC/defs.h b/openair2/LAYER2/MAC/defs.h index de9071525d..cb1b2e4917 100644 --- a/openair2/LAYER2/MAC/defs.h +++ b/openair2/LAYER2/MAC/defs.h @@ -133,12 +133,18 @@ /*!\brief maximum value for channel quality indicator */ #define MAX_CQI_VALUE 15 -//if value equal oxFFFF means counters are NOT active +/*!\brief value for indicating BSR Timer is not running */ #define MAC_UE_BSR_TIMER_NOT_RUNNING (0xFFFF) #define LCID_EMPTY 0 #define LCID_NOT_EMPTY 1 +/*!\brief minimum RLC PDU size to be transmitted = min RLC Status PDU or RLC UM PDU SN 5 bits */ +#define MIN_RLC_PDU_SIZE (2) + +/*!\brief minimum MAC data needed for transmitting 1 min RLC PDU size + 1 byte MAC subHeader */ +#define MIN_MAC_HDR_RLC_SIZE (1 + MIN_RLC_PDU_SIZE) + /* * eNB part */ diff --git a/openair2/LAYER2/MAC/ue_procedures.c b/openair2/LAYER2/MAC/ue_procedures.c index a4c77c2cda..c90dd5857c 100644 --- a/openair2/LAYER2/MAC/ue_procedures.c +++ b/openair2/LAYER2/MAC/ue_procedures.c @@ -1245,13 +1245,12 @@ void ue_get_sdu(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_t subf { mac_rlc_status_resp_t rlc_status; - uint8_t dcch_header_len=0,dcch1_header_len=0,dtch_header_len=0,dtch_header_len_last=0; - uint8_t dcch_header_len_tmp=0, dtch_header_len_tmp=0; - //TO DO -// uint8_t total_rlc_pdu_header_len=0, rlc_pdu_header_len_last=0 ; + uint8_t total_rlc_pdu_header_len=0, rlc_pdu_header_len_last=0 ; + uint16_t buflen_remain = 0; uint8_t bsr_len=0,bsr_ce_len=0,bsr_header_len=0; uint8_t phr_header_len=0, phr_ce_len=0,phr_len=0; uint8_t lcid=0; + boolean_t is_lcid_processed = FALSE; uint16_t sdu_lengths[8] = { 0, 0, 0, 0, 0, 0, 0, 0 }; uint8_t sdu_lcids[8] = { 0, 0, 0, 0, 0, 0, 0, 0 }; uint8_t payload_offset=0,num_sdus=0; @@ -1267,7 +1266,6 @@ void ue_get_sdu(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_t subf unsigned short short_padding=0, post_padding=0, padding_len=0; int j; // used for padding // Compute header length - int all_pdu_len; int lcg_id = 0; int lcg_id_bsr_trunc = 0; int highest_priority = 16; @@ -1304,10 +1302,6 @@ void ue_get_sdu(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_t subf } #endif - dcch_header_len=2;//sizeof(SCH_SUBHEADER_SHORT); - dcch1_header_len=2;//sizeof(SCH_SUBHEADER_SHORT); - // hypo length,in case of long header skip the padding byte - dtch_header_len=(buflen > 128 ) ? 3 : 2 ; //sizeof(SCH_SUBHEADER_LONG)-1 : sizeof(SCH_SUBHEADER_SHORT); bsr_header_len = 0; phr_header_len = 1;//sizeof(SCH_SUBHEADER_FIXED); @@ -1385,258 +1379,233 @@ void ue_get_sdu(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_t subf // check for UL bandwidth requests and add SR control element // Check for DCCH first +// TO DO: Unrool the loop to do it at least once to avoid the if num_sdu +for (lcid=DCCH; lcid < DTCH ; lcid++) { + if (UE_mac_inst[module_idP].scheduling_info.LCID_status[lcid] == LCID_NOT_EMPTY) { - if (UE_mac_inst[module_idP].scheduling_info.LCID_status[DCCH] == LCID_NOT_EMPTY) { + is_lcid_processed = FALSE; - //It is not necessary to get RLC status again, it was done in ue_scheduler and stored - //for sanity keep it and check, to be removed if OK - rlc_status = mac_rlc_status_ind(module_idP, - UE_mac_inst[module_idP].crnti, - eNB_index, - frameP, - ENB_FLAG_NO, - MBMS_FLAG_NO, // eNB_index - DCCH, - (buflen-dcch_header_len-bsr_len-phr_len)); + //Multiplex all available DCCH RLC PDUs considering to multiplex the last PDU each time for maximize the data + //Adjust at the end of the loop + while ((!is_lcid_processed) && (bsr_len + phr_len + total_rlc_pdu_header_len + rlc_pdu_header_len_last + sdu_length_total + MIN_MAC_HDR_RLC_SIZE <= buflen)) { - AssertFatal ( UE_mac_inst[module_idP].scheduling_info.LCID_buffer_remain[DCCH] >= rlc_status.bytes_in_buffer, "Inconsistent BO! for LCID=%d MAC=%d RLC=%d\n", - DCCH,UE_mac_inst[module_idP].scheduling_info.LCID_buffer_remain[DCCH],rlc_status.bytes_in_buffer); + buflen_remain = buflen - (bsr_len + phr_len + total_rlc_pdu_header_len + rlc_pdu_header_len_last + sdu_length_total + 1); - LOG_D(MAC, "[UE %d] Frame %d : UL-DCCH -> ULSCH, RLC SRB1 has %d bytes to " - "send (Transport Block size %d BSR size=%d PHR=%d SDU Length Total %d , mac header len %d BSR byte before Tx=%d)\n", - module_idP,frameP, UE_mac_inst[module_idP].scheduling_info.LCID_buffer_remain[DCCH],buflen,bsr_len,phr_len,sdu_length_total,dcch_header_len,UE_mac_inst[module_idP].scheduling_info.BSR_bytes[UE_mac_inst[module_idP].scheduling_info.LCGID[DCCH]]); + rlc_status = mac_rlc_status_ind(module_idP, + UE_mac_inst[module_idP].crnti, + eNB_index, + frameP, + ENB_FLAG_NO, + MBMS_FLAG_NO, // eNB_index + lcid, + buflen_remain); + + AssertFatal ( UE_mac_inst[module_idP].scheduling_info.LCID_buffer_remain[lcid] >= rlc_status.bytes_in_buffer, "Inconsistent BO! for LCID=%d MAC=%d RLC=%d\n", + lcid,UE_mac_inst[module_idP].scheduling_info.LCID_buffer_remain[lcid],rlc_status.bytes_in_buffer); + + if (rlc_status.bytes_in_buffer > 0) { - sdu_lengths[0] += mac_rlc_data_req(module_idP, - UE_mac_inst[module_idP].crnti, - eNB_index, - frameP, - ENB_FLAG_NO, - MBMS_FLAG_NO, - DCCH, - (char *)&ulsch_buff[sdu_lengths[0]]); + LOG_D(MAC, "[UE %d] Frame %d : UL-DCCH -> ULSCH, RLC SRB%d has %d bytes to " + "send (Transport Block size %d BSR size=%d PHR=%d SDU Length Total %d , mac header len %d BSR byte before Tx=%d)\n", + module_idP,frameP, lcid,UE_mac_inst[module_idP].scheduling_info.LCID_buffer_remain[lcid],buflen,bsr_len,phr_len,sdu_length_total,total_rlc_pdu_header_len,UE_mac_inst[module_idP].scheduling_info.BSR_bytes[UE_mac_inst[module_idP].scheduling_info.LCGID[lcid]]); - AssertFatal (UE_mac_inst[module_idP].scheduling_info.LCID_buffer_remain[DCCH] >= sdu_lengths[0], "LCID=%d RLC has segmented %d bytes but MAC has max=%d\n", - DCCH,sdu_lengths[0],UE_mac_inst[module_idP].scheduling_info.LCID_buffer_remain[DCCH]); + + sdu_lengths[num_sdus] = mac_rlc_data_req(module_idP, + UE_mac_inst[module_idP].crnti, + eNB_index, + frameP, + ENB_FLAG_NO, + MBMS_FLAG_NO, + lcid, + (char *)&ulsch_buff[sdu_length_total]); + + + AssertFatal (UE_mac_inst[module_idP].scheduling_info.LCID_buffer_remain[lcid] >= sdu_lengths[num_sdus], "LCID=%d RLC has segmented %d bytes but MAC has max=%d\n", + lcid,sdu_lengths[num_sdus],UE_mac_inst[module_idP].scheduling_info.LCID_buffer_remain[lcid]); - sdu_length_total += sdu_lengths[0]; - sdu_lcids[0] = DCCH; - LOG_D(MAC,"[UE %d] TX Multiplex RLC PDU TX Got %d bytes for SRB1\n",module_idP,sdu_lengths[0]); - num_sdus = 1; - //header_len +=2; - // update LCID remain buffer - UE_mac_inst[module_idP].scheduling_info.LCID_buffer_remain[DCCH] -= sdu_lengths[0]; - /* Update BSR : substract transmitted data */ - if (UE_mac_inst[module_idP].scheduling_info.BSR_bytes[UE_mac_inst[module_idP].scheduling_info.LCGID[DCCH]] >= sdu_lengths[0]){ - UE_mac_inst[module_idP].scheduling_info.BSR_bytes[UE_mac_inst[module_idP].scheduling_info.LCGID[DCCH]] -= sdu_lengths[0] ; - } - else { - LOG_I(MAC, "[UE %d] Frame %d Subframe%d: WARNING Buffer occupancy =%d for LCGID%d is lower than data transmitted=%d for LCID%d\n", - module_idP,frameP,subframe, - UE_mac_inst[module_idP].scheduling_info.BSR_bytes[UE_mac_inst[module_idP].scheduling_info.LCGID[DCCH]], - UE_mac_inst[module_idP].scheduling_info.LCGID[DCCH], - sdu_lengths[0],DCCH); - UE_mac_inst[module_idP].scheduling_info.BSR_bytes[UE_mac_inst[module_idP].scheduling_info.LCGID[DCCH]] = 0; - } + sdu_length_total += sdu_lengths[num_sdus]; + sdu_lcids[num_sdus] = lcid; + LOG_D(MAC,"[UE %d] TX Multiplex RLC PDU TX Got %d bytes for SRB%d\n",module_idP,sdu_lengths[num_sdus],lcid); + //header_len +=2; + // update LCID remain buffer + UE_mac_inst[module_idP].scheduling_info.LCID_buffer_remain[lcid] -= sdu_lengths[num_sdus]; + /* Update BSR : substract transmitted data */ + if (UE_mac_inst[module_idP].scheduling_info.BSR_bytes[UE_mac_inst[module_idP].scheduling_info.LCGID[lcid]] >= sdu_lengths[num_sdus]){ + UE_mac_inst[module_idP].scheduling_info.BSR_bytes[UE_mac_inst[module_idP].scheduling_info.LCGID[lcid]] -= sdu_lengths[num_sdus] ; + } + else { + LOG_I(MAC, "[UE %d] Frame %d Subframe%d: WARNING Buffer occupancy =%d for LCGID%d is lower than data transmitted=%d for LCID%d\n", + module_idP,frameP,subframe, + UE_mac_inst[module_idP].scheduling_info.BSR_bytes[UE_mac_inst[module_idP].scheduling_info.LCGID[lcid]], + UE_mac_inst[module_idP].scheduling_info.LCGID[lcid], + sdu_lengths[num_sdus],lcid); + UE_mac_inst[module_idP].scheduling_info.BSR_bytes[UE_mac_inst[module_idP].scheduling_info.LCGID[lcid]] = 0; + } - //Update the number of LCGID with data as BSR shall reflect status after BSR transmission - if ((num_lcg_id_with_data > 1) && (UE_mac_inst[module_idP].scheduling_info.BSR_bytes[UE_mac_inst[module_idP].scheduling_info.LCGID[DCCH]] == 0)) - { - num_lcg_id_with_data --; - // Change BSR size to BSR SHORT if num_lcg_id_with_data becomes to 1 - if ((bsr_len) && (num_lcg_id_with_data == 1)) - { - bsr_ce_len = sizeof(BSR_SHORT); - bsr_len = bsr_ce_len + bsr_header_len; - } + //Update the number of LCGID with data as BSR shall reflect status after BSR transmission + if ((num_lcg_id_with_data > 1) && (UE_mac_inst[module_idP].scheduling_info.BSR_bytes[UE_mac_inst[module_idP].scheduling_info.LCGID[lcid]] == 0)) + { + num_lcg_id_with_data --; + // Change BSR size to BSR SHORT if num_lcg_id_with_data becomes to 1 + if ((bsr_len) && (num_lcg_id_with_data == 1)) + { + bsr_ce_len = sizeof(BSR_SHORT); + bsr_len = bsr_ce_len + bsr_header_len; + } - } + } - UE_mac_inst[module_idP].scheduling_info.LCID_status[DCCH] = LCID_EMPTY; + //Update total MAC Header size for RLC PDUs and save last one + total_rlc_pdu_header_len += rlc_pdu_header_len_last; + + if (buflen == (bsr_len + phr_len + total_rlc_pdu_header_len + sdu_length_total + 1)) { + //No more remaining TBS after this PDU + //exit the function + rlc_pdu_header_len_last = 1; + is_lcid_processed = TRUE; + } + else { + rlc_pdu_header_len_last = (sdu_lengths[num_sdus] > 128 ) ? 3 : 2 ; + + //Change to 1 byte if it does not fit in the TBS, ie last PDU + if (buflen <= (bsr_len + phr_len + total_rlc_pdu_header_len + rlc_pdu_header_len_last + sdu_length_total)) { + rlc_pdu_header_len_last = 1; + is_lcid_processed = TRUE; + } + + //Update number of SDU + num_sdus ++; + } + + + } //end if (rlc_status.bytes_in_buffer > 0) + else { + // Switch to next LCID or exit the whole loop + is_lcid_processed = TRUE; + } } - else { - dcch_header_len=0; - num_sdus = 0; - } + + UE_mac_inst[module_idP].scheduling_info.LCID_status[lcid] = LCID_EMPTY; + } +} + + +// Now Check for DTCH first +// TO DO: do it according to Logical Channel Prioritization if at least 2 DTCH +for (lcid=DTCH; lcid < MAX_NUM_LCID ; lcid++) { +if (UE_mac_inst[module_idP].scheduling_info.LCID_status[lcid] == LCID_NOT_EMPTY) { + + is_lcid_processed = FALSE; + + //Multiplex all available DTCH RLC PDUs considering to multiplex the last PDU each time for maximize the data + //Adjust at the end of the loop + while ((!is_lcid_processed) && (bsr_len + phr_len + total_rlc_pdu_header_len + rlc_pdu_header_len_last + sdu_length_total + MIN_MAC_HDR_RLC_SIZE <= buflen)) { + + buflen_remain = buflen - (bsr_len + phr_len + total_rlc_pdu_header_len + rlc_pdu_header_len_last + sdu_length_total + 1); + + rlc_status = mac_rlc_status_ind(module_idP, + UE_mac_inst[module_idP].crnti, + eNB_index, + frameP, + ENB_FLAG_NO, + MBMS_FLAG_NO, // eNB_index + lcid, + buflen_remain); + + AssertFatal ( UE_mac_inst[module_idP].scheduling_info.LCID_buffer_remain[lcid] >= rlc_status.bytes_in_buffer, "Inconsistent BO! for LCID=%d MAC=%d RLC=%d\n", + lcid,UE_mac_inst[module_idP].scheduling_info.LCID_buffer_remain[lcid],rlc_status.bytes_in_buffer); + + if (rlc_status.bytes_in_buffer > 0) { + + + LOG_D(MAC, "[UE %d] Frame %d : UL-DTCH -> ULSCH, RLC LCID%d has %d bytes to " + "send (Transport Block size %d BSR size=%d PHR=%d SDU Length Total %d , mac header len %d BSR byte before Tx=%d)\n", + module_idP,frameP, lcid,UE_mac_inst[module_idP].scheduling_info.LCID_buffer_remain[lcid],buflen,bsr_len,phr_len,sdu_length_total,total_rlc_pdu_header_len,UE_mac_inst[module_idP].scheduling_info.BSR_bytes[UE_mac_inst[module_idP].scheduling_info.LCGID[lcid]]); + + + sdu_lengths[num_sdus] = mac_rlc_data_req(module_idP, + UE_mac_inst[module_idP].crnti, + eNB_index, + frameP, + ENB_FLAG_NO, + MBMS_FLAG_NO, + lcid, + (char *)&ulsch_buff[sdu_length_total]); + + + AssertFatal (UE_mac_inst[module_idP].scheduling_info.LCID_buffer_remain[lcid] >= sdu_lengths[num_sdus], "LCID=%d RLC has segmented %d bytes but MAC has max=%d\n", + lcid,sdu_lengths[num_sdus],UE_mac_inst[module_idP].scheduling_info.LCID_buffer_remain[lcid]); - // if the RLC AM is used, then RLC will only provide 2 bytes for ACK - // in this case, we sould add bsr + sdu_length_total += sdu_lengths[num_sdus]; + sdu_lcids[num_sdus] = lcid; + LOG_D(MAC,"[UE %d] TX Multiplex RLC PDU TX Got %d bytes for LCID%d\n",module_idP,sdu_lengths[num_sdus],lcid); + //header_len +=2; + // update LCID remain buffer + UE_mac_inst[module_idP].scheduling_info.LCID_buffer_remain[lcid] -= sdu_lengths[num_sdus]; + /* Update BSR : substract transmitted data */ + if (UE_mac_inst[module_idP].scheduling_info.BSR_bytes[UE_mac_inst[module_idP].scheduling_info.LCGID[lcid]] >= sdu_lengths[num_sdus]){ + UE_mac_inst[module_idP].scheduling_info.BSR_bytes[UE_mac_inst[module_idP].scheduling_info.LCGID[lcid]] -= sdu_lengths[num_sdus] ; + } + else { + LOG_I(MAC, "[UE %d] Frame %d Subframe%d: WARNING Buffer occupancy =%d for LCGID%d is lower than data transmitted=%d for LCID%d\n", + module_idP,frameP,subframe, + UE_mac_inst[module_idP].scheduling_info.BSR_bytes[UE_mac_inst[module_idP].scheduling_info.LCGID[lcid]], + UE_mac_inst[module_idP].scheduling_info.LCGID[lcid], + sdu_lengths[num_sdus],lcid); + UE_mac_inst[module_idP].scheduling_info.BSR_bytes[UE_mac_inst[module_idP].scheduling_info.LCGID[lcid]] = 0; + } - // DCCH1 - if (UE_mac_inst[module_idP].scheduling_info.LCID_status[DCCH1] == LCID_NOT_EMPTY) { + //Update the number of LCGID with data as BSR shall reflect status after BSR transmission + if ((num_lcg_id_with_data > 1) && (UE_mac_inst[module_idP].scheduling_info.BSR_bytes[UE_mac_inst[module_idP].scheduling_info.LCGID[lcid]] == 0)) + { + num_lcg_id_with_data --; + // Change BSR size to BSR SHORT if num_lcg_id_with_data becomes to 1 + if ((bsr_len) && (num_lcg_id_with_data == 1)) + { + bsr_ce_len = sizeof(BSR_SHORT); + bsr_len = bsr_ce_len + bsr_header_len; + } - //It is not necessary to get RLC status again, it was done in ue_scheduler and stored - //for sanity keep it and check, to be removed if OK - rlc_status = mac_rlc_status_ind(module_idP, - UE_mac_inst[module_idP].crnti, - eNB_index, - frameP, - ENB_FLAG_NO, - MBMS_FLAG_NO, // eNB_index - DCCH1, - (buflen-bsr_len-phr_len-dcch_header_len-dcch1_header_len-sdu_length_total)); + } - AssertFatal ( UE_mac_inst[module_idP].scheduling_info.LCID_buffer_remain[DCCH1] >= rlc_status.bytes_in_buffer, "Inconsistent BO! for LCID=%d MAC=%d RLC=%d\n", - DCCH1,UE_mac_inst[module_idP].scheduling_info.LCID_buffer_remain[DCCH1],rlc_status.bytes_in_buffer); + //Update total MAC Header size for RLC PDUs and save last one + total_rlc_pdu_header_len += rlc_pdu_header_len_last; - LOG_D(MAC,"[UE %d] Frame %d subframe %d: UL-DCCH1 -> ULSCH, RLC SRB2 has %d bytes to" - " send (Transport Block size %d BSR size=%d PHR=%d SRB1 Hdr %d SDU Length Total %d , mac header len %d BSR byte before Tx=%d)\n", - module_idP,frameP, subframe, UE_mac_inst[module_idP].scheduling_info.LCID_buffer_remain[DCCH1],buflen,bsr_len,phr_len,dcch_header_len,sdu_length_total,dcch1_header_len,UE_mac_inst[module_idP].scheduling_info.BSR_bytes[UE_mac_inst[module_idP].scheduling_info.LCGID[DCCH1]]); + if (buflen == (bsr_len + phr_len + total_rlc_pdu_header_len + sdu_length_total + 1)) { + //No more remaining TBS after this PDU + //exit the function + rlc_pdu_header_len_last = 1; + is_lcid_processed = TRUE; + } + else { + rlc_pdu_header_len_last = (sdu_lengths[num_sdus] > 128 ) ? 3 : 2 ; - sdu_lengths[num_sdus] = mac_rlc_data_req(module_idP, - UE_mac_inst[module_idP].crnti, - eNB_index, - frameP, - ENB_FLAG_NO, - MBMS_FLAG_NO, - DCCH1, - (char *)&ulsch_buff[sdu_lengths[num_sdus]]); + //Change to 1 byte if it does not fit in the TBS, ie last PDU + if (buflen <= (bsr_len + phr_len + total_rlc_pdu_header_len + rlc_pdu_header_len_last + sdu_length_total)) { + rlc_pdu_header_len_last = 1; + is_lcid_processed = TRUE; + } - AssertFatal (UE_mac_inst[module_idP].scheduling_info.LCID_buffer_remain[DCCH1] >= sdu_lengths[num_sdus], "LCID=%d RLC has segmented %d bytes but MAC has max=%d\n", - DCCH1,sdu_lengths[num_sdus],UE_mac_inst[module_idP].scheduling_info.LCID_buffer_remain[DCCH1]); + //Update number of SDU + num_sdus ++; + } - sdu_length_total += sdu_lengths[num_sdus]; - sdu_lcids[num_sdus] = DCCH1; - LOG_D(MAC,"[UE %d] TX Multiplex RLC PDU Got %d bytes for SRB2\n",module_idP,sdu_lengths[num_sdus]); - //dcch_header_len +=2; // include dcch1 - UE_mac_inst[module_idP].scheduling_info.LCID_status[DCCH1] = LCID_EMPTY; - UE_mac_inst[module_idP].scheduling_info.LCID_buffer_remain[DCCH1] -= sdu_lengths[num_sdus]; - /* Update BSR : substract transmitted data */ - if (UE_mac_inst[module_idP].scheduling_info.BSR_bytes[UE_mac_inst[module_idP].scheduling_info.LCGID[DCCH1]] >= sdu_lengths[num_sdus]){ - UE_mac_inst[module_idP].scheduling_info.BSR_bytes[UE_mac_inst[module_idP].scheduling_info.LCGID[DCCH1]] -= sdu_lengths[num_sdus]; - } - else { - LOG_I(MAC, "[UE %d] Frame %d Subframe%d: WARNING Buffer occupancy =%d for LCGID%d is lower than data transmitted=%d for LCID%d\n", - module_idP,frameP,subframe, - UE_mac_inst[module_idP].scheduling_info.BSR_bytes[UE_mac_inst[module_idP].scheduling_info.LCGID[DCCH1]], - UE_mac_inst[module_idP].scheduling_info.LCGID[DCCH1], - sdu_lengths[num_sdus],DCCH1); - UE_mac_inst[module_idP].scheduling_info.BSR_bytes[UE_mac_inst[module_idP].scheduling_info.LCGID[DCCH1]] = 0; - } + } //end if (rlc_status.bytes_in_buffer > 0) + else { + // Switch to next LCID or exit the whole loop + is_lcid_processed = TRUE; + } + } - //Update the number of LCGID with data as BSR shall reflect status after BSR transmission - if ((num_lcg_id_with_data > 1) && (UE_mac_inst[module_idP].scheduling_info.BSR_bytes[UE_mac_inst[module_idP].scheduling_info.LCGID[DCCH1]] == 0)) - { - num_lcg_id_with_data --; - // Change BSR size to BSR SHORT if num_lcg_id_with_data becomes to 1 - if ((bsr_len) && (num_lcg_id_with_data == 1)) - { - bsr_ce_len = sizeof(BSR_SHORT); - bsr_len = bsr_ce_len + bsr_header_len; - } - } - - num_sdus++; - - } else { - dcch1_header_len =0; - } - - - dtch_header_len=0; - dtch_header_len_last=0; - for (lcid=DTCH; lcid < MAX_NUM_LCID ; lcid++){ - dtch_header_len+=3; - dtch_header_len_last=3; - - all_pdu_len = bsr_len+phr_len+dcch_header_len+dcch1_header_len+dtch_header_len+sdu_length_total; - if ((UE_mac_inst[module_idP].scheduling_info.LCID_status[lcid] == LCID_NOT_EMPTY) && - (all_pdu_len <= buflen)) { - - AssertFatal (UE_mac_inst[module_idP].logicalChannelConfig[lcid] != NULL, "LCID (%d) is not active!\n", lcid); - - // optimize the dtch header lenght - //if ((UE_mac_inst[module_idP].scheduling_info.BSR_bytes[DTCH] > 128) && - /* if (((UE_mac_inst[module_idP].scheduling_info.BSR_bytes[DTCH] >= 128) && - ((UE_mac_inst[module_idP].scheduling_info.BSR_bytes[DTCH]+bsr_len+phr_len+dcch_header_len+dcch1_header_len+dtch_header_len) > buflen)&& - buflen >=128 )) - dtch_header_len = 3;//sizeof(SCH_SUBHEADER_LONG); - else - dtch_header_len = 2;//sizeof(SCH_SUBHEADER_SHORT); - */ - //It is not necessary to get RLC status again, it was done in ue_scheduler and stored - //for sanity keep it and check, to be removed if OK - rlc_status = mac_rlc_status_ind(module_idP, - UE_mac_inst[module_idP].crnti, - eNB_index, - frameP, - ENB_FLAG_NO, - MBMS_FLAG_NO, // eNB_index - lcid, - buflen-all_pdu_len); - - AssertFatal ( UE_mac_inst[module_idP].scheduling_info.LCID_buffer_remain[lcid] >= rlc_status.bytes_in_buffer, "Inconsistent BO! for LCID=%d MAC=%d RLC=%d\n", - lcid,UE_mac_inst[module_idP].scheduling_info.LCID_buffer_remain[lcid],rlc_status.bytes_in_buffer); - - LOG_D(MAC,"[UE %d] Frame %d subframe %d: UL-DTCH -> ULSCH%d, %d bytes to send (Transport Block size %d, mac header len %d, BSR byte before Tx=%d)\n", - module_idP,frameP, subframe,lcid, rlc_status.bytes_in_buffer,buflen,dtch_header_len, UE_mac_inst[module_idP].scheduling_info.BSR_bytes[UE_mac_inst[module_idP].scheduling_info.LCGID[lcid]]); - - if (rlc_status.bytes_in_buffer > 0) { - - sdu_lengths[num_sdus] = mac_rlc_data_req(module_idP, - UE_mac_inst[module_idP].crnti, - eNB_index, - frameP, - ENB_FLAG_NO, - MBMS_FLAG_NO, // eNB_index - lcid, - (char *)&ulsch_buff[sdu_length_total]); - - AssertFatal (UE_mac_inst[module_idP].scheduling_info.LCID_buffer_remain[lcid] >= sdu_lengths[num_sdus], "LCID=%d RLC has segmented %d bytes but MAC has max=%d\n", - lcid,sdu_lengths[num_sdus],UE_mac_inst[module_idP].scheduling_info.LCID_buffer_remain[lcid]); - - - //adjust dtch header - LOG_D(MAC,"[UE %d] Frame %d Subframe %d TX Got %d bytes for DTCH%d New BSR bytes=%d\n",module_idP,frameP,subframe,sdu_lengths[num_sdus],lcid,UE_mac_inst[module_idP].scheduling_info.BSR_bytes[UE_mac_inst[module_idP].scheduling_info.LCGID[lcid]]); - sdu_lcids[num_sdus] = lcid; - sdu_length_total += sdu_lengths[num_sdus]; - if (sdu_lengths[num_sdus] < 128) { - dtch_header_len --; - dtch_header_len_last --; - } - - /* Update BSR : substract transmitted data */ - UE_mac_inst[module_idP].scheduling_info.LCID_buffer_remain[lcid] -= sdu_lengths[num_sdus]; - if (UE_mac_inst[module_idP].scheduling_info.BSR_bytes[UE_mac_inst[module_idP].scheduling_info.LCGID[lcid]] >= sdu_lengths[num_sdus]){ - UE_mac_inst[module_idP].scheduling_info.BSR_bytes[UE_mac_inst[module_idP].scheduling_info.LCGID[lcid]] -= sdu_lengths[num_sdus]; - } - else { - LOG_I(MAC, "[UE %d] Frame %d Subframe %d: WARNING Buffer occupancy =%d for LCGID%d is lower than data transmitted=%d for LCID%d\n", - module_idP,frameP,subframe, - UE_mac_inst[module_idP].scheduling_info.BSR_bytes[UE_mac_inst[module_idP].scheduling_info.LCGID[lcid]], - UE_mac_inst[module_idP].scheduling_info.LCGID[lcid], - sdu_lengths[num_sdus],lcid); - UE_mac_inst[module_idP].scheduling_info.BSR_bytes[UE_mac_inst[module_idP].scheduling_info.LCGID[lcid]] = 0; - } - - //Update the number of LCGID with data as BSR shall reflect status after BSR transmission - if ((num_lcg_id_with_data > 1) && (UE_mac_inst[module_idP].scheduling_info.BSR_bytes[UE_mac_inst[module_idP].scheduling_info.LCGID[lcid]] == 0)) - { - num_lcg_id_with_data --; - // Change BSR size to BSR SHORT if num_lcg_id_with_data becomes to 1 - if ((bsr_len) && (num_lcg_id_with_data == 1)) - { - bsr_ce_len = sizeof(BSR_SHORT); - bsr_len = bsr_ce_len + bsr_header_len; - } - } - - - num_sdus++; - - } else { - dtch_header_len -= 3; - } - UE_mac_inst[module_idP].scheduling_info.LCID_status[lcid] = LCID_EMPTY; - } else { // no rlc pdu : generate the dummy header - dtch_header_len -= 3; - } - } + UE_mac_inst[module_idP].scheduling_info.LCID_status[lcid] = LCID_EMPTY; + } +} //lcgid= get_bsr_lcgid(module_idP); @@ -1687,28 +1656,22 @@ void ue_get_sdu(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_t subf LOG_T(MAC,"[UE %d] Frame %d: bsr s %p bsr_l %p, phr_p %p\n", module_idP,frameP,bsr_s, bsr_l, phr_p); - if (dtch_header_len == 0 ) - dtch_header_len_last =0; - - // adjust the header length - dcch_header_len_tmp = dcch_header_len; - dtch_header_len_tmp = dtch_header_len; - - if (dtch_header_len==0) { - dcch_header_len = (dcch_header_len>0)? 1: dcch_header_len; - } else { - dtch_header_len_last-=1; - dtch_header_len= (dtch_header_len >0)? dtch_header_len - dtch_header_len_last : dtch_header_len; - } // Check BSR padding: it is done after PHR according to Logical Channel Prioritization order + // Check for max padding size, ie MAC Hdr for last RLC PDU = 1 /* For Padding BSR: - if the number of padding bits is equal to or larger than the size of the Short BSR plus its subheader but smaller than the size of the Long BSR plus its subheader: - if more than one LCG has data available for transmission in the TTI where the BSR is transmitted: report Truncated BSR of the LCG with the highest priority logical channel with data available for transmission; - else report Short BSR. - else if the number of padding bits is equal to or larger than the size of the Long BSR plus its subheader, report Long BSR. */ - padding_len = buflen-bsr_len-phr_len-dcch_header_len-dcch1_header_len-dtch_header_len-sdu_length_total; + if (sdu_length_total) { + padding_len = buflen - (bsr_len + phr_len + total_rlc_pdu_header_len + sdu_length_total + 1); + } + else { + padding_len = buflen - (bsr_len + phr_len); + } + if ((padding_len) && (bsr_len == 0)) { @@ -1766,7 +1729,7 @@ void ue_get_sdu(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_t subf bsr_l->Buffer_size2 = UE_mac_inst[module_idP].scheduling_info.BSR[LCGID2]; bsr_l->Buffer_size3 = UE_mac_inst[module_idP].scheduling_info.BSR[LCGID3]; - LOG_D(MAC, "[UE %d] Frame %d BSR Trig=%d report long BSR (level LCGID0 %d,level LCGID1 %d,level LCGID2 %d,level LCGID3 %d)\n", module_idP,frameP, + LOG_I(MAC, "[UE %d] Frame %d BSR Trig=%d report long BSR (level LCGID0 %d,level LCGID1 %d,level LCGID2 %d,level LCGID3 %d)\n", module_idP,frameP, UE_mac_inst[module_idP].BSR_reporting_active, UE_mac_inst[module_idP].scheduling_info.BSR[LCGID0], UE_mac_inst[module_idP].scheduling_info.BSR[LCGID1], @@ -1781,7 +1744,7 @@ void ue_get_sdu(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_t subf bsr_t->LCGID = lcg_id_bsr_trunc; bsr_t->Buffer_size = UE_mac_inst[module_idP].scheduling_info.BSR[lcg_id_bsr_trunc]; - LOG_D(MAC,"[UE %d] Frame %d BSR Trig=%d report TRUNCATED BSR with level %d for LCGID %d\n", + LOG_I(MAC,"[UE %d] Frame %d BSR Trig=%d report TRUNCATED BSR with level %d for LCGID %d\n", module_idP, frameP, UE_mac_inst[module_idP].BSR_reporting_active, UE_mac_inst[module_idP].scheduling_info.BSR[lcg_id_bsr_trunc],lcg_id_bsr_trunc); } @@ -1791,31 +1754,49 @@ void ue_get_sdu(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_t subf bsr_s->LCGID = lcg_id_bsr_trunc; bsr_s->Buffer_size = UE_mac_inst[module_idP].scheduling_info.BSR[lcg_id_bsr_trunc]; - LOG_D(MAC,"[UE %d] Frame %d BSR Trig=%d report SHORT BSR with level %d for LCGID %d\n", + LOG_I(MAC,"[UE %d] Frame %d BSR Trig=%d report SHORT BSR with level %d for LCGID %d\n", module_idP, frameP, UE_mac_inst[module_idP].BSR_reporting_active, UE_mac_inst[module_idP].scheduling_info.BSR[lcg_id_bsr_trunc],lcg_id_bsr_trunc); } } - // 1-bit padding or 2-bit padding special padding subheader - padding_len = buflen-bsr_len-phr_len-dcch_header_len-dcch1_header_len-dtch_header_len-sdu_length_total; +// 1-bit padding or 2-bit padding special padding subheader +// Check for max padding size, ie MAC Hdr for last RLC PDU = 1 + if (sdu_length_total) { + padding_len = buflen - (bsr_len + phr_len + total_rlc_pdu_header_len + sdu_length_total + 1); + } + else { + padding_len = buflen - (bsr_len + phr_len); + } + if (padding_len <= 2) { short_padding = padding_len; // only add padding header post_padding = 0; - } else { + //update total MAC Hdr size for RLC data + if (sdu_length_total) { + rlc_pdu_header_len_last = 1; + total_rlc_pdu_header_len ++; + } + } + else if (sdu_length_total) { + total_rlc_pdu_header_len += rlc_pdu_header_len_last; + post_padding = buflen - (bsr_len + phr_len + total_rlc_pdu_header_len + sdu_length_total + 1); + // If by adding MAC Hdr for last RLC PDU the padding is 0 then set MAC Hdr for last RLC PDU = 1 and compute 1 or 2 byte padding + if (post_padding == 0) { + total_rlc_pdu_header_len -= rlc_pdu_header_len_last; + padding_len = buflen - (bsr_len + phr_len + total_rlc_pdu_header_len + sdu_length_total + 1); + short_padding = padding_len; + total_rlc_pdu_header_len ++; + } + } + else { if (padding_len == buflen) {// nona mac pdu *access_mode=CANCELED_ACCESS; } short_padding = 0; - if (dtch_header_len==0) { - dcch_header_len = dcch_header_len_tmp; - } else { - dtch_header_len= dtch_header_len_tmp; - } - - post_padding = buflen-bsr_len-phr_len-dcch_header_len-dcch1_header_len-dtch_header_len-sdu_length_total -1 ; + post_padding = buflen - (bsr_len + phr_len + total_rlc_pdu_header_len + sdu_length_total + 1); } // Generate header @@ -1834,11 +1815,13 @@ void ue_get_sdu(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_t subf post_padding); // long_bsr LOG_D(MAC, - "[UE %d] Generate header :bufflen %d sdu_length_total %d, num_sdus %d, sdu_lengths[0] %d, sdu_lcids[0] %d => payload offset %d, dcch_header_len %d, dtch_header_len %d, padding %d,post_padding %d, bsr len %d, phr len %d, reminder %d \n", - module_idP,buflen, sdu_length_total,num_sdus,sdu_lengths[0],sdu_lcids[0],payload_offset, dcch_header_len, dtch_header_len, + "[UE %d] Generate header :bufflen %d sdu_length_total %d, num_sdus %d, sdu_lengths[0] %d, sdu_lcids[0] %d => payload offset %d, total_rlc_pdu_header_len %d, padding %d,post_padding %d, bsr len %d, phr len %d, reminder %d \n", + module_idP,buflen, sdu_length_total,num_sdus,sdu_lengths[0],sdu_lcids[0],payload_offset, total_rlc_pdu_header_len, short_padding,post_padding, bsr_len, phr_len,buflen-sdu_length_total-payload_offset); // cycle through SDUs and place in ulsch_buffer - memcpy(&ulsch_buffer[payload_offset],ulsch_buff,sdu_length_total); + if (sdu_length_total) { + memcpy(&ulsch_buffer[payload_offset],ulsch_buff,sdu_length_total); + } // fill remainder of DLSCH with random data for (j=0; j<(buflen-sdu_length_total-payload_offset); j++) { @@ -1852,10 +1835,13 @@ void ue_get_sdu(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_t subf /* Actions when a BSR is sent */ if (bsr_ce_len) { + LOG_D(MAC,"[UE %d] MAC BSR Sent !! bsr (ce%d,hdr%d) buff_len %d\n", + module_idP, bsr_ce_len, bsr_header_len, buflen); + // Reset ReTx BSR Timer UE_mac_inst[module_idP].scheduling_info.retxBSR_SF = get_sf_retxBSRTimer(UE_mac_inst[module_idP].scheduling_info.retxBSR_Timer); - LOG_I(MAC,"[UE %d] MAC ReTx BSR Timer Reset =%d\n", + LOG_D(MAC,"[UE %d] MAC ReTx BSR Timer Reset =%d\n", UE_mac_inst[module_idP].scheduling_info.retxBSR_SF); // Reset Periodic Timer except when BSR is truncated @@ -1863,15 +1849,11 @@ void ue_get_sdu(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_t subf { UE_mac_inst[module_idP].scheduling_info.periodicBSR_SF = get_sf_periodicBSRTimer(UE_mac_inst[module_idP].scheduling_info.periodicBSR_Timer); - LOG_I(MAC,"[UE %d] MAC Periodic BSR Timer Reset =%d\n", + LOG_D(MAC,"[UE %d] MAC Periodic BSR Timer Reset =%d\n", UE_mac_inst[module_idP].scheduling_info.periodicBSR_SF); } - LOG_I(MAC,"[UE %d] MAC BSR Triggered !! bsr (ce%d,hdr%d) buff_len %d\n", - module_idP, bsr_ce_len, bsr_header_len, buflen); - - // Reset BSR Trigger flags UE_mac_inst[module_idP].BSR_reporting_active = BSR_TRIGGER_NONE; } diff --git a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am.c b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am.c index 85104b940c..ded7dc0783 100644 --- a/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am.c +++ b/openair2/LAYER2/RLC/AM_v9.3.0/rlc_am.c @@ -341,6 +341,7 @@ rlc_am_get_pdus ( if (pdu) { list_add_tail_eurecom (pdu, &rlc_pP->pdus_to_mac_layer); rlc_pP->status_requested = 0; + rlc_pP->status_buffer_occupancy = 0; rlc_am_start_timer_status_prohibit(ctxt_pP, rlc_pP); return; } From 710a246596aee5063facd0106a6935a64edaea12 Mon Sep 17 00:00:00 2001 From: hbilel Date: Mon, 28 Nov 2016 10:55:00 +0100 Subject: [PATCH 302/349] enhance BSR log --- openair2/LAYER2/MAC/ue_procedures.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/openair2/LAYER2/MAC/ue_procedures.c b/openair2/LAYER2/MAC/ue_procedures.c index c90dd5857c..1ba0fa092d 100644 --- a/openair2/LAYER2/MAC/ue_procedures.c +++ b/openair2/LAYER2/MAC/ue_procedures.c @@ -1729,7 +1729,7 @@ if (UE_mac_inst[module_idP].scheduling_info.LCID_status[lcid] == LCID_NOT_EMPTY) bsr_l->Buffer_size2 = UE_mac_inst[module_idP].scheduling_info.BSR[LCGID2]; bsr_l->Buffer_size3 = UE_mac_inst[module_idP].scheduling_info.BSR[LCGID3]; - LOG_I(MAC, "[UE %d] Frame %d BSR Trig=%d report long BSR (level LCGID0 %d,level LCGID1 %d,level LCGID2 %d,level LCGID3 %d)\n", module_idP,frameP, + LOG_I(MAC, "[UE %d] Frame %d subframe %d BSR Trig=%d report long BSR (level LCGID0 %d,level LCGID1 %d,level LCGID2 %d,level LCGID3 %d)\n", module_idP,frameP,subframe, UE_mac_inst[module_idP].BSR_reporting_active, UE_mac_inst[module_idP].scheduling_info.BSR[LCGID0], UE_mac_inst[module_idP].scheduling_info.BSR[LCGID1], @@ -1744,8 +1744,8 @@ if (UE_mac_inst[module_idP].scheduling_info.LCID_status[lcid] == LCID_NOT_EMPTY) bsr_t->LCGID = lcg_id_bsr_trunc; bsr_t->Buffer_size = UE_mac_inst[module_idP].scheduling_info.BSR[lcg_id_bsr_trunc]; - LOG_I(MAC,"[UE %d] Frame %d BSR Trig=%d report TRUNCATED BSR with level %d for LCGID %d\n", - module_idP, frameP, UE_mac_inst[module_idP].BSR_reporting_active, UE_mac_inst[module_idP].scheduling_info.BSR[lcg_id_bsr_trunc],lcg_id_bsr_trunc); + LOG_I(MAC,"[UE %d] Frame %d subframe %d BSR Trig=%d report TRUNCATED BSR with level %d for LCGID %d\n", + module_idP, frameP, subframe, UE_mac_inst[module_idP].BSR_reporting_active, UE_mac_inst[module_idP].scheduling_info.BSR[lcg_id_bsr_trunc],lcg_id_bsr_trunc); } else @@ -1754,8 +1754,8 @@ if (UE_mac_inst[module_idP].scheduling_info.LCID_status[lcid] == LCID_NOT_EMPTY) bsr_s->LCGID = lcg_id_bsr_trunc; bsr_s->Buffer_size = UE_mac_inst[module_idP].scheduling_info.BSR[lcg_id_bsr_trunc]; - LOG_I(MAC,"[UE %d] Frame %d BSR Trig=%d report SHORT BSR with level %d for LCGID %d\n", - module_idP, frameP, UE_mac_inst[module_idP].BSR_reporting_active, UE_mac_inst[module_idP].scheduling_info.BSR[lcg_id_bsr_trunc],lcg_id_bsr_trunc); + LOG_I(MAC,"[UE %d] Frame %d subframe %d BSR Trig=%d report SHORT BSR with level %d for LCGID %d\n", + module_idP, frameP, subframe, UE_mac_inst[module_idP].BSR_reporting_active, UE_mac_inst[module_idP].scheduling_info.BSR[lcg_id_bsr_trunc],lcg_id_bsr_trunc); } } From 28923dc8e27d15839cde227786f896a3ec94bd82 Mon Sep 17 00:00:00 2001 From: Florian Kaltenberger Date: Mon, 28 Nov 2016 13:58:41 +0100 Subject: [PATCH 303/349] fixing bug introduced in 5c5c336300924ed66beb6b4946117314ee8a4b64 --- targets/ARCH/COMMON/common_lib.h | 3 ++- targets/ARCH/EXMIMO/DEFS/openair_device.h | 5 ++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/targets/ARCH/COMMON/common_lib.h b/targets/ARCH/COMMON/common_lib.h index a6c8e43483..a366b54023 100644 --- a/targets/ARCH/COMMON/common_lib.h +++ b/targets/ARCH/COMMON/common_lib.h @@ -44,8 +44,9 @@ #define BBU_LOCAL_RADIO_HEAD 0 #define BBU_REMOTE_RADIO_HEAD 1 +#ifndef MAX_CARDS #define MAX_CARDS 8 - +#endif typedef int64_t openair0_timestamp; typedef volatile int64_t openair0_vtimestamp; diff --git a/targets/ARCH/EXMIMO/DEFS/openair_device.h b/targets/ARCH/EXMIMO/DEFS/openair_device.h index b4916490e2..b22cf1879b 100644 --- a/targets/ARCH/EXMIMO/DEFS/openair_device.h +++ b/targets/ARCH/EXMIMO/DEFS/openair_device.h @@ -24,9 +24,8 @@ // Maximum number of concurrently supported cards -// defined in openair_common_lib.h -//#define MAX_CARDS 16 -//#define INIT_ZEROS {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; +#define MAX_CARDS 16 +#define INIT_ZEROS {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; /** PCIe subsystem configuration Space From b80ce3510e205423e8f2cb4508c74f9f997609c7 Mon Sep 17 00:00:00 2001 From: GabrirelCouturier Date: Mon, 28 Nov 2016 19:27:25 +0100 Subject: [PATCH 304/349] BSR and MAC UL encoding fixes --- openair2/LAYER2/MAC/defs.h | 4 +- openair2/LAYER2/MAC/ue_procedures.c | 166 ++++++++++++++++------------ 2 files changed, 97 insertions(+), 73 deletions(-) diff --git a/openair2/LAYER2/MAC/defs.h b/openair2/LAYER2/MAC/defs.h index cb1b2e4917..86fc367f51 100644 --- a/openair2/LAYER2/MAC/defs.h +++ b/openair2/LAYER2/MAC/defs.h @@ -959,9 +959,9 @@ typedef struct { /// buffer status for each lcgid uint8_t BSR[MAX_NUM_LCGID]; // should be more for mesh topology /// keep the number of bytes in rlc buffer for each lcgid - uint16_t BSR_bytes[MAX_NUM_LCGID]; + int32_t BSR_bytes[MAX_NUM_LCGID]; /// after multiplexing buffer remain for each lcid - uint16_t LCID_buffer_remain[MAX_NUM_LCID]; + int32_t LCID_buffer_remain[MAX_NUM_LCID]; /// sum of all lcid buffer size uint16_t All_lcid_buffer_size_lastTTI; /// buffer status for each lcid diff --git a/openair2/LAYER2/MAC/ue_procedures.c b/openair2/LAYER2/MAC/ue_procedures.c index 1ba0fa092d..0413cfe524 100644 --- a/openair2/LAYER2/MAC/ue_procedures.c +++ b/openair2/LAYER2/MAC/ue_procedures.c @@ -1162,50 +1162,67 @@ unsigned char generate_ulsch_header(uint8_t *mac_header, LOG_T(MAC,"[UE] sdu subheader %d (lcid %d, %d bytes)\n",i,sdu_lcids[i],sdu_lengths[i]); #endif - if ((first_element>0)) { - mac_header_ptr->E = 1; -#ifdef DEBUG_HEADER_PARSING - LOG_D(MAC,"[UE] last subheader : %x (R%d,E%d,LCID%d)\n",*(unsigned char*)mac_header_ptr, - ((SCH_SUBHEADER_FIXED *)mac_header_ptr)->R, - ((SCH_SUBHEADER_FIXED *)mac_header_ptr)->E, - ((SCH_SUBHEADER_FIXED *)mac_header_ptr)->LCID); -#endif - mac_header_ptr+=last_size; - // printf("last_size %d,mac_header_ptr %p\n",last_size,mac_header_ptr); - } else { - first_element=1; - + if ((i == (num_sdus - 1)) && ((short_padding) || (post_padding == 0))) { + if (first_element>0) { + mac_header_ptr->E = 1; + #ifdef DEBUG_HEADER_PARSING + LOG_D(MAC,"[UE] last subheader : %x (R%d,E%d,LCID%d)\n",*(unsigned char*)mac_header_ptr, + ((SCH_SUBHEADER_FIXED *)mac_header_ptr)->R, + ((SCH_SUBHEADER_FIXED *)mac_header_ptr)->E, + ((SCH_SUBHEADER_FIXED *)mac_header_ptr)->LCID); + #endif + mac_header_ptr+=last_size; + } + mac_header_ptr->R = 0; + mac_header_ptr->E = 0; + mac_header_ptr->LCID = sdu_lcids[i]; } + else { + if ((first_element>0)) { + mac_header_ptr->E = 1; + #ifdef DEBUG_HEADER_PARSING + LOG_D(MAC,"[UE] last subheader : %x (R%d,E%d,LCID%d)\n",*(unsigned char*)mac_header_ptr, + ((SCH_SUBHEADER_FIXED *)mac_header_ptr)->R, + ((SCH_SUBHEADER_FIXED *)mac_header_ptr)->E, + ((SCH_SUBHEADER_FIXED *)mac_header_ptr)->LCID); + #endif + mac_header_ptr+=last_size; + // printf("last_size %d,mac_header_ptr %p\n",last_size,mac_header_ptr); + } else { + first_element=1; - if (sdu_lengths[i] < 128) { - ((SCH_SUBHEADER_SHORT *)mac_header_ptr)->R = 0; // 3 - ((SCH_SUBHEADER_SHORT *)mac_header_ptr)->E = 0; - ((SCH_SUBHEADER_SHORT *)mac_header_ptr)->F = 0; - ((SCH_SUBHEADER_SHORT *)mac_header_ptr)->LCID = sdu_lcids[i]; - ((SCH_SUBHEADER_SHORT *)mac_header_ptr)->L = (unsigned char)sdu_lengths[i]; - last_size=2; -#ifdef DEBUG_HEADER_PARSING - LOG_D(MAC,"[UE] short sdu\n"); - LOG_T(MAC,"[UE] last subheader : %x (R%d,E%d,LCID%d,F%d,L%d)\n", - ((uint16_t*)mac_header_ptr)[0], - ((SCH_SUBHEADER_SHORT *)mac_header_ptr)->R, - ((SCH_SUBHEADER_SHORT *)mac_header_ptr)->E, - ((SCH_SUBHEADER_SHORT *)mac_header_ptr)->LCID, - ((SCH_SUBHEADER_SHORT *)mac_header_ptr)->F, - ((SCH_SUBHEADER_SHORT *)mac_header_ptr)->L); -#endif - } else { - ((SCH_SUBHEADER_LONG *)mac_header_ptr)->R = 0; - ((SCH_SUBHEADER_LONG *)mac_header_ptr)->E = 0; - ((SCH_SUBHEADER_LONG *)mac_header_ptr)->F = 1; - ((SCH_SUBHEADER_LONG *)mac_header_ptr)->LCID = sdu_lcids[i]; - ((SCH_SUBHEADER_LONG *)mac_header_ptr)->L_MSB = ((unsigned short) sdu_lengths[i]>>8)&0x7f; - ((SCH_SUBHEADER_LONG *)mac_header_ptr)->L_LSB = (unsigned short) sdu_lengths[i]&0xff; - ((SCH_SUBHEADER_LONG *)mac_header_ptr)->padding = 0x00; - last_size=3; -#ifdef DEBUG_HEADER_PARSING - LOG_D(MAC,"[UE] long sdu\n"); -#endif + } + + if (sdu_lengths[i] < 128) { + ((SCH_SUBHEADER_SHORT *)mac_header_ptr)->R = 0; // 3 + ((SCH_SUBHEADER_SHORT *)mac_header_ptr)->E = 0; + ((SCH_SUBHEADER_SHORT *)mac_header_ptr)->F = 0; + ((SCH_SUBHEADER_SHORT *)mac_header_ptr)->LCID = sdu_lcids[i]; + ((SCH_SUBHEADER_SHORT *)mac_header_ptr)->L = (unsigned char)sdu_lengths[i]; + last_size=2; + #ifdef DEBUG_HEADER_PARSING + LOG_D(MAC,"[UE] short sdu\n"); + LOG_T(MAC,"[UE] last subheader : %x (R%d,E%d,LCID%d,F%d,L%d)\n", + ((uint16_t*)mac_header_ptr)[0], + ((SCH_SUBHEADER_SHORT *)mac_header_ptr)->R, + ((SCH_SUBHEADER_SHORT *)mac_header_ptr)->E, + ((SCH_SUBHEADER_SHORT *)mac_header_ptr)->LCID, + ((SCH_SUBHEADER_SHORT *)mac_header_ptr)->F, + ((SCH_SUBHEADER_SHORT *)mac_header_ptr)->L); + #endif + } else { + ((SCH_SUBHEADER_LONG *)mac_header_ptr)->R = 0; + ((SCH_SUBHEADER_LONG *)mac_header_ptr)->E = 0; + ((SCH_SUBHEADER_LONG *)mac_header_ptr)->F = 1; + ((SCH_SUBHEADER_LONG *)mac_header_ptr)->LCID = sdu_lcids[i]; + ((SCH_SUBHEADER_LONG *)mac_header_ptr)->L_MSB = ((unsigned short) sdu_lengths[i]>>8)&0x7f; + ((SCH_SUBHEADER_LONG *)mac_header_ptr)->L_LSB = (unsigned short) sdu_lengths[i]&0xff; + ((SCH_SUBHEADER_LONG *)mac_header_ptr)->padding = 0x00; + last_size=3; + #ifdef DEBUG_HEADER_PARSING + LOG_D(MAC,"[UE] long sdu\n"); + #endif + } } } @@ -1223,6 +1240,7 @@ unsigned char generate_ulsch_header(uint8_t *mac_header, //mac_header_ptr=last_size; // FIXME: should be ++ } + if ((ce_ptr-mac_header_control_elements) > 0) { memcpy((void*)mac_header_ptr,mac_header_control_elements,ce_ptr-mac_header_control_elements); mac_header_ptr+=(unsigned char)(ce_ptr-mac_header_control_elements); @@ -1249,7 +1267,7 @@ void ue_get_sdu(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_t subf uint16_t buflen_remain = 0; uint8_t bsr_len=0,bsr_ce_len=0,bsr_header_len=0; uint8_t phr_header_len=0, phr_ce_len=0,phr_len=0; - uint8_t lcid=0; + uint8_t lcid=0,lcid_rlc_pdu_count=0; boolean_t is_lcid_processed = FALSE; uint16_t sdu_lengths[8] = { 0, 0, 0, 0, 0, 0, 0, 0 }; uint8_t sdu_lcids[8] = { 0, 0, 0, 0, 0, 0, 0, 0 }; @@ -1384,12 +1402,13 @@ for (lcid=DCCH; lcid < DTCH ; lcid++) { if (UE_mac_inst[module_idP].scheduling_info.LCID_status[lcid] == LCID_NOT_EMPTY) { is_lcid_processed = FALSE; + lcid_rlc_pdu_count = 0; //Multiplex all available DCCH RLC PDUs considering to multiplex the last PDU each time for maximize the data //Adjust at the end of the loop - while ((!is_lcid_processed) && (bsr_len + phr_len + total_rlc_pdu_header_len + rlc_pdu_header_len_last + sdu_length_total + MIN_MAC_HDR_RLC_SIZE <= buflen)) { + while ((!is_lcid_processed) && (bsr_len + phr_len + total_rlc_pdu_header_len + sdu_length_total + MIN_MAC_HDR_RLC_SIZE <= buflen)) { - buflen_remain = buflen - (bsr_len + phr_len + total_rlc_pdu_header_len + rlc_pdu_header_len_last + sdu_length_total + 1); + buflen_remain = buflen - (bsr_len + phr_len + total_rlc_pdu_header_len + sdu_length_total + 1); rlc_status = mac_rlc_status_ind(module_idP, UE_mac_inst[module_idP].crnti, @@ -1400,8 +1419,8 @@ for (lcid=DCCH; lcid < DTCH ; lcid++) { lcid, buflen_remain); - AssertFatal ( UE_mac_inst[module_idP].scheduling_info.LCID_buffer_remain[lcid] >= rlc_status.bytes_in_buffer, "Inconsistent BO! for LCID=%d MAC=%d RLC=%d\n", - lcid,UE_mac_inst[module_idP].scheduling_info.LCID_buffer_remain[lcid],rlc_status.bytes_in_buffer); + AssertFatal ( UE_mac_inst[module_idP].scheduling_info.LCID_buffer_remain[lcid] >= rlc_status.bytes_in_buffer, "Inconsistent BO! for LCID=%d MAC=%d RLC=%d RLC PDU nb=%d Frame %d Subrame %d\n", + lcid,UE_mac_inst[module_idP].scheduling_info.LCID_buffer_remain[lcid],rlc_status.bytes_in_buffer,lcid_rlc_pdu_count,frameP,subframe); if (rlc_status.bytes_in_buffer > 0) { @@ -1458,9 +1477,6 @@ for (lcid=DCCH; lcid < DTCH ; lcid++) { } - //Update total MAC Header size for RLC PDUs and save last one - total_rlc_pdu_header_len += rlc_pdu_header_len_last; - if (buflen == (bsr_len + phr_len + total_rlc_pdu_header_len + sdu_length_total + 1)) { //No more remaining TBS after this PDU //exit the function @@ -1475,17 +1491,20 @@ for (lcid=DCCH; lcid < DTCH ; lcid++) { rlc_pdu_header_len_last = 1; is_lcid_processed = TRUE; } - - //Update number of SDU - num_sdus ++; } + //Update number of SDU + num_sdus ++; + + //Update total MAC Header size for RLC PDUs and save last one + total_rlc_pdu_header_len += rlc_pdu_header_len_last; } //end if (rlc_status.bytes_in_buffer > 0) else { // Switch to next LCID or exit the whole loop is_lcid_processed = TRUE; } + lcid_rlc_pdu_count ++; } UE_mac_inst[module_idP].scheduling_info.LCID_status[lcid] = LCID_EMPTY; @@ -1499,12 +1518,13 @@ for (lcid=DTCH; lcid < MAX_NUM_LCID ; lcid++) { if (UE_mac_inst[module_idP].scheduling_info.LCID_status[lcid] == LCID_NOT_EMPTY) { is_lcid_processed = FALSE; + lcid_rlc_pdu_count = 0; //Multiplex all available DTCH RLC PDUs considering to multiplex the last PDU each time for maximize the data //Adjust at the end of the loop - while ((!is_lcid_processed) && (bsr_len + phr_len + total_rlc_pdu_header_len + rlc_pdu_header_len_last + sdu_length_total + MIN_MAC_HDR_RLC_SIZE <= buflen)) { + while ((!is_lcid_processed) && (bsr_len + phr_len + total_rlc_pdu_header_len + sdu_length_total + MIN_MAC_HDR_RLC_SIZE <= buflen)) { - buflen_remain = buflen - (bsr_len + phr_len + total_rlc_pdu_header_len + rlc_pdu_header_len_last + sdu_length_total + 1); + buflen_remain = buflen - (bsr_len + phr_len + total_rlc_pdu_header_len + sdu_length_total + 1); rlc_status = mac_rlc_status_ind(module_idP, UE_mac_inst[module_idP].crnti, @@ -1515,8 +1535,8 @@ if (UE_mac_inst[module_idP].scheduling_info.LCID_status[lcid] == LCID_NOT_EMPTY) lcid, buflen_remain); - AssertFatal ( UE_mac_inst[module_idP].scheduling_info.LCID_buffer_remain[lcid] >= rlc_status.bytes_in_buffer, "Inconsistent BO! for LCID=%d MAC=%d RLC=%d\n", - lcid,UE_mac_inst[module_idP].scheduling_info.LCID_buffer_remain[lcid],rlc_status.bytes_in_buffer); + AssertFatal ( UE_mac_inst[module_idP].scheduling_info.LCID_buffer_remain[lcid] >= rlc_status.bytes_in_buffer, "Inconsistent BO! for LCID=%d MAC=%d RLC=%d RLC PDU nb=%d Frame %d Subrame %d\n", + lcid,UE_mac_inst[module_idP].scheduling_info.LCID_buffer_remain[lcid],rlc_status.bytes_in_buffer,lcid_rlc_pdu_count,frameP,subframe); if (rlc_status.bytes_in_buffer > 0) { @@ -1535,6 +1555,9 @@ if (UE_mac_inst[module_idP].scheduling_info.LCID_status[lcid] == LCID_NOT_EMPTY) lcid, (char *)&ulsch_buff[sdu_length_total]); + AssertFatal (sdu_lengths[num_sdus] < MAX_ULSCH_PAYLOAD_BYTES, "LCID=%d RLC PDU size = %d is too big\n", + lcid,sdu_lengths[num_sdus]); + AssertFatal (UE_mac_inst[module_idP].scheduling_info.LCID_buffer_remain[lcid] >= sdu_lengths[num_sdus], "LCID=%d RLC has segmented %d bytes but MAC has max=%d\n", lcid,sdu_lengths[num_sdus],UE_mac_inst[module_idP].scheduling_info.LCID_buffer_remain[lcid]); @@ -1573,9 +1596,6 @@ if (UE_mac_inst[module_idP].scheduling_info.LCID_status[lcid] == LCID_NOT_EMPTY) } - //Update total MAC Header size for RLC PDUs and save last one - total_rlc_pdu_header_len += rlc_pdu_header_len_last; - if (buflen == (bsr_len + phr_len + total_rlc_pdu_header_len + sdu_length_total + 1)) { //No more remaining TBS after this PDU //exit the function @@ -1590,17 +1610,20 @@ if (UE_mac_inst[module_idP].scheduling_info.LCID_status[lcid] == LCID_NOT_EMPTY) rlc_pdu_header_len_last = 1; is_lcid_processed = TRUE; } - - //Update number of SDU - num_sdus ++; } + //Update number of SDU + num_sdus ++; + + //Update total MAC Header size for RLC PDUs and save last one + total_rlc_pdu_header_len += rlc_pdu_header_len_last; } //end if (rlc_status.bytes_in_buffer > 0) else { // Switch to next LCID or exit the whole loop is_lcid_processed = TRUE; } + lcid_rlc_pdu_count ++; } UE_mac_inst[module_idP].scheduling_info.LCID_status[lcid] = LCID_EMPTY; @@ -1666,7 +1689,7 @@ if (UE_mac_inst[module_idP].scheduling_info.LCID_status[lcid] == LCID_NOT_EMPTY) - else if the number of padding bits is equal to or larger than the size of the Long BSR plus its subheader, report Long BSR. */ if (sdu_length_total) { - padding_len = buflen - (bsr_len + phr_len + total_rlc_pdu_header_len + sdu_length_total + 1); + padding_len = buflen - (bsr_len + phr_len + total_rlc_pdu_header_len - rlc_pdu_header_len_last + sdu_length_total + 1); } else { padding_len = buflen - (bsr_len + phr_len); @@ -1762,7 +1785,7 @@ if (UE_mac_inst[module_idP].scheduling_info.LCID_status[lcid] == LCID_NOT_EMPTY) // 1-bit padding or 2-bit padding special padding subheader // Check for max padding size, ie MAC Hdr for last RLC PDU = 1 if (sdu_length_total) { - padding_len = buflen - (bsr_len + phr_len + total_rlc_pdu_header_len + sdu_length_total + 1); + padding_len = buflen - (bsr_len + phr_len + total_rlc_pdu_header_len - rlc_pdu_header_len_last + sdu_length_total + 1); } else { padding_len = buflen - (bsr_len + phr_len); @@ -1774,12 +1797,11 @@ if (UE_mac_inst[module_idP].scheduling_info.LCID_status[lcid] == LCID_NOT_EMPTY) post_padding = 0; //update total MAC Hdr size for RLC data if (sdu_length_total) { + total_rlc_pdu_header_len = total_rlc_pdu_header_len - rlc_pdu_header_len_last + 1; rlc_pdu_header_len_last = 1; - total_rlc_pdu_header_len ++; - } + } } else if (sdu_length_total) { - total_rlc_pdu_header_len += rlc_pdu_header_len_last; post_padding = buflen - (bsr_len + phr_len + total_rlc_pdu_header_len + sdu_length_total + 1); // If by adding MAC Hdr for last RLC PDU the padding is 0 then set MAC Hdr for last RLC PDU = 1 and compute 1 or 2 byte padding if (post_padding == 0) { @@ -1824,8 +1846,10 @@ if (UE_mac_inst[module_idP].scheduling_info.LCID_status[lcid] == LCID_NOT_EMPTY) } // fill remainder of DLSCH with random data - for (j=0; j<(buflen-sdu_length_total-payload_offset); j++) { - ulsch_buffer[payload_offset+sdu_length_total+j] = (char)(taus()&0xff); + if (post_padding) { + for (j=0; j<(buflen-sdu_length_total-payload_offset); j++) { + ulsch_buffer[payload_offset+sdu_length_total+j] = (char)(taus()&0xff); + } } LOG_D(MAC,"[UE %d][SR] Gave SDU to PHY, clearing any scheduling request\n", module_idP,payload_offset, sdu_length_total); @@ -2295,7 +2319,7 @@ boolean_t update_bsr(module_id_t module_idP, frame_t frameP, sub_frame_t subfra uint8_t lcgid; uint8_t num_lcid_with_data = 0; // for LCID with data only if LCGID is defined uint16_t lcgid_buffer_remain[MAX_NUM_LCGID] = {0,0,0,0}; - uint16_t lcid_bytes_in_buffer[MAX_NUM_LCID]; + int32_t lcid_bytes_in_buffer[MAX_NUM_LCID]; /* Array for ordering LCID with data per decreasing priority order */ uint8_t lcid_reordered_array[MAX_NUM_LCID]= {MAX_NUM_LCID,MAX_NUM_LCID,MAX_NUM_LCID,MAX_NUM_LCID,MAX_NUM_LCID,MAX_NUM_LCID,MAX_NUM_LCID,MAX_NUM_LCID,MAX_NUM_LCID,MAX_NUM_LCID,MAX_NUM_LCID}; From ea7c0e1b36656de02bf1185ab9cd77786e0cd143 Mon Sep 17 00:00:00 2001 From: hbilel Date: Tue, 29 Nov 2016 15:26:57 +0100 Subject: [PATCH 305/349] reduce BSR logging --- openair2/LAYER2/MAC/ue_procedures.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/openair2/LAYER2/MAC/ue_procedures.c b/openair2/LAYER2/MAC/ue_procedures.c index 0413cfe524..28520802c7 100644 --- a/openair2/LAYER2/MAC/ue_procedures.c +++ b/openair2/LAYER2/MAC/ue_procedures.c @@ -1752,7 +1752,7 @@ if (UE_mac_inst[module_idP].scheduling_info.LCID_status[lcid] == LCID_NOT_EMPTY) bsr_l->Buffer_size2 = UE_mac_inst[module_idP].scheduling_info.BSR[LCGID2]; bsr_l->Buffer_size3 = UE_mac_inst[module_idP].scheduling_info.BSR[LCGID3]; - LOG_I(MAC, "[UE %d] Frame %d subframe %d BSR Trig=%d report long BSR (level LCGID0 %d,level LCGID1 %d,level LCGID2 %d,level LCGID3 %d)\n", module_idP,frameP,subframe, + LOG_D(MAC, "[UE %d] Frame %d subframe %d BSR Trig=%d report long BSR (level LCGID0 %d,level LCGID1 %d,level LCGID2 %d,level LCGID3 %d)\n", module_idP,frameP,subframe, UE_mac_inst[module_idP].BSR_reporting_active, UE_mac_inst[module_idP].scheduling_info.BSR[LCGID0], UE_mac_inst[module_idP].scheduling_info.BSR[LCGID1], @@ -1767,7 +1767,7 @@ if (UE_mac_inst[module_idP].scheduling_info.LCID_status[lcid] == LCID_NOT_EMPTY) bsr_t->LCGID = lcg_id_bsr_trunc; bsr_t->Buffer_size = UE_mac_inst[module_idP].scheduling_info.BSR[lcg_id_bsr_trunc]; - LOG_I(MAC,"[UE %d] Frame %d subframe %d BSR Trig=%d report TRUNCATED BSR with level %d for LCGID %d\n", + LOG_D(MAC,"[UE %d] Frame %d subframe %d BSR Trig=%d report TRUNCATED BSR with level %d for LCGID %d\n", module_idP, frameP, subframe, UE_mac_inst[module_idP].BSR_reporting_active, UE_mac_inst[module_idP].scheduling_info.BSR[lcg_id_bsr_trunc],lcg_id_bsr_trunc); } @@ -1777,7 +1777,7 @@ if (UE_mac_inst[module_idP].scheduling_info.LCID_status[lcid] == LCID_NOT_EMPTY) bsr_s->LCGID = lcg_id_bsr_trunc; bsr_s->Buffer_size = UE_mac_inst[module_idP].scheduling_info.BSR[lcg_id_bsr_trunc]; - LOG_I(MAC,"[UE %d] Frame %d subframe %d BSR Trig=%d report SHORT BSR with level %d for LCGID %d\n", + LOG_D(MAC,"[UE %d] Frame %d subframe %d BSR Trig=%d report SHORT BSR with level %d for LCGID %d\n", module_idP, frameP, subframe, UE_mac_inst[module_idP].BSR_reporting_active, UE_mac_inst[module_idP].scheduling_info.BSR[lcg_id_bsr_trunc],lcg_id_bsr_trunc); } } From f22e56ee6d5c2b2b6ee641dfa4c2bd0057ab5439 Mon Sep 17 00:00:00 2001 From: ROBERT Benoit Date: Thu, 1 Dec 2016 16:31:05 +0100 Subject: [PATCH 306/349] - Problem in DCI NDI : the implementation use 5 HARQ processes, but process 0 NDI never toggled because it was reused on subframe 5 that is not carrying format 1 DCI. Fix -> use 8 harq processes instead of 5. - SI scheduled on every subframe 5 (even and odd frames) instead of only on even frames - Add DLSCH scheduling on subframe 5 for odd frames - change default rballoc from 0x7FFF to 0x1FFFF to support maximum 10MHz throughput --- openair1/SCHED/phy_mac_stub.c | 79 ++++++++++++++++++++--------------- 1 file changed, 45 insertions(+), 34 deletions(-) diff --git a/openair1/SCHED/phy_mac_stub.c b/openair1/SCHED/phy_mac_stub.c index 0ac194d051..7753e9c2e3 100644 --- a/openair1/SCHED/phy_mac_stub.c +++ b/openair1/SCHED/phy_mac_stub.c @@ -40,14 +40,21 @@ #include "SCHED/phy_procedures_emos.h" #endif +/* SYRTEM */ +uint8_t dci_ndi_toggle_even[8] = {0, 0, 0, 0, 0, 0, 0, 0}; +uint8_t dci_ndi_toggle_odd[8] = {0, 0, 0, 0, 0, 0, 0, 0}; + void fill_dci(DCI_PDU *DCI_pdu,PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc) { - +/* SYRTEM */ + uint8_t *dci_ndi_toggle_tmp = NULL; + uint8_t harq_pid_value = 0; +/* End of SYRTEM */ //uint8_t cooperation_flag = eNB->cooperation_flag; uint8_t transmission_mode = eNB->transmission_mode[0]; - uint32_t rballoc = 0x7FFF; + uint32_t rballoc = 0x1FFFF; //uint32_t rballoc2 = 0x000F; int subframe = proc->subframe_tx; @@ -68,12 +75,14 @@ void fill_dci(DCI_PDU *DCI_pdu,PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc) switch (subframe) { case 5: - DCI_pdu->Num_common_dci = 1; - DCI_pdu->dci_alloc[0].L = 2; - DCI_pdu->dci_alloc[0].firstCCE = 0; - DCI_pdu->dci_alloc[0].rnti = SI_RNTI; - DCI_pdu->dci_alloc[0].format = format1A; - DCI_pdu->dci_alloc[0].ra_flag = 0; + if ( !(proc->frame_tx&1) ) // SI message on even frame only (SFN mod 2 == 0) + { + DCI_pdu->Num_common_dci = 1; + DCI_pdu->dci_alloc[0].L = 2; + DCI_pdu->dci_alloc[0].firstCCE = 0; + DCI_pdu->dci_alloc[0].rnti = SI_RNTI; + DCI_pdu->dci_alloc[0].format = format1A; + DCI_pdu->dci_alloc[0].ra_flag = 0; switch (eNB->frame_parms.N_RB_DL) { case 6: @@ -187,6 +196,12 @@ void fill_dci(DCI_PDU *DCI_pdu,PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc) } break; //subframe switch + } // if ( !(proc->frame_tx&1) ) + else // No SI message on odd frame (SFN mod 2 == 1) + { + /* warning: work around to send dlsch on subframe 5 odd frame !!! */ + /* todo: clean up, espacially if subframe cases are added next !!! */ + } /* case 6: DCI_pdu->Num_ue_spec_dci = 1; @@ -225,15 +240,23 @@ void fill_dci(DCI_PDU *DCI_pdu,PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc) if (eNB->frame_parms.frame_type == FDD) { DCI_pdu->dci_alloc[0].dci_length = sizeof_DCI1_5MHz_FDD_t; + harq_pid_value = ( ((proc->frame_tx * 10) + subframe) % 8 ); + + if (!(subframe&1)) // even subframe + dci_ndi_toggle_tmp = &(dci_ndi_toggle_even[harq_pid_value]); + else // odd subframe + dci_ndi_toggle_tmp = &(dci_ndi_toggle_odd[harq_pid_value]); + ((DCI1_5MHz_FDD_t *)&dlsch_pdu)->rballoc = rballoc; //computeRIV(25,10,3); ((DCI1_5MHz_FDD_t *)&dlsch_pdu)->TPC = 0; - ((DCI1_5MHz_FDD_t *)&dlsch_pdu)->harq_pid = subframe % 5; + ((DCI1_5MHz_FDD_t *)&dlsch_pdu)->harq_pid = harq_pid_value; ((DCI1_5MHz_FDD_t *)&dlsch_pdu)->mcs = eNB->target_ue_dl_mcs; - //((DCI1_5MHz_FDD_t *)&dlsch_pdu)->mcs = (unsigned char) ((eNB->frame%1024)%28); - ((DCI1_5MHz_FDD_t *)&dlsch_pdu)->ndi = subframe / 5; + ((DCI1_5MHz_FDD_t *)&dlsch_pdu)->ndi = (*dci_ndi_toggle_tmp); ((DCI1_5MHz_FDD_t *)&dlsch_pdu)->rv = 0; ((DCI1_5MHz_FDD_t *)&dlsch_pdu)->rah = 0; + (*dci_ndi_toggle_tmp) = ((*dci_ndi_toggle_tmp) + 1) & 1; + memcpy((void*)&DCI_pdu->dci_alloc[0].dci_pdu[0],(void *)&dlsch_pdu,sizeof(DCI1_5MHz_FDD_t)); /* @@ -296,36 +319,24 @@ void fill_dci(DCI_PDU *DCI_pdu,PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc) if (eNB->frame_parms.frame_type == FDD) { DCI_pdu->dci_alloc[0].dci_length = sizeof_DCI1_10MHz_FDD_t; + harq_pid_value = ( ((proc->frame_tx * 10) + subframe) % 8 ); + + if (!(subframe&1)) // even subframe + dci_ndi_toggle_tmp = &(dci_ndi_toggle_even[harq_pid_value]); + else // odd subframe + dci_ndi_toggle_tmp = &(dci_ndi_toggle_odd[harq_pid_value]); + ((DCI1_10MHz_FDD_t *)&dlsch_pdu)->rballoc = rballoc; //computeRIV(50,10,3); ((DCI1_10MHz_FDD_t *)&dlsch_pdu)->TPC = 0; - ((DCI1_10MHz_FDD_t *)&dlsch_pdu)->harq_pid = subframe % 5; + ((DCI1_10MHz_FDD_t *)&dlsch_pdu)->harq_pid = harq_pid_value; ((DCI1_10MHz_FDD_t *)&dlsch_pdu)->mcs = eNB->target_ue_dl_mcs; - //((DCI1_10MHz_FDD_t *)&dlsch_pdu)->mcs = (unsigned char) ((eNB->frame%1024)%28); - ((DCI1_10MHz_FDD_t *)&dlsch_pdu)->ndi = subframe / 5; + ((DCI1_10MHz_FDD_t *)&dlsch_pdu)->ndi = (*dci_ndi_toggle_tmp); ((DCI1_10MHz_FDD_t *)&dlsch_pdu)->rv = 0; ((DCI1_10MHz_FDD_t *)&dlsch_pdu)->rah = 0; + (*dci_ndi_toggle_tmp) = ((*dci_ndi_toggle_tmp) + 1) & 1; + memcpy((void*)&DCI_pdu->dci_alloc[0].dci_pdu[0],(void *)&dlsch_pdu,sizeof(DCI1_10MHz_FDD_t)); - - /* - //user2 - DCI_pdu->dci_alloc[1].dci_length = sizeof_DCI1_10MHz_TDD_t; - DCI_pdu->dci_alloc[1].L = 2; - DCI_pdu->dci_alloc[1].rnti = 0x1236; - DCI_pdu->dci_alloc[1].format = format1; - DCI_pdu->dci_alloc[1].ra_flag = 0; - - ((DCI1_10MHz_FDD_t *)&dlsch_pdu)->rballoc = rballoc2; - ((DCI1_10MHz_FDD_t *)&dlsch_pdu)->TPC = 0; - ((DCI1_10MHz_FDD_t *)&dlsch_pdu)->dai = 0; - ((DCI1_10MHz_FDD_t *)&dlsch_pdu)->harq_pid = 1; - //((DCI1_10MHz_FDD_t *)&dlsch_pdu)->mcs = (unsigned char) ((eNB->proc[subframe].frame%1024)%28); - ((DCI1_10MHz_FDD_t *)&dlsch_pdu)->mcs = eNB->target_ue_dl_mcs; - ((DCI1_10MHz_FDD_t *)&dlsch_pdu)->ndi = 1; - ((DCI1_10MHz_FDD_t *)&dlsch_pdu)->rv = 0; - ((DCI1_10MHz_FDD_t *)&dlsch_pdu)->rah = 0; - memcpy((void*)&DCI_pdu->dci_alloc[1].dci_pdu[0],(void *)&((DCI1_10MHz_FDD_t *)&dlsch_pdu)->,sizeof(DCI1_10MHz_TDD_t)); - */ } else { DCI_pdu->dci_alloc[0].dci_length = sizeof_DCI1_10MHz_TDD_t; From f52a2c958360179e57b59d2c4fabd0ae4fb601a4 Mon Sep 17 00:00:00 2001 From: ROBERT Benoit Date: Mon, 5 Dec 2016 15:41:47 +0100 Subject: [PATCH 307/349] correct issue 147 : --phy-test mode : error msg " DL Received HarqReTx round=1 mcs=28 rballoc=8191 rv=0 " --- openair1/SCHED/phy_procedures_lte_eNb.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/openair1/SCHED/phy_procedures_lte_eNb.c b/openair1/SCHED/phy_procedures_lte_eNb.c index 7286154c65..3069afa763 100644 --- a/openair1/SCHED/phy_procedures_lte_eNb.c +++ b/openair1/SCHED/phy_procedures_lte_eNb.c @@ -1105,7 +1105,7 @@ void phy_procedures_eNB_TX(PHY_VARS_eNB *eNB, int frame=proc->frame_tx; int subframe=proc->subframe_tx; // uint16_t input_buffer_length; - uint32_t i,aa; + uint32_t i,j,aa; uint8_t harq_pid; DCI_PDU *DCI_pdu; DCI_PDU DCI_pdu_tmp; @@ -1203,6 +1203,14 @@ void phy_procedures_eNB_TX(PHY_VARS_eNB *eNB, fill_dci_emos(DCI_pdu,eNB); #else fill_dci(DCI_pdu,eNB,proc); + // clear previous allocation information for all UEs + for (i=0; idlsch[i][0]){ + for (j=0; j<8; j++) + eNB->dlsch[i][0]->harq_processes[j]->round = 0; + } + } + #endif } From bc032392c9e7c9fc2e97d4f4905d00e9bb7f19d0 Mon Sep 17 00:00:00 2001 From: fnabet Date: Mon, 5 Dec 2016 16:51:27 +0100 Subject: [PATCH 308/349] add workarounds for OAI issues --- openair2/LAYER2/MAC/ue_procedures.c | 37 ++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/openair2/LAYER2/MAC/ue_procedures.c b/openair2/LAYER2/MAC/ue_procedures.c index 28520802c7..886ccff238 100644 --- a/openair2/LAYER2/MAC/ue_procedures.c +++ b/openair2/LAYER2/MAC/ue_procedures.c @@ -70,6 +70,8 @@ #define DEBUG_HEADER_PARSING 1 #define ENABLE_MAC_PAYLOAD_DEBUG 1 +extern uint8_t usim_test; + /* #ifndef USER_MODE #define msg debug_msg @@ -1408,6 +1410,13 @@ for (lcid=DCCH; lcid < DTCH ; lcid++) { //Adjust at the end of the loop while ((!is_lcid_processed) && (bsr_len + phr_len + total_rlc_pdu_header_len + sdu_length_total + MIN_MAC_HDR_RLC_SIZE <= buflen)) { + // Workaround for issue in OAI eNB or EPC which are not able to process SRB2 message multiplexed with SRB1 on the same MAC PDU + if ((usim_test == 0) && (lcid == DCCH1) && (lcid_rlc_pdu_count == 0) && (num_sdus)) { + + // Skip SRB2 multiplex if at least one SRB1 SDU is already multiplexed + break; + } + buflen_remain = buflen - (bsr_len + phr_len + total_rlc_pdu_header_len + sdu_length_total + 1); rlc_status = mac_rlc_status_ind(module_idP, @@ -1419,8 +1428,21 @@ for (lcid=DCCH; lcid < DTCH ; lcid++) { lcid, buflen_remain); + // Workaround for BO issue in RLC AM ReTx : RLC BO can not be bigger than stored MAC BO + if (UE_mac_inst[module_idP].scheduling_info.LCID_buffer_remain[lcid] < rlc_status.bytes_in_buffer) { + + LOG_I(MAC, "[UE %d] Frame %d Subframe%d: WARNING Inconsistent BO! for LCID=%d MAC=%d RLC=%d RLC PDU nb=%d\n", + module_idP,frameP,subframe, + lcid,UE_mac_inst[module_idP].scheduling_info.LCID_buffer_remain[lcid],rlc_status.bytes_in_buffer,lcid_rlc_pdu_count); + + // Skip multiplexing for the LCID + break; + } + + /* AssertFatal ( UE_mac_inst[module_idP].scheduling_info.LCID_buffer_remain[lcid] >= rlc_status.bytes_in_buffer, "Inconsistent BO! for LCID=%d MAC=%d RLC=%d RLC PDU nb=%d Frame %d Subrame %d\n", lcid,UE_mac_inst[module_idP].scheduling_info.LCID_buffer_remain[lcid],rlc_status.bytes_in_buffer,lcid_rlc_pdu_count,frameP,subframe); + */ if (rlc_status.bytes_in_buffer > 0) { @@ -1535,8 +1557,21 @@ if (UE_mac_inst[module_idP].scheduling_info.LCID_status[lcid] == LCID_NOT_EMPTY) lcid, buflen_remain); - AssertFatal ( UE_mac_inst[module_idP].scheduling_info.LCID_buffer_remain[lcid] >= rlc_status.bytes_in_buffer, "Inconsistent BO! for LCID=%d MAC=%d RLC=%d RLC PDU nb=%d Frame %d Subrame %d\n", + // Workaround for BO issue in RLC AM ReTx : RLC BO can not be bigger than stored MAC BO + if (UE_mac_inst[module_idP].scheduling_info.LCID_buffer_remain[lcid] < rlc_status.bytes_in_buffer) { + + LOG_I(MAC, "[UE %d] Frame %d Subframe%d: WARNING Inconsistent BO! for LCID=%d MAC=%d RLC=%d RLC PDU nb=%d\n", + module_idP,frameP,subframe, + lcid,UE_mac_inst[module_idP].scheduling_info.LCID_buffer_remain[lcid],rlc_status.bytes_in_buffer,lcid_rlc_pdu_count); + + // Skip multiplexing for the LCID + break; + } + + /* + AssertFatal ( UE_mac_inst[module_idP].scheduling_info.LCID_buffer_remain[lcid] >= rlc_status.bytes_in_buffer, "Inconsistent BO! for LCID=%d MAC=%d RLC=%d RLC PDU nb=%d Frame %d Subrame %d\n", lcid,UE_mac_inst[module_idP].scheduling_info.LCID_buffer_remain[lcid],rlc_status.bytes_in_buffer,lcid_rlc_pdu_count,frameP,subframe); + */ if (rlc_status.bytes_in_buffer > 0) { From 41582eb340f0cdd8ac4d03e8f99ba2ca02752d8e Mon Sep 17 00:00:00 2001 From: Xiwen JIANG Date: Mon, 5 Dec 2016 17:56:58 +0100 Subject: [PATCH 309/349] fix compliation problems for unitary tests --- openair1/SIMULATION/LTE_PHY/mbmssim.c | 3 ++- openair1/SIMULATION/LTE_PHY/pbchsim.c | 2 +- openair1/SIMULATION/LTE_PHY/pdcchsim.c | 7 ++++--- openair1/SIMULATION/LTE_PHY/prachsim.c | 1 + openair1/SIMULATION/LTE_PHY/pucchsim.c | 1 + openair1/SIMULATION/LTE_PHY/ulsim.c | 2 +- 6 files changed, 10 insertions(+), 6 deletions(-) diff --git a/openair1/SIMULATION/LTE_PHY/mbmssim.c b/openair1/SIMULATION/LTE_PHY/mbmssim.c index 65d9112c9d..7849dec1ab 100644 --- a/openair1/SIMULATION/LTE_PHY/mbmssim.c +++ b/openair1/SIMULATION/LTE_PHY/mbmssim.c @@ -238,6 +238,7 @@ int main(int argc, char **argv) n_tx=2; lte_param_init(n_tx, + n_tx, n_rx, transmission_mode, extended_prefix_flag, @@ -301,7 +302,7 @@ int main(int argc, char **argv) 0); // Create transport channel structures for 2 transport blocks (MIMO) - eNB->dlsch_MCH = new_eNB_dlsch(1,8,Nsoft,N_RB_DL,0,&eNB->lte_frame_parms); + eNB->dlsch_MCH = new_eNB_dlsch(1,8,Nsoft,N_RB_DL,0,&eNB->frame_parms); if (!eNB->dlsch_MCH) { printf("Can't get eNB dlsch structures\n"); diff --git a/openair1/SIMULATION/LTE_PHY/pbchsim.c b/openair1/SIMULATION/LTE_PHY/pbchsim.c index f696cc8da4..83906d7322 100644 --- a/openair1/SIMULATION/LTE_PHY/pbchsim.c +++ b/openair1/SIMULATION/LTE_PHY/pbchsim.c @@ -325,7 +325,7 @@ int main(int argc, char **argv) if (transmission_mode>=2) n_tx=2; - lte_param_init(n_tx,n_rx,transmission_mode,extended_prefix_flag,frame_type,Nid_cell,3,N_RB_DL,0,osf,0); + lte_param_init(n_tx, n_tx,n_rx,transmission_mode,extended_prefix_flag,frame_type,Nid_cell,3,N_RB_DL,0,osf,0); eNB1 = malloc(sizeof(PHY_VARS_eNB)); eNB2 = malloc(sizeof(PHY_VARS_eNB)); diff --git a/openair1/SIMULATION/LTE_PHY/pdcchsim.c b/openair1/SIMULATION/LTE_PHY/pdcchsim.c index d8b096a8cd..04b9d304b3 100644 --- a/openair1/SIMULATION/LTE_PHY/pdcchsim.c +++ b/openair1/SIMULATION/LTE_PHY/pdcchsim.c @@ -694,6 +694,7 @@ int main(int argc, char **argv) n_tx=2; lte_param_init(n_tx, + n_tx, n_rx, transmission_mode, extended_prefix_flag, @@ -737,7 +738,7 @@ int main(int argc, char **argv) subframe,NUMBER_OF_OFDM_CARRIERS, eNB->frame_parms.Ncp,eNB->frame_parms.samples_per_tti,nsymb); - eNB2UE = new_channel_desc_scm(eNB->frame_parms.nb_antennas_tx_eNB, + eNB2UE = new_channel_desc_scm(eNB->frame_parms.nb_antennas_tx, UE->frame_parms.nb_antennas_rx, channel_model, N_RB2sampling_rate(eNB->frame_parms.N_RB_DL), @@ -812,7 +813,7 @@ int main(int argc, char **argv) for (trial=0; trialcommon_vars.txdataF[eNb_id][aa][512*14*subframe],&eNB->common_vars.txdataF[eNb_id][aa][0]); - for (aa=0; aaframe_parms.nb_antennas_tx_eNB; aa++) { + for (aa=0; aaframe_parms.nb_antennas_tx; aa++) { memset(&eNB->common_vars.txdataF[eNb_id][aa][0],0,FRAME_LENGTH_COMPLEX_SAMPLES_NO_PREFIX*sizeof(int32_t)); } @@ -958,7 +959,7 @@ int main(int argc, char **argv) tx_lev = 0; - for (aa=0; aalte_frame_parms.nb_antenna_ports_eNB; aa++) { + for (aa=0; aaframe_parms.nb_antenna_ports_eNB; aa++) { if (eNB->frame_parms.Ncp == 1) PHY_ofdm_mod(&eNB->common_vars.txdataF[eNb_id][aa][subframe*nsymb*eNB->frame_parms.ofdm_symbol_size], // input, &txdata[aa][subframe*eNB->frame_parms.samples_per_tti], // output diff --git a/openair1/SIMULATION/LTE_PHY/prachsim.c b/openair1/SIMULATION/LTE_PHY/prachsim.c index ad57d17507..7acc07528c 100644 --- a/openair1/SIMULATION/LTE_PHY/prachsim.c +++ b/openair1/SIMULATION/LTE_PHY/prachsim.c @@ -308,6 +308,7 @@ int main(int argc, char **argv) n_tx=2; lte_param_init(n_tx, + n_tx, n_rx, transmission_mode, extended_prefix_flag, diff --git a/openair1/SIMULATION/LTE_PHY/pucchsim.c b/openair1/SIMULATION/LTE_PHY/pucchsim.c index 843cd27a54..77bfcb18cf 100644 --- a/openair1/SIMULATION/LTE_PHY/pucchsim.c +++ b/openair1/SIMULATION/LTE_PHY/pucchsim.c @@ -296,6 +296,7 @@ int main(int argc, char **argv) n_tx=2; lte_param_init(n_tx, + n_tx, n_rx, transmission_mode, extended_prefix_flag, diff --git a/openair1/SIMULATION/LTE_PHY/ulsim.c b/openair1/SIMULATION/LTE_PHY/ulsim.c index 52d6b6b347..cf9e5aaa30 100644 --- a/openair1/SIMULATION/LTE_PHY/ulsim.c +++ b/openair1/SIMULATION/LTE_PHY/ulsim.c @@ -680,7 +680,7 @@ int main(int argc, char **argv) } // Create transport channel structures for 2 transport blocks (MIMO) for (i=0; i<2; i++) { - eNB->dlsch[0][i] = new_eNB_dlsch(1,8,1827072,N_RB_DL,0,eNB->frame_parms); + eNB->dlsch[0][i] = new_eNB_dlsch(1,8,1827072,N_RB_DL,0,&eNB->frame_parms); UE->dlsch[0][i] = new_ue_dlsch(1,8,1827072,MAX_TURBO_ITERATIONS,N_RB_DL,0); if (!eNB->dlsch[0][i]) { From 8def47c4881ab140d16d04faff815e3a95c345e7 Mon Sep 17 00:00:00 2001 From: Xenofon Foukas Date: Mon, 5 Dec 2016 22:04:12 +0200 Subject: [PATCH 310/349] Changed old licenses in FlexRAN agent source files --- .../CONTROL_MODULES/MAC/flexran_agent_mac.c | 48 ++++++++---------- .../CONTROL_MODULES/MAC/flexran_agent_mac.h | 48 ++++++++---------- .../MAC/flexran_agent_mac_defs.h | 48 ++++++++---------- .../MAC/flexran_agent_mac_internal.c | 48 ++++++++---------- .../MAC/flexran_agent_mac_internal.h | 48 ++++++++---------- openair2/ENB_APP/flexran_agent.c | 48 ++++++++---------- openair2/ENB_APP/flexran_agent.h | 49 ++++++++----------- openair2/ENB_APP/flexran_agent_async.c | 48 ++++++++---------- openair2/ENB_APP/flexran_agent_async.h | 48 ++++++++---------- openair2/ENB_APP/flexran_agent_common.c | 48 ++++++++---------- openair2/ENB_APP/flexran_agent_common.h | 48 ++++++++---------- .../ENB_APP/flexran_agent_common_internal.c | 48 ++++++++---------- .../ENB_APP/flexran_agent_common_internal.h | 48 ++++++++---------- openair2/ENB_APP/flexran_agent_defs.h | 48 ++++++++---------- openair2/ENB_APP/flexran_agent_extern.h | 48 ++++++++---------- openair2/ENB_APP/flexran_agent_handler.c | 48 ++++++++---------- openair2/ENB_APP/flexran_agent_net_comm.c | 48 ++++++++---------- openair2/ENB_APP/flexran_agent_net_comm.h | 48 ++++++++---------- openair2/ENB_APP/flexran_agent_task_manager.c | 47 ++++++++---------- openair2/ENB_APP/flexran_agent_task_manager.h | 47 ++++++++---------- openair2/LAYER2/MAC/flexran_agent_mac_proto.h | 48 ++++++++---------- .../MAC/flexran_agent_scheduler_dataplane.c | 48 ++++++++---------- .../MAC/flexran_agent_scheduler_dlsch_ue.c | 48 ++++++++---------- .../flexran_agent_scheduler_dlsch_ue_remote.c | 48 ++++++++---------- .../flexran_agent_scheduler_dlsch_ue_remote.h | 48 ++++++++---------- openair2/LAYER2/MAC/flexran_dci_conversions.h | 48 ++++++++---------- openair2/UTIL/ASYNC_IF/link_manager.c | 47 ++++++++---------- openair2/UTIL/ASYNC_IF/link_manager.h | 47 ++++++++---------- openair2/UTIL/ASYNC_IF/message_queue.c | 47 ++++++++---------- openair2/UTIL/ASYNC_IF/message_queue.h | 47 ++++++++---------- openair2/UTIL/ASYNC_IF/ringbuffer_queue.c | 47 ++++++++---------- openair2/UTIL/ASYNC_IF/ringbuffer_queue.h | 47 ++++++++---------- openair2/UTIL/ASYNC_IF/socket_link.c | 47 ++++++++---------- openair2/UTIL/ASYNC_IF/socket_link.h | 47 ++++++++---------- 34 files changed, 680 insertions(+), 943 deletions(-) diff --git a/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c b/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c index 34b6ef345f..b9cad28278 100644 --- a/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c +++ b/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c @@ -1,31 +1,23 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see . - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@lists.eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ +/* + * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The OpenAirInterface Software Alliance licenses this file to You under + * the OAI Public License, Version 1.0 (the "License"); you may not use this file + * except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.openairinterface.org/?page_id=698 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *------------------------------------------------------------------------------- + * For more information about the OpenAirInterface (OAI) Software Alliance: + * contact@openairinterface.org + */ /*! \file flexran_agent_mac.c * \brief FlexRAN agent message handler for MAC layer diff --git a/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.h b/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.h index fbb13ceca9..e2378e9311 100644 --- a/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.h +++ b/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.h @@ -1,31 +1,23 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see . - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@lists.eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ +/* + * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The OpenAirInterface Software Alliance licenses this file to You under + * the OAI Public License, Version 1.0 (the "License"); you may not use this file + * except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.openairinterface.org/?page_id=698 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *------------------------------------------------------------------------------- + * For more information about the OpenAirInterface (OAI) Software Alliance: + * contact@openairinterface.org + */ /*! \file flexran_agent_mac.h * \brief FlexRAN agent message handler APIs for MAC layer diff --git a/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac_defs.h b/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac_defs.h index e42847c371..bb6aed1d8e 100644 --- a/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac_defs.h +++ b/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac_defs.h @@ -1,31 +1,23 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2016 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see . - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@lists.eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ +/* + * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The OpenAirInterface Software Alliance licenses this file to You under + * the OAI Public License, Version 1.0 (the "License"); you may not use this file + * except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.openairinterface.org/?page_id=698 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *------------------------------------------------------------------------------- + * For more information about the OpenAirInterface (OAI) Software Alliance: + * contact@openairinterface.org + */ /*! \file flexran_agent_mac_defs.h * \brief FlexRAN agent - mac interface primitives diff --git a/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac_internal.c b/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac_internal.c index 04a90250eb..a63225e657 100644 --- a/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac_internal.c +++ b/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac_internal.c @@ -1,31 +1,23 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see . - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@lists.eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ +/* + * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The OpenAirInterface Software Alliance licenses this file to You under + * the OAI Public License, Version 1.0 (the "License"); you may not use this file + * except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.openairinterface.org/?page_id=698 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *------------------------------------------------------------------------------- + * For more information about the OpenAirInterface (OAI) Software Alliance: + * contact@openairinterface.org + */ /*! \file flexran_agent_mac_internal.c * \brief Helper functions for the MAC agent diff --git a/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac_internal.h b/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac_internal.h index e7a922d503..9a7d4a8555 100644 --- a/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac_internal.h +++ b/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac_internal.h @@ -1,31 +1,23 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see . - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@lists.eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ +/* + * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The OpenAirInterface Software Alliance licenses this file to You under + * the OAI Public License, Version 1.0 (the "License"); you may not use this file + * except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.openairinterface.org/?page_id=698 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *------------------------------------------------------------------------------- + * For more information about the OpenAirInterface (OAI) Software Alliance: + * contact@openairinterface.org + */ /*! \file flexran_agent_mac_internal.h * \brief Implementation specific definitions for the FlexRAN MAC agent diff --git a/openair2/ENB_APP/flexran_agent.c b/openair2/ENB_APP/flexran_agent.c index 8984e39971..beca1062bd 100644 --- a/openair2/ENB_APP/flexran_agent.c +++ b/openair2/ENB_APP/flexran_agent.c @@ -1,31 +1,23 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see . - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@lists.eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ +/* + * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The OpenAirInterface Software Alliance licenses this file to You under + * the OAI Public License, Version 1.0 (the "License"); you may not use this file + * except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.openairinterface.org/?page_id=698 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *------------------------------------------------------------------------------- + * For more information about the OpenAirInterface (OAI) Software Alliance: + * contact@openairinterface.org + */ /*! \file flexran_agent.h * \brief top level flexran agent receive thread and itti task diff --git a/openair2/ENB_APP/flexran_agent.h b/openair2/ENB_APP/flexran_agent.h index beed4b9885..21ea21aafc 100644 --- a/openair2/ENB_APP/flexran_agent.h +++ b/openair2/ENB_APP/flexran_agent.h @@ -1,32 +1,23 @@ - -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see . - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@lists.eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ +/* + * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The OpenAirInterface Software Alliance licenses this file to You under + * the OAI Public License, Version 1.0 (the "License"); you may not use this file + * except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.openairinterface.org/?page_id=698 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *------------------------------------------------------------------------------- + * For more information about the OpenAirInterface (OAI) Software Alliance: + * contact@openairinterface.org + */ /*! \file flexran_agent.h * \brief top level flexran agent diff --git a/openair2/ENB_APP/flexran_agent_async.c b/openair2/ENB_APP/flexran_agent_async.c index ae0273a668..978b44929d 100644 --- a/openair2/ENB_APP/flexran_agent_async.c +++ b/openair2/ENB_APP/flexran_agent_async.c @@ -1,31 +1,23 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see . - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@lists.eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ +/* + * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The OpenAirInterface Software Alliance licenses this file to You under + * the OAI Public License, Version 1.0 (the "License"); you may not use this file + * except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.openairinterface.org/?page_id=698 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *------------------------------------------------------------------------------- + * For more information about the OpenAirInterface (OAI) Software Alliance: + * contact@openairinterface.org + */ /*! \file flexran_agent_async.c * \brief channel implementation for async interface diff --git a/openair2/ENB_APP/flexran_agent_async.h b/openair2/ENB_APP/flexran_agent_async.h index 3e5c21463a..b097b15c25 100644 --- a/openair2/ENB_APP/flexran_agent_async.h +++ b/openair2/ENB_APP/flexran_agent_async.h @@ -1,31 +1,23 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see . - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@lists.eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ +/* + * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The OpenAirInterface Software Alliance licenses this file to You under + * the OAI Public License, Version 1.0 (the "License"); you may not use this file + * except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.openairinterface.org/?page_id=698 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *------------------------------------------------------------------------------- + * For more information about the OpenAirInterface (OAI) Software Alliance: + * contact@openairinterface.org + */ /*! \file flexran_agent_async.h * \brief channel implementation for async interface diff --git a/openair2/ENB_APP/flexran_agent_common.c b/openair2/ENB_APP/flexran_agent_common.c index 00f938f4fb..2ccca6602b 100644 --- a/openair2/ENB_APP/flexran_agent_common.c +++ b/openair2/ENB_APP/flexran_agent_common.c @@ -1,31 +1,23 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see . - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@lists.eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ +/* + * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The OpenAirInterface Software Alliance licenses this file to You under + * the OAI Public License, Version 1.0 (the "License"); you may not use this file + * except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.openairinterface.org/?page_id=698 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *------------------------------------------------------------------------------- + * For more information about the OpenAirInterface (OAI) Software Alliance: + * contact@openairinterface.org + */ /*! \file flexran_agent_common.c * \brief common primitives for all agents diff --git a/openair2/ENB_APP/flexran_agent_common.h b/openair2/ENB_APP/flexran_agent_common.h index caa2eeb900..56a52cd0b6 100644 --- a/openair2/ENB_APP/flexran_agent_common.h +++ b/openair2/ENB_APP/flexran_agent_common.h @@ -1,31 +1,23 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see . - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@lists.eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ +/* + * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The OpenAirInterface Software Alliance licenses this file to You under + * the OAI Public License, Version 1.0 (the "License"); you may not use this file + * except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.openairinterface.org/?page_id=698 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *------------------------------------------------------------------------------- + * For more information about the OpenAirInterface (OAI) Software Alliance: + * contact@openairinterface.org + */ /*! \file flexran_agent_common.h * \brief common message primitves and utilities diff --git a/openair2/ENB_APP/flexran_agent_common_internal.c b/openair2/ENB_APP/flexran_agent_common_internal.c index f35cd8666f..3026190863 100644 --- a/openair2/ENB_APP/flexran_agent_common_internal.c +++ b/openair2/ENB_APP/flexran_agent_common_internal.c @@ -1,31 +1,23 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see . - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@lists.eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ +/* + * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The OpenAirInterface Software Alliance licenses this file to You under + * the OAI Public License, Version 1.0 (the "License"); you may not use this file + * except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.openairinterface.org/?page_id=698 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *------------------------------------------------------------------------------- + * For more information about the OpenAirInterface (OAI) Software Alliance: + * contact@openairinterface.org + */ /*! \file flexran_agent_common_internal.c * \brief internal functions for common message primitves and utilities diff --git a/openair2/ENB_APP/flexran_agent_common_internal.h b/openair2/ENB_APP/flexran_agent_common_internal.h index 45f4a73ffb..c8f78aafe9 100644 --- a/openair2/ENB_APP/flexran_agent_common_internal.h +++ b/openair2/ENB_APP/flexran_agent_common_internal.h @@ -1,31 +1,23 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see . - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@lists.eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ +/* + * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The OpenAirInterface Software Alliance licenses this file to You under + * the OAI Public License, Version 1.0 (the "License"); you may not use this file + * except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.openairinterface.org/?page_id=698 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *------------------------------------------------------------------------------- + * For more information about the OpenAirInterface (OAI) Software Alliance: + * contact@openairinterface.org + */ /*! \file flexran_agent_common_internal.h * \brief internal agent functions for common message primitves and utilities diff --git a/openair2/ENB_APP/flexran_agent_defs.h b/openair2/ENB_APP/flexran_agent_defs.h index 7da0487120..d60510b0c7 100644 --- a/openair2/ENB_APP/flexran_agent_defs.h +++ b/openair2/ENB_APP/flexran_agent_defs.h @@ -1,31 +1,23 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2016 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see . - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@lists.eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ +/* + * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The OpenAirInterface Software Alliance licenses this file to You under + * the OAI Public License, Version 1.0 (the "License"); you may not use this file + * except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.openairinterface.org/?page_id=698 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *------------------------------------------------------------------------------- + * For more information about the OpenAirInterface (OAI) Software Alliance: + * contact@openairinterface.org + */ /*! \file flexran_agent_defs.h * \brief FlexRAN agent common definitions diff --git a/openair2/ENB_APP/flexran_agent_extern.h b/openair2/ENB_APP/flexran_agent_extern.h index 602b1d6ce3..3a03239e6f 100644 --- a/openair2/ENB_APP/flexran_agent_extern.h +++ b/openair2/ENB_APP/flexran_agent_extern.h @@ -1,31 +1,23 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2016 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see . - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@lists.eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ +/* + * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The OpenAirInterface Software Alliance licenses this file to You under + * the OAI Public License, Version 1.0 (the "License"); you may not use this file + * except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.openairinterface.org/?page_id=698 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *------------------------------------------------------------------------------- + * For more information about the OpenAirInterface (OAI) Software Alliance: + * contact@openairinterface.org + */ /*! \file ENB_APP/extern.h * \brief FlexRAN agent - mac interface primitives diff --git a/openair2/ENB_APP/flexran_agent_handler.c b/openair2/ENB_APP/flexran_agent_handler.c index c077827c66..4967e46923 100644 --- a/openair2/ENB_APP/flexran_agent_handler.c +++ b/openair2/ENB_APP/flexran_agent_handler.c @@ -1,31 +1,23 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see . - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@lists.eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ +/* + * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The OpenAirInterface Software Alliance licenses this file to You under + * the OAI Public License, Version 1.0 (the "License"); you may not use this file + * except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.openairinterface.org/?page_id=698 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *------------------------------------------------------------------------------- + * For more information about the OpenAirInterface (OAI) Software Alliance: + * contact@openairinterface.org + */ /*! \file flexran_agent_handler.c * \brief FlexRAN agent tx and rx message handler diff --git a/openair2/ENB_APP/flexran_agent_net_comm.c b/openair2/ENB_APP/flexran_agent_net_comm.c index 986c819fb0..6e39d6089f 100644 --- a/openair2/ENB_APP/flexran_agent_net_comm.c +++ b/openair2/ENB_APP/flexran_agent_net_comm.c @@ -1,31 +1,23 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2016 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see . - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@lists.eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ +/* + * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The OpenAirInterface Software Alliance licenses this file to You under + * the OAI Public License, Version 1.0 (the "License"); you may not use this file + * except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.openairinterface.org/?page_id=698 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *------------------------------------------------------------------------------- + * For more information about the OpenAirInterface (OAI) Software Alliance: + * contact@openairinterface.org + */ /*! \file flexran_agent_net_comm.c * \brief FlexRAN agent network interface abstraction diff --git a/openair2/ENB_APP/flexran_agent_net_comm.h b/openair2/ENB_APP/flexran_agent_net_comm.h index ca26de7c16..e4aa854c70 100644 --- a/openair2/ENB_APP/flexran_agent_net_comm.h +++ b/openair2/ENB_APP/flexran_agent_net_comm.h @@ -1,31 +1,23 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2016 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see . - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@lists.eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ +/* + * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The OpenAirInterface Software Alliance licenses this file to You under + * the OAI Public License, Version 1.0 (the "License"); you may not use this file + * except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.openairinterface.org/?page_id=698 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *------------------------------------------------------------------------------- + * For more information about the OpenAirInterface (OAI) Software Alliance: + * contact@openairinterface.org + */ /*! \file flexran_agent_net_comm.h * \brief FlexRAN agent network interface abstraction diff --git a/openair2/ENB_APP/flexran_agent_task_manager.c b/openair2/ENB_APP/flexran_agent_task_manager.c index e278386ba4..eaa6a58af8 100644 --- a/openair2/ENB_APP/flexran_agent_task_manager.c +++ b/openair2/ENB_APP/flexran_agent_task_manager.c @@ -1,31 +1,24 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2015 Eurecom +/* + * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The OpenAirInterface Software Alliance licenses this file to You under + * the OAI Public License, Version 1.0 (the "License"); you may not use this file + * except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.openairinterface.org/?page_id=698 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *------------------------------------------------------------------------------- + * For more information about the OpenAirInterface (OAI) Software Alliance: + * contact@openairinterface.org + */ - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see . - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE - -*******************************************************************************/ /*! \file flexran_agent_task_manager.h * \brief Implementation of scheduled tasks manager for the FlexRAN agent * \author Xenofon Foukas diff --git a/openair2/ENB_APP/flexran_agent_task_manager.h b/openair2/ENB_APP/flexran_agent_task_manager.h index 9faa0e3db7..1b14f1f6f6 100644 --- a/openair2/ENB_APP/flexran_agent_task_manager.h +++ b/openair2/ENB_APP/flexran_agent_task_manager.h @@ -1,31 +1,24 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2015 Eurecom +/* + * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The OpenAirInterface Software Alliance licenses this file to You under + * the OAI Public License, Version 1.0 (the "License"); you may not use this file + * except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.openairinterface.org/?page_id=698 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *------------------------------------------------------------------------------- + * For more information about the OpenAirInterface (OAI) Software Alliance: + * contact@openairinterface.org + */ - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see . - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE - -*******************************************************************************/ /*! \file flexran_agent_task_manager.h * \brief Implementation of scheduled tasks manager for the FlexRAN agent * \author Xenofon Foukas diff --git a/openair2/LAYER2/MAC/flexran_agent_mac_proto.h b/openair2/LAYER2/MAC/flexran_agent_mac_proto.h index 9e46e0904a..060e8ab6ca 100644 --- a/openair2/LAYER2/MAC/flexran_agent_mac_proto.h +++ b/openair2/LAYER2/MAC/flexran_agent_mac_proto.h @@ -1,31 +1,23 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see . - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@lists.eurecom.fr - - Address : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE - -*******************************************************************************/ +/* + * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The OpenAirInterface Software Alliance licenses this file to You under + * the OAI Public License, Version 1.0 (the "License"); you may not use this file + * except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.openairinterface.org/?page_id=698 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *------------------------------------------------------------------------------- + * For more information about the OpenAirInterface (OAI) Software Alliance: + * contact@openairinterface.org + */ /*! \file flexran_agent_mac_proto.h * \brief MAC functions for FlexRAN agent diff --git a/openair2/LAYER2/MAC/flexran_agent_scheduler_dataplane.c b/openair2/LAYER2/MAC/flexran_agent_scheduler_dataplane.c index aff196681e..6d3c32a516 100644 --- a/openair2/LAYER2/MAC/flexran_agent_scheduler_dataplane.c +++ b/openair2/LAYER2/MAC/flexran_agent_scheduler_dataplane.c @@ -1,31 +1,23 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see . - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@lists.eurecom.fr - - Address : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE - -*******************************************************************************/ +/* + * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The OpenAirInterface Software Alliance licenses this file to You under + * the OAI Public License, Version 1.0 (the "License"); you may not use this file + * except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.openairinterface.org/?page_id=698 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *------------------------------------------------------------------------------- + * For more information about the OpenAirInterface (OAI) Software Alliance: + * contact@openairinterface.org + */ /*! \file flexran_agent_scheduler_dataplane.c * \brief data plane procedures related to eNB scheduling diff --git a/openair2/LAYER2/MAC/flexran_agent_scheduler_dlsch_ue.c b/openair2/LAYER2/MAC/flexran_agent_scheduler_dlsch_ue.c index bc0187cd56..8975465e77 100644 --- a/openair2/LAYER2/MAC/flexran_agent_scheduler_dlsch_ue.c +++ b/openair2/LAYER2/MAC/flexran_agent_scheduler_dlsch_ue.c @@ -1,31 +1,23 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see . - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@lists.eurecom.fr - - Address : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE - -*******************************************************************************/ +/* + * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The OpenAirInterface Software Alliance licenses this file to You under + * the OAI Public License, Version 1.0 (the "License"); you may not use this file + * except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.openairinterface.org/?page_id=698 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *------------------------------------------------------------------------------- + * For more information about the OpenAirInterface (OAI) Software Alliance: + * contact@openairinterface.org + */ /*! \file flexran_agent_scheduler_dlsch_ue.c * \brief procedures related to eNB for the DLSCH transport channel diff --git a/openair2/LAYER2/MAC/flexran_agent_scheduler_dlsch_ue_remote.c b/openair2/LAYER2/MAC/flexran_agent_scheduler_dlsch_ue_remote.c index 78b093c27d..7dec8d0c56 100644 --- a/openair2/LAYER2/MAC/flexran_agent_scheduler_dlsch_ue_remote.c +++ b/openair2/LAYER2/MAC/flexran_agent_scheduler_dlsch_ue_remote.c @@ -1,31 +1,23 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see . - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@lists.eurecom.fr - - Address : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE - -*******************************************************************************/ +/* + * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The OpenAirInterface Software Alliance licenses this file to You under + * the OAI Public License, Version 1.0 (the "License"); you may not use this file + * except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.openairinterface.org/?page_id=698 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *------------------------------------------------------------------------------- + * For more information about the OpenAirInterface (OAI) Software Alliance: + * contact@openairinterface.org + */ /*! \file flexran_agent_scheduler_dlsch_ue_remote.c * \brief procedures related to remote scheduling in the DLSCH transport channel diff --git a/openair2/LAYER2/MAC/flexran_agent_scheduler_dlsch_ue_remote.h b/openair2/LAYER2/MAC/flexran_agent_scheduler_dlsch_ue_remote.h index 2cfad85771..7a02ff2f1d 100644 --- a/openair2/LAYER2/MAC/flexran_agent_scheduler_dlsch_ue_remote.h +++ b/openair2/LAYER2/MAC/flexran_agent_scheduler_dlsch_ue_remote.h @@ -1,31 +1,23 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see . - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@lists.eurecom.fr - - Address : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE - -*******************************************************************************/ +/* + * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The OpenAirInterface Software Alliance licenses this file to You under + * the OAI Public License, Version 1.0 (the "License"); you may not use this file + * except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.openairinterface.org/?page_id=698 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *------------------------------------------------------------------------------- + * For more information about the OpenAirInterface (OAI) Software Alliance: + * contact@openairinterface.org + */ /*! \file flexran_agent_scheduler_dlsch_ue_remote.h * \brief Local stub for remote scheduler used by the controller diff --git a/openair2/LAYER2/MAC/flexran_dci_conversions.h b/openair2/LAYER2/MAC/flexran_dci_conversions.h index 038290d1b2..a417c39d20 100644 --- a/openair2/LAYER2/MAC/flexran_dci_conversions.h +++ b/openair2/LAYER2/MAC/flexran_dci_conversions.h @@ -1,31 +1,23 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see . - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@lists.eurecom.fr - - Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France. - - *******************************************************************************/ +/* + * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The OpenAirInterface Software Alliance licenses this file to You under + * the OAI Public License, Version 1.0 (the "License"); you may not use this file + * except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.openairinterface.org/?page_id=698 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *------------------------------------------------------------------------------- + * For more information about the OpenAirInterface (OAI) Software Alliance: + * contact@openairinterface.org + */ /*! \file flexran_dci_conversions.h * \brief Conversion helpers from flexran messages to OAI formats DCI diff --git a/openair2/UTIL/ASYNC_IF/link_manager.c b/openair2/UTIL/ASYNC_IF/link_manager.c index 0ab2ecc2b2..1c9fb72bfe 100644 --- a/openair2/UTIL/ASYNC_IF/link_manager.c +++ b/openair2/UTIL/ASYNC_IF/link_manager.c @@ -1,31 +1,24 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2015 Eurecom +/* + * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The OpenAirInterface Software Alliance licenses this file to You under + * the OAI Public License, Version 1.0 (the "License"); you may not use this file + * except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.openairinterface.org/?page_id=698 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *------------------------------------------------------------------------------- + * For more information about the OpenAirInterface (OAI) Software Alliance: + * contact@openairinterface.org + */ - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see . - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE - -*******************************************************************************/ /*! \file link_manager.c * \brief this is the implementation of a link manager * \author Cedric Roux diff --git a/openair2/UTIL/ASYNC_IF/link_manager.h b/openair2/UTIL/ASYNC_IF/link_manager.h index 4f0628c0ee..a25c072b41 100644 --- a/openair2/UTIL/ASYNC_IF/link_manager.h +++ b/openair2/UTIL/ASYNC_IF/link_manager.h @@ -1,31 +1,24 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2015 Eurecom +/* + * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The OpenAirInterface Software Alliance licenses this file to You under + * the OAI Public License, Version 1.0 (the "License"); you may not use this file + * except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.openairinterface.org/?page_id=698 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *------------------------------------------------------------------------------- + * For more information about the OpenAirInterface (OAI) Software Alliance: + * contact@openairinterface.org + */ - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see . - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE - -*******************************************************************************/ /*! \file link_manager.h * \brief this is the implementation of a link manager * \author Cedric Roux diff --git a/openair2/UTIL/ASYNC_IF/message_queue.c b/openair2/UTIL/ASYNC_IF/message_queue.c index 3e06b5021a..ee6c92d852 100644 --- a/openair2/UTIL/ASYNC_IF/message_queue.c +++ b/openair2/UTIL/ASYNC_IF/message_queue.c @@ -1,31 +1,24 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2015 Eurecom +/* + * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The OpenAirInterface Software Alliance licenses this file to You under + * the OAI Public License, Version 1.0 (the "License"); you may not use this file + * except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.openairinterface.org/?page_id=698 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *------------------------------------------------------------------------------- + * For more information about the OpenAirInterface (OAI) Software Alliance: + * contact@openairinterface.org + */ - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see . - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE - -*******************************************************************************/ /*! \file message_queue.c * \brief this is the implementation of a message queue * \author Cedric Roux diff --git a/openair2/UTIL/ASYNC_IF/message_queue.h b/openair2/UTIL/ASYNC_IF/message_queue.h index 15fc4335a1..4e46ec08d6 100644 --- a/openair2/UTIL/ASYNC_IF/message_queue.h +++ b/openair2/UTIL/ASYNC_IF/message_queue.h @@ -1,31 +1,24 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2015 Eurecom +/* + * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The OpenAirInterface Software Alliance licenses this file to You under + * the OAI Public License, Version 1.0 (the "License"); you may not use this file + * except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.openairinterface.org/?page_id=698 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *------------------------------------------------------------------------------- + * For more information about the OpenAirInterface (OAI) Software Alliance: + * contact@openairinterface.org + */ - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see . - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE - -*******************************************************************************/ /*! \file message_queue.h * \brief this is the implementation of a message queue * \author Cedric Roux diff --git a/openair2/UTIL/ASYNC_IF/ringbuffer_queue.c b/openair2/UTIL/ASYNC_IF/ringbuffer_queue.c index 0d63e41431..047e3f716c 100644 --- a/openair2/UTIL/ASYNC_IF/ringbuffer_queue.c +++ b/openair2/UTIL/ASYNC_IF/ringbuffer_queue.c @@ -1,31 +1,24 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2015 Eurecom +/* + * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The OpenAirInterface Software Alliance licenses this file to You under + * the OAI Public License, Version 1.0 (the "License"); you may not use this file + * except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.openairinterface.org/?page_id=698 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *------------------------------------------------------------------------------- + * For more information about the OpenAirInterface (OAI) Software Alliance: + * contact@openairinterface.org + */ - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see . - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE - -*******************************************************************************/ /*! \file ringbuffer_queue.c * \brief Lock-free ringbuffer used for async message passing of agent * \author Xenofon Foukas diff --git a/openair2/UTIL/ASYNC_IF/ringbuffer_queue.h b/openair2/UTIL/ASYNC_IF/ringbuffer_queue.h index 756a35ae4a..7dc4637404 100644 --- a/openair2/UTIL/ASYNC_IF/ringbuffer_queue.h +++ b/openair2/UTIL/ASYNC_IF/ringbuffer_queue.h @@ -1,31 +1,24 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2015 Eurecom +/* + * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The OpenAirInterface Software Alliance licenses this file to You under + * the OAI Public License, Version 1.0 (the "License"); you may not use this file + * except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.openairinterface.org/?page_id=698 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *------------------------------------------------------------------------------- + * For more information about the OpenAirInterface (OAI) Software Alliance: + * contact@openairinterface.org + */ - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see . - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE - -*******************************************************************************/ /*! \file ringbuffer_queue.h * \brief Lock-free ringbuffer used for async message passing of agent * \author Xenofon Foukas diff --git a/openair2/UTIL/ASYNC_IF/socket_link.c b/openair2/UTIL/ASYNC_IF/socket_link.c index f4bd248f78..720a55398c 100644 --- a/openair2/UTIL/ASYNC_IF/socket_link.c +++ b/openair2/UTIL/ASYNC_IF/socket_link.c @@ -1,31 +1,24 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2015 Eurecom +/* + * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The OpenAirInterface Software Alliance licenses this file to You under + * the OAI Public License, Version 1.0 (the "License"); you may not use this file + * except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.openairinterface.org/?page_id=698 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *------------------------------------------------------------------------------- + * For more information about the OpenAirInterface (OAI) Software Alliance: + * contact@openairinterface.org + */ - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see . - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE - -*******************************************************************************/ /*! \file socket_link.c * \brief this is the implementation of a TCP socket ASYNC IF * \author Cedric Roux diff --git a/openair2/UTIL/ASYNC_IF/socket_link.h b/openair2/UTIL/ASYNC_IF/socket_link.h index c9e99b839f..5b9f438c8a 100644 --- a/openair2/UTIL/ASYNC_IF/socket_link.h +++ b/openair2/UTIL/ASYNC_IF/socket_link.h @@ -1,31 +1,24 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2015 Eurecom +/* + * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The OpenAirInterface Software Alliance licenses this file to You under + * the OAI Public License, Version 1.0 (the "License"); you may not use this file + * except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.openairinterface.org/?page_id=698 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *------------------------------------------------------------------------------- + * For more information about the OpenAirInterface (OAI) Software Alliance: + * contact@openairinterface.org + */ - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see . - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@eurecom.fr - - Address : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE - -*******************************************************************************/ /*! \file socket_link.h * \brief this is the implementation of a TCP socket ASYNC IF * \author Cedric Roux From 726a543abf90b99e5fd54ca30e9b39f61c406019 Mon Sep 17 00:00:00 2001 From: "Wilson W.K. Thong" Date: Thu, 24 Nov 2016 20:07:55 +0800 Subject: [PATCH 311/349] fixed missing a slot_fep() processing on the 1st OFDM symbol of the first DL subframe after UL, causing no SI-RNTI DCI detected --- openair1/SCHED/phy_procedures_lte_ue.c | 41 +++++++++++++++++++------- 1 file changed, 30 insertions(+), 11 deletions(-) diff --git a/openair1/SCHED/phy_procedures_lte_ue.c b/openair1/SCHED/phy_procedures_lte_ue.c index 5dc629b90b..91d5fefb66 100644 --- a/openair1/SCHED/phy_procedures_lte_ue.c +++ b/openair1/SCHED/phy_procedures_lte_ue.c @@ -3299,11 +3299,23 @@ int phy_procedures_UE_RX(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uin l2 = (ue->frame_parms.symbols_per_tti/2)-1; } - //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - // RX processing of symbols l=1...l2 (l=0 is done in last scheduling epoch) - //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - +#if 1 // 2016-11-24 wilson fixed missing slot_fep on 1st ofdm symbol of the first DL subframe after UL + int prev_subframe_rx = (subframe_rx - 1)<0? 9: (subframe_rx - 1); + if (subframe_select(&ue->frame_parms,prev_subframe_rx) != SF_DL) { + //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + // RX processing of symbols l=0...l2 + //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + l=0; + } else { + //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + // RX processing of symbols l=1...l2 (l=0 is done in last scheduling epoch) + //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + l=1; + } + for (; l<=l2; l++) { +#else for (l=1; l<=l2; l++) { +#endif if (abstraction_flag == 0) { start_meas(&ue->ofdm_demod_stats); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SLOT_FEP, VCD_FUNCTION_IN); @@ -3424,13 +3436,20 @@ int phy_procedures_UE_RX(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uin ue_measurement_procedures(l-1,ue,proc,eNB_id,abstraction_flag,mode); } // for l=1..l2 - // do first symbol of next subframe for channel estimation - slot_fep(ue, - 0, - (2+(subframe_rx<<1))%20, - ue->rx_offset, - 0, - 0); + +#if 1 // 2016-11-24 wilson fixed missing slot_fep on 1st ofdm symbol of the first DL subframe after UL + // do first symbol of next downlink subframe for channel estimation + int next_subframe_rx = (1+subframe_rx)%10; + if (subframe_select(&ue->frame_parms,next_subframe_rx) != SF_UL) +#endif + { + slot_fep(ue, + 0, + (next_subframe_rx<<1), + ue->rx_offset, + 0, + 0); + } } // not an S-subframe // run pbch procedures if subframe is 0 From ae253f45b25cf246cfdca085531c472e30537a3c Mon Sep 17 00:00:00 2001 From: "Wilson W.K. Thong" Date: Fri, 25 Nov 2016 18:49:02 +0800 Subject: [PATCH 312/349] added more logs to debug missing SI-RNTI DCIs --- openair1/PHY/LTE_TRANSPORT/dci.c | 11 ++++++-- targets/RT/USER/lte-ue.c | 46 ++++++++++++++++++++++++++++---- 2 files changed, 50 insertions(+), 7 deletions(-) diff --git a/openair1/PHY/LTE_TRANSPORT/dci.c b/openair1/PHY/LTE_TRANSPORT/dci.c index 38cfc2c8c9..c27d156ad2 100644 --- a/openair1/PHY/LTE_TRANSPORT/dci.c +++ b/openair1/PHY/LTE_TRANSPORT/dci.c @@ -1126,6 +1126,9 @@ void pdcch_extract_rbs_dual(int32_t **rxdataF, int nushiftmod3 = frame_parms->nushift%3; symbol_mod = (symbol>=(7-frame_parms->Ncp)) ? symbol-(7-frame_parms->Ncp) : symbol; +#ifdef DEBUG_DCI_DECODING + LOG_I(PHY, "extract_rbs_dual: symbol_mod %d\n",symbol_mod); +#endif for (aarx=0; aarxnb_antennas_rx; aarx++) { @@ -2679,11 +2682,15 @@ void dci_decoding_procedure0(LTE_UE_PDCCH **pdcch_vars, nCCE = get_nCCE(pdcch_vars[eNB_id]->num_pdcch_symbols,frame_parms,mi); - if (nCCE > get_nCCE(3,frame_parms,1)) + if (nCCE > get_nCCE(3,frame_parms,1)) { + LOG_D(PHY,"skip DCI decoding: nCCE=%d > get_nCCE(3,frame_parms,1)=%d\n", nCCE, get_nCCE(3,frame_parms,1)); return; + } - if (nCCEmode ) == 0) { hw_slot_offset = (UE->rx_offset<<1) / UE->frame_parms.samples_per_tti; - LOG_I( HW, "Got synch: hw_slot_offset %d\n", hw_slot_offset ); + LOG_I( HW, "Got synch: hw_slot_offset %d, carrier off %d Hz, rxgain %d (DL %u, UL %u), UE_scan_carrier %d\n", + hw_slot_offset, + freq_offset, + UE->rx_total_gain_dB, + downlink_frequency[0][0]+freq_offset, + downlink_frequency[0][0]+uplink_frequency_offset[0][0]+freq_offset, + UE->UE_scan_carrier ); + if (UE->UE_scan_carrier == 1) { UE->UE_scan_carrier = 0; @@ -710,10 +717,21 @@ static void *UE_thread_rxn_txnp4(void *arg) while (sync_var<0) pthread_cond_wait(&sync_cond, &sync_mutex); +#if 1 // 2016-11-23 wilson add pthread name to the logging +#define THREAD_NAME_LEN 16 + char threadname[THREAD_NAME_LEN]; + ret = pthread_getname_np(proc->pthread_rxtx, threadname, THREAD_NAME_LEN); + if (ret != 0) + { + perror("pthread_getname_np : "); + exit_fun("Error getting thread name"); + } +#endif + pthread_mutex_unlock(&sync_mutex); printf("unlocked sync_mutex, waiting (UE_thread_rxtx)\n"); - printf("Starting UE RXN_TXNP4 thread\n"); + printf("Starting UE RXN_TXNP4 thread (%s)\n", threadname); while (!oai_exit) { if (pthread_mutex_lock(&proc->mutex_rxtx) != 0) { @@ -739,10 +757,27 @@ static void *UE_thread_rxn_txnp4(void *arg) VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_RX0_UE+(proc->subframe_rx&1), proc->frame_rx ); VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_TX0_UE+(proc->subframe_tx&1), proc->frame_tx ); - if ((subframe_select( &UE->frame_parms, proc->subframe_rx) == SF_DL) || - (UE->frame_parms.frame_type == FDD) || - (subframe_select( &UE->frame_parms, proc->subframe_rx ) == SF_S)) { + lte_subframe_t sf_type = subframe_select( &UE->frame_parms, proc->subframe_rx); + if ((sf_type == SF_DL) || + (UE->frame_parms.frame_type == FDD) || + (sf_type == SF_S)) { + if (UE->frame_parms.frame_type == TDD) { + LOG_D(PHY, "%s,TDD%d,%s: calling UE_RX\n", + threadname, + UE->frame_parms.tdd_config, + (sf_type==SF_DL? "SF_DL" : + (sf_type==SF_UL? "SF_UL" : + (sf_type==SF_S ? "SF_S" : "UNKNOWN_SF_TYPE")))); + } else { + LOG_D(PHY, "%s,%s,%s: calling UE_RX\n", + threadname, + (UE->frame_parms.frame_type==FDD? "FDD": + (UE->frame_parms.frame_type==TDD? "TDD":"UNKNOWN_DUPLEX_MODE")), + (sf_type==SF_DL? "SF_DL" : + (sf_type==SF_UL? "SF_UL" : + (sf_type==SF_S ? "SF_S" : "UNKNOWN_SF_TYPE")))); + } phy_procedures_UE_RX( UE, proc, 0, 0, UE->mode, no_relay, NULL ); } @@ -1122,6 +1157,7 @@ void *UE_thread(void *arg) { exit_fun("nothing to add"); return &UE_thread_retval; } + LOG_D(PHY, "firing up rxtx_thread[%d] at subframe %d\n", sf&1, sf); } else { LOG_E( PHY, "[SCHED][UE] UE RX thread busy (IC %d)!!\n", instance_cnt_rxtx); if (instance_cnt_rxtx > 2) { From e1b95332007859fb720d7ae9b0924962db85d3df Mon Sep 17 00:00:00 2001 From: "Wilson W.K. Thong" Date: Fri, 25 Nov 2016 18:56:08 +0800 Subject: [PATCH 313/349] enabled extra logs --- openair1/PHY/LTE_ESTIMATION/lte_ue_measurements.c | 4 ++-- openair1/PHY/LTE_TRANSPORT/dci.c | 10 +++++----- openair1/PHY/LTE_TRANSPORT/initial_sync.c | 2 +- openair1/PHY/LTE_TRANSPORT/pcfich.c | 6 +++--- openair1/SCHED/phy_procedures_lte_ue.c | 2 +- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/openair1/PHY/LTE_ESTIMATION/lte_ue_measurements.c b/openair1/PHY/LTE_ESTIMATION/lte_ue_measurements.c index b7b36efa0b..c7fc5c4e7d 100644 --- a/openair1/PHY/LTE_ESTIMATION/lte_ue_measurements.c +++ b/openair1/PHY/LTE_ESTIMATION/lte_ue_measurements.c @@ -32,7 +32,7 @@ #define k1 ((long long int) 1000) #define k2 ((long long int) (1024-k1)) -//#define DEBUG_MEAS +#define DEBUG_MEAS #ifdef USER_MODE void print_shorts(char *s,short *x) @@ -287,7 +287,7 @@ void ue_rrc_measurements(PHY_VARS_UE *ue, for (l=0,nu=0; l<=(4-ue->frame_parms.Ncp); l+=(4-ue->frame_parms.Ncp),nu=3) { k = (nu + nushift)%6; #ifdef DEBUG_MEAS - LOG_I(PHY,"[UE %d] Frame %d subframe %d Doing ue_rrc_measurements rsrp/rssi (Nid_cell %d, nushift %d, eNB_offset %d, k %d, l %d)\n",ue->Mod_id,ue->proc.proc_rxtx[subframe&1].frame_rx,subframe,Nid_cell,nushift, + LOG_D(PHY,"[UE %d] Frame %d subframe %d Doing ue_rrc_measurements rsrp/rssi (Nid_cell %d, nushift %d, eNB_offset %d, k %d, l %d)\n",ue->Mod_id,ue->proc.proc_rxtx[subframe&1].frame_rx,subframe,Nid_cell,nushift, eNB_offset,k,l); #endif diff --git a/openair1/PHY/LTE_TRANSPORT/dci.c b/openair1/PHY/LTE_TRANSPORT/dci.c index c27d156ad2..9554da33db 100644 --- a/openair1/PHY/LTE_TRANSPORT/dci.c +++ b/openair1/PHY/LTE_TRANSPORT/dci.c @@ -403,7 +403,7 @@ void pdcch_demapping(uint16_t *llr,uint16_t *wbar,LTE_DL_FRAME_PARMS *frame_parm for (i=0; i<4; i++) { wbar[mprime] = llr[tti_offset0+i]; #ifdef DEBUG_DCI_DECODING - LOG_I(PHY,"PDCCH demapping mprime %d.%d <= llr %d (symbol %d re %d) -> (%d,%d)\n",mprime/4,i,tti_offset0+i,symbol_offset,re_offset0,*(char*)&wbar[mprime],*(1+(char*)&wbar[mprime])); + LOG_D(PHY,"PDCCH demapping mprime %d.%d <= llr %d (symbol %d re %d) -> (%d,%d)\n",mprime/4,i,tti_offset0+i,symbol_offset,re_offset0,*(char*)&wbar[mprime],*(1+(char*)&wbar[mprime])); #endif mprime++; re_offset0++; @@ -419,7 +419,7 @@ void pdcch_demapping(uint16_t *llr,uint16_t *wbar,LTE_DL_FRAME_PARMS *frame_parm for (i=0; i<4; i++) { wbar[mprime] = llr[tti_offset+i]; #ifdef DEBUG_DCI_DECODING - LOG_I(PHY,"PDCCH demapping mprime %d.%d <= llr %d (symbol %d re %d) -> (%d,%d)\n",mprime/4,i,tti_offset+i,symbol_offset,re_offset+i,*(char*)&wbar[mprime],*(1+(char*)&wbar[mprime])); + LOG_D(PHY,"PDCCH demapping mprime %d.%d <= llr %d (symbol %d re %d) -> (%d,%d)\n",mprime/4,i,tti_offset+i,symbol_offset,re_offset+i,*(char*)&wbar[mprime],*(1+(char*)&wbar[mprime])); #endif mprime++; } @@ -2473,16 +2473,16 @@ void dci_decoding(uint8_t DCI_LENGTH, #ifdef DEBUG_DCI_DECODING for (i=0; i<16+DCI_LENGTH; i++) - LOG_I(PHY," DCI %d : (%d,%d,%d)\n",i,*(d_rx+96+(3*i)),*(d_rx+97+(3*i)),*(d_rx+98+(3*i))); + LOG_D(PHY," DCI %d : (%d,%d,%d)\n",i,*(d_rx+96+(3*i)),*(d_rx+97+(3*i)),*(d_rx+98+(3*i))); #endif memset(decoded_output,0,2+((16+DCI_LENGTH)>>3)); #ifdef DEBUG_DCI_DECODING - printf("Before Viterbi\n"); + LOG_D(PHY, "Before Viterbi\n"); for (i=0; i<16+DCI_LENGTH; i++) - printf("%d : (%d,%d,%d)\n",i,*(d_rx+96+(3*i)),*(d_rx+97+(3*i)),*(d_rx+98+(3*i))); + LOG_D(PHY, "%d : (%d,%d,%d)\n",i,*(d_rx+96+(3*i)),*(d_rx+97+(3*i)),*(d_rx+98+(3*i))); #endif //debug_printf("Doing DCI Viterbi \n"); diff --git a/openair1/PHY/LTE_TRANSPORT/initial_sync.c b/openair1/PHY/LTE_TRANSPORT/initial_sync.c index 663978e92c..7df08a8382 100644 --- a/openair1/PHY/LTE_TRANSPORT/initial_sync.c +++ b/openair1/PHY/LTE_TRANSPORT/initial_sync.c @@ -41,7 +41,7 @@ #include "common_lib.h" extern openair0_config_t openair0_cfg[]; -//#define DEBUG_INITIAL_SYNCH +#define DEBUG_INITIAL_SYNCH int pbch_detection(PHY_VARS_UE *ue, runmode_t mode) { diff --git a/openair1/PHY/LTE_TRANSPORT/pcfich.c b/openair1/PHY/LTE_TRANSPORT/pcfich.c index 8af540eea1..1d73d020a0 100644 --- a/openair1/PHY/LTE_TRANSPORT/pcfich.c +++ b/openair1/PHY/LTE_TRANSPORT/pcfich.c @@ -34,7 +34,7 @@ //uint16_t pcfich_reg[4]; //uint8_t pcfich_first_reg_idx = 0; -//#define DEBUG_PCFICH +#define DEBUG_PCFICH void generate_pcfich_reg_mapping(LTE_DL_FRAME_PARMS *frame_parms) { @@ -301,7 +301,7 @@ uint8_t rx_pcfich(LTE_DL_FRAME_PARMS *frame_parms, } #ifdef DEBUG_PCFICH - msg("metric %d : %d\n",i,metric); + LOG_I(PHY, "metric %d : %d\n",i,metric); #endif if (metric > old_metric) { @@ -311,7 +311,7 @@ uint8_t rx_pcfich(LTE_DL_FRAME_PARMS *frame_parms, } #ifdef DEBUG_PCFICH - msg("[PHY] PCFICH detected for %d PDCCH symbols\n",num_pdcch_symbols); + LOG_I(PHY, "PCFICH detected for %d PDCCH symbols\n",num_pdcch_symbols); #endif return(num_pdcch_symbols); } diff --git a/openair1/SCHED/phy_procedures_lte_ue.c b/openair1/SCHED/phy_procedures_lte_ue.c index 91d5fefb66..cc3f5e6e10 100644 --- a/openair1/SCHED/phy_procedures_lte_ue.c +++ b/openair1/SCHED/phy_procedures_lte_ue.c @@ -3279,7 +3279,7 @@ int phy_procedures_UE_RX(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uin #ifdef DEBUG_PHY_PROC - LOG_D(PHY,"[%s %d] Frame %d subframe %d: Doing phy_procedures_UE_RX (%d)\n", + LOG_I(PHY,"[%s %d] Frame %d subframe %d: Doing phy_procedures_UE_RX (-)\n", (r_type == multicast_relay) ? "RN/UE" : "UE", ue->Mod_id,frame_rx, subframe_rx); #endif From 81daba1931c308e254b65f4735a1c04bf115c599 Mon Sep 17 00:00:00 2001 From: "Wilson W.K. Thong" Date: Fri, 25 Nov 2016 18:57:33 +0800 Subject: [PATCH 314/349] Revert "enabled extra logs" This reverts commit 5466562b16d70f2729f6103e1c0d3ee619470191. --- openair1/PHY/LTE_ESTIMATION/lte_ue_measurements.c | 4 ++-- openair1/PHY/LTE_TRANSPORT/dci.c | 10 +++++----- openair1/PHY/LTE_TRANSPORT/initial_sync.c | 2 +- openair1/PHY/LTE_TRANSPORT/pcfich.c | 6 +++--- openair1/SCHED/phy_procedures_lte_ue.c | 2 +- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/openair1/PHY/LTE_ESTIMATION/lte_ue_measurements.c b/openair1/PHY/LTE_ESTIMATION/lte_ue_measurements.c index c7fc5c4e7d..b7b36efa0b 100644 --- a/openair1/PHY/LTE_ESTIMATION/lte_ue_measurements.c +++ b/openair1/PHY/LTE_ESTIMATION/lte_ue_measurements.c @@ -32,7 +32,7 @@ #define k1 ((long long int) 1000) #define k2 ((long long int) (1024-k1)) -#define DEBUG_MEAS +//#define DEBUG_MEAS #ifdef USER_MODE void print_shorts(char *s,short *x) @@ -287,7 +287,7 @@ void ue_rrc_measurements(PHY_VARS_UE *ue, for (l=0,nu=0; l<=(4-ue->frame_parms.Ncp); l+=(4-ue->frame_parms.Ncp),nu=3) { k = (nu + nushift)%6; #ifdef DEBUG_MEAS - LOG_D(PHY,"[UE %d] Frame %d subframe %d Doing ue_rrc_measurements rsrp/rssi (Nid_cell %d, nushift %d, eNB_offset %d, k %d, l %d)\n",ue->Mod_id,ue->proc.proc_rxtx[subframe&1].frame_rx,subframe,Nid_cell,nushift, + LOG_I(PHY,"[UE %d] Frame %d subframe %d Doing ue_rrc_measurements rsrp/rssi (Nid_cell %d, nushift %d, eNB_offset %d, k %d, l %d)\n",ue->Mod_id,ue->proc.proc_rxtx[subframe&1].frame_rx,subframe,Nid_cell,nushift, eNB_offset,k,l); #endif diff --git a/openair1/PHY/LTE_TRANSPORT/dci.c b/openair1/PHY/LTE_TRANSPORT/dci.c index 9554da33db..c27d156ad2 100644 --- a/openair1/PHY/LTE_TRANSPORT/dci.c +++ b/openair1/PHY/LTE_TRANSPORT/dci.c @@ -403,7 +403,7 @@ void pdcch_demapping(uint16_t *llr,uint16_t *wbar,LTE_DL_FRAME_PARMS *frame_parm for (i=0; i<4; i++) { wbar[mprime] = llr[tti_offset0+i]; #ifdef DEBUG_DCI_DECODING - LOG_D(PHY,"PDCCH demapping mprime %d.%d <= llr %d (symbol %d re %d) -> (%d,%d)\n",mprime/4,i,tti_offset0+i,symbol_offset,re_offset0,*(char*)&wbar[mprime],*(1+(char*)&wbar[mprime])); + LOG_I(PHY,"PDCCH demapping mprime %d.%d <= llr %d (symbol %d re %d) -> (%d,%d)\n",mprime/4,i,tti_offset0+i,symbol_offset,re_offset0,*(char*)&wbar[mprime],*(1+(char*)&wbar[mprime])); #endif mprime++; re_offset0++; @@ -419,7 +419,7 @@ void pdcch_demapping(uint16_t *llr,uint16_t *wbar,LTE_DL_FRAME_PARMS *frame_parm for (i=0; i<4; i++) { wbar[mprime] = llr[tti_offset+i]; #ifdef DEBUG_DCI_DECODING - LOG_D(PHY,"PDCCH demapping mprime %d.%d <= llr %d (symbol %d re %d) -> (%d,%d)\n",mprime/4,i,tti_offset+i,symbol_offset,re_offset+i,*(char*)&wbar[mprime],*(1+(char*)&wbar[mprime])); + LOG_I(PHY,"PDCCH demapping mprime %d.%d <= llr %d (symbol %d re %d) -> (%d,%d)\n",mprime/4,i,tti_offset+i,symbol_offset,re_offset+i,*(char*)&wbar[mprime],*(1+(char*)&wbar[mprime])); #endif mprime++; } @@ -2473,16 +2473,16 @@ void dci_decoding(uint8_t DCI_LENGTH, #ifdef DEBUG_DCI_DECODING for (i=0; i<16+DCI_LENGTH; i++) - LOG_D(PHY," DCI %d : (%d,%d,%d)\n",i,*(d_rx+96+(3*i)),*(d_rx+97+(3*i)),*(d_rx+98+(3*i))); + LOG_I(PHY," DCI %d : (%d,%d,%d)\n",i,*(d_rx+96+(3*i)),*(d_rx+97+(3*i)),*(d_rx+98+(3*i))); #endif memset(decoded_output,0,2+((16+DCI_LENGTH)>>3)); #ifdef DEBUG_DCI_DECODING - LOG_D(PHY, "Before Viterbi\n"); + printf("Before Viterbi\n"); for (i=0; i<16+DCI_LENGTH; i++) - LOG_D(PHY, "%d : (%d,%d,%d)\n",i,*(d_rx+96+(3*i)),*(d_rx+97+(3*i)),*(d_rx+98+(3*i))); + printf("%d : (%d,%d,%d)\n",i,*(d_rx+96+(3*i)),*(d_rx+97+(3*i)),*(d_rx+98+(3*i))); #endif //debug_printf("Doing DCI Viterbi \n"); diff --git a/openair1/PHY/LTE_TRANSPORT/initial_sync.c b/openair1/PHY/LTE_TRANSPORT/initial_sync.c index 7df08a8382..663978e92c 100644 --- a/openair1/PHY/LTE_TRANSPORT/initial_sync.c +++ b/openair1/PHY/LTE_TRANSPORT/initial_sync.c @@ -41,7 +41,7 @@ #include "common_lib.h" extern openair0_config_t openair0_cfg[]; -#define DEBUG_INITIAL_SYNCH +//#define DEBUG_INITIAL_SYNCH int pbch_detection(PHY_VARS_UE *ue, runmode_t mode) { diff --git a/openair1/PHY/LTE_TRANSPORT/pcfich.c b/openair1/PHY/LTE_TRANSPORT/pcfich.c index 1d73d020a0..8af540eea1 100644 --- a/openair1/PHY/LTE_TRANSPORT/pcfich.c +++ b/openair1/PHY/LTE_TRANSPORT/pcfich.c @@ -34,7 +34,7 @@ //uint16_t pcfich_reg[4]; //uint8_t pcfich_first_reg_idx = 0; -#define DEBUG_PCFICH +//#define DEBUG_PCFICH void generate_pcfich_reg_mapping(LTE_DL_FRAME_PARMS *frame_parms) { @@ -301,7 +301,7 @@ uint8_t rx_pcfich(LTE_DL_FRAME_PARMS *frame_parms, } #ifdef DEBUG_PCFICH - LOG_I(PHY, "metric %d : %d\n",i,metric); + msg("metric %d : %d\n",i,metric); #endif if (metric > old_metric) { @@ -311,7 +311,7 @@ uint8_t rx_pcfich(LTE_DL_FRAME_PARMS *frame_parms, } #ifdef DEBUG_PCFICH - LOG_I(PHY, "PCFICH detected for %d PDCCH symbols\n",num_pdcch_symbols); + msg("[PHY] PCFICH detected for %d PDCCH symbols\n",num_pdcch_symbols); #endif return(num_pdcch_symbols); } diff --git a/openair1/SCHED/phy_procedures_lte_ue.c b/openair1/SCHED/phy_procedures_lte_ue.c index cc3f5e6e10..91d5fefb66 100644 --- a/openair1/SCHED/phy_procedures_lte_ue.c +++ b/openair1/SCHED/phy_procedures_lte_ue.c @@ -3279,7 +3279,7 @@ int phy_procedures_UE_RX(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uin #ifdef DEBUG_PHY_PROC - LOG_I(PHY,"[%s %d] Frame %d subframe %d: Doing phy_procedures_UE_RX (-)\n", + LOG_D(PHY,"[%s %d] Frame %d subframe %d: Doing phy_procedures_UE_RX (%d)\n", (r_type == multicast_relay) ? "RN/UE" : "UE", ue->Mod_id,frame_rx, subframe_rx); #endif From 4a0e4b5e146bd882de0f1938734fb5ba91f8af57 Mon Sep 17 00:00:00 2001 From: "Wilson W.K. Thong" Date: Fri, 2 Dec 2016 18:35:19 +0800 Subject: [PATCH 315/349] fixing thread busy crash: add more VCD logs to debug timing issues --- openair1/PHY/LTE_TRANSPORT/rar_tools.c | 6 ++++ openair1/SCHED/phy_procedures_lte_ue.c | 17 +++++++++- openair2/UTIL/LOG/vcd_signal_dumper.c | 24 ++++++++++++++ openair2/UTIL/LOG/vcd_signal_dumper.h | 24 ++++++++++++++ targets/RT/USER/lte-ue.c | 43 +++++++++++++++++--------- 5 files changed, 98 insertions(+), 16 deletions(-) diff --git a/openair1/PHY/LTE_TRANSPORT/rar_tools.c b/openair1/PHY/LTE_TRANSPORT/rar_tools.c index f86c009543..60fa52df16 100644 --- a/openair1/PHY/LTE_TRANSPORT/rar_tools.c +++ b/openair1/PHY/LTE_TRANSPORT/rar_tools.c @@ -34,6 +34,7 @@ #include "SCHED/extern.h" #include "LAYER2/MAC/defs.h" #include "SCHED/defs.h" +#include "UTIL/LOG/vcd_signal_dumper.h" #include "assertions.h" @@ -171,6 +172,8 @@ int generate_ue_ulsch_params_from_rar(PHY_VARS_UE *ue, unsigned char eNB_id ) { + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_TX_ULSCH_RAR,VCD_FUNCTION_IN); + // RA_HEADER_RAPID *rarh = (RA_HEADER_RAPID *)rar_pdu; uint8_t transmission_mode = ue->transmission_mode[eNB_id]; unsigned char *rar_pdu = ue->dlsch_ra[eNB_id]->harq_processes[0]->b; @@ -315,6 +318,9 @@ int generate_ue_ulsch_params_from_rar(PHY_VARS_UE *ue, msg("ulsch ra (UE): TPC %d\n",ulsch->harq_processes[harq_pid]->TPC); msg("ulsch ra (UE): O %d\n",ulsch->O); msg("ulsch ra (UE): ORI %d\n",ulsch->O_RI); + + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_TX_ULSCH_RAR,VCD_FUNCTION_OUT); + //#endif return(0); } diff --git a/openair1/SCHED/phy_procedures_lte_ue.c b/openair1/SCHED/phy_procedures_lte_ue.c index 5dc629b90b..a4ef075726 100644 --- a/openair1/SCHED/phy_procedures_lte_ue.c +++ b/openair1/SCHED/phy_procedures_lte_ue.c @@ -942,6 +942,8 @@ void ulsch_common_procedures(PHY_VARS_UE *ue, UE_rxtx_proc_t *proc) { int dummy_tx_buffer[3840*4] __attribute__((aligned(16))); #endif + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_TX_ULSCH_COMMON,VCD_FUNCTION_IN); + start_meas(&ue->ofdm_mod_stats); nsymb = (frame_parms->Ncp == 0) ? 14 : 12; @@ -1043,7 +1045,7 @@ void ulsch_common_procedures(PHY_VARS_UE *ue, UE_rxtx_proc_t *proc) { stop_meas(&ue->ofdm_mod_stats); - + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_TX_ULSCH_COMMON,VCD_FUNCTION_OUT); } @@ -1054,6 +1056,8 @@ void ue_prach_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uin int prach_power; PRACH_RESOURCES_t prach_resources_local; + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_TX_PRACH, VCD_FUNCTION_IN); + ue->generate_prach=0; if (ue->mac_enabled==0){ @@ -1170,6 +1174,8 @@ void ue_prach_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uin if (ue->prach_cnt==3) ue->generate_prach=0; + + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_TX_PRACH, VCD_FUNCTION_OUT); } void ue_ulsch_uespec_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uint8_t abstraction_flag) { @@ -1189,6 +1195,8 @@ void ue_ulsch_uespec_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB uint8_t ulsch_input_buffer[5477] __attribute__ ((aligned(32))); uint8_t access_mode; + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_TX_ULSCH_UESPEC,VCD_FUNCTION_IN); + // get harq_pid from subframe relationship harq_pid = subframe2harq_pid(&ue->frame_parms, frame_tx, @@ -1455,6 +1463,9 @@ void ue_ulsch_uespec_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB ue->sr[subframe_tx]=0; } } // subframe_scheduling_flag==1 + + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_TX_ULSCH_UESPEC,VCD_FUNCTION_OUT); + } void ue_srs_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uint8_t abstraction_flag) @@ -1552,6 +1563,8 @@ void ue_pucch_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uin int tx_amp; int8_t Po_PUCCH; + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_TX_PUCCH,VCD_FUNCTION_IN); + SOUNDINGRS_UL_CONFIG_DEDICATED *pSoundingrs_ul_config_dedicated=&ue->soundingrs_ul_config_dedicated[eNB_id]; // 36.213 8.2 @@ -1742,6 +1755,8 @@ void ue_pucch_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uin } } // SR_Payload==1 + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_TX_PUCCH,VCD_FUNCTION_OUT); + // PUCCH 2x if (ue->generate_ul_signal[eNB_id] == 0) { // we have not generated ACK/NAK/SR in this subframe diff --git a/openair2/UTIL/LOG/vcd_signal_dumper.c b/openair2/UTIL/LOG/vcd_signal_dumper.c index d367ec7766..b65839cd90 100644 --- a/openair2/UTIL/LOG/vcd_signal_dumper.c +++ b/openair2/UTIL/LOG/vcd_signal_dumper.c @@ -174,6 +174,10 @@ const char* eurecomVariablesNames[] = { "ue0_SFN5", "ue0_SFN6", "ue0_SFN7", +#if 1 // 2016-11-29 wilson debug thread busy crash + "ue0_trx_read_ns", + "ue0_trx_write_ns", +#endif }; const char* eurecomFunctionsNames[] = { @@ -188,6 +192,19 @@ const char* eurecomFunctionsNames[] = { "ue_thread_synch", "ue_thread_rxtx0", "ue_thread_rxtx1", +#if 1 // 2016-11-29 wilson debug thread busy crash + "trx_read_sf9", + "trx_write_sf9", + "ue_signal_cond_rxtx", + "ue_wait_cond_rxtx0", + "ue_wait_cond_rxtx1", + "ue_lock_mutex_rxtx_for_cond_wait0", + "ue_lock_mutex_rxtx_for_cond_wait1", + "ue_lock_mutex_rxtx_for_cnt_decrement0", + "ue_lock_mutex_rxtx_for_cnt_decrement1", + "ue_lock_mutex_rxtx_for_cnt_increment0", + "ue_lock_mutex_rxtx_for_cnt_increment1", +#endif /* RRH signals */ "eNB_tx", @@ -218,6 +235,13 @@ const char* eurecomFunctionsNames[] = { "phy_eNB_slot_fep", "phy_procedures_ue_tx", "phy_procedures_ue_rx", +#if 1 // 2016-12-01 wilson debug long TX runtime in special subframe + "phy_procedures_ue_tx_ulsch_uespec", + "phy_procedures_ue_tx_pucch", + "phy_procedures_ue_tx_ulsch_common", + "phy_procedures_ue_tx_prach", + "phy_procedures_ue_tx_ulsch_rar", +#endif "phy_procedures_eNB_lte", "phy_procedures_UE_lte", "pdsch_thread", diff --git a/openair2/UTIL/LOG/vcd_signal_dumper.h b/openair2/UTIL/LOG/vcd_signal_dumper.h index 1e03e95002..f90775d824 100644 --- a/openair2/UTIL/LOG/vcd_signal_dumper.h +++ b/openair2/UTIL/LOG/vcd_signal_dumper.h @@ -146,6 +146,10 @@ typedef enum { VCD_SIGNAL_DUMPER_VARIABLES_UE0_SFN5, VCD_SIGNAL_DUMPER_VARIABLES_UE0_SFN6, VCD_SIGNAL_DUMPER_VARIABLES_UE0_SFN7, +#if 1 // 2016-11-29 wilson debug thread busy crash + VCD_SIGNAL_DUMPER_VARIABLES_UE0_TRX_READ_NS, + VCD_SIGNAL_DUMPER_VARIABLES_UE0_TRX_WRITE_NS, +#endif VCD_SIGNAL_DUMPER_VARIABLES_LAST, VCD_SIGNAL_DUMPER_VARIABLES_END = VCD_SIGNAL_DUMPER_VARIABLES_LAST, } vcd_signal_dump_variables; @@ -162,6 +166,19 @@ typedef enum { VCD_SIGNAL_DUMPER_FUNCTIONS_UE_THREAD_SYNCH, VCD_SIGNAL_DUMPER_FUNCTIONS_UE_THREAD_RXTX0, VCD_SIGNAL_DUMPER_FUNCTIONS_UE_THREAD_RXTX1, +#if 1 // 2016-11-29 wilson debug thread busy crash + VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_READ_SF9, + VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_WRITE_SF9, + VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SIGNAL_COND_RXTX, + VCD_SIGNAL_DUMPER_FUNCTIONS_UE_WAIT_COND_RXTX0, + VCD_SIGNAL_DUMPER_FUNCTIONS_UE_WAIT_COND_RXTX1, + VCD_SIGNAL_DUMPER_FUNCTIONS_UE_LOCK_MUTEX_RXTX_FOR_COND_WAIT0, + VCD_SIGNAL_DUMPER_FUNCTIONS_UE_LOCK_MUTEX_RXTX_FOR_COND_WAIT1, + VCD_SIGNAL_DUMPER_FUNCTIONS_UE_LOCK_MUTEX_RXTX_FOR_CNT_DECREMENT0, + VCD_SIGNAL_DUMPER_FUNCTIONS_UE_LOCK_MUTEX_RXTX_FOR_CNT_DECREMENT1, + VCD_SIGNAL_DUMPER_FUNCTIONS_UE_LOCK_MUTEX_RXTX_FOR_CNT_INCREMENT0, + VCD_SIGNAL_DUMPER_FUNCTIONS_UE_LOCK_MUTEX_RXTX_FOR_CNT_INCREMENT1, +#endif /* RRH signals */ VCD_SIGNAL_DUMPER_FUNCTIONS_eNB_TX, @@ -192,6 +209,13 @@ typedef enum { VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_SLOT_FEP, VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_TX, VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_RX, +#if 1 // 2016-12-01 wilson debug long TX runtime in special subframe + VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_TX_ULSCH_UESPEC, + VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_TX_PUCCH, + VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_TX_ULSCH_COMMON, + VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_TX_PRACH, + VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_TX_ULSCH_RAR, +#endif VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_ENB_LTE, VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_LTE, VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_THREAD, diff --git a/targets/RT/USER/lte-ue.c b/targets/RT/USER/lte-ue.c index 8e11a82638..395d767ad8 100644 --- a/targets/RT/USER/lte-ue.c +++ b/targets/RT/USER/lte-ue.c @@ -716,6 +716,7 @@ static void *UE_thread_rxn_txnp4(void *arg) printf("Starting UE RXN_TXNP4 thread\n"); while (!oai_exit) { + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_UE_LOCK_MUTEX_RXTX_FOR_COND_WAIT0+(proc->subframe_rx&1), 1 ); if (pthread_mutex_lock(&proc->mutex_rxtx) != 0) { LOG_E( PHY, "[SCHED][UE] error locking mutex for UE RXTX\n" ); exit_fun("nothing to add"); @@ -723,15 +724,18 @@ static void *UE_thread_rxn_txnp4(void *arg) } while (proc->instance_cnt_rxtx < 0) { + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_UE_WAIT_COND_RXTX0+(proc->subframe_rx&1), 1 ); // most of the time, the thread is waiting here pthread_cond_wait( &proc->cond_rxtx, &proc->mutex_rxtx ); } + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_UE_WAIT_COND_RXTX0+(proc->subframe_rx&1), 0 ); if (pthread_mutex_unlock(&proc->mutex_rxtx) != 0) { LOG_E( PHY, "[SCHED][UE] error unlocking mutex for UE RXn_TXnp4\n" ); exit_fun("nothing to add"); return &UE_thread_rxtx_retval; } + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_UE_LOCK_MUTEX_RXTX_FOR_COND_WAIT0+(proc->subframe_rx&1), 0 ); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_UE_THREAD_RXTX0+(proc->subframe_rx&1), 1 ); VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_SUBFRAME_NUMBER_RX0_UE+(proc->subframe_rx&1), proc->subframe_rx ); @@ -782,6 +786,7 @@ static void *UE_thread_rxn_txnp4(void *arg) VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_UE_THREAD_RXTX0+(proc->subframe_rx&1), 0 ); + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_UE_LOCK_MUTEX_RXTX_FOR_CNT_DECREMENT0+(proc->subframe_rx&1), 1 ); if (pthread_mutex_lock(&proc->mutex_rxtx) != 0) { LOG_E( PHY, "[SCHED][UE] error locking mutex for UE RXTX\n" ); exit_fun("noting to add"); @@ -796,6 +801,7 @@ static void *UE_thread_rxn_txnp4(void *arg) exit_fun("noting to add"); return &UE_thread_rxtx_retval; } + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_UE_LOCK_MUTEX_RXTX_FOR_CNT_DECREMENT0+(proc->subframe_rx&1), 0 ); } // thread finished @@ -1013,20 +1019,22 @@ void *UE_thread(void *arg) { for (i=0; iframe_parms.nb_antennas_rx; i++) rxp[i] = (void*)&rxdata[i][UE->frame_parms.ofdm_symbol_size+UE->frame_parms.nb_prefix_samples0+(sf*UE->frame_parms.samples_per_tti)]; // grab signal for subframe - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_READ, 1 ); if (UE->mode != loop_through_memory) { if (sf<9) { + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_READ, 1 ); rxs = UE->rfdevice.trx_read_func(&UE->rfdevice, ×tamp, rxp, UE->frame_parms.samples_per_tti, UE->frame_parms.nb_antennas_rx); - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_WRITE, 1 ); - // prepare tx buffer pointers + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_READ, 0 ); + VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_UE0_TRX_READ_NS, rxs ); + // prepare tx buffer pointers for (i=0; iframe_parms.nb_antennas_tx; i++) txp[i] = (void*)&UE->common_vars.txdata[i][((sf+2)%10)*UE->frame_parms.samples_per_tti]; + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_WRITE, 1 ); txs = UE->rfdevice.trx_write_func(&UE->rfdevice, timestamp+ (2*UE->frame_parms.samples_per_tti) - @@ -1036,27 +1044,25 @@ void *UE_thread(void *arg) { UE->frame_parms.samples_per_tti, UE->frame_parms.nb_antennas_tx, 1); - if (txs != UE->frame_parms.samples_per_tti) { - LOG_E(PHY,"TX : Timeout (sent %d/%d)\n",txs, UE->frame_parms.samples_per_tti); - exit_fun( "problem transmitting samples" ); - } - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_WRITE, 0 ); - + VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_UE0_TRX_WRITE_NS, rxs ); } else { + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_READ_SF9, 1 ); rxs = UE->rfdevice.trx_read_func(&UE->rfdevice, ×tamp, rxp, UE->frame_parms.samples_per_tti-UE->frame_parms.ofdm_symbol_size-UE->frame_parms.nb_prefix_samples0, UE->frame_parms.nb_antennas_rx); - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_WRITE, 1 ); + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_READ_SF9, 0 ); + VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_UE0_TRX_READ_NS, rxs ); + // prepare tx buffer pointers - for (i=0; iframe_parms.nb_antennas_tx; i++) txp[i] = (void*)&UE->common_vars.txdata[i][((sf+2)%10)*UE->frame_parms.samples_per_tti]; + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_WRITE_SF9, 1 ); txs = UE->rfdevice.trx_write_func(&UE->rfdevice, timestamp+ (2*UE->frame_parms.samples_per_tti) - @@ -1066,25 +1072,29 @@ void *UE_thread(void *arg) { UE->frame_parms.samples_per_tti - rx_off_diff, UE->frame_parms.nb_antennas_tx, 1); + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_WRITE_SF9, 0 ); + VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_UE0_TRX_WRITE_NS, rxs ); if (txs != UE->frame_parms.samples_per_tti - rx_off_diff) { LOG_E(PHY,"TX : Timeout (sent %d/%d)\n",txs, UE->frame_parms.samples_per_tti-rx_off_diff); exit_fun( "problem transmitting samples" ); } - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_WRITE, 0 ); + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_READ_SF9, 1 ); // read in first symbol of next frame and adjust for timing drift rxs = UE->rfdevice.trx_read_func(&UE->rfdevice, ×tamp1, (void**)rxdata, - UE->frame_parms.ofdm_symbol_size+UE->frame_parms.nb_prefix_samples0 - rx_off_diff, + UE->frame_parms.ofdm_symbol_size + UE->frame_parms.nb_prefix_samples0 - rx_off_diff, UE->frame_parms.nb_antennas_rx); - rx_off_diff = 0; + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_READ_SF9, 0 ); + VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_UE0_TRX_READ_NS, rxs ); + rx_off_diff = 0; } } - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_READ, 0 ); // operate on thread sf mod 2 UE_rxtx_proc_t *proc = &UE->proc.proc_rxtx[sf&1]; + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_UE_LOCK_MUTEX_RXTX_FOR_CNT_INCREMENT0+(proc->subframe_rx&1), 1 ); // lock mutex if (pthread_mutex_lock(&proc->mutex_rxtx) != 0) { LOG_E( PHY, "[SCHED][UE] error locking mutex for UE RX\n" ); @@ -1114,14 +1124,17 @@ void *UE_thread(void *arg) { exit_fun("nothing to add"); return &UE_thread_retval; } + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_UE_LOCK_MUTEX_RXTX_FOR_CNT_INCREMENT0+(proc->subframe_rx&1), 0 ); if (instance_cnt_rxtx == 0) { + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SIGNAL_COND_RXTX, 1 ); if (pthread_cond_signal(&proc->cond_rxtx) != 0) { LOG_E( PHY, "[SCHED][UE] ERROR pthread_cond_signal for UE RX thread\n" ); exit_fun("nothing to add"); return &UE_thread_retval; } + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SIGNAL_COND_RXTX, 0 ); } else { LOG_E( PHY, "[SCHED][UE] UE RX thread busy (IC %d)!!\n", instance_cnt_rxtx); if (instance_cnt_rxtx > 2) { From 8daa6897e9a0d4fced1a62d3556ccec4932b1982 Mon Sep 17 00:00:00 2001 From: "Wilson W.K. Thong" Date: Fri, 2 Dec 2016 18:37:34 +0800 Subject: [PATCH 316/349] fixing thread busy crash: add more error checking to catch timing issues --- openair1/SCHED/phy_procedures_lte_ue.c | 4 +-- targets/RT/USER/lte-ue.c | 37 ++++++++++++++++++++++---- 2 files changed, 34 insertions(+), 7 deletions(-) diff --git a/openair1/SCHED/phy_procedures_lte_ue.c b/openair1/SCHED/phy_procedures_lte_ue.c index a4ef075726..98168926c2 100644 --- a/openair1/SCHED/phy_procedures_lte_ue.c +++ b/openair1/SCHED/phy_procedures_lte_ue.c @@ -1225,8 +1225,8 @@ void ue_ulsch_uespec_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB } else { if (harq_pid==255) { - LOG_E(PHY,"[UE%d] Frame %d ulsch_decoding.c: FATAL ERROR: illegal harq_pid, returning\n", - Mod_id,frame_tx); + LOG_E(PHY,"[UE%d] Frame %d subframe %d ulsch_decoding.c: FATAL ERROR: illegal harq_pid, returning\n", + Mod_id,frame_tx, subframe_tx); mac_xface->macphy_exit("Error in ulsch_decoding"); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_TX, VCD_FUNCTION_OUT); stop_meas(&ue->phy_proc_tx); diff --git a/targets/RT/USER/lte-ue.c b/targets/RT/USER/lte-ue.c index 395d767ad8..14f841df4b 100644 --- a/targets/RT/USER/lte-ue.c +++ b/targets/RT/USER/lte-ue.c @@ -924,10 +924,11 @@ void *UE_thread(void *arg) { rxp, UE->frame_parms.samples_per_tti*10, UE->frame_parms.nb_antennas_rx); - + if (rxs!=UE->frame_parms.samples_per_tti*10) { - exit_fun("problem in rx"); + LOG_E(PHY, "problem in rx 1! want #samples=%d but got only %d!\n", UE->frame_parms.samples_per_tti*10, rxs); + exit_fun("problem in rx 1"); return &UE_thread_retval; } } @@ -960,7 +961,8 @@ void *UE_thread(void *arg) { UE->frame_parms.nb_antennas_rx); if (rxs!=UE->frame_parms.samples_per_tti){ - exit_fun("problem in rx"); + LOG_E(PHY, "problem in rx 2! want #samples=%d but got only %d!\n", UE->frame_parms.samples_per_tti, rxs); + exit_fun("problem in rx 2"); return &UE_thread_retval; } @@ -982,7 +984,8 @@ void *UE_thread(void *arg) { UE->rx_offset, UE->frame_parms.nb_antennas_rx); if (rxs != UE->rx_offset) { - exit_fun("problem in rx"); + LOG_E(PHY, "problem in rx 3! want #samples=%d but got only %d!\n", UE->rx_offset, rxs); + exit_fun("problem in rx 3!"); return &UE_thread_retval; } } @@ -996,6 +999,11 @@ void *UE_thread(void *arg) { (void**)rxdata, UE->frame_parms.ofdm_symbol_size+UE->frame_parms.nb_prefix_samples0, UE->frame_parms.nb_antennas_rx); + if (rxs != (UE->frame_parms.ofdm_symbol_size+UE->frame_parms.nb_prefix_samples0)) { + LOG_E(PHY, "problem in rx 4! want #samples=%d but got only %d!\n", UE->frame_parms.ofdm_symbol_size+UE->frame_parms.nb_prefix_samples0, rxs); + exit_fun("problem in rx 4!"); + return &UE_thread_retval; + } slot_fep(UE, 0, 0, @@ -1029,6 +1037,11 @@ void *UE_thread(void *arg) { UE->frame_parms.nb_antennas_rx); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_READ, 0 ); VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_UE0_TRX_READ_NS, rxs ); + if (rxs != UE->frame_parms.samples_per_tti) { + LOG_E(PHY, "problem in rx 5! want #samples=%d but got only %d!\n", UE->frame_parms.samples_per_tti, rxs); + exit_fun("problem in rx 5!"); + return &UE_thread_retval; + } // prepare tx buffer pointers for (i=0; iframe_parms.nb_antennas_tx; i++) @@ -1046,6 +1059,10 @@ void *UE_thread(void *arg) { 1); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_WRITE, 0 ); VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_UE0_TRX_WRITE_NS, rxs ); + if (txs != UE->frame_parms.samples_per_tti) { + LOG_E(PHY,"TX : Timeout (sent %d/%d)\n",txs, UE->frame_parms.samples_per_tti); + exit_fun( "problem transmitting samples" ); + } } else { @@ -1057,6 +1074,11 @@ void *UE_thread(void *arg) { UE->frame_parms.nb_antennas_rx); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_READ_SF9, 0 ); VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_UE0_TRX_READ_NS, rxs ); + if (rxs != (UE->frame_parms.samples_per_tti-UE->frame_parms.ofdm_symbol_size-UE->frame_parms.nb_prefix_samples0)) { + LOG_E(PHY, "problem in rx 6! want #samples=%d but got only %d!\n", UE->frame_parms.samples_per_tti-UE->frame_parms.ofdm_symbol_size-UE->frame_parms.nb_prefix_samples0, rxs); + exit_fun("problem in rx 6!"); + return &UE_thread_retval; + } // prepare tx buffer pointers for (i=0; iframe_parms.nb_antennas_tx; i++) @@ -1088,7 +1110,12 @@ void *UE_thread(void *arg) { UE->frame_parms.nb_antennas_rx); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_READ_SF9, 0 ); VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_UE0_TRX_READ_NS, rxs ); - rx_off_diff = 0; + if (rxs != (UE->frame_parms.ofdm_symbol_size + UE->frame_parms.nb_prefix_samples0 - rx_off_diff)) { + LOG_E(PHY, "problem in rx 7! want #samples=%d but got only %d! rx_off_diff=%d\n", UE->frame_parms.ofdm_symbol_size+UE->frame_parms.nb_prefix_samples0 - rx_off_diff, rxs, rx_off_diff); + exit_fun("problem in rx 7!"); + return &UE_thread_retval; + } + rx_off_diff = 0; } } // operate on thread sf mod 2 From 675e0b10cbc1e595b33982f3eb1ab59ff44d632c Mon Sep 17 00:00:00 2001 From: "Wilson W.K. Thong" Date: Fri, 2 Dec 2016 18:40:24 +0800 Subject: [PATCH 317/349] fixing thread busy crash: fixed incorrect processing of special-subframe TX as a normal TX --- targets/RT/USER/lte-ue.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/targets/RT/USER/lte-ue.c b/targets/RT/USER/lte-ue.c index 14f841df4b..b78bf36ed7 100644 --- a/targets/RT/USER/lte-ue.c +++ b/targets/RT/USER/lte-ue.c @@ -775,14 +775,21 @@ static void *UE_thread_rxn_txnp4(void *arg) } if ((subframe_select( &UE->frame_parms, proc->subframe_tx) == SF_UL) || - (UE->frame_parms.frame_type == FDD) || - (subframe_select( &UE->frame_parms, proc->subframe_tx ) == SF_S)) { + (UE->frame_parms.frame_type == FDD) ) { if (UE->mode != loop_through_memory) { phy_procedures_UE_TX(UE,proc,0,0,UE->mode,no_relay); } } + if ((subframe_select( &UE->frame_parms, proc->subframe_tx) == SF_S) && + (UE->frame_parms.frame_type == TDD)) { + + if (UE->mode != loop_through_memory) { + phy_procedures_UE_S_TX(UE,0,0,no_relay); + } + } + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_UE_THREAD_RXTX0+(proc->subframe_rx&1), 0 ); From 086520f50ec75ce9aca49cc6bd324df6628453f9 Mon Sep 17 00:00:00 2001 From: "Wilson W.K. Thong" Date: Fri, 25 Nov 2016 18:58:21 +0800 Subject: [PATCH 318/349] clean up changes for change submission issue #42 --- targets/RT/USER/lte-ue.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/targets/RT/USER/lte-ue.c b/targets/RT/USER/lte-ue.c index a35c0e59e3..3caaac7b7c 100644 --- a/targets/RT/USER/lte-ue.c +++ b/targets/RT/USER/lte-ue.c @@ -717,7 +717,6 @@ static void *UE_thread_rxn_txnp4(void *arg) while (sync_var<0) pthread_cond_wait(&sync_cond, &sync_mutex); -#if 1 // 2016-11-23 wilson add pthread name to the logging #define THREAD_NAME_LEN 16 char threadname[THREAD_NAME_LEN]; ret = pthread_getname_np(proc->pthread_rxtx, threadname, THREAD_NAME_LEN); @@ -726,7 +725,6 @@ static void *UE_thread_rxn_txnp4(void *arg) perror("pthread_getname_np : "); exit_fun("Error getting thread name"); } -#endif pthread_mutex_unlock(&sync_mutex); printf("unlocked sync_mutex, waiting (UE_thread_rxtx)\n"); From 6c6d20b622517552448d824649c373d305ff148b Mon Sep 17 00:00:00 2001 From: "Wilson W.K. Thong" Date: Tue, 6 Dec 2016 21:10:53 +0800 Subject: [PATCH 319/349] added logging to debug PRACH --- openair1/PHY/LTE_TRANSPORT/prach.c | 7 +++++++ openair1/SCHED/phy_procedures_lte_ue.c | 13 +++++++------ 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/openair1/PHY/LTE_TRANSPORT/prach.c b/openair1/PHY/LTE_TRANSPORT/prach.c index d9f5434cf5..33780a7def 100644 --- a/openair1/PHY/LTE_TRANSPORT/prach.c +++ b/openair1/PHY/LTE_TRANSPORT/prach.c @@ -629,6 +629,13 @@ int32_t generate_prach( PHY_VARS_UE *ue, uint8_t eNB_id, uint8_t subframe, uint1 #if defined(EXMIMO) || defined(OAI_USRP) 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); +#endif if (prach_start<0) prach_start+=(ue->frame_parms.samples_per_tti*LTE_NUMBER_OF_SUBFRAMES_PER_FRAME); diff --git a/openair1/SCHED/phy_procedures_lte_ue.c b/openair1/SCHED/phy_procedures_lte_ue.c index 5dc629b90b..f0811476eb 100644 --- a/openair1/SCHED/phy_procedures_lte_ue.c +++ b/openair1/SCHED/phy_procedures_lte_ue.c @@ -1142,14 +1142,15 @@ void ue_prach_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uin } else { UE_transport_info[ue->Mod_id][ue->CC_id].cntl.prach_flag=1; UE_transport_info[ue->Mod_id][ue->CC_id].cntl.prach_id=ue->prach_resources[eNB_id]->ra_PreambleIndex; - if (ue->mac_enabled==1){ - mac_xface->Msg1_transmitted(ue->Mod_id, - ue->CC_id, - frame_tx, - eNB_id); - } } + if (ue->mac_enabled==1){ + mac_xface->Msg1_transmitted(ue->Mod_id, + ue->CC_id, + frame_tx, + eNB_id); + } + LOG_D(PHY,"[UE %d][RAPROC] Frame %d, subframe %d: Generating PRACH (eNB %d) preamble index %d for UL, TX power %d dBm (PL %d dB), l3msg \n", ue->Mod_id,frame_tx,subframe_tx,eNB_id, ue->prach_resources[eNB_id]->ra_PreambleIndex, From 53777043c338e7a1a9e107078d2f2be4698c54ad Mon Sep 17 00:00:00 2001 From: "Wilson W.K. Thong" Date: Tue, 6 Dec 2016 21:10:30 +0800 Subject: [PATCH 320/349] fixed PRACH TA default value in TDD mode see issue #43 --- targets/RT/USER/lte-softmodem.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/targets/RT/USER/lte-softmodem.c b/targets/RT/USER/lte-softmodem.c index 9f98aaada1..e28f70a8c9 100644 --- a/targets/RT/USER/lte-softmodem.c +++ b/targets/RT/USER/lte-softmodem.c @@ -1594,8 +1594,16 @@ int main( int argc, char **argv ) UE[CC_id]->rx_total_gain_dB = (int)rx_gain[CC_id][0] + rx_gain_off; UE[CC_id]->tx_power_max_dBm = tx_max_power[CC_id]; - UE[CC_id]->N_TA_offset = 0; - + if (UE[CC_id]->frame_parms.frame_type == TDD) { + if (UE[CC_id]->frame_parms.N_RB_DL == 100) + UE[CC_id]->N_TA_offset = 624; + else if (UE[CC_id]->frame_parms.N_RB_DL == 50) + UE[CC_id]->N_TA_offset = 624/2; + else if (UE[CC_id]->frame_parms.N_RB_DL == 25) + UE[CC_id]->N_TA_offset = 624/4; + } else { + UE[CC_id]->N_TA_offset = 0; + } } // printf("tx_max_power = %d -> amp %d\n",tx_max_power,get_tx_amp(tx_max_poHwer,tx_max_power)); From 488b84cb4632fc081a4426028542a057ed30352e Mon Sep 17 00:00:00 2001 From: "Wilson W.K. Thong" Date: Fri, 2 Dec 2016 18:41:50 +0800 Subject: [PATCH 321/349] fixing thread busy crash: disabled timing consuming NAS logs see issue #44 --- openair3/NAS/COMMON/IES/EsmMessageContainer.c | 2 +- openair3/NAS/COMMON/UTIL/TLVDecoder.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/openair3/NAS/COMMON/IES/EsmMessageContainer.c b/openair3/NAS/COMMON/IES/EsmMessageContainer.c index 1a7f88d299..a223f36820 100644 --- a/openair3/NAS/COMMON/IES/EsmMessageContainer.c +++ b/openair3/NAS/COMMON/IES/EsmMessageContainer.c @@ -28,7 +28,7 @@ #include "EsmMessageContainer.h" #include "nas_log.h" -#define NAS_DEBUG 1 +//#define NAS_DEBUG 1 int decode_esm_message_container(EsmMessageContainer *esmmessagecontainer, uint8_t iei, uint8_t *buffer, uint32_t len) { diff --git a/openair3/NAS/COMMON/UTIL/TLVDecoder.h b/openair3/NAS/COMMON/UTIL/TLVDecoder.h index 801ab77c8d..37834c5660 100644 --- a/openair3/NAS/COMMON/UTIL/TLVDecoder.h +++ b/openair3/NAS/COMMON/UTIL/TLVDecoder.h @@ -26,7 +26,7 @@ #include "nas_log.h" #ifndef NAS_DEBUG -# define NAS_DEBUG 1 +//# define NAS_DEBUG 1 #endif #define DECODE_U8(bUFFER, vALUE, sIZE) \ From 4041a661fc7f86eb65ab37d86498b9b5a3703d9d Mon Sep 17 00:00:00 2001 From: "Wilson W.K. Thong" Date: Thu, 27 Oct 2016 14:33:52 +0800 Subject: [PATCH 322/349] fixed incorrect wiresahrk SFN/SF for UL/DL data --- openair1/SCHED/phy_procedures_lte_ue.c | 14 +++++----- openair2/LAYER2/MAC/defs.h | 12 ++++++--- openair2/LAYER2/MAC/openair2_proc.c | 2 +- openair2/LAYER2/MAC/proto.h | 11 +++++--- openair2/LAYER2/MAC/ra_procedures.c | 4 +-- openair2/LAYER2/MAC/ue_procedures.c | 36 ++++++++++++++------------ openair2/PHY_INTERFACE/defs.h | 2 +- targets/RT/USER/lte-ue.c | 12 +++++---- 8 files changed, 55 insertions(+), 38 deletions(-) diff --git a/openair1/SCHED/phy_procedures_lte_ue.c b/openair1/SCHED/phy_procedures_lte_ue.c index 5dc629b90b..9d1279c302 100644 --- a/openair1/SCHED/phy_procedures_lte_ue.c +++ b/openair1/SCHED/phy_procedures_lte_ue.c @@ -3684,12 +3684,14 @@ void phy_procedures_UE_lte(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,u if (ue->mac_enabled==1) { if (slot==0) { - ret = mac_xface->ue_scheduler(ue->Mod_id, - frame_tx, - subframe_rx, - subframe_select(&ue->frame_parms,subframe_tx), - eNB_id, - 0/*FIXME CC_id*/); + ret = mac_xface->ue_scheduler(ue->Mod_id, + frame_rx, + subframe_rx, + frame_tx, + subframe_tx, + subframe_select(&ue->frame_parms,subframe_tx), + eNB_id, + 0/*FIXME CC_id*/); if (ret == CONNECTION_LOST) { LOG_E(PHY,"[UE %d] Frame %d, subframe %d RRC Connection lost, returning to PRACH\n",ue->Mod_id, diff --git a/openair2/LAYER2/MAC/defs.h b/openair2/LAYER2/MAC/defs.h index 2235c3e1c4..96855dd1cd 100644 --- a/openair2/LAYER2/MAC/defs.h +++ b/openair2/LAYER2/MAC/defs.h @@ -995,10 +995,14 @@ typedef struct { /*!\brief Top level UE MAC structure */ typedef struct { uint16_t Node_id; - /// frame counter - frame_t frame; - /// subframe counter - sub_frame_t subframe; + /// RX frame counter + frame_t rxFrame; + /// RX subframe counter + sub_frame_t rxSubframe; + /// TX frame counter + frame_t txFrame; + /// TX subframe counter + sub_frame_t txSubframe; /// C-RNTI of UE uint16_t crnti; /// C-RNTI of UE before HO diff --git a/openair2/LAYER2/MAC/openair2_proc.c b/openair2/LAYER2/MAC/openair2_proc.c index 950713de5a..4b63571277 100644 --- a/openair2/LAYER2/MAC/openair2_proc.c +++ b/openair2/LAYER2/MAC/openair2_proc.c @@ -82,7 +82,7 @@ int openair2_stats_read(char *buffer, char **my_buffer, off_t off, int length) // mod_id used for PDCP and RLC Mod_id = NB_eNB_INST + ue_id ; - len+=sprintf(&buffer[len],"UE TTI: %d\n",UE_mac_inst[ue_id].frame); + len+=sprintf(&buffer[len],"UE RX TTI: %d\n",UE_mac_inst[ue_id].rxFrame); for (enb_id= 0; enb_id ra_SupervisionInfo.mac_ContentionResolutionTimer)<<3)); UE_mac_inst[module_idP].RA_contention_resolution_cnt++; @@ -1727,10 +1731,10 @@ ue_scheduler( } } - if (update_bsr(module_idP,frameP, eNB_indexP, lcid, UE_mac_inst[module_idP].scheduling_info.LCGID[lcid])) { + if (update_bsr(module_idP,txFrameP, eNB_indexP, lcid, UE_mac_inst[module_idP].scheduling_info.LCGID[lcid])) { UE_mac_inst[module_idP].scheduling_info.SR_pending= 1; LOG_D(MAC,"[UE %d][SR] Frame %d subframe %d SR for PUSCH is pending for LCGID %d with BSR level %d (%d bytes in RLC)\n", - module_idP, frameP,subframeP,UE_mac_inst[module_idP].scheduling_info.LCGID[lcid], + module_idP, txFrameP,txSubframeP,UE_mac_inst[module_idP].scheduling_info.LCGID[lcid], UE_mac_inst[module_idP].scheduling_info.BSR[UE_mac_inst[module_idP].scheduling_info.LCGID[lcid]], UE_mac_inst[module_idP].scheduling_info.BSR_bytes[UE_mac_inst[module_idP].scheduling_info.LCGID[lcid]]); } diff --git a/openair2/PHY_INTERFACE/defs.h b/openair2/PHY_INTERFACE/defs.h index 0892b4d0b1..e29ccdcc5e 100644 --- a/openair2/PHY_INTERFACE/defs.h +++ b/openair2/PHY_INTERFACE/defs.h @@ -169,7 +169,7 @@ typedef struct { void (*dl_phy_sync_success) (module_id_t Mod_id,frame_t frameP, uint8_t CH_index,uint8_t first_sync); /// Only calls the PDCP for now - UE_L2_STATE_t (*ue_scheduler)(module_id_t Mod_id, frame_t frameP,sub_frame_t subframe, lte_subframe_t direction, uint8_t eNB_id, int CC_id); + UE_L2_STATE_t (*ue_scheduler)(module_id_t Mod_id, frame_t rxFrameP,sub_frame_t rxSubframe, frame_t txFrameP,sub_frame_t txSubframe, lte_subframe_t direction, uint8_t eNB_id, int CC_id); /// PHY-Config-Dedicated UE void (*phy_config_dedicated_ue)(module_id_t Mod_id,int CC_id,uint8_t CH_index, diff --git a/targets/RT/USER/lte-ue.c b/targets/RT/USER/lte-ue.c index 8e11a82638..932e875752 100644 --- a/targets/RT/USER/lte-ue.c +++ b/targets/RT/USER/lte-ue.c @@ -749,11 +749,13 @@ static void *UE_thread_rxn_txnp4(void *arg) if (UE->mac_enabled==1) { ret = mac_xface->ue_scheduler(UE->Mod_id, - proc->frame_tx, - proc->subframe_rx, - subframe_select(&UE->frame_parms,proc->subframe_tx), - 0, - 0/*FIXME CC_id*/); + proc->frame_rx, + proc->subframe_rx, + proc->frame_tx, + proc->subframe_tx, + subframe_select(&UE->frame_parms,proc->subframe_tx), + 0, + 0/*FIXME CC_id*/); if (ret == CONNECTION_LOST) { LOG_E( PHY, "[UE %"PRIu8"] Frame %"PRIu32", subframe %u RRC Connection lost, returning to PRACH\n", From 55e50b20523bbe6ec94881c2b6836b911f132353 Mon Sep 17 00:00:00 2001 From: "Wilson W.K. Thong" Date: Fri, 2 Dec 2016 18:45:34 +0800 Subject: [PATCH 323/349] enhanced wireshark logging. also logs BCH, PRACH and RAR. Tested with wireshark 2.2.2 on linux and windows see issue #45 --- openair1/SCHED/phy_procedures_lte_ue.c | 13 +++++++++++++ openair2/LAYER2/MAC/proto.h | 4 ++++ openair2/LAYER2/MAC/ra_procedures.c | 2 +- openair2/LAYER2/MAC/rar_tools.c | 7 +++++++ openair2/PHY_INTERFACE/defs.h | 2 +- openair2/UTIL/OPT/probe.c | 16 +++++++++++----- 6 files changed, 37 insertions(+), 7 deletions(-) diff --git a/openair1/SCHED/phy_procedures_lte_ue.c b/openair1/SCHED/phy_procedures_lte_ue.c index 9d1279c302..db2c2788e5 100644 --- a/openair1/SCHED/phy_procedures_lte_ue.c +++ b/openair1/SCHED/phy_procedures_lte_ue.c @@ -56,6 +56,7 @@ fifo_dump_emos_UE emos_dump_UE; #endif #include "UTIL/LOG/vcd_signal_dumper.h" +#include "UTIL/OPT/opt.h" #if defined(ENABLE_ITTI) # include "intertask_interface.h" @@ -2302,6 +2303,17 @@ void ue_pbch_procedures(uint8_t eNB_id,PHY_VARS_UE *ue,UE_rxtx_proc_t *proc, uin if ((pbch_tx_ant>0) && (pbch_tx_ant<=4)) { + if (opt_enabled) { + static uint8_t dummy[3]; + dummy[0] = ue->pbch_vars[eNB_id]->decoded_output[2]; + dummy[1] = ue->pbch_vars[eNB_id]->decoded_output[1]; + dummy[2] = ue->pbch_vars[eNB_id]->decoded_output[0]; + trace_pdu(1, dummy, 3, ue->Mod_id, 0, 0, + frame_rx, subframe_rx, 0, 0); + LOG_D(OPT,"[UE %d][PBCH] Frame %d trace pdu for PBCH\n", + ue->Mod_id, subframe_rx); + } + if (pbch_tx_ant>2) { LOG_W(PHY,"[openair][SCHED][SYNCH] PBCH decoding: pbch_tx_ant>2 not supported\n"); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_PBCH_PROCEDURES, VCD_FUNCTION_OUT); @@ -2980,6 +2992,7 @@ void process_rar(PHY_VARS_UE *ue, UE_rxtx_proc_t *proc, int eNB_id, runmode_t mo timing_advance = mac_xface->ue_process_rar(ue->Mod_id, ue->CC_id, frame_rx, + ue->prach_resources[eNB_id]->ra_RNTI, dlsch0->harq_processes[0]->b, &ue->pdcch_vars[eNB_id]->crnti, ue->prach_resources[eNB_id]->ra_PreambleIndex); diff --git a/openair2/LAYER2/MAC/proto.h b/openair2/LAYER2/MAC/proto.h index 08f29f8f47..f6f59c1ed5 100644 --- a/openair2/LAYER2/MAC/proto.h +++ b/openair2/LAYER2/MAC/proto.h @@ -426,6 +426,9 @@ PRACH_RESOURCES_t *ue_get_rach(module_id_t module_idP,int CC_id,frame_t frameP,u /* \brief Function called by PHY to process the received RAR. It checks that the preamble matches what was sent by the eNB and provides the timing advance and t-CRNTI. @param Mod_id Index of UE instance +@param CC_id Index to a component carrier +@param frame Frame index +@param ra_rnti RA_RNTI value @param dlsch_buffer Pointer to dlsch_buffer containing RAR PDU @param t_crnti Pointer to PHY variable containing the T_CRNTI @param preamble_index Preamble Index used by PHY to transmit the PRACH. This should match the received RAR to trigger the rest of @@ -437,6 +440,7 @@ ue_process_rar( const module_id_t module_idP, const int CC_id, const frame_t frameP, + const rnti_t ra_rnti, uint8_t * const dlsch_buffer, rnti_t * const t_crnti, const uint8_t preamble_index diff --git a/openair2/LAYER2/MAC/ra_procedures.c b/openair2/LAYER2/MAC/ra_procedures.c index 7d562bb353..c62fa1a8a7 100644 --- a/openair2/LAYER2/MAC/ra_procedures.c +++ b/openair2/LAYER2/MAC/ra_procedures.c @@ -271,7 +271,7 @@ void Msg1_tx(module_id_t module_idP,uint8_t CC_id,frame_t frameP, uint8_t eNB_id UE_mac_inst[module_idP].RA_attempt_number++; if (opt_enabled) { - trace_pdu(0, NULL, 0, module_idP, 2, UE_mac_inst[module_idP].RA_prach_resources.ra_PreambleIndex, + trace_pdu(0, NULL, 0, module_idP, 0 , UE_mac_inst[module_idP].RA_prach_resources.ra_PreambleIndex, UE_mac_inst[module_idP].txFrame, UE_mac_inst[module_idP].txSubframe, 0, UE_mac_inst[module_idP].RA_attempt_number); LOG_D(OPT,"[UE %d][RAPROC] TX MSG1 Frame %d trace pdu for rnti %x with size %d\n", module_idP, frameP, 1, UE_mac_inst[module_idP].RA_Msg3_size); diff --git a/openair2/LAYER2/MAC/rar_tools.c b/openair2/LAYER2/MAC/rar_tools.c index c7bc9120c3..b453b5cca8 100644 --- a/openair2/LAYER2/MAC/rar_tools.c +++ b/openair2/LAYER2/MAC/rar_tools.c @@ -133,6 +133,7 @@ ue_process_rar( const module_id_t module_idP, const int CC_id, const frame_t frameP, + const rnti_t ra_rnti, uint8_t* const dlsch_buffer, rnti_t* const t_crnti, const uint8_t preamble_index @@ -168,6 +169,12 @@ ue_process_rar( LOG_D(MAC,"[UE %d][RAPROC] rar->t_crnti %x\n",module_idP,(uint16_t)rar[5]+(rar[4]<<8)); #endif + if (opt_enabled) { + LOG_D(OPT,"[UE %d][RAPROC] CC_id %d RAR Frame %d trace pdu for ra-RNTI %x\n", + module_idP, CC_id, frameP, ra_rnti); + trace_pdu(1, (uint8_t*)rarh, 7, module_idP, 2, ra_rnti, + UE_mac_inst[module_idP].rxFrame, UE_mac_inst[module_idP].rxSubframe, 0, 0); + } if (preamble_index == rarh->RAPID) { *t_crnti = (uint16_t)rar[5]+(rar[4]<<8);//rar->t_crnti; diff --git a/openair2/PHY_INTERFACE/defs.h b/openair2/PHY_INTERFACE/defs.h index e29ccdcc5e..b4a04e0b16 100644 --- a/openair2/PHY_INTERFACE/defs.h +++ b/openair2/PHY_INTERFACE/defs.h @@ -160,7 +160,7 @@ typedef struct { PRACH_RESOURCES_t* (*ue_get_rach)(module_id_t Mod_id,int CC_id,frame_t frameP,uint8_t Msg3_flag,sub_frame_t subframe); /// Process Random-Access Response - uint16_t (*ue_process_rar)(module_id_t Mod_id,int CC_id,frame_t frameP,uint8_t *dlsch_buffer,uint16_t *t_crnti,uint8_t preamble_index); + uint16_t (*ue_process_rar)(module_id_t Mod_id,int CC_id,frame_t frameP, uint16_t ra_rnti, uint8_t *dlsch_buffer, uint16_t *t_crnti,uint8_t preamble_index); /// Get SR payload (0,1) from UE MAC uint32_t (*ue_get_SR)(module_id_t Mod_id,int CC_id,frame_t frameP,uint8_t eNB_id,rnti_t rnti,sub_frame_t subframe); diff --git a/openair2/UTIL/OPT/probe.c b/openair2/UTIL/OPT/probe.c index a3836f5777..1c6b8e814b 100644 --- a/openair2/UTIL/OPT/probe.c +++ b/openair2/UTIL/OPT/probe.c @@ -304,19 +304,25 @@ static void SendFrame(guint8 radioType, guint8 direction, guint8 rntiType, frameBuffer[frameOffset++] = retx; } -#ifdef WIRESHARK_DEV +//#ifdef WIRESHARK_DEV /* Relating to out-of-band events */ /* N.B. dissector will only look to these fields if length is 0... */ if (pdu_buffer_size==0) { switch (oob_event) { case ltemac_send_preamble : - LOG_D(OPT,"oob event %d %d\n",ltemac_send_preamble ); + LOG_D(OPT,"oob ltemac_send_preamble event %02x." + //"%02x." + "%02x.%02x\n", + MAC_LTE_OOB_EVENT_TAG, + //ltemac_send_preamble, + rnti, + oob_event_value); //frameBuffer[frameOffset++]=0; //frameBuffer[frameOffset++]=0; //frameBuffer[frameOffset++]=0; frameBuffer[frameOffset++] = MAC_LTE_OOB_EVENT_TAG; - frameBuffer[frameOffset++]=ltemac_send_preamble; + //frameBuffer[frameOffset++]=ltemac_send_preamble; frameBuffer[frameOffset++]=rnti; // is the preamble frameBuffer[frameOffset++]=oob_event_value; break; @@ -329,12 +335,12 @@ static void SendFrame(guint8 radioType, guint8 direction, guint8 rntiType, case ltemac_sr_failure: default: - LOG_D(OPT,"not implemeneted yet\n"); + LOG_W(OPT,"not implemeneted yet\n"); break; } } -#endif +//#endif /***************************************/ /* Now write the MAC PDU */ frameBuffer[frameOffset++] = MAC_LTE_PAYLOAD_TAG; From 05a261ae6699903690b946e52037c6cd36077310 Mon Sep 17 00:00:00 2001 From: "Wilson W.K. Thong" Date: Wed, 7 Dec 2016 14:35:50 +0800 Subject: [PATCH 324/349] further clean up changes for change submission --- openair1/SCHED/phy_procedures_lte_ue.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/openair1/SCHED/phy_procedures_lte_ue.c b/openair1/SCHED/phy_procedures_lte_ue.c index 91d5fefb66..e6f27cca15 100644 --- a/openair1/SCHED/phy_procedures_lte_ue.c +++ b/openair1/SCHED/phy_procedures_lte_ue.c @@ -3299,7 +3299,6 @@ int phy_procedures_UE_RX(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uin l2 = (ue->frame_parms.symbols_per_tti/2)-1; } -#if 1 // 2016-11-24 wilson fixed missing slot_fep on 1st ofdm symbol of the first DL subframe after UL int prev_subframe_rx = (subframe_rx - 1)<0? 9: (subframe_rx - 1); if (subframe_select(&ue->frame_parms,prev_subframe_rx) != SF_DL) { //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ @@ -3313,9 +3312,6 @@ int phy_procedures_UE_RX(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uin l=1; } for (; l<=l2; l++) { -#else - for (l=1; l<=l2; l++) { -#endif if (abstraction_flag == 0) { start_meas(&ue->ofdm_demod_stats); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SLOT_FEP, VCD_FUNCTION_IN); @@ -3437,11 +3433,9 @@ int phy_procedures_UE_RX(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uin } // for l=1..l2 -#if 1 // 2016-11-24 wilson fixed missing slot_fep on 1st ofdm symbol of the first DL subframe after UL // do first symbol of next downlink subframe for channel estimation int next_subframe_rx = (1+subframe_rx)%10; if (subframe_select(&ue->frame_parms,next_subframe_rx) != SF_UL) -#endif { slot_fep(ue, 0, From e6671827bb78a59620bdaaaa73b86e27005905f7 Mon Sep 17 00:00:00 2001 From: "Wilson W.K. Thong" Date: Wed, 7 Dec 2016 14:42:26 +0800 Subject: [PATCH 325/349] clean up changes for submission --- openair2/UTIL/LOG/vcd_signal_dumper.c | 6 ------ openair2/UTIL/LOG/vcd_signal_dumper.h | 6 ------ 2 files changed, 12 deletions(-) diff --git a/openair2/UTIL/LOG/vcd_signal_dumper.c b/openair2/UTIL/LOG/vcd_signal_dumper.c index b65839cd90..86a7fbea3d 100644 --- a/openair2/UTIL/LOG/vcd_signal_dumper.c +++ b/openair2/UTIL/LOG/vcd_signal_dumper.c @@ -174,10 +174,8 @@ const char* eurecomVariablesNames[] = { "ue0_SFN5", "ue0_SFN6", "ue0_SFN7", -#if 1 // 2016-11-29 wilson debug thread busy crash "ue0_trx_read_ns", "ue0_trx_write_ns", -#endif }; const char* eurecomFunctionsNames[] = { @@ -192,7 +190,6 @@ const char* eurecomFunctionsNames[] = { "ue_thread_synch", "ue_thread_rxtx0", "ue_thread_rxtx1", -#if 1 // 2016-11-29 wilson debug thread busy crash "trx_read_sf9", "trx_write_sf9", "ue_signal_cond_rxtx", @@ -204,7 +201,6 @@ const char* eurecomFunctionsNames[] = { "ue_lock_mutex_rxtx_for_cnt_decrement1", "ue_lock_mutex_rxtx_for_cnt_increment0", "ue_lock_mutex_rxtx_for_cnt_increment1", -#endif /* RRH signals */ "eNB_tx", @@ -235,13 +231,11 @@ const char* eurecomFunctionsNames[] = { "phy_eNB_slot_fep", "phy_procedures_ue_tx", "phy_procedures_ue_rx", -#if 1 // 2016-12-01 wilson debug long TX runtime in special subframe "phy_procedures_ue_tx_ulsch_uespec", "phy_procedures_ue_tx_pucch", "phy_procedures_ue_tx_ulsch_common", "phy_procedures_ue_tx_prach", "phy_procedures_ue_tx_ulsch_rar", -#endif "phy_procedures_eNB_lte", "phy_procedures_UE_lte", "pdsch_thread", diff --git a/openair2/UTIL/LOG/vcd_signal_dumper.h b/openair2/UTIL/LOG/vcd_signal_dumper.h index f90775d824..19f5e8aab1 100644 --- a/openair2/UTIL/LOG/vcd_signal_dumper.h +++ b/openair2/UTIL/LOG/vcd_signal_dumper.h @@ -146,10 +146,8 @@ typedef enum { VCD_SIGNAL_DUMPER_VARIABLES_UE0_SFN5, VCD_SIGNAL_DUMPER_VARIABLES_UE0_SFN6, VCD_SIGNAL_DUMPER_VARIABLES_UE0_SFN7, -#if 1 // 2016-11-29 wilson debug thread busy crash VCD_SIGNAL_DUMPER_VARIABLES_UE0_TRX_READ_NS, VCD_SIGNAL_DUMPER_VARIABLES_UE0_TRX_WRITE_NS, -#endif VCD_SIGNAL_DUMPER_VARIABLES_LAST, VCD_SIGNAL_DUMPER_VARIABLES_END = VCD_SIGNAL_DUMPER_VARIABLES_LAST, } vcd_signal_dump_variables; @@ -166,7 +164,6 @@ typedef enum { VCD_SIGNAL_DUMPER_FUNCTIONS_UE_THREAD_SYNCH, VCD_SIGNAL_DUMPER_FUNCTIONS_UE_THREAD_RXTX0, VCD_SIGNAL_DUMPER_FUNCTIONS_UE_THREAD_RXTX1, -#if 1 // 2016-11-29 wilson debug thread busy crash VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_READ_SF9, VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_WRITE_SF9, VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SIGNAL_COND_RXTX, @@ -178,7 +175,6 @@ typedef enum { VCD_SIGNAL_DUMPER_FUNCTIONS_UE_LOCK_MUTEX_RXTX_FOR_CNT_DECREMENT1, VCD_SIGNAL_DUMPER_FUNCTIONS_UE_LOCK_MUTEX_RXTX_FOR_CNT_INCREMENT0, VCD_SIGNAL_DUMPER_FUNCTIONS_UE_LOCK_MUTEX_RXTX_FOR_CNT_INCREMENT1, -#endif /* RRH signals */ VCD_SIGNAL_DUMPER_FUNCTIONS_eNB_TX, @@ -209,13 +205,11 @@ typedef enum { VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_SLOT_FEP, VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_TX, VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_RX, -#if 1 // 2016-12-01 wilson debug long TX runtime in special subframe VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_TX_ULSCH_UESPEC, VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_TX_PUCCH, VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_TX_ULSCH_COMMON, VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_TX_PRACH, VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_TX_ULSCH_RAR, -#endif VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_ENB_LTE, VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_LTE, VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_THREAD, From bd30471076e9624c9c3041fb138fba87e9f8248e Mon Sep 17 00:00:00 2001 From: gabrielC Date: Thu, 8 Dec 2016 11:07:38 +0100 Subject: [PATCH 326/349] [OAI-UE] merge com4Innov branch to integration branch --- cmake_targets/CMakeLists.txt | 4 +- openair1/PHY/defs.h | 2 +- openair2/COMMON/commonDef.h | 2 +- openair2/LAYER2/MAC/ue_procedures.c | 2 +- openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c | 2 +- openair2/LAYER2/RLC/UM_v9.3.0/rlc_um.c | 18 +++++- openair2/LAYER2/RLC/UM_v9.3.0/rlc_um.h | 2 +- openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_test.c | 8 +-- openair2/LAYER2/RLC/rlc_mac.c | 2 +- openair2/NETWORK_DRIVER/UE_IP/common.c | 5 +- openair3/NAS/COMMON/EMM/MSG/AttachAccept.c | 3 +- .../COMMON/EMM/MSG/AuthenticationRequest.c | 2 +- .../NAS/COMMON/EMM/MSG/SecurityModeCommand.c | 2 + .../NAS/COMMON/EMM/MSG/SecurityModeComplete.c | 5 +- openair3/NAS/COMMON/IES/EmergencyNumberList.c | 54 ++++++++++++++---- openair3/NAS/COMMON/IES/EmergencyNumberList.h | 10 +++- openair3/NAS/COMMON/IES/MobileIdentity.c | 15 +++-- openair3/NAS/COMMON/IES/MobileIdentity.h | 57 ++++++++++++++++++- openair3/NAS/UE/EMM/SAP/emm_asDef.h | 1 + openair3/NAS/UE/EMM/SAP/emm_recv.c | 4 +- openair3/NAS/UE/EMM/SAP/emm_send.c | 29 ++++++++++ openair3/NAS/UE/EMM/SecurityModeControl.c | 3 +- openair3/NAS/UE/EMM/emm_proc.h | 2 +- targets/TEST/PDCP/with_rlc/test_pdcp_rlc.c | 4 +- 24 files changed, 194 insertions(+), 44 deletions(-) diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index 07d92a1b05..891001ecbc 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -644,7 +644,7 @@ add_boolean_option(ENABLE_USE_CPU_EXECUTION_TIME True "Add data in vcd traces: d add_boolean_option(ENABLE_VCD True "always true now, time measurements of proc calls and var displays") add_boolean_option(ENABLE_VCD_FIFO True "time measurements of proc calls and var displays sent to FIFO (one more thread)") add_boolean_option(HARD_RT False "???") -add_boolean_option(LINUX False "used in weird memcpy() in pdcp.c ???") +add_boolean_option(LINUX True "used in weird memcpy() in pdcp.c ???") add_boolean_option(LINUX_LIST False "used only in lists.c: either use OAI implementation of lists or Linux one (should be True, but it is False") add_boolean_option(LOG_NO_THREAD True "Disable thread for log, seems always set to true") add_boolean_option(OPENAIR_LTE True "Seems legacy: keep it to true") @@ -727,7 +727,7 @@ add_boolean_option(TRACE_RLC_UM_TX_STATUS False "TRACE for RLC UM, TO BE CHANGE ########################## # PDCP LAYER OPTIONS ########################## -add_boolean_option(PDCP_USE_NETLINK False "For eNB, PDCP communicate with a NETLINK socket if connected to network driver, else could use a RT-FIFO") +add_boolean_option(PDCP_USE_NETLINK True "For eNB, PDCP communicate with a NETLINK socket if connected to network driver, else could use a RT-FIFO") add_boolean_option(PDCP_USE_NETLINK_QUEUES False "When PDCP_USE_NETLINK is true, incoming IP packets are stored in queues") add_boolean_option(LINK_ENB_PDCP_TO_IP_DRIVER False "For eNB, PDCP communicate with a IP driver") add_boolean_option(LINK_ENB_PDCP_TO_GTPV1U True "For eNB, PDCP communicate with GTP-U protocol (eNB<->S-GW)") diff --git a/openair1/PHY/defs.h b/openair1/PHY/defs.h index 375efa5fea..0e69265d20 100644 --- a/openair1/PHY/defs.h +++ b/openair1/PHY/defs.h @@ -656,7 +656,7 @@ typedef struct { /// \brief Total gains with bypassed RF gain stage (ExpressMIMO2/Lime) uint32_t rx_gain_byp[4]; /// \brief Current transmit power - int8_t tx_power_dBm[10]; + int16_t tx_power_dBm[10]; /// \brief Total number of REs in current transmission int tx_total_RE[10]; /// \brief Maximum transmit power diff --git a/openair2/COMMON/commonDef.h b/openair2/COMMON/commonDef.h index cfd5d68e40..ae1bdaf994 100644 --- a/openair2/COMMON/commonDef.h +++ b/openair2/COMMON/commonDef.h @@ -119,7 +119,7 @@ typedef struct { Byte_t digit14:4; Byte_t digit13:4; #define EVEN_PARITY 0 -#define ODD_PARITY 1 +#define ODD_PARITY 0xf Byte_t parity:4; Byte_t digit15:4; } num; diff --git a/openair2/LAYER2/MAC/ue_procedures.c b/openair2/LAYER2/MAC/ue_procedures.c index 886ccff238..642475a063 100644 --- a/openair2/LAYER2/MAC/ue_procedures.c +++ b/openair2/LAYER2/MAC/ue_procedures.c @@ -1356,7 +1356,7 @@ void ue_get_sdu(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_t subf // Trigger BSR Periodic UE_mac_inst[module_idP].BSR_reporting_active |= BSR_TRIGGER_PERIODIC; - LOG_I(MAC,"[UE %d] MAC BSR Triggered PeriodicBSR Timer expiry at frame%d subframe %d TBS=%d\n", + LOG_D(MAC,"[UE %d] MAC BSR Triggered PeriodicBSR Timer expiry at frame%d subframe %d TBS=%d\n", module_idP, frameP, subframe, buflen); } diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c index 17808c03ff..fedef42b60 100644 --- a/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c +++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c @@ -493,7 +493,7 @@ int pdcp_fifo_read_input_sdus (const protocol_ctxt_t* const ctxt_pP) ctxt.enb_flag = ctxt_cpy.enb_flag; #ifdef PDCP_DEBUG - LOG_I(PDCP, "[PDCP][NETLINK] pdcp_read_header_g.rb_id = %d\n", pdcp_read_header_g.rb_id); + LOG_D(PDCP, "[PDCP][NETLINK] pdcp_read_header_g.rb_id = %d\n", pdcp_read_header_g.rb_id); #endif if (ctxt_cpy.enb_flag) { diff --git a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um.c b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um.c index 3232399d10..51440d0bfa 100644 --- a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um.c +++ b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um.c @@ -426,7 +426,7 @@ rlc_um_rx (const protocol_ctxt_t* const ctxt_pP, void *argP, struct mac_data_ind //----------------------------------------------------------------------------- struct mac_status_resp -rlc_um_mac_status_indication (const protocol_ctxt_t* const ctxt_pP, void *rlc_pP, uint16_t tbs_sizeP, struct mac_status_ind tx_statusP) +rlc_um_mac_status_indication (const protocol_ctxt_t* const ctxt_pP, void *rlc_pP, uint16_t tbs_sizeP, struct mac_status_ind tx_statusP,const eNB_flag_t enb_flagP) { struct mac_status_resp status_resp; uint16_t sdu_size = 0; @@ -434,6 +434,7 @@ rlc_um_mac_status_indication (const protocol_ctxt_t* const ctxt_pP, void *rlc_pP int32_t diff_time=0; rlc_um_entity_t *rlc_p = NULL; mem_block_t *mb_p = NULL; + unsigned int max_li_overhead = 0; status_resp.buffer_occupancy_in_pdus = 0; status_resp.buffer_occupancy_in_bytes = 0; @@ -453,7 +454,20 @@ rlc_um_mac_status_indication (const protocol_ctxt_t* const ctxt_pP, void *rlc_pP if ((status_resp.buffer_occupancy_in_bytes > 0) && ((mb_p = list_get_head(&rlc_p->input_sdus)) != NULL)) { - status_resp.buffer_occupancy_in_bytes += rlc_p->tx_header_min_length_in_bytes; + //Fix on full Header size + if (enb_flagP == ENB_FLAG_NO) + { + // compute Length Indicator overhead to inform MAC of maximum full RLC PDU size according to stored SDUs + // For UE scheduler + // Could be useful for eNB: to be checked + if (rlc_p->input_sdus.nb_elements <= 1) { + max_li_overhead = 0; + } else { + unsigned int num_li = rlc_p->input_sdus.nb_elements - 1; + max_li_overhead = num_li + (num_li >> 1) + (num_li & 1); + } + } + status_resp.buffer_occupancy_in_bytes += (rlc_p->tx_header_min_length_in_bytes + max_li_overhead); status_resp.buffer_occupancy_in_pdus = rlc_p->input_sdus.nb_elements; diff_time = ctxt_pP->frame - ((struct rlc_um_tx_sdu_management *)mb_p->data)->sdu_creation_time; diff --git a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um.h b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um.h index d87f1e29d0..5951eaf149 100644 --- a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um.h +++ b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um.h @@ -186,7 +186,7 @@ protected_rlc_um( void rlc_um_rx (const protocol_ctxt_t* const ctxt_pP, rlc_ * \param[in] tx_statusP Transmission status given by MAC on previous MAC transmission of the PDU. * \return The maximum number of bytes that can be served by RLC instance to MAC. */ -public_rlc_um( struct mac_status_resp rlc_um_mac_status_indication (const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t * const rlc_pP, uint16_t tbs_sizeP, struct mac_status_ind tx_statusP);) +public_rlc_um( struct mac_status_resp rlc_um_mac_status_indication (const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t * const rlc_pP, uint16_t tbs_sizeP, struct mac_status_ind tx_statusP, const eNB_flag_t enb_flagP);) /*! \fn struct mac_data_req rlc_um_mac_data_request (const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t * const rlc_pP) * \brief Gives PDUs to lower layer MAC. diff --git a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_test.c b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_test.c index c9a82e12f6..92f18e72d7 100644 --- a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_test.c +++ b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_test.c @@ -471,9 +471,9 @@ void rlc_um_v9_3_0_test_exchange_pdus(rlc_um_entity_t *um_txP, memset(&mac_rlc_status_resp_tx, 0, sizeof(struct mac_status_resp)); memset(&mac_rlc_status_resp_rx, 0, sizeof(struct mac_status_resp)); - mac_rlc_status_resp_tx = rlc_um_mac_status_indication(um_txP, g_frame, 1, bytes_txP, tx_status); + mac_rlc_status_resp_tx = rlc_um_mac_status_indication(um_txP, g_frame, 1, bytes_txP, tx_status,ENB_FLAG_YES); data_request_tx = rlc_um_mac_data_request(um_txP, g_frame); - mac_rlc_status_resp_rx = rlc_um_mac_status_indication(um_rxP, g_frame, 0, bytes_rxP, tx_status); + mac_rlc_status_resp_rx = rlc_um_mac_status_indication(um_rxP, g_frame, 0, bytes_rxP, tx_status,ENB_FLAG_YES); data_request_rx = rlc_um_mac_data_request(um_rxP, g_frame); @@ -517,9 +517,9 @@ void rlc_um_v9_3_0_test_exchange_delayed_pdus(rlc_um_entity_t *um_txP, memset(&mac_rlc_status_resp_tx, 0, sizeof(struct mac_status_resp)); memset(&mac_rlc_status_resp_rx, 0, sizeof(struct mac_status_resp)); - mac_rlc_status_resp_tx = rlc_um_mac_status_indication(um_txP, g_frame, 1, bytes_txP, tx_status); + mac_rlc_status_resp_tx = rlc_um_mac_status_indication(um_txP, g_frame, 1, bytes_txP, tx_status,ENB_FLAG_YES); data_request_tx = rlc_um_mac_data_request(um_txP, g_frame); - mac_rlc_status_resp_rx = rlc_um_mac_status_indication(um_rxP, g_frame, 0, bytes_rxP, tx_status); + mac_rlc_status_resp_rx = rlc_um_mac_status_indication(um_rxP, g_frame, 0, bytes_rxP, tx_status,ENB_FLAG_YES); data_request_rx = rlc_um_mac_data_request(um_rxP, g_frame); diff --git a/openair2/LAYER2/RLC/rlc_mac.c b/openair2/LAYER2/RLC/rlc_mac.c index 6462bb9abb..d59b187dc7 100644 --- a/openair2/LAYER2/RLC/rlc_mac.c +++ b/openair2/LAYER2/RLC/rlc_mac.c @@ -406,7 +406,7 @@ mac_rlc_status_resp_t mac_rlc_status_ind( break; case RLC_MODE_UM: - status_resp = rlc_um_mac_status_indication(&ctxt, &rlc_union_p->rlc.um, tb_sizeP, tx_status); + status_resp = rlc_um_mac_status_indication(&ctxt, &rlc_union_p->rlc.um, tb_sizeP, tx_status, enb_flagP); mac_rlc_status_resp.bytes_in_buffer = status_resp.buffer_occupancy_in_bytes; mac_rlc_status_resp.pdus_in_buffer = status_resp.buffer_occupancy_in_pdus; mac_rlc_status_resp.head_sdu_creation_time = status_resp.head_sdu_creation_time; diff --git a/openair2/NETWORK_DRIVER/UE_IP/common.c b/openair2/NETWORK_DRIVER/UE_IP/common.c index 6bef269de8..8696801597 100644 --- a/openair2/NETWORK_DRIVER/UE_IP/common.c +++ b/openair2/NETWORK_DRIVER/UE_IP/common.c @@ -99,7 +99,8 @@ ue_ip_common_class_wireless2ip( hard_header_len = ue_ip_dev[instP]->hard_header_len; skb_set_mac_header(skb_p, 0); - + skb_set_network_header(skb_p, hard_header_len); +skb_p->mark = rb_idP; //printk("[NAC_COMMIN_RECEIVE]: Packet Type %d (%d,%d)",skb_p->pkt_type,PACKET_HOST,PACKET_BROADCAST); skb_p->pkt_type = PACKET_HOST; @@ -344,7 +345,7 @@ void ue_ip_common_wireless2ip(struct nlmsghdr *nlh_pP) ue_ip_common_class_wireless2ip(pdcph_p->data_size, (unsigned char *)NLMSG_DATA(nlh_pP) + UE_IP_PDCPH_SIZE, - pdcph_p->inst, + 1, //pdcph_p->inst, pdcph_p->rb_id); } diff --git a/openair3/NAS/COMMON/EMM/MSG/AttachAccept.c b/openair3/NAS/COMMON/EMM/MSG/AttachAccept.c index cec2d16977..248540dff3 100644 --- a/openair3/NAS/COMMON/EMM/MSG/AttachAccept.c +++ b/openair3/NAS/COMMON/EMM/MSG/AttachAccept.c @@ -188,10 +188,11 @@ int decode_attach_accept(attach_accept_msg *attach_accept, uint8_t *buffer, uint default: errorCodeDecoder = TLV_DECODE_UNEXPECTED_IEI; + LOG_TRACE(WARNING, "DECODE_UNEXPECTED_IEI %x (4 bits)", ieiDecoded); return TLV_DECODE_UNEXPECTED_IEI; } } - + LOG_TRACE(WARNING, "DECODED %d\n", decoded); return decoded; } diff --git a/openair3/NAS/COMMON/EMM/MSG/AuthenticationRequest.c b/openair3/NAS/COMMON/EMM/MSG/AuthenticationRequest.c index fac93c5df3..3e0bffde2d 100644 --- a/openair3/NAS/COMMON/EMM/MSG/AuthenticationRequest.c +++ b/openair3/NAS/COMMON/EMM/MSG/AuthenticationRequest.c @@ -38,7 +38,7 @@ int decode_authentication_request(authentication_request_msg *authentication_req CHECK_PDU_POINTER_AND_LENGTH_DECODER(buffer, AUTHENTICATION_REQUEST_MINIMUM_LENGTH, len); /* Decoding mandatory fields */ - if ((decoded_result = decode_u8_nas_key_set_identifier(&authentication_request->naskeysetidentifierasme, 0, *(buffer + decoded) >> 4, len - decoded)) < 0) + if ((decoded_result = decode_u8_nas_key_set_identifier(&authentication_request->naskeysetidentifierasme, 0, *(buffer + decoded), len - decoded)) < 0) return decoded_result; decoded++; diff --git a/openair3/NAS/COMMON/EMM/MSG/SecurityModeCommand.c b/openair3/NAS/COMMON/EMM/MSG/SecurityModeCommand.c index aeec3d4024..c89a9f5bb7 100644 --- a/openair3/NAS/COMMON/EMM/MSG/SecurityModeCommand.c +++ b/openair3/NAS/COMMON/EMM/MSG/SecurityModeCommand.c @@ -72,6 +72,8 @@ int decode_security_mode_command(security_mode_command_msg *security_mode_comman decoded += decoded_result; /* Set corresponding mask to 1 in presencemask */ security_mode_command->presencemask |= SECURITY_MODE_COMMAND_IMEISV_REQUEST_PRESENT; + LOG_I(NAS," SECURITY MODE COMMAND: IMEISV_REQUEST: %d \n",security_mode_command->imeisvrequest); + break; case SECURITY_MODE_COMMAND_REPLAYED_NONCEUE_IEI: diff --git a/openair3/NAS/COMMON/EMM/MSG/SecurityModeComplete.c b/openair3/NAS/COMMON/EMM/MSG/SecurityModeComplete.c index f10401d09a..80ceeb34d7 100644 --- a/openair3/NAS/COMMON/EMM/MSG/SecurityModeComplete.c +++ b/openair3/NAS/COMMON/EMM/MSG/SecurityModeComplete.c @@ -76,8 +76,11 @@ int encode_security_mode_complete(security_mode_complete_msg *security_mode_comp /* Checking IEI and pointer */ CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, SECURITY_MODE_COMPLETE_MINIMUM_LENGTH, len); + LOG_I(NAS,"SECURITY MODE COMMAND COMPLETE: presencemask: %d \n",security_mode_complete->presencemask); + if ((security_mode_complete->presencemask & SECURITY_MODE_COMPLETE_IMEISV_PRESENT) == SECURITY_MODE_COMPLETE_IMEISV_PRESENT) { + LOG_I(NAS,"SECURITY MODE COMMAND COMPLETE: encode imeisv \n"); if ((encode_result = encode_mobile_identity(&security_mode_complete->imeisv, SECURITY_MODE_COMPLETE_IMEISV_IEI, buffer + encoded, len - @@ -87,7 +90,7 @@ int encode_security_mode_complete(security_mode_complete_msg *security_mode_comp else encoded += encode_result; } - + LOG_I(NAS,"SECURITY MODE COMMAND COMPLETE done !!! \n"); return encoded; } diff --git a/openair3/NAS/COMMON/IES/EmergencyNumberList.c b/openair3/NAS/COMMON/IES/EmergencyNumberList.c index 39b59ef0ca..9330fdc312 100644 --- a/openair3/NAS/COMMON/IES/EmergencyNumberList.c +++ b/openair3/NAS/COMMON/IES/EmergencyNumberList.c @@ -41,10 +41,24 @@ int decode_emergency_number_list(EmergencyNumberList *emergencynumberlist, uint8 ielen = *(buffer + decoded); decoded++; CHECK_LENGTH_DECODER(len - decoded, ielen); - emergencynumberlist->lengthofemergency = *(buffer + decoded); - decoded++; - emergencynumberlist->emergencyservicecategoryvalue = *(buffer + decoded) & 0x1f; - decoded++; + int information_element_index = 0; + while ((decoded < ielen) && (information_element_index < EMERGENCY_NUMBER_LIST_MAX_NUMBER_INFORMATION)) { + emergencynumberlist->emergency_number_information[information_element_index].lengthofemergency = *(buffer + decoded); + decoded++; + emergencynumberlist->emergency_number_information[information_element_index].emergencyservicecategoryvalue = *(buffer + decoded) & 0x1f; + decoded++; + int remaining_len = emergencynumberlist->emergency_number_information[information_element_index].lengthofemergency - 1; + int digit_index = 0; + while (remaining_len > 0) { + emergencynumberlist->emergency_number_information[information_element_index].bcd_digits[digit_index++] = *(buffer + decoded); + decoded++; + remaining_len --; + } + while (digit_index < EMERGENCY_NUMBER_LIST_MAX_2DIGITS) { + emergencynumberlist->emergency_number_information[information_element_index].bcd_digits[digit_index++] = 0xFF; + } + information_element_index++; + } #if defined (NAS_DEBUG) dump_emergency_number_list_xml(emergencynumberlist, iei); #endif @@ -67,11 +81,16 @@ int encode_emergency_number_list(EmergencyNumberList *emergencynumberlist, uint8 lenPtr = (buffer + encoded); encoded ++; - *(buffer + encoded) = emergencynumberlist->lengthofemergency; - encoded++; - *(buffer + encoded) = 0x00 | - (emergencynumberlist->emergencyservicecategoryvalue & 0x1f); - encoded++; + for ( int ie_index = 0; ie_index < emergencynumberlist->num_emergency_elements; ie_index++) { + *(buffer + encoded) = emergencynumberlist->emergency_number_information[ie_index].lengthofemergency; + encoded++; + *(buffer + encoded) = 0x00 | + (emergencynumberlist->emergency_number_information[ie_index].emergencyservicecategoryvalue & 0x1f); + encoded++; + for (int bcd2_index = 0; bcd2_index < (emergencynumberlist->emergency_number_information[ie_index].lengthofemergency - 1); bcd2_index++) { + *(buffer + encoded) = emergencynumberlist->emergency_number_information[ie_index].bcd_digits[bcd2_index]; + } + } *lenPtr = encoded - 1 - ((iei > 0) ? 1 : 0); return encoded; } @@ -83,9 +102,20 @@ void dump_emergency_number_list_xml(EmergencyNumberList *emergencynumberlist, ui if (iei > 0) /* Don't display IEI if = 0 */ printf(" 0x%X\n", iei); - - printf(" %u\n", emergencynumberlist->lengthofemergency); - printf(" %u\n", emergencynumberlist->emergencyservicecategoryvalue); + for ( int ie_index = 0; ie_index < emergencynumberlist->num_emergency_elements; ie_index++) { + printf(" %u\n", emergencynumberlist->emergency_number_information[ie_index].lengthofemergency); + printf(" %u\n", emergencynumberlist->emergency_number_information[ie_index].emergencyservicecategoryvalue); + for (int bcd2_index = 0; bcd2_index < (emergencynumberlist->emergency_number_information[ie_index].lengthofemergency - 1); bcd2_index++) { + uint8_t bcd1 = emergencynumberlist->emergency_number_information[ie_index].bcd_digits[bcd2_index] & 0x0f; + uint8_t bcd2 = (emergencynumberlist->emergency_number_information[ie_index].bcd_digits[bcd2_index] & 0xf0) >> 4; + if (bcd1 < 10) { + printf(" %u\n", (bcd2_index*2)+1, bcd1, (bcd2_index*2)+1); + if (bcd2 < 10) { + printf(" %u\n", (bcd2_index*2)+2, bcd2, (bcd2_index*2)+2); + } + } + } + } printf("\n"); } diff --git a/openair3/NAS/COMMON/IES/EmergencyNumberList.h b/openair3/NAS/COMMON/IES/EmergencyNumberList.h index d2fd149dc0..ab47c1ff06 100644 --- a/openair3/NAS/COMMON/IES/EmergencyNumberList.h +++ b/openair3/NAS/COMMON/IES/EmergencyNumberList.h @@ -32,8 +32,14 @@ #define EMERGENCY_NUMBER_LIST_MAXIMUM_LENGTH 50 typedef struct EmergencyNumberList_tag { - uint8_t lengthofemergency; - uint8_t emergencyservicecategoryvalue:5; + uint8_t num_emergency_elements; + struct { + uint8_t lengthofemergency; + uint8_t emergencyservicecategoryvalue:5; +#define EMERGENCY_NUMBER_LIST_MAX_2DIGITS 6 + uint8_t bcd_digits[EMERGENCY_NUMBER_LIST_MAX_2DIGITS]; // length to be fixed +#define EMERGENCY_NUMBER_LIST_MAX_NUMBER_INFORMATION 2 + } emergency_number_information[EMERGENCY_NUMBER_LIST_MAX_NUMBER_INFORMATION]; } EmergencyNumberList; int encode_emergency_number_list(EmergencyNumberList *emergencynumberlist, uint8_t iei, uint8_t *buffer, uint32_t len); diff --git a/openair3/NAS/COMMON/IES/MobileIdentity.c b/openair3/NAS/COMMON/IES/MobileIdentity.c index 7ab30011ce..59cf4dc44f 100644 --- a/openair3/NAS/COMMON/IES/MobileIdentity.c +++ b/openair3/NAS/COMMON/IES/MobileIdentity.c @@ -575,6 +575,8 @@ static int encode_imei_mobile_identity(ImeiMobileIdentity_t *imei, uint8_t *buff static int encode_imeisv_mobile_identity(ImeisvMobileIdentity_t *imeisv, uint8_t *buffer) { uint32_t encoded = 0; + LOG_I(NAS,"SECURITY MODE COMMAND COMPLETE: encode_imeisv_mobile_identity \n"); + *(buffer + encoded) = 0x00 | (imeisv->digit1 << 4) | (imeisv->oddeven << 3) | (imeisv->typeofidentity); encoded++; @@ -590,12 +592,15 @@ static int encode_imeisv_mobile_identity(ImeisvMobileIdentity_t *imeisv, uint8_t encoded++; *(buffer + encoded) = 0x00 | (imeisv->digit13 << 4) | imeisv->digit12; encoded++; + *(buffer + encoded) = 0x00 | (imeisv->digit15 << 4) | imeisv->digit14; + encoded++; + *(buffer + encoded) = 0x00 | (imeisv->parity << 4) | imeisv->digit16; - if (imeisv->oddeven != MOBILE_IDENTITY_EVEN) { - *(buffer + encoded) = 0x00 | (imeisv->digit15 << 4) | imeisv->digit14; - } else { - *(buffer + encoded) = 0xf0 | imeisv->digit14; - } + //if (imeisv->oddeven != MOBILE_IDENTITY_EVEN) { + // *(buffer + encoded) = 0x00 | (imeisv->digit15 << 4) | imeisv->digit14; + //} else { + // *(buffer + encoded) = 0xf0 | imeisv->digit14; + //} encoded++; return encoded; diff --git a/openair3/NAS/COMMON/IES/MobileIdentity.h b/openair3/NAS/COMMON/IES/MobileIdentity.h index 8d1c5cdbe5..9c082c12df 100644 --- a/openair3/NAS/COMMON/IES/MobileIdentity.h +++ b/openair3/NAS/COMMON/IES/MobileIdentity.h @@ -73,8 +73,63 @@ typedef struct { uint8_t mbmssessionid; } TmgiMobileIdentity_t; +typedef struct imeisv_s{ + uint8_t digit1:4; + uint8_t oddeven:1; + uint8_t typeofidentity:3; + uint8_t digit2:4; + uint8_t digit3:4; + uint8_t digit4:4; + uint8_t digit5:4; + uint8_t digit6:4; + uint8_t digit7:4; + uint8_t digit8:4; + uint8_t digit9:4; + uint8_t digit10:4; + uint8_t digit11:4; + uint8_t digit12:4; + uint8_t digit13:4; + uint8_t digit14:4; + uint8_t digit15:4; + uint8_t digit16:4; +#define EVEN_PARITY 0 +#define ODD_PARITY 1 + uint8_t parity:4; +} imeisv_t; + +#if 0 +typedef struct imeisv_s { + uint8_t length; + union { + struct { + uint8_t tac2:4; + uint8_t tac1:4; + uint8_t tac4:4; + uint8_t tac3:4; + uint8_t tac6:4; + uint8_t tac5:4; + uint8_t tac8:4; + uint8_t tac7:4; + uint8_t snr2:4; + uint8_t snr1:4; + uint8_t snr4:4; + uint8_t snr3:4; + uint8_t snr6:4; + uint8_t snr5:4; + uint8_t svn2:4; + uint8_t svn1:4; +#define EVEN_PARITY 0 +#define ODD_PARITY 1 + uint8_t parity:4; + } num; +#define IMEISV_BCD8_SIZE 9 + uint8_t value[IMEISV_BCD8_SIZE]; + } u; +} imeisv_t; +#endif + typedef ImsiMobileIdentity_t ImeiMobileIdentity_t; -typedef ImsiMobileIdentity_t ImeisvMobileIdentity_t; +typedef imeisv_t ImeisvMobileIdentity_t; typedef ImsiMobileIdentity_t TmsiMobileIdentity_t; typedef ImsiMobileIdentity_t NoMobileIdentity_t; diff --git a/openair3/NAS/UE/EMM/SAP/emm_asDef.h b/openair3/NAS/UE/EMM/SAP/emm_asDef.h index bf0e6f6c37..69ea979b63 100644 --- a/openair3/NAS/UE/EMM/SAP/emm_asDef.h +++ b/openair3/NAS/UE/EMM/SAP/emm_asDef.h @@ -120,6 +120,7 @@ typedef struct emm_as_security_s { uint8_t ucs2; uint8_t uia; /* Replayed UMTS integrity algorithms */ uint8_t gea; /* Replayed GPRS encryption algorithms */ + uint8_t imeisv_request; uint8_t umts_present; uint8_t gprs_present; diff --git a/openair3/NAS/UE/EMM/SAP/emm_recv.c b/openair3/NAS/UE/EMM/SAP/emm_recv.c index a79a14d9c1..60b504f1ce 100644 --- a/openair3/NAS/UE/EMM/SAP/emm_recv.c +++ b/openair3/NAS/UE/EMM/SAP/emm_recv.c @@ -472,13 +472,15 @@ int emm_recv_security_mode_command(security_mode_command_msg *msg, * Message processing */ /* Execute the security mode control procedure initiated by the network */ + LOG_I(NAS,"Execute the security mode control procedure initiated by the network: imeisvrequest %d\n",msg->imeisvrequest); rc = emm_proc_security_mode_command( msg->naskeysetidentifier.tsc != NAS_KEY_SET_IDENTIFIER_MAPPED, msg->naskeysetidentifier.naskeysetidentifier, msg->selectednassecurityalgorithms.typeofcipheringalgorithm, msg->selectednassecurityalgorithms.typeofintegrityalgorithm, msg->replayeduesecuritycapabilities.eea, - msg->replayeduesecuritycapabilities.eia); + msg->replayeduesecuritycapabilities.eia, + msg->imeisvrequest & 0x7); LOG_FUNC_RETURN (rc); } diff --git a/openair3/NAS/UE/EMM/SAP/emm_send.c b/openair3/NAS/UE/EMM/SAP/emm_send.c index 7e13d03c7b..e960b85848 100644 --- a/openair3/NAS/UE/EMM/SAP/emm_send.c +++ b/openair3/NAS/UE/EMM/SAP/emm_send.c @@ -855,6 +855,35 @@ int emm_send_security_mode_complete(const emm_as_security_t *msg, /* Mandatory - Message type */ emm_msg->messagetype = SECURITY_MODE_COMPLETE; + if(msg->imeisv_request) + { + // configure imeisv param + emm_msg->presencemask |= SECURITY_MODE_COMPLETE_IMEISV_PRESENT; + + // 33 85 76 02 05 26 84 01 F1 + emm_msg->imeisv.imeisv; + emm_msg->imeisv.imeisv.digit1 = 0x3; + emm_msg->imeisv.imeisv.oddeven = 0x0; + emm_msg->imeisv.imeisv.typeofidentity = 0x3; + emm_msg->imeisv.imeisv.digit2 = 0x5; + emm_msg->imeisv.imeisv.digit3 = 0x7; + emm_msg->imeisv.imeisv.digit4 = 0x4; + emm_msg->imeisv.imeisv.digit5 = 0x7; + emm_msg->imeisv.imeisv.digit6 = 0x3; + emm_msg->imeisv.imeisv.digit7 = 0x0; + emm_msg->imeisv.imeisv.digit8 = 0x4; + emm_msg->imeisv.imeisv.digit9 = 0x0; + emm_msg->imeisv.imeisv.digit10 = 0x0; + emm_msg->imeisv.imeisv.digit11 = 0x7; + emm_msg->imeisv.imeisv.digit12 = 0x0; + emm_msg->imeisv.imeisv.digit13 = 0x5; + emm_msg->imeisv.imeisv.digit14 = 0x3; + emm_msg->imeisv.imeisv.digit15 = 0x0; + emm_msg->imeisv.imeisv.digit16 = 0x0; + emm_msg->imeisv.imeisv.parity = ODD_PARITY; + + size += SECURITY_MODE_COMPLETE_MAXIMUM_LENGTH; + } LOG_FUNC_RETURN (size); } diff --git a/openair3/NAS/UE/EMM/SecurityModeControl.c b/openair3/NAS/UE/EMM/SecurityModeControl.c index 7d19808481..f27eb7b4af 100644 --- a/openair3/NAS/UE/EMM/SecurityModeControl.c +++ b/openair3/NAS/UE/EMM/SecurityModeControl.c @@ -146,7 +146,7 @@ static void _security_release(emm_security_context_t *ctx); ** ** ***************************************************************************/ int emm_proc_security_mode_command(int native_ksi, int ksi, - int seea, int seia, int reea, int reia) + int seea, int seia, int reea, int reia, int imeisv_request) { LOG_FUNC_IN; @@ -329,6 +329,7 @@ int emm_proc_security_mode_command(int native_ksi, int ksi, emm_sap.u.emm_as.u.security.guti = _emm_data.guti; emm_sap.u.emm_as.u.security.ueid = 0; emm_sap.u.emm_as.u.security.msgType = EMM_AS_MSG_TYPE_SMC; + emm_sap.u.emm_as.u.security.imeisv_request = imeisv_request; emm_sap.u.emm_as.u.security.emm_cause = emm_cause; /* Setup EPS NAS security data */ emm_as_set_security_data(&emm_sap.u.emm_as.u.security.sctx, diff --git a/openair3/NAS/UE/EMM/emm_proc.h b/openair3/NAS/UE/EMM/emm_proc.h index e6a3ae0cdd..60f71f11c2 100644 --- a/openair3/NAS/UE/EMM/emm_proc.h +++ b/openair3/NAS/UE/EMM/emm_proc.h @@ -174,7 +174,7 @@ int emm_proc_authentication_delete(void); * -------------------------------------------------------------------------- */ int emm_proc_security_mode_command(int native_ksi, int ksi, int seea, int seia, - int reea, int reia); + int reea, int reia,int imeisv_request); /* *--------------------------------------------------------------------------- diff --git a/targets/TEST/PDCP/with_rlc/test_pdcp_rlc.c b/targets/TEST/PDCP/with_rlc/test_pdcp_rlc.c index 0c1500fd5e..dc395281dc 100644 --- a/targets/TEST/PDCP/with_rlc/test_pdcp_rlc.c +++ b/targets/TEST/PDCP/with_rlc/test_pdcp_rlc.c @@ -188,9 +188,9 @@ void pdcp_rlc_test_exchange_pdus(rlc_um_entity_t *um_txP, memset(&mac_rlc_status_resp_tx, 0, sizeof(struct mac_status_resp)); memset(&mac_rlc_status_resp_rx, 0, sizeof(struct mac_status_resp)); - mac_rlc_status_resp_tx = rlc_um_mac_status_indication(um_txP, bytes_txP, tx_status); + mac_rlc_status_resp_tx = rlc_um_mac_status_indication(um_txP, bytes_txP, tx_status, ENB_FLAG_YES); data_request_tx = rlc_um_mac_data_request(um_txP); - mac_rlc_status_resp_rx = rlc_um_mac_status_indication(um_rxP, bytes_rxP, tx_status); + mac_rlc_status_resp_rx = rlc_um_mac_status_indication(um_rxP, bytes_rxP, tx_status, ENB_FLAG_YES); data_request_rx = rlc_um_mac_data_request(um_rxP); From 179ff736584b6dfd5956bc5c3b1a2033bb3af035 Mon Sep 17 00:00:00 2001 From: Cedric Roux Date: Thu, 8 Dec 2016 16:47:30 +0100 Subject: [PATCH 327/349] integration fix: use old CMakeLists.txt Another way to set those two variables has to be used for the specific UE case (use a sub CMakeLists.txt, see in build_oai). --- cmake_targets/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index 891001ecbc..07d92a1b05 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -644,7 +644,7 @@ add_boolean_option(ENABLE_USE_CPU_EXECUTION_TIME True "Add data in vcd traces: d add_boolean_option(ENABLE_VCD True "always true now, time measurements of proc calls and var displays") add_boolean_option(ENABLE_VCD_FIFO True "time measurements of proc calls and var displays sent to FIFO (one more thread)") add_boolean_option(HARD_RT False "???") -add_boolean_option(LINUX True "used in weird memcpy() in pdcp.c ???") +add_boolean_option(LINUX False "used in weird memcpy() in pdcp.c ???") add_boolean_option(LINUX_LIST False "used only in lists.c: either use OAI implementation of lists or Linux one (should be True, but it is False") add_boolean_option(LOG_NO_THREAD True "Disable thread for log, seems always set to true") add_boolean_option(OPENAIR_LTE True "Seems legacy: keep it to true") @@ -727,7 +727,7 @@ add_boolean_option(TRACE_RLC_UM_TX_STATUS False "TRACE for RLC UM, TO BE CHANGE ########################## # PDCP LAYER OPTIONS ########################## -add_boolean_option(PDCP_USE_NETLINK True "For eNB, PDCP communicate with a NETLINK socket if connected to network driver, else could use a RT-FIFO") +add_boolean_option(PDCP_USE_NETLINK False "For eNB, PDCP communicate with a NETLINK socket if connected to network driver, else could use a RT-FIFO") add_boolean_option(PDCP_USE_NETLINK_QUEUES False "When PDCP_USE_NETLINK is true, incoming IP packets are stored in queues") add_boolean_option(LINK_ENB_PDCP_TO_IP_DRIVER False "For eNB, PDCP communicate with a IP driver") add_boolean_option(LINK_ENB_PDCP_TO_GTPV1U True "For eNB, PDCP communicate with GTP-U protocol (eNB<->S-GW)") From e4a84606b94bcf26a9b076f6bfaa785d0d670327 Mon Sep 17 00:00:00 2001 From: Cedric Roux Date: Thu, 8 Dec 2016 17:09:39 +0100 Subject: [PATCH 328/349] integration fix: send SRS configuration to UE only if SRS active Manually testing with the Samsung Galaxy Note 4 failed, probably because the phone didn't like to receive SRS configuration. Let's send it only if activated. --- openair2/RRC/LITE/MESSAGES/asn1_msg.c | 30 ++++++++++++++++----------- openair2/RRC/LITE/MESSAGES/asn1_msg.h | 2 ++ openair2/RRC/LITE/rrc_eNB.c | 1 + 3 files changed, 21 insertions(+), 12 deletions(-) diff --git a/openair2/RRC/LITE/MESSAGES/asn1_msg.c b/openair2/RRC/LITE/MESSAGES/asn1_msg.c index 7d2fc3a3d8..b4290e8b9d 100644 --- a/openair2/RRC/LITE/MESSAGES/asn1_msg.c +++ b/openair2/RRC/LITE/MESSAGES/asn1_msg.c @@ -1388,6 +1388,7 @@ uint8_t do_RRCConnectionSetup( const protocol_ctxt_t* const ctxt_pP, rrc_eNB_ue_context_t* const ue_context_pP, + int CC_id, uint8_t* const buffer, const uint8_t transmission_mode, const uint8_t Transaction_id, @@ -1492,7 +1493,10 @@ do_RRCConnectionSetup( physicalConfigDedicated2->tpc_PDCCH_ConfigPUCCH = CALLOC(1,sizeof(*physicalConfigDedicated2->tpc_PDCCH_ConfigPUCCH)); physicalConfigDedicated2->tpc_PDCCH_ConfigPUSCH = CALLOC(1,sizeof(*physicalConfigDedicated2->tpc_PDCCH_ConfigPUSCH)); physicalConfigDedicated2->cqi_ReportConfig = CALLOC(1,sizeof(*physicalConfigDedicated2->cqi_ReportConfig)); - physicalConfigDedicated2->soundingRS_UL_ConfigDedicated = CALLOC(1,sizeof(*physicalConfigDedicated2->soundingRS_UL_ConfigDedicated)); + if (enb_properties.properties[ctxt_pP->module_id]->srs_enable[CC_id]) + physicalConfigDedicated2->soundingRS_UL_ConfigDedicated = CALLOC(1,sizeof(*physicalConfigDedicated2->soundingRS_UL_ConfigDedicated)); + else + physicalConfigDedicated2->soundingRS_UL_ConfigDedicated = NULL; physicalConfigDedicated2->antennaInfo = CALLOC(1,sizeof(*physicalConfigDedicated2->antennaInfo)); physicalConfigDedicated2->schedulingRequestConfig = CALLOC(1,sizeof(*physicalConfigDedicated2->schedulingRequestConfig)); #ifdef CBA @@ -1578,17 +1582,19 @@ do_RRCConnectionSetup( */ //soundingRS-UL-ConfigDedicated - physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->present = SoundingRS_UL_ConfigDedicated_PR_setup; - physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->choice.setup.srs_Bandwidth = - SoundingRS_UL_ConfigDedicated__setup__srs_Bandwidth_bw0; - physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->choice.setup.srs_HoppingBandwidth = - SoundingRS_UL_ConfigDedicated__setup__srs_HoppingBandwidth_hbw0; - physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->choice.setup.freqDomainPosition=0; - physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->choice.setup.duration=1; - physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->choice.setup.srs_ConfigIndex=45; - physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->choice.setup.transmissionComb=0; - physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->choice.setup.cyclicShift= - SoundingRS_UL_ConfigDedicated__setup__cyclicShift_cs0; + if (enb_properties.properties[ctxt_pP->module_id]->srs_enable[CC_id]) { + physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->present = SoundingRS_UL_ConfigDedicated_PR_setup; + physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->choice.setup.srs_Bandwidth = + SoundingRS_UL_ConfigDedicated__setup__srs_Bandwidth_bw0; + physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->choice.setup.srs_HoppingBandwidth = + SoundingRS_UL_ConfigDedicated__setup__srs_HoppingBandwidth_hbw0; + physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->choice.setup.freqDomainPosition=0; + physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->choice.setup.duration=1; + physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->choice.setup.srs_ConfigIndex=45; + physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->choice.setup.transmissionComb=0; + physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->choice.setup.cyclicShift= + SoundingRS_UL_ConfigDedicated__setup__cyclicShift_cs0; + } //AntennaInfoDedicated diff --git a/openair2/RRC/LITE/MESSAGES/asn1_msg.h b/openair2/RRC/LITE/MESSAGES/asn1_msg.h index 661914ea6e..881a778030 100644 --- a/openair2/RRC/LITE/MESSAGES/asn1_msg.h +++ b/openair2/RRC/LITE/MESSAGES/asn1_msg.h @@ -133,6 +133,7 @@ do_RRCConnectionReconfigurationComplete( PhysicalConfigDedicated IEs. The latter does not enable periodic CQI reporting (PUCCH format 2/2a/2b) or SRS. @param ctxt_pP Running context @param ue_context_pP UE context +@param CC_id Component Carrier ID @param buffer Pointer to PER-encoded ASN.1 description of DL-CCCH-Message PDU @param transmission_mode Transmission mode for UE (1-9) @param UE_id UE index for this message @@ -144,6 +145,7 @@ uint8_t do_RRCConnectionSetup( const protocol_ctxt_t* const ctxt_pP, rrc_eNB_ue_context_t* const ue_context_pP, + int CC_id, uint8_t* const buffer, const uint8_t transmission_mode, const uint8_t Transaction_id, diff --git a/openair2/RRC/LITE/rrc_eNB.c b/openair2/RRC/LITE/rrc_eNB.c index 747522e01b..08d50da39c 100644 --- a/openair2/RRC/LITE/rrc_eNB.c +++ b/openair2/RRC/LITE/rrc_eNB.c @@ -3743,6 +3743,7 @@ rrc_eNB_generate_RRCConnectionSetup( eNB_rrc_inst[ctxt_pP->module_id].carrier[CC_id].Srb0.Tx_buffer.payload_size = do_RRCConnectionSetup(ctxt_pP, ue_context_pP, + CC_id, (uint8_t*) eNB_rrc_inst[ctxt_pP->module_id].carrier[CC_id].Srb0.Tx_buffer.Payload, (fp->nb_antennas_tx_eNB==2)?2:1, //at this point we do not have the UE capability information, so it can only be TM1 or TM2 rrc_eNB_get_next_transaction_identifier(ctxt_pP->module_id), From 497e89d97e88b6ffddc138c024243c26ad9be73e Mon Sep 17 00:00:00 2001 From: Cedric Roux Date: Thu, 8 Dec 2016 17:48:56 +0100 Subject: [PATCH 329/349] integration fix: bugfix: wrong enum used --- openair1/PHY/INIT/lte_init.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openair1/PHY/INIT/lte_init.c b/openair1/PHY/INIT/lte_init.c index 3fcc37f6bd..035410eb25 100644 --- a/openair1/PHY/INIT/lte_init.c +++ b/openair1/PHY/INIT/lte_init.c @@ -483,7 +483,7 @@ void phy_config_dedicated_eNB_step2(PHY_VARS_eNB *eNB) } if (physicalConfigDedicated->soundingRS_UL_ConfigDedicated) { - if (physicalConfigDedicated->soundingRS_UL_ConfigDedicated->present == SchedulingRequestConfig_PR_setup) { + if (physicalConfigDedicated->soundingRS_UL_ConfigDedicated->present == SoundingRS_UL_ConfigDedicated_PR_setup) { eNB->soundingrs_ul_config_dedicated[UE_id].duration = physicalConfigDedicated->soundingRS_UL_ConfigDedicated->choice.setup.duration; eNB->soundingrs_ul_config_dedicated[UE_id].cyclicShift = physicalConfigDedicated->soundingRS_UL_ConfigDedicated->choice.setup.cyclicShift; @@ -876,7 +876,7 @@ void phy_config_dedicated_ue(uint8_t Mod_id,int CC_id,uint8_t eNB_id, if (physicalConfigDedicated->soundingRS_UL_ConfigDedicated) { phy_vars_ue->soundingrs_ul_config_dedicated[eNB_id].srsConfigDedicatedSetup = 0; - if (physicalConfigDedicated->soundingRS_UL_ConfigDedicated->present == SchedulingRequestConfig_PR_setup) { + if (physicalConfigDedicated->soundingRS_UL_ConfigDedicated->present == SoundingRS_UL_ConfigDedicated_PR_setup) { phy_vars_ue->soundingrs_ul_config_dedicated[eNB_id].srsConfigDedicatedSetup = 1; phy_vars_ue->soundingrs_ul_config_dedicated[eNB_id].duration = physicalConfigDedicated->soundingRS_UL_ConfigDedicated->choice.setup.duration; phy_vars_ue->soundingrs_ul_config_dedicated[eNB_id].cyclicShift = physicalConfigDedicated->soundingRS_UL_ConfigDedicated->choice.setup.cyclicShift; From 752ceb19221001ec18d22425157beae83a2436ba Mon Sep 17 00:00:00 2001 From: Cedric Roux Date: Thu, 8 Dec 2016 17:49:56 +0100 Subject: [PATCH 330/349] integration fix: remove compilation warnings --- openair1/PHY/LTE_TRANSPORT/srs_modulation.c | 2 +- openair3/NAS/UE/EMM/SAP/emm_send.c | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/openair1/PHY/LTE_TRANSPORT/srs_modulation.c b/openair1/PHY/LTE_TRANSPORT/srs_modulation.c index 15561e6b28..7e29d998a1 100644 --- a/openair1/PHY/LTE_TRANSPORT/srs_modulation.c +++ b/openair1/PHY/LTE_TRANSPORT/srs_modulation.c @@ -133,7 +133,7 @@ int32_t generate_srs_tx(PHY_VARS_UE *ue, uint16_t msrsb=0,Nb=0,nb,b,msrs0=0,k,Msc_RS,Msc_RS_idx,carrier_pos,symbol_offset; uint16_t *Msc_idx_ptr; int32_t k0; - uint32_t subframe_offset; + //uint32_t subframe_offset; uint8_t Bsrs = soundingrs_ul_config_dedicated->srs_Bandwidth; uint8_t Csrs = frame_parms->soundingrs_ul_config_common.srs_BandwidthConfig; uint8_t Ssrs = frame_parms->soundingrs_ul_config_common.srs_SubframeConfig; diff --git a/openair3/NAS/UE/EMM/SAP/emm_send.c b/openair3/NAS/UE/EMM/SAP/emm_send.c index e960b85848..554c556932 100644 --- a/openair3/NAS/UE/EMM/SAP/emm_send.c +++ b/openair3/NAS/UE/EMM/SAP/emm_send.c @@ -861,7 +861,6 @@ int emm_send_security_mode_complete(const emm_as_security_t *msg, emm_msg->presencemask |= SECURITY_MODE_COMPLETE_IMEISV_PRESENT; // 33 85 76 02 05 26 84 01 F1 - emm_msg->imeisv.imeisv; emm_msg->imeisv.imeisv.digit1 = 0x3; emm_msg->imeisv.imeisv.oddeven = 0x0; emm_msg->imeisv.imeisv.typeofidentity = 0x3; From 46b2ee9577073261163349f03057f2587186b955 Mon Sep 17 00:00:00 2001 From: Cedric Roux Date: Thu, 8 Dec 2016 17:51:02 +0100 Subject: [PATCH 331/349] integration fix: attempt to clarify ODD_PARITY This may need to be refined. The variable ODD_PARITY is defined at various places, with different values, causing compilation warnings. It's wrong to define a variable with different values. A new variable is created, specific to IMEI case: IMEI_ODD_PARITY. Maybe ODD_PARITY should also have 0xf as value, and so maybe only one variable is necessary. To be checked at some point... --- openair2/COMMON/commonDef.h | 2 +- openair3/NAS/COMMON/IES/MobileIdentity.h | 4 ++-- openair3/NAS/UE/EMM/SAP/emm_send.c | 2 +- openair3/NAS/UE/EMM/emm_main.c | 3 ++- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/openair2/COMMON/commonDef.h b/openair2/COMMON/commonDef.h index ae1bdaf994..cfd5d68e40 100644 --- a/openair2/COMMON/commonDef.h +++ b/openair2/COMMON/commonDef.h @@ -119,7 +119,7 @@ typedef struct { Byte_t digit14:4; Byte_t digit13:4; #define EVEN_PARITY 0 -#define ODD_PARITY 0xf +#define ODD_PARITY 1 Byte_t parity:4; Byte_t digit15:4; } num; diff --git a/openair3/NAS/COMMON/IES/MobileIdentity.h b/openair3/NAS/COMMON/IES/MobileIdentity.h index 9c082c12df..72abcb9ed4 100644 --- a/openair3/NAS/COMMON/IES/MobileIdentity.h +++ b/openair3/NAS/COMMON/IES/MobileIdentity.h @@ -93,7 +93,7 @@ typedef struct imeisv_s{ uint8_t digit15:4; uint8_t digit16:4; #define EVEN_PARITY 0 -#define ODD_PARITY 1 +#define IMEI_ODD_PARITY 0xf uint8_t parity:4; } imeisv_t; @@ -119,7 +119,7 @@ typedef struct imeisv_s { uint8_t svn2:4; uint8_t svn1:4; #define EVEN_PARITY 0 -#define ODD_PARITY 1 +#define IMEI_ODD_PARITY 0xf uint8_t parity:4; } num; #define IMEISV_BCD8_SIZE 9 diff --git a/openair3/NAS/UE/EMM/SAP/emm_send.c b/openair3/NAS/UE/EMM/SAP/emm_send.c index 554c556932..e3fc4fa7f9 100644 --- a/openair3/NAS/UE/EMM/SAP/emm_send.c +++ b/openair3/NAS/UE/EMM/SAP/emm_send.c @@ -879,7 +879,7 @@ int emm_send_security_mode_complete(const emm_as_security_t *msg, emm_msg->imeisv.imeisv.digit14 = 0x3; emm_msg->imeisv.imeisv.digit15 = 0x0; emm_msg->imeisv.imeisv.digit16 = 0x0; - emm_msg->imeisv.imeisv.parity = ODD_PARITY; + emm_msg->imeisv.imeisv.parity = IMEI_ODD_PARITY; size += SECURITY_MODE_COMPLETE_MAXIMUM_LENGTH; } diff --git a/openair3/NAS/UE/EMM/emm_main.c b/openair3/NAS/UE/EMM/emm_main.c index 82946a634e..2eb4d8fa24 100644 --- a/openair3/NAS/UE/EMM/emm_main.c +++ b/openair3/NAS/UE/EMM/emm_main.c @@ -40,6 +40,7 @@ Description Defines the EPS Mobility Management procedure call manager, #include "emm_main.h" #include "nas_log.h" #include "emmData.h" +#include "MobileIdentity.h" #include "memory.h" #include "usim_api.h" @@ -919,7 +920,7 @@ static int _emm_main_get_imei(imei_t *imei, const char *imei_str) int len = strlen(imei_str); if (len % 2) { - imei->u.num.parity = ODD_PARITY; + imei->u.num.parity = IMEI_ODD_PARITY; } else { imei->u.num.parity = EVEN_PARITY; } From 3750ebc2d60091742444139cc38d1949b0786f19 Mon Sep 17 00:00:00 2001 From: ROBERT Benoit Date: Fri, 9 Dec 2016 16:13:06 +0100 Subject: [PATCH 332/349] Update UE autotest testsuite for OAI1B develop1B_integration_w49 branch --- .../autotests/patches/CmakeLists.patch | 2 +- .../autotest_ue_cell_synch_event.patch | 4 +- .../autotest_ue_dlsch_bitrate_metric.patch | 4 +- .../patches/autotest_ue_offsets_metric.patch | 18 +- .../autotests/patches/build_oai.patch | 10 +- cmake_targets/autotests/testsuite_ue_noS1.xml | 1154 +++++++++++------ 6 files changed, 752 insertions(+), 440 deletions(-) diff --git a/cmake_targets/autotests/patches/CmakeLists.patch b/cmake_targets/autotests/patches/CmakeLists.patch index 9f2731ca73..1e54e3a0f3 100644 --- a/cmake_targets/autotests/patches/CmakeLists.patch +++ b/cmake_targets/autotests/patches/CmakeLists.patch @@ -1,5 +1,5 @@ diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt -index 3169c6c..eaf5417 100644 +index 07d92a1..b6a02d1 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -235,6 +235,7 @@ add_boolean_option(DEBUG_OMG False "???") diff --git a/cmake_targets/autotests/patches/autotest_ue_cell_synch_event.patch b/cmake_targets/autotests/patches/autotest_ue_cell_synch_event.patch index 33f5ac339f..766b724c6c 100644 --- a/cmake_targets/autotests/patches/autotest_ue_cell_synch_event.patch +++ b/cmake_targets/autotests/patches/autotest_ue_cell_synch_event.patch @@ -1,8 +1,8 @@ diff --git a/openair1/PHY/LTE_TRANSPORT/initial_sync.c b/openair1/PHY/LTE_TRANSPORT/initial_sync.c -index 661fe96..782305d 100644 +index 663978e..b77cb1b 100644 --- a/openair1/PHY/LTE_TRANSPORT/initial_sync.c +++ b/openair1/PHY/LTE_TRANSPORT/initial_sync.c -@@ -469,6 +469,15 @@ int initial_sync(PHY_VARS_UE *ue, runmode_t mode) +@@ -476,6 +476,15 @@ int initial_sync(PHY_VARS_UE *ue, runmode_t mode) //#endif if (ue->UE_scan_carrier == 0) { diff --git a/cmake_targets/autotests/patches/autotest_ue_dlsch_bitrate_metric.patch b/cmake_targets/autotests/patches/autotest_ue_dlsch_bitrate_metric.patch index b7a7dbfa02..74139109f2 100644 --- a/cmake_targets/autotests/patches/autotest_ue_dlsch_bitrate_metric.patch +++ b/cmake_targets/autotests/patches/autotest_ue_dlsch_bitrate_metric.patch @@ -1,8 +1,8 @@ diff --git a/openair1/SCHED/phy_procedures_lte_ue.c b/openair1/SCHED/phy_procedures_lte_ue.c -index 3ed4c79..6023886 100644 +index 5dc629b..353a049 100644 --- a/openair1/SCHED/phy_procedures_lte_ue.c +++ b/openair1/SCHED/phy_procedures_lte_ue.c -@@ -2944,6 +2944,13 @@ int phy_procedures_UE_RX(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uin +@@ -3551,6 +3551,13 @@ int phy_procedures_UE_RX(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uin LOG_D(PHY,"[UE %d] Calculating bitrate Frame %d: total_TBS = %d, total_TBS_last = %d, bitrate %f kbits\n", ue->Mod_id,frame_rx,ue->total_TBS[eNB_id], ue->total_TBS_last[eNB_id],(float) ue->bitrate[eNB_id]/1000.0); diff --git a/cmake_targets/autotests/patches/autotest_ue_offsets_metric.patch b/cmake_targets/autotests/patches/autotest_ue_offsets_metric.patch index 3fca1a70fd..85afe8703e 100644 --- a/cmake_targets/autotests/patches/autotest_ue_offsets_metric.patch +++ b/cmake_targets/autotests/patches/autotest_ue_offsets_metric.patch @@ -1,14 +1,12 @@ diff --git a/openair1/SCHED/phy_procedures_lte_ue.c b/openair1/SCHED/phy_procedures_lte_ue.c -index 3ed4c79..7185e5a 100644 +index 5dc629b..4d31ad3 100644 --- a/openair1/SCHED/phy_procedures_lte_ue.c +++ b/openair1/SCHED/phy_procedures_lte_ue.c -@@ -2748,7 +2748,25 @@ int phy_procedures_UE_RX(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uin - 0); +@@ -3347,6 +3347,22 @@ int phy_procedures_UE_RX(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uin // first slot has been processed (FFTs + Channel Estimation, PCFICH/PHICH/PDCCH) -- -+ -+ /* SYRTEM */ + ++ #if UE_AUTOTEST_TRACE + if ( (frame_rx % 10 == 0) && (subframe_rx == 0)) { + printf("AUTOTEST Metric : UE_FREQ_OFFSET = %d Hz (frame = %d) \n", ue->common_vars.freq_offset, frame_rx); + printf("AUTOTEST Metric : UE_RX_OFFSET = %d (frame = %d) \n", ue->rx_offset, frame_rx); @@ -21,11 +19,9 @@ index 3ed4c79..7185e5a 100644 + (double)ue->measurements.n0_power_tot_dBm+132.24, + frame_rx); + } ++ #endif + -+ -+ -+ -+ ++ // do procedures for C-RNTI if (ue->dlsch[eNB_id][0]->active == 1) { - ue_pdsch_procedures(ue, + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_PROC, VCD_FUNCTION_IN); diff --git a/cmake_targets/autotests/patches/build_oai.patch b/cmake_targets/autotests/patches/build_oai.patch index d6cecda6e5..cf93b466e7 100644 --- a/cmake_targets/autotests/patches/build_oai.patch +++ b/cmake_targets/autotests/patches/build_oai.patch @@ -1,8 +1,8 @@ diff --git a/cmake_targets/build_oai b/cmake_targets/build_oai -index b77a9ba..8e3021d 100755 +index 25e9a1c..0b04bb7 100755 --- a/cmake_targets/build_oai +++ b/cmake_targets/build_oai -@@ -53,6 +53,7 @@ BUILD_DOXYGEN=0 +@@ -54,6 +54,7 @@ BUILD_DOXYGEN=0 T_TRACER="False" DISABLE_HARDWARE_DEPENDENCY="False" CMAKE_BUILD_TYPE="" @@ -10,7 +10,7 @@ index b77a9ba..8e3021d 100755 trap handle_ctrl_c INT function print_help() { -@@ -127,6 +128,8 @@ Options +@@ -130,6 +131,8 @@ Options Enables the T tracer. --disable-hardware-dependency Disable HW dependency during installation @@ -19,7 +19,7 @@ index b77a9ba..8e3021d 100755 Usage (first build): oaisim (eNB + UE): ./build_oai -I --oaisim -x --install-system-files Eurecom EXMIMO + COTS UE : ./build_oai -I --eNB -x --install-system-files -@@ -278,6 +281,10 @@ function main() { +@@ -285,6 +288,10 @@ function main() { echo_info "Disabling hardware dependency for compiling software" DISABLE_HARDWARE_DEPENDENCY="True" shift 1;; @@ -30,7 +30,7 @@ index b77a9ba..8e3021d 100755 -h | --help) print_help exit 1;; -@@ -447,6 +454,7 @@ function main() { +@@ -457,6 +464,7 @@ function main() { echo "set (DEADLINE_SCHEDULER \"${DEADLINE_SCHEDULER_FLAG_USER}\" )" >>$cmake_file echo "set (CPU_AFFINITY \"${CPU_AFFINITY_FLAG_USER}\" )" >>$cmake_file echo "set ( T_TRACER $T_TRACER )" >> $cmake_file diff --git a/cmake_targets/autotests/testsuite_ue_noS1.xml b/cmake_targets/autotests/testsuite_ue_noS1.xml index 19b945dc28..c5403feab2 100644 --- a/cmake_targets/autotests/testsuite_ue_noS1.xml +++ b/cmake_targets/autotests/testsuite_ue_noS1.xml @@ -2,22 +2,27 @@ imb182-desktop yanbo-M4HM87P-00 /mnt/sradio/TEST_RESULTS/ - - https://gitlab.eurecom.fr/oai/openairinterface5g.git --> - + https://gitlab.eurecom.fr/oai1B/openairinterface5g.git + + https://gitlab.eurecom.fr/oai/openair-cn.git --> - Enhancement-142-OAI_UE_autotest_framework - + develop1B + develop1B_integration_w49 --> + - develop @@ -30,12 +35,21 @@ yanbo-M4HM87P-00 - + + + + + + + + + + lte-softmodem-noS1 @@ -62,7 +76,7 @@ -c --UE -w USRP --noS1 --eNB --ue-autotest-trace source ./targets/bin/init_nas_nos1 UE - sleep 20; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C2660000000 -r25 --ue-scan-carrier --ue-txgain 90 -A 20 --ue-rxgain 125 -S --phy-test + sleep 20; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C2660000000 -r25 --ue-scan-carrier --ue-txgain 85 -A 20 --ue-rxgain 125 -S --phy-test @@ -164,7 +178,7 @@ -c --UE -w USRP --noS1 --eNB --ue-autotest-trace source ./targets/bin/init_nas_nos1 UE - sleep 20; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C2660000000 -r25 --ue-scan-carrier --ue-txgain 90 -A 20 --ue-rxgain 125 -S --phy-test + sleep 20; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C2660000000 -r25 --ue-scan-carrier --ue-txgain 85 -A 20 --ue-rxgain 125 -S --phy-test @@ -271,7 +285,7 @@ -c --UE -w USRP --noS1 --eNB --ue-autotest-trace source ./targets/bin/init_nas_nos1 UE - sleep 20; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C2660000000 -r25 --ue-scan-carrier --ue-txgain 90 -A 20 --ue-rxgain 125 -S --phy-test + sleep 20; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C2660000000 -r25 --ue-scan-carrier --ue-txgain 85 -A 20 --ue-rxgain 125 -S --phy-test @@ -373,7 +387,7 @@ -c --UE -w USRP --noS1 --eNB --ue-autotest-trace source ./targets/bin/init_nas_nos1 UE - sleep 20; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C2660000000 -r25 --ue-scan-carrier --ue-txgain 90 -A 20 --ue-rxgain 125 -S --phy-test + sleep 20; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C2660000000 -r25 --ue-scan-carrier --ue-txgain 85 -A 20 --ue-rxgain 125 -S --phy-test @@ -475,7 +489,7 @@ -c --UE -w USRP --noS1 --eNB --ue-autotest-trace source ./targets/bin/init_nas_nos1 UE - sleep 20; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C2660000000 -r25 --ue-scan-carrier --ue-txgain 90 -A 20 --ue-rxgain 125 -S --phy-test + sleep 20; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C2660000000 -r25 --ue-scan-carrier --ue-txgain 85 -A 20 --ue-rxgain 125 -S --phy-test @@ -577,7 +591,7 @@ -c --UE -w USRP --noS1 --eNB --ue-autotest-trace source ./targets/bin/init_nas_nos1 UE - sleep 20; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C2660000000 -r25 --ue-scan-carrier --ue-txgain 90 -A 20 --ue-rxgain 125 -S --phy-test + sleep 20; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C2660000000 -r25 --ue-scan-carrier --ue-txgain 85 -A 20 --ue-rxgain 125 -S --phy-test @@ -679,7 +693,7 @@ -c --UE -w USRP --noS1 --eNB --ue-autotest-trace source ./targets/bin/init_nas_nos1 UE - sleep 20; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C2660000000 -r25 --ue-scan-carrier --ue-txgain 90 -A 20 --ue-rxgain 125 -S --phy-test + sleep 20; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C2660000000 -r25 --ue-scan-carrier --ue-txgain 85 -A 20 --ue-rxgain 125 -S --phy-test @@ -781,7 +795,7 @@ -c --UE -w USRP --noS1 --eNB --ue-autotest-trace source ./targets/bin/init_nas_nos1 UE - sleep 20; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C2660000000 -r25 --ue-scan-carrier --ue-txgain 90 -A 20 --ue-rxgain 125 -S --phy-test + sleep 20; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C2660000000 -r25 --ue-scan-carrier --ue-txgain 85 -A 20 --ue-rxgain 125 -S --phy-test @@ -884,7 +898,7 @@ -c --UE -w USRP --noS1 --eNB --ue-autotest-trace source ./targets/bin/init_nas_nos1 UE - sleep 20; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C2660000000 -r25 --ue-scan-carrier --ue-txgain 90 -A 20 --ue-rxgain 125 -S --phy-test + sleep 20; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C2660000000 -r25 --ue-scan-carrier --ue-txgain 85 -A 20 --ue-rxgain 125 -S --phy-test @@ -986,7 +1000,7 @@ -c --UE -w USRP --noS1 --eNB --ue-autotest-trace source ./targets/bin/init_nas_nos1 UE - sleep 20; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C2660000000 -r25 --ue-scan-carrier --ue-txgain 90 -A 20 --ue-rxgain 125 -S --phy-test + sleep 20; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C2660000000 -r25 --ue-scan-carrier --ue-txgain 85 -A 20 --ue-rxgain 125 -S --phy-test @@ -1088,7 +1102,7 @@ -c --UE -w USRP --noS1 --eNB --ue-autotest-trace source ./targets/bin/init_nas_nos1 UE - sleep 20; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C2660000000 -r25 --ue-scan-carrier --ue-txgain 90 -A 20 --ue-rxgain 125 -S --phy-test + sleep 20; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C2660000000 -r25 --ue-scan-carrier --ue-txgain 85 -A 20 --ue-rxgain 125 -S --phy-test @@ -1190,7 +1204,7 @@ -c --UE -w USRP --noS1 --eNB --ue-autotest-trace source ./targets/bin/init_nas_nos1 UE - sleep 20; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C2660000000 -r25 --ue-scan-carrier --ue-txgain 90 -A 20 --ue-rxgain 125 -S --phy-test + sleep 20; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C2660000000 -r25 --ue-scan-carrier --ue-txgain 85 -A 20 --ue-rxgain 125 -S --phy-test @@ -1292,7 +1306,7 @@ -c --UE -w USRP --noS1 --eNB --ue-autotest-trace source ./targets/bin/init_nas_nos1 UE - sleep 20; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C2660000000 -r25 --ue-scan-carrier --ue-txgain 90 -A 20 --ue-rxgain 125 -S --phy-test + sleep 20; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C2660000000 -r25 --ue-scan-carrier --ue-txgain 85 -A 20 --ue-rxgain 125 -S --phy-test @@ -1395,7 +1409,7 @@ -c --UE -w USRP --noS1 --eNB --ue-autotest-trace source ./targets/bin/init_nas_nos1 UE - sleep 20; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C2660000000 -r25 --ue-scan-carrier --ue-txgain 90 -A 20 --ue-rxgain 125 -S --phy-test + sleep 20; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C2660000000 -r25 --ue-scan-carrier --ue-txgain 85 -A 20 --ue-rxgain 125 -S --phy-test @@ -1497,7 +1511,7 @@ -c --UE -w USRP --noS1 --eNB --ue-autotest-trace source ./targets/bin/init_nas_nos1 UE - sleep 20; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C2660000000 -r25 --ue-scan-carrier --ue-txgain 90 -A 20 --ue-rxgain 125 -S --phy-test + sleep 20; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C2660000000 -r25 --ue-scan-carrier --ue-txgain 85 -A 20 --ue-rxgain 125 -S --phy-test @@ -1599,7 +1613,7 @@ -c --UE -w USRP --noS1 --eNB --ue-autotest-trace source ./targets/bin/init_nas_nos1 UE - sleep 20; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C2660000000 -r25 --ue-scan-carrier --ue-txgain 90 -A 20 --ue-rxgain 125 -S --phy-test + sleep 20; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C2660000000 -r25 --ue-scan-carrier --ue-txgain 85 -A 20 --ue-rxgain 125 -S --phy-test @@ -1675,57 +1689,6 @@ unit_of_meas = ""/> - - lte-softmodem-noS1 - - imb182-desktop - yanbo-M4HM87P-00 - 300 - /tmp - - $OPENAIR_DIR/cmake_targets/build_oai - -c -w USRP --eNB --noS1 - source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB - - $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 - -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 28 --single-thread-disable --phy-test - - - - - False - - /tmp - - $OPENAIR_DIR/cmake_targets/build_oai - -c --UE -w USRP --noS1 --eNB --ue-autotest-trace - source ./targets/bin/init_nas_nos1 UE - - sleep 20; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C2660000000 -r25 --ue-scan-carrier --ue-txgain 90 -A 20 --ue-rxgain 125 -S --phy-test - - - - - - False - UE_USRP.NOS1.PHYTEST_PERF.BAND7.5MHZ.MCS28 - 36 - - - - - lte-softmodem-noS1 @@ -1804,7 +1767,7 @@ -c --UE -w USRP --noS1 --eNB --ue-autotest-trace source ./targets/bin/init_nas_nos1 UE - sleep 20; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C2660000000 -r25 --ue-scan-carrier --ue-txgain 90 -A 20 --ue-rxgain 125 -S --phy-test + sleep 20; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C2660000000 -r25 --ue-scan-carrier --ue-txgain 85 -A 20 --ue-rxgain 125 -S --phy-test @@ -1907,7 +1870,7 @@ -c --UE -w USRP --noS1 --eNB --ue-autotest-trace source ./targets/bin/init_nas_nos1 UE - sleep 20; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C2660000000 -r50 --ue-scan-carrier --ue-txgain 90 -A 20 --ue-rxgain 125 -S --phy-test + sleep 20; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C2660000000 -r50 --ue-scan-carrier --ue-txgain 85 -A 20 --ue-rxgain 125 -S --phy-test @@ -2010,7 +1973,7 @@ -c --UE -w USRP --noS1 --eNB --ue-autotest-trace source ./targets/bin/init_nas_nos1 UE - sleep 20; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C2660000000 -r50 --ue-scan-carrier --ue-txgain 90 -A 20 --ue-rxgain 125 -S --phy-test + sleep 20; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C2660000000 -r50 --ue-scan-carrier --ue-txgain 85 -A 20 --ue-rxgain 125 -S --phy-test @@ -2089,54 +2052,6 @@ - - lte-softmodem-noS1 - - imb182-desktop - yanbo-M4HM87P-00 - 300 - /tmp - - $OPENAIR_DIR/cmake_targets/build_oai - -c -w USRP --eNB --noS1 - source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB - - $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 - -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 0 - sleep 80;iperf -c 10.0.1.9 -i 1 -u -b 512K - - - - False - - /tmp - - $OPENAIR_DIR/cmake_targets/build_oai - -c --UE -w USRP --noS1 --eNB --ue-autotest-trace - source ./targets/bin/init_nas_nos1 UE - - sleep 20; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C2660000000 -r25 --ue-scan-carrier --ue-txgain 90 -A 20 --ue-rxgain 125 -S - - iperf -s -i 1 -u - - 200 - - False - UE_USRP.NOS1.DATA_IPERF.BAND7.5MHZ.MCS00 - 36 - - - - lte-softmodem-noS1 @@ -2152,7 +2067,7 @@ $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.50PRB.usrpb210.conf -W -m 28 - sleep 80;iperf -c 10.0.1.9 -i 1 -u -b 6M + sleep 80;iperf -c 10.0.1.9 -i 1 -u -b 30M @@ -2164,7 +2079,7 @@ -c --UE -w USRP --noS1 --eNB --ue-autotest-trace source ./targets/bin/init_nas_nos1 UE - sleep 20; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C2660000000 -r50 --ue-scan-carrier --ue-txgain 90 -A 20 --ue-rxgain 125 -S + sleep 20; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C2660000000 -r50 --ue-scan-carrier --ue-txgain 85 -A 20 --ue-rxgain 125 -S iperf -s -i 1 -u @@ -2240,54 +2155,6 @@ unit_of_meas = ""/> - - lte-softmodem-noS1 - - imb182-desktop - yanbo-M4HM87P-00 - 300 - /tmp - - $OPENAIR_DIR/cmake_targets/build_oai - -c -w USRP --eNB --noS1 - source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB - - $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 - -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 9 - sleep 80;iperf -c 10.0.1.9 -i 1 -u -b 2M - - - - False - - /tmp - - $OPENAIR_DIR/cmake_targets/build_oai - -c --UE -w USRP --noS1 --eNB --ue-autotest-trace - source ./targets/bin/init_nas_nos1 UE - - sleep 20; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C2660000000 -r25 --ue-scan-carrier --ue-txgain 90 -A 20 --ue-rxgain 125 -S - - iperf -s -i 1 -u - - 200 - - False - UE_USRP.NOS1.DATA_IPERF.BAND7.5MHZ.MCS09 - 36 - - - - @@ -2340,55 +2207,6 @@ - - lte-softmodem-noS1 - - imb182-desktop - yanbo-M4HM87P-00 - 300 - /tmp - - $OPENAIR_DIR/cmake_targets/build_oai - -c -w USRP --eNB --noS1 - source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB - - $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 - -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 10 - sleep 80;iperf -c 10.0.1.9 -i 1 -u -b 2M - - - - False - - /tmp - - $OPENAIR_DIR/cmake_targets/build_oai - -c --UE -w USRP --noS1 --eNB --ue-autotest-trace - source ./targets/bin/init_nas_nos1 UE - - sleep 20; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C2660000000 -r25 --ue-scan-carrier --ue-txgain 90 -A 20 --ue-rxgain 125 -S - - iperf -s -i 1 -u - - 200 - - False - UE_USRP.NOS1.DATA_IPERF.BAND7.5MHZ.MCS10 - 36 - - - - - lte-softmodem-noS1 @@ -2441,54 +2259,6 @@ - - lte-softmodem-noS1 - - imb182-desktop - yanbo-M4HM87P-00 - 300 - /tmp - - $OPENAIR_DIR/cmake_targets/build_oai - -c -w USRP --eNB --noS1 - source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB - - $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 - -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 16 - sleep 80;iperf -c 10.0.1.9 -i 1 -u -b 2M - - - - False - - /tmp - - $OPENAIR_DIR/cmake_targets/build_oai - -c --UE -w USRP --noS1 --eNB --ue-autotest-trace - source ./targets/bin/init_nas_nos1 UE - - sleep 20; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C2660000000 -r25 --ue-scan-carrier --ue-txgain 90 -A 20 --ue-rxgain 125 -S - - iperf -s -i 1 -u - - 200 - - False - UE_USRP.NOS1.DATA_IPERF.BAND7.5MHZ.MCS16 - 36 - - - - @@ -2542,55 +2312,6 @@ - - lte-softmodem-noS1 - - imb182-desktop - yanbo-M4HM87P-00 - 300 - /tmp - - $OPENAIR_DIR/cmake_targets/build_oai - -c -w USRP --eNB --noS1 - source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB - - $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 - -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 17 - sleep 80;iperf -c 10.0.1.9 -i 1 -u -b 2M - - - - False - - /tmp - - $OPENAIR_DIR/cmake_targets/build_oai - -c --UE -w USRP --noS1 --eNB --ue-autotest-trace - source ./targets/bin/init_nas_nos1 UE - - sleep 20; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C2660000000 -r25 --ue-scan-carrier --ue-txgain 90 -A 20 --ue-rxgain 125 -S - - iperf -s -i 1 -u - - 200 - - False - UE_USRP.NOS1.DATA_IPERF.BAND7.5MHZ.MCS17 - 36 - - - - - lte-softmodem-noS1 @@ -2645,54 +2366,6 @@ - - lte-softmodem-noS1 - - imb182-desktop - yanbo-M4HM87P-00 - 300 - /tmp - - $OPENAIR_DIR/cmake_targets/build_oai - -c -w USRP --eNB --noS1 - source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB - - $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 - -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 19 - sleep 80;iperf -c 10.0.1.9 -i 1 -u -b 2M - - - - False - - /tmp - - $OPENAIR_DIR/cmake_targets/build_oai - -c --UE -w USRP --noS1 --eNB --ue-autotest-trace - source ./targets/bin/init_nas_nos1 UE - - sleep 20; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C2660000000 -r25 --ue-scan-carrier --ue-txgain 90 -A 20 --ue-rxgain 125 -S - - iperf -s -i 1 -u - - 200 - - False - UE_USRP.NOS1.DATA_IPERF.BAND7.5MHZ.MCS19 - 36 - - - - @@ -2745,54 +2418,6 @@ - - lte-softmodem-noS1 - - imb182-desktop - yanbo-M4HM87P-00 - 300 - /tmp - - $OPENAIR_DIR/cmake_targets/build_oai - -c -w USRP --eNB --noS1 - source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB - - $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 - -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 27 - sleep 30;iperf -c 10.0.1.9 -i 1 -u -b 10M - - - - False - - /tmp - - $OPENAIR_DIR/cmake_targets/build_oai - -c --UE -w USRP --noS1 --eNB --ue-autotest-trace - source ./targets/bin/init_nas_nos1 UE - - sleep 5; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C2660000000 -r25 --ue-scan-carrier --ue-txgain 85 -A 20 --ue-rxgain 125 -S - - iperf -s -i 1 -u - - 200 - - False - UE_USRP.NOS1.DATA_IPERF.BAND7.5MHZ.MCS27 - 36 - - - - @@ -2821,7 +2446,7 @@ -c --UE -w USRP --noS1 --eNB --ue-autotest-trace source ./targets/bin/init_nas_nos1 UE - sleep 20; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C2660000000 -r25 --ue-scan-carrier --ue-txgain 90 -A 20 --ue-rxgain 125 -S + sleep 20; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C2660000000 -r25 --ue-scan-carrier --ue-txgain 85 -A 20 --ue-rxgain 125 -S iperf -s -i 1 -u @@ -2894,5 +2519,696 @@ unit_of_meas = ""/> + + + + + + lte-softmodem-noS1 + + imb182-desktop + yanbo-M4HM87P-00 + 300 + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c -w USRP --eNB --noS1 + source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB + + $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 + -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 0 + sleep 80;iperf -c 10.0.1.9 -i 1 -u -b 512K + + + + False + + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c --UE -w USRP --noS1 --eNB --ue-autotest-trace + source ./targets/bin/init_nas_nos1 UE + + sleep 20; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C2660000000 -r25 --ue-scan-carrier --ue-txgain 85 -A 20 --ue-rxgain 125 -S + + iperf -s -i 1 -u + + 200 + + False + UE_USRP.NOS1.DATA_IPERF.BAND7.5MHZ.MCS00 + 36 + + + + + + + + + lte-softmodem-noS1 + + imb182-desktop + yanbo-M4HM87P-00 + 300 + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c -w USRP --eNB --noS1 + source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB + + $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 + -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 9 + sleep 80;iperf -c 10.0.1.9 -i 1 -u -b 2M + + + + False + + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c --UE -w USRP --noS1 --eNB --ue-autotest-trace + source ./targets/bin/init_nas_nos1 UE + + sleep 20; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C2660000000 -r25 --ue-scan-carrier --ue-txgain 85 -A 20 --ue-rxgain 125 -S + + iperf -s -i 1 -u + + 200 + + False + UE_USRP.NOS1.DATA_IPERF.BAND7.5MHZ.MCS09 + 36 + + + + + + + + lte-softmodem-noS1 + + imb182-desktop + yanbo-M4HM87P-00 + 300 + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c -w USRP --eNB --noS1 + source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB + + $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 + -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 10 + sleep 80;iperf -c 10.0.1.9 -i 1 -u -b 2M + + + + False + + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c --UE -w USRP --noS1 --eNB --ue-autotest-trace + source ./targets/bin/init_nas_nos1 UE + + sleep 20; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C2660000000 -r25 --ue-scan-carrier --ue-txgain 85 -A 20 --ue-rxgain 125 -S + + iperf -s -i 1 -u + + 200 + + False + UE_USRP.NOS1.DATA_IPERF.BAND7.5MHZ.MCS10 + 36 + + + + + + + + + lte-softmodem-noS1 + + imb182-desktop + yanbo-M4HM87P-00 + 300 + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c -w USRP --eNB --noS1 + source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB + + $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 + -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 16 + sleep 80;iperf -c 10.0.1.9 -i 1 -u -b 2M + + + + False + + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c --UE -w USRP --noS1 --eNB --ue-autotest-trace + source ./targets/bin/init_nas_nos1 UE + + sleep 20; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C2660000000 -r25 --ue-scan-carrier --ue-txgain 85 -A 20 --ue-rxgain 125 -S + + iperf -s -i 1 -u + + 200 + + False + UE_USRP.NOS1.DATA_IPERF.BAND7.5MHZ.MCS16 + 36 + + + + + + + + lte-softmodem-noS1 + + imb182-desktop + yanbo-M4HM87P-00 + 300 + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c -w USRP --eNB --noS1 + source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB + + $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 + -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 17 + sleep 80;iperf -c 10.0.1.9 -i 1 -u -b 2M + + + + False + + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c --UE -w USRP --noS1 --eNB --ue-autotest-trace + source ./targets/bin/init_nas_nos1 UE + + sleep 20; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C2660000000 -r25 --ue-scan-carrier --ue-txgain 85 -A 20 --ue-rxgain 125 -S + + iperf -s -i 1 -u + + 200 + + False + UE_USRP.NOS1.DATA_IPERF.BAND7.5MHZ.MCS17 + 36 + + + + + + + + lte-softmodem-noS1 + + imb182-desktop + yanbo-M4HM87P-00 + 300 + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c -w USRP --eNB --noS1 + source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB + + $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 + -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 19 + sleep 80;iperf -c 10.0.1.9 -i 1 -u -b 2M + + + + False + + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c --UE -w USRP --noS1 --eNB --ue-autotest-trace + source ./targets/bin/init_nas_nos1 UE + + sleep 20; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C2660000000 -r25 --ue-scan-carrier --ue-txgain 85 -A 20 --ue-rxgain 125 -S + + iperf -s -i 1 -u + + 200 + + False + UE_USRP.NOS1.DATA_IPERF.BAND7.5MHZ.MCS19 + 36 + + + + + + + + lte-softmodem-noS1 + + imb182-desktop + yanbo-M4HM87P-00 + 300 + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c -w USRP --eNB --noS1 + source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB + + $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 + -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 27 + sleep 30;iperf -c 10.0.1.9 -i 1 -u -b 15M + + + + False + + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c --UE -w USRP --noS1 --eNB --ue-autotest-trace + source ./targets/bin/init_nas_nos1 UE + + sleep 5; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C2660000000 -r25 --ue-scan-carrier --ue-txgain 85 -A 20 --ue-rxgain 125 -S + + iperf -s -i 1 -u + + 200 + + False + UE_USRP.NOS1.DATA_IPERF.BAND7.5MHZ.MCS27 + 36 + + + + + + + + + + + + + + + + + lte-softmodem-noS1 + + imb182-desktop + yanbo-M4HM87P-00 + 300 + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c -w USRP --eNB --noS1 + source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB + + $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 + -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 28 --single-thread-disable --phy-test + + + + + False + + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c --UE -w USRP --noS1 --eNB --ue-autotest-trace + source ./targets/bin/init_nas_nos1 UE + + sleep 20; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C2660000000 -r25 --ue-scan-carrier --ue-txgain 85 -A 20 --ue-rxgain 125 -S --phy-test + + + + + + False + + + + UE_USRP.NOS1.PHYTEST_PERF.BAND7.5MHZ.MCS28 + 36 + + + + lte-softmodem-noS1 + + imb182-desktop + yanbo-M4HM87P-00 + 18000 + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c -w USRP --eNB --noS1 + source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB + + $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 + -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 28 --single-thread-disable --phy-test + + + + + False + + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c --UE -w USRP --noS1 --eNB --ue-autotest-trace + source ./targets/bin/init_nas_nos1 UE + + sleep 20; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C2660000000 -r25 --ue-scan-carrier --ue-txgain 85 -A 20 --ue-rxgain 125 -S --phy-test + + + + + + False + + + + UE_USRP.NOS1.PHYTEST_STAB.BAND7.5MHZ.MCS28 + 16 + + + + + lte-softmodem-noS1 + + imb182-desktop + yanbo-M4HM87P-00 + 300 + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c -w USRP --eNB --noS1 + source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB + + $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 + -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 28 + sleep 30;iperf -c 10.0.1.9 -i 1 -u -b 13700K + + + + False + + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c --UE -w USRP --noS1 --eNB --ue-autotest-trace + source ./targets/bin/init_nas_nos1 UE + + sleep 5; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C2660000000 -r25 --ue-scan-carrier --ue-txgain 85 -A 20 --ue-rxgain 125 -S + + iperf -s -i 1 -u + + 200 + + False + + + + + UE_USRP.NOS1.DATA_IPERF_DL.BAND7.5MHZ.MCS28 + 36 + + + + + lte-softmodem-noS1 + + imb182-desktop + yanbo-M4HM87P-00 + 3600 + UE_USRP.NOS1.DATA_IPERF_STAB_DL.BAND7.5MHZ.MCS28 + 16 + + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c -w USRP --eNB --noS1 + source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB + + $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 + -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 28 + sleep 80;iperf -c 10.0.1.9 -i 1 -u -b 2M + + + + False + + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c --UE -w USRP --noS1 --eNB --ue-autotest-trace + source ./targets/bin/init_nas_nos1 UE + + sleep 20; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C2660000000 -r25 --ue-scan-carrier --ue-txgain 85 -A 20 --ue-rxgain 125 -S + + iperf -s -i 1 -u + + 2800 + + False + + + + + + + + + + lte-softmodem-noS1 + + imb182-desktop + yanbo-M4HM87P-00 + 300 + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c -w USRP --eNB --noS1 + source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB + + $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 + -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 28 + sleep 30;iperf -c 10.0.1.9 -i 1 + + + + False + + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c --UE -w USRP --noS1 --eNB --ue-autotest-trace + source ./targets/bin/init_nas_nos1 UE + + sleep 5; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C2660000000 -r25 --ue-scan-carrier --ue-txgain 85 -A 20 --ue-rxgain 125 -S + + iperf -s -i 1 + + 200 + + False + + + + + UE_USRP.NOS1.DATA_IPERF_TCP_DL.BAND7.5MHZ.MCS28 + 36 + + + + + lte-softmodem-noS1 + + imb182-desktop + yanbo-M4HM87P-00 + 300 + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c -w USRP --eNB --noS1 + source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB + + $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 + -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.50PRB.usrpb210.conf -W -m 28 + sleep 80;iperf -c 10.0.1.9 -i 1 + + + + False + + /tmp + + $OPENAIR_DIR/cmake_targets/build_oai + -c --UE -w USRP --noS1 --eNB --ue-autotest-trace + source ./targets/bin/init_nas_nos1 UE + + sleep 20; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C2660000000 -r50 --ue-scan-carrier --ue-txgain 85 -A 20 --ue-rxgain 125 -S + + iperf -s -i 1 + + 200 + + False + UE_USRP.NOS1.DATA_IPERF_TCP_DL.BAND7.10MHZ.MCS28 + 36 + + + + + + + + + + + + From 8db3583b09d8be1ef5e95a146fa7f1c3c014821a Mon Sep 17 00:00:00 2001 From: Cedric Roux Date: Fri, 9 Dec 2016 17:47:29 +0100 Subject: [PATCH 333/349] integration fix: add usim_test to at_nas --- openair3/NAS/UE/UEprocess.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/openair3/NAS/UE/UEprocess.c b/openair3/NAS/UE/UEprocess.c index 248633c3a1..20af58dac6 100644 --- a/openair3/NAS/UE/UEprocess.c +++ b/openair3/NAS/UE/UEprocess.c @@ -71,6 +71,8 @@ static void _nas_signal_handler(int signal); static void _nas_clean(int usr_fd, int net_fd); +uint8_t usim_test = 0; + /****************************************************************************/ /****************** E X P O R T E D F U N C T I O N S ******************/ /****************************************************************************/ From 0a9d013f59c24f7f56c1629ef02e494f3442fc05 Mon Sep 17 00:00:00 2001 From: Cedric Roux Date: Fri, 9 Dec 2016 17:47:49 +0100 Subject: [PATCH 334/349] integration fix: LOG_I/LOG_D do not exist when compiling at_nas_ue Use LOG_TRACE instead. --- openair3/NAS/COMMON/EMM/MSG/SecurityModeCommand.c | 2 +- openair3/NAS/COMMON/EMM/MSG/SecurityModeComplete.c | 6 +++--- openair3/NAS/COMMON/IES/MobileIdentity.c | 2 +- openair3/NAS/UE/EMM/SAP/emm_recv.c | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/openair3/NAS/COMMON/EMM/MSG/SecurityModeCommand.c b/openair3/NAS/COMMON/EMM/MSG/SecurityModeCommand.c index c89a9f5bb7..a1a34f9495 100644 --- a/openair3/NAS/COMMON/EMM/MSG/SecurityModeCommand.c +++ b/openair3/NAS/COMMON/EMM/MSG/SecurityModeCommand.c @@ -72,7 +72,7 @@ int decode_security_mode_command(security_mode_command_msg *security_mode_comman decoded += decoded_result; /* Set corresponding mask to 1 in presencemask */ security_mode_command->presencemask |= SECURITY_MODE_COMMAND_IMEISV_REQUEST_PRESENT; - LOG_I(NAS," SECURITY MODE COMMAND: IMEISV_REQUEST: %d \n",security_mode_command->imeisvrequest); + LOG_TRACE(INFO," SECURITY MODE COMMAND: IMEISV_REQUEST: %d \n",security_mode_command->imeisvrequest); break; diff --git a/openair3/NAS/COMMON/EMM/MSG/SecurityModeComplete.c b/openair3/NAS/COMMON/EMM/MSG/SecurityModeComplete.c index 80ceeb34d7..3258134feb 100644 --- a/openair3/NAS/COMMON/EMM/MSG/SecurityModeComplete.c +++ b/openair3/NAS/COMMON/EMM/MSG/SecurityModeComplete.c @@ -76,11 +76,11 @@ int encode_security_mode_complete(security_mode_complete_msg *security_mode_comp /* Checking IEI and pointer */ CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, SECURITY_MODE_COMPLETE_MINIMUM_LENGTH, len); - LOG_I(NAS,"SECURITY MODE COMMAND COMPLETE: presencemask: %d \n",security_mode_complete->presencemask); + LOG_TRACE(INFO,"SECURITY MODE COMMAND COMPLETE: presencemask: %d \n",security_mode_complete->presencemask); if ((security_mode_complete->presencemask & SECURITY_MODE_COMPLETE_IMEISV_PRESENT) == SECURITY_MODE_COMPLETE_IMEISV_PRESENT) { - LOG_I(NAS,"SECURITY MODE COMMAND COMPLETE: encode imeisv \n"); + LOG_TRACE(INFO,"SECURITY MODE COMMAND COMPLETE: encode imeisv \n"); if ((encode_result = encode_mobile_identity(&security_mode_complete->imeisv, SECURITY_MODE_COMPLETE_IMEISV_IEI, buffer + encoded, len - @@ -90,7 +90,7 @@ int encode_security_mode_complete(security_mode_complete_msg *security_mode_comp else encoded += encode_result; } - LOG_I(NAS,"SECURITY MODE COMMAND COMPLETE done !!! \n"); + LOG_TRACE(INFO,"SECURITY MODE COMMAND COMPLETE done !!! \n"); return encoded; } diff --git a/openair3/NAS/COMMON/IES/MobileIdentity.c b/openair3/NAS/COMMON/IES/MobileIdentity.c index 59cf4dc44f..4651fa0047 100644 --- a/openair3/NAS/COMMON/IES/MobileIdentity.c +++ b/openair3/NAS/COMMON/IES/MobileIdentity.c @@ -575,7 +575,7 @@ static int encode_imei_mobile_identity(ImeiMobileIdentity_t *imei, uint8_t *buff static int encode_imeisv_mobile_identity(ImeisvMobileIdentity_t *imeisv, uint8_t *buffer) { uint32_t encoded = 0; - LOG_I(NAS,"SECURITY MODE COMMAND COMPLETE: encode_imeisv_mobile_identity \n"); + LOG_TRACE(INFO,"SECURITY MODE COMMAND COMPLETE: encode_imeisv_mobile_identity \n"); *(buffer + encoded) = 0x00 | (imeisv->digit1 << 4) | (imeisv->oddeven << 3) | (imeisv->typeofidentity); diff --git a/openair3/NAS/UE/EMM/SAP/emm_recv.c b/openair3/NAS/UE/EMM/SAP/emm_recv.c index 60b504f1ce..0ad41b09d8 100644 --- a/openair3/NAS/UE/EMM/SAP/emm_recv.c +++ b/openair3/NAS/UE/EMM/SAP/emm_recv.c @@ -140,7 +140,7 @@ int emm_recv_attach_accept(attach_accept_msg *msg, int *emm_cause) // supported cases: // typeoflist = 1 Or // typeoflist = 0 and numberofelements = 1 (ie numberofelements equal to zero see 3gpp 24.301 9.9.3.33.1) - LOG_D(NAS,"attach accept type of list: %d, number of element: %d\n",msg->tailist.typeoflist, msg->tailist.numberofelements); + LOG_TRACE(DEBUG,"attach accept type of list: %d, number of element: %d\n",msg->tailist.typeoflist, msg->tailist.numberofelements); if (!( (msg->tailist.typeoflist == TRACKING_AREA_IDENTITY_LIST_ONE_PLMN_CONSECUTIVE_TACS) || ((msg->tailist.typeoflist == 0) && ( msg->tailist.numberofelements == 0)) ) @@ -472,7 +472,7 @@ int emm_recv_security_mode_command(security_mode_command_msg *msg, * Message processing */ /* Execute the security mode control procedure initiated by the network */ - LOG_I(NAS,"Execute the security mode control procedure initiated by the network: imeisvrequest %d\n",msg->imeisvrequest); + LOG_TRACE(INFO,"Execute the security mode control procedure initiated by the network: imeisvrequest %d\n",msg->imeisvrequest); rc = emm_proc_security_mode_command( msg->naskeysetidentifier.tsc != NAS_KEY_SET_IDENTIFIER_MAPPED, msg->naskeysetidentifier.naskeysetidentifier, From a574c3d31bc4c7b13c3831e162b97acf10715242 Mon Sep 17 00:00:00 2001 From: Cedric Roux Date: Mon, 12 Dec 2016 09:22:01 +0100 Subject: [PATCH 335/349] integration fix: wrong license --- openair1/SCHED/srs_pc.c | 48 +++++++++++++++++------------------------ 1 file changed, 20 insertions(+), 28 deletions(-) diff --git a/openair1/SCHED/srs_pc.c b/openair1/SCHED/srs_pc.c index 461d230975..98049b2ed0 100644 --- a/openair1/SCHED/srs_pc.c +++ b/openair1/SCHED/srs_pc.c @@ -1,31 +1,23 @@ -/******************************************************************************* - OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - OpenAirInterface is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - - OpenAirInterface is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OpenAirInterface.The full GNU General Public License is - included in this distribution in the file called "COPYING". If not, - see . - - Contact Information - OpenAirInterface Admin: openair_admin@eurecom.fr - OpenAirInterface Tech : openair_tech@eurecom.fr - OpenAirInterface Dev : openair4g-devel@lists.eurecom.fr - - Address : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE - - *******************************************************************************/ +/* + * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The OpenAirInterface Software Alliance licenses this file to You under + * the OAI Public License, Version 1.0 (the "License"); you may not use this file + * except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.openairinterface.org/?page_id=698 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *------------------------------------------------------------------------------- + * For more information about the OpenAirInterface (OAI) Software Alliance: + * contact@openairinterface.org + */ /*! \file srs_pc.c * \brief Implementation of UE SRS Power Control procedures from 36.213 LTE specifications (Section From 5976ea4a95a585b78674ac89b14394cf3e96d6ce Mon Sep 17 00:00:00 2001 From: Cedric Roux Date: Mon, 12 Dec 2016 09:22:50 +0100 Subject: [PATCH 336/349] hotfix: attempt for a better gitlab CI setup Not sure it's the right thing to do, but this commit should reduce fake builds. --- .gitlab-ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index aa11892fa6..15c44aed22 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -34,4 +34,5 @@ job1: - sshpass -p "$OAI_PASS" rsync -az -e "ssh -o StrictHostKeyChecking=no " --rsync-path="mkdir -p $NFS_TEST_RESULTS_DIR && rsync" $OPENAIR_DIR/cmake_targets/autotests/log $OAI_USER@localhost:$NFS_TEST_RESULTS_DIR - sshpass -p "$OAI_PASS" rsync -az -e "ssh -o StrictHostKeyChecking=no " --rsync-path="mkdir -p $EXTERNAL_SHARE_DIR && rsync" $OPENAIR_DIR/cmake_targets/autotests/log $OAI_USER@localhost:$EXTERNAL_SHARE_DIR - cat $OPENAIR_DIR/cmake_targets/autotests/log/results_autotests.xml - when: manual + only: + - triggers From e04e8a62cc3e35221d5150c56c5be38d8defe8ab Mon Sep 17 00:00:00 2001 From: hbilel Date: Mon, 12 Dec 2016 11:45:22 +0100 Subject: [PATCH 337/349] remove mac-struct usage from phy --- openair1/PHY/INIT/lte_init.c | 8 ++++++++ openair1/PHY/LTE_TRANSPORT/dci_tools.c | 4 ++-- openair1/PHY/LTE_TRANSPORT/defs.h | 2 ++ openair1/PHY/LTE_TRANSPORT/phich.c | 6 +++--- openair1/SCHED/phy_procedures_lte_ue.c | 4 ++-- openair2/LAYER2/MAC/config.c | 1 + openair2/PHY_INTERFACE/defs.h | 3 +++ 7 files changed, 21 insertions(+), 7 deletions(-) diff --git a/openair1/PHY/INIT/lte_init.c b/openair1/PHY/INIT/lte_init.c index 035410eb25..c10e4dd3c1 100644 --- a/openair1/PHY/INIT/lte_init.c +++ b/openair1/PHY/INIT/lte_init.c @@ -746,6 +746,14 @@ void phy_config_dedicated_scell_eNB(uint8_t Mod_id, } #endif +void phy_config_harq_ue(uint8_t Mod_id,int CC_id,uint8_t eNB_id, + uint16_t max_harq_tx ) +{ + + PHY_VARS_UE *phy_vars_ue = PHY_vars_UE_g[Mod_id][CC_id]; + phy_vars_ue->ulsch[eNB_id]->Mlimit = max_harq_tx; +} + void phy_config_dedicated_ue(uint8_t Mod_id,int CC_id,uint8_t eNB_id, struct PhysicalConfigDedicated *physicalConfigDedicated ) { diff --git a/openair1/PHY/LTE_TRANSPORT/dci_tools.c b/openair1/PHY/LTE_TRANSPORT/dci_tools.c index 92836ebcf9..e73bb94d41 100644 --- a/openair1/PHY/LTE_TRANSPORT/dci_tools.c +++ b/openair1/PHY/LTE_TRANSPORT/dci_tools.c @@ -6451,7 +6451,7 @@ int generate_ue_ulsch_params_from_dci(void *dci_pdu, // ue->Mod_id,harq_pid, // proc->frame_rx, // subframe, - // UE_mac_inst[eNB_id].scheduling_info.maxHARQ_Tx); + // ulsch->Mlimit); //#endif if (ulsch->harq_processes[harq_pid]->round > 0) // NACK detected on phich @@ -6460,7 +6460,7 @@ int generate_ue_ulsch_params_from_dci(void *dci_pdu, ulsch->harq_processes[harq_pid] = ulsch->harq_processes[8]; // LOG_I(PHY," Adaptative retransmission - copy temporary harq Process to current harq process. [harqId %d round %d] \n",harq_pid, ulsch->harq_processes[8]->round); - if (ulsch->harq_processes[harq_pid]->round >= UE_mac_inst[eNB_id].scheduling_info.maxHARQ_Tx) + if (ulsch->harq_processes[harq_pid]->round >= ulsch->Mlimit) //UE_mac_inst[eNB_id].scheduling_info.maxHARQ_Tx) { ulsch->harq_processes[harq_pid]->subframe_scheduling_flag = 0; ulsch->harq_processes[harq_pid]->round = 0; diff --git a/openair1/PHY/LTE_TRANSPORT/defs.h b/openair1/PHY/LTE_TRANSPORT/defs.h index f8d36d3bd4..c41df6c931 100644 --- a/openair1/PHY/LTE_TRANSPORT/defs.h +++ b/openair1/PHY/LTE_TRANSPORT/defs.h @@ -346,6 +346,8 @@ typedef struct { uint8_t num_cba_dci[10]; /// allocated CBA RNTI uint16_t cba_rnti[4];//NUM_MAX_CBA_GROUP]; + /// UL max-harq-retransmission + uint8_t Mlimit; } LTE_UE_ULSCH_t; typedef struct { diff --git a/openair1/PHY/LTE_TRANSPORT/phich.c b/openair1/PHY/LTE_TRANSPORT/phich.c index 9a32876602..c7cc188893 100644 --- a/openair1/PHY/LTE_TRANSPORT/phich.c +++ b/openair1/PHY/LTE_TRANSPORT/phich.c @@ -1381,13 +1381,13 @@ void rx_phich(PHY_VARS_UE *ue, HI16, nseq_PHICH, ngroup_PHICH, - UE_mac_inst[eNB_id].scheduling_info.maxHARQ_Tx); + ulsch->Mlimit); //#endif // ulsch->harq_processes[harq_pid]->Ndi = 0; ulsch->harq_processes[harq_pid]->round++; - if ( ulsch->harq_processes[harq_pid]->round >= (UE_mac_inst[eNB_id].scheduling_info.maxHARQ_Tx - 1) ) + if ( ulsch->harq_processes[harq_pid]->round >= (ulsch->Mlimit - 1) ) { // this is last push re transmission ulsch->harq_processes[harq_pid]->rvidx = rv_table[ulsch->harq_processes[harq_pid]->round&3]; @@ -1402,7 +1402,7 @@ void rx_phich(PHY_VARS_UE *ue, //ulsch->harq_processes[harq_pid]->round = 0; //LOG_I(PHY,"PUSCH MAX Retransmission acheived ==> flush harq buff (%d) \n",harq_pid); - //LOG_I(PHY,"[HARQ-UL harqId: %d] PHICH NACK MAX RETRANS(%d) ==> subframe_scheduling_flag = %d round: %d\n", harq_pid, UE_mac_inst[eNB_id].scheduling_info.maxHARQ_Tx, ulsch->harq_processes[harq_pid]->subframe_scheduling_flag, ulsch->harq_processes[harq_pid]->round); + //LOG_I(PHY,"[HARQ-UL harqId: %d] PHICH NACK MAX RETRANS(%d) ==> subframe_scheduling_flag = %d round: %d\n", harq_pid, ulsch->Mlimit, ulsch->harq_processes[harq_pid]->subframe_scheduling_flag, ulsch->harq_processes[harq_pid]->round); } else { diff --git a/openair1/SCHED/phy_procedures_lte_ue.c b/openair1/SCHED/phy_procedures_lte_ue.c index 5dc629b90b..883099be30 100644 --- a/openair1/SCHED/phy_procedures_lte_ue.c +++ b/openair1/SCHED/phy_procedures_lte_ue.c @@ -1235,8 +1235,8 @@ void ue_ulsch_uespec_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB // deactivate service request // ue->ulsch[eNB_id]->harq_processes[harq_pid]->subframe_scheduling_flag = 0; - LOG_D(PHY,"Generating PUSCH (Abssubframe: %d.%d): harq-Id: %d, round: %d, MaxReTrans: %d \n",frame_tx,subframe_tx,harq_pid,ue->ulsch[eNB_id]->harq_processes[harq_pid]->round,UE_mac_inst[eNB_id].scheduling_info.maxHARQ_Tx); - if (ue->ulsch[eNB_id]->harq_processes[harq_pid]->round >= (UE_mac_inst[eNB_id].scheduling_info.maxHARQ_Tx - 1)) + LOG_D(PHY,"Generating PUSCH (Abssubframe: %d.%d): harq-Id: %d, round: %d, MaxReTrans: %d \n",frame_tx,subframe_tx,harq_pid,ue->ulsch[eNB_id]->harq_processes[harq_pid]->round,ue->ulsch[eNB_id]->Mlimit); + if (ue->ulsch[eNB_id]->harq_processes[harq_pid]->round >= (ue->ulsch[eNB_id]->Mlimit - 1)) { LOG_D(PHY,"PUSCH MAX Retransmission acheived ==> send last pusch (%d) \n"); ue->ulsch[eNB_id]->harq_processes[harq_pid]->subframe_scheduling_flag = 0; diff --git a/openair2/LAYER2/MAC/config.c b/openair2/LAYER2/MAC/config.c index 2ec37a423e..e4252ed500 100644 --- a/openair2/LAYER2/MAC/config.c +++ b/openair2/LAYER2/MAC/config.c @@ -221,6 +221,7 @@ rrc_mac_config_req( } else { UE_mac_inst[Mod_idP].scheduling_info.maxHARQ_Tx = (uint16_t) MAC_MainConfig__ul_SCH_Config__maxHARQ_Tx_n5; } + mac_xface->phy_config_harq_ue(Mod_idP,0,eNB_index,UE_mac_inst[Mod_idP].scheduling_info.maxHARQ_Tx); if (mac_MainConfig->ul_SCH_Config->retxBSR_Timer) { UE_mac_inst[Mod_idP].scheduling_info.retxBSR_Timer = (uint16_t) mac_MainConfig->ul_SCH_Config->retxBSR_Timer; diff --git a/openair2/PHY_INTERFACE/defs.h b/openair2/PHY_INTERFACE/defs.h index 8c711e971d..aeab9dfe66 100644 --- a/openair2/PHY_INTERFACE/defs.h +++ b/openair2/PHY_INTERFACE/defs.h @@ -185,6 +185,9 @@ typedef struct { void (*phy_config_dedicated_ue)(module_id_t Mod_id,int CC_id,uint8_t CH_index, struct PhysicalConfigDedicated *physicalConfigDedicated); + /// PHY-Config-harq UE + void (*phy_config_harq_ue)(module_id_t Mod_id,int CC_id,uint8_t CH_index, + uint16_t max_harq_tx); /// Configure Common PHY parameters from SIB1 void (*phy_config_sib1_ue)(module_id_t Mod_id,int CC_id,uint8_t CH_index, TDD_Config_t *tdd_config, From e0bf855fbf38f1e2373f6b9b36d1c45acbe5f9a8 Mon Sep 17 00:00:00 2001 From: hbilel Date: Mon, 12 Dec 2016 12:12:27 +0100 Subject: [PATCH 338/349] initialize max retans tx Mlimit --- openair1/PHY/INIT/defs.h | 12 ++++++++++++ openair1/PHY/LTE_TRANSPORT/ulsch_coding.c | 2 ++ openair2/LAYER2/MAC/main.c | 1 + 3 files changed, 15 insertions(+) diff --git a/openair1/PHY/INIT/defs.h b/openair1/PHY/INIT/defs.h index 1874c4e8c7..2b65bebc8d 100644 --- a/openair1/PHY/INIT/defs.h +++ b/openair1/PHY/INIT/defs.h @@ -206,7 +206,19 @@ void phy_config_dedicated_ue(module_id_t Mod_id, uint8_t CH_index, struct PhysicalConfigDedicated *physicalConfigDedicated); +/*! +\fn void phy_config_harq_ue(module_id_t Mod_id,uint8_t CC_id,uint8_t CH_index, + uint16_t max_harq_tx) +\brief Configure UE UL max harq Tx. +\details Invoked upon reception of RRCConnectionSetup or RRCConnectionReconfiguration from eNB. +@param Mod_id Instance ID for eNB +@param CC_id Component Carrier index +@param CH_index Index of eNB for this configuration +@param max_harq_tx max harq tx information + */ +void phy_config_harq_ue(module_id_t Mod_id,int CC_id,uint8_t CH_index, + uint16_t max_harq_tx); /** \brief Configure UE MBSFN common parameters. \details Invoked upon reception of SIB13 from eNB. diff --git a/openair1/PHY/LTE_TRANSPORT/ulsch_coding.c b/openair1/PHY/LTE_TRANSPORT/ulsch_coding.c index fe4e05747a..4559aaa326 100644 --- a/openair1/PHY/LTE_TRANSPORT/ulsch_coding.c +++ b/openair1/PHY/LTE_TRANSPORT/ulsch_coding.c @@ -140,6 +140,8 @@ LTE_UE_ULSCH_t *new_ue_ulsch(unsigned char N_RB_UL, uint8_t abstraction_flag) if (ulsch) { memset(ulsch,0,sizeof(LTE_UE_ULSCH_t)); + ulsch->Mlimit = 4; + for (i=0; i<8; i++) { ulsch->harq_processes[i] = (LTE_UL_UE_HARQ_t *)malloc16(sizeof(LTE_UL_UE_HARQ_t)); diff --git a/openair2/LAYER2/MAC/main.c b/openair2/LAYER2/MAC/main.c index 0fe9d63b6f..203bd3f36f 100644 --- a/openair2/LAYER2/MAC/main.c +++ b/openair2/LAYER2/MAC/main.c @@ -527,6 +527,7 @@ int l2_init(LTE_DL_FRAME_PARMS *frame_parms,int eMBMS_active, char *uecap_xer,ui mac_xface->phy_config_dedicated_eNB = phy_config_dedicated_eNB; mac_xface->phy_config_dedicated_ue = phy_config_dedicated_ue; + mac_xface->phy_config_harq_ue = phy_config_harq_ue; mac_xface->get_lte_frame_parms = get_lte_frame_parms; mac_xface->get_mu_mimo_mode = get_mu_mimo_mode; From 17aefade3fece7f4e0fdbbb84c1e8fc8c236ace0 Mon Sep 17 00:00:00 2001 From: hbilel Date: Mon, 12 Dec 2016 12:48:48 +0100 Subject: [PATCH 339/349] remove temporary harq process for ue (ul) --- openair1/PHY/LTE_TRANSPORT/dci_tools.c | 6 +++--- openair1/PHY/LTE_TRANSPORT/defs.h | 2 +- openair1/PHY/LTE_TRANSPORT/phich.c | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/openair1/PHY/LTE_TRANSPORT/dci_tools.c b/openair1/PHY/LTE_TRANSPORT/dci_tools.c index e73bb94d41..a1c118529a 100644 --- a/openair1/PHY/LTE_TRANSPORT/dci_tools.c +++ b/openair1/PHY/LTE_TRANSPORT/dci_tools.c @@ -6453,11 +6453,11 @@ int generate_ue_ulsch_params_from_dci(void *dci_pdu, // subframe, // ulsch->Mlimit); //#endif - +/* if (ulsch->harq_processes[harq_pid]->round > 0) // NACK detected on phich { // ulsch->harq_processes[harq_pid]->round++; already done on phich_rx - ulsch->harq_processes[harq_pid] = ulsch->harq_processes[8]; + // ulsch->harq_processes[harq_pid] = ulsch->harq_processes[8]; // LOG_I(PHY," Adaptative retransmission - copy temporary harq Process to current harq process. [harqId %d round %d] \n",harq_pid, ulsch->harq_processes[8]->round); if (ulsch->harq_processes[harq_pid]->round >= ulsch->Mlimit) //UE_mac_inst[eNB_id].scheduling_info.maxHARQ_Tx) @@ -6479,7 +6479,7 @@ int generate_ue_ulsch_params_from_dci(void *dci_pdu, //LOG_I(PHY," [HARQ-UL harqId: %d] Adaptative retransmission NACK ==> subframe_scheduling_flag = %d round: %d\n", harq_pid, ulsch->harq_processes[harq_pid]->subframe_scheduling_flag,ulsch->harq_processes[harq_pid]->round); } } - +*/ } } diff --git a/openair1/PHY/LTE_TRANSPORT/defs.h b/openair1/PHY/LTE_TRANSPORT/defs.h index c41df6c931..442fd82167 100644 --- a/openair1/PHY/LTE_TRANSPORT/defs.h +++ b/openair1/PHY/LTE_TRANSPORT/defs.h @@ -283,7 +283,7 @@ typedef struct { /// SRS active flag uint8_t srs_active; /// Pointers to 8 HARQ processes for the ULSCH - LTE_UL_UE_HARQ_t *harq_processes[9]; + LTE_UL_UE_HARQ_t *harq_processes[8]; /// Pointer to CQI data uint8_t o[MAX_CQI_BYTES]; /// Length of CQI data (bits) diff --git a/openair1/PHY/LTE_TRANSPORT/phich.c b/openair1/PHY/LTE_TRANSPORT/phich.c index c7cc188893..989567ca34 100644 --- a/openair1/PHY/LTE_TRANSPORT/phich.c +++ b/openair1/PHY/LTE_TRANSPORT/phich.c @@ -1441,7 +1441,7 @@ void rx_phich(PHY_VARS_UE *ue, // rely only on DCI0 decoding and check if NDI has toggled // save current harq_processes content in temporary struct // harqId-8 corresponds to the temporary struct. In total we have 8 harq process(0 ..7) + 1 temporary harq process() - ulsch->harq_processes[8] = ulsch->harq_processes[harq_pid]; + //ulsch->harq_processes[8] = ulsch->harq_processes[harq_pid]; ulsch->harq_processes[harq_pid]->subframe_scheduling_flag =0; ulsch->harq_processes[harq_pid]->status = IDLE; From 7f4c961d82dca3c7e10be4a07e18729ea3e6bb57 Mon Sep 17 00:00:00 2001 From: Chia-Yu Chang Date: Mon, 12 Dec 2016 18:41:26 +0100 Subject: [PATCH 340/349] add T messages for FLEXRAN and fix a complication error in FLEXRAN --- common/utils/T/T_messages.txt | 21 +++++++++++++++++++ .../MAC/flexran_agent_scheduler_dataplane.c | 2 +- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/common/utils/T/T_messages.txt b/common/utils/T/T_messages.txt index 2d2ee3c489..af2579cb1b 100644 --- a/common/utils/T/T_messages.txt +++ b/common/utils/T/T_messages.txt @@ -423,6 +423,27 @@ ID = LEGACY_ENB_APP_TRACE GROUP = ALL:LEGACY_ENB_APP:LEGACY_GROUP_TRACE:LEGACY FORMAT = string,log +ID = LEGACY_FLEXRAN_AGENT_INFO + DESC = FLEXRAN_AGENT legacy logs - info level + GROUP = ALL:LEGACY_FLEXRAN_AGENT:LEGACY_GROUP_INFO:LEGACY + FORMAT = string,log +ID = LEGACY_FLEXRAN_AGENT_ERROR + DESC = FLEXRAN_AGENT legacy logs - error level + GROUP = ALL:LEGACY_FLEXRAN_AGENT:LEGACY_GROUP_ERROR:LEGACY + FORMAT = string,log +ID = LEGACY_FLEXRAN_AGENT_WARNING + DESC = FLEXRAN_AGENT legacy logs - warning level + GROUP = ALL:LEGACY_FLEXRAN_AGENT:LEGACY_GROUP_WARNING:LEGACY + FORMAT = string,log +ID = LEGACY_FLEXRAN_AGENT_DEBUG + DESC = FLEXRAN_AGENT legacy logs - debug level + GROUP = ALL:LEGACY_FLEXRAN_AGENT:LEGACY_GROUP_DEBUG:LEGACY + FORMAT = string,log +ID = LEGACY_FLEXRAN_AGENT_TRACE + DESC = FLEXRAN_AGENT legacy logs - trace level + GROUP = ALL:LEGACY_FLEXRAN_AGENT:LEGACY_GROUP_TRACE:LEGACY + FORMAT = string,log + ID = LEGACY_SCTP_INFO DESC = SCTP legacy logs - info level GROUP = ALL:LEGACY_SCTP:LEGACY_GROUP_INFO:LEGACY diff --git a/openair2/LAYER2/MAC/flexran_agent_scheduler_dataplane.c b/openair2/LAYER2/MAC/flexran_agent_scheduler_dataplane.c index 6d3c32a516..ff3ef32bd6 100644 --- a/openair2/LAYER2/MAC/flexran_agent_scheduler_dataplane.c +++ b/openair2/LAYER2/MAC/flexran_agent_scheduler_dataplane.c @@ -303,7 +303,7 @@ void flexran_apply_ue_spec_scheduling_decisions(mid_t mod_id, if (opt_enabled == 1) { trace_pdu(1, (uint8_t *)UE_list->DLSCH_pdu[CC_id][0][UE_id].payload[0], TBS, mod_id, 3, UE_RNTI(mod_id, UE_id), - eNB->subframe,0,0); + eNB->frame, eNB->subframe,0,0); LOG_D(OPT,"[eNB %d][DLSCH] CC_id %d Frame %d rnti %x with size %d\n", mod_id, CC_id, frame, UE_RNTI(mod_id,UE_id), TBS); } From 01c50449c3c7a8ced78f6d0907e0bc56a9ddbf66 Mon Sep 17 00:00:00 2001 From: Chia-Yu Chang Date: Mon, 12 Dec 2016 18:43:37 +0100 Subject: [PATCH 341/349] fix the AVX2 compilation directive --- openair1/PHY/LTE_TRANSPORT/ulsch_decoding.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openair1/PHY/LTE_TRANSPORT/ulsch_decoding.c b/openair1/PHY/LTE_TRANSPORT/ulsch_decoding.c index 0ce810a52c..7f4f4cf5f6 100644 --- a/openair1/PHY/LTE_TRANSPORT/ulsch_decoding.c +++ b/openair1/PHY/LTE_TRANSPORT/ulsch_decoding.c @@ -1442,7 +1442,7 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc, } #if defined(__x86_64__)||defined(__i386__) -#ifndef __AVX2 +#ifndef __AVX2__ for (iprime=0; iprimee[iprime]) = *((__m128i *)&y[j2]); #else From ca078ff54945b97c84be7ddcf2e6703cbd8dba13 Mon Sep 17 00:00:00 2001 From: hbilel Date: Tue, 13 Dec 2016 17:38:43 +0100 Subject: [PATCH 342/349] fix compilation error --- openair2/LAYER2/MAC/ue_procedures.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openair2/LAYER2/MAC/ue_procedures.c b/openair2/LAYER2/MAC/ue_procedures.c index 0761177a19..cdac22c486 100644 --- a/openair2/LAYER2/MAC/ue_procedures.c +++ b/openair2/LAYER2/MAC/ue_procedures.c @@ -2127,14 +2127,14 @@ ue_scheduler( } //Check whether Regular BSR is triggered - if (update_bsr(module_idP,frameP, subframeP,eNB_indexP) == TRUE) { + if (update_bsr(module_idP,txFrameP, txSubframeP,eNB_indexP) == TRUE) { // call SR procedure to generate pending SR and BSR for next PUCCH/PUSCH TxOp. This should implement the procedures // outlined in Sections 5.4.4 an 5.4.5 of 36.321 UE_mac_inst[module_idP].scheduling_info.SR_pending= 1; // Regular BSR trigger UE_mac_inst[module_idP].BSR_reporting_active |= BSR_TRIGGER_REGULAR; LOG_D(MAC,"[UE %d][BSR] Regular BSR Triggered Frame %d subframe %d SR for PUSCH is pending\n", - module_idP, frameP,subframeP); + module_idP, txFrameP,txSubframeP); } // UE has no valid phy config dedicated || no valid/released SR From 1167dd6b33b44d5c078108874cbe9f6d6478711b Mon Sep 17 00:00:00 2001 From: gabrielC Date: Wed, 14 Dec 2016 10:16:54 +0100 Subject: [PATCH 343/349] ue autotest merge part2 --- .../autotests/patches/CmakeLists.patch | 12 - .../autotest_ue_cell_synch_event.patch | 20 - .../autotest_ue_dlsch_bitrate_metric.patch | 18 - .../patches/autotest_ue_offsets_metric.patch | 27 - .../autotests/patches/build_oai.patch | 40 - .../autotests/run_lte-softmodem-nos1_tests.py | 2595 ------------- .../autotests/testsuite_ue_noS1_eurecom.xml | 3214 ----------------- .../CODING/3gpplte_turbo_decoder_sse_8bit.c | 5 - 8 files changed, 5931 deletions(-) delete mode 100644 cmake_targets/autotests/patches/CmakeLists.patch delete mode 100644 cmake_targets/autotests/patches/autotest_ue_cell_synch_event.patch delete mode 100644 cmake_targets/autotests/patches/autotest_ue_dlsch_bitrate_metric.patch delete mode 100644 cmake_targets/autotests/patches/autotest_ue_offsets_metric.patch delete mode 100644 cmake_targets/autotests/patches/build_oai.patch delete mode 100755 cmake_targets/autotests/run_lte-softmodem-nos1_tests.py delete mode 100644 cmake_targets/autotests/testsuite_ue_noS1_eurecom.xml diff --git a/cmake_targets/autotests/patches/CmakeLists.patch b/cmake_targets/autotests/patches/CmakeLists.patch deleted file mode 100644 index 1e54e3a0f3..0000000000 --- a/cmake_targets/autotests/patches/CmakeLists.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt -index 07d92a1..b6a02d1 100644 ---- a/cmake_targets/CMakeLists.txt -+++ b/cmake_targets/CMakeLists.txt -@@ -235,6 +235,7 @@ add_boolean_option(DEBUG_OMG False "???") - add_boolean_option(XFORMS False "This adds the possibility to see the signal oscilloscope") - add_boolean_option(PRINT_STATS False "This adds the possibility to see the status") - add_boolean_option(T_TRACER False "Activate the T tracer, a debugging/monitoring framework" ) -+add_boolean_option(UE_AUTOTEST_TRACE False "Activate UE autotest specific logs") - - add_boolean_option(DEBUG_CONSOLE False "makes debugging easier, disables stdout/stderr buffering") - diff --git a/cmake_targets/autotests/patches/autotest_ue_cell_synch_event.patch b/cmake_targets/autotests/patches/autotest_ue_cell_synch_event.patch deleted file mode 100644 index 766b724c6c..0000000000 --- a/cmake_targets/autotests/patches/autotest_ue_cell_synch_event.patch +++ /dev/null @@ -1,20 +0,0 @@ -diff --git a/openair1/PHY/LTE_TRANSPORT/initial_sync.c b/openair1/PHY/LTE_TRANSPORT/initial_sync.c -index 663978e..b77cb1b 100644 ---- a/openair1/PHY/LTE_TRANSPORT/initial_sync.c -+++ b/openair1/PHY/LTE_TRANSPORT/initial_sync.c -@@ -476,6 +476,15 @@ int initial_sync(PHY_VARS_UE *ue, runmode_t mode) - //#endif - - if (ue->UE_scan_carrier == 0) { -+ -+ #if UE_AUTOTEST_TRACE -+ LOG_I(PHY,"[UE %d] AUTOTEST Cell Sync : frame = %d, rx_offset %d, freq_offset %d \n", -+ ue->Mod_id, -+ ue->proc.proc_rxtx[0].frame_rx, -+ ue->rx_offset, -+ ue->common_vars.freq_offset ); -+ #endif -+ - if (ue->mac_enabled==1) { - LOG_I(PHY,"[UE%d] Sending synch status to higher layers\n",ue->Mod_id); - //mac_resynch(); diff --git a/cmake_targets/autotests/patches/autotest_ue_dlsch_bitrate_metric.patch b/cmake_targets/autotests/patches/autotest_ue_dlsch_bitrate_metric.patch deleted file mode 100644 index 74139109f2..0000000000 --- a/cmake_targets/autotests/patches/autotest_ue_dlsch_bitrate_metric.patch +++ /dev/null @@ -1,18 +0,0 @@ -diff --git a/openair1/SCHED/phy_procedures_lte_ue.c b/openair1/SCHED/phy_procedures_lte_ue.c -index 5dc629b..353a049 100644 ---- a/openair1/SCHED/phy_procedures_lte_ue.c -+++ b/openair1/SCHED/phy_procedures_lte_ue.c -@@ -3551,6 +3551,13 @@ int phy_procedures_UE_RX(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uin - LOG_D(PHY,"[UE %d] Calculating bitrate Frame %d: total_TBS = %d, total_TBS_last = %d, bitrate %f kbits\n", - ue->Mod_id,frame_rx,ue->total_TBS[eNB_id], - ue->total_TBS_last[eNB_id],(float) ue->bitrate[eNB_id]/1000.0); -+ -+ #if UE_AUTOTEST_TRACE -+ if ((frame_rx % 100 == 0)) { -+ LOG_I(PHY,"[UE %d] AUTOTEST Metric : UE_DLSCH_BITRATE = %5.2f kbps (frame = %d) \n", ue->Mod_id, (float) ue->bitrate[eNB_id]/1000.0, frame_rx); -+ } -+ #endif -+ - } - - diff --git a/cmake_targets/autotests/patches/autotest_ue_offsets_metric.patch b/cmake_targets/autotests/patches/autotest_ue_offsets_metric.patch deleted file mode 100644 index 85afe8703e..0000000000 --- a/cmake_targets/autotests/patches/autotest_ue_offsets_metric.patch +++ /dev/null @@ -1,27 +0,0 @@ -diff --git a/openair1/SCHED/phy_procedures_lte_ue.c b/openair1/SCHED/phy_procedures_lte_ue.c -index 5dc629b..4d31ad3 100644 ---- a/openair1/SCHED/phy_procedures_lte_ue.c -+++ b/openair1/SCHED/phy_procedures_lte_ue.c -@@ -3347,6 +3347,22 @@ int phy_procedures_UE_RX(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uin - - // first slot has been processed (FFTs + Channel Estimation, PCFICH/PHICH/PDCCH) - -+ #if UE_AUTOTEST_TRACE -+ if ( (frame_rx % 10 == 0) && (subframe_rx == 0)) { -+ printf("AUTOTEST Metric : UE_FREQ_OFFSET = %d Hz (frame = %d) \n", ue->common_vars.freq_offset, frame_rx); -+ printf("AUTOTEST Metric : UE_RX_OFFSET = %d (frame = %d) \n", ue->rx_offset, frame_rx); -+ -+ printf("AUTOTEST Metric : RRC Measurments RSRP[0] %.2f dBm/RE, RSSI %.2f dBm, RSRQ[0] %.2f dB, N0 %d dBm/RE, NF %.1f dB (frame = %d)\n", -+ 10*log10(ue->measurements.rsrp[0])-ue->rx_total_gain_dB, -+ 10*log10(ue->measurements.rssi)-ue->rx_total_gain_dB, -+ 10*log10(ue->measurements.rsrq[0]), -+ ue->measurements.n0_power_tot_dBm, -+ (double)ue->measurements.n0_power_tot_dBm+132.24, -+ frame_rx); -+ } -+ #endif -+ -+ - // do procedures for C-RNTI - if (ue->dlsch[eNB_id][0]->active == 1) { - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_PROC, VCD_FUNCTION_IN); diff --git a/cmake_targets/autotests/patches/build_oai.patch b/cmake_targets/autotests/patches/build_oai.patch deleted file mode 100644 index cf93b466e7..0000000000 --- a/cmake_targets/autotests/patches/build_oai.patch +++ /dev/null @@ -1,40 +0,0 @@ -diff --git a/cmake_targets/build_oai b/cmake_targets/build_oai -index 25e9a1c..0b04bb7 100755 ---- a/cmake_targets/build_oai -+++ b/cmake_targets/build_oai -@@ -54,6 +54,7 @@ BUILD_DOXYGEN=0 - T_TRACER="False" - DISABLE_HARDWARE_DEPENDENCY="False" - CMAKE_BUILD_TYPE="" -+UE_AUTOTEST_TRACE="False" - trap handle_ctrl_c INT - - function print_help() { -@@ -130,6 +131,8 @@ Options - Enables the T tracer. - --disable-hardware-dependency - Disable HW dependency during installation -+--ue-autotest-trace -+ Enable specific traces for UE autotest framework - Usage (first build): - oaisim (eNB + UE): ./build_oai -I --oaisim -x --install-system-files - Eurecom EXMIMO + COTS UE : ./build_oai -I --eNB -x --install-system-files -@@ -285,6 +288,10 @@ function main() { - echo_info "Disabling hardware dependency for compiling software" - DISABLE_HARDWARE_DEPENDENCY="True" - shift 1;; -+ --ue-autotest-trace) -+ UE_AUTOTEST_TRACE="True" -+ echo_info "Enabling autotest specific trace for UE" -+ shift 1;; - -h | --help) - print_help - exit 1;; -@@ -457,6 +464,7 @@ function main() { - echo "set (DEADLINE_SCHEDULER \"${DEADLINE_SCHEDULER_FLAG_USER}\" )" >>$cmake_file - echo "set (CPU_AFFINITY \"${CPU_AFFINITY_FLAG_USER}\" )" >>$cmake_file - echo "set ( T_TRACER $T_TRACER )" >> $cmake_file -+ echo "set (UE_AUTOTEST_TRACE $UE_AUTOTEST_TRACE)" >> $cmake_file - echo 'include(${CMAKE_CURRENT_SOURCE_DIR}/../CMakeLists.txt)' >> $cmake_file - cd $DIR/$lte_build_dir/build - cmake .. diff --git a/cmake_targets/autotests/run_lte-softmodem-nos1_tests.py b/cmake_targets/autotests/run_lte-softmodem-nos1_tests.py deleted file mode 100755 index 2ece62ae16..0000000000 --- a/cmake_targets/autotests/run_lte-softmodem-nos1_tests.py +++ /dev/null @@ -1,2595 +0,0 @@ -#! /usr/bin/python -#/* -# * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more -# * contributor license agreements. See the NOTICE file distributed with -# * this work for additional information regarding copyright ownership. -# * The OpenAirInterface Software Alliance licenses this file to You under -# * the OAI Public License, Version 1.0 (the "License"); you may not use this file -# * except in compliance with the License. -# * You may obtain a copy of the License at -# * -# * http://www.openairinterface.org/?page_id=698 -# * -# * Unless required by applicable law or agreed to in writing, software -# * distributed under the License is distributed on an "AS IS" BASIS, -# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# * See the License for the specific language governing permissions and -# * limitations under the License. -# *------------------------------------------------------------------------------- -# * For more information about the OpenAirInterface (OAI) Software Alliance: -# * contact@openairinterface.org -# */ - -# \author Rohit Gupta - Benoit ROBERT (benoit.robert@syrtem.com) -# \version 0.1 -# @ingroup _test - -# \Changelog -# 2016-11-18 : -# - Add progess bar during test execution update_progress() - -import tempfile -import threading -import sys -import traceback -import wave -import os -import time -import datetime -import getpass -import math #from time import clock -import xml.etree.ElementTree as ET -import re - -#from dict2xml import dict2xml as xmlify - -from colorama import Fore, Back, Style - -import numpy as np - -import log - -from openair import * - -import paramiko - -import subprocess -import commands -sys.path.append('/opt/ssh') -sys.path.append(os.path.expandvars('$OPENAIR_DIR/cmake_targets/autotests/tools/')) - -from lib_autotest import * -import ssh -from ssh import SSHSession -import argparse - - -# update_progress() : Displays or updates a console progress bar -## Accepts a float between 0 and 1. Any int will be converted to a float. -## A value under 0 represents a 'halt'. -## A value at 1 or bigger represents 100% -def update_progress(progress, prefix_string): - barLength = 20 # Modify this to change the length of the progress bar - status = "" - #print "progress = "+ str(progress) - if isinstance(progress, int): - progress = float(progress) - if not isinstance(progress, float): - progress = 0 - status = "error: progress var must be float\r\n" - if progress < 0: - progress = 0 - status = "Halt...\r\n" - if progress >= 1: - progress = 1 - status = "Done...\r\n" - block = int(round(barLength*progress)) - text = "\r"+prefix_string+" [{0}] {1}% {2}".format( "="*block + " "*(barLength-block), progress*100, status) - sys.stdout.write(text) - sys.stdout.flush() - - -def exit_prog(exit_val): - print(Style.RESET_ALL), - sys.exit(exit_val) - -# \brief write a string to a file -# \param filename name of file -# \param string string to write -# \mode file opening mode (default=write) -def write_file(filename, string, mode="w"): - text_file = open(filename, mode) - text_file.write(string) - text_file.close() - -# \brief function to check if test case passed throughput test -# \param filename name of file which has throughput results (usually from iperf -s ... -# \param min_tput minimum throughput -# \param max_tuput maximum throughput -# \param average average throughput -# \param min_duration minimum duration of throughput -#The throughput values found in file must be higher than values from from arguments 2,3,4,5 -#The function returns True if throughput conditions are saisfied else it returns fails -def tput_test(filename, min_tput, max_tput, average, min_duration): - - if os.path.exists(filename): - with open (filename, "r") as myfile: - data=myfile.read() - p=re.compile('(\d*.\d*) Mbits/sec') - array=p.findall(data) - array = [ float(x) for x in array ] - duration = array.__len__() - if duration !=0: - min_list = min(array) - max_list = max(array) - average_list = np.mean(array) - else: - min_list = 0 - max_list = 0 - average_list=0 - tput_string=' ( '+ "min=%0.2f" % min_list + ' Mbps / ' + "max=%0.2f" % max_list + ' Mbps / ' + "avg=%0.2f" % average_list + ' Mbps / ' + "dur=%0.2f" % duration + ' s) ' - if (min_list >= min_tput and max_list >= max_tput and average_list >= average and duration >= min_duration): - return True , tput_string - else: - return False , tput_string - else: - return False , tput_string - -# \brief Convert string to float or return None if there is exception -def try_convert_to_float(string, fail=None): - try: - return float(string) - except Exception: - return fail; - -# \brief get throughput statistics from log file -# \param search_expr search expression found in test_case_list.xml file -# \param logfile_traffic logfile which has traffic statistics -def tput_test_search_expr (search_expr, logfile_traffic): - result=0 - tput_string='' - if search_expr !='': - if search_expr.find('throughput_test')!= -1 : - p= re.compile('min\s*=\s*(\d*.\d*)\s*Mbits/sec') - min_tput=p.findall(search_expr) - if min_tput.__len__()==1: - min_tput = min_tput[0] - else: - min_tput = None - - p= re.compile('max\s*=\s*(\d*.\d*)\s*Mbits/sec') - max_tput=p.findall(search_expr) - if max_tput.__len__()==1: - max_tput = max_tput[0] - else: - max_tput = None - - p= re.compile('average\s*=\s*(\d*.\d*)\s*Mbits/sec') - avg_tput=p.findall(search_expr) - if avg_tput.__len__()==1: - avg_tput=avg_tput[0] - else: - avg_tput = None - - p= re.compile('duration\s*=\s*(\d*.\d*)\s*s') - duration=p.findall(search_expr) - if duration.__len__()==1: - duration = duration[0] - else: - duration = None - - min_tput = try_convert_to_float(min_tput) - max_tput = try_convert_to_float(max_tput) - avg_tput = try_convert_to_float(avg_tput) - duration = try_convert_to_float(duration) - - if (min_tput != None and max_tput != None and avg_tput != None and duration != None ): - result, tput_string = tput_test(logfile_traffic, min_tput, max_tput, avg_tput, duration) - else: - result=1 - - return result, tput_string - -# \brief function to copy files to/from remote machine -# \param username user with which to make sftp connection -# \param password password of user -# \param hostname host to connect -# \ports port of remote machine on which server is listening -# \paramList This is list of operations as a set {operation: "get/put", localfile: "filename", remotefile: "filename" -# \param logfile Ignored currently and set once at the beginning of program -def sftp_module (username, password, hostname, ports, paramList,logfile): - #localD = localfile - #remoteD = remotefile - #fd, paramiko_logfile = tempfile.mkstemp() - #res = os.close(fd ) - #paramiko logfile path should not be changed with multiple calls. The logs seem to in first file regardless - error = "" - #The lines below are outside exception loop to be sure to terminate the test case if the network connectivity goes down or there is authentication failure - transport = paramiko.Transport((hostname, ports)) - transport.connect(username = username, password = password) - sftp = paramiko.SFTPClient.from_transport(transport) - # index =0 - for param in paramList: - try: - operation = param["operation"] - localD = param["localfile"] - remoteD = param["remotefile"] - if operation == "put": - sftp.put(remotepath=remoteD, localpath=localD) - elif operation == "get": - sftp.get(remotepath=remoteD, localpath=localD) - else : - print "sftp_module: unidentified operation:<" + operation + "> Exiting now" - print "hostname = " + hostname - print "ports = " + ports - print "localfile = " + localD - print "remotefile = " + remoteD - print "operation = " + operation - sys.exit() - except Exception, e: - error = error + ' In function: ' + sys._getframe().f_code.co_name + ': *** Caught exception: ' + str(e.__class__) + " : " + str( e) - error = error + '\n username = ' + username + '\n hostname = ' + hostname + '\n localfile = ' + localD + '\n remotefile = ' + remoteD + '\n operation = ' + operation + '\nlogfile = ' + logfile + '\n ports = ' + str(ports) + '\n' - error = error + traceback.format_exc() - print error - - sftp.close() - transport.close() - res = os.system('\n echo \'SFTP Module Log for Machine: <' + hostname + '> starts...\' >> ' + logfile + ' 2>&1 ') - res = os.system('cat ' + paramiko_logfile + ' >> ' + logfile + ' 2>&1 \n') - write_file(logfile, error, "a") - res = os.system('\n echo \'SFTP Module Log for Machine: <' + hostname + '> ends...\' >> ' + logfile + ' 2>&1 \n') - -# \brief bash script stub put at the end of scripts to terminate it -# \param timeout_cmd terminate script after timeout_cmd seconds -# \param terminate_missing_procs if True terminate all the processes launched by script if one of them terminates prematurely (due to error) -def finalize_deploy_script (timeout_cmd, terminate_missing_procs='False'): - cmd = 'declare -i timeout_cmd='+str(timeout_cmd) + '\n' - if terminate_missing_procs == 'True': - cmd = cmd + """ - #The code below checks if one the processes launched in background has crashed. - #If it does, then the code below terminates all the child processes created by this script - declare -i wakeup_interval=1 - declare -i step=0 - echo \"Array pid = ${array_exec_pid[@]}\" - while [ "$step" -lt "$timeout_cmd" ] - do - declare -i break_while_loop=0 - #Iterate over each process ID in array_exec_pid - for i in "${array_exec_pid[@]}" - do - numchild=`pstree -p $i | perl -ne 's/\((\d+)\)/print " $1"/ge' |wc -w` - echo "PID = $i, numchild = $numchild" - if [ "$numchild" -eq "0" ] ; then - echo "Process ID $i has finished unexpectedly. Now preparing to kill all the processes " - break_while_loop=1 - break - fi - done - if [ "$break_while_loop" -eq "1" ] ; then - break - fi - step=$(( step + wakeup_interval )) - sleep $wakeup_interval - done - echo "Final time step (Duration of test case) = $step " - date - """ - else: - #We do not terminate the script if one of the processes has existed prematurely - cmd = cmd + 'sleep ' + str(timeout_cmd) + ' ; date \n' - - return cmd - -# \brief run python script and update config file params of test case -# \param oai module with already open connection -# \param config_string config string taken from xml file -# \param logdirRepo directory of remote repository -# \param python_script python script location -def update_config_file(oai, config_string, logdirRepo, python_script): - cmd="" - if config_string : - stringArray = config_string.splitlines() - #python_script = '$OPENAIR_DIR/targets/autotests/tools/search_repl.py' - for string in stringArray: - #split the string based on space now - string1=string.split() - cmd = cmd + 'python ' + python_script + ' ' + logdirRepo+'/'+string1[0] + ' ' + string1[1] + ' '+ string1[2] + '\n' - #cmd = cmd + 'perl -p -i -e \'s/'+ string1[1] + '\\s*=\\s*"\\S*"\\s*/' + string1[1] + ' = "' + string1[2] +'"' + '/g\' ' + logdirRepo + '/' +string1[0] + '\n' - return cmd - #result = oai.send_recv(cmd) - -# \brief thread safe sshsession wrapper due to occasional connection issues with ssh -# \param machine name of machine -# \param username user login for remote machine -# \param key_file file name which has keys to enable passwordless login -# \param password password for remote machine -# \param logdir_remote remote directory -# \param logdir_local_base local directory -# \param operation operation to perform (get_all, put_all) transfers recursively for directories -def SSHSessionWrapper(machine, username, key_file, password, logdir_remote, logdir_local_base, operation): - max_tries = 10 - i=0 - while i <= max_tries: - i = i +1 - try: - ssh = SSHSession(machine , username, key_file, password) - if operation == "get_all": - ssh.get_all(logdir_remote , logdir_local_base) - elif operation == "put_all": - ssh.put_all(logdir_local_base, logdir_remote ) - else: - print "Error: Uknown operation in SSHSessionWrapper. Exiting now..." - sys.exit(1) - break - except Exception, e: - error='' - error = error + ' In Class = function: ' + sys._getframe().f_code.co_name + ': *** Caught exception: ' + str(e.__class__) + " : " + str( e) - error = error + '\n username = ' + username + '\n machine = ' + machine + '\n logdir_remote = ' + logdir_remote + '\n logdir_local_base = ' + logdir_local_base - error = error + traceback.format_exc() - print error - print " Retrying again in 1 seconds" - time.sleep(1) - print "Continuing ..." - if i ==max_tries: - print "Fatal Error: Max no of retries reached. Exiting now..." - sys.exit(1) - - - -# \briefFunction to clean old programs that might be running from earlier execution -# \param oai - parameter for making connection to machine -# \parm programList list of programs that must be terminated before execution of any test case -# \param CleanUpAluLteBox program to terminate AlU Bell Labs LTE Box -# \param ExmimoRfStop String to stop EXMIMO card (specified in test_case_list.xml) -def cleanOldPrograms(oai, programList, CleanUpAluLteBox, ExmimoRfStop, logdir, logdirOAI5GRepo): - cmd = 'killall -9 ' + programList - result = oai.send(cmd, True) -# print "\t\t > "+cmd -# print "\t\t < "+result - -# print "Killing old programs on ..." + result - programArray = programList.split() - programListJoin = '|'.join(programArray) - cmd = " ( date ;echo \"Starting cleaning old programs.. \" ; dmesg|tail ; echo \"Current disk space.. \" ; df -h )>& " + logdir + "/oai_test_setup_cleanup.log.`hostname` 2>&1 ; sync" - result=oai.send_recv(cmd) -# print "\t\t > "+cmd -# print "\t\t < "+result - - cmd = cleanupOldProgramsScript + ' ' + '\''+programListJoin+'\'' - #result = oai.send_recv(cmd) - #print result - result = oai.send_expect_false(cmd, 'Match found', False) -# print "\t\t > "+cmd -# print "\t\t < "+result - -# print "Looking for old programs..." + result - res=oai.send_recv(CleanUpAluLteBox, True) -# print "\t\t > "+CleanUpAluLteBox -# print "\t\t < "+res - cmd= " echo \"Starting EXmimoRF Stop... \" >> " + logdir + "/oai_test_setup_cleanup.log.`hostname` 2>&1 ; sync "; - result = oai.send_recv(cmd) -# print "\t\t > "+cmd -# print "\t\t < "+result - cmd = "( " + "cd " + logdirOAI5GRepo + " ; source oaienv ; " + ExmimoRfStop + " ) >> " + logdir + "/oai_test_setup_cleanup.log.`hostname` 2>&1 ; sync " -# print "cleanoldprograms cmd = " + cmd - res=oai.send_recv(cmd, False, timeout=600) -# print "\t\t > "+cmd -# print "\t\t < "+res - - cmd= " echo \"Stopping EXmimoRF Stop... \" >> " + logdir + "/oai_test_setup_cleanup.log.`hostname` 2>&1 ; sync "; - result = oai.send_recv(cmd) -# print "\t\t > "+cmd -# print "\t\t < "+result - - #res = oai.send_recv(ExmimoRfStop, False) - cmd = " ( date ;echo \"Finished cleaning old programs.. \" ; dmesg | tail)>> $HOME/.oai_test_setup_cleanup.log.`hostname` 2>&1 ; sync" - res=oai.send_recv(cmd) -# print "\t\t > "+cmd -# print "\t\t < "+res - -# \brief Class thread to launch a generic command on remote machine -# \param threadID number of thread (for book keeping) -# \param threadname string of threadname (for book keeping) -# \param machine machine name on which to run the command -# \param username username with which to login -# \param password password with which to login -# \param cmd command as a string to run on remote machine -# \parma sudo if True sudo is set -# \param timeout timeout of command in seconds -class oaiThread (threading.Thread): - def __init__(self, threadID, threadname, machine, username, password, cmd, sudo, timeout): - threading.Thread.__init__(self) - self.threadID = threadID - self.threadname = threadname - self.machine = machine - self.username = username - self.password = password - self.cmd = cmd - self.sudo = sudo - self.timeout = timeout - def run(self): - try: - oai = openair('localdomain',self.machine) - oai.connect(self.username, self.password) - # print "Starting " + self.threadname + " on machine " + self.machine - result = oai.send_recv(self.cmd, self.sudo, self.timeout) - #print "result = " + result - #print "Exiting " + self.threadname - oai.disconnect() - except Exception, e: - error='' - error = error + ' In class oaiThread, function: ' + sys._getframe().f_code.co_name + ': *** Caught exception: ' + str(e.__class__) + " : " + str( e) - error = error + '\n threadID = ' + str(self.threadID) + '\n threadname = ' + self.threadname + '\n timeout = ' + str(self.timeout) + '\n machine = ' + self.machine + '\n cmd = ' + self.cmd + '\n timeout = ' + str(self.timeout) + '\n username = ' + self.username + '\n' - error = error + traceback.format_exc() - print error - - -# \brief This class runs test cases with class {execution, compilatation} -# \param threadID number of thread (for book keeping) -# \param name string of threadname (for book keeping) -# \param machine machine name on which to run the command -# \param logdirOAI5GRepo directory on remote machine which as openairinterface5g repo installed -# \param testcasename name of test case to run on remote machine -# \param CleanupAluLteBox string that contains commands to stop ALU Bell Labs LTEBox (specified in test_case_list.xml) -# \param user username with which to login -# \param password password with which to login -# \param timeout timeout of command in seconds -# \param ExmimoRfStop command to stop EXMIMO Card -class testCaseThread_generic (threading.Thread): - def __init__(self, threadID, name, machine, logdirOAI5GRepo, testcasename,oldprogramList, CleanupAluLteBox, user, password, timeout, ExmimoRfStop): - threading.Thread.__init__(self) - self.threadID = threadID - self.name = name - self.testcasename = testcasename - self.timeout = timeout - self.machine = machine - self.logdirOAI5GRepo = logdirOAI5GRepo - self.oldprogramList = oldprogramList - self.CleanupAluLteBox = CleanupAluLteBox - self.password=password - self.ExmimoRfStop = ExmimoRfStop - self.user = user - def run(self): - try: - mypassword='' - #addsudo = 'echo \'' + mypassword + '\' | sudo -S -E ' - addpass = 'echo \'' + mypassword + '\' | ' - #user = getpass.getuser() - print "Starting test case : " + self.testcasename + " On machine " + self.machine + " timeout = " + str(self.timeout) - oai = openair('localdomain',self.machine) - oai.connect(self.user, self.password) - #cleanOldPrograms(oai, self.oldprogramList, self.CleanupAluLteBox, self.ExmimoRfStop) - logdir_local = os.environ.get('OPENAIR_DIR') - logdir_local_testcase = logdir_local +'/cmake_targets/autotests/log/'+ self.testcasename - logdir_local_base = logdir_local +'/cmake_targets/autotests/log/' - logdir_remote_testcase = self.logdirOAI5GRepo + '/cmake_targets/autotests/log/' + self.testcasename - logdir_remote = self.logdirOAI5GRepo + '/cmake_targets/autotests/log/' - logfile_task_testcasename = logdir_local_testcase + '/test_task' + '_' + self.testcasename + '_.log' - logfile_task_testcasename_out = logdir_remote + '/test_task_out' + '_' + self.testcasename + '_.log' - #print "logdir_local_testcase = " + logdir_local_testcase - #print "logdir_remote_testcase = " + logdir_remote_testcase - #if os.path.exists(logdir_local_testcase) == True : - # os.removedirs(logdir_local_testcase) - #os.mkdir(logdir_local_testcase) - os.system("rm -fr " + logdir_local_testcase ) - os.system("mkdir -p " + logdir_local_testcase) - cmd = "mkdir -p " + logdir_remote_testcase - res = oai.send_recv(cmd, False, self.timeout) - #print "res = " + res - - cmd = "( cd " + self.logdirOAI5GRepo + " \n " - cmd = cmd + "source oaienv \n" - cmd = cmd + "$OPENAIR_DIR/cmake_targets/autotests/run_exec_autotests.bash --run-group \"" + self.testcasename + "\" -p \'\'" - cmd = cmd + " ) >& " + logfile_task_testcasename_out + " ; " + "mkdir -p " + logdir_remote_testcase + "; mv " + logfile_task_testcasename_out + " " +logdir_remote_testcase - - #print "cmd = " + cmd - res = oai.send_recv(cmd, False, self.timeout) - #print "res = " + res - #print "ThreadID = " + str(self.threadID) + "ThreadName: " + self.name + " testcasename: " + self.testcasename + "Execution Result = " + res - write_file(logfile_task_testcasename, cmd, mode="w") - #Now we copy all the remote files - #ssh = SSHSession(self.machine , username=user, key_file=None, password=self.password) - #ssh.get_all(logdir_remote_testcase , logdir_local_base) - SSHSessionWrapper(self.machine, self.user, None, self.password, logdir_remote_testcase, logdir_local_base, "get_all") - print "Finishing test case : " + self.testcasename + " On machine " + self.machine - #cleanOldPrograms(oai, self.oldprogramList, self.CleanupAluLteBox, self.ExmimoRfStop) - #oai.kill(user,mypassword) - oai.disconnect() - except Exception, e: - error='' - error = error + ' In Class = testCaseThread_generic, function: ' + sys._getframe().f_code.co_name + ': *** Caught exception: ' + str(e.__class__) + " : " + str( e) - error = error + '\n threadID = ' + str(self.threadID) + '\n threadName = ' + self.name + '\n testcasename = ' + self.testcasename + '\n machine = ' + self.machine + '\n logdirOAI5GRepo = ' + self.logdirOAI5GRepo + '\n' + '\n timeout = ' + str(self.timeout) + '\n user = ' + self.user - error = error + traceback.format_exc() - print error - print "Continuing with next test case..." - #sys.exit() - - - -# \bried function to run a command as a sudo -# \param cmd command as a string -# \param password password to be supplied -def addsudo (cmd, password=""): - cmd = 'echo \'' + password + '\' | sudo -S -E bash -c \' ' + cmd + '\' ' - return cmd - -# \brief handler for executing test cases (compilation, execution) -# \param name of testcase -# \param threadListGeneric list of threads which are already running on remote machines -# \param oldprogramList list of programs which must be terminated before running a test case -# \param logdirOAI5GRepo directory on remote machine which as openairinterface5g repo installed -# \param MachineList list of all machines on which generic test cases can be run -# \param user username with which to login -# \param password password with which to login -# \param CleanupAluLteBox string that contains commands to stop ALU Bell Labs LTEBox (specified in test_case_list.xml) -# \param timeout timeout of command in seconds -# \param ExmimoRfStop command to stop EXMIMO Card -def handle_testcaseclass_generic (testcasename, threadListGeneric, oldprogramList, logdirOAI5GRepo, MachineList, user, password, CleanupAluLteBox,timeout, ExmimoRfStop): - try: - mypassword=password - MachineListFree=[] - threadListNew=[] - while MachineListFree.__len__() == 0 : - MachineListBusy=[] - MachineListFree=[] - threadListNew=[] - #first we need to find the list of free machines that we could run our test case - if threadListGeneric.__len__() ==0 : - #This means no thread is started yet - MachineListFree = MachineList[:] - else : - for param in threadListGeneric : - thread_id = param["thread_id"] - machine = param["Machine"] - testcasenameold = param["testcasename"] - thread_id.join(1) - if thread_id.isAlive() == True: - threadListNew.append(param) - print "thread_id is alive: testcasename: " + testcasenameold + " on machine "+ machine - if machine not in MachineListBusy: - MachineListBusy.append(machine) - else : - print "thread_id is finished: testcasename: " + testcasenameold + " on machine " + machine - #threadListGeneric.remove(param) - #if machine not in MachineListFree: - # MachineListFree.append(machine) - #Now we check if there is at least one free machine - MachineListFree = MachineList[:] - for machine in MachineListBusy: - if machine in MachineListFree: - MachineListFree.remove(machine) - print "MachineListFree = " + ','.join(MachineListFree) - print "MachineListBusy = " + ','.join(MachineListBusy) - print "MachineList = " + ','.join(MachineList) - machine = MachineListFree[0] - thread = testCaseThread_generic(1,"Generic Thread_"+testcasename+"_"+ "machine_", machine, logdirOAI5GRepo, testcasename, oldprogramList, CleanupAluLteBox, user, password, timeout, ExmimoRfStop) - param={"thread_id":thread, "Machine":machine, "testcasename":testcasename} - thread.start() - threadListNew.append(param) - return threadListNew - except Exception, e: - error='' - error = error + ' In function: ' + sys._getframe().f_code.co_name + ': *** Caught exception: ' + str(e.__class__) + " : " + str( e) - error = error + '\n testcasename = ' + testcasename + '\n logdirOAI5GRepo = ' + logdirOAI5GRepo + '\n MachineList = ' + ','.join(MachineList) + '\n timeout = ' + str(timeout) + '\n' + 'user = ' + user - error = error + traceback.format_exc() - print error - print "Continuing..." - #sys.exit(1) - -# \brief Blocking wait for all threads related to generic testcase execution, class (compilation and execution) -# \param threadListGeneric list of threads which are running on remote machines -# \param timeout time to wait on threads in seconds -def wait_testcaseclass_generic_threads(threadListGeneric, timeout = 1): - threadListGenericNew=[] - for param in threadListGeneric: - thread_id = param["thread_id"] - machine = param["Machine"] - testcasenameold = param["testcasename"] - thread_id.join(timeout) - if thread_id.isAlive() == True: - threadListGenericNew.append(param) - print "thread_id on machine: " + machine + " is still alive: testcasename: " + testcasenameold - print " Exiting now..." - sys.exit(1) - else: - print "thread_id on machine: " + machine + " is stopped: testcasename: " + testcasenameold - #threadListGeneric.remove(param) - return threadListGenericNew - - -# \brief handler for executing test cases (lte-softmodem) -# \param testcase name of testcase -# \param oldprogramList list of programs which must be terminated before running a test case -# \param logdirOAI5GRepo directory on remote machine which has openairinterface5g repo installed -# \param logdirOpenaircnRepo directory on remote machine which has openair-cn repo installed -# \param MachineList list of all machines on which test cases can be run -# \param user username with which to login -# \param password password with which to login -# \param CleanupAluLteBox string that contains commands to stop ALU Bell Labs LTEBox (specified in test_case_list.xml) -# \param ExmimoRfStop command to stop EXMIMO Card -# \param nruns_lte-softmodem global parameter to override number of runs (nruns) within the test case -def handle_testcaseclass_softmodem (testcase, oldprogramList, logdirOAI5GRepo , logdirOpenaircnRepo, MachineList, user, password, CleanUpAluLteBox, ExmimoRfStop, nruns_lte_softmodem, timeout_cmd): - #We ignore the password sent to this function for secuirity reasons for password present in log files - #It is recommended to add a line in /etc/sudoers that looks something like below. The line below will run sudo without password prompt - # your_user_name ALL=(ALL:ALL) NOPASSWD: ALL - mypassword='' - #addsudo = 'echo \'' + mypassword + '\' | sudo -S -E ' - addpass = 'echo \'' + mypassword + '\' | ' - #user = getpass.getuser() - testcasename = testcase.get('id') - testcaseclass = testcase.findtext('class',default='') - if timeout_cmd == '': - timeout_cmd = testcase.findtext('TimeOut_cmd',default='') - timeout_cmd = int(float(timeout_cmd)) - #Timeout_thread is more than that of cmd to have room for compilation time, etc - timeout_thread = timeout_cmd + 300 - if nruns_lte_softmodem == '': - nruns = testcase.findtext('nruns',default='') - else: - nruns = nruns_lte_softmodem - nruns = int(float(nruns)) - tags = testcase.findtext('tags',default='') - - RRHMachine = testcase.findtext('RRH',default='') - RRH_compile_prog = testcase.findtext('RRH_compile_prog',default='') - RRH_compile_prog_args = testcase.findtext('RRH_compile_prog_args',default='') - RRH_pre_exec = testcase.findtext('RRH_pre_exec',default='') - RRH_pre_exec_args = testcase.findtext('RRH_pre_exec_args',default='') - RRH_main_exec = testcase.findtext('RRH_main_exec',default='') - RRH_main_exec_args = testcase.findtext('RRH_main_exec_args',default='') - RRH_terminate_missing_procs = testcase.findtext('RRH_terminate_missing_procs',default='False') - - - eNBMachine = testcase.findtext('eNB',default='') - eNB_config_file = testcase.findtext('eNB_config_file',default='') - eNB_compile_prog = testcase.findtext('eNB_compile_prog',default='') - eNB_compile_prog_args = testcase.findtext('eNB_compile_prog_args',default='') - eNB_pre_exec = testcase.findtext('eNB_pre_exec',default='') - eNB_pre_exec_args = testcase.findtext('eNB_pre_exec_args',default='') - eNB_main_exec = testcase.findtext('eNB_main_exec',default='') - eNB_main_exec_args = testcase.findtext('eNB_main_exec_args',default='') - eNB_traffic_exec = testcase.findtext('eNB_traffic_exec',default='') - eNB_traffic_exec_args = testcase.findtext('eNB_traffic_exec_args',default='') - eNB_terminate_missing_procs = testcase.findtext('eNB_terminate_missing_procs',default='False') - eNB_search_expr_true = testcase.findtext('eNB_search_expr_true','') - if re.compile('\w+').match(eNB_search_expr_true) != None: - eNB_search_expr_true = eNB_search_expr_true + ' duration=' + str(timeout_cmd-90) + 's' - - UEMachine = testcase.findtext('UE',default='') - UE_config_file = testcase.findtext('UE_config_file',default='') - UE_compile_prog = testcase.findtext('UE_compile_prog',default='') - UE_compile_prog_args = testcase.findtext('UE_compile_prog_args',default='') - UE_pre_exec = testcase.findtext('UE_pre_exec',default='') - UE_pre_exec_args = testcase.findtext('UE_pre_exec_args',default='') - UE_main_exec = testcase.findtext('UE_main_exec',default='') - UE_main_exec_args = testcase.findtext('UE_main_exec_args',default='') - UE_traffic_exec = testcase.findtext('UE_traffic_exec',default='') - UE_traffic_exec_args = testcase.findtext('UE_traffic_exec_args',default='') - UE_terminate_missing_procs = testcase.findtext('UE_terminate_missing_procs',default='False') - UE_search_expr_true = testcase.findtext('UE_search_expr_true','') - UE_stop_script = testcase.findtext('UE_stop_script','') - if re.compile('\w+').match(UE_search_expr_true) != None: - UE_search_expr_true = UE_search_expr_true + ' duration=' + str(timeout_cmd-90) + 's' - - EPCMachine = testcase.findtext('EPC',default='') - EPC_config_file = testcase.findtext('EPC_config_file',default='') - EPC_compile_prog = testcase.findtext('EPC_compile_prog',default='') - EPC_compile_prog_args = testcase.findtext('EPC_compile_prog_args',default='') - HSS_compile_prog = testcase.findtext('HSS_compile_prog',default='') - HSS_compile_prog_args = testcase.findtext('HSS_compile_prog_args',default='') - - EPC_pre_exec= testcase.findtext('EPC_pre_exec',default='') - EPC_pre_exec_args = testcase.findtext('EPC_pre_exec_args',default='') - EPC_main_exec= testcase.findtext('EPC_main_exec',default='') - EPC_main_exec_args = testcase.findtext('EPC_main_exec_args',default='') - HSS_main_exec= testcase.findtext('HSS_main_exec',default='') - HSS_main_exec_args = testcase.findtext('HSS_main_exec_args',default='') - EPC_traffic_exec = testcase.findtext('EPC_traffic_exec',default='') - EPC_traffic_exec_args = testcase.findtext('EPC_traffic_exec_args',default='') - EPC_terminate_missing_procs = testcase.findtext('EPC_terminate_missing_procs',default='False') - EPC_search_expr_true = testcase.findtext('EPC_search_expr_true','') - if re.compile('\w+').match(EPC_search_expr_true) != None: - EPC_search_expr_true = EPC_search_expr_true + ' duration=' + str(timeout_cmd-90) + 's' - - index_eNBMachine = MachineList.index(eNBMachine) - index_UEMachine = MachineList.index(UEMachine) - index_EPCMachine = MachineList.index(EPCMachine) - cmd = 'cd ' + logdirOAI5GRepo + '; source oaienv ; env|grep OPENAIR' - oai_eNB = openair('localdomain', eNBMachine) - oai_eNB.connect(user, password) - res= oai_eNB.send_recv(cmd) - oai_UE = openair('localdomain', UEMachine) - oai_UE.connect(user, password) - res = oai_eNB.send_recv(cmd) - oai_EPC = openair('localdomain', EPCMachine) - oai_EPC.connect(user, password) - res = oai_eNB.send_recv(cmd) - if RRHMachine != '': - cmd = 'cd ' + logdirOAI5GRepo + '; source oaienv ; env|grep OPENAIR' - index_RRHMachine = MachineList.index(RRHMachine) - oai_RRH = openair('localdomain', RRHMachine) - oai_RRH.connect(user, password) - res= oai_RRH.send_recv(cmd) - #cleanOldPrograms(oai_eNB, oldprogramList, CleanUpAluLteBox, ExmimoRfStop) - #cleanOldPrograms(oai_UE, oldprogramList, CleanUpAluLteBox, ExmimoRfStop) - #cleanOldPrograms(oai_EPC, oldprogramList, CleanUpAluLteBox, ExmimoRfStop) - logdir_local = os.environ.get('OPENAIR_DIR') - if logdir_local is None: - print "Environment variable OPENAIR_DIR not set correctly" - sys.exit() - - #Make the log directory of test case - #cmd = 'mkdir -p ' + logdir_eNB - #result = oai_eNB.send_recv(cmd) - #cmd = 'mkdir -p ' + logdir_UE - #result = oai_UE.send_recv(cmd) - #cmd = 'mkdir -p ' + logdir_EPC - #result = oai_EPC.send_recv(cmd) - - print "Updating the config files for ENB/UE/EPC..." - #updating the eNB/UE/EPC configuration file from the test case - #update_config_file(oai_eNB, eNB_config_file, logdirOAI5GRepo) - #update_config_file(oai_UE, UE_config_file, logdirOAI5GRepo) - #update_config_file(oai_EPC, EPC_config_file, logdirOpenaircnRepo) - test_result=1 - test_result_string='' - start_time=time.time() - for run in range(0,nruns): - run_result=1 - run_result_string='' - logdir_eNB = logdirOAI5GRepo+'/cmake_targets/autotests/log/'+ testcasename + '/run_' + str(run) - logdir_RRH = logdirOAI5GRepo+'/cmake_targets/autotests/log/'+ testcasename + '/run_' + str(run) - logdir_UE = logdirOAI5GRepo+'/cmake_targets/autotests/log/'+ testcasename + '/run_' + str(run) - logdir_EPC = logdirOpenaircnRepo+'/TEST/autotests/log/'+ testcasename + '/run_' + str(run) - logdir_local_testcase = logdir_local + '/cmake_targets/autotests/log/'+ testcasename + '/run_' + str(run) - #Make the log directory of test case - if RRHMachine != '': - cmd = 'rm -fr ' + logdir_RRH + ' ; mkdir -p ' + logdir_RRH - result = oai_RRH.send_recv(cmd) - cmd = 'rm -fr ' + logdir_eNB + ' ; mkdir -p ' + logdir_eNB - result = oai_eNB.send_recv(cmd) - cmd = 'rm -fr ' + logdir_UE + ' ; mkdir -p ' + logdir_UE - result = oai_UE.send_recv(cmd) - cmd = 'rm -fr ' + logdir_EPC + '; mkdir -p ' + logdir_EPC - result = oai_EPC.send_recv(cmd) - cmd = ' rm -fr ' + logdir_local_testcase + ' ; mkdir -p ' + logdir_local_testcase - result = os.system(cmd) - - if RRHMachine != '': - logfile_compile_RRH = logdir_RRH + '/RRH_compile' + '_' + str(run) + '_.log' - logfile_exec_RRH = logdir_RRH + '/RRH_exec' + '_' + str(run) + '_.log' - logfile_pre_exec_RRH = logdir_RRH + '/RRH_pre_exec' + '_' + str(run) + '_.log' - logfile_task_RRH_compile_out = logdir_RRH + '/RRH_task_compile_out' + '_' + str(run) + '_.log' - logfile_task_RRH_compile = logdir_local_testcase + '/RRH_task_compile' + '_' + str(run) + '_.log' - logfile_task_RRH_out = logdir_RRH + '/RRH_task_out' + '_' + str(run) + '_.log' - logfile_task_RRH = logdir_local_testcase + '/RRH_task' + '_' + str(run) + '_.log' - task_RRH_compile = ' ( uname -a ; date \n' - task_RRH_compile = task_RRH_compile + 'cd ' + logdirOAI5GRepo + ' ; source oaienv ; source cmake_targets/tools/build_helper \n' - task_RRH_compile = task_RRH_compile + 'env |grep OPENAIR \n' - if RRH_compile_prog != "": - task_RRH_compile = task_RRH_compile + ' ( ' + RRH_compile_prog + ' '+ RRH_compile_prog_args + ' ) > ' + logfile_compile_RRH + ' 2>&1 \n' - task_RRH_compile = task_RRH_compile + ' date ) > ' + logfile_task_RRH_compile_out + ' 2>&1 ' - write_file(logfile_task_RRH_compile, task_RRH_compile, mode="w") - - task_RRH = ' ( uname -a ; date \n' - task_RRH = task_RRH + ' export OPENAIR_TESTDIR=' + logdir_RRH + '\n' - task_RRH = task_RRH + 'cd ' + logdirOAI5GRepo + ' ; source oaienv ; source cmake_targets/tools/build_helper \n' - task_RRH = task_RRH + 'env |grep OPENAIR \n' + 'array_exec_pid=() \n' - - if RRH_pre_exec != "": - task_RRH = task_RRH + ' ( date; ' + RRH_pre_exec + ' '+ RRH_pre_exec_args + ' ) > ' + logfile_pre_exec_RRH + ' 2>&1 \n' - if RRH_main_exec != "": - task_RRH = task_RRH + ' ( date; ' + addsudo(RRH_main_exec + ' ' + RRH_main_exec_args, mypassword) + ' ) > ' + logfile_exec_RRH + ' 2>&1 & \n' - task_RRH = task_RRH + 'array_exec_pid+=($!) \n' - task_RRH = task_RRH + 'echo eNB_main_exec PID = $! \n' - #terminate the eNB test case after timeout_cmd seconds - task_RRH = task_RRH + finalize_deploy_script (timeout_cmd, RRH_terminate_missing_procs) + ' \n' - task_RRH = task_RRH + 'handle_ctrl_c' + '\n' - task_RRH = task_RRH + ' ) > ' + logfile_task_RRH_out + ' 2>&1 ' - write_file(logfile_task_RRH, task_RRH, mode="w") - - logfile_compile_eNB = logdir_eNB + '/eNB_compile' + '_' + str(run) + '_.log' - logfile_exec_eNB = logdir_eNB + '/eNB_exec' + '_' + str(run) + '_.log' - logfile_pre_exec_eNB = logdir_eNB + '/eNB_pre_exec' + '_' + str(run) + '_.log' - logfile_traffic_eNB = logdir_eNB + '/eNB_traffic' + '_' + str(run) + '_.log' - logfile_task_eNB_compile_out = logdir_eNB + '/eNB_task_compile_out' + '_' + str(run) + '_.log' - logfile_task_eNB_compile = logdir_local_testcase + '/eNB_task_compile' + '_' + str(run) + '_.log' - logfile_task_eNB_out = logdir_eNB + '/eNB_task_out' + '_' + str(run) + '_.log' - logfile_task_eNB = logdir_local_testcase + '/eNB_task' + '_' + str(run) + '_.log' - logfile_local_traffic_eNB_out = logdir_local_testcase + '/eNB_traffic' + '_' + str(run) + '_.log' - logfile_tshark_eNB = logdir_eNB + '/eNB_tshark' + '_' + str(run) + '_.log' - logfile_pcap_eNB = logdir_eNB + '/eNB_tshark' + '_' + str(run) + '_.pcap' - logfile_pcap_zip_eNB = logdir_eNB + '/eNB_tshark' + '_' + str(run) + '_.pcap.zip' - logfile_pcap_tmp_eNB = '/tmp/' + '/eNB_tshark' + '_' + str(run) + '_.pcap' - - task_eNB_compile = ' ( uname -a ; date \n' - task_eNB_compile = task_eNB_compile + 'cd ' + logdirOAI5GRepo + ' ; source oaienv ; source cmake_targets/tools/build_helper \n' - task_eNB_compile = task_eNB_compile + 'env |grep OPENAIR \n' - task_eNB_compile = task_eNB_compile + update_config_file(oai_eNB, eNB_config_file, logdirOAI5GRepo, '$OPENAIR_DIR/cmake_targets/autotests/tools/search_repl.py') + '\n' - if eNB_compile_prog != "": - task_eNB_compile = task_eNB_compile + ' ( ' + eNB_compile_prog + ' '+ eNB_compile_prog_args + ' ) > ' + logfile_compile_eNB + ' 2>&1 \n' - task_eNB_compile = task_eNB_compile + ' date ) > ' + logfile_task_eNB_compile_out + ' 2>&1 ' - write_file(logfile_task_eNB_compile, task_eNB_compile, mode="w") - - task_eNB = ' ( uname -a ; date \n' - task_eNB = task_eNB + ' export OPENAIR_TESTDIR=' + logdir_eNB + '\n' - task_eNB = task_eNB + 'cd ' + logdirOAI5GRepo + ' ; source oaienv ; source cmake_targets/tools/build_helper \n' - task_eNB = task_eNB + 'env |grep OPENAIR \n' + 'array_exec_pid=() \n' - - if eNB_pre_exec != "": - task_eNB = task_eNB + ' ( date; ' + eNB_pre_exec + ' '+ eNB_pre_exec_args + ' ) > ' + logfile_pre_exec_eNB + ' 2>&1 \n' - if eNB_main_exec != "": - task_eNB = task_eNB + ' ( date; ' + addsudo(eNB_main_exec + ' ' + eNB_main_exec_args, mypassword) + ' ) > ' + logfile_exec_eNB + ' 2>&1 & \n' - task_eNB = task_eNB + 'array_exec_pid+=($!) \n' - task_eNB = task_eNB + 'echo eNB_main_exec PID = $! \n' - if eNB_traffic_exec != "": - cmd_traffic = eNB_traffic_exec + ' ' + eNB_traffic_exec_args - if cmd_traffic.find('-c') >= 0: - cmd_traffic = cmd_traffic + ' -t ' + str(timeout_cmd - 60) - task_eNB = task_eNB + ' (date; ' + cmd_traffic + ' ) > ' + logfile_traffic_eNB + ' 2>&1 & \n' - task_eNB = task_eNB + 'array_exec_pid+=($!) \n' - task_eNB = task_eNB + 'echo eNB_traffic_exec PID = $! \n' - - task_eNB = task_eNB + ' (date; sudo rm -f ' + logfile_pcap_tmp_eNB + ' ; sudo -E tshark -i lo -s 65535 -a duration:' + str(timeout_cmd-10)+ ' -w ' + logfile_pcap_tmp_eNB+ ' ; sudo -E chown ' + user + ' ' + logfile_pcap_tmp_eNB + ' ; zip -j -9 ' + logfile_pcap_zip_eNB + ' ' + logfile_pcap_tmp_eNB + ' ) > ' + logfile_tshark_eNB + ' 2>&1 & \n ' - task_eNB = task_eNB + 'array_exec_pid+=($!) \n' - task_eNB = task_eNB + 'echo eNB_tshark_exec PID = $! \n' - #terminate the eNB test case after timeout_cmd seconds - task_eNB = task_eNB + finalize_deploy_script (timeout_cmd, eNB_terminate_missing_procs) + ' \n' - #task_eNB = task_eNB + 'sleep ' + str(timeout_cmd) + ' \n' - task_eNB = task_eNB + 'handle_ctrl_c' + '\n' - task_eNB = task_eNB + ' ) > ' + logfile_task_eNB_out + ' 2>&1 ' - write_file(logfile_task_eNB, task_eNB, mode="w") - - #task_eNB = 'echo \" ' + task_eNB + '\" > ' + logfile_script_eNB + ' 2>&1 ; ' + task_eNB - logfile_compile_UE = logdir_UE + '/UE_compile' + '_' + str(run) + '_.log' - logfile_exec_UE = logdir_UE + '/UE_exec' + '_' + str(run) + '_.log' - logfile_pre_exec_UE = logdir_UE + '/UE_pre_exec' + '_' + str(run) + '_.log' - logfile_traffic_UE = logdir_UE + '/UE_traffic' + '_' + str(run) + '_.log' - logfile_task_UE_out = logdir_UE + '/UE_task_out' + '_' + str(run) + '_.log' - logfile_task_UE = logdir_local_testcase + '/UE_task' + '_' + str(run) + '_.log' - logfile_task_UE_compile_out = logdir_UE + '/UE_task_compile_out' + '_' + str(run) + '_.log' - logfile_task_UE_compile = logdir_local_testcase + '/UE_task_compile' + '_' + str(run) + '_.log' - logfile_local_traffic_UE_out = logdir_local_testcase + '/UE_traffic' + '_' + str(run) + '_.log' - - task_UE_compile = ' ( uname -a ; date \n' - task_UE_compile = task_UE_compile + 'array_exec_pid=()' + '\n' - task_UE_compile = task_UE_compile + 'cd ' + logdirOAI5GRepo + '\n' - task_UE_compile = task_UE_compile + 'source oaienv \n' - task_UE_compile = task_UE_compile + 'source cmake_targets/tools/build_helper \n' - task_UE_compile = task_UE_compile + 'env |grep OPENAIR \n' - task_UE_compile = task_UE_compile + update_config_file(oai_UE, UE_config_file, logdirOAI5GRepo, '$OPENAIR_DIR/cmake_targets/autotests/tools/search_repl.py') + '\n' - if UE_compile_prog != "": - task_UE_compile = task_UE_compile + ' ( ' + UE_compile_prog + ' '+ UE_compile_prog_args + ' ) > ' + logfile_compile_UE + ' 2>&1 \n' - task_UE_compile = task_UE_compile + ' ) > ' + logfile_task_UE_compile_out + ' 2>&1 ' - write_file(logfile_task_UE_compile, task_UE_compile, mode="w") - - task_UE = ' ( uname -a ; date \n' - task_UE = task_UE + 'array_exec_pid=()' + '\n' - task_UE = task_UE + 'cd ' + logdirOAI5GRepo + '\n' - task_UE = task_UE + 'source oaienv \n' - task_UE = task_UE + 'source cmake_targets/tools/build_helper \n' - task_UE = task_UE + 'env |grep OPENAIR \n' - if UE_pre_exec != "": - task_UE = task_UE + ' ( date; ' + UE_pre_exec + ' '+ UE_pre_exec_args + ' ) > ' + logfile_pre_exec_UE + ' 2>&1 \n' - if UE_main_exec != "": - task_UE = task_UE + ' ( date; ' + addsudo(UE_main_exec + ' ' + UE_main_exec_args, mypassword) + ' ) > ' + logfile_exec_UE + ' 2>&1 & \n' - task_UE = task_UE + 'array_exec_pid+=($!) \n' - task_UE = task_UE + 'echo UE_main_exec PID = $! \n' - if UE_traffic_exec != "": - cmd_traffic = UE_traffic_exec + ' ' + UE_traffic_exec_args - if cmd_traffic.find('-c') >= 0: - cmd_traffic = cmd_traffic + ' -t ' + str(timeout_cmd - 60) - task_UE = task_UE + ' ( date; ' + cmd_traffic + ' ) >' + logfile_traffic_UE + ' 2>&1 & \n' - task_UE = task_UE + 'array_exec_pid+=($!) \n' - task_UE = task_UE + 'echo UE_traffic_exec PID = $! \n' - #terminate the UE test case after timeout_cmd seconds - task_UE = task_UE + finalize_deploy_script (timeout_cmd, UE_terminate_missing_procs) + ' \n' - #task_UE = task_UE + 'sleep ' + str(timeout_cmd) + ' \n' - task_UE = task_UE + 'handle_ctrl_c' + '\n' - task_UE = task_UE + ' ) > ' + logfile_task_UE_out + ' 2>&1 ' - write_file(logfile_task_UE, task_UE, mode="w") - #task_UE = 'echo \" ' + task_UE + '\" > ' + logfile_script_UE + ' 2>&1 ; ' + task_UE - - logfile_compile_EPC = logdir_EPC + '/EPC_compile' + '_' + str(run) + '_.log' - logfile_compile_HSS = logdir_EPC + '/HSS_compile' + '_' + str(run) + '_.log' - logfile_exec_EPC = logdir_EPC + '/EPC_exec' + '_' + str(run) + '_.log' - logfile_pre_exec_EPC = logdir_EPC + '/EPC_pre_exec' + '_' + str(run) + '_.log' - logfile_exec_HSS = logdir_EPC + '/HSS_exec' + '_' + str(run) + '_.log' - logfile_traffic_EPC = logdir_EPC + '/EPC_traffic' + '_' + str(run) + '_.log' - logfile_task_EPC_out = logdir_EPC + '/EPC_task_out' + '_' + str(run) + '_.log' - logfile_task_EPC = logdir_local_testcase + '/EPC_task' + '_' + str(run) + '_.log' - logfile_task_EPC_compile_out = logdir_EPC + '/EPC_task_compile_out' + '_' + str(run) + '_.log' - logfile_task_EPC_compile = logdir_local_testcase + '/EPC_task_compile' + '_' + str(run) + '_.log' - logfile_local_traffic_EPC_out = logdir_local_testcase + '/EPC_traffic' + '_' + str(run) + '_.log' - - task_EPC_compile = ' ( uname -a ; date \n' - task_EPC_compile = task_EPC_compile + 'array_exec_pid=()' + '\n' - task_EPC_compile = task_EPC_compile + 'cd ' + logdirOpenaircnRepo + ' ; source oaienv \n' - task_EPC_compile = task_EPC_compile + update_config_file(oai_EPC, EPC_config_file, logdirOpenaircnRepo, logdirOpenaircnRepo+'/TEST/autotests/tools/search_repl.py') + '\n' - task_EPC_compile = task_EPC_compile + 'source BUILD/TOOLS/build_helper \n' - if EPC_compile_prog != "": - task_EPC_compile = task_EPC_compile + '(' + EPC_compile_prog + ' ' + EPC_compile_prog_args + ' ) > ' + logfile_compile_EPC + ' 2>&1 \n' - if HSS_compile_prog != "": - task_EPC_compile = task_EPC_compile + '(' + HSS_compile_prog + ' ' + HSS_compile_prog_args + ' ) > ' + logfile_compile_HSS + ' 2>&1 \n' - task_EPC_compile = task_EPC_compile + ' ) > ' + logfile_task_EPC_compile_out + ' 2>&1 ' - write_file(logfile_task_EPC_compile, task_EPC_compile, mode="w") - - task_EPC = ' ( uname -a ; date \n' - task_EPC = task_EPC + ' export OPENAIRCN_TESTDIR=' + logdir_EPC + '\n' - task_EPC = task_EPC + 'array_exec_pid=()' + '\n' - task_EPC = task_EPC + 'cd ' + logdirOpenaircnRepo + '; source oaienv\n' - task_EPC = task_EPC + 'source BUILD/TOOLS/build_helper \n' - if EPC_pre_exec != "": - task_EPC = task_EPC + ' ( date; ' + EPC_pre_exec + ' '+ EPC_pre_exec_args + ' ) > ' + logfile_pre_exec_EPC + ' 2>&1 \n' - if HSS_main_exec != "": - task_EPC = task_EPC + '( date; ' + addsudo (HSS_main_exec + ' ' + HSS_main_exec_args, mypassword) + ' ) > ' + logfile_exec_HSS + ' 2>&1 & \n' - task_EPC = task_EPC + 'array_exec_pid+=($!) \n' - task_EPC = task_EPC + 'echo HSS_main_exec PID = $! \n' - if EPC_main_exec != "": - task_EPC = task_EPC + '( date; ' + addsudo (EPC_main_exec + ' ' + EPC_main_exec_args, mypassword) + ' ) > ' + logfile_exec_EPC + ' 2>&1 & \n' - task_EPC = task_EPC + 'array_exec_pid+=($!) \n' - task_EPC = task_EPC + 'echo EPC_main_exec PID = $! \n' - if EPC_traffic_exec != "": - cmd_traffic = EPC_traffic_exec + ' ' + EPC_traffic_exec_args - if cmd_traffic.find('-c') >= 0: - cmd_traffic = cmd_traffic + ' -t ' + str(timeout_cmd - 60) - task_EPC = task_EPC + '( date; ' + cmd_traffic + ' ) > ' + logfile_traffic_EPC + ' 2>&1 & \n' - task_EPC = task_EPC + 'array_exec_pid+=($!) \n' - task_EPC = task_EPC + 'echo EPC_traffic_exec PID = $! \n' - #terminate the EPC test case after timeout_cmd seconds - task_EPC = task_EPC + finalize_deploy_script (timeout_cmd, EPC_terminate_missing_procs) + '\n' - #task_EPC = task_EPC + 'sleep ' + str(timeout_cmd) + '\n' - task_EPC = task_EPC + 'handle_ctrl_c' '\n' - task_EPC = task_EPC + ' ) > ' + logfile_task_EPC_out + ' 2>&1 ' - write_file(logfile_task_EPC, task_EPC, mode="w") - - #first we compile all the programs but only for run_0 - if run == 0: - thread_EPC = oaiThread(1, "EPC_thread", EPCMachine, user, password , task_EPC_compile, False, timeout_thread) - thread_eNB = oaiThread(2, "eNB_thread", eNBMachine, user, password , task_eNB_compile, False, timeout_thread) - thread_UE = oaiThread(3, "UE_thread", UEMachine, user, password , task_UE_compile, False, timeout_thread) - if RRHMachine != '': - thread_RRH = oaiThread(4, "RRH_thread", RRHMachine, user, password , task_RRH_compile, False, timeout_thread) - threads=[] - threads.append(thread_eNB) - threads.append(thread_UE) - threads.append(thread_EPC) - if RRHMachine != '': - threads.append(thread_RRH) - # Start new Threads - thread_eNB.start() - thread_UE.start() - thread_EPC.start() - if RRHMachine != '': - thread_RRH.start() - #Wait for all the compile threads to complete - for t in threads: - t.join() - - #Now we execute all the threads - thread_EPC = oaiThread(1, "EPC_thread", EPCMachine, user, password , task_EPC, False, timeout_thread) - thread_eNB = oaiThread(2, "eNB_thread", eNBMachine, user, password , task_eNB, False, timeout_thread) - thread_UE = oaiThread(3, "UE_thread", UEMachine, user, password , task_UE, False, timeout_thread) - if RRHMachine != '': - thread_RRH = oaiThread(4, "RRH_thread", RRHMachine, user, password , task_RRH, False, timeout_thread) - threads=[] - threads.append(thread_eNB) - threads.append(thread_UE) - threads.append(thread_EPC) - if RRHMachine != '': - threads.append(thread_RRH) - # Start new Threads - - thread_eNB.start() - thread_UE.start() - thread_EPC.start() - if RRHMachine != '': - thread_RRH.start() - #Wait for all the compile threads to complete - for t in threads: - t.join() - #Now we get the log files from remote machines on the local machine - if RRHMachine != '': - cleanOldProgramsAllMachines([oai_eNB, oai_UE, oai_EPC, oai_RRH] , oldprogramList, CleanUpAluLteBox, ExmimoRfStop, [logdir_eNB, logdir_UE, logdir_EPC, logdir_RRH], logdirOAI5GRepo) - else: - cleanOldProgramsAllMachines([oai_eNB, oai_UE, oai_EPC] , oldprogramList, CleanUpAluLteBox, ExmimoRfStop, [logdir_eNB, logdir_UE, logdir_EPC], logdirOAI5GRepo) - logfile_UE_stop_script_out = logdir_UE + '/UE_stop_script_out' + '_' + str(run) + '_.log' - logfile_UE_stop_script = logdir_local_testcase + '/UE_stop_script' + '_' + str(run) + '_.log' - - if UE_stop_script != "": - cmd = ' ( uname -a ; date \n' - cmd = cmd + 'cd ' + logdirOAI5GRepo + ' ; source oaienv ; source cmake_targets/tools/build_helper \n' - cmd = cmd + 'env |grep OPENAIR \n' + 'array_exec_pid=() \n' - cmd = cmd + UE_stop_script + '\n' - cmd = cmd + ') > ' + logfile_UE_stop_script_out + ' 2>&1 ' - write_file(logfile_UE_stop_script , cmd, mode="w") - thread_UE = oaiThread(4, "UE_thread", UEMachine, user, password , cmd, False, timeout_thread) - thread_UE.start() - thread_UE.join() - - #Now we change the permissions of the logfiles to avoid some of them being with root permissions - cmd = 'sudo -E chown -R ' + user + ' ' + logdir_eNB - res= oai_eNB.send_recv(cmd) - print "Changing permissions of logdir <" + logdir_eNB + "> in eNB machine..." + res - - cmd = 'sudo -E chown -R ' + user + ' ' + logdir_UE - res= oai_UE.send_recv(cmd) - print "Changing permissions of logdir <" + logdir_UE + "> in UE machine..." + res - - cmd = 'sudo -E chown -R ' + user + ' ' + logdir_EPC - res= oai_EPC.send_recv(cmd) - print "Changing permissions of logdir <" + logdir_EPC + "> in EPC machine..." + res - - if RRHMachine != '': - cmd = 'sudo -E chown -R ' + user + ' ' + logdir_RRH - res= oai_RRH.send_recv(cmd) - print "Changing permissions of logdir <" + logdir_RRH + "> in RRH machine..." + res - - print "Copying files from EPCMachine : " + EPCMachine + "logdir_EPC = " + logdir_EPC - SSHSessionWrapper(EPCMachine, user, None, password, logdir_EPC, logdir_local + '/cmake_targets/autotests/log/'+ testcasename, "get_all") - - print "Copying files from eNBMachine " + eNBMachine + "logdir_eNB = " + logdir_eNB - SSHSessionWrapper(eNBMachine, user, None, password, logdir_eNB, logdir_local + '/cmake_targets/autotests/log/'+ testcasename, "get_all") - - print "Copying files from UEMachine : " + UEMachine + "logdir_UE = " + logdir_UE - SSHSessionWrapper(UEMachine, user, None, password, logdir_UE, logdir_local + '/cmake_targets/autotests/log/'+ testcasename, "get_all") - - if RRHMachine != '': - print "Copying files from RRHMachine : " + RRHMachine + "logdir_RRH = " + logdir_RRH - SSHSessionWrapper(RRHMachine, user, None, password, logdir_RRH, logdir_local + '/cmake_targets/autotests/log/'+ testcasename, "get_all") - - - #Currently we only perform throughput tests - tput_run_string='' - result, tput_string = tput_test_search_expr(eNB_search_expr_true, logfile_local_traffic_eNB_out) - tput_run_string = tput_run_string + tput_string - run_result=run_result&result - result, tput_string = tput_test_search_expr(EPC_search_expr_true, logfile_local_traffic_EPC_out) - run_result=run_result&result - tput_run_string = tput_run_string + tput_string - result, tput_string = tput_test_search_expr(UE_search_expr_true, logfile_local_traffic_UE_out) - run_result=run_result&result - tput_run_string = tput_run_string + tput_string - - if run_result == 1: - run_result_string = ' RUN_'+str(run) + ' = PASS' - else: - run_result_string = ' RUN_'+str(run) + ' = FAIL' - - #If there is assertion, we mark the test case as failure as most likely eNB crashed - cmd = "grep -ilr \"assertion\" " + logdir_local_testcase + " | cat " - cmd_out = subprocess.check_output ([cmd], shell=True) - if len(cmd_out) !=0 : - run_result=0 - run_result_string = ' RUN_'+str(run) + ' = FAIL(Assert)' - - #If there is thread busy error, we mark the test case as failure as most likely eNB crashed - cmd = "grep -ilr \"thread busy\" " + logdir_local_testcase + " | cat " - cmd_out = subprocess.check_output ([cmd], shell=True) - if len(cmd_out) !=0: - run_result=0 - run_result_string = ' RUN_'+str(run) + ' = FAIL(Thread_Busy)' - - #If there is Segmentation fault, we mark the test case as failure as most likely eNB crashed - cmd = "grep -ilr \"segmentation fault\" " + logdir_local_testcase + " | cat " - cmd_out = subprocess.check_output ([cmd], shell=True) - if len(cmd_out) !=0: - run_result=0 - run_result_string = ' RUN_'+str(run) + ' = FAIL(SEGFAULT)' - - run_result_string = run_result_string + tput_run_string - - test_result=test_result & run_result - test_result_string=test_result_string + run_result_string - - oai_eNB.disconnect() - oai_UE.disconnect() - oai_EPC.disconnect() - #We need to close the new ssh session that was created - #if index_eNBMachine == index_EPCMachine: - # oai_EPC.disconnect() - #Now we finalize the xml file of the test case - end_time=time.time() - duration= end_time - start_time - xmlFile = logdir_local + '/cmake_targets/autotests/log/'+ testcasename + '/test.' + testcasename + '.xml' - if test_result ==0: - result='FAIL' - else: - result = 'PASS' - xml="\n \n" - write_file(xmlFile, xml, mode="w") - - - - -# \brief handler for executing test cases (lte-softmodem-noS1) -# \param testcase name of testcase -# \param oldprogramList list of programs which must be terminated before running a test case -# \param logdirOAI5GRepo directory on remote machine which has openairinterface5g repo installed -# \param logdirOpenaircnRepo directory on remote machine which has openair-cn repo installed -# \param MachineList list of all machines on which test cases can be run -# \param user username with which to login -# \param password password with which to login -# \param CleanupAluLteBox string that contains commands to stop ALU Bell Labs LTEBox (specified in test_case_list.xml) -# \param ExmimoRfStop command to stop EXMIMO Card -# \param nruns_lte-softmodem global parameter to override number of runs (nruns) within the test case -def handle_testcaseclass_softmodem_noS1 (testcase, oldprogramList, logdirOAI5GRepo , logdirOpenaircnRepo, MachineList, user, password, CleanUpAluLteBox, ExmimoRfStop, nruns_lte_softmodem, timeout_cmd): - #We ignore the password sent to this function for secuirity reasons for password present in log files - #It is recommended to add a line in /etc/sudoers that looks something like below. The line below will run sudo without password prompt - # your_user_name ALL=(ALL:ALL) NOPASSWD: ALL - - indent="\t" - threads=[] - - # - # Test case parameters - # ----------------------------------------------------------------------------- - testcase_verdict = 'PASS' - testcase_time_start = datetime.datetime.now() - testcase_name = testcase.get('id') - testcase_class = testcase.findtext('class',default='') - testcase_desc = testcase.findtext('desc',default='') - if timeout_cmd == '': - timeout_cmd = testcase.findtext('TimeOut_cmd',default='') - timeout_cmd = int(float(timeout_cmd)) - timeout_thread = timeout_cmd + 60 #Timeout_thread is more than that of cmd to have room for compilation time, etc - if nruns_lte_softmodem == '': - nruns = testcase.findtext('nruns',default='') - else: - nruns = nruns_lte_softmodem - nruns = int(float(nruns)) - tags = testcase.findtext('tags',default='') - - max_ntries = testcase.findtext('max_ntries',default='') - if max_ntries : - max_ntries = int(float(max_ntries)) - else : - max_ntries = nruns - - print( indent + "> testcase time start : " + str(testcase_time_start) ) - print( indent + "> testcase class : " + testcase_class ) - print( indent + "> testcase description : " + testcase_desc ) - print( indent + "> testcase timeout : " + str(timeout_cmd) ) - print( indent + "> testcase thread timeout : " + str(timeout_thread) ) - print( indent + "> number of runs : " + str(nruns) ) - print( indent + "> number of max tries : " + str(max_ntries) ) - print( indent + "> testcase tags : " + tags ) - - logdir_local_testcase = openairdir_local + '/cmake_targets/autotests/log/'+ testcasename - logdir_eNB_testcase = logdirOAI5GRepo +'/cmake_targets/autotests/log/'+ testcasename - logdir_UE_testcase = logdirOAI5GRepo +'/cmake_targets/autotests/log/'+ testcasename - - # - # Local checks for test cases - # ----------------------------------------------- - - # Logging directory - if (not os.path.exists(logdir_local_testcase)): - os.system('mkdir -p ' + logdir_local_testcase) - - # - # REMOTE MACHINE COMPILATION - # ------------------------------------------------ - - eNBMachine = testcase.findtext('eNB',default='') - eNB_config_file = testcase.findtext('eNB_config_file',default='') - eNB_compile_prog = testcase.findtext('eNB_compile_prog',default='') - eNB_compile_prog_args = testcase.findtext('eNB_compile_prog_args',default='') - - logfile_compile_eNB = logdir_eNB_testcase + '/eNB_compile.log' - logfile_task_eNB_compile_out = logdir_eNB_testcase + '/eNB_task_compile_out.log' - logfile_task_eNB_compile = logdir_local_testcase + '/eNB_task_compile.log' - - # Check that machine is in test setup machine list - print( Fore.WHITE + indent + "> testcase eNB machine :"), - if (eNBMachine not in MachineList): - print( Fore.RED + eNBMachine + " not in test setup machine list") - testcase_verdict = 'INCON' - else : - print eNBMachine, - # get machine description - eNBMachineDesc = MachineDescDic[eNBMachine] - index_eNBMachine = MachineList.index(eNBMachine) - # check that openairinterface is installed on machine - oai_eNB = openair('localdomain', eNBMachine) - oai_eNB.connect(user, password) - cmd = 'cd ' + logdirOAI5GRepo + '; source oaienv ; env|grep --color=never OPENAIR' - res= oai_eNB.send_recv(cmd) - m = re.search('OPENAIR_HOME', res, re.DOTALL) - if m: - print - # Create testcase directory on remote eNB - cmd = 'rm -fr ' + logdir_eNB_testcase + ' ; mkdir -p ' + logdir_eNB_testcase - result = oai_eNB.send_recv(cmd) - - # Check if we need to compile lte-softmodem-noS1 on remote machine - eNB_compile_cmd = eNB_compile_prog + ' '+ eNB_compile_prog_args - if ('last_compile_prog' in eNBMachineDesc) and eNBMachineDesc['last_compile_prog'] == eNB_compile_cmd: - print( Fore.WHITE + indent + "> eNB machine compilation : skipped -> "+eNB_compile_cmd ) - else: - print( Fore.WHITE + indent + "> eNB machine compilation : triggered -> "+eNB_compile_cmd ) - eNBMachineDesc['last_compile_prog'] = eNB_compile_prog + ' '+ eNB_compile_prog_args # if last compilation is the same do not compile again - task_eNB_compile = ' ( uname -a ; date \n' - task_eNB_compile = task_eNB_compile + 'cd ' + logdirOAI5GRepo + ' ; source oaienv ; source cmake_targets/tools/build_helper \n' - task_eNB_compile = task_eNB_compile + 'env |grep OPENAIR \n' - task_eNB_compile = task_eNB_compile + update_config_file(oai_eNB, eNB_config_file, logdirOAI5GRepo, '$OPENAIR_DIR/cmake_targets/autotests/tools/search_repl.py') + '\n' - if eNB_compile_cmd != "": - task_eNB_compile = task_eNB_compile + ' ( ' + eNB_compile_cmd + ' ) > ' + logfile_compile_eNB + ' 2>&1 \n' - task_eNB_compile = task_eNB_compile + ' date ) > ' + logfile_task_eNB_compile_out + ' 2>&1 ' - write_file(logfile_task_eNB_compile, task_eNB_compile, mode="w") - - - thread_eNB = oaiThread(1, "eNB_thread_compile", eNBMachine, user, password , task_eNB_compile, False, timeout_thread) - threads.append(thread_eNB) - thread_eNB.start() - - else: - print( Fore.RED + " -> OAI5G not properly setup ! please check REMOTE MACHINE PREPARATION step") - testcase_verdict = 'INCON' - - - UEMachine = testcase.findtext('UE',default='') - UE_config_file = testcase.findtext('UE_config_file',default='') - UE_compile_prog = testcase.findtext('UE_compile_prog',default='') - UE_compile_prog_args = testcase.findtext('UE_compile_prog_args',default='') - - logfile_compile_UE = logdir_UE_testcase + '/UE_compile.log' - logfile_task_UE_compile_out = logdir_UE_testcase + '/UE_task_compile_out.log' - logfile_task_UE_compile = logdir_local_testcase + '/UE_task_compile.log' - - # Check that machine is in test setup machine list - print( Fore.WHITE + indent + "> testcase UE machine :"), - if (UEMachine not in MachineList): - print( Fore.RED + UEMachine + " not in test setup machine list") - testcase_verdict = 'INCON' - else : - print UEMachine, - # get machine description - UEMachineDesc = MachineDescDic[UEMachine] - index_UEMachine = MachineList.index(UEMachine) - # check that openairinterface is installed on machine - oai_UE = openair('localdomain', UEMachine) - oai_UE.connect(user, password) - cmd = 'cd ' + logdirOAI5GRepo + '; source oaienv ; env|grep --color=never OPENAIR' - res= oai_UE.send_recv(cmd) - m = re.search('OPENAIR_HOME', res, re.DOTALL) - if m: - print - # Create testcase directory on remote UE - cmd = 'rm -fr ' + logdir_UE_testcase + ' ; mkdir -p ' + logdir_UE_testcase - result = oai_UE.send_recv(cmd) - - # Check if we need to compile lte-softmodem-noS1 on remote machine - UE_compile_cmd = UE_compile_prog + ' '+ UE_compile_prog_args - if ('last_compile_prog' in UEMachineDesc) and UEMachineDesc['last_compile_prog'] == UE_compile_cmd: - print( Fore.WHITE + indent + "> UE machine compilation : skipped -> "+UE_compile_cmd ) - else: - print( Fore.WHITE + indent + "> UE machine compilation : triggered -> "+UE_compile_cmd ) - UEMachineDesc['last_compile_prog'] = UE_compile_prog + ' '+ UE_compile_prog_args - task_UE_compile = ' ( uname -a ; date \n' - task_UE_compile = task_UE_compile + 'cd ' + logdirOAI5GRepo + ' ; source oaienv ; source cmake_targets/tools/build_helper \n' - task_UE_compile = task_UE_compile + 'env |grep OPENAIR \n' - task_UE_compile = task_UE_compile + update_config_file(oai_UE, UE_config_file, logdirOAI5GRepo, '$OPENAIR_DIR/cmake_targets/autotests/tools/search_repl.py') + '\n' - if UE_compile_cmd != "": - task_UE_compile = task_UE_compile + ' ( ' + UE_compile_cmd + ' ) > ' + logfile_compile_UE + ' 2>&1 \n' - task_UE_compile = task_UE_compile + ' date ) > ' + logfile_task_UE_compile_out + ' 2>&1 ' - write_file(logfile_task_UE_compile, task_UE_compile, mode="w") - - thread_UE = oaiThread(2, "UE_thread_compile", UEMachine, user, password , task_UE_compile, False, timeout_thread) - threads.append(thread_UE) - thread_UE.start() - - else: - print( Fore.RED + " -> OAI5G not properly setup ! please check REMOTE MACHINE PREPARATION step") - testcase_verdict = 'INCON' - - - - - - - # Wait for Compilation thread to terminate - #----------------------------------------- - for t in threads: - t.join() - - # TODO check that compilation is succeed - - #first we compile all the programs -# thread_UE = oaiThread(3, "UE_thread", UEMachine, user, password , task_UE_compile, False, timeout_thread) -# threads.append(thread_UE) -# thread_UE.start() - - - - - -# index_UEMachine = MachineList.index(UEMachine) -# oai_UE = openair('localdomain', UEMachine) -# oai_UE.connect(user, password) -# res = oai_UE.send_recv(cmd) -# res = oai_eNB.send_recv(cmd) - - - - # - # RUN LOOP - # ------------------------------------------------ - if testcase_verdict != 'PASS': # if something went wrong to not run test cases - max_ntries=0 - - indent="\t\t" - - runs_results = [] - nb_runs = 0 - nb_run_pass = 0 - nb_run_failed = 0 - nb_run_inc = 0 - nb_run_skip = 0 - - nb_seg_fault = 0 - - for run in range(0,max_ntries): - - if nruns == nb_run_pass + nb_run_failed: - break - - nb_runs += 1 - - # - # RUN initialization - # ---------------------------------------------------- - - prefix_string = Fore.WHITE + indent + "> RUN_"+str(run).zfill(2)+" :" - -# print (Fore.WHITE + indent + "> RUN_"+str(run).zfill(2)+" : " ), -# sys.stdout.flush() - - run_start_time=datetime.datetime.now() - - logdir_local_run = openairdir_local + '/cmake_targets/autotests/log/'+ testcasename + '/run_' + str(run) - logdir_eNB_run = logdirOAI5GRepo +'/cmake_targets/autotests/log/' + testcasename + '/run_' + str(run) - logdir_UE_run = logdirOAI5GRepo +'/cmake_targets/autotests/log/' + testcasename + '/run_' + str(run) - - cmd = 'rm -fr ' + logdir_eNB_run + ' ; mkdir -p ' + logdir_eNB_run - result = oai_eNB.send_recv(cmd) - cmd = 'rm -fr ' + logdir_UE_run + ' ; mkdir -p ' + logdir_UE_run - result = oai_UE.send_recv(cmd) - cmd = ' rm -fr ' + logdir_local_run + ' ; mkdir -p ' + logdir_local_run - result = os.system(cmd) - - - # - # RUN parametrization - # ---------------------------------------------------- - eNB_pre_exec = testcase.findtext('eNB_pre_exec',default='') - eNB_pre_exec_args = testcase.findtext('eNB_pre_exec_args',default='') - eNB_main_exec = testcase.findtext('eNB_main_exec',default='') - eNB_main_exec_args = testcase.findtext('eNB_main_exec_args',default='') - eNB_traffic_exec = testcase.findtext('eNB_traffic_exec',default='') - eNB_traffic_exec_args = testcase.findtext('eNB_traffic_exec_args',default='') - eNB_terminate_missing_procs = testcase.findtext('eNB_terminate_missing_procs',default='True') - - logfile_exec_eNB = logdir_eNB_run + '/eNB_exec' + '_' + str(run) + '_.log' - logfile_pre_exec_eNB = logdir_eNB_run + '/eNB_pre_exec' + '_' + str(run) + '_.log' - logfile_task_eNB_out = logdir_eNB_run + '/eNB_task_out' + '_' + str(run) + '_.log' - logfile_traffic_eNB = logdir_eNB_run + '/eNB_traffic' + '_' + str(run) + '_.log' - logfile_task_eNB = logdir_local_run + '/eNB_task' + '_' + str(run) + '_.log' - - task_eNB = ' ( uname -a ; date \n' - task_eNB = task_eNB + 'cd ' + logdirOAI5GRepo + ' ; source oaienv ; source cmake_targets/tools/build_helper \n' - task_eNB = task_eNB + 'env |grep OPENAIR \n' + 'array_exec_pid=() \n' - if eNB_pre_exec != "": - task_eNB = task_eNB + ' ( date; ' + eNB_pre_exec + ' '+ eNB_pre_exec_args + ' ) > ' + logfile_pre_exec_eNB + ' 2>&1 \n' - if eNB_main_exec != "": - task_eNB = task_eNB + ' ( date; ' + addsudo(eNB_main_exec + ' ' + eNB_main_exec_args, '') + ' ) > ' + logfile_exec_eNB + ' 2>&1 & \n' - task_eNB = task_eNB + 'array_exec_pid+=($!) \n' - task_eNB = task_eNB + 'echo eNB_main_exec PID = $! \n' - if eNB_traffic_exec != "": - cmd_traffic = eNB_traffic_exec + ' ' + eNB_traffic_exec_args - if cmd_traffic.find('-c') >= 0: - cmd_traffic = cmd_traffic + ' -t ' + str(timeout_cmd - 80) - task_eNB = task_eNB + ' (date; ' + cmd_traffic + ' ) > ' + logfile_traffic_eNB + ' 2>&1 & \n' - task_eNB = task_eNB + 'array_exec_pid+=($!) \n' - task_eNB = task_eNB + 'echo eNB_traffic_exec PID = $! \n' - #terminate the eNB test case after timeout_cmd seconds - task_eNB = task_eNB + finalize_deploy_script (timeout_cmd, eNB_terminate_missing_procs) + ' \n' - #task_eNB = task_eNB + 'sleep ' + str(timeout_cmd) + ' \n' - task_eNB = task_eNB + 'handle_ctrl_c' + '\n' - task_eNB = task_eNB + ' ) > ' + logfile_task_eNB_out + ' 2>&1 ' - write_file(logfile_task_eNB, task_eNB, mode="w") - - - UE_pre_exec = testcase.findtext('UE_pre_exec',default='') - UE_pre_exec_args = testcase.findtext('UE_pre_exec_args',default='') - UE_main_exec = testcase.findtext('UE_main_exec',default='') - UE_main_exec_args = testcase.findtext('UE_main_exec_args',default='') - UE_traffic_exec = testcase.findtext('UE_traffic_exec',default='') - UE_traffic_exec_args = testcase.findtext('UE_traffic_exec_args',default='') - UE_terminate_missing_procs = testcase.findtext('UE_terminate_missing_procs',default='True') - UE_search_expr_true = testcase.findtext('UE_search_expr_true','') - - logfile_exec_UE = logdir_UE_run + '/UE_exec' + '_' + str(run) + '_.log' - logfile_pre_exec_UE = logdir_UE_run + '/UE_pre_exec' + '_' + str(run) + '_.log' - logfile_task_UE_out = logdir_UE_run + '/UE_task_out' + '_' + str(run) + '_.log' - logfile_traffic_UE = logdir_UE_run + '/UE_traffic' + '_' + str(run) + '_.log' - logfile_task_UE = logdir_local_run + '/UE_task' + '_' + str(run) + '_.log' - - - task_UE = ' ( uname -a ; date \n' - task_UE = task_UE + 'array_exec_pid=()' + '\n' - task_UE = task_UE + 'cd ' + logdirOAI5GRepo + '\n' - task_UE = task_UE + 'source oaienv \n' - task_UE = task_UE + 'source cmake_targets/tools/build_helper \n' - task_UE = task_UE + 'env |grep OPENAIR \n' - if UE_pre_exec != "": - task_UE = task_UE + ' ( date; ' + UE_pre_exec + ' '+ UE_pre_exec_args + ' ) > ' + logfile_pre_exec_UE + ' 2>&1 \n' - if UE_main_exec != "": - task_UE = task_UE + ' ( date; ' + addsudo(UE_main_exec + ' ' + UE_main_exec_args, '') + ' ) > ' + logfile_exec_UE + ' 2>&1 & \n' - task_UE = task_UE + 'array_exec_pid+=($!) \n' - task_UE = task_UE + 'echo UE_main_exec PID = $! \n' - if UE_traffic_exec != "": - cmd_traffic = UE_traffic_exec + ' ' + UE_traffic_exec_args - if cmd_traffic.find('-c') >= 0: - cmd_traffic = cmd_traffic + ' -t ' + str(timeout_cmd - 60) - task_UE = task_UE + ' ( date; ' + cmd_traffic + ' ) >' + logfile_traffic_UE + ' 2>&1 & \n' - task_UE = task_UE + 'array_exec_pid+=($!) \n' - task_UE = task_UE + 'echo UE_traffic_exec PID = $! \n' - #terminate the UE test case after timeout_cmd seconds - task_UE = task_UE + finalize_deploy_script (timeout_cmd, UE_terminate_missing_procs) + ' \n' - #task_UE = task_UE + 'sleep ' + str(timeout_cmd) + ' \n' - task_UE = task_UE + 'handle_ctrl_c' + '\n' - task_UE = task_UE + ' ) > ' + logfile_task_UE_out + ' 2>&1 ' - write_file(logfile_task_UE, task_UE, mode="w") - #task_UE = 'echo \" ' + task_UE + '\" > ' + logfile_script_UE + ' 2>&1 ; ' + task_UE - - - - - - - - # - # RUN work - # ---------------------------------------------------- - thread_eNB = oaiThread(1, "eNB_thread", eNBMachine, user, password , task_eNB, False, timeout_thread) - thread_UE = oaiThread(2, "UE_thread", UEMachine, user, password , task_UE, False, timeout_thread) - threads=[] - threads.append(thread_eNB) - threads.append(thread_UE) - thread_eNB.start() - thread_UE.start() - - run_work_inprogress_flag = True - progress_step = timeout_thread/20 - progress_count = 0 - - while (run_work_inprogress_flag): - - - update_progress(float(progress_count)/float(timeout_thread),prefix_string) - - time.sleep(progress_step) - - progress_count += progress_step - -# sys.stdout.write ('#') -# sys.stdout.flush() - - run_work_inprogress_flag = False - for t in threads: - if t.isAlive(): - run_work_inprogress_flag = True - - - update_progress(1,prefix_string) - - for t in threads: - t.join() - - - # - # - #----------------------------------------------------- - cleanOldProgramsAllMachines([oai_eNB, oai_UE] , oldprogramList, CleanUpAluLteBox, ExmimoRfStop, [logdir_eNB_run, logdir_UE_run], logdirOAI5GRepo) - - SSHSessionWrapper(eNBMachine, user, None, password, logdir_eNB_run, logdir_local_testcase, "get_all") - #print "Copying files from UEMachine : " + UEMachine + "logdir_UE = " + logdir_UE - SSHSessionWrapper(UEMachine, user, None, password, logdir_UE_run, logdir_local_testcase, "get_all") - - metric_checks_flag = 1 - - fname = logdir_local_run+ '/UE_exec' + '_' + str(run) + '_.log' - cell_synch_status = analyser.check_cell_synchro(fname) - print (Fore.WHITE + indent + "> Check Cell synchro :"), - - if cell_synch_status == 'CELL_SYNCH': - print ( Fore.GREEN + cell_synch_status) - else : - print ( Fore.RED + cell_synch_status) - metric_checks_flag = 0 - - ue_seg_fault_status = analyser.check_exec_seg_fault(fname) - if ue_seg_fault_status == 'SEG_FAULT' : - nb_seg_fault += 1 - - # - # Check metrics - #---------------------------------------------------- - runs_metrics = [] - run_traffic = [] - - if metric_checks_flag : - verdict = 'PASS' - - # UE side metrics - metricList=testcase.findall('UE_metric') - for metric in metricList: - - metric_verdict = 'PASS' - - metric_def = {} - metric_def['id'] = metric.get('id') - metric_def['description'] = metric.get('description') - metric_def['regex'] = metric.get('regex') - metric_def['unit_of_meas'] = metric.get('unit_of_meas') - metric_def['pass_fail_stat']= metric.get('pass_fail_stat') - metric_min_lim = metric.get('min_limit') - if metric_min_lim: - metric_def['min_limit'] = float(metric_min_lim) - metric_max_lim = metric.get('max_limit') - if metric_max_lim: - metric_def['max_limit'] = float(metric_max_lim) - - fname = logdir_local_run+ '/UE_exec' + '_' + str(run) + '_.log' - - args = {'metric' : metric_def, - 'file' : fname } - - metric_extracted = analyser.do_extract_metrics(args) - - print (Fore.WHITE + indent + "> Metric : "+metric_def['id']), - print ("(min="+str( metric_extracted['metric_min'])+", max="+str( metric_extracted['metric_max'])+", mean="+str( metric_extracted['metric_mean'])+", median="+str( metric_extracted['metric_median'])+")") - -# print "\t > Metric "+metric_def['id']+" :" -# print "\t\t> min = "+ str( metric_extracted['metric_min'] ) -# print "\t\t> min_index = "+ str( metric_extracted['metric_min_index'] ) -# print "\t\t> max = "+ str( metric_extracted['metric_max'] ) -# print "\t\t> max_index = "+ str( metric_extracted['metric_max_index'] ) -# print "\t\t> mean = "+ str( metric_extracted['metric_mean'] ) -# print "\t\t> median = "+ str( metric_extracted['metric_median'] ) - - if metric_def['pass_fail_stat'] : - metric_verdict = analyser.do_check_verdict(metric_def, metric_extracted) - - metric_fig = logdir_local_run+ '/UE_metric_'+ metric_def['id']+'_' + str(run) + '_.png' - analyser.do_img_metrics(metric_def, metric_extracted, metric_fig) - - - metric_fig_report = '../log/'+ testcasename + '/run_' + str(run) + '/UE_metric_'+ metric_def['id']+'_' + str(run) + '_.png' - - run_metrics = dict( metric_id = metric_def['id'], - metric_desc = metric_def['description'], - metric_uom = metric_def['unit_of_meas'], - metric_min = metric_extracted['metric_min'], - metric_min_index= metric_extracted['metric_min_index'], - metric_max = metric_extracted['metric_max'], - metric_max_index= metric_extracted['metric_max_index'], - metric_mean = metric_extracted['metric_mean'], - metric_median = metric_extracted['metric_median'], - metric_fig = metric_fig_report) - - if metric_def['pass_fail_stat'] : - run_metrics['pass_fail_stat'] = metric_def['pass_fail_stat'] - if metric_min_lim : - run_metrics['pass_fail_min_limit'] = metric_def['min_limit'] - if metric_max_lim : - run_metrics['pass_fail_max_limit'] = metric_def['max_limit'] - - runs_metrics.append(run_metrics) - - if metric_verdict != 'PASS': - verdict = metric_verdict - - # End Metrics LOOP - # --------------------- - - - # Traffic analysis - if UE_traffic_exec != "": - - fname = logdir_local_run+ '/UE_traffic' + '_' + str(run) + '_.log' - args = {'file' : fname } - traffic_metrics = analyser.do_extract_traffic_metrics(args) - traffic_fig = logdir_local_run+ '/UE_traffic'+'_' + str(run) + '_.png' - analyser.do_img_traffic(traffic_metrics, traffic_fig) - - traffic_fig_report= '../log/'+ testcasename + '/run_' + str(run) + '/UE_traffic'+'_' + str(run) + '_.png' - - dur_pass_fail_crit = 'none' - if traffic_metrics['traffic_count'] == 0 : - verdict = 'FAIL' - elif UE_search_expr_true != "": - traffic_duration_limit = float(UE_search_expr_true) - dur_pass_fail_crit = str(traffic_duration_limit) - # print 'traffic_duration_limit = '+str(traffic_duration_limit) - # print 'traffic_metrics[interval_stop_max] = '+str(traffic_metrics['interval_stop_max']) - if traffic_metrics['interval_stop_max'] < traffic_duration_limit : - verdict = 'FAIL' - - - run_traffic = dict( traffic_count = traffic_metrics['traffic_count'], - bw_min = traffic_metrics['bw_min'], - bw_max = traffic_metrics['bw_max'], - bw_mean = traffic_metrics['bw_mean'], - bw_median = traffic_metrics['bw_median'], - jitter_min = traffic_metrics['jitter_min'], - jitter_max = traffic_metrics['jitter_max'], - jitter_mean = traffic_metrics['jitter_mean'], - jitter_median = traffic_metrics['jitter_median'], - rl_min = traffic_metrics['rl_min'], - rl_max = traffic_metrics['rl_max'], - rl_mean = traffic_metrics['rl_mean'], - rl_median = traffic_metrics['rl_median'], - iperf_duration = traffic_metrics['interval_stop_max'], - dur_pass_fail_crit = dur_pass_fail_crit, - traffic_fig = traffic_fig_report ) - else: - run_traffic = dict( traffic_count = 0) - - else : - verdict = 'SKIP' - - - - # - # RUN verdict and finalization - # ---------------------------------------------------- - run_stop_time=datetime.datetime.now() - run_duration = run_stop_time-run_start_time -# print (Fore.WHITE + ("duration=" :"), - print (Fore.WHITE + indent + "> RUN duration : "+ str(run_duration) +"s" ) - - print (Fore.WHITE + indent + "> RUN verdict :"), - - if verdict == 'PASS': - nb_run_pass += 1 - print ( Fore.GREEN + verdict) - elif verdict == 'FAIL': - nb_run_failed += 1 - testcase_verdict = 'FAIL' - print ( Fore.RED + verdict) - elif verdict == 'SKIP': - nb_run_skip += 1 - print ( Fore.YELLOW + verdict) - else: - nb_run_inc += 1 - if testcase_verdict == 'PASS' : testcase_verdict = 'INCON' - print (Fore.YELLOW+'INCONCLUSIVE') - - run_results = dict( run_id=str(run), - run_start_time = run_start_time, - run_stop_time = run_stop_time , - run_verdict = verdict, - ue_seg_fault_status = ue_seg_fault_status, - run_duration = run_duration, - runs_metrics = runs_metrics, - run_traffic = run_traffic) - runs_results.append(run_results) - - # END RUN LOOP - #---------------------------------------------------- - - indent="\t" - - # Test case duration - # ---------------------------------- - testcase_time_stop = datetime.datetime.now() - print(Fore.WHITE + indent + "> testcase time stop : " + str(testcase_time_start) ), - print " -> TestCase duration = "+str(testcase_time_stop - testcase_time_start) - - # Save remote log files - # ----------------------------------- - #Now we change the permissions of the logfiles to avoid some of them being with root permissions - cmd = 'sudo -E chown -R ' + user + ' ' + logdir_eNB_testcase - res= oai_eNB.send_recv(cmd) - cmd = 'sudo -E chown -R ' + user + ' ' + logdir_UE_testcase - res= oai_UE.send_recv(cmd) - - # Save remote log files on MTC - #print "Copying files from eNBMachine " + eNBMachine + "logdir_eNB = " + logdir_eNB - SSHSessionWrapper(eNBMachine, user, None, password, logdir_eNB_testcase, openairdir_local + '/cmake_targets/autotests/log/', "get_all") - #print "Copying files from UEMachine : " + UEMachine + "logdir_UE = " + logdir_UE - SSHSessionWrapper(UEMachine, user, None, password, logdir_UE_testcase, openairdir_local + '/cmake_targets/autotests/log/', "get_all") - - oai_eNB.disconnect() - oai_UE.disconnect() - - # Set test case final verdict - # ----------------------------------- - test_result_string = 'do be completed' - - if testcase_verdict == 'PASS': - if nb_run_pass == 0 : - testcase_verdict = 'INCON' - - print(Fore.WHITE + indent + "> testcase final verdict :"), - if testcase_verdict == 'PASS': - print ( Fore.GREEN + testcase_verdict) - elif testcase_verdict == 'FAIL': - print ( Fore.RED + testcase_verdict) - else: - print (Fore.YELLOW+'INCONCLUSIVE') - - print(Style.RESET_ALL) - - duration= testcase_time_stop - testcase_time_start - - test_result = dict(testcase_name=testcasename, - testcaseclass=testcaseclass, - testcase_verdict = testcase_verdict, - testcase_time_start=testcase_time_start, - testcase_time_stop=testcase_time_stop, - tags=tags, - nruns=nb_runs, - nb_run_pass = nb_run_pass, - nb_run_skip = nb_run_skip, - nb_run_failed = nb_run_failed, - nb_run_inc=nb_run_inc, - nb_seg_fault = nb_seg_fault, - testcase_timeout=timeout_cmd, - testcase_duration = duration, - testcase_eNBMachine =eNBMachine, - testcase_UEMachine =UEMachine, - runs_results = runs_results) - test_results.append(test_result) - - xmlFile = logdir_local_testcase + '/test.' + testcasename + '.xml' - xml="\n \n" - write_file(xmlFile, xml, mode="w") - - xmlFile_ng = logdir_local_testcase + '/test.' + testcasename + '_ng.xml' - xml_ng = xmlify(test_result, wrap=testcasename, indent=" ") - write_file(xmlFile_ng, xml_ng, mode="w") - - - - return testcase_verdict - - - - -# \brief This function searches if test case is present in list of test cases that need to be executed by user -# \param testcasename the test case to search for -# \param testcasegroup list that is passed from the arguments -# \param test_case_exclude list of test cases excluded from execution (specified in test_case_list.xml) -def search_test_case_group(testcasename, testcasegroup, test_case_exclude): - - if test_case_exclude != "": - testcase_exclusion_list=test_case_exclude.split() - for entry in testcase_exclusion_list: - if entry.find('+') >=0: - match = re.search(entry, testcasename) - if match: - #print "\nSkipping test case as it is found in black list: " + testcasename - return False - else: - match = entry.find(testcasename) - if match >=0: - #print "\nSkipping test case as it is found in black list: " + testcasename - return False - if testcasegroup == '': - return True - else: - testcaselist = testcasegroup.split() - for entry in testcaselist: - if entry.find('+') >=0: - match = re.search(entry, testcasename) - if match: - return True - else: - match = testcasename.find(entry) - if match >=0: - return True - return False - -# \brief thread that cleans up remote machines from pre-existing test case executions -# \param threadID number of thread (for book keeping) -# \param threadname name of thread (for book keeping) -# \param oai handler that can be used to execute programs on remote machines -# \param CleanUpOldProgs list of programs which must be terminated before running a test case (specified in test_case_list.xml) -# \param CleanupAluLteBox string that contains commands to stop ALU Bell Labs LTEBox (specified in test_case_list.xml) -# \param ExmimoRfStop command to stop EXMIMO Card -class oaiCleanOldProgramThread (threading.Thread): - def __init__(self, threadID, threadname, oai, CleanUpOldProgs, CleanUpAluLteBox, ExmimoRfStop, logdir, logdirOAI5GRepo): - threading.Thread.__init__(self) - self.threadID = threadID - self.threadname = threadname - self.oai = oai - self.CleanUpOldProgs = CleanUpOldProgs - self.CleanUpAluLteBox = CleanUpAluLteBox - self.ExmimoRfStop = ExmimoRfStop - self.logdir = logdir - self.logdirOAI5GRepo = logdirOAI5GRepo - def run(self): - try: - cleanOldPrograms(self.oai, self.CleanUpOldProgs, self.CleanUpAluLteBox, self.ExmimoRfStop, self.logdir, self.logdirOAI5GRepo) - except Exception, e: - error='' - error = error + ' In class oaiCleanOldProgramThread, function: ' + sys._getframe().f_code.co_name + ': *** Caught exception: ' + str(e.__class__) + " : " + str( e) - error = error + '\n threadID = ' + str(self.threadID) + '\n threadname = ' + self.threadname + '\n CleanUpOldProgs = ' + self.CleanUpOldProgs + '\n CleanUpAluLteBox = ' + self.CleanUpAluLteBox + '\n ExmimoRfStop = ' + self.ExmimoRfStop + '\n' - error = error + traceback.format_exc() - print error - print "There is error in cleaning up old programs....." - #sys.exit(1) - -# \brief Run parallel threads in all machines for clean up old execution of test cases -# \param oai_list list of handlers that can be used to execute programs on remote machines -# \param CleanUpOldProgs list of programs which must be terminated before running a test case (specified in test_case_list.xml) -# \param CleanupAluLteBox string that contains commands to stop ALU Bell Labs LTEBox (specified in test_case_list.xml) -# \param ExmimoRfStop command to stop EXMIMO Card -def cleanOldProgramsAllMachines(oai_list, CleanOldProgs, CleanUpAluLteBox, ExmimoRfStop, logdir_list, logdirOAI5GRepo): - threadId=0 - threadList=[] - index=0 - if len(oai_list)!=len(logdir_list) : - logdir_list=[logdir[0]]*len(oai_list) - - for oai in oai_list: - threadName="cleanup_thread_"+str(threadId) - thread=oaiCleanOldProgramThread(threadId, threadName, oai, CleanUpOldProgs, CleanUpAluLteBox, ExmimoRfStop, logdir_list[index],logdirOAI5GRepo) - threadList.append(thread) - thread.start() - threadId = threadId + 1 - index = index+1 - for t in threadList: - t.join() - - -debug = 0 -pw ='' -i = 0 -dlsim=0 -localshell=0 -GitOAI5GRepo='' -GitOAI5GRepoBranch='' -GitOAI5GHeadVersion='' -user='' -pw='' -testcasegroup='' -NFSResultsShare='' -cleanUpRemoteMachines=False -openairdir_local = os.environ.get('OPENAIR_DIR') -if openairdir_local is None: - print "Environment variable OPENAIR_DIR not set correctly" - sys.exit() -locallogdir = openairdir_local + '/cmake_targets/autotests/log' -reportdir = openairdir_local + '/cmake_targets/autotests/report' -MachineList = '' -MachineListGeneric='' -MachineDescDic={} -flag_remove_logdir=False -flag_start_testcase=False -nruns_lte_softmodem='' -flag_skip_git_head_check=False -flag_skip_oai_install=False -flag_skip_machine_preparation=False -flag_skip_sanity_check=False -Timeout_cmd='' -xmlInputFile='' - -#print "Number of arguments argc = " + str(len(sys.argv)) -#for index in range(1,len(sys.argv) ): -# print "argv_" + str(index) + " : " + sys.argv[index] - -oai_list = [] - - -i=1 -while i < len (sys.argv): - arg=sys.argv[i] - if arg == '-r': - flag_remove_logdir=True - elif arg == '-s' : - flag_start_testcase=True - elif arg == '-g' : - testcasegroup = sys.argv[i+1].replace("\"","") - i = i +1 - elif arg == '-c': - cleanUpRemoteMachines=True - elif arg == '-5GRepo': - GitOAI5GRepo = sys.argv[i+1] - i = i +1 - elif arg == '-5GRepoBranch': - GitOAI5GRepoBranch = sys.argv[i+1] - i = i +1 - elif arg == '-5GRepoHeadVersion': - GitOAI5GHeadVersion = sys.argv[i+1] - #We now find the branch that corresponds to this Git Head Commit - cmd = "git show-ref --head " + " | grep " + GitOAI5GHeadVersion - cmd_out = subprocess.check_output ([cmd], shell=True) - cmd_out=cmd_out.replace("\n","") - cmd_out = cmd_out.split('/') - GitOAI5GRepoBranch = cmd_out[-1] - if GitOAI5GRepoBranch == '': - print "Error extracting GitBranch from head commit. Exiting now..." - sys.exit(1) - i = i +1 - elif arg == '-u': - user = sys.argv[i+1] - i = i +1 - elif arg == '-p': - pw = sys.argv[i+1] - i = i +1 - elif arg == '-n': - NFSResultsShare = sys.argv[i+1] - i = i +1 - elif arg == '--nrun_lte_softmodem': - nruns_lte_softmodem = sys.argv[i+1] - i = i +1 - elif arg == '-MachineList': - MachineList = sys.argv[i+1] - MachineList = MachineList.replace("\"","") - MachineList = MachineList.replace("\'","") - i = i +1 - elif arg == '-MachineListGeneric': - MachineListGeneric = sys.argv[i+1] - MachineListGeneric = MachineListGeneric.replace("\"","") - MachineListGeneric = MachineListGeneric.replace("\'","") - i = i +1 - elif arg == '--skip-git-head-check': - flag_skip_git_head_check=True - elif arg == '--timeout_cmd': - Timeout_cmd = sys.argv[i+1] - i = i +1 - elif arg == '--skip-oai-install': - flag_skip_oai_install=True - elif arg == '--skip-machine-preparation': - flag_skip_machine_preparation=True - elif arg == '--skip-sanity-check': - flag_skip_sanity_check=True - elif arg == '--test-suite' : - xmlInputFile = sys.argv[i+1] - i = i +1 - elif arg == '-h' : - print "-s: This flag *MUST* be set to start the test cases" - print "-r: Remove the log directory in autotests" - print "-g: Run test cases in a group" - print "-c: Run cleanup scripts on remote machines and exit" - print "-5GRepo: Repository for OAI 5G to use to run tests (overrides GitOAI5GRepo in test_case_list.xml)" - print "-5GRepoBranch: Branch for OAI 5G Repository to run tests (overrides the branch in test_case_list.xml)" - print "-5GRepoHeadVersion: Head commit on which to run tests (overrides the branch in test_case_list.xml)" - print "-u: use the user name passed as argument" - print "-p: use the password passed as an argument" - print "-n: Set the NFS share passed as an argument" - print "--nrun_lte_softmodem: Set the number of runs for lte-softmodem test case class" - print "-MachineList : overrides the MachineList parameter in test_case_list.xml" - print "-MachineListGeneric : overrides the MachineListGeneric parameter in test_case_list.xml" - print "--skip-git-head-check: skip checking of GitHead remote/local branch (only for debugging)" - print "--timeout_cmd: Override the default parameter (timeout_cmd) in test_case_list.xml. This parameter is in seconds and should be > 120" - print "--skip-oai-install: Skips the openairinterface5g installer" - print "--skip-machine-preparation: skipp the whole system preparation -> direct to test cases" - print "--skip-sanity-check: skipp the machine sanity checks" - print "--test-suite: Select a XML test-suite file" - sys.exit() - else : - print "Unrecongnized Option: <" + arg + ">. Use -h to see valid options" - sys.exit() - i= i + 1 - -logdir = '/tmp/' + 'OAITestFrameWork-' + user + '/' -logdirOAI5GRepo = logdir + 'openairinterface5g/' -logdirOpenaircnRepo = logdir + 'openair-cn/' -patchdir = logdirOAI5GRepo + 'cmake_targets/autotests/patches/' -NFSResultsDir = '/mnt/sradio' -cleanupOldProgramsScript = '$OPENAIR_DIR/cmake_targets/autotests/tools/remove_old_programs.bash' - -#Now we parse the xml file for basic configuration -xmlTree = ET.parse(xmlInputFile) -xmlRoot = xmlTree.getroot() - -# -# Read test session configuration -# --------------------------------------------------------------------------------- -print (Fore.YELLOW + '\nStep 0.1 - Read test session configuration') -print (Fore.YELLOW + '-------------------------------------------------') - -test_session_start_time = datetime.datetime.now() -print (Fore.WHITE + ' - start time : '+ str(test_session_start_time)) - -host = os.uname()[1] -print (Fore.WHITE + ' - MTC host : '+host) - - -if user=='': - user = getpass.getuser() -print (Fore.WHITE + ' - user : '+user) - -if pw=='': - pw = getpass.getpass() -print (Fore.WHITE + ' - password : '+pw) - -print (Fore.WHITE + ' - cmd line flags : ') -print (Fore.WHITE + ' + -s : '+str(flag_start_testcase)) -print (Fore.WHITE + ' + -r : '+str(flag_remove_logdir)) -print (Fore.WHITE + ' + -c : '+str(cleanUpRemoteMachines)) -print (Fore.WHITE + ' + --skip-git-head-check : '+str(flag_skip_git_head_check)) -print (Fore.WHITE + ' + --skip-oai-install : '+str(flag_skip_oai_install)) -print (Fore.WHITE + ' + --skip-machine-preparation : '+str(flag_skip_machine_preparation)) -print (Fore.WHITE + ' + --skip-sanity-check : '+str(flag_skip_sanity_check)) - - -print (Fore.WHITE + ' - Test setup basic config : (* -> overwrite by cmd line parameter)') -print (Fore.WHITE + ' + test setup config file : '+str(xmlInputFile)) -print (Fore.WHITE + ' + remote setup dir : '+str(logdir)) -print (Fore.WHITE + ' + remote OAI5G repo : '+str(logdirOAI5GRepo)) -print (Fore.WHITE + ' + remote OpenAirCN repo : '+str(logdirOpenaircnRepo)) - - -if MachineList =='': - MachineList = xmlRoot.findtext('MachineList',default='') -NFSResultsShare = xmlRoot.findtext('NFSResultsShare',default='') -GitOpenaircnRepo = xmlRoot.findtext('GitOpenair-cnRepo',default='') - -if GitOAI5GRepo == '': - GitOAI5GRepo = xmlRoot.findtext('GitOAI5GRepo',default='') - -if GitOAI5GRepoBranch == '': - GitOAI5GRepoBranch = xmlRoot.findtext('GitOAI5GRepoBranch',default='') -if GitOAI5GHeadVersion == '': - GitOAI5GHeadVersion = xmlRoot.findtext('GitOAI5GHeadVersion',default='') - -GitOpenaircnRepoBranch = xmlRoot.findtext('GitOpenair-cnRepoBranch',default='') -CleanUpOldProgs = xmlRoot.findtext('CleanUpOldProgs',default='') -CleanUpAluLteBox = xmlRoot.findtext('CleanUpAluLteBox',default='') -Timeout_execution = int (xmlRoot.findtext('Timeout_execution')) -if MachineListGeneric == '': - MachineListGeneric = xmlRoot.findtext('MachineListGeneric',default='') -TestCaseExclusionList = xmlRoot.findtext('TestCaseExclusionList',default='') -ExmimoRfStop = xmlRoot.findtext('ExmimoRfStop',default='') -if nruns_lte_softmodem == '': - nruns_lte_softmodem = xmlRoot.findtext('nruns_lte-softmodem',default='') - -print (Fore.WHITE + ' + MachineList : '+ MachineList) -print (Fore.WHITE + ' + GitOpenair-cnRepo : '+ GitOpenaircnRepo) -print (Fore.WHITE + ' + GitOAI5GRepo : '+ GitOAI5GRepo) -print (Fore.WHITE + ' + GitOAI5GBranch : '+ GitOAI5GRepoBranch) -print (Fore.WHITE + ' + GitOpenaircnRepoBranch : '+ GitOpenaircnRepoBranch) -print (Fore.WHITE + ' + NFSResultsShare : '+ NFSResultsShare) -print (Fore.WHITE + ' + nruns_lte_softmodem : '+ nruns_lte_softmodem) -print (Fore.WHITE + ' + Timeout_cmd : '+ Timeout_cmd) - - -if GitOAI5GHeadVersion == '': - cmd = "git log --pretty=format:\'%H\' -n 1" # origin/"+ GitOAI5GRepoBranch -# cmd = "git show-ref --heads -s "+ GitOAI5GRepoBranch - GitOAI5GHeadVersion = subprocess.check_output ([cmd], shell=True) - GitOAI5GHeadVersion=GitOAI5GHeadVersion.replace("\n","") - - # Print commiter and date : git log -1 --pretty=format:"%an %ad" - -print (Fore.WHITE + ' + GitOAI5GHeadVersion : '+ GitOAI5GHeadVersion) -#print "CleanUpOldProgs = " + CleanUpOldProgs -print (Fore.WHITE + ' + Timeout_execution (s) : '+ str(Timeout_execution)) - -if GitOAI5GHeadVersion == '': - print "Error getting the OAI5GBranch Head version...Exiting" - sys.exit() - -NFSTestsResultsDir = NFSResultsShare + '/'+ GitOAI5GRepoBranch + '/' + GitOAI5GHeadVersion - -#print "NFSTestsResultsDir = " + NFSTestsResultsDir - -OAI5GpatchFileList=xmlRoot.findall('OAI5GPatchFile') - - - -MachineList = MachineList.split() -MachineListGeneric = MachineListGeneric.split() - - -MachineDescDic - - -# -# 'Check Mater Test Controller sanity (MTC)' -# --------------------------------------------------------------------------------- -print (Fore.YELLOW + '\nStep 0.2 - Check Mater Test Controller sanity (MTC)') -print (Fore.YELLOW + '-------------------------------------------------') - -try: - print (Fore.WHITE + ' - check OpenAirInterface environment variable OPENAIR1_DIR... '), - os.environ["OPENAIR1_DIR"] -except KeyError: - print (Fore.RED + 'FAILED') - print "Please set the environment variable OPENAIR1_DIR in the .bashrc or run 'source oaienv' " - exit_prog(1) -print (Fore.GREEN + 'OK') - -try: - print (Fore.WHITE + ' - check OpenAirInterface environment variable OPENAIR2_DIR... '), - os.environ["OPENAIR2_DIR"] -except KeyError: - print (Fore.RED + 'FAILED') - print "Please set the environment variable OPENAIR2_DIR in the .bashrc or run 'source oaienv' " - exit_prog(1) -print (Fore.GREEN + 'OK') - -try: - os.environ["OPENAIR_TARGETS"] -except KeyError: - print "Please set the environment variable OPENAIR_TARGETS in the .bashrc or run 'source oaienv' " - sexit_prog(1) - -print (Fore.WHITE + ' - kill zombie ssh sessions from earlier sessions... '), -cmd='ps aux |grep \"/usr/bin/ssh -q -l ' + user + '\"| tr -s \" \" :| cut -f 2 -d :| xargs kill -9 ' -os.system(cmd) -print (Fore.GREEN + 'DONE') - -if flag_start_testcase == False: - print "You need to start the testcase by passing option -s. Use -h to see all options. Aborting now..." - exit_prog(1) - - -#print "Killing zombie ssh sessions from earlier sessions..." -#cmd='ps aux |grep \"/usr/bin/ssh -q -l guptar\"|tr -s \" \" :|cut -f 2 -d :|xargs kill -9 ' -#cmd = cmd + '; ps aux |grep \"/usr/bin/ssh -q -l ' + user + '\"| tr -s \" \" :| cut -f 2 -d :| xargs kill -9 ' -#os.system(cmd) -#print cmd - -try: - analyser = __import__("lib_autotest_analyser") -except ImportError as err: - print('Import error: ' + str(err)) - exit(0) - -if flag_remove_logdir == True: - print "Removing directory: " + locallogdir - os.system(' rm -fr ' + locallogdir + '; mkdir -p ' + locallogdir ) - -if not os.path.exists(locallogdir): - os.system('mkdir -p ' + locallogdir ) - - -paramiko_logfile = os.path.expandvars('$OPENAIR_DIR/cmake_targets/autotests/log/paramiko.log') -res=os.system(' echo > ' + paramiko_logfile) -paramiko.util.log_to_file(paramiko_logfile) - - -# -# 'REMOTE MACHINE SANITY CHEKS' -# --------------------------------------------------------------------------------- -print (Fore.YELLOW + '\nStep 0.3 - REMOTE MACHINE SANITY CHEKS') -print (Fore.YELLOW + '-------------------------------------------------') - - -for machine in MachineList: - oai_list.append( openair('localdomain',machine)) - MachineDescDic[machine]={} - - -if not flag_skip_sanity_check: - - if localshell == 0: - try: - index=0 - for machine in MachineList: - print (Fore.WHITE + " - Check sanity for remote machine "+machine) - - oai_list[index].connect(user,pw) - print (Fore.WHITE + " > Checking for sudo permissions for user "+user+ " : "), - result = oai_list[index].send_expect_false('sudo -S -v','may not run sudo',True) - if (result == 'OK'): - print (Fore.GREEN + result ) - else: - print (Fore.RED + result ) - - print (Fore.WHITE + " > Cleaning Older running programs : "), - cleanOldPrograms(oai_list[index], CleanUpOldProgs, CleanUpAluLteBox, ExmimoRfStop, '$HOME', '/tmp') - print (Fore.WHITE + " Done") - - #result = oai_list[index].send('mount ' + NFSResultsDir, True) - #print "Mounting NFS Share " + NFSResultsDir + "..." + result - - # Check if NFS share is mounted correctly. - #print 'Checking if NFS Share<' + NFSResultsDir + '> is mounted correctly...' - #cmd = 'if grep -qs '+NFSResultsDir+ ' /proc/mounts; then echo \'' + NFSResultsDir + ' is mounted\' ; fi' - #search_expr = NFSResultsDir + ' is mounted' - #print "cmd = " + cmd - #print "search_expr = " + search_expr - #result = oai_list[index].send_expect(cmd, search_expr) - #print "Mount NFS_Results_Dir..." + result - index = index + 1 - - #oai.connect2(user,pw) - #oai.get_shell() - except : - print 'Fail to connect to the machine: '+ machine - sys.exit(1) - else: - pw = '' - oai_list[0].connect_localshell() -else: - print (Fore.RED + " Skipping Machine sanity check...") - - -# -# 'REMOTE MACHINE TEST SETUP CONFIGURATION' -# --------------------------------------------------------------------------------- -print (Fore.YELLOW + '\nStep 0.4 - REMOTE MACHINE PREPARATION') -print (Fore.YELLOW + '-------------------------------------------------') - -if not flag_skip_machine_preparation: - index=0 - threads_init_setup=[] - for oai in oai_list: - try: - print "setting up machine: " + MachineList[index] - #print oai_list[oai].send_recv('echo \''+pw+'\' |sudo -S -v') - #print oai_list[oai].send_recv('sudo su') - #print oai_list[oai].send_recv('who am i') - #cleanUpPrograms(oai_list[oai] - cmd = 'sudo -S -E rm -fr ' + logdir + ' ; mkdir -p ' + logdir - result = oai.send_recv(cmd) - print cmd - - setuplogfile = logdir + '/setup_log_' + MachineList[index] + '_.txt' - setup_script = locallogdir + '/setup_script_' + MachineList[index] + '_.txt' - - #Sometimes git fails so the script below retries in that case - localfile = os.path.expandvars('$OPENAIR_DIR/cmake_targets/autotests/tools/git-retry.sh') - remotefile = logdir + '/git-retry.sh' - paramList=[] - port=22 - paramList.append ( {"operation":'put', "localfile":localfile, "remotefile":remotefile} ) - sftp_log = os.path.expandvars(locallogdir + '/sftp_module.log') - sftp_module (user, pw, MachineList[index], port, paramList, sftp_log) - - cmd = ' ( \n' - #cmd = cmd + 'rm -fR ' + logdir + '\n' - #cmd = cmd + 'mkdir -p ' + logdir + '\n' - cmd = cmd + 'cd '+ logdir + '\n' - cmd = cmd + 'sudo apt-get install -y git \n' - cmd = cmd + 'chmod 700 ' + logdir + '/git-retry.sh \n' - cmd = cmd + logdir + '/git-retry.sh clone '+ GitOAI5GRepo +' \n' - cmd = cmd + logdir + '/git-retry.sh clone '+ GitOpenaircnRepo + ' \n' - cmd = cmd + 'cd ' + logdirOAI5GRepo + '\n' - cmd = cmd + 'git checkout ' + GitOAI5GRepoBranch + '\n' - if GitOAI5GHeadVersion : - cmd = cmd + 'git checkout ' + GitOAI5GHeadVersion + '\n' - cmd = cmd + 'git_head=`git ls-remote |grep \'' + GitOAI5GRepoBranch + '\'` \n' - cmd = cmd + 'git_head=($git_head) \n' - cmd = cmd + 'git_head=${git_head[0]} \n' - cmd = cmd + 'echo \"GitOAI5GHeadVersion_remote = $git_head\" \n' - cmd = cmd + 'echo \"GitOAI5GHeadVersion_local = ' + GitOAI5GHeadVersion + '\" \n' - if flag_skip_git_head_check==True: - cmd = cmd + 'echo \"skipping GitHead check...\" \n ' - else: - cmd = cmd + 'if [ \"$git_head\" != \"'+ GitOAI5GHeadVersion + '\" ]; then echo \"error: Git openairinterface5g head version does not match\" ; fi \n' - cmd = cmd + 'source oaienv' + '\n' - if flag_skip_oai_install == False: - cmd = cmd + 'source $OPENAIR_DIR/cmake_targets/tools/build_helper \n' - cmd = cmd + 'echo \"Installing core OAI dependencies...Start\" \n' - cmd = cmd + '$OPENAIR_DIR/cmake_targets/build_oai -I --install-optional-packages \n' - cmd = cmd + 'echo \"Installing core OAI dependencies...Finished\" \n' - #cmd = cmd + 'echo \"Installing BLADERF OAI dependencies...Start\" \n' - #cmd = cmd + 'check_install_bladerf_driver \n' - #cmd = cmd + 'echo \"Installing BLADERF OAI dependencies...Finished\" \n' - #cmd = cmd + 'echo \"Installing USRP OAI dependencies...Start\" \n' - #cmd = cmd + 'check_install_usrp_uhd_driver \n' - #cmd = cmd + 'echo \"Installing USRP OAI dependencies...Finished\" \n' - cmd = cmd + 'cd ' + logdirOpenaircnRepo + '\n' - cmd = cmd + 'git checkout ' + GitOpenaircnRepoBranch + '\n' - cmd = cmd + 'env |grep OPENAIR' + '\n' - cmd = cmd + ' cd ' + logdir + '\n' - cmd = cmd + 'mkdir -p ' + patchdir + '\n' - cmd = cmd + ' ) > ' + setuplogfile + ' 2>&1 \n' - #cmd = cmd + 'echo \' ' + cmd + '\' > ' + setup_script + ' 2>&1 \n ' - #result = oai_list[index].send_recv(cmd, False, 300 ) - write_file(setup_script, cmd, mode="w") - tempThread = oaiThread(index, 'thread_setup_'+str(index)+'_' + MachineList[index] , MachineList[index] , user, pw, cmd, False, 3000) - threads_init_setup.append(tempThread ) - tempThread.start() - index = index + 1 - except Exception, e: - print 'There is error in one of the commands to setup the machine '+ MachineList[index] - error='' - error = error + ' In function: ' + sys._getframe().f_code.co_name + ': *** Caught exception: ' + str(e.__class__) + " : " + str( e) - error = error + traceback.format_exc() - print error - sys.exit(1) - - #Now we wait for all the threads to complete - index = 0 - for t in threads_init_setup: - t.join() - - port = 22 - paramList=[] - sftp_log = os.path.expandvars(locallogdir + '/sftp_module.log') - - #Now we copy patch files and apply them - print( Fore.WHITE + " - Installating patch files on machine " + MachineList[index]) - for patchFile in OAI5GpatchFileList: - localfile = os.path.expandvars('$OPENAIR_DIR/cmake_targets/autotests/patches/')+patchFile.get('name') - remotefile = logdirOAI5GRepo + '/cmake_targets/autotests/patches/'+patchFile.get('name') - if patchFile.get('machine') == MachineList[index] or patchFile.get('machine') == None: - if os.path.isfile(localfile): - print( Fore.WHITE + "\t> PATCH FILE :"+localfile) - paramList=[] - paramList.append ( {"operation":'put', "localfile":localfile, "remotefile":remotefile} ) - sftp_module (user, pw, MachineList[index], port, paramList, sftp_log) - cmd = ' cd ' + logdirOAI5GRepo + ' ;git apply cmake_targets/autotests/patches/'+patchFile.get('name') - res = oai_list[index].send_recv(cmd) - #print res - - paramList=[] - - setuplogfile = logdir + '/setup_log_' + MachineList[index] + '_.txt' - setup_script = locallogdir + '/setup_script_' + MachineList[index] + '_.txt' - localfile = locallogdir + '/setup_log_' + MachineList[index] + '_.txt' - remotefile = logdir + '/setup_log_' + MachineList[index] + '_.txt' - sftp_log = os.path.expandvars(locallogdir + '/sftp_module.log') - paramList.append ( {"operation":'get', "localfile":localfile, "remotefile":remotefile} ) - #sftp_module (user, pw, MachineList[index], port, localfile, remotefile, sftp_log, "get") - - #Now we copy test_case_list.xml on the remote machines - localfile = os.path.expandvars('$OPENAIR_DIR/cmake_targets/autotests/test_case_list.xml') - remotefile = logdirOAI5GRepo + '/cmake_targets/autotests/test_case_list.xml' - # paramList.append ( {"operation":'put', "localfile":localfile, "remotefile":remotefile} ) - # sftp_module (user, pw, MachineList[index], port, paramList, sftp_log) - - sftp_module (user, pw, MachineList[index], port, paramList, sftp_log) - - - cmd = ' cd ' + logdirOAI5GRepo + ' ; source oaienv ; env|grep OPENAIR \n' - res = oai_list[index].send_recv(cmd) - index = index +1 - if os.path.exists(localfile) == 0: - print "Setup log file <" + localfile + "> missing for machine <" + MachineList[index] + ">. Please check the setup log files. Exiting now" - sys.exit(1) - - #Now we process all the test cases - #Now we check if there was error in setup files - - status, out = commands.getstatusoutput('grep ' + ' -il \'error\' ' + locallogdir + '/setup_log*') - if (out != '') : - print "There is error in setup of machines" - print "status = " + str(status) + "\n Check files for error = " + out - print "Exiting now..." - sys.exit(1) - - cleanOldProgramsAllMachines(oai_list, CleanUpOldProgs, CleanUpAluLteBox, ExmimoRfStop, '$HOME' , logdirOAI5GRepo) - if cleanUpRemoteMachines == True: - print "Error while cleaning Remote machines" - print "Exiting now..." - sys.exit(0) - - -else: - print (Fore.RED + " Skipping Machine preparation...") - -# ************************************************************************** -# ************************************************************************** -# STEP 2 - TEST SELECTION AND PARAMETRIZATION -# ************************************************************************** -# ************************************************************************** - -print (Fore.YELLOW + '\nStep 2 - TEST SELECTION') -print (Fore.YELLOW + '-------------------------------------------------') - -print (Fore.WHITE + " Parsing test case list for test selection...") -print (Fore.WHITE + " - TestCaseExclusionList : "+TestCaseExclusionList) -print (Fore.WHITE + " - testcasegroup : "+testcasegroup) - - - - -testcaseList=xmlRoot.findall('testCase') - -nb_total_testcases = 0 -nb_total_testcases_softmodem = 0 -nb_total_testcases_softmodem_noS1 = 0 -nb_total_testcases_compilation = 0 -nb_total_testcases_execution = 0 - -nb_run_testcases = 0 -nb_run_testcases_softmodem = 0 -nb_run_testcases_softmodem_noS1 = 0 -nb_run_testcases_compilation = 0 -nb_run_testcases_execution = 0 - - -for testcase in testcaseList: - try: - testcasename = testcase.get('id') - testcaseclass = testcase.findtext('class',default='') - desc = testcase.findtext('desc',default='') - nb_total_testcases+=1 - - run_flag = search_test_case_group(testcasename, testcasegroup, TestCaseExclusionList) - if (run_flag): - nb_run_testcases+=1 - - if testcaseclass == 'lte-softmodem' : - nb_total_testcases_softmodem+=1 - if (run_flag): nb_run_testcases_softmodem+=1 - elif testcaseclass == 'lte-softmodem-noS1': - nb_total_testcases_softmodem_noS1+=1 - if (run_flag): nb_run_testcases_softmodem_noS1+=1 - elif testcaseclass == 'compilation': - nb_total_testcases_compilation+=1 - if (run_flag): nb_run_testcases_compilation+=1 - elif testcaseclass == 'execution': - nb_total_testcases_execution+=1 - if (run_flag): nb_run_testcases_execution+=1 - else : - print "Unknown test case class: " + testcaseclass - sys.exit() - - except Exception, e: - error='' - error = error + ' In function: ' + sys._getframe().f_code.co_name + ': *** Caught exception: ' + str(e.__class__) + " : " + str( e) - error = error + '\n testcasename = ' + testcasename + '\n testcaseclass = ' + testcaseclass + '\n desc = ' + 'desc' + '\n' - error = error + traceback.format_exc() - print error - print "Continuing to next test case..." - -print (Fore.WHITE + " Parsing done...") - -print (Fore.WHITE + " - Total number of test cases : "+str(nb_total_testcases)) -print (Fore.WHITE + " - Total number class softmodem : "+str(nb_total_testcases_softmodem)) -print (Fore.WHITE + " - Total number class softmodem-noS1 : "+str(nb_total_testcases_softmodem_noS1)) -print (Fore.WHITE + " - Total number class compilation : "+str(nb_total_testcases_compilation)) -print (Fore.WHITE + " - Total number class execution : "+str(nb_total_testcases_execution)) -print -print (Fore.WHITE + " - Selected number of test cases : "+str(nb_run_testcases)) -print (Fore.WHITE + " - Selected class softmodem : "+str(nb_run_testcases_softmodem)) -print (Fore.WHITE + " - Selected class softmodem_noS1 : "+str(nb_run_testcases_softmodem_noS1)) -print (Fore.WHITE + " - Selected class compilation : "+str(nb_run_testcases_compilation)) -print (Fore.WHITE + " - Selected class execution : "+str(nb_run_testcases_execution)) - -# ************************************************************************** -# ************************************************************************** -# STEP 3 - TEST CAMPAIGNS -# ************************************************************************** -# ************************************************************************** - -test_results = [] - - -print (Fore.YELLOW + '\nStep 3 - TEST CAMPAIGNS') -print (Fore.YELLOW + '-------------------------------------------------') - -print (Fore.WHITE + " Start test campaign...") - -run_count = 0 -for testcase in testcaseList: - try: - testcasename = testcase.get('id') - testcaseclass = testcase.findtext('class',default='') - desc = testcase.findtext('desc',default='') - #print "Machine list top level = " + ','.join(MachineList) - - if search_test_case_group(testcasename, testcasegroup, TestCaseExclusionList) == True: - run_count+=1 - print (Fore.WHITE + " ("+str(run_count).zfill(3)+"/"+str(nb_run_testcases).zfill(3)+") - test case "+testcasename+" : "), - if testcaseclass == 'lte-softmodem' : - eNBMachine = testcase.findtext('eNB',default='') - UEMachine = testcase.findtext('UE',default='') - EPCMachine = testcase.findtext('EPC',default='') - #index_eNBMachine = MachineList.index(eNBMachine) - #index_UEMachine = MachineList.index(UEMachine) - #index_EPCMachine = MachineList.index(EPCMachine) - if (eNBMachine not in MachineList)|(UEMachine not in MachineList)|(UEMachine not in MachineList): - print "One of the machines is not in the machine list" - print "eNBMachine : " + eNBMachine + "UEMachine : " + UEMachine + "EPCMachine : " + EPCMachine + "MachineList : " + ','.join(MachineList) - print "testcasename = " + testcasename + " class = " + testcaseclass - threadListGlobal = wait_testcaseclass_generic_threads(threadListGlobal, Timeout_execution) - #cleanOldProgramsAllMachines(oai_list, CleanUpOldProgs, CleanUpAluLteBox, ExmimoRfStop) - handle_testcaseclass_softmodem (testcase, CleanUpOldProgs, logdirOAI5GRepo, logdirOpenaircnRepo, MachineList, user, pw, CleanUpAluLteBox, ExmimoRfStop, nruns_lte_softmodem, Timeout_cmd ) - - #The lines below are copied from below to trace the failure of some of the machines in test setup. These lines below need to be removed in long term - print "Creating xml file for overall results..." - cmd = "cat $OPENAIR_DIR/cmake_targets/autotests/log/*/*.xml > $OPENAIR_DIR/cmake_targets/autotests/log/results_autotests.xml " - res=os.system(cmd) - os.system('sync') - print "Now copying files to NFS Share" - oai_localhost = openair('localdomain','localhost') - oai_localhost.connect(user,pw) - cmd = ' mkdir -p ' + NFSTestsResultsDir - res = oai_localhost.send_recv(cmd) - - print "Copying files from GilabCI Runner Machine : " + host + " .locallogdir = " + locallogdir + ", NFSTestsResultsDir = " + NFSTestsResultsDir - SSHSessionWrapper('localhost', user, None, pw , NFSTestsResultsDir , locallogdir, "put_all") - oai_localhost.disconnect() - - elif testcaseclass == 'lte-softmodem-noS1' : - eNBMachine = testcase.findtext('eNB',default='') - UEMachine = testcase.findtext('UE',default='') - if (eNBMachine not in MachineList)|(UEMachine not in MachineList): - print "One of the machines is not in the machine list" - print "eNBMachine : " + eNBMachine + "UEMachine : " + UEMachine + "MachineList : " + ','.join(MachineList) - print "testcasename = " + testcasename + " class = " + testcaseclass - threadListGlobal = wait_testcaseclass_generic_threads(threadListGlobal, Timeout_execution) - - handle_testcaseclass_softmodem_noS1 (testcase, CleanUpOldProgs, logdirOAI5GRepo, logdirOpenaircnRepo, MachineList, user, pw, CleanUpAluLteBox, ExmimoRfStop, nruns_lte_softmodem, Timeout_cmd ) - - #The lines below are copied from below to trace the failure of some of the machines in test setup. These lines below need to be removed in long term - print "Creating xml file for overall results..." - cmd = "cat $OPENAIR_DIR/cmake_targets/autotests/log/*/*.xml > $OPENAIR_DIR/cmake_targets/autotests/log/results_autotests.xml " - res=os.system(cmd) - os.system('sync') - - elif (testcaseclass == 'compilation'): - threadListGlobal = handle_testcaseclass_generic (testcasename, threadListGlobal, CleanUpOldProgs, logdirOAI5GRepo, MachineListGeneric, user, pw, CleanUpAluLteBox,Timeout_execution, ExmimoRfStop) - elif (testcaseclass == 'execution'): - threadListGlobal = handle_testcaseclass_generic (testcasename, threadListGlobal, CleanUpOldProgs, logdirOAI5GRepo, MachineListGeneric, user, pw, CleanUpAluLteBox, Timeout_execution, ExmimoRfStop) - else : - print "Unknown test case class: " + testcaseclass - sys.exit() - - except Exception, e: - error='' - error = error + ' In function: ' + sys._getframe().f_code.co_name + ': *** Caught exception: ' + str(e.__class__) + " : " + str( e) - error = error + '\n testcasename = ' + testcasename + '\n testcaseclass = ' + testcaseclass + '\n desc = ' + 'desc' + '\n' - error = error + traceback.format_exc() - print error - print "Continuing to next test case..." - #sys.exit(1) - - -print "Exiting the test cases execution now. Waiting for existing threads to complete..." - -for param in threadListGlobal: - thread_id = param["thread_id"] - thread_id.join() - - -# ************************************************************************** -# ************************************************************************** -# STEP 4 - TEST REPORT PRODUCTION -# ************************************************************************** -# ************************************************************************** - - - -test_session_stop_time = datetime.datetime.now() - -print (Fore.YELLOW + '\nStep 4 - TEST REPORT PRODUCTION') -print (Fore.YELLOW + '-------------------------------------------------') - -report_dir = reportdir + '/'+ test_session_start_time.strftime("%Y-%m-%d_%H-%M")+"_"+host - -cmd = 'mkdir -p ' + report_dir -result = os.system(cmd) - -cmd = 'cp -r '+locallogdir+' '+report_dir -result = os.system(cmd) - -context = { - 'report_path' : report_dir, - 'test_session_start_time' : test_session_start_time, - 'test_session_stop_time' : test_session_stop_time, - 'test_session_duration' : test_session_stop_time-test_session_start_time, - 'mtc_host' : host, - 'user' : user, - 'password' : pw, - 'test_results' : test_results, -} - -for test_result in test_results: - cmd = 'mkdir -p ' + report_dir + '/'+ test_result['testcase_name'] - result = os.system(cmd) - - report_file = report_dir + '/'+ test_result['testcase_name'] + '/'+ test_result['testcase_name']+ '_report.html' - - analyser.create_test_report_detailed_html(test_result, report_file ) - - print test_result - - -analyser.create_report_html(context) - -exit_prog(0) - diff --git a/cmake_targets/autotests/testsuite_ue_noS1_eurecom.xml b/cmake_targets/autotests/testsuite_ue_noS1_eurecom.xml deleted file mode 100644 index 25a4a652e5..0000000000 --- a/cmake_targets/autotests/testsuite_ue_noS1_eurecom.xml +++ /dev/null @@ -1,3214 +0,0 @@ - - -imb182-desktop yanbo-M4HM87P-00 - /mnt/sradio/TEST_RESULTS/ - https://gitlab.eurecom.fr/oai/openairinterface5g.git - https://gitlab.eurecom.fr/oai/openair-cn.git --> - develop - - - - - - - - - develop - oaisim oaisim_nos1 lte-softmodem lte-softmodem-nos1 mme_gw run_epc auth_request run_hss oai_hss mme spgw hss hss_sim configure_cots* wvdial iperf iperf_script iperf_script_phone ping tshark rrh_gw iperf3 iperf3_script iperf3_script_phone pppd - sudo -S -E /opt/ltebox/tools/stop_ltebox -$OPENAIR_DIR/cmake_targets/build_oai -w EXMIMO -c; sudo -S -E $OPENAIR_DIR/cmake_targets/tools/stop_exmimo2; sudo -E $OPENAIR_DIR/cmake_targets/autotests/tools/configure_cots_bandrich_ue.py --reset-ue; sudo -E $OPENAIR_DIR/cmake_targets/autotests/tools/configure_cots_huaweiE398_ue.py --reset-ue; sudo -E $OPENAIR_DIR/cmake_targets/autotests/tools/configure_cots_sony_experia_m4_ue.py --stop-ue; uname -a; sudo -E dmesg - 36000 - - - yanbo-M4HM87P-00 - - - - - - lte-softmodem-noS1 - - imb182-desktop - yanbo-M4HM87P-00 - 300 - /tmp - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tracking_area_code \"1\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_country_code \"208\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_network_code \"95\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf N_RB_DL 25 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mme_ip_address "ipv4=\"192.168.12.26\";ipv6=\"192:168:30::17\";active=\"yes\";preference=\"ipv4\";" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf downlink_frequency 2685000000L - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf uplink_frequency_offset -120000000 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tx_gain 90 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf rx_gain 125 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf frame_type \"FDD\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_rx 1 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_tx 1 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1_MME \"eth5\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1_MME \"192.168.12.82/24\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1U \"eth5\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1U \"192.168.12.82/24\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_PORT_FOR_S1U 2152 - $OPENAIR_DIR/cmake_targets/build_oai - -c -w USRP --eNB --noS1 - source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB - - $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 - -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 0 --phy-test - - - - - False - - /tmp - - $OPENAIR_DIR/cmake_targets/build_oai - -c --UE -w USRP --noS1 --eNB - source ./targets/bin/init_nas_nos1 UE - - sleep 50; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C2685004636. -r25 --ue-scan-carrier --ue-txgain 90 -A 20 --ue-rxgain 125 -S --phy-test -g 4 - - - - - - False - - UE_USRP.NOS1.PHYTEST_PERF.BAND7.5MHZ.MCS00 - 36 - - - - lte-softmodem-noS1 - - imb182-desktop - ued-PRM-130 - 300 - /tmp - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tracking_area_code \"1\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_country_code \"208\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_network_code \"95\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf N_RB_DL 25 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mme_ip_address "ipv4=\"192.168.12.26\";ipv6=\"192:168:30::17\";active=\"yes\";preference=\"ipv4\";" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf downlink_frequency 2685000000L - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf uplink_frequency_offset -120000000 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tx_gain 90 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf rx_gain 125 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf frame_type \"FDD\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_rx 1 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_tx 1 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1_MME \"eth5\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1_MME \"192.168.12.82/24\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1U \"eth5\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1U \"192.168.12.82/24\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_PORT_FOR_S1U 2152 - $OPENAIR_DIR/cmake_targets/build_oai - -c -w USRP --eNB --noS1 - source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB - - $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 - -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 0 --phy-test - - - - - False - - /tmp - - $OPENAIR_DIR/cmake_targets/build_oai - -c --UE -w EXMIMO --noS1 - source ./targets/bin/init_nas_nos1 UE - - sleep 50; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C 2685000000 -r25 --ue-scan-carrier --ue-txgain 0 --ue-rxgain 5 -S -A 6 -F myriadRF_FMX --ue-max-power -25 --phy-test -g 4 - - - - - - False - - UE_UEDV1.NOS1.PHYTEST_PERF.BAND7.5MHZ.MCS00 - 36 - - - - lte-softmodem-noS1 - - imb182-desktop - yanbo-M4HM87P-00 - 300 - /tmp - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tracking_area_code \"1\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_country_code \"208\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_network_code \"95\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf N_RB_DL 25 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mme_ip_address "ipv4=\"192.168.12.26\";ipv6=\"192:168:30::17\";active=\"yes\";preference=\"ipv4\";" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf downlink_frequency 2685000000L - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf uplink_frequency_offset -120000000 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tx_gain 90 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf rx_gain 125 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf frame_type \"FDD\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_rx 1 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_tx 1 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1_MME \"eth5\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1_MME \"192.168.12.82/24\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1U \"eth5\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1U \"192.168.12.82/24\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_PORT_FOR_S1U 2152 - $OPENAIR_DIR/cmake_targets/build_oai - -c -w USRP --eNB --noS1 - source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB - - $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 - -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 1 --phy-test - - - - - False - - /tmp - - $OPENAIR_DIR/cmake_targets/build_oai - -c --UE -w USRP --noS1 --eNB - source ./targets/bin/init_nas_nos1 UE - - sleep 50; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C2685004636. -r25 --ue-scan-carrier --ue-txgain 90 -A 20 --ue-rxgain 125 -S --phy-test -g 4 - - - - - - False - - UE_USRP.NOS1.PHYTEST_PERF.BAND7.5MHZ.MCS01 - 36 - - - - lte-softmodem-noS1 - - imb182-desktop - ued-PRM-130 - 300 - /tmp - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tracking_area_code \"1\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_country_code \"208\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_network_code \"95\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf N_RB_DL 25 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mme_ip_address "ipv4=\"192.168.12.26\";ipv6=\"192:168:30::17\";active=\"yes\";preference=\"ipv4\";" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf downlink_frequency 2685000000L - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf uplink_frequency_offset -120000000 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tx_gain 90 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf rx_gain 125 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf frame_type \"FDD\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_rx 1 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_tx 1 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1_MME \"eth5\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1_MME \"192.168.12.82/24\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1U \"eth5\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1U \"192.168.12.82/24\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_PORT_FOR_S1U 2152 - $OPENAIR_DIR/cmake_targets/build_oai - -c -w USRP --eNB --noS1 - source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB - - $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 - -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 1 --phy-test - - - - - False - - /tmp - - $OPENAIR_DIR/cmake_targets/build_oai - -c --UE -w EXMIMO --noS1 - source ./targets/bin/init_nas_nos1 UE - - sleep 50; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C 2685000000 -r25 --ue-scan-carrier --ue-txgain 0 --ue-rxgain 5 -S -A 6 -F myriadRF_FMX --ue-max-power -25 --phy-test -g 4 - - - - - - False - - UE_UEDV1.NOS1.PHYTEST_PERF.BAND7.5MHZ.MCS01 - 36 - - - - - - - - - lte-softmodem-noS1 - - imb182-desktop - yanbo-M4HM87P-00 - 300 - /tmp - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tracking_area_code \"1\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_country_code \"208\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_network_code \"95\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf N_RB_DL 25 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mme_ip_address "ipv4=\"192.168.12.26\";ipv6=\"192:168:30::17\";active=\"yes\";preference=\"ipv4\";" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf downlink_frequency 2685000000L - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf uplink_frequency_offset -120000000 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tx_gain 90 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf rx_gain 125 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf frame_type \"FDD\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_rx 1 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_tx 1 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1_MME \"eth5\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1_MME \"192.168.12.82/24\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1U \"eth5\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1U \"192.168.12.82/24\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_PORT_FOR_S1U 2152 - $OPENAIR_DIR/cmake_targets/build_oai - -c -w USRP --eNB --noS1 - source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB - - $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 - -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 9 --phy-test - - - - - False - - /tmp - - $OPENAIR_DIR/cmake_targets/build_oai - -c --UE -w USRP --noS1 --eNB - source ./targets/bin/init_nas_nos1 UE - - sleep 50; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C2685004636. -r25 --ue-scan-carrier --ue-txgain 90 -A 20 --ue-rxgain 125 -S --phy-test -g 4 - - - - - - False - - UE_USRP.NOS1.PHYTEST_PERF.BAND7.5MHZ.MCS09 - 36 - - - - lte-softmodem-noS1 - - imb182-desktop - ued-PRM-130 - 300 - /tmp - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tracking_area_code \"1\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_country_code \"208\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_network_code \"95\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf N_RB_DL 25 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mme_ip_address "ipv4=\"192.168.12.26\";ipv6=\"192:168:30::17\";active=\"yes\";preference=\"ipv4\";" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf downlink_frequency 2685000000L - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf uplink_frequency_offset -120000000 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tx_gain 90 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf rx_gain 125 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf frame_type \"FDD\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_rx 1 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_tx 1 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1_MME \"eth5\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1_MME \"192.168.12.82/24\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1U \"eth5\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1U \"192.168.12.82/24\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_PORT_FOR_S1U 2152 - $OPENAIR_DIR/cmake_targets/build_oai - -c -w USRP --eNB --noS1 - source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB - - $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 - -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 9 --phy-test - - - - - False - - /tmp - - $OPENAIR_DIR/cmake_targets/build_oai - -c --UE -w EXMIMO --noS1 - source ./targets/bin/init_nas_nos1 UE - - sleep 50; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C 2685000000 -r25 --ue-scan-carrier --ue-txgain 0 --ue-rxgain 5 -S -A 6 -F myriadRF_FMX --ue-max-power -25 --phy-test -g 4 - - - - - - False - - UE_UEDV1.NOS1.PHYTEST_PERF.BAND7.5MHZ.MCS09 - 36 - - - - lte-softmodem-noS1 - - imb182-desktop - yanbo-M4HM87P-00 - 300 - /tmp - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tracking_area_code \"1\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_country_code \"208\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_network_code \"95\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf N_RB_DL 25 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mme_ip_address "ipv4=\"192.168.12.26\";ipv6=\"192:168:30::17\";active=\"yes\";preference=\"ipv4\";" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf downlink_frequency 2685000000L - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf uplink_frequency_offset -120000000 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tx_gain 90 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf rx_gain 125 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf frame_type \"FDD\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_rx 1 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_tx 1 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1_MME \"eth5\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1_MME \"192.168.12.82/24\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1U \"eth5\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1U \"192.168.12.82/24\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_PORT_FOR_S1U 2152 - $OPENAIR_DIR/cmake_targets/build_oai - -c -w USRP --eNB --noS1 - source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB - - $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 - -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 16 --phy-test - - - - - False - - /tmp - - $OPENAIR_DIR/cmake_targets/build_oai - -c --UE -w USRP --noS1 --eNB - source ./targets/bin/init_nas_nos1 UE - - sleep 50; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C2685004636. -r25 --ue-scan-carrier --ue-txgain 90 -A 20 --ue-rxgain 125 -S --phy-test -g 4 - - - - - - False - - UE_USRP.NOS1.PHYTEST_PERF.BAND7.5MHZ.MCS16 - 36 - - - - lte-softmodem-noS1 - - imb182-desktop - ued-PRM-130 - 300 - /tmp - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tracking_area_code \"1\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_country_code \"208\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_network_code \"95\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf N_RB_DL 25 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mme_ip_address "ipv4=\"192.168.12.26\";ipv6=\"192:168:30::17\";active=\"yes\";preference=\"ipv4\";" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf downlink_frequency 2685000000L - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf uplink_frequency_offset -120000000 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tx_gain 90 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf rx_gain 125 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf frame_type \"FDD\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_rx 1 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_tx 1 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1_MME \"eth5\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1_MME \"192.168.12.82/24\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1U \"eth5\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1U \"192.168.12.82/24\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_PORT_FOR_S1U 2152 - $OPENAIR_DIR/cmake_targets/build_oai - -c -w USRP --eNB --noS1 - source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB - - $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 - -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 16 --phy-test - - - - - False - - /tmp - - $OPENAIR_DIR/cmake_targets/build_oai - -c --UE -w EXMIMO --noS1 - source ./targets/bin/init_nas_nos1 UE - - sleep 50; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C 2685000000 -r25 --ue-scan-carrier --ue-txgain 0 --ue-rxgain 5 -S -A 6 -F myriadRF_FMX --ue-max-power -25 --phy-test -g 4 - - - - - - False - - UE_UEDV1.NOS1.PHYTEST_PERF.BAND7.5MHZ.MCS16 - 36 - - - - lte-softmodem-noS1 - - imb182-desktop - yanbo-M4HM87P-00 - 300 - /tmp - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tracking_area_code \"1\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_country_code \"208\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_network_code \"95\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf N_RB_DL 25 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mme_ip_address "ipv4=\"192.168.12.26\";ipv6=\"192:168:30::17\";active=\"yes\";preference=\"ipv4\";" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf downlink_frequency 2685000000L - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf uplink_frequency_offset -120000000 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tx_gain 90 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf rx_gain 125 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf frame_type \"FDD\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_rx 1 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_tx 1 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1_MME \"eth5\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1_MME \"192.168.12.82/24\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1U \"eth5\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1U \"192.168.12.82/24\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_PORT_FOR_S1U 2152 - $OPENAIR_DIR/cmake_targets/build_oai - -c -w USRP --eNB --noS1 - source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB - - $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 - -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 10 --phy-test - - - - - False - - /tmp - - $OPENAIR_DIR/cmake_targets/build_oai - -c --UE -w USRP --noS1 --eNB - source ./targets/bin/init_nas_nos1 UE - - sleep 50; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C2685004636. -r25 --ue-scan-carrier --ue-txgain 90 -A 20 --ue-rxgain 125 -S --phy-test -g 4 - - - - - - False - UE_USRP.NOS1.PHYTEST_PERF.BAND7.5MHZ.MCS10 - - 36 - - - - lte-softmodem-noS1 - - imb182-desktop - ued-PRM-130 - 300 - /tmp - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tracking_area_code \"1\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_country_code \"208\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_network_code \"95\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf N_RB_DL 25 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mme_ip_address "ipv4=\"192.168.12.26\";ipv6=\"192:168:30::17\";active=\"yes\";preference=\"ipv4\";" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf downlink_frequency 2685000000L - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf uplink_frequency_offset -120000000 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tx_gain 90 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf rx_gain 125 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf frame_type \"FDD\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_rx 1 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_tx 1 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1_MME \"eth5\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1_MME \"192.168.12.82/24\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1U \"eth5\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1U \"192.168.12.82/24\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_PORT_FOR_S1U 2152 - $OPENAIR_DIR/cmake_targets/build_oai - -c -w USRP --eNB --noS1 - source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB - - $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 - -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 10 --phy-test - - - - - False - - /tmp - - $OPENAIR_DIR/cmake_targets/build_oai - -c --UE -w EXMIMO --noS1 - source ./targets/bin/init_nas_nos1 UE - - sleep 50; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C 2685000000 -r25 --ue-scan-carrier --ue-txgain 0 --ue-rxgain 5 -S -A 6 -F myriadRF_FMX --ue-max-power -25 --phy-test -g 4 - - - - - - False - UE_UEDV1.NOS1.PHYTEST_PERF.BAND7.5MHZ.MCS10 - 36 - - - - - lte-softmodem-noS1 - - imb182-desktop - yanbo-M4HM87P-00 - 300 - /tmp - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tracking_area_code \"1\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_country_code \"208\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_network_code \"95\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf N_RB_DL 25 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mme_ip_address "ipv4=\"192.168.12.26\";ipv6=\"192:168:30::17\";active=\"yes\";preference=\"ipv4\";" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf downlink_frequency 2685000000L - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf uplink_frequency_offset -120000000 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tx_gain 90 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf rx_gain 125 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf frame_type \"FDD\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_rx 1 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_tx 1 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1_MME \"eth5\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1_MME \"192.168.12.82/24\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1U \"eth5\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1U \"192.168.12.82/24\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_PORT_FOR_S1U 2152 - $OPENAIR_DIR/cmake_targets/build_oai - -c -w USRP --eNB --noS1 - source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB - - $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 - -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 17 --phy-test - - - - - False - - /tmp - - $OPENAIR_DIR/cmake_targets/build_oai - -c --UE -w USRP --noS1 --eNB - source ./targets/bin/init_nas_nos1 UE - - sleep 50; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C2685004636. -r25 --ue-scan-carrier --ue-txgain 90 -A 20 --ue-rxgain 125 -S --phy-test -g 4 - - - - - - False - UE_USRP.NOS1.PHYTEST_PERF.BAND7.5MHZ.MCS17 - - 36 - - - - lte-softmodem-noS1 - - imb182-desktop - ued-PRM-130 - 300 - /tmp - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tracking_area_code \"1\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_country_code \"208\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_network_code \"95\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf N_RB_DL 25 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mme_ip_address "ipv4=\"192.168.12.26\";ipv6=\"192:168:30::17\";active=\"yes\";preference=\"ipv4\";" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf downlink_frequency 2685000000L - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf uplink_frequency_offset -120000000 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tx_gain 90 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf rx_gain 125 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf frame_type \"FDD\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_rx 1 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_tx 1 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1_MME \"eth5\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1_MME \"192.168.12.82/24\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1U \"eth5\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1U \"192.168.12.82/24\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_PORT_FOR_S1U 2152 - $OPENAIR_DIR/cmake_targets/build_oai - -c -w USRP --eNB --noS1 - source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB - - $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 - -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 17 --phy-test - - - - - False - - /tmp - - $OPENAIR_DIR/cmake_targets/build_oai - -c --UE -w EXMIMO --noS1 - source ./targets/bin/init_nas_nos1 UE - - sleep 50; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C 2685000000 -r25 --ue-scan-carrier --ue-txgain 0 --ue-rxgain 5 -S -A 6 -F myriadRF_FMX --ue-max-power -25 --phy-test -g 4 - - - - - - False - UE_UEDV1.NOS1.PHYTEST_PERF.BAND7.5MHZ.MCS17 - 36 - - - - - lte-softmodem-noS1 - - imb182-desktop - yanbo-M4HM87P-00 - 300 - /tmp - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tracking_area_code \"1\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_country_code \"208\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_network_code \"95\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf N_RB_DL 25 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mme_ip_address "ipv4=\"192.168.12.26\";ipv6=\"192:168:30::17\";active=\"yes\";preference=\"ipv4\";" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf downlink_frequency 2685000000L - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf uplink_frequency_offset -120000000 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tx_gain 90 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf rx_gain 125 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf frame_type \"FDD\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_rx 1 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_tx 1 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1_MME \"eth5\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1_MME \"192.168.12.82/24\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1U \"eth5\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1U \"192.168.12.82/24\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_PORT_FOR_S1U 2152 - $OPENAIR_DIR/cmake_targets/build_oai - -c -w USRP --eNB --noS1 - source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB - - $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 - -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 18 --phy-test - - - - - False - - /tmp - - $OPENAIR_DIR/cmake_targets/build_oai - -c --UE -w USRP --noS1 --eNB - source ./targets/bin/init_nas_nos1 UE - - sleep 50; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C2685004636. -r25 --ue-scan-carrier --ue-txgain 90 -A 20 --ue-rxgain 125 -S --phy-test -g 4 - - - - - - False - UE_USRP.NOS1.PHYTEST_PERF.BAND7.5MHZ.MCS18 - - 36 - - - - lte-softmodem-noS1 - - imb182-desktop - ued-PRM-130 - 300 - /tmp - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tracking_area_code \"1\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_country_code \"208\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_network_code \"95\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf N_RB_DL 25 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mme_ip_address "ipv4=\"192.168.12.26\";ipv6=\"192:168:30::17\";active=\"yes\";preference=\"ipv4\";" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf downlink_frequency 2685000000L - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf uplink_frequency_offset -120000000 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tx_gain 90 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf rx_gain 125 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf frame_type \"FDD\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_rx 1 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_tx 1 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1_MME \"eth5\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1_MME \"192.168.12.82/24\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1U \"eth5\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1U \"192.168.12.82/24\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_PORT_FOR_S1U 2152 - $OPENAIR_DIR/cmake_targets/build_oai - -c -w USRP --eNB --noS1 - source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB - - $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 - -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 18 --phy-test - - - - - False - - /tmp - - $OPENAIR_DIR/cmake_targets/build_oai - -c --UE -w EXMIMO --noS1 - source ./targets/bin/init_nas_nos1 UE - - sleep 50; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C 2685000000 -r25 --ue-scan-carrier --ue-txgain 0 --ue-rxgain 5 -S -A 6 -F myriadRF_FMX --ue-max-power -25 --phy-test -g 4 - - - - - - False - UE_UEDV1.NOS1.PHYTEST_PERF.BAND7.5MHZ.MCS18 - 36 - - - - - lte-softmodem-noS1 - - imb182-desktop - yanbo-M4HM87P-00 - 300 - /tmp - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tracking_area_code \"1\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_country_code \"208\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_network_code \"95\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf N_RB_DL 25 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mme_ip_address "ipv4=\"192.168.12.26\";ipv6=\"192:168:30::17\";active=\"yes\";preference=\"ipv4\";" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf downlink_frequency 2685000000L - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf uplink_frequency_offset -120000000 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tx_gain 90 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf rx_gain 125 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf frame_type \"FDD\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_rx 1 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_tx 1 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1_MME \"eth5\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1_MME \"192.168.12.82/24\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1U \"eth5\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1U \"192.168.12.82/24\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_PORT_FOR_S1U 2152 - $OPENAIR_DIR/cmake_targets/build_oai - -c -w USRP --eNB --noS1 - source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB - - $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 - -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 19 --phy-test - - - - - False - - /tmp - - $OPENAIR_DIR/cmake_targets/build_oai - -c --UE -w USRP --noS1 --eNB - source ./targets/bin/init_nas_nos1 UE - - sleep 50; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C2685004636. -r25 --ue-scan-carrier --ue-txgain 90 -A 20 --ue-rxgain 125 -S --phy-test -g 4 - - - - - - False - UE_USRP.NOS1.PHYTEST_PERF.BAND7.5MHZ.MCS19 - - 36 - - - - lte-softmodem-noS1 - - imb182-desktop - ued-PRM-130 - 300 - /tmp - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tracking_area_code \"1\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_country_code \"208\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_network_code \"95\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf N_RB_DL 25 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mme_ip_address "ipv4=\"192.168.12.26\";ipv6=\"192:168:30::17\";active=\"yes\";preference=\"ipv4\";" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf downlink_frequency 2685000000L - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf uplink_frequency_offset -120000000 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tx_gain 90 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf rx_gain 125 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf frame_type \"FDD\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_rx 1 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_tx 1 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1_MME \"eth5\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1_MME \"192.168.12.82/24\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1U \"eth5\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1U \"192.168.12.82/24\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_PORT_FOR_S1U 2152 - $OPENAIR_DIR/cmake_targets/build_oai - -c -w USRP --eNB --noS1 - source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB - - $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 - -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 19 --phy-test - - - - - False - - /tmp - - $OPENAIR_DIR/cmake_targets/build_oai - -c --UE -w EXMIMO --noS1 - source ./targets/bin/init_nas_nos1 UE - - sleep 50; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C 2685000000 -r25 --ue-scan-carrier --ue-txgain 0 --ue-rxgain 5 -S -A 6 -F myriadRF_FMX --ue-max-power -25 --phy-test -g 4 - - - - - - False - UE_UEDV1.NOS1.PHYTEST_PERF.BAND7.5MHZ.MCS19 - 36 - - - - - - lte-softmodem-noS1 - - imb182-desktop - yanbo-M4HM87P-00 - 300 - /tmp - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tracking_area_code \"1\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_country_code \"208\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_network_code \"95\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf N_RB_DL 25 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mme_ip_address "ipv4=\"192.168.12.26\";ipv6=\"192:168:30::17\";active=\"yes\";preference=\"ipv4\";" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf downlink_frequency 2685000000L - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf uplink_frequency_offset -120000000 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tx_gain 90 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf rx_gain 125 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf frame_type \"FDD\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_rx 1 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_tx 1 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1_MME \"eth5\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1_MME \"192.168.12.82/24\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1U \"eth5\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1U \"192.168.12.82/24\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_PORT_FOR_S1U 2152 - $OPENAIR_DIR/cmake_targets/build_oai - -c -w USRP --eNB --noS1 - source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB - - $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 - -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 20 --phy-test - - - - - False - - /tmp - - $OPENAIR_DIR/cmake_targets/build_oai - -c --UE -w USRP --noS1 --eNB - source ./targets/bin/init_nas_nos1 UE - - sleep 50; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C2685004636. -r25 --ue-scan-carrier --ue-txgain 90 -A 20 --ue-rxgain 125 -S --phy-test -g 4 - - - - - - False - UE_USRP.NOS1.PHYTEST_PERF.BAND7.5MHZ.MCS20 - - 36 - - - - lte-softmodem-noS1 - - imb182-desktop - ued-PRM-130 - 300 - /tmp - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tracking_area_code \"1\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_country_code \"208\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_network_code \"95\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf N_RB_DL 25 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mme_ip_address "ipv4=\"192.168.12.26\";ipv6=\"192:168:30::17\";active=\"yes\";preference=\"ipv4\";" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf downlink_frequency 2685000000L - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf uplink_frequency_offset -120000000 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tx_gain 90 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf rx_gain 125 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf frame_type \"FDD\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_rx 1 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_tx 1 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1_MME \"eth5\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1_MME \"192.168.12.82/24\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1U \"eth5\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1U \"192.168.12.82/24\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_PORT_FOR_S1U 2152 - $OPENAIR_DIR/cmake_targets/build_oai - -c -w USRP --eNB --noS1 - source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB - - $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 - -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 20 --phy-test - - - - - False - - /tmp - - $OPENAIR_DIR/cmake_targets/build_oai - -c --UE -w EXMIMO --noS1 - source ./targets/bin/init_nas_nos1 UE - - sleep 50; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C 2685000000 -r25 --ue-scan-carrier --ue-txgain 0 --ue-rxgain 5 -S -A 6 -F myriadRF_FMX --ue-max-power -25 --phy-test -g 4 - - - - - - False - UE_UEDV1.NOS1.PHYTEST_PERF.BAND7.5MHZ.MCS20 - 36 - - - - - lte-softmodem-noS1 - - imb182-desktop - yanbo-M4HM87P-00 - 300 - /tmp - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tracking_area_code \"1\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_country_code \"208\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_network_code \"95\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf N_RB_DL 25 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mme_ip_address "ipv4=\"192.168.12.26\";ipv6=\"192:168:30::17\";active=\"yes\";preference=\"ipv4\";" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf downlink_frequency 2685000000L - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf uplink_frequency_offset -120000000 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tx_gain 90 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf rx_gain 125 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf frame_type \"FDD\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_rx 1 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_tx 1 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1_MME \"eth5\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1_MME \"192.168.12.82/24\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1U \"eth5\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1U \"192.168.12.82/24\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_PORT_FOR_S1U 2152 - $OPENAIR_DIR/cmake_targets/build_oai - -c -w USRP --eNB --noS1 - source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB - - $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 - -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 21 --phy-test - - - - - False - - /tmp - - $OPENAIR_DIR/cmake_targets/build_oai - -c --UE -w USRP --noS1 --eNB - source ./targets/bin/init_nas_nos1 UE - - sleep 50; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C2685004636. -r25 --ue-scan-carrier --ue-txgain 90 -A 20 --ue-rxgain 125 -S --phy-test -g 4 - - - - - - False - UE_USRP.NOS1.PHYTEST_PERF.BAND7.5MHZ.MCS21 - 36 - - - - - lte-softmodem-noS1 - - imb182-desktop - ued-PRM-130 - 300 - /tmp - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tracking_area_code \"1\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_country_code \"208\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_network_code \"95\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf N_RB_DL 25 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mme_ip_address "ipv4=\"192.168.12.26\";ipv6=\"192:168:30::17\";active=\"yes\";preference=\"ipv4\";" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf downlink_frequency 2685000000L - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf uplink_frequency_offset -120000000 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tx_gain 90 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf rx_gain 125 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf frame_type \"FDD\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_rx 1 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_tx 1 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1_MME \"eth5\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1_MME \"192.168.12.82/24\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1U \"eth5\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1U \"192.168.12.82/24\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_PORT_FOR_S1U 2152 - $OPENAIR_DIR/cmake_targets/build_oai - -c -w USRP --eNB --noS1 - source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB - - $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 - -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 21 --phy-test - - - - - False - - /tmp - - $OPENAIR_DIR/cmake_targets/build_oai - -c --UE -w EXMIMO --noS1 - source ./targets/bin/init_nas_nos1 UE - - sleep 50; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C 2685000000 -r25 --ue-scan-carrier --ue-txgain 0 --ue-rxgain 5 -S -A 6 -F myriadRF_FMX --ue-max-power -25 --phy-test -g 4 - - - - - - False - UE_UEDV1.NOS1.PHYTEST_PERF.BAND7.5MHZ.MCS21 - 36 - - - - - lte-softmodem-noS1 - - imb182-desktop - yanbo-M4HM87P-00 - 300 - /tmp - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tracking_area_code \"1\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_country_code \"208\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_network_code \"95\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf N_RB_DL 25 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mme_ip_address "ipv4=\"192.168.12.26\";ipv6=\"192:168:30::17\";active=\"yes\";preference=\"ipv4\";" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf downlink_frequency 2685000000L - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf uplink_frequency_offset -120000000 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tx_gain 90 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf rx_gain 125 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf frame_type \"FDD\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_rx 1 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_tx 1 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1_MME \"eth5\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1_MME \"192.168.12.82/24\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1U \"eth5\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1U \"192.168.12.82/24\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_PORT_FOR_S1U 2152 - $OPENAIR_DIR/cmake_targets/build_oai - -c -w USRP --eNB --noS1 - source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB - - $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 - -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 22 --phy-test - - - - - False - - /tmp - - $OPENAIR_DIR/cmake_targets/build_oai - -c --UE -w USRP --noS1 --eNB - source ./targets/bin/init_nas_nos1 UE - - sleep 50; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C2685004636. -r25 --ue-scan-carrier --ue-txgain 90 -A 20 --ue-rxgain 125 -S --phy-test -g 4 - - - - - - False - UE_USRP.NOS1.PHYTEST_PERF.BAND7.5MHZ.MCS22 - - 36 - - - - lte-softmodem-noS1 - - imb182-desktop - ued-PRM-130 - 300 - /tmp - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tracking_area_code \"1\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_country_code \"208\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_network_code \"95\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf N_RB_DL 25 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mme_ip_address "ipv4=\"192.168.12.26\";ipv6=\"192:168:30::17\";active=\"yes\";preference=\"ipv4\";" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf downlink_frequency 2685000000L - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf uplink_frequency_offset -120000000 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tx_gain 90 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf rx_gain 125 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf frame_type \"FDD\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_rx 1 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_tx 1 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1_MME \"eth5\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1_MME \"192.168.12.82/24\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1U \"eth5\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1U \"192.168.12.82/24\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_PORT_FOR_S1U 2152 - $OPENAIR_DIR/cmake_targets/build_oai - -c -w USRP --eNB --noS1 - source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB - - $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 - -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 22 --phy-test - - - - - False - - /tmp - - $OPENAIR_DIR/cmake_targets/build_oai - -c --UE -w EXMIMO --noS1 - source ./targets/bin/init_nas_nos1 UE - - sleep 50; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C 2685000000 -r25 --ue-scan-carrier --ue-txgain 0 --ue-rxgain 5 -S -A 6 -F myriadRF_FMX --ue-max-power -25 --phy-test -g 4 - - - - - - False - UE_UEDV1.NOS1.PHYTEST_PERF.BAND7.5MHZ.MCS22 - 36 - - - - - lte-softmodem-noS1 - - imb182-desktop - yanbo-M4HM87P-00 - 300 - /tmp - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tracking_area_code \"1\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_country_code \"208\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_network_code \"95\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf N_RB_DL 25 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mme_ip_address "ipv4=\"192.168.12.26\";ipv6=\"192:168:30::17\";active=\"yes\";preference=\"ipv4\";" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf downlink_frequency 2685000000L - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf uplink_frequency_offset -120000000 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tx_gain 90 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf rx_gain 125 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf frame_type \"FDD\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_rx 1 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_tx 1 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1_MME \"eth5\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1_MME \"192.168.12.82/24\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1U \"eth5\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1U \"192.168.12.82/24\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_PORT_FOR_S1U 2152 - $OPENAIR_DIR/cmake_targets/build_oai - -c -w USRP --eNB --noS1 - source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB - - $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 - -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 23 --phy-test - - - - - False - - /tmp - - $OPENAIR_DIR/cmake_targets/build_oai - -c --UE -w USRP --noS1 --eNB - source ./targets/bin/init_nas_nos1 UE - - sleep 50; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C2685004636. -r25 --ue-scan-carrier --ue-txgain 90 -A 20 --ue-rxgain 125 -S --phy-test -g 4 - - - - - - False - UE_USRP.NOS1.PHYTEST_PERF.BAND7.5MHZ.MCS23 - 36 - - - - - lte-softmodem-noS1 - - imb182-desktop - ued-PRM-130 - 300 - /tmp - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tracking_area_code \"1\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_country_code \"208\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_network_code \"95\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf N_RB_DL 25 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mme_ip_address "ipv4=\"192.168.12.26\";ipv6=\"192:168:30::17\";active=\"yes\";preference=\"ipv4\";" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf downlink_frequency 2685000000L - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf uplink_frequency_offset -120000000 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tx_gain 90 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf rx_gain 125 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf frame_type \"FDD\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_rx 1 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_tx 1 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1_MME \"eth5\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1_MME \"192.168.12.82/24\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1U \"eth5\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1U \"192.168.12.82/24\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_PORT_FOR_S1U 2152 - $OPENAIR_DIR/cmake_targets/build_oai - -c -w USRP --eNB --noS1 - source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB - - $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 - -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 23 --phy-test - - - - - False - - /tmp - - $OPENAIR_DIR/cmake_targets/build_oai - -c --UE -w EXMIMO --noS1 - source ./targets/bin/init_nas_nos1 UE - - sleep 50; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C 2685000000 -r25 --ue-scan-carrier --ue-txgain 0 --ue-rxgain 5 -S -A 6 -F myriadRF_FMX --ue-max-power -25 --phy-test -g 4 - - - - - - False - UE_UEDV1.NOS1.PHYTEST_PERF.BAND7.5MHZ.MCS23 - 36 - - - - - lte-softmodem-noS1 - - imb182-desktop - yanbo-M4HM87P-00 - 300 - /tmp - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tracking_area_code \"1\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_country_code \"208\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_network_code \"95\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf N_RB_DL 25 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mme_ip_address "ipv4=\"192.168.12.26\";ipv6=\"192:168:30::17\";active=\"yes\";preference=\"ipv4\";" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf downlink_frequency 2685000000L - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf uplink_frequency_offset -120000000 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tx_gain 90 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf rx_gain 125 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf frame_type \"FDD\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_rx 1 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_tx 1 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1_MME \"eth5\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1_MME \"192.168.12.82/24\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1U \"eth5\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1U \"192.168.12.82/24\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_PORT_FOR_S1U 2152 - $OPENAIR_DIR/cmake_targets/build_oai - -c -w USRP --eNB --noS1 - source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB - - $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 - -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 24 --phy-test - - - - - False - - /tmp - - $OPENAIR_DIR/cmake_targets/build_oai - -c --UE -w USRP --noS1 --eNB - source ./targets/bin/init_nas_nos1 UE - - sleep 50; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C2685004636. -r25 --ue-scan-carrier --ue-txgain 90 -A 20 --ue-rxgain 125 -S --phy-test -g 4 - - - - - - False - UE_USRP.NOS1.PHYTEST_PERF.BAND7.5MHZ.MCS24 - 36 - - - - - lte-softmodem-noS1 - - imb182-desktop - ued-PRM-130 - 300 - /tmp - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tracking_area_code \"1\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_country_code \"208\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_network_code \"95\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf N_RB_DL 25 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mme_ip_address "ipv4=\"192.168.12.26\";ipv6=\"192:168:30::17\";active=\"yes\";preference=\"ipv4\";" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf downlink_frequency 2685000000L - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf uplink_frequency_offset -120000000 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tx_gain 90 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf rx_gain 125 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf frame_type \"FDD\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_rx 1 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_tx 1 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1_MME \"eth5\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1_MME \"192.168.12.82/24\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1U \"eth5\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1U \"192.168.12.82/24\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_PORT_FOR_S1U 2152 - $OPENAIR_DIR/cmake_targets/build_oai - -c -w USRP --eNB --noS1 - source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB - - $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 - -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 24 --phy-test - - - - - False - - /tmp - - $OPENAIR_DIR/cmake_targets/build_oai - -c --UE -w EXMIMO --noS1 - source ./targets/bin/init_nas_nos1 UE - - sleep 50; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C 2685000000 -r25 --ue-scan-carrier --ue-txgain 0 --ue-rxgain 5 -S -A 6 -F myriadRF_FMX --ue-max-power -25 --phy-test -g 4 - - - - - - False - UE_UEDV1.NOS1.PHYTEST_PERF.BAND7.5MHZ.MCS24 - 36 - - - - - - lte-softmodem-noS1 - - imb182-desktop - yanbo-M4HM87P-00 - 300 - /tmp - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tracking_area_code \"1\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_country_code \"208\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_network_code \"95\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf N_RB_DL 25 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mme_ip_address "ipv4=\"192.168.12.26\";ipv6=\"192:168:30::17\";active=\"yes\";preference=\"ipv4\";" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf downlink_frequency 2685000000L - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf uplink_frequency_offset -120000000 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tx_gain 90 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf rx_gain 125 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf frame_type \"FDD\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_rx 1 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_tx 1 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1_MME \"eth5\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1_MME \"192.168.12.82/24\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1U \"eth5\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1U \"192.168.12.82/24\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_PORT_FOR_S1U 2152 - $OPENAIR_DIR/cmake_targets/build_oai - -c -w USRP --eNB --noS1 - source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB - - $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 - -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 25 --phy-test - - - - - False - - /tmp - - $OPENAIR_DIR/cmake_targets/build_oai - -c --UE -w USRP --noS1 --eNB - source ./targets/bin/init_nas_nos1 UE - - sleep 50; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C2685004636. -r25 --ue-scan-carrier --ue-txgain 90 -A 20 --ue-rxgain 125 -S --phy-test -g 4 - - - - - - False - UE_USRP.NOS1.PHYTEST_PERF.BAND7.5MHZ.MCS25 - 36 - - - - - lte-softmodem-noS1 - - imb182-desktop - ued-PRM-130 - 300 - /tmp - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tracking_area_code \"1\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_country_code \"208\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_network_code \"95\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf N_RB_DL 25 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mme_ip_address "ipv4=\"192.168.12.26\";ipv6=\"192:168:30::17\";active=\"yes\";preference=\"ipv4\";" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf downlink_frequency 2685000000L - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf uplink_frequency_offset -120000000 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tx_gain 90 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf rx_gain 125 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf frame_type \"FDD\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_rx 1 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_tx 1 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1_MME \"eth5\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1_MME \"192.168.12.82/24\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1U \"eth5\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1U \"192.168.12.82/24\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_PORT_FOR_S1U 2152 - $OPENAIR_DIR/cmake_targets/build_oai - -c -w USRP --eNB --noS1 - source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB - - $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 - -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 25 --phy-test - - - - - False - - /tmp - - $OPENAIR_DIR/cmake_targets/build_oai - -c --UE -w EXMIMO --noS1 - source ./targets/bin/init_nas_nos1 UE - - sleep 50; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C 2685000000 -r25 --ue-scan-carrier --ue-txgain 0 --ue-rxgain 5 -S -A 6 -F myriadRF_FMX --ue-max-power -25 --phy-test -g 4 - - - - - - False - UE_UEDV1.NOS1.PHYTEST_PERF.BAND7.5MHZ.MCS25 - 36 - - - - - lte-softmodem-noS1 - - imb182-desktop - yanbo-M4HM87P-00 - 300 - /tmp - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tracking_area_code \"1\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_country_code \"208\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_network_code \"95\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf N_RB_DL 25 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mme_ip_address "ipv4=\"192.168.12.26\";ipv6=\"192:168:30::17\";active=\"yes\";preference=\"ipv4\";" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf downlink_frequency 2685000000L - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf uplink_frequency_offset -120000000 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tx_gain 90 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf rx_gain 125 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf frame_type \"FDD\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_rx 1 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_tx 1 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1_MME \"eth5\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1_MME \"192.168.12.82/24\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1U \"eth5\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1U \"192.168.12.82/24\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_PORT_FOR_S1U 2152 - $OPENAIR_DIR/cmake_targets/build_oai - -c -w USRP --eNB --noS1 - source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB - - $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 - -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 26 --phy-test - - - - - False - - /tmp - - $OPENAIR_DIR/cmake_targets/build_oai - -c --UE -w USRP --noS1 --eNB - source ./targets/bin/init_nas_nos1 UE - - sleep 50; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C2685004636. -r25 --ue-scan-carrier --ue-txgain 90 -A 20 --ue-rxgain 125 -S --phy-test -g 4 - - - - - - False - UE_USRP.NOS1.PHYTEST_PERF.BAND7.5MHZ.MCS26 - 36 - - - - - lte-softmodem-noS1 - - imb182-desktop - ued-PRM-130 - 300 - /tmp - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tracking_area_code \"1\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_country_code \"208\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_network_code \"95\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf N_RB_DL 25 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mme_ip_address "ipv4=\"192.168.12.26\";ipv6=\"192:168:30::17\";active=\"yes\";preference=\"ipv4\";" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf downlink_frequency 2685000000L - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf uplink_frequency_offset -120000000 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tx_gain 90 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf rx_gain 125 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf frame_type \"FDD\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_rx 1 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_tx 1 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1_MME \"eth5\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1_MME \"192.168.12.82/24\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1U \"eth5\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1U \"192.168.12.82/24\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_PORT_FOR_S1U 2152 - $OPENAIR_DIR/cmake_targets/build_oai - -c -w USRP --eNB --noS1 - source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB - - $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 - -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 26 --phy-test - - - - - False - - /tmp - - $OPENAIR_DIR/cmake_targets/build_oai - -c --UE -w EXMIMO --noS1 - source ./targets/bin/init_nas_nos1 UE - - sleep 50; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C 2685000000 -r25 --ue-scan-carrier --ue-txgain 0 --ue-rxgain 5 -S -A 6 -F myriadRF_FMX --ue-max-power -25 --phy-test -g 4 - - - - - - False - UE_UEDV1.NOS1.PHYTEST_PERF.BAND7.5MHZ.MCS26 - 36 - - - - - lte-softmodem-noS1 - - imb182-desktop - yanbo-M4HM87P-00 - 300 - /tmp - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tracking_area_code \"1\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_country_code \"208\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_network_code \"95\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf N_RB_DL 25 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mme_ip_address "ipv4=\"192.168.12.26\";ipv6=\"192:168:30::17\";active=\"yes\";preference=\"ipv4\";" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf downlink_frequency 2685000000L - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf uplink_frequency_offset -120000000 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tx_gain 90 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf rx_gain 125 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf frame_type \"FDD\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_rx 1 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_tx 1 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1_MME \"eth5\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1_MME \"192.168.12.82/24\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1U \"eth5\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1U \"192.168.12.82/24\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_PORT_FOR_S1U 2152 - $OPENAIR_DIR/cmake_targets/build_oai - -c -w USRP --eNB --noS1 - source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB - - $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 - -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 27 --phy-test - - - - - False - - /tmp - - $OPENAIR_DIR/cmake_targets/build_oai - -c --UE -w USRP --noS1 --eNB - source ./targets/bin/init_nas_nos1 UE - - sleep 50; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C2685004636. -r25 --ue-scan-carrier --ue-txgain 90 -A 20 --ue-rxgain 125 -S --phy-test -g 4 - - - - - - False - UE_USRP.NOS1.PHYTEST_PERF.BAND7.5MHZ.MCS27 - 36 - - - - - lte-softmodem-noS1 - - imb182-desktop - ued-PRM-130 - 300 - /tmp - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tracking_area_code \"1\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_country_code \"208\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_network_code \"95\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf N_RB_DL 25 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mme_ip_address "ipv4=\"192.168.12.26\";ipv6=\"192:168:30::17\";active=\"yes\";preference=\"ipv4\";" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf downlink_frequency 2685000000L - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf uplink_frequency_offset -120000000 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tx_gain 90 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf rx_gain 125 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf frame_type \"FDD\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_rx 1 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_tx 1 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1_MME \"eth5\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1_MME \"192.168.12.82/24\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1U \"eth5\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1U \"192.168.12.82/24\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_PORT_FOR_S1U 2152 - $OPENAIR_DIR/cmake_targets/build_oai - -c -w USRP --eNB --noS1 - source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB - - $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 - -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 27 --phy-test - - - - - False - - /tmp - - $OPENAIR_DIR/cmake_targets/build_oai - -c --UE -w EXMIMO --noS1 - source ./targets/bin/init_nas_nos1 UE - - sleep 50; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C 2685000000 -r25 --ue-scan-carrier --ue-txgain 0 --ue-rxgain 5 -S -A 6 -F myriadRF_FMX --ue-max-power -25 --phy-test -g 4 - - - - - - False - UE_UEDV1.NOS1.PHYTEST_PERF.BAND7.5MHZ.MCS27 - 36 - - - - - lte-softmodem-noS1 - - imb182-desktop - yanbo-M4HM87P-00 - 300 - /tmp - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tracking_area_code \"1\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_country_code \"208\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_network_code \"95\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf N_RB_DL 25 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mme_ip_address "ipv4=\"192.168.12.26\";ipv6=\"192:168:30::17\";active=\"yes\";preference=\"ipv4\";" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf downlink_frequency 2685000000L - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf uplink_frequency_offset -120000000 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tx_gain 90 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf rx_gain 125 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf frame_type \"FDD\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_rx 1 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_tx 1 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1_MME \"eth5\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1_MME \"192.168.12.82/24\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1U \"eth5\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1U \"192.168.12.82/24\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_PORT_FOR_S1U 2152 - $OPENAIR_DIR/cmake_targets/build_oai - -c -w USRP --eNB --noS1 - source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB - - $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 - -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 28 --phy-test - - - - - False - - /tmp - - $OPENAIR_DIR/cmake_targets/build_oai - -c --UE -w USRP --noS1 --eNB - source ./targets/bin/init_nas_nos1 UE - - sleep 50; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C2685004636. -r25 --ue-scan-carrier --ue-txgain 90 -A 20 --ue-rxgain 125 -S --phy-test -g 4 - - - - - - False - UE_USRP.NOS1.PHYTEST_PERF.BAND7.5MHZ.MCS28 - 36 - - - - - lte-softmodem-noS1 - - imb182-desktop - ued-PRM-130 - 300 - /tmp - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tracking_area_code \"1\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_country_code \"208\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_network_code \"95\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf N_RB_DL 25 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mme_ip_address "ipv4=\"192.168.12.26\";ipv6=\"192:168:30::17\";active=\"yes\";preference=\"ipv4\";" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf downlink_frequency 2685000000L - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf uplink_frequency_offset -120000000 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tx_gain 90 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf rx_gain 125 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf frame_type \"FDD\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_rx 1 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_tx 1 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1_MME \"eth5\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1_MME \"192.168.12.82/24\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1U \"eth5\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1U \"192.168.12.82/24\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_PORT_FOR_S1U 2152 - $OPENAIR_DIR/cmake_targets/build_oai - -c -w USRP --eNB --noS1 - source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB - - $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 - -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 28 --phy-test - - - - - False - - /tmp - - $OPENAIR_DIR/cmake_targets/build_oai - -c --UE -w EXMIMO --noS1 - source ./targets/bin/init_nas_nos1 UE - - sleep 50; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C 2685000000 -r25 --ue-scan-carrier --ue-txgain 0 --ue-rxgain 5 -S -A 6 -F myriadRF_FMX --ue-max-power -25 --phy-test -g 4 - - - - - - False - UE_UEDV1.NOS1.PHYTEST_PERF.BAND7.5MHZ.MCS28 - 36 - - - - - - lte-softmodem-noS1 - - imb182-desktop - yanbo-M4HM87P-00 - 18000 - /tmp - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tracking_area_code \"1\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_country_code \"208\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_network_code \"95\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf N_RB_DL 25 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mme_ip_address "ipv4=\"192.168.12.26\";ipv6=\"192:168:30::17\";active=\"yes\";preference=\"ipv4\";" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf downlink_frequency 2685000000L - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf uplink_frequency_offset -120000000 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tx_gain 90 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf rx_gain 125 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf frame_type \"FDD\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_rx 1 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_tx 1 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1_MME \"eth5\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1_MME \"192.168.12.82/24\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1U \"eth5\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1U \"192.168.12.82/24\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_PORT_FOR_S1U 2152 - $OPENAIR_DIR/cmake_targets/build_oai - -c -w USRP --eNB --noS1 - source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB - - $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 - -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 27 --phy-test - - - - - False - - /tmp - - $OPENAIR_DIR/cmake_targets/build_oai - -c --UE -w USRP --noS1 --eNB - source ./targets/bin/init_nas_nos1 UE - - sleep 50; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C2685004636. -r25 --ue-scan-carrier --ue-txgain 90 -A 20 --ue-rxgain 125 -S --phy-test -g 4 - - - - - - False - UE_USRP.NOS1.PHYTEST_STAB.BAND7.5MHZ.MCS27 - 36 - - - - - lte-softmodem-noS1 - - imb182-desktop - ued-PRM-130 - 300 - /tmp - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tracking_area_code \"1\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_country_code \"208\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_network_code \"95\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf N_RB_DL 25 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mme_ip_address "ipv4=\"192.168.12.26\";ipv6=\"192:168:30::17\";active=\"yes\";preference=\"ipv4\";" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf downlink_frequency 2685000000L - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf uplink_frequency_offset -120000000 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tx_gain 90 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf rx_gain 125 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf frame_type \"FDD\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_rx 1 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_tx 1 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1_MME \"eth5\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1_MME \"192.168.12.82/24\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1U \"eth5\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1U \"192.168.12.82/24\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_PORT_FOR_S1U 2152 - $OPENAIR_DIR/cmake_targets/build_oai - -c -w USRP --eNB --noS1 - source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB - - $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 - -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 27 --phy-test - - - - - False - - /tmp - - $OPENAIR_DIR/cmake_targets/build_oai - -c --UE -w EXMIMO --noS1 - source ./targets/bin/init_nas_nos1 UE - - sleep 50; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C 2685000000 -r25 --ue-scan-carrier --ue-txgain 0 --ue-rxgain 5 -S -A 6 -F myriadRF_FMX --ue-max-power -25 --phy-test -g 4 - - - - - - False - UE_UEDV1.NOS1.PHYTEST_STAB.BAND7.5MHZ.MCS27 - 36 - - - - - - lte-softmodem-noS1 - - imb182-desktop - yanbo-M4HM87P-00 - 300 - /tmp - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tracking_area_code \"1\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_country_code \"208\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_network_code \"95\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf N_RB_DL 50 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mme_ip_address "ipv4=\"192.168.12.26\";ipv6=\"192:168:30::17\";active=\"yes\";preference=\"ipv4\";" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf downlink_frequency 2685000000L - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf uplink_frequency_offset -120000000 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tx_gain 90 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf rx_gain 125 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf frame_type \"FDD\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_rx 1 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_tx 1 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1_MME \"eth5\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1_MME \"192.168.12.82/24\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1U \"eth5\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1U \"192.168.12.82/24\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_PORT_FOR_S1U 2152 - $OPENAIR_DIR/cmake_targets/build_oai - -c -w USRP --eNB --noS1 - source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB - - $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 - -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 27 --phy-test - - - - - False - - /tmp - - $OPENAIR_DIR/cmake_targets/build_oai - -c --UE -w USRP --noS1 --eNB - source ./targets/bin/init_nas_nos1 UE - - sleep 50; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C2685004636. -r50 --ue-scan-carrier --ue-txgain 90 -A 20 --ue-rxgain 125 -S --phy-test -g 4 - - - - - - False - UE_USRP.NOS1.PHYTEST_PERF.BAND7.10MHZ.MCS27 - 36 - - - - - lte-softmodem-noS1 - - imb182-desktop - ued-PRM-130 - 300 - /tmp - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tracking_area_code \"1\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_country_code \"208\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_network_code \"95\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf N_RB_DL 50 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mme_ip_address "ipv4=\"192.168.12.26\";ipv6=\"192:168:30::17\";active=\"yes\";preference=\"ipv4\";" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf downlink_frequency 2685000000L - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf uplink_frequency_offset -120000000 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tx_gain 90 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf rx_gain 125 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf frame_type \"FDD\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_rx 1 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_tx 1 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1_MME \"eth5\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1_MME \"192.168.12.82/24\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1U \"eth5\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1U \"192.168.12.82/24\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_PORT_FOR_S1U 2152 - $OPENAIR_DIR/cmake_targets/build_oai - -c -w USRP --eNB --noS1 - source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB - - $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 - -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 27 --phy-test - - - - - False - - /tmp - - $OPENAIR_DIR/cmake_targets/build_oai - -c --UE -w EXMIMO --noS1 - source ./targets/bin/init_nas_nos1 UE - - sleep 50; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C 2685000000 -r50 --ue-scan-carrier --ue-txgain 0 --ue-rxgain 5 -S -A 6 -F myriadRF_FMX --ue-max-power -25 --phy-test -g 4 - - - - - - False - UE_UEDV1.NOS1.PHYTEST_PERF.BAND7.10MHZ.MCS27 - 36 - - - - - - lte-softmodem-noS1 - - imb182-desktop - yanbo-M4HM87P-00 - 300 - /tmp - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tracking_area_code \"1\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_country_code \"208\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_network_code \"95\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf N_RB_DL 50 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mme_ip_address "ipv4=\"192.168.12.26\";ipv6=\"192:168:30::17\";active=\"yes\";preference=\"ipv4\";" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf downlink_frequency 2685000000L - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf uplink_frequency_offset -120000000 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tx_gain 90 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf rx_gain 125 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf frame_type \"FDD\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_rx 1 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_tx 1 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1_MME \"eth5\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1_MME \"192.168.12.82/24\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1U \"eth5\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1U \"192.168.12.82/24\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_PORT_FOR_S1U 2152 - $OPENAIR_DIR/cmake_targets/build_oai - -c -w USRP --eNB --noS1 - source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB - - $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 - -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 28 --phy-test - - - - - False - - /tmp - - $OPENAIR_DIR/cmake_targets/build_oai - -c --UE -w USRP --noS1 --eNB - source ./targets/bin/init_nas_nos1 UE - - sleep 50; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C2685004636. -r50 --ue-scan-carrier --ue-txgain 90 -A 20 --ue-rxgain 125 -S --phy-test -g 4 - - - - - - False - UE_USRP.NOS1.PHYTEST_PERF.BAND7.10MHZ.MCS28 - 36 - - - - - - - lte-softmodem-noS1 - - imb182-desktop - ued-PRM-130 - 300 - /tmp - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tracking_area_code \"1\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_country_code \"208\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_network_code \"95\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf N_RB_DL 50 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mme_ip_address "ipv4=\"192.168.12.26\";ipv6=\"192:168:30::17\";active=\"yes\";preference=\"ipv4\";" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf downlink_frequency 2685000000L - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf uplink_frequency_offset -120000000 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tx_gain 90 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf rx_gain 125 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf frame_type \"FDD\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_rx 1 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_tx 1 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1_MME \"eth5\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1_MME \"192.168.12.82/24\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1U \"eth5\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1U \"192.168.12.82/24\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_PORT_FOR_S1U 2152 - $OPENAIR_DIR/cmake_targets/build_oai - -c -w USRP --eNB --noS1 - source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB - - $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 - -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 19 --phy-test - - - - - False - - /tmp - - $OPENAIR_DIR/cmake_targets/build_oai - -c --UE -w EXMIMO --noS1 - source ./targets/bin/init_nas_nos1 UE - - sleep 50; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C 2685000000 -r50 --ue-scan-carrier --ue-txgain 0 --ue-rxgain 5 -S -A 6 -F myriadRF_FMX --ue-max-power -25 --phy-test -g 4 - - - - - - False - UE_UEDV1.NOS1.PHYTEST_PERF.BAND7.10MHZ.MCS19 - 36 - - - - - - lte-softmodem-noS1 - - imb182-desktop - yanbo-M4HM87P-00 - 300 - /tmp - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tracking_area_code \"1\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_country_code \"208\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_network_code \"95\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf N_RB_DL 25 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mme_ip_address "ipv4=\"192.168.12.26\";ipv6=\"192:168:30::17\";active=\"yes\";preference=\"ipv4\";" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf downlink_frequency 2685000000L - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf uplink_frequency_offset -120000000 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tx_gain 90 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf rx_gain 125 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf frame_type \"FDD\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_rx 1 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_tx 1 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1_MME \"eth5\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1_MME \"192.168.12.82/24\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1U \"eth5\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1U \"192.168.12.82/24\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_PORT_FOR_S1U 2152 - $OPENAIR_DIR/cmake_targets/build_oai - -c -w USRP --eNB --noS1 - source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB - - $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 - -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 0 - sleep 80;iperf -c 10.0.1.9 -i 1 -u -b 512K - - - - False - - /tmp - - $OPENAIR_DIR/cmake_targets/build_oai - -c --UE -w USRP --noS1 --eNB - source ./targets/bin/init_nas_nos1 UE - - sleep 50; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C2685004636 -r25 --ue-scan-carrier --ue-txgain 90 -A 20 --ue-rxgain 125 -S -g 4 - - iperf -s -i 1 -u - - 200 - - False - UE_USRP.NOS1.DATA_IPERF.BAND7.5MHZ.MCS00 - 36 - - - - - lte-softmodem-noS1 - - imb182-desktop - ued-PRM-130 - 300 - /tmp - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tracking_area_code \"1\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_country_code \"208\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_network_code \"95\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf N_RB_DL 25 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mme_ip_address "ipv4=\"192.168.12.26\";ipv6=\"192:168:30::17\";active=\"yes\";preference=\"ipv4\";" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf downlink_frequency 2685000000L - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf uplink_frequency_offset -120000000 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tx_gain 90 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf rx_gain 125 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf frame_type \"FDD\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_rx 1 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_tx 1 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1_MME \"eth5\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1_MME \"192.168.12.82/24\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1U \"eth5\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1U \"192.168.12.82/24\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_PORT_FOR_S1U 2152 - $OPENAIR_DIR/cmake_targets/build_oai - -c -w USRP --eNB --noS1 - source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB - - $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 - -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 0 - sleep 80;iperf -c 10.0.1.9 -i 1 -u -b 512K - - - - False - - /tmp - - $OPENAIR_DIR/cmake_targets/build_oai - -c --UE -w EXMIMO --noS1 - source ./targets/bin/init_nas_nos1 UE - - sleep 50; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C 2685000000 -r25 --ue-scan-carrier --ue-txgain 15 --ue-rxgain 5 -S -A 6 -F myriadRF_FMX --ue-max-power -25 -g 4 - - iperf -s -i 1 -u - - 200 - - False - UE_UEDV1.NOS1.DATA_IPERF.BAND7.5MHZ.MCS00 - 36 - - - - lte-softmodem-noS1 - - imb182-desktop - yanbo-M4HM87P-00 - 300 - /tmp - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tracking_area_code \"1\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_country_code \"208\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_network_code \"95\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf N_RB_DL 25 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mme_ip_address "ipv4=\"192.168.12.26\";ipv6=\"192:168:30::17\";active=\"yes\";preference=\"ipv4\";" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf downlink_frequency 2685000000L - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf uplink_frequency_offset -120000000 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tx_gain 90 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf rx_gain 125 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf frame_type \"FDD\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_rx 1 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_tx 1 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1_MME \"eth5\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1_MME \"192.168.12.82/24\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1U \"eth5\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1U \"192.168.12.82/24\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_PORT_FOR_S1U 2152 - $OPENAIR_DIR/cmake_targets/build_oai - -c -w USRP --eNB --noS1 - source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB - - $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 - -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 9 - sleep 80;iperf -c 10.0.1.9 -i 1 -u -b 2M - - - - False - - /tmp - - $OPENAIR_DIR/cmake_targets/build_oai - -c --UE -w USRP --noS1 --eNB - source ./targets/bin/init_nas_nos1 UE - - sleep 50; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C2685004636 -r25 --ue-scan-carrier --ue-txgain 90 -A 20 --ue-rxgain 125 -S -g 4 - - iperf -s -i 1 -u - - 200 - - False - UE_USRP.NOS1.DATA_IPERF.BAND7.5MHZ.MCS09 - 36 - - - - - lte-softmodem-noS1 - - imb182-desktop - ued-PRM-130 - 300 - /tmp - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tracking_area_code \"1\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_country_code \"208\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_network_code \"95\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf N_RB_DL 25 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mme_ip_address "ipv4=\"192.168.12.26\";ipv6=\"192:168:30::17\";active=\"yes\";preference=\"ipv4\";" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf downlink_frequency 2685000000L - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf uplink_frequency_offset -120000000 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tx_gain 90 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf rx_gain 125 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf frame_type \"FDD\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_rx 1 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_tx 1 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1_MME \"eth5\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1_MME \"192.168.12.82/24\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1U \"eth5\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1U \"192.168.12.82/24\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_PORT_FOR_S1U 2152 - $OPENAIR_DIR/cmake_targets/build_oai - -c -w USRP --eNB --noS1 - source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB - - $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 - -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 9 - sleep 80;iperf -c 10.0.1.9 -i 1 -u -b 2M - - - - False - - /tmp - - $OPENAIR_DIR/cmake_targets/build_oai - -c --UE -w EXMIMO --noS1 - source ./targets/bin/init_nas_nos1 UE - - sleep 50; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C 2685000000 -r25 --ue-scan-carrier --ue-txgain 15 --ue-rxgain 5 -S -A 6 -F myriadRF_FMX --ue-max-power -25 -g 4 - - iperf -s -i 1 -u - - 200 - - False - UE_UEDV1.NOS1.DATA_IPERF.BAND7.5MHZ.MCS09 - 36 - - - - - lte-softmodem-noS1 - - imb182-desktop - yanbo-M4HM87P-00 - 300 - /tmp - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tracking_area_code \"1\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_country_code \"208\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_network_code \"95\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf N_RB_DL 25 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mme_ip_address "ipv4=\"192.168.12.26\";ipv6=\"192:168:30::17\";active=\"yes\";preference=\"ipv4\";" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf downlink_frequency 2685000000L - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf uplink_frequency_offset -120000000 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tx_gain 90 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf rx_gain 125 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf frame_type \"FDD\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_rx 1 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_tx 1 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1_MME \"eth5\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1_MME \"192.168.12.82/24\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1U \"eth5\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1U \"192.168.12.82/24\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_PORT_FOR_S1U 2152 - $OPENAIR_DIR/cmake_targets/build_oai - -c -w USRP --eNB --noS1 - source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB - - $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 - -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 10 - sleep 80;iperf -c 10.0.1.9 -i 1 -u -b 2M - - - - False - - /tmp - - $OPENAIR_DIR/cmake_targets/build_oai - -c --UE -w USRP --noS1 --eNB - source ./targets/bin/init_nas_nos1 UE - - sleep 50; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C2685004636 -r25 --ue-scan-carrier --ue-txgain 90 -A 20 --ue-rxgain 125 -S -g 4 - - iperf -s -i 1 -u - - 200 - - False - UE_USRP.NOS1.DATA_IPERF.BAND7.5MHZ.MCS10 - 36 - - - - - lte-softmodem-noS1 - - imb182-desktop - ued-PRM-130 - 300 - /tmp - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tracking_area_code \"1\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_country_code \"208\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_network_code \"95\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf N_RB_DL 25 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mme_ip_address "ipv4=\"192.168.12.26\";ipv6=\"192:168:30::17\";active=\"yes\";preference=\"ipv4\";" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf downlink_frequency 2685000000L - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf uplink_frequency_offset -120000000 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tx_gain 90 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf rx_gain 125 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf frame_type \"FDD\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_rx 1 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_tx 1 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1_MME \"eth5\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1_MME \"192.168.12.82/24\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1U \"eth5\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1U \"192.168.12.82/24\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_PORT_FOR_S1U 2152 - $OPENAIR_DIR/cmake_targets/build_oai - -c -w USRP --eNB --noS1 - source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB - - $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 - -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 10 - sleep 80;iperf -c 10.0.1.9 -i 1 -u -b 2M - - - - False - - /tmp - - $OPENAIR_DIR/cmake_targets/build_oai - -c --UE -w EXMIMO --noS1 - source ./targets/bin/init_nas_nos1 UE - - sleep 50; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C 2685000000 -r25 --ue-scan-carrier --ue-txgain 15 --ue-rxgain 5 -S -A 6 -F myriadRF_FMX --ue-max-power -25 -g 4 - - iperf -s -i 1 -u - - 200 - - False - UE_UEDV1.NOS1.DATA_IPERF.BAND7.5MHZ.MCS10 - 36 - - - - - - lte-softmodem-noS1 - - imb182-desktop - yanbo-M4HM87P-00 - 300 - /tmp - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tracking_area_code \"1\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_country_code \"208\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_network_code \"95\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf N_RB_DL 25 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mme_ip_address "ipv4=\"192.168.12.26\";ipv6=\"192:168:30::17\";active=\"yes\";preference=\"ipv4\";" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf downlink_frequency 2685000000L - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf uplink_frequency_offset -120000000 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tx_gain 90 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf rx_gain 125 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf frame_type \"FDD\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_rx 1 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_tx 1 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1_MME \"eth5\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1_MME \"192.168.12.82/24\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1U \"eth5\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1U \"192.168.12.82/24\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_PORT_FOR_S1U 2152 - $OPENAIR_DIR/cmake_targets/build_oai - -c -w USRP --eNB --noS1 - source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB - - $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 - -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 16 - sleep 80;iperf -c 10.0.1.9 -i 1 -u -b 2M - - - - False - - /tmp - - $OPENAIR_DIR/cmake_targets/build_oai - -c --UE -w USRP --noS1 --eNB - source ./targets/bin/init_nas_nos1 UE - - sleep 50; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C2685004636 -r25 --ue-scan-carrier --ue-txgain 90 -A 20 --ue-rxgain 125 -S -g 4 - - iperf -s -i 1 -u - - 200 - - False - UE_USRP.NOS1.DATA_IPERF.BAND7.5MHZ.MCS16 - 36 - - - - - lte-softmodem-noS1 - - imb182-desktop - ued-PRM-130 - 300 - /tmp - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tracking_area_code \"1\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_country_code \"208\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_network_code \"95\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf N_RB_DL 25 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mme_ip_address "ipv4=\"192.168.12.26\";ipv6=\"192:168:30::17\";active=\"yes\";preference=\"ipv4\";" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf downlink_frequency 2685000000L - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf uplink_frequency_offset -120000000 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tx_gain 90 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf rx_gain 125 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf frame_type \"FDD\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_rx 1 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_tx 1 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1_MME \"eth5\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1_MME \"192.168.12.82/24\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1U \"eth5\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1U \"192.168.12.82/24\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_PORT_FOR_S1U 2152 - $OPENAIR_DIR/cmake_targets/build_oai - -c -w USRP --eNB --noS1 - source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB - - $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 - -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 16 - sleep 80;iperf -c 10.0.1.9 -i 1 -u -b 2M - - - - False - - /tmp - - $OPENAIR_DIR/cmake_targets/build_oai - -c --UE -w EXMIMO --noS1 - source ./targets/bin/init_nas_nos1 UE - - sleep 50; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C 2685000000 -r25 --ue-scan-carrier --ue-txgain 15 --ue-rxgain 5 -S -A 6 -F myriadRF_FMX --ue-max-power -25 -g 4 - - iperf -s -i 1 -u - - 200 - - False - UE_UEDV1.NOS1.DATA_IPERF.BAND7.5MHZ.MCS16 - 36 - - - - - - lte-softmodem-noS1 - - imb182-desktop - yanbo-M4HM87P-00 - 300 - /tmp - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tracking_area_code \"1\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_country_code \"208\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_network_code \"95\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf N_RB_DL 25 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mme_ip_address "ipv4=\"192.168.12.26\";ipv6=\"192:168:30::17\";active=\"yes\";preference=\"ipv4\";" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf downlink_frequency 2685000000L - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf uplink_frequency_offset -120000000 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tx_gain 90 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf rx_gain 125 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf frame_type \"FDD\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_rx 1 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_tx 1 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1_MME \"eth5\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1_MME \"192.168.12.82/24\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1U \"eth5\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1U \"192.168.12.82/24\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_PORT_FOR_S1U 2152 - $OPENAIR_DIR/cmake_targets/build_oai - -c -w USRP --eNB --noS1 - source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB - - $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 - -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 17 - sleep 80;iperf -c 10.0.1.9 -i 1 -u -b 2M - - - - False - - /tmp - - $OPENAIR_DIR/cmake_targets/build_oai - -c --UE -w USRP --noS1 --eNB - source ./targets/bin/init_nas_nos1 UE - - sleep 50; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C2685004636 -r25 --ue-scan-carrier --ue-txgain 90 -A 20 --ue-rxgain 125 -S -g 4 - - iperf -s -i 1 -u - - 200 - - False - UE_USRP.NOS1.DATA_IPERF.BAND7.5MHZ.MCS17 - 36 - - - - - lte-softmodem-noS1 - - imb182-desktop - ued-PRM-130 - 300 - /tmp - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tracking_area_code \"1\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_country_code \"208\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_network_code \"95\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf N_RB_DL 25 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mme_ip_address "ipv4=\"192.168.12.26\";ipv6=\"192:168:30::17\";active=\"yes\";preference=\"ipv4\";" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf downlink_frequency 2685000000L - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf uplink_frequency_offset -120000000 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tx_gain 90 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf rx_gain 125 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf frame_type \"FDD\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_rx 1 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_tx 1 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1_MME \"eth5\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1_MME \"192.168.12.82/24\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1U \"eth5\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1U \"192.168.12.82/24\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_PORT_FOR_S1U 2152 - $OPENAIR_DIR/cmake_targets/build_oai - -c -w USRP --eNB --noS1 - source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB - - $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 - -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 17 - sleep 80;iperf -c 10.0.1.9 -i 1 -u -b 2M - - - - False - - /tmp - - $OPENAIR_DIR/cmake_targets/build_oai - -c --UE -w EXMIMO --noS1 - source ./targets/bin/init_nas_nos1 UE - - sleep 50; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C 2685000000 -r25 --ue-scan-carrier --ue-txgain 15 --ue-rxgain 5 -S -A 6 -F myriadRF_FMX --ue-max-power -25 -g 4 - - iperf -s -i 1 -u - - 200 - - False - UE_UEDV1.NOS1.DATA_IPERF.BAND7.5MHZ.MCS17 - 36 - - - - - - - - lte-softmodem-noS1 - - imb182-desktop - yanbo-M4HM87P-00 - 300 - /tmp - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tracking_area_code \"1\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_country_code \"208\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_network_code \"95\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf N_RB_DL 25 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mme_ip_address "ipv4=\"192.168.12.26\";ipv6=\"192:168:30::17\";active=\"yes\";preference=\"ipv4\";" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf downlink_frequency 2685000000L - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf uplink_frequency_offset -120000000 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tx_gain 90 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf rx_gain 125 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf frame_type \"FDD\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_rx 1 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_tx 1 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1_MME \"eth5\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1_MME \"192.168.12.82/24\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1U \"eth5\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1U \"192.168.12.82/24\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_PORT_FOR_S1U 2152 - $OPENAIR_DIR/cmake_targets/build_oai - -c -w USRP --eNB --noS1 - source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB - - $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 - -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 19 - sleep 80;iperf -c 10.0.1.9 -i 1 -u -b 2M - - - - False - - /tmp - - $OPENAIR_DIR/cmake_targets/build_oai - -c --UE -w USRP --noS1 --eNB - source ./targets/bin/init_nas_nos1 UE - - sleep 50; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C2685004636 -r25 --ue-scan-carrier --ue-txgain 90 -A 20 --ue-rxgain 125 -S -g 4 - - iperf -s -i 1 -u - - 200 - - False - UE_USRP.NOS1.DATA_IPERF.BAND7.5MHZ.MCS19 - 36 - - - - - lte-softmodem-noS1 - - imb182-desktop - ued-PRM-130 - 300 - /tmp - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tracking_area_code \"1\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_country_code \"208\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_network_code \"95\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf N_RB_DL 25 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mme_ip_address "ipv4=\"192.168.12.26\";ipv6=\"192:168:30::17\";active=\"yes\";preference=\"ipv4\";" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf downlink_frequency 2685000000L - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf uplink_frequency_offset -120000000 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tx_gain 90 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf rx_gain 125 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf frame_type \"FDD\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_rx 1 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_tx 1 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1_MME \"eth5\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1_MME \"192.168.12.82/24\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1U \"eth5\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1U \"192.168.12.82/24\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_PORT_FOR_S1U 2152 - $OPENAIR_DIR/cmake_targets/build_oai - -c -w USRP --eNB --noS1 - source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB - - $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 - -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 19 - sleep 80;iperf -c 10.0.1.9 -i 1 -u -b 2M - - - - False - - /tmp - - $OPENAIR_DIR/cmake_targets/build_oai - -c --UE -w EXMIMO --noS1 - source ./targets/bin/init_nas_nos1 UE - - sleep 50; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C 2685000000 -r25 --ue-scan-carrier --ue-txgain 15 --ue-rxgain 5 -S -A 6 -F myriadRF_FMX --ue-max-power -25 -g 4 - - iperf -s -i 1 -u - - 200 - - False - UE_UEDV1.NOS1.DATA_IPERF.BAND7.5MHZ.MCS19 - 36 - - - - - lte-softmodem-noS1 - - imb182-desktop - yanbo-M4HM87P-00 - 300 - /tmp - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tracking_area_code \"1\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_country_code \"208\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_network_code \"95\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf N_RB_DL 25 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mme_ip_address "ipv4=\"192.168.12.26\";ipv6=\"192:168:30::17\";active=\"yes\";preference=\"ipv4\";" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf downlink_frequency 2685000000L - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf uplink_frequency_offset -120000000 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tx_gain 90 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf rx_gain 125 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf frame_type \"FDD\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_rx 1 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_tx 1 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1_MME \"eth5\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1_MME \"192.168.12.82/24\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1U \"eth5\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1U \"192.168.12.82/24\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_PORT_FOR_S1U 2152 - $OPENAIR_DIR/cmake_targets/build_oai - -c -w USRP --eNB --noS1 - source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB - - $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 - -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 27 - sleep 80;iperf -c 10.0.1.9 -i 1 -u -b 2M - - - - False - - /tmp - - $OPENAIR_DIR/cmake_targets/build_oai - -c --UE -w USRP --noS1 --eNB - source ./targets/bin/init_nas_nos1 UE - - sleep 50; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C2685004636 -r25 --ue-scan-carrier --ue-txgain 90 -A 20 --ue-rxgain 125 -S -g 4 - - iperf -s -i 1 -u - - 200 - - False - UE_USRP.NOS1.DATA_IPERF.BAND7.5MHZ.MCS27 - 36 - - - - - lte-softmodem-noS1 - - imb182-desktop - yanbo-M4HM87P-00 - 3600 - /tmp - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tracking_area_code \"1\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_country_code \"208\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_network_code \"95\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf N_RB_DL 25 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mme_ip_address "ipv4=\"192.168.12.26\";ipv6=\"192:168:30::17\";active=\"yes\";preference=\"ipv4\";" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf downlink_frequency 2685000000L - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf uplink_frequency_offset -120000000 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tx_gain 90 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf rx_gain 125 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf frame_type \"FDD\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_rx 1 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_tx 1 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1_MME \"eth5\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1_MME \"192.168.12.82/24\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1U \"eth5\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1U \"192.168.12.82/24\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_PORT_FOR_S1U 2152 - $OPENAIR_DIR/cmake_targets/build_oai - -c -w USRP --eNB --noS1 - source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB - - $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 - -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 27 - sleep 80;iperf -c 10.0.1.9 -i 1 -u -b 2M - - - - False - - /tmp - - $OPENAIR_DIR/cmake_targets/build_oai - -c --UE -w USRP --noS1 --eNB - source ./targets/bin/init_nas_nos1 UE - - sleep 50; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C2685004636 -r25 --ue-scan-carrier --ue-txgain 90 -A 20 --ue-rxgain 125 -S -g 4 - - iperf -s -i 1 -u - - 2800 - - False - UE_USRP.NOS1.DATA_IPERF_STAB.BAND7.5MHZ.MCS27 - 16 - - - - - lte-softmodem-noS1 - - imb182-desktop - ued-PRM-130 - 300 - /tmp - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tracking_area_code \"1\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_country_code \"208\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mobile_network_code \"95\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf N_RB_DL 25 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf mme_ip_address "ipv4=\"192.168.12.26\";ipv6=\"192:168:30::17\";active=\"yes\";preference=\"ipv4\";" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf downlink_frequency 2685000000L - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf uplink_frequency_offset -120000000 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf tx_gain 90 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf rx_gain 125 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf frame_type \"FDD\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_rx 1 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf nb_antennas_tx 1 - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1_MME \"eth5\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1_MME \"192.168.12.82/24\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_INTERFACE_NAME_FOR_S1U \"eth5\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_IPV4_ADDRESS_FOR_S1U \"192.168.12.82/24\" - targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf ENB_PORT_FOR_S1U 2152 - $OPENAIR_DIR/cmake_targets/build_oai - -c -w USRP --eNB --noS1 - source $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 eNB - - $OPENAIR_DIR/cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 - -O $OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf -W -m 27 - sleep 80;iperf -c 10.0.1.9 -i 1 -u -b 2M - - - - False - - /tmp - - $OPENAIR_DIR/cmake_targets/build_oai - -c --UE -w EXMIMO --noS1 - source ./targets/bin/init_nas_nos1 UE - - sleep 50; ./cmake_targets/autotests/tools/run_gdb ./cmake_targets/lte_noS1_build_oai/build/lte-softmodem-nos1 -U -C 2685000000 -r25 --ue-scan-carrier --ue-txgain 15 --ue-rxgain 5 -S -A 6 -F myriadRF_FMX --ue-max-power -25 -g 4 - - iperf -s -i 1 -u - - 200 - - False - UE_UEDV1.NOS1.DATA_IPERF.BAND7.5MHZ.MCS27 - 36 - - - diff --git a/openair1/PHY/CODING/3gpplte_turbo_decoder_sse_8bit.c b/openair1/PHY/CODING/3gpplte_turbo_decoder_sse_8bit.c index 5ae2ec2ecd..ff7e02a239 100644 --- a/openair1/PHY/CODING/3gpplte_turbo_decoder_sse_8bit.c +++ b/openair1/PHY/CODING/3gpplte_turbo_decoder_sse_8bit.c @@ -972,11 +972,6 @@ unsigned char phy_threegpplte_turbo_decoder8(short *y, } else n2 = n; - if(n2<256) - { - printf("phy_threegpplte_turbo_decoder8 : frame length < 256\n"); - return 255; - } for (iind=0; iind < 188 && f1f2mat[iind].nb_bits != n; iind++); From 2f3483d1d30457961e9cfa5bd80d471417728967 Mon Sep 17 00:00:00 2001 From: Benoit ROBERT Date: Wed, 14 Dec 2016 12:26:01 +0100 Subject: [PATCH 344/349] correct issue 154 on PDCP fifo for noS1 mode --- openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c index fedef42b60..eb78a4ca7c 100644 --- a/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c +++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c @@ -424,18 +424,22 @@ int pdcp_fifo_read_input_sdus (const protocol_ctxt_t* const ctxt_pP) return 0; # else /* PDCP_USE_NETLINK_QUEUES*/ int len = 1; + int msg_len; rb_id_t rab_id = 0; - - while (len > 0) { + int rlc_data_req_flag = 3; + + while ((len > 0) && (rlc_data_req_flag !=0)) { len = recvmsg(nas_sock_fd, &nas_msg_rx, 0); if (len<=0) { // nothing in pdcp NAS socket //LOG_D(PDCP, "[PDCP][NETLINK] Nothing in socket, length %d \n", len); } else { + + msg_len = len; for (nas_nlh_rx = (struct nlmsghdr *) nl_rx_buf; - NLMSG_OK (nas_nlh_rx, len); - nas_nlh_rx = NLMSG_NEXT (nas_nlh_rx, len)) { + NLMSG_OK (nas_nlh_rx, msg_len); + nas_nlh_rx = NLMSG_NEXT (nas_nlh_rx, msg_len)) { if (nas_nlh_rx->nlmsg_type == NLMSG_DONE) { LOG_D(PDCP, "[PDCP][NETLINK] RX NLMSG_DONE\n"); @@ -493,7 +497,7 @@ int pdcp_fifo_read_input_sdus (const protocol_ctxt_t* const ctxt_pP) ctxt.enb_flag = ctxt_cpy.enb_flag; #ifdef PDCP_DEBUG - LOG_D(PDCP, "[PDCP][NETLINK] pdcp_read_header_g.rb_id = %d\n", pdcp_read_header_g.rb_id); + LOG_I(PDCP, "[PDCP][NETLINK] pdcp_read_header_g.rb_id = %d\n", pdcp_read_header_g.rb_id); #endif if (ctxt_cpy.enb_flag) { From 82437cccb756d05e0546aceefaf346e938793f67 Mon Sep 17 00:00:00 2001 From: ROBERT Benoit Date: Thu, 1 Dec 2016 16:31:05 +0100 Subject: [PATCH 345/349] - Problem in DCI NDI : the implementation use 5 HARQ processes, but process 0 NDI never toggled because it was reused on subframe 5 that is not carrying format 1 DCI. Fix -> use 8 harq processes instead of 5. - SI scheduled on every subframe 5 (even and odd frames) instead of only on even frames - Add DLSCH scheduling on subframe 5 for odd frames - change default rballoc from 0x7FFF to 0x1FFFF to support maximum 10MHz throughput --- openair1/SCHED/phy_mac_stub.c | 79 ++++++++++++++++++++--------------- 1 file changed, 45 insertions(+), 34 deletions(-) diff --git a/openair1/SCHED/phy_mac_stub.c b/openair1/SCHED/phy_mac_stub.c index 0ac194d051..7753e9c2e3 100644 --- a/openair1/SCHED/phy_mac_stub.c +++ b/openair1/SCHED/phy_mac_stub.c @@ -40,14 +40,21 @@ #include "SCHED/phy_procedures_emos.h" #endif +/* SYRTEM */ +uint8_t dci_ndi_toggle_even[8] = {0, 0, 0, 0, 0, 0, 0, 0}; +uint8_t dci_ndi_toggle_odd[8] = {0, 0, 0, 0, 0, 0, 0, 0}; + void fill_dci(DCI_PDU *DCI_pdu,PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc) { - +/* SYRTEM */ + uint8_t *dci_ndi_toggle_tmp = NULL; + uint8_t harq_pid_value = 0; +/* End of SYRTEM */ //uint8_t cooperation_flag = eNB->cooperation_flag; uint8_t transmission_mode = eNB->transmission_mode[0]; - uint32_t rballoc = 0x7FFF; + uint32_t rballoc = 0x1FFFF; //uint32_t rballoc2 = 0x000F; int subframe = proc->subframe_tx; @@ -68,12 +75,14 @@ void fill_dci(DCI_PDU *DCI_pdu,PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc) switch (subframe) { case 5: - DCI_pdu->Num_common_dci = 1; - DCI_pdu->dci_alloc[0].L = 2; - DCI_pdu->dci_alloc[0].firstCCE = 0; - DCI_pdu->dci_alloc[0].rnti = SI_RNTI; - DCI_pdu->dci_alloc[0].format = format1A; - DCI_pdu->dci_alloc[0].ra_flag = 0; + if ( !(proc->frame_tx&1) ) // SI message on even frame only (SFN mod 2 == 0) + { + DCI_pdu->Num_common_dci = 1; + DCI_pdu->dci_alloc[0].L = 2; + DCI_pdu->dci_alloc[0].firstCCE = 0; + DCI_pdu->dci_alloc[0].rnti = SI_RNTI; + DCI_pdu->dci_alloc[0].format = format1A; + DCI_pdu->dci_alloc[0].ra_flag = 0; switch (eNB->frame_parms.N_RB_DL) { case 6: @@ -187,6 +196,12 @@ void fill_dci(DCI_PDU *DCI_pdu,PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc) } break; //subframe switch + } // if ( !(proc->frame_tx&1) ) + else // No SI message on odd frame (SFN mod 2 == 1) + { + /* warning: work around to send dlsch on subframe 5 odd frame !!! */ + /* todo: clean up, espacially if subframe cases are added next !!! */ + } /* case 6: DCI_pdu->Num_ue_spec_dci = 1; @@ -225,15 +240,23 @@ void fill_dci(DCI_PDU *DCI_pdu,PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc) if (eNB->frame_parms.frame_type == FDD) { DCI_pdu->dci_alloc[0].dci_length = sizeof_DCI1_5MHz_FDD_t; + harq_pid_value = ( ((proc->frame_tx * 10) + subframe) % 8 ); + + if (!(subframe&1)) // even subframe + dci_ndi_toggle_tmp = &(dci_ndi_toggle_even[harq_pid_value]); + else // odd subframe + dci_ndi_toggle_tmp = &(dci_ndi_toggle_odd[harq_pid_value]); + ((DCI1_5MHz_FDD_t *)&dlsch_pdu)->rballoc = rballoc; //computeRIV(25,10,3); ((DCI1_5MHz_FDD_t *)&dlsch_pdu)->TPC = 0; - ((DCI1_5MHz_FDD_t *)&dlsch_pdu)->harq_pid = subframe % 5; + ((DCI1_5MHz_FDD_t *)&dlsch_pdu)->harq_pid = harq_pid_value; ((DCI1_5MHz_FDD_t *)&dlsch_pdu)->mcs = eNB->target_ue_dl_mcs; - //((DCI1_5MHz_FDD_t *)&dlsch_pdu)->mcs = (unsigned char) ((eNB->frame%1024)%28); - ((DCI1_5MHz_FDD_t *)&dlsch_pdu)->ndi = subframe / 5; + ((DCI1_5MHz_FDD_t *)&dlsch_pdu)->ndi = (*dci_ndi_toggle_tmp); ((DCI1_5MHz_FDD_t *)&dlsch_pdu)->rv = 0; ((DCI1_5MHz_FDD_t *)&dlsch_pdu)->rah = 0; + (*dci_ndi_toggle_tmp) = ((*dci_ndi_toggle_tmp) + 1) & 1; + memcpy((void*)&DCI_pdu->dci_alloc[0].dci_pdu[0],(void *)&dlsch_pdu,sizeof(DCI1_5MHz_FDD_t)); /* @@ -296,36 +319,24 @@ void fill_dci(DCI_PDU *DCI_pdu,PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc) if (eNB->frame_parms.frame_type == FDD) { DCI_pdu->dci_alloc[0].dci_length = sizeof_DCI1_10MHz_FDD_t; + harq_pid_value = ( ((proc->frame_tx * 10) + subframe) % 8 ); + + if (!(subframe&1)) // even subframe + dci_ndi_toggle_tmp = &(dci_ndi_toggle_even[harq_pid_value]); + else // odd subframe + dci_ndi_toggle_tmp = &(dci_ndi_toggle_odd[harq_pid_value]); + ((DCI1_10MHz_FDD_t *)&dlsch_pdu)->rballoc = rballoc; //computeRIV(50,10,3); ((DCI1_10MHz_FDD_t *)&dlsch_pdu)->TPC = 0; - ((DCI1_10MHz_FDD_t *)&dlsch_pdu)->harq_pid = subframe % 5; + ((DCI1_10MHz_FDD_t *)&dlsch_pdu)->harq_pid = harq_pid_value; ((DCI1_10MHz_FDD_t *)&dlsch_pdu)->mcs = eNB->target_ue_dl_mcs; - //((DCI1_10MHz_FDD_t *)&dlsch_pdu)->mcs = (unsigned char) ((eNB->frame%1024)%28); - ((DCI1_10MHz_FDD_t *)&dlsch_pdu)->ndi = subframe / 5; + ((DCI1_10MHz_FDD_t *)&dlsch_pdu)->ndi = (*dci_ndi_toggle_tmp); ((DCI1_10MHz_FDD_t *)&dlsch_pdu)->rv = 0; ((DCI1_10MHz_FDD_t *)&dlsch_pdu)->rah = 0; + (*dci_ndi_toggle_tmp) = ((*dci_ndi_toggle_tmp) + 1) & 1; + memcpy((void*)&DCI_pdu->dci_alloc[0].dci_pdu[0],(void *)&dlsch_pdu,sizeof(DCI1_10MHz_FDD_t)); - - /* - //user2 - DCI_pdu->dci_alloc[1].dci_length = sizeof_DCI1_10MHz_TDD_t; - DCI_pdu->dci_alloc[1].L = 2; - DCI_pdu->dci_alloc[1].rnti = 0x1236; - DCI_pdu->dci_alloc[1].format = format1; - DCI_pdu->dci_alloc[1].ra_flag = 0; - - ((DCI1_10MHz_FDD_t *)&dlsch_pdu)->rballoc = rballoc2; - ((DCI1_10MHz_FDD_t *)&dlsch_pdu)->TPC = 0; - ((DCI1_10MHz_FDD_t *)&dlsch_pdu)->dai = 0; - ((DCI1_10MHz_FDD_t *)&dlsch_pdu)->harq_pid = 1; - //((DCI1_10MHz_FDD_t *)&dlsch_pdu)->mcs = (unsigned char) ((eNB->proc[subframe].frame%1024)%28); - ((DCI1_10MHz_FDD_t *)&dlsch_pdu)->mcs = eNB->target_ue_dl_mcs; - ((DCI1_10MHz_FDD_t *)&dlsch_pdu)->ndi = 1; - ((DCI1_10MHz_FDD_t *)&dlsch_pdu)->rv = 0; - ((DCI1_10MHz_FDD_t *)&dlsch_pdu)->rah = 0; - memcpy((void*)&DCI_pdu->dci_alloc[1].dci_pdu[0],(void *)&((DCI1_10MHz_FDD_t *)&dlsch_pdu)->,sizeof(DCI1_10MHz_TDD_t)); - */ } else { DCI_pdu->dci_alloc[0].dci_length = sizeof_DCI1_10MHz_TDD_t; From 17d62a67776b13e2af75b464ee85c9c1fd6bb735 Mon Sep 17 00:00:00 2001 From: ROBERT Benoit Date: Mon, 5 Dec 2016 15:41:47 +0100 Subject: [PATCH 346/349] correct issue 147 : --phy-test mode : error msg " DL Received HarqReTx round=1 mcs=28 rballoc=8191 rv=0 " --- openair1/SCHED/phy_procedures_lte_eNb.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/openair1/SCHED/phy_procedures_lte_eNb.c b/openair1/SCHED/phy_procedures_lte_eNb.c index a7d9e73e2f..ff12ac7fef 100644 --- a/openair1/SCHED/phy_procedures_lte_eNb.c +++ b/openair1/SCHED/phy_procedures_lte_eNb.c @@ -1124,7 +1124,7 @@ void phy_procedures_eNB_TX(PHY_VARS_eNB *eNB, int frame=proc->frame_tx; int subframe=proc->subframe_tx; // uint16_t input_buffer_length; - uint32_t i,aa; + uint32_t i,j,aa; uint8_t harq_pid; DCI_PDU *DCI_pdu; DCI_PDU DCI_pdu_tmp; @@ -1222,6 +1222,14 @@ void phy_procedures_eNB_TX(PHY_VARS_eNB *eNB, fill_dci_emos(DCI_pdu,eNB); #else fill_dci(DCI_pdu,eNB,proc); + // clear previous allocation information for all UEs + for (i=0; idlsch[i][0]){ + for (j=0; j<8; j++) + eNB->dlsch[i][0]->harq_processes[j]->round = 0; + } + } + #endif } From a525be94c3640eeea5c6ebc70a92f7a26018684c Mon Sep 17 00:00:00 2001 From: Florian Kaltenberger Date: Thu, 15 Dec 2016 17:00:53 +0100 Subject: [PATCH 347/349] changing antenna number back to 1 --- .../PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf index 2942832d94..5ef5a4f50b 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.usrpb210.conf @@ -37,8 +37,8 @@ eNBs = N_RB_DL = 25; Nid_cell_mbsfn = 0; nb_antenna_ports = 1; - nb_antennas_tx = 2; - nb_antennas_rx = 2; + nb_antennas_tx = 1; + nb_antennas_rx = 1; tx_gain = 90; rx_gain = 125; prach_root = 0; From 66c292b95b35203e3fb714777f8b431dbd5b7dbe Mon Sep 17 00:00:00 2001 From: Cedric Roux Date: Mon, 19 Dec 2016 11:19:05 +0100 Subject: [PATCH 348/349] integration fix: update T messages --- common/utils/T/T_messages.txt | 104 +++++++++++++++++++++++++++++++++- 1 file changed, 102 insertions(+), 2 deletions(-) diff --git a/common/utils/T/T_messages.txt b/common/utils/T/T_messages.txt index af2579cb1b..d1807080bc 100644 --- a/common/utils/T/T_messages.txt +++ b/common/utils/T/T_messages.txt @@ -1267,6 +1267,14 @@ ID = VCD_VARIABLE_UE0_SFN7 DESC = VCD variable UE0_SFN7 GROUP = ALL:VCD:ENB:VCD_VARIABLE FORMAT = ulong,value +ID = VCD_VARIABLE_UE0_TRX_READ_NS + DESC = VCD variable UE0_TRX_READ_NS + GROUP = ALL:VCD:ENB:VCD_VARIABLE + FORMAT = ulong,value +ID = VCD_VARIABLE_UE0_TRX_WRITE_NS + DESC = VCD variable UE0_TRX_WRITE_NS + GROUP = ALL:VCD:ENB:VCD_VARIABLE + FORMAT = ulong,value #functions @@ -1310,6 +1318,50 @@ ID = VCD_FUNCTION_UE_THREAD_RXTX1 DESC = VCD function UE_THREAD_RXTX1 GROUP = ALL:VCD:UE:VCD_FUNCTION FORMAT = int,value +ID = VCD_FUNCTION_TRX_READ_SF9 + DESC = VCD function TRX_READ_SF9 + GROUP = ALL:VCD:UE:VCD_FUNCTION + FORMAT = int,value +ID = VCD_FUNCTION_TRX_WRITE_SF9 + DESC = VCD function TRX_WRITE_SF9 + GROUP = ALL:VCD:UE:VCD_FUNCTION + FORMAT = int,value +ID = VCD_FUNCTION_UE_SIGNAL_COND_RXTX + DESC = VCD function UE_SIGNAL_COND_RXTX + GROUP = ALL:VCD:UE:VCD_FUNCTION + FORMAT = int,value +ID = VCD_FUNCTION_UE_WAIT_COND_RXTX0 + DESC = VCD function UE_WAIT_COND_RXTX0 + GROUP = ALL:VCD:UE:VCD_FUNCTION + FORMAT = int,value +ID = VCD_FUNCTION_UE_WAIT_COND_RXTX1 + DESC = VCD function UE_WAIT_COND_RXTX1 + GROUP = ALL:VCD:UE:VCD_FUNCTION + FORMAT = int,value +ID = VCD_FUNCTION_UE_LOCK_MUTEX_RXTX_FOR_COND_WAIT0 + DESC = VCD function UE_LOCK_MUTEX_RXTX_FOR_COND_WAIT0 + GROUP = ALL:VCD:UE:VCD_FUNCTION + FORMAT = int,value +ID = VCD_FUNCTION_UE_LOCK_MUTEX_RXTX_FOR_COND_WAIT1 + DESC = VCD function UE_LOCK_MUTEX_RXTX_FOR_COND_WAIT1 + GROUP = ALL:VCD:UE:VCD_FUNCTION + FORMAT = int,value +ID = VCD_FUNCTION_UE_LOCK_MUTEX_RXTX_FOR_CNT_DECREMENT0 + DESC = VCD function UE_LOCK_MUTEX_RXTX_FOR_CNT_DECREMENT0 + GROUP = ALL:VCD:UE:VCD_FUNCTION + FORMAT = int,value +ID = VCD_FUNCTION_UE_LOCK_MUTEX_RXTX_FOR_CNT_DECREMENT1 + DESC = VCD function UE_LOCK_MUTEX_RXTX_FOR_CNT_DECREMENT1 + GROUP = ALL:VCD:UE:VCD_FUNCTION + FORMAT = int,value +ID = VCD_FUNCTION_UE_LOCK_MUTEX_RXTX_FOR_CNT_INCREMENT0 + DESC = VCD function UE_LOCK_MUTEX_RXTX_FOR_CNT_INCREMENT0 + GROUP = ALL:VCD:UE:VCD_FUNCTION + FORMAT = int,value +ID = VCD_FUNCTION_UE_LOCK_MUTEX_RXTX_FOR_CNT_INCREMENT1 + DESC = VCD function UE_LOCK_MUTEX_RXTX_FOR_CNT_INCREMENT1 + GROUP = ALL:VCD:UE:VCD_FUNCTION + FORMAT = int,value ID = VCD_FUNCTION_eNB_TX DESC = VCD function eNB_TX GROUP = ALL:VCD:ENB:VCD_FUNCTION @@ -1402,8 +1454,8 @@ ID = VCD_FUNCTION_PHY_PROCEDURES_ENB_RX_UESPEC1 DESC = VCD function PHY_PROCEDURES_ENB_RX_UESPEC1 GROUP = ALL:VCD:ENB:VCD_FUNCTION FORMAT = int,value -ID = VCD_FUNCTION_PHY_PROCEDURES_ENB_SLOT_FEP - DESC = VCD function PHY_PROCEDURES_ENB_SLOT_FEP +ID = VCD_FUNCTION_ENB_SLOT_FEP + DESC = VCD function ENB_SLOT_FEP GROUP = ALL:VCD:ENB:VCD_FUNCTION FORMAT = int,value ID = VCD_FUNCTION_PHY_PROCEDURES_UE_TX @@ -1414,6 +1466,26 @@ ID = VCD_FUNCTION_PHY_PROCEDURES_UE_RX DESC = VCD function PHY_PROCEDURES_UE_RX GROUP = ALL:VCD:UE:VCD_FUNCTION FORMAT = int,value +ID = VCD_FUNCTION_PHY_PROCEDURES_UE_TX_ULSCH_UESPEC + DESC = VCD function PHY_PROCEDURES_UE_TX_ULSCH_UESPEC + GROUP = ALL:VCD:UE:VCD_FUNCTION + FORMAT = int,value +ID = VCD_FUNCTION_PHY_PROCEDURES_UE_TX_PUCCH + DESC = VCD function PHY_PROCEDURES_UE_TX_PUCCH + GROUP = ALL:VCD:UE:VCD_FUNCTION + FORMAT = int,value +ID = VCD_FUNCTION_PHY_PROCEDURES_UE_TX_ULSCH_COMMON + DESC = VCD function PHY_PROCEDURES_UE_TX_ULSCH_COMMON + GROUP = ALL:VCD:UE:VCD_FUNCTION + FORMAT = int,value +ID = VCD_FUNCTION_PHY_PROCEDURES_UE_TX_PRACH + DESC = VCD function PHY_PROCEDURES_UE_TX_PRACH + GROUP = ALL:VCD:UE:VCD_FUNCTION + FORMAT = int,value +ID = VCD_FUNCTION_PHY_PROCEDURES_UE_TX_ULSCH_RAR + DESC = VCD function PHY_PROCEDURES_UE_TX_ULSCH_RAR + GROUP = ALL:VCD:UE:VCD_FUNCTION + FORMAT = int,value ID = VCD_FUNCTION_PHY_PROCEDURES_ENB_LTE DESC = VCD function PHY_PROCEDURES_ENB_LTE GROUP = ALL:VCD:ENB:VCD_FUNCTION @@ -1502,6 +1574,22 @@ ID = VCD_FUNCTION_RX_PHICH DESC = VCD function RX_PHICH GROUP = ALL:VCD:ENB:VCD_FUNCTION FORMAT = int,value +ID = VCD_FUNCTION_PDSCH_PROC + DESC = VCD function PDSCH_PROC + GROUP = ALL:VCD:UE:VCD_FUNCTION + FORMAT = int,value +ID = VCD_FUNCTION_PDSCH_PROC_SI + DESC = VCD function PDSCH_PROC_SI + GROUP = ALL:VCD:UE:VCD_FUNCTION + FORMAT = int,value +ID = VCD_FUNCTION_PDSCH_PROC_P + DESC = VCD function PDSCH_PROC_P + GROUP = ALL:VCD:UE:VCD_FUNCTION + FORMAT = int,value +ID = VCD_FUNCTION_PDSCH_PROC_RA + DESC = VCD function PDSCH_PROC_RA + GROUP = ALL:VCD:UE:VCD_FUNCTION + FORMAT = int,value ID = VCD_FUNCTION_PHY_UE_CONFIG_SIB2 DESC = VCD function PHY_UE_CONFIG_SIB2 GROUP = ALL:VCD:UE:VCD_FUNCTION @@ -1606,6 +1694,14 @@ ID = VCD_FUNCTION_ENB_DLSCH_SCRAMBLING DESC = VCD function ENB_DLSCH_SCRAMBLING GROUP = ALL:VCD:ENB:VCD_FUNCTION FORMAT = int,value +ID = VCD_FUNCTION_ENB_BEAM_PRECODING + DESC = VCD function ENB_BEAM_PRECODING + GROUP = ALL:VCD:ENB:VCD_FUNCTION + FORMAT = int,value +ID = VCD_FUNCTION_ENB_OFDM_MODULATION + DESC = VCD function ENB_OFDM_MODULATION + GROUP = ALL:VCD:ENB:VCD_FUNCTION + FORMAT = int,value ID = VCD_FUNCTION_MACPHY_INIT DESC = VCD function MACPHY_INIT GROUP = ALL:VCD:ENB:VCD_FUNCTION @@ -1718,6 +1814,10 @@ ID = VCD_FUNCTION_RLC_DATA_REQ DESC = VCD function RLC_DATA_REQ GROUP = ALL:VCD:ENB:VCD_FUNCTION FORMAT = int,value +ID = VCD_FUNCTION_RLC_DATA_IND + DESC = VCD function RLC_DATA_IND + GROUP = ALL:VCD:ENB:VCD_FUNCTION + FORMAT = int,value ID = VCD_FUNCTION_MAC_RLC_STATUS_IND DESC = VCD function MAC_RLC_STATUS_IND GROUP = ALL:VCD:ENB:VCD_FUNCTION From 5ebdbf9f2d99a675844d5a63f02876a807d94859 Mon Sep 17 00:00:00 2001 From: Cedric Roux Date: Mon, 19 Dec 2016 12:25:35 +0100 Subject: [PATCH 349/349] integration fix: align32 missing (NOT DEFINITIVE!) We have a crash: Program received signal SIGSEGV, Segmentation fault. [Switching to Thread 0x7fff7387d700 (LWP 1944)] ulsch_decoding (eNB=eNB@entry=0x7fffaf73b010, proc=proc@entry=0x7fffaf73b480, UE_id=UE_id@entry=0 '\000', control_only_flag=control_only_flag@entry=0 '\000', Nbundled=, llr8_flag=) at /roux/merge/openairinterface5g/openair1/PHY/LTE_TRANSPORT/ulsch_decoding.c:1450 1450 *((__m256i *)&ulsch_harq->e[iprime]) = *((__m256i *)&y[j2]); This commit reduces the apparition of the crash, but does not eliminate it completely. To be fixed after integration. --- openair1/PHY/LTE_TRANSPORT/ulsch_decoding.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openair1/PHY/LTE_TRANSPORT/ulsch_decoding.c b/openair1/PHY/LTE_TRANSPORT/ulsch_decoding.c index 7f4f4cf5f6..68f3abc094 100644 --- a/openair1/PHY/LTE_TRANSPORT/ulsch_decoding.c +++ b/openair1/PHY/LTE_TRANSPORT/ulsch_decoding.c @@ -872,7 +872,7 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc, int16_t ys,c; uint32_t wACK_idx; uint8_t dummy_w_cc[3*(MAX_CQI_BITS+8+32)]; - int16_t y[6*14*1200]; + int16_t y[6*14*1200] __attribute__((aligned(32))); uint8_t ytag[14*1200]; // uint8_t ytag2[6*14*1200],*ytag2_ptr; int16_t cseq[6*14*1200];