Commit 6d385a81 authored by Raphael Defosseux's avatar Raphael Defosseux

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

 Conflicts were resolved on :
   # Trivial:
   openair2/LAYER2/MAC/eNB_scheduler_RA.c
   openair2/LAYER2/PDCP_v10.1.0/pdcp.c
   # issue416_nfapicleanup version was taken
   openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c
   # not so trivial --> to be checked
   targets/RT/USER/lte-softmodem.c
   targets/RT/USER/lte-uesoftmodem.c
parents 99e9da75 118418cd
# vim swp
*.swp
# log and exec file
log/
lte_build_oai/
targets/bin/
cmake_targets/nas_sim_tools/build/
......@@ -17,7 +17,7 @@ openairinterface5g
├── maketags : Script to generate emacs tags
├── nfapi : Contains the NFAPI code. A local Readme file provides more details.
├── 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.
├── openair2 : 3GPP LTE Rel-10 RLC/MAC/PDCP/RRC/X2AP implementation.
├── COMMON
├── DOCS
├── ENB_APP
......
......@@ -133,6 +133,7 @@ pipeline {
script {
def message = "OAI " + JOB_NAME + " build (" + BUILD_ID + "): Merge Conflicts -- Cannot perform CI"
addGitLabMRComment comment: message
currentBuild.result = 'FAILURE'
}
}
}
......@@ -283,6 +284,11 @@ pipeline {
}
}
post {
failure {
script {
currentBuild.result = 'FAILURE'
}
}
always {
script {
dir ('archives') {
......@@ -392,7 +398,7 @@ pipeline {
}
}
}
stage ("Test FDD - Band 7 - B210") {
stage ("Test MONOLITHIC - FDD - Band 7 - B210") {
steps {
script {
if ("MERGE".equals(env.gitlabActionType)) {
......@@ -443,7 +449,7 @@ pipeline {
}
}
}
stage ("Test TDD - Band 40 - B210") {
stage ("Test MONOLITHIC - TDD - Band 40 - B210") {
steps {
script {
if ("MERGE".equals(env.gitlabActionType)) {
......@@ -647,6 +653,57 @@ pipeline {
}
}
}
stage ("Test OAI UE Sniffing - FDD - Band 20 - B200") {
steps {
script {
if ("MERGE".equals(env.gitlabActionType)) {
//gitlabCommitStatus(name: "Test-OAI-UE-FDD-Band20") {
build job: 'UE-CI-FDD-Band20-B200',
parameters: [
string(name: 'eNB_Repository', value: String.valueOf(GIT_URL)),
string(name: 'eNB_Branch', value: String.valueOf(env.gitlabSourceBranch)),
string(name: 'eNB_CommitID', value: String.valueOf(env.gitlabMergeRequestLastCommit)),
booleanParam(name: 'eNB_mergeRequest', value: true),
string(name: 'eNB_TargetBranch', value: String.valueOf(env.gitlabTargetBranch))
]
//}
} else {
//gitlabCommitStatus(name: "Test-OAI-UE-FDD-Band20") {
build job: 'UE-CI-FDD-Band20-B200',
parameters: [
string(name: 'eNB_Repository', value: String.valueOf(GIT_URL)),
string(name: 'eNB_Branch', value: String.valueOf(GIT_BRANCH)),
string(name: 'eNB_CommitID', value: String.valueOf(GIT_COMMIT)),
booleanParam(name: 'eNB_mergeRequest', value: false)
]
//}
}
}
}
post {
// In case of any non-success, we are retrieving the HTML report of the last completed
// slave job.
// The only drop-back is that we may retrieve the HTML report of a previous build
always {
script {
if (!fileExists('test_results-UE-CI-FDD-Band20-B200.html')) {
copyArtifacts(projectName: 'UE-CI-FDD-Band20-B200',
filter: 'test_results*.html',
selector: lastCompleted())
if (fileExists('test_results-UE-CI-FDD-Band20-B200.html')) {
sh "sed -i -e 's#TEMPLATE_BUILD_TIME#${JOB_TIMESTAMP}#' test_results-UE-CI-FDD-Band20-B200.html"
archiveArtifacts artifacts: 'test_results-UE-CI-FDD-Band20-B200.html'
}
}
}
}
failure {
script {
currentBuild.result = 'FAILURE'
}
}
}
}
}
post {
always {
......
This diff is collapsed.
......@@ -111,7 +111,7 @@ function build_on_vm {
fi
echo "############################################################"
echo "Copying GIT repo into VM ($VM_NAME)"
echo "Copying GIT repo into VM ($VM_NAME)"
echo "############################################################"
if [[ "$VM_NAME" == *"-flexran-rtc"* ]]
then
......
......@@ -207,18 +207,18 @@ MACRLCs = (
phy_test_mode = 0;
puSch10xSnr = 200;
puCch10xSnr = 200;
}
}
);
L1s = (
{
num_cc = 1;
tr_n_preference = "local_mac";
}
}
);
RUs = (
{
{
local_rf = "yes"
nb_tx = 2
nb_rx = 2
......@@ -229,7 +229,7 @@ RUs = (
max_rxgain = 115;
eNB_instances = [0];
}
);
);
THREAD_STRUCT = (
{
......@@ -267,4 +267,3 @@ log_config :
rrc_log_level ="info";
rrc_log_verbosity ="medium";
};
......@@ -205,18 +205,18 @@ MACRLCs = (
phy_test_mode = 0;
puSch10xSnr = 200;
puCch10xSnr = 200;
}
}
);
L1s = (
{
{
num_cc = 1;
tr_n_preference = "local_mac";
}
}
);
RUs = (
{
{
local_rf = "yes"
nb_tx = 1
nb_rx = 1
......@@ -228,7 +228,7 @@ RUs = (
eNB_instances = [0];
}
);
);
THREAD_STRUCT = (
{
......@@ -266,4 +266,3 @@ NETWORK_CONTROLLER :
rrc_log_level ="info";
rrc_log_verbosity ="medium";
};
......@@ -7,7 +7,7 @@ eNBs =
{
# real_time choice in {hard, rt-preempt, no}
real_time = "no";
////////// Identification parameters:
eNB_ID = 0xe00;
......@@ -207,18 +207,18 @@ MACRLCs = (
phy_test_mode = 0;
puSch10xSnr = 160;
puCch10xSnr = 160;
}
}
);
L1s = (
{
{
num_cc = 1;
tr_n_preference = "local_mac";
}
}
);
RUs = (
{
{
local_if_name = "lo";
remote_address = "127.0.0.2";
local_address = "127.0.0.1";
......@@ -234,7 +234,7 @@ RUs = (
att_rx = 0;
eNB_instances = [0];
}
);
);
THREAD_STRUCT = (
{
......@@ -272,4 +272,3 @@ NETWORK_CONTROLLER :
rrc_log_level ="info";
rrc_log_verbosity ="medium";
};
......@@ -7,7 +7,7 @@ eNBs =
{
# real_time choice in {hard, rt-preempt, no}
real_time = "no";
////////// Identification parameters:
eNB_ID = 0xe00;
......@@ -207,18 +207,18 @@ MACRLCs = (
phy_test_mode = 0;
puSch10xSnr = 160;
puCch10xSnr = 160;
}
}
);
L1s = (
{
{
num_cc = 1;
tr_n_preference = "local_mac";
}
}
);
RUs = (
{
{
local_if_name = "lo";
remote_address = "127.0.0.2";
local_address = "127.0.0.1";
......@@ -234,7 +234,7 @@ RUs = (
att_rx = 0;
eNB_instances = [0];
}
);
);
THREAD_STRUCT = (
{
......@@ -272,4 +272,3 @@ NETWORK_CONTROLLER :
rrc_log_level ="info";
rrc_log_verbosity ="medium";
};
......@@ -7,7 +7,7 @@ eNBs =
{
# real_time choice in {hard, rt-preempt, no}
real_time = "no";
////////// Identification parameters:
eNB_ID = 0xe00;
......@@ -207,18 +207,18 @@ MACRLCs = (
phy_test_mode = 0;
puSch10xSnr = 160;
puCch10xSnr = 160;
}
}
);
L1s = (
{
{
num_cc = 1;
tr_n_preference = "local_mac";
}
}
);
RUs = (
{
{
local_if_name = "lo";
remote_address = "127.0.0.2";
local_address = "127.0.0.1";
......@@ -234,7 +234,7 @@ RUs = (
att_rx = 0;
eNB_instances = [0];
}
);
);
THREAD_STRUCT = (
{
......@@ -272,4 +272,3 @@ NETWORK_CONTROLLER :
rrc_log_level ="info";
rrc_log_verbosity ="medium";
};
......@@ -42,4 +42,3 @@ log_config = {
rrc_log_level ="error";
rrc_log_verbosity ="medium";
};
......@@ -42,4 +42,3 @@ log_config = {
rrc_log_level ="error";
rrc_log_verbosity ="medium";
};
......@@ -17,21 +17,21 @@ log_config = {
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;
}
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
......@@ -40,5 +40,5 @@ RUs = (
bands = [7,38,42,43];
max_pdschReferenceSignalPower = -27;
max_rxgain = 125;
}
}
);
......@@ -24,26 +24,26 @@
// section for "valid" memory leaks: the related functions are allocators and
// the caller is responsible of freeing the memory. cppcheck has a mechanism
// to check more accuretaly this, by defining callers responsible of freeing
// but tools like valgring might be more suitable
// but tools like valgring might be more suitable
//
//-----------------------------------------------------------------------------
// suppress error about keysP memory leak, free must be done by calling func
// suppress error about keysP memory leak, free must be done by calling func
memleak:common/utils/hashtable/obj_hashtable.c
//-----------------------------------------------------------------------------
// suppress error about keys memory leak, free must be done by calling func
// suppress error about keys memory leak, free must be done by calling func
memleak:openair2/UTIL/OMG/omg_hashtable.c
//-----------------------------------------------------------------------------
// suppress error about data memory leak. This is the buffer where
// suppress error about data memory leak. This is the buffer where
// _emm_as_encode function creates the encoded buffer
//
memleak:openair3/NAS/UE/EMM/SAP/emm_as.c
//-----------------------------------------------------------------------------
//*****************************************************************************
// section for files not used in oai exec's included in CI.
// section for files not used in oai exec's included in CI.
// Possibly candidates for removal otherwise should be documented and updated
// for project rules enforcement
// ----------------------------------------------------------------------------
// likely sources for test programs, maintained?
// likely sources for test programs, maintained?
invalidPrintfArgType_sint:openair1/PHY/CODING/TESTBENCH/ltetest.c
memleak:openair1/PHY/CODING/TESTBENCH/ltetest.c
invalidPrintfArgType_sint:openair1/PHY/CODING/TESTBENCH/pdcch_test.c
......@@ -72,14 +72,14 @@ uninitvar:openair2/UTIL/OTG/otg_rx_socket.c
// iteration of the loop.
nullPointer:common/utils/T/local_tracer.c:243
//-----------------------------------------------------------------------------
// once again cppcheck is not to understand that fds is initialized in the
// once again cppcheck does not understand that fds is initialized in the
// first iteration of the loop
nullPointer:common/utils/T/tracer/multi.c:264
nullPointer:common/utils/T/tracer/multi.c:265
//
//*****************************************************************************
//
// True problems we don't know how to fix, Suppression is commented out,
//
// True problems we don't know how to fix, Suppression is commented out,
// as these kind of problem need either to be fixed or can be suppressed
// when fully uderstood
//-----------------------------------------------------------------------------
......@@ -89,13 +89,13 @@ nullPointer:common/utils/T/tracer/multi.c:265
// memleak:nfapi/open-nFAPI/pnf/src/pnf_p7_interface.c
// memleak:nfapi/open-nFAPI/vnf/src/vnf_p7_interface.c
//-----------------------------------------------------------------------------
// may be security_data->kenb.value is released from calling functions. But even
// when, for test, freeing it before returning from emm_proc_security_mode_command
// may be security_data->kenb.value is released from calling functions. But even
// when, for test, freeing it before returning from emm_proc_security_mode_command
// which does the allocation, cppcheck complains. So something might be wrong...
// memleak:openair3/NAS/UE/EMM/SecurityModeControl.c
//-----------------------------------------------------------------------------
// when used, nobody but the original developer can guess if sn_data_cnf is set or not
// cppcheck found that in some cases it is not, code needs cleanup before fixing that...
// cppcheck found that in some cases it is not, code needs cleanup before fixing that...
// uninitvar:openair2/LAYER2/RLC/AM_v9.3.0/rlc_am_status_report.c
//*****************************************************************************
// *INDENT-ON*
This diff is collapsed.
......@@ -264,7 +264,7 @@ case $key in
ARCHIVES_LOC=cppcheck
LOG_PATTERN=cppcheck.xml
NB_PATTERN_FILES=1
BUILD_OPTIONS="--enable=warning --force --xml --xml-version=2 --suppressions-list=ci-scripts/cppcheck_suppressions.list"
BUILD_OPTIONS="--enable=warning --force --xml --xml-version=2 --suppressions-list=ci-scripts/cppcheck_suppressions.list -I common/utils -j4"
NBARGS=$[$NBARGS+256]
shift
;;
......@@ -344,7 +344,7 @@ case $key in
ARCHIVES_LOC=cppcheck
LOG_PATTERN=cppcheck.xml
NB_PATTERN_FILES=1
BUILD_OPTIONS="--enable=warning --force --xml --xml-version=2 --suppressions-list=ci-scripts/cppcheck_suppressions.list"
BUILD_OPTIONS="--enable=warning --force --xml --xml-version=2 --suppressions-list=ci-scripts/cppcheck_suppressions.list -I common/utils -j4"
NBARGS=$[$NBARGS+256]
;;
enb-ethernet)
......
......@@ -65,7 +65,7 @@
<class>Ping</class>
<desc>ping (5MHz - 20 sec)</desc>
<ping_args>-c 20</ping_args>
<ping_packetloss_threshold>50</ping_packetloss_threshold>
<ping_packetloss_threshold>25</ping_packetloss_threshold>
</testCase>
<testCase id="040601">
......@@ -112,7 +112,7 @@
<class>Iperf</class>
<desc>iperf (5MHz - UL/2Mbps/UDP)(30 sec)(unbalanced)</desc>
<iperf_args>-u -b 2M -t 30 -i 1 -R</iperf_args>
<iperf_packetloss_threshold>80</iperf_packetloss_threshold>
<iperf_packetloss_threshold>50</iperf_packetloss_threshold>
<iperf_profile>unbalanced</iperf_profile>
</testCase>
......
......@@ -81,7 +81,7 @@
<class>Ping</class>
<desc>ping (5MHz - 20 sec)</desc>
<ping_args>-c 20</ping_args>
<ping_packetloss_threshold>50</ping_packetloss_threshold>
<ping_packetloss_threshold>25</ping_packetloss_threshold>
</testCase>
<testCase id="040602">
......
......@@ -37,7 +37,7 @@
<Initialize_eNB_args>-O ci-scripts/conf_files/rru.tdd.band40.conf</Initialize_eNB_args>
<eNB_instance>0</eNB_instance>
</testCase>
<testCase id="030125">
<class>Initialize_eNB</class>
<desc>Initialize RCC (TDD/Band40/20MHz/info)</desc>
......
<!--
Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The OpenAirInterface Software Alliance licenses this file to You under
the OAI Public License, Version 1.1 (the "License"); you may not use this file
except in compliance with the License.
You may obtain a copy of the License at
http://www.openairinterface.org/?page_id=698
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
For more information about the OpenAirInterface (OAI) Software Alliance:
contact@openairinterface.org
-->
<testCaseList>
<htmlTabRef>build-tab</htmlTabRef>
<htmlTabName>Build</htmlTabName>
<htmlTabIcon>wrench</htmlTabIcon>
<TestCaseRequestedList>
090101
</TestCaseRequestedList>
<TestCaseExclusionList></TestCaseExclusionList>
<testCase id="090101">
<class>Build_OAI_UE</class>
<desc>Build OAI UE</desc>
<Build_OAI_UE_args>-w USRP --UE</Build_OAI_UE_args>
</testCase>
</testCaseList>
<!--
Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The OpenAirInterface Software Alliance licenses this file to You under
the OAI Public License, Version 1.1 (the "License"); you may not use this file
except in compliance with the License.
You may obtain a copy of the License at
http://www.openairinterface.org/?page_id=698
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
For more information about the OpenAirInterface (OAI) Software Alliance:
contact@openairinterface.org
-->
<testCaseList>
<htmlTabRef>test-10mhz-orange</htmlTabRef>
<htmlTabName>Test-10Mhz-Orange</htmlTabName>
<htmlTabIcon>tasks</htmlTabIcon>
<TestCaseRequestedList>
090102 000001 090109
</TestCaseRequestedList>
<TestCaseExclusionList></TestCaseExclusionList>
<testCase id="090102">
<class>Initialize_OAI_UE</class>
<desc>Initialize OAI UE -- sniffing Orange frequency</desc>
<Initialize_OAI_UE_args>-C 816000000 -r 50 --ue-rxgain 120 --ue-scan-carrier --no-L2-connect</Initialize_OAI_UE_args>
</testCase>
<testCase id="000001">
<class>IdleSleep</class>
<desc>Sleep</desc>
<idle_sleep_time_in_sec>30</idle_sleep_time_in_sec>
</testCase>
<testCase id="090109">
<class>Terminate_OAI_UE</class>
<desc>Terminate OAI UE</desc>
</testCase>
</testCaseList>
<!--
Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The OpenAirInterface Software Alliance licenses this file to You under
the OAI Public License, Version 1.1 (the "License"); you may not use this file
except in compliance with the License.
You may obtain a copy of the License at
http://www.openairinterface.org/?page_id=698
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
For more information about the OpenAirInterface (OAI) Software Alliance:
contact@openairinterface.org
-->
<testCaseList>
<htmlTabRef>test-10mHz-sfr</htmlTabRef>
<htmlTabName>Test-10MHz-SFR</htmlTabName>
<htmlTabIcon>tasks</htmlTabIcon>
<TestCaseRequestedList>
090104 000001 090109
</TestCaseRequestedList>
<TestCaseExclusionList></TestCaseExclusionList>
<testCase id="090104">
<class>Initialize_OAI_UE</class>
<desc>Initialize OAI UE -- sniffing SFR frequency</desc>
<Initialize_OAI_UE_args>-C 806000000 -r 50 --ue-rxgain 120 --ue-scan-carrier --no-L2-connect</Initialize_OAI_UE_args>
</testCase>
<testCase id="000001">
<class>IdleSleep</class>
<desc>Sleep</desc>
<idle_sleep_time_in_sec>30</idle_sleep_time_in_sec>
</testCase>
<testCase id="090109">
<class>Terminate_OAI_UE</class>
<desc>Terminate OAI UE</desc>
</testCase>
</testCaseList>
This diff is collapsed.
......@@ -990,11 +990,11 @@
<pre_exec>$OPENAIR_DIR/cmake_targets/autotests/tools/free_mem.bash</pre_exec>
<pre_exec_args></pre_exec_args>
<main_exec> $OPENAIR_DIR/targets/bin/ulsim.Rel14</main_exec>
<main_exec_args> -BnbRBs=25 -mcs=5 -yN_rx=1 -gchannel=N -xTransmission=1 -snr=6 -wsnrInterrupt=1.0 -e_snr_step=.1 -P -nb_frame=500 -Operf=70
-BnbRBs=25 -mcs=16 -yN_rx=1 -gchannel=N -xTransmission=1 -snr=12 -wsnrInterrupt=1.0 -e_snr_step=.1 -P -nb_frame=500 -Operf=70
-BnbRBs=50 -mcs=5 -yN_rx=1 -gchannel=N -xTransmission=1 -snr=6 -wsnrInterrupt=1.0 -e_snr_step=.1 -P -nb_frame=500 -Operf=70
-BnbRBs=50 -mcs=16 -yN_rx=1 -gchannel=N -xTransmission=1 -snr=12 -wsnrInterrupt=1.0 -e_snr_step=.1 -P -nb_frame=500 -Operf=70
-BnbRBs=100 -mcs=5 -yN_rx=1 -gchannel=N -xTransmission=1 -snr=6 -wsnrInterrupt=1.0 -e_snr_step=.1 -P -nb_frame=500 -Operf=70
<main_exec_args> -BnbRBs=25 -mcs=5 -yN_rx=1 -gchannel=N -xTransmission=1 -snr=6 -wsnrInterrupt=1.0 -e_snr_step=.1 -P -nb_frame=500 -Operf=70
-BnbRBs=25 -mcs=16 -yN_rx=1 -gchannel=N -xTransmission=1 -snr=12 -wsnrInterrupt=1.0 -e_snr_step=.1 -P -nb_frame=500 -Operf=70
-BnbRBs=50 -mcs=5 -yN_rx=1 -gchannel=N -xTransmission=1 -snr=6 -wsnrInterrupt=1.0 -e_snr_step=.1 -P -nb_frame=500 -Operf=70
-BnbRBs=50 -mcs=16 -yN_rx=1 -gchannel=N -xTransmission=1 -snr=12 -wsnrInterrupt=1.0 -e_snr_step=.1 -P -nb_frame=500 -Operf=70
-BnbRBs=100 -mcs=5 -yN_rx=1 -gchannel=N -xTransmission=1 -snr=6 -wsnrInterrupt=1.0 -e_snr_step=.1 -P -nb_frame=500 -Operf=70
-BnbRBs=100 -mcs=16 -yN_rx=1 -gchannel=N -xTransmission=1 -snr=12 -wsnrInterrupt=1.0 -e_snr_step=.1 -P -nb_frame=500 -Operf=70 </main_exec_args>
<tags>ulsim.test1 ulsim.test2 ulsim.test3 ulsim.test4 ulsim.test5 ulsim.test6</tags>
<search_expr_true>"passed"</search_expr_true>
......
This diff is collapsed.
......@@ -102,7 +102,7 @@ check_supported_distribution() {
"ubuntu14.04") return 0 ;;
"fedora24") return 0 ;;
"rhel7") return 0 ;;
"rhel7.6") return 0 ;;
"rhel7.6") return 0 ;;
"centos7") return 0 ;;
esac
return 1
......@@ -639,8 +639,6 @@ check_install_oai_software() {
libidn2-0-dev \
libidn11-dev \
libmysqlclient-dev \
liboctave-dev \
libpgm-dev \
libpython2.7-dev \
libsctp1 \
libsctp-dev \
......@@ -651,7 +649,6 @@ check_install_oai_software() {
libxml2-dev \
libxslt1-dev \
mscgen \
octave \
octave-signal \
openssh-client \
openssh-server \
......@@ -663,7 +660,8 @@ check_install_oai_software() {
pydb \
libyaml-dev \
wget \
libxpm-dev
libxpm-dev \
libboost-all-dev
$SUDO update-alternatives --set "$LAPACK_LIBNAME" "$LAPACK_TARGET"
......@@ -711,8 +709,6 @@ check_install_oai_software() {
libidn2-devel \
libidn-devel \
mariadb-devel \
octave-devel \
openpgm-devel \
lksctp-tools \
lksctp-tools-devel \
openssl-devel \
......@@ -722,8 +718,6 @@ check_install_oai_software() {
libxml2 \
libxml2-devel \
libxslt-devel \
octave \
octave-signal \
openssh-clients \
openssh-server \
openssl \
......@@ -746,7 +740,7 @@ check_install_oai_software() {
libyaml-devel
fi
install_asn1c_from_source
install_asn1c_from_source $1
$SUDO rm -fr /opt/ssh
$SUDO git clone https://gist.github.com/2190472.git /opt/ssh
}
......
......@@ -23,7 +23,7 @@ reset_color="$(tput sgr0)"
function error()
{
echo -e "$red_color"ERROR: "$@""$reset_color"
exit 1
# exit 1
}
function check_sha1()
......@@ -56,11 +56,11 @@ function patch_file()
echo -e "$green_color""patch file $file with $OPENAIR_DIR/cmake_targets/tools/$patch""$reset_color"
patch "$file" "$OPENAIR_DIR/cmake_targets/tools/$patch"
if [ $? -ne 0 ]
then
error "patching of $file with $OPENAIR_DIR/cmake_targets/tools/$patch failed"
fi
# patch "$file" "$OPENAIR_DIR/cmake_targets/tools/$patch"
# if [ $? -ne 0 ]
# then
# error "patching of $file with $OPENAIR_DIR/cmake_targets/tools/$patch failed"
# fi
}
function apply_patches()
......@@ -140,6 +140,22 @@ function patch_s1ap()
esac
}
function patch_f1ap()
{
local directory="$1"
local version="$2"
case "$version" in
R15 )
#nothing to do anymore (fixes went to asn1c)
;;
* )
error unknwon/unhandled F1AP version \'"$version"\'
;;
esac
}
function main()
{
if [ $# -ne 3 ]
......@@ -167,6 +183,9 @@ function main()
S1AP )
patch_s1ap "$directory" "$version"
;;
F1AP )
patch_f1ap "$directory" "$version"
;;
* )
error unknown module "$module"
;;
......
......@@ -2,23 +2,29 @@
function main()
{
mkdir -p $1
cd $1
PROTOCOL_DIR=$1
mkdir -p ${PROTOCOL_DIR}
cd ${PROTOCOL_DIR}
# Because use $* also include directory, so we need shift
shift
#if this script is called with only 2 arguments (so 1 here after the shift), it's for RRC
#(there may be a better way...)
if [ $# -eq 1 ]; then
# There are three types parameter for asn1c
# One is for RRC
# and one is for F1AP
# another is for other protocols
if echo ${PROTOCOL_DIR} | grep -q "RRC"; then
#asn1c does not work well with extension groups, we need the following fix:
# replace [[ by '<name> SEQUENCE {'
# and ]] by '} OPTIONAL'
#<name> is ext<N> with N starting from 1 and incremented at each new [[ ]] just
#following another [[ ]]
#
#this is what the following C program does
#asn1c does not work well with extension groups, we need the following fix:
# replace [[ by '<name> SEQUENCE {'
# and ]] by '} OPTIONAL'
#<name> is ext<N> with N starting from 1 and incremented at each new [[ ]] just
#following another [[ ]]
#
#this is what the following C program does
echo generate asnfix.c
echo generate asnfix.c
cat << EOF > asnfix.c
/* transforms:
......@@ -85,30 +91,34 @@ int main(void)
}
EOF
echo compile asnfix.c
echo compile asnfix.c
gcc -Wall -o asnfix asnfix.c
gcc -Wall -o asnfix asnfix.c
echo run asnfix on $1
echo run asnfix on $1
./asnfix < $1 > fixed_grammar.asn
./asnfix < $1 > fixed_grammar.asn
rm -f asnfix asnfix.c
rm -f asnfix asnfix.c
echo done with asnfix
echo done with asnfix
echo running asn1c
echo running asn1c
asn1c -gen-PER -fcompound-names fixed_grammar.asn 2>&1 | grep -v -- '->' | grep -v '^Compiled' |grep -v sample
asn1c -gen-PER -fcompound-names -no-gen-example fixed_grammar.asn 2>&1 | grep -v -- '->' | grep -v '^Compiled' |grep -v sample
rm -f fixed_grammar.asn
rm -f fixed_grammar.asn
echo asn1c done
echo asn1c done
elif echo ${PROTOCOL_DIR} | grep -q "F1AP"; then
asn1c -gen-PER -fcompound-names -no-gen-example -findirect-choice -fno-include-deps $* 2>&1 | grep -v -- '->' | grep -v '^Compiled' |grep -v sample
else
asn1c -gen-PER -fcompound-names $* 2>&1 | grep -v -- '->' | grep -v '^Compiled' |grep -v sample
asn1c -gen-PER -fcompound-names -no-gen-example $* 2>&1 | grep -v -- '->' | grep -v '^Compiled' |grep -v sample
fi
awk '
......
......@@ -3,11 +3,11 @@ GENERATED_FULL_DIR=$1
shift
ASN1_SOURCE_DIR=$1
shift
export ASN1C_PREFIX=$1
export ASN1C_PREFIX=$1
shift
options=$*
done_flag="$GENERATED_FULL_DIR"/done
if [ "$done_flag" -ot $ASN1_SOURCE_DIR ] ; then
if [ "$done_flag" -ot $ASN1_SOURCE_DIR ] ; then
rm -f "$GENERATED_FULL_DIR"/${ASN1C_PREFIX}*.c "$GENERATED_FULL_DIR"/${ASN1C_PREFIX}*.h
mkdir -p "$GENERATED_FULL_DIR"
asn1c -pdu=all -fcompound-names -gen-PER -no-gen-OER -no-gen-example $options -D $GENERATED_FULL_DIR $ASN1_SOURCE_DIR |& egrep -v "^Copied|^Compiled" | sort -u
......
# config module source files
![configmodule_srcdir](/uploads/fdc3e96011fd5592440900dfa05b4701/configmodule_srcdir.png)
![configmodule_srcdir](/uploads/fdc3e96011fd5592440900dfa05b4701/configmodule_srcdir.png)
# config module components
![configmodule_components](/uploads/54f8a3953d5ee53717cd9a3b71f85c68/configmodule_components.png)
[Configuration module home](../config.md)
\ No newline at end of file
[Configuration module home](../config.md)
The configuration module objectives are
The configuration module objectives are
1. Allow easy parameters management in oai, helping the development of a flexible, modularized and fully configurable softmodem.
1. Use a common configuration API in all oai modules
1. Allow development of alternative configuration sources without modifying the oai code. Today the only delivered configuration source is the libconfig format configuration file.
1. Allow development of alternative configuration sources without modifying the oai code. Today the only delivered configuration source is the libconfig format configuration file.
As a developer you may need to look at these sections:
* [add parameters in an existing section](devusage/addaparam.md)
* [add a parameter set, in a new section](devusage/addparamset.md)
* [configuration module API](devusage/api.md)
* [configuration module public structures](devusage/struct.md)
* [configuration module API](devusage/api.md)
* [configuration module public structures](devusage/struct.md)
Whatever your need is, configuration module usage examples can be found in oai sources:
* complex example, using all the configuration module functionalities, including parameter checking:
Whatever your need is, configuration module usage examples can be found in oai sources:
* complex example, using all the configuration module functionalities, including parameter checking:
[NB-IoT configuration code](https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/openair2/ENB_APP/NB_IoT_config.c) and [NB-IoT configuration include file](https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/openair2/ENB_APP/NB_IoT_paramdef.h)
* very simple example, just reading a parameter set corresponding to a dedicated section: the telnetsrv_autoinit function in [common/utils/telnetsrv/telnetsrv.c, around line 726](https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/common/utils/telnetsrv/telnetsrv.c#L726)
* an example with run-time definition of parameters, in the logging sub-system: the log_getconfig function at the top of [openair2/UTIL/LOG/log.c](https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/openair2/UTIL/LOG/log.c)
......
To add a new parameter in an existing section you insert an item in a `paramdef_t` array, which describes the parameters to be read in the existing `config_get` call. You also need to increment the numparams argument.
To add a new parameter in an existing section you insert an item in a `paramdef_t` array, which describes the parameters to be read in the existing `config_get` call. You also need to increment the numparams argument.
existing code:
existing code:
```c
unsigned int varopt1;
paramdef_t someoptions[] = {
......@@ -11,10 +11,10 @@ paramdef_t someoptions[] = {
{"opt1", "<help opt1>", 0, uptr:&varopt1, defuintval:0, TYPE_UINT, 0 },
};
config_get( someoptions,sizeof(someoptions)/sizeof(paramdef_t),"somesection");
config_get( someoptions,sizeof(someoptions)/sizeof(paramdef_t),"somesection");
```
new code:
new code:
```c
unsigned int varopt1;
......@@ -31,7 +31,7 @@ paramdef_t someoptions[] = {
{"opt2", "<help opt2>", 0, strptr:&varopt2,defstrval:"",TYPE_STRING,0 },
};
config_get( someoptions,sizeof(someoptions)/sizeof(paramdef_t),"somesection");
config_get( someoptions,sizeof(someoptions)/sizeof(paramdef_t),"somesection");
```
......@@ -57,10 +57,10 @@ The configuration module provides a mechanism to check the parameter value read
A `checkedparam_t` structure array provides the parameter verification procedures:
```c
/*
/*
definition of the verification to be done on param opt1 and opt2.
opt1 is an integer option we must be set to 0,2,3,4 or 7 in the
config source.
config source.
if opt1 is set to 0 in the config file, it will be set to 1, etc
opt2 is C string option with the authorize values "zero","oneThird","twoThird","one"
*/
......@@ -82,5 +82,5 @@ for(int i=0 ; i < sizeof(someoptions)/sizeof(paramdesc_t) ; i ++) {
```
When you need a specific verification algorithm, you can provide your own verification function and use it in place of the available ones, in the `checkedparam_t` union. If no existing structure definition match your need, you can enhance the configuration module. You then have to add a new verification function in https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/common/config/config_userapi.c and add a new structure definition in the `checkedparam_t` type defined in https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/common/config/config_paramdesc.h
[Configuration module developer main page](../../config/devusage.md)
[Configuration module developer main page](../../config/devusage.md)
[Configuration module home](../../config.md)
The configuration module maps a configuration file section to a `paramdef_t` structure array. One `config_get` call can be used to return the values of all the parameters described in the `paramdef_t` array.
Retrieving a single occurence of a parameter set ( a group in the libconfig terminology) is just a two steps task:
1. describe the parameters in a `paramdef_t` array
1. call the `config_get` function
1. call the `config_get` function
[config_get example](../../config/devusage/addaparam.md)
......@@ -30,19 +30,19 @@ NB-IoT_MACRLCs =
);
```
The configuration module provides the `config_getlist` call to support lists of group of parameters. Below is a commented code example, using the config_getlist call.
The configuration module provides the `config_getlist` call to support lists of group of parameters. Below is a commented code example, using the config_getlist call.
```c
/* name of section containing the list */
#define NBIOT_MACRLCLIST_CONFIG_STRING "NB-IoT_MACRLCs"
/*
/*
The following macro define the parameters names, as used in the
configuration file
*/
#define CONFIG_STRING_MACRLC_CC "num_cc"
*/
#define CONFIG_STRING_MACRLC_CC "num_cc"
.....
#define CONFIG_MACRLC_S_PORTD "remote_s_portd"
#define CONFIG_MACRLC_S_PORTD "remote_s_portd"
/*
now define a macro which will be used to initialize the NbIoT_MacRLC_Params
......@@ -51,16 +51,16 @@ configuration file
module allocate the memory for the parameters values.
*/
/*------------------------------------------------------------------------------------------------------------*/
/* optname helpstr paramflags XXXptr defXXXval type numelt */
/* optname helpstr paramflags XXXptr defXXXval type numelt */
/*------------------------------------------------------------------------------------------------------------*/
#define MACRLCPARAMS_DESC { \
{CONFIG_STRING_MACRLC_CC, NULL, 0, uptr:NULL, defintval:1, TYPE_UINT, 0}, \
............. \
{CONFIG_MACRLC_S_PORTD, NULL, 0, uptr:NULL, defintval:50021, TYPE_UINT, 0}, \
}
}
/*
/*
the following macros define the indexes used to access the NbIoT_MacRLC_Params array
items. They must be maintained consistent with the previous MACRLCPARAMS_DESC macro
which is used to initialize the NbIoT_MacRLC_Params variable
......@@ -72,60 +72,60 @@ which is used to initialize the NbIoT_MacRLC_Params variable
void RCconfig_NbIoTmacrlc(void) {
/*
define and initialize the array of paramdef_t structures describing the groups of
parameters we want to read. It will be passed as the second argument of the
parameters we want to read. It will be passed as the second argument of the
config_getlist call, which will use it as an input only argument.
*/
paramdef_t NbIoT_MacRLC_Params[] = MACRLCPARAMS_DESC;
/*
/*
now define and initialize a paramlist_def_t structure which will be passed
to the config_getlist call. The first field is the only one to be initialized
it contains the name of the section to be read.
it contains the name of the section to be read.
that section contains the list of group of parameters.
The two other fields are output parameters used to return respectively
a pointer to a two dimensional array of paramdef_t structures pointers, and the
a pointer to a two dimensional array of paramdef_t structures pointers, and the
number of items in the list of groups (size of first dimension, the second one
being the number of parameters in each group.
*/
*/
paramlist_def_t NbIoT_MacRLC_ParamList = {NBIOT_MACRLCLIST_CONFIG_STRING,NULL,0};
/*
the config_getlist will allocate the second field of the paramlist_def_t structure, a
two dimensional array of paramdef_t pointers. In each param_def item it will allocate
/*
the config_getlist will allocate the second field of the paramlist_def_t structure, a
two dimensional array of paramdef_t pointers. In each param_def item it will allocate
the value pointer and set the value to what it will get from the config source. The
numelt field of the paramlist_def_t structure will be set to the number of groups of
parameters in the list.
in this example the last argument of config_getlist is unused, it may contain a
character string, used as a prefix for the section name. It has to be specified when the
list to be read is under another section.
*/
*/
config_getlist( &NbIoT_MacRLC_ParamList,NbIoT_MacRLC_Params,
sizeof(NbIoT_MacRLC_Params)/sizeof(paramdef_t),
sizeof(NbIoT_MacRLC_Params)/sizeof(paramdef_t),
NULL);
/*
/*
start a loop in the nuber of groups in the list, the numelt field of the
paramlist_def_t structure has been set in the config_getlist call
*/
for (j=0 ; j<NbIoT_MacRLC_ParamList.numelt ; j++) {
..........
/* access the MACRLC_REMOTE_S_PORTD parameter in the j ieme group of the list */
RC.nb_iot_mac[j]->eth_params_s.remote_portd =
RC.nb_iot_mac[j]->eth_params_s.remote_portd =
*(NbIoT_MacRLC_ParamList.paramarray[j][MACRLC_REMOTE_S_PORTD_IDX].iptr);
............
} // MacRLC_ParamList.numelt > 0
}
```
```
[Configuration module developer main page](../../config/devusage.md)
[Configuration module developer main page](../../config/devusage.md)
[Configuration module home](../../config.md)
......@@ -25,14 +25,14 @@ int config_get(paramdef_t *params,int numparams, char *prefix)
- `PARAMFLAG_DISABLECMDLINE`: parameter cannot be modified via the command line
- `PARAMFLAG_DONOTREAD`: ignore the parameter, can be used at run-time, to alter a pre-defined `paramdef_t` array which is used in several `config_get` or/and `config_getlist` calls.
- `PARAMFLAG_NOFREE`: do not free the memory possibly allocated by the config module to store the value of the parameter. Default behavior is for the config module to free the memory it has allocated when the `config_end` function is called.
- `PARAMFLAG_BOOL`: Only relevant for integer types. tell the config module that when processing the command line, the corresponding option can be specified without any arggument and that in this case it must set the value to 1.
- `PARAMFLAG_BOOL`: Only relevant for integer types. tell the config module that when processing the command line, the corresponding option can be specified without any arggument and that in this case it must set the value to 1.
* `params` is also used as an output parameter, `< XXX >ptr >` field is used by the config module to store the value it has read. The following bits can possibly be set in the `paramflags` mask after the call:
- `PARAMFLAG_MALLOCINCONFIG`: memory has been allocated for the ` < XXX >ptr > ` field
- `PARAMFLAG_PARAMSET`: parameter has been found in the config source, it is not set to default value.
- `PARAMFLAG_PARAMSET`: parameter has been set to its default value
* `numparams` is the number of entries in the params array
* `prefix` is a character string to be appended to the parameters name, it defines the parameters position in the configuration file hierarchy (the section name in libconfig terminology).
* `prefix` is a character string to be appended to the parameters name, it defines the parameters position in the configuration file hierarchy (the section name in libconfig terminology).
* The returned value is the number of parameters which have been assigned a value or -1 if a severe error occured
```c
......@@ -42,8 +42,8 @@ int config_libconfig_getlist(paramlist_def_t *ParamList, paramdef_t *params, int
* Calls the `config_<config source>_get` function for each list occurrence
* `params` points to an array of `paramdef_t` structures which describes the parameters in each occurrence of the list
* `ParamList` points to a structure, where `paramarray` field points to an array of `paramdef_t` structure, allocated by the function. It is used to return the values of the parameters.
* The returned value is the number of occurrences in the list or -1 in case of severe error
* The returned value is the number of occurrences in the list or -1 in case of severe error
[Configuration module developer main page](../../config/devusage.md)
[Configuration module developer main page](../../config/devusage.md)
[Configuration module home](../../config.md)
......@@ -10,11 +10,11 @@ It is defined in include file [ common/config/config_paramdesc.h ](https://gitla
| `type` | Supported parameter types are defined as integer macros. Supported simple types are `TYPE_STRING`, parameter value is returned in `strptr` field, `TYPE_INT8` `TYPE_UINT8` `TYPE_INT16` `TYPE_UINT16` `TYPE_INT32` `TYPE_UINT32` `TYPE_INT64` `TYPE_UINT64`, parameter value is returned in the corresponding uXptr or iXptr, `TYPE_MASK`, value is returned in `u32ptr`, `TYPE_DOUBLE` value is returned in `dblptr`, `TYPE_IPV4ADDR` value is returned in binary, network bytes order in `u32ptr` field. `TYPE_STRINGLIST`, `TYPE_INTARRAY` and `TYPE_UINTARRAY` are multiple values types. Multiple values are returned in respectively, `strlistptr`, `iptr` and `uptr` fields which then point to arrays. The `numelt` field gives the number of item in the array. | I |
| `numelt` | For `TYPE_STRING` where `strptr` points to a preallocated string, this field must contain the size in bytes of the available memory. For all multiple values types, this field contains the number of values in the value field.| I/O |
| `chkPptr` | possible pointer to the structure containing the info used to check parameter values | I |
| `processedvalue` | When `chkPptr` is not `ǸULL`, is used to return a value, computed from the original parameter, as read from the configuration source. | O |
| `processedvalue` | When `chkPptr` is not `ǸULL`, is used to return a value, computed from the original parameter, as read from the configuration source. | O |
# `paramlist_def_t`structure
It is defined in include file [ common/config/config_paramdesc.h ](https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/common/config/config_paramdesc.h#L160).
It is used as an argument to `config_getlist` calls, to get values of multiple occurrences of group of parameters.
It is defined in include file [ common/config/config_paramdesc.h ](https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/common/config/config_paramdesc.h#L160).
It is used as an argument to `config_getlist` calls, to get values of multiple occurrences of group of parameters.
| Fields | Description | I/O |
|:-----------|:------------------------------------------------------------------|----:|
......@@ -23,11 +23,11 @@ It is used as an argument to `config_getlist` calls, to get values of multiple o
| `numelt` | Number of items in the `paramarray` field | O |
# `checkedparam_t` union
It is defined in include file [ common/config/config_paramdesc.h ](https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/common/config/config_paramdesc.h#L62).
It is defined in include file [ common/config/config_paramdesc.h ](https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/common/config/config_paramdesc.h#L62).
This union of structures is used to provide a parameter checking mechanism. Each `paramdef_t` instance may include a pointer to a `checkedparam_t`structure which is then used by the configuration module to check the value it got from the config source.
Each structure in the union provides one parameter verification method, which returns `-1` when the verification fails. Currently the following structures are defined in the `checkedparam_t` union:
| structure name | Description |
| structure name | Description |
|:-----------|:------------------------------------------------------------------|----:|
| `s1` | check an integer against a list of authorized values |
| `s1a` | check an integer against a list of authorized values and set the parameter value to another integer depending on the read value|
......@@ -40,14 +40,14 @@ each of these structures provide the required fields to perform the specified pa
The configuration module provides an implementation of the functions to be used to check parameters, qs described below.
## `s1` structure
| field | Description |
| field | Description |
|:-----------|:------------------------------------------------------------------|
| `f1` | pointer to the checking function. Initialize to `config_check_intval` to use the config module implementation |
| `okintval` | array of `CONFIG_MAX_NUMCHECKVAL` integers containing the authorized values |
| `num_okintval` | number of used values in `okintval` |
## `s1a` structure
| field | Description |
| field | Description |
|:-----------|:------------------------------------------------------------------|
| `f1a` | pointer to the checking function. Initialize to `config_check_modify_integer` to use the config module implementation |
| `okintval` | array of `CONFIG_MAX_NUMCHECKVAL` integers containing the authorized values |
......@@ -55,13 +55,13 @@ The configuration module provides an implementation of the functions to be used
| `num_okintval` | number of used values in `okintval` and `setintval` |
## `s2` structure
| field | Description |
| field | Description |
|:-----------|:------------------------------------------------------------------|
| `f2` | pointer to the checking function. Initialize to `config_check_intrange` to use the config module implementation |
| `okintrange` | array of 2 integers containing the min and max values for the parameter |
## `s3` structure
| field | Description |
| field | Description |
|:-----------|:------------------------------------------------------------------|
| `f3` | pointer to the checking function. Initialize to `config_check_strval` to use the config module implementation |
| `okstrval` | array of `CONFIG_MAX_NUMCHECKVAL` C string pointers containing the authorized values |
......@@ -69,7 +69,7 @@ The configuration module provides an implementation of the functions to be used
## `s3a` structure
| field | Description |
| field | Description |
|:-----------|:------------------------------------------------------------------|
| `f3a` | pointer to the checking function. Initialize to `config_checkstr_assign_integer` to use the config module implementation |
| `okstrval` | array of `CONFIG_MAX_NUMCHECKVAL` C string pointers containing the authorized values |
......@@ -77,9 +77,9 @@ The configuration module provides an implementation of the functions to be used
| `num_okstrval` | number of used values in `okintval` and `setintval` |
## `s4` and `s5` structures
| field | Description |
| field | Description |
|:-----------|:------------------------------------------------------------------|
| `f4` or `f5` | pointer to the checking function. they are generic structures to be used when no existing structure provides the required parameter verification. `f4` takes one argument, the `paramdef_t` structure corresponding to the parameter to be checked (`int (*f4)(paramdef_t *param)`), `f5` taxes no argument (`void (*checkfunc)(void)`) |
[Configuration module developer main page](../../config/devusage.md)
[Configuration module developer main page](../../config/devusage.md)
[Configuration module home](../../config.md)
-O is the only mandatory command line option to start the eNodeb softmodem (lte-softmodem executable), it is used to specify the configuration source with the associated parameters:
-O is the only mandatory command line option to start the eNodeb softmodem (lte-softmodem executable), it is used to specify the configuration source with the associated parameters:
```bash
$ ./lte-softmodem -O <configsource>:<parameter1>:<parameter2>:...
```
The configuration module can also be used without a configuration source, ie to only parse the command line. In this case the -O switch is optional. This mode is used in the ue-softmodem executable and by the phy_simulators executables (ulsim, dlsim)
The configuration module can also be used without a configuration source, ie to only parse the command line. In this case the -O switch is optional. This mode is used in the ue-softmodem executable and by the phy_simulators executables (ulsim, dlsim)
Currently the available config sources are:
- **libconfig**: libconfig file. [libconfig file format](http://www.hyperrealm.com/libconfig/libconfig_manual.html#Configuration-Files) Parameter1 is the file path and parameter 2 can be used to specify the level of console messages printed by the configuration module.
- **libconfig**: libconfig file. [libconfig file format](http://www.hyperrealm.com/libconfig/libconfig_manual.html#Configuration-Files) Parameter1 is the file path and parameter 2 can be used to specify the level of console messages printed by the configuration module.
```bash
$ ./lte-softmodem -O libconfig:<config>:dbgl<debuglevel>
```
- **cmdlineonly**: command line only, the default mode for lte-uesoftmodem and the phy simiulators. In this case -O may be used to specify the config module debug level.
The debug level is a mask:
* bit 1: print parameters values
The debug level is a mask:
* bit 1: print parameters values
* bit 2: print memory allocation/free performed by the config module
* bit 3: print command line processing messages
* bit 4: disable execution abort when parameters checking fails
As a oai user, you may have to use bit 1 (dbgl1) , to check your configuration and get the full name of a parameter you would like to modify on the command line. Other bits are for developers usage, (dbgl7 will print all debug messages).
As a oai user, you may have to use bit 1 (dbgl1) , to check your configuration and get the full name of a parameter you would like to modify on the command line. Other bits are for developers usage, (dbgl7 will print all debug messages).
```bash
$ ./lte-softmodem -O libconfig:<config>:dbgl1
$ ./lte-softmodem -O libconfig:<config>:dbgl1
```
```bash
$ ./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: 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 >
```
......@@ -49,23 +49,23 @@ To get help on supported parameters you can use specific options:
-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
-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
--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
-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
--telnetsrv: Start embedded telnet server
--msc: Enable the MSC tracing utility
--------------------------------------------------------------------
[LIBCONFIG] loader: 2/2 parameters successfully set, (2 to default value)
......@@ -84,13 +84,13 @@ Getting ENBSParams
```
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
$ ./lte-softmodem -O <config>
```
Configuration file parameters, except for the configuration file path, can be specified in a **config** section in the configuration file:
Configuration file parameters, except for the configuration file path, can be specified in a **config** section in the configuration file:
```
config:
......@@ -102,8 +102,8 @@ Configuration files examples can be found in the targets/PROJECTS/GENERIC-LTE-EP
```bash
$ ./lte-softmodem -O <config> --eNBs.[0].component_carriers.[0].N_RB_DL 100
```
```
As specified earlier, use the dbgl1 debug level to get the full name of a parameter you would like to modify on the command line.
[Configuration module home](../config.md)
\ No newline at end of file
[Configuration module home](../config.md)
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file common/ngran_types.h
* \brief Definitions for NGRAN node types
* \author R. Knopp
* \date 2018
* \version 0.1
* \company Eurecom
* \email: knopp@eurecom.fr
* \note
* \warning
*/
#ifndef __NGRAN_TYPES_H__
#define __NGRAN_TYPES_H__
typedef enum {
ngran_eNB = 0,
ngran_ng_eNB = 1,
ngran_gNB = 2,
ngran_eNB_CU = 3,
ngran_ng_eNB_CU = 4,
ngran_gNB_CU = 5,
ngran_eNB_DU = 6,
ngran_gNB_DU = 7
} ngran_node_t;
#define NODE_IS_MONOLITHIC(nOdE_TyPe) ((nOdE_TyPe) == ngran_eNB || (nOdE_TyPe) == ngran_ng_eNB || (nOdE_TyPe) == ngran_gNB)
#define NODE_IS_CU(nOdE_TyPe) ((nOdE_TyPe) == ngran_eNB_CU || (nOdE_TyPe) == ngran_ng_eNB_CU || (nOdE_TyPe) == ngran_gNB_CU)
#define NODE_IS_DU(nOdE_TyPe) ((nOdE_TyPe) == ngran_eNB_DU || (nOdE_TyPe) == ngran_gNB_DU)
#endif
......@@ -39,6 +39,8 @@
#include "PHY/types.h"
#include "PHY/impl_defs_top.h"
#include "PHY/impl_defs_lte.h"
#include "ENB_APP/enb_config.h"
#include "RRC/LTE/rrc_defs.h"
#include "flexran_agent_defs.h"
......@@ -49,7 +51,11 @@
#include "gtpv1u_eNB_defs.h"
#include "PHY/defs_L1_NB_IoT.h"
#include "RRC/LTE/defs_NB_IoT.h"
typedef struct {
/// RAN context config file name
char *config_file_name;
......
......@@ -2,6 +2,6 @@
The oai shared library loader is implemented in two source files, located in [common/utils](https://gitlab.eurecom.fr/oai/openairinterface5g/tree/develop/common/utils)
1. [load_module_shlib.c](https://gitlab.eurecom.fr/oai/openairinterface5g/tree/develop/common/utils/load_module_shlib.c) contains the loader implementation
1. [load_module_shlib.h](https://gitlab.eurecom.fr/oai/openairinterface5g/tree/develop/common/utils/load_module_shlib.h) is the loader include file containing both private and public data type definitions. It also contain API prototypes.
1. [load_module_shlib.h](https://gitlab.eurecom.fr/oai/openairinterface5g/tree/develop/common/utils/load_module_shlib.h) is the loader include file containing both private and public data type definitions. It also contain API prototypes.
[loader home page](../loader.md)
\ No newline at end of file
[loader home page](../loader.md)
The loader objectives are
The loader objectives are
1. provides a common mechanism to prevent an executable to include code that is only used under specific configurations, without rebuilding the code
1. Provide a common mechanism to allow to choose between different implementations of a given set of functions, without rebuilding the code
As a developer you may need to look at these sections:
* [loading a shared library](devusage/loading.md)
* [loader API](devusage/api.md)
* [loader public structures](devusage/struct.md)
* [loader API](devusage/api.md)
* [loader public structures](devusage/struct.md)
Loader usage examples can be found in oai sources:
Loader usage examples can be found in oai sources:
* device and transport initialization code: [function `load_lib` in *targets/ARCH/COMMON/__common_lib.c__* ](https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/targets/ARCH/COMMON/common_lib.c#L91)
* device and transport initialization code: [function `load_lib` in *targets/ARCH/COMMON/__common_lib.c__* ](https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/targets/ARCH/COMMON/common_lib.c#L91)
* turbo encoder and decoder initialization: [function `load_codinglib`in *openair1/PHY/CODING/__coding_load.c__*](https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/openair1/PHY/CODING/coding_load.c#L113)
[loader home page](../loader.md)
Loader API is defined in the [common/utils/load_module_shlib.h](https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/common/utils/load_module_shlib.h) include file.
Loader API is defined in the [common/utils/load_module_shlib.h](https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/common/utils/load_module_shlib.h) include file.
```c
int load_module_shlib(char *modname,loader_shlibfunc_t *farray, int numf)
```
* possibly initializes the loader, if it has not been already initialized
* Formats the full shared library path, using the `modname` argument and the loader `shlibpath` and `shlibversion`configuration parameters.
* possibly initializes the loader, if it has not been already initialized
* Formats the full shared library path, using the `modname` argument and the loader `shlibpath` and `shlibversion`configuration parameters.
* loads the shared library, using the dlopen system call
* looks for `< modname >_autoinit` symbol, using the `dlsym` system call and possibly call the corresponding function.
* looks for `< modname >_checkbuildver` symbol, using the `dlsym` system call and possibly calls the corresponding function. If the return value of this call is `-1`, program execution is stopped. It is the responsibility of the shared library developer to implement or not a `< modname >_checkbuildver` function and to decide if a version mismatch is a fatal condition. The `< modname >_checkbuildver` function must match the `checkverfunc_t` function type. The first argument is the main executable version, as set in the `PACKAGE_VERSION` macro defined in the [oai CMakeLists](https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/cmake_targets/CMakeLists.txt#L218), around line 218. The second argument points to the shared library version which should be set by the `< modname >_checkbuildver` function.
* looks for `< modname >_checkbuildver` symbol, using the `dlsym` system call and possibly calls the corresponding function. If the return value of this call is `-1`, program execution is stopped. It is the responsibility of the shared library developer to implement or not a `< modname >_checkbuildver` function and to decide if a version mismatch is a fatal condition. The `< modname >_checkbuildver` function must match the `checkverfunc_t` function type. The first argument is the main executable version, as set in the `PACKAGE_VERSION` macro defined in the [oai CMakeLists](https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/cmake_targets/CMakeLists.txt#L218), around line 218. The second argument points to the shared library version which should be set by the `< modname >_checkbuildver` function.
* If the farray pointer is null, looks for `< modname >_getfarray` symbol, calls the corresponding function when the symbol is found. `< modname >_getfarray` takes one argument, a pointer to a `loader_shlibfunc_t` array, and returns the number of items in this array, as defined by the `getfarrayfunc_t` type. The `loader_shlibfunc_t` array returned by the shared library must be fully filled (both `fname` and `fptr` fields).
* looks for the `numf` function symbols listed in the `farray[i].fname` arguments and set the corresponding `farray[i].fptr`function pointers
......@@ -14,7 +14,7 @@ int load_module_shlib(char *modname,loader_shlibfunc_t *farray, int numf)
```c
void * get_shlibmodule_fptr(char *modname, char *fname)
```
Returns a pointer to the symbol `fname`, defined in module `modname`, or `NULL` if the symbol is not found.
Returns a pointer to the symbol `fname`, defined in module `modname`, or `NULL` if the symbol is not found.
[loader home page](../../loader.md)
[loader developer home page](../devusage.md)
\ No newline at end of file
[loader home page](../../loader.md)
[loader developer home page](../devusage.md)
......@@ -10,16 +10,16 @@ Typical loader usage looks like:
/* shared library loader include file */
#include "common/utils/load_module_shlib.h"
.............
/*
define and initialize the array, describing the list of functions
/*
define and initialize the array, describing the list of functions
implemented in "mymodule"
*/
loader_shlibfunc_t mymodule_fdesc[2];
mymodule_fdesc[0].fname="mymodule_f1";
mymodule_fdesc[1].fname="mymodule_f2";
mymodule_fdesc[0].fname="mymodule_f1";
mymodule_fdesc[1].fname="mymodule_f2";
/*
load the library, it's name must be libmymod.so. Configuration can be
load the library, it's name must be libmymod.so. Configuration can be
used to specify a specific path to look for libmymod.so. Configuration
can also specify a version, for example "V1", in this case the loader
will look for libmymodV1.so
......@@ -28,13 +28,13 @@ Typical loader usage looks like:
if (ret < 0) {
fprintf(stderr,"Library couldn't be loaded\n");
} else {
/*
/*
library has been loaded, we probably want to call some functions...
*/
ret=((funcf1_t)mymodule_fdesc[0].fptr)();
..................
/*
/*
later and/or somewhere else in the code you may want to call function "mymodule_f2"
You can use the loader get_shlibmodule_fptr(char *modname, char *fname) function
to retrieve the pointer to that function
......@@ -50,7 +50,7 @@ if (f2 != NULL) {
}
...............
```
When loading a shared library the loader looks for a symbol named `< module name > _autoinit` and, if it finds it, calls it. The `autoinit` function is called without any argument and the returned value, if any, is not tested.
When loading a shared library the loader looks for a symbol named `< module name > _autoinit` and, if it finds it, calls it. The `autoinit` function is called without any argument and the returned value, if any, is not tested.
[loader home page](../loader.md)
[loader developer home page](../../loader/devusage.md)
\ No newline at end of file
[loader home page](../loader.md)
[loader developer home page](../../loader/devusage.md)
......@@ -6,5 +6,5 @@ It is defined in include file [ common/util/load_module_shlib.h ](https://gitlab
| `fname` | symbol name, is passed to the [`dlsym`](http://man7.org/linux/man-pages/man3/dlsym.3.html) system call performed by the loader to get a pointer to the symbol | I |
| `fptr` | pointer to the symbol name, set by the loader. `fptr` is defined as a `int (*fptr)(void)` function type | O |
[loader home page](../../loader.md)
[loader developer home page](../devusage.md)
\ No newline at end of file
[loader home page](../../loader.md)
[loader developer home page](../devusage.md)
......@@ -6,7 +6,7 @@ Shared library full names are built by the loader using the format:
1. the < *module version* > and < *path* > optional parameters, are defined at run-time, depending on the configuration.
## loader parameters
The loader is using the [configuration module](../../../config/DOC/config.md), and defines global and per library parameters. Global parameters must be specified under the **loader** section and library specific parameters under a **loader.<*module name*>** section. Module specific parameters override the global parameters.
The loader is using the [configuration module](../../../config/DOC/config.md), and defines global and per library parameters. Global parameters must be specified under the **loader** section and library specific parameters under a **loader.<*module name*>** section. Module specific parameters override the global parameters.
### Global loader parameters
| name | type | default | description |
|:---:|:---:|:---:|:----|
......@@ -39,7 +39,7 @@ If you want to load a device called *liboai_device_USRP.so* without writting a s
With this latest example, nn the softmodem logs, you can check that the right device library has been loaded:
```bash
[LIBCONFIG] loader.oai_device.shlibpath not found in /usr/local/oai/develop-nb-iot-merge/openairinterface5g/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.nbiot.band7.tm1.50PRB.usrpb210.conf
[LIBCONFIG] loader.oai_device.shlibpath not found in /usr/local/oai/develop-nb-iot-merge/openairinterface5g/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.nbiot.band7.tm1.50PRB.usrpb210.conf
[LIBCONFIG] loader.oai_device.shlibversion set to default value ""
[LIBCONFIG] loader.oai_device: 1/2 parameters successfully set, (1 to default value)
[CONFIG] shlibversion set to _USRP from command line
......@@ -47,4 +47,4 @@ With this latest example, nn the softmodem logs, you can check that the right de
```
[loader home page](../loader.md)
\ No newline at end of file
[loader home page](../loader.md)
......@@ -12,11 +12,11 @@ these macros are used in place of the printf C function. The additionnal ***comp
| macro | level letter | level value | level name |
|:---------|:---------------|:---------------|----------------:|
| LOG_E | E | 0 | error |
| LOG_E | E | 0 | error |
| LOG_W | W | 1 | warning |
| LOG_I | I | 2 | informational |
| LOG_D | D | 3 | debug |
| LOG_T | T | 4 | trace |
| LOG_T | T | 4 | trace |
component list is defined as an `enum` in [log.h](https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/common/utils/LOG/log.h). A new component can be defined by adding an item in this type, it must also be defined in the T tracer [T_messages.txt ](https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/common/utils/T/T_messages.txt).
......@@ -27,18 +27,18 @@ Most oai sources are including LOG macros.
```C
LOG_DEBUGFLAG(<flag>)
```
this macro is to be used in if statements. The condition is true if the flag has been set, as described in the [run time usage page](rtusage.md)
this macro is to be used in if statements. The condition is true if the flag has been set, as described in the [run time usage page](rtusage.md)
```C
if ( LOG_DEBUGFLAG(<flag>) {
/*
/*
the code below is only executed if the corresponding
<flag>_debug option is set.
*/
*/
......................
......................
}
```
[example in oai code](https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/openair1/PHY/LTE_TRANSPORT/ulsch_demodulation.c#L396)
[example in oai code](https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/openair1/PHY/LTE_TRANSPORT/ulsch_demodulation.c#L396)
#### memory dump macros
```C
......@@ -47,16 +47,16 @@ LOG_DUMPFLAG(<flag>)
this macro is to be used in if statements. The condition is true if the flag has been set, as described in the [run time usage page](rtusage.md). It is mainly provided to surround LOG_M macros or direct calls to `log_dump`which otherwise would be unconditionals.
```C
if ( LOG_DUMPFLAG(<flag>) {
/*
/*
the code below is only executed if the corresponding
<flag>_dump option is set.
*/
*/
LOG_M(.............
LOG_M(.............
log_dump(...
}
[example in oai code](https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/openair1/PHY/LTE_TRANSPORT/prach.c#L205)
[example in oai code](https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/openair1/PHY/LTE_TRANSPORT/prach.c#L205)
#### matlab format dump
```C
LOG_M(file, vector, data, len, dec, format)
......@@ -71,13 +71,13 @@ LOG_M(file, vector, data, len, dec, format)
|format| int | defines the type of data to be dumped|
This macro can be used to dump a buffer in a format that can be used for analyze via tools like matlab or octave. **It must be surrounded by LOG_DEBUGFLAG or LOG_DUMPFLAG macros, to prevent the dump to be built unconditionally.** The LOG_M macro points to the `write_file_matlab` function implemented in [log.c](https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/common/utils/LOG/log.c). **This function should be revisited for more understandable implementation and ease of use (format parameter ???)**
[example in oai code](https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/openair1/PHY/LTE_TRANSPORT/prach.c#L205)
[example in oai code](https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/openair1/PHY/LTE_TRANSPORT/prach.c#L205)
#### hexadecimal format dump
```C
LOG_DUMPMSG(c, f, b, s, x...)
```
dumps a memory region if the corresponding debug flag `f` is set as explained here [run time usage page](rtusage.md)
dumps a memory region if the corresponding debug flag `f` is set as explained here [run time usage page](rtusage.md)
|argument| type| description |
|:-----------|:-------|-----------------:|
......@@ -88,12 +88,12 @@ dumps a memory region if the corresponding debug flag `f` is set as explained he
| x...| printf format and arguments| text string to be printed at the top of the dump|
This macro can be used to conditionaly dump a buffer, bytes by bytes, giving the integer value of each byte in hexadecimal form.
[example in oai code](https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/openair2/RRC/LTE/rrc_eNB.c#L1181)
[example in oai code](https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/openair2/RRC/LTE/rrc_eNB.c#L1181)
This macro points to the `log_dump` function, implemented in [log.c](https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/common/utils/LOG/log.c). This function can also dump buffers containing `double` data via the LOG_UDUMPMSG macro
```C
LOG_UDUMPMSG(c, b, s, f, x...)
LOG_UDUMPMSG(c, b, s, f, x...)
```
|argument| type| description |
|:-----------|:-------|-----------------:|
......@@ -103,8 +103,8 @@ LOG_UDUMPMSG(c, b, s, f, x...)
|f| int | format of dumped data LOG_DUMP_CHAR or LOG_DUMP_DOUBLE|
| x...| printf format and arguments| text string to be printed at the top of the dump|
[example in oai code](https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/openair1/SIMULATION/LTE_PHY/dlsim.c#L1974)
[example in oai code](https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/openair1/SIMULATION/LTE_PHY/dlsim.c#L1974)
[logging facility developer main page](devusage.md)
[logging facility main page](log.md)
[oai Wikis home](https://gitlab.eurecom.fr/oai/openairinterface5g/wikis/home)
\ No newline at end of file
[logging facility developer main page](devusage.md)
[logging facility main page](log.md)
[oai Wikis home](https://gitlab.eurecom.fr/oai/openairinterface5g/wikis/home)
......@@ -2,11 +2,11 @@
The oai logging facility is implemented in two source files, located in [common/utils/LOG](LOG)
1. [log.c](../log.c) contains logging implementation
1. [log.h](../log.h) is the logging facility include file containing both private and public data type definitions. It also contain API prototypes.
1. [log.h](../log.h) is the logging facility include file containing both private and public data type definitions. It also contain API prototypes.
The logging facility doesn't create any thread, all api's are executed in the context of the caller. The tracing macro's `LOG_<X>` are all using the logRecord_mt function to output the messages. To keep this function thread safe it must perform a single system call to the output stream. The buffer used to build the message must be specific to the calling thread, which is today enforced by using a variable in the logRecord_mt stack.
Data used by the logging utility are defined by the `log_t` structure which is allocated at init time, when calling the `logInit` function.
[logging facility main page](log.md)
[oai Wikis home](https://gitlab.eurecom.fr/oai/openairinterface5g/wikis/home)
\ No newline at end of file
[logging facility main page](log.md)
[oai Wikis home](https://gitlab.eurecom.fr/oai/openairinterface5g/wikis/home)
......@@ -4,7 +4,7 @@
```C
int logInit (void);
```
Allocate the internal data used by the logging utility, set the configuration, using the [configuration module](../../../config/DOC/config.md)
Allocate the internal data used by the logging utility, set the configuration, using the [configuration module](../../../config/DOC/config.md)
```C
void logClean (void)
......@@ -30,9 +30,9 @@ void close_component_filelog(int comp)
Redirect or reset to stdout the output stream used by the logging facility. When the output stream is redirected to a file, it is created under /tmp with a hard-coded filename including the componemt name.
```C
SET_LOG_DEBUG(flag)
SET_LOG_DEBUG(flag)
CLEAR_LOG_DEBUG(flag)
SET_LOG_DUMP(flag)
SET_LOG_DUMP(flag)
CLEAR_LOG_DUMP(flag)
```
These macros are used to set or clear the corresponding bit flag, trigerring the activation or un-activation of conditional code or memory dumps generation.
......@@ -42,8 +42,8 @@ Example of using the logging utility APIs can be found, for initialization and c
#### components and debug flags definitions
Adding a new component is just adding an item in the `comp_name_t` enum defined in [log.h](../log.h) . You must also declare it in the T Tracer facility [message fefinitions](../../T/T_messages.txt).
To add a flag than can then be used for adding conditional code or memory dumps you have to add the flag definition in the `LOG_MASKMAP_INIT` macro, in [log.h](../log.h).
To add a flag than can then be used for adding conditional code or memory dumps you have to add the flag definition in the `LOG_MASKMAP_INIT` macro, in [log.h](../log.h).
[logging facility developer main page](devusage.md)
[logging facility main page](log.md)
[oai Wikis home](https://gitlab.eurecom.fr/oai/openairinterface5g/wikis/home)
\ No newline at end of file
[logging facility developer main page](devusage.md)
[logging facility main page](log.md)
[oai Wikis home](https://gitlab.eurecom.fr/oai/openairinterface5g/wikis/home)
### logging facility developer usage
The logging facility objectives are
1. provide a common console tracing mechanism
The logging facility objectives are
1. provide a common console tracing mechanism
1. Allow a flexible activation of console traces, by configuration or dynamically at any time while code is running.
Most developpers will only use the log macros to add console messages to the code. The logging facility also provides an api that is used for initialization and configuration.
Most developpers will only use the log macros to add console messages to the code. The logging facility also provides an api that is used for initialization and configuration.
[Adding console traces in oaicode](addconsoletrace.md)
[Adding console traces in oaicode](addconsoletrace.md)
[Configuring the logging facility](configurelog.md)
[Configuring the logging facility](configurelog.md)
[logging facility main page](log.md)
[logging facility main page](log.md)
[oai Wikis home](https://gitlab.eurecom.fr/oai/openairinterface5g/wikis/home)
# OAI console logging facility
oai includes a console logging facility that any component should use when writting informational or debugging messages to the softmodem or uesoftmodem stdout stream.
oai includes a console logging facility that any component should use when writting informational or debugging messages to the softmodem or uesoftmodem stdout stream.
By default, this facility is included at build-time and activated at run-time. The T Tracer and the Logging facility share common options for activation:
- To disable the logging facility (and T Tracer) at build-time use the *--disable-T-Tracer* switch:
......
## configuring the logging facility
The logging facility is fully configurable and it uses the [config module](../../../config/config.md) to get its parameters at init time. The [telnet server](../../telnetsrv/DOC/telnetsrv.md) includes a set of commands which can be used to dynamically modify the logging facility behavior
The logging facility is fully configurable and it uses the [config module](../../../config/config.md) to get its parameters at init time. The [telnet server](../../telnetsrv/DOC/telnetsrv.md) includes a set of commands which can be used to dynamically modify the logging facility behavior
All logging facility parameters are defined in the log_config section. Some parameters are global to the logging facility, they modify the way messages are printed to stdout. Conversely, some parameters are specific to a component and only modify the behavior for messages issued by a given component. A third type of parameters can be used to activate conditional debug code or dump messages or buffers.
......@@ -14,7 +14,7 @@ All logging facility parameters are defined in the log_config section. Some para
### Component specific parameters
| name | type | default | description |
|:---:|:---:|:---:|:----|
| `<component>_log_level` | `boolean` | global log level, as defined by the `global_log_level ` parameter) |
| `<component>_log_level` | `boolean` | global log level, as defined by the `global_log_level ` parameter) |
| `<component>_log_infile` | `boolean` | 0 = false| Triggers the redirection of log messages printed by the specified component in a file. The file path and name is /tmp/<componemt>.[extension] the extension is optional and component dependant, it can be `log `, `dat `, `txt `|
The list of components defined within oai can be retrieved from the [config module](../../../config/config.md) traces, when asking for config module debugging info on the command line:
......@@ -215,7 +215,7 @@ The list of components defined within oai can be retrieved from the [config mod
log init done
```
It can also be retrieved when using the telnet server, as explained [below](### Using the telnet server to configure the logging facility)
It can also be retrieved when using the telnet server, as explained [below](### Using the telnet server to configure the logging facility)
### parameters to activate conditional code
| name | type | default | description |
......@@ -238,15 +238,15 @@ The following example sets all components log level to info, exept for hw,phy,ma
};
```
### Using the command line to configure the logging facility
Command line parameter values supersedes values specified in the configuration file.
Command line parameter values supersedes values specified in the configuration file.
```bash
./lte-softmodem -O --log_config.global_log_options nocolor,level,thread --log_config.prach_log_level debug --log_config.PRACH_debug
./lte-softmodem -O --log_config.global_log_options nocolor,level,thread --log_config.prach_log_level debug --log_config.PRACH_debug
```
In this example to get all the debug PRACH messages it is necessary to also set the PRACH_debug flag. This is a choice from the developper.
The log messages will be printed whithout color and the header will include the lmessage evel and the thread name:
```bash
[PHY]I ru thread Time in secs now: 104652566
[PHY]I ru thread Time in secs last pps: 91827117
[PHY]I ru thread Time in secs now: 104652566
[PHY]I ru thread Time in secs last pps: 91827117
[PHY]I ru thread RU 0 rf device ready
[PHY]I ru thread RU 0 no asynch_south interface
[MAC]E rxtx processing SCHED_MODE=0
......@@ -256,10 +256,10 @@ The log messages will be printed whithout color and the header will include the
[PHY]I lte-softmodem PRACH (eNB) : running rx_prach for subframe 1, prach_FreqOffset 2, prach_ConfigIndex 0 , rootSequenceIndex 0
[PHY]I lte-softmodem PRACH (eNB) : running rx_prach for subframe 1, prach_FreqOffset 2, prach_ConfigIndex 0 , rootSequenceIndex 0
```
### Using the telnet server to configure the logging facility
The telnet server includes a `log` command which can be used to dymically modify the logging facility configuration parameters.
[telnet server ***softmodem log*** commands](../../telnetsrv/DOC/telnetlog.md)
[telnet server ***softmodem log*** commands](../../telnetsrv/DOC/telnetlog.md)
[logging facility main page](log.md)
[logging facility main page](log.md)
[oai Wikis home](https://gitlab.eurecom.fr/oai/openairinterface5g/wikis/home)
......@@ -393,15 +393,18 @@ int logInit (void) {
register_log_component("mRAL","",RAL_UE);
register_log_component("ENB_APP","log",ENB_APP);
register_log_component("FLEXRAN_AGENT","log",FLEXRAN_AGENT);
register_log_component("PROTO_AGENT","log",PROTO_AGENT);
register_log_component("TMR","",TMR);
register_log_component("USIM","txt",USIM);
register_log_component("SIM","txt",SIM);
/* following log component are used for the localization*/
/* following log component are used for the localization*/
register_log_component("LOCALIZE","log",LOCALIZE);
register_log_component("NAS","log",NAS);
register_log_component("UDP","",UDP_);
register_log_component("GTPV1U","",GTPU);
register_log_component("S1AP","",S1AP);
register_log_component("F1AP","",F1AP);
register_log_component("X2AP","",X2AP);
register_log_component("SCTP","",SCTP);
register_log_component("X2AP","",X2AP);
......
......@@ -204,6 +204,7 @@ typedef enum {
GTPU,
SPGW,
S1AP,
F1AP,
SCTP,
HW,
OSA,
......@@ -214,6 +215,8 @@ typedef enum {
TMR,
USIM,
LOCALIZE,
PROTO_AGENT,
F1U,
X2AP,
LOADER,
ASN,
......
......@@ -629,7 +629,7 @@ ID = LEGACY_OCM_DEBUG
FORMAT = string,log
ID = LEGACY_OCM_TRACE
DESC = OCM legacy logs - trace level
GROUP = ALL:LEGACY_OCM:LEGACY_GROUP_TRACE:LEGACY
OGROUP = ALL:LEGACY_OCM:LEGACY_GROUP_TRACE:LEGACY
FORMAT = string,log
ID = LEGACY_OIP_INFO
......@@ -888,6 +888,62 @@ ID = LEGACY_componentP_TRACE
ID = LEGACY_PROTO_AGENT_DEBUG
DESC = PROTO AGENT DEBUG LEVEL
GROUP = ALL:LEGACY_PROTO:LEGACY_GROUP_DEBUG:LEGACY
FORMAT = string,log
ID = LEGACY_PROTO_AGENT_INFO
DESC = PROTO AGENT INFO LEVEL
GROUP = ALL:LEGACY_PROTO:LEGACY_GROUP_INFO:LEGACY
FORMAT = string,log
ID = LEGACY_PROTO_AGENT_WARNING
DESC = PROTO AGENT WARNING LEVEL
GROUP = ALL:LEGACY_PROTO:LEGACY_GROUP_WARNING:LEGACY
FORMAT = string,log
ID = LEGACY_PROTO_AGENT_ERROR
DESC = PROTO AGENT ERROR LEVEL
GROUP = ALL:LEGACY_PROTO:LEGACY_GROUP_ERROR:LEGACY
FORMAT = string,log
ID = LEGACY_F1U_DEBUG
DESC = F1U DEBUG LEVEL
GROUP = ALL:LEGACY_F1U:LEGACY_GROUP_DEBUG:LEGACY
FORMAT = string,log
ID = LEGACY_F1U_INFO
DESC = F1U INFO LEVEL
GROUP = ALL:LEGACY_F1U:LEGACY_GROUP_INFO:LEGACY
FORMAT = string,log
ID = LEGACY_F1U_ERROR
DESC = F1U ERROR LEVEL
GROUP = ALL:LEGACY_F1U:LEGACY_GROUP_ERROR:LEGACY
FORMAT = string,log
ID = LEGACY_F1AP_TRACE
DESC = F1AP TRACE LEVEL
GROUP = ALL:LEGACY_F1AP:LEGACY_GROUP_TRACE:LEGACY
FORMAT = string,log
ID = LEGACY_F1AP_DEBUG
DESC = F1AP DEBUG LEVEL
GROUP = ALL:LEGACY_F1AP:LEGACY_GROUP_DEBUG:LEGACY
FORMAT = string,log
ID = LEGACY_F1AP_INFO
DESC = F1AP INFO LEVEL
GROUP = ALL:LEGACY_F1AP:LEGACY_GROUP_INFO:LEGACY
FORMAT = string,log
ID = LEGACY_F1AP_WARNING
DESC = F1AP WARNING LEVEL
GROUP = ALL:LEGACY_F1AP:LEGACY_GROUP_WARNING:LEGACY
FORMAT = string,log
ID = LEGACY_F1AP_ERROR
DESC = F1AP ERROR LEVEL
GROUP = ALL:LEGACY_F1AP:LEGACY_GROUP_ERROR:LEGACY
FORMAT = string,log
#################
#### UE LOGS ####
#################
......
......@@ -35,13 +35,11 @@
void output_log_mem(void);
#define _Assert_Exit_ \
{ \
fprintf(stderr, "\nExiting execution\n"); \
display_backtrace(); \
fflush(stdout); \
fflush(stderr); \
exit(EXIT_FAILURE); \
}
#define _Assert_(cOND, aCTION, fORMAT, aRGS...) \
do { \
......
......@@ -150,7 +150,7 @@ int msc_init(const msc_env_t envP, const int max_threadsP)
pointer_p = malloc(MSC_MAX_MESSAGE_LENGTH);
AssertFatal (pointer_p, "malloc failed!\n");
rv = lfds611_stack_guaranteed_push( g_msc_memory_stack_p, pointer_p );
AssertFatal (rv, "lfds611_stack_guaranteed_push failed for item %u\n", i);
AssertFatal (rv, "lfds611_stack_guaranteed_push failed for item %d\n", i);
}
for (i = MIN_MSC_PROTOS; i < MAX_MSC_PROTOS; i++) {
......@@ -476,7 +476,20 @@ int msc_init(const msc_env_t envP, const int max_threadsP)
}
break;
case MSC_F1AP_CU:
rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "F1AP_CU");
if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;}
//if ((envP == MSC_E_UTRAN) || (envP == MSC_MME_GW) || (envP == MSC_MME)) {
msc_log_declare_proto(i);
//}
break;
case MSC_F1AP_DU:
rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "F1AP_DU");
if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {g_msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;}
//if ((envP == MSC_E_UTRAN) || (envP == MSC_MME_GW) || (envP == MSC_MME)) {
msc_log_declare_proto(i);
//}
break;
default:
rv = snprintf(&g_msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "UNKNOWN");
......
......@@ -62,6 +62,8 @@ typedef enum {
MSC_S11_MME,
MSC_S6A_MME,
MSC_HSS,
MSC_F1AP_CU,
MSC_F1AP_DU,
MSC_X2AP_SRC_ENB,
MSC_X2AP_TARGET_ENB,
MAX_MSC_PROTOS,
......
......@@ -13,3 +13,4 @@
#include "openair2/COMMON/udp_messages_def.h"
#include "openair2/COMMON/gtpv1_u_messages_def.h"
#include "openair2/COMMON/flexran_messages_def.h"
#include "openair2/COMMON/f1ap_messages_def.h"
/*
Author: Laurent THOMAS, Open Cells
copyleft: OpenAirInterface Software Alliance and it's licence
copyleft: OpenAirInterface Software Alliance and it's licence
*/
#include <vector>
#include <map>
......@@ -122,7 +122,7 @@ extern "C" {
pthread_mutex_unlock (&t->queue_cond_lock);
t->admin.func(NULL);
pthread_mutex_lock (&t->queue_cond_lock);
}
}
pthread_mutex_unlock (&t->queue_cond_lock);
return ret;
}
......@@ -290,12 +290,12 @@ extern "C" {
struct sched_param sparam;
memset(&sparam, 0, sizeof(sparam));
sparam.sched_priority = sched_get_priority_max(SCHED_FIFO)-10;
policy = SCHED_FIFO ;
policy = SCHED_FIFO ;
if (pthread_setschedparam(t->thread, policy, &sparam) != 0) {
LOG_E(TMR,"task %s : Failed to set pthread priority\n", itti_get_task_name(task_id) );
}
}
#endif
#endif
return 0;
}
......
/*
Author: Laurent THOMAS, Open Cells
Copyleft: OpenAirInterface software alliance and it's licence
Copyleft: OpenAirInterface software alliance and it's licence
*/
#ifndef INTERTASK_INTERFACE_H_
#define INTERTASK_INTERFACE_H_
......@@ -300,6 +300,8 @@ typedef struct {
TASK_DEF(TASK_MSC, TASK_PRIORITY_MED, 200, NULL, NULL)\
TASK_DEF(TASK_GTPV1_U, TASK_PRIORITY_MED, 1000,NULL, NULL)\
TASK_DEF(TASK_UDP, TASK_PRIORITY_MED, 1000, NULL, NULL)\
TASK_DEF(TASK_CU_F1, TASK_PRIORITY_MED, 200, NULL, NULL) \
TASK_DEF(TASK_DU_F1, TASK_PRIORITY_MED, 200, NULL, NULL) \
TASK_DEF(TASK_MAX, TASK_PRIORITY_MED, 200, NULL, NULL)
#define TASK_DEF(TaskID, pRIO, qUEUEsIZE, FuNc, ThreadFunc) { pRIO, qUEUEsIZE, #TaskID, FuNc, ThreadFunc },
......
......@@ -3,15 +3,15 @@
The following example is extracted from [the oai `openair1/PHY/CODING/coding_load.c` file](https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/openair1/PHY/CODING/coding_load.c).
```c
/*
/*
include the telnet server data structures and API definitions
*/
#include "common/utils/telnetsrv/telnetsrv.h"
#include "common/utils/telnetsrv/telnetsrv.h"
/*
define the null terminated array of telnetshell_cmddef_t structures
which map each sub-command string to a function implementing it.
which map each sub-command string to a function implementing it.
you may also provide a help string which will be printed when
the global help command is used. The prototype for the function
implementing sub commands must match the `cmdfunc_t` type defined
......@@ -25,7 +25,7 @@ static telnetshell_cmddef_t coding_cmdarray[] = {
/*
define the null terminated list of telnetshell_vardef_t structures defining the
variables that can be set and get using the pre-defined get and set command
variables that can be set and get using the pre-defined get and set command
of the telnet server
*/
telnetshell_vardef_t coding_vardef[] = {
......@@ -34,7 +34,7 @@ telnetshell_vardef_t coding_vardef[] = {
};
.................
/*
look for telnet server, if it is loaded, add the coding commands to it
look for telnet server, if it is loaded, add the coding commands to it
we use the shared library loader API to check the telnet server availibility
The telnet server TELNET_ADDCMD_FNAME function takes three arguments:
1. The name of the telnet command to be added, here "coding"
......@@ -43,9 +43,9 @@ The telnet server TELNET_ADDCMD_FNAME function takes three arguments:
*/
add_telnetcmd_func_t addcmd = (add_telnetcmd_func_t)get_shlibmodule_fptr("telnetsrv", TELNET_ADDCMD_FNAME);
if (addcmd != NULL) {
addcmd("coding",coding_vardef,coding_cmdarray);
addcmd("coding",coding_vardef,coding_cmdarray);
.......
/*
/*
functions implementing the "coding mode" sub command, as defined in
the `coding_cmdarray` passed earlier to the TELNET_ADDCMD_FNAME function.
This function will be called by the telnet server, when the `coding_cmdarray`
......@@ -53,15 +53,15 @@ The telnet server TELNET_ADDCMD_FNAME function takes three arguments:
*/
int coding_setmod_cmd(char *buff, int debug, telnet_printfunc_t prnt)
{
/*
/*
1. buff argument is an input argument, pointer to the string received
from the telnet client, the command and sub-command parts are removed
In this case it points after "coding setmod" and is of no use as
we don't have second level sub-commands.
we don't have second level sub-commands.
1. debug argument is an input argument set by the telnet server
1. prnt arguments is also an input argument, a function pointer, to be used
1. prnt arguments is also an input argument, a function pointer, to be used
in place of printf to print messages on the telnet client interface. As this function
is called by the telnet server stdout points to the main executable console,
is called by the telnet server stdout points to the main executable console,
*/
if (debug > 0)
prnt( "coding_setmod_cmd received %s\n",buff);
......@@ -89,28 +89,28 @@ int coding_setmod_cmd(char *buff, int debug, telnet_printfunc_t prnt)
```c
int add_telnetcmd(char *modulename, telnetshell_vardef_t *var, telnetshell_cmddef_t *cmd)
```
Add a command and the `cmd` list of sub-commands to the telnet server. After a successful call to `add_telnetcmd` function, the telnet server calls the function defined for each sub-commands in the null terminated `cmd` array, when the character string received from the telnet client matches the command and sub-command strings.
Also adds the list of variables described in the `var` array to the list of variable which can be set and read.
The function returns -1 if one argument is NULL.
The telnet server is dynamically loaded, to use the `add_telnetcmd` function, the shared library loader API should be used to check the availability of the telnet server and retrieve it's address, as shown in [the example at the top of this page](telnetaddcmd.md#code-example-of-adding-a-command-to-the-telnet-server).
Add a command and the `cmd` list of sub-commands to the telnet server. After a successful call to `add_telnetcmd` function, the telnet server calls the function defined for each sub-commands in the null terminated `cmd` array, when the character string received from the telnet client matches the command and sub-command strings.
Also adds the list of variables described in the `var` array to the list of variable which can be set and read.
The function returns -1 if one argument is NULL.
The telnet server is dynamically loaded, to use the `add_telnetcmd` function, the shared library loader API should be used to check the availability of the telnet server and retrieve it's address, as shown in [the example at the top of this page](telnetaddcmd.md#code-example-of-adding-a-command-to-the-telnet-server).
# telnet server public data types
## `telnetshell_vardef_t`structure
## `telnetshell_vardef_t`structure
This structure is used by developers to describe the variables that can be set or read using the get,set and getall sub-commands.
| Fields | type |Description |
| Fields | type |Description |
|:-----------|:------:|:-----------------------|
| `varname` | `char[TELNET_CMD_MAXSIZE]` | variable name, as specified when using the get and set commands. |
| `vartype` | `char` | Defines the type of the variable pointed by the `varvalptr`field. Supported values: TELNET_VARTYPE_INT32 TELNET_VARTYPE_INT16 TELNET_VARTYPE_INT64 TELNET_VARTYPE_STRING TELNET_VARTYPE_DOUBLE |
| `varvalptr` | `void*` | Defines the type of the variable pointed by the `varvalptr`field |
## `telnetshell_cmddef_t`structure
## `telnetshell_cmddef_t`structure
This structure is used by developers to describe the first level sub-commands to be added to the telnet server.
| Fields | type |Description |
| Fields | type |Description |
|:-----------|:------:|:-----------------------|
| `cmdname` | `char[TELNET_CMD_MAXSIZE]` | command name, as tested by the telnet server to check it should call the `cmdfunc` function |
| `helpstr` | `char[TELNET_HELPSTR_SIZE]` | character string to print when the elp`command is received from the telnet client |
| `cmdfunc` | `cmdfunc_t` | pointer to the function implementing the `cmdname` sub command. |
[oai telnet server home](telnetsrv.md)
\ No newline at end of file
[oai telnet server home](telnetsrv.md)
......@@ -4,18 +4,18 @@ The oai telnet server is implemented in a shared library to be loaded by the [oa
Currently the telnet server only supports one user connection. The same dedicated thread is used to wait for a user connection and process the input received from this connection.
The telnet server provides an API which can be used by any oai component to add new CLI commands to the server. A pre-defined command can be used to get or set a list of variables.
The telnet server provides an API which can be used by any oai component to add new CLI commands to the server. A pre-defined command can be used to get or set a list of variables.
# telnet server source files
telnet server source files are located in [common/utils/telnetsrv](https://gitlab.eurecom.fr/oai/openairinterface5g/tree/develop/common/utils/telnetsrv)
1. [telnetsrv.c](https://gitlab.eurecom.fr/oai/openairinterface5g/tree/develop/common/utils/telnetsrv/telnetsrv.c) contains the telnet server implementation, including the implementation of the telnet CLI command.
1. [telnetsrv.c](https://gitlab.eurecom.fr/oai/openairinterface5g/tree/develop/common/utils/telnetsrv/telnetsrv.c) contains the telnet server implementation, including the implementation of the telnet CLI command.
1. [telnetsrv.h](https://gitlab.eurecom.fr/oai/openairinterface5g/tree/develop/common/utils/telnetsrv/telnetsrv.h) is the telnet server include file containing both private and public data type definitions. It also contains API prototypes for functions that are used to register a new command in the server.
1. `telnetsrv\_\<XXX\>.c`: implementation of \<XXX\> CLI command which are delivered with the telnet server.
1. `telnetsrv\_\<XXX\>.h`: include file for the implementation of XXX CLI command. Usually included only in the corresponding `.c`file
1. [telnetsrv_CMakeLists.txt](https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/common/utils/telnetsrv/telnetsrv_CMakeLists.txt): CMakelists file containing the cmake instructions to build the telnet server. this file is included in the [global oai CMakelists](https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/cmake_targets/CMakeLists.txt).
[oai telnet server home](telnetsrv.md)
\ No newline at end of file
[oai telnet server home](telnetsrv.md)
......@@ -10,12 +10,12 @@ telnet, phypb = 65000
telnet, hsize = 50
telnet, hfile = "oaitelnet.history"
softmodem> telnet set loopc 100
telnet, loopc set to
telnet, loopc set to
100
softmodem> telnet get loopc
telnet, loopc = 100
softmodem>
softmodem>
```
[oai telnetserver home](telnetsrv.md)
[oai telnetserver usage home](telnetusage.md)
\ No newline at end of file
[oai telnetserver home](telnetsrv.md)
[oai telnetserver usage home](telnetusage.md)
......@@ -22,7 +22,7 @@ softmodem> help
softmodem show loglvl|thread|config
softmodem log (enter help for details)
softmodem thread (enter help for details)
softmodem exit
softmodem exit
module 2 = phy:
phy disp [phycnt,uedump,uestat UE<x>]
module 3 = loader:
......@@ -34,24 +34,24 @@ softmodem> help
module 4 = coding:
coding [get set] maxiter <value>
coding mode [sse,avx2,stdc,none]
softmodem>
```
softmodem>
```
# oai telnet server, specific commands help
# oai telnet server, specific commands help
``` bash
softmodem> softmodem log help
log sub commands:
show: display current log configuration
online, noonline: enable or disable console logs
enable, disable id1-id2: enable or disable logs for components index id1 to id2
level_<level> id1-id2: set log level to <level> for components index id1 to id2
level_<verbosity> id1-id2: set log verbosity to <verbosity> for components index id1 to id2
use the show command to get the values for <level>, <verbosity> and the list of component indexes that can be used for id1 and id2
log sub commands:
show: display current log configuration
online, noonline: enable or disable console logs
enable, disable id1-id2: enable or disable logs for components index id1 to id2
level_<level> id1-id2: set log level to <level> for components index id1 to id2
level_<verbosity> id1-id2: set log verbosity to <verbosity> for components index id1 to id2
use the show command to get the values for <level>, <verbosity> and the list of component indexes that can be used for id1 and id2
softmodem>
```
[oai telnetserver home](telnetsrv.md)
[oai telnetserver usage home](telnetusage.md)
\ No newline at end of file
[oai telnetserver home](telnetsrv.md)
[oai telnetserver usage home](telnetusage.md)
......@@ -40,5 +40,5 @@ softmodem>
```
[oai telnetserver home](telnetsrv.md)
[oai telnetserver usage home](telnetusage.md)
\ No newline at end of file
[oai telnetserver home](telnetsrv.md)
[oai telnetserver usage home](telnetusage.md)
......@@ -43,5 +43,5 @@ softmodem> loader show modules
softmodem>
```
[oai telnetserver home](telnetsrv.md)
[oai telnetserver usage home](telnetusage.md)
\ No newline at end of file
[oai telnetserver home](telnetsrv.md)
[oai telnetserver usage home](telnetusage.md)
......@@ -38,10 +38,10 @@ log level/verbosity comp 33 USIM set to info / medium (disabled)
log level/verbosity comp 34 LOCALIZE set to info / medium (disabled)
log level/verbosity comp 35 RRH set to info / medium (disabled)
softmodem> softmodem log show
Available log levels:
emerg alert crit error warn notice info debug file trace
Available verbosity:
none low medium high full
Available log levels:
emerg alert crit error warn notice info debug file trace
Available verbosity:
none low medium high full
component verbosity level enabled
00 PHY: medium info N
01 MAC: medium info N
......@@ -89,8 +89,8 @@ log level/verbosity comp 3 OCG set to error / medium (enabled)
log level/verbosity comp 4 OMG set to error / medium (enabled)
softmodem> exit
Connection closed by foreign host.
```
```
[oai telnetserver home](telnetsrv.md)
[oai telnetserver home](telnetsrv.md)
[oai telnetserver usage home](telnetusage.md)
[oai Wikis home](https://gitlab.eurecom.fr/oai/openairinterface5g/wikis/home)
\ No newline at end of file
[oai Wikis home](https://gitlab.eurecom.fr/oai/openairinterface5g/wikis/home)
The telnet server includes a **_loop_** command that can be used to iterate a given command. The number of iterations and the delay, in ms between two iterations can be modified, as shown in the following example:
The telnet server includes a **_loop_** command that can be used to iterate a given command. The number of iterations and the delay, in ms between two iterations can be modified, as shown in the following example:
```bash
softmodem> telnet get loopc
......@@ -6,35 +6,35 @@ telnet, loopc = 10
softmodem> telnet get loopd
telnet, loopd = 2000
softmodem> telnet set loopd 1000
telnet, loopd set to
telnet, loopd set to
1000
softmodem> loop softmodem show thread
2018-03-27 17:58:49.000 2/10
id name state USRmod KRNmod prio nice vsize proc pol
id name state USRmod KRNmod prio nice vsize proc pol
3946 lte-softmodem S 20005 9440 20 0 236560384 2 0 other
3946 lte-softmodem S 20005 9440 20 0 236560384 2 0 other
3946 lte-softmodem S 7 95 20 0 236560384 2 0 other
3948 telnet R 0 0 20 0 236560384 2 0 other
3949 ITTI acceptor S 2 9 20 0 236560384 2 0 other
3951 ITTI 12 S 2 2 20 0 236560384 7 0 other
3952 ITTI 11 S 0 0 20 0 236560384 0 0 other
3953 ITTI 9 S 0 0 20 0 236560384 1 0 other
3954 ITTI 7 S 0 0 20 0 236560384 7 0 other
3955 ITTI 8 S 0 0 20 0 236560384 7 0 other
3956 ITTI 4 S 35 0 20 0 236560384 2 0 other
3957 ru_thread S 15366 3072 -10 0 236560384 0 2 rt: rr
3958 ru_thread_prach S 0 0 -10 0 236560384 7 1 rt: fifo
3959 fep_thread S 1874 123 -10 0 236560384 5 1 rt: fifo
3960 feptx_thread S 1554 101 -10 0 236560384 7 1 rt: fifo
3969 ru_thread S 0 0 -10 0 236560384 0 2 rt: rr
3970 ru_thread S 1313 5522 -10 0 236560384 5 2 rt: rr
3971 ru_thread S 4 6 -10 0 236560384 1 2 rt: rr
3972 lte-softmodem S 318 9 -10 0 236560384 7 1 rt: fifo
3973 lte-softmodem S 6 13 -10 0 236560384 4 1 rt: fifo
3946 lte-softmodem S 7 95 20 0 236560384 2 0 other
3948 telnet R 0 0 20 0 236560384 2 0 other
3949 ITTI acceptor S 2 9 20 0 236560384 2 0 other
3951 ITTI 12 S 2 2 20 0 236560384 7 0 other
3952 ITTI 11 S 0 0 20 0 236560384 0 0 other
3953 ITTI 9 S 0 0 20 0 236560384 1 0 other
3954 ITTI 7 S 0 0 20 0 236560384 7 0 other
3955 ITTI 8 S 0 0 20 0 236560384 7 0 other
3956 ITTI 4 S 35 0 20 0 236560384 2 0 other
3957 ru_thread S 15366 3072 -10 0 236560384 0 2 rt: rr
3958 ru_thread_prach S 0 0 -10 0 236560384 7 1 rt: fifo
3959 fep_thread S 1874 123 -10 0 236560384 5 1 rt: fifo
3960 feptx_thread S 1554 101 -10 0 236560384 7 1 rt: fifo
3969 ru_thread S 0 0 -10 0 236560384 0 2 rt: rr
3970 ru_thread S 1313 5522 -10 0 236560384 5 2 rt: rr
3971 ru_thread S 4 6 -10 0 236560384 1 2 rt: rr
3972 lte-softmodem S 318 9 -10 0 236560384 7 1 rt: fifo
3973 lte-softmodem S 6 13 -10 0 236560384 4 1 rt: fifo
```
A **_loop_** command can be interrupted by pressing the **_enter_** key till getting the prompt.
```
A **_loop_** command can be interrupted by pressing the **_enter_** key till getting the prompt.
[oai telnetserver home](telnetsrv.md)
[oai telnetserver usage home](telnetusage.md)
\ No newline at end of file
[oai telnetserver home](telnetsrv.md)
[oai telnetserver usage home](telnetusage.md)
......@@ -3,5 +3,5 @@ The oai embedded telnet server is an optional monitoring and debugging tool. It
* [Using the telnet server](telnetusage.md)
* [Adding commands to the oai telnet server](telnetaddcmd.md)
* [telnet server architecture ](telnetarch.md)
[oai Wikis home](https://gitlab.eurecom.fr/oai/openairinterface5g/wikis/home)
\ No newline at end of file
[oai Wikis home](https://gitlab.eurecom.fr/oai/openairinterface5g/wikis/home)
# starting the softmodem with the telnet server
# starting the softmodem with the telnet server
By default the embedded telnet server, which is implemented in a shared library, is not built. It can be built after compiling the softmodem executable using the `build_oai` script:
```bash
cd \<oai repository\>/openairinterface5g
source oaienv
cd cmake_targets
./build_oai --build-telnetsrv
cd \<oai repository\>/openairinterface5g
source oaienv
cd cmake_targets
./build_oai --build-telnetsrv
```
This will create the `libtelnetsrv.so` file in the `targets/bin` and `cmake_targets/lte_build_oai/build` sub directories of the oai repository.
When starting the softmodem, you must specify the **_\-\-telnetsrv_** option to load and start the telnet server. The telnet server is loaded via the [oai shared library loader](loader).
# using the Command Line Interface
By default the telnet server listen on all the ip addresses configured on the system and on port 9090. This behavior can be changed using the `listenaddr` and `listenport` parameters.
# using the Command Line Interface
By default the telnet server listen on all the ip addresses configured on the system and on port 9090. This behavior can be changed using the `listenaddr` and `listenport` parameters.
The telnet server includes a basic help, listing available commands and some commands also provide a specific detailed help sub-command.
Below are examples of telnet sessions:
Below are examples of telnet sessions:
* [getting help](telnethelp.md)
* [using the history](telnethist.md)
* [using the get and set commands](telnetgetset.md)
* [using the loop command](telnetloop.md)
* [loader command](telnetloader.md)
* [log command](telnetlog.md)
* [log command](telnetlog.md)
# telnet server parameters
The telnet server is using the [oai configuration module](Config/Rtusage). Telnet parameters must be specified in the `telnetsrv` section. Some parameters can be modified via the telnet telnet server command, as specified in the last column of the following table.
......@@ -36,4 +36,4 @@ The telnet server is using the [oai configuration module](Config/Rtusage). Telne
| `histfile` | `character string` | "oaitelnet.history" | file used for command history persistency | Y |
| `histfsize` | `integer` | 50 | maximum number of commands saved in the history | Y |
[oai telnet server home](telnetsrv.md)
\ No newline at end of file
[oai telnet server home](telnetsrv.md)
......@@ -22,7 +22,7 @@
/*! \file common/utils/telnetsrv/telnetsrv_cpumeasur_def.h
* \brief: definitions of macro used to initialize the telnet_ltemeasurdef_t
* \ strucures arrays which are then used by the display functions
* \ in telnetsrv_measurements.c.
* \ in telnetsrv_measurements.c.
* \author Francois TABURET
* \date 2019
* \version 0.1
......
all: measurement_display thread-pool-test
measurement_display: measurement_display.c thread-pool.h
gcc measurement_display.c -I /data/openairinterface5g.nr/common/utils/ -I. /data/openairinterface5g.nr/common/utils/backtrace.c -lpthread -D TEST_THREAD_POOL -I../LOG -I../../utils/T -o measurement_display
thread-pool-test: thread-pool.c thread-pool.h
gcc -g thread-pool.c -I /data/openairinterface5g.nr/common/utils/ -I. /data/openairinterface5g.nr/common/utils/backtrace.c -lpthread -D TEST_THREAD_POOL -I../LOG -I../../utils/T -o thread-pool-test
/*
Author: Laurent THOMAS, Open Cells
copyleft: OpenAirInterface Software Alliance and it's licence
*/
#define __USE_GNU
#define _GNU_SOURCE
#include <stdio.h>
#include <pthread.h>
#include <sched.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#include <string.h>
#include <unistd.h>
#include <sys/syscall.h>
#include <sys/time.h>
#include <stdint.h>
#include <sys/stat.h>
#include <fcntl.h>
#include "thread-pool.h"
#define SEP "\t"
uint64_t cpuCyclesMicroSec;
int main(int argc, char *argv[]) {
if(argc != 2) {
printf("Need one paramter: the trace Linux pipe (fifo)");
exit(1);
}
mkfifo(argv[1],0666);
int fd=open(argv[1], O_RDONLY);
if ( fd == -1 ) {
perror("open read mode trace file:");
exit(1);
}
uint64_t deb=rdtsc();
usleep(100000);
cpuCyclesMicroSec=(rdtsc()-deb)/100000;
printf("Cycles per µs: %lu\n",cpuCyclesMicroSec);
printf("Key" SEP "delay to process" SEP "processing time" SEP "delay to be read answer\n");
notifiedFIFO_elt_t doneRequest;
while ( 1 ) {
if ( read(fd,&doneRequest, sizeof(doneRequest)) == sizeof(doneRequest)) {
printf("%lu" SEP "%lu" SEP "%lu" SEP "%lu" "\n",
doneRequest.key,
(doneRequest.startProcessingTime-doneRequest.creationTime)/cpuCyclesMicroSec,
(doneRequest.endProcessingTime-doneRequest.startProcessingTime)/cpuCyclesMicroSec,
(doneRequest.returnTime-doneRequest.endProcessingTime)/cpuCyclesMicroSec
);
} else {
printf("no measurements\n");
sleep(1);
}
}
}
/*
Author: Laurent THOMAS, Open Cells
copyleft: OpenAirInterface Software Alliance and it's licence
*/
#define _GNU_SOURCE
#include <sched.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <string.h>
#include <unistd.h>
#include <ctype.h>
#include <sys/sysinfo.h>
#include <threadPool/thread-pool.h>
void displayList(notifiedFIFO_t *nf) {
int n=0;
notifiedFIFO_elt_t *ptr=nf->outF;
while(ptr) {
printf("element: %d, key: %lu\n",++n,ptr->key);
ptr=ptr->next;
}
printf("End of list: %d elements\n",n);
}
static inline notifiedFIFO_elt_t *pullNotifiedFifoRemember( notifiedFIFO_t *nf, struct one_thread *thr) {
mutexlock(nf->lockF);
while(!nf->outF)
condwait(nf->notifF, nf->lockF);
notifiedFIFO_elt_t *ret=nf->outF;
nf->outF=nf->outF->next;
if (nf->outF==NULL)
nf->inF=NULL;
// For abort feature
thr->runningOnKey=ret->key;
thr->abortFlag=false;
mutexunlock(nf->lockF);
return ret;
}
void *one_thread(void *arg) {
struct one_thread *myThread=(struct one_thread *) arg;
struct thread_pool *tp=myThread->pool;
// configure the thread core assignment
// TBD: reserve the core for us exclusively
if ( myThread->coreID >= 0 && myThread->coreID < get_nprocs_conf()) {
cpu_set_t cpuset;
CPU_ZERO(&cpuset);
CPU_SET(myThread->coreID, &cpuset);
pthread_setaffinity_np(pthread_self(), sizeof(cpu_set_t), &cpuset);
}
//Configure the thread scheduler policy for Linux
struct sched_param sparam= {0};
sparam.sched_priority = sched_get_priority_max(SCHED_RR);
pthread_setschedparam(pthread_self(), SCHED_RR, &sparam);
// set the thread name for debugging
sprintf(myThread->name,"Tpool_%d",myThread->coreID);
pthread_setname_np(pthread_self(), myThread->name );
// Infinite loop to process requests
do {
notifiedFIFO_elt_t *elt=pullNotifiedFifoRemember(&tp->incomingFifo, myThread);
if (tp->measurePerf) elt->startProcessingTime=rdtsc();
elt->processingFunc(NotifiedFifoData(elt));
if (tp->measurePerf) elt->endProcessingTime=rdtsc();
if (elt->reponseFifo) {
// Check if the job is still alive, else it has been aborted
mutexlock(tp->incomingFifo.lockF);
if (myThread->abortFlag)
delNotifiedFIFO_elt(elt);
else
pushNotifiedFIFO(elt->reponseFifo, elt);
mutexunlock(tp->incomingFifo.lockF);
}
} while (true);
}
void initTpool(char *params,tpool_t *pool, bool performanceMeas) {
memset(pool,0,sizeof(*pool));
char *measr=getenv("threadPoolMeasurements");
pool->measurePerf=performanceMeas;
// force measurement if the output is defined
pool->measurePerf=measr!=NULL;
if (measr) {
mkfifo(measr,0666);
AssertFatal(-1 != (pool->dummyTraceFd=
open(measr, O_RDONLY| O_NONBLOCK)),"");
AssertFatal(-1 != (pool->traceFd=
open(measr, O_WRONLY|O_APPEND|O_NOATIME|O_NONBLOCK)),"");
} else
pool->traceFd=-1;
//Configure the thread scheduler policy for Linux
struct sched_param sparam= {0};
sparam.sched_priority = sched_get_priority_max(SCHED_RR)-1;
pthread_setschedparam(pthread_self(), SCHED_RR, &sparam);
pool->activated=true;
initNotifiedFIFO(&pool->incomingFifo);
char *saveptr, * curptr;
pool->nbThreads=0;
pool->restrictRNTI=false;
curptr=strtok_r(params,",",&saveptr);
while ( curptr!=NULL ) {
int c=toupper(curptr[0]);
switch (c) {
case 'U':
pool->restrictRNTI=true;
break;
case 'N':
pool->activated=false;
break;
default:
pool->allthreads=(struct one_thread *)malloc(sizeof(struct one_thread));
pool->allthreads->next=pool->allthreads;
printf("create a thread for core %d\n", atoi(curptr));
pool->allthreads->coreID=atoi(curptr);
pool->allthreads->id=pool->nbThreads;
pool->allthreads->pool=pool;
pthread_create(&pool->allthreads->threadID, NULL, one_thread, (void *)pool->allthreads);
pool->nbThreads++;
}
curptr=strtok_r(NULL,",",&saveptr);
}
if (pool->activated && pool->nbThreads==0) {
printf("No servers created in the thread pool, exit\n");
exit(1);
}
}
#ifdef TEST_THREAD_POOL
struct testData {
int id;
char txt[30];
};
void processing(void *arg) {
struct testData *in=(struct testData *)arg;
printf("doing: %d, %s, in thr %ld\n",in->id, in->txt,pthread_self() );
sprintf(in->txt,"Done by %ld, job %d", pthread_self(), in->id);
usleep(rand()%100);
printf("done: %d, %s, in thr %ld\n",in->id, in->txt,pthread_self() );
}
int main() {
notifiedFIFO_t myFifo;
initNotifiedFIFO(&myFifo);
pushNotifiedFIFO(&myFifo,newNotifiedFIFO_elt(sizeof(struct testData), 1234,NULL,NULL));
for(int i=10; i>1; i--) {
pushNotifiedFIFO(&myFifo,newNotifiedFIFO_elt(sizeof(struct testData), 1000+i,NULL,NULL));
}
displayList(&myFifo);
notifiedFIFO_elt_t *tmp=pullNotifiedFIFO(&myFifo);
printf("pulled: %lu\n", tmp->key);
displayList(&myFifo);
tmp=pullNotifiedFIFO(&myFifo);
printf("pulled: %lu\n", tmp->key);
displayList(&myFifo);
abortNotifiedFIFO(&myFifo,1005);
printf("aborted 1005\n");
displayList(&myFifo);
pushNotifiedFIFO(&myFifo,newNotifiedFIFO_elt(sizeof(struct testData), 12345678, NULL, NULL));
displayList(&myFifo);
abortNotifiedFIFO(&myFifo,12345678);
printf("aborted 12345678\n");
displayList(&myFifo);
do {
tmp=pollNotifiedFIFO(&myFifo);
if (tmp) {
printf("pulled: %lu\n", tmp->key);
displayList(&myFifo);
} else
printf("Empty list \n");
} while(tmp);
tpool_t pool;
char params[]="1,2,3,u";
initTpool(params,&pool, true);
notifiedFIFO_t worker_back;
initNotifiedFIFO(&worker_back);
for (int i=0; i <1000 ; i++) {
notifiedFIFO_elt_t *work=newNotifiedFIFO_elt(sizeof(struct testData), i, &worker_back, processing);
struct testData *x=(struct testData *)NotifiedFifoData(work);
x->id=i;
pushTpool(&pool, work);
}
do {
tmp=pullTpool(&worker_back,&pool);
if (tmp) {
struct testData *dd=NotifiedFifoData(tmp);
printf("Result: %s\n",dd->txt);
delNotifiedFIFO_elt(tmp);
} else
printf("Empty list \n");
abortTpool(&pool,510);
} while(tmp);
return 0;
}
#endif
/*
Author: Laurent THOMAS, Open Cells
copyleft: OpenAirInterface Software Alliance and it's licence
*/
#ifndef THREAD_POOL_H
#define THREAD_POOL_H
#include <stdbool.h>
#include <stdint.h>
#include <pthread.h>
#include <sys/syscall.h>
#include <assertions.h>
#include <LOG/log.h>
#ifdef DEBUG
#define THREADINIT PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP
#else
#define THREADINIT PTHREAD_MUTEX_INITIALIZER
#endif
#define mutexinit(mutex) AssertFatal(pthread_mutex_init(&mutex,NULL)==0,"");
#define condinit(signal) AssertFatal(pthread_cond_init(&signal,NULL)==0,"");
#define mutexlock(mutex) AssertFatal(pthread_mutex_lock(&mutex)==0,"");
#define mutextrylock(mutex) pthread_mutex_trylock(&mutex)
#define mutexunlock(mutex) AssertFatal(pthread_mutex_unlock(&mutex)==0,"");
#define condwait(condition, mutex) AssertFatal(pthread_cond_wait(&condition, &mutex)==0,"");
#define condbroadcast(signal) AssertFatal(pthread_cond_broadcast(&signal)==0,"");
#define condsignal(signal) AssertFatal(pthread_cond_broadcast(&signal)==0,"");
typedef struct notifiedFIFO_elt_s {
struct notifiedFIFO_elt_s *next;
uint64_t key; //To filter out elements
struct notifiedFIFO_s *reponseFifo;
void (*processingFunc)(void *);
bool malloced;
uint64_t creationTime;
uint64_t startProcessingTime;
uint64_t endProcessingTime;
uint64_t returnTime;
void *msgData;
} notifiedFIFO_elt_t;
typedef struct notifiedFIFO_s {
notifiedFIFO_elt_t *outF;
notifiedFIFO_elt_t *inF;
pthread_mutex_t lockF;
pthread_cond_t notifF;
} notifiedFIFO_t;
// You can use this allocator or use any piece of memory
static inline notifiedFIFO_elt_t *newNotifiedFIFO_elt(int size,
uint64_t key,
notifiedFIFO_t *reponseFifo,
void (*processingFunc)(void *)) {
notifiedFIFO_elt_t *ret;
AssertFatal( NULL != (ret=(notifiedFIFO_elt_t *) malloc(sizeof(notifiedFIFO_elt_t)+size+32)), "");
ret->next=NULL;
ret->key=key;
ret->reponseFifo=reponseFifo;
ret->processingFunc=processingFunc;
// We set user data piece aligend 32 bytes to be able to process it with SIMD
ret->msgData=(void *)ret+(sizeof(notifiedFIFO_elt_t)/32+1)*32;
ret->malloced=true;
return ret;
}
static inline void *NotifiedFifoData(notifiedFIFO_elt_t *elt) {
return elt->msgData;
}
static inline void delNotifiedFIFO_elt(notifiedFIFO_elt_t *elt) {
if (elt->malloced) {
elt->malloced=false;
free(elt);
} else
printf("delNotifiedFIFO on something not allocated by newNotifiedFIFO\n");
//LOG_W(UTIL,"delNotifiedFIFO on something not allocated by newNotifiedFIFO\n");
}
static inline void initNotifiedFIFO(notifiedFIFO_t *nf) {
mutexinit(nf->lockF);
condinit (nf->notifF);
nf->inF=NULL;
nf->outF=NULL;
// No delete function: the creator has only to free the memory
}
static inline void pushNotifiedFIFO(notifiedFIFO_t *nf, notifiedFIFO_elt_t *msg) {
mutexlock(nf->lockF);
msg->next=NULL;
if (nf->outF == NULL)
nf->outF = msg;
if (nf->inF)
nf->inF->next = msg;
nf->inF = msg;
condbroadcast(nf->notifF);
mutexunlock(nf->lockF);
}
static inline notifiedFIFO_elt_t *pullNotifiedFIFO(notifiedFIFO_t *nf) {
mutexlock(nf->lockF);
while(!nf->outF)
condwait(nf->notifF, nf->lockF);
notifiedFIFO_elt_t *ret=nf->outF;
nf->outF=nf->outF->next;
if (nf->outF==NULL)
nf->inF=NULL;
mutexunlock(nf->lockF);
return ret;
}
static inline notifiedFIFO_elt_t *pollNotifiedFIFO(notifiedFIFO_t *nf) {
int tmp=mutextrylock(nf->lockF);
if (tmp != 0 )
return NULL;
notifiedFIFO_elt_t *ret=nf->outF;
if (ret!=NULL)
nf->outF=nf->outF->next;
if (nf->outF==NULL)
nf->inF=NULL;
mutexunlock(nf->lockF);
return ret;
}
// This function aborts all messages matching the key
// If the queue is used in thread pools, it doesn't cancels already running processing
// because the message has already been picked
static inline void abortNotifiedFIFO(notifiedFIFO_t *nf, uint64_t key) {
mutexlock(nf->lockF);
notifiedFIFO_elt_t **start=&nf->outF;
while(*start!=NULL) {
if ( (*start)->key == key ) {
notifiedFIFO_elt_t *request=*start;
*start=(*start)->next;
delNotifiedFIFO_elt(request);
}
if (*start != NULL)
start=&(*start)->next;
}
mutexunlock(nf->lockF);
}
struct one_thread {
pthread_t threadID;
int id;
int coreID;
char name[256];
uint64_t runningOnKey;
bool abortFlag;
struct thread_pool *pool;
struct one_thread *next;
};
typedef struct thread_pool {
int activated;
bool measurePerf;
int traceFd;
int dummyTraceFd;
uint64_t cpuCyclesMicroSec;
uint64_t startProcessingUE;
int nbThreads;
bool restrictRNTI;
notifiedFIFO_t incomingFifo;
struct one_thread *allthreads;
} tpool_t;
static inline void pushTpool(tpool_t *t, notifiedFIFO_elt_t *msg) {
if (t->measurePerf) msg->creationTime=rdtsc();
pushNotifiedFIFO(&t->incomingFifo, msg);
}
static inline notifiedFIFO_elt_t *pullTpool(notifiedFIFO_t *responseFifo, tpool_t *t) {
notifiedFIFO_elt_t *msg= pullNotifiedFIFO(responseFifo);
if (t->measurePerf)
msg->returnTime=rdtsc();
if (t->traceFd)
if(write(t->traceFd, msg, sizeof(*msg)));
return msg;
}
static inline notifiedFIFO_elt_t *tryPullTpool(notifiedFIFO_t *responseFifo, tpool_t *t) {
notifiedFIFO_elt_t *msg= pollNotifiedFIFO(responseFifo);
if (msg == NULL)
return NULL;
if (t->measurePerf)
msg->returnTime=rdtsc();
if (t->traceFd)
if(write(t->traceFd, msg, sizeof(*msg)));
return msg;
}
static inline void abortTpool(tpool_t *t, uint64_t key) {
notifiedFIFO_t *nf=&t->incomingFifo;
mutexlock(nf->lockF);
notifiedFIFO_elt_t **start=&nf->outF;
while(*start!=NULL) {
if ( (*start)->key == key ) {
notifiedFIFO_elt_t *request=*start;
*start=(*start)->next;
delNotifiedFIFO_elt(request);
}
if (*start != NULL)
start=&(*start)->next;
}
struct one_thread *ptr=t->allthreads;
while(ptr!=NULL) {
if (ptr->runningOnKey==key)
ptr->abortFlag=true;
ptr=ptr->next;
}
mutexunlock(nf->lockF);
}
void initTpool(char *params,tpool_t *pool, bool performanceMeas);
#endif
# Thread pool
The thread pool is a working server, made of a set of worker threads that can be mapped on CPU cores.
Each worker loop on pick from the same input queue jobs to do.
When a job is done, the worker sends a return if a return is defined.
A selective abort allows to cancel parallel jobs (usage: a client pushed jobs, but from a response of one job, the other linked jobs becomes useless).
All the thread pool functions are thread safe, nevertheless the working functions are implemented by the thread pool client, so the client has to tackle the parallel execution of his functions called "processingFunc" hereafter.
## license
Author: Laurent Thomas, Open cells project
The owner share this piece code to Openairsoftware alliance as per OSA license terms
# jobs
A job is a message (notifiedFIFO_elt_t):
next: internal FIFO chain, do not set it
key: a long int that the client can use to identify a message or a group of messages
responseFifo: if the client defines a response FIFO, the message will be posted back after processing
processingFunc: any funtion (type void processingFunc(void *)) that the worker will launch
msgData: the data passed to processingFunc. It can be added automatically, or you can set it to a buffer you are managing
malloced: a boolean that enable internal free in these cases: no return Fifo or Abort feature
The job messages can be created with newNotifiedFIFO_elt() and delNotifiedFIFO_elt() or managed by the client.
# Queues of jobs
Queues are type of: notifiedFIFO_t that must be initialized by init_notifiedFIFO()
No delete function is required, the creator has only to free the data of type notifiedFIFO_t
push_notifiedFIFO() add a job in the queue
pull_notifiedFIFO() is blocking, poll_notifiedFIFO() is non blocking
abort_notifiedFIFO() allows the customer to delete all waiting jobs that match with the key (see key in jobs definition)
# Thread pools
## initialization
The clients can create one or more thread pools with init_tpool()
the params string structure: describes a list of cores, separated by "," that run a worker thread
If the core exists on the CPU, the thread pool initialization sets the affinity between this thread and the related code (use negative values is allowed, so the thread will never be mapped on a specific core).
The threads are all Linux real time scheduler, their name is set automatically is "Tpool_<core id>"
## adding jobs
The client create their jobs messages as a notifiedFIFO_elt_t, then they push it with pushTpool() (that internally calls push_notifiedFIFO())
If they need a return, they have to create response queues with init_notifiedFIFO() and set this FIFO pointer in the notifiedFIFO_elt_t before pushing the job.
## abort
A abort service abortTpool() allows to abort all jobs that match a key (see jobs "key"). When the abort returns, it garanties no job (matching the key) response will be posted on response queues.
Nevertheless, jobs already performed before the return of abortTpool() are pushed in the response Fifo queue.
## Performance measurements
A performance measurement is integrated: the pool will automacillay fill timestamps:
* creationTime: time the request is push to the pool;
* startProcessingTime: time a worker start to run on the job
* endProcessingTime: time the worker finished the job
* returnTime: time the client reads the result
if you set the environement variable: thread-pool-measurements to a valid file name
These measurements will be wrote to this Linux pipe.
A tool to read the linux fifo and display it in ascii is provided: see the local directory Makefile for this tool and to compile the thread pool unitary tests.
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.
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.
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.
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.
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.
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.
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.
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