Commit ade9a6dd authored by Cedric Roux's avatar Cedric Roux

Merge remote-tracking branch 'origin/develop_integration_2018_w33' into develop

Summary of changes:
- fix compilation on CentOS
- some work on the T tracer:
  - add a 'multi' tracer to connect several tracers at the same time
  - improve 'to_vcd' to be compatible with previous VCD traces
- preliminary work for X2 handover
- various bug fixes

A new version of asn1c is to be used with this commit.
Do:
  cd [top directory of repository]
  source oaienv
  cd cmake_targets
  ./build_oai -I
parents bd5b3b1e 69338c69
develop 1 128-ues 256_QAM_demod 2cw_fairRRscd 375-syrtem-sdr-platform 383-ulsch-scheduler-optimization 401-bug-related-to-nr-pucch-format-2-generator 408-reworked 408-ue-main-threads 445-LDPC-implementation-on-GPU 459-pusch-based-ta-updates 464-ru_beamforming_in_gpu 464-ru_beamforming_in_gpu-CPUsubfunction 472-add-pusch-dmrs-modes 481-ldpc-decoder-on-gpu 5g_fapi_scf LTE-sidelink LTE_TRX_on_single_port NCTU_CS_ISIP NCTU_CS_ISIP_CPU NCTU_CS_ISIP_GPU NCTU_OpinConnect_LDPC NR-PHY-MAC-IF-multi-UE NR_10MHz NR_CSI_reporting NR_DCI_01 NR_DLUL_PF NR_DLUL_PF_rebased NR_DL_sched_fixes NR_DL_scheduler NR_FAPI_beamindex_SSB_RO NR_FR2_RA NR_FR2_RRC_SSB NR_MAC_CE_GlobalEdge NR_MAC_Multi_Rach_GlobalEdge NR_MAC_SSB_RO_GlobalEdge NR_MAC_SSB_RO_UE_IDCC NR_MAC_SSB_RO_merge NR_MAC_TCI_UCI_GlobalEdge NR_NGAP NR_PDCP_noS1 NR_PUCCH_MultiUE NR_RA_updates NR_RRCConfiguragion_FR2 NR_RRCConfiguration NR_RRCConfiguration_FR2 NR_RRCConfiguration_S1U NR_RRCConfiguration_merge_develop NR_RRCConfiguration_sync_source NR_RRCConfiguration_trx_thread NR_RRC_CP_bugfix NR_RRC_PDCP NR_RRC_PRACH_procedures NR_RRC_PRACH_procedures_todevelop NR_RRC_PUSCH NR_RRC_TA NR_RRC_X2AP_AMBR_Change_Global_edge NR_RRC_X2AP_RemoveHardcodings_GlobalEdge NR_RRC_config_simplified NR_RRC_harq NR_RRC_harq_b NR_RRC_harq_hacks NR_RRC_harq_newdcipdu NR_SA_F1AP_dev NR_SA_NGAP_RRC NR_SA_NGAP_RRC_wk42 NR_SA_itti_sim_wk48 NR_SA_itti_sim_wk48_hs NR_SA_itti_sim_wk48_hs1 NR_SCHED NR_SCHED_HARQ NR_SCHED_PDCCH_PUCCH_HARQ NR_SCHED_PDCCH_PUCCH_HARQ_rebased NR_SCHED_fixes NR_SRB_Config NR_TRX_on_single_port NR_TRX_on_single_port2 NR_UE_MAC_scheduler NR_UE_RA_fixes NR_UE_UL_DCI_improvements NR_UE_dlsch_bugfix NR_UE_enable_parallelization NR_UE_stability_fixes NR_UL_FAPI_programming NR_UL_scheduler NR_UL_scheduler_rebased NR_UL_scheduling NR_beam_simulation NR_beamforming_test NR_gNB_SCF_Indication NR_ipaccess_testing NR_mac_uci_functions_rework NR_msg2_phytest NR_scheduling_CSIRS NR_scheduling_request NR_scheduling_request2 NR_test_S1U_RRC_PRACH_procedures NR_ue_dlsch_dmrs_cdm New-Merge-sidelink-develop OpInConnect_ISIP PUSCH_TA_update RA_CI_test UE_DL_DCI_hotfix UpdateRANRemoteUEReport add_iris_hw addoptions_nr_USRPdevice bch-fixes-bitmap benetel_5g_prach_fix benetel_driver_update benetel_phase_rotation benetel_phase_rotation_old bugfix-find-uci bugfix-minor-remove-wrong-log bugfix-nr-bands bugfix-nr-ldpc-post-processing bugfix-nr-ldpc-size-typo bugfix-nr-pdcp-sn-size bugfix-nr-rate-matching-assertion cce_indexing_fix cce_indexing_fix2 ci-deploy-asterix ci-deploy-docker-compose ci-rd-july-improvements ci-test ci-ul-iperf-from-trf-container ci-yacine clean-5G-scope-round2 cleanup_softmodem_main constant_power container_fix container_v1.2.2 debug_branch_init_sync develop-FeMBMS develop-SnT develop-ci develop-ci-fju develop-large-scale-emulations develop-m2ap develop-multi-RRUs develop-nb-iot-merge develop-nb-iot-merge-w-conflicts develop-nb-iot-ntust develop-nr develop-nr-adding-2018-09-asn1 develop-nr-fr2 develop-nr-fr2-rework develop-nr_cppcheck develop-oriecpriupdates develop-sib1 develop-sib1-local develop-sib1-lts develop-vco3 develop_ci develop_inria_ci_deployment develop_inria_ci_deployment_gp develop_inria_ci_deployment_gp_b4merge develop_integration_2019_w44 develop_integration_2020_w15 develop_integration_2020_w19 develop_integration_w08 develop_jenkins_replay develop_stable dfts_alternatives dlsch-all-dlslots dlsch_encode_mthread dlsch_parallel dlsim-autotests documentation docupdate_tools dongzhanyi-zte-0001 dongzhanyi-zte-develop dongzhanyi-zte-develop2 dreibh/apt-auth-fix dreibh/device-load-fix dreibh/device-load-fix-develop-branch dreibh/doxygen-fix dual-connectivity dummy edrx extend_sharedlibusage extend_sharedlibusage2 fapi_for_dmrs_and_ptrs feat-mac-sock feature-368-channel-simulator feature-4g-sched feature-flexran-cm-s1ap feature-nr-4g-nfapi-modifications feature-pdcp-task feature-support-clang-format feature/make-s1-mme-port-configurable feature/make-s1-mme-port-configurable-with-astyle-fixes feature_tm3 fembms-enb-ue finalize-oaicn-integration firas fix-ci-tun fix-clock-source fix-dirty-ue-same-machine fix-itti fix-itti-segv fix-l2-sim fix-limeSDR-compile fix-softmodem-restart fix-warnings fix_NR_DLUL_PF fix_do_ra_data fix_pdsch_low_prb fix_rfsim_mimo fix_rrc_x2_ticking fixes-CE-RLC-PDU-size fixes-mac-sched-nfapi fixes-mac-sched-tun fixes-tun flexran-apps flexran-improvements flexran-repair-mme-mgmt flexran-report-split fr2-hw-test fujitsu_lte_contribution fujitsu_lte_contribution-128 gNB-nrUE-USRP generate_push_ptrs gnb-only-test harq-hotfix hotfix-minor-remove-nr-rlc-cppcheck-error hotfix-nr-rlc-tick hotfix-ocp-executable hotfix-ue-musim-compilation hotfix_usrp_lib improve_build_nr_lte_merge improve_nr_modulation improve_ue_stability initial-nfapi-PNF-fixes integration-develop-nr-2019w45 integration_2020_wk40 integration_2020_wk41 integration_2020_wk42_2 integration_2020_wk45 integration_2020_wk45_2 integration_2020_wk46 integration_2020_wk46_2 integration_2020_wk47 integration_2020_wk48 integration_2020_wk48_2 integration_2020_wk49 integration_2020_wk50 integration_2020_wk50_1 integration_2020_wk51 integration_2020_wk51_2 integration_2021_wk02 integration_2021_wk02_wMR988 inter-RRU inter-RRU-final inter-RRU-nr inter-RRU-oairu inter-rru-UE interoperability-test isip_nr issue392-simplify-s1-nos1step2_01 issue416_nfapicleanup issue_345_l2_fapi_simulator itti-enhancement l2-fixes ldpc-dec-layering ldpc-decoder-codegen ldpc-decoder-codegen2 ldpc-decoder-improvements ldpc-offload ldpc_short_codeword_fixes load_gnb lte-m-ue_type lte_uplink_improvement mac-fixes-wk45_2 main_python master mbms-fix-develop-nr merging-2019-w51-to-develop-nr minor-fix-doc-basic-sim modify_fairRRscd_parallel mosaic5g-oai-ran mosaic5g-oai-sim mu_allocate multi-L1 multi-RRUs nasmesh_kernel_5.8 new_nos1 new_pdcp new_rlc new_rlc_2020 new_rlc_in_mbms nfapi-bugfix nfapi_improvement nfapi_nr_develop ngap-dlul ngap-support ngap-w48-merge2 ngap-wf ngap-wf-1120 ngap-wf-1120-srb ngap-wf-1120-srb-gtp ngap-wf-1120-srb-gtp-hs ngap-wf-1120-srb-gtp-hs1 ngap-wf-1120-srb-gtp-hs2 ngap-wf-1120-srb-gtp-yhz ngap-wf-1203-yunsdr ngap-wf-liuyu ngap_lfq_1120 ngap_merge noCore nr-coreset-bug-fix nr-dlsch-multi-thread nr-dlsch-thread nr-dual-connectivity nr-interdigital-test nr-ip-uplink-noS1 nr-mac-pdu-wireshark nr-mac-remove-ue-list nr-multiple-ssb nr-pdcp nr-pdsch-extraction-bugfix nr-physim-update nr-rlc-am-bugfix-w44 nr-rlc-bugfix-w44 nr-ssb-measurements nr-timing-measurement nr-timing-measurement-merge nr-ue-buffer-status nr-ue-slot-based nr-uldci nrUE nrUE-hs nrUE-upper-layer nr_beamforming nr_bsr nr_ci_dlsim nr_csi_newbranch nr_dci_procedures nr_demo_wsa2019 nr_dl_dmrs_type2 nr_dl_pf nr_dl_pf2 nr_dl_ul_ptrs nr_dlsch_parallel_measurements nr_dlsim_plot nr_fapi_for_push_tmp nr_fdd_if_fix nr_fix_easycppcheck nr_flexible_NRBDL nr_improve_build_procedures nr_increase_tp nr_mib_vsa_test nr_pdcch_testing nr_pdcch_updates nr_pdsch_integration nr_polar_decoder_improvement nr_prach nr_prach_fr2 nr_pucch nr_pucch2 nr_segmentation_fixes nr_sim_fix nr_tdd_configuration nr_ue_msg3 nr_ue_tti_cleanup nr_ul_pf nr_ul_scfdma nr_vcd nrue-multi-thread nrue_msg2_reception nsa-ue nsa_remove_band_hardcodings oai-sim oai-ubuntu-docker oai-ubuntu-docker-for-lmssdr oairu oc-docker-october-improvements ocp_simulator openxg/develop pdcp-benchmark pdsch-ch-est polar8 ptrs_rrc_config pusch-mthread-scaling-fix pusch-retrans-fix-ue ra-dl-ul rau_rru_reciprocity_measurements recode_itti_from_scratch reduce_memory_footprint release_v1_2_0_candidate remove-ci-workaround remove_nos1_hack_pdcp remove_x2_gnb_hardcoding repair-TA revert-f5c94279 revert-itti revert_memcpy rh-ci-add-ue-parallelization rh_ci_fix_autoterminate rh_ci_fr1_update rh_ci_oc rh_ci_py rh_ci_rfsim_ra rh_doc_update_3 rh_fr1_newjenkins rh_fr1_update rh_gnb_compile_fix rh_wk50_debug rhel77-build rlc-v2-bugfix-status-reporting rlc-v2-tick rlc_v2_coverity_fixes rrc-enb-phy-testmode ru-parallel-beamforming ru_rau_enhancement-external-timing runel runel-reverse-test s1-subnormal_rewrite s1_subnormal s1_subnormal-robert s1ap-bugfix-rab_setup sa-demo sa-merge-rrc-srb sa-msg4 sa-msg4-rrc sa-msg4-rrc-yihz sa-msg4-rrc-yihz-hs sa_rrc_yihz signal-delay small-bugfixes-w40 small-config-change smallcleanup softmodem_cleanup split73 test-x310-perf testing_2symb_pdcch testing_with_external_txdata thread-pool tools_5Gadapt tp-ota-test trx_thread_param trx_write_thread ue-csi ue-fixes-ota ue-updates-runel-test ue_adjust_gain ue_beam_selection ue_dlsch-multi-threading ue_dlsch_decoding_ldpc_offload ue_nfapi_mch uhd_priority_set_cleanup ul-freq-iq-samps-to-file ul_dl_dci_same_slot ul_harq ulsch_decode_mthread ulsim_changes update-to-2019-march-june-release usrp_fix_adc_shift_and_pps_sync usrp_gpio_test wireshark-log-scheduling-requests x2-endc-processing x2_neighbor_6cells x2_tdd xiangwab xiangwan yihongzheng_srb zzs 2021.w02 2020.w51_2 2020.w51 2020.w50 2020.w49 2020.w48_2 2020.w48 2020.w47 2020.w46_2 2020.w46 2020.w45_2 2020.w45 2020.w44 2020.w42_2 2020.w42 2020.w41 2020.w39 2020.w38 2020.w37 2020.w36 2020.w34 2020.w33 2020.w31 2020.w30 2020.w29 2020.w28 2020.w26 2020.w25 2020.w24 2020.w23 2020.w22 2020.w19 2020.w17 2020.w16 2020.w15 2020.w11 2020.w09 2020.w06 2020.w05 2020.w04 2020.w03 2019.w51 2019.w44 2019.w41 2019.w36 2019.w30 2019.w28 2019.w27 2019.w25 2019.w23 2019.w21 2019.w17 2019.w15 2019.w13 2019.w11 2019.w10 2019.w09 2019.w08 2019.w07 2019.w06 2019.w04 2019.w03 2018.w51 2018.w48 2018.w47 2018.w46 2018.w44 2018.w41 2018.w40 2018.w39 2018.w36 2018.w33 v1.2.2 v1.2.1 v1.2.0 v1.1.1 v1.1.0 v1.0.3 v1.0.2 v1.0.1 v1.0.0 osa-etsi-ws-ue osa-etsi-ws-try2 osa-etsi-ws-try1 osa-etsi-ws-gNB nr-ip-over-lte nr-ip-over-lte-v.1.5 nr-ip-over-lte-v.1.4 nr-ip-over-lte-v.1.3 nr-ip-over-lte-v.1.2 nr-ip-over-lte-v.1.1 nr-ip-over-lte-v.1.0 develop-nr-pdcch develop-nr-2020w03 develop-nr-2020w02 develop-nr-2019w51 develop-nr-2019w50 develop-nr-2019w48 develop-nr-2019w47 develop-nr-2019w45 develop-nr-2019w43 develop-nr-2019w42 develop-nr-2019w40 develop-nr-2019w28 develop-nr-2019w23 benetel_phase_rotation
No related merge requests found
......@@ -1880,9 +1880,13 @@ endif (${T_TRACER})
#This rule and the following deal with it.
add_custom_command (
OUTPUT ${OPENAIR_DIR}/common/utils/T/T_IDs.h
COMMAND make
COMMAND $(MAKE) clean
COMMAND $(MAKE)
COMMAND $(MAKE) check_vcd
WORKING_DIRECTORY ${OPENAIR_DIR}/common/utils/T
DEPENDS ${OPENAIR_DIR}/common/utils/T/T_messages.txt
${OPENAIR_DIR}/common/utils/LOG/vcd_signal_dumper.c
${OPENAIR_DIR}/common/utils/LOG/vcd_signal_dumper.h
)
#This rule is specifically needed to generate T files
......@@ -2187,7 +2191,8 @@ if (${T_TRACER})
oai_eth_transpro
FLPT_MSG ASYNC_IF FLEXRAN_AGENT HASHTABLE MSC UTIL OMG_SUMO SECU_OSA
SECU_CN SCHED_LIB PHY L2 default_sched remote_sched RAL CN_UTILS
GTPV1U SCTP_CLIENT UDP LIB_NAS_UE LFDS LFDS7 SIMU OPENAIR0_LIB PHY_MEX)
GTPV1U SCTP_CLIENT UDP LIB_NAS_UE LFDS LFDS7 SIMU OPENAIR0_LIB PHY_MEX
coding)
if (TARGET ${i})
add_dependencies(${i} generate_T)
endif()
......@@ -2230,7 +2235,7 @@ function(make_driver name dir)
endforeach()
CONFIGURE_FILE(${OPENAIR_CMAKE}/tools/Kbuild.cmake ${OPENAIR_BIN_DIR}/${name}/Kbuild)
add_custom_command(OUTPUT ${name}.ko
COMMAND make -C ${module_build_path} M=${OPENAIR_BIN_DIR}/${name}
COMMAND $(MAKE) -C ${module_build_path} M=${OPENAIR_BIN_DIR}/${name}
WORKING_DIRECTORY ${OPENAIR_BIN_DIR}/${name}
COMMENT "building ${module}.ko"
VERBATIM
......
......@@ -683,7 +683,7 @@ install_asn1c_from_source(){
# better to use a given commit than a branch in case the branch
# is updated and requires modifications in the source of OAI
#git checkout velichkov_s1ap_plus_option_group
git checkout ec830d70bbb014b769810355a2f321a91ccd8a58
git checkout 73d6b23dcec9ab36605b4af884143824392134c1
autoreconf -iv
./configure
make -j`nproc`
......
......@@ -39,7 +39,7 @@
/* WARNING: if you edit the enums below, update also string definitions in vcd_signal_dumper.c */
typedef enum {
VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_TX0_ENB = 0,
VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_TX0_ENB=0,
VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_TX1_ENB,
VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_RX0_ENB,
VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_RX1_ENB,
......@@ -91,12 +91,12 @@ typedef enum {
VCD_SIGNAL_DUMPER_VARIABLES_TX_SEQ_NUM,
VCD_SIGNAL_DUMPER_VARIABLES_CNT,
VCD_SIGNAL_DUMPER_VARIABLES_DUMMY_DUMP,
VCD_SIGNAL_DUMPER_VARIABLE_ITTI_SEND_MSG,
VCD_SIGNAL_DUMPER_VARIABLE_ITTI_POLL_MSG,
VCD_SIGNAL_DUMPER_VARIABLE_ITTI_RECV_MSG,
VCD_SIGNAL_DUMPER_VARIABLE_ITTI_ALLOC_MSG,
VCD_SIGNAL_DUMPER_VARIABLE_MP_ALLOC,
VCD_SIGNAL_DUMPER_VARIABLE_MP_FREE,
VCD_SIGNAL_DUMPER_VARIABLES_ITTI_SEND_MSG,
VCD_SIGNAL_DUMPER_VARIABLES_ITTI_POLL_MSG,
VCD_SIGNAL_DUMPER_VARIABLES_ITTI_RECV_MSG,
VCD_SIGNAL_DUMPER_VARIABLES_ITTI_ALLOC_MSG,
VCD_SIGNAL_DUMPER_VARIABLES_MP_ALLOC,
VCD_SIGNAL_DUMPER_VARIABLES_MP_FREE,
VCD_SIGNAL_DUMPER_VARIABLES_UE_INST_CNT_RX,
VCD_SIGNAL_DUMPER_VARIABLES_UE_INST_CNT_TX,
VCD_SIGNAL_DUMPER_VARIABLES_DCI_INFO,
......
......@@ -15,4 +15,5 @@ tracer/to_vcd
tracer/extract_input_subframe
tracer/extract_output_subframe
tracer/extract
tracer/multi
tracee/tracee
......@@ -18,6 +18,15 @@ T_messages.txt.h: T_messages.txt
T_IDs.h: $(GENIDS) T_messages.txt
./$(GENIDS) T_messages.txt T_IDs.h
check_vcd:
gcc -Wall -I. -I.. -I../itti -Itracer -o _check_vcd check_vcd.c tracer/database.c tracer/utils.c -lm -pthread
./_check_vcd || (rm -f ./_check_vcd ./T_IDs.h ./T_messages.txt.h && false)
rm -f ./_check_vcd
.PHONY: check_vcd
clean:
rm -f *.o $(GENIDS) core T_IDs.h T_messages.txt.h
cd tracer && make clean
rm -f *.o $(GENIDS) core T_IDs.h T_messages.txt.h _check_vcd
cleanall: clean
cd tracer && $(MAKE) clean
......@@ -31,6 +31,12 @@ volatile int _T_freelist_head;
volatile int *T_freelist_head = &_T_freelist_head;
T_cache_t *T_cache;
#if BASIC_SIMULATOR
/* global variables used by T_GET_SLOT, see in T.h */
volatile uint64_t T_next_id;
volatile uint64_t T_active_id;
#endif
static void get_message(int s)
{
char t;
......@@ -91,7 +97,7 @@ static void new_thread(void *(*f)(void *), void *data)
/* defined in local_tracer.c */
void T_local_tracer_main(int remote_port, int wait_for_tracer,
int local_socket, char *shm_file);
int local_socket, void *shm_array);
/* We monitor the tracee and the local tracer processes.
* When one dies we forcefully kill the other.
......@@ -114,22 +120,31 @@ void T_init(int remote_port, int wait_for_tracer, int dont_fork)
{
int socket_pair[2];
int s;
int T_shm_fd;
int child1, child2;
char shm_file[128];
sprintf(shm_file, "/%s%d", T_SHM_FILENAME, getpid());
int i;
if (socketpair(AF_UNIX, SOCK_STREAM, 0, socket_pair))
{ perror("socketpair"); abort(); }
/* setup shared memory */
T_cache = mmap(NULL, T_CACHE_SIZE * sizeof(T_cache_t),
PROT_READ | PROT_WRITE, MAP_SHARED | MAP_ANONYMOUS, -1, 0);
if (T_cache == MAP_FAILED)
{ perror("mmap"); abort(); }
/* let's garbage the memory to catch some potential problems
* (think multiprocessor sync issues, barriers, etc.)
*/
memset(T_cache, 0x55, T_CACHE_SIZE * sizeof(T_cache_t));
for (i = 0; i < T_CACHE_SIZE; i++) T_cache[i].busy = 0;
/* child1 runs the local tracer and child2 (or main) runs the tracee */
child1 = fork(); if (child1 == -1) abort();
if (child1 == 0) {
close(socket_pair[1]);
T_local_tracer_main(remote_port, wait_for_tracer, socket_pair[0],
shm_file);
T_cache);
exit(0);
}
close(socket_pair[0]);
......@@ -138,6 +153,7 @@ void T_init(int remote_port, int wait_for_tracer, int dont_fork)
child2 = fork(); if (child2 == -1) abort();
if (child2 != 0) {
close(socket_pair[1]);
munmap(T_cache, T_CACHE_SIZE * sizeof(T_cache_t));
monitor_and_kill(child1, child2);
}
}
......@@ -148,34 +164,29 @@ void T_init(int remote_port, int wait_for_tracer, int dont_fork)
T_socket = s;
/* setup shared memory */
T_shm_fd = shm_open(shm_file, O_RDWR /*| O_SYNC*/, 0666);
shm_unlink(shm_file);
if (T_shm_fd == -1) { perror(shm_file); abort(); }
T_cache = mmap(NULL, T_CACHE_SIZE * sizeof(T_cache_t),
PROT_READ | PROT_WRITE, MAP_SHARED, T_shm_fd, 0);
if (T_cache == MAP_FAILED)
{ perror(shm_file); abort(); }
close(T_shm_fd);
new_thread(T_receive_thread, NULL);
}
void T_Config_Init(void)
{
int T_port; /* by default we wait for the tracer */
int T_nowait; /* default port to listen to to wait for the tracer */
int T_dont_fork; /* default is to fork, see 'T_init' to understand */
int T_port; /* by default we wait for the tracer */
int T_nowait; /* default port to listen to to wait for the tracer */
int T_dont_fork; /* default is to fork, see 'T_init' to understand */
paramdef_t ttraceparams[] = CMDLINE_TTRACEPARAMS_DESC ;
paramdef_t ttraceparams[] = CMDLINE_TTRACEPARAMS_DESC;
/* for a cleaner config file, TTracer params should be defined in a specific section... */
config_get( ttraceparams,sizeof(ttraceparams)/sizeof(paramdef_t),TTRACER_CONFIG_PREFIX);
/* for a cleaner config file, TTracer params should be defined in a
* specific section...
*/
config_get(ttraceparams,
sizeof(ttraceparams) / sizeof(paramdef_t),
TTRACER_CONFIG_PREFIX);
/* compatibility: look for TTracer command line options in root section */
config_process_cmdline( ttraceparams,sizeof(ttraceparams)/sizeof(paramdef_t),NULL);
/* compatibility: look for TTracer command line options in root section */
config_process_cmdline(ttraceparams,
sizeof(ttraceparams) / sizeof(paramdef_t),
NULL);
if (T_stdout == 0) {
if (T_stdout == 0)
T_init(T_port, 1-T_nowait, T_dont_fork);
}
}
......@@ -112,13 +112,37 @@ extern volatile int *T_freelist_head;
extern T_cache_t *T_cache;
extern int *T_active;
/* When running the basic simulator, we may fill the T cache too fast.
* Let's not crash if it's full, just wait.
* Let's serialize write accesses to the T cache. For that, we use a
* 'ticket' mechanism. To acquire a T slot the caller needs to own the
* current active ticket. We also wait for the slot to be free if
* it is already in use.
*/
#if BASIC_SIMULATOR
# define T_BASIC_SIMULATOR_WAIT \
while (T_cache[T_LOCAL_slot].busy) usleep(100)
# define T_GET_SLOT \
do { \
extern volatile uint64_t T_next_id; \
extern volatile uint64_t T_active_id; \
uint64_t id; \
/* get a ticket */ \
id = __sync_fetch_and_add(&T_next_id, 1); \
/* wait for our turn */ \
while (id != __sync_fetch_and_add(&T_active_id, 0)) /* busy wait */; \
/* this is our turn, try to acquire the slot until it's free */ \
do { \
T_LOCAL_busy = __sync_fetch_and_or(&T_cache[T_LOCAL_slot].busy, 0x01); \
if (T_LOCAL_busy & 0x01) usleep(100); \
} while (T_LOCAL_busy & 0x01); \
/* check that there are still some tickets */ \
if (__sync_fetch_and_add(&T_active_id, 0) == 0xffffffffffffffff) { \
printf("T: reached the end of times, bye...\n"); \
abort(); \
} \
/* free our ticket, which signals the next waiter that it's its turn */ \
(void)__sync_fetch_and_add(&T_active_id, 1); \
} while (0)
#else
# define T_BASIC_SIMULATOR_WAIT /* */
# define T_GET_SLOT \
T_LOCAL_busy = __sync_fetch_and_or(&T_cache[T_LOCAL_slot].busy, 0x01);
#endif
/* used at header of Tn, allocates buffer */
......@@ -126,11 +150,12 @@ extern int *T_active;
char *T_LOCAL_buf; \
int T_LOCAL_size = 0; \
int T_LOCAL_slot; \
int T_LOCAL_busy; \
T_LOCAL_slot = __sync_fetch_and_add(T_freelist_head, 1) \
& (T_CACHE_SIZE - 1); \
(void)__sync_fetch_and_and(T_freelist_head, T_CACHE_SIZE - 1); \
T_BASIC_SIMULATOR_WAIT; \
if (T_cache[T_LOCAL_slot].busy) { \
T_GET_SLOT; \
if (T_LOCAL_busy & 0x01) { \
printf("%s:%d:%s: T cache is full - consider increasing its size\n", \
__FILE__, __LINE__, __FUNCTION__); \
abort(); \
......@@ -142,7 +167,7 @@ extern int *T_active;
#define T_COMMIT() \
T_cache[T_LOCAL_slot].length = T_LOCAL_size; \
__sync_synchronize(); \
T_cache[T_LOCAL_slot].busy = 1; \
(void)__sync_fetch_and_or(&T_cache[T_LOCAL_slot].busy, 0x02);
#define T_CHECK_SIZE(len, argnum) \
if (T_LOCAL_size + (len) > T_BUFFER_MAX) { \
......@@ -578,10 +603,10 @@ extern int *T_active;
/* optname helpstr paramflags XXXptr defXXXval type numelt */
/*------------------------------------------------------------------------------------------------------------------------------------------*/
#define CMDLINE_TTRACEPARAMS_DESC { \
{"T_port", CONFIG_HLP_TPORT, 0, iptr:&T_port, defintval:2021, TYPE_INT, 0}, \
{"T_nowait", CONFIG_HLP_NOTWAIT, PARAMFLAG_BOOL, iptr:&T_nowait, defintval:0, TYPE_INT, 0}, \
{"T_dont_fork", CONFIG_HLP_TNOFORK, PARAMFLAG_BOOL, iptr:&T_dont_fork, defintval:0, TYPE_INT, 0}, \
{"T_stdout", CONFIG_HLP_STDOUT, PARAMFLAG_BOOL, iptr:&T_stdout, defintval:1, TYPE_INT, 0}, \
{"T_port", CONFIG_HLP_TPORT, 0, iptr:&T_port, defintval:2021, TYPE_INT, 0}, \
{"T_nowait", CONFIG_HLP_NOTWAIT, PARAMFLAG_BOOL, iptr:&T_nowait, defintval:0, TYPE_INT, 0}, \
{"T_dont_fork", CONFIG_HLP_TNOFORK, PARAMFLAG_BOOL, iptr:&T_dont_fork, defintval:0, TYPE_INT, 0}, \
{"T_stdout", CONFIG_HLP_STDOUT, PARAMFLAG_BOOL, iptr:&T_stdout, defintval:1, TYPE_INT, 0}, \
}
......
......@@ -31,13 +31,15 @@
#endif
typedef struct {
/* 'busy' is a bit field
* bit 0: 1 means that slot is acquired by writer
* bit 1: 1 means that slot is ready for consumption
*/
volatile int busy;
char buffer[T_BUFFER_MAX];
int length;
} T_cache_t;
#define T_SHM_FILENAME "/T_shm_segment"
/* number of VCD functions (to be kept up to date! see in T_messages.txt) */
#define VCD_NUM_FUNCTIONS 190
......
This diff is collapsed.
/*
* To disable the checks done by this program, see below at the beginning
* of the function 'main'.
*/
#include <stdio.h>
#include <string.h>
#include <stdarg.h>
#include "database.h"
#define T_TRACER 1
#include "T.h"
/* VCD specific defines and includes
* If the codebase changes, it may need to be updated
*/
#define ENB_MODE
#define ENABLE_USE_CPU_EXECUTION_TIME
#include "../LOG/vcd_signal_dumper.c"
void err(char *fmt, ...) __attribute__ ((format (printf, 1, 2)));
void err(char *fmt, ...)
{
va_list ap;
va_start(ap, fmt);
printf("\x1b[31m");
printf("error: ");
vprintf(fmt, ap);
printf("\n"
"\x1b[33m\n"
"You probably added a VCD trace (variable or function) but you did not\n"
"update T_messages.txt and/or T_defs.h in common/utils/T/\n"
"\n"
"Be sure to add the new trace to T_messages.txt, at the right place in the\n"
"file. Do not forget to define VCD_NAME with an identical value as found\n"
"in the array eurecomVariablesNames or eurecomFunctionsNames.\n"
"\n"
"Be sure to update VCD_NUM_FUNCTIONS, VCD_NUM_VARIABLES, VCD_FIRST_FUNCTION\n"
"and VCD_FIRST_VARIABLE in T_defs.h\n"
"\n"
"The same procedure has to be followed when you delete a VCD trace.\n"
"Delete it in T_messages.txt as well and update T_defs.h\n"
"\n"
"You can disable those VCD checks at development time.\n"
"To disable the VCD checks see the file common/utils/T/check_vcd.c\n"
"Do not push any modification that disables the VCD checks to the\n"
"main repository.\n");
printf("\x1b[m\n");
va_end(ap);
exit(1);
}
int main(void)
{
/* to disable the checks done by this program, uncomment the following
* line, ie. remove the leading '//'
*/
//return 0;
void *database = parse_database("T_messages.txt");
int number_of_events;
int first_var = -1;
int last_var;
int first_fun = -1;
int last_fun;
char *prefix;
int prefix_len;
char *name;
char *vcd_name;
int i;
FILE *in;
char *l = NULL;
size_t lsize;
if (database == NULL) err("something wrong with T_messages.txt");
/* check the value of VCD_NUM_FUNCTIONS */
if (VCD_NUM_FUNCTIONS != sizeof(eurecomFunctionsNames) / sizeof(char *))
err("VCD_NUM_FUNCTIONS (%d) must be equal to %zd",
VCD_NUM_FUNCTIONS,
sizeof(eurecomFunctionsNames) / sizeof(char *));
/* check the value of VCD_NUM_VARIABLES */
if (VCD_NUM_VARIABLES != sizeof(eurecomVariablesNames) / sizeof(char *))
err("VCD_NUM_VARIABLES (%d) must be equal to %zd",
VCD_NUM_VARIABLES,
sizeof(eurecomVariablesNames) / sizeof(char *));
number_of_events = number_of_ids(database);
if (number_of_events == 0) err("no event defined in T_messages.txt");
/* T_messages.txt ends with VCD VARIABLES followed by VCD FUNCTIONS
* followed by nothing.
* Let's check.
*/
/* check VCD VARIABLES traces in T_messages.txt */
prefix = "VCD_VARIABLE_";
prefix_len = strlen(prefix);
for (i = 0; i < number_of_events; i++) {
name = event_name_from_id(database, i);
if (strncmp(name, prefix, prefix_len)) continue;
first_var = i;
break;
}
if (first_var == -1)
err("no VCD_VARIABLE_ found in T_messages.txt");
for (; i < number_of_events; i++) {
name = event_name_from_id(database, i);
if (strncmp(name, prefix, prefix_len)) break;
}
last_var = i-1;
/* check VCD FUNCTIONS traces in T_messages.txt */
if (i == number_of_events)
err("no VCD_FUNCTION_ found in T_messages.txt");
prefix = "VCD_FUNCTION_";
prefix_len = strlen(prefix);
first_fun = i;
name = event_name_from_id(database, i);
if (strncmp(name, prefix, prefix_len))
err("last VCD_VARIABLE_ not followed by a VCD_FUNCTION_ in T_messages.txt");
for (; i < number_of_events; i++) {
name = event_name_from_id(database, i);
if (strncmp(name, prefix, prefix_len)) break;
}
if (i != number_of_events)
err("T_messages.txt does not end with a VCD_FUNCTION_ trace");
last_fun = i-1;
if (first_var != (unsigned)VCD_FIRST_VARIABLE)
err("VCD_FIRST_VARIABLE is not correct in T_defs.h");
if (first_fun != (unsigned)VCD_FIRST_FUNCTION)
err("VCD_FIRST_FUNCTION is not correct in T_defs.h");
if (last_var-first_var+1 != VCD_NUM_VARIABLES)
err("VCD_NUM_VARIABLES is not correct in T_defs.h");
if (last_fun-first_fun+1 != VCD_NUM_FUNCTIONS)
err("VCD_NUM_FUNCTIONS is not correct in T_defs.h");
/* check that VCD_NAME is identical to
* eurecomVariablesNames[x]/eurecomFunctionsNames[x]
*/
prefix = "VCD_VARIABLE_";
prefix_len = strlen(prefix);
for (i = 0; i < number_of_events; i++) {
name = event_name_from_id(database, i);
if (strncmp(name, prefix, prefix_len)) continue;
vcd_name = event_vcd_name_from_id(database, i);
if (vcd_name == NULL)
err("%s has no VCD_NAME in T_messages.txt", name);
if (strcmp(vcd_name, eurecomVariablesNames[i - first_var]))
err("%s has a wrong VCD_NAME in T_messages.txt", name);
}
prefix = "VCD_FUNCTION_";
prefix_len = strlen(prefix);
for (i = 0; i < number_of_events; i++) {
name = event_name_from_id(database, i);
if (strncmp(name, prefix, prefix_len)) continue;
vcd_name = event_vcd_name_from_id(database, i);
if (vcd_name == NULL)
err("%s has no VCD_NAME in T_messages.txt", name);
if (strcmp(vcd_name, eurecomFunctionsNames[i - first_fun]))
err("%s has a wrong VCD_NAME in T_messages.txt", name);
}
/* check IDs - these checks are difficult because we parse
* common/utils/LOG/vcd_signal_dumper.h which is expected to
* be formatted as is:
* - define vcd_signal_dump_variables then vcd_signal_dump_functions
* - one VCD_XXXX per line starting with two spaces
* followed by ',' or '=' with no space in between
* - no #ifdef / #if is taken into account
* - we require VCD_SIGNAL_DUMPER_VARIABLES_END and
* VCD_SIGNAL_DUMPER_FUNCTIONS_END at the end of each array,
* each on a line of its own with two spaces before and nothing after.
*
* If these checks fail, consider formatting
* common/utils/LOG/vcd_signal_dumper.h as expected here, if
* it makes sense of course. Otherwise, change the code below.
*
* In common/utils/LOG/vcd_signal_dumper.h a valid name is
* either VCD_SIGNAL_DUMPER_VARIABLES_ABC or
* VCD_SIGNAL_DUMPER_FUNCTIONS_XYZ
* and in T_messages.txt the corresponding name has to be
* VCD_VARIABLE_ABC or VCD_FUNCTION_XYZ
*/
i = first_var;
in = fopen("../LOG/vcd_signal_dumper.h", "r");
if (in == NULL) err("could not open ../LOG/vcd_signal_dumper.h");
while (1) {
char *x = " VCD_SIGNAL_DUMPER_VARIABLES_";
ssize_t r;
free(l);
l = NULL;
lsize = 0;
r = getline(&l, &lsize, in);
if (r == -1) break;
if (!strcmp(l, " VCD_SIGNAL_DUMPER_VARIABLES_END\n")) break;
/* remove ',' or '=' if found */
{ char *s=l; while (*s) { if (*s==','||*s=='=') { *s=0; break; } s++; } }
if (strncmp(l, x, strlen(x))) continue;
if (!(i >= first_var && i <= last_var))
err("T_messages.txt is not correct with respect to VCD VARIABLES");
name = event_name_from_id(database, i);
if (strcmp(l+strlen(x), name+strlen("VCD_VARIABLE_")))
err("%s is not correct in T_messages.txt", name);
i++;
}
if (i != last_var + 1) err("VCD VARIABLES wrong in T_messages.txt");
while (1) {
char *x = " VCD_SIGNAL_DUMPER_FUNCTIONS_";
ssize_t r;
free(l);
l = NULL;
lsize = 0;
r = getline(&l, &lsize, in);
if (r == -1) break;
if (!strcmp(l, " VCD_SIGNAL_DUMPER_FUNCTIONS_END\n")) break;
/* remove ',' or '=' if found */
{ char *s=l; while (*s) { if (*s==','||*s=='=') { *s=0; break; } s++; } }
if (strncmp(l, x, strlen(x))) continue;
if (!(i >= first_fun && i <= last_fun))
err("T_messages.txt is not correct with respect to VCD FUNCTIONS");
name = event_name_from_id(database, i);
if (strcmp(l+strlen(x), name+strlen("VCD_FUNCTION_")))
err("%s is not correct in T_messages.txt", name);
i++;
}
fclose(in);
if (i != last_fun + 1) err("VCD FUNCTIONS wrong in T_messages.txt");
return 0;
}
......@@ -14,21 +14,21 @@ int cmp(const void *p1, const void *p2)
}
/* return 1 if s was not already known, 0 if it was */
int new_unique_id(char *s)
int new_unique_id(char *s, char *input_file)
{
if (unique_ids_size)
if (bsearch(&s, unique_ids, unique_ids_size, sizeof(char *), cmp) != NULL) {
printf("FATAL: ID %s is not unique\n", s);
printf("error: ID %s is not unique in %s\n", s, input_file);
return 0;
}
if (unique_ids_size == unique_ids_maxsize) {
unique_ids_maxsize += 256;
unique_ids = realloc(unique_ids, unique_ids_maxsize * sizeof(char *));
if (unique_ids == NULL) { printf("out of memory\n"); abort(); }
if (unique_ids == NULL) { printf("erorr: out of memory\n"); abort(); }
}
unique_ids[unique_ids_size] = strdup(s);
if (unique_ids[unique_ids_size] == NULL)
{ printf("out of memory\n"); abort(); }
{ printf("erorr: out of memory\n"); abort(); }
unique_ids_size++;
qsort(unique_ids, unique_ids_size, sizeof(char *), cmp);
return 1;
......@@ -43,7 +43,8 @@ void putname(int c)
if (bufname_size == bufname_maxsize) {
bufname_maxsize += 256;
bufname = realloc(bufname, bufname_maxsize);
if (bufname == NULL) { printf("memory allocation error\n"); exit(1); }
if (bufname == NULL)
{ printf("erorr: memory allocation error\n"); exit(1); }
}
bufname[bufname_size] = c;
bufname_size++;
......@@ -58,7 +59,8 @@ void putvalue(int c)
if (bufvalue_size == bufvalue_maxsize) {
bufvalue_maxsize += 256;
bufvalue = realloc(bufvalue, bufvalue_maxsize);
if (bufvalue == NULL) { printf("memory allocation error\n"); exit(1); }
if (bufvalue == NULL)
{ printf("error: memory allocation error\n"); exit(1); }
}
bufvalue[bufvalue_size] = c;
bufvalue_size++;
......@@ -119,7 +121,7 @@ int main(int n, char **v)
char *in_name;
char *out_name;
if (n != 3) { printf("gimme <source> <dest>\n"); exit(1); }
if (n != 3) { printf("error: gimme <source> <dest>\n"); exit(1); }
n = 0;
......@@ -134,14 +136,13 @@ int main(int n, char **v)
while (1) {
get_line(in, &name, &value);
if (name == NULL) break;
printf("name '%s' value '%s'\n", name, value);
if (isspace(value[strlen(value)-1])) {
printf("bad value '%s' (no space at the end please!)\n", value);
printf("error: bad value '%s' (no space at the end please!)\n", value);
unlink(out_name);
exit(1);
}
if (!strcmp(name, "ID")) {
if (!new_unique_id(value)) { unlink(out_name); exit(1); }
if (!new_unique_id(value, in_name)) { unlink(out_name); exit(1); }
fprintf(out, "#define T_%s T_ID(%d)\n", value, n);
n++;
}
......
......@@ -337,54 +337,34 @@ static void forward(void *_forwarder, char *buf, int size)
static void wait_message(void)
{
while (T_local_cache[T_busylist_head].busy == 0) usleep(1000);
}
static void init_shm(char *shm_file)
{
int i;
int s = shm_open(shm_file, O_RDWR | O_CREAT /*| O_SYNC*/, 0666);
if (s == -1) { perror(shm_file); abort(); }
if (ftruncate(s, T_CACHE_SIZE * sizeof(T_cache_t)))
{ perror(shm_file); abort(); }
T_local_cache = mmap(NULL, T_CACHE_SIZE * sizeof(T_cache_t),
PROT_READ | PROT_WRITE, MAP_SHARED, s, 0);
if (T_local_cache == MAP_FAILED)
{ perror(shm_file); abort(); }
close(s);
/* let's garbage the memory to catch some potential problems
* (think multiprocessor sync issues, barriers, etc.)
*/
memset(T_local_cache, 0x55, T_CACHE_SIZE * sizeof(T_cache_t));
for (i = 0; i < T_CACHE_SIZE; i++) T_local_cache[i].busy = 0;
while ((T_local_cache[T_busylist_head].busy & 0x02) == 0) usleep(1000);
}
void T_local_tracer_main(int remote_port, int wait_for_tracer,
int local_socket, char *shm_file)
int local_socket, void *shm_array)
{
int s;
int port = remote_port;
int dont_wait = wait_for_tracer ? 0 : 1;
void *f;
printf("local tracer starting\n");
/* write on a socket fails if the other end is closed and we get SIGPIPE */
if (signal(SIGPIPE, SIG_IGN) == SIG_ERR){
if (signal(SIGPIPE, SIG_IGN) == SIG_ERR) {
printf("local tracer received SIGPIPE\n");
abort();
}
}
T_local_cache = shm_array;
init_shm(shm_file);
s = local_socket;
printf("local tracer starting step 2\n");
if (dont_wait) {
char t = 2;
printf("local tracer in no wait mode \n");
if (write(s, &t, 1) != 1) abort();
}
printf("local tracer starting step 3\n");
f = forwarder(port, s);
printf("local tracer main loop.... \n");
/* read messages */
while (1) {
wait_message();
......
......@@ -7,7 +7,7 @@ LIBS=-lm
XLIBS=-lX11 -lpng -lXft
all: record replay extract_config textlog enb ue vcd macpdu2wireshark \
extract_input_subframe extract_output_subframe to_vcd extract
extract_input_subframe extract_output_subframe to_vcd extract multi
record: utils.o record.o database.o config.o
$(CC) $(CFLAGS) -o record $^ $(LIBS)
......@@ -57,19 +57,22 @@ macpdu2wireshark: macpdu2wireshark.o database.o utils.o handler.o event.o \
config.o
$(CC) $(CFLAGS) -o $@ $^ $(LIBS)
multi: multi.o utils.o database.o config.o
$(CC) $(CFLAGS) -o multi $^ $(LIBS)
.PHONY: all gui/gui.a view/view.a logger/logger.a filter/filter.a
gui/gui.a:
cd gui && make
cd gui && $(MAKE)
view/view.a:
cd view && make
cd view && $(MAKE)
logger/logger.a:
cd logger && make
cd logger && $(MAKE)
filter/filter.a:
cd filter && make
cd filter && $(MAKE)
%.o: %.c
$(CC) $(CFLAGS) -c -o $@ $<
......@@ -77,9 +80,9 @@ filter/filter.a:
clean:
rm -f *.o core tracer_remote textlog enb ue vcd record replay
rm -f extract_config macpdu2wireshark extract_input_subframe
rm -f extract_output_subframe to_vcd extract
cd gui && make clean
cd view && make clean
cd logger && make clean
cd filter && make clean
cd hacks && make clean
rm -f extract_output_subframe to_vcd extract multi
cd gui && $(MAKE) clean
cd view && $(MAKE) clean
cd logger && $(MAKE) clean
cd filter && $(MAKE) clean
cd hacks && $(MAKE) clean
......@@ -60,3 +60,9 @@ void verify_config(void)
abort();
}
}
void get_local_config(char **txt, int *len)
{
*txt = local;
*len = local_size;
}
......@@ -5,5 +5,6 @@ void clear_remote_config(void);
void append_received_config_chunk(char *buf, int length);
void load_config_file(char *filename);
void verify_config(void);
void get_local_config(char **txt, int *len);
#endif /* _CONFIG_H_ */
......@@ -13,6 +13,7 @@ typedef struct {
char **arg_type;
char **arg_name;
int asize;
char *vcd_name;
int id;
} id;
......@@ -138,6 +139,7 @@ id *add_id(database *r, char *idname, int i)
r->i[r->isize].arg_type = NULL;
r->i[r->isize].arg_name = NULL;
r->i[r->isize].asize = 0;
r->i[r->isize].vcd_name = NULL;
r->i[r->isize].id = i;
r->isize++;
qsort(r->i, r->isize, sizeof(id), id_cmp);
......@@ -224,6 +226,12 @@ void add_desc(id *i, char *desc)
i->desc = strdup(desc); if (i->desc == NULL) abort();
}
void add_vcd_name(id *i, char *vcd_name)
{
if (i == NULL) {printf("ERROR: VCD_NAME line before ID line\n");exit(1);}
i->vcd_name = strdup(vcd_name); if (i->vcd_name == NULL) abort();
}
char *format_get_next_token(char **cur)
{
char *start;
......@@ -320,6 +328,7 @@ void *parse_database(char *filename)
if (!strcmp(name, "GROUP")) add_groups(r, last_id, value);
if (!strcmp(name, "DESC")) add_desc(last_id, value);
if (!strcmp(name, "FORMAT")) add_format(last_id, value);
if (!strcmp(name, "VCD_NAME")) add_vcd_name(last_id, value);
}
fclose(in);
......@@ -424,6 +433,12 @@ char *event_name_from_id(void *_database, int id)
return d->i[d->id_to_pos[id]].name;
}
char *event_vcd_name_from_id(void *_database, int id)
{
database *d = _database;
return d->i[d->id_to_pos[id]].vcd_name;
}
int event_id_from_name(void *_database, char *name)
{
database *d = _database;
......
......@@ -8,6 +8,7 @@ void list_ids(void *database);
void list_groups(void *database);
void on_off(void *d, char *item, int *a, int onoff);
char *event_name_from_id(void *database, int id);
char *event_vcd_name_from_id(void *_database, int id);
int event_id_from_name(void *database, char *name);
int number_of_ids(void *database);
int database_get_ids(void *database, char ***ids);
......
......@@ -878,6 +878,7 @@ int main(int n, char **v)
restart:
clear_remote_config();
if (enb_data.socket != -1) close(enb_data.socket);
enb_data.socket = connect_to(ip, port);
/* send the first message - activate selected traces */
......
This diff is collapsed.
......@@ -12,7 +12,14 @@
#include "logger/logger.h"
#include "view/view.h"
enum var_type {
DEFAULT,
VCD_FUNCTION,
VCD_VARIABLE
};
typedef struct {
enum var_type type;
char *event;
char *arg;
char *vcd_name;
......@@ -44,16 +51,39 @@ void vcd_write_header(vcd_vars *v, int n)
"$version\n"
" to_vcd\n"
"$end\n"
"$timescale 1ns $end\n"
"$timescale 1ns $end\n") <= 0) abort();
if (fprintf(out,
"$scope module logic $end\n") <= 0) abort();
for (i = 0; i < n; i++)
if (v[i].type == DEFAULT)
if (fprintf(out, "$var wire %d %s %s $end\n",
v[i].boolean ? 1 : 64,
v[i].vcd_name, v[i].vcd_name) <= 0) abort();
if (fprintf(out,
"$upscope $end\n") <= 0) abort();
if (fprintf(out,
"$scope module functions $end\n") <= 0) abort();
for (i = 0; i < n; i++)
if (v[i].type == VCD_FUNCTION)
if (fprintf(out, "$var wire %d %s %s $end\n",
v[i].boolean ? 1 : 64,
v[i].vcd_name, v[i].vcd_name) <= 0) abort();
if (fprintf(out,
"$upscope $end\n") <= 0) abort();
if (fprintf(out,
"$scope module variables $end\n") <= 0) abort();
for (i = 0; i < n; i++)
if (fprintf(out, "$var wire %d %s %s $end\n",
v[i].boolean ? 1 : 64,
v[i].vcd_name, v[i].vcd_name) <= 0) abort();
if (v[i].type == VCD_VARIABLE)
if (fprintf(out, "$var wire %d %s %s $end\n",
v[i].boolean ? 1 : 64,
v[i].vcd_name, v[i].vcd_name) <= 0) abort();
if (fprintf(out,
"$upscope $end\n") <= 0) abort();
if (fprintf(out,
"$upscope $end\n"
"$enddefinitions $end\n"
"$dumpvars\n") <= 0) abort();
......@@ -194,12 +224,13 @@ void force_stop(int x)
}
vcd_vars *add_var(vcd_vars *vars, int nvars,
char *event, char *arg, char *vcd_name, int is_boolean)
char *event, char *arg, char *vcd_name, int is_boolean, enum var_type t)
{
if (nvars % 64 == 0) {
vars = realloc(vars, (nvars+64) * sizeof(vcd_vars));
if (vars == NULL) abort();
}
vars[nvars].type = t;
vars[nvars].event = event;
vars[nvars].arg = arg;
vars[nvars].vcd_name = vcd_name;
......@@ -240,7 +271,7 @@ int main(int n, char **v)
char *event = v[++i];
char *arg = v[++i];
char *vcd_name = v[++i];
vars = add_var(vars, nvars, event, arg, vcd_name, 1);
vars = add_var(vars, nvars, event, arg, vcd_name, 1, DEFAULT);
nvars++;
continue;
}
......@@ -248,7 +279,7 @@ int main(int n, char **v)
char *event = v[++i];
char *arg = v[++i];
char *vcd_name = v[++i];
vars = add_var(vars, nvars, event, arg, vcd_name, 0);
vars = add_var(vars, nvars, event, arg, vcd_name, 0, DEFAULT);
nvars++;
continue;
}
......@@ -283,20 +314,30 @@ int main(int n, char **v)
/* activate all VCD traces */
for (i = 0; i < number_of_events; i++) {
int is_boolean;
enum var_type type;
int prefix_length;
char *name = event_name_from_id(database, i);
char *vcd_name;
char *var_prefix = "VCD_VARIABLE_";
char *fun_prefix = "VCD_FUNCTION_";
if (!strncmp(name, var_prefix, strlen(var_prefix))) {
prefix_length = strlen(var_prefix);
is_boolean = 0;
type = VCD_VARIABLE;
} else if (!strncmp(name, fun_prefix, strlen(fun_prefix))) {
prefix_length = strlen(fun_prefix);
is_boolean = 1;
type = VCD_FUNCTION;
} else
continue;
vcd_name = event_vcd_name_from_id(database, i);
if (vcd_name == NULL) {
vcd_name = name+prefix_length;
printf("WARNING: ID %s does not define VCD_NAME in the file %s, using %s\n",
name, database_filename, vcd_name);
}
vars = add_var(vars, nvars,
name, "value", name+prefix_length, is_boolean);
name, "value", vcd_name, is_boolean, type);
nvars++;
}
}
......
......@@ -857,6 +857,7 @@ int main(int n, char **v)
restart:
clear_remote_config();
if (ue_data.socket != -1) close(ue_data.socket);
ue_data.socket = connect_to(ip, port);
/* send the first message - activate selected traces */
......
......@@ -79,6 +79,36 @@ list *list_append(list *l, void *data)
/* socket */
/****************************************************************************/
int create_listen_socket(char *addr, int port)
{
struct sockaddr_in a;
int s;
int v;
s = socket(AF_INET, SOCK_STREAM, 0);
if (s == -1) { perror("socket"); exit(1); }
v = 1;
if (setsockopt(s, SOL_SOCKET, SO_REUSEADDR, &v, sizeof(int)))
{ perror("setsockopt"); exit(1); }
a.sin_family = AF_INET;
a.sin_port = htons(port);
a.sin_addr.s_addr = inet_addr(addr);
if (bind(s, (struct sockaddr *)&a, sizeof(a))) { perror("bind"); exit(1); }
if (listen(s, 5)) { perror("listen"); exit(1); }
return s;
}
int socket_accept(int s)
{
struct sockaddr_in a;
socklen_t alen;
alen = sizeof(a);
return accept(s, (struct sockaddr *)&a, &alen);
}
int socket_send(int socket, void *buffer, int size)
{
char *x = buffer;
......@@ -94,26 +124,13 @@ int socket_send(int socket, void *buffer, int size)
int get_connection(char *addr, int port)
{
struct sockaddr_in a;
socklen_t alen;
int s, t;
printf("waiting for connection on %s:%d\n", addr, port);
s = socket(AF_INET, SOCK_STREAM, 0);
if (s == -1) { perror("socket"); exit(1); }
t = 1;
if (setsockopt(s, SOL_SOCKET, SO_REUSEADDR, &t, sizeof(int)))
{ perror("setsockopt"); exit(1); }
a.sin_family = AF_INET;
a.sin_port = htons(port);
a.sin_addr.s_addr = inet_addr(addr);
s = create_listen_socket(addr, port);
if (bind(s, (struct sockaddr *)&a, sizeof(a))) { perror("bind"); exit(1); }
if (listen(s, 5)) { perror("bind"); exit(1); }
alen = sizeof(a);
t = accept(s, (struct sockaddr *)&a, &alen);
t = socket_accept(s);
if (t == -1) { perror("accept"); exit(1); }
close(s);
......@@ -137,14 +154,11 @@ int fullread(int fd, void *_buf, int count)
return ret;
}
int connect_to(char *addr, int port)
int try_connect_to(char *addr, int port)
{
int s;
struct sockaddr_in a;
printf("connecting to %s:%d\n", addr, port);
again:
s = socket(AF_INET, SOCK_STREAM, 0);
if (s == -1) { perror("socket"); exit(1); }
......@@ -155,6 +169,21 @@ again:
if (connect(s, (struct sockaddr *)&a, sizeof(a)) == -1) {
perror("connect");
close(s);
return -1;
}
return s;
}
int connect_to(char *addr, int port)
{
int s;
printf("connecting to %s:%d\n", addr, port);
again:
s = try_connect_to(addr, port);
if (s == -1) {
printf("trying again in 1s\n");
sleep(1);
goto again;
......
......@@ -24,11 +24,14 @@ list *list_append(list *l, void *data);
#define DEFAULT_REMOTE_IP "127.0.0.1"
#define DEFAULT_REMOTE_PORT 2021
int create_listen_socket(char *addr, int port);
int socket_accept(int s);
/* socket_send: return 0 if okay, -1 on error */
int socket_send(int socket, void *buffer, int size);
int get_connection(char *addr, int port);
/* fullread: return length read if okay (that is: 'count'), -1 on error */
int fullread(int fd, void *_buf, int count);
int try_connect_to(char *addr, int port);
int connect_to(char *addr, int port);
/****************************************************************************/
......
......@@ -745,7 +745,7 @@ void itti_exit_task(void)
#if defined(OAI_EMU) || defined(RTAI)
if (task_id > TASK_UNKNOWN) {
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLE_ITTI_RECV_MSG,
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_ITTI_RECV_MSG,
__sync_and_and_fetch (&itti_desc.vcd_receive_msg, ~(1L << task_id)));
}
#endif
......
......@@ -40,8 +40,14 @@
#include<math.h>
#include <stdlib.h>
#include <string.h>
#include <linux/version.h>
#if RHEL_RELEASE_CODE >= 1796
#include <lapacke/lapacke_utils.h>
#include <lapacke/lapacke.h>
#else
#include <lapacke_utils.h>
#include <lapacke.h>
#endif
#include <cblas.h>
#include "linear_preprocessing_rec.h"
......
......@@ -13,9 +13,14 @@ data storage. */
#include <stdlib.h>
#include <cblas.h>
#include <string.h>
#include <linux/version.h>
#if RHEL_RELEASE_CODE >= 1796
#include <lapacke/lapacke_utils.h>
#include <lapacke/lapacke.h>
#else
#include <lapacke_utils.h>
#include <lapacke.h>
#endif
//#define DEBUG_PREPROC
......@@ -366,4 +371,4 @@ float sqrt_float(float x, float sqrt_x)
{
sqrt_x = (float)(sqrt((double)(x)));
return sqrt_x;
}
\ No newline at end of file
}
......@@ -2355,12 +2355,12 @@ int RCconfig_S1(MessageDef *msg_p, uint32_t i) {
#endif
}
if (strcmp(*(S1ParamList.paramarray[l][ENB_MME_IP_ADDRESS_PREFERENCE_IDX].strptr), "ipv4") == 0) {
S1AP_REGISTER_ENB_REQ (msg_p).mme_ip_address[j].ipv4 = 1;
S1AP_REGISTER_ENB_REQ (msg_p).mme_ip_address[l].ipv4 = 1;
} else if (strcmp(*(S1ParamList.paramarray[l][ENB_MME_IP_ADDRESS_PREFERENCE_IDX].strptr), "ipv6") == 0) {
S1AP_REGISTER_ENB_REQ (msg_p).mme_ip_address[j].ipv6 = 1;
S1AP_REGISTER_ENB_REQ (msg_p).mme_ip_address[l].ipv6 = 1;
} else if (strcmp(*(S1ParamList.paramarray[l][ENB_MME_IP_ADDRESS_PREFERENCE_IDX].strptr), "no") == 0) {
S1AP_REGISTER_ENB_REQ (msg_p).mme_ip_address[j].ipv4 = 1;
S1AP_REGISTER_ENB_REQ (msg_p).mme_ip_address[j].ipv6 = 1;
S1AP_REGISTER_ENB_REQ (msg_p).mme_ip_address[l].ipv4 = 1;
S1AP_REGISTER_ENB_REQ (msg_p).mme_ip_address[l].ipv6 = 1;
}
}
......
......@@ -386,6 +386,7 @@ set_ul_DAI(int module_idP, int UE_idP, int CC_idP, int frameP,
UE_list->UE_template[CC_idP][UE_idP].DAI_ul[3] = DAI;
break;
}
break;
case 2:
// if ((subframeP==3)||(subframeP==8))
......
......@@ -324,7 +324,11 @@ static const struct net_device_ops nasmesh_netdev_ops = {
.ndo_set_mac_address = NULL,
.ndo_set_config = nas_set_config,
.ndo_do_ioctl = nas_CTL_ioctl,
#if RHEL_RELEASE_CODE>=1797
.extended.ndo_change_mtu = nas_change_mtu,
#else
.ndo_change_mtu = nas_change_mtu,
#endif
.ndo_tx_timeout = nas_tx_timeout,
};
......
......@@ -349,7 +349,11 @@ static const struct net_device_ops ue_ip_netdev_ops = {
.ndo_set_mac_address = ue_ip_set_mac_address,
.ndo_set_config = ue_ip_set_config,
.ndo_do_ioctl = NULL,
.ndo_change_mtu = ue_ip_change_mtu,
#if RHEL_RELEASE_CODE>=1797
.extended.ndo_change_mtu = ue_ip_change_mtu,
#else
.ndo_change_mtu = ue_ip_change_mtu,
#endif
.ndo_tx_timeout = ue_ip_tx_timeout,
.ndo_change_rx_flags = ue_ip_change_rx_flags,
};
......
......@@ -6881,3 +6881,201 @@ id-EDT-Session ProtocolIE-ID ::= 281
id-CNTypeRestrictions ProtocolIE-ID ::= 282
END
-- **************************************************************
--
-- Container definitions
--
-- **************************************************************
S1AP-Containers {
itu-t (0) identified-organization (4) etsi (0) mobileDomain (0)
eps-Access (21) modules (3) s1ap (1) version1 (1) s1ap-Containers (5) }
DEFINITIONS AUTOMATIC TAGS ::=
BEGIN
-- **************************************************************
--
-- IE parameter types from other modules.
--
-- **************************************************************
IMPORTS
Criticality,
Presence,
PrivateIE-ID,
ProtocolExtensionID,
ProtocolIE-ID
FROM S1AP-CommonDataTypes
maxPrivateIEs,
maxProtocolExtensions,
maxProtocolIEs
FROM S1AP-Constants;
-- **************************************************************
--
-- Class Definition for Protocol IEs
--
-- **************************************************************
S1AP-PROTOCOL-IES ::= CLASS {
&id ProtocolIE-ID UNIQUE,
&criticality Criticality,
&Value,
&presence Presence
}
WITH SYNTAX {
ID &id
CRITICALITY &criticality
TYPE &Value
PRESENCE &presence
}
-- **************************************************************
--
-- Class Definition for Protocol IEs
--
-- **************************************************************
S1AP-PROTOCOL-IES-PAIR ::= CLASS {
&id ProtocolIE-ID UNIQUE,
&firstCriticality Criticality,
&FirstValue,
&secondCriticality Criticality,
&SecondValue,
&presence Presence
}
WITH SYNTAX {
ID &id
FIRST CRITICALITY &firstCriticality
FIRST TYPE &FirstValue
SECOND CRITICALITY &secondCriticality
SECOND TYPE &SecondValue
PRESENCE &presence
}
-- **************************************************************
--
-- Class Definition for Protocol Extensions
--
-- **************************************************************
S1AP-PROTOCOL-EXTENSION ::= CLASS {
&id ProtocolExtensionID UNIQUE,
&criticality Criticality,
&Extension,
&presence Presence
}
WITH SYNTAX {
ID &id
CRITICALITY &criticality
EXTENSION &Extension
PRESENCE &presence
}
-- **************************************************************
--
-- Class Definition for Private IEs
--
-- **************************************************************
S1AP-PRIVATE-IES ::= CLASS {
&id PrivateIE-ID,
&criticality Criticality,
&Value,
&presence Presence
}
WITH SYNTAX {
ID &id
CRITICALITY &criticality
TYPE &Value
PRESENCE &presence
}
-- **************************************************************
--
-- Container for Protocol IEs
--
-- **************************************************************
ProtocolIE-Container {S1AP-PROTOCOL-IES : IEsSetParam} ::=
SEQUENCE (SIZE (0..maxProtocolIEs)) OF
ProtocolIE-Field {{IEsSetParam}}
ProtocolIE-SingleContainer {S1AP-PROTOCOL-IES : IEsSetParam} ::=
ProtocolIE-Field {{IEsSetParam}}
ProtocolIE-Field {S1AP-PROTOCOL-IES : IEsSetParam} ::= SEQUENCE {
id S1AP-PROTOCOL-IES.&id ({IEsSetParam}),
criticality S1AP-PROTOCOL-IES.&criticality ({IEsSetParam}{@id}),
value S1AP-PROTOCOL-IES.&Value ({IEsSetParam}{@id})
}
-- **************************************************************
--
-- Container for Protocol IE Pairs
--
-- **************************************************************
ProtocolIE-ContainerPair {S1AP-PROTOCOL-IES-PAIR : IEsSetParam} ::=
SEQUENCE (SIZE (0..maxProtocolIEs)) OF
ProtocolIE-FieldPair {{IEsSetParam}}
ProtocolIE-FieldPair {S1AP-PROTOCOL-IES-PAIR : IEsSetParam} ::= SEQUENCE {
id S1AP-PROTOCOL-IES-PAIR.&id ({IEsSetParam}),
firstCriticality S1AP-PROTOCOL-IES-PAIR.&firstCriticality ({IEsSetParam}{@id}),
firstValue S1AP-PROTOCOL-IES-PAIR.&FirstValue ({IEsSetParam}{@id}),
secondCriticality S1AP-PROTOCOL-IES-PAIR.&secondCriticality ({IEsSetParam}{@id}),
secondValue S1AP-PROTOCOL-IES-PAIR.&SecondValue ({IEsSetParam}{@id})
}
-- **************************************************************
--
-- Container Lists for Protocol IE Containers
--
-- **************************************************************
ProtocolIE-ContainerList {INTEGER : lowerBound, INTEGER : upperBound, S1AP-PROTOCOL-IES : IEsSetParam} ::=
SEQUENCE (SIZE (lowerBound..upperBound)) OF
ProtocolIE-SingleContainer {{IEsSetParam}}
ProtocolIE-ContainerPairList {INTEGER : lowerBound, INTEGER : upperBound, S1AP-PROTOCOL-IES-PAIR : IEsSetParam} ::=
SEQUENCE (SIZE (lowerBound..upperBound)) OF
ProtocolIE-ContainerPair {{IEsSetParam}}
-- **************************************************************
--
-- Container for Protocol Extensions
--
-- **************************************************************
ProtocolExtensionContainer {S1AP-PROTOCOL-EXTENSION : ExtensionSetParam} ::=
SEQUENCE (SIZE (1..maxProtocolExtensions)) OF
ProtocolExtensionField {{ExtensionSetParam}}
ProtocolExtensionField {S1AP-PROTOCOL-EXTENSION : ExtensionSetParam} ::= SEQUENCE {
id S1AP-PROTOCOL-EXTENSION.&id ({ExtensionSetParam}),
criticality S1AP-PROTOCOL-EXTENSION.&criticality ({ExtensionSetParam}{@id}),
extensionValue S1AP-PROTOCOL-EXTENSION.&Extension ({ExtensionSetParam}{@id})
}
-- **************************************************************
--
-- Container for Private IEs
--
-- **************************************************************
PrivateIE-Container {S1AP-PRIVATE-IES : IEsSetParam } ::=
SEQUENCE (SIZE (1.. maxPrivateIEs)) OF
PrivateIE-Field {{IEsSetParam}}
PrivateIE-Field {S1AP-PRIVATE-IES : IEsSetParam} ::= SEQUENCE {
id S1AP-PRIVATE-IES.&id ({IEsSetParam}),
criticality S1AP-PRIVATE-IES.&criticality ({IEsSetParam}{@id}),
value S1AP-PRIVATE-IES.&Value ({IEsSetParam}{@id})
}
END
......@@ -121,7 +121,7 @@ extern int emulate_rf;
extern int numerology;
extern int fepw;
extern int single_thread_flag;
extern clock_source_t clock_source;
extern void phy_init_RU(RU_t*);
extern void phy_free_RU(RU_t*);
......@@ -1411,7 +1411,8 @@ void fill_rf_config(RU_t *ru, char *rf_config_file) {
cfg->num_rb_dl=fp->N_RB_DL;
cfg->tx_num_channels=ru->nb_tx;
cfg->rx_num_channels=ru->nb_rx;
cfg->clock_source=clock_source;
for (i=0; i<ru->nb_tx; i++) {
cfg->tx_freq[i] = (double)fp->dl_CarrierFreq;
......
......@@ -130,7 +130,7 @@ volatile int start_UE = 0;
#endif
volatile int oai_exit = 0;
static clock_source_t clock_source = internal;
clock_source_t clock_source = internal;
static int wait_for_sync = 0;
unsigned int mmapped_dma=0;
......@@ -942,7 +942,7 @@ int main( int argc, char **argv )
printf("Reading in command-line options\n");
get_options ();
get_options ();
if (CONFIG_ISFLAGSET(CONFIG_ABORT) ) {
fprintf(stderr,"Getting configuration failed\n");
exit(-1);
......@@ -1131,13 +1131,6 @@ int main( int argc, char **argv )
rt_sleep_ns(10*100000000ULL);
if (nfapi_mode) {
printf("NFAPI*** - mutex and cond created - will block shortly for completion of PNF connection\n");
pthread_cond_init(&sync_cond,NULL);
pthread_mutex_init(&sync_mutex, NULL);
}
if (nfapi_mode)
{
printf("NFAPI*** - mutex and cond created - will block shortly for completion of PNF connection\n");
......
......@@ -65,7 +65,7 @@
#define CONFIG_HLP_UELOOP "get softmodem (UE) to loop through memory instead of acquiring from HW\n"
#define CONFIG_HLP_PHYTST "test UE phy layer, mac disabled\n"
#define CONFIG_HLP_DMAMAP "sets flag for improved EXMIMO UE performance\n"
#define CONFIG_HLP_EXCCLK "tells hardware to use an external clock reference\n"
#define CONFIG_HLP_CLK "tells hardware to use a clock reference (0:internal, 1:external, 2:gpsdo)\n"
#define CONFIG_HLP_USIM "use XOR autentication algo in case of test usim mode\n"
#define CONFIG_HLP_NOSNGLT "Disables single-thread mode in lte-softmodem\n"
#define CONFIG_HLP_TADV "Set timing_advance\n"
......@@ -161,7 +161,7 @@
{"phy-test", CONFIG_HLP_PHYTST, PARAMFLAG_BOOL, iptr:&phy_test, defintval:0, TYPE_INT, 0}, \
{"usim-test", CONFIG_HLP_USIM, PARAMFLAG_BOOL, u8ptr:&usim_test, defintval:0, TYPE_UINT8, 0}, \
{"mmapped-dma", CONFIG_HLP_DMAMAP, PARAMFLAG_BOOL, uptr:&mmapped_dma, defintval:0, TYPE_INT, 0}, \
{"external-clock", CONFIG_HLP_EXCCLK, PARAMFLAG_BOOL, uptr:&clock_source, defintval:0, TYPE_INT, 0}, \
{"clock", CONFIG_HLP_CLK, 0, uptr:&clock_source, defintval:0, TYPE_UINT, 0}, \
{"wait-for-sync", NULL, PARAMFLAG_BOOL, iptr:&wait_for_sync, defintval:0, TYPE_INT, 0}, \
{"single-thread-enable", CONFIG_HLP_NOSNGLT, PARAMFLAG_BOOL, iptr:&single_thread_flag, defintval:0, TYPE_INT, 0}, \
{"threadIQ", NULL, 0, iptr:&(threads.iq), defintval:1, TYPE_INT, 0}, \
......
......@@ -136,7 +136,7 @@ volatile int start_UE = 0;
#endif
volatile int oai_exit = 0;
static clock_source_t clock_source = internal;
clock_source_t clock_source = internal;
static int wait_for_sync = 0;
unsigned int mmapped_dma=0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment