Commit 6c823168 authored by Robert Schmidt's avatar Robert Schmidt

Merge remote-tracking branch 'origin/episys-merge-nsa' into integration_2021_wk51_d

parents f1c7cdd4 0ea0965a
......@@ -18,3 +18,8 @@ GPATH
GRTAGS
GTAGS
tags
# others
nfapi_nr_interface_scf
*.log
*.out
......@@ -8,14 +8,17 @@
"name": "(gdb) Launch",
"type": "cppdbg",
"request": "launch",
"program": "enter program name, for example ${workspaceFolder}/a.exe",
"args": [],
"program": "${workspaceFolder}/cmake_targets/ran_build/build/lte-softmodem",
"args": [
"-O", "../ci-scripts/conf_files/rcc.band7.tm1.nfapi.conf",
"--noS1"
],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"cwd": "${workspaceFolder}/cmake_targets",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"miDebuggerPath": "/path/to/gdb",
"miDebuggerPath": "${workspaceFolder}/cmake_targets/sudo-gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
......
......@@ -21,16 +21,28 @@
# OpenAirInterface License #
OpenAirInterface is under OpenAirInterface Software Alliance license.
### Included Fixes: ###
- Ease of use of gprof and address sanitizer for debugging purposes
- Updated json files to allow for GDB, real-time debugging capabilities
- Updated logging features to minimally log only key connection milestones. This imroves scalability of multiple UEs.
- Updated logging to include time stamp for timing analysis
- Updated memory allocation procedures to correct size requirements
- Added debugging features to handle signal terminations
- nfapi.c pullarray8 fix invalid pointer math
- Overlapping destination and source memory in memcpy, so updated to memmove to check for this bug
- Advanced error checking mechanisms in critical pack and unpack functions
- Created option for CPU assignment to UE to improve scalability
- Added EPC integration to allow multiple individual UE entities to each have their USIM information parced by the executables
- Updated random value seeds to minimize probability of error in generation of random values
- Enables capability round robin scheduler if desired
- Enables capability real time scheduler if desired
- Added new standalone functions to the UE phy-layer (phy_stub_ue.c) to incorporate individual UE entities
- Updated sending and packing functions in UE (lte_ue.c) to incorporate new standalone changes
- Incorporated semaphores to control timing of incoming downlink packets
- Implemented new queuing system to handle message exchange from UE to eNB and vice versa
- Updated global value in nFAPI for size of subframe
- Updated global value to increase scalability in system
* [OAI License Model](http://www.openairinterface.org/?page_id=101)
* [OAI License v1.1 on our website](http://www.openairinterface.org/?page_id=698)
It is distributed under **OAI Public License V1.1**.
The license information is distributed under [LICENSE](LICENSE) file in the same directory.
Please see [NOTICE](NOTICE.md) file for third party software that is included in the sources.
# Where to Start #
......
......@@ -404,26 +404,6 @@ pipeline {
}
}
}
stage ("Test L2 simulator") {
when {
expression {doFullTestsuite}
}
steps {
lock (vmResource) {
script {
timeout (time: 30, unit: 'MINUTES') {
try {
gitlabCommitStatus(name: "Test L2-sim") {
sh "./ci-scripts/oai-ci-vm-tool test --workspace $WORKSPACE --variant l2-sim --job-name ${JOB_NAME} --build-id ${BUILD_ID}"
}
} catch (Exception e) {
currentBuild.result = 'FAILURE'
}
}
}
}
}
}
stage ("Destroy all Virtual Machines") {
when {
expression {doMandatoryTests}
......
log_config = {
global_log_level ="info";
global_log_verbosity ="medium";
hw_log_level ="info";
hw_log_verbosity ="medium";
phy_log_level ="info";
phy_log_verbosity ="medium";
mac_log_level ="info";
mac_log_verbosity ="medium";
rlc_log_level ="info";
rlc_log_verbosity ="medium";
pdcp_log_level ="info";
pdcp_log_verbosity ="medium";
rrc_log_level ="info";
rrc_log_verbosity ="full";
};
uicc0 = {
imsi = "208950000000031";
key = "0c0a34601d4f07677303652c0462535b";
opc= "63bfa50ee6523365ff14c1f45f88737d";
dnn= "oai";
nssai_sst=222;
nssai_sd=123;
}
L1s = (
{
num_cc = 1;
tr_n_preference = "nfapi";
local_n_if_name = "ens3";
remote_n_address = "127.0.0.1"; //Proxy IP
local_n_address = "127.0.0.1";
local_n_portc = 50600;
remote_n_portc = 50601;
local_n_portd = 50610;
remote_n_portd = 50611;
}
);
RUs = (
{
local_rf = "yes"
nb_tx = 1
nb_rx = 1
att_tx = 90
att_rx = 0;
bands = [7,38,42,43];
max_pdschReferenceSignalPower = -27;
max_rxgain = 125;
}
);
log_config = {
global_log_level ="info";
global_log_verbosity ="medium";
hw_log_level ="info";
hw_log_verbosity ="medium";
phy_log_level ="info";
phy_log_verbosity ="medium";
mac_log_level ="info";
mac_log_verbosity ="medium";
rlc_log_level ="info";
rlc_log_verbosity ="medium";
pdcp_log_level ="info";
pdcp_log_verbosity ="medium";
rrc_log_level ="info";
rrc_log_verbosity ="full";
};
uicc0 = {
imsi = "208950000000031";
key = "0c0a34601d4f07677303652c0462535b";
opc= "63bfa50ee6523365ff14c1f45f88737d";
dnn= "oai";
nssai_sst=222;
nssai_sd=123;
}
L1s = (
{
num_cc = 1;
tr_n_preference = "nfapi";
local_n_if_name = "ens3";
remote_n_address = "127.0.0.1"; //Proxy IP
local_n_address = "127.0.0.1";
local_n_portc = 50600;
remote_n_portc = 50601;
local_n_portd = 50610;
remote_n_portd = 50611;
}
);
RUs = (
{
local_rf = "yes"
nb_tx = 1
nb_rx = 1
att_tx = 90
att_rx = 0;
bands = [7,38,42,43];
max_pdschReferenceSignalPower = -27;
max_rxgain = 125;
}
);
log_config = {
global_log_level ="info";
global_log_verbosity ="medium";
hw_log_level ="info";
hw_log_verbosity ="medium";
phy_log_level ="info";
phy_log_verbosity ="medium";
mac_log_level ="info";
mac_log_verbosity ="medium";
rlc_log_level ="info";
rlc_log_verbosity ="medium";
pdcp_log_level ="info";
pdcp_log_verbosity ="medium";
rrc_log_level ="info";
rrc_log_verbosity ="full";
};
uicc0 = {
imsi = "208950000000032";
key = "0c0a34601d4f07677303652c0462535b";
opc= "63bfa50ee6523365ff14c1f45f88737d";
dnn= "oai";
nssai_sst=222;
nssai_sd=123;
}
L1s = (
{
num_cc = 1;
tr_n_preference = "nfapi";
local_n_if_name = "ens3";
remote_n_address = "127.0.0.1"; //Proxy IP
local_n_address = "127.0.0.1";
local_n_portc = 50600;
remote_n_portc = 50601;
local_n_portd = 50610;
remote_n_portd = 50611;
}
);
RUs = (
{
local_rf = "yes"
nb_tx = 1
nb_rx = 1
att_tx = 90
att_rx = 0;
bands = [7,38,42,43];
max_pdschReferenceSignalPower = -27;
max_rxgain = 125;
}
);
log_config = {
global_log_level ="info";
global_log_verbosity ="medium";
hw_log_level ="info";
hw_log_verbosity ="medium";
phy_log_level ="info";
phy_log_verbosity ="medium";
mac_log_level ="info";
mac_log_verbosity ="medium";
rlc_log_level ="info";
rlc_log_verbosity ="medium";
pdcp_log_level ="info";
pdcp_log_verbosity ="medium";
rrc_log_level ="info";
rrc_log_verbosity ="full";
};
uicc0 = {
imsi = "208950000000033";
key = "0c0a34601d4f07677303652c0462535b";
opc= "63bfa50ee6523365ff14c1f45f88737d";
dnn= "oai";
nssai_sst=222;
nssai_sd=123;
}
L1s = (
{
num_cc = 1;
tr_n_preference = "nfapi";
local_n_if_name = "ens3";
remote_n_address = "127.0.0.1"; //Proxy IP
local_n_address = "127.0.0.1";
local_n_portc = 50600;
remote_n_portc = 50601;
local_n_portd = 50610;
remote_n_portd = 50611;
}
);
RUs = (
{
local_rf = "yes"
nb_tx = 1
nb_rx = 1
att_tx = 90
att_rx = 0;
bands = [7,38,42,43];
max_pdschReferenceSignalPower = -27;
max_rxgain = 125;
}
);
log_config = {
global_log_level ="info";
global_log_verbosity ="medium";
hw_log_level ="info";
hw_log_verbosity ="medium";
phy_log_level ="info";
phy_log_verbosity ="medium";
mac_log_level ="info";
mac_log_verbosity ="medium";
rlc_log_level ="info";
rlc_log_verbosity ="medium";
pdcp_log_level ="info";
pdcp_log_verbosity ="medium";
rrc_log_level ="info";
rrc_log_verbosity ="full";
};
uicc0 = {
imsi = "208950000000034";
key = "0c0a34601d4f07677303652c0462535b";
opc= "63bfa50ee6523365ff14c1f45f88737d";
dnn= "oai";
nssai_sst=222;
nssai_sd=123;
}
L1s = (
{
num_cc = 1;
tr_n_preference = "nfapi";
local_n_if_name = "ens3";
remote_n_address = "127.0.0.1"; //Proxy IP
local_n_address = "127.0.0.1";
local_n_portc = 50600;
remote_n_portc = 50601;
local_n_portd = 50610;
remote_n_portd = 50611;
}
);
RUs = (
{
local_rf = "yes"
nb_tx = 1
nb_rx = 1
att_tx = 90
att_rx = 0;
bands = [7,38,42,43];
max_pdschReferenceSignalPower = -27;
max_rxgain = 125;
}
);
This diff is collapsed.
log_config = {
global_log_level ="info";
global_log_verbosity ="medium";
hw_log_level ="info";
hw_log_verbosity ="medium";
phy_log_level ="info";
phy_log_verbosity ="medium";
mac_log_level ="info";
mac_log_verbosity ="medium";
rlc_log_level ="info";
rlc_log_verbosity ="medium";
pdcp_log_level ="info";
pdcp_log_verbosity ="medium";
rrc_log_level ="info";
rrc_log_verbosity ="full";
};
L1s = (
{
num_cc = 1;
tr_n_preference = "nfapi";
local_n_if_name = "ens3";
remote_n_address = "127.0.0.1"; //Proxy IP
local_n_address = "127.0.0.1";
local_n_portc = 50000;
remote_n_portc = 50001;
local_n_portd = 50010;
remote_n_portd = 50011;
}
);
RUs = (
{
local_rf = "yes"
nb_tx = 1
nb_rx = 1
att_tx = 90
att_rx = 0;
bands = [7,38,42,43];
max_pdschReferenceSignalPower = -27;
max_rxgain = 125;
}
);
This diff is collapsed.
log_config = {
global_log_level ="info";
global_log_verbosity ="medium";
hw_log_level ="info";
hw_log_verbosity ="medium";
phy_log_level ="info";
phy_log_verbosity ="medium";
mac_log_level ="info";
mac_log_verbosity ="medium";
rlc_log_level ="info";
rlc_log_verbosity ="medium";
pdcp_log_level ="info";
pdcp_log_verbosity ="medium";
rrc_log_level ="info";
rrc_log_verbosity ="full";
};
uicc0 = {
imsi = "2089900007487";
key = "fec86ba6eb707ed08905757b1bb44b8f";
opc= "C42449363BBAD02B66D16BC975D77CC1";
dnn= "oai";
nssai_sst=1;
nssai_sd=1;
}
L1s = (
{
num_cc = 1;
tr_n_preference = "nfapi";
local_n_if_name = "lo:";
remote_n_address = "127.0.0.1"; //Proxy IP
local_n_address = "127.0.0.1";
local_n_portc = 50600;
remote_n_portc = 50601;
local_n_portd = 50610;
remote_n_portd = 50611;
}
);
RUs = (
{
local_rf = "yes"
nb_tx = 1
nb_rx = 1
att_tx = 90
att_rx = 0;
bands = [7,38,42,43];
max_pdschReferenceSignalPower = -27;
max_rxgain = 125;
}
);
This diff is collapsed.
log_config = {
global_log_level ="info";
global_log_verbosity ="medium";
hw_log_level ="info";
hw_log_verbosity ="medium";
phy_log_level ="info";
phy_log_verbosity ="medium";
mac_log_level ="info";
mac_log_verbosity ="medium";
rlc_log_level ="info";
rlc_log_verbosity ="medium";
pdcp_log_level ="info";
pdcp_log_verbosity ="medium";
rrc_log_level ="info";
rrc_log_verbosity ="full";
};
L1s = (
{
num_cc = 1;
tr_n_preference = "nfapi";
local_n_if_name = "lo";
remote_n_address = "127.0.0.1";
local_n_address = "127.0.0.1";
local_n_portc = 50000;
remote_n_portc = 50001;
local_n_portd = 50010;
remote_n_portd = 50011;
}
);
RUs = (
{
local_rf = "yes"
nb_tx = 1
nb_rx = 1
att_tx = 90
att_rx = 0;
bands = [7,38,42,43];
max_pdschReferenceSignalPower = -27;
max_rxgain = 125;
}
);
log_config = {
global_log_level ="info";
global_log_verbosity ="medium";
hw_log_level ="info";
hw_log_verbosity ="medium";
phy_log_level ="info";
phy_log_verbosity ="medium";
mac_log_level ="info";
mac_log_verbosity ="medium";
rlc_log_level ="info";
rlc_log_verbosity ="medium";
pdcp_log_level ="info";
pdcp_log_verbosity ="medium";
rrc_log_level ="info";
rrc_log_verbosity ="full";
};
L1s = (
{
num_cc = 1;
tr_n_preference = "nfapi";
local_n_if_name = "ens3";
remote_n_address = "127.0.0.1"; //Proxy IP
local_n_address = "127.0.0.1";
local_n_portc = 50600;
remote_n_portc = 50601;
local_n_portd = 50610;
remote_n_portd = 50611;
}
);
RUs = (
{
local_rf = "yes"
nb_tx = 1
nb_rx = 1
att_tx = 90
att_rx = 0;
bands = [7,38,42,43];
max_pdschReferenceSignalPower = -27;
max_rxgain = 125;
}
);
......@@ -1033,116 +1033,6 @@ function report_test {
echo " </div>" >> ./test_simulator_results.html
fi
ARCHIVES_LOC=archives/l2_sim/test
if [ -d $ARCHIVES_LOC ]
then
echo " <h3>4G LTE L2-NFAPI Simulator Check</h3>" >> ./test_simulator_results.html
if [ -f $ARCHIVES_LOC/test_final_status.log ]
then
if [ `grep -c TEST_OK $ARCHIVES_LOC/test_final_status.log` -eq 1 ]
then
echo " <div class=\"alert alert-success\">" >> ./test_simulator_results.html
echo " <strong>TEST was SUCCESSFUL <span class=\"glyphicon glyphicon-ok-circle\"></span></strong>" >> ./test_simulator_results.html
echo " </div>" >> ./test_simulator_results.html
else
echo " <div class=\"alert alert-danger\">" >> ./test_simulator_results.html
echo " <strong>TEST was a FAILURE! <span class=\"glyphicon glyphicon-ban-circle\"></span></strong>" >> ./test_simulator_results.html
echo " </div>" >> ./test_simulator_results.html
fi
else
echo " <div class=\"alert alert-danger\">" >> ./test_simulator_results.html
echo " <strong>COULD NOT DETERMINE TEST FINAL STATUS! <span class=\"glyphicon glyphicon-ban-circle\"></span></strong>" >> ./test_simulator_results.html
echo " </div>" >> ./test_simulator_results.html
fi
echo " <button data-toggle=\"collapse\" data-target=\"#oai-l2-sim-test-details\">More details on L2-NFAPI Simulator test results</button>" >> ./test_simulator_results.html
echo " <div id=\"oai-l2-sim-test-details\" class=\"collapse\">" >> ./test_simulator_results.html
echo " <table border = \"1\">" >> ./test_simulator_results.html
echo " <tr bgcolor = \"#33CCFF\" >" >> ./test_simulator_results.html
echo " <th>Log File Name</th>" >> ./test_simulator_results.html
echo " <th>Command</th>" >> ./test_simulator_results.html
echo " <th>Status</th>" >> ./test_simulator_results.html
echo " <th>Statistics</th>" >> ./test_simulator_results.html
echo " </tr>" >> ./test_simulator_results.html
EPC_CONFIGS=("wS1" "noS1")
TRANS_MODES=("fdd")
BW_CASES=(05)
NB_USERS=(01 04)
for CN_CONFIG in ${EPC_CONFIGS[@]}
do
for TMODE in ${TRANS_MODES[@]}
do
for BW in ${BW_CASES[@]}
do
for UES in ${NB_USERS[@]}
do
echo " <tr bgcolor = \"#8FBC8F\" >" >> ./test_simulator_results.html
if [[ $CN_CONFIG =~ .*wS1.* ]]
then
echo " <td align = \"center\" colspan = 4 >Test with EPC (aka withS1): ${TMODE} -- ${BW}MHz -- ${UES} user(s)</td>" >> ./test_simulator_results.html
else
echo " <td align = \"center\" colspan = 4 >Test without EPC (aka noS1): ${TMODE} -- ${BW}MHz -- ${UES} user(s)</td>" >> ./test_simulator_results.html
fi
echo " </tr>" >> ./test_simulator_results.html
ENB_LOG=$ARCHIVES_LOC/${TMODE}_${BW}MHz_${UES}users_${CN_CONFIG}_enb.log
UE_LOG=`echo $ENB_LOG | sed -e "s#enb#ue#"`
if [ -f $ENB_LOG ] && [ -f $UE_LOG ]
then
NAME_ENB=`echo $ENB_LOG | sed -e "s#$ARCHIVES_LOC/##"`
NAME_UE=`echo $UE_LOG | sed -e "s#$ARCHIVES_LOC/##"`
echo " <tr>" >> ./test_simulator_results.html
echo " <td>$NAME_ENB --- $NAME_UE</td>" >> ./test_simulator_results.html
echo " <td>N/A</td>" >> ./test_simulator_results.html
NB_ENB_GOT_SYNC=`egrep -c "got sync" $ENB_LOG`
NB_UE_GOT_SYNC=`egrep -c "got sync" $UE_LOG`
NB_ENB_SYNCED_WITH_UE=`egrep -c "Sending NFAPI_START_RESPONSE" $UE_LOG`
if [ $NB_ENB_GOT_SYNC -gt 0 ] && [ $NB_UE_GOT_SYNC -gt 2 ] && [ $NB_ENB_SYNCED_WITH_UE -gt 0 ]
then
echo " <td bgcolor = \"green\" >OK</td>" >> ./test_simulator_results.html
else
echo " <td bgcolor = \"red\" >KO</td>" >> ./test_simulator_results.html
fi
echo " <td><pre>" >> ./test_simulator_results.html
if [ $NB_ENB_GOT_SYNC -gt 0 ]
then
echo "<font color = \"blue\">- eNB --> got sync</font>" >> ./test_simulator_results.html
else
echo "<font color = \"red\"><b>- eNB NEVER got sync</b></font>" >> ./test_simulator_results.html
fi
if [ $NB_UE_GOT_SYNC -gt 2 ]
then
echo "<font color = \"blue\">- UE --> got sync</font>" >> ./test_simulator_results.html
else
echo "<font color = \"red\"><b>- UE NEVER got sync</b></font>" >> ./test_simulator_results.html
fi
if [ $NB_ENB_SYNCED_WITH_UE -gt 0 ]
then
echo "<font color = \"blue\">- UE attached to eNB</font>" >> ./test_simulator_results.html
else
echo "<font color = \"red\"><b>- UE NEVER attached to eNB</b></font>" >> ./test_simulator_results.html
fi
echo " </pre></td>" >> ./test_simulator_results.html
echo " </tr>" >> ./test_simulator_results.html
fi
PING_LOGS=`ls $ARCHIVES_LOC/${TMODE}_${BW}MHz_${UES}users_${CN_CONFIG}_ping*.log 2> /dev/null`
analyzePingFiles
IPERF_TESTS=`ls $ARCHIVES_LOC/${TMODE}_${BW}MHz_${UES}users_${CN_CONFIG}_iperf_dl*client*txt 2> /dev/null`
analyzeIperfFiles
IPERF_TESTS=`ls $ARCHIVES_LOC/${TMODE}_${BW}MHz_${UES}users_${CN_CONFIG}_iperf_ul*client*txt 2> /dev/null`
analyzeIperfFiles
done
done
done
done
echo " </table>" >> ./test_simulator_results.html
echo " </div>" >> ./test_simulator_results.html
fi
ARCHIVES_LOC=archives/phy_sim/test
if [ -d $ARCHIVES_LOC ]
then
......
......@@ -1472,13 +1472,18 @@ function run_test_on_vm {
echo "############################################################"
echo "OAI CI VM script"
echo "############################################################"
if [[ (( "$RUN_OPTIONS" == "complex" ) && ( $VM_NAME =~ .*-l2-sim.* )) ]] || [[ (( "$RUN_OPTIONS" == "complex" ) && ( $VM_NAME =~ .*-rf-sim.* )) ]]
if [[ (( "$RUN_OPTIONS" == "complex" ) && ( $VM_NAME =~ .*-l2-sim.* )) ]]
then
ENB_VM_NAME=`echo $VM_NAME | sed -e "s#l2-sim#enb-ethernet#" -e "s#rf-sim#enb-ethernet#"`
echo "This VM test type is no longer supported in the pipeline framework"
return
fi
if [[ (( "$RUN_OPTIONS" == "complex" ) && ( $VM_NAME =~ .*-rf-sim.* )) ]]
then
ENB_VM_NAME=`echo $VM_NAME | sed -e "s#rf-sim#enb-ethernet#"`
ENB_VM_CMDS=${ENB_VM_NAME}_cmds.txt
echo "ENB_VM_NAME = $ENB_VM_NAME"
echo "ENB_VM_CMD_FILE = $ENB_VM_CMDS"
UE_VM_NAME=`echo $VM_NAME | sed -e "s#l2-sim#ue-ethernet#" -e "s#rf-sim#ue-ethernet#"`
UE_VM_NAME=`echo $VM_NAME | sed -e "s#rf-sim#ue-ethernet#"`
UE_VM_CMDS=${UE_VM_NAME}_cmds.txt
echo "UE_VM_NAME = $UE_VM_NAME"
echo "UE_VM_CMD_FILE = $UE_VM_CMDS"
......@@ -1499,7 +1504,7 @@ function run_test_on_vm {
echo "JENKINS_WKSP = $JENKINS_WKSP"
echo "ARCHIVES_LOC = $ARCHIVES_LOC"
if [[ (( "$RUN_OPTIONS" == "complex" ) && ( $VM_NAME =~ .*-l2-sim.* )) ]] || [[ (( "$RUN_OPTIONS" == "complex" ) && ( $VM_NAME =~ .*-rf-sim.* )) ]]
if [[ (( "$RUN_OPTIONS" == "complex" ) && ( $VM_NAME =~ .*-rf-sim.* )) ]]
then
echo "############################################################"
echo "Waiting for ENB VM to be started"
......
.usim.*
.ue_emm.nvram*
.ue.nvram*
......@@ -359,6 +359,10 @@ set(CMAKE_C_FLAGS_DEBUG "${debugOpt} -O0")
set(CMAKE_C_FLAGS_RELWITHDEBINFO "${debugOpt} -O2")
set(CMAKE_C_FLAGS_RELEASE "-O3")
# Enable assert() for RelWithDebInfo builds
string(REPLACE "-DNDEBUG" "" CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO}")
string(REPLACE "-DNDEBUG" "" CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}")
set(GIT_BRANCH "UNKNOWN")
set(GIT_COMMIT_HASH "UNKNOWN")
set(GIT_COMMIT_DATE "UNKNOWN")
......@@ -1472,6 +1476,7 @@ set(NFAPI_USER_SRC
${NFAPI_USER_DIR}/nfapi.c
${NFAPI_USER_DIR}/nfapi_pnf.c
${NFAPI_USER_DIR}/nfapi_vnf.c
${NFAPI_USER_DIR}/gnb_ind_vars.c
)
add_library(NFAPI_USER_LIB ${NFAPI_USER_SRC})
add_dependencies(NFAPI_USER_LIB rrc_flag)
......@@ -2025,6 +2030,7 @@ set(NR_L2_SRC_UE
${NR_UE_RRC_DIR}/L2_interface_ue.c
${NR_UE_RRC_DIR}/main_ue.c
${NR_UE_RRC_DIR}/rrc_UE.c
${NR_UE_RRC_DIR}/rrc_nsa.c
)
set (MAC_SRC
......@@ -2069,6 +2075,7 @@ set (MAC_NR_SRC
set (MAC_SRC_UE
${PHY_INTERFACE_DIR}/phy_stub_UE.c
${PHY_INTERFACE_DIR}/queue_t.c
${MAC_DIR}/main_ue.c
${MAC_DIR}/ue_procedures.c
${MAC_DIR}/ra_procedures.c
......@@ -2782,6 +2789,7 @@ add_executable(lte-softmodem
${OPENAIR3_DIR}/NAS/UE/nas_ue_task.c
${OPENAIR_DIR}/common/utils/utils.c
${OPENAIR_DIR}/common/utils/system.c
${PHY_INTERFACE_DIR}/queue_t.c
${OPENAIR_DIR}/common/utils/lte/ue_power.c
${OPENAIR_DIR}/common/utils/lte/prach_utils.c
${XFORMSINTERFACE_SOURCE}
......@@ -2826,6 +2834,7 @@ add_executable(ocp-enb
${OPENAIR_DIR}/common/utils/system.c
${OPENAIR_DIR}/common/utils/lte/ue_power.c
${OPENAIR_DIR}/common/utils/lte/prach_utils.c
${PHY_INTERFACE_DIR}/queue_t.c
${XFORMSINTERFACE_SOURCE}
${T_SOURCE}
${CONFIG_SOURCES}
......@@ -2966,6 +2975,7 @@ add_executable(nr-softmodem
${OPENAIR_DIR}/common/utils/lte/ue_power.c
${OPENAIR_DIR}/common/utils/lte/prach_utils.c
${OPENAIR_DIR}/common/utils/nr/nr_common.c
${PHY_INTERFACE_DIR}/queue_t.c
${XFORMSINTERFACE_SOURCE}
${T_SOURCE}
${CONFIG_SOURCES}
......@@ -3006,6 +3016,7 @@ add_executable(ocp-gnb
${OPENAIR_DIR}/common/utils/nr/nr_common.c
${OPENAIR_DIR}/common/utils/utils.c
${OPENAIR_DIR}/common/utils/system.c
${PHY_INTERFACE_DIR}/queue_t.c
${XFORMS_SOURCE_NR}
${T_SOURCE}
${CONFIG_SOURCES}
......@@ -3209,14 +3220,16 @@ add_executable(nr_dlsim
${OPENAIR_DIR}/executables/softmodem-common.c
${OPENAIR2_DIR}/RRC/NAS/nas_config.c
${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/netlink_init.c
${NR_UE_RRC_DIR}/rrc_nsa.c
${NFAPI_USER_DIR}/nfapi.c
${OPENAIR_DIR}/common/utils/threadPool/thread-pool.c
${PHY_INTERFACE_DIR}/queue_t.c
${UTIL_SRC}
${T_SOURCE}
${SHLIB_LOADER_SOURCES}
)
target_link_libraries(nr_dlsim
-Wl,--start-group UTIL SIMU_COMMON SIMU PHY_COMMON PHY_NR_COMMON PHY_NR PHY_NR_UE SCHED_NR_LIB SCHED_NR_UE_LIB MAC_NR MAC_UE_NR MAC_NR_COMMON RRC_LIB NR_RRC_LIB CONFIG_LIB L2_LTE_NR L2_NR HASHTABLE X2AP_ENB X2AP_LIB SECU_CN NGAP_GNB -Wl,--end-group
-Wl,--start-group UTIL SIMU_COMMON SIMU PHY_COMMON PHY_NR_COMMON PHY_NR PHY_NR_UE SCHED_NR_LIB SCHED_NR_UE_LIB MAC_NR MAC_UE_NR MAC_NR_COMMON RRC_LIB NR_RRC_LIB CONFIG_LIB L2_LTE_NR L2_NR HASHTABLE X2AP_ENB X2AP_LIB SECU_CN NGAP_GNB NFAPI_COMMON_LIB NFAPI_LIB NFAPI_PNF_LIB NFAPI_USER_LIB -lz -Wl,--end-group
m pthread ${ATLAS_LIBRARIES} ${T_LIB} ITTI ${OPENSSL_LIBRARIES} dl
)
target_compile_definitions(nr_dlsim PUBLIC -DPHYSICAL_SIMULATOR)
......@@ -3229,13 +3242,15 @@ add_executable(nr_prachsim
${OPENAIR1_DIR}/SCHED_NR/phy_procedures_nr_common.c
${OPENAIR2_DIR}/RRC/NAS/nas_config.c
${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/netlink_init.c
${NR_UE_RRC_DIR}/rrc_nsa.c
${NFAPI_USER_DIR}/nfapi.c
${OPENAIR_DIR}/common/utils/threadPool/thread-pool.c
${PHY_INTERFACE_DIR}/queue_t.c
${UTIL_SRC}
${T_SOURCE}
${SHLIB_LOADER_SOURCES})
target_link_libraries(nr_prachsim
-Wl,--start-group UTIL SIMU_COMMON SIMU PHY_COMMON PHY_NR_COMMON PHY_NR PHY_RU PHY_NR_UE MAC_NR_COMMON SCHED_NR_LIB SCHED_NR_UE_LIB MAC_NR MAC_UE_NR MAC_NR_COMMON RRC_LIB NR_RRC_LIB CONFIG_LIB L2_LTE_NR L2_NR HASHTABLE X2AP_ENB X2AP_LIB SECU_CN NGAP_GNB -Wl,--end-group
-Wl,--start-group UTIL SIMU_COMMON SIMU PHY_COMMON PHY_NR_COMMON PHY_NR PHY_RU PHY_NR_UE MAC_NR_COMMON SCHED_NR_LIB SCHED_NR_UE_LIB MAC_NR MAC_UE_NR MAC_NR_COMMON RRC_LIB NR_RRC_LIB CONFIG_LIB L2_LTE_NR L2_NR HASHTABLE X2AP_ENB X2AP_LIB SECU_CN NGAP_GNB NFAPI_COMMON_LIB NFAPI_LIB NFAPI_PNF_LIB NFAPI_USER_LIB -lz -Wl,--end-group
m pthread ${ATLAS_LIBRARIES} ${T_LIB} ITTI ${OPENSSL_LIBRARIES} dl)
add_executable(nr_ulschsim
......@@ -3244,6 +3259,7 @@ add_executable(nr_ulschsim
${OPENAIR_DIR}/common/utils/utils.c
${OPENAIR_DIR}/common/utils/system.c
${OPENAIR_DIR}/common/utils/nr/nr_common.c
${PHY_INTERFACE_DIR}/queue_t.c
${UTIL_SRC}
${T_SOURCE}
${SHLIB_LOADER_SOURCES}
......@@ -3262,13 +3278,15 @@ add_executable(nr_ulsim
${OPENAIR_DIR}/executables/softmodem-common.c
${OPENAIR2_DIR}/RRC/NAS/nas_config.c
${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/netlink_init.c
${NR_UE_RRC_DIR}/rrc_nsa.c
${NFAPI_USER_DIR}/nfapi.c
${PHY_INTERFACE_DIR}/queue_t.c
${UTIL_SRC}
${T_SOURCE}
${SHLIB_LOADER_SOURCES}
)
target_link_libraries(nr_ulsim
-Wl,--start-group UTIL SIMU_COMMON SIMU PHY_COMMON PHY_NR_COMMON PHY_NR PHY_NR_UE SCHED_NR_LIB SCHED_NR_UE_LIB MAC_NR MAC_UE_NR MAC_NR_COMMON RRC_LIB NR_RRC_LIB CONFIG_LIB L2_LTE_NR L2_NR HASHTABLE X2AP_ENB X2AP_LIB SECU_CN NGAP_GNB -Wl,--end-group
-Wl,--start-group UTIL SIMU_COMMON SIMU PHY_COMMON PHY_NR_COMMON PHY_NR PHY_NR_UE SCHED_NR_LIB SCHED_NR_UE_LIB MAC_NR MAC_UE_NR MAC_NR_COMMON RRC_LIB NR_RRC_LIB CONFIG_LIB L2_LTE_NR L2_NR HASHTABLE X2AP_ENB X2AP_LIB SECU_CN NGAP_GNB NFAPI_COMMON_LIB NFAPI_LIB NFAPI_PNF_LIB NFAPI_USER_LIB -lz -Wl,--end-group
m pthread ${ATLAS_LIBRARIES} ${T_LIB} ITTI ${OPENSSL_LIBRARIES} dl
)
target_compile_definitions(nr_ulsim PUBLIC -DPHYSICAL_SIMULATOR)
......
......@@ -43,6 +43,8 @@
#include <string.h>
#include <linux/prctl.h>
#include "common/config/config_userapi.h"
#include <time.h>
#include <sys/time.h>
// main log variables
......@@ -508,6 +510,53 @@ char *log_getthreadname(char *threadname,
}
}
#if LOG_MINIMAL
#include <sys/syscall.h>
void logMinimal(int comp, int level, const char *format, ...)
{
struct timespec ts;
if (clock_gettime(CLOCK_MONOTONIC, &ts) == -1)
abort();
char buf[MAX_LOG_TOTAL];
int n = snprintf(buf, sizeof(buf), "%lu.%06lu %08lx [%s] %c ",
ts.tv_sec,
ts.tv_nsec / 1000,
syscall(__NR_gettid),
g_log->log_component[comp].name,
level);
if (n < 0 || n >= sizeof(buf))
{
fprintf(stderr, "%s: n=%d\n", __func__, n);
return;
}
va_list args;
va_start(args, format);
int m = vsnprintf(buf + n, sizeof(buf) - n, format, args);
va_end(args);
if (m < 0)
{
fprintf(stderr, "%s: n=%d m=%d\n", __func__, n, m);
return;
}
int len = n + m;
if (len > sizeof(buf) - 1)
{
len = sizeof(buf) - 1;
}
if (buf[len - 1] != '\n')
{
buf[len++] = '\n';
}
__attribute__((unused))
int unused = write(STDOUT_FILENO, buf, len);
}
#endif // LOG_MINIMAL
static int log_header(char *log_buffer,
int buffsize,
int comp,
......
......@@ -54,6 +54,12 @@
#include "T.h"
#include <common/utils/utils.h>
/*----------------------------------------------------------------------------*/
#include <assert.h>
#ifdef NDEBUG
#warning assert is disabled
#endif
#define NUM_ELEMENTS(ARRAY) (sizeof(ARRAY) / sizeof(ARRAY[0]))
#define CHECK_INDEX(ARRAY, INDEX) assert((INDEX) < NUM_ELEMENTS(ARRAY))
#ifdef __cplusplus
extern "C" {
......@@ -402,10 +408,32 @@ int32_t write_file_matlab(const char *fname, const char *vname, void *data, int
#define LOG_DUMP_DOUBLE 1
// debugging macros
#define LOG_F LOG_I /* because LOG_F was originaly to dump a message or buffer but is also used as a regular level...., to dump use LOG_DUMPMSG */
#define LOG_MINIMAL 1 /* 1 for minimal logging: E, W and A */
#if LOG_MINIMAL
void logMinimal(int component, int level, const char *format, ...) __attribute__((format(printf, 3, 4)));
# define LOG_E(COMPONENT, ...) do if (1) logMinimal(COMPONENT, 'E', __VA_ARGS__); while (0)
# define LOG_W(COMPONENT, ...) do if (1) logMinimal(COMPONENT, 'W', __VA_ARGS__); while (0)
# define LOG_A(COMPONENT, ...) do if (1) logMinimal(COMPONENT, 'A', __VA_ARGS__); while (0) /* logs intended for analysis */
# define LOG_I(COMPONENT, ...) do if (1) logMinimal(COMPONENT, 'I', __VA_ARGS__); while (0)
# define LOG_D(COMPONENT, ...) do if (0) logMinimal(COMPONENT, 'D', __VA_ARGS__); while (0)
# define LOG_T(COMPONENT, ...) do if (0) logMinimal(COMPONENT, 'T', __VA_ARGS__); while (0)
# define LOG_M(FILE, VECTOR, DATA, LEN, DEC, FORMAT) ((void) 0)
# define LOG_DUMPFLAG(D) 0
# define LOG_DEBUGFLAG(D) 0
# define LOG_DUMPMSG(C, B, S, X...) ((void) 0)
# define VLOG(C, L, F, ARGS) ((void) 0)
#else // LOG_MINIMAL
# if T_TRACER
/* per component, level dependent macros */
# define LOG_E(c, x...) do { if (T_stdout) { if( g_log->log_component[c].level >= OAILOG_ERR ) logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_ERR, x) ;} else { T(T_LEGACY_ ## c ## _ERROR, T_PRINTF(x)) ;}} while (0)
# define LOG_W(c, x...) do { if (T_stdout) { if( g_log->log_component[c].level >= OAILOG_WARNING) logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_WARNING, x) ;} else { T(T_LEGACY_ ## c ## _WARNING, T_PRINTF(x)) ;}} while (0)
# define LOG_A LOG_I
# define LOG_I(c, x...) do { if (T_stdout) { if( g_log->log_component[c].level >= OAILOG_INFO ) logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_INFO, x) ;} else { T(T_LEGACY_ ## c ## _INFO, T_PRINTF(x)) ;}} while (0)
# define LOG_D(c, x...) do { if (T_stdout) { if( g_log->log_component[c].level >= OAILOG_DEBUG ) logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_DEBUG, x) ;} else { T(T_LEGACY_ ## c ## _DEBUG, T_PRINTF(x)) ;}} while (0)
# define LOG_T(c, x...) do { if (T_stdout) { if( g_log->log_component[c].level >= OAILOG_TRACE ) logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_TRACE, x) ;} else { T(T_LEGACY_ ## c ## _TRACE, T_PRINTF(x)) ;}} while (0)
......@@ -425,6 +453,7 @@ int32_t write_file_matlab(const char *fname, const char *vname, void *data, int
# define LOG_E(c, x...) do { if( g_log->log_component[c].level >= OAILOG_ERR ) logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_ERR, x) ;} while (0)
# define LOG_W(c, x...) do { if( g_log->log_component[c].level >= OAILOG_WARNING) logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_WARNING, x) ;} while (0)
# define LOG_I(c, x...) do { if( g_log->log_component[c].level >= OAILOG_INFO ) logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_INFO, x) ;} while (0)
# define LOG_A LOG_I
# define LOG_D(c, x...) do { if( g_log->log_component[c].level >= OAILOG_DEBUG ) logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_DEBUG, x) ;} while (0)
# define LOG_T(c, x...) do { if( g_log->log_component[c].level >= OAILOG_TRACE ) logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_TRACE, x) ;} while (0)
# define VLOG(c,l, f, args) do { if( g_log->log_component[c].level >= l ) vlogRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, l, f, args) ; } while (0)
......@@ -438,6 +467,8 @@ int32_t write_file_matlab(const char *fname, const char *vname, void *data, int
# define LOG_VAR(A,B) A B
# define T_ACTIVE(a) (0)
# endif /* T_TRACER */
#endif // LOG_MINIMAL
/* avoid warnings for variables only used in LOG macro's but set outside debug section */
#define GCC_NOTUSED __attribute__((unused))
#define LOG_USEDINLOG_VAR(A,B) GCC_NOTUSED A B
......
......@@ -438,9 +438,22 @@ extern "C" {
void itti_send_terminate_message(task_id_t task_id) {
}
static volatile bool shutting_down;
static void catch_sigterm(int) {
static const char msg[] = "\n** Caught SIGTERM, shutting down\n";
__attribute__((unused))
int unused = write(STDOUT_FILENO, msg, sizeof(msg) - 1);
shutting_down = true;
}
void itti_wait_tasks_end(void) {
while(1)
sleep(24*3600);
shutting_down = false;
signal(SIGTERM, catch_sigterm);
while (! shutting_down)
{
sleep(24 * 3600);
}
}
void itti_update_lte_time(uint32_t frame, uint8_t slot) {}
......@@ -455,4 +468,42 @@ extern "C" {
int signal_mask(void) {
return 0;
}
void log_scheduler(const char* label)
{
int policy = sched_getscheduler(0);
struct sched_param param;
if (sched_getparam(0, &param) == -1)
{
LOG_E(HW, "sched_getparam: %s\n", strerror(errno));
abort();
}
cpu_set_t cpu_set;
if (sched_getaffinity(0, sizeof(cpu_set), &cpu_set) == -1)
{
LOG_E(HW, "sched_getaffinity: %s\n", strerror(errno));
abort();
}
int num_cpus = sysconf(_SC_NPROCESSORS_ONLN);
if (num_cpus < 1)
{
LOG_E(HW, "sysconf(_SC_NPROCESSORS_ONLN): %s\n", strerror(errno));
abort();
}
char buffer[num_cpus];
for (int i = 0; i < num_cpus; i++)
{
buffer[i] = CPU_ISSET(i, &cpu_set) ? 'Y' : '-';
}
LOG_A(HW, "Scheduler policy=%d priority=%d affinity=[%d]%.*s label=%s\n",
policy,
param.sched_priority,
num_cpus,
num_cpus,
buffer,
label);
}
} // extern "C"
......@@ -346,6 +346,8 @@ void *rrc_enb_process_msg(void *);
TASK_DEF(TASK_DU_F1, TASK_PRIORITY_MED, 200, NULL, NULL) \
TASK_DEF(TASK_RRC_UE_SIM, TASK_PRIORITY_MED, 200, NULL, NULL) \
TASK_DEF(TASK_RRC_GNB_SIM, TASK_PRIORITY_MED, 200, NULL, NULL) \
TASK_DEF(TASK_RRC_NSA_UE, TASK_PRIORITY_MED, 200, NULL, NULL) \
TASK_DEF(TASK_RRC_NSA_NRUE, TASK_PRIORITY_MED, 200, NULL, NULL) \
TASK_DEF(TASK_NAS_NRUE, TASK_PRIORITY_MED, 200, NULL, NULL) \
TASK_DEF(TASK_MAX, TASK_PRIORITY_MED, 200, NULL, NULL)
......@@ -362,6 +364,8 @@ typedef enum {
FOREACH_TASK(TASK_ENUM)
} task_id_t;
extern uint16_t ue_idx_standalone;
extern uint16_t node_number;
typedef task_id_t thread_id_t;
......@@ -586,6 +590,7 @@ int timer_remove(long timer_id);
int signal_handle(int *end);
int signal_mask(void);
void log_scheduler(const char *label);
#ifdef __cplusplus
}
#endif
......
......@@ -2,6 +2,9 @@
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <unistd.h>
#include <sched.h>
#include <errno.h>
#include "utils.h"
void *calloc_or_fail(size_t size) {
......@@ -22,6 +25,32 @@ void *malloc_or_fail(size_t size) {
return ptr;
}
const char *hexdump(const void *data, size_t data_len, char *out, size_t out_len)
{
char *p = out;
char *endp = out + out_len;
const uint8_t *q = data;
snprintf(p, endp - p, "[%zu]", data_len);
p += strlen(p);
for (size_t i = 0; i < data_len; ++i)
{
if (p >= endp)
{
static const char ellipses[] = "...";
char *s = endp - sizeof(ellipses);
if (s >= p)
{
strcpy(s, ellipses);
}
break;
}
snprintf(p, endp - p, " %02X", *q++);
p += strlen(p);
}
return out;
}
/****************************************************************************
** **
** Name: hex_char_to_hex_value() **
......@@ -111,3 +140,32 @@ void *memcpy1(void *dst,const void *src,size_t n) {
asm volatile("rep movsb" : "+D" (dst) : "c"(n), "S"(src) : "cc","memory");
return(ret);
}
void set_priority(int priority)
{
/* When running with a realtime scheduler, a buggy run-away process can take
down the host requiring a reboot to recover. To avoid this scenario, we
use alarm(2) to set a maximum running time */
unsigned max_runtime_seconds = 10 * 60; /* default */
const char *env = getenv("MAX_RUNTIME_SECONDS");
if (env != NULL)
{
max_runtime_seconds = atoi(env);
}
unsigned was_alarm = alarm(max_runtime_seconds);
/* Normally, was_alarm should be 0 indicating there was no previous alarm set.
A non-zero value could indicate a mistake */
fprintf(stderr, "Set alarm for %u seconds, was %u (see $MAX_RUNTIME_SECONDS)\n",
max_runtime_seconds, was_alarm);
struct sched_param param =
{
.sched_priority = priority,
};
fprintf(stderr, "Calling sched_setscheduler(%d)\n", priority);
if (sched_setscheduler(0, SCHED_RR, &param) == -1)
{
fprintf(stderr, "sched_setscheduler: %s\n", strerror(errno));
abort();
}
}
......@@ -10,6 +10,7 @@ extern "C" {
#define sizeofArray(a) (sizeof(a)/sizeof(*(a)))
void *calloc_or_fail(size_t size);
void *malloc_or_fail(size_t size);
const char *hexdump(const void *data, size_t data_len, char *out, size_t out_len);
// Converts an hexadecimal ASCII coded digit into its value. **
int hex_char_to_hex_value (char c);
......@@ -18,6 +19,7 @@ int hex_string_to_hex_value (uint8_t *hex_value, const char *hex_string, int siz
void *memcpy1(void *dst,const void *src,size_t n);
void set_priority(int priority);
char *itoa(int i);
......
There are fundamental changes to the L2 emulation mechanism; these changes allow the
user to run multiple UEs in separate Linux processes/machines/VMs/etc. They use a separate
entity between the UE(s) and eNB. The UEs use nFAPI to communicate with the eNB. The
nFAPI interface allows us to run in an emulated layer 2 mode, meaning that we are bypassing
the layer 1 (PHY) functionality. Because we are bypassing the PHY layer,
channel modeling capabilties have been added in the LTE UE phy_stub_ue.c file. To understand
the interfaces between the different components associated with LTE mode, the image
functional_diagram_proxy_lte.png has been provided.
This functionality allows the user to plug in their own channel model and emulate the packet dropping procedure
in real time. The channel modeling has not been provided by EpiSci, but the OAI code
base already has some BLER curves available for use. The channel modeling functionality
that is included in the phy_stub_ue.c file only includes the downlink channel modeling.
Any uplink channel modeling must be conducted in some sort of proxy, which would sit
between the UEs and eNB. (A description of the downlink channel modeling is shown in the
Channel_Abstraction_UE_Handling_LTE.PNG image).
The updates to the OAI code base removed some latent bugs, added multi-UE scalability,
and were tested with a standard bypass proxy between the UE(s) and eNB. The bypass proxy is
publicly available on GitHub (https://github.com/EpiSci/oai-lte-multi-ue-proxy). With this package,
various multi-UE scenarios can be tested without the overhead of PHY-layer features
of underlying radios. The features added in the L2 Emulator Mode for LTE are:
- Ease of use of gprof and address sanitizer for debugging purposes
- Updated json files to allow for GDB, real-time debugging capabilities
- Updated logging features to minimally log only key connection milestones. This improves scalability of multiple UEs.
The logging mechanism described here is located in the log.c and log.h files. The LOG_MINIMAL
function allows us to remove most OAI logging and includes LOG_A(...) logs and above. The LOG_A
logs were chosen as analysis logs to meet EpiSci's internal testing procedure. The LOG_As
only include logs that are considered to be milestones in a given test. For example, a
log indicating that the RACH procedure has been completed for LTE. To select full logging,
set LOG_MINIMAL = 0 in the log.h file.
- Updated logging to include time stamp for timing analysis
- Updated memory allocation procedures to correct size requirements
- Added debugging features to handle signal terminations
- nfapi.c pullarray8 fix invalid pointer math
- Overlapping destination and source memory in memcpy, so updated to memmove to check for this bug
- Advanced error checking mechanisms in critical pack and unpack functions
- Created option for CPU assignment to UE to improve scalability
- Added EPC integration to allow multiple individual UE entities to each have their USIM information parsed by the executables
- Updated random value seeds to minimize probability of error in generation of random values
- Enables capability round robin scheduler if desired
- Enables capability real time scheduler if desired
- Added new standalone functions to the UE phy-layer (phy_stub_ue.c) to incorporate individual UE entities
- Updated sending and packing functions in UE (lte_ue.c) to incorporate new standalone changes
- Incorporated semaphores to control timing of incoming downlink packets
- Implemented new queuing system to handle message exchange from UE to eNB and vice versa
- Updated global value in nFAPI for size of subframe
- Updated global value to increase scalability in system
There are fundamental changes to the L2 emulation mechanism; these changes allow the
user to run multiple UEs in separate Linux processes/machines/VMs/etc. They use a separate
entity between the UE(s) and eNB/gNB. The UEs use nFAPI to communicate with the eNB/gNB. The
nFAPI interface allows us to run in an emulated L2 mode, meaning that we are bypassing
the layer 1 (PHY) layer functionality. Becasue we are bypassing the PHY layer, special
channel modeling capabilty has been added in the LTE UE phy_stub_ue.c file. To understand
the interfaces between the different components associated with NSA mode, the image
functional_diagram_proxy_nsa.png has been provided.
This functionality allows the user to plug in their own channel model and emulate the packet dropping procedure
in real time. The channel modeling has not been provided by EpiSci, but the OAI code
base already has some BLER curves available for use. The chanel modeling functionality
that is included in the phy_stub_ue.c file only includes the downlink channel modeling.
Any uplink channel modeling must be conducted in some sort of proxy, which would sit
between the UEs and eNB/gNB. (A description of the downlink channel modeling is shown in the
Channel_Abstraction_UE_Handling_LTE.PNG image).
The updates to the OAI code base removed some latent bugs, added multi-UE scalability,
and were tested with a standard bypass proxy between the UE(s) and eNB/gNB. The bypass proxy is
publicly available on GitHub (https://github.com/EpiSci/oai-lte-multi-ue-proxy). With this package,
various multi-UE scenarios can be tested without the overhead of PHY-layer features
of underlying radios. The added features to the OAI code base are listed below.
- Ease of use of gprof and address sanitizer for debugging purposes
- Updated json files to allow for GDB, real-time debugging capabilities
- Updated logging features to minimally log only key connection milestones. This improves scalability of multiple UEs.
The logging mechanism described here is located in the log.c and log.h files. The LOG_MINIMAL
function allows us to remove most logs and include LOG_A(...) logs and above. The LOG_A
logs were chosen as analysis logs to meet EpiSci's internal testing procedure. The LOG_As
only include logs that are considered to be milestones in a given test. For example, a
log indicating that the CFRA procedure has been completed for NSA mode. To revert to full logging,
set LOG_MINIMAL = 0 in the log.h file.
- Updated logging to include time stamp for timing analysis
- Updated memory allocation procedures to correct size requirements
- Added debugging features to handle signal terminations
- nfapi.c pullarray8 fix invalid pointer math
- Overlapping destination and source memory in memcpy, so updated to memmove to check for this bug
- Advanced error checking mechanisms in critical pack and unpack functions
- Created option for CPU assignment to UE to improve scalability
- Added EPC integration to allow multiple individual UE entities to each have their USIM information parsed by the executables
- Updated random value seeds to minimize probability of error in generation of random values
- Enables capability round robin scheduler if desired
- Enables capability real time scheduler if desired
- Added new standalone functions to the UE phy-layer (phy_stub_ue.c) to incorporate individual UE entities
- Updated sending and packing functions in UE (lte_ue.c) to incorporate new standalone changes
- Incorporated semaphores to control timing of incoming downlink packets
- Implemented new queuing system to handle message exchange from UE to eNB and vice versa
- Updated global value in nFAPI for size of subframe
- Updated global value to increase scalability in system
Additionally, NSA mode includes the establishment between an NR UE and the gNB via the LTE UE and eNB
connection. For NSA mode, the downlink channel abstraction has not been added to the feature set yet.
NSA mode has been tested and is fully functional with EpiSci's public version of the nFAPI proxy
located at https://github.com/EpiSci/oai-lte-multi-ue-proxy
NSA mode establishment includes the following steps:
- First UE capability enquiry is sent to NR UE
- NR UE updates and fills first capability enquiry
- eNB request for a measurement report
- Measurement request is sent to NR UE
- Measurement report is filled in NR UE
- Measurement report is received in eNB
- Request for second UE capability enquiry
- Send second enquiry to NR UE
- Second capability information is filled by NR UE
- Second capability information is sent to eNB
- NR UE capability information is received in gNB
- Periodic measurement report received in gNB
- RRCReconfigurationRequest is sent to NR UE
- RRCReconfigurationComplete is sent from NR UE
- RACH is received in the gNB
- RAR is received in NR UE
- Msg 3 is generated and sent to gNB
- CFRA procedure is complete
Please note, the current status is:
- A single NSA UE is able to ping an external source
- Up to 4 NSA UEs can complete the CFRA procedure with a single gNB
- UE-to-UE traffic is still in work (incomplete due to gNB crashing)
- The gNB is crashing regularly and is still in work
Test Setup:
For launching the multi-UE for NSA mode, there is a provided test script in the
public EpiSci GitHub multi-ue-proxy repository. However, a brief outline of the
test set up is included below.
If running multiple NSA UEs in a single machine, you will need to launch
multiple LTE and NR UE processes. For example, to launch a 2 NSA UE scenario
there will be a total of 7 processes running for this particular scenario.
These processes are LTE UE #1, LTE UE #2, NR UE #1, NR UE #2, eNB, gNB and the
proxy. A detailed description of the launch processes can be found at
https://github.com/EpiSci/oai-lte-multi-ue-proxy/blob/master/README.md
......@@ -553,7 +553,11 @@ void fill_rx_indication_from_split(uint8_t *bufferZone, PHY_VARS_eNB *eNB,int UE
pdu->rx_indication_rel8.tl.tag = NFAPI_RX_INDICATION_REL8_TAG;
pdu->rx_indication_rel8.length = eNB->ulsch[UE_id]->harq_processes[harq_pid]->TBS>>3;
pdu->rx_indication_rel8.offset = 1; // DJP - I dont understand - but broken unless 1 ???? 0; // filled in at the end of the UL_INFO formation
pdu->data = eNB->ulsch[UE_id]->harq_processes[harq_pid]->decodedBytes;
AssertFatal(pdu->rx_indication_rel8.length <= NFAPI_RX_IND_DATA_MAX, "Invalid PDU len %d\n",
pdu->rx_indication_rel8.length);
memcpy(pdu->rx_ind_data,
eNB->ulsch[UE_id]->harq_processes[harq_pid]->decodedBytes,
pdu->rx_indication_rel8.length);
// estimate timing advance for MAC
timing_advance_update = ul_propa[UE_id].ta;
......
......@@ -1043,7 +1043,7 @@ void init_pdcp(void) {
pdcp_initmask = pdcp_initmask | ENB_NAS_USE_TUN_W_MBMS_BIT;
if ( split73!=SPLIT73_DU)
pdcp_module_init(pdcp_initmask);
pdcp_module_init(pdcp_initmask, 0);
if (NODE_IS_CU(RC.rrc[0]->node_type)) {
//pdcp_set_rlc_data_req_func(proto_agent_send_rlc_data_req);
......@@ -1057,14 +1057,14 @@ void init_pdcp(void) {
}
static void wait_nfapi_init(char *thread_name) {
printf( "waiting for NFAPI PNF connection and population of global structure (%s)\n",thread_name);
LOG_I(ENB_APP, "waiting for NFAPI PNF connection and population of global structure (%s)\n",thread_name);
pthread_mutex_lock( &nfapi_sync_mutex );
while (nfapi_sync_var<0)
pthread_cond_wait( &nfapi_sync_cond, &nfapi_sync_mutex );
pthread_mutex_unlock(&nfapi_sync_mutex);
printf( "NFAPI: got sync (%s)\n", thread_name);
LOG_I(ENB_APP, "NFAPI: got sync (%s)\n", thread_name);
}
void terminate_task(module_id_t mod_id, task_id_t from, task_id_t to) {
......
......@@ -240,7 +240,6 @@ void rx_func(void *param) {
// RX processing
int tx_slot_type = nr_slot_select(cfg,frame_tx,slot_tx);
int rx_slot_type = nr_slot_select(cfg,frame_rx,slot_rx);
if (rx_slot_type == NR_UPLINK_SLOT || rx_slot_type == NR_MIXED_SLOT) {
// UE-specific RX processing for subframe n
// TODO: check if this is correct for PARALLEL_RU_L1_TRX_SPLIT
......@@ -451,7 +450,9 @@ void init_gNB_Tpool(int inst) {
msgData->next_slot = get_next_downlink_slot(gNB, &gNB->gNB_config, 0, first_tx_slot-1);
pushNotifiedFIFO(gNB->resp_RU_tx,msgRUTx); // to unblock the process in the beginning
threadCreate(&proc->L1_stats_thread,nrL1_stats_thread,(void*)gNB,"L1_stats",-1,OAI_PRIORITY_RT_LOW);
if (!get_softmodem_params()->emulate_l1) {
threadCreate(&proc->L1_stats_thread,nrL1_stats_thread,(void*)gNB,"L1_stats",-1,OAI_PRIORITY_RT_LOW);
}
}
......
......@@ -80,7 +80,8 @@ static int DEFBFW[] = {0x00007fff};
extern volatile int oai_exit;
extern struct timespec timespec_sub(struct timespec lhs, struct timespec rhs);
extern struct timespec timespec_add(struct timespec lhs, struct timespec rhs);
extern void nr_phy_free_RU(RU_t *);
extern void nr_phy_config_request(NR_PHY_Config_t *gNB);
#include "executables/thread-common.h"
......@@ -1323,9 +1324,35 @@ void *ru_thread( void *param ) {
}
// This is a forever while loop, it loops over subframes which are scheduled by incoming samples from HW devices
struct timespec slot_start;
clock_gettime(CLOCK_MONOTONIC, &slot_start);
struct timespec slot_duration;
slot_duration.tv_sec = 0;
//slot_duration.tv_nsec = 0.5e6;
slot_duration.tv_nsec = 0.5e6;
while (!oai_exit) {
// these are local subframe/frame counters to check that we are in synch with the fronthaul timing.
// They are set on the first rx/tx in the underly FH routines.
slot_start = timespec_add(slot_start,slot_duration);
struct timespec curr_time;
clock_gettime(CLOCK_MONOTONIC, &curr_time);
struct timespec sleep_time;
if((slot_start.tv_sec > curr_time.tv_sec) || (slot_start.tv_sec == curr_time.tv_sec && slot_start.tv_nsec > curr_time.tv_nsec)){
sleep_time = timespec_sub(slot_start,curr_time);
usleep(sleep_time.tv_nsec * 1e-3);
}
else{//continue
}
// clock_gettime(CLOCK_MONOTONIC, &curr_time);
//printf("sfn:%d, slot:%d, start time %d.%d slot start %d.%d \n",frame,slot,curr_time.tv_sec,curr_time.tv_nsec,slot_start.tv_sec,slot_start.tv_nsec);
if (slot==(fp->slots_per_frame-1)) {
slot=0;
frame++;
......
......@@ -596,8 +596,33 @@ static void wait_nfapi_init(char *thread_name) {
}
void init_pdcp(void) {
if (!NODE_IS_DU(RC.nrrrc[0]->node_type)) {
// pdcp_layer_init();
if (!get_softmodem_params()->nsa) {
if (!NODE_IS_DU(RC.nrrrc[0]->node_type)) {
//pdcp_layer_init();
uint32_t pdcp_initmask = (IS_SOFTMODEM_NOS1) ?
(PDCP_USE_NETLINK_BIT | LINK_ENB_PDCP_TO_IP_DRIVER_BIT) : LINK_ENB_PDCP_TO_GTPV1U_BIT;
if (IS_SOFTMODEM_NOS1) {
printf("IS_SOFTMODEM_NOS1 option enabled \n");
pdcp_initmask = pdcp_initmask | ENB_NAS_USE_TUN_BIT | SOFTMODEM_NOKRNMOD_BIT;
}
nr_pdcp_module_init(pdcp_initmask, 0);
if (NODE_IS_CU(RC.nrrrc[0]->node_type)) {
LOG_I(PDCP, "node is CU, pdcp send rlc_data_req by proto_agent \n");
pdcp_set_rlc_data_req_func((send_rlc_data_req_func_t)proto_agent_send_rlc_data_req);
} else {
LOG_I(PDCP, "node is gNB \n");
pdcp_set_rlc_data_req_func((send_rlc_data_req_func_t) rlc_data_req);
pdcp_set_pdcp_data_ind_func((pdcp_data_ind_func_t) pdcp_data_ind);
}
} else {
LOG_I(PDCP, "node is DU, rlc send pdcp_data_ind by proto_agent \n");
pdcp_set_pdcp_data_ind_func((pdcp_data_ind_func_t) proto_agent_send_pdcp_data_ind);
}
} else {
pdcp_layer_init();
uint32_t pdcp_initmask = (IS_SOFTMODEM_NOS1) ?
(PDCP_USE_NETLINK_BIT | LINK_ENB_PDCP_TO_IP_DRIVER_BIT) : LINK_ENB_PDCP_TO_GTPV1U_BIT;
......@@ -606,19 +631,9 @@ void init_pdcp(void) {
pdcp_initmask = pdcp_initmask | ENB_NAS_USE_TUN_BIT | SOFTMODEM_NOKRNMOD_BIT;
}
pdcp_module_init(pdcp_initmask);
if (NODE_IS_CU(RC.nrrrc[0]->node_type)) {
LOG_I(PDCP, "node is CU, pdcp send rlc_data_req by proto_agent \n");
pdcp_set_rlc_data_req_func(proto_agent_send_rlc_data_req);
} else {
LOG_I(PDCP, "node is gNB \n");
pdcp_set_rlc_data_req_func(rlc_data_req);
pdcp_set_pdcp_data_ind_func(pdcp_data_ind);
}
} else {
LOG_I(PDCP, "node is DU, rlc send pdcp_data_ind by proto_agent \n");
pdcp_set_pdcp_data_ind_func(proto_agent_send_pdcp_data_ind);
nr_pdcp_module_init(pdcp_initmask, 0);
pdcp_set_rlc_data_req_func((send_rlc_data_req_func_t) rlc_data_req);
pdcp_set_pdcp_data_ind_func((pdcp_data_ind_func_t) pdcp_data_ind);
}
}
......@@ -645,6 +660,8 @@ int main( int argc, char **argv ) {
printf("Reading in command-line options\n");
get_options ();
EPC_MODE_ENABLED = !IS_SOFTMODEM_NOS1;
if (CONFIG_ISFLAGSET(CONFIG_ABORT) ) {
fprintf(stderr,"Getting configuration failed\n");
exit(-1);
......@@ -676,10 +693,12 @@ int main( int argc, char **argv ) {
// initialize mscgen log after ITTI
MSC_INIT(MSC_E_UTRAN, ADDED_QUEUES_MAX+TASK_MAX);
init_opt();
if(PDCP_USE_NETLINK)
if(!IS_SOFTMODEM_NOS1)
netlink_init();
if(PDCP_USE_NETLINK && !IS_SOFTMODEM_NOS1) {
netlink_init();
if (get_softmodem_params()->nsa) {
init_pdcp();
}
}
#ifndef PACKAGE_VERSION
# define PACKAGE_VERSION "UNKNOWN-EXPERIMENTAL"
#endif
......
This diff is collapsed.
......@@ -157,6 +157,7 @@ char uecap_xer[1024];
*/
uint8_t abstraction_flag=0;
/*---------------------BMC: timespec helpers -----------------------------*/
struct timespec min_diff_time = { .tv_sec = 0, .tv_nsec = 0 };
......@@ -190,10 +191,17 @@ int create_tasks_nrue(uint32_t ue_nb) {
LOG_E(NR_RRC, "Create task for RRC UE failed\n");
return -1;
}
if (itti_create_task (TASK_NAS_NRUE, nas_nrue_task, NULL) < 0) {
LOG_E(NR_RRC, "Create task for NAS UE failed\n");
return -1;
}
if (get_softmodem_params()->nsa) {
init_connections_with_lte_ue();
if (itti_create_task (TASK_RRC_NSA_NRUE, recv_msgs_from_lte_ue, NULL) < 0) {
LOG_E(NR_RRC, "Create task for RRC NSA nr-UE failed\n");
return -1;
}
}
if (itti_create_task (TASK_NAS_NRUE, nas_nrue_task, NULL) < 0) {
LOG_E(NR_RRC, "Create task for NAS UE failed\n");
return -1;
}
}
itti_wait_ready(0);
......@@ -371,25 +379,23 @@ void init_openair0(void) {
}
}
static void init_pdcp(void) {
static void init_pdcp(int ue_id) {
uint32_t pdcp_initmask = (!IS_SOFTMODEM_NOS1) ? LINK_ENB_PDCP_TO_GTPV1U_BIT : (LINK_ENB_PDCP_TO_GTPV1U_BIT | PDCP_USE_NETLINK_BIT | LINK_ENB_PDCP_TO_IP_DRIVER_BIT);
/*if (IS_SOFTMODEM_BASICSIM || IS_SOFTMODEM_RFSIM || (nfapi_getmode()==NFAPI_UE_STUB_PNF)) {
pdcp_initmask = pdcp_initmask | UE_NAS_USE_TUN_BIT;
}*/
if (IS_SOFTMODEM_NOKRNMOD)
if (IS_SOFTMODEM_NOKRNMOD) {
pdcp_initmask = pdcp_initmask | UE_NAS_USE_TUN_BIT;
/*if (rlc_module_init() != 0) {
}
if (get_softmodem_params()->nsa && rlc_module_init(0) != 0) {
LOG_I(RLC, "Problem at RLC initiation \n");
}
pdcp_layer_init();
nr_DRB_preconfiguration();*/
pdcp_layer_init();
pdcp_module_init(pdcp_initmask);
pdcp_set_rlc_data_req_func(rlc_data_req);
pdcp_set_pdcp_data_ind_func(pdcp_data_ind);
nr_pdcp_module_init(pdcp_initmask, ue_id);
pdcp_set_rlc_data_req_func((send_rlc_data_req_func_t) rlc_data_req);
pdcp_set_pdcp_data_ind_func((pdcp_data_ind_func_t) pdcp_data_ind);
}
// Stupid function addition because UE itti messages queues definition is common with eNB
......@@ -399,6 +405,13 @@ void *rrc_enb_process_msg(void *notUsed) {
int main( int argc, char **argv ) {
set_priority(79);
if (mlockall(MCL_CURRENT | MCL_FUTURE) == -1)
{
fprintf(stderr, "mlockall: %s\n", strerror(errno));
return EXIT_FAILURE;
}
//uint8_t beta_ACK=0,beta_RI=0,beta_CQI=2;
PHY_VARS_NR_UE *UE[MAX_NUM_CCs];
start_background_system();
......@@ -441,13 +454,27 @@ int main( int argc, char **argv ) {
LOG_I(HW, "Version: %s\n", PACKAGE_VERSION);
init_NR_UE(1,rrc_config_path);
if(IS_SOFTMODEM_NOS1 || get_softmodem_params()->sa)
init_pdcp();
int mode_offset = get_softmodem_params()->nsa ? NUMBER_OF_UE_MAX : 1;
uint16_t node_number = get_softmodem_params()->node_number;
ue_id_g = (node_number == 0) ? 0 : node_number - 2;
AssertFatal(ue_id_g >= 0, "UE id is expected to be nonnegative.\n");
if(IS_SOFTMODEM_NOS1 || get_softmodem_params()->sa || get_softmodem_params()->nsa) {
if(node_number == 0) {
init_pdcp(0);
}
else {
init_pdcp(mode_offset + ue_id_g);
}
}
NB_UE_INST=1;
NB_INST=1;
PHY_vars_UE_g = malloc(sizeof(PHY_VARS_NR_UE **));
PHY_vars_UE_g[0] = malloc(sizeof(PHY_VARS_NR_UE *)*MAX_NUM_CCs);
if (get_softmodem_params()->emulate_l1) {
RCconfig_nr_ue_L1();
}
if (get_softmodem_params()->do_ra)
AssertFatal(get_softmodem_params()->phy_test == 0,"RA and phy_test are mutually exclusive\n");
......@@ -455,54 +482,57 @@ int main( int argc, char **argv ) {
if (get_softmodem_params()->sa)
AssertFatal(get_softmodem_params()->phy_test == 0,"Standalone mode and phy_test are mutually exclusive\n");
for (int CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
PHY_vars_UE_g[0][CC_id] = (PHY_VARS_NR_UE *)malloc(sizeof(PHY_VARS_NR_UE));
UE[CC_id] = PHY_vars_UE_g[0][CC_id];
memset(UE[CC_id],0,sizeof(PHY_VARS_NR_UE));
set_options(CC_id, UE[CC_id]);
NR_UE_MAC_INST_t *mac = get_mac_inst(0);
if (get_softmodem_params()->sa) {
uint16_t nr_band = get_band(downlink_frequency[CC_id][0],uplink_frequency_offset[CC_id][0]);
mac->nr_band = nr_band;
nr_init_frame_parms_ue_sa(&UE[CC_id]->frame_parms,
downlink_frequency[CC_id][0],
uplink_frequency_offset[CC_id][0],
get_softmodem_params()->numerology,
nr_band);
if (!get_softmodem_params()->nsa && get_softmodem_params()->emulate_l1)
start_oai_nrue_threads();
if (!get_softmodem_params()->emulate_l1) {
for (int CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
PHY_vars_UE_g[0][CC_id] = (PHY_VARS_NR_UE *)malloc(sizeof(PHY_VARS_NR_UE));
UE[CC_id] = PHY_vars_UE_g[0][CC_id];
memset(UE[CC_id],0,sizeof(PHY_VARS_NR_UE));
set_options(CC_id, UE[CC_id]);
NR_UE_MAC_INST_t *mac = get_mac_inst(0);
if (get_softmodem_params()->sa) { // set frame config to initial values from command line and assume that the SSB is centered on the grid
uint16_t nr_band = get_band(downlink_frequency[CC_id][0],uplink_frequency_offset[CC_id][0]);
mac->nr_band = nr_band;
nr_init_frame_parms_ue_sa(&UE[CC_id]->frame_parms,
downlink_frequency[CC_id][0],
uplink_frequency_offset[CC_id][0],
get_softmodem_params()->numerology,
nr_band);
}
else{
if(mac->if_module != NULL && mac->if_module->phy_config_request != NULL)
mac->if_module->phy_config_request(&mac->phy_config);
fapi_nr_config_request_t *nrUE_config = &UE[CC_id]->nrUE_config;
nr_init_frame_parms_ue(&UE[CC_id]->frame_parms, nrUE_config,
*mac->scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0]);
}
init_symbol_rotation(&UE[CC_id]->frame_parms);
init_timeshift_rotation(&UE[CC_id]->frame_parms);
init_nr_ue_vars(UE[CC_id], 0, abstraction_flag);
}
else{
if(mac->if_module != NULL && mac->if_module->phy_config_request != NULL)
mac->if_module->phy_config_request(&mac->phy_config);
fapi_nr_config_request_t *nrUE_config = &UE[CC_id]->nrUE_config;
init_openair0();
// init UE_PF_PO and mutex lock
pthread_mutex_init(&ue_pf_po_mutex, NULL);
memset (&UE_PF_PO[0][0], 0, sizeof(UE_PF_PO_t)*NUMBER_OF_UE_MAX*MAX_NUM_CCs);
configure_linux();
mlockall(MCL_CURRENT | MCL_FUTURE);
nr_init_frame_parms_ue(&UE[CC_id]->frame_parms, nrUE_config, *mac->scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0]);
if(IS_SOFTMODEM_DOSCOPE) {
load_softscope("nr",PHY_vars_UE_g[0][0]);
}
init_symbol_rotation(&UE[CC_id]->frame_parms);
init_timeshift_rotation(&UE[CC_id]->frame_parms);
init_nr_ue_vars(UE[CC_id], 0, abstraction_flag);
init_NR_UE_threads(1);
printf("UE threads created by %ld\n", gettid());
}
init_openair0();
// init UE_PF_PO and mutex lock
pthread_mutex_init(&ue_pf_po_mutex, NULL);
memset (&UE_PF_PO[0][0], 0, sizeof(UE_PF_PO_t)*NUMBER_OF_UE_MAX*MAX_NUM_CCs);
configure_linux();
mlockall(MCL_CURRENT | MCL_FUTURE);
if(IS_SOFTMODEM_DOSCOPE) {
load_softscope("nr",PHY_vars_UE_g[0][0]);
}
init_NR_UE_threads(1);
printf("UE threads created by %ld\n", gettid());
// wait for end of program
printf("TYPE <CTRL-C> TO TERMINATE\n");
......
......@@ -34,7 +34,8 @@
{"offset-divisor", CONFIG_HLP_OFFSET_DIV, 0, uptr:(uint32_t *)&nrUE_params.ofdm_offset_divisor, defuintval:UINT_MAX, TYPE_UINT32, 0}, \
{"nr-dlsch-demod-shift", CONFIG_HLP_DLSHIFT, 0, iptr:(int32_t *)&nr_dlsch_demod_shift, defintval:0, TYPE_INT, 0}, \
{"V" , CONFIG_HLP_VCD, PARAMFLAG_BOOL, iptr:&vcdflag, defintval:0, TYPE_INT, 0}, \
{"rrc_config_path", CONFIG_HLP_RRC_CFG_PATH,0, strptr:(char **)&rrc_config_path, defstrval:"./", TYPE_STRING, 0} \
{"rrc_config_path", CONFIG_HLP_RRC_CFG_PATH,0, strptr:(char **)&rrc_config_path, defstrval:"./", TYPE_STRING, 0}, \
{"ue-idx-standalone", NULL, 0, u16ptr:&ue_idx_standalone, defuintval:0xFFFF, TYPE_UINT16, 0} \
}
......@@ -88,7 +89,9 @@ extern void init_NR_UE(int, char*);
extern void init_NR_UE_threads(int);
extern void reset_opp_meas(void);
extern void print_opp_meas(void);
extern void start_oai_nrue_threads(void);
void *UE_thread(void *arg);
void init_nr_ue_vars(PHY_VARS_NR_UE *ue, uint8_t UE_id, uint8_t abstraction_flag);
void init_nrUE_standalone_thread(int ue_idx);
#endif
......@@ -328,7 +328,7 @@ static void init_pdcp(void) {
pdcp_initmask = pdcp_initmask | ENB_NAS_USE_TUN_BIT | SOFTMODEM_NOKRNMOD_BIT ;
}
pdcp_module_init(pdcp_initmask);
nr_pdcp_module_init(pdcp_initmask, 0);
pdcp_set_rlc_data_req_func(rlc_data_req);
pdcp_set_pdcp_data_ind_func(pdcp_data_ind);
}
......
......@@ -211,10 +211,13 @@ void set_softmodem_sighandler(void) {
memset(&act,0,sizeof(act));
act.sa_handler=signal_handler;
sigaction(SOFTMODEM_RTSIGNAL,&act,&oldact);
// Disabled in order generate a core dump for analysis with gdb
# if 0
printf("Send signal %d to display resource usage...\n",SIGRTMIN+1);
signal(SIGSEGV, signal_handler);
signal(SIGINT, signal_handler);
signal(SIGTERM, signal_handler);
signal(SIGABRT, signal_handler);
#endif
}
......@@ -98,6 +98,7 @@ extern "C"
#define CONFIG_HLP_DISABLNBIOT "disable nb-iot, even if defined in config\n"
#define CONFIG_HLP_USRP_THREAD "having extra thead for usrp tx\n"
#define CONFIG_HLP_NFAPI "Change the nFAPI mode for NR\n"
#define CONFIG_L1_EMULATOR "Run in L1 emulated mode (disable PHY layer)\n"
/*-----------------------------------------------------------------------------------------------------------------------------------------------------*/
/* command line parameters common to eNodeB and UE */
......@@ -122,7 +123,10 @@ extern "C"
#define USE_256QAM_TABLE softmodem_params.use_256qam_table
#define PRB_INTERPOLATION softmodem_params.prb_interpolation
#define NFAPI softmodem_params.nfapi
#define NSA softmodem_params.nsa
#define NODE_NUMBER softmodem_params.node_number
#define NON_STOP softmodem_params.non_stop
#define EMULATE_L1 softmodem_params.emulate_l1
#define DEFAULT_RFCONFIG_FILE "/usr/local/etc/syriq/ue.band7.tm1.PRB100.NR40.dat";
......@@ -155,13 +159,16 @@ extern int usrp_tx_thread;
{"nokrnmod", CONFIG_HLP_NOKRNMOD, PARAMFLAG_BOOL, uptr:&nokrnmod, defintval:0, TYPE_INT, 0}, \
{"nbiot-disable", CONFIG_HLP_DISABLNBIOT, PARAMFLAG_BOOL, uptr:&nonbiot, defuintval:0, TYPE_INT, 0}, \
{"use-256qam-table", CONFIG_HLP_256QAM, PARAMFLAG_BOOL, iptr:&USE_256QAM_TABLE, defintval:0, TYPE_INT, 0}, \
{"do-prb-interpolation", CONFIG_HLP_PRBINTER, PARAMFLAG_BOOL, iptr:&PRB_INTERPOLATION, defintval:0, TYPE_INT, 0}, \
{"usrp-tx-thread-config", CONFIG_HLP_USRP_THREAD, 0, iptr:&usrp_tx_thread, defstrval:0, TYPE_INT, 0}, \
{"nfapi", CONFIG_HLP_NFAPI, 0, u8ptr:&nfapi_mode, defintval:0, TYPE_UINT8, 0}, \
{"non-stop", CONFIG_HLP_NONSTOP, PARAMFLAG_BOOL, iptr:&NON_STOP, defintval:0, TYPE_INT, 0}, \
{"nsa", CONFIG_HLP_NSA, PARAMFLAG_BOOL, iptr:&NSA, defintval:0, TYPE_INT, 0}, \
{"node-number", NULL, 0, u16ptr:&NODE_NUMBER, defuintval:0, TYPE_UINT16, 0}, \
{"usrp-tx-thread-config", CONFIG_HLP_USRP_THREAD, 0, iptr:&usrp_tx_thread, defstrval:0, TYPE_INT, 0}, \
{"do-prb-interpolation", CONFIG_HLP_PRBINTER, PARAMFLAG_BOOL, iptr:&PRB_INTERPOLATION, defintval:0, TYPE_INT, 0}, \
{"nfapi", CONFIG_HLP_NFAPI, 0, u8ptr:&nfapi_mode, defintval:0, TYPE_UINT8, 0}, \
{"non-stop", CONFIG_HLP_NONSTOP, PARAMFLAG_BOOL, iptr:&NON_STOP, defintval:0, TYPE_INT, 0}, \
{"emulate-l1", CONFIG_L1_EMULATOR, PARAMFLAG_BOOL, iptr:&EMULATE_L1, defintval:0, TYPE_INT, 0}, \
}
#define CONFIG_HLP_NSA "Enable NSA mode \n"
#define CONFIG_HLP_FLOG "Enable online log \n"
#define CONFIG_HLP_LOGL "Set the global log level, valid options: (4:trace, 3:debug, 2:info, 1:warn, (0:error))\n"
#define CONFIG_HLP_LOGV "Set the global log verbosity \n"
......@@ -251,7 +258,10 @@ typedef struct {
int use_256qam_table;
int prb_interpolation;
uint8_t nfapi;
int nsa;
uint16_t node_number;
int non_stop;
int emulate_l1;
} softmodem_params_t;
extern uint64_t get_softmodem_optmask(void);
......@@ -272,6 +282,7 @@ void tx_func(void *param);
void rx_func(void *param);
void ru_tx_func(void *param);
extern uint8_t nfapi_mode;
extern int16_t vnf_pnf_sfnslot_delta;
#ifdef __cplusplus
}
#endif
......
#include "gnb_ind_vars.h"
queue_t gnb_rach_ind_queue;
queue_t gnb_rx_ind_queue;
queue_t gnb_crc_ind_queue;
queue_t gnb_uci_ind_queue;
queue_t gnb_slot_ind_queue;
#pragma once
#include "openair2/PHY_INTERFACE/queue_t.h"
extern queue_t gnb_rach_ind_queue;
extern queue_t gnb_rx_ind_queue;
extern queue_t gnb_crc_ind_queue;
extern queue_t gnb_uci_ind_queue;
extern queue_t gnb_slot_ind_queue;
......@@ -23,7 +23,15 @@
#include <pthread.h>
#include "nfapi/oai_integration/vendor_ext.h"
#include "common/utils/LOG/log.h"
static char nfapi_str_mode[6][24] = {"MONOLITHIC","PNF","VNF","UE_STUB_PNF","UE_STUB_OFFNET","<UNKNOWN NFAPI MODE>"};
static const char *const nfapi_str_mode[] = {
"MONOLITHIC",
"PNF",
"VNF",
"UE_STUB_PNF",
"UE_STUB_OFFNET",
"STANDALONE_PNF",
"<UNKNOWN NFAPI MODE>"
};
typedef struct {
nfapi_mode_t nfapi_mode;
......@@ -32,15 +40,9 @@ typedef struct {
static nfapi_params_t nfapi_params = {0};
void set_thread_priority(int priority) {
//printf("%s(priority:%d)\n", __FUNCTION__, priority);
pthread_attr_t ptAttr;
struct sched_param schedParam;
schedParam.__sched_priority = priority; //79;
if(sched_setscheduler(0, SCHED_RR, &schedParam) != 0) {
printf("Failed to set scheduler to SCHED_RR\n");
}
set_priority(priority);
pthread_attr_t ptAttr;
if(pthread_attr_setschedpolicy(&ptAttr, SCHED_RR) != 0) {
printf("Failed to set pthread sched policy SCHED_RR\n");
}
......@@ -54,7 +56,7 @@ void set_thread_priority(int priority) {
}
}
char *nfapi_get_strmode(void) {
const char *nfapi_get_strmode(void) {
if (nfapi_params.nfapi_mode > NFAPI_MODE_UNKNOWN)
return nfapi_str_mode[NFAPI_MODE_UNKNOWN];
......
......@@ -218,14 +218,9 @@ void pnf_nfapi_trace(nfapi_trace_level_t nfapi_level, const char *message, ...)
}
void pnf_set_thread_priority(int priority) {
pthread_attr_t ptAttr;
struct sched_param schedParam;
schedParam.__sched_priority = priority;
if(sched_setscheduler(0, SCHED_RR, &schedParam) != 0) {
printf("failed to set SCHED_RR\n");
}
set_priority(priority);
pthread_attr_t ptAttr;
if(pthread_attr_setschedpolicy(&ptAttr, SCHED_RR) != 0) {
printf("failed to set pthread SCHED_RR %d\n", errno);
}
......@@ -248,7 +243,7 @@ void *pnf_p7_thread_start(void *ptr) {
}
void *pnf_nr_p7_thread_start(void *ptr) {
NFAPI_TRACE(NFAPI_TRACE_INFO, "[PNF] P7 THREAD %s\n", __FUNCTION__);
NFAPI_TRACE(NFAPI_TRACE_INFO, "[NR_PNF] NR P7 THREAD %s\n", __FUNCTION__);
pnf_set_thread_priority(79);
nfapi_pnf_p7_config_t *config = (nfapi_pnf_p7_config_t *)ptr;
nfapi_nr_pnf_p7_start(config);
......@@ -805,7 +800,7 @@ int config_request(nfapi_pnf_config_t *config, nfapi_pnf_phy_config_t *phy, nfap
// to keep only the necessary just to keep the nfapi FSM rolling by sending a dummy response.
LTE_DL_FRAME_PARMS *fp;
if (NFAPI_MODE!=NFAPI_UE_STUB_PNF) {
if (NFAPI_MODE!=NFAPI_UE_STUB_PNF && NFAPI_MODE!=NFAPI_MODE_STANDALONE_PNF) {
struct PHY_VARS_eNB_s *eNB = RC.eNB[0][0];
fp = &eNB->frame_parms;
} else {
......@@ -967,7 +962,7 @@ int config_request(nfapi_pnf_config_t *config, nfapi_pnf_phy_config_t *phy, nfap
num_tlv++;
}
if(NFAPI_MODE!=NFAPI_UE_STUB_PNF) {
if(NFAPI_MODE!=NFAPI_UE_STUB_PNF && NFAPI_MODE!=NFAPI_MODE_STANDALONE_PNF) {
printf("[PNF] CONFIG_REQUEST[num_tlv:%d] TLVs processed:%d\n", req->num_tlv, num_tlv);
printf("[PNF] Simulating PHY CONFIG - DJP\n");
PHY_Config_t phy_config;
......@@ -991,7 +986,7 @@ int config_request(nfapi_pnf_config_t *config, nfapi_pnf_phy_config_t *phy, nfap
nfapi_pnf_config_resp(config, &nfapi_resp);
printf("[PNF] Sent NFAPI_CONFIG_RESPONSE phy_id:%d\n", phy_info->id);
if(NFAPI_MODE==NFAPI_UE_STUB_PNF)
if(NFAPI_MODE==NFAPI_UE_STUB_PNF || NFAPI_MODE==NFAPI_MODE_STANDALONE_PNF)
free(fp);
return 0;
......@@ -1226,15 +1221,15 @@ int pnf_phy_dl_tti_req(gNB_L1_rxtx_proc_t *proc, nfapi_pnf_p7_config_t *pnf_p7,
proc = &gNB->proc.L1_proc;
nfapi_nr_dl_tti_request_pdu_t *dl_tti_pdu_list = req->dl_tti_request_body.dl_tti_pdu_list;
//if (req->dl_tti_request_body.nPDUs)
// NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() TX:%d/%d RX:%d/%d; sfn:%d, slot:%d, nGroup:%u, nPDUs: %u, nUE: %u, PduIdx: %u,\n",
// __FUNCTION__, proc->frame_tx, proc->slot_tx, proc->frame_rx, proc->slot_rx, // TODO: change subframes to slot
// req->SFN,
// req->Slot,
// req->dl_tti_request_body.nGroup,
// req->dl_tti_request_body.nPDUs,
// req->dl_tti_request_body.nUe,
// req->dl_tti_request_body.PduIdx);
if (req->dl_tti_request_body.nPDUs)
NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() TX:%d/%d RX:%d/%d; sfn:%d, slot:%d, nGroup:%u, nPDUs: %u, nUE: %p, PduIdx: %p,\n",
__FUNCTION__, proc->frame_tx, proc->slot_tx, proc->frame_rx, proc->slot_rx, // TODO: change subframes to slot
req->SFN,
req->Slot,
req->dl_tti_request_body.nGroup,
req->dl_tti_request_body.nPDUs,
req->dl_tti_request_body.nUe,
req->dl_tti_request_body.PduIdx);
for (int i=0; i<req->dl_tti_request_body.nPDUs; i++) {
// NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() sfn/sf:%d PDU[%d] size:%d pdcch_vars->num_dci:%d\n", __FUNCTION__, NFAPI_SFNSF2DEC(req->sfn_sf), i, dl_config_pdu_list[i].pdu_size,pdcch_vars->num_dci);
......@@ -1250,10 +1245,10 @@ int pnf_phy_dl_tti_req(gNB_L1_rxtx_proc_t *proc, nfapi_pnf_p7_config_t *pnf_p7,
//NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() PDU:%d BCH: pdu_index:%u pdu_length:%d sdu_length:%d BCH_SDU:%x,%x,%x\n", __FUNCTION__, i, pdu_index, bch_pdu->bch_pdu_rel8.length, tx_request_pdu[sfn][sf][pdu_index]->segments[0].segment_length, sdu[0], sdu[1], sdu[2]);
handle_nr_nfapi_ssb_pdu(msgTx, sfn, slot, &dl_tti_pdu_list[i]);
gNB->pbch_configured=1;
}
}
else if (dl_tti_pdu_list[i].PDUType == NFAPI_NR_DL_TTI_PDSCH_PDU_TYPE) {
nfapi_nr_dl_tti_pdsch_pdu *pdsch_pdu = &dl_tti_pdu_list[i].pdsch_pdu;
nfapi_nr_dl_tti_pdsch_pdu_rel15_t *rel15_pdu = &pdsch_pdu->pdsch_pdu_rel15;
nfapi_nr_dl_tti_pdsch_pdu_rel15_t *rel15_pdu = &pdsch_pdu->pdsch_pdu_rel15;
nfapi_nr_pdu_t *tx_data = tx_data_request[sfn][slot][rel15_pdu->pduIndex];
if (tx_data != NULL) {
......@@ -1466,6 +1461,7 @@ int pnf_phy_ul_tti_req(gNB_L1_rxtx_proc_t *proc, nfapi_pnf_p7_config_t *pnf_p7,
switch (ul_tti_pdu_list[i].pdu_type) {
case NFAPI_NR_UL_CONFIG_PUSCH_PDU_TYPE:
//LOG_D(PHY,"frame %d, slot %d, Got NFAPI_NR_UL_TTI_PUSCH_PDU_TYPE for %d.%d\n", frame, slot, UL_tti_req->SFN, UL_tti_req->Slot);
//curr_sfn = curr_sfn + 3; //Gokul
nr_fill_ulsch(gNB,curr_sfn, curr_slot, &ul_tti_pdu_list[i].pusch_pdu);
break;
case NFAPI_NR_UL_CONFIG_PUCCH_PDU_TYPE:
......@@ -1661,7 +1657,6 @@ nfapi_pnf_p7_subframe_buffer_t dummy_subframe;
int start_request(nfapi_pnf_config_t *config, nfapi_pnf_phy_config_t *phy, nfapi_start_request_t *req) {
printf("[PNF] Received NFAPI_START_REQ phy_id:%d\n", req->header.phy_id);
nfapi_set_trace_level(NFAPI_TRACE_INFO);
pnf_info *pnf = (pnf_info *)(config->user_data);
phy_info *phy_info = pnf->phys;
nfapi_pnf_p7_config_t *p7_config = nfapi_pnf_p7_config_create();
......@@ -1697,11 +1692,11 @@ int start_request(nfapi_pnf_config_t *config, nfapi_pnf_phy_config_t *phy, nfapi
p7_config->tx_req = &pnf_phy_tx_req;
p7_config->lbt_dl_config_req = &pnf_phy_lbt_dl_config_req;
p7_config->ue_release_req = &pnf_phy_ue_release_req;
if (NFAPI_MODE==NFAPI_UE_STUB_PNF) {
p7_config->dl_config_req = &memcpy_dl_config_req;
p7_config->ul_config_req = &memcpy_ul_config_req;
p7_config->hi_dci0_req = &memcpy_hi_dci0_req;
p7_config->tx_req = &memcpy_tx_req;
if (NFAPI_MODE==NFAPI_UE_STUB_PNF || NFAPI_MODE==NFAPI_MODE_STANDALONE_PNF) {
p7_config->dl_config_req = NULL;
p7_config->ul_config_req = NULL;
p7_config->hi_dci0_req = NULL;
p7_config->tx_req = NULL;
} else {
p7_config->dl_config_req = &pnf_phy_dl_config_req;
p7_config->ul_config_req = &pnf_phy_ul_config_req;
......@@ -1754,7 +1749,7 @@ int start_request(nfapi_pnf_config_t *config, nfapi_pnf_phy_config_t *phy, nfapi
//phy_init_RU(RC.ru[0]);
printf("[PNF] About to call init_eNB_afterRU()\n");
if (NFAPI_MODE!=NFAPI_UE_STUB_PNF) {
if (NFAPI_MODE!=NFAPI_UE_STUB_PNF && NFAPI_MODE!=NFAPI_MODE_STANDALONE_PNF) {
init_eNB_afterRU();
}
......@@ -1781,7 +1776,6 @@ int start_request(nfapi_pnf_config_t *config, nfapi_pnf_phy_config_t *phy, nfapi
int nr_start_request(nfapi_pnf_config_t *config, nfapi_pnf_phy_config_t *phy, nfapi_nr_start_request_scf_t *req) {
printf("[PNF] Received NFAPI_START_REQ phy_id:%d\n", req->header.phy_id);
nfapi_set_trace_level(NFAPI_TRACE_INFO);
pnf_info *pnf = (pnf_info *)(config->user_data);
phy_info *phy_info = pnf->phys;
nfapi_pnf_p7_config_t *p7_config = nfapi_pnf_p7_config_create();
......@@ -1827,10 +1821,10 @@ int nr_start_request(nfapi_pnf_config_t *config, nfapi_pnf_phy_config_t *phy, n
p7_config->lbt_dl_config_req = &pnf_phy_lbt_dl_config_req;
p7_config->ue_release_req = &pnf_phy_ue_release_req;
if (NFAPI_MODE==NFAPI_UE_STUB_PNF) {
p7_config->dl_config_req = &memcpy_dl_config_req;
p7_config->ul_config_req = &memcpy_ul_config_req;
p7_config->hi_dci0_req = &memcpy_hi_dci0_req;
p7_config->tx_req = &memcpy_tx_req;
p7_config->dl_config_req = NULL;
p7_config->ul_config_req = NULL;
p7_config->hi_dci0_req = NULL;
p7_config->tx_req = NULL;
} else {
p7_config->dl_config_req = &pnf_phy_dl_config_req;
p7_config->ul_config_req = &pnf_phy_ul_config_req;
......@@ -2232,7 +2226,7 @@ void configure_nr_nfapi_pnf(char *vnf_ip_addr, int vnf_p5_port, char *pnf_ip_add
void configure_nfapi_pnf(char *vnf_ip_addr, int vnf_p5_port, char *pnf_ip_addr, int pnf_p7_port, int vnf_p7_port) {
printf("%s() PNF\n\n\n\n\n\n", __FUNCTION__);
if(NFAPI_MODE!=NFAPI_UE_STUB_PNF) {
if(NFAPI_MODE!=NFAPI_UE_STUB_PNF && NFAPI_MODE!=NFAPI_MODE_STANDALONE_PNF) {
nfapi_setmode(NFAPI_MODE_PNF); // PNF!
}
nfapi_pnf_config_t *config = nfapi_pnf_config_create();
......@@ -2286,15 +2280,13 @@ void oai_subframe_ind(uint16_t sfn, uint16_t sf) {
uint16_t sfn_sf_tx = sfn<<4 | sf;
if ((sfn % 100 == 0) && sf==0) {
struct timespec ts;
clock_gettime(CLOCK_MONOTONIC, &ts);
NFAPI_TRACE(NFAPI_TRACE_INFO, "[PNF] %s %d.%d (sfn:%u sf:%u) SFN/SF(TX):%u\n", __FUNCTION__, ts.tv_sec, ts.tv_nsec, sfn, sf, NFAPI_SFNSF2DEC(sfn_sf_tx));
NFAPI_TRACE(NFAPI_TRACE_INFO, "[PNF] (sfn:%u sf:%u) SFN/SF(TX):%u\n", sfn, sf, NFAPI_SFNSF2DEC(sfn_sf_tx));
}
int subframe_ret = nfapi_pnf_p7_subframe_ind(p7_config_g, p7_config_g->phy_id, sfn_sf_tx);
if (subframe_ret) {
NFAPI_TRACE(NFAPI_TRACE_INFO, "[PNF] %s(frame:%u subframe:%u) SFN/SF(TX):%u - PROBLEM with pnf_p7_subframe_ind()\n", __FUNCTION__, sfn, sf, sfn_sf_tx, NFAPI_SFNSF2DEC(sfn_sf_tx));
NFAPI_TRACE(NFAPI_TRACE_INFO, "[PNF] (frame:%u subframe:%u) SFN/SF(TX):%u - PROBLEM with pnf_p7_subframe_ind()\n", sfn, sf, sfn_sf_tx);
} else {
//NFAPI_TRACE(NFAPI_TRACE_INFO, "***NFAPI subframe handler finished *** \n");
}
......
This diff is collapsed.
......@@ -70,10 +70,11 @@ typedef enum {
NFAPI_MODE_VNF,
NFAPI_UE_STUB_PNF,
NFAPI_UE_STUB_OFFNET,
NFAPI_MODE_STANDALONE_PNF,
NFAPI_MODE_UNKNOWN
} nfapi_mode_t;
char *nfapi_get_strmode(void);
const char *nfapi_get_strmode(void);
void nfapi_logmode(void);
nfapi_mode_t nfapi_getmode(void);
void nfapi_setmode(nfapi_mode_t nfapi_mode);
......
......@@ -14,38 +14,31 @@
* limitations under the License.
*/
#pragma once
#ifndef _DEBUG_H_
#define _DEBUG_H_
#include <string.h>
#include <errno.h>
#define ERR strerror(errno)
/*! The trace levels used by the nfapi libraries */
typedef enum nfapi_trace_level
{
NFAPI_TRACE_ERROR = 1,
NFAPI_TRACE_WARN,
NFAPI_TRACE_NOTE,
NFAPI_TRACE_INFO,
NFAPI_TRACE_LEVEL_MAX
NFAPI_TRACE_NONE,
NFAPI_TRACE_ERROR,
NFAPI_TRACE_WARN,
NFAPI_TRACE_NOTE,
NFAPI_TRACE_INFO,
NFAPI_TRACE_DEBUG,
} nfapi_trace_level_t;
/*! The trace function pointer */
typedef void (*nfapi_trace_fn_t)(nfapi_trace_level_t level, const char* format, ...);
/*! Global trace function */
extern nfapi_trace_fn_t nfapi_trace_g;
void nfapi_trace(nfapi_trace_level_t, char const *caller, const char *format, ...)
__attribute__((format(printf, 3, 4)));
/*! Global trace level */
extern nfapi_trace_level_t nfapi_trace_level_g;
/*! NFAPI trace macro */
//#define NFAPI_TRACE(level, format, ...) { if(nfapi_trace_g && ((nfapi_trace_level_t)level <= nfapi_trace_level_g)) (*nfapi_trace_g)(level, format, ##__VA_ARGS__); }
#define NFAPI_TRACE(level, format, ...) { if (nfapi_trace_g) (*nfapi_trace_g)(level, format, ##__VA_ARGS__); }
/*! Function to change the trace level
* \param new_level The modified trace level
*/
nfapi_trace_level_t nfapi_trace_level(void);
void nfapi_set_trace_level(nfapi_trace_level_t new_level);
#define NFAPI_TRACE(LEVEL, FORMAT, ...) do { \
if (nfapi_trace_level() >= (LEVEL)) \
nfapi_trace(LEVEL, __func__, FORMAT, ##__VA_ARGS__); \
} while (0)
#endif /* _DEBUG_H_ */
This diff is collapsed.
......@@ -27,6 +27,8 @@
#define NFAPI_PNF_PARAM_GENERAL_OUI_LENGTH 3
#define NFAPI_MAX_NUM_RF_BANDS 16
#define NFAPI_MAX_PACKED_MESSAGE_SIZE 8192
// The following definition control the size of arrays used in the interface.
// These may be changed if desired. They are used in the encoder to make sure
// that the user has not specified a 'count' larger than the max array, and also
......@@ -122,12 +124,13 @@ typedef struct {
// Convenience methods to convert between SFN/SLOT formats
#define NFAPI_SFNSLOT2DEC(_sfn,_slot) ( _sfn*20 + _slot ) // total count of slots
#define NFAPI_SFNSLOTDEC2SFNSLOT(_sfnslot_dec) ((((_sfnslot_dec) / 20) << 4) | (((_sfnslot_dec) - (((_sfnslot_dec) / 20) * 10)) & 0x3F))
#define NFAPI_SFNSLOTDEC2SFNSLOT(_sfnslot_dec) ((((_sfnslot_dec) / 20) << 6) | (((_sfnslot_dec) - (((_sfnslot_dec) / 20) * 20)) & 0x3F))
#define NFAPI_SFNSLOT2SFN(_sfnslot) ((_sfnslot) >> 6)
#define NFAPI_SFNSLOT2SLOT(_sfnslot) ((_sfnslot) & 0x3F)
#define NFAPI_SFNSLOTDEC2SFN(_sfnslot_dec) ((_sfnslot_dec) / 20)
#define NFAPI_SFNSLOTDEC2SLOT(_sfnslot_dec) ((_sfnslot_dec) % 20)
#define NFAPI_SFNSLOT2HEX(_sfn,_slot) ((_sfn << 6) | (_slot & 0x3F))
#define NFAPI_MAX_SFNSLOTDEC 1024*20 // 20 is for numerology 1
......@@ -706,7 +709,6 @@ typedef struct {
#define NFAPI_PHICH_CONFIG_PHICH_DURATION_TAG 0x0015
#define NFAPI_PHICH_CONFIG_PHICH_POWER_OFFSET_TAG 0x0016
typedef struct {
nfapi_uint16_tlv_t primary_synchronization_signal_epre_eprers;
nfapi_uint16_tlv_t secondary_synchronization_signal_epre_eprers;
......@@ -2497,7 +2499,7 @@ typedef struct {
typedef struct {
nfapi_p7_message_header_t header;
uint32_t t1;
int32_t delta_sfn_sf;
int32_t delta_sfn_sf;
nfapi_vendor_extension_tlv_t vendor_extension;
} nfapi_dl_node_sync_t;
......@@ -2872,11 +2874,12 @@ typedef struct {
} nfapi_rx_indication_rel9_t;
#define NFAPI_RX_INDICATION_REL9_TAG 0x2025
#define NFAPI_RX_IND_DATA_MAX 8192
typedef struct {
nfapi_rx_ue_information rx_ue_information;
nfapi_rx_indication_rel8_t rx_indication_rel8;
nfapi_rx_indication_rel9_t rx_indication_rel9;
uint8_t* data;
uint8_t rx_ind_data[NFAPI_RX_IND_DATA_MAX];
} nfapi_rx_indication_pdu_t;
#define NFAPI_RX_IND_MAX_PDU 100
......
This diff is collapsed.
......@@ -29,7 +29,7 @@
static uint32_t get_packed_msg_len(uintptr_t msgHead, uintptr_t msgEnd) {
if (msgEnd < msgHead) {
NFAPI_TRACE(NFAPI_TRACE_ERROR, "get_packed_msg_len: Error in pointers supplied %d, %d\n", msgHead, msgEnd);
NFAPI_TRACE(NFAPI_TRACE_ERROR, "get_packed_msg_len: Error in pointers supplied %lu, %lu\n", msgHead, msgEnd);
return 0;
}
......
This diff is collapsed.
This diff is collapsed.
......@@ -148,6 +148,7 @@ typedef struct {
int pnf_p7_message_pump(pnf_p7_t* pnf_p7);
int pnf_nr_p7_message_pump(pnf_p7_t* pnf_p7);
int pnf_p7_pack_and_send_p7_message(pnf_p7_t* pnf_p7, nfapi_p7_message_header_t* msg, uint32_t msg_len);
int pnf_nr_p7_pack_and_send_p7_message(pnf_p7_t* pnf_p7, nfapi_p7_message_header_t* header, uint32_t msg_len);
int pnf_p7_send_message(pnf_p7_t* pnf_p7, uint8_t* msg, uint32_t msg_len);
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -278,7 +278,7 @@ void *fapi_thread_start(void *ptr) {
if(instance->tick == 1000) {
if(instance->tx_byte_count > 0) {
printf("[FAPI] Tx rate %d bytes/sec\n", instance->tx_byte_count);
printf("[FAPI] Tx rate %u bytes/sec\n", instance->tx_byte_count);
instance->tx_byte_count = 0;
}
......@@ -319,7 +319,7 @@ void *fapi_thread_start(void *ptr) {
millisec = now_ts.tv_nsec / 1e6;
if(last_millisec != -1 && ((last_millisec + 1 ) % 1000) != millisec) {
printf("*** missing millisec %d %d\n", last_millisec, millisec);
printf("*** missing millisec %u %u\n", last_millisec, millisec);
catchup = millisec - last_millisec - 1;
}
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -106,7 +106,7 @@ void phy_config_request(PHY_Config_t *phy_config) {
int Ncp = cfg->subframe_config.dl_cyclic_prefix_type.value;
int p_eNB = cfg->rf_config.tx_antenna_ports.value;
uint32_t dl_CarrierFreq = cfg->nfapi_config.earfcn.value;
LOG_I(PHY,"Configuring MIB for instance %d, CCid %d : (band %d,N_RB_DL %d, N_RB_UL %d, Nid_cell %d,eNB_tx_antenna_ports %d,Ncp %d,DL freq %u,phich_config.resource %d, phich_config.duration %d)\n",
LOG_A(PHY,"Configuring MIB for instance %d, CCid %d : (band %d,N_RB_DL %d, N_RB_UL %d, Nid_cell %d,eNB_tx_antenna_ports %d,Ncp %d,DL freq %u,phich_config.resource %d, phich_config.duration %d)\n",
Mod_id, CC_id, eutra_band, dl_Bandwidth, ul_Bandwidth, Nid_cell, p_eNB,Ncp,dl_CarrierFreq,
cfg->phich_config.phich_resource.value,
cfg->phich_config.phich_duration.value);
......
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