Commit c72696c5 authored by wujing's avatar wujing

merge OAI develop_2019_w04

parents 63dda4aa f7938a4b
job1:
script:
- date
- pwd
- echo $OAI_TEST_CASE_GROUP
- echo $MACHINELIST
- echo $MACHINELISTGENERIC
- echo $RESULT_DIR
- echo $NRUNS_LTE_SOFTMODEM
- source oaienv
- rm -rf cmake_targets/autotests/log
- mkdir cmake_targets/autotests/log
- cd cmake_targets/autotests/v2
- python main.py
- date
only:
- triggers
...@@ -9,26 +9,36 @@ Please see NOTICE.txt for third party software that is included in the sources. ...@@ -9,26 +9,36 @@ Please see NOTICE.txt for third party software that is included in the sources.
The OpenAirInterface (OAI) software is composed of the following parts: The OpenAirInterface (OAI) software is composed of the following parts:
openairinterface5g openairinterface5g
├── cmake_targets: build utilities to compile (simulation, emulation and real-time platforms), and generated build files ├── ci-scripts: Meta-scripts used by the OSA CI process. Contains also configuration files used day-to-day by CI.
├── common : some common OAI utilities, other tools can be found at openair2/UTILS ├── cmake_targets: Build utilities to compile (simulation, emulation and real-time platforms), and generated build files
├── common : Some common OAI utilities, other tools can be found at openair2/UTILS
├── doc : Contains an up-to-date feature set list
├── LICENSE ├── LICENSE
├── maketags : script to generate emacs tags ├── maketags : Script to generate emacs tags
├── openair1 : 3GPP LTE Rel-10 PHY layer + PHY RF simulation and a subset of Rel 12 Features. ├── nfapi : Contains the NFAPI code. A local Readme file provides more details.
├── openair2 :3GPP LTE Rel-10 RLC/MAC/PDCP/RRC/X2AP implementation. ├── openair1 : 3GPP LTE Rel-10/12 PHY layer + PHY RF simulation. A local Readme file provides more details.
├── openair2 : 3GPP LTE Rel-10 RLC/MAC/PDCP/RRC/X2AP implementation.
├── COMMON
├── DOCS
├── ENB_APP
├── LAYER2/RLC/ with the following subdirectories: UM_v9.3.0, TM_v9.3.0, and AM_v9.3.0. ├── LAYER2/RLC/ with the following subdirectories: UM_v9.3.0, TM_v9.3.0, and AM_v9.3.0.
├── LAYER2/PDCP/PDCP_v10.1.0. ├── LAYER2/PDCP/PDCP_v10.1.0.
├── RRC/LITE ├── NETWORK_DRIVER
├── PHY_INTERFACE ├── PHY_INTERFACE
├── RRC/LITE
├── UTIL
├── X2AP ├── X2AP
├── ENB_APP
├── openair3: 3GPP LTE Rel10 for S1AP, NAS GTPV1-U for both ENB and UE. ├── openair3: 3GPP LTE Rel10 for S1AP, NAS GTPV1-U for both ENB and UE.
├── COMMON
├── DOCS
├── GTPV1-U ├── GTPV1-U
├── NAS ├── NAS
├── S1AP ├── S1AP
├── SCTP ├── SCTP
├── SECU ├── SECU
├── UDP ├── UDP
└── targets: top level wrapper for unitary simulation for PHY channels, system-level emulation (eNB-UE with and without S1), and realtime eNB and UE and RRH GW. ├── UTILS
└── targets: Top-level wrappers for unitary simulation for PHY channels, system-level emulation (eNB-UE with and without S1), and realtime eNB and UE and RRH GW.
RELEASE NOTES: RELEASE NOTES:
...@@ -44,3 +54,10 @@ v0.6 -> RRH functionality, UE greatly improved, better TDD support, ...@@ -44,3 +54,10 @@ v0.6 -> RRH functionality, UE greatly improved, better TDD support,
a lot of bugs fixed. WARNING: oaisim in PHY abstraction mode does not a lot of bugs fixed. WARNING: oaisim in PHY abstraction mode does not
work, you need to use v0.5.2 for that. work, you need to use v0.5.2 for that.
v0.6.1 -> Mostly bugfixes. This is the last version without NFAPI. v0.6.1 -> Mostly bugfixes. This is the last version without NFAPI.
v1.0.0 -> January 2019. This version first implements the architectural split described in doc/oai_lte_enb_func_split_arch.png picture.
Only FAPI, nFAPI and IF4.5 interfaces are implemented.
Repository tree structure prepares future integrations of features such as LTE-M, nbIOT or 5G-NR.
Preliminary X2 support has been implemented.
S1-flex has been introduced.
New tools: config library, telnet server, ...
A lot of bugfixes and a proper automated Continuous Integration process validates contributions.
This diff is collapsed.
...@@ -187,8 +187,12 @@ pipeline { ...@@ -187,8 +187,12 @@ pipeline {
]) { ]) {
sh "python3 main.py --mode=TesteNB --eNBIPAddress=${params.eNB_IPAddress} --eNBRepository=${eNB_Repository} --eNBBranch=${eNB_Branch} --eNBCommitID=${eNB_CommitID} --eNB_AllowMerge=${eNB_AllowMergeRequestProcess} --eNBUserName=${eNB_Username} --eNBPassword=${eNB_Password} --eNBSourceCodePath=${params.eNB_SourceCodePath} --EPCIPAddress=${params.EPC_IPAddress} --EPCType=${params.EPC_Type} --EPCUserName=${EPC_Username} --EPCPassword=${EPC_Password} --EPCSourceCodePath=${params.EPC_SourceCodePath} --ADBIPAddress=${params.ADB_IPAddress} --ADBUserName=${ADB_Username} --ADBPassword=${ADB_Password} --XMLTestFile=${testXMLFile}" sh "python3 main.py --mode=TesteNB --eNBIPAddress=${params.eNB_IPAddress} --eNBRepository=${eNB_Repository} --eNBBranch=${eNB_Branch} --eNBCommitID=${eNB_CommitID} --eNB_AllowMerge=${eNB_AllowMergeRequestProcess} --eNBUserName=${eNB_Username} --eNBPassword=${eNB_Password} --eNBSourceCodePath=${params.eNB_SourceCodePath} --EPCIPAddress=${params.EPC_IPAddress} --EPCType=${params.EPC_Type} --EPCUserName=${EPC_Username} --EPCPassword=${EPC_Password} --EPCSourceCodePath=${params.EPC_SourceCodePath} --ADBIPAddress=${params.ADB_IPAddress} --ADBUserName=${ADB_Username} --ADBPassword=${ADB_Password} --XMLTestFile=${testXMLFile}"
} }
<<<<<<< HEAD
} catch (Exception e) { } catch (Exception e) {
currentBuild.result = 'FAILURE' currentBuild.result = 'FAILURE'
=======
sh "python3 main.py --mode=FinalizeHtml --finalStatus=${buildStageStatus} --eNBIPAddress=${params.eNB_IPAddress} --eNBUserName=${eNB_Username} --eNBPassword=${eNB_Password}"
>>>>>>> develop_integration_2019_w04
} }
} }
} }
......
...@@ -201,8 +201,8 @@ MACRLCs = ( ...@@ -201,8 +201,8 @@ MACRLCs = (
tr_s_preference = "local_L1"; tr_s_preference = "local_L1";
tr_n_preference = "local_RRC"; tr_n_preference = "local_RRC";
phy_test_mode = 0; phy_test_mode = 0;
puSch10xSnr = 200; puSch10xSnr = 160;
puCch10xSnr = 200; puCch10xSnr = 160;
} }
); );
...@@ -228,6 +228,15 @@ RUs = ( ...@@ -228,6 +228,15 @@ RUs = (
} }
); );
THREAD_STRUCT = (
{
#three config for level of parallelism "PARALLEL_SINGLE_THREAD", "PARALLEL_RU_L1_SPLIT", or "PARALLEL_RU_L1_TRX_SPLIT"
parallel_config = "PARALLEL_SINGLE_THREAD";
#two option for worker "WORKER_DISABLE" or "WORKER_ENABLE"
worker_config = "WORKER_ENABLE";
}
);
NETWORK_CONTROLLER : NETWORK_CONTROLLER :
{ {
FLEXRAN_ENABLED = "no"; FLEXRAN_ENABLED = "no";
......
...@@ -201,8 +201,8 @@ MACRLCs = ( ...@@ -201,8 +201,8 @@ MACRLCs = (
tr_s_preference = "local_L1"; tr_s_preference = "local_L1";
tr_n_preference = "local_RRC"; tr_n_preference = "local_RRC";
phy_test_mode = 0; phy_test_mode = 0;
puSch10xSnr = 200; puSch10xSnr = 160;
puCch10xSnr = 200; puCch10xSnr = 160;
} }
); );
...@@ -222,12 +222,21 @@ RUs = ( ...@@ -222,12 +222,21 @@ RUs = (
att_rx = 0; att_rx = 0;
bands = [7]; bands = [7];
max_pdschReferenceSignalPower = -27; max_pdschReferenceSignalPower = -27;
max_rxgain = 115; max_rxgain = 125;
eNB_instances = [0]; eNB_instances = [0];
} }
); );
THREAD_STRUCT = (
{
#three config for level of parallelism "PARALLEL_SINGLE_THREAD", "PARALLEL_RU_L1_SPLIT", or "PARALLEL_RU_L1_TRX_SPLIT"
parallel_config = "PARALLEL_SINGLE_THREAD";
#two option for worker "WORKER_DISABLE" or "WORKER_ENABLE"
worker_config = "WORKER_ENABLE";
}
);
NETWORK_CONTROLLER : NETWORK_CONTROLLER :
{ {
FLEXRAN_ENABLED = "no"; FLEXRAN_ENABLED = "no";
......
...@@ -201,8 +201,8 @@ MACRLCs = ( ...@@ -201,8 +201,8 @@ MACRLCs = (
tr_s_preference = "local_L1"; tr_s_preference = "local_L1";
tr_n_preference = "local_RRC"; tr_n_preference = "local_RRC";
phy_test_mode = 0; phy_test_mode = 0;
puSch10xSnr = 200; puSch10xSnr = 160;
puCch10xSnr = 200; puCch10xSnr = 160;
} }
); );
...@@ -222,12 +222,21 @@ RUs = ( ...@@ -222,12 +222,21 @@ RUs = (
att_rx = 0; att_rx = 0;
bands = [7]; bands = [7];
max_pdschReferenceSignalPower = -27; max_pdschReferenceSignalPower = -27;
max_rxgain = 115; max_rxgain = 120;
eNB_instances = [0]; eNB_instances = [0];
} }
); );
THREAD_STRUCT = (
{
#three config for level of parallelism "PARALLEL_SINGLE_THREAD", "PARALLEL_RU_L1_SPLIT", or "PARALLEL_RU_L1_TRX_SPLIT"
parallel_config = "PARALLEL_SINGLE_THREAD";
#two option for worker "WORKER_DISABLE" or "WORKER_ENABLE"
worker_config = "WORKER_ENABLE";
}
);
NETWORK_CONTROLLER : NETWORK_CONTROLLER :
{ {
FLEXRAN_ENABLED = "no"; FLEXRAN_ENABLED = "no";
......
...@@ -200,8 +200,8 @@ MACRLCs = ( ...@@ -200,8 +200,8 @@ MACRLCs = (
tr_s_preference = "local_L1"; tr_s_preference = "local_L1";
tr_n_preference = "local_RRC"; tr_n_preference = "local_RRC";
phy_test_mode = 0; phy_test_mode = 0;
puSch10xSnr = 200; puSch10xSnr = 160;
puCch10xSnr = 200; puCch10xSnr = 160;
} }
); );
...@@ -234,7 +234,7 @@ RUs = ( ...@@ -234,7 +234,7 @@ RUs = (
THREAD_STRUCT = ( THREAD_STRUCT = (
{ {
#three config for level of parallelism "PARALLEL_SINGLE_THREAD", "PARALLEL_RU_L1_SPLIT", or "PARALLEL_RU_L1_TRX_SPLIT" #three config for level of parallelism "PARALLEL_SINGLE_THREAD", "PARALLEL_RU_L1_SPLIT", or "PARALLEL_RU_L1_TRX_SPLIT"
parallel_config = "PARALLEL_RU_L1_TRX_SPLIT"; parallel_config = "PARALLEL_SINGLE_THREAD";
#two option for worker "WORKER_DISABLE" or "WORKER_ENABLE" #two option for worker "WORKER_DISABLE" or "WORKER_ENABLE"
worker_config = "WORKER_ENABLE"; worker_config = "WORKER_ENABLE";
} }
......
...@@ -200,8 +200,8 @@ MACRLCs = ( ...@@ -200,8 +200,8 @@ MACRLCs = (
tr_s_preference = "local_L1"; tr_s_preference = "local_L1";
tr_n_preference = "local_RRC"; tr_n_preference = "local_RRC";
phy_test_mode = 0; phy_test_mode = 0;
puSch10xSnr = 200; puSch10xSnr = 160;
puCch10xSnr = 200; puCch10xSnr = 160;
} }
); );
...@@ -234,7 +234,7 @@ RUs = ( ...@@ -234,7 +234,7 @@ RUs = (
THREAD_STRUCT = ( THREAD_STRUCT = (
{ {
#three config for level of parallelism "PARALLEL_SINGLE_THREAD", "PARALLEL_RU_L1_SPLIT", or "PARALLEL_RU_L1_TRX_SPLIT" #three config for level of parallelism "PARALLEL_SINGLE_THREAD", "PARALLEL_RU_L1_SPLIT", or "PARALLEL_RU_L1_TRX_SPLIT"
parallel_config = "PARALLEL_RU_L1_TRX_SPLIT"; parallel_config = "PARALLEL_SINGLE_THREAD";
#two option for worker "WORKER_DISABLE" or "WORKER_ENABLE" #two option for worker "WORKER_DISABLE" or "WORKER_ENABLE"
worker_config = "WORKER_ENABLE"; worker_config = "WORKER_ENABLE";
} }
......
...@@ -200,8 +200,8 @@ MACRLCs = ( ...@@ -200,8 +200,8 @@ MACRLCs = (
tr_s_preference = "local_L1"; tr_s_preference = "local_L1";
tr_n_preference = "local_RRC"; tr_n_preference = "local_RRC";
phy_test_mode = 0; phy_test_mode = 0;
puSch10xSnr = 200; puSch10xSnr = 160;
puCch10xSnr = 200; puCch10xSnr = 160;
} }
); );
...@@ -234,7 +234,7 @@ RUs = ( ...@@ -234,7 +234,7 @@ RUs = (
THREAD_STRUCT = ( THREAD_STRUCT = (
{ {
#three config for level of parallelism "PARALLEL_SINGLE_THREAD", "PARALLEL_RU_L1_SPLIT", or "PARALLEL_RU_L1_TRX_SPLIT" #three config for level of parallelism "PARALLEL_SINGLE_THREAD", "PARALLEL_RU_L1_SPLIT", or "PARALLEL_RU_L1_TRX_SPLIT"
parallel_config = "PARALLEL_RU_L1_TRX_SPLIT"; parallel_config = "PARALLEL_SINGLE_THREAD";
#two option for worker "WORKER_DISABLE" or "WORKER_ENABLE" #two option for worker "WORKER_DISABLE" or "WORKER_ENABLE"
worker_config = "WORKER_ENABLE"; worker_config = "WORKER_ENABLE";
} }
......
This diff is collapsed.
...@@ -20,7 +20,7 @@ RUs = ( ...@@ -20,7 +20,7 @@ RUs = (
THREAD_STRUCT = ( THREAD_STRUCT = (
{ {
#three config for level of parallelism "PARALLEL_SINGLE_THREAD", "PARALLEL_RU_L1_SPLIT", or "PARALLEL_RU_L1_TRX_SPLIT" #three config for level of parallelism "PARALLEL_SINGLE_THREAD", "PARALLEL_RU_L1_SPLIT", or "PARALLEL_RU_L1_TRX_SPLIT"
parallel_config = "PARALLEL_RU_L1_TRX_SPLIT"; parallel_config = "PARALLEL_SINGLE_THREAD";
#two option for worker "WORKER_DISABLE" or "WORKER_ENABLE" #two option for worker "WORKER_DISABLE" or "WORKER_ENABLE"
worker_config = "WORKER_ENABLE"; worker_config = "WORKER_ENABLE";
} }
......
log_config = {
global_log_level ="info";
global_log_verbosity ="medium";
hw_log_level ="info";
hw_log_verbosity ="medium";
phy_log_level ="info";
phy_log_verbosity ="medium";
mac_log_level ="info";
mac_log_verbosity ="medium";
rlc_log_level ="info";
rlc_log_verbosity ="medium";
pdcp_log_level ="info";
pdcp_log_verbosity ="medium";
rrc_log_level ="info";
rrc_log_verbosity ="full";
};
L1s = (
{
num_cc = 1;
tr_n_preference = "nfapi";
local_n_if_name = "lo";
remote_n_address = "127.0.0.2";
local_n_address = "127.0.0.1";
local_n_portc = 50000;
remote_n_portc = 50001;
local_n_portd = 50010;
remote_n_portd = 50011;
}
);
RUs = (
{
local_rf = "yes"
nb_tx = 1
nb_rx = 1
att_tx = 90
att_rx = 0;
bands = [7,38,42,43];
max_pdschReferenceSignalPower = -27;
max_rxgain = 125;
}
);
This diff is collapsed.
...@@ -40,6 +40,7 @@ function variant_usage { ...@@ -40,6 +40,7 @@ function variant_usage {
echo " --variant cppcheck OR -v4" echo " --variant cppcheck OR -v4"
echo " --variant enb-ethernet OR -v7" echo " --variant enb-ethernet OR -v7"
echo " --variant ue-ethernet OR -v8" echo " --variant ue-ethernet OR -v8"
echo " --variant l2-sim OR -v9"
echo " --variant flexran-rtc OR -v10" echo " --variant flexran-rtc OR -v10"
} }
...@@ -285,6 +286,18 @@ case $key in ...@@ -285,6 +286,18 @@ case $key in
NBARGS=$[$NBARGS+256] NBARGS=$[$NBARGS+256]
shift shift
;; ;;
-v9)
VM_NAME=ci-l2-sim
VM_MEMORY=8192
VM_CPU=8
ARCHIVES_LOC=l2_sim
LOG_PATTERN=.Rel14.txt
NB_PATTERN_FILES=4
BUILD_OPTIONS="--eNB -t ETHERNET"
RUN_OPTIONS="complex"
NBARGS=$[$NBARGS+256]
shift
;;
-v10) -v10)
VM_NAME=ci-flexran-rtc VM_NAME=ci-flexran-rtc
ARCHIVES_LOC=flexran ARCHIVES_LOC=flexran
...@@ -350,6 +363,17 @@ case $key in ...@@ -350,6 +363,17 @@ case $key in
BUILD_OPTIONS="--UE -t ETHERNET --noS1" BUILD_OPTIONS="--UE -t ETHERNET --noS1"
NBARGS=$[$NBARGS+256] NBARGS=$[$NBARGS+256]
;; ;;
l2-sim)
VM_NAME=ci-l2-sim
VM_MEMORY=8192
VM_CPU=8
ARCHIVES_LOC=l2_sim
LOG_PATTERN=.Rel14.txt
NB_PATTERN_FILES=4
BUILD_OPTIONS="--eNB -t ETHERNET"
RUN_OPTIONS="complex"
NBARGS=$[$NBARGS+256]
;;
flexran-rtc) flexran-rtc)
VM_NAME=ci-flexran-rtc VM_NAME=ci-flexran-rtc
ARCHIVES_LOC=flexran ARCHIVES_LOC=flexran
......
...@@ -504,6 +504,130 @@ then ...@@ -504,6 +504,130 @@ then
done done
fi fi
ARCHIVES_LOC=archives/l2_sim/test
if [ -d $ARCHIVES_LOC ]
then
echo " <h3>L2-NFAPI Simulator Check</h3>" >> ./test_simulator_results.html
if [ -f $ARCHIVES_LOC/test_final_status.log ]
then
if [ `grep -c TEST_OK $ARCHIVES_LOC/test_final_status.log` -eq 1 ]
then
echo " <div class=\"alert alert-success\">" >> ./test_simulator_results.html
echo " <strong>TEST was SUCCESSFUL <span class=\"glyphicon glyphicon-ok-circle\"></span></strong>" >> ./test_simulator_results.html
echo " </div>" >> ./test_simulator_results.html
else
echo " <div class=\"alert alert-danger\">" >> ./test_simulator_results.html
echo " <strong>TEST was a FAILURE! <span class=\"glyphicon glyphicon-ban-circle\"></span></strong>" >> ./test_simulator_results.html
echo " </div>" >> ./test_simulator_results.html
fi
else
echo " <div class=\"alert alert-danger\">" >> ./test_simulator_results.html
echo " <strong>COULD NOT DETERMINE TEST FINAL STATUS! <span class=\"glyphicon glyphicon-ban-circle\"></span></strong>" >> ./test_simulator_results.html
echo " </div>" >> ./test_simulator_results.html
fi
echo " <button data-toggle=\"collapse\" data-target=\"#oai-l2-sim-test-details\">More details on L2-NFAPI Simulator test results</button>" >> ./test_simulator_results.html
echo " <div id=\"oai-l2-sim-test-details\" class=\"collapse\">" >> ./test_simulator_results.html
echo " <table border = \"1\">" >> ./test_simulator_results.html
echo " <tr bgcolor = \"#33CCFF\" >" >> ./test_simulator_results.html
echo " <th>Log File Name</th>" >> ./test_simulator_results.html
echo " <th>Command</th>" >> ./test_simulator_results.html
echo " <th>Status</th>" >> ./test_simulator_results.html
echo " <th>Statistics</th>" >> ./test_simulator_results.html
echo " </tr>" >> ./test_simulator_results.html
TRANS_MODES=("fdd")
BW_CASES=(05)
for TMODE in ${TRANS_MODES[@]}
do
for BW in ${BW_CASES[@]}
do
ENB_LOG=$ARCHIVES_LOC/${TMODE}_${BW}MHz_enb.log
UE_LOG=`echo $ENB_LOG | sed -e "s#enb#ue#"`
if [ -f $ENB_LOG ] && [ -f $UE_LOG ]
then
NAME_ENB=`echo $ENB_LOG | sed -e "s#$ARCHIVES_LOC/##"`
NAME_UE=`echo $UE_LOG | sed -e "s#$ARCHIVES_LOC/##"`
echo " <tr>" >> ./test_simulator_results.html
echo " <td>$NAME_ENB --- $NAME_UE</td>" >> ./test_simulator_results.html
echo " <td>N/A</td>" >> ./test_simulator_results.html
NB_ENB_GOT_SYNC=`egrep -c "got sync" $ENB_LOG`
NB_UE_GOT_SYNC=`egrep -c "got sync" $UE_LOG`
NB_ENB_SYNCED_WITH_UE=`egrep -c "Sending NFAPI_START_RESPONSE" $UE_LOG`
if [ $NB_ENB_GOT_SYNC -eq 1 ] && [ $NB_UE_GOT_SYNC -eq 3 ] && [ $NB_ENB_SYNCED_WITH_UE -eq 1 ]
then
echo " <td bgcolor = \"green\" >OK</td>" >> ./test_simulator_results.html
else
echo " <td bgcolor = \"red\" >KO</td>" >> ./test_simulator_results.html
fi
echo " <td><pre>" >> ./test_simulator_results.html
if [ $NB_ENB_GOT_SYNC -eq 1 ]
then
echo "<font color = \"blue\">- eNB --> got sync</font>" >> ./test_simulator_results.html
else
echo "<font color = \"red\"><b>- eNB NEVER got sync</b></font>" >> ./test_simulator_results.html
fi
if [ $NB_UE_GOT_SYNC -eq 3 ]
then
echo "<font color = \"blue\">- UE --> got sync</font>" >> ./test_simulator_results.html
else
echo "<font color = \"red\"><b>- UE NEVER got sync</b></font>" >> ./test_simulator_results.html
fi
if [ $NB_ENB_SYNCED_WITH_UE -eq 1 ]
then
echo "<font color = \"blue\">- UE attached to eNB</font>" >> ./test_simulator_results.html
else
echo "<font color = \"red\"><b>- UE NEVER attached to eNB</b></font>" >> ./test_simulator_results.html
fi
echo " </pre></td>" >> ./test_simulator_results.html
echo " </tr>" >> ./test_simulator_results.html
fi
PING_CASE=$ARCHIVES_LOC/${TMODE}_${BW}MHz_ping_epc.txt
if [ -f $PING_CASE ]
then
echo " <tr>" >> ./test_simulator_results.html
NAME=`echo $PING_CASE | sed -e "s#$ARCHIVES_LOC/##"`
echo " <td>$NAME</td>" >> ./test_simulator_results.html
CMD=`egrep "COMMAND IS" $PING_CASE | sed -e "s#COMMAND IS: ##"`
echo " <td>$CMD</td>" >> ./test_simulator_results.html
FILE_COMPLETE=`egrep -c "ping statistics" $PING_CASE`
if [ $FILE_COMPLETE -eq 0 ]
then
echo " <td bgcolor = \"red\" >KO</td>" >> ./test_simulator_results.html
echo " <td>N/A</td>" >> ./test_simulator_results.html
else
NB_TR_PACKETS=`egrep "packets transmitted" $PING_CASE | sed -e "s# packets transmitted.*##"`
NB_RC_PACKETS=`egrep "packets transmitted" $PING_CASE | sed -e "s#^.*packets transmitted, ##" -e "s# received,.*##"`
if [ $NB_TR_PACKETS -eq $NB_RC_PACKETS ]
then
echo " <td bgcolor = \"green\" >OK</td>" >> ./test_simulator_results.html
else
echo " <td bgcolor = \"red\" >KO</td>" >> ./test_simulator_results.html
fi
echo " <td>" >> ./test_simulator_results.html
echo " <pre>" >> ./test_simulator_results.html
STATS=`egrep "packets transmitted" $PING_CASE | sed -e "s#^.*received, ##" -e "s#, time.*##" -e "s# packet loss##"`
echo "Packet Loss : $STATS" >> ./test_simulator_results.html
RTTMIN=`egrep "rtt min" $PING_CASE | awk '{split($4,a,"/"); print a[1] " " $5}'`
echo "RTT Minimal : $RTTMIN" >> ./test_simulator_results.html
RTTAVG=`egrep "rtt min" $PING_CASE | awk '{split($4,a,"/"); print a[2] " " $5}'`
echo "RTT Average : $RTTAVG" >> ./test_simulator_results.html
RTTMAX=`egrep "rtt min" $PING_CASE | awk '{split($4,a,"/"); print a[3] " " $5}'`
echo "RTT Maximal : $RTTMAX" >> ./test_simulator_results.html
echo " </pre>" >> ./test_simulator_results.html
echo " </td>" >> ./test_simulator_results.html
fi
echo " </tr>" >> ./test_simulator_results.html
fi
done
done
echo " </table>" >> ./test_simulator_results.html
echo " </div>" >> ./test_simulator_results.html
fi
echo "</body>" >> ./test_simulator_results.html echo "</body>" >> ./test_simulator_results.html
echo "</html>" >> ./test_simulator_results.html echo "</html>" >> ./test_simulator_results.html
......
This diff is collapsed.
...@@ -26,9 +26,9 @@ ...@@ -26,9 +26,9 @@
<htmlTabIcon>tasks</htmlTabIcon> <htmlTabIcon>tasks</htmlTabIcon>
<TestCaseRequestedList> <TestCaseRequestedList>
040101 040101
030121 040301 040521 040623 040624 040625 040626 040627 040662 040661 040663 040664 040401 040201 030201 030121 040301 040521 040623 040624 040625 040662 040401 040201 030201
</TestCaseRequestedList> </TestCaseRequestedList>
<TestCaseExclusionList></TestCaseExclusionList> <TestCaseExclusionList>040626 040627 040661 040663 040664</TestCaseExclusionList>
<testCase id="030121"> <testCase id="030121">
<class>Initialize_eNB</class> <class>Initialize_eNB</class>
...@@ -110,16 +110,16 @@ ...@@ -110,16 +110,16 @@
<testCase id="040661"> <testCase id="040661">
<class>Iperf</class> <class>Iperf</class>
<desc>iperf (20MHz - UL/20Mbps/UDP)(30 sec)(balanced profile)</desc> <desc>iperf (20MHz - UL/12Mbps/UDP)(30 sec)(balanced profile)</desc>
<iperf_args>-u -b 20M -t 30 -i 1 -R</iperf_args> <iperf_args>-u -b 12M -t 30 -i 1 -R</iperf_args>
<iperf_packetloss_threshold>50</iperf_packetloss_threshold> <iperf_packetloss_threshold>50</iperf_packetloss_threshold>
<iperf_profile>balanced</iperf_profile> <iperf_profile>balanced</iperf_profile>
</testCase> </testCase>
<testCase id="040662"> <testCase id="040662">
<class>Iperf</class> <class>Iperf</class>
<desc>iperf (20MHz - UL/20Mbps/UDP)(30 sec)(single-ue profile)</desc> <desc>iperf (20MHz - UL/17Mbps/UDP)(30 sec)(single-ue profile)</desc>
<iperf_args>-u -b 20M -t 30 -i 1 -R</iperf_args> <iperf_args>-u -b 17M -t 30 -i 1 -R</iperf_args>
<iperf_packetloss_threshold>50</iperf_packetloss_threshold> <iperf_packetloss_threshold>50</iperf_packetloss_threshold>
<iperf_profile>single-ue</iperf_profile> <iperf_profile>single-ue</iperf_profile>
</testCase> </testCase>
......
...@@ -94,9 +94,9 @@ ...@@ -94,9 +94,9 @@
<testCase id="040652"> <testCase id="040652">
<class>Iperf</class> <class>Iperf</class>
<desc>iperf (10MHz - UL/20Mbps/UDP)(30 sec)(single-ue profile)</desc> <desc>iperf (10MHz - UL/5Mbps/UDP)(30 sec)(single-ue profile)</desc>
<iperf_args>-u -b 20M -t 30 -i 1 -R</iperf_args> <iperf_args>-u -b 5M -t 30 -i 1 -R</iperf_args>
<iperf_packetloss_threshold>50</iperf_packetloss_threshold> <iperf_packetloss_threshold>60</iperf_packetloss_threshold>
<iperf_profile>single-ue</iperf_profile> <iperf_profile>single-ue</iperf_profile>
</testCase> </testCase>
......
...@@ -86,16 +86,16 @@ ...@@ -86,16 +86,16 @@
<testCase id="040624"> <testCase id="040624">
<class>Iperf</class> <class>Iperf</class>
<desc>iperf (20MHz - DL/70Mbps/UDP)(30 sec)(single-ue profile)</desc> <desc>iperf (20MHz - DL/50Mbps/UDP)(30 sec)(single-ue profile)</desc>
<iperf_args>-u -b 70M -t 30 -i 1</iperf_args> <iperf_args>-u -b 50M -t 30 -i 1</iperf_args>
<iperf_packetloss_threshold>50</iperf_packetloss_threshold> <iperf_packetloss_threshold>50</iperf_packetloss_threshold>
<iperf_profile>single-ue</iperf_profile> <iperf_profile>single-ue</iperf_profile>
</testCase> </testCase>
<testCase id="040662"> <testCase id="040662">
<class>Iperf</class> <class>Iperf</class>
<desc>iperf (20MHz - UL/20Mbps/UDP)(30 sec)(single-ue profile)</desc> <desc>iperf (20MHz - UL/10Mbps/UDP)(30 sec)(single-ue profile)</desc>
<iperf_args>-u -b 20M -t 30 -i 1 -R</iperf_args> <iperf_args>-u -b 10M -t 30 -i 1 -R</iperf_args>
<iperf_packetloss_threshold>50</iperf_packetloss_threshold> <iperf_packetloss_threshold>50</iperf_packetloss_threshold>
<iperf_profile>single-ue</iperf_profile> <iperf_profile>single-ue</iperf_profile>
</testCase> </testCase>
......
...@@ -183,7 +183,6 @@ set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-rpath -Wl,${CMAKE_CU ...@@ -183,7 +183,6 @@ set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-rpath -Wl,${CMAKE_CU
######################### #########################
# set a flag for changes in the source code # set a flag for changes in the source code
# these changes are related to hardcoded path to include .h files # these changes are related to hardcoded path to include .h files
add_definitions(-DCMAKER)
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS} -g -DMALLOC_CHECK_=3") set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS} -g -DMALLOC_CHECK_=3")
set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS} -g -DMALLOC_CHECK_=3 -O2") set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS} -g -DMALLOC_CHECK_=3 -O2")
...@@ -2155,7 +2154,6 @@ add_executable(test_epc_generate_scenario ...@@ -2155,7 +2154,6 @@ add_executable(test_epc_generate_scenario
${OPENAIR2_DIR}/ENB_APP/enb_config.h ${OPENAIR2_DIR}/ENB_APP/enb_config.h
${OPENAIR2_DIR}/COMMON/commonDef.h ${OPENAIR2_DIR}/COMMON/commonDef.h
${OPENAIR2_DIR}/COMMON/messages_def.h ${OPENAIR2_DIR}/COMMON/messages_def.h
${OPENAIR2_DIR}/COMMON/messages_types.h
${OPENAIR3_DIR}/S1AP/s1ap_eNB_defs.h ${OPENAIR3_DIR}/S1AP/s1ap_eNB_defs.h
) )
target_link_libraries (test_epc_generate_scenario target_link_libraries (test_epc_generate_scenario
...@@ -2175,7 +2173,6 @@ add_executable(test_epc_play_scenario ...@@ -2175,7 +2173,6 @@ add_executable(test_epc_play_scenario
${OPENAIR3_DIR}/TEST/EPC_TEST/play_scenario.h ${OPENAIR3_DIR}/TEST/EPC_TEST/play_scenario.h
${OPENAIR2_DIR}/COMMON/commonDef.h ${OPENAIR2_DIR}/COMMON/commonDef.h
${OPENAIR2_DIR}/COMMON/messages_def.h ${OPENAIR2_DIR}/COMMON/messages_def.h
${OPENAIR2_DIR}/COMMON/messages_types.h
) )
target_include_directories(test_epc_play_scenario PUBLIC /usr/local/share/asn1c) target_include_directories(test_epc_play_scenario PUBLIC /usr/local/share/asn1c)
target_link_libraries (test_epc_play_scenario target_link_libraries (test_epc_play_scenario
......
...@@ -76,7 +76,6 @@ macro(add_boolean_option name val helpstr) ...@@ -76,7 +76,6 @@ macro(add_boolean_option name val helpstr)
endmacro(add_boolean_option) endmacro(add_boolean_option)
# compilation flags # compilation flags
# added CMAKER conditional compilation to not bother legacy building system
############################################# #############################################
if(NOT CMAKE_BUILD_TYPE) if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING "Choose the type of build, options are: None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel." FORCE) set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING "Choose the type of build, options are: None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel." FORCE)
...@@ -84,7 +83,7 @@ endif() ...@@ -84,7 +83,7 @@ endif()
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS Debug Release RelWithDebInfo MinSizeRel) 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 -DCMAKER") 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_DEBUG "${CMAKE_C_FLAGS_DEBUG} -ggdb -DMALLOC_CHECK_=3") 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") set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} -ggdb -DMALLOC_CHECK_=3 -O2")
......
...@@ -32,8 +32,8 @@ OS_DISTRO=$(grep "^ID=" /etc/os-release | sed "s/ID=//" | sed "s/\"//g") ...@@ -32,8 +32,8 @@ OS_DISTRO=$(grep "^ID=" /etc/os-release | sed "s/ID=//" | sed "s/\"//g")
OS_RELEASE=$(grep "^VERSION_ID=" /etc/os-release | sed "s/VERSION_ID=//" | sed "s/\"//g") OS_RELEASE=$(grep "^VERSION_ID=" /etc/os-release | sed "s/VERSION_ID=//" | sed "s/\"//g")
case "$OS_DISTRO" in case "$OS_DISTRO" in
fedora) OS_BASEDISTRO="fedora"; INSTALLER="dnf"; CMAKE="cmake" ;; fedora) OS_BASEDISTRO="fedora"; INSTALLER="dnf"; CMAKE="cmake" ;;
rhel) OS_BASEDISTRO="fedora"; INSTALLER="yum"; CMAKE="cmake3" ;; rhel) OS_BASEDISTRO="fedora"; INSTALLER="yum --skip-broken"; CMAKE="cmake3" ;;
centos) OS_BASEDISTRO="fedora"; INSTALLER="yum"; CMAKE="cmake3" ;; centos) OS_BASEDISTRO="fedora"; INSTALLER="yum --skip-broken"; CMAKE="cmake3" ;;
debian) OS_BASEDISTRO="debian"; INSTALLER="apt-get"; CMAKE="cmake" ;; debian) OS_BASEDISTRO="debian"; INSTALLER="apt-get"; CMAKE="cmake" ;;
ubuntu) OS_BASEDISTRO="debian"; INSTALLER="apt-get"; CMAKE="cmake" ;; ubuntu) OS_BASEDISTRO="debian"; INSTALLER="apt-get"; CMAKE="cmake" ;;
esac esac
......
# OAI configuration module # OAI configuration module
The configuration module provides an api that other oai components can use to get parameters at init time. It defines a parameter structure, used to describe parameters attributes (for example name and type). The same structure includes a pointer to the variable where the configuration module writes the parameter value, at run time, when calling config_get or config_getlist functions. For each parameter a function to check the value can be specified and pre-defined functions are provided for some common parameter validations (integer in a range or in a list, string in a list). The module also include a mechanism to check that no unknown options have been entered on the command line The configuration module provides an api that other oai components can use to get parameters at init time. It defines a parameter structure, used to describe parameters attributes (for example name and type). The same structure includes a pointer to the variable where the configuration module writes the parameter value, at run time, when calling config_get or config_getlist functions. For each parameter a function to check the value can be specified and pre-defined functions are provided for some common parameter validations (integer in a range or in a list, string in a list). The module also include an api to check that no unknown options have been entered on the command line and a a mechanism to display a help text for suppoted parameters.
## Documentation ## Documentation
......
```c ```c
configmodule_interface_t *load_configmodule(int argc, char **argv) configmodule_interface_t *load_configmodule(int argc, char **argv, uint32_t initflags)
``` ```
* Parses the command line options, looking for the –O argument * Parses the command line options, looking for the –O argument
* Loads the `libparams_<configsource>.so` (today `libparams_libconfig.so`) shared library * Loads the `libparams_<configsource>.so` (today `libparams_libconfig.so`) shared library
* Looks for `config_<config source>_init` symbol and calls it , passing it an array of string corresponding to the « : » separated strings used in the –O option * Looks for `config_<config source>_init` symbol and calls it , passing it an array of string corresponding to the « : » separated strings used in the –O option
* Looks for `config_<config source>_get`, `config_<config source>_getlist` and `config_<config source>_end` symbols which are the three functions a configuration library should implement. Get and getlist are mandatory, end is optional. * Looks for `config_<config source>_get`, `config_<config source>_getlist` and `config_<config source>_end` symbols which are the three functions a configuration library should implement. Get and getlist are mandatory, end is optional.
* Stores all the necessary information in a `configmodule_interface_t structure`, which is of no use for caller as long as we only use one configuration source. * Stores all the necessary information in a `configmodule_interface_t structure`, which is of no use for caller as long as we only use one configuration source.
* if the bit CONFIG_ENABLECMDLINEONLY is set in `initflags` then the module allows parameters to be set only via the command line. This is used for the oai UE.
```c ```c
void End_configmodule(void) void End_configmodule(void)
......
...@@ -27,6 +27,63 @@ $ ./lte-softmodem -O libconfig:<config>:dbgl1 ...@@ -27,6 +27,63 @@ $ ./lte-softmodem -O libconfig:<config>:dbgl1
```bash ```bash
$ ./lte-uesoftmodem -O cmdlineonly:dbgl1 $ ./lte-uesoftmodem -O cmdlineonly:dbgl1
``` ```
To get help on supported parameters you can use specific options:
* ---help: print help for command line only parameters and for parameters not defined in a specific section
* ---help_< prefix > : print help for parameters defined under the section < prefix >
```
./lte-softmodem -O libconfig:/usr/local/oai/conf/enb.nbiot.band7.tm1.50PRB.usrpb210.conf --help
[CONFIG] get parameters from libconfig /usr/local/oai/conf/enb.nbiot.band7.tm1.50PRB.usrpb210.conf , debug flags: 0x00000000
.............................................
[LIBCONFIG] (root): 19/19 parameters successfully set, (16 to default value)
-----Help for section (root section) : 019 entries------
--rf-config-file: Configuration file for front-end (e.g. LMS7002M)
--ulsch-max-errors: set the eNodeB max ULSCH erros
--phy-test: test UE phy layer, mac disabled
--usim-test: use XOR autentication algo in case of test usim mode
--emulate-rf: Emulated RF enabled(disable by defult)
--clock: tells hardware to use a clock reference (0:internal, 1:external, 2:gpsdo)
--wait-for-sync: Help string not specified
--single-thread-enable: Disables single-thread mode in lte-softmodem
-C: Set the downlink frequency for all component carriers
-a: Channel id offset
-d: Enable soft scope and L1 and L2 stats (Xforms)
-q: Enable processing timing measurement of lte softmodem on per subframe basis
-S: Skip the missed slots/subframes
--numerology: adding numerology for 5G
--parallel-config: three config for level of parallelism 'PARALLEL_SINGLE_THREAD', 'PARALLEL_RU_L1_SPLIT', or 'PARALLEL_RU_L1_TRX_SPLIT'
--worker-config: two option for worker 'WORKER_DISABLE' or 'WORKER_ENABLE'
--nbiot-disable: disable nb-iot, even if defined in config
--noS1: Disable s1 interface
--nokrnmod: (noS1 only): Use tun instead of namesh module
--------------------------------------------------------------------
[LIBCONFIG] (root): 4/4 parameters successfully set, (4 to default value)
-----Help for section (root section) : 004 entries------
-R: Enable online log
-g: Set the global log level, valide options: (4:trace, 3:debug, 2:info, 1:warn, (0:error))
--telnetsrv: Start embedded telnet server
--msc: Enable the MSC tracing utility
--------------------------------------------------------------------
[LIBCONFIG] loader: 2/2 parameters successfully set, (2 to default value)
[LIBCONFIG] loader.telnetsrv: 2/2 parameters successfully set, (1 to default value)
[LOADER] library libtelnetsrv.so is not loaded: libtelnetsrv.so: cannot open shared object file: No such file or directory
Getting ENBSParams
[LIBCONFIG] (root): 3/3 parameters successfully set, (1 to default value)
-----Help for section (root section) : 003 entries------
--Asn1_verbosity: Help string not specified
--Active_eNBs: Help string not specified
--noS1: Help string not specified
--------------------------------------------------------------------
/usr/local/oai/issue390_configmodule_cmdlinebug/openairinterface5g/common/config/config_cmdline.c:224 config_process_cmdline() Exiting OAI softmodem: [CONFIG] Exiting after displaying help
```
For the lte-softmodem (the eNodeB) The config source parameter defaults to libconfig, preserving the initial -O option format. In this case you cannot specify the debug level. For the lte-softmodem (the eNodeB) The config source parameter defaults to libconfig, preserving the initial -O option format. In this case you cannot specify the debug level.
```bash ```bash
......
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
#include <errno.h> #include <errno.h>
#include <platform_types.h> #include <platform_types.h>
#include "config_userapi.h" #include "config_userapi.h"
#include "../utils/LOG/log.h"
int parse_stringlist(paramdef_t *cfgoptions, char *val) { int parse_stringlist(paramdef_t *cfgoptions, char *val) {
char *atoken; char *atoken;
...@@ -74,14 +74,15 @@ int processoption(paramdef_t *cfgoptions, char *value) { ...@@ -74,14 +74,15 @@ int processoption(paramdef_t *cfgoptions, char *value) {
if ( value == NULL) { if ( value == NULL) {
if( (cfgoptions->paramflags &PARAMFLAG_BOOL) == 0 ) { /* not a boolean, argument required */ if( (cfgoptions->paramflags &PARAMFLAG_BOOL) == 0 ) { /* not a boolean, argument required */
fprintf(stderr,"[CONFIG] command line, option %s requires an argument\n",cfgoptions->optname); CONFIG_PRINTF_ERROR("[CONFIG] command line, option %s requires an argument\n",cfgoptions->optname);
return 0;
} else { /* boolean value option without argument, set value to true*/ } else { /* boolean value option without argument, set value to true*/
tmpval = defbool; tmpval = defbool;
} }
} }
switch(cfgoptions->type) { switch(cfgoptions->type) {
char *charptr;
case TYPE_STRING: case TYPE_STRING:
if (cfgoptions->numelt == 0 ) { if (cfgoptions->numelt == 0 ) {
config_check_valptr(cfgoptions, cfgoptions->strptr, strlen(tmpval)+1); config_check_valptr(cfgoptions, cfgoptions->strptr, strlen(tmpval)+1);
...@@ -105,14 +106,24 @@ int processoption(paramdef_t *cfgoptions, char *value) { ...@@ -105,14 +106,24 @@ int processoption(paramdef_t *cfgoptions, char *value) {
case TYPE_UINT8: case TYPE_UINT8:
case TYPE_INT8: case TYPE_INT8:
config_check_valptr(cfgoptions, (char **)&(cfgoptions->iptr),sizeof(int32_t)); config_check_valptr(cfgoptions, (char **)&(cfgoptions->iptr),sizeof(int32_t));
config_assign_int(cfgoptions,cfgoptions->optname,(int32_t)strtol(tmpval,NULL,0)); config_assign_int(cfgoptions,cfgoptions->optname,(int32_t)strtol(tmpval,&charptr,0));
if( *charptr != 0) {
CONFIG_PRINTF_ERROR("[CONFIG] command line, option %s requires an integer argument\n",cfgoptions->optname);
}
optisset=1; optisset=1;
break; break;
case TYPE_UINT64: case TYPE_UINT64:
case TYPE_INT64: case TYPE_INT64:
config_check_valptr(cfgoptions, (char **)&(cfgoptions->i64ptr),sizeof(uint64_t)); config_check_valptr(cfgoptions, (char **)&(cfgoptions->i64ptr),sizeof(uint64_t));
*(cfgoptions->i64ptr)=strtoll(tmpval,NULL,0); *(cfgoptions->i64ptr)=strtoll(tmpval,&charptr,0);
if( *charptr != 0) {
CONFIG_PRINTF_ERROR("[CONFIG] command line, option %s requires an integer argument\n",cfgoptions->optname);
}
printf_cmdl("[CONFIG] %s set to %lli from command line\n", cfgoptions->optname, (long long)*(cfgoptions->i64ptr)); printf_cmdl("[CONFIG] %s set to %lli from command line\n", cfgoptions->optname, (long long)*(cfgoptions->i64ptr));
optisset=1; optisset=1;
break; break;
...@@ -123,7 +134,12 @@ int processoption(paramdef_t *cfgoptions, char *value) { ...@@ -123,7 +134,12 @@ int processoption(paramdef_t *cfgoptions, char *value) {
case TYPE_DOUBLE: case TYPE_DOUBLE:
config_check_valptr(cfgoptions, (char **)&(cfgoptions->dblptr),sizeof(double)); config_check_valptr(cfgoptions, (char **)&(cfgoptions->dblptr),sizeof(double));
*(cfgoptions->dblptr) = strtof(tmpval,NULL); *(cfgoptions->dblptr) = strtof(tmpval,&charptr);
if( *charptr != 0) {
CONFIG_PRINTF_ERROR("[CONFIG] command line, option %s requires a double argument\n",cfgoptions->optname);
}
printf_cmdl("[CONFIG] %s set to %lf from command line\n", cfgoptions->optname, *(cfgoptions->dblptr)); printf_cmdl("[CONFIG] %s set to %lf from command line\n", cfgoptions->optname, *(cfgoptions->dblptr));
optisset=1; optisset=1;
break; break;
...@@ -132,7 +148,7 @@ int processoption(paramdef_t *cfgoptions, char *value) { ...@@ -132,7 +148,7 @@ int processoption(paramdef_t *cfgoptions, char *value) {
break; break;
default: default:
fprintf(stderr,"[CONFIG] command line, %s type %i not supported\n",cfgoptions->optname, cfgoptions->type); CONFIG_PRINTF_ERROR("[CONFIG] command line, %s type %i not supported\n",cfgoptions->optname, cfgoptions->type);
break; break;
} /* switch on param type */ } /* switch on param type */
...@@ -143,16 +159,20 @@ int processoption(paramdef_t *cfgoptions, char *value) { ...@@ -143,16 +159,20 @@ int processoption(paramdef_t *cfgoptions, char *value) {
return optisset; return optisset;
} }
int config_check_cmdlineopt(char *prefix) { /*--------------------------------------------------------------------*/
/* check unknown options in the command line
*/
int config_check_unknown_cmdlineopt(char *prefix) {
int unknowndetected=0; int unknowndetected=0;
char testprefix[CONFIG_MAXOPTLENGTH]=""; char testprefix[CONFIG_MAXOPTLENGTH];
int finalcheck = 0; int finalcheck = 0;
memset(testprefix,0,sizeof(testprefix));
if (prefix != NULL) { if (prefix != NULL) {
if (strcmp(prefix,CONFIG_CHECKALLSECTIONS) == 0) if (strcmp(prefix,CONFIG_CHECKALLSECTIONS) == 0)
finalcheck = 1; finalcheck = 1;
else if (strlen(prefix) > 0) { else if (strlen(prefix) > 0) {
sprintf(testprefix,"--%s.",prefix); sprintf(testprefix,"--%.*s.",CONFIG_MAXOPTLENGTH-1,prefix);
} }
} }
...@@ -161,6 +181,8 @@ int config_check_cmdlineopt(char *prefix) { ...@@ -161,6 +181,8 @@ int config_check_cmdlineopt(char *prefix) {
if ( !finalcheck && testprefix[0]==0 && index(config_get_if()->argv[i],'.') != NULL) continue; if ( !finalcheck && testprefix[0]==0 && index(config_get_if()->argv[i],'.') != NULL) continue;
if ( !finalcheck && isdigit(config_get_if()->argv[i][0])) continue;
if ( !finalcheck && config_get_if()->argv[i][0] == '-' && isdigit(config_get_if()->argv[i][1])) continue; if ( !finalcheck && config_get_if()->argv[i][0] == '-' && isdigit(config_get_if()->argv[i][1])) continue;
if ( (config_get_if()->argv_info[i] & CONFIG_CMDLINEOPT_PROCESSED) == 0 ) { if ( (config_get_if()->argv_info[i] & CONFIG_CMDLINEOPT_PROCESSED) == 0 ) {
...@@ -170,10 +192,13 @@ int config_check_cmdlineopt(char *prefix) { ...@@ -170,10 +192,13 @@ int config_check_cmdlineopt(char *prefix) {
} }
} }
printf_cmdl("[CONFIG] %i unknown option(s) in command line starting with %s (section %s)\n", if (unknowndetected > 0) {
unknowndetected,testprefix,((prefix==NULL)?"":prefix)); CONFIG_PRINTF_ERROR("[CONFIG] %i unknown option(s) in command line starting with %s (section %s)\n",
unknowndetected,testprefix,((prefix==NULL)?"":prefix));
}
return unknowndetected; return unknowndetected;
} /* parse_cmdline*/ } /* config_check_unknown_cmdlineopt */
int config_process_cmdline(paramdef_t *cfgoptions,int numoptions, char *prefix) { int config_process_cmdline(paramdef_t *cfgoptions,int numoptions, char *prefix) {
int c = config_get_if()->argc; int c = config_get_if()->argc;
...@@ -194,7 +219,7 @@ int config_process_cmdline(paramdef_t *cfgoptions,int numoptions, char *prefix) ...@@ -194,7 +219,7 @@ int config_process_cmdline(paramdef_t *cfgoptions,int numoptions, char *prefix)
if (pp == NULL || strcasecmp(pp,config_get_if()->argv[i] ) == 0 ) { if (pp == NULL || strcasecmp(pp,config_get_if()->argv[i] ) == 0 ) {
if( prefix == NULL) { if( prefix == NULL) {
config_printhelp(cfgoptions,numoptions); config_printhelp(cfgoptions,numoptions,"(root section)");
if ( ! ( CONFIG_ISFLAGSET(CONFIG_NOEXITONHELP))) if ( ! ( CONFIG_ISFLAGSET(CONFIG_NOEXITONHELP)))
exit_fun("[CONFIG] Exiting after displaying help\n"); exit_fun("[CONFIG] Exiting after displaying help\n");
...@@ -203,8 +228,7 @@ int config_process_cmdline(paramdef_t *cfgoptions,int numoptions, char *prefix) ...@@ -203,8 +228,7 @@ int config_process_cmdline(paramdef_t *cfgoptions,int numoptions, char *prefix)
pp=strtok_r(NULL, " ",&tokctx); pp=strtok_r(NULL, " ",&tokctx);
if ( prefix != NULL && pp != NULL && strncasecmp(prefix,pp,strlen(pp)) == 0 ) { if ( prefix != NULL && pp != NULL && strncasecmp(prefix,pp,strlen(pp)) == 0 ) {
printf ("Help for %s section:\n",prefix); config_printhelp(cfgoptions,numoptions,prefix);
config_printhelp(cfgoptions,numoptions);
if ( ! (CONFIG_ISFLAGSET(CONFIG_NOEXITONHELP))) { if ( ! (CONFIG_ISFLAGSET(CONFIG_NOEXITONHELP))) {
fprintf(stderr,"[CONFIG] %s %i section %s:", __FILE__, __LINE__, prefix); fprintf(stderr,"[CONFIG] %s %i section %s:", __FILE__, __LINE__, prefix);
...@@ -267,16 +291,5 @@ int config_process_cmdline(paramdef_t *cfgoptions,int numoptions, char *prefix) ...@@ -267,16 +291,5 @@ int config_process_cmdline(paramdef_t *cfgoptions,int numoptions, char *prefix)
} /* fin du while */ } /* fin du while */
printf_cmdl("[CONFIG] %s %i options set from command line\n",((prefix == NULL) ? "(root)":prefix),j); printf_cmdl("[CONFIG] %s %i options set from command line\n",((prefix == NULL) ? "(root)":prefix),j);
if ( !(CONFIG_ISFLAGSET( CONFIG_NOCHECKUNKOPT )) ) {
i=config_check_cmdlineopt(prefix);
if (i > 0) {
fprintf(stderr,"[CONFIG] %i unknown options for section %s detected in command line\n",
i,((prefix==NULL)?"\"root section\"":prefix));
exit_fun(" Exiting after detecting errors in command line \n");
}
}
return j; return j;
} /* parse_cmdline*/ } /* parse_cmdline*/
...@@ -36,12 +36,15 @@ ...@@ -36,12 +36,15 @@
#include <unistd.h> #include <unistd.h>
#include <errno.h> #include <errno.h>
#include <dlfcn.h> #include <dlfcn.h>
#include <platform_types.h>
#define CONFIG_LOADCONFIG_MAIN #define CONFIG_LOADCONFIG_MAIN
#include "config_load_configmodule.h" #include "config_load_configmodule.h"
#include "config_userapi.h" #include "config_userapi.h"
#include "../utils/LOG/log.h"
#define CONFIG_SHAREDLIBFORMAT "libparams_%s.so" #define CONFIG_SHAREDLIBFORMAT "libparams_%s.so"
int load_config_sharedlib(configmodule_interface_t *cfgptr) { int load_config_sharedlib(configmodule_interface_t *cfgptr) {
void *lib_handle; void *lib_handle;
char fname[128]; char fname[128];
...@@ -198,7 +201,7 @@ configmodule_interface_t *load_configmodule(int argc, char **argv, uint32_t init ...@@ -198,7 +201,7 @@ configmodule_interface_t *load_configmodule(int argc, char **argv, uint32_t init
} }
if ( strstr(argv[i], "help_config") != NULL ) { if ( strstr(argv[i], "help_config") != NULL ) {
config_printhelp(Config_Params,CONFIG_PARAMLENGTH(Config_Params)); config_printhelp(Config_Params,CONFIG_PARAMLENGTH(Config_Params),CONFIG_SECTIONNAME);
exit(0); exit(0);
} }
...@@ -304,7 +307,7 @@ configmodule_interface_t *load_configmodule(int argc, char **argv, uint32_t init ...@@ -304,7 +307,7 @@ configmodule_interface_t *load_configmodule(int argc, char **argv, uint32_t init
if (cfgmode != NULL) free(cfgmode); if (cfgmode != NULL) free(cfgmode);
if (CONFIG_ISFLAGSET(CONFIG_ABORT)) { if (CONFIG_ISFLAGSET(CONFIG_ABORT)) {
config_printhelp(Config_Params,CONFIG_PARAMLENGTH(Config_Params)); config_printhelp(Config_Params,CONFIG_PARAMLENGTH(Config_Params),CONFIG_SECTIONNAME );
// exit(-1); // exit(-1);
} }
...@@ -342,7 +345,7 @@ void free_configmodule(void) { ...@@ -342,7 +345,7 @@ void free_configmodule(void) {
if( cfgptr->cfgmode != NULL) free(cfgptr->cfgmode); if( cfgptr->cfgmode != NULL) free(cfgptr->cfgmode);
printf ("[CONFIG] free %u config parameter pointers\n",cfgptr->num_cfgP); printf ("[CONFIG] free %i config parameter pointers\n",cfgptr->num_cfgP);
for (int i=0; i<cfgptr->num_cfgP; i++) { for (int i=0; i<cfgptr->num_cfgP; i++) {
if ( cfgptr->cfgP[i] != NULL) free(cfgptr->cfgP[i]); if ( cfgptr->cfgP[i] != NULL) free(cfgptr->cfgP[i]);
......
...@@ -51,7 +51,6 @@ ...@@ -51,7 +51,6 @@
#define CONFIG_PRINTPARAMS 1 // print parameters values while processing #define CONFIG_PRINTPARAMS 1 // print parameters values while processing
#define CONFIG_DEBUGPTR (1<<1) // print memory allocation/free debug messages #define CONFIG_DEBUGPTR (1<<1) // print memory allocation/free debug messages
#define CONFIG_DEBUGCMDLINE (1<<2) // print command line processing messages #define CONFIG_DEBUGCMDLINE (1<<2) // print command line processing messages
#define CONFIG_NOCHECKUNKOPT (1<<3) // disable check unprocessed (so invalid) command line options
#define CONFIG_NOABORTONCHKF (1<<4) // disable abort execution when parameter checking function fails #define CONFIG_NOABORTONCHKF (1<<4) // disable abort execution when parameter checking function fails
#define CONFIG_NOEXITONHELP (1<<19) // do not exit after printing help #define CONFIG_NOEXITONHELP (1<<19) // do not exit after printing help
#define CONFIG_HELP (1<<20) // print help message #define CONFIG_HELP (1<<20) // print help message
...@@ -109,5 +108,7 @@ extern configmodule_interface_t *cfgptr; ...@@ -109,5 +108,7 @@ extern configmodule_interface_t *cfgptr;
#define CONFIG_ENABLECMDLINEONLY (1<<1) #define CONFIG_ENABLECMDLINEONLY (1<<1)
extern configmodule_interface_t *load_configmodule(int argc, char **argv, uint32_t initflags); extern configmodule_interface_t *load_configmodule(int argc, char **argv, uint32_t initflags);
extern void end_configmodule(void); extern void end_configmodule(void);
#define CONFIG_PRINTF_ERROR(f, x... ) if (isLogInitDone ()) { LOG_E(ENB_APP,f,x);} else {printf(f,x);}; if ( !CONFIG_ISFLAGSET(CONFIG_NOABORTONCHKF) ) exit_fun("exit because configuration failed\n");
#endif /* INCLUDE_CONFIG_LOADCONFIGMODULE_H */ #endif /* INCLUDE_CONFIG_LOADCONFIGMODULE_H */
...@@ -39,15 +39,13 @@ ...@@ -39,15 +39,13 @@
#include <errno.h> #include <errno.h>
#include <dlfcn.h> #include <dlfcn.h>
#include <arpa/inet.h> #include <arpa/inet.h>
#include <platform_types.h> #include <platform_types.h>
#include "config_userapi.h" #include "config_userapi.h"
#include "../utils/LOG/log.h"
configmodule_interface_t *config_get_if(void) { configmodule_interface_t *config_get_if(void) {
if (cfgptr == NULL) { if (cfgptr == NULL) {
fprintf(stderr,"[CONFIG] %s %d config module not initialized\n",__FILE__, __LINE__); CONFIG_PRINTF_ERROR("[CONFIG] %s %d config module not initialized\n",__FILE__,__LINE__);
exit(-1);
} }
return cfgptr; return cfgptr;
...@@ -66,9 +64,8 @@ char *config_check_valptr(paramdef_t *cfgoptions, char **ptr, int length) { ...@@ -66,9 +64,8 @@ char *config_check_valptr(paramdef_t *cfgoptions, char **ptr, int length) {
config_get_if()->numptrs++; config_get_if()->numptrs++;
} }
} else { } else {
fprintf(stderr, "[CONFIG] %s %d option %s, cannot allocate pointer: %s \n", CONFIG_PRINTF_ERROR("[CONFIG] %s %d option %s, cannot allocate pointer: %s \n",
__FILE__, __LINE__, cfgoptions->optname, strerror(errno)); __FILE__, __LINE__, cfgoptions->optname, strerror(errno));
exit(-1);
} }
} }
...@@ -78,9 +75,8 @@ char *config_check_valptr(paramdef_t *cfgoptions, char **ptr, int length) { ...@@ -78,9 +75,8 @@ char *config_check_valptr(paramdef_t *cfgoptions, char **ptr, int length) {
if (*ptr != NULL) { if (*ptr != NULL) {
return *ptr; return *ptr;
} else { } else {
fprintf(stderr,"[CONFIG] %s %d option %s, definition error: value pointer is NULL, declared as %i bytes allocated\n", CONFIG_PRINTF_ERROR("[CONFIG] %s %d option %s, definition error: value pointer is NULL, declared as %i bytes allocated\n",
__FILE__, __LINE__,cfgoptions->optname, cfgoptions->numelt); __FILE__, __LINE__,cfgoptions->optname, cfgoptions->numelt);
exit(-1);
} }
} }
...@@ -95,8 +91,7 @@ char *config_check_valptr(paramdef_t *cfgoptions, char **ptr, int length) { ...@@ -95,8 +91,7 @@ char *config_check_valptr(paramdef_t *cfgoptions, char **ptr, int length) {
config_get_if()->numptrs++; config_get_if()->numptrs++;
} }
} else { } else {
fprintf (stderr,"[CONFIG] %s %d malloc error\n",__FILE__, __LINE__); CONFIG_PRINTF_ERROR("[CONFIG] %s %d malloc error\n",__FILE__, __LINE__);
exit(-1);
} }
} }
...@@ -157,8 +152,7 @@ void config_assign_processedint(paramdef_t *cfgoption, int val) { ...@@ -157,8 +152,7 @@ void config_assign_processedint(paramdef_t *cfgoption, int val) {
if ( cfgoption->processedvalue != NULL) { if ( cfgoption->processedvalue != NULL) {
*(cfgoption->processedvalue) = val; *(cfgoption->processedvalue) = val;
} else { } else {
fprintf (stderr,"[CONFIG] %s %d malloc error\n",__FILE__, __LINE__); CONFIG_PRINTF_ERROR("[CONFIG] %s %d malloc error\n",__FILE__, __LINE__);
exit(-1);
} }
} }
...@@ -177,15 +171,17 @@ int config_get_processedint(paramdef_t *cfgoption) { ...@@ -177,15 +171,17 @@ int config_get_processedint(paramdef_t *cfgoption) {
return ret; return ret;
} }
void config_printhelp(paramdef_t *params,int numparams) { void config_printhelp(paramdef_t *params,int numparams, char *prefix) {
printf("\n-----Help for section %-26s: %03i entries------\n",(prefix==NULL)?"(root section)":prefix ,numparams);
for (int i=0 ; i<numparams ; i++) { for (int i=0 ; i<numparams ; i++) {
if ( params[i].helpstr != NULL) { printf(" %s%s: %s",
printf("%s%s: %s", (strlen(params[i].optname) <= 1) ? "-" : "--",
(strlen(params[i].optname) <= 1) ? "-" : "--", params[i].optname,
params[i].optname, (params[i].helpstr != NULL)?params[i].helpstr:"Help string not specified\n");
params[i].helpstr); } /* for on params entries */
}
} printf("--------------------------------------------------------------------\n\n");
} }
int config_execcheck(paramdef_t *params,int numparams, char *prefix) { int config_execcheck(paramdef_t *params,int numparams, char *prefix) {
...@@ -202,11 +198,7 @@ int config_execcheck(paramdef_t *params,int numparams, char *prefix) { ...@@ -202,11 +198,7 @@ int config_execcheck(paramdef_t *params,int numparams, char *prefix) {
} }
if (st != 0) { if (st != 0) {
fprintf(stderr,"[CONFIG] config_execcheck: section %s %i parameters with wrong value\n", prefix, -st); CONFIG_PRINTF_ERROR("[CONFIG] config_execcheck: section %s %i parameters with wrong value\n", prefix, -st);
if ( CONFIG_ISFLAGSET(CONFIG_NOABORTONCHKF) == 0) {
exit_fun("exit because configuration failed\n");
}
} }
return st; return st;
...@@ -263,6 +255,7 @@ int config_getlist(paramlist_def_t *ParamList, paramdef_t *params, int numparams ...@@ -263,6 +255,7 @@ int config_getlist(paramlist_def_t *ParamList, paramdef_t *params, int numparams
for (int i = 0; i < ParamList->numelt; ++i) { for (int i = 0; i < ParamList->numelt; ++i) {
// TODO config_process_cmdline? // TODO config_process_cmdline?
sprintf(cfgpath, "%s.[%i]", newprefix, i); sprintf(cfgpath, "%s.[%i]", newprefix, i);
config_process_cmdline(ParamList->paramarray[i],numparams,cfgpath);
config_execcheck(ParamList->paramarray[i], numparams, cfgpath); config_execcheck(ParamList->paramarray[i], numparams, cfgpath);
} }
...@@ -370,6 +363,12 @@ int config_checkstr_assign_integer(paramdef_t *param) { ...@@ -370,6 +363,12 @@ int config_checkstr_assign_integer(paramdef_t *param) {
return -1; return -1;
} }
void config_set_checkfunctions(paramdef_t *params, checkedparam_t *checkfunctions, int numparams) {
for (int i=0; i< numparams ; i++ ) {
params[i].chkPptr = &(checkfunctions[i]);
}
}
int config_setdefault_string(paramdef_t *cfgoptions, char *prefix) { int config_setdefault_string(paramdef_t *cfgoptions, char *prefix) {
int status = 0; int status = 0;
......
...@@ -49,7 +49,7 @@ extern "C" ...@@ -49,7 +49,7 @@ extern "C"
/* utility functions, to be used by configuration module and/or configuration libraries */ /* utility functions, to be used by configuration module and/or configuration libraries */
extern configmodule_interface_t *config_get_if(void); extern configmodule_interface_t *config_get_if(void);
extern char *config_check_valptr(paramdef_t *cfgoptions, char **ptr, int length) ; extern char *config_check_valptr(paramdef_t *cfgoptions, char **ptr, int length) ;
extern void config_printhelp(paramdef_t *,int numparams); extern void config_printhelp(paramdef_t *,int numparams, char *prefix);
extern int config_process_cmdline(paramdef_t *params,int numparams, char *prefix); extern int config_process_cmdline(paramdef_t *params,int numparams, char *prefix);
extern void config_assign_processedint(paramdef_t *cfgoption, int val); extern void config_assign_processedint(paramdef_t *cfgoption, int val);
extern void config_assign_int(paramdef_t *cfgoptions, char *fullname, int val); extern void config_assign_int(paramdef_t *cfgoptions, char *fullname, int val);
...@@ -57,10 +57,13 @@ extern int config_assign_ipv4addr(paramdef_t *cfgoptions, char *ipv4addr); ...@@ -57,10 +57,13 @@ extern int config_assign_ipv4addr(paramdef_t *cfgoptions, char *ipv4addr);
/* apis to get/check parameters, to be used by oai modules, at configuration time */ /* apis to get/check parameters, to be used by oai modules, at configuration time */
#define CONFIG_CHECKALLSECTIONS "ALLSECTIONS" #define CONFIG_CHECKALLSECTIONS "ALLSECTIONS"
extern int config_check_cmdlineopt(char *prefix); extern int config_check_unknown_cmdlineopt(char *prefix);
extern int config_get(paramdef_t *params,int numparams, char *prefix); extern int config_get(paramdef_t *params,int numparams, char *prefix);
extern int config_getlist(paramlist_def_t *ParamList, paramdef_t *params, int numparams, char *prefix); extern int config_getlist(paramlist_def_t *ParamList, paramdef_t *params, int numparams, char *prefix);
/* apis to set some of the paramdef_t fields before using the get/getlist api's */
extern void config_set_checkfunctions(paramdef_t *params, checkedparam_t *checkfunctions, int numparams);
/* apis to retrieve parameters info after calling get or getlist functions */ /* apis to retrieve parameters info after calling get or getlist functions */
extern int config_isparamset(paramdef_t *params,int paramidx); extern int config_isparamset(paramdef_t *params,int paramidx);
extern int config_get_processedint(paramdef_t *cfgoption); extern int config_get_processedint(paramdef_t *cfgoption);
......
This diff is collapsed.
...@@ -219,7 +219,6 @@ void log_getconfig(log_t *g_log) { ...@@ -219,7 +219,6 @@ void log_getconfig(log_t *g_log) {
paramdef_t logparams_logfile[MAX_LOG_PREDEF_COMPONENTS]; paramdef_t logparams_logfile[MAX_LOG_PREDEF_COMPONENTS];
paramdef_t logparams_debug[sizeof(log_maskmap)/sizeof(mapping)]; paramdef_t logparams_debug[sizeof(log_maskmap)/sizeof(mapping)];
paramdef_t logparams_dump[sizeof(log_maskmap)/sizeof(mapping)]; paramdef_t logparams_dump[sizeof(log_maskmap)/sizeof(mapping)];
CONFIG_SETRTFLAG(CONFIG_NOCHECKUNKOPT);
int ret = config_get( logparams_defaults,sizeof(logparams_defaults)/sizeof(paramdef_t),CONFIG_STRING_LOG_PREFIX); int ret = config_get( logparams_defaults,sizeof(logparams_defaults)/sizeof(paramdef_t),CONFIG_STRING_LOG_PREFIX);
if (ret <0) { if (ret <0) {
...@@ -305,8 +304,8 @@ void log_getconfig(log_t *g_log) { ...@@ -305,8 +304,8 @@ void log_getconfig(log_t *g_log) {
} }
config_get( logparams_debug,(sizeof(log_maskmap)/sizeof(mapping)) - 1 ,CONFIG_STRING_LOG_PREFIX); config_get( logparams_debug,(sizeof(log_maskmap)/sizeof(mapping)) - 1 ,CONFIG_STRING_LOG_PREFIX);
CONFIG_CLEARRTFLAG(CONFIG_NOCHECKUNKOPT);
config_get( logparams_dump,(sizeof(log_maskmap)/sizeof(mapping)) - 1 ,CONFIG_STRING_LOG_PREFIX); config_get( logparams_dump,(sizeof(log_maskmap)/sizeof(mapping)) - 1 ,CONFIG_STRING_LOG_PREFIX);
config_check_unknown_cmdlineopt(CONFIG_STRING_LOG_PREFIX);
/* set the debug mask according to the debug parameters values */ /* set the debug mask according to the debug parameters values */
for (int i=0; log_maskmap[i].name != NULL ; i++) { for (int i=0; log_maskmap[i].name != NULL ; i++) {
......
...@@ -145,6 +145,7 @@ extern "C" { ...@@ -145,6 +145,7 @@ extern "C" {
#define DEBUG_CTRLSOCKET (1<<10) #define DEBUG_CTRLSOCKET (1<<10)
#define DEBUG_SECURITY (1<<11) #define DEBUG_SECURITY (1<<11)
#define DEBUG_NAS (1<<12) #define DEBUG_NAS (1<<12)
#define DEBUG_RLC (1<<13)
#define UE_TIMING (1<<20) #define UE_TIMING (1<<20)
...@@ -162,6 +163,7 @@ extern "C" { ...@@ -162,6 +163,7 @@ extern "C" {
{"CTRLSOCKET", DEBUG_CTRLSOCKET},\ {"CTRLSOCKET", DEBUG_CTRLSOCKET},\
{"SECURITY", DEBUG_SECURITY},\ {"SECURITY", DEBUG_SECURITY},\
{"NAS", DEBUG_NAS},\ {"NAS", DEBUG_NAS},\
{"RLC", DEBUG_RLC},\
{"UE_TIMING", UE_TIMING},\ {"UE_TIMING", UE_TIMING},\
{NULL,-1}\ {NULL,-1}\
} }
...@@ -345,6 +347,8 @@ int32_t write_file_matlab(const char *fname, const char *vname, void *data, int ...@@ -345,6 +347,8 @@ int32_t write_file_matlab(const char *fname, const char *vname, void *data, int
} }
#define LOG_OPTIONS_IDX 2 #define LOG_OPTIONS_IDX 2
/*----------------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------------*/
/** @defgroup _debugging debugging macros /** @defgroup _debugging debugging macros
* @ingroup _macro * @ingroup _macro
......
...@@ -19,7 +19,7 @@ T_IDs.h: $(GENIDS) T_messages.txt ...@@ -19,7 +19,7 @@ T_IDs.h: $(GENIDS) T_messages.txt
./$(GENIDS) T_messages.txt T_IDs.h ./$(GENIDS) T_messages.txt T_IDs.h
check_vcd: check_vcd:
gcc -Wall -I. -I.. -I../itti -Itracer -o _check_vcd check_vcd.c tracer/database.c tracer/utils.c -lm -pthread gcc -Wall -I. -I.. -I../itti -I../../../openair2/COMMON -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) ./_check_vcd || (rm -f ./_check_vcd ./T_IDs.h ./T_messages.txt.h && false)
rm -f ./_check_vcd rm -f ./_check_vcd
......
...@@ -12,14 +12,16 @@ ...@@ -12,14 +12,16 @@
#include "common/config/config_userapi.h" #include "common/config/config_userapi.h"
#define QUIT(x) do { \ #define QUIT(x) do { \
printf("T tracer: QUIT: %s\n", x); \ printf("T tracer: QUIT: %s\n", x); \
exit(1); \ exit(1); \
} while (0) } while (0)
/* array used to activate/disactivate a log */ /* array used to activate/disactivate a log */
static int T_IDs[T_NUMBER_OF_IDS]; static int T_IDs[T_NUMBER_OF_IDS];
int *T_active = T_IDs; int *T_active = T_IDs;
int T_stdout;
int T_stdout = 1;
static int T_socket; static int T_socket;
...@@ -32,125 +34,159 @@ volatile int *T_freelist_head = &_T_freelist_head; ...@@ -32,125 +34,159 @@ volatile int *T_freelist_head = &_T_freelist_head;
T_cache_t *T_cache; T_cache_t *T_cache;
#if BASIC_SIMULATOR #if BASIC_SIMULATOR
/* global variables used by T_GET_SLOT, see in T.h */ /* global variables used by T_GET_SLOT, see in T.h */
volatile uint64_t T_next_id; volatile uint64_t T_next_id;
volatile uint64_t T_active_id; volatile uint64_t T_active_id;
#endif #endif
static void get_message(int s) static void get_message(int s) {
{
char t; char t;
int l; int l;
int id; int id;
int is_on; int is_on;
if (read(s, &t, 1) != 1) QUIT("get_message fails"); if (read(s, &t, 1) != 1) QUIT("get_message fails");
printf("T tracer: got mess %d\n", t);
printf("T tracer: got mess %d\n", t);
switch (t) { switch (t) {
case 0: case 0:
/* toggle all those IDs */
/* optimze? (too much syscalls) */ /* toggle all those IDs */
if (read(s, &l, sizeof(int)) != sizeof(int)) QUIT("get_message fails"); /* optimze? (too much syscalls) */
while (l) { if (read(s, &l, sizeof(int)) != sizeof(int)) QUIT("get_message fails");
if (read(s, &id, sizeof(int)) != sizeof(int)) QUIT("get_message fails");
T_IDs[id] = 1 - T_IDs[id]; while (l) {
l--; if (read(s, &id, sizeof(int)) != sizeof(int)) QUIT("get_message fails");
}
break; T_IDs[id] = 1 - T_IDs[id];
case 1: l--;
/* set IDs as given */ }
/* optimize? */
if (read(s, &l, sizeof(int)) != sizeof(int)) QUIT("get_message fails"); break;
id = 0;
while (l) { case 1:
if (read(s, &is_on, sizeof(int)) != sizeof(int))
QUIT("get_message fails"); /* set IDs as given */
T_IDs[id] = is_on; /* optimize? */
id++; if (read(s, &l, sizeof(int)) != sizeof(int)) QUIT("get_message fails");
l--;
} id = 0;
break;
case 2: break; /* do nothing, this message is to wait for local tracer */ while (l) {
if (read(s, &is_on, sizeof(int)) != sizeof(int))
QUIT("get_message fails");
T_IDs[id] = is_on;
id++;
l--;
}
break;
case 2:
break; /* do nothing, this message is to wait for local tracer */
} }
} }
static void *T_receive_thread(void *_) static void *T_receive_thread(void *_) {
{
while (1) get_message(T_socket); while (1) get_message(T_socket);
return NULL; return NULL;
} }
static void new_thread(void *(*f)(void *), void *data) static void new_thread(void *(*f)(void *), void *data) {
{
pthread_t t; pthread_t t;
pthread_attr_t att; pthread_attr_t att;
if (pthread_attr_init(&att)) if (pthread_attr_init(&att)) {
{ fprintf(stderr, "pthread_attr_init err\n"); exit(1); } fprintf(stderr, "pthread_attr_init err\n");
if (pthread_attr_setdetachstate(&att, PTHREAD_CREATE_DETACHED)) exit(1);
{ fprintf(stderr, "pthread_attr_setdetachstate err\n"); exit(1); } }
if (pthread_create(&t, &att, f, data))
{ fprintf(stderr, "pthread_create err\n"); exit(1); } if (pthread_attr_setdetachstate(&att, PTHREAD_CREATE_DETACHED)) {
if (pthread_attr_destroy(&att)) fprintf(stderr, "pthread_attr_setdetachstate err\n");
{ fprintf(stderr, "pthread_attr_destroy err\n"); exit(1); } exit(1);
}
if (pthread_create(&t, &att, f, data)) {
fprintf(stderr, "pthread_create err\n");
exit(1);
}
if (pthread_attr_destroy(&att)) {
fprintf(stderr, "pthread_attr_destroy err\n");
exit(1);
}
} }
/* defined in local_tracer.c */ /* defined in local_tracer.c */
void T_local_tracer_main(int remote_port, int wait_for_tracer, void T_local_tracer_main(int remote_port, int wait_for_tracer,
int local_socket, void *shm_array); int local_socket, void *shm_array);
/* We monitor the tracee and the local tracer processes. /* We monitor the tracee and the local tracer processes.
* When one dies we forcefully kill the other. * When one dies we forcefully kill the other.
*/ */
#include <sys/types.h> #include <sys/types.h>
#include <sys/wait.h> #include <sys/wait.h>
static void monitor_and_kill(int child1, int child2) static void monitor_and_kill(int child1, int child2) {
{
int child; int child;
int status; int status;
child = wait(&status); child = wait(&status);
if (child == -1) perror("wait"); if (child == -1) perror("wait");
kill(child1, SIGKILL); kill(child1, SIGKILL);
kill(child2, SIGKILL); kill(child2, SIGKILL);
exit(0); exit(0);
} }
void T_init(int remote_port, int wait_for_tracer, int dont_fork) void T_init(int remote_port, int wait_for_tracer, int dont_fork) {
{
int socket_pair[2]; int socket_pair[2];
int s; int s;
int child1, child2; int child1, child2;
int i; int i;
if (socketpair(AF_UNIX, SOCK_STREAM, 0, socket_pair)) if (socketpair(AF_UNIX, SOCK_STREAM, 0, socket_pair)) {
{ perror("socketpair"); abort(); } perror("socketpair");
abort();
}
/* setup shared memory */ /* setup shared memory */
T_cache = mmap(NULL, T_CACHE_SIZE * sizeof(T_cache_t), T_cache = mmap(NULL, T_CACHE_SIZE * sizeof(T_cache_t),
PROT_READ | PROT_WRITE, MAP_SHARED | MAP_ANONYMOUS, -1, 0); PROT_READ | PROT_WRITE, MAP_SHARED | MAP_ANONYMOUS, -1, 0);
if (T_cache == MAP_FAILED)
{ perror("mmap"); abort(); } if (T_cache == MAP_FAILED) {
perror("mmap");
abort();
}
/* let's garbage the memory to catch some potential problems /* let's garbage the memory to catch some potential problems
* (think multiprocessor sync issues, barriers, etc.) * (think multiprocessor sync issues, barriers, etc.)
*/ */
memset(T_cache, 0x55, T_CACHE_SIZE * sizeof(T_cache_t)); memset(T_cache, 0x55, T_CACHE_SIZE * sizeof(T_cache_t));
for (i = 0; i < T_CACHE_SIZE; i++) T_cache[i].busy = 0; 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 runs the local tracer and child2 (or main) runs the tracee */
child1 = fork();
if (child1 == -1) abort();
child1 = fork(); if (child1 == -1) abort();
if (child1 == 0) { if (child1 == 0) {
close(socket_pair[1]); close(socket_pair[1]);
T_local_tracer_main(remote_port, wait_for_tracer, socket_pair[0], T_local_tracer_main(remote_port, wait_for_tracer, socket_pair[0],
T_cache); T_cache);
exit(0); exit(0);
} }
close(socket_pair[0]); close(socket_pair[0]);
if (dont_fork == 0) { if (dont_fork == 0) {
child2 = fork(); if (child2 == -1) abort(); child2 = fork();
if (child2 == -1) abort();
if (child2 != 0) { if (child2 != 0) {
close(socket_pair[1]); close(socket_pair[1]);
munmap(T_cache, T_CACHE_SIZE * sizeof(T_cache_t)); munmap(T_cache, T_CACHE_SIZE * sizeof(T_cache_t));
...@@ -161,27 +197,21 @@ void T_init(int remote_port, int wait_for_tracer, int dont_fork) ...@@ -161,27 +197,21 @@ void T_init(int remote_port, int wait_for_tracer, int dont_fork)
s = socket_pair[1]; s = socket_pair[1];
/* wait for first message - initial list of active T events */ /* wait for first message - initial list of active T events */
get_message(s); get_message(s);
T_socket = s; T_socket = s;
new_thread(T_receive_thread, NULL); new_thread(T_receive_thread, NULL);
} }
void T_Config_Init(void) void T_Config_Init(void) {
{ int T_port=TTRACER_DEFAULT_PORTNUM; /* by default we wait for the tracer */
int T_port; /* by default we wait for the tracer */ int T_nowait=0; /* default port to listen to to wait for the tracer */
int T_nowait; /* default port to listen to to wait for the tracer */ int T_dont_fork=0; /* default is to fork, see 'T_init' to understand */
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 /* for a cleaner config file, TTracer params should be defined in a
* specific section... * specific section...
*/ */
config_get(ttraceparams, config_get(ttraceparams,
sizeof(ttraceparams) / sizeof(paramdef_t), sizeof(ttraceparams) / sizeof(paramdef_t),
TTRACER_CONFIG_PREFIX); TTRACER_CONFIG_PREFIX);
/* compatibility: look for TTracer command line options in root section */ /* compatibility: look for TTracer command line options in root section */
config_process_cmdline(ttraceparams, config_process_cmdline(ttraceparams,
sizeof(ttraceparams) / sizeof(paramdef_t), sizeof(ttraceparams) / sizeof(paramdef_t),
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
#include "T_defs.h" #include "T_defs.h"
#ifdef T_SEND_TIME #ifdef T_SEND_TIME
#include <time.h> #include <time.h>
#endif #endif
/* T message IDs */ /* T message IDs */
...@@ -76,13 +76,13 @@ ...@@ -76,13 +76,13 @@
T_BUFFER_MAX - T_LOCAL_size, T_PUT_printf_deref x); \ T_BUFFER_MAX - T_LOCAL_size, T_PUT_printf_deref x); \
if (T_PUT_len < 0) { \ if (T_PUT_len < 0) { \
printf("%s:%d:%s: you can't read this, or can you?", \ printf("%s:%d:%s: you can't read this, or can you?", \
__FILE__, __LINE__, __FUNCTION__); \ __FILE__, __LINE__, __FUNCTION__); \
abort(); \ abort(); \
} \ } \
if (T_PUT_len >= T_BUFFER_MAX - T_LOCAL_size) { \ if (T_PUT_len >= T_BUFFER_MAX - T_LOCAL_size) { \
printf("%s:%d:%s: cannot put argument %d in T macro, not enough space" \ printf("%s:%d:%s: cannot put argument %d in T macro, not enough space" \
", consider increasing T_BUFFER_MAX (%d)\n", \ ", consider increasing T_BUFFER_MAX (%d)\n", \
__FILE__, __LINE__, __FUNCTION__, argnum, T_BUFFER_MAX); \ __FILE__, __LINE__, __FUNCTION__, argnum, T_BUFFER_MAX); \
abort(); \ abort(); \
} \ } \
T_LOCAL_size += T_PUT_len + 1; \ T_LOCAL_size += T_PUT_len + 1; \
...@@ -97,9 +97,9 @@ struct T_header; ...@@ -97,9 +97,9 @@ struct T_header;
/* T macro tricks */ /* T macro tricks */
extern int T_stdout; extern int T_stdout;
#define TN(...) TN_N(__VA_ARGS__,33,32,31,30,29,28,27,26,25,24,23,22,21,\ #define TN(...) TN_N(__VA_ARGS__,33,32,31,30,29,28,27,26,25,24,23,22,21,\
20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0)(__VA_ARGS__) 20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0)(__VA_ARGS__)
#define TN_N(n0,n1,n2,n3,n4,n5,n6,n7,n8,n9,n10,n11,n12,n13,n14,n15,n16,n17,\ #define TN_N(n0,n1,n2,n3,n4,n5,n6,n7,n8,n9,n10,n11,n12,n13,n14,n15,n16,n17,\
n18,n19,n20,n21,n22,n23,n24,n25,n26,n27,n28,n29,n30,n31,n32,n,...) T##n n18,n19,n20,n21,n22,n23,n24,n25,n26,n27,n28,n29,n30,n31,n32,n,...) T##n
#define T(...) do { if (T_stdout == 0) TN(__VA_ARGS__); } while (0) #define T(...) do { if (T_stdout == 0) TN(__VA_ARGS__); } while (0)
/* type used to send arbitrary buffer data */ /* type used to send arbitrary buffer data */
...@@ -119,30 +119,30 @@ extern int *T_active; ...@@ -119,30 +119,30 @@ extern int *T_active;
*/ */
#if BASIC_SIMULATOR #if BASIC_SIMULATOR
# define T_GET_SLOT \ # define T_GET_SLOT \
do { \ do { \
extern volatile uint64_t T_next_id; \ extern volatile uint64_t T_next_id; \
extern volatile uint64_t T_active_id; \ extern volatile uint64_t T_active_id; \
uint64_t id; \ uint64_t id; \
/* get a ticket */ \ /* get a ticket */ \
id = __sync_fetch_and_add(&T_next_id, 1); \ id = __sync_fetch_and_add(&T_next_id, 1); \
/* wait for our turn */ \ /* wait for our turn */ \
while (id != __sync_fetch_and_add(&T_active_id, 0)) /* busy wait */; \ 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 */ \ /* this is our turn, try to acquire the slot until it's free */ \
do { \ do { \
T_LOCAL_busy = __sync_fetch_and_or(&T_cache[T_LOCAL_slot].busy, 0x01); \ T_LOCAL_busy = __sync_fetch_and_or(&T_cache[T_LOCAL_slot].busy, 0x01); \
if (T_LOCAL_busy & 0x01) usleep(100); \ if (T_LOCAL_busy & 0x01) usleep(100); \
} while (T_LOCAL_busy & 0x01); \ } while (T_LOCAL_busy & 0x01); \
/* check that there are still some tickets */ \ /* check that there are still some tickets */ \
if (__sync_fetch_and_add(&T_active_id, 0) == 0xffffffffffffffff) { \ if (__sync_fetch_and_add(&T_active_id, 0) == 0xffffffffffffffff) { \
printf("T: reached the end of times, bye...\n"); \ printf("T: reached the end of times, bye...\n"); \
abort(); \ abort(); \
} \ } \
/* free our ticket, which signals the next waiter that it's its turn */ \ /* free our ticket, which signals the next waiter that it's its turn */ \
(void)__sync_fetch_and_add(&T_active_id, 1); \ (void)__sync_fetch_and_add(&T_active_id, 1); \
} while (0) } while (0)
#else #else
# define T_GET_SLOT \ # define T_GET_SLOT \
T_LOCAL_busy = __sync_fetch_and_or(&T_cache[T_LOCAL_slot].busy, 0x01); T_LOCAL_busy = __sync_fetch_and_or(&T_cache[T_LOCAL_slot].busy, 0x01);
#endif #endif
/* used at header of Tn, allocates buffer */ /* used at header of Tn, allocates buffer */
...@@ -172,8 +172,8 @@ extern int *T_active; ...@@ -172,8 +172,8 @@ extern int *T_active;
#define T_CHECK_SIZE(len, argnum) \ #define T_CHECK_SIZE(len, argnum) \
if (T_LOCAL_size + (len) > T_BUFFER_MAX) { \ if (T_LOCAL_size + (len) > T_BUFFER_MAX) { \
printf("%s:%d:%s: cannot put argument %d in T macro, not enough space" \ printf("%s:%d:%s: cannot put argument %d in T macro, not enough space" \
", consider increasing T_BUFFER_MAX (%d)\n", \ ", consider increasing T_BUFFER_MAX (%d)\n", \
__FILE__, __LINE__, __FUNCTION__, argnum, T_BUFFER_MAX); \ __FILE__, __LINE__, __FUNCTION__, argnum, T_BUFFER_MAX); \
abort(); \ abort(); \
} }
...@@ -598,20 +598,21 @@ extern int *T_active; ...@@ -598,20 +598,21 @@ extern int *T_active;
#define TTRACER_CONFIG_PREFIX "TTracer" #define TTRACER_CONFIG_PREFIX "TTracer"
/*------------------------------------------------------------------------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------------------------------------------------------------------------------*/
/* configuration parameters for TTRACE utility */ /* configuration parameters for TTRACE utility */
/* optname helpstr paramflags XXXptr defXXXval type numelt */ /* optname helpstr paramflags XXXptr defXXXval type numelt */
/*------------------------------------------------------------------------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------------------------------------------------------------------------------*/
#define TTRACER_DEFAULT_PORTNUM 2021
#define CMDLINE_TTRACEPARAMS_DESC { \ #define CMDLINE_TTRACEPARAMS_DESC { \
{"T_port", CONFIG_HLP_TPORT, 0, iptr:&T_port, defintval:2021, TYPE_INT, 0}, \ {"T_port", CONFIG_HLP_TPORT, 0, iptr:&T_port, defintval:TTRACER_DEFAULT_PORTNUM, TYPE_INT, 0},\
{"T_nowait", CONFIG_HLP_NOTWAIT, PARAMFLAG_BOOL, iptr:&T_nowait, defintval:0, 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_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_stdout", CONFIG_HLP_STDOUT, PARAMFLAG_BOOL, iptr:&T_stdout, defintval:1, TYPE_INT, 0},\
} }
/* log on stdout */ /* log on stdout */
void T_init(int remote_port, int wait_for_tracer, int dont_fork); void T_init(int remote_port, int wait_for_tracer, int dont_fork);
void T_Config_Init(void); void T_Config_Init(void);
#else /* T_TRACER */ #else /* T_TRACER */
......
...@@ -22,9 +22,7 @@ ...@@ -22,9 +22,7 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <inttypes.h> #include <inttypes.h>
#ifdef CMAKER
#include <platform_types.h> #include <platform_types.h>
#endif
#if defined(ENB_MODE) #if defined(ENB_MODE)
# define display_backtrace() # define display_backtrace()
......
This diff is collapsed.
...@@ -25,46 +25,46 @@ ...@@ -25,46 +25,46 @@
#include <stdint.h> #include <stdint.h>
typedef enum { typedef enum {
MIN_MSC_ENV = 0, MIN_MSC_ENV = 0,
MSC_E_UTRAN = MIN_MSC_ENV, MSC_E_UTRAN = MIN_MSC_ENV,
MSC_E_UTRAN_LIPA, MSC_E_UTRAN_LIPA,
MSC_MME_GW, MSC_MME_GW,
MSC_MME, MSC_MME,
MSC_SP_GW, MSC_SP_GW,
MAX_MSC_ENV MAX_MSC_ENV
} msc_env_t; } msc_env_t;
typedef enum { typedef enum {
MIN_MSC_PROTOS = 0, MIN_MSC_PROTOS = 0,
MSC_IP_UE = MIN_MSC_PROTOS, MSC_IP_UE = MIN_MSC_PROTOS,
MSC_NAS_UE, MSC_NAS_UE,
MSC_RRC_UE, MSC_RRC_UE,
MSC_PDCP_UE, MSC_PDCP_UE,
MSC_RLC_UE, MSC_RLC_UE,
MSC_MAC_UE, MSC_MAC_UE,
MSC_PHY_UE, MSC_PHY_UE,
MSC_PHY_ENB, MSC_PHY_ENB,
MSC_MAC_ENB, MSC_MAC_ENB,
MSC_RLC_ENB, MSC_RLC_ENB,
MSC_PDCP_ENB, MSC_PDCP_ENB,
MSC_RRC_ENB, MSC_RRC_ENB,
MSC_IP_ENB, MSC_IP_ENB,
MSC_S1AP_ENB, MSC_S1AP_ENB,
MSC_GTPU_ENB, MSC_GTPU_ENB,
MSC_GTPU_SGW, MSC_GTPU_SGW,
MSC_S1AP_MME, MSC_S1AP_MME,
MSC_MMEAPP_MME, MSC_MMEAPP_MME,
MSC_NAS_MME, MSC_NAS_MME,
MSC_NAS_EMM_MME, MSC_NAS_EMM_MME,
MSC_NAS_ESM_MME, MSC_NAS_ESM_MME,
MSC_SP_GWAPP_MME, MSC_SP_GWAPP_MME,
MSC_S11_MME, MSC_S11_MME,
MSC_S6A_MME, MSC_S6A_MME,
MSC_HSS, MSC_HSS,
MAX_MSC_PROTOS, MAX_MSC_PROTOS,
MSC_X2AP_SRC_ENB, MSC_X2AP_SRC_ENB,
MSC_X2AP_TARGET_ENB, MSC_X2AP_TARGET_ENB,
} msc_proto_t; } msc_proto_t;
...@@ -73,22 +73,22 @@ typedef enum { ...@@ -73,22 +73,22 @@ typedef enum {
#define MSC_AS_TIME_FMT "%05u:%02u" #define MSC_AS_TIME_FMT "%05u:%02u"
#define MSC_AS_TIME_ARGS(CTXT_Pp) \ #define MSC_AS_TIME_ARGS(CTXT_Pp) \
(CTXT_Pp)->frame, \ (CTXT_Pp)->frame, \
(CTXT_Pp)->subframe (CTXT_Pp)->subframe
typedef int(*msc_init_t)(const msc_env_t, const int ); typedef int(*msc_init_t)(const msc_env_t, const int );
typedef void(*msc_start_use_t)(void ); typedef void(*msc_start_use_t)(void );
typedef void(*msc_end_t)(void); typedef void(*msc_end_t)(void);
typedef void(*msc_log_event_t)(const msc_proto_t,char *, ...); typedef void(*msc_log_event_t)(const msc_proto_t,char *, ...);
typedef void(*msc_log_message_t)(const char * const, const msc_proto_t, const msc_proto_t, typedef void(*msc_log_message_t)(const char *const, const msc_proto_t, const msc_proto_t,
const uint8_t* const, const unsigned int, char * , ...); const uint8_t *const, const unsigned int, char *, ...);
typedef struct msc_interface { typedef struct msc_interface {
int msc_loaded; int msc_loaded;
msc_init_t msc_init; msc_init_t msc_init;
msc_start_use_t msc_start_use; msc_start_use_t msc_start_use;
msc_end_t msc_end; msc_end_t msc_end;
msc_log_event_t msc_log_event; msc_log_event_t msc_log_event;
msc_log_message_t msc_log_message; msc_log_message_t msc_log_message;
} msc_interface_t; } msc_interface_t;
#ifdef MSC_LIBRARY #ifdef MSC_LIBRARY
...@@ -99,15 +99,17 @@ void msc_end(void); ...@@ -99,15 +99,17 @@ void msc_end(void);
void msc_log_declare_proto(const msc_proto_t protoP); void msc_log_declare_proto(const msc_proto_t protoP);
void msc_log_event(const msc_proto_t protoP,char *format, ...); void msc_log_event(const msc_proto_t protoP,char *format, ...);
void msc_log_message( void msc_log_message(
const char * const message_operationP, const char *const message_operationP,
const msc_proto_t receiverP, const msc_proto_t receiverP,
const msc_proto_t senderP, const msc_proto_t senderP,
const uint8_t* const bytesP, const uint8_t *const bytesP,
const unsigned int num_bytes, const unsigned int num_bytes,
char *format, ...); char *format, ...);
#else #else
#define MESSAGE_CHART_GENERATOR msc_interface.msc_loaded
msc_interface_t msc_interface; msc_interface_t msc_interface;
#define MSC_INIT(arg1,arg2) if(msc_interface.msc_loaded) msc_interface.msc_init(arg1,arg2) #define MSC_INIT(arg1,arg2) if(msc_interface.msc_loaded) msc_interface.msc_init(arg1,arg2)
#define MSC_START_USE if(msc_interface.msc_loaded) msc_interface.msc_start_use #define MSC_START_USE if(msc_interface.msc_loaded) msc_interface.msc_start_use
...@@ -119,4 +121,4 @@ msc_interface_t msc_interface; ...@@ -119,4 +121,4 @@ msc_interface_t msc_interface;
#define MSC_LOG_TX_MESSAGE_FAILED(sENDER, rECEIVER, bYTES, nUMbYTES, fORMAT, aRGS...) if(msc_interface.msc_loaded) msc_interface.msc_log_message("-x",sENDER, rECEIVER, (const uint8_t *)bYTES, nUMbYTES, fORMAT, ##aRGS) #define MSC_LOG_TX_MESSAGE_FAILED(sENDER, rECEIVER, bYTES, nUMbYTES, fORMAT, aRGS...) if(msc_interface.msc_loaded) msc_interface.msc_log_message("-x",sENDER, rECEIVER, (const uint8_t *)bYTES, nUMbYTES, fORMAT, ##aRGS)
#endif #endif
#endif #endif
This diff is collapsed.
#ifndef _TIME_UTILS_H_
#define _TIME_UTILS_H_
#include <time.h>
#include <stdint.h>
static inline int64_t clock_difftime_ns(struct timespec start, struct timespec end)
{
struct timespec temp;
int64_t temp_ns;
if ((end.tv_nsec-start.tv_nsec)<0) {
temp.tv_sec = end.tv_sec-start.tv_sec-1;
temp.tv_nsec = 1000000000+end.tv_nsec-start.tv_nsec;
} else {
temp.tv_sec = end.tv_sec-start.tv_sec;
temp.tv_nsec = end.tv_nsec-start.tv_nsec;
}
temp_ns = (int64_t)(temp.tv_sec) * (int64_t)1000000000 + (temp.tv_nsec);
return temp_ns;
}
#endif /* _TIME_UTILS_H_ */
...@@ -8,7 +8,8 @@ ...@@ -8,7 +8,8 @@
5. [eNB RRC Layer](#enb-rrc-layer) 5. [eNB RRC Layer](#enb-rrc-layer)
6. [eNB X2AP](#enb-x2ap) 6. [eNB X2AP](#enb-x2ap)
7. [eNB Advanced Features](#enb-advanced-features) 7. [eNB Advanced Features](#enb-advanced-features)
2. [OpenAirInterface UE Feature Set](#openairinterface-ue-feature-set) 2. [OpenAirInterface Functional Split](#openairinterface-functional-split)
3. [OpenAirInterface UE Feature Set](#openairinterface-ue-feature-set)
1. [LTE UE PHY Layer](#lte-ue-phy-layer) 1. [LTE UE PHY Layer](#lte-ue-phy-layer)
2. [LTE UE MAC Layer](#lte-ue-mac-layer) 2. [LTE UE MAC Layer](#lte-ue-mac-layer)
3. [LTE UE RLC Layer](#lte-ue-rlc-layer) 3. [LTE UE RLC Layer](#lte-ue-rlc-layer)
...@@ -128,6 +129,18 @@ The X2AP layer is based on **3GPP 36.423** v14.6.0 and implements the following ...@@ -128,6 +129,18 @@ The X2AP layer is based on **3GPP 36.423** v14.6.0 and implements the following
**To be completed** **To be completed**
# OpenAirInterface Functional Split #
- RCC: Radio-Cloud Center
- RAU: Radio-Access Unit
- RRU: Remote Radio-Unit
![Functional Split Architecture](./oai_lte_enb_func_split_arch.png)
- IF4.5 / IF5 : similar to IEEE P1914.1
- FAPI (IF2) : specified by Small Cell Forum (open-nFAPI implementation)
- IF1 : F1 in 3GPP Release 15 (not implemented yet)
# OpenAirInterface UE Feature Set # # OpenAirInterface UE Feature Set #
## LTE UE PHY Layer ## ## LTE UE PHY Layer ##
...@@ -169,3 +182,10 @@ The RRC layer is based on **3GPP 36.331** v14.3.0 and implements the following f ...@@ -169,3 +182,10 @@ The RRC layer is based on **3GPP 36.331** v14.3.0 and implements the following f
- System Information decoding - System Information decoding
- RRC connection establishment - RRC connection establishment
## LTE UE NAS Layer ##
The NAS layer is based on **3GPP 24.301** and implements the following functions:
- EMM attach/detach, authentication, tracking area update, and more
- ESM default/dedicated bearer, PDN connectivity, and more
...@@ -270,6 +270,7 @@ int pnf_param_resp_cb(nfapi_vnf_config_t* config, int p5_idx, nfapi_pnf_param_re ...@@ -270,6 +270,7 @@ int pnf_param_resp_cb(nfapi_vnf_config_t* config, int p5_idx, nfapi_pnf_param_re
for(int i = 0; i < resp->pnf_phy.number_of_phys; ++i) for(int i = 0; i < resp->pnf_phy.number_of_phys; ++i)
{ {
phy_info phy; phy_info phy;
memset(&phy,0,sizeof(phy));
phy.index = resp->pnf_phy.phy[i].phy_config_index; phy.index = resp->pnf_phy.phy[i].phy_config_index;
printf("[VNF] (PHY:%d) phy_config_idx:%d\n", i, resp->pnf_phy.phy[i].phy_config_index); printf("[VNF] (PHY:%d) phy_config_idx:%d\n", i, resp->pnf_phy.phy[i].phy_config_index);
...@@ -287,6 +288,7 @@ int pnf_param_resp_cb(nfapi_vnf_config_t* config, int p5_idx, nfapi_pnf_param_re ...@@ -287,6 +288,7 @@ int pnf_param_resp_cb(nfapi_vnf_config_t* config, int p5_idx, nfapi_pnf_param_re
for(int i = 0; i < resp->pnf_rf.number_of_rfs; ++i) { for(int i = 0; i < resp->pnf_rf.number_of_rfs; ++i) {
rf_info rf; rf_info rf;
memset(&rf,0,sizeof(rf));
rf.index = resp->pnf_rf.rf[i].rf_config_index; rf.index = resp->pnf_rf.rf[i].rf_config_index;
printf("[VNF] (RF:%d) rf_config_idx:%d\n", i, resp->pnf_rf.rf[i].rf_config_index); printf("[VNF] (RF:%d) rf_config_idx:%d\n", i, resp->pnf_rf.rf[i].rf_config_index);
...@@ -912,7 +914,7 @@ int param_resp_cb(nfapi_vnf_config_t* config, int p5_idx, nfapi_param_response_t ...@@ -912,7 +914,7 @@ int param_resp_cb(nfapi_vnf_config_t* config, int p5_idx, nfapi_param_response_t
// for now just 1 // for now just 1
printf("[VNF] %d.%d pnf p7 %s:%d timing %d %d %d %d\n", p5_idx, phy->id, phy->remote_addr, phy->remote_port, p7_vnf->timing_window, p7_vnf->periodic_timing_period, p7_vnf->aperiodic_timing_enabled, p7_vnf->periodic_timing_period); printf("[VNF] %d.%d pnf p7 %s:%d timing %u %u %u %u\n", p5_idx, phy->id, phy->remote_addr, phy->remote_port, p7_vnf->timing_window, p7_vnf->periodic_timing_period, p7_vnf->aperiodic_timing_enabled, p7_vnf->periodic_timing_period);
req->header.message_id = NFAPI_CONFIG_REQUEST; req->header.message_id = NFAPI_CONFIG_REQUEST;
req->header.phy_id = phy->id; req->header.phy_id = phy->id;
...@@ -934,7 +936,7 @@ int param_resp_cb(nfapi_vnf_config_t* config, int p5_idx, nfapi_param_response_t ...@@ -934,7 +936,7 @@ int param_resp_cb(nfapi_vnf_config_t* config, int p5_idx, nfapi_param_response_t
req->nfapi_config.timing_window.tl.tag = NFAPI_NFAPI_TIMING_WINDOW_TAG; req->nfapi_config.timing_window.tl.tag = NFAPI_NFAPI_TIMING_WINDOW_TAG;
req->nfapi_config.timing_window.value = p7_vnf->timing_window; req->nfapi_config.timing_window.value = p7_vnf->timing_window;
printf("[VNF] Timing window:%d\n", p7_vnf->timing_window); printf("[VNF] Timing window:%u\n", p7_vnf->timing_window);
req->num_tlv++; req->num_tlv++;
if(p7_vnf->periodic_timing_enabled || p7_vnf->aperiodic_timing_enabled) { if(p7_vnf->periodic_timing_enabled || p7_vnf->aperiodic_timing_enabled) {
......
...@@ -1237,11 +1237,11 @@ int pnf_connect(pnf_t* pnf) ...@@ -1237,11 +1237,11 @@ int pnf_connect(pnf_t* pnf)
} }
struct addrinfo *p = servinfo; struct addrinfo *p = servinfo;
int i = 0;
int connected = 0; int connected = 0;
while(p != NULL && connected == 0) while(p != NULL && connected == 0)
{ {
#ifdef NFAPI_TRACE_ENABLED
char* family = "Unknown"; char* family = "Unknown";
char* address = "Unknown"; char* address = "Unknown";
char _addr[128]; char _addr[128];
...@@ -1261,6 +1261,7 @@ int pnf_connect(pnf_t* pnf) ...@@ -1261,6 +1261,7 @@ int pnf_connect(pnf_t* pnf)
} }
NFAPI_TRACE(NFAPI_TRACE_NOTE, "Host address info %d Family:%s Address:%s\n", i++, family, address); NFAPI_TRACE(NFAPI_TRACE_NOTE, "Host address info %d Family:%s Address:%s\n", i++, family, address);
#endif
if (pnf->sctp) if (pnf->sctp)
{ {
......
...@@ -389,7 +389,7 @@ static uint32_t get_sf_time(uint32_t now_hr, uint32_t sf_start_hr) ...@@ -389,7 +389,7 @@ static uint32_t get_sf_time(uint32_t now_hr, uint32_t sf_start_hr)
{ {
if(now_hr < sf_start_hr) if(now_hr < sf_start_hr)
{ {
NFAPI_TRACE(NFAPI_TRACE_INFO, "now is earlier than start of subframe now_hr:%u sf_start_hr:%u\n", now_hr, sf_start_hr); //NFAPI_TRACE(NFAPI_TRACE_INFO, "now is earlier than start of subframe now_hr:%u sf_start_hr:%u\n", now_hr, sf_start_hr);
return 0; return 0;
} }
else else
......
...@@ -1203,12 +1203,12 @@ void vnf_handle_ul_node_sync(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_p7) ...@@ -1203,12 +1203,12 @@ void vnf_handle_ul_node_sync(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_p7)
if(phy->in_sync == 0) if(phy->in_sync == 0)
{ {
NFAPI_TRACE(NFAPI_TRACE_NOTE, "***** Adjusting VNF phy_id:%d SFN/SF (%s) from %d to %d (%d) mode:%s zeroCount:%u sync:%s\n", /*NFAPI_TRACE(NFAPI_TRACE_NOTE, "***** Adjusting VNF phy_id:%d SFN/SF (%s) from %d to %d (%d) mode:%s zeroCount:%u sync:%s\n",
ind.header.phy_id, (phy->in_sync ? "via sfn" : "now"), ind.header.phy_id, (phy->in_sync ? "via sfn" : "now"),
NFAPI_SFNSF2DEC(curr_sfn_sf), NFAPI_SFNSF2DEC(new_sfn_sf), phy->adjustment, NFAPI_SFNSF2DEC(curr_sfn_sf), NFAPI_SFNSF2DEC(new_sfn_sf), phy->adjustment,
phy->filtered_adjust ? "FILTERED" : "ABSOLUTE", phy->filtered_adjust ? "FILTERED" : "ABSOLUTE",
phy->zero_count, phy->zero_count,
phy->in_sync ? "IN_SYNC" : "OUT_OF_SYNC"); phy->in_sync ? "IN_SYNC" : "OUT_OF_SYNC");*/
phy->sfn_sf = new_sfn_sf; phy->sfn_sf = new_sfn_sf;
} }
......
This diff is collapsed.
...@@ -47,27 +47,20 @@ void ...@@ -47,27 +47,20 @@ void
ccodedot11_encode (unsigned int numbytes, ccodedot11_encode (unsigned int numbytes,
unsigned char *inPtr, unsigned char *inPtr,
unsigned char *outPtr, unsigned char *outPtr,
unsigned char puncturing) unsigned char puncturing) {
{
unsigned int state; unsigned int state;
unsigned char c, out, shiftbit =0; unsigned char c, out, shiftbit =0;
// printf("In ccodedot11_encode (%d,%p,%p,%d)\n",numbytes,inPtr,outPtr,puncturing); // printf("In ccodedot11_encode (%d,%p,%p,%d)\n",numbytes,inPtr,outPtr,puncturing);
#ifdef DEBUG_CCODE #ifdef DEBUG_CCODE
unsigned int dummy; unsigned int dummy;
#endif //DEBUG_CCODE #endif //DEBUG_CCODE
int bit_index; int bit_index;
/* The input bit is shifted in position 8 of the state. /* The input bit is shifted in position 8 of the state.
Shiftbit will take values between 1 and 8 */ Shiftbit will take values between 1 and 8 */
state = 0; state = 0;
#ifdef DEBUG_CCODE #ifdef DEBUG_CCODE
dummy = 0; dummy = 0;
#endif //DEBUG_CCODE #endif //DEBUG_CCODE
/* Do not increment inPtr until we read the next octet */ /* Do not increment inPtr until we read the next octet */
bit_index=0; bit_index=0;
...@@ -78,85 +71,75 @@ ccodedot11_encode (unsigned int numbytes, ...@@ -78,85 +71,75 @@ ccodedot11_encode (unsigned int numbytes,
#endif //DEBUG_CCODE #endif //DEBUG_CCODE
switch (puncturing) { switch (puncturing) {
case 0: //rate 1/2 case 0: //rate 1/2
for (shiftbit = 0; shiftbit<8; shiftbit++) { for (shiftbit = 0; shiftbit<8; shiftbit++) {
state >>= 1;
state >>= 1;
if ((c&(1<<shiftbit)) != 0) {
state |= 64;
}
out = ccodedot11_table[state]; if ((c&(1<<shiftbit)) != 0) {
state |= 64;
*outPtr++ = out & 1; }
*outPtr++ = (out>>1)&1;
out = ccodedot11_table[state];
*outPtr++ = out & 1;
*outPtr++ = (out>>1)&1;
#ifdef DEBUG_CCODE #ifdef DEBUG_CCODE
printf("%d: %d -> %d (%d)\n",dummy,state,out,ccodedot11_table[state]); printf("%u: %u -> %d (%u)\n",dummy,state,out,ccodedot11_table[state]);
dummy+=2; dummy+=2;
#endif //DEBUG_CCODE #endif //DEBUG_CCODE
}
} break;
break;
case 1: // rate 3/4
for (shiftbit = 0; shiftbit<8; shiftbit++) {
state >>= 1; case 1: // rate 3/4
for (shiftbit = 0; shiftbit<8; shiftbit++) {
state >>= 1;
if ((c&(1<<shiftbit)) != 0) { if ((c&(1<<shiftbit)) != 0) {
state |= 64; state |= 64;
} }
out = ccodedot11_table[state]; out = ccodedot11_table[state];
if (bit_index<2) if (bit_index<2)
*outPtr++ = out & 1; *outPtr++ = out & 1;
if (bit_index!=1) if (bit_index!=1)
*outPtr++ = (out>>1)&1; *outPtr++ = (out>>1)&1;
#ifdef DEBUG_CCODE #ifdef DEBUG_CCODE
printf("%d: %d -> %d (%d)\n",dummy,state,out,ccodedot11_table[state]); printf("%u: %u -> %d (%u)\n",dummy,state,out,ccodedot11_table[state]);
dummy+=2; dummy+=2;
#endif //DEBUG_CCODE #endif //DEBUG_CCODE
bit_index=(bit_index==2)?0:(bit_index+1);
}
bit_index=(bit_index==2)?0:(bit_index+1); break;
}
break;
case 2: // rate 2/3
for (shiftbit = 0; shiftbit<8; shiftbit++) {
state >>= 1;
if ((c&(1<<shiftbit)) != 0) { case 2: // rate 2/3
state |= 64; for (shiftbit = 0; shiftbit<8; shiftbit++) {
} state >>= 1;
out = ccodedot11_table[state]; if ((c&(1<<shiftbit)) != 0) {
state |= 64;
}
*outPtr++ = out & 1; out = ccodedot11_table[state];
*outPtr++ = out & 1;
if (bit_index==0) if (bit_index==0)
*outPtr++ = (out>>1)&1; *outPtr++ = (out>>1)&1;
#ifdef DEBUG_CCODE #ifdef DEBUG_CCODE
printf("%d: %d -> %d (%d)\n",dummy,state,out,ccodedot11_table[state]); printf("%d: %u -> %d (%u)\n",dummy,state,out,ccodedot11_table[state]);
dummy+=2; dummy+=2;
#endif //DEBUG_CCODE #endif //DEBUG_CCODE
bit_index=(bit_index==0)?1:0;
}
bit_index=(bit_index==0)?1:0; break;
}
break;
default: default:
break; break;
} }
} }
...@@ -181,8 +164,6 @@ ccodedot11_encode (unsigned int numbytes, ...@@ -181,8 +164,6 @@ ccodedot11_encode (unsigned int numbytes,
} }
*/ */
} }
...@@ -197,8 +178,7 @@ ccodedot11_encode (unsigned int numbytes, ...@@ -197,8 +178,7 @@ ccodedot11_encode (unsigned int numbytes,
/* Basic code table initialization for constraint length 7 */ /* Basic code table initialization for constraint length 7 */
/* Input in MSB, followed by state in 6 LSBs */ /* Input in MSB, followed by state in 6 LSBs */
void ccodedot11_init(void) void ccodedot11_init(void) {
{
unsigned int i, j, k, sum; unsigned int i, j, k, sum;
for (i = 0; i < 128; i++) { for (i = 0; i < 128; i++) {
...@@ -219,8 +199,7 @@ void ccodedot11_init(void) ...@@ -219,8 +199,7 @@ void ccodedot11_init(void)
} }
/* Input in LSB, followed by state in 6 MSBs */ /* Input in LSB, followed by state in 6 MSBs */
void ccodedot11_init_inv(void) void ccodedot11_init_inv(void) {
{
unsigned int i, j, k, sum; unsigned int i, j, k, sum;
for (i = 0; i < 128; i++) { for (i = 0; i < 128; i++) {
...@@ -251,21 +230,15 @@ void ccodedot11_init_inv(void) ...@@ -251,21 +230,15 @@ void ccodedot11_init_inv(void)
#ifdef DEBUG_CCODE #ifdef DEBUG_CCODE
#include <stdio.h> #include <stdio.h>
main() main() {
{
unsigned char test[] = "0Thebigredfox"; unsigned char test[] = "0Thebigredfox";
unsigned char output[512], *inPtr, *outPtr; unsigned char output[512], *inPtr, *outPtr;
unsigned int i; unsigned int i;
test[0] = 128; test[0] = 128;
test[1] = 0; test[1] = 0;
ccodedot11_init(); ccodedot11_init();
inPtr = test; inPtr = test;
outPtr = output; outPtr = output;
ccodedot11_encode(16, inPtr, outPtr,0); ccodedot11_encode(16, inPtr, outPtr,0);
for (i = 0; i < 32; i++) printf("%x ", output[i]); for (i = 0; i < 32; i++) printf("%x ", output[i]);
......
...@@ -52,20 +52,16 @@ ccodelte_encode (int32_t numbits, ...@@ -52,20 +52,16 @@ ccodelte_encode (int32_t numbits,
uint8_t add_crc, uint8_t add_crc,
uint8_t *inPtr, uint8_t *inPtr,
uint8_t *outPtr, uint8_t *outPtr,
uint16_t rnti) uint16_t rnti) {
{
uint32_t state; uint32_t state;
uint8_t c, out, first_bit; uint8_t c, out, first_bit;
int8_t shiftbit=0; int8_t shiftbit=0;
uint16_t c16; uint16_t c16;
uint16_t next_last_byte=0; uint16_t next_last_byte=0;
uint32_t crc=0; uint32_t crc=0;
#ifdef DEBUG_CCODE #ifdef DEBUG_CCODE
uint32_t dummy=0; uint32_t dummy=0;
#endif //DEBUG_CCODE #endif //DEBUG_CCODE
/* The input bit is shifted in position 8 of the state. /* The input bit is shifted in position 8 of the state.
Shiftbit will take values between 1 and 8 */ Shiftbit will take values between 1 and 8 */
state = 0; state = 0;
...@@ -137,17 +133,12 @@ ccodelte_encode (int32_t numbits, ...@@ -137,17 +133,12 @@ ccodelte_encode (int32_t numbits,
#endif //DEBUG_CCODE #endif //DEBUG_CCODE
/* Do not increment inPtr until we read the next octet */ /* Do not increment inPtr until we read the next octet */
while (numbits > 0) { while (numbits > 0) {
c = *inPtr++; c = *inPtr++;
#ifdef DEBUG_CCODE #ifdef DEBUG_CCODE
printf("** %x **\n",c); printf("** %x **\n",c);
#endif //DEBUG_CCODE #endif //DEBUG_CCODE
// for (shiftbit = 0; (shiftbit<8) && (numbits>0);shiftbit++,numbits--) { // for (shiftbit = 0; (shiftbit<8) && (numbits>0);shiftbit++,numbits--) {
for (shiftbit = 7; (shiftbit>=0) && (numbits>0); shiftbit--,numbits--) { for (shiftbit = 7; (shiftbit>=0) && (numbits>0); shiftbit--,numbits--) {
state >>= 1; state >>= 1;
...@@ -157,23 +148,18 @@ ccodelte_encode (int32_t numbits, ...@@ -157,23 +148,18 @@ ccodelte_encode (int32_t numbits,
} }
out = ccodelte_table[state]; out = ccodelte_table[state];
*outPtr++ = out & 1; *outPtr++ = out & 1;
*outPtr++ = (out>>1)&1; *outPtr++ = (out>>1)&1;
*outPtr++ = (out>>2)&1; *outPtr++ = (out>>2)&1;
#ifdef DEBUG_CCODE #ifdef DEBUG_CCODE
printf("numbits %d, input %d, outbit %d: %d -> %d (%d%d%d)\n",numbits,state>>6,dummy,state,out,out&1,(out>>1)&1,(out>>2)&1); printf("numbits %d, input %d, outbit %d: %d -> %d (%d%d%d)\n",numbits,state>>6,dummy,state,out,out&1,(out>>1)&1,(out>>2)&1);
dummy+=3; dummy+=3;
#endif //DEBUG_CCODE #endif //DEBUG_CCODE
} }
} }
// now code 8-bit CRC for UCI // now code 8-bit CRC for UCI
if (add_crc == 1) { if (add_crc == 1) {
c = (uint8_t)(crc>>24); c = (uint8_t)(crc>>24);
// for (shiftbit = 0; (shiftbit<8);shiftbit++) { // for (shiftbit = 0; (shiftbit<8);shiftbit++) {
...@@ -185,22 +171,18 @@ ccodelte_encode (int32_t numbits, ...@@ -185,22 +171,18 @@ ccodelte_encode (int32_t numbits,
} }
out = ccodelte_table[state]; out = ccodelte_table[state];
*outPtr++ = out & 1; *outPtr++ = out & 1;
*outPtr++ = (out>>1)&1; *outPtr++ = (out>>1)&1;
*outPtr++ = (out>>2)&1; *outPtr++ = (out>>2)&1;
#ifdef DEBUG_CCODE #ifdef DEBUG_CCODE
printf("crc bit %d input %d, outbit %d: %d -> %d (%d)\n",shiftbit,state>>6,dummy,state,out,ccodelte_table[state]); printf("crc bit %d input %d, outbit %d: %d -> %d (%u)\n",shiftbit,state>>6,dummy,state,out,ccodelte_table[state]);
dummy+=3; dummy+=3;
#endif //DEBUG_CCODE #endif //DEBUG_CCODE
} }
} }
// now code 16-bit CRC for DCI // now code 16-bit CRC for DCI
if (add_crc == 2) { if (add_crc == 2) {
c16 = (uint16_t)(crc>>16); c16 = (uint16_t)(crc>>16);
// for (shiftbit = 0; (shiftbit<16);shiftbit++) { // for (shiftbit = 0; (shiftbit<16);shiftbit++) {
...@@ -212,16 +194,13 @@ ccodelte_encode (int32_t numbits, ...@@ -212,16 +194,13 @@ ccodelte_encode (int32_t numbits,
} }
out = ccodelte_table[state]; out = ccodelte_table[state];
*outPtr++ = out & 1; *outPtr++ = out & 1;
*outPtr++ = (out>>1)&1; *outPtr++ = (out>>1)&1;
*outPtr++ = (out>>2)&1; *outPtr++ = (out>>2)&1;
#ifdef DEBUG_CCODE #ifdef DEBUG_CCODE
printf("crc bit %d input %d, outbit %d: %d -> %d (%d)\n",shiftbit,state>>6,dummy,state,out,ccodelte_table[state]); printf("crc bit %d input %d, outbit %d: %d -> %d (%u)\n",shiftbit,state>>6,dummy,state,out,ccodelte_table[state]);
dummy+=3; dummy+=3;
#endif //DEBUG_CCODE #endif //DEBUG_CCODE
} }
} }
} }
...@@ -238,8 +217,7 @@ ccodelte_encode (int32_t numbits, ...@@ -238,8 +217,7 @@ ccodelte_encode (int32_t numbits,
/* Basic code table initialization for constraint length 7 */ /* Basic code table initialization for constraint length 7 */
/* Input in MSB, followed by state in 6 LSBs */ /* Input in MSB, followed by state in 6 LSBs */
void ccodelte_init(void) void ccodelte_init(void) {
{
unsigned int i, j, k, sum; unsigned int i, j, k, sum;
for (i = 0; i < 128; i++) { for (i = 0; i < 128; i++) {
...@@ -260,8 +238,7 @@ void ccodelte_init(void) ...@@ -260,8 +238,7 @@ void ccodelte_init(void)
} }
/* Input in LSB, followed by state in 6 MSBs */ /* Input in LSB, followed by state in 6 MSBs */
void ccodelte_init_inv(void) void ccodelte_init_inv(void) {
{
unsigned int i, j, k, sum; unsigned int i, j, k, sum;
for (i = 0; i < 128; i++) { for (i = 0; i < 128; i++) {
...@@ -281,8 +258,7 @@ void ccodelte_init_inv(void) ...@@ -281,8 +258,7 @@ void ccodelte_init_inv(void)
} }
} }
void ccodedab_init(void) void ccodedab_init(void) {
{
unsigned int i, j, k, sum; unsigned int i, j, k, sum;
for (i = 0; i < 128; i++) { for (i = 0; i < 128; i++) {
...@@ -303,8 +279,7 @@ void ccodedab_init(void) ...@@ -303,8 +279,7 @@ void ccodedab_init(void)
} }
/* Input in LSB, followed by state in 6 MSBs */ /* Input in LSB, followed by state in 6 MSBs */
void ccodedab_init_inv(void) void ccodedab_init_inv(void) {
{
unsigned int i, j, k, sum; unsigned int i, j, k, sum;
for (i = 0; i < 128; i++) { for (i = 0; i < 128; i++) {
...@@ -334,21 +309,15 @@ void ccodedab_init_inv(void) ...@@ -334,21 +309,15 @@ void ccodedab_init_inv(void)
#ifdef CCODE_MAIN #ifdef CCODE_MAIN
#include <stdio.h> #include <stdio.h>
main() main() {
{
unsigned char test[] = "Thebigredfox"; unsigned char test[] = "Thebigredfox";
unsigned char output[512], *inPtr, *outPtr; unsigned char output[512], *inPtr, *outPtr;
unsigned int i; unsigned int i;
test[0] = 128; test[0] = 128;
test[1] = 0; test[1] = 0;
ccodelte_init(); ccodelte_init();
inPtr = test; inPtr = test;
outPtr = output; outPtr = output;
ccodelte_encode(21, inPtr, outPtr); ccodelte_encode(21, inPtr, outPtr);
for (i = 0; i < 21*3; i++) printf("%x ", output[i]); for (i = 0; i < 21*3; i++) printf("%x ", output[i]);
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -1438,8 +1438,6 @@ uint8_t rx_pcfich(LTE_DL_FRAME_PARMS *frame_parms, ...@@ -1438,8 +1438,6 @@ uint8_t rx_pcfich(LTE_DL_FRAME_PARMS *frame_parms,
void generate_phich_reg_mapping(LTE_DL_FRAME_PARMS *frame_parms); void generate_phich_reg_mapping(LTE_DL_FRAME_PARMS *frame_parms);
void init_transport_channels(uint8_t);
void generate_RIV_tables(void); void generate_RIV_tables(void);
/*! /*!
......
This diff is collapsed.
This diff is collapsed.
File mode changed from 100755 to 100644
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
This diff is collapsed.
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
File mode changed from 100755 to 100644
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
File mode changed from 100755 to 100644
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
File mode changed from 100755 to 100644
This diff is collapsed.
File mode changed from 100755 to 100644
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
File mode changed from 100755 to 100644
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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