diff --git a/CMakeLists.txt b/CMakeLists.txt index 5ce23ce926..26eb35eb51 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -189,12 +189,17 @@ elseif(${CPUARCH} NOT STREQUAL "x86_64") message(FATAL_ERROR "Cannot compile for CPU architecture ${CPUARCH}") endif() -set(C_FLAGS_PROCESSOR "${C_FLAGS_PROCESSOR} -fno-var-tracking-assignments -march=native") +set(C_FLAGS_PROCESSOR "${C_FLAGS_PROCESSOR} -march=native") # add autotools definitions that were maybe used! add_definitions("-DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_FCNTL_H=1 -DHAVE_ARPA_INET_H=1 -DHAVE_SYS_TIME_H=1 -DHAVE_SYS_SOCKET_H=1 -DHAVE_STRERROR=1 -DHAVE_SOCKET=1 -DHAVE_MEMSET=1 -DHAVE_GETTIMEOFDAY=1 -DHAVE_STDLIB_H=1 -DHAVE_MALLOC=1 -DHAVE_LIBSCTP") -set(commonOpts "-pipe -Wno-packed-bitfield-compat -fPIC -Wall -fno-strict-aliasing -rdynamic") +set(commonOpts "-pipe -fPIC -Wall -fno-strict-aliasing") +# GNU C/C++ Compiler might throw many warnings without packed-bitfield-compat, see man page +# also, we need -rdynamic to incorporate all symbols in shared objects, again, see man page +if(CMAKE_C_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "GNU") + set(commonOpts "${commonOpts} -Wno-packed-bitfield-compat -rdynamic") +endif() set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${C_FLAGS_PROCESSOR} ${commonOpts} -std=gnu11 -funroll-loops") diff --git a/cmake_targets/at_commands/CMakeLists.txt b/cmake_targets/at_commands/CMakeLists.txt index d2d5db704e..9e16576ba9 100755 --- a/cmake_targets/at_commands/CMakeLists.txt +++ b/cmake_targets/at_commands/CMakeLists.txt @@ -82,7 +82,7 @@ endif() set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS Debug Release RelWithDebInfo MinSizeRel) # -set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -msse4.2 -std=gnu99 -Wall -Wstrict-prototypes -fno-strict-aliasing -rdynamic -funroll-loops -Wno-packed-bitfield-compat ") +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -msse4.2 -std=gnu99 -Wall -Wstrict-prototypes -fno-strict-aliasing -rdynamic -funroll-loops") set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -ggdb -DMALLOC_CHECK_=3") set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} -ggdb -DMALLOC_CHECK_=3 -O2") diff --git a/cmake_targets/nas_sim_tools/CMakeLists.txt b/cmake_targets/nas_sim_tools/CMakeLists.txt index 739e55a33e..05d7a42712 100755 --- a/cmake_targets/nas_sim_tools/CMakeLists.txt +++ b/cmake_targets/nas_sim_tools/CMakeLists.txt @@ -10,7 +10,7 @@ add_definitions(-std=gnu99) ENABLE_LANGUAGE(C) set(CMAKE_C_FLAGS - "${CMAKE_C_FLAGS} ${C_FLAGS_PROCESSOR} -Werror -Wall -Wstrict-prototypes -Wno-packed-bitfield-compat -g") + "${CMAKE_C_FLAGS} ${C_FLAGS_PROCESSOR} -Werror -Wall -Wstrict-prototypes -g") set(OPENAIR_DIR $ENV{OPENAIR_DIR}) set(OPENAIR3_DIR $ENV{OPENAIR_DIR}/openair3) diff --git a/common/utils/ocp_itti/intertask_interface.h b/common/utils/ocp_itti/intertask_interface.h index 19b0ba32a9..131606f6fe 100644 --- a/common/utils/ocp_itti/intertask_interface.h +++ b/common/utils/ocp_itti/intertask_interface.h @@ -64,6 +64,9 @@ typedef struct itti_lte_time_s { typedef struct IttiMsgEmpty_s { + // This dummy element is to avoid CLANG warning: empty struct has size 0 in C, size 1 in C++ + // To be removed if the structure is filled + uint32_t dummy; } IttiMsgEmpty; typedef struct IttiMsgText_s { diff --git a/docker/Dockerfile.phySim.rhel8.2 b/docker/Dockerfile.phySim.rhel8.2 index 6abbd52832..ad0944f02b 100644 --- a/docker/Dockerfile.phySim.rhel8.2 +++ b/docker/Dockerfile.phySim.rhel8.2 @@ -31,14 +31,16 @@ RUN rm -Rf /oai-ran WORKDIR /oai-ran COPY . . -#only install address sanitizer for this container, the others don't need it -RUN yum install -y libasan +#only install address sanitizer and LLVM (clang, ...) for this container, the others don't need it +RUN yum install -y libasan llvm-toolset #run build_oai to build the target image RUN /bin/sh oaienv && \ cd cmake_targets && \ mkdir -p log && \ - ./build_oai --phy_simulators --ninja --verbose-ci --sanitize-address --noavx512 -c + export CC=/usr/bin/clang && \ + export CXX=/usr/bin/clang++ && \ + ./build_oai --phy_simulators --gNB --eNB --nrUE --UE --ninja --verbose-ci --sanitize-address --noavx512 -c --cmake-opt -DCMAKE_C_FLAGS=-Werror --cmake-opt -DCMAKE_CXX_FLAGS=-Werror #start from scratch for target executable FROM registry.access.redhat.com/ubi8/ubi:latest as oai-physim diff --git a/executables/lte-enb.c b/executables/lte-enb.c index b9f0816764..516fafd336 100644 --- a/executables/lte-enb.c +++ b/executables/lte-enb.c @@ -206,7 +206,7 @@ static inline int rxtx(PHY_VARS_eNB *eNB, T(T_ENB_PHY_DL_TICK, T_INT(eNB->Mod_id), T_INT(proc->frame_tx), T_INT(proc->subframe_tx)); // if this is IF5 or 3GPP_eNB - if (eNB->RU_list && eNB->RU_list[0] && eNB->RU_list[0]->function < NGFI_RAU_IF4p5) { + if (eNB->RU_list[0] && eNB->RU_list[0]->function < NGFI_RAU_IF4p5) { wakeup_prach_eNB(eNB,NULL,proc->frame_rx,proc->subframe_rx); wakeup_prach_eNB_br(eNB,NULL,proc->frame_rx,proc->subframe_rx); } diff --git a/executables/lte-ru.c b/executables/lte-ru.c index a784ee5a09..23e2a3e4b4 100644 --- a/executables/lte-ru.c +++ b/executables/lte-ru.c @@ -1126,7 +1126,7 @@ static void do_ru_synch(RU_t *ru) { int check_sync(RU_t *ru, RU_t *ru_master, int subframe) { - if (fabs(ru_master->proc.t[subframe].tv_nsec - ru->proc.t[subframe].tv_nsec) > 500000) + if (labs(ru_master->proc.t[subframe].tv_nsec - ru->proc.t[subframe].tv_nsec) > 500000) return 0; return 1; @@ -1178,12 +1178,12 @@ void wakeup_L1s(RU_t *ru) { if (ru->is_slave == 0 && ( (proc->RU_mask[ru->proc.tti_rx]&(1<RU_list[i]->state == RU_RUN) { //This is master & the RRU has already been received if (check_sync(eNB->RU_list[i],eNB->RU_list[0],ru->proc.tti_rx) == 0) - LOG_E(PHY,"RU %d is not SYNC, subframe %d, time %f this is master\n", - eNB->RU_list[i]->idx, ru->proc.tti_rx, fabs(eNB->RU_list[i]->proc.t[ru->proc.tti_rx].tv_nsec - eNB->RU_list[0]->proc.t[ru->proc.tti_rx].tv_nsec)); + LOG_E(PHY,"RU %d is not SYNC, subframe %d, time %ld this is master\n", + eNB->RU_list[i]->idx, ru->proc.tti_rx, labs(eNB->RU_list[i]->proc.t[ru->proc.tti_rx].tv_nsec - eNB->RU_list[0]->proc.t[ru->proc.tti_rx].tv_nsec)); } else if (ru->is_slave == 1 && ru->state == RU_RUN && ( (proc->RU_mask[ru->proc.tti_rx]&(1<<0)) == 1)) { // master already received. TODO: we assume that RU0 is master. if (check_sync(ru,eNB->RU_list[0],ru->proc.tti_rx) == 0) - LOG_E(PHY,"RU %d is not SYNC time, subframe %d, time %f\n", - ru->idx, ru->proc.tti_rx, fabs(ru->proc.t[ru->proc.tti_rx].tv_nsec - eNB->RU_list[0]->proc.t[ru->proc.tti_rx].tv_nsec)); + LOG_E(PHY,"RU %d is not SYNC time, subframe %d, time %ld\n", + ru->idx, ru->proc.tti_rx, labs(ru->proc.t[ru->proc.tti_rx].tv_nsec - eNB->RU_list[0]->proc.t[ru->proc.tti_rx].tv_nsec)); } } diff --git a/executables/lte-softmodem.h b/executables/lte-softmodem.h index e9fc35ed1a..4143bce3a4 100644 --- a/executables/lte-softmodem.h +++ b/executables/lte-softmodem.h @@ -41,13 +41,13 @@ /* optname helpstr paramflags XXXptr defXXXval type numelt */ /*------------------------------------------------------------------------------------------------------------------------------------------*/ #define CMDLINE_UEMODEPARAMS_DESC { \ - {"calib-ue-rx", CONFIG_HLP_CALUER, 0, iptr:&rx_input_level_dBm, defintval:0, TYPE_INT, 0}, \ - {"calib-ue-rx-med", CONFIG_HLP_CALUERM, 0, iptr:&rx_input_level_dBm, defintval:0, TYPE_INT, 0}, \ - {"calib-ue-rx-byp", CONFIG_HLP_CALUERB, 0, iptr:&rx_input_level_dBm, defintval:0, TYPE_INT, 0}, \ - {"debug-ue-prach", CONFIG_HLP_DBGUEPR, PARAMFLAG_BOOL, uptr:NULL, defuintval:1, TYPE_INT, 0}, \ - {"no-L2-connect", CONFIG_HLP_NOL2CN, PARAMFLAG_BOOL, uptr:NULL, defuintval:1, TYPE_INT, 0}, \ - {"calib-prach-tx", CONFIG_HLP_CALPRACH, PARAMFLAG_BOOL, uptr:NULL, defuintval:1, TYPE_INT, 0}, \ - {"ue-dump-frame", CONFIG_HLP_DUMPFRAME, PARAMFLAG_BOOL, iptr:&dumpframe, defintval:0, TYPE_INT, 0}, \ + {"calib-ue-rx", CONFIG_HLP_CALUER, 0, .iptr=&rx_input_level_dBm, .defintval=0, TYPE_INT, 0}, \ + {"calib-ue-rx-med", CONFIG_HLP_CALUERM, 0, .iptr=&rx_input_level_dBm, .defintval=0, TYPE_INT, 0}, \ + {"calib-ue-rx-byp", CONFIG_HLP_CALUERB, 0, .iptr=&rx_input_level_dBm, .defintval=0, TYPE_INT, 0}, \ + {"debug-ue-prach", CONFIG_HLP_DBGUEPR, PARAMFLAG_BOOL, .uptr=NULL, .defuintval=1, TYPE_INT, 0}, \ + {"no-L2-connect", CONFIG_HLP_NOL2CN, PARAMFLAG_BOOL, .uptr=NULL, .defuintval=1, TYPE_INT, 0}, \ + {"calib-prach-tx", CONFIG_HLP_CALPRACH, PARAMFLAG_BOOL, .uptr=NULL, .defuintval=1, TYPE_INT, 0}, \ + {"ue-dump-frame", CONFIG_HLP_DUMPFRAME, PARAMFLAG_BOOL, .iptr=&dumpframe, .defintval=0, TYPE_INT, 0}, \ } #define CMDLINE_CALIBUERX_IDX 0 #define CMDLINE_CALIBUERXMED_IDX 1 @@ -90,25 +90,25 @@ /*-------------------------------------------------------------------------------------------------------------------------------------------------------*/ // clang-format off #define CMDLINE_UEPARAMS_DESC { \ - {"U", CONFIG_HLP_NUMUE, 0, iptr:&NB_UE_INST, defuintval:1, TYPE_INT, 0}, \ - {"ue-rxgain", CONFIG_HLP_UERXG, 0, dblptr:&(rx_gain[0][0]), defdblval:130, TYPE_DOUBLE, 0}, \ - {"ue-rxgain-off", CONFIG_HLP_UERXGOFF, 0, dblptr:&rx_gain_off, defdblval:0, TYPE_DOUBLE, 0}, \ - {"ue-txgain", CONFIG_HLP_UETXG, 0, dblptr:&(tx_gain[0][0]), defdblval:0, TYPE_DOUBLE, 0}, \ - {"ue-nb-ant-rx", CONFIG_HLP_UENANTR, 0, u8ptr:&nb_antenna_rx, defuintval:1, TYPE_UINT8, 0}, \ - {"ue-nb-ant-tx", CONFIG_HLP_UENANTT, 0, u8ptr:&nb_antenna_tx, defuintval:1, TYPE_UINT8, 0}, \ - {"ue-scan-carrier", CONFIG_HLP_UESCAN, PARAMFLAG_BOOL, iptr:&UE_scan_carrier, defintval:0, TYPE_INT, 0}, \ - {"ue-max-power", NULL, 0, iptr:&(tx_max_power[0]), defintval:23, TYPE_INT, 0}, \ - {"emul-iface", CONFIG_HLP_EMULIFACE, 0, strptr:&emul_iface, defstrval:"lo", TYPE_STRING, 100}, \ - {"L2-emul", NULL, 0, u8ptr:&nfapi_mode, defuintval:3, TYPE_UINT8, 0}, \ - {"num-ues", NULL, 0, iptr:&(NB_UE_INST), defuintval:1, TYPE_INT, 0}, \ - {"r" , CONFIG_HLP_PRB, 0, u8ptr:&(frame_parms[0]->N_RB_DL), defintval:25, TYPE_UINT8, 0}, \ - {"dlsch-demod-shift", CONFIG_HLP_DLSHIFT, 0, iptr:(int32_t *)&dlsch_demod_shift, defintval:0, TYPE_INT, 0}, \ - {"usrp-args", CONFIG_HLP_USRP_ARGS, 0, strptr:&usrp_args, defstrval:"type=b200",TYPE_STRING, 0}, \ - {"mmapped-dma", CONFIG_HLP_DMAMAP, PARAMFLAG_BOOL, uptr:&mmapped_dma, defintval:0, TYPE_INT, 0}, \ - {"T" , CONFIG_HLP_TDD, PARAMFLAG_BOOL, iptr:&tddflag, defintval:0, TYPE_INT, 0}, \ - {"A", CONFIG_HLP_TADV, 0, iptr:&(timingadv), defintval:0, TYPE_INT, 0}, \ - {"ue-idx-standalone", NULL, 0, u16ptr:&ue_idx_standalone, defuintval:0xFFFF, TYPE_UINT16, 0}, \ - {"node-number", NULL, 0, u16ptr:&node_number, defuintval:2, TYPE_UINT16, 0}, \ + {"U", CONFIG_HLP_NUMUE, 0, .iptr=&NB_UE_INST, .defuintval=1, TYPE_INT, 0}, \ + {"ue-rxgain", CONFIG_HLP_UERXG, 0, .dblptr=&(rx_gain[0][0]), .defdblval=130, TYPE_DOUBLE, 0}, \ + {"ue-rxgain-off", CONFIG_HLP_UERXGOFF, 0, .dblptr=&rx_gain_off, .defdblval=0, TYPE_DOUBLE, 0}, \ + {"ue-txgain", CONFIG_HLP_UETXG, 0, .dblptr=&(tx_gain[0][0]), .defdblval=0, TYPE_DOUBLE, 0}, \ + {"ue-nb-ant-rx", CONFIG_HLP_UENANTR, 0, .u8ptr=&nb_antenna_rx, .defuintval=1, TYPE_UINT8, 0}, \ + {"ue-nb-ant-tx", CONFIG_HLP_UENANTT, 0, .u8ptr=&nb_antenna_tx, .defuintval=1, TYPE_UINT8, 0}, \ + {"ue-scan-carrier", CONFIG_HLP_UESCAN, PARAMFLAG_BOOL, .iptr=&UE_scan_carrier, .defintval=0, TYPE_INT, 0}, \ + {"ue-max-power", NULL, 0, .iptr=&(tx_max_power[0]), .defintval=23, TYPE_INT, 0}, \ + {"emul-iface", CONFIG_HLP_EMULIFACE, 0, .strptr=&emul_iface, .defstrval="lo", TYPE_STRING, 100}, \ + {"L2-emul", NULL, 0, .u8ptr=&nfapi_mode, .defuintval=3, TYPE_UINT8, 0}, \ + {"num-ues", NULL, 0, .iptr=&(NB_UE_INST), .defuintval=1, TYPE_INT, 0}, \ + {"r" , CONFIG_HLP_PRB, 0, .u8ptr=&(frame_parms[0]->N_RB_DL), .defintval=25, TYPE_UINT8, 0}, \ + {"dlsch-demod-shift", CONFIG_HLP_DLSHIFT, 0, .iptr=(int32_t *)&dlsch_demod_shift, .defintval=0, TYPE_INT, 0}, \ + {"usrp-args", CONFIG_HLP_USRP_ARGS, 0, .strptr=&usrp_args, .defstrval="type=b200",TYPE_STRING, 0}, \ + {"mmapped-dma", CONFIG_HLP_DMAMAP, PARAMFLAG_BOOL, .uptr=&mmapped_dma, .defintval=0, TYPE_INT, 0}, \ + {"T" , CONFIG_HLP_TDD, PARAMFLAG_BOOL, .iptr=&tddflag, .defintval=0, TYPE_INT, 0}, \ + {"A", CONFIG_HLP_TADV, 0, .iptr=&(timingadv), .defintval=0, TYPE_INT, 0}, \ + {"ue-idx-standalone", NULL, 0, .u16ptr=&ue_idx_standalone, .defuintval=0xFFFF, TYPE_UINT16, 0}, \ + {"node-number", NULL, 0, .u16ptr=&node_number, .defuintval=2, TYPE_UINT16, 0}, \ } // clang-format on diff --git a/executables/lte-uesoftmodem.c b/executables/lte-uesoftmodem.c index 8e0161c1b6..7e6f779095 100644 --- a/executables/lte-uesoftmodem.c +++ b/executables/lte-uesoftmodem.c @@ -482,7 +482,7 @@ void init_openair0(LTE_DL_FRAME_PARMS *frame_parms,int rxgain) { void terminate_task(task_id_t task_id, module_id_t mod_id) { LOG_I(ENB_APP, "sending TERMINATE_MESSAGE to task %s (%d)\n", itti_get_task_name(task_id), task_id); MessageDef *msg; - msg = itti_alloc_new_message (ENB_APP, 0, TERMINATE_MESSAGE); + msg = itti_alloc_new_message (TASK_ENB_APP, 0, TERMINATE_MESSAGE); itti_send_msg_to_task (task_id, ENB_MODULE_ID_TO_INSTANCE(mod_id), msg); } diff --git a/nfapi/open-nFAPI/nfapi/public_inc/nfapi_interface.h b/nfapi/open-nFAPI/nfapi/public_inc/nfapi_interface.h index 5e8fde4487..7ce7da2290 100644 --- a/nfapi/open-nFAPI/nfapi/public_inc/nfapi_interface.h +++ b/nfapi/open-nFAPI/nfapi/public_inc/nfapi_interface.h @@ -1897,6 +1897,9 @@ typedef struct { } nfapi_ul_config_periodic_cqi_pmi_ri_report_re13_t; typedef struct { + // This dummy element is to avoid CLANG warning: empty struct has size 0 in C, size 1 in C++ + // To be removed if the structure is filled + uint32_t dummy; } nfapi_ul_config_aperiodic_cqi_pmi_ri_report_re13_t; typedef struct { @@ -3020,9 +3023,15 @@ typedef struct { #define NFAPI_LBT_DL_INDICATION_BODY_TAG 0x2058 typedef struct { + // This dummy element is to avoid CLANG warning: empty struct has size 0 in C, size 1 in C++ + // To be removed if the structure is filled + uint32_t dummy; } nfapi_error_indication_msg_invalid_state; typedef struct { + // This dummy element is to avoid CLANG warning: empty struct has size 0 in C, size 1 in C++ + // To be removed if the structure is filled + uint32_t dummy; } nfapi_error_indication_msg_bch_missing; typedef struct { diff --git a/openair1/PHY/CODING/TESTBENCH/polartest.c b/openair1/PHY/CODING/TESTBENCH/polartest.c index 9dd5e45958..72762ba441 100644 --- a/openair1/PHY/CODING/TESTBENCH/polartest.c +++ b/openair1/PHY/CODING/TESTBENCH/polartest.c @@ -29,7 +29,6 @@ int main(int argc, char *argv[]) uint32_t decoderState=0, blockErrorState=0; //0 = Success, -1 = Decoding failed, 1 = Block Error. uint16_t testLength = NR_POLAR_PBCH_PAYLOAD_BITS, coderLength = NR_POLAR_PBCH_E; uint16_t blockErrorCumulative=0, bitErrorCumulative=0; - double timeEncoderCumulative = 0, timeDecoderCumulative = 0; uint8_t aggregation_level = 8, decoderListSize = 8, logFlag = 0; uint16_t rnti=0; @@ -326,8 +325,6 @@ int main(int argc, char *argv[]) #endif //Iteration times are in microseconds. - timeEncoderCumulative+=(timeEncoder.diff/(get_cpu_freq_GHz()*1000.0)); - timeDecoderCumulative+=(timeDecoder.diff/(get_cpu_freq_GHz()*1000.0)); if (logFlag) fprintf(logFile,",%f,%d,%u,%f,%f\n", SNR, nBitError, blockErrorState, (timeEncoder.diff/(get_cpu_freq_GHz()*1000.0)), (timeDecoder.diff/(get_cpu_freq_GHz()*1000.0))); if (nBitError<0) { @@ -351,14 +348,11 @@ int main(int argc, char *argv[]) decoderListSize, SNR, ((double)blockErrorCumulative/iterations), ((double)bitErrorCumulative / (iterations*testLength)), (double)timeEncoder.diff/timeEncoder.trials/(get_cpu_freq_GHz()*1000.0),(double)timeDecoder.diff/timeDecoder.trials/(get_cpu_freq_GHz()*1000.0)); - //(timeEncoderCumulative/iterations),timeDecoderCumulative/iterations); if (blockErrorCumulative==0 && bitErrorCumulative==0) break; blockErrorCumulative = 0; bitErrorCumulative = 0; - timeEncoderCumulative = 0; - timeDecoderCumulative = 0; } print_meas(&timeEncoder,"polar_encoder",NULL,NULL); diff --git a/openair1/PHY/CODING/lte_rate_matching.c b/openair1/PHY/CODING/lte_rate_matching.c index 548b7bfcba..37298623c5 100644 --- a/openair1/PHY/CODING/lte_rate_matching.c +++ b/openair1/PHY/CODING/lte_rate_matching.c @@ -174,7 +174,7 @@ uint32_t sub_block_interleaving_cc(uint32_t D, uint8_t *d,uint8_t *w) { void sub_block_deinterleaving_turbo(uint32_t D,int16_t *d,int16_t *w) { uint32_t RTC = (D>>5), ND, ND3; - uint32_t row,col,Kpi,index; + uint32_t row,col,Kpi; uint32_t index3,k,k2; int16_t *d1,*d2,*d3; @@ -200,7 +200,6 @@ void sub_block_deinterleaving_turbo(uint32_t D,int16_t *d,int16_t *w) { #ifdef RM_DEBUG2 printf("Col %d\n",col); #endif - index = bitrev[col]; index3 = bitrev_x3[col];//3*index; for (row=0; rowN_RB_DL*12]; ul_ch_mag128 = (__m128i *)&ul_ch_mag[aarx][symbol*frame_parms->N_RB_DL*12]; - ul_ch_mag128b = (__m128i *)&ul_ch_magb[aarx][symbol*frame_parms->N_RB_DL*12]; rxdataF128 = (__m128i *)&rxdataF_ext[aarx][symbol*frame_parms->N_RB_DL*12]; rxdataF_comp128 = (__m128i *)&rxdataF_comp[aarx][symbol*frame_parms->N_RB_DL*12]; #elif defined(__arm__) || defined(__aarch64__) ul_ch128 = (int16x4_t *)&ul_ch_estimates_ext[aarx][symbol*frame_parms->N_RB_DL*12]; ul_ch_mag128 = (int16x8_t *)&ul_ch_mag[aarx][symbol*frame_parms->N_RB_DL*12]; - ul_ch_mag128b = (int16x8_t *)&ul_ch_magb[aarx][symbol*frame_parms->N_RB_DL*12]; rxdataF128 = (int16x4_t *)&rxdataF_ext[aarx][symbol*frame_parms->N_RB_DL*12]; rxdataF_comp128 = (int16x8_t *)&rxdataF_comp[aarx][symbol*frame_parms->N_RB_DL*12]; #endif @@ -912,7 +909,6 @@ void ulsch_channel_compensation(int32_t **rxdataF_ext, ul_ch128+=3; ul_ch_mag128+=3; - ul_ch_mag128b+=3; rxdataF128+=3; rxdataF_comp128+=3; #elif defined(__arm__) || defined(__aarch64__) @@ -962,7 +958,6 @@ void ulsch_channel_compensation(int32_t **rxdataF_ext, ul_ch128+=6; ul_ch_mag128+=3; - ul_ch_mag128b+=3; rxdataF128+=6; rxdataF_comp128+=3; #endif @@ -1169,7 +1164,6 @@ void rx_ulsch(PHY_VARS_eNB *eNB, pusch_vars->rxdataF_ext, pusch_vars->drs_ch_estimates, pusch_vars->ul_ch_mag, - pusch_vars->ul_ch_magb, pusch_vars->rxdataF_comp, frame_parms, l, diff --git a/openair1/PHY/LTE_UE_TRANSPORT/dlsch_demodulation.c b/openair1/PHY/LTE_UE_TRANSPORT/dlsch_demodulation.c index 8c0681e162..9e646bd793 100644 --- a/openair1/PHY/LTE_UE_TRANSPORT/dlsch_demodulation.c +++ b/openair1/PHY/LTE_UE_TRANSPORT/dlsch_demodulation.c @@ -4550,12 +4550,11 @@ void dlsch_alamouti(LTE_DL_FRAME_PARMS *frame_parms, unsigned short nb_rb) { #if defined(__x86_64__)||defined(__i386__) short *rxF0,*rxF1; - __m128i *ch_mag0,*ch_mag1,*ch_mag0b,*ch_mag1b, *rxF0_128; + __m128i *ch_mag0,*ch_mag1,*ch_mag0b,*ch_mag1b; unsigned char rb,re; int jj = (symbol*frame_parms->N_RB_DL*12); uint8_t symbol_mod = (symbol>=(7-frame_parms->Ncp)) ? symbol-(7-frame_parms->Ncp) : symbol; uint8_t pilots = ((symbol_mod==0)||(symbol_mod==(4-frame_parms->Ncp))) ? 1 : 0; - rxF0_128 = (__m128i *) &rxdataF_comp[0][jj]; //amp = _mm_set1_epi16(ONE_OVER_2_Q15); // printf("Doing alamouti!\n"); rxF0 = (short *)&rxdataF_comp[0][jj]; //tx antenna 0 h0*y @@ -4590,33 +4589,20 @@ void dlsch_alamouti(LTE_DL_FRAME_PARMS *frame_parms, //ch_mag0b[0] = _mm_srai_epi16(ch_mag0b[0],1); //ch_mag0b[1] = _mm_srai_epi16(ch_mag0b[1],1); - //rxF0_128[0] = _mm_mulhi_epi16(rxF0_128[0],amp); - //rxF0_128[0] = _mm_slli_epi16(rxF0_128[0],1); - //rxF0_128[1] = _mm_mulhi_epi16(rxF0_128[1],amp); - //rxF0_128[1] = _mm_slli_epi16(rxF0_128[1],1); - - //rxF0_128[0] = _mm_srai_epi16(rxF0_128[0],1); - //rxF0_128[1] = _mm_srai_epi16(rxF0_128[1],1); - if (pilots==0) { ch_mag0[2] = _mm_adds_epi16(ch_mag0[2],ch_mag1[2]); ch_mag0b[2] = _mm_adds_epi16(ch_mag0b[2],ch_mag1b[2]); //ch_mag0[2] = _mm_srai_epi16(ch_mag0[2],1); //ch_mag0b[2] = _mm_srai_epi16(ch_mag0b[2],1); - //rxF0_128[2] = _mm_mulhi_epi16(rxF0_128[2],amp); - //rxF0_128[2] = _mm_slli_epi16(rxF0_128[2],1); - //rxF0_128[2] = _mm_srai_epi16(rxF0_128[2],1); ch_mag0+=3; ch_mag1+=3; ch_mag0b+=3; ch_mag1b+=3; - rxF0_128+=3; } else { ch_mag0+=2; ch_mag1+=2; ch_mag0b+=2; ch_mag1b+=2; - rxF0_128+=2; } } diff --git a/openair1/PHY/LTE_UE_TRANSPORT/dlsch_llr_computation.c b/openair1/PHY/LTE_UE_TRANSPORT/dlsch_llr_computation.c index 3a366e748d..c5478a6340 100644 --- a/openair1/PHY/LTE_UE_TRANSPORT/dlsch_llr_computation.c +++ b/openair1/PHY/LTE_UE_TRANSPORT/dlsch_llr_computation.c @@ -569,7 +569,6 @@ void dlsch_64qam_llr(LTE_DL_FRAME_PARMS *frame_parms, unsigned char symbol_mod,len_mod4; short *llr; int16_t *llr2; - int8_t *pllr_symbol; /* if (first_symbol_flag==1) @@ -579,9 +578,6 @@ void dlsch_64qam_llr(LTE_DL_FRAME_PARMS *frame_parms, */ llr = dlsch_llr; - pllr_symbol = (int8_t*)dlsch_llr; - pllr_symbol += llr_offset; - symbol_mod = (symbol>=(7-frame_parms->Ncp)) ? symbol-(7-frame_parms->Ncp) : symbol; if ((symbol_mod==0) || (symbol_mod==(4-frame_parms->Ncp))) { @@ -597,15 +593,6 @@ void dlsch_64qam_llr(LTE_DL_FRAME_PARMS *frame_parms, len = (nb_rb*12) - pbch_pss_sss_adjust; } -// printf("dlsch_64qam_llr: symbol %d,nb_rb %d, len %d,pbch_pss_sss_adjust %d\n",symbol,nb_rb,len,pbch_pss_sss_adjust); - -/* LOG_I(PHY,"dlsch_64qam_llr [symb %d / FirstSym %d / Length %d]: @LLR Buff %x \n", - symbol, - first_symbol_flag, - len, - dlsch_llr, - pllr_symbol);*/ - llr2 = llr; llr += (len*6); @@ -8325,7 +8312,6 @@ int dlsch_64qam_64qam_llr(LTE_DL_FRAME_PARMS *frame_parms, int16_t *ch_mag_i = (int16_t*)&dl_ch_mag_i[0][(symbol*frame_parms->N_RB_DL*12)]; int16_t *rho = (int16_t*)&rho_i[0][(symbol*frame_parms->N_RB_DL*12)]; int16_t *llr16; - int8_t *pllr_symbol; // pointer where llrs should filled for this ofdm symbol int len; uint8_t symbol_mod = (symbol >= (7-frame_parms->Ncp))? (symbol-(7-frame_parms->Ncp)) : symbol; @@ -8354,18 +8340,6 @@ int dlsch_64qam_64qam_llr(LTE_DL_FRAME_PARMS *frame_parms, len = (nb_rb*12) - pbch_pss_sss_adjust; } - pllr_symbol = (int8_t*)dlsch_llr; - pllr_symbol += llr_offset; - //printf("dlsch_64qam_64qam_llr: symbol %d,nb_rb %d, len %d,pbch_pss_sss_adjust %d\n",symbol,nb_rb,len,pbch_pss_sss_adjust); - /*LOG_I(PHY,"dlsch_64qam_64qam_llr [symb %d / FirstSym %d / Length %d / LLR Offset %d]: @LLR Buff %x, @LLR Buff(symb) %x, , @Compute LLR Buff(symb) %x \n", - symbol, - first_symbol_flag, - len, - llr_offset, - (int16_t*)dlsch_llr, - llr16, - pllr_symbol);*/ - // Round length up to multiple of 16 words uint32_t len256i = ((len+16)>>4)*16; int32_t *rxF_256i = (int32_t*) malloc16_clear(len256i*4); diff --git a/openair1/PHY/LTE_UE_TRANSPORT/pmch_ue.c b/openair1/PHY/LTE_UE_TRANSPORT/pmch_ue.c index eb9e3bc742..fe82120e2f 100644 --- a/openair1/PHY/LTE_UE_TRANSPORT/pmch_ue.c +++ b/openair1/PHY/LTE_UE_TRANSPORT/pmch_ue.c @@ -145,7 +145,7 @@ void mch_extract_rbs_khz_1dot25(int **rxdataF, /*unsigned char symbol,*/ unsigned char subframe, LTE_DL_FRAME_PARMS *frame_parms) { - int i,j,offset,aarx,numext; + int i, j, offset, aarx; if( (subframe&0x1) == 0) { offset=0; @@ -153,8 +153,6 @@ void mch_extract_rbs_khz_1dot25(int **rxdataF, offset=3; } - numext=0; - for (aarx=0; aarxnb_antennas_rx; aarx++) { for (i=0,j=0; iN_RB_DL*72; i++) { if( ((i-offset)%6) != 0 ) { @@ -163,7 +161,6 @@ void mch_extract_rbs_khz_1dot25(int **rxdataF, rxdataF_ext[aarx][(frame_parms->N_RB_DL*60)+j+0] = rxdataF[aarx][i+1+0]; //DC dl_ch_estimates_ext[aarx][j+0] = dl_ch_estimates[aarx][i+0]; dl_ch_estimates_ext[aarx][(frame_parms->N_RB_DL*60)+j+0] = dl_ch_estimates[aarx][i+(frame_parms->N_RB_DL*72)+0]; - numext+=2; j++; } } diff --git a/openair1/SCHED/ru_procedures.c b/openair1/SCHED/ru_procedures.c index fc566db485..fdeb58ead1 100644 --- a/openair1/SCHED/ru_procedures.c +++ b/openair1/SCHED/ru_procedures.c @@ -618,7 +618,7 @@ void init_fep_thread(RU_t *ru, void kill_fep_thread(RU_t *ru) { RU_proc_t *proc = &ru->proc; - if (proc->pthread_fep == 0) + if (proc->pthread_fep[0] == 0) return; pthread_mutex_lock( &proc->mutex_fep[0] ); proc->instance_cnt_fep[0] = 0; diff --git a/openair1/SCHED_NR/phy_procedures_nr_gNB.c b/openair1/SCHED_NR/phy_procedures_nr_gNB.c index 7060d13e51..24cacd092f 100644 --- a/openair1/SCHED_NR/phy_procedures_nr_gNB.c +++ b/openair1/SCHED_NR/phy_procedures_nr_gNB.c @@ -602,9 +602,8 @@ void fill_ul_rb_mask(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx) { for (int ULSCH_id = 0; ULSCH_id < gNB->max_nb_pusch; ULSCH_id++) { NR_gNB_ULSCH_t *ulsch = &gNB->ulsch[ULSCH_id]; - int harq_pid; NR_UL_gNB_HARQ_t *ulsch_harq = ulsch->harq_process; - AssertFatal(ulsch_harq != NULL, "harq_pid %d is not allocated\n", harq_pid); + AssertFatal(ulsch_harq != NULL, "harq_pid %d is not allocated\n", ulsch->harq_pid); if ((ulsch->active == true) && (ulsch->frame == frame_rx) && (ulsch->slot == slot_rx) && (ulsch->handled == 0)) { uint8_t symbol_start = ulsch_harq->ulsch_pdu.start_symbol_index; uint8_t symbol_end = symbol_start + ulsch_harq->ulsch_pdu.nr_of_symbols; diff --git a/openair1/SIMULATION/NR_PHY/ulsim.c b/openair1/SIMULATION/NR_PHY/ulsim.c index d8ffdcc55e..5c9a443a0b 100644 --- a/openair1/SIMULATION/NR_PHY/ulsim.c +++ b/openair1/SIMULATION/NR_PHY/ulsim.c @@ -1225,7 +1225,7 @@ int main(int argc, char **argv) tx_offset = frame_parms->get_samples_slot_timestamp(slot, frame_parms, 0); txlev_sum = 0; for (int aa = 0; aa < UE->frame_parms.nb_antennas_tx; aa++) { - atxlev[aa] = signal_energy((int32_t*)&UE->common_vars.txdata[aa][tx_offset + 5 * frame_parms->ofdm_symbol_size + 4 * frame_parms->nb_prefix_samples + frame_parms->nb_prefix_samples0], + atxlev[aa] = signal_energy((int32_t *)&UE->common_vars.txdata[aa][tx_offset + 5 * frame_parms->ofdm_symbol_size + 4 * frame_parms->nb_prefix_samples + frame_parms->nb_prefix_samples0], frame_parms->ofdm_symbol_size + frame_parms->nb_prefix_samples); txlev_sum += atxlev[aa]; diff --git a/openair2/COMMON/as_message.h b/openair2/COMMON/as_message.h index ef7314697f..0848714c2c 100644 --- a/openair2/COMMON/as_message.h +++ b/openair2/COMMON/as_message.h @@ -331,7 +331,9 @@ typedef struct nas_establish_req_s { * fill me */ typedef struct nas_deregistration_req_s { - // fill me + // This dummy element is to avoid CLANG warning: empty struct has size 0 in C, size 1 in C++ + // To be removed if the structure is filled + uint32_t dummy; } nas_deregistration_req_t; /* @@ -469,7 +471,11 @@ typedef ul_info_transfer_ind_t dl_info_transfer_ind_t; */ /* TODO: Quality of Service parameters */ -typedef struct {} as_qos_t; +typedef struct { + // This dummy element is to avoid CLANG warning: empty struct has size 0 in C, size 1 in C++ + // To be removed if the structure is filled + uint32_t dummy; +} as_qos_t; /* * NAS->AS - Radio access bearer establishment request diff --git a/openair2/COMMON/f1ap_messages_types.h b/openair2/COMMON/f1ap_messages_types.h index d8aac0fff1..9d507df8f3 100644 --- a/openair2/COMMON/f1ap_messages_types.h +++ b/openair2/COMMON/f1ap_messages_types.h @@ -73,7 +73,9 @@ typedef struct f1ap_net_ip_address_s { } f1ap_net_ip_address_t; typedef struct f1ap_cu_setup_req_s { - // + // This dummy element is to avoid CLANG warning: empty struct has size 0 in C, size 1 in C++ + // To be removed if the structure is filled + uint32_t dummy; } f1ap_cu_setup_req_t; typedef struct cellIDs_s { diff --git a/openair2/COMMON/m2ap_messages_types.h b/openair2/COMMON/m2ap_messages_types.h index 90d1cd386d..4187f1736c 100644 --- a/openair2/COMMON/m2ap_messages_types.h +++ b/openair2/COMMON/m2ap_messages_types.h @@ -90,7 +90,9 @@ typedef struct m2ap_net_ip_address_s { } m2ap_net_ip_address_t; typedef struct m2ap_enb_setup_req_s { - // + // This dummy element is to avoid CLANG warning: empty struct has size 0 in C, size 1 in C++ + // To be removed if the structure is filled + uint32_t dummy; } m2ap_enb_setup_req_t; @@ -449,6 +451,9 @@ typedef struct m2ap_register_enb_req_s { typedef struct m2ap_subframe_process_s { /* nothing, we simply use the module ID in the header */ + // This dummy element is to avoid CLANG warning: empty struct has size 0 in C, size 1 in C++ + // To be removed if the structure is filled + uint32_t dummy; } m2ap_subframe_process_t; //-------------------------------------------------------------------------------------------// @@ -533,48 +538,114 @@ typedef struct m2ap_enb_sctp_req_s { typedef struct m2ap_mbms_scheduling_information_resp_s { + // This dummy element is to avoid CLANG warning: empty struct has size 0 in C, size 1 in C++ + // To be removed if the structure is filled + uint32_t dummy; } m2ap_mbms_scheduling_information_resp_t; typedef struct m2ap_session_start_req_s { + // This dummy element is to avoid CLANG warning: empty struct has size 0 in C, size 1 in C++ + // To be removed if the structure is filled + uint32_t dummy; } m2ap_session_start_req_t; typedef struct m2ap_session_start_resp_s { + // This dummy element is to avoid CLANG warning: empty struct has size 0 in C, size 1 in C++ + // To be removed if the structure is filled + uint32_t dummy; } m2ap_session_start_resp_t; typedef struct m2ap_session_start_failure_s { + // This dummy element is to avoid CLANG warning: empty struct has size 0 in C, size 1 in C++ + // To be removed if the structure is filled + uint32_t dummy; } m2ap_session_start_failure_t; typedef struct m2ap_session_stop_req_s { + // This dummy element is to avoid CLANG warning: empty struct has size 0 in C, size 1 in C++ + // To be removed if the structure is filled + uint32_t dummy; } m2ap_session_stop_req_t; typedef struct m2ap_session_stop_resp_s { + // This dummy element is to avoid CLANG warning: empty struct has size 0 in C, size 1 in C++ + // To be removed if the structure is filled + uint32_t dummy; } m2ap_session_stop_resp_t; typedef struct m2ap_reset_s { + // This dummy element is to avoid CLANG warning: empty struct has size 0 in C, size 1 in C++ + // To be removed if the structure is filled + uint32_t dummy; } m2ap_reset_t; typedef struct m2ap_enb_configuration_update_s { + // This dummy element is to avoid CLANG warning: empty struct has size 0 in C, size 1 in C++ + // To be removed if the structure is filled + uint32_t dummy; } m2ap_enb_configuration_update_t; typedef struct m2ap_enb_configuration_update_ack_s { + // This dummy element is to avoid CLANG warning: empty struct has size 0 in C, size 1 in C++ + // To be removed if the structure is filled + uint32_t dummy; } m2ap_enb_configuration_update_ack_t; typedef struct m2ap_enb_configuration_update_failure_s { + // This dummy element is to avoid CLANG warning: empty struct has size 0 in C, size 1 in C++ + // To be removed if the structure is filled + uint32_t dummy; } m2ap_enb_configuration_update_failure_t; typedef struct m2ap_mce_configuration_update_s { + // This dummy element is to avoid CLANG warning: empty struct has size 0 in C, size 1 in C++ + // To be removed if the structure is filled + uint32_t dummy; } m2ap_mce_configuration_update_t; typedef struct m2ap_mce_configuration_update_ack_s { + // This dummy element is to avoid CLANG warning: empty struct has size 0 in C, size 1 in C++ + // To be removed if the structure is filled + uint32_t dummy; } m2ap_mce_configuration_update_ack_t; typedef struct m2ap_mce_configuration_update_failure_s { + // This dummy element is to avoid CLANG warning: empty struct has size 0 in C, size 1 in C++ + // To be removed if the structure is filled + uint32_t dummy; } m2ap_mce_configuration_update_failure_t; typedef struct m2ap_error_indication_s { + // This dummy element is to avoid CLANG warning: empty struct has size 0 in C, size 1 in C++ + // To be removed if the structure is filled + uint32_t dummy; }m2ap_error_indication_t; typedef struct m2ap_mbms_session_update_req_s { + // This dummy element is to avoid CLANG warning: empty struct has size 0 in C, size 1 in C++ + // To be removed if the structure is filled + uint32_t dummy; } m2ap_mbms_session_update_req_t; typedef struct m2ap_mbms_session_update_resp_s { + // This dummy element is to avoid CLANG warning: empty struct has size 0 in C, size 1 in C++ + // To be removed if the structure is filled + uint32_t dummy; } m2ap_mbms_session_update_resp_t; typedef struct m2ap_mbms_session_update_failure_s { + // This dummy element is to avoid CLANG warning: empty struct has size 0 in C, size 1 in C++ + // To be removed if the structure is filled + uint32_t dummy; } m2ap_mbms_session_update_failure_t; typedef struct m2ap_mbms_service_counting_report_s { + // This dummy element is to avoid CLANG warning: empty struct has size 0 in C, size 1 in C++ + // To be removed if the structure is filled + uint32_t dummy; } m2ap_mbms_service_counting_report_t; typedef struct m2ap_mbms_overload_notification_s { + // This dummy element is to avoid CLANG warning: empty struct has size 0 in C, size 1 in C++ + // To be removed if the structure is filled + uint32_t dummy; } m2ap_mbms_overload_notification_t; typedef struct m2ap_mbms_service_counting_req_s { + // This dummy element is to avoid CLANG warning: empty struct has size 0 in C, size 1 in C++ + // To be removed if the structure is filled + uint32_t dummy; } m2ap_mbms_service_counting_req_t; typedef struct m2ap_mbms_service_counting_resp_s { + // This dummy element is to avoid CLANG warning: empty struct has size 0 in C, size 1 in C++ + // To be removed if the structure is filled + uint32_t dummy; } m2ap_mbms_service_counting_resp_t; typedef struct m2ap_mbms_service_counting_failure_s { + // This dummy element is to avoid CLANG warning: empty struct has size 0 in C, size 1 in C++ + // To be removed if the structure is filled + uint32_t dummy; } m2ap_mbms_service_counting_failure_t; diff --git a/openair2/COMMON/m3ap_messages_types.h b/openair2/COMMON/m3ap_messages_types.h index 36ac8fcc9a..815f8b6df4 100644 --- a/openair2/COMMON/m3ap_messages_types.h +++ b/openair2/COMMON/m3ap_messages_types.h @@ -160,6 +160,9 @@ typedef struct m3ap_register_mce_req_s { typedef struct m3ap_subframe_process_s { /* nothing, we simply use the module ID in the header */ + // This dummy element is to avoid CLANG warning: empty struct has size 0 in C, size 1 in C++ + // To be removed if the structure is filled + uint32_t dummy; } m3ap_subframe_process_t; //-------------------------------------------------------------------------------------------// @@ -270,28 +273,64 @@ typedef struct m3ap_mme_sctp_req_s { typedef struct m3ap_session_start_req_s{ + // This dummy element is to avoid CLANG warning: empty struct has size 0 in C, size 1 in C++ + // To be removed if the structure is filled + uint32_t dummy; }m3ap_session_start_req_t; typedef struct m3ap_session_start_resp_s{ + // This dummy element is to avoid CLANG warning: empty struct has size 0 in C, size 1 in C++ + // To be removed if the structure is filled + uint32_t dummy; }m3ap_session_start_resp_t; typedef struct m3ap_session_start_failure_s{ + // This dummy element is to avoid CLANG warning: empty struct has size 0 in C, size 1 in C++ + // To be removed if the structure is filled + uint32_t dummy; }m3ap_session_start_failure_t; typedef struct m3ap_session_stop_req_s{ + // This dummy element is to avoid CLANG warning: empty struct has size 0 in C, size 1 in C++ + // To be removed if the structure is filled + uint32_t dummy; }m3ap_session_stop_req_t; typedef struct m3ap_session_stop_resp_s{ + // This dummy element is to avoid CLANG warning: empty struct has size 0 in C, size 1 in C++ + // To be removed if the structure is filled + uint32_t dummy; }m3ap_session_stop_resp_t; typedef struct m3ap_session_stop_failure_s{ + // This dummy element is to avoid CLANG warning: empty struct has size 0 in C, size 1 in C++ + // To be removed if the structure is filled + uint32_t dummy; }m3ap_session_stop_failure_t; typedef struct m3ap_error_indication_s{ + // This dummy element is to avoid CLANG warning: empty struct has size 0 in C, size 1 in C++ + // To be removed if the structure is filled + uint32_t dummy; }m3ap_error_indication_t; typedef struct m3ap_reset_s{ + // This dummy element is to avoid CLANG warning: empty struct has size 0 in C, size 1 in C++ + // To be removed if the structure is filled + uint32_t dummy; }m3ap_reset_t; typedef struct m3ap_reset_ack_s{ + // This dummy element is to avoid CLANG warning: empty struct has size 0 in C, size 1 in C++ + // To be removed if the structure is filled + uint32_t dummy; }m3ap_reset_ack_t; typedef struct m3ap_mbms_session_update_req_s{ + // This dummy element is to avoid CLANG warning: empty struct has size 0 in C, size 1 in C++ + // To be removed if the structure is filled + uint32_t dummy; }m3ap_mbms_session_update_req_t; typedef struct m3ap_mbms_session_update_resp_s{ + // This dummy element is to avoid CLANG warning: empty struct has size 0 in C, size 1 in C++ + // To be removed if the structure is filled + uint32_t dummy; }m3ap_mbms_session_update_resp_t; typedef struct m3ap_mbms_session_update_failure_s{ + // This dummy element is to avoid CLANG warning: empty struct has size 0 in C, size 1 in C++ + // To be removed if the structure is filled + uint32_t dummy; }m3ap_mbms_session_update_failure_t; typedef struct m3ap_setup_req_s{ /* Connexion id used between SCTP/M3AP */ @@ -306,14 +345,29 @@ typedef struct m3ap_setup_req_s{ uint16_t default_sctp_stream_id; }m3ap_setup_req_t; typedef struct m3ap_setup_resp_s{ + // This dummy element is to avoid CLANG warning: empty struct has size 0 in C, size 1 in C++ + // To be removed if the structure is filled + uint32_t dummy; }m3ap_setup_resp_t; typedef struct m3ap_setup_failure_s{ + // This dummy element is to avoid CLANG warning: empty struct has size 0 in C, size 1 in C++ + // To be removed if the structure is filled + uint32_t dummy; }m3ap_setup_failure_t; typedef struct m3ap_mce_configuration_update_s{ + // This dummy element is to avoid CLANG warning: empty struct has size 0 in C, size 1 in C++ + // To be removed if the structure is filled + uint32_t dummy; }m3ap_mce_configuration_update_t; typedef struct m3ap_mce_configuration_update_ack_s{ + // This dummy element is to avoid CLANG warning: empty struct has size 0 in C, size 1 in C++ + // To be removed if the structure is filled + uint32_t dummy; }m3ap_mce_configuration_update_ack_t; typedef struct m3ap_mce_configuration_update_failure_s{ + // This dummy element is to avoid CLANG warning: empty struct has size 0 in C, size 1 in C++ + // To be removed if the structure is filled + uint32_t dummy; }m3ap_mce_configuration_update_failure_t; diff --git a/openair2/COMMON/phy_messages_types.h b/openair2/COMMON/phy_messages_types.h index 40e4678228..aef018db76 100644 --- a/openair2/COMMON/phy_messages_types.h +++ b/openair2/COMMON/phy_messages_types.h @@ -82,6 +82,9 @@ typedef struct PhyConfigurationReq_s { // UE: RRC -> PHY messages typedef struct PhyDeactivateReq_s { + // This dummy element is to avoid CLANG warning: empty struct has size 0 in C, size 1 in C++ + // To be removed if the structure is filled + uint32_t dummy; } PhyDeactivateReq; typedef struct PhyFindCellReq_s { @@ -93,9 +96,15 @@ typedef struct PhyFindCellReq_s { } PhyFindCellReq; typedef struct PhyFindNextCellReq_s { + // This dummy element is to avoid CLANG warning: empty struct has size 0 in C, size 1 in C++ + // To be removed if the structure is filled + uint32_t dummy; } PhyFindNextCellReq; typedef struct PhyMeasThresholdReq_s { + // This dummy element is to avoid CLANG warning: empty struct has size 0 in C, size 1 in C++ + // To be removed if the structure is filled + uint32_t dummy; # if ENABLE_RAL ral_transaction_id_t transaction_id; ral_link_cfg_param_t cfg_param; @@ -103,6 +112,9 @@ typedef struct PhyMeasThresholdReq_s { } PhyMeasThresholdReq; typedef struct PhyMeasReportInd_s { + // This dummy element is to avoid CLANG warning: empty struct has size 0 in C, size 1 in C++ + // To be removed if the structure is filled + uint32_t dummy; # if ENABLE_RAL ral_threshold_t threshold; ral_link_param_t link_param; @@ -119,6 +131,9 @@ typedef struct PhyFindCellInd_s { } PhyFindCellInd; typedef struct PhyMeasThresholdConf_s { + // This dummy element is to avoid CLANG warning: empty struct has size 0 in C, size 1 in C++ + // To be removed if the structure is filled + uint32_t dummy; # if ENABLE_RAL ral_transaction_id_t transaction_id; ral_status_t status; diff --git a/openair2/COMMON/x2ap_messages_types.h b/openair2/COMMON/x2ap_messages_types.h index cd092b6ca8..ca01be5035 100644 --- a/openair2/COMMON/x2ap_messages_types.h +++ b/openair2/COMMON/x2ap_messages_types.h @@ -174,6 +174,9 @@ typedef struct x2ap_register_enb_req_s { typedef struct x2ap_subframe_process_s { /* nothing, we simply use the module ID in the header */ + // This dummy element is to avoid CLANG warning: empty struct has size 0 in C, size 1 in C++ + // To be removed if the structure is filled + uint32_t dummy; } x2ap_subframe_process_t; //-------------------------------------------------------------------------------------------// diff --git a/openair2/ENB_APP/enb_paramdef_mme.h b/openair2/ENB_APP/enb_paramdef_mme.h index fde9b1c3a8..b1deee0e8e 100644 --- a/openair2/ENB_APP/enb_paramdef_mme.h +++ b/openair2/ENB_APP/enb_paramdef_mme.h @@ -45,9 +45,9 @@ #define MME_CONFIG_STRING_MME_M3 "enable_mme_m3" #define MMEPARAMS_DESC {\ -{MME_CONFIG_STRING_MME_ID, NULL, 0, uptr:NULL, defintval:0, TYPE_UINT, 0}, \ -{MME_CONFIG_STRING_MME_NAME, NULL, 0, strptr:NULL, defstrval:"OAIMME", TYPE_STRING, 0}, \ -{MME_CONFIG_STRING_MME_M3, NULL, 0, strptr:NULL, defstrval:"no", TYPE_STRING, 0}, \ +{MME_CONFIG_STRING_MME_ID, NULL, 0, .uptr=NULL, .defintval=0, TYPE_UINT, 0}, \ +{MME_CONFIG_STRING_MME_NAME, NULL, 0, .strptr=NULL, .defstrval="OAIMME", TYPE_STRING, 0}, \ +{MME_CONFIG_STRING_MME_M3, NULL, 0, .strptr=NULL, .defstrval="no", TYPE_STRING, 0}, \ } #define MME_MME_ID_IDX 0 @@ -75,9 +75,9 @@ #define MME_NETPARAMS_DESC { \ -{MME_CONFIG_STRING_MME_INTERFACE_NAME_FOR_M3_MCE, NULL, 0, strptr:&mme_interface_name_for_m3_mce, defstrval:"lo", TYPE_STRING, 0}, \ -{MME_CONFIG_STRING_MME_IPV4_ADDRESS_FOR_M3C, NULL, 0, strptr:&mme_ipv4_address_for_m3c, defstrval:"127.0.0.18/24", TYPE_STRING, 0}, \ -{MME_CONFIG_STRING_MME_PORT_FOR_M3C, NULL, 0, uptr:&mme_port_for_m3c, defintval:36444L, TYPE_UINT, 0}, \ +{MME_CONFIG_STRING_MME_INTERFACE_NAME_FOR_M3_MCE, NULL, 0, .strptr=&mme_interface_name_for_m3_mce, .defstrval="lo", TYPE_STRING, 0}, \ +{MME_CONFIG_STRING_MME_IPV4_ADDRESS_FOR_M3C, NULL, 0, .strptr=&mme_ipv4_address_for_m3c, .defstrval="127.0.0.18/24", TYPE_STRING, 0}, \ +{MME_CONFIG_STRING_MME_PORT_FOR_M3C, NULL, 0, .uptr=&mme_port_for_m3c, .defintval=36444L, TYPE_UINT, 0}, \ } #endif diff --git a/openair2/LAYER2/MAC/eNB_scheduler_mch.c b/openair2/LAYER2/MAC/eNB_scheduler_mch.c index 9cdc72a558..1478a98ac6 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler_mch.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_mch.c @@ -707,7 +707,7 @@ schedule_MBMS_NFAPI(module_id_t module_idP, uint8_t CC_id, frame_t frameP, uint16_t msi_control_element[29], *msi_ptr; // MSI buffer pointer char *buffer_pointer=NULL; - if (msi_flag == 1 && cc->mbms_SessionList) { + if (msi_flag == 1 && cc->mbms_SessionList[mbms_mch_i]) { // Create MSI here msi_ptr = &msi_control_element[0]; @@ -867,7 +867,7 @@ schedule_MBMS_NFAPI(module_id_t module_idP, uint8_t CC_id, frame_t frameP, // there is MTCHs, loop if there are more than 1 // BAd race condition: all this struct is filled by another thread, no mutex or any code to make it coherent - if (mtch_flag == 1 && cc->mbms_SessionList && cc->mbms_SessionList[0] && cc->mbms_SessionList[0]->list.array[0]) { + if (mtch_flag == 1 && cc->mbms_SessionList[0] && cc->mbms_SessionList[0]->list.array[0]) { // Calculate TBS // get MTCH data from RLC (like for DTCH) LOG_D(MAC, "[eNB %d] CC_id %d Frame %d subframeP %d: Schedule MTCH (area %d, sfAlloc %d)\n", module_idP, CC_id, frameP, subframeP, i, j); diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c b/openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c index 60c3fbd485..65ea5e2a79 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c @@ -414,7 +414,8 @@ void ra_preambles_config(NR_PRACH_RESOURCES_t *prach_resources, NR_UE_MAC_INST_t // Overwrite seed with non-random seed for IQ player/recorder seed = 1; } else { - seed=(unsigned int) (rdtsc_oai() && ~0); + // & to truncate the int64_t and keep only the LSB bits, up to sizeof(int) + seed = (unsigned int) (rdtsc_oai() & ~0); } RA_config_t *ra = &mac->ra; @@ -739,7 +740,6 @@ uint8_t nr_ue_get_rach(module_id_t mod_id, uint16_t sdu_lengths[NB_RB_MAX] = {0}; int TBS_bytes = 848; int mac_ce_len = 0; - int header_length_total=0; unsigned short post_padding = 1; // fill ulsch_buffer with random data @@ -749,7 +749,6 @@ uint8_t nr_ue_get_rach(module_id_t mod_id, //Sending SDUs with size 1 //Initialize elements of sdu_lengths sdu_lengths[0] = TBS_bytes - 3 - post_padding - mac_ce_len; - header_length_total += 2 + (sdu_lengths[0] >= 128); size_sdu += sdu_lengths[0]; if (size_sdu > 0) { @@ -966,7 +965,8 @@ void nr_ra_failed(uint8_t mod_id, uint8_t CC_id, NR_PRACH_RESOURCES_t *prach_res // Overwrite seed with non-random seed for IQ player/recorder seed = 1; } else { - seed=(unsigned int) (rdtsc_oai() && ~0); + // & to truncate the int64_t and keep only the LSB bits, up to sizeof(int) + seed = (unsigned int) (rdtsc_oai() & ~0); } ra->first_Msg3 = 1; diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c index e6f32b1405..7d16783416 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c @@ -1275,7 +1275,6 @@ void nr_schedule_ue_spec(module_id_t module_id, header->LCID = DL_SCH_LCID_PADDING; buf += sizeof(NR_MAC_SUBHEADER_LONG); header->L = htons(bufEnd-buf); - dlsch_total_bytes += bufEnd-buf; for (; ((intptr_t)buf) % 4; buf++) *buf = lrand48() & 0xff; @@ -1306,6 +1305,7 @@ void nr_schedule_ue_spec(module_id_t module_id, UE->mac_stats.dl.total_rbs += sched_pdsch->rbSize; UE->mac_stats.dl.num_mac_sdu += sdus; UE->mac_stats.dl.current_rbs = sched_pdsch->rbSize; + UE->mac_stats.dl.total_sdu_bytes += dlsch_total_bytes; /* save retransmission information */ harq->sched_pdsch = *sched_pdsch; diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c index 3c314c6c86..6ed327e125 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c @@ -325,6 +325,7 @@ int nr_process_mac_pdu(instance_t module_idP, if (UE_idx->CellGroup) { LOG_D(NR_MAC, "Frame %d : ULSCH -> UL-DCCH %d (gNB %ld, %d bytes), rnti: 0x%04x \n", frameP, rx_lcid, module_idP, mac_len, crnti); + UE->mac_stats.ul.total_sdu_bytes += mac_len; mac_rlc_data_ind(module_idP, crnti, module_idP, diff --git a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h index 1cd0f89736..b8517da55e 100644 --- a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h +++ b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h @@ -614,6 +614,7 @@ typedef struct NR_mac_dir_stats { uint64_t errors; uint64_t total_bytes; uint32_t current_bytes; + uint64_t total_sdu_bytes; uint32_t total_rbs; uint32_t total_rbs_retx; uint32_t num_mac_sdu; diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c index b0b4e235c6..b7de2ffad4 100644 --- a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c +++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c @@ -647,7 +647,6 @@ pdcp_data_ind( exit(1); } - //uint8_t dc = pdcp_get_dc_filed((unsigned char*)sdu_buffer_pP->data); } /* diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp_primitives.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp_primitives.c index 675fbd8a57..c1ba248178 100644 --- a/openair2/LAYER2/PDCP_v10.1.0/pdcp_primitives.c +++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp_primitives.c @@ -34,27 +34,6 @@ extern bool util_mark_nth_bit_of_octet(uint8_t* octet, uint8_t index); -/* - * Parses data/control field out of buffer of User Plane PDCP Data PDU with - * long PDCP SN (12-bit) - * - * @param pdu_buffer PDCP PDU buffer - * @return 1 bit dc - */ -uint8_t pdcp_get_dc_filed(unsigned char* pdu_buffer) -{ - uint8_t dc = 0x00; - - if (pdu_buffer == NULL) { - return 0; - } - - dc = (uint8_t)pdu_buffer[0] & 0xF0; // Reset D/C field - dc >>= 8; // FIXME this is broken!!! returns 0 all the time - - return dc; -} - /* * Parses sequence number out of buffer of User Plane PDCP Data PDU with * long PDCP SN (12-bit) diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp_primitives.h b/openair2/LAYER2/PDCP_v10.1.0/pdcp_primitives.h index 423f69afc9..6adcde8f74 100644 --- a/openair2/LAYER2/PDCP_v10.1.0/pdcp_primitives.h +++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp_primitives.h @@ -101,16 +101,6 @@ typedef struct { */ #define PDCP_CONTROL_PDU_STATUS_REPORT_HEADER_SIZE 2 -/* - * Parses data/control field out of buffer of User Plane PDCP Data PDU with - * long PDCP SN (12-bit) - * - * @param pdu_buffer PDCP PDU buffer - * @return 1 bit dc - */ - -uint8_t pdcp_get_dc_filed(unsigned char* pdu_buffer); - /* * Parses sequence number out of buffer of User Plane PDCP Data PDU with * long PDCP SN (12-bit) diff --git a/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c b/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c index 6aa44194a3..7312eeeef2 100644 --- a/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c +++ b/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c @@ -1245,7 +1245,7 @@ int nr_ue_dl_indication(nr_downlink_indication_t *dl_info, NR_UL_TIME_ALIGNMENT_ } } pthread_mutex_unlock(&mac_IF_mutex); - return 0; + return ret_mask; } nr_ue_if_module_t *nr_ue_if_module_init(uint32_t module_id){ diff --git a/openair2/RRC/LTE/MESSAGES/asn1_msg.c b/openair2/RRC/LTE/MESSAGES/asn1_msg.c index f5e6959cf5..8c16487296 100644 --- a/openair2/RRC/LTE/MESSAGES/asn1_msg.c +++ b/openair2/RRC/LTE/MESSAGES/asn1_msg.c @@ -1499,7 +1499,7 @@ uint8_t do_SIB23(uint8_t Mod_id, //memset((*sib2)->radioResourceConfigCommon.ext4->bcch_Config_v1310, 0, sizeof(BCCH_Config_v1310_t)); //(*sib2)->radioResourceConfigCommon.ext4->bcch_Config_v1310->modificationPeriodCoeff_v1310 = BCCH_Config_v1310__modificationPeriodCoeff_v1310_n64; - if (configuration->pcch_config_v1310) { + if (configuration->pcch_config_v1310[CC_id] == true) { (*sib2)->radioResourceConfigCommon.ext4->pcch_Config_v1310 = CALLOC(1, sizeof(LTE_PCCH_Config_v1310_t)); (*sib2)->radioResourceConfigCommon.ext4->pcch_Config_v1310->paging_narrowBands_r13 = configuration->paging_narrowbands_r13[CC_id]; (*sib2)->radioResourceConfigCommon.ext4->pcch_Config_v1310->mpdcch_NumRepetition_Paging_r13 = configuration->mpdcch_numrepetition_paging_r13[CC_id]; diff --git a/openair2/RRC/NR/nr_rrc_config.c b/openair2/RRC/NR/nr_rrc_config.c index 49115023dc..7a41c60887 100644 --- a/openair2/RRC/NR/nr_rrc_config.c +++ b/openair2/RRC/NR/nr_rrc_config.c @@ -946,7 +946,7 @@ static void set_SR_periodandoffset(NR_SchedulingRequestResourceConfig_t *schedul schedulingRequestResourceConfig->periodicityAndOffset->choice.sl160 = sr_slot; return; } - else if(sr_slot < 320 || NR_SubcarrierSpacing_kHz60){ + else if(sr_slot < 320 || scs == NR_SubcarrierSpacing_kHz60){ schedulingRequestResourceConfig->periodicityAndOffset->present = NR_SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl320; schedulingRequestResourceConfig->periodicityAndOffset->choice.sl320 = sr_slot; return; diff --git a/openair2/RRC/NR/rrc_gNB_radio_bearers.c b/openair2/RRC/NR/rrc_gNB_radio_bearers.c index b4d6c55762..f7280e209a 100644 --- a/openair2/RRC/NR/rrc_gNB_radio_bearers.c +++ b/openair2/RRC/NR/rrc_gNB_radio_bearers.c @@ -32,7 +32,6 @@ rrc_pdu_session_param_t *find_pduSession(gNB_RRC_UE_t *ue, int id, bool create) ue->nb_of_pdusessions++; else return NULL; - AssertFatal(ue->nb_of_pdusessions < NGAP_MAX_PDU_SESSION, ""); return ue->pduSession + j; } diff --git a/openair2/RRC/NR_UE/rrc_UE.c b/openair2/RRC/NR_UE/rrc_UE.c index dda30839e8..4feb4a381b 100644 --- a/openair2/RRC/NR_UE/rrc_UE.c +++ b/openair2/RRC/NR_UE/rrc_UE.c @@ -2734,9 +2734,9 @@ void process_lte_nsa_msg(nsa_msg_t *msg, int msg_len) LOG_D(NR_RRC, "Received NR band information: %ld.\n", nr_freq_band_list->list.array[i]->choice.bandInformationNR->bandNR); } - MessageDef *dummy_msg = itti_alloc_new_message(TASK_RRC_NSA_UE, 0, UE_CAPABILITY_DUMMY); + int dummy_msg = 0;// whatever piece of data, it will never be used by sendee LOG_D(NR_RRC, "We are calling nsa_sendmsg_to_lte_ue to send a UE_CAPABILITY_DUMMY\n"); - nsa_sendmsg_to_lte_ue(dummy_msg, sizeof(dummy_msg), UE_CAPABILITY_DUMMY); + nsa_sendmsg_to_lte_ue(&dummy_msg, sizeof(dummy_msg), UE_CAPABILITY_DUMMY); LOG_A(NR_RRC, "Sent initial NRUE Capability response to LTE UE\n"); break; } diff --git a/openair2/RRC/NR_UE/rrc_nsa.c b/openair2/RRC/NR_UE/rrc_nsa.c index 9e62243c65..279e920779 100644 --- a/openair2/RRC/NR_UE/rrc_nsa.c +++ b/openair2/RRC/NR_UE/rrc_nsa.c @@ -14,7 +14,7 @@ int get_from_lte_ue_fd() return from_lte_ue_fd; } -void nsa_sendmsg_to_lte_ue(const void *message, size_t msg_len, MessagesIds msg_type) +void nsa_sendmsg_to_lte_ue(const void *message, size_t msg_len, Rrc_Msg_Type_t msg_type) { LOG_I(NR_RRC, "Entered %s \n", __FUNCTION__); nsa_msg_t n_msg; diff --git a/openair2/RRC/NR_UE/rrc_proto.h b/openair2/RRC/NR_UE/rrc_proto.h index 6c0499933e..83f6773da7 100644 --- a/openair2/RRC/NR_UE/rrc_proto.h +++ b/openair2/RRC/NR_UE/rrc_proto.h @@ -160,7 +160,7 @@ void *recv_msgs_from_lte_ue(void *args_p); void init_connections_with_lte_ue(void); -void nsa_sendmsg_to_lte_ue(const void *message, size_t msg_len, MessagesIds msg_type); +void nsa_sendmsg_to_lte_ue(const void *message, size_t msg_len, Rrc_Msg_Type_t msg_type); void start_oai_nrue_threads(void); diff --git a/openair3/NAS/COMMON/API/NETWORK/nas_message.c b/openair3/NAS/COMMON/API/NETWORK/nas_message.c index d1a9e97025..02fa4ad6ca 100644 --- a/openair3/NAS/COMMON/API/NETWORK/nas_message.c +++ b/openair3/NAS/COMMON/API/NETWORK/nas_message.c @@ -986,6 +986,7 @@ static int _nas_message_decrypt( length, security_header_type); memcpy(dest, src, length); DECODE_U8(dest, *(uint8_t*)(&header), size); + (void) size; // prevent warning of unused variable, but we have to decode it LOG_FUNC_RETURN (header.protocol_discriminator); //LOG_FUNC_RETURN (length); break; @@ -1022,6 +1023,7 @@ static int _nas_message_decrypt( /* Decode the first octet (security header type or EPS bearer identity, * and protocol discriminator) */ DECODE_U8(dest, *(uint8_t*)(&header), size); + (void) size; // prevent warning of unused variable, but we have to decode it LOG_FUNC_RETURN (header.protocol_discriminator); @@ -1056,6 +1058,7 @@ static int _nas_message_decrypt( /* Decode the first octet (security header type or EPS bearer identity, * and protocol discriminator) */ DECODE_U8(dest, *(uint8_t*)(&header), size); + (void) size; // prevent warning of unused variable, but we have to decode it LOG_FUNC_RETURN (header.protocol_discriminator); } @@ -1071,6 +1074,7 @@ static int _nas_message_decrypt( /* Decode the first octet (security header type or EPS bearer identity, * and protocol discriminator) */ DECODE_U8(dest, *(uint8_t*)(&header), size); + (void) size; // prevent warning of unused variable, but we have to decode it LOG_FUNC_RETURN (header.protocol_discriminator); @@ -1084,6 +1088,7 @@ static int _nas_message_decrypt( /* Decode the first octet (security header type or EPS bearer identity, * and protocol discriminator) */ DECODE_U8(dest, *(uint8_t*)(&header), size); + (void) size; // prevent warning of unused variable, but we have to decode it LOG_FUNC_RETURN (header.protocol_discriminator); break; diff --git a/openair3/NAS/COMMON/IES/TrafficFlowTemplate.h b/openair3/NAS/COMMON/IES/TrafficFlowTemplate.h index 651ec7ef5c..b4f7a5df26 100644 --- a/openair3/NAS/COMMON/IES/TrafficFlowTemplate.h +++ b/openair3/NAS/COMMON/IES/TrafficFlowTemplate.h @@ -96,7 +96,11 @@ typedef struct { * and "no TFT operation" shall be empty. * --------------------------------------------------------------- */ -typedef struct {} NoPacketFilter; +typedef struct { + // This dummy element is to avoid CLANG warning: empty struct has size 0 in C, size 1 in C++ + // To be removed if the structure is filled + uint32_t dummy; +} NoPacketFilter; typedef NoPacketFilter DeleteExistingTft; typedef NoPacketFilter NoTftOperation; @@ -155,7 +159,9 @@ typedef union { */ typedef struct { - /* TODO */ + // This dummy element is to avoid CLANG warning: empty struct has size 0 in C, size 1 in C++ + // To be removed if the structure is filled + uint32_t dummy; } ParameterList; /* diff --git a/openair3/NAS/UE/API/USER/at_command.h b/openair3/NAS/UE/API/USER/at_command.h index b7bdb11b75..658dbc7a08 100644 --- a/openair3/NAS/UE/API/USER/at_command.h +++ b/openair3/NAS/UE/API/USER/at_command.h @@ -160,7 +160,11 @@ typedef enum { /* CGSN AT command type */ #define AT_COMMAND_CGSN_MASK AT_COMMAND_NO_PARAM -typedef struct at_cgsn_s {} at_cgsn_t; +typedef struct at_cgsn_s { + // This dummy element is to avoid CLANG warning: empty struct has size 0 in C, size 1 in C++ + // To be removed if the structure is filled + uint32_t dummy; +} at_cgsn_t; /* CGMI: Request manufacturer identification * ----------------------------------------- @@ -172,7 +176,11 @@ typedef struct at_cgsn_s {} at_cgsn_t; /* CGMI AT command type */ #define AT_COMMAND_CGMI_MASK AT_COMMAND_NO_PARAM -typedef struct at_cgmi_s {} at_cgmi_t; +typedef struct at_cgmi_s { + // This dummy element is to avoid CLANG warning: empty struct has size 0 in C, size 1 in C++ + // To be removed if the structure is filled + uint32_t dummy; +} at_cgmi_t; /* CGMM: Request model identification * ---------------------------------- @@ -184,7 +192,11 @@ typedef struct at_cgmi_s {} at_cgmi_t; /* CGMM AT command type */ #define AT_COMMAND_CGMM_MASK AT_COMMAND_NO_PARAM -typedef struct at_cgmm_s {} at_cgmm_t; +typedef struct at_cgmm_s { + // This dummy element is to avoid CLANG warning: empty struct has size 0 in C, size 1 in C++ + // To be removed if the structure is filled + uint32_t dummy; +} at_cgmm_t; /* CGMR: Request revision identification * ------------------------------------- @@ -197,7 +209,11 @@ typedef struct at_cgmm_s {} at_cgmm_t; /* CGMR AT command type */ #define AT_COMMAND_CGMR_MASK AT_COMMAND_NO_PARAM -typedef struct at_cgmr_s {} at_cgmr_t; +typedef struct at_cgmr_s { + // This dummy element is to avoid CLANG warning: empty struct has size 0 in C, size 1 in C++ + // To be removed if the structure is filled + uint32_t dummy; +} at_cgmr_t; /* CIMI: Request International Mobile Subscriber Identity * ------------------------------------------------------ @@ -210,7 +226,11 @@ typedef struct at_cgmr_s {} at_cgmr_t; /* CIMI AT command type */ #define AT_COMMAND_CIMI_MASK AT_COMMAND_NO_PARAM -typedef struct at_cimi_s {} at_cimi_t; +typedef struct at_cimi_s { + // This dummy element is to avoid CLANG warning: empty struct has size 0 in C, size 1 in C++ + // To be removed if the structure is filled + uint32_t dummy; +} at_cimi_t; /* * ============================================== @@ -288,7 +308,11 @@ typedef struct { /* CSQ AT command type */ #define AT_COMMAND_CSQ_MASK AT_COMMAND_NO_PARAM -typedef struct at_csq_s {} at_csq_t; +typedef struct at_csq_s { + // This dummy element is to avoid CLANG warning: empty struct has size 0 in C, size 1 in C++ + // To be removed if the structure is filled + uint32_t dummy; +} at_csq_t; /* CESQ: Extented signal quality * ----------------------------- @@ -299,7 +323,11 @@ typedef struct at_csq_s {} at_csq_t; /* CESQ AT command type */ #define AT_COMMAND_CESQ_MASK AT_COMMAND_NO_PARAM -typedef struct at_cesq_s {} at_cesq_t; +typedef struct at_cesq_s { + // This dummy element is to avoid CLANG warning: empty struct has size 0 in C, size 1 in C++ + // To be removed if the structure is filled + uint32_t dummy; +} at_cesq_t; /* CLAC: List all available AT commands * ------------------------------------ @@ -310,7 +338,11 @@ typedef struct at_cesq_s {} at_cesq_t; /* CLAC AT command type */ #define AT_COMMAND_CLAC_MASK AT_COMMAND_NO_PARAM -typedef struct at_clac_s {} at_clac_t; +typedef struct at_clac_s { + // This dummy element is to avoid CLANG warning: empty struct has size 0 in C, size 1 in C++ + // To be removed if the structure is filled + uint32_t dummy; +} at_clac_t; /* * ========================= @@ -363,7 +395,11 @@ typedef struct { /* CNUM AT command type */ #define AT_COMMAND_CNUM_MASK AT_COMMAND_NO_PARAM -typedef struct at_cnum_s {} at_cnum_t; +typedef struct at_cnum_s { + // This dummy element is to avoid CLANG warning: empty struct has size 0 in C, size 1 in C++ + // To be removed if the structure is filled + uint32_t dummy; +} at_cnum_t; /* CLCK: Facility lock * ------------------- diff --git a/openair3/NAS/UE/EMM/SAP/emm_sap.c b/openair3/NAS/UE/EMM/SAP/emm_sap.c index 3f48cf3d8f..fcd5d6911e 100644 --- a/openair3/NAS/UE/EMM/SAP/emm_sap.c +++ b/openair3/NAS/UE/EMM/SAP/emm_sap.c @@ -111,17 +111,17 @@ int emm_sap_send(nas_user_t *user, emm_sap_t *msg) if ( (primitive > (emm_primitive_t)EMMREG_PRIMITIVE_MIN) && (primitive < (emm_primitive_t)EMMREG_PRIMITIVE_MAX) ) { /* Forward to the EMMREG-SAP */ - msg->u.emm_reg.primitive = primitive; + msg->u.emm_reg.primitive = (emm_reg_primitive_t) primitive; rc = emm_reg_send(user, &msg->u.emm_reg); } else if ( (primitive > (emm_primitive_t)EMMESM_PRIMITIVE_MIN) && (primitive < (emm_primitive_t)EMMESM_PRIMITIVE_MAX) ) { /* Forward to the EMMESM-SAP */ - msg->u.emm_esm.primitive = primitive; + msg->u.emm_esm.primitive = (emm_esm_primitive_t) primitive; rc = emm_esm_send(user, &msg->u.emm_esm); } else if ( (primitive > (emm_primitive_t)EMMAS_PRIMITIVE_MIN) && (primitive < (emm_primitive_t)EMMAS_PRIMITIVE_MAX) ) { /* Forward to the EMMAS-SAP */ - msg->u.emm_as.primitive = primitive; + msg->u.emm_as.primitive = (emm_as_primitive_t) primitive; rc = emm_as_send(user, &msg->u.emm_as); } else { diff --git a/openair3/NGAP/ngap_gNB_context_management_procedures.c b/openair3/NGAP/ngap_gNB_context_management_procedures.c index 8d3c20d218..c9db35e8c8 100644 --- a/openair3/NGAP/ngap_gNB_context_management_procedures.c +++ b/openair3/NGAP/ngap_gNB_context_management_procedures.c @@ -188,8 +188,31 @@ int ngap_ue_context_release_req(instance_t instance, ie->criticality = NGAP_Criticality_ignore; ie->value.present = NGAP_UEContextReleaseRequest_IEs__value_PR_Cause; DevAssert(ue_release_req_p->cause <= NGAP_Cause_PR_choice_ExtensionS); - ie->value.choice.Cause.present = ue_release_req_p->cause; - ie->value.choice.Cause.choice.misc = ue_release_req_p->cause_value; + switch(ue_release_req_p->cause){ + case NGAP_CAUSE_RADIO_NETWORK: + ie->value.choice.Cause.present = NGAP_Cause_PR_radioNetwork; + ie->value.choice.Cause.choice.radioNetwork = ue_release_req_p->cause_value; + break; + case NGAP_CAUSE_TRANSPORT: + ie->value.choice.Cause.present = NGAP_Cause_PR_transport; + ie->value.choice.Cause.choice.transport = ue_release_req_p->cause_value; + break; + case NGAP_CAUSE_NAS: + ie->value.choice.Cause.present = NGAP_Cause_PR_nas; + ie->value.choice.Cause.choice.nas = ue_release_req_p->cause_value; + break; + case NGAP_CAUSE_PROTOCOL: + ie->value.choice.Cause.present = NGAP_Cause_PR_protocol; + ie->value.choice.Cause.choice.protocol = ue_release_req_p->cause_value; + break; + case NGAP_CAUSE_MISC: + ie->value.choice.Cause.present = NGAP_Cause_PR_misc; + ie->value.choice.Cause.choice.misc = ue_release_req_p->cause_value; + break; + default: + NGAP_WARN("Received NG Error indication cause NGAP_Cause_PR_choice_Extensions\n"); + break; + } } if (ngap_gNB_encode_pdu(&pdu, &buffer, &length) < 0) { diff --git a/openair3/NGAP/ngap_gNB_nas_procedures.c b/openair3/NGAP/ngap_gNB_nas_procedures.c index fdbe6ce0f9..069f3ce48b 100644 --- a/openair3/NGAP/ngap_gNB_nas_procedures.c +++ b/openair3/NGAP/ngap_gNB_nas_procedures.c @@ -665,30 +665,35 @@ int ngap_gNB_initial_ctxt_resp(instance_t instance, ngap_initial_context_setup_r item->pDUSessionID = initial_ctxt_resp_p->pdusessions_failed[i].pdusession_id; /* cause */ - pdusessionUnTransfer.cause.present = initial_ctxt_resp_p->pdusessions_failed[i].cause; - switch (pdusessionUnTransfer.cause.present) { + switch(initial_ctxt_resp_p->pdusessions_failed[i].cause) { case NGAP_CAUSE_RADIO_NETWORK: + pdusessionUnTransfer.cause.present = NGAP_Cause_PR_radioNetwork; pdusessionUnTransfer.cause.choice.radioNetwork = initial_ctxt_resp_p->pdusessions_failed[i].cause_value; break; case NGAP_CAUSE_TRANSPORT: + pdusessionUnTransfer.cause.present = NGAP_Cause_PR_transport; pdusessionUnTransfer.cause.choice.transport = initial_ctxt_resp_p->pdusessions_failed[i].cause_value; break; case NGAP_CAUSE_NAS: + pdusessionUnTransfer.cause.present = NGAP_Cause_PR_nas; pdusessionUnTransfer.cause.choice.nas = initial_ctxt_resp_p->pdusessions_failed[i].cause_value; break; case NGAP_CAUSE_PROTOCOL: + pdusessionUnTransfer.cause.present = NGAP_Cause_PR_protocol; pdusessionUnTransfer.cause.choice.protocol = initial_ctxt_resp_p->pdusessions_failed[i].cause_value; break; case NGAP_CAUSE_MISC: + pdusessionUnTransfer.cause.present = NGAP_Cause_PR_misc; pdusessionUnTransfer.cause.choice.misc = initial_ctxt_resp_p->pdusessions_failed[i].cause_value; break; case NGAP_CAUSE_NOTHING: - default: + default: + LOG_E(NR_RRC, "Unknown PDU session failure cause %d\n", initial_ctxt_resp_p->pdusessions_failed[i].cause); break; } @@ -928,33 +933,37 @@ int ngap_gNB_pdusession_setup_resp(instance_t instance, ngap_pdusession_setup_re item->pDUSessionID = pdusession_failed->pdusession_id; /* cause */ - pdusessionUnTransfer_p.cause.present = pdusession_failed->cause; - switch (pdusessionUnTransfer_p.cause.present) { + switch(pdusession_failed->cause) { case NGAP_CAUSE_RADIO_NETWORK: + pdusessionUnTransfer_p.cause.present = NGAP_Cause_PR_radioNetwork; pdusessionUnTransfer_p.cause.choice.radioNetwork = pdusession_failed->cause_value; break; case NGAP_CAUSE_TRANSPORT: + pdusessionUnTransfer_p.cause.present = NGAP_Cause_PR_transport; pdusessionUnTransfer_p.cause.choice.transport = pdusession_failed->cause_value; break; case NGAP_CAUSE_NAS: + pdusessionUnTransfer_p.cause.present = NGAP_Cause_PR_nas; pdusessionUnTransfer_p.cause.choice.nas = pdusession_failed->cause_value; break; case NGAP_CAUSE_PROTOCOL: + pdusessionUnTransfer_p.cause.present = NGAP_Cause_PR_protocol; pdusessionUnTransfer_p.cause.choice.protocol = pdusession_failed->cause_value; break; case NGAP_CAUSE_MISC: + pdusessionUnTransfer_p.cause.present = NGAP_Cause_PR_misc; pdusessionUnTransfer_p.cause.choice.misc = pdusession_failed->cause_value; break; case NGAP_CAUSE_NOTHING: - default: + default: + LOG_E(NR_RRC, "Unknown PDU session failure cause %d\n", pdusession_failed->cause); break; } - NGAP_DEBUG("pdusession setup response: failed pdusession ID %ld\n", item->pDUSessionID); asn_encode_to_new_buffer_result_t res = asn_encode_to_new_buffer(NULL, ATS_ALIGNED_CANONICAL_PER, &asn_DEF_NGAP_PDUSessionResourceSetupUnsuccessfulTransfer, &pdusessionUnTransfer_p); @@ -1087,32 +1096,37 @@ int ngap_gNB_pdusession_modify_resp(instance_t instance, ngap_pdusession_modify_ item->pDUSessionID = pdusession_modify_resp_p->pdusessions_failed[i].pdusession_id; NGAP_PDUSessionResourceModifyUnsuccessfulTransfer_t pdusessionTransfer = {0}; - pdusessionTransfer.cause.present = pdusession_modify_resp_p->pdusessions_failed[i].cause; - switch (pdusessionTransfer.cause.present) { + switch(pdusession_modify_resp_p->pdusessions_failed[i].cause) { case NGAP_CAUSE_RADIO_NETWORK: - pdusessionTransfer.cause.choice.radioNetwork = pdusession_modify_resp_p->pdusessions_failed[i].cause_value; + pdusessionTransfer.cause.present = NGAP_Cause_PR_radioNetwork; + pdusessionTransfer.cause.choice.radioNetwork = pdusession_modify_resp_p->pdusessions_failed[i].cause_value; break; case NGAP_CAUSE_TRANSPORT: + pdusessionTransfer.cause.present = NGAP_Cause_PR_transport; pdusessionTransfer.cause.choice.transport = pdusession_modify_resp_p->pdusessions_failed[i].cause_value; break; case NGAP_CAUSE_NAS: + pdusessionTransfer.cause.present = NGAP_Cause_PR_nas; pdusessionTransfer.cause.choice.nas = pdusession_modify_resp_p->pdusessions_failed[i].cause_value; break; case NGAP_CAUSE_PROTOCOL: + pdusessionTransfer.cause.present = NGAP_Cause_PR_protocol; pdusessionTransfer.cause.choice.protocol = pdusession_modify_resp_p->pdusessions_failed[i].cause_value; break; case NGAP_CAUSE_MISC: + pdusessionTransfer.cause.present = NGAP_Cause_PR_misc; pdusessionTransfer.cause.choice.misc = pdusession_modify_resp_p->pdusessions_failed[i].cause_value; break; case NGAP_CAUSE_NOTHING: default: - break; + LOG_E(NR_RRC, "Unknown PDU session failure cause %d\n", pdusession_modify_resp_p->pdusessions_failed[i].cause); + break; } asn_encode_to_new_buffer_result_t res = {0}; diff --git a/radio/iqplayer/iqplayer_lib.c b/radio/iqplayer/iqplayer_lib.c index 7ac587bb95..2df57c9202 100644 --- a/radio/iqplayer/iqplayer_lib.c +++ b/radio/iqplayer/iqplayer_lib.c @@ -43,16 +43,11 @@ static void busy_wait(uint32_t usecs) { uint32_t elapsed_usecs; - double temp; - int j; struct timespec requestStart, requestEnd; // Active wait clock_gettime(CLOCK_REALTIME, &requestStart); - temp = 0; while (1) { - for (j=0; j < 40; j++) - temp += sin(j); clock_gettime(CLOCK_REALTIME, &requestEnd); elapsed_usecs = ( requestEnd.tv_sec - requestStart.tv_sec ) / 1e-6 + ( requestEnd.tv_nsec - requestStart.tv_nsec ) / 1e3; diff --git a/radio/rfsimulator/simulator.c b/radio/rfsimulator/simulator.c index bcd568cd50..4db78e9659 100644 --- a/radio/rfsimulator/simulator.c +++ b/radio/rfsimulator/simulator.c @@ -77,15 +77,15 @@ /*-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/ #define simOpt PARAMFLAG_NOFREE|PARAMFLAG_CMDLINE_NOPREFIXENABLED #define RFSIMULATOR_PARAMS_DESC { \ - {"serveraddr", "\n", simOpt, strptr:&rfsimulator->ip, defstrval:"127.0.0.1", TYPE_STRING, 0 },\ - {"serverport", "\n", simOpt, u16ptr:&(rfsimulator->port), defuintval:PORT, TYPE_UINT16, 0 },\ - {RFSIMU_OPTIONS_PARAMNAME, RFSIM_CONFIG_HELP_OPTIONS, 0, strlistptr:NULL, defstrlistval:NULL, TYPE_STRINGLIST,0 },\ - {"IQfile", "\n",simOpt, strptr:&saveF, defstrval:"/tmp/rfsimulator.iqs",TYPE_STRING, 0 },\ - {"modelname", "\n", simOpt, strptr:&modelname, defstrval:"AWGN", TYPE_STRING, 0 },\ - {"ploss", "\n", simOpt, dblptr:&(rfsimulator->chan_pathloss), defdblval:0, TYPE_DOUBLE, 0 },\ - {"forgetfact", "\n", simOpt, dblptr:&(rfsimulator->chan_forgetfact), defdblval:0, TYPE_DOUBLE, 0 },\ - {"offset", "\n", simOpt, iptr:&(rfsimulator->chan_offset), defintval:0, TYPE_INT, 0 },\ - {"wait_timeout", "\n", simOpt, iptr:&(rfsimulator->wait_timeout), defintval:1, TYPE_INT, 0 },\ + {"serveraddr", "\n", simOpt, .strptr=&rfsimulator->ip, .defstrval="127.0.0.1", TYPE_STRING, 0 },\ + {"serverport", "\n", simOpt, .u16ptr=&(rfsimulator->port), .defuintval=PORT, TYPE_UINT16, 0 },\ + {RFSIMU_OPTIONS_PARAMNAME, RFSIM_CONFIG_HELP_OPTIONS, 0, .strlistptr=NULL, .defstrlistval=NULL, TYPE_STRINGLIST,0 },\ + {"IQfile", "\n",simOpt, .strptr=&saveF, .defstrval="/tmp/rfsimulator.iqs",TYPE_STRING, 0 },\ + {"modelname", "\n", simOpt, .strptr=&modelname, .defstrval="AWGN", TYPE_STRING, 0 },\ + {"ploss", "\n", simOpt, .dblptr=&(rfsimulator->chan_pathloss), .defdblval=0, TYPE_DOUBLE, 0 },\ + {"forgetfact", "\n", simOpt, .dblptr=&(rfsimulator->chan_forgetfact),.defdblval=0, TYPE_DOUBLE, 0 },\ + {"offset", "\n", simOpt, .iptr=&(rfsimulator->chan_offset), .defintval=0, TYPE_INT, 0 },\ + {"wait_timeout", "\n", simOpt, .iptr=&(rfsimulator->wait_timeout), .defintval=1, TYPE_INT, 0 },\ }; static void getset_currentchannels_type(char *buf, int debug, webdatadef_t *tdata, telnet_printfunc_t prnt); @@ -557,12 +557,12 @@ static int startServer(openair0_device *device) { int enable = 1; AssertFatal(setsockopt(t->listen_sock, SOL_SOCKET, SO_REUSEADDR, &enable, sizeof(int)) == 0, ""); struct sockaddr_in addr = { -sin_family: +.sin_family= AF_INET, -sin_port: +.sin_port= htons(t->port), -sin_addr: - { s_addr: INADDR_ANY } +.sin_addr= + { .s_addr= INADDR_ANY } }; int rc = bind(t->listen_sock, (struct sockaddr *)&addr, sizeof(addr)); AssertFatal(rc == 0, "bind failed: errno %d, %s", errno, strerror(errno)); @@ -580,12 +580,12 @@ static int startClient(openair0_device *device) { int sock; AssertFatal((sock = socket(AF_INET, SOCK_STREAM, 0)) >= 0, ""); struct sockaddr_in addr = { -sin_family: +.sin_family= AF_INET, -sin_port: +.sin_port= htons(t->port), -sin_addr: - { s_addr: INADDR_ANY } +.sin_addr= + { .s_addr= INADDR_ANY } }; addr.sin_addr.s_addr = inet_addr(t->ip); bool connected=false; @@ -634,7 +634,7 @@ static int rfsimulator_write_internal(rfsimulator_state_t *t, openair0_timestamp } } - if ( t->lastWroteTS != 0 && abs((double)t->lastWroteTS-timestamp) > (double)CirSize) + if ( t->lastWroteTS != 0 && fabs((double)t->lastWroteTS-timestamp) > (double)CirSize) LOG_E(HW,"Discontinuous TX gap too large Tx:%lu, %lu\n", t->lastWroteTS, timestamp); if (t->lastWroteTS > timestamp+nsamps) @@ -770,7 +770,7 @@ static bool flushInput(rfsimulator_state_t *t, int timeout, int nsamps_for_initi pthread_mutex_lock(&Sockmutex); - if (t->lastWroteTS != 0 && ( abs((double)t->lastWroteTS-b->lastReceivedTS) > (double)CirSize)) + if (t->lastWroteTS != 0 && (fabs((double)t->lastWroteTS-b->lastReceivedTS) > (double)CirSize)) LOG_E(HW,"UEsock: %d Tx/Rx shift too large Tx:%lu, Rx:%lu\n", fd, t->lastWroteTS, b->lastReceivedTS); pthread_mutex_unlock(&Sockmutex);