Commit 756ac05e authored by laurent's avatar laurent

merge develop,fix basic sim and warnings

parents 44167f01 6c8938d5
......@@ -674,7 +674,8 @@ class SSHConnection():
self.command('mkdir -p ' + self.EPCSourceCodePath + '/scripts', '\$', 5)
self.command('cd /opt/hss_sim0609', '\$', 5)
self.command('echo ' + self.EPCPassword + ' | sudo -S rm -f hss.log daemon.log', '\$', 5)
self.command('echo ' + self.EPCPassword + ' | sudo -S echo "Starting sudo session" && sudo daemon --unsafe --name=simulated_hss --chdir=/opt/hss_sim0609 ./starthss_real ', '\$', 5)
# based on Robert's feedback, new method to run simulated HSS
self.command('sudo su -c "cd /opt/hss_sim0609 && screen -dm -S simulated_hss ./starthss_real"', '\$', 5)
else:
logging.error('This option should not occur!')
self.close()
......
......@@ -112,7 +112,7 @@ function analyzeIperfFiles {
echo " <td bgcolor = \"green\" >OK</td>" >> ./test_simulator_results.html
fi
else
EFFECTIVE_BITRATE=`tail -n3 $IPERF_CASE | egrep "Mbits/sec" | sed -e "s#^.*MBytes *##" -e "s#sec.*#sec#"`
EFFECTIVE_BITRATE=`tail -n3 $IPERF_CASE | egrep "bits/sec" | sed -e "s#^.*Bytes *##" -e "s#sec.*#sec#"`
if [[ $EFFECTIVE_BITRATE =~ .*Kbits/sec.* ]]
then
EFFECTIVE_BITRATE=`echo $EFFECTIVE_BITRATE | sed -e "s# *Kbits/sec.*##"`
......@@ -136,9 +136,9 @@ function analyzeIperfFiles {
else
echo " <td bgcolor = \"green\" >OK</td>" >> ./test_simulator_results.html
fi
EFFECTIVE_BITRATE=`tail -n3 $IPERF_CASE | egrep "Mbits/sec" | sed -e "s#^.*MBytes *##" -e "s#sec.*#sec#"`
JITTER=`tail -n3 $IPERF_CASE | egrep "Mbits/sec" | sed -e "s#^.*Mbits/sec *##" -e "s#ms.*#ms#"`
PACKETLOSS=`tail -n3 $IPERF_CASE | egrep "Mbits/sec" | sed -e "s#^.*(##" -e "s#).*##"`
EFFECTIVE_BITRATE=`tail -n3 $IPERF_CASE | egrep "bits/sec" | sed -e "s#^.*Bytes *##" -e "s#sec.*#sec#"`
JITTER=`tail -n3 $IPERF_CASE | egrep "bits/sec" | sed -e "s#^.*bits/sec *##" -e "s#ms.*#ms#"`
PACKETLOSS=`tail -n3 $IPERF_CASE | egrep "bits/sec" | sed -e "s#^.*(##" -e "s#).*##"`
fi
echo " <td>" >> ./test_simulator_results.html
echo " <pre>" >> ./test_simulator_results.html
......@@ -730,8 +730,8 @@ function report_test {
IPERF_TESTS=`ls $ARCHIVES_LOC/${TMODE}_${BW}prb_${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
IPERF_TESTS=`ls $ARCHIVES_LOC/${TMODE}_${BW}prb_${CN_CONFIG}_iperf_ul*client*txt 2> /dev/null`
analyzeIperfFiles
done
done
done
......
......@@ -342,6 +342,7 @@ function check_iperf {
local FILE_COMPLETE=`egrep -c "Server Report" ${LOC_BASE_LOG}_client.txt`
if [ $FILE_COMPLETE -eq 0 ]
then
# This part will become obsolete once we have UL
if [[ $LOC_IS_RF_SIM -eq 1 ]] && [[ $LOC_IS_NR -eq 1 ]]
then
echo "no UL integration right now --> normal to have no server report"
......@@ -350,11 +351,11 @@ function check_iperf {
local EFFECTIVE_BANDWIDTH=`tail -n1 ${LOC_BASE_LOG}_server.txt | sed -e "s#^.*MBytes *##" -e "s#^.*KBytes *##" -e "s#sec.*#sec#"`
if [[ $2 =~ .*K.* ]]
then
local BW_SUFFIX="K"
local BW_PREFIX="K"
else
local BW_SUFFIX="M"
local BW_PREFIX="M"
fi
if [[ $EFFECTIVE_BANDWIDTH =~ .*${LOC_REQ_BW}.*${BW_SUFFIX}bits.* ]] || [[ $EFFECTIVE_BANDWIDTH =~ .*${LOC_REQ_BW_MINUS_ONE}.*${BW_SUFFIX}bits.* ]]
if [[ $EFFECTIVE_BANDWIDTH =~ .*${LOC_REQ_BW}.*${BW_PREFIX}bits.* ]] || [[ $EFFECTIVE_BANDWIDTH =~ .*${LOC_REQ_BW_MINUS_ONE}.*${BW_PREFIX}bits.* ]]
then
echo "got requested DL bandwidth: $EFFECTIVE_BANDWIDTH"
else
......@@ -370,10 +371,19 @@ function check_iperf {
echo "File Report not found"
fi
else
local EFFECTIVE_BANDWIDTH=`tail -n3 ${LOC_BASE_LOG}_client.txt | egrep "Mbits/sec" | sed -e "s#^.*MBytes *##" -e "s#sec.*#sec#"`
if [ `egrep -c "Mbits/sec" ${LOC_BASE_LOG}_client.txt` -ne 0 ]
then
local EFFECTIVE_BANDWIDTH=`tail -n3 ${LOC_BASE_LOG}_client.txt | egrep "Mbits/sec" | sed -e "s#^.*MBytes *##" -e "s#sec.*#sec#"`
local BW_PREFIX="M"
fi
if [ `egrep -c "Kbits/sec" ${LOC_BASE_LOG}_client.txt` -ne 0 ]
then
local EFFECTIVE_BANDWIDTH=`tail -n3 ${LOC_BASE_LOG}_client.txt | egrep "Kbits/sec" | sed -e "s#^.*KBytes *##" -e "s#sec.*#sec#"`
local BW_PREFIX="K"
fi
if [ $LOC_IS_DL -eq 1 ] && [ $LOC_IS_BASIC_SIM -eq 1 ]
then
if [[ $EFFECTIVE_BANDWIDTH =~ .*${LOC_REQ_BW}.*Mbits.* ]] || [[ $EFFECTIVE_BANDWIDTH =~ .*${LOC_REQ_BW_MINUS_ONE}.*Mbits.* ]] || [[ $EFFECTIVE_BANDWIDTH =~ .*${LOC_REQ_BW_MINUS_TWO}.*Mbits.* ]] || [[ $EFFECTIVE_BANDWIDTH =~ .*${LOC_REQ_BW_MINUS_THREE}.*Mbits.* ]]
if [[ $EFFECTIVE_BANDWIDTH =~ .*${LOC_REQ_BW}.*${BW_PREFIX}bits.* ]] || [[ $EFFECTIVE_BANDWIDTH =~ .*${LOC_REQ_BW_MINUS_ONE}.*${BW_PREFIX}bits.* ]] || [[ $EFFECTIVE_BANDWIDTH =~ .*${LOC_REQ_BW_MINUS_TWO}.*${BW_PREFIX}bits.* ]] || [[ $EFFECTIVE_BANDWIDTH =~ .*${LOC_REQ_BW_MINUS_THREE}.*${BW_PREFIX}bits.* ]]
then
echo "got requested DL bandwidth: $EFFECTIVE_BANDWIDTH"
else
......@@ -381,7 +391,7 @@ function check_iperf {
IPERF_STATUS=-1
fi
else
if [[ $EFFECTIVE_BANDWIDTH =~ .*${LOC_REQ_BW}.*Mbits.* ]] || [[ $EFFECTIVE_BANDWIDTH =~ .*${LOC_REQ_BW_MINUS_ONE}.*Mbits.* ]]
if [[ $EFFECTIVE_BANDWIDTH =~ .*${LOC_REQ_BW}.*${BW_PREFIX}bits.* ]] || [[ $EFFECTIVE_BANDWIDTH =~ .*${LOC_REQ_BW_MINUS_ONE}.*${BW_PREFIX}bits.* ]]
then
if [ $LOC_IS_DL -eq 1 ]
then
......@@ -390,7 +400,7 @@ function check_iperf {
echo "got requested UL bandwidth: $EFFECTIVE_BANDWIDTH"
fi
else
echo "not basic-sim got LESS than requested DL bandwidth: $EFFECTIVE_BANDWIDTH"
echo "got LESS than requested DL bandwidth: $EFFECTIVE_BANDWIDTH"
IPERF_STATUS=-1
fi
fi
......@@ -2067,7 +2077,7 @@ function run_test_on_vm {
fi
echo "############################################################"
echo "${CN_CONFIG} : iperf DL -- UE is server and eNB is client"
echo "${CN_CONFIG} : iperf DL -- NR-UE is server and gNB is client"
echo "############################################################"
THROUGHPUT="30K"
CURR_IPERF_LOG_BASE=tdd_${PRB}prb_${CN_CONFIG}_iperf_dl
......@@ -2078,6 +2088,18 @@ function run_test_on_vm {
scp -o StrictHostKeyChecking=no ubuntu@$NR_UE_VM_IP_ADDR:/home/ubuntu/${CURR_IPERF_LOG_BASE}_server.txt $ARCHIVES_LOC
check_iperf $ARCHIVES_LOC/$CURR_IPERF_LOG_BASE $THROUGHPUT
echo "############################################################"
echo "${CN_CONFIG} : iperf UL -- gNB is server and NR-UE is client"
echo "############################################################"
THROUGHPUT="30K"
CURR_IPERF_LOG_BASE=tdd_${PRB}prb_${CN_CONFIG}_iperf_ul
get_enb_noS1_ip_addr $GNB_VM_CMDS $GNB_VM_IP_ADDR
get_ue_ip_addr $NR_UE_VM_CMDS $NR_UE_VM_IP_ADDR 1
generic_iperf $GNB_VM_CMDS $GNB_VM_IP_ADDR $ENB_IP_ADDR $NR_UE_VM_CMDS $NR_UE_VM_IP_ADDR $UE_IP_ADDR $THROUGHPUT $CURR_IPERF_LOG_BASE 1 0
scp -o StrictHostKeyChecking=no ubuntu@$GNB_VM_IP_ADDR:/home/ubuntu/${CURR_IPERF_LOG_BASE}_server.txt $ARCHIVES_LOC
scp -o StrictHostKeyChecking=no ubuntu@$NR_UE_VM_IP_ADDR:/home/ubuntu/${CURR_IPERF_LOG_BASE}_client.txt $ARCHIVES_LOC
check_iperf $ARCHIVES_LOC/$CURR_IPERF_LOG_BASE $THROUGHPUT
echo "############################################################"
echo "${CN_CONFIG} : Terminate gNB/NR-UE simulators"
echo "############################################################"
......
......@@ -247,22 +247,18 @@ add_boolean_option(T_TRACER True "Activate the T tracer, a debugging
add_boolean_option(UE_AUTOTEST_TRACE False "Activate UE autotest specific logs")
add_boolean_option(UE_DEBUG_TRACE False "Activate UE debug trace")
add_boolean_option(UE_TIMING_TRACE False "Activate UE timing trace")
add_boolean_option(USRP_REC_PLAY False "Enable USRP record playback mode")
add_boolean_option(BASIC_SIMULATOR False "Has to be True when building the basic simulator, False otherwise")
add_boolean_option(DEBUG_CONSOLE False "makes debugging easier, disables stdout/stderr buffering")
add_boolean_option(ENABLE_ITTI True "ITTI is internal messaging, should remain enabled for most targets")
set (OCP_ITTI ${OPENAIR_DIR}/common/utils/ocp_itti)
if (${ENABLE_ITTI})
add_library(ITTI
${OCP_ITTI}/intertask_interface.cpp
${OPENAIR_DIR}/common/utils/backtrace.c
${OPENAIR_DIR}/common/utils/memory_pools.c
)
add_library(ITTI
${OCP_ITTI}/intertask_interface.cpp
${OPENAIR_DIR}/common/utils/backtrace.c
${OPENAIR_DIR}/common/utils/memory_pools.c
)
add_dependencies(ITTI rrc_flag)
set(ITTI_LIB ITTI)
set(GTPU_need_ITTI ${OPENAIR3_DIR}/GTPV1-U/gtpv1u_eNB.c)
endif (${ENABLE_ITTI})
##################################################
# ASN.1 grammar C code generation & dependencies #
......@@ -660,7 +656,6 @@ set (SHLIB_LOADER_SOURCES
include_directories("${OPENAIR_TARGETS}/ARCH/USRP/USERSPACE/LIB/")
set(HWLIB_USRP_SOURCE
${OPENAIR_TARGETS}/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp
${OPENAIR_TARGETS}/ARCH/USRP/USERSPACE/LIB/usrp_lib_config.c
)
add_library(oai_usrpdevif MODULE ${HWLIB_USRP_SOURCE} )
target_link_libraries(oai_usrpdevif uhd)
......@@ -1714,7 +1709,6 @@ 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
${LTE_RLC_SRC}
)
set (MAC_SRC
......@@ -2370,6 +2364,9 @@ add_library(rfsimulator MODULE
)
target_link_libraries(rfsimulator SIMU ${ATLAS_LIBRARIES})
add_library(oai_iqplayer MODULE
${OPENAIR_TARGETS}/ARCH/iqplayer/iqplayer_lib.c
)
set(CMAKE_MODULE_PATH "${OPENAIR_DIR}/cmake_targets/tools/MODULES" "${CMAKE_MODULE_PATH}")
#include T directory even if the T is off because T macros are in the code
......@@ -2450,6 +2447,7 @@ add_executable(lte-softmodem
${OPENAIR_TARGETS}/COMMON/create_tasks.c
${OPENAIR_TARGETS}/COMMON/create_tasks_mbms.c
${OPENAIR_TARGETS}/ARCH/COMMON/common_lib.c
${OPENAIR_TARGETS}/ARCH/COMMON/record_player.c
${OPENAIR2_DIR}/RRC/NAS/nas_config.c
${OPENAIR2_DIR}/RRC/NAS/rb_config.c
${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/netlink_init.c
......@@ -2464,7 +2462,7 @@ add_executable(lte-softmodem
${CONFIG_SOURCES}
${SHLIB_LOADER_SOURCES}
)
add_dependencies(lte-softmodem rrc_flag s1ap_flag x2_flag)
add_dependencies(lte-softmodem rrc_flag s1ap_flag x2_flag oai_iqplayer)
target_link_libraries (lte-softmodem
-Wl,--start-group
......@@ -2490,6 +2488,7 @@ add_executable(ocp-softmodem
${OPENAIR_TARGETS}/COMMON/create_tasks.c
${OPENAIR_TARGETS}/COMMON/create_tasks_mbms.c
${OPENAIR_TARGETS}/ARCH/COMMON/common_lib.c
${OPENAIR_TARGETS}/ARCH/COMMON/record_player.c
${OPENAIR2_DIR}/RRC/NAS/nas_config.c
${OPENAIR2_DIR}/RRC/NAS/rb_config.c
${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/netlink_init.c
......@@ -2504,7 +2503,7 @@ add_executable(ocp-softmodem
${CONFIG_SOURCES}
${SHLIB_LOADER_SOURCES}
)
add_dependencies(ocp-softmodem rrc_flag s1ap_flag x2_flag)
add_dependencies(ocp-softmodem rrc_flag s1ap_flag x2_flag oai_iqplayer)
target_link_libraries (ocp-softmodem
-Wl,--start-group
......@@ -2555,6 +2554,7 @@ add_executable(lte-uesoftmodem
${OPENAIR_TARGETS}/RT/USER/rfsim.c
${OPENAIR_TARGETS}/COMMON/create_tasks_ue.c
${OPENAIR_TARGETS}/ARCH/COMMON/common_lib.c
${OPENAIR_TARGETS}/ARCH/COMMON/record_player.c
${OPENAIR2_DIR}/RRC/NAS/nas_config.c
${OPENAIR2_DIR}/RRC/NAS/rb_config.c
${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/netlink_init.c
......@@ -2601,6 +2601,7 @@ add_executable(nr-softmodem
${OPENAIR_DIR}/executables/softmodem-common.c
${OPENAIR1_DIR}/SIMULATION/TOOLS/taus.c
${OPENAIR_TARGETS}/ARCH/COMMON/common_lib.c
${OPENAIR_TARGETS}/ARCH/COMMON/record_player.c
${OPENAIR2_DIR}/RRC/NAS/nas_config.c
${OPENAIR2_DIR}/RRC/NAS/rb_config.c
${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/netlink_init.c
......@@ -2617,7 +2618,7 @@ target_link_libraries (nr-softmodem
-Wl,--start-group
UTIL HASHTABLE SCTP_CLIENT UDP SCHED_LIB SCHED_RU_LIB SCHED_NR_LIB PHY_NR PHY PHY_COMMON PHY_RU LFDS GTPV1U SECU_CN SECU_OSA
${ITTI_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${FLEXRAN_AGENT_LIB} LFDS7 ${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} RRC_LIB NR_RRC_LIB
S1AP_LIB S1AP_ENB L2 L2_LTE L2_NR MAC_NR_COMMON NFAPI_COMMON_LIB NFAPI_LIB NFAPI_VNF_LIB NFAPI_PNF_LIB NFAPI_USER_LIB
S1AP_LIB S1AP_ENB L2 L2_NR MAC_NR_COMMON NFAPI_COMMON_LIB NFAPI_LIB NFAPI_VNF_LIB NFAPI_PNF_LIB NFAPI_USER_LIB
X2AP_LIB X2AP_ENB F1AP_LIB F1AP M2AP_LIB M2AP_ENB M3AP_LIB M3AP_ENB ${PROTO_AGENT_LIB} ${FSPT_MSG_LIB}
-Wl,--end-group z dl)
......@@ -2640,6 +2641,7 @@ add_executable(nr-uesoftmodem
${OPENAIR_DIR}/executables/softmodem-common.c
${OPENAIR1_DIR}/SIMULATION/TOOLS/taus.c
${OPENAIR_TARGETS}/ARCH/COMMON/common_lib.c
${OPENAIR_TARGETS}/ARCH/COMMON/record_player.c
${OPENAIR2_DIR}/RRC/NAS/nas_config.c
${OPENAIR2_DIR}/RRC/NAS/rb_config.c
${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/netlink_init.c
......@@ -2903,7 +2905,7 @@ if (${T_TRACER})
nr_ulschsim ldpctest polartest smallblocktest cu_test du_test
#all "add_library" definitions
ITTI RRC_LIB NR_RRC_LIB S1AP_LIB S1AP_ENB X2AP_LIB X2AP_ENB M2AP_LIB M2AP_ENB M3AP_LIB M3AP_ENB F1AP_LIB F1AP
params_libconfig oai_exmimodevif oai_usrpdevif oai_bladerfdevif oai_lmssdrdevif
params_libconfig oai_exmimodevif oai_usrpdevif oai_bladerfdevif oai_lmssdrdevif oai_iqplayer
oai_eth_transpro oai_mobipass tcp_bridge tcp_bridge_oai
coding FLPT_MSG ASYNC_IF FLEXRAN_AGENT HASHTABLE MSC UTIL OMG_SUMO
SECU_OSA SECU_CN SCHED_LIB SCHED_NR_LIB SCHED_RU_LIB SCHED_UE_LIB SCHED_NR_UE_LIB default_sched remote_sched RAL
......
......@@ -296,8 +296,8 @@ check_install_usrp_uhd_driver(){
x=$((x + 1))
done
$SUDO apt-get update
$SUDO apt-get -y --allow-unauthenticated install python python-tk libboost-all-dev libusb-1.0-0-dev
$SUDO apt-get -y --allow-unauthenticated install libuhd-dev libuhd003 uhd-host
$SUDO apt-get -y install python python-tk libboost-all-dev libusb-1.0-0-dev
$SUDO apt-get -y install libuhd-dev libuhd003 uhd-host
elif [[ "$OS_BASEDISTRO" == "fedora" ]]; then
$SUDO $INSTALLER -y install python boost libusb-devel libusbx-devel boost-devel python-mako python-docutils cmake
$SUDO -H pip install requests
......@@ -367,9 +367,9 @@ check_install_bladerf_driver(){
$SUDO add-apt-repository -y ppa:bladerf/bladerf
$SUDO apt-get update
fi
$SUDO apt-get install -y --allow-unauthenticated bladerf libbladerf-dev
$SUDO apt-get install -y --allow-unauthenticated bladerf-firmware-fx3
$SUDO apt-get install -y --allow-unauthenticated bladerf-fpga-hostedx40
$SUDO apt-get install -y bladerf libbladerf-dev
$SUDO apt-get install -y bladerf-firmware-fx3
$SUDO apt-get install -y bladerf-fpga-hostedx40
elif [[ "$OS_BASEDISTRO" == "fedora" ]]; then
install_bladerf_driver_from_source
else
......
......@@ -274,16 +274,6 @@ typedef struct {
} log_t;
#if defined(ENABLE_ITTI)
typedef enum log_instance_type_e {
LOG_INSTANCE_UNKNOWN,
LOG_INSTANCE_ENB,
LOG_INSTANCE_UE,
} log_instance_type_t;
void log_set_instance_type (log_instance_type_t instance);
#endif
#ifdef LOG_MAIN
log_t *g_log;
......
......@@ -633,9 +633,6 @@ inline static uint32_t vcd_get_write_index(void)
return write_index;
}
#if defined(ENABLE_ITTI)
int signal_mask(void);
#endif
void *vcd_dumper_thread_rt(void *args)
{
......@@ -644,9 +641,7 @@ void *vcd_dumper_thread_rt(void *args)
struct sched_param sched_param;
uint32_t data_ready_wait;
# if defined(ENABLE_ITTI)
return 0; //signal_mask(); //function defined at common/utils/ocp_itti/intertask_interface.cpp
# endif
sched_param.sched_priority = sched_get_priority_min(SCHED_FIFO) + 1;
sched_setscheduler(0, SCHED_FIFO, &sched_param);
......
......@@ -358,23 +358,21 @@ static void forward(void *_forwarder, char *buf, int size) {
f->tail = new;
#if BASIC_SIMULATOR
/* When runnng the basic simulator, the tracer may be too slow.
* Let's not take too much memory in the tracee and
* wait if there is too much data to send. 200MB is
* arbitrary.
*/
while (f->memusage > 200 * 1024 * 1024) {
if (pthread_cond_signal(&f->cond)) abort();
if (pthread_mutex_unlock(&f->lock)) abort();
while (f->memusage > 200 * 1024 * 1024) {
if (pthread_cond_signal(&f->cond)) abort();
usleep(1000);
if (pthread_mutex_unlock(&f->lock)) abort();
if (pthread_mutex_lock(&f->lock)) abort();
}
usleep(1000);
#endif /* BASIC_SIMULATOR */
if (pthread_mutex_lock(&f->lock)) abort();
}
#endif
f->memusage += size+4;
/* warn every 100MB */
......
# telnet server principles
The oai telnet server is implemented in a shared library to be loaded by the [oai shared library loader](loader). The implementation includes a `telnetsrv_autoinit` function which is automatically called at load time, starts the telnet server and registers a first set of commands, which are delivered with the server (telnet, softmodem, loader).
The oai telnet server is implemented in shared libraries to be loaded by the [oai shared library loader](loader). `libtelnetsrv.so ` contains the code common to all oai softmodem executables, where `libtelnetsrv_<app>.so` contains the code specific to the executable identified by `app`.
| `<app>` | executable |
| :-----: | :---------------: |
| enb | `lte-softmodem` |
| gnb | `nr-softmodem` |
| 4Gue | `lte-uesoftmodem` |
| 5Gue | `nr-uesoftmodem` |
The implementation includes a `telnetsrv_autoinit` function which is automatically called at load time, starts the telnet server and registers a first set of commands, which are delivered with the server (telnet, softmodem, loader). it also uses the `get_softmodem_function` call to retrieve the running executable id and possibly loads the corresponding `libtelnetsrv_<app>.so`library.
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.
......@@ -12,10 +21,11 @@ The telnet server provides an API which can be used by any oai component to add
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. This implementation is compatible with all softmodem executables and is in charge of loading any additional `libtelnetsrv_<app> .so` containing code specific to the running executables.
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_<XXX\>.c`: implementation of \<XXX\> CLI command which are delivered with the telnet server and are common to all softmodem executables.
1. `telnetsrv_<XXX\>.h`: include file for the implementation of XXX CLI command. Usually included only in the corresponding `.c`file
1. `telnetsrv_<app>_<XXX>.c`: implementation of \<XXX\> CLI command specific to the executable identified by \<app\>.These sources are used to create `libtelnetsrv_<app>.so` at build time.
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)
......@@ -8,7 +8,7 @@ By default the embedded telnet server, which is implemented in a shared library,
./build_oai --build-lib telnetsrv
```
This will create the `libtelnetsrv.so` file in the `targets/bin` and `cmake_targets/ran_build/build` sub directories of the oai repository.
This will create the `libtelnetsrv.so` and `libtelnetsrv_<app> file in the `targets/bin` and `cmake_targets/ran_build/build` sub directories of the oai repository. <app> can be "enb", "gnb", "4GUE" or "5GUE", each library containing functions specific to a given executable.
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).
......
......@@ -53,6 +53,7 @@
#include <sys/resource.h>
#include "common/utils/load_module_shlib.h"
#include "common/config/config_userapi.h"
#include "executables/softmodem-common.h"
#include <readline/history.h>
......@@ -546,6 +547,7 @@ void run_telnetsrv(void) {
int readc, filled;
int status;
int optval = 1;
char prompt[sizeof(TELNET_PROMPT_PREFIX)+10];
pthread_setname_np(pthread_self(), "telnet");
set_sched(pthread_self(),0,telnetparams.priority);
sock = socket(AF_INET, SOCK_STREAM, 0);
......@@ -570,6 +572,7 @@ void run_telnetsrv(void) {
fprintf(stderr,"[TELNETSRV] Error %s on listen call\n",strerror(errno));
using_history();
int plen=sprintf(prompt,"%s_%s> ",TELNET_PROMPT_PREFIX,get_softmodem_function(NULL));
printf("\nInitializing telnet server...\n");
while( (telnetparams.new_socket = accept(sock, &cli_addr, &cli_len)) ) {
......@@ -613,9 +616,9 @@ void run_telnetsrv(void) {
HIST_ENTRY *hisentry = history_get(strtol(buf+1,NULL,0));
if (hisentry) {
char msg[TELNET_MAX_MSGLENGTH + sizeof(TELNET_PROMPT) +10];
char msg[TELNET_MAX_MSGLENGTH + plen +10];
sprintf(buf,"%s",hisentry->line);
sprintf(msg,"%s %s\n",TELNET_PROMPT, hisentry->line);
sprintf(msg,"%s %s\n",prompt, hisentry->line);
send(telnetparams.new_socket, msg, strlen(msg), MSG_NOSIGNAL);
}
}
......@@ -635,7 +638,7 @@ void run_telnetsrv(void) {
add_history(buf);
}
send(telnetparams.new_socket, TELNET_PROMPT, sizeof(TELNET_PROMPT), MSG_NOSIGNAL);
send(telnetparams.new_socket, prompt, strlen(prompt), MSG_NOSIGNAL);
} else {
printf ("[TELNETSRV] Closing telnet connection...\n");
break;
......@@ -653,7 +656,7 @@ void run_telnetsrv(void) {
}
/*------------------------------------------------------------------------------------------------*/
/* set_telnetmodule loads the commands delivered with the telnet server
/* load the commands delivered with the telnet server
*
*
*
......@@ -709,10 +712,17 @@ int add_sharedmodules(void) {
return ret;
}
/* autoinit functions is called by the loader when the telnet shared library is
dynamically loaded
*/
int telnetsrv_autoinit(void) {
memset(&telnetparams,0,sizeof(telnetparams));
config_get( telnetoptions,sizeof(telnetoptions)/sizeof(paramdef_t),"telnetsrv");
/* possibly load a exec specific shared lib */
char *execfunc=get_softmodem_function(NULL);
char libname[64];
sprintf(libname,"telnetsrv_%s",execfunc);
load_module_shlib(libname,NULL,0,NULL);
if(pthread_create(&telnetparams.telnet_pthread,NULL, (void *(*)(void *))run_telnetsrv, NULL) != 0) {
fprintf(stderr,"[TELNETSRV] Error %s on pthread_create call\n",strerror(errno));
return -1;
......
......@@ -35,7 +35,7 @@
#define TELNET_PORT 9090
#define TELNET_MAX_MSGLENGTH 2048
#define TELNET_PROMPT "softmodem> "
#define TELNET_PROMPT_PREFIX "softmodem"
#define TELNET_MAXCMD 20
#define TELNET_CMD_MAXSIZE 20
#define TELNET_HELPSTR_SIZE 80
......
......@@ -2,20 +2,32 @@ set(TELNETROOT ${OPENAIR_DIR}/common/utils/telnetsrv )
set(TELNETSRV_SOURCE
${TELNETROOT}/telnetsrv.c
${TELNETROOT}/telnetsrv_phycmd.c
${TELNETROOT}/telnetsrv_proccmd.c
${TELNETROOT}/telnetsrv_loader.c
${TELNETROOT}/telnetsrv_measurements.c
)
#set(TELNETSRV_ETHDEVCMD_SOURCE
# ${APPROOT}/telnetsrv/telnetsrv_ethdevcmd.c
# )
add_library(telnetsrv MODULE ${TELNETSRV_SOURCE} )
#add_library(telnetsrv_ethdevcmd MODULE ${TELNETSRV_ETHDEVCMD_SOURCE} )
target_link_libraries(telnetsrv PRIVATE history)
foreach(TELNETLIB enb gnb 4gUE 5gUE)
set(TELNETLIB_SRCS "")
foreach(TELNETLIB_ASRC measurements phycmd)
set(TELNETLIB_SRC ${OPENAIR_DIR}/common/utils/telnetsrv/telnetsrv_${TELNETLIB}_${TELNETLIB_ASRC}.c)
if (EXISTS ${TELNETLIB_SRC})
set( TELNETLIB_SRCS "${TELNETLIB_SRC};${TELNETLIB_SRCS}")
endif()
endforeach()
if(NOT "${TELNETLIB_SRCS}" STREQUAL "")
message("Add ${TELNETLIB} specific telnet functions in libtelnetsrv_${TELNETLIB}.so")
add_library(telnetsrv_${TELNETLIB} MODULE ${TELNETLIB_SRCS} )
add_dependencies(telnetsrv telnetsrv_${TELNETLIB})
install(TARGETS telnetsrv_${TELNETLIB} DESTINATION bin)
else()
message("No specific telnet functions for ${TELNETLIB}")
endif()
endforeach()
install(TARGETS telnetsrv DESTINATION bin)
if (EXISTS "${OPENAIR_BUILD_DIR}/ran_build/build" AND IS_DIRECTORY "${OPENAIR_BUILD_DIR}/ran_build/build")
......
/*
* 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/utils/telnetsrv/telnetsrv_measurements.c
* \brief: implementation of telnet commands related to eNB measurments
* \author Francois TABURET
* \date 2019
* \version 0.1
* \company NOKIA BellLabs France
* \email: francois.taburet@nokia-bell-labs.com
* \note
* \warning
*/
#define _GNU_SOURCE
#include <sys/types.h>
#include <stdio.h>
#include <unistd.h>
#include <errno.h>
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>
#define TELNETSERVERCODE
#include "telnetsrv.h"
#include "common/utils/LOG/log.h"
#include "common/config/config_userapi.h"
#include "telnetsrv_measurements.h"
#include "telnetsrv_ltemeasur_def.h"
#include "telnetsrv_cpumeasur_def.h"
#include "openair2/LAYER2/MAC/mac.h"
#include "openair1/PHY/phy_extern.h"
void measurcmd_display_macstats(telnet_printfunc_t prnt);
void measurcmd_display_macstats_ue(telnet_printfunc_t prnt);
void measurcmd_display_rlcstats(telnet_printfunc_t prnt);
void measurcmd_display_phycpu(telnet_printfunc_t prnt);
void measurcmd_display_maccpu(telnet_printfunc_t prnt);
void measurcmd_display_pdcpcpu(telnet_printfunc_t prnt);
static telnet_measurgroupdef_t enbmeasurgroups[] = {
{"enb", GROUP_LTESTATS,0, measurcmd_display_macstats, {NULL}},
{"enbues",GROUP_LTESTATS,0, measurcmd_display_macstats_ue,{NULL}},
{"rlc", GROUP_LTESTATS,0, measurcmd_display_rlcstats, {NULL}},
{"phycpu",GROUP_CPUSTATS,0, measurcmd_display_phycpu, {NULL}},
{"maccpu",GROUP_CPUSTATS,0, measurcmd_display_maccpu, {NULL}},
{"pdcpcpu",GROUP_CPUSTATS,0, measurcmd_display_pdcpcpu, {NULL}},
};
#define TELNET_NUM_ENBMEASURGROUPS (sizeof(enbmeasurgroups)/sizeof(telnet_measurgroupdef_t))
static int eNB_id =0;
static double cpufreq;
#define HDR "---------------------------------"
int get_measurgroups(telnet_measurgroupdef_t **measurgroups) {
*measurgroups = enbmeasurgroups;
return TELNET_NUM_ENBMEASURGROUPS;
}
void measurcmd_display_phycpu(telnet_printfunc_t prnt) {
PHY_VARS_eNB *phyvars = RC.eNB[eNB_id][0];
telnet_cpumeasurdef_t cpumeasur[]=CPU_PHYENB_MEASURE;
prnt("%s cpu (%1.1g GHz) measurements: PHY (cpustats %s) %s\n",HDR,cpufreq,
PRINT_CPUMEAS_STATE,HDR);
measurcmd_display_cpumeasures(prnt, cpumeasur, sizeof(cpumeasur)/sizeof(telnet_cpumeasurdef_t));
}
void measurcmd_display_maccpu(telnet_printfunc_t prnt) {
eNB_MAC_INST *macvars = RC.mac[eNB_id];
telnet_cpumeasurdef_t cpumeasur[]=CPU_MACENB_MEASURE;
prnt("%s cpu (%1.1g GHz) measurements: MAC (cpustats %s) %s\n",HDR,cpufreq,
PRINT_CPUMEAS_STATE,HDR);
measurcmd_display_cpumeasures(prnt, cpumeasur, sizeof(cpumeasur)/sizeof(telnet_cpumeasurdef_t));
}
void measurcmd_display_pdcpcpu(telnet_printfunc_t prnt) {
pdcp_stats_t *pdcpvars = &(eNB_pdcp_stats[eNB_id]);
telnet_cpumeasurdef_t cpumeasur[]=CPU_PDCPENB_MEASURE;
prnt("%s cpu (%1.1g GHz) measurements: PDCP (cpustats %s) %s \n",HDR,cpufreq,
PRINT_CPUMEAS_STATE,HDR);
measurcmd_display_cpumeasures(prnt, cpumeasur, sizeof(cpumeasur)/sizeof(telnet_cpumeasurdef_t));
}
/*----------------------------------------------------------------------------------------------------*/
void measurcmd_display_macstats_ue(telnet_printfunc_t prnt) {
UE_list_t *UE_list = &(RC.mac[eNB_id]->UE_list);
for (int UE_id=UE_list->head; UE_id>=0; UE_id=UE_list->next[UE_id]) {
for (int i=0; i<UE_list->numactiveCCs[UE_id]; i++) {
int CC_id = UE_list->ordered_CCids[i][UE_id];
prnt("%s UE %i Id %i CCid %i %s\n",HDR,i,UE_id,CC_id,HDR);
eNB_UE_STATS *macuestatptr = &(UE_list->eNB_UE_stats[CC_id][UE_id]);
telnet_ltemeasurdef_t statsptr[]=LTEMAC_UEMEASURE;
measurcmd_display_measures(prnt, statsptr, sizeof(statsptr)/sizeof(telnet_ltemeasurdef_t));
}
}
} /* measurcmd_display_macstats_ue */
void measurcmd_display_macstats(telnet_printfunc_t prnt) {
for (int CC_id=0 ; CC_id < MAX_NUM_CCs; CC_id++) {
eNB_STATS *macstatptr=&(RC.mac[eNB_id]->eNB_stats[CC_id]);
telnet_ltemeasurdef_t statsptr[]=LTEMAC_MEASURE;
prnt("%s eNB %i mac stats CC %i frame %u %s\n",
HDR, eNB_id, CC_id, RC.mac[eNB_id]->frame,HDR);
measurcmd_display_measures(prnt,statsptr,sizeof(statsptr)/sizeof(telnet_ltemeasurdef_t));
}
} /* measurcmd_display_macstats */
void measurcmd_display_one_rlcstat(telnet_printfunc_t prnt, int UE_id, telnet_ltemeasurdef_t *statsptr, int num_rlcmeasure, unsigned int *rlcstats,
char *rbid_str, protocol_ctxt_t *ctxt, const srb_flag_t srb_flagP, const rb_id_t rb_idP)
{
int rlc_status = rlc_stat_req(ctxt,srb_flagP,rb_idP,
rlcstats, rlcstats+1, rlcstats+2, rlcstats+3, rlcstats+4, rlcstats+5,
rlcstats+6, rlcstats+7, rlcstats+8, rlcstats+9, rlcstats+10, rlcstats+11,
rlcstats+12, rlcstats+13, rlcstats+14, rlcstats+15, rlcstats+16, rlcstats+17,
rlcstats+18, rlcstats+19, rlcstats+20, rlcstats+21, rlcstats+22, rlcstats+23,
rlcstats+24, rlcstats+25, rlcstats+26, rlcstats+27);
if (rlc_status == RLC_OP_STATUS_OK) {
prnt("%s UE %i RLC %s mode %s %s\n",HDR,UE_id, rbid_str,
(rlcstats[0]==RLC_MODE_AM)? "AM": (rlcstats[0]==RLC_MODE_UM)?"UM":"NONE",HDR);
measurcmd_display_measures(prnt, statsptr, num_rlcmeasure);
}
} /* status measurcmd_rlc_stat_req */
void measurcmd_display_rlcstats(telnet_printfunc_t prnt) {
protocol_ctxt_t ctxt;
UE_list_t *UE_list = &(RC.mac[eNB_id]->UE_list);
telnet_ltemeasurdef_t statsptr[]=LTE_RLCMEASURE;
int num_rlcmeasure = sizeof(statsptr)/sizeof(telnet_ltemeasurdef_t );
unsigned int *rlcstats = malloc(num_rlcmeasure*sizeof(unsigned int));
eNB_MAC_INST *eNB = RC.mac[eNB_id];
for(int i=0; i <num_rlcmeasure ; i++) {
statsptr[i].vptr = rlcstats + i;
}
for (int UE_id=UE_list->head; UE_id>=0; UE_id=UE_list->next[UE_id]) {
#define NB_eNB_INST 1
PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt,eNB_id, ENB_FLAG_YES,UE_list->eNB_UE_stats[0][UE_id].crnti,
eNB->frame,eNB->subframe,eNB_id);
measurcmd_display_one_rlcstat(prnt, UE_id, statsptr, num_rlcmeasure, rlcstats, "DCCH", &ctxt, SRB_FLAG_YES, DCCH);
measurcmd_display_one_rlcstat(prnt, UE_id, statsptr, num_rlcmeasure, rlcstats, "DTCH", &ctxt, SRB_FLAG_NO, DTCH-2);
}
} /* measurcmd_display_macstats_ue */
......@@ -29,7 +29,7 @@
* \note
* \warning
*/
#define _GNU_SOURCE
#define _GNU_SOURCE
#include <string.h>
#include <pthread.h>
......@@ -39,104 +39,85 @@
#define TELNETSRV_PHYCMD_MAIN
#include "telnetsrv_phycmd.h"
char *prnbuff;
extern int dump_eNB_stats(PHY_VARS_eNB *eNB, char* buffer, int length);
void init_phytelnet(void)
{
prnbuff=malloc(get_phybsize() );
if (prnbuff == NULL)
{
fprintf(stderr,"Error %s on malloc in init_phytelnet()\n",strerror(errno));
}
}
extern int dump_eNB_stats(PHY_VARS_eNB *eNB, char *buffer, int length);
void display_uestatshead( telnet_printfunc_t prnt)
{
prnt("cc ue rnti Dmcs Umcs tao tau Dbr Dtb \n");
}
void init_phytelnet(void) {
prnbuff=malloc(get_phybsize() );
void dump_uestats(int debug, telnet_printfunc_t prnt, uint8_t prntflag)
{
if (prnbuff == NULL) {
fprintf(stderr,"Error %s on malloc in init_phytelnet()\n",strerror(errno));
}
}
int p;
void display_uestatshead( telnet_printfunc_t prnt) {
prnt("cc ue rnti Dmcs Umcs tao tau Dbr Dtb \n");
}
p=dump_eNB_l2_stats( prnbuff, 0);
if(prntflag>=1)
prnt("%s\n",prnbuff);
if(debug>=1)
prnt("%i bytes printed\n",p);
void dump_uestats(int debug, telnet_printfunc_t prnt, uint8_t prntflag) {
int p;
p=dump_eNB_l2_stats( prnbuff, 0);
if(prntflag>=1)
prnt("%s\n",prnbuff);
if(debug>=1)
prnt("%i bytes printed\n",p);
}
void display_uestats(int debug, telnet_printfunc_t prnt, int ue)
{
for (int cc=0; cc<1 ; cc++)
{
}
void display_uestats(int debug, telnet_printfunc_t prnt, int ue) {
for (int cc=0; cc<1 ; cc++) {
}
}
void display_phycounters(char *buf, int debug, telnet_printfunc_t prnt)
{
prnt(" DLSCH kb DLSCH kb/s\n");
dump_uestats(debug, prnt,0);
void display_phycounters(char *buf, int debug, telnet_printfunc_t prnt) {
prnt(" DLSCH kb DLSCH kb/s\n");
dump_uestats(debug, prnt,0);
}
int dump_phyvars(char *buf, int debug, telnet_printfunc_t prnt)
{
if (debug > 0)
prnt("phy interface module received %s\n",buf);
if (strcasestr(buf,"phycnt") != NULL)
{
display_phycounters(buf, debug, prnt);
}
if (strcasestr(buf,"uestat") != NULL)
{
char *cptr=strcasestr(buf+sizeof("uestat"),"UE");
display_uestatshead(prnt);
if (cptr != NULL)
{
int ueidx = strtol( cptr+sizeof("UE"), NULL, 10);
if (ueidx < NUMBER_OF_UE_MAX && ueidx >= 0)
{
display_uestats(debug, prnt,ueidx);
}
} /* if cptr != NULL */
else
{
for (int ue=0; ue<NUMBER_OF_UE_MAX ; ue++)
{
display_uestats(debug, prnt,ue);
}
} /* else cptr != NULL */
} /* uestat */
if (strcasestr(buf,"uedump") != NULL)
{
dump_uestats(debug, prnt,1);
}
return 0;
int dump_phyvars(char *buf, int debug, telnet_printfunc_t prnt) {
if (debug > 0)
prnt("phy interface module received %s\n",buf);
if (strcasestr(buf,"phycnt") != NULL) {
display_phycounters(buf, debug, prnt);
}
if (strcasestr(buf,"uestat") != NULL) {
char *cptr=strcasestr(buf+sizeof("uestat"),"UE");
display_uestatshead(prnt);
if (cptr != NULL) {
int ueidx = strtol( cptr+sizeof("UE"), NULL, 10);
if (ueidx < NUMBER_OF_UE_MAX && ueidx >= 0) {
display_uestats(debug, prnt,ueidx);
}
} /* if cptr != NULL */
else {
for (int ue=0; ue<NUMBER_OF_UE_MAX ; ue++) {
display_uestats(debug, prnt,ue);
}
} /* else cptr != NULL */
} /* uestat */
if (strcasestr(buf,"uedump") != NULL) {
dump_uestats(debug, prnt,1);
}
return 0;
}
telnetshell_cmddef_t phy_cmdarray[] = {
{"disp","[phycnt,uedump,uestat UE<x>]", dump_phyvars},
{"disp","[phycnt,uedump,uestat UE<x>]", dump_phyvars},
{"","",NULL},
{"","",NULL},
};
/*-------------------------------------------------------------------------------------*/
void add_phy_cmds(void)
{
init_phytelnet();
add_telnetcmd("phy", phy_vardef, phy_cmdarray);
void add_phy_cmds(void) {
init_phytelnet();
add_telnetcmd("phy", phy_vardef, phy_cmdarray);
}
......@@ -20,9 +20,9 @@
*/
/*! \file common/utils/telnetsrv/telnetsrv_measurements.c
* \brief: implementation of telnet commands related to measurments
* \brief: implementation of telnet measurement functions common to all softmodems
* \author Francois TABURET
* \date 2019
* \date 2020
* \version 0.1
* \company NOKIA BellLabs France
* \email: francois.taburet@nokia-bell-labs.com
......@@ -47,40 +47,18 @@
#include "common/utils/LOG/log.h"
#include "common/config/config_userapi.h"
#include "telnetsrv_measurements.h"
#include "telnetsrv_ltemeasur_def.h"
#include "telnetsrv_cpumeasur_def.h"
#include "openair2/LAYER2/MAC/mac.h"
#include "openair1/PHY/phy_extern.h"
void measurcmd_display_macstats(telnet_printfunc_t prnt);
void measurcmd_display_macstats_ue(telnet_printfunc_t prnt);
void measurcmd_display_rlcstats(telnet_printfunc_t prnt);
void measurcmd_display_phycpu(telnet_printfunc_t prnt);
void measurcmd_display_maccpu(telnet_printfunc_t prnt);
void measurcmd_display_pdcpcpu(telnet_printfunc_t prnt);
static telnet_measurgroupdef_t measurgroups[] = {
{"enb", GROUP_LTESTATS,0, measurcmd_display_macstats, {NULL}},
{"enbues",GROUP_LTESTATS,0, measurcmd_display_macstats_ue,{NULL}},
{"rlc", GROUP_LTESTATS,0, measurcmd_display_rlcstats, {NULL}},
{"phycpu",GROUP_CPUSTATS,0, measurcmd_display_phycpu, {NULL}},
{"maccpu",GROUP_CPUSTATS,0, measurcmd_display_maccpu, {NULL}},
{"pdcpcpu",GROUP_CPUSTATS,0, measurcmd_display_pdcpcpu, {NULL}},
};
#define TELNET_NUM_MEASURGROUPS (sizeof(measurgroups)/sizeof(telnet_measurgroupdef_t))
static int eNB_id =0;
static char *grouptypes[] = {"ltestats","cpustats"};
static double cpufreq;
#define TELNET_NUM_MEASURTYPES (sizeof(grouptypes)/sizeof(char *))
#define HDR "---------------------------------"
void measurcmd_display_groups(telnet_printfunc_t prnt) {
void measurcmd_display_groups(telnet_printfunc_t prnt,telnet_measurgroupdef_t *measurgroups,int groups_size) {
prnt(" %*s %10s %s\n",TELNET_MAXMEASURNAME_LEN-1,"name","type","nombre de mesures");
for(int i=0; i<TELNET_NUM_MEASURGROUPS; i++)
for(int i=0; i<groups_size; i++)
prnt("%02d %*s %10s %i\n",i,TELNET_MAXMEASURNAME_LEN-1,measurgroups[i].groupname,
grouptypes[measurgroups[i].type], measurgroups[i].size);
} /* measurcmd_display_groups */
......@@ -96,32 +74,9 @@ void measurcmd_display_cpumeasures(telnet_printfunc_t prnt, telnet_cpumeasurdef_
prnt("\n\n");
} /* measurcmd_display_measures */
#define PRINT_CPUMEAS_STATE ((cpumeas(CPUMEAS_GETSTATE))?"enabled":"disabled")
void measurcmd_display_phycpu(telnet_printfunc_t prnt) {
PHY_VARS_eNB *phyvars = RC.eNB[eNB_id][0];
telnet_cpumeasurdef_t cpumeasur[]=CPU_PHYENB_MEASURE;
prnt("%s cpu (%1.1g GHz) measurements: PHY (cpustats %s) %s\n",HDR,cpufreq,
PRINT_CPUMEAS_STATE,HDR);
measurcmd_display_cpumeasures(prnt, cpumeasur, sizeof(cpumeasur)/sizeof(telnet_cpumeasurdef_t));
}
void measurcmd_display_maccpu(telnet_printfunc_t prnt) {
eNB_MAC_INST *macvars = RC.mac[eNB_id];
telnet_cpumeasurdef_t cpumeasur[]=CPU_MACENB_MEASURE;
prnt("%s cpu (%1.1g GHz) measurements: MAC (cpustats %s) %s\n",HDR,cpufreq,
PRINT_CPUMEAS_STATE,HDR);
measurcmd_display_cpumeasures(prnt, cpumeasur, sizeof(cpumeasur)/sizeof(telnet_cpumeasurdef_t));
}
void measurcmd_display_pdcpcpu(telnet_printfunc_t prnt) {
pdcp_stats_t *pdcpvars = &(eNB_pdcp_stats[eNB_id]);
telnet_cpumeasurdef_t cpumeasur[]=CPU_PDCPENB_MEASURE;
prnt("%s cpu (%1.1g GHz) measurements: PDCP (cpustats %s) %s \n",HDR,cpufreq,
PRINT_CPUMEAS_STATE,HDR);
measurcmd_display_cpumeasures(prnt, cpumeasur, sizeof(cpumeasur)/sizeof(telnet_cpumeasurdef_t));
}
/*----------------------------------------------------------------------------------------------------*/
/* lte measurements functions */
/* cellular measurements functions */
uint64_t measurcmd_getstatvalue(telnet_ltemeasurdef_t *measur,telnet_printfunc_t prnt) {
uint64_t val;
......@@ -164,70 +119,7 @@ void measurcmd_display_measures(telnet_printfunc_t prnt, telnet_ltemeasurdef_t
prnt("\n\n");
} /* measurcmd_display_measures */
void measurcmd_display_macstats_ue(telnet_printfunc_t prnt) {
UE_list_t *UE_list = &(RC.mac[eNB_id]->UE_list);
for (int UE_id=UE_list->head; UE_id>=0; UE_id=UE_list->next[UE_id]) {
for (int i=0; i<UE_list->numactiveCCs[UE_id]; i++) {
int CC_id = UE_list->ordered_CCids[i][UE_id];
prnt("%s UE %i Id %i CCid %i %s\n",HDR,i,UE_id,CC_id,HDR);
eNB_UE_STATS *macuestatptr = &(UE_list->eNB_UE_stats[CC_id][UE_id]);
telnet_ltemeasurdef_t statsptr[]=LTEMAC_UEMEASURE;
measurcmd_display_measures(prnt, statsptr, sizeof(statsptr)/sizeof(telnet_ltemeasurdef_t));
}
}
} /* measurcmd_display_macstats_ue */
void measurcmd_display_macstats(telnet_printfunc_t prnt) {
for (int CC_id=0 ; CC_id < MAX_NUM_CCs; CC_id++) {
eNB_STATS *macstatptr=&(RC.mac[eNB_id]->eNB_stats[CC_id]);
telnet_ltemeasurdef_t statsptr[]=LTEMAC_MEASURE;
prnt("%s eNB %i mac stats CC %i frame %u %s\n",
HDR, eNB_id, CC_id, RC.mac[eNB_id]->frame,HDR);
measurcmd_display_measures(prnt,statsptr,sizeof(statsptr)/sizeof(telnet_ltemeasurdef_t));
}
} /* measurcmd_display_macstats */
void measurcmd_display_one_rlcstat(telnet_printfunc_t prnt, int UE_id, telnet_ltemeasurdef_t *statsptr, int num_rlcmeasure, unsigned int *rlcstats,
char *rbid_str, protocol_ctxt_t *ctxt, const srb_flag_t srb_flagP, const rb_id_t rb_idP)
{
int rlc_status = rlc_stat_req(ctxt,srb_flagP,rb_idP,
rlcstats, rlcstats+1, rlcstats+2, rlcstats+3, rlcstats+4, rlcstats+5,
rlcstats+6, rlcstats+7, rlcstats+8, rlcstats+9, rlcstats+10, rlcstats+11,
rlcstats+12, rlcstats+13, rlcstats+14, rlcstats+15, rlcstats+16, rlcstats+17,
rlcstats+18, rlcstats+19, rlcstats+20, rlcstats+21, rlcstats+22, rlcstats+23,
rlcstats+24, rlcstats+25, rlcstats+26, rlcstats+27);
if (rlc_status == RLC_OP_STATUS_OK) {
prnt("%s UE %i RLC %s mode %s %s\n",HDR,UE_id, rbid_str,
(rlcstats[0]==RLC_MODE_AM)? "AM": (rlcstats[0]==RLC_MODE_UM)?"UM":"NONE",HDR);
measurcmd_display_measures(prnt, statsptr, num_rlcmeasure);
}
} /* status measurcmd_rlc_stat_req */
void measurcmd_display_rlcstats(telnet_printfunc_t prnt) {
protocol_ctxt_t ctxt;
UE_list_t *UE_list = &(RC.mac[eNB_id]->UE_list);
telnet_ltemeasurdef_t statsptr[]=LTE_RLCMEASURE;
int num_rlcmeasure = sizeof(statsptr)/sizeof(telnet_ltemeasurdef_t );
unsigned int *rlcstats = malloc(num_rlcmeasure*sizeof(unsigned int));
eNB_MAC_INST *eNB = RC.mac[eNB_id];
for(int i=0; i <num_rlcmeasure ; i++) {
statsptr[i].vptr = rlcstats + i;
}
for (int UE_id=UE_list->head; UE_id>=0; UE_id=UE_list->next[UE_id]) {
#define NB_eNB_INST 1
PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt,eNB_id, ENB_FLAG_YES,UE_list->eNB_UE_stats[0][UE_id].crnti,
eNB->frame,eNB->subframe,eNB_id);
measurcmd_display_one_rlcstat(prnt, UE_id, statsptr, num_rlcmeasure, rlcstats, "DCCH", &ctxt, SRB_FLAG_YES, DCCH);
measurcmd_display_one_rlcstat(prnt, UE_id, statsptr, num_rlcmeasure, rlcstats, "DTCH", &ctxt, SRB_FLAG_NO, DTCH-2);
}
} /* measurcmd_display_macstats_ue */
/*------------------------------------------------------------------------------------------------------------------------*/
/* function called by the telnet server when measur command is entered */
......@@ -238,20 +130,24 @@ int measurcmd_show(char *buf, int debug, telnet_printfunc_t prnt) {
if (debug > 0)
prnt(" measurcmd_show received %s\n",buf);
// char tmp[20480];
// dump_eNB_l2_stats(tmp, 0);
// prnt("%s\n",tmp);
int (*fptr)(telnet_measurgroupdef_t **) = dlsym(RTLD_DEFAULT,"get_measurgroups");
if ( fptr == NULL) {
prnt("No measures available for this softmodem\n");
return 0;
}
telnet_measurgroupdef_t *measurgroups;
int num_measurgroups = fptr( &measurgroups);
int s = sscanf(buf,"%ms %i-%i\n",&subcmd, &idx1,&idx2);
if (s>0) {
if ( strcmp(subcmd,"groups") == 0) {
measurcmd_display_groups(prnt);
measurcmd_display_groups(prnt,measurgroups,num_measurgroups);
badcmd=0;
} else {
for (int i=0; i<TELNET_NUM_MEASURTYPES; i++) {
if(strcmp(subcmd,grouptypes[i]) == 0) {
for(int j=0; j<TELNET_NUM_MEASURGROUPS; j++) {
for(int j=0; j<num_measurgroups; j++) {
if(i == measurgroups[j].type) {
badcmd=0;
measurgroups[j].displayfunc(prnt);
......@@ -260,7 +156,7 @@ int measurcmd_show(char *buf, int debug, telnet_printfunc_t prnt) {
}
}/* for i...*/
for (int i=0; i<TELNET_NUM_MEASURGROUPS; i++) {
for (int i=0; i<num_measurgroups; i++) {
if(strcmp(subcmd,measurgroups[i].groupname) == 0) {
measurgroups[i].displayfunc(prnt);
badcmd=0;
......
......@@ -34,16 +34,13 @@
#include <dlfcn.h>
#include "telnetsrv.h"
#include "openair1/PHY/defs_eNB.h"
#ifdef TELNETSRV_MEASURMENTS_MAIN
#define TELNET_MAXMEASURNAME_LEN 30
#define TELNET_MAXMEASURGROUPS 10
telnetshell_vardef_t measur_vardef[] = {
{"",0,NULL}
};
#define PRINT_CPUMEAS_STATE ((cpumeas(CPUMEAS_GETSTATE))?"enabled":"disabled")
typedef struct cpumeasurdef {
char statname[TELNET_MAXMEASURNAME_LEN];
time_stats_t *astatptr;
......@@ -75,6 +72,7 @@ typedef struct mesurgroupdef {
#define LTEMAC_MEASURGROUP_NAME "ltemac"
#define PHYCPU_MEASURGROUP_NAME "phycpu"
#ifdef TELNETSRV_MEASURMENTS_MAIN
int measurcmd_show(char *buf, int debug, telnet_printfunc_t prnt);
int measurcmd_cpustats(char *buf, int debug, telnet_printfunc_t prnt);
telnetshell_cmddef_t measur_cmdarray[] = {
......@@ -83,6 +81,19 @@ telnetshell_cmddef_t measur_cmdarray[] = {
{"","",NULL}
};
telnetshell_vardef_t measur_vardef[] = {
{"",0,NULL}
};
/* function to be implemented in any telnetsrv_xxx_measurements.c sources
to allow common measurment code to access measurments data */
extern int get_measurgroups(telnet_measurgroupdef_t **measurgroups);
/* */
#else
extern void add_measur_cmds(void);
extern void add_measur_cmds(void);
extern void measurcmd_display_groups(telnet_printfunc_t prnt,telnet_measurgroupdef_t *measurgroups,int groups_size);
extern void measurcmd_display_cpumeasures(telnet_printfunc_t prnt, telnet_cpumeasurdef_t *cpumeasure, int cpumeasure_size) ;
extern uint64_t measurcmd_getstatvalue(telnet_ltemeasurdef_t *measur,telnet_printfunc_t prnt);
extern void measurcmd_display_measures(telnet_printfunc_t prnt, telnet_ltemeasurdef_t *statsptr, int stats_size);
#endif /* TELNETSRV_MEASURCMD_MAIN */
......@@ -960,7 +960,7 @@ void RCconfig_RU(void) {
static void get_options(void) {
CONFIG_SETRTFLAG(CONFIG_NOEXITONHELP);
get_common_options();
get_common_options(SOFTMODEM_ENB_BIT);
CONFIG_CLEARRTFLAG(CONFIG_NOEXITONHELP);
if ( !(CONFIG_ISFLAGSET(CONFIG_ABORT)) ) {
......
......@@ -93,10 +93,8 @@
// extern openair0_device openair0;
#if defined(ENABLE_ITTI)
extern volatile int start_gNB;
extern volatile int start_UE;
#endif
extern volatile int start_gNB;
extern volatile int start_UE;
extern volatile int oai_exit;
extern openair0_config_t openair0_cfg[MAX_CARDS];
......@@ -360,7 +358,7 @@ static void *gNB_L1_thread( void *param ) {
}
#if 0 //defined(ENABLE_ITTI) && defined(ENABLE_USE_MME)
#if 0
// Wait for gNB application initialization to be complete (gNB registration to MME)
static void wait_system_ready (char *message, volatile int *start_flag) {
static char *indicator[] = {". ", ".. ", "... ", ".... ", ".....",
......
......@@ -142,9 +142,7 @@ extern int sync_var;
extern int transmission_mode;
extern double cpuf;
#if defined(ENABLE_ITTI)
extern volatile int start_eNB;
extern volatile int start_UE;
#endif
extern volatile int start_eNB;
extern volatile int start_UE;
#endif
......@@ -71,9 +71,7 @@ unsigned short config_frames[4] = {2,9,11,13};
#include "UTIL/OTG/otg_vars.h"
#endif
#if defined(ENABLE_ITTI)
#include "intertask_interface.h"
#endif
#include "intertask_interface.h"
#include "PHY/INIT/phy_init.h"
......@@ -101,9 +99,7 @@ pthread_mutex_t sync_mutex;
int sync_var=-1; //!< protected by mutex \ref sync_mutex.
int config_sync_var=-1;
#if defined(ENABLE_ITTI)
volatile int start_gNB = 0;
#endif
volatile int start_gNB = 0;
volatile int oai_exit = 0;
static int wait_for_sync = 0;
......@@ -119,9 +115,7 @@ int32_t uplink_frequency_offset[MAX_NUM_CCs][4];
//Temp fix for inexistent NR upper layer
unsigned char NB_gNB_INST = 1;
#if defined(ENABLE_ITTI)
static char *itti_dump_file = NULL;
#endif
static char *itti_dump_file = NULL;
int UE_scan = 1;
int UE_scan_carrier = 0;
......@@ -306,7 +300,7 @@ void exit_function(const char *file, const char *function, const int line, const
exit(1);
}
#if defined(ENABLE_ITTI)
void *l2l1_task(void *arg) {
MessageDef *message_p = NULL;
int result;
......@@ -379,7 +373,6 @@ void *l2l1_task(void *arg) {
*/
return NULL;
}
#endif
int create_gNB_tasks(uint32_t gnb_nb) {
LOG_D(GNB_APP, "%s(gnb_nb:%d)\n", __FUNCTION__, gnb_nb);
......@@ -642,7 +635,6 @@ void wait_gNBs(void) {
printf("gNB L1 are configured\n");
}
#if defined(ENABLE_ITTI)
/*
* helper function to terminate a certain ITTI task
*/
......@@ -756,7 +748,6 @@ int restart_L1L2(module_id_t gnb_id) {
pthread_mutex_unlock(&sync_mutex);
return 0;
}
#endif
static void wait_nfapi_init(char *thread_name) {
printf( "waiting for NFAPI PNF connection and population of global structure (%s)\n",thread_name);
......@@ -814,7 +805,7 @@ int main( int argc, char **argv )
configure_linux();
printf("Reading in command-line options\n");
get_options ();
get_common_options();
get_common_options(SOFTMODEM_GNB_BIT );
if (CONFIG_ISFLAGSET(CONFIG_ABORT) ) {
fprintf(stderr,"Getting configuration failed\n");
......@@ -835,16 +826,16 @@ int main( int argc, char **argv )
}
cpuf=get_cpu_freq_GHz();
#if defined(ENABLE_ITTI)
itti_init(TASK_MAX, THREAD_MAX, MESSAGES_ID_MAX, tasks_info, messages_info);
// initialize mscgen log after ITTI
MSC_INIT(MSC_E_UTRAN, THREAD_MAX+TASK_MAX);
#endif
init_opt();
#ifdef PDCP_USE_NETLINK
if(!IS_SOFTMODEM_NOS1)
netlink_init();
#if defined(PDCP_USE_NETLINK_QUEUES)
pdcp_netlink_init();
......@@ -859,8 +850,6 @@ int main( int argc, char **argv )
if(IS_SOFTMODEM_NOS1)
init_pdcp();
#if defined(ENABLE_ITTI)
if (RC.nb_nr_inst > 0) {
// don't create if node doesn't connect to RRC/S1/GTP
AssertFatal(create_gNB_tasks(1) == 0,"cannot create ITTI tasks\n");
......@@ -869,7 +858,6 @@ int main( int argc, char **argv )
RCconfig_L1();
}
#endif
/* Start the agent. If it is turned off in the configuration, it won't start */
RCconfig_nr_flexran();
......@@ -1004,19 +992,12 @@ int main( int argc, char **argv )
// wait for end of program
printf("TYPE <CTRL-C> TO TERMINATE\n");
//getchar();
#if defined(ENABLE_ITTI)
printf("Entering ITTI signals handler\n");
itti_wait_tasks_end();
printf("Returned from ITTI signal handler\n");
oai_exit=1;
printf("oai_exit=%d\n",oai_exit);
#else
while (oai_exit==0)
sleep(1);
printf("Terminating application - oai_exit=%d\n",oai_exit);
#endif
// stop threads
/*#ifdef XFORMS
......
......@@ -416,15 +416,14 @@ void processSlotRX( PHY_VARS_NR_UE *UE, UE_nr_rxtx_proc_t *proc) {
LOG_D(PHY,"phy_procedures_nrUE_RX: slot:%d, time %lu\n", proc->nr_tti_rx, (rdtsc()-a)/3500);
//printf(">>> nr_ue_pdcch_procedures ended\n");
#endif
if(IS_SOFTMODEM_NOS1) { //&& proc->nr_tti_rx==1
//Hardcoded rnti value
protocol_ctxt_t ctxt;
PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, UE->Mod_id, ENB_FLAG_NO,
0x1234, proc->frame_rx,
proc->nr_tti_rx, 0);
pdcp_run(&ctxt);
pdcp_fifo_flush_sdus(&ctxt);
}
if(IS_SOFTMODEM_NOS1){ //&& proc->nr_tti_rx==1
//Hardcoded rnti value
protocol_ctxt_t ctxt;
PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, UE->Mod_id, ENB_FLAG_NO,
0x1234, proc->frame_rx,
proc->nr_tti_rx, 0);
pdcp_run(&ctxt);
}
}
// no UL for now
......
......@@ -135,6 +135,7 @@ int threequarter_fs=0;
uint32_t downlink_frequency[MAX_NUM_CCs][4];
int32_t uplink_frequency_offset[MAX_NUM_CCs][4];
//int32_t uplink_counter = 0;
extern int16_t nr_dlsch_demod_shift;
......@@ -332,8 +333,6 @@ void init_scope(void) {
}
#if defined(ENABLE_ITTI)
void *l2l1_task(void *arg) {
MessageDef *message_p = NULL;
int result;
......@@ -373,7 +372,7 @@ void *l2l1_task(void *arg) {
return NULL;
}
#endif
int16_t dlsch_demod_shift;
......@@ -655,7 +654,7 @@ int main( int argc, char **argv ) {
logInit();
// get options and fill parameters from configuration file
get_options (); //Command-line options, enb_properties
get_common_options();
get_common_options(SOFTMODEM_5GUE_BIT );
#if T_TRACER
T_Config_Init();
#endif
......
......@@ -37,6 +37,7 @@
#include "common/utils/load_module_shlib.h"
#include "common/utils/telnetsrv/telnetsrv.h"
#include "executables/thread-common.h"
#include "common/utils/LOG/log.h"
#include "softmodem-common.h"
static softmodem_params_t softmodem_params;
......@@ -44,7 +45,7 @@ char *parallel_config=NULL;
char *worker_config=NULL;
static mapping softmodem_funcs[] = MAPPING_SOFTMODEM_FUNCTIONS;
static struct timespec start;
uint64_t get_softmodem_optmask(void) {
......@@ -60,16 +61,36 @@ softmodem_params_t *get_softmodem_params(void) {
return &softmodem_params;
}
void get_common_options(void) {
int32_t check_execmask(uint64_t execmask) {
char *softmodemfunc=map_int_to_str(softmodem_funcs, execmask);
if (softmodemfunc != NULL) {
set_softmodem_optmask(execmask);
return 0;
}
return -1;
}
char *get_softmodem_function(uint64_t *sofmodemfunc_mask_ptr) {
uint64_t fmask=(get_softmodem_optmask()&SOFTMODEM_FUNC_BITS);
char *softmodemfunc=map_int_to_str(softmodem_funcs, fmask);
if (sofmodemfunc_mask_ptr != NULL)
*sofmodemfunc_mask_ptr=fmask;
if (softmodemfunc != NULL) {
return softmodemfunc;
}
return "???";
}
void get_common_options(uint32_t execmask) {
uint32_t online_log_messages=0;
uint32_t glog_level =0;
uint32_t start_telnetsrv=0;
uint32_t glog_level=0 ;
uint32_t start_telnetsrv = 0;
uint32_t noS1 = 0, nokrnmod = 0, nonbiot = 0;
uint32_t rfsim = 0, basicsim = 0, do_forms = 0;
char *logmem_filename = NULL;
paramdef_t cmdline_params[] =CMDLINE_PARAMS_DESC ;
paramdef_t cmdline_logparams[] =CMDLINE_LOGPARAMS_DESC ;
checkedparam_t cmdline_log_CheckParams[] = CMDLINE_LOGPARAMS_CHECK_DESC;
check_execmask(execmask);
config_get( cmdline_params,sizeof(cmdline_params)/sizeof(paramdef_t),NULL);
config_set_checkfunctions(cmdline_logparams, cmdline_log_CheckParams,
sizeof(cmdline_logparams)/sizeof(paramdef_t));
......
......@@ -31,6 +31,7 @@
*/
#ifndef SOFTMODEM_COMMON_H
#define SOFTMODEM_COMMON_H
#include "openair1/PHY/defs_common.h"
#ifdef __cplusplus
extern "C"
{
......@@ -173,6 +174,14 @@ extern "C"
#define SOFTMODEM_BASICSIM_BIT (1<<11)
#define SOFTMODEM_SIML1_BIT (1<<12)
#define SOFTMODEM_DOFORMS_BIT (1<<15)
#define SOFTMODEM_RECPLAY_BIT (1<<16)
#define SOFTMODEM_ENB_BIT (1<<20)
#define SOFTMODEM_GNB_BIT (1<<21)
#define SOFTMODEM_4GUE_BIT (1<<22)
#define SOFTMODEM_5GUE_BIT (1<<23)
#define SOFTMODEM_FUNC_BITS (SOFTMODEM_ENB_BIT | SOFTMODEM_GNB_BIT | SOFTMODEM_5GUE_BIT | SOFTMODEM_4GUE_BIT)
#define MAPPING_SOFTMODEM_FUNCTIONS {{"enb",SOFTMODEM_ENB_BIT},{"gnb",SOFTMODEM_GNB_BIT},{"4Gue",SOFTMODEM_4GUE_BIT},{"5Gue",SOFTMODEM_5GUE_BIT}}
#define IS_SOFTMODEM_NOS1 ( get_softmodem_optmask() & SOFTMODEM_NOS1_BIT)
#define IS_SOFTMODEM_NOKRNMOD ( get_softmodem_optmask() & SOFTMODEM_NOKRNMOD_BIT)
......@@ -181,7 +190,11 @@ extern "C"
#define IS_SOFTMODEM_BASICSIM ( get_softmodem_optmask() & SOFTMODEM_BASICSIM_BIT)
#define IS_SOFTMODEM_SIML1 ( get_softmodem_optmask() & SOFTMODEM_SIML1_BIT)
#define IS_SOFTMODEM_DOFORMS ( get_softmodem_optmask() & SOFTMODEM_DOFORMS_BIT)
#define IS_SOFTMODEM_IQPLAYER ( get_softmodem_optmask() & SOFTMODEM_RECPLAY_BIT)
#define IS_SOFTMODEM_ENB_BIT ( get_softmodem_optmask() & SOFTMODEM_ENB_BIT)
#define IS_SOFTMODEM_GNB_BIT ( get_softmodem_optmask() & SOFTMODEM_GNB_BIT)
#define IS_SOFTMODEM_4GUE_BIT ( get_softmodem_optmask() & SOFTMODEM_4GUE_BIT)
#define IS_SOFTMODEM_5GUE_BIT ( get_softmodem_optmask() & SOFTMODEM_5GUE_BIT)
typedef struct {
uint64_t optmask;
......@@ -206,7 +219,8 @@ typedef struct {
extern uint64_t get_softmodem_optmask(void);
extern uint64_t set_softmodem_optmask(uint64_t bitmask);
extern softmodem_params_t *get_softmodem_params(void);
extern void get_common_options(void);
extern void get_common_options(uint32_t execmask);
extern char *get_softmodem_function(uint64_t *sofmodemfunc_mask_ptr);
#define SOFTMODEM_RTSIGNAL (SIGRTMIN+1)
extern void set_softmodem_sighandler(void);
extern uint32_t downlink_frequency[MAX_NUM_CCs][4];
......
......@@ -39,7 +39,7 @@ nfapi_pnf_config_t* nfapi_pnf_config_create()
_this->_public.codec_config.allocate = &malloc;
_this->_public.codec_config.deallocate = &free;
return &(_this->_public);
return (nfapi_pnf_config_t* )_this;
}
void nfapi_pnf_config_destory(nfapi_pnf_config_t* config)
......
......@@ -55,7 +55,7 @@ nfapi_vnf_config_t* nfapi_vnf_config_create()
_this->_public.codec_config.deallocate = &free;
return &(_this->_public);
return (nfapi_vnf_config_t* )_this;
}
void nfapi_vnf_config_destory(nfapi_vnf_config_t* config)
......
......@@ -47,7 +47,7 @@ nfapi_vnf_p7_config_t* nfapi_vnf_p7_config_create()
_this->_public.codec_config.deallocate = &free;
return &(_this->_public);
return (nfapi_vnf_p7_config_t*)_this;
}
void nfapi_vnf_p7_config_destory(nfapi_vnf_p7_config_t* config)
......
......@@ -525,7 +525,7 @@ int main(int argc, char *argv[])
time_stats_t time_optim[10], time_decoder[10];
n_iter_stats_t dec_iter[3];
short BG=0,Zc,Kb;
short BG=0,Zc,Kb=0;
while ((c = getopt (argc, argv, "q:r:s:S:l:n:d:i:t:u:h")) != -1)
switch (c)
......
......@@ -36,7 +36,7 @@
#include "common/utils/LOG/log.h"
#include "common/utils/LOG/vcd_signal_dumper.h"
#include "executables/softmodem-common.h"
//uint8_t ncs_cell[20][7];
//#define DEBUG_PUCCH_TXS
......@@ -801,9 +801,8 @@ uint32_t rx_pucch(PHY_VARS_eNB *eNB,
for (j=0; j<NUMBER_OF_UE_MAX; j++) {
eNB->pucch1_stats_cnt[j][i]=0;
eNB->pucch1ab_stats_cnt[j][i]=0;
#if defined(USRP_REC_PLAY) // not 100% sure
eNB->pucch1_stats_thres[j][i]=0;
#endif
if ( IS_SOFTMODEM_IQPLAYER)
eNB->pucch1_stats_thres[j][i]=0;
}
}
......@@ -1193,15 +1192,13 @@ uint32_t rx_pucch(PHY_VARS_eNB *eNB,
stat_re=0;
stat_im=0;
// Do detection now
#if defined(USRP_REC_PLAY)
// It looks like the value is a bit messy when RF is replayed.
// It looks like the pucch1_thres value is a bit messy when RF is replayed.
// For instance i assume to skip pucch1_thres from the test below.
// Not 100% sure
if (sigma2_dB<(dB_fixed(stat_max))) {//
#else
if (sigma2_dB<(dB_fixed(stat_max)-pucch1_thres)) {//
#endif
if (sigma2_dB<(dB_fixed(stat_max) - (IS_SOFTMODEM_IQPLAYER?0:pucch1_thres)) ) {//
chL = (nsymb>>1)-4;
chest_mag=0;
cfo = (frame_parms->Ncp==0) ? &cfo_pucch_np[14*phase_max] : &cfo_pucch_ep[12*phase_max];
......@@ -1339,11 +1336,7 @@ uint32_t rx_pucch(PHY_VARS_eNB *eNB,
if (fmt==pucch_format1b)
*(1+payload) = (stat_im<0) ? 1 : 2;
} else { // insufficient energy on PUCCH so NAK
#if defined(USRP_REC_PLAY)
LOG_D(PHY,"PUCCH 1a/b: NAK subframe %d : sigma2_dB %d, stat_max %d, pucch1_thres %d\n",subframe,sigma2_dB,dB_fixed(stat_max),pucch1_thres);
#else
LOG_D(PHY,"In pucch.c PUCCH 1a/b: NAK subframe %d : sigma2_dB %d, stat_max %d, pucch1_thres %d\n",subframe,sigma2_dB,dB_fixed(stat_max),pucch1_thres);
#endif
*payload = 4; // DTX
((int16_t *)&eNB->pucch1ab_stats[UE_id][(subframe<<10) + (eNB->pucch1ab_stats_cnt[UE_id][subframe])])[0] = (int16_t)(stat_re);
((int16_t *)&eNB->pucch1ab_stats[UE_id][(subframe<<10) + (eNB->pucch1ab_stats_cnt[UE_id][subframe])])[1] = (int16_t)(stat_im);
......
......@@ -711,6 +711,15 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB,
}
#ifdef DEBUG_ULSCH_DECODING
LOG_I(PHY, "Decoder output (payload): \n");
for (i = 0; i < harq_process->TBS / 8; i++) {
//harq_process_ul_ue->a[i] = (unsigned char) rand();
//printf("a[%d]=0x%02x\n",i,harq_process_ul_ue->a[i]);
printf("0x%02x",harq_process->b[i]);
}
#endif
ulsch->last_iteration_cnt = ret;
return(ret);
......
......@@ -1078,6 +1078,7 @@ void nr_pusch_codeword_scrambling(uint8_t *in,
void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
unsigned char harq_pid,
uint8_t frame,
uint8_t slot,
uint8_t thread_id,
int gNB_id);
......
......@@ -41,9 +41,15 @@
#include "PHY/NR_TRANSPORT/nr_sch_dmrs.h"
#include "PHY/defs_nr_common.h"
#include "PHY/TOOLS/tools_defs.h"
#include "executables/nr-softmodem.h"
#include "executables/softmodem-common.h"
#include "LAYER2/NR_MAC_UE/mac_proto.h"
//#define DEBUG_SCFDMA
//#define DEBUG_PUSCH_MAPPING
//#define DEBUG_MAC_PDU
//extern int32_t uplink_counter;
void nr_pusch_codeword_scrambling(uint8_t *in,
uint32_t size,
......@@ -86,6 +92,7 @@ void nr_pusch_codeword_scrambling(uint8_t *in,
void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
unsigned char harq_pid,
uint8_t frame,
uint8_t slot,
uint8_t thread_id,
int gNB_id) {
......@@ -104,11 +111,13 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
int ap, start_symbol, Nid_cell, i;
int sample_offsetF, N_RE_prime, N_PRB_oh;
uint16_t n_rnti;
uint8_t data_existing =0;
NR_UE_ULSCH_t *ulsch_ue;
NR_UL_UE_HARQ_t *harq_process_ul_ue;
NR_DL_FRAME_PARMS *frame_parms = &UE->frame_parms;
NR_UE_PUSCH *pusch_ue = UE->pusch_vars[thread_id][gNB_id];
uint8_t ulsch_input_buffer[MAX_ULSCH_PAYLOAD_BYTES];
num_of_codewords = 1; // tmp assumption
n_rnti = 0x1234;
......@@ -157,14 +166,54 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
0,
harq_process_ul_ue->Nl);
uint8_t access_mode = SCHEDULED_ACCESS;
//-----------------------------------------------------//
// to be removed later when MAC is ready
if (harq_process_ul_ue != NULL){
for (i = 0; i < harq_process_ul_ue->TBS / 8; i++) {
harq_process_ul_ue->a[i] = (unsigned char) rand();
//printf("input encoder a[%d]=0x%02x\n",i,harq_process_ul_ue->a[i]);
}
if (IS_SOFTMODEM_NOS1){
data_existing = nr_ue_get_sdu(UE->Mod_id, UE->CC_id, frame,
slot, 0, ulsch_input_buffer, harq_process_ul_ue->TBS/8, &access_mode);
//IP traffic to be transmitted
if(data_existing){
//harq_process_ul_ue->a = (unsigned char*)calloc(harq_process_ul_ue->TBS/8, sizeof(unsigned char));
memcpy(harq_process_ul_ue->a, ulsch_input_buffer, harq_process_ul_ue->TBS/8);
#ifdef DEBUG_MAC_PDU
LOG_I(PHY, "Printing MAC PDU to be encoded, TBS is: %d \n", harq_process_ul_ue->TBS/8);
for (i = 0; i < harq_process_ul_ue->TBS / 8; i++) {
printf("0x%02x",harq_process_ul_ue->a[i]);
}
printf("\n");
#endif
}
//Random traffic to be transmitted if there is no IP traffic available for this Tx opportunity
else{
//Use zeros for the header bytes in noS1 mode, in order to make sure that the LCID is not valid
//and block this traffic from being forwarded to the upper layers at the gNB
uint16_t payload_offset = 5;
LOG_D(PHY, "Random data to be tranmsitted: \n");
//Give the header bytes some dummy value in order to block the random packet at the MAC layer of the receiver
for (i = 0; i<payload_offset; i++)
harq_process_ul_ue->a[i] = 0;
for (i = payload_offset; i < harq_process_ul_ue->TBS / 8; i++) {
harq_process_ul_ue->a[i] = (unsigned char) rand();
//printf(" input encoder a[%d]=0x%02x\n",i,harq_process_ul_ue->a[i]);
}
}
}
//else if(uplink_counter == 0){ //if(!IS_SOFTMODEM_NOS1){
else{
LOG_D(PHY, "Random data to be tranmsitted: \n");
for (i = 0; i < harq_process_ul_ue->TBS / 8; i++) {
harq_process_ul_ue->a[i] = (unsigned char) rand();
//printf(" input encoder a[%d]=0x%02x\n",i,harq_process_ul_ue->a[i]);
}
//uplink_counter++;
}
} else {
LOG_E(PHY, "[phy_procedures_nrUE_TX] harq_process_ul_ue is NULL !!\n");
return;
......@@ -175,6 +224,7 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
/////////////////////////ULSCH coding/////////////////////////
///////////
nr_ulsch_encoding(ulsch_ue, frame_parms, harq_pid);
///////////
......@@ -219,6 +269,7 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
////////////////////////////////////////////////////////////////////////
//}
}
/////////////////////////DMRS Modulation/////////////////////////
......@@ -372,10 +423,12 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
}
}
//}
///////////
////////////////////////////////////////////////////////////////////////
return;
LOG_D(PHY, "Is data existing ?: %d \n", data_existing);
}
......@@ -406,6 +459,13 @@ uint8_t nr_ue_pusch_common_procedures(PHY_VARS_NR_UE *UE,
if (tx_offset < 0)
tx_offset += frame_parms->samples_per_frame;
// clear the transmit data array for the current subframe
/*for (int aa=0; aa<UE->frame_parms.nb_antennas_tx; aa++) {
memset(&UE->common_vars.txdata[aa][tx_offset],0,UE->frame_parms.samples_per_slot*sizeof(int32_t));
//memset(&UE->common_vars.txdataF[aa][tx_offset],0,UE->frame_parms.samples_per_slot*sizeof(int32_t));
}*/
txdata = UE->common_vars.txdata;
txdataF = UE->common_vars.txdataF;
......
......@@ -46,9 +46,7 @@
#include <time.h>
#if defined(ENABLE_ITTI)
#include "intertask_interface.h"
#endif
#include "intertask_interface.h"
extern int oai_nfapi_rach_ind(nfapi_rach_indication_t *rach_ind);
......
......@@ -47,4 +47,4 @@ void handle_nr_nfapi_dlsch_pdu(PHY_VARS_gNB *gNB,int frame,int slot,
void nr_fill_rx_indication(PHY_VARS_gNB *gNB, int frame, int slot_rx, int UE_id, uint8_t harq_pid);
void nr_fill_crc_indication(PHY_VARS_gNB *gNB, int frame, int slot_rx, int UE_id, uint8_t crc_flag);
\ No newline at end of file
void nr_fill_crc_indication(PHY_VARS_gNB *gNB, int frame, int slot_rx, int UE_id, uint8_t crc_flag);
......@@ -39,15 +39,15 @@
#include "PHY/INIT/phy_init.h"
#include "PHY/MODULATION/nr_modulation.h"
#include "T.h"
#include "executables/nr-softmodem.h"
#include "executables/softmodem-common.h"
#include "assertions.h"
#include "msc.h"
#include <time.h>
#if defined(ENABLE_ITTI)
#include "intertask_interface.h"
#endif
#include "intertask_interface.h"
extern uint8_t nfapi_mode;
/*
......@@ -285,8 +285,14 @@ void nr_ulsch_procedures(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx, int UE_id
if (ret > gNB->ulsch[UE_id][0]->max_ldpc_iterations)
LOG_I(PHY, "ULSCH in error\n");
else
LOG_I(PHY, "ULSCH received ok\n");
//gNB->ulsch[UE_id+1][0]->harq_processes[harq_pid]->b
else if(gNB->ulsch[UE_id][0]->harq_processes[harq_pid]->b!=NULL){
LOG_I(PHY, "ULSCH received ok \n");
if(IS_SOFTMODEM_NOS1){ //&& gNB->ulsch[UE_id][0]->rnti == 0x1234
nr_fill_crc_indication (gNB,frame_rx, slot_rx, UE_id, 0);
nr_fill_rx_indication(gNB, frame_rx, slot_rx, UE_id, harq_pid);
}
}
}
......@@ -298,25 +304,35 @@ void nr_fill_rx_indication(PHY_VARS_gNB *gNB, int frame, int slot_rx, int UE_id,
// --------------------
nfapi_rx_indication_pdu_t *pdu;
int timing_advance_update;
int sync_pos;
NR_gNB_ULSCH_t *ulsch = gNB->ulsch[UE_id][0];
NR_UL_gNB_HARQ_t *harq_process = ulsch->harq_processes[harq_pid];
uint16_t mu = gNB->gNB_config.subframe_config.numerology_index_mu.value;
// pthread_mutex_lock(&gNB->UL_INFO_mutex);
// gNB->UL_INFO.rx_ind.sfn_sf = frame<<4| slot_rx;
// gNB->UL_INFO.rx_ind.rx_indication_body.tl.tag = NFAPI_RX_INDICATION_BODY_TAG;
pthread_mutex_lock(&gNB->UL_INFO_mutex);
gNB->UL_INFO.rx_ind.sfn_sf = frame<<4| slot_rx;
gNB->UL_INFO.rx_ind.rx_indication_body.tl.tag = NFAPI_RX_INDICATION_BODY_TAG;
gNB->UL_INFO.rx_ind.rx_indication_body.rx_pdu_list->rx_indication_rel8.length = gNB->ulsch[UE_id][0]->harq_processes[harq_pid]->TBS>>3;
pdu = &gNB->UL_INFO.rx_ind.rx_indication_body.rx_pdu_list[gNB->UL_INFO.rx_ind.rx_indication_body.number_of_pdus];
pdu = &gNB->UL_INFO.rx_ind.rx_indication_body.rx_pdu_list[gNB->UL_INFO.rx_ind.rx_indication_body.number_of_pdus];
// pdu->rx_ue_information.handle = gNB->ulsch[UE_id+1][0]->handle;
// pdu->rx_ue_information.tl.tag = NFAPI_RX_UE_INFORMATION_TAG;
// pdu->rx_ue_information.rnti = gNB->ulsch[UE_id+1][0]->rnti;
// pdu->rx_indication_rel8.tl.tag = NFAPI_RX_INDICATION_REL8_TAG;
// pdu->rx_indication_rel8.length = gNB->ulsch[UE_id+1][0]->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->rx_ue_information.handle = gNB->ulsch[UE_id+1][0]->handle;
pdu->rx_ue_information.tl.tag = NFAPI_RX_UE_INFORMATION_TAG;
pdu->rx_ue_information.rnti = gNB->ulsch[UE_id][0]->rnti;
pdu->rx_indication_rel8.tl.tag = NFAPI_RX_INDICATION_REL8_TAG;
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 = harq_process->b;//gNB->ulsch[UE_id+1][0]->harq_processes[harq_pid]->b;
// estimate timing advance for MAC
sync_pos = nr_est_timing_advance_pusch(gNB, UE_id);
timing_advance_update = sync_pos; // - gNB->frame_parms.nb_prefix_samples/4; //to check
// printf("\x1B[33m" "timing_advance_update = %d\n" "\x1B[0m", timing_advance_update);
pdu->data = gNB->ulsch[UE_id+1][0]->harq_processes[harq_pid]->b;
//pdu->data = gNB->ulsch[UE_id+1][0]->harq_processes[harq_pid]->b;
sync_pos = nr_est_timing_advance_pusch(gNB, UE_id); // estimate timing advance for MAC
timing_advance_update = sync_pos * (1 << mu); // scale by the used scs numerology
......@@ -340,37 +356,37 @@ void nr_fill_rx_indication(PHY_VARS_gNB *gNB, int frame, int slot_rx, int UE_id,
pdu->rx_indication_rel8.timing_advance = timing_advance_update;
// estimate UL_CQI for MAC (from antenna port 0 only)
// int SNRtimes10 = dB_fixed_times10(gNB->pusch_vars[UE_id]->ulsch_power[0]) - 300;//(10*gNB->measurements.n0_power_dB[0]);
int SNRtimes10 = dB_fixed_times10(gNB->pusch_vars[UE_id]->ulsch_power[0]) - 300;//(10*gNB->measurements.n0_power_dB[0]);
// if (SNRtimes10 < -640) pdu->rx_indication_rel8.ul_cqi=0;
// else if (SNRtimes10 > 635) pdu->rx_indication_rel8.ul_cqi=255;
// else pdu->rx_indication_rel8.ul_cqi=(640+SNRtimes10)/5;
if (SNRtimes10 < -640) pdu->rx_indication_rel8.ul_cqi=0;
else if (SNRtimes10 > 635) pdu->rx_indication_rel8.ul_cqi=255;
else pdu->rx_indication_rel8.ul_cqi=(640+SNRtimes10)/5;
// LOG_D(PHY,"[PUSCH %d] Frame %d Subframe %d Filling RX_indication with SNR %d (%d), timing_advance %d (update %d)\n",
// harq_pid,frame,slot_rx,SNRtimes10,pdu->rx_indication_rel8.ul_cqi,pdu->rx_indication_rel8.timing_advance,
// timing_advance_update);
gNB->UL_INFO.rx_ind.rx_indication_body.number_of_pdus++;
// gNB->UL_INFO.rx_ind.sfn_sf = frame<<4 | slot_rx;
gNB->UL_INFO.rx_ind.sfn_sf = frame<<4 | slot_rx;
// pthread_mutex_unlock(&gNB->UL_INFO_mutex);
pthread_mutex_unlock(&gNB->UL_INFO_mutex);
}
void nr_fill_crc_indication (PHY_VARS_gNB *gNB, int frame, int slot_rx, int UE_id, uint8_t crc_flag){
// pthread_mutex_lock(&gNB->UL_INFO_mutex);
// nfapi_crc_indication_pdu_t *pdu = &gNB->UL_INFO.crc_ind.crc_indication_body.crc_pdu_list[gNB->UL_INFO.crc_ind.crc_indication_body.number_of_crcs];
// gNB->UL_INFO.crc_ind.sfn_sf = frame<<4 | subframe;
// gNB->UL_INFO.crc_ind.header.message_id = NFAPI_CRC_INDICATION;
// gNB->UL_INFO.crc_ind.crc_indication_body.tl.tag = NFAPI_CRC_INDICATION_BODY_TAG;
// pdu->instance_length = 0; // don't know what to do with this
// // pdu->rx_ue_information.handle = handle;
// pdu->rx_ue_information.tl.tag = NFAPI_RX_UE_INFORMATION_TAG;
// pdu->rx_ue_information.rnti = gNB->ulsch[UE_id]->rnti;
// pdu->crc_indication_rel8.tl.tag = NFAPI_CRC_INDICATION_REL8_TAG;
// pdu->crc_indication_rel8.crc_flag = crc_flag;
void nr_fill_crc_indication (PHY_VARS_gNB *gNB, int frame, int slot_rx, int UE_id, uint8_t crc_flag) {
pthread_mutex_lock(&gNB->UL_INFO_mutex);
nfapi_crc_indication_pdu_t *pdu = &gNB->UL_INFO. crc_ind.crc_indication_body.crc_pdu_list[gNB->UL_INFO.crc_ind.crc_indication_body.number_of_crcs];
gNB->UL_INFO.crc_ind.sfn_sf = frame<<4 | slot_rx;
gNB->UL_INFO.crc_ind.header.message_id = NFAPI_CRC_INDICATION;
gNB->UL_INFO.crc_ind.crc_indication_body.tl.tag = NFAPI_CRC_INDICATION_BODY_TAG;
pdu->instance_length = 0; // don't know what to do with this
// pdu->rx_ue_information.handle = handle;
pdu->rx_ue_information.tl.tag = NFAPI_RX_UE_INFORMATION_TAG;
pdu->rx_ue_information.rnti = gNB->ulsch[UE_id][0]->rnti;
pdu->crc_indication_rel8.tl.tag = NFAPI_CRC_INDICATION_REL8_TAG;
pdu->crc_indication_rel8.crc_flag = crc_flag;
gNB->UL_INFO.crc_ind.crc_indication_body.number_of_crcs++;
//LOG_D(PHY, "%s() rnti:%04x crcs:%d crc_flag:%d\n", __FUNCTION__, pdu->rx_ue_information.rnti, gNB->UL_INFO.crc_ind.crc_indication_body.number_of_crcs, crc_flag);
// pthread_mutex_unlock(&gNB->UL_INFO_mutex);
//LOG_D(PHY, "%s() rnti:%04x crcs:%d crc_flag:%d\n", __FUNCTION__, pdu->rx_ue_information.rnti, eNB->UL_INFO.crc_ind.crc_indication_body.number_of_crcs, crc_flag);
pthread_mutex_unlock(&gNB->UL_INFO_mutex);
}
void phy_procedures_gNB_common_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx) {
......@@ -422,8 +438,6 @@ void phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx)
//LOG_M("rxdataF_comp.m","rxF_comp",gNB->pusch_vars[UE_id]->rxdataF_comp[0],6900,1,1);
//LOG_M("rxdataF_ext.m","rxF_ext",gNB->pusch_vars[UE_id]->rxdataF_ext[0],6900,1,1);
nr_ulsch_procedures(gNB, frame_rx, slot_rx, UE_id, harq_pid);
nr_fill_rx_indication(gNB, frame_rx, slot_rx, UE_id, harq_pid); // indicate SDU to MAC
nr_fill_crc_indication(gNB, frame_rx, slot_rx, UE_id, 0);
}
}
}
......
......@@ -74,15 +74,7 @@ fifo_dump_emos_UE emos_dump_UE;
#include "common/utils/LOG/vcd_signal_dumper.h"
#include "UTIL/OPT/opt.h"
#if defined(ENABLE_ITTI)
# include "intertask_interface.h"
#endif
//#include "PHY/defs.h"
//#include "PHY/CODING/extern.h"
#include "intertask_interface.h"
#include "T.h"
#define DLSCH_RB_ALLOC 0x1fbf // skip DC RB (total 23/25 RBs)
......@@ -2493,6 +2485,7 @@ void phy_procedures_nrUE_TX(PHY_VARS_NR_UE *ue,
nr_ue_ulsch_procedures(ue,
harq_pid,
frame_tx,
slot_tx,
thread_id,
gNB_id);
......@@ -2507,8 +2500,8 @@ void phy_procedures_nrUE_TX(PHY_VARS_NR_UE *ue,
} // UE_mode==PUSCH
*/
nr_ue_pusch_common_procedures(ue,
LOG_D(PHY, "Sending data \n");
nr_ue_pusch_common_procedures(ue,
harq_pid,
slot_tx,
thread_id,
......@@ -2517,6 +2510,7 @@ void phy_procedures_nrUE_TX(PHY_VARS_NR_UE *ue,
/*
if ((ue->UE_mode[eNB_id] == PRACH) &&
(ue->frame_parms.prach_config_common.prach_Config_enabled==1)) {
......
......@@ -53,11 +53,7 @@
#include "common/utils/LOG/vcd_signal_dumper.h"
#include "UTIL/OPT/opt.h"
#if defined(ENABLE_ITTI)
#include "intertask_interface.h"
#endif
#include "intertask_interface.h"
#include "PHY/defs_UE.h"
#include "PHY/CODING/coding_extern.h"
......@@ -4885,10 +4881,8 @@ void phy_procedures_UE_lte(PHY_VARS_UE *ue,
uint8_t abstraction_flag,
uint8_t do_pdcch_flag,
runmode_t mode) {
#if defined(ENABLE_ITTI)
MessageDef *msg_p;
int result;
#endif
int frame_rx = proc->frame_rx;
int frame_tx = proc->frame_tx;
int subframe_rx = proc->subframe_rx;
......@@ -4905,9 +4899,6 @@ void phy_procedures_UE_lte(PHY_VARS_UE *ue,
if ( LOG_DEBUGFLAG(UE_TIMING)) {
start_meas(&ue->phy_proc[ue->current_thread_id[subframe_rx]]);
}
#if defined(ENABLE_ITTI)
do {
// Checks if a message has been sent to PHY sub-task
itti_poll_msg (TASK_PHY_UE, &msg_p);
......@@ -4929,8 +4920,6 @@ void phy_procedures_UE_lte(PHY_VARS_UE *ue,
}
} while(msg_p != NULL);
#endif
for (slot=0; slot<2; slot++) {
if ((subframe_select(&ue->frame_parms,subframe_tx)==SF_UL)||
(ue->frame_parms.frame_type == FDD)) {
......
......@@ -68,58 +68,19 @@ uint16_t NB_UE_INST = 1;
//Dummy Functions
lte_subframe_t subframe_select(LTE_DL_FRAME_PARMS *frame_parms, unsigned char subframe) {return(SF_DL);}
int rlc_module_init (int enb) {return(0);}
//int rlc_module_init (int enb) {return(0);}
void pdcp_layer_init (void) {}
boolean_t pdcp_data_ind( const protocol_ctxt_t *const ctxt_pP, const srb_flag_t srb_flagP, const MBMS_flag_t MBMS_flagP, const rb_id_t rb_idP,
const sdu_size_t sdu_buffer_sizeP, mem_block_t *const sdu_buffer_pP)
{return (0);}
int rrc_init_nr_global_param (void) {return(0);}
void config_common(int Mod_idP,int CC_idP,int Nid_cell,int nr_bandP,uint64_t SSB_positions,uint16_t ssb_periodicity,uint64_t dl_CarrierFreqP,uint32_t dl_BandwidthP);
int8_t nr_mac_rrc_data_ind_ue(const module_id_t module_id, const int CC_id, const uint8_t gNB_index,
const int8_t channel, const uint8_t* pduP, const sdu_size_t pdu_len) {return(0);}
uint64_t get_softmodem_optmask(void) {return 0;}
mac_rlc_status_resp_t mac_rlc_status_ind(const module_id_t module_idP,
const rnti_t rntiP,
const eNB_index_t eNB_index,
const frame_t frameP,
const sub_frame_t subframeP,
const eNB_flag_t enb_flagP,
const MBMS_flag_t MBMS_flagP,
const logical_chan_id_t channel_idP,
const tb_size_t tb_sizeP,
const uint32_t sourceL2Id,
const uint32_t destinationL2Id) {mac_rlc_status_resp_t mac_rlc_status_resp = {0}; return mac_rlc_status_resp;}
tbs_size_t mac_rlc_data_req(const module_id_t module_idP,
const rnti_t rntiP,
const eNB_index_t eNB_index,
const frame_t frameP,
const eNB_flag_t enb_flagP,
const MBMS_flag_t MBMS_flagP,
const logical_chan_id_t channel_idP,
const tb_size_t tb_sizeP,
char *buffer_pP,
const uint32_t sourceL2Id,
const uint32_t destinationL2Id) {return 0;}
int generate_dlsch_header(unsigned char *mac_header,
unsigned char num_sdus,
unsigned short *sdu_lengths,
unsigned char *sdu_lcids,
unsigned char drx_cmd,
unsigned short timing_advance_cmd,
unsigned char *ue_cont_res_id,
unsigned char short_padding,
unsigned short post_padding){return 0;}
void nr_ip_over_LTE_DRB_preconfiguration(void){}
void mac_rlc_data_ind (
const module_id_t module_idP,
const rnti_t rntiP,
const eNB_index_t eNB_index,
const frame_t frameP,
const eNB_flag_t enb_flagP,
const MBMS_flag_t MBMS_flagP,
const logical_chan_id_t channel_idP,
char *buffer_pP,
const tb_size_t tb_sizeP,
num_tb_t num_tbP,
crc_t *crcs_pP)
{}
// needed for some functions
openair0_config_t openair0_cfg[MAX_CARDS];
......
......@@ -60,6 +60,7 @@ uint16_t NB_UE_INST = 1;
// needed for some functions
openair0_config_t openair0_cfg[MAX_CARDS];
uint64_t get_softmodem_optmask(void) {return 0;}
int main(int argc, char **argv)
{
......
......@@ -70,53 +70,12 @@ uint16_t NB_UE_INST = 1;
// dummy functions
int8_t nr_mac_rrc_data_ind_ue(const module_id_t module_id, const int CC_id, const uint8_t gNB_index,
const int8_t channel, const uint8_t* pduP, const sdu_size_t pdu_len) { return 0; }
void mac_rlc_data_ind ( const module_id_t module_idP,
const rnti_t rntiP,
const eNB_index_t eNB_index,
const frame_t frameP,
const eNB_flag_t enb_flagP,
const MBMS_flag_t MBMS_flagP,
const logical_chan_id_t channel_idP,
char *buffer_pP,
const tb_size_t tb_sizeP,
num_tb_t num_tbP,
crc_t *crcs_pP){}
mac_rlc_status_resp_t mac_rlc_status_ind( const module_id_t module_idP,
const rnti_t rntiP,
const eNB_index_t eNB_index,
const frame_t frameP,
const sub_frame_t subframeP,
const eNB_flag_t enb_flagP,
const MBMS_flag_t MBMS_flagP,
const logical_chan_id_t channel_idP,
const tb_size_t tb_sizeP,
const uint32_t sourceL2Id,
const uint32_t destinationL2Id)
{mac_rlc_status_resp_t mac_rlc_status_resp = {0}; return mac_rlc_status_resp;}
tbs_size_t mac_rlc_data_req( const module_id_t module_idP,
const rnti_t rntiP,
const eNB_index_t eNB_index,
const frame_t frameP,
const eNB_flag_t enb_flagP,
const MBMS_flag_t MBMS_flagP,
const logical_chan_id_t channel_idP,
const tb_size_t tb_sizeP,
char *buffer_pP,
const uint32_t sourceL2Id,
const uint32_t destinationL2Id )
{return 0;}
int generate_dlsch_header(unsigned char *mac_header,
unsigned char num_sdus,
unsigned short *sdu_lengths,
unsigned char *sdu_lcids,
unsigned char drx_cmd,
unsigned short timing_advance_cmd,
unsigned char *ue_cont_res_id,
unsigned char short_padding,
unsigned short post_padding){return 0;}
uint64_t get_softmodem_optmask(void) {return 0;}
int rlc_module_init (int enb) {return(0);}
//int rlc_module_init (int enb) {return(0);}
void pdcp_layer_init (void) {}
boolean_t pdcp_data_ind( const protocol_ctxt_t *const ctxt_pP, const srb_flag_t srb_flagP, const MBMS_flag_t MBMS_flagP, const rb_id_t rb_idP,
const sdu_size_t sdu_buffer_sizeP, mem_block_t *const sdu_buffer_pP)
{return (0);}
void nr_ip_over_LTE_DRB_preconfiguration(void){}
// needed for some functions
......
......@@ -290,7 +290,7 @@ Protocol__FlexUlCqiReport * copy_ul_cqi_report(Protocol__FlexUlCqiReport * origi
full_ul_report->has_sfn_sn = original->has_sfn_sn;
full_ul_report->n_cqi_meas = original->n_cqi_meas;
Protocol__FlexUlCqi **ul_report;
Protocol__FlexUlCqi **ul_report=NULL;
ul_report = malloc(sizeof(Protocol__FlexUlCqi *) * full_ul_report->n_cqi_meas);
if(ul_report == NULL)
goto error;
......@@ -348,7 +348,7 @@ Protocol__FlexDlCqiReport * copy_dl_cqi_report(Protocol__FlexDlCqiReport * origi
dl_report->has_sfn_sn = original->has_sfn_sn;
dl_report->n_csi_report = original->n_csi_report;
Protocol__FlexDlCsi **csi_reports;
Protocol__FlexDlCsi **csi_reports=NULL;
csi_reports = malloc(sizeof(Protocol__FlexDlCsi *) * dl_report->n_csi_report);
if (csi_reports == NULL)
goto error;
......@@ -383,7 +383,7 @@ Protocol__FlexPagingBufferReport * copy_paging_buffer_report(Protocol__FlexPagin
protocol__flex_paging_buffer_report__init(copy);
copy->n_paging_info = original->n_paging_info;
Protocol__FlexPagingInfo **p_info;
Protocol__FlexPagingInfo **p_info=NULL;
p_info = malloc(sizeof(Protocol__FlexPagingInfo *) * copy->n_paging_info);
if (p_info == NULL)
goto error;
......
......@@ -45,10 +45,8 @@
#define GNB_CONF_STRING_OTG_APP_TYPE "app_type"
#define GNB_CONF_STRING_OTG_BG_TRAFFIC "bg_traffic"
#if defined(ENABLE_ITTI) && defined(ENABLE_USE_MME)
extern int asn_debug;
extern int asn1_xer_print;
#endif
#ifdef LIBCONFIG_LONG
#define libconfig_int long
......
......@@ -57,9 +57,7 @@
/* for fair round robin SCHED */
#include "eNB_scheduler_fairRR.h"
#if defined(ENABLE_ITTI)
#include "intertask_interface.h"
#endif
#include "intertask_interface.h"
#include "assertions.h"
......
......@@ -55,14 +55,12 @@
//#include "LAYER2/MAC/pre_processor.c"
#include "pdcp.h"
#if defined(ENABLE_ITTI)
#include "intertask_interface.h"
#endif
#include "intertask_interface.h"
#include "SIMULATION/TOOLS/sim.h" // for taus
#include "T.h"
#include "executables/softmodem-common.h"
#include "common/ran_context.h"
#include "LAYER2/MAC/eNB_scheduler_fairRR.h"
......@@ -1353,28 +1351,31 @@ initiate_ra_proc(module_id_t module_idP,
/* TODO: find better procedure to allocate RNTI */
do {
#if defined(USRP_REC_PLAY) // deterministic rnti in usrp record/playback mode
static int drnti[MAX_MOBILES_PER_ENB] = { 0xbda7, 0x71da, 0x9c40, 0xc350, 0x2710, 0x4e20, 0x7530, 0x1388, 0x3a98, 0x61a8, 0x88b8, 0xafc8, 0xd6d8, 0x1b58, 0x4268, 0x6978 };
int j = 0;
int nb_ue = 0;
for (j = 0; j < MAX_MOBILES_PER_ENB; j++) {
if (UE_RNTI(module_idP, j) > 0) {
nb_ue++;
} else {
break;
if (IS_SOFTMODEM_IQPLAYER) { /* iq player mode, use deterministic rnti */
static int drnti[MAX_MOBILES_PER_ENB];
static int drnti_def[]={ 0xbda7, 0x71da, 0x9c40, 0xc350, 0x2710, 0x4e20, 0x7530, 0x1388, 0x3a98, 0x61a8, 0x88b8, 0xafc8, 0xd6d8, 0x1b58, 0x4268, 0x6978 };
for (int j=0; j<MAX_MOBILES_PER_ENB && j< (sizeof(drnti_def)/sizeof(int));j++)
drnti[i]=drnti_def[i];
int nb_ue = 0;
for (int j = 0; j < MAX_MOBILES_PER_ENB; j++) {
if (UE_RNTI(module_idP, j) > 0) {
nb_ue++;
} else {
break;
}
}
}
if (nb_ue >= MAX_MOBILES_PER_ENB) {
printf("No more free RNTI available, increase MAX_MOBILES_PER_ENB\n");
abort();
}
if (nb_ue >= MAX_MOBILES_PER_ENB || nb_ue >= (sizeof(drnti_def)/sizeof(int))) {
printf("No more free RNTI available, increase MAX_MOBILES_PER_ENB\n");
abort();
}
ra[i].rnti = drnti[nb_ue];
#else
ra[i].rnti = taus();
#endif
ra[i].rnti = drnti[nb_ue];
} else {
ra[i].rnti = taus();
}
loop++;
} while (loop != 100 &&
/* TODO: this is not correct, the rnti may be in use without
......
......@@ -44,9 +44,7 @@
//#include "LAYER2/MAC/pre_processor.c"
#include "pdcp.h"
#if defined(ENABLE_ITTI)
#include "intertask_interface.h"
#endif
#include "intertask_interface.h"
#define ENABLE_MAC_PAYLOAD_DEBUG
#define DEBUG_eNB_SCHEDULER 1
......
......@@ -53,9 +53,7 @@
#include "assertions.h"
#if defined(ENABLE_ITTI)
#include "intertask_interface.h"
#endif
#include "intertask_interface.h"
#include <dlfcn.h>
......
......@@ -48,10 +48,6 @@
#include "pdcp.h"
#include "assertions.h"
//#if defined(ENABLE_ITTI)
//#include "intertask_interface.h"
//#endif
//
#include "SIMULATION/TOOLS/sim.h" // for taus
#define ENABLE_MAC_PAYLOAD_DEBUG
......
......@@ -48,10 +48,8 @@
//#include "LAYER2/MAC/pre_processor.c"
#include "pdcp.h"
#if defined(ENABLE_ITTI)
#include "intertask_interface.h"
#endif
#include "intertask_interface.h"
#include "executables/softmodem-common.h"
#include "T.h"
#define ENABLE_MAC_PAYLOAD_DEBUG
......@@ -2184,9 +2182,8 @@ add_new_ue(module_id_t mod_idP,
UE_list->ordered_ULCCids[0][UE_id] = cc_idP;
UE_list->num_UEs++;
UE_list->active[UE_id] = TRUE;
#if defined(USRP_REC_PLAY) // not specific to record/playback ?
UE_list->UE_template[cc_idP][UE_id].pre_assigned_mcs_ul = 0;
#endif
if (IS_SOFTMODEM_IQPLAYER)// not specific to record/playback ?
UE_list->UE_template[cc_idP][UE_id].pre_assigned_mcs_ul = 0;
UE_list->UE_template[cc_idP][UE_id].rach_resource_type = rach_resource_type;
memset((void *) &UE_list->UE_sched_ctrl[UE_id],
0,
......
......@@ -48,9 +48,7 @@
#include "assertions.h"
#include "pdcp.h"
#if defined(ENABLE_ITTI)
#include "intertask_interface.h"
#endif
#include "intertask_interface.h"
#include "ENB_APP/flexran_agent_defs.h"
#include "flexran_agent_ran_api.h"
......@@ -937,6 +935,7 @@ rx_sdu(const module_id_t enb_mod_idP,
stop_meas(&mac->rx_ulsch_sdu);
}
//-----------------------------------------------------------------------------
/*
* Return the BSR table index corresponding to the number of bytes in input
......
......@@ -1294,3 +1294,4 @@ uint8_t ul_subframe2_k_phich(COMMON_channels_t *cc, sub_frame_t ul_subframe);
/* MAC ITTI messaging related functions */
/* Main loop of MAC itti message handling */
void *mac_enb_task(void *arg);
......@@ -56,9 +56,7 @@
#include "pdcp.h"
#include "targets/RT/USER/lte-softmodem.h"
#if defined(ENABLE_ITTI)
#include "intertask_interface.h"
#endif
#include "intertask_interface.h"
#include "assertions.h"
......@@ -2455,10 +2453,8 @@ ue_scheduler(const module_id_t module_idP,
struct LTE_RACH_ConfigCommon *rach_ConfigCommon =
(struct LTE_RACH_ConfigCommon *) NULL;
protocol_ctxt_t ctxt;
#if defined(ENABLE_ITTI)
MessageDef *msg_p;
int result;
#endif
#if UE_TIMING_TRACE
start_meas(&UE_mac_inst[module_idP].ue_scheduler);
#endif
......@@ -2467,7 +2463,6 @@ ue_scheduler(const module_id_t module_idP,
PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, module_idP, ENB_FLAG_NO,
UE_mac_inst[module_idP].crnti, txFrameP,
txSubframeP, eNB_indexP);
#if defined(ENABLE_ITTI)
if(module_idP == 0) {
do {
......@@ -2497,8 +2492,6 @@ ue_scheduler(const module_id_t module_idP,
} while (msg_p != NULL);
}
#endif
//Mac_rlc_xface->frameP=frameP;
//Rrc_xface->Frame_index=Mac_rlc_xface->frameP;
//if (subframe%5 == 0)
......
......@@ -118,7 +118,8 @@ typedef struct {
#define UL_SCH_LCID_CCCH 0x00
#define UL_SCH_LCID_SRB1 0x01
#define UL_SCH_LCID_SRB2 0x02
#define UL_SCH_LCID_SRB3 0x03
#define UL_SCH_LCID_DTCH 0x03
#define UL_SCH_LCID_SRB3 0x04
#define UL_SCH_LCID_CCCH_MSG3 0x21
#define UL_SCH_LCID_RECOMMENDED_BITRATE_QUERY 0x35
#define UL_SCH_LCID_MULTI_ENTRY_PHR_4_OCT 0x36
......@@ -132,5 +133,10 @@ typedef struct {
#define UL_SCH_LCID_L_BSR 0x3E
#define UL_SCH_LCID_PADDING 0x3F
#define NR_MAX_NUM_LCID 32
#define NR_MAX_NUM_LCGID 8
#define MAX_RLC_SDU_SUBHEADER_SIZE 3
#endif /*__LAYER2_MAC_H__ */
......@@ -51,8 +51,14 @@
#include "fapi_nr_ue_interface.h"
#include "NR_IF_Module.h"
#include "PHY/defs_nr_common.h"
#include "openair2/LAYER2/NR_MAC_COMMON/nr_mac.h"
#define NB_NR_UE_MAC_INST 1
/*!\brief Maximum number of logical channl group IDs */
/*!\brief value for indicating BSR Timer is not running */
#define NR_MAC_UE_BSR_TIMER_NOT_RUNNING (0xFFFF)
typedef enum {
SFN_C_MOD_2_EQ_0,
......@@ -60,6 +66,68 @@ typedef enum {
SFN_C_IMPOSSIBLE
} SFN_C_TYPE;
// LTE structure, might need to be adapted for NR
typedef struct {
/// buffer status for each lcgid
uint8_t BSR[NR_MAX_NUM_LCGID]; // should be more for mesh topology
/// keep the number of bytes in rlc buffer for each lcgid
int32_t BSR_bytes[NR_MAX_NUM_LCGID];
/// after multiplexing buffer remain for each lcid
int32_t LCID_buffer_remain[NR_MAX_NUM_LCID];
/// sum of all lcid buffer size
uint16_t All_lcid_buffer_size_lastTTI;
/// buffer status for each lcid
uint8_t LCID_status[NR_MAX_NUM_LCID];
/// SR pending as defined in 36.321
uint8_t SR_pending;
/// SR_COUNTER as defined in 36.321
uint16_t SR_COUNTER;
/// logical channel group ide for each LCID
uint8_t LCGID[NR_MAX_NUM_LCID];
/// retxBSR-Timer, default value is sf2560
uint16_t retxBSR_Timer;
/// retxBSR_SF, number of subframe before triggering a regular BSR
uint16_t retxBSR_SF;
/// periodicBSR-Timer, default to infinity
uint16_t periodicBSR_Timer;
/// periodicBSR_SF, number of subframe before triggering a periodic BSR
uint16_t periodicBSR_SF;
/// default value is 0: not configured
uint16_t sr_ProhibitTimer;
/// sr ProhibitTime running
uint8_t sr_ProhibitTimer_Running;
/// default value to n5
uint16_t maxHARQ_Tx;
/// default value is false
uint16_t ttiBundling;
/// default value is release
struct DRX_Config *drx_config;
/// default value is release
struct MAC_MainConfig__phr_Config *phr_config;
///timer before triggering a periodic PHR
uint16_t periodicPHR_Timer;
///timer before triggering a prohibit PHR
uint16_t prohibitPHR_Timer;
///DL Pathloss change value
uint16_t PathlossChange;
///number of subframe before triggering a periodic PHR
int16_t periodicPHR_SF;
///number of subframe before triggering a prohibit PHR
int16_t prohibitPHR_SF;
///DL Pathloss Change in db
uint16_t PathlossChange_db;
/// default value is false
uint16_t extendedBSR_Sizes_r10;
/// default value is false
uint16_t extendedPHR_r10;
//Bj bucket usage per lcid
int16_t Bj[NR_MAX_NUM_LCID];
// Bucket size per lcid
int16_t bucket_size[NR_MAX_NUM_LCID];
} NR_UE_SCHEDULING_INFO;
/*!\brief Top level UE MAC structure */
typedef struct {
......@@ -82,6 +150,7 @@ typedef struct {
/// Random access parameter
uint16_t ra_rnti;
uint16_t crnti;
//BWP params
NR_BWP_PARMS initial_bwp_dl;
......@@ -96,6 +165,13 @@ typedef struct {
nr_ue_if_module_t *if_module;
nr_scheduled_response_t scheduled_response;
nr_phy_config_t phy_config;
/// BSR report flag management
uint8_t BSR_reporting_active;
NR_UE_SCHEDULING_INFO scheduling_info;
/// PHR
uint8_t PHR_reporting_active;
} NR_UE_MAC_INST_t;
typedef enum seach_space_mask_e {
......
......@@ -150,5 +150,18 @@ void nr_ue_process_mac_pdu(
int8_t nr_ue_process_dlsch(module_id_t module_id, int cc_id, uint8_t gNB_index, fapi_nr_dci_indication_t *dci_ind, void *pduP, uint32_t pdu_len);
uint8_t nr_ue_get_sdu(module_id_t module_idP, int CC_id, frame_t frameP,
sub_frame_t subframe, uint8_t eNB_index,
uint8_t *ulsch_buffer, uint16_t buflen, uint8_t *access_mode);
uint16_t
nr_generate_ulsch_pdu(uint8_t *mac_pdu,
uint8_t *sdus_payload,
uint8_t num_sdus,
uint16_t *sdu_lengths,
uint8_t *sdu_lcids,
uint16_t *crnti,
uint16_t buflen);
#endif
/** @}*/
......@@ -51,10 +51,13 @@
#include "executables/softmodem-common.h"
/* log utils */
#include "common/utils/LOG/log.h"
#include "SIMULATION/TOOLS/sim.h" // for taus
#include "openair2/LAYER2/NR_MAC_COMMON/nr_mac.h"
#include "common/utils/LOG/vcd_signal_dumper.h"
#include <stdio.h>
#include <math.h>
//int mbms_rab_id = 2047;
//#define ENABLE_MAC_PAYLOAD_DEBUG 1
......@@ -2340,7 +2343,204 @@ void nr_ue_process_mac_pdu(
}
pdu_ptr += ( mac_subheader_len + mac_ce_len + mac_sdu_len );
pdu_len -= ( mac_subheader_len + mac_ce_len + mac_sdu_len );
AssertFatal(pdu_len >= 0, "[MAC] nr_ue_process_mac_pdu, residual mac pdu length < 0!\n");
}
}
//---------------------------------------------------------------------------------
uint16_t
nr_generate_ulsch_pdu(uint8_t *mac_pdu,
uint8_t *sdus_payload,
uint8_t num_sdus,
uint16_t *sdu_lengths,
uint8_t *sdu_lcids,
uint16_t *crnti,
uint16_t buflen) {
NR_MAC_SUBHEADER_FIXED *mac_pdu_ptr = (NR_MAC_SUBHEADER_FIXED *) mac_pdu;
unsigned char * ulsch_buffer_ptr = sdus_payload;
uint8_t last_size=0;
uint16_t sdu_length_total=0;
int i;
int offset=0;
// 2) Generation of ULSCH MAC SDU subheaders
for (i = 0; i < num_sdus; i++) {
LOG_D(MAC, "[gNB] Generate ULSCH header num sdu %d len sdu %d\n", num_sdus, sdu_lengths[i]);
if (sdu_lengths[i] < 128) {
((NR_MAC_SUBHEADER_SHORT *) mac_pdu_ptr)->R = 0;
((NR_MAC_SUBHEADER_SHORT *) mac_pdu_ptr)->F = 0;
((NR_MAC_SUBHEADER_SHORT *) mac_pdu_ptr)->LCID = sdu_lcids[i];
((NR_MAC_SUBHEADER_SHORT *) mac_pdu_ptr)->L = (unsigned char) sdu_lengths[i];
last_size = 2;
} else {
((NR_MAC_SUBHEADER_LONG *) mac_pdu_ptr)->R = 0;
((NR_MAC_SUBHEADER_LONG *) mac_pdu_ptr)->F = 1;
((NR_MAC_SUBHEADER_LONG *) mac_pdu_ptr)->LCID = sdu_lcids[i];
((NR_MAC_SUBHEADER_LONG *) mac_pdu_ptr)->L1 = ((unsigned short) sdu_lengths[i] >> 8) & 0x7f;
((NR_MAC_SUBHEADER_LONG *) mac_pdu_ptr)->L2 = (unsigned short) sdu_lengths[i] & 0xff;
last_size = 3;
}
mac_pdu_ptr += last_size;
// 3) cycle through SDUs, compute each relevant and place dlsch_buffer in
memcpy((void *) mac_pdu_ptr, (void *) ulsch_buffer_ptr, sdu_lengths[i]);
ulsch_buffer_ptr+= sdu_lengths[i];
sdu_length_total+= sdu_lengths[i];
mac_pdu_ptr += sdu_lengths[i];
}
offset = ((unsigned char *) mac_pdu_ptr - mac_pdu);
// 4) Compute final offset for padding
uint16_t padding_bytes = buflen - offset;
LOG_D(MAC, "Number of padding bytes: %d \n", padding_bytes);
if (padding_bytes > 0) {
((NR_MAC_SUBHEADER_FIXED *) mac_pdu_ptr)->R = 0;
((NR_MAC_SUBHEADER_FIXED *) mac_pdu_ptr)->LCID = UL_SCH_LCID_PADDING;
mac_pdu_ptr++;
} else {
// no MAC subPDU with padding
}
return offset;
}
uint8_t
nr_ue_get_sdu(module_id_t module_idP, int CC_id, frame_t frameP,
sub_frame_t subframe, uint8_t eNB_index,
uint8_t *ulsch_buffer, uint16_t buflen, uint8_t *access_mode) {
uint8_t total_rlc_pdu_header_len = 0;
int16_t buflen_remain = 0;
uint8_t lcid = 0;
uint16_t sdu_lengths[8] = { 0, 0, 0, 0, 0, 0, 0, 0 };
uint8_t sdu_lcids[8] = { 0, 0, 0, 0, 0, 0, 0, 0 };
uint16_t payload_offset = 0, num_sdus = 0;
uint8_t ulsch_sdus[MAX_ULSCH_PAYLOAD_BYTES];
uint16_t sdu_length_total = 0;
//unsigned short post_padding = 0;
rlc_buffer_occupancy_t lcid_buffer_occupancy_old =
0, lcid_buffer_occupancy_new = 0;
LOG_D(MAC,
"[UE %d] MAC PROCESS UL TRANSPORT BLOCK at frame%d subframe %d TBS=%d\n",
module_idP, frameP, subframe, buflen);
AssertFatal(CC_id == 0,
"Transmission on secondary CCs is not supported yet\n");
#if UE_TIMING_TRACE
start_meas(&UE_mac_inst[module_idP].tx_ulsch_sdu);
#endif
//NR_UE_MAC_INST_t *nr_ue_mac_inst = get_mac_inst(0);
// Check for DCCH first
// TO DO: Multiplex in the order defined by the logical channel prioritization
for (lcid = UL_SCH_LCID_SRB1;
lcid < NR_MAX_NUM_LCID; lcid++) {
lcid_buffer_occupancy_old =
//TODO: Replace static value with CRNTI
mac_rlc_get_buffer_occupancy_ind(module_idP,
0x1234, eNB_index, frameP, //nr_ue_mac_inst->crnti
subframe, ENB_FLAG_NO,
lcid);
lcid_buffer_occupancy_new = lcid_buffer_occupancy_old;
if(lcid_buffer_occupancy_new){
buflen_remain =
buflen - (total_rlc_pdu_header_len + sdu_length_total + MAX_RLC_SDU_SUBHEADER_SIZE);
LOG_D(MAC,
"[UE %d] Frame %d : UL-DXCH -> ULSCH, RLC %d has %d bytes to "
"send (Transport Block size %d SDU Length Total %d , mac header len %d, buflen_remain %d )\n", //BSR byte before Tx=%d
module_idP, frameP, lcid, lcid_buffer_occupancy_new,
buflen, sdu_length_total,
total_rlc_pdu_header_len, buflen_remain); // ,nr_ue_mac_inst->scheduling_info.BSR_bytes[nr_ue_mac_inst->scheduling_info.LCGID[lcid]]
while(buflen_remain > 0 && lcid_buffer_occupancy_new){
//TODO: Replace static value with CRNTI
sdu_lengths[num_sdus] = mac_rlc_data_req(module_idP,
0x1234, eNB_index, //nr_ue_mac_inst->crnti
frameP,
ENB_FLAG_NO,
MBMS_FLAG_NO,
lcid,
buflen_remain,
(char *)&ulsch_sdus[sdu_length_total],0,
0
);
AssertFatal(buflen_remain >= sdu_lengths[num_sdus],
"LCID=%d RLC has segmented %d bytes but MAC has max=%d\n",
lcid, sdu_lengths[num_sdus], buflen_remain);
if (sdu_lengths[num_sdus]) {
sdu_length_total += sdu_lengths[num_sdus];
sdu_lcids[num_sdus] = lcid;
//Update total MAC Header size for RLC PDUs
/*if(sdu_lengths[num_sdus]<128)
total_rlc_pdu_header_len += 2;
else
total_rlc_pdu_header_len += 3;*/
total_rlc_pdu_header_len += MAX_RLC_SDU_SUBHEADER_SIZE; //rlc_pdu_header_len_last;
//Update number of SDU
num_sdus++;
}
/* Get updated BO after multiplexing this PDU */
//TODO: Replace static value with CRNTI
lcid_buffer_occupancy_new =
mac_rlc_get_buffer_occupancy_ind(module_idP,
0x1234, //nr_ue_mac_inst->crnti
eNB_index, frameP,
subframe, ENB_FLAG_NO,
lcid);
buflen_remain =
buflen - (total_rlc_pdu_header_len + sdu_length_total + MAX_RLC_SDU_SUBHEADER_SIZE);
}
}
}
// Generate ULSCH PDU
if (num_sdus>0) {
payload_offset = nr_generate_ulsch_pdu(ulsch_buffer, // mac header
ulsch_sdus,
num_sdus, // num sdus
sdu_lengths, // sdu length
sdu_lcids, // sdu lcid
NULL, // crnti
buflen); // long_bsr
}
else
return 0;
// Padding: fill remainder of ULSCH with 0
if (buflen - payload_offset > 0){
for (int j = payload_offset; j < buflen; j++)
ulsch_buffer[j] = 0;
}
#if defined(ENABLE_MAC_PAYLOAD_DEBUG)
LOG_I(MAC, "Printing UL MAC payload UE side, payload_offset: %d \n", payload_offset);
for (int i = 0; i < buflen ; i++) {
//harq_process_ul_ue->a[i] = (unsigned char) rand();
//printf("a[%d]=0x%02x\n",i,harq_process_ul_ue->a[i]);
printf("%02x ",(unsigned char)ulsch_buffer[i]);
}
printf("\n");
#endif
return 1;
}
......@@ -55,9 +55,7 @@
#include "flexran_agent_extern.h"
#include "flexran_agent_mac.h"
#if defined(ENABLE_ITTI)
#include "intertask_interface.h"
#endif
#include "assertions.h"
#include <openair1/PHY/LTE_TRANSPORT/transport_proto.h>
......
......@@ -46,9 +46,7 @@
//#include "LAYER2/MAC/pre_processor.c"
#include "pdcp.h"
#if defined(ENABLE_ITTI)
#include "intertask_interface.h"
#endif
#define ENABLE_MAC_PAYLOAD_DEBUG
#define DEBUG_eNB_SCHEDULER 1
......
......@@ -33,6 +33,8 @@
#include "mac_proto.h"
#include "PHY/NR_TRANSPORT/nr_dlsch.h"
#include "PHY/NR_TRANSPORT/nr_dci.h"
#include "executables/nr-softmodem.h"
#include "LAYER2/NR_MAC_COMMON/nr_mac.h"
#include "executables/softmodem-common.h"
extern RAN_CONTEXT_t RC;
//#define ENABLE_MAC_PAYLOAD_DEBUG 1
......@@ -529,3 +531,4 @@ void nr_schedule_uss_ulsch_phytest(nfapi_nr_ul_tti_request_t *UL_tti_req,
//pusch_pdu->beamforming; //not used for now
}
}
......@@ -50,9 +50,7 @@
//#include "LAYER2/MAC/pre_processor.c"
#include "pdcp.h"
#if defined(ENABLE_ITTI)
#include "intertask_interface.h"
#endif
#include "T.h"
......
......@@ -29,6 +29,203 @@
*/
#include "LAYER2/NR_MAC_gNB/mac_proto.h"
#include "executables/softmodem-common.h"
//#define ENABLE_MAC_PAYLOAD_DEBUG 1
void nr_process_mac_pdu(
module_id_t module_idP,
uint8_t CC_id,
frame_t frameP,
uint8_t *pduP,
uint16_t mac_pdu_len)
{
// This function is adapting code from the old
// parse_header(...) and ue_send_sdu(...) functions of OAI LTE
uint8_t *pdu_ptr = pduP, rx_lcid, done = 0;
int pdu_len = mac_pdu_len;
uint16_t mac_ce_len, mac_subheader_len, mac_sdu_len;
// For both DL/UL-SCH
// Except:
// - UL/DL-SCH: fixed-size MAC CE(known by LCID)
// - UL/DL-SCH: padding
// - UL-SCH: MSG3 48-bits
// |0|1|2|3|4|5|6|7| bit-wise
// |R|F| LCID |
// | L |
// |0|1|2|3|4|5|6|7| bit-wise
// |R|F| LCID |
// | L |
// | L |
// For both DL/UL-SCH
// For:
// - UL/DL-SCH: fixed-size MAC CE(known by LCID)
// - UL/DL-SCH: padding, for single/multiple 1-oct padding CE(s)
// - UL-SCH: MSG3 48-bits
// |0|1|2|3|4|5|6|7| bit-wise
// |R|R| LCID |
// LCID: The Logical Channel ID field identifies the logical channel instance of the corresponding MAC SDU or the type of the corresponding MAC CE or padding as described in Tables 6.2.1-1 and 6.2.1-2 for the DL-SCH and UL-SCH respectively. There is one LCID field per MAC subheader. The LCID field size is 6 bits;
// L: The Length field indicates the length of the corresponding MAC SDU or variable-sized MAC CE in bytes. There is one L field per MAC subheader except for subheaders corresponding to fixed-sized MAC CEs and padding. The size of the L field is indicated by the F field;
// F: lenght of L is 0:8 or 1:16 bits wide
// R: Reserved bit, set to zero.
while (!done && pdu_len > 0){
mac_ce_len = 0;
mac_subheader_len = 1; // default to fixed-length subheader = 1-oct
mac_sdu_len = 0;
rx_lcid = ((NR_MAC_SUBHEADER_FIXED *)pdu_ptr)->LCID;
LOG_D(MAC, "LCID received at gNB side: %d \n", rx_lcid);
switch(rx_lcid){
// MAC CE
/*#ifdef DEBUG_HEADER_PARSING
LOG_D(MAC, "[UE] LCID %d, PDU length %d\n", ((NR_MAC_SUBHEADER_FIXED *)pdu_ptr)->LCID, pdu_len);
#endif*/
case UL_SCH_LCID_S_BSR:
//38.321 section 6.1.3.1
//fixed length
mac_ce_len =1;
/* Extract short BSR value */
break;
case UL_SCH_LCID_S_TRUNCATED_BSR:
//38.321 section 6.1.3.1
//fixed length
mac_ce_len =1;
/* Extract short truncated BSR value */
break;
case UL_SCH_LCID_L_BSR:
//38.321 section 6.1.3.1
//variable length
mac_ce_len |= (uint16_t)((NR_MAC_SUBHEADER_SHORT *)pdu_ptr)->L;
mac_subheader_len = 2;
if(((NR_MAC_SUBHEADER_SHORT *)pdu_ptr)->F){
mac_ce_len |= (uint16_t)(((NR_MAC_SUBHEADER_LONG *)pdu_ptr)->L2)<<8;
mac_subheader_len = 3;
}
/* Extract long BSR value */
break;
case UL_SCH_LCID_L_TRUNCATED_BSR:
//38.321 section 6.1.3.1
//variable length
mac_ce_len |= (uint16_t)((NR_MAC_SUBHEADER_SHORT *)pdu_ptr)->L;
mac_subheader_len = 2;
if(((NR_MAC_SUBHEADER_SHORT *)pdu_ptr)->F){
mac_ce_len |= (uint16_t)(((NR_MAC_SUBHEADER_LONG *)pdu_ptr)->L2)<<8;
mac_subheader_len = 3;
}
/* Extract long truncated BSR value */
break;
case UL_SCH_LCID_C_RNTI:
//38.321 section 6.1.3.2
//fixed length
mac_ce_len = 2;
/* Extract CRNTI value */
break;
case UL_SCH_LCID_SINGLE_ENTRY_PHR:
//38.321 section 6.1.3.8
//fixed length
mac_ce_len = 2;
/* Extract SINGLE ENTRY PHR elements for PHR calculation */
break;
case UL_SCH_LCID_MULTI_ENTRY_PHR_1_OCT:
//38.321 section 6.1.3.9
// varialbe length
mac_ce_len |= (uint16_t)((NR_MAC_SUBHEADER_SHORT *)pdu_ptr)->L;
mac_subheader_len = 2;
if(((NR_MAC_SUBHEADER_SHORT *)pdu_ptr)->F){
mac_ce_len |= (uint16_t)(((NR_MAC_SUBHEADER_LONG *)pdu_ptr)->L2)<<8;
mac_subheader_len = 3;
}
/* Extract MULTI ENTRY PHR elements from single octet bitmap for PHR calculation */
break;
case UL_SCH_LCID_MULTI_ENTRY_PHR_4_OCT:
//38.321 section 6.1.3.9
// varialbe length
mac_ce_len |= (uint16_t)((NR_MAC_SUBHEADER_SHORT *)pdu_ptr)->L;
mac_subheader_len = 2;
if(((NR_MAC_SUBHEADER_SHORT *)pdu_ptr)->F){
mac_ce_len |= (uint16_t)(((NR_MAC_SUBHEADER_LONG *)pdu_ptr)->L2)<<8;
mac_subheader_len = 3;
}
/* Extract MULTI ENTRY PHR elements from four octets bitmap for PHR calculation */
break;
case UL_SCH_LCID_PADDING:
done = 1;
// end of MAC PDU, can ignore the rest.
break;
case UL_SCH_LCID_DTCH:
// check if LCID is valid at current time.
if(((NR_MAC_SUBHEADER_SHORT *)pdu_ptr)->F){
//mac_sdu_len |= (uint16_t)(((NR_MAC_SUBHEADER_LONG *)pdu_ptr)->L2)<<8;
mac_subheader_len = 3;
mac_sdu_len = ((uint16_t)(((NR_MAC_SUBHEADER_LONG *) pdu_ptr)->L1 & 0x7f) << 8)
| ((uint16_t)((NR_MAC_SUBHEADER_LONG *) pdu_ptr)->L2 & 0xff);
} else {
mac_sdu_len = (uint16_t)((NR_MAC_SUBHEADER_SHORT *)pdu_ptr)->L;
mac_subheader_len = 2;
}
LOG_D(MAC, "[UE %d] Frame %d : DLSCH -> DL-DTCH %d (gNB %d, %d bytes)\n", module_idP, frameP, rx_lcid, module_idP, mac_sdu_len);
#if defined(ENABLE_MAC_PAYLOAD_DEBUG)
LOG_T(MAC, "[UE %d] First 32 bytes of DLSCH : \n", module_idP);
for (i = 0; i < 32; i++)
LOG_T(MAC, "%x.", (pdu_ptr + mac_subheader_len)[i]);
LOG_T(MAC, "\n");
#endif
if (IS_SOFTMODEM_NOS1){
if (rx_lcid < NB_RB_MAX && rx_lcid >= UL_SCH_LCID_DTCH) {
mac_rlc_data_ind(module_idP,
0x1234,
module_idP,
frameP,
ENB_FLAG_YES,
MBMS_FLAG_NO,
rx_lcid,
(char *) (pdu_ptr + mac_subheader_len),
mac_sdu_len,
1,
NULL);
} else {
LOG_E(MAC, "[UE %d] Frame %d : unknown LCID %d (gNB %d)\n", module_idP, frameP, rx_lcid, module_idP);
}
}
break;
default:
return;
break;
}
pdu_ptr += ( mac_subheader_len + mac_ce_len + mac_sdu_len );
pdu_len -= ( mac_subheader_len + mac_ce_len + mac_sdu_len );
AssertFatal(pdu_len >= 0, "[MAC] nr_process_mac_pdu, residual mac pdu length < 0!\n");
}
}
/*
* When data are received on PHY and transmitted to MAC
......@@ -68,7 +265,20 @@ void nr_rx_sdu(const module_id_t gnb_mod_idP,
UE_id,
ul_cqi);
if (sduP != NULL)
#if defined(ENABLE_MAC_PAYLOAD_DEBUG)
LOG_I(MAC, "Printing received UL MAC payload at gNB side: %d \n");
for (int i = 0; i < sdu_lenP ; i++) {
//harq_process_ul_ue->a[i] = (unsigned char) rand();
//printf("a[%d]=0x%02x\n",i,harq_process_ul_ue->a[i]);
printf("%02x ",(unsigned char)sduP[i]);
}
printf("\n");
#endif
if (sduP != NULL){
UE_scheduling_control->ta_update = timing_advance;
LOG_D(MAC, "Received PDU at MAC gNB \n");
nr_process_mac_pdu(gnb_mod_idP, CC_idP, frameP, sduP, sdu_lenP);
}
}
}
\ No newline at end of file
}
......@@ -165,6 +165,14 @@ void config_nr_mib(int Mod_idP,
int cellBarred,
int intraFreqReselection);
void nr_process_mac_pdu(
module_id_t module_idP,
uint8_t CC_id,
frame_t frameP,
uint8_t *pduP,
uint16_t mac_pdu_len);
/* \brief Function to indicate a received SDU on ULSCH.
@param Mod_id Instance ID of gNB
@param CC_id Component carrier index
......
......@@ -2297,7 +2297,6 @@ uint64_t pdcp_module_init( uint64_t pdcp_optmask ) {
if(UE_NAS_USE_TUN) {
int num_if = (NFAPI_MODE == NFAPI_UE_STUB_PNF || IS_SOFTMODEM_SIML1 )?MAX_NUMBER_NETIF:1;
netlink_init_tun("ue",num_if);
//Add --nr-ip-over-lte option check for next line
if (IS_SOFTMODEM_NOS1)
nas_config(1, 1, 2, "ue");
netlink_init_mbms_tun("uem",num_if);
......
......@@ -129,6 +129,7 @@ int pdcp_fifo_flush_sdus(const protocol_ctxt_t *const ctxt_pP) {
ret = sendto(pdcp_pc5_sockfd, &(sdu_p->data[sizeof(pdcp_data_ind_header_t)]),
sizeof(sidelink_pc5s_element), 0, (struct sockaddr *)&prose_pdcp_addr,sizeof(prose_pdcp_addr) );
} else if (UE_NAS_USE_TUN) {
//ret = write(nas_sock_fd[ctxt_pP->module_id], &(sdu_p->data[sizeof(pdcp_data_ind_header_t)]),sizeToWrite );
if(rb_id == mbms_rab_id){
......@@ -137,21 +138,40 @@ int pdcp_fifo_flush_sdus(const protocol_ctxt_t *const ctxt_pP) {
}
else
{
ret = write(nas_sock_fd[ctxt_pP->module_id], &(sdu_p->data[sizeof(pdcp_data_ind_header_t)]),sizeToWrite );
#if defined(ENABLE_PDCP_PAYLOAD_DEBUG)
LOG_I(PHY, "PDCP output to be sent to TUN interface: \n");
for (int i = sizeof(pdcp_data_ind_header_t); i < sizeToWrite; i++) {
printf("%02x ",(unsigned char)sdu_p->data[i]);
}
printf("\n");
#endif
ret = write(nas_sock_fd[ctxt_pP->module_id], &(sdu_p->data[sizeof(pdcp_data_ind_header_t)]),sizeToWrite );
//LOG_I(PDCP,"[PDCP_FIFOS] ret %d TRIED TO PUSH DATA TO rb_id %d handle %d sizeToWrite %d\n",ret,rb_id,nas_sock_fd[ctxt_pP->module_id],sizeToWrite);
}
} else if (ENB_NAS_USE_TUN) {
if ((ret = write(nas_sock_fd[0], &(sdu_p->data[sizeof(pdcp_data_ind_header_t)]),sizeToWrite )) != sizeToWrite) {
printf("ret: %d\n",ret);
}
#if defined(ENABLE_PDCP_PAYLOAD_DEBUG)
LOG_I(PHY, "PDCP output to be sent to TUN interface: \n");
for (int i = sizeof(pdcp_data_ind_header_t); i < sizeToWrite; i++) {
printf("%02x ",(unsigned char)sdu_p->data[i]);
}
printf("\n");
#endif
ret = write(nas_sock_fd[0], &(sdu_p->data[sizeof(pdcp_data_ind_header_t)]), sizeToWrite);
} else if (PDCP_USE_NETLINK) {
memcpy(NLMSG_DATA(nas_nlh_tx), (uint8_t *) sdu_p->data, sizeToWrite);
nas_nlh_tx->nlmsg_len = sizeToWrite;
ret = sendmsg(nas_sock_fd[0],&nas_msg_tx,0);
} // PDCP_USE_NETLINK
if(ret < 0) LOG_E(PDCP,"[PDCP_FIFOS] pdcp_fifo_flush_sdus (ret (instead of: %d) : %d, errno: %d %s)\n", ret, sizeToWrite, errno, strerror(errno));
AssertFatal(ret >= 0,"[PDCP_FIFOS] pdcp_fifo_flush_sdus (errno: %d %s), nas_sock_fd[0]: %d\n", errno, strerror(errno), nas_sock_fd[0]);
#if defined(ENABLE_PDCP_PAYLOAD_DEBUG)
LOG_I(PDCP, "Printing first bytes of PDCP SDU before removing it from the list: \n");
for (int i=0; i<30; i++){
LOG_I(PDCP, "%x", sdu_p->data[i]);
}
#endif
list_remove_head (&pdcp_sdu_list);
free_mem_block (sdu_p, __func__);
pdcp_nb_sdu_sent ++;
......@@ -237,6 +257,15 @@ int pdcp_fifo_read_input_sdus_fromtun (const protocol_ctxt_t *const ctxt_pP) {
LOG_D(PDCP, "[FRAME %5u][UE][IP][INSTANCE %u][RB %ld][--- PDCP_DATA_REQ / %d Bytes --->][PDCP][MOD %u][UE %04x][RB %ld]\n",
ctxt.frame, ctxt.instance, rab_id, len, ctxt.module_id,
ctxt.rnti, rab_id);
#if defined ENABLE_PDCP_PAYLOAD_DEBUG
LOG_I(PHY, "TUN interface output received from PDCP: \n");
for (int i = 0; i < 128; i++) {
printf("%02x ",(unsigned char)nl_rx_buf[i]);
}
printf("\n");
#endif
pdcp_data_req(&ctxt, SRB_FLAG_NO, rab_id, RLC_MUI_UNDEFINED,
RLC_SDU_CONFIRM_NO, len, (unsigned char *)nl_rx_buf,
PDCP_TRANSMISSION_MODE_DATA
......
......@@ -33,7 +33,7 @@
#include "UTIL/OSA/osa_defs.h"
#include "common/utils/LOG/vcd_signal_dumper.h"
#include "executables/softmodem-common.h"
#include "LAYER2/MAC/mac_extern.h"
#include "pdcp.h"
......@@ -213,28 +213,28 @@ pdcp_validate_security(
stream_decrypt(pdcp_pP->cipheringAlgorithm,
&decrypt_params,
&buffer_decrypted);
#if !defined(USRP_REC_PLAY)
if (srb_flagP) {
if (!IS_SOFTMODEM_IQPLAYER) {
if (srb_flagP) {
/* Now check the integrity of the complete PDU */
decrypt_params.message = pdcp_pdu_buffer;
decrypt_params.blength = sdu_buffer_size << 3;
decrypt_params.key = pdcp_pP->kRRCint + 16;// 128;
if (stream_check_integrity(pdcp_pP->integrityProtAlgorithm,
&decrypt_params,
&pdcp_pdu_buffer[sdu_buffer_size]) != 0) {
MSC_LOG_EVENT(
(ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_PDCP_ENB:MSC_PDCP_UE,
" Security: failed MAC-I Algo %X UE %"PRIx16" ",
pdcp_pP->integrityProtAlgorithm,
ctxt_pP->rnti);
LOG_E(PDCP, "[OSA][RB %ld] %s failed to validate MAC-I (key %llx) of incoming PDU\n",
rb_id, (pdcp_pP->is_ue != 0) ? "UE" : "eNB",((long long unsigned int*)decrypt_params.key)[0]);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_VALIDATE_SECURITY, VCD_FUNCTION_OUT);
return -1;
decrypt_params.message = pdcp_pdu_buffer;
decrypt_params.blength = sdu_buffer_size << 3;
decrypt_params.key = pdcp_pP->kRRCint + 16;// 128;
if (stream_check_integrity(pdcp_pP->integrityProtAlgorithm,
&decrypt_params,
&pdcp_pdu_buffer[sdu_buffer_size]) != 0) {
MSC_LOG_EVENT(
(ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_PDCP_ENB:MSC_PDCP_UE,
" Security: failed MAC-I Algo %X UE %"PRIx16" ",
pdcp_pP->integrityProtAlgorithm,
ctxt_pP->rnti);
LOG_E(PDCP, "[OSA][RB %ld] %s failed to validate MAC-I (key %llx) of incoming PDU\n",
rb_id, (pdcp_pP->is_ue != 0) ? "UE" : "eNB",((long long unsigned int*)decrypt_params.key)[0]);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_VALIDATE_SECURITY, VCD_FUNCTION_OUT);
return -1;
}
}
}
#endif
} /* !IQPLAYER */
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_VALIDATE_SECURITY, VCD_FUNCTION_OUT);
return 0;
......
......@@ -26,9 +26,7 @@
//-----------------------------------------------------------------------------
#include "platform_types.h"
//-----------------------------------------------------------------------------
#if ENABLE_ITTI
#include "intertask_interface.h"
#endif
#include "intertask_interface.h"
#include "assertions.h"
#include "list.h"
#include "rlc_am.h"
......
......@@ -33,13 +33,13 @@
static nr_rlc_ue_manager_t *nr_rlc_ue_manager;
/* TODO: handle time a bit more properly */
#if 0
//#if 0
static uint64_t nr_rlc_current_time;
static int nr_rlc_current_time_last_frame;
static int nr_rlc_current_time_last_subframe;
#endif
//#endif
#if 0
//#if 0
void mac_rlc_data_ind (
const module_id_t module_idP,
const rnti_t rntiP,
......@@ -68,6 +68,9 @@ void mac_rlc_data_ind (
nr_rlc_manager_lock(nr_rlc_ue_manager);
ue = nr_rlc_manager_get_ue(nr_rlc_ue_manager, rntiP);
if(ue == NULL)
LOG_I(RLC, "RLC instance for the given UE was not found \n");
switch (channel_idP) {
case 1 ... 2: rb = ue->srb[channel_idP - 1]; break;
case 3 ... 7: rb = ue->drb[channel_idP - 3]; break;
......@@ -75,6 +78,7 @@ void mac_rlc_data_ind (
}
if (rb != NULL) {
LOG_D(RLC, "RB found! (channel ID %d) \n", channel_idP);
rb->set_time(rb, nr_rlc_current_time);
rb->recv_pdu(rb, buffer_pP, tb_sizeP);
} else {
......@@ -177,11 +181,11 @@ mac_rlc_status_resp_t mac_rlc_status_ind(
if (rb != NULL) {
nr_rlc_entity_buffer_status_t buf_stat;
rb->set_time(rb, nr_rlc_current_time);
/* 36.321 deals with BSR values up to 3000000 bytes, after what it
* reports '> 3000000' (table 6.1.3.1-2). Passing 4000000 is thus
/* 38.321 deals with BSR values up to 81338368 bytes, after what it
* reports '> 81338368' (table 6.1.3.1-2). Passing 100000000 is thus
* more than enough.
*/
buf_stat = rb->buffer_status(rb, 4000000);
buf_stat = rb->buffer_status(rb, 100000000);
ret.bytes_in_buffer = buf_stat.status_size
+ buf_stat.retx_size
+ buf_stat.tx_size;
......@@ -199,11 +203,66 @@ mac_rlc_status_resp_t mac_rlc_status_ind(
ret.head_sdu_is_segmented = 0;
return ret;
}
#endif
//#endif
rlc_buffer_occupancy_t mac_rlc_get_buffer_occupancy_ind(
const module_id_t module_idP,
const rnti_t rntiP,
const eNB_index_t eNB_index,
const frame_t frameP,
const sub_frame_t subframeP,
const eNB_flag_t enb_flagP,
const logical_chan_id_t channel_idP)
{
nr_rlc_ue_t *ue;
rlc_buffer_occupancy_t ret;
nr_rlc_entity_t *rb;
if (enb_flagP) {
LOG_E(RLC, "Tx mac_rlc_get_buffer_occupancy_ind function is not implemented for eNB LcId=%u\n", channel_idP);
exit(1);
}
/* TODO: handle time a bit more properly */
if (nr_rlc_current_time_last_frame != frameP ||
nr_rlc_current_time_last_subframe != subframeP) {
nr_rlc_current_time++;
nr_rlc_current_time_last_frame = frameP;
nr_rlc_current_time_last_subframe = subframeP;
}
nr_rlc_manager_lock(nr_rlc_ue_manager);
ue = nr_rlc_manager_get_ue(nr_rlc_ue_manager, rntiP);
switch (channel_idP) {
case 1 ... 2: rb = ue->srb[channel_idP - 1]; break;
case 3 ... 7: rb = ue->drb[channel_idP - 3]; break;
default: rb = NULL; break;
}
if (rb != NULL) {
nr_rlc_entity_buffer_status_t buf_stat;
rb->set_time(rb, nr_rlc_current_time);
/* 38.321 deals with BSR values up to 81338368 bytes, after what it
* reports '> 81338368' (table 6.1.3.1-2). Passing 100000000 is thus
* more than enough.
*/
buf_stat = rb->buffer_status(rb, 100000000);
ret = buf_stat.status_size
+ buf_stat.retx_size
+ buf_stat.tx_size;
} else {
ret = 0;
}
nr_rlc_manager_unlock(nr_rlc_ue_manager);
return ret;
}
int oai_emulation;
#if 0
//#if 0
rlc_op_status_t rlc_data_req (const protocol_ctxt_t *const ctxt_pP,
const srb_flag_t srb_flagP,
const MBMS_flag_t MBMS_flagP,
......@@ -255,9 +314,9 @@ rlc_op_status_t rlc_data_req (const protocol_ctxt_t *const ctxt_pP,
return RLC_OP_STATUS_OK;
}
#endif
//#endif
#if 0
//#if 0
int rlc_module_init(int enb_flag)
{
static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER;
......@@ -278,13 +337,13 @@ int rlc_module_init(int enb_flag)
return 0;
}
#endif
//#endif
#if 0
//#if 0
void rlc_util_print_hex_octets(comp_name_t componentP, unsigned char *dataP, const signed long sizeP)
{
}
#endif
//#endif
static void deliver_sdu(void *_ue, nr_rlc_entity_t *entity, char *buf, int size)
{
......@@ -755,7 +814,7 @@ __attribute__ ((unused)) static void add_drb(int rnti, struct LTE_DRB_ToAddMod *
}
}
#if 0
//#if 0
rlc_op_status_t rrc_rlc_config_asn1_req (const protocol_ctxt_t * const ctxt_pP,
const LTE_SRB_ToAddModList_t * const srb2add_listP,
const LTE_DRB_ToAddModList_t * const drb2add_listP,
......@@ -800,9 +859,9 @@ rlc_op_status_t rrc_rlc_config_asn1_req (const protocol_ctxt_t * const ctxt_pP
return RLC_OP_STATUS_OK;
}
#endif
//#endif
#if 0
//#if 0
rlc_op_status_t rrc_rlc_config_req (
const protocol_ctxt_t* const ctxt_pP,
const srb_flag_t srb_flagP,
......@@ -861,16 +920,16 @@ rlc_op_status_t rrc_rlc_config_req (
nr_rlc_manager_unlock(nr_rlc_ue_manager);
return RLC_OP_STATUS_OK;
}
#endif
//#endif
#if 0
//#if 0
void rrc_rlc_register_rrc (rrc_data_ind_cb_t rrc_data_indP, rrc_data_conf_cb_t rrc_data_confP)
{
/* nothing to do */
}
#endif
//#endif
#if 0
//#if 0
rlc_op_status_t rrc_rlc_remove_ue (const protocol_ctxt_t* const x)
{
LOG_D(RLC, "%s:%d:%s: remove UE %d\n", __FILE__, __LINE__, __FUNCTION__, x->rnti);
......@@ -880,4 +939,4 @@ rlc_op_status_t rrc_rlc_remove_ue (const protocol_ctxt_t* const x)
return RLC_OP_STATUS_OK;
}
#endif
//#endif
......@@ -182,28 +182,27 @@ void handle_nr_ulsch(NR_UL_IND_t *UL_info) {
LOG_D(PHY, "UL_info->crc_ind.crc_indication_body.crc_pdu_list[%d].crc_indication_rel8.crc_flag:%d\n", j, UL_info->crc_ind.crc_indication_body.crc_pdu_list[j].crc_indication_rel8.crc_flag);
if (UL_info->crc_ind.crc_indication_body.crc_pdu_list[j].crc_indication_rel8.crc_flag == 1) { // CRC error indication
LOG_D(MAC,"Frame %d, Slot %d Calling rx_sdu (CRC error) \n",UL_info->frame,UL_info->slot);
LOG_I(MAC,"Frame %d, Slot %d Calling rx_sdu (CRC error) \n",UL_info->frame,UL_info->slot);
nr_rx_sdu(UL_info->module_id,
UL_info->CC_id,
NFAPI_SFNSF2SFN(UL_info->rx_ind.sfn_sf), //UL_info->frame,
NFAPI_SFNSF2SF(UL_info->rx_ind.sfn_sf), //UL_info->slot,
UL_info->rx_ind.rx_indication_body.rx_pdu_list[i].rx_ue_information.rnti,
(uint8_t *)NULL,
UL_info->rx_ind.rx_indication_body.rx_pdu_list[i].rx_indication_rel8.length,
UL_info->rx_ind.rx_indication_body.rx_pdu_list[i].rx_indication_rel8.timing_advance,
UL_info->rx_ind.rx_indication_body.rx_pdu_list[i].rx_indication_rel8.ul_cqi);
}
else {
LOG_D(MAC,"Frame %d, Slot %d Calling rx_sdu (CRC ok) \n",UL_info->frame,UL_info->slot);
UL_info->CC_id,
NFAPI_SFNSF2SFN(UL_info->rx_ind.sfn_sf), //UL_info->frame,
NFAPI_SFNSF2SF(UL_info->rx_ind.sfn_sf), //UL_info->slot,
UL_info->rx_ind.rx_indication_body.rx_pdu_list[i].rx_ue_information.rnti,
(uint8_t *)NULL,
UL_info->rx_ind.rx_indication_body.rx_pdu_list[i].rx_indication_rel8.length,
UL_info->rx_ind.rx_indication_body.rx_pdu_list[i].rx_indication_rel8.timing_advance,
UL_info->rx_ind.rx_indication_body.rx_pdu_list[i].rx_indication_rel8.ul_cqi);
} else {
LOG_D(MAC,"Frame %d, Slot %d Calling rx_sdu (CRC ok), received length: %d \n",UL_info->frame,UL_info->slot, UL_info->rx_ind.rx_indication_body.rx_pdu_list[i].rx_indication_rel8.length);
nr_rx_sdu(UL_info->module_id,
UL_info->CC_id,
NFAPI_SFNSF2SFN(UL_info->rx_ind.sfn_sf), //UL_info->frame,
NFAPI_SFNSF2SF(UL_info->rx_ind.sfn_sf), //UL_info->slot,
UL_info->rx_ind.rx_indication_body.rx_pdu_list[i].rx_ue_information.rnti,
UL_info->rx_ind.rx_indication_body.rx_pdu_list[i].data,
UL_info->rx_ind.rx_indication_body.rx_pdu_list[i].rx_indication_rel8.length,
UL_info->rx_ind.rx_indication_body.rx_pdu_list[i].rx_indication_rel8.timing_advance,
UL_info->rx_ind.rx_indication_body.rx_pdu_list[i].rx_indication_rel8.ul_cqi);
UL_info->CC_id,
NFAPI_SFNSF2SFN(UL_info->rx_ind.sfn_sf), //UL_info->frame,
NFAPI_SFNSF2SF(UL_info->rx_ind.sfn_sf), //UL_info->slot,
UL_info->rx_ind.rx_indication_body.rx_pdu_list[i].rx_ue_information.rnti,
UL_info->rx_ind.rx_indication_body.rx_pdu_list[i].data,
UL_info->rx_ind.rx_indication_body.rx_pdu_list[i].rx_indication_rel8.length,
UL_info->rx_ind.rx_indication_body.rx_pdu_list[i].rx_indication_rel8.timing_advance,
UL_info->rx_ind.rx_indication_body.rx_pdu_list[i].rx_indication_rel8.ul_cqi);
}
//printf("rx_indication_rel8.timing_advance %d\n", UL_info->rx_ind.rx_indication_body.rx_pdu_list[i].rx_indication_rel8.timing_advance);
break;
......
......@@ -37,9 +37,7 @@
#include "msc.h"
#include "common/ran_context.h"
#if defined(ENABLE_ITTI)
#include "intertask_interface.h"
#endif
#include "intertask_interface.h"
#include "flexran_agent_extern.h"
#undef C_RNTI // C_RNTI is used in F1AP generated code, prevent preprocessor replace
......
......@@ -37,9 +37,7 @@
#include "msc.h"
#include "common/ran_context.h"
#if defined(ENABLE_ITTI)
#include "intertask_interface.h"
#endif
#include "intertask_interface.h"
//#define RRC_DATA_REQ_DEBUG
//#define DEBUG_RRC 1
......@@ -135,7 +133,6 @@ rrc_data_ind(
ctxt_pP->rnti);
}
#if defined(ENABLE_ITTI)
{
MessageDef *message_p;
// Uses a new buffer to avoid issue with PDCP buffer content that could be changed by PDCP (asynchronous message handling).
......@@ -152,11 +149,4 @@ rrc_data_ind(
RRC_DCCH_DATA_IND (message_p).eNB_index = ctxt_pP->eNB_index;
itti_send_msg_to_task (ctxt_pP->enb_flag ? TASK_RRC_ENB : TASK_RRC_UE, ctxt_pP->instance, message_p);
}
#else
rrc_eNB_decode_dcch(
ctxt_pP,
DCCH_index,
buffer_pP,
sdu_sizeP);
#endif
}
......@@ -37,9 +37,7 @@
#include "msc.h"
#if defined(ENABLE_ITTI)
#include "intertask_interface.h"
#endif
#include "intertask_interface.h"
//#define RRC_DATA_REQ_DEBUG
......@@ -76,7 +74,6 @@ mac_rrc_data_req_ue(
LOG_D(RRC,"[UE %d] Frame %d buffer_pP status %d,\n",Mod_idP,frameP, UE_rrc_inst[Mod_idP].Srb0[eNB_index].Tx_buffer.payload_size);
if( (UE_rrc_inst[Mod_idP].Srb0[eNB_index].Tx_buffer.payload_size > 0) ) {
#if defined(ENABLE_ITTI)
{
MessageDef *message_p;
int ccch_size = UE_rrc_inst[Mod_idP].Srb0[eNB_index].Tx_buffer.payload_size;
......@@ -96,7 +93,6 @@ mac_rrc_data_req_ue(
itti_send_msg_to_task (TASK_MAC_UE, UE_MODULE_ID_TO_INSTANCE(Mod_idP), message_p);
}
#endif
memcpy(&buffer_pP[0],&UE_rrc_inst[Mod_idP].Srb0[eNB_index].Tx_buffer.Payload[0],UE_rrc_inst[Mod_idP].Srb0[eNB_index].Tx_buffer.payload_size);
uint8_t Ret_size=UE_rrc_inst[Mod_idP].Srb0[eNB_index].Tx_buffer.payload_size;
// UE_rrc_inst[Mod_id].Srb0[eNB_index].Tx_buffer.payload_size=0;
......@@ -138,7 +134,6 @@ mac_rrc_data_ind_ue(
if(srb_idP == BCCH_SI_MBMS) {
LOG_D(RRC,"[UE %d] Received SDU for BCCH on MBMS SRB %ld from eNB %d\n",module_idP,srb_idP,eNB_indexP);
#if defined(ENABLE_ITTI)
{
MessageDef *message_p;
int msg_sdu_size = sizeof(RRC_MAC_BCCH_MBMS_DATA_IND (message_p).sdu);
......@@ -161,14 +156,10 @@ mac_rrc_data_ind_ue(
RRC_MAC_BCCH_MBMS_DATA_IND (message_p).rsrp = 45 /* TODO change phy to report rspp */;
itti_send_msg_to_task (TASK_RRC_UE, ctxt.instance, message_p);
}
#else
decode_BCCH_MBMS_DLSCH_Message(&ctxt,eNB_indexP,(uint8_t *)sduP,sdu_lenP, 0, 0);
#endif
}
if(srb_idP == BCCH) {
LOG_D(RRC,"[UE %d] Received SDU for BCCH on SRB %ld from eNB %d\n",module_idP,srb_idP,eNB_indexP);
#if defined(ENABLE_ITTI)
{
MessageDef *message_p;
int msg_sdu_size = sizeof(RRC_MAC_BCCH_DATA_IND (message_p).sdu);
......@@ -191,9 +182,6 @@ mac_rrc_data_ind_ue(
RRC_MAC_BCCH_DATA_IND (message_p).rsrp = 45 /* TODO change phy to report rspp */;
itti_send_msg_to_task (TASK_RRC_UE, ctxt.instance, message_p);
}
#else
decode_BCCH_DLSCH_Message(&ctxt,eNB_indexP,(uint8_t *)sduP,sdu_lenP, 0, 0);
#endif
}
if(srb_idP == PCCH) {
......@@ -204,7 +192,6 @@ mac_rrc_data_ind_ue(
if((srb_idP & RAB_OFFSET) == CCCH) {
if (sdu_lenP>0) {
LOG_T(RRC,"[UE %d] Received SDU for CCCH on SRB %ld from eNB %d\n",module_idP,srb_idP & RAB_OFFSET,eNB_indexP);
#if defined(ENABLE_ITTI)
{
MessageDef *message_p;
int msg_sdu_size = CCCH_SDU_SIZE;
......@@ -226,20 +213,12 @@ mac_rrc_data_ind_ue(
RRC_MAC_CCCH_DATA_IND (message_p).rnti = rntiP;
itti_send_msg_to_task (TASK_RRC_UE, ctxt.instance, message_p);
}
#else
SRB_INFO *Srb_info;
Srb_info = &UE_rrc_inst[module_idP].Srb0[eNB_indexP];
memcpy(Srb_info->Rx_buffer.Payload,sduP,sdu_lenP);
Srb_info->Rx_buffer.payload_size = sdu_lenP;
rrc_ue_decode_ccch(&ctxt, Srb_info, eNB_indexP);
#endif
}
}
if ((srb_idP & RAB_OFFSET) == MCCH) {
LOG_T(RRC,"[UE %d] Frame %d: Received SDU on MBSFN sync area %d for MCCH on SRB %ld from eNB %d\n",
module_idP,frameP, mbsfn_sync_areaP, srb_idP & RAB_OFFSET,eNB_indexP);
#if defined(ENABLE_ITTI)
{
MessageDef *message_p;
int msg_sdu_size = sizeof(RRC_MAC_MCCH_DATA_IND (message_p).sdu);
......@@ -259,9 +238,6 @@ mac_rrc_data_ind_ue(
RRC_MAC_MCCH_DATA_IND (message_p).mbsfn_sync_area = mbsfn_sync_areaP;
itti_send_msg_to_task (TASK_RRC_UE, ctxt.instance, message_p);
}
#else
decode_MCCH_Message(&ctxt, eNB_indexP, sduP, sdu_lenP, mbsfn_sync_areaP);
#endif
}
//TTN (for D2D)
......@@ -297,7 +273,6 @@ rrc_data_req_ue(
ctxt_pP->rnti,
muiP,
sdu_sizeP);
#if defined(ENABLE_ITTI)
{
MessageDef *message_p;
// Uses a new buffer to avoid issue with PDCP buffer content that could be changed by PDCP (asynchronous message handling).
......@@ -325,18 +300,6 @@ rrc_data_req_ue(
message_p);
return TRUE; // TODO should be changed to a CNF message later, currently RRC lite does not used the returned value anyway.
}
#else
return pdcp_data_req (
ctxt_pP,
SRB_FLAG_YES,
rb_idP,
muiP,
confirmP,
sdu_sizeP,
buffer_pP,
modeP,NULL, NULL
);
#endif
}
//------------------------------------------------------------------------------
......@@ -352,7 +315,6 @@ rrc_data_ind_ue(
rb_id_t DCCH_index = Srb_id;
LOG_I(RRC, "[UE %x] Frame %d: received a DCCH %ld message on SRB %ld with Size %d from eNB %d\n",
ctxt_pP->module_id, ctxt_pP->frame, DCCH_index,Srb_id,sdu_sizeP, ctxt_pP->eNB_index);
#if defined(ENABLE_ITTI)
{
MessageDef *message_p;
// Uses a new buffer to avoid issue with PDCP buffer content that could be changed by PDCP (asynchronous message handling).
......@@ -369,20 +331,11 @@ rrc_data_ind_ue(
RRC_DCCH_DATA_IND (message_p).eNB_index = ctxt_pP->eNB_index;
itti_send_msg_to_task (TASK_RRC_UE, ctxt_pP->instance, message_p);
}
#else
//#warning "LG put 0 to arg4 that is eNB index"
rrc_ue_decode_dcch(
ctxt_pP,
DCCH_index,
buffer_pP,
0);
#endif
}
//-------------------------------------------------------------------------------------------//
void rrc_in_sync_ind(module_id_t Mod_idP, frame_t frameP, uint16_t eNB_index) {
//-------------------------------------------------------------------------------------------//
#if defined(ENABLE_ITTI)
{
MessageDef *message_p;
//LOG_I(RRC,"sending a message to task_mac_ue\n");
......@@ -391,14 +344,6 @@ void rrc_in_sync_ind(module_id_t Mod_idP, frame_t frameP, uint16_t eNB_index) {
RRC_MAC_IN_SYNC_IND (message_p).enb_index = eNB_index;
itti_send_msg_to_task (TASK_RRC_UE, UE_MODULE_ID_TO_INSTANCE(Mod_idP), message_p);
}
#else
UE_rrc_inst[Mod_idP].Info[eNB_index].N310_cnt=0;
if (UE_rrc_inst[Mod_idP].Info[eNB_index].T310_active==1) {
UE_rrc_inst[Mod_idP].Info[eNB_index].N311_cnt++;
}
#endif
}
//-------------------------------------------------------------------------------------------//
......@@ -412,7 +357,6 @@ void rrc_out_of_sync_ind(module_id_t Mod_idP, frame_t frameP, uint16_t eNB_index
UE_rrc_inst[Mod_idP].Info[eNB_index].N310_cnt,
UE_rrc_inst[Mod_idP].Info[eNB_index].N311_cnt);
#if defined(ENABLE_ITTI)
{
MessageDef *message_p;
message_p = itti_alloc_new_message (TASK_MAC_UE, RRC_MAC_OUT_OF_SYNC_IND);
......@@ -420,9 +364,6 @@ void rrc_out_of_sync_ind(module_id_t Mod_idP, frame_t frameP, uint16_t eNB_index
RRC_MAC_OUT_OF_SYNC_IND (message_p).enb_index = eNB_index;
itti_send_msg_to_task (TASK_RRC_UE, UE_MODULE_ID_TO_INSTANCE(Mod_idP), message_p);
}
#else
UE_rrc_inst[Mod_idP].Info[eNB_index].N310_cnt++;
#endif
}
//------------------------------------------------------------------------------
......@@ -442,16 +383,11 @@ mac_UE_get_rrc_status(
//-------------------------------------------------------------------------------------------//
int mac_ue_ccch_success_ind(module_id_t Mod_idP, uint8_t eNB_index) {
//-------------------------------------------------------------------------------------------//
#if defined(ENABLE_ITTI)
{
MessageDef *message_p;
message_p = itti_alloc_new_message (TASK_MAC_UE, RRC_MAC_CCCH_DATA_CNF);
RRC_MAC_CCCH_DATA_CNF (message_p).enb_index = eNB_index;
itti_send_msg_to_task (TASK_RRC_UE, UE_MODULE_ID_TO_INSTANCE(Mod_idP), message_p);
}
#else
// reset the tx buffer to indicate RRC that ccch was successfully transmitted (for example if contention resolution succeeds)
UE_rrc_inst[Mod_idP].Srb0[eNB_index].Tx_buffer.payload_size=0;
#endif
return 0;
}
This diff is collapsed.
......@@ -91,10 +91,8 @@ LTE_DRX_Config_t *do_DrxConfig(int CC_id, RrcConfigurationReq *configuration, LT
@param br_flag Do for BL/CE UE configuration
@return size of encoded bit stream in bytes*/
uint8_t do_SIB1(rrc_eNB_carrier_data_t *carrier,int Mod_id,int CC_id, BOOLEAN_t brOption
#if defined(ENABLE_ITTI)
,RrcConfigurationReq *configuration
#endif
uint8_t do_SIB1(rrc_eNB_carrier_data_t *carrier,int Mod_id,int CC_id, BOOLEAN_t brOption,
RrcConfigurationReq *configuration
);
/**
......@@ -120,10 +118,8 @@ uint8_t do_SIB1_MBMS(rrc_eNB_carrier_data_t *carrier,int Mod_id,int CC_id, RrcCo
@param MBMS_flag Indicates presence of MBMS system information (when 1)
@return size of encoded bit stream in bytes*/
uint8_t do_SIB23(uint8_t Mod_id,int CC_id, BOOLEAN_t brOption
#if defined(ENABLE_ITTI)
, RrcConfigurationReq *configuration
#endif
uint8_t do_SIB23(uint8_t Mod_id,int CC_id, BOOLEAN_t brOption,
RrcConfigurationReq *configuration
);
/**
......
......@@ -68,10 +68,8 @@
//#include "PHY/defs.h"
#include "enb_config.h"
#include "intertask_interface.h"
#if defined(ENABLE_ITTI)
#include "intertask_interface.h"
#endif
......@@ -178,21 +176,15 @@ uint8_t do_SIB1_NB_IoT(uint8_t Mod_id, int CC_id,
memset(PLMN_identity_info_NB_IoT.plmn_Identity_r13.mcc,0,sizeof(*PLMN_identity_info_NB_IoT.plmn_Identity_r13.mcc));
asn_set_empty(&PLMN_identity_info_NB_IoT.plmn_Identity_r13.mcc->list);//.size=0;
//left as it is???
#if defined(ENABLE_ITTI)
dummy_mcc[0] = (configuration->mcc / 100) % 10;
dummy_mcc[1] = (configuration->mcc / 10) % 10;
dummy_mcc[2] = (configuration->mcc / 1) % 10;
#else
dummy_mcc[0] = 0;
dummy_mcc[1] = 0;
dummy_mcc[2] = 1;
#endif
ASN_SEQUENCE_ADD(&PLMN_identity_info_NB_IoT.plmn_Identity_r13.mcc->list,&dummy_mcc[0]);
ASN_SEQUENCE_ADD(&PLMN_identity_info_NB_IoT.plmn_Identity_r13.mcc->list,&dummy_mcc[1]);
ASN_SEQUENCE_ADD(&PLMN_identity_info_NB_IoT.plmn_Identity_r13.mcc->list,&dummy_mcc[2]);
PLMN_identity_info_NB_IoT.plmn_Identity_r13.mnc.list.size=0;
PLMN_identity_info_NB_IoT.plmn_Identity_r13.mnc.list.count=0;
#if defined(ENABLE_ITTI)
if (configuration->mnc >= 100) {
dummy_mnc[0] = (configuration->mnc / 100) % 10;
......@@ -210,11 +202,6 @@ uint8_t do_SIB1_NB_IoT(uint8_t Mod_id, int CC_id,
}
}
#else
dummy_mnc[0] = 0;
dummy_mnc[1] = 1;
dummy_mnc[2] = 0xf;
#endif
ASN_SEQUENCE_ADD(&PLMN_identity_info_NB_IoT.plmn_Identity_r13.mnc.list,&dummy_mnc[0]);
ASN_SEQUENCE_ADD(&PLMN_identity_info_NB_IoT.plmn_Identity_r13.mnc.list,&dummy_mnc[1]);
......@@ -230,28 +217,16 @@ uint8_t do_SIB1_NB_IoT(uint8_t Mod_id, int CC_id,
// 16 bits = 2 byte
(*sib1_NB_IoT)->cellAccessRelatedInfo_r13.trackingAreaCode_r13.buf = MALLOC(2); //MALLOC works in byte
//lefts as it is?
#if defined(ENABLE_ITTI)
(*sib1_NB_IoT)->cellAccessRelatedInfo_r13.trackingAreaCode_r13.buf[0] = (configuration->tac >> 8) & 0xff;
(*sib1_NB_IoT)->cellAccessRelatedInfo_r13.trackingAreaCode_r13.buf[1] = (configuration->tac >> 0) & 0xff;
#else
(*sib1_NB_IoT)->cellAccessRelatedInfo_r13.trackingAreaCode_r13.buf[0] = 0x00;
(*sib1_NB_IoT)->cellAccessRelatedInfo_r13.trackingAreaCode_r13.buf[1] = 0x01;
#endif
(*sib1_NB_IoT)->cellAccessRelatedInfo_r13.trackingAreaCode_r13.size=2;
(*sib1_NB_IoT)->cellAccessRelatedInfo_r13.trackingAreaCode_r13.bits_unused=0;
// 28 bits --> i have to use 32 bits = 4 byte
(*sib1_NB_IoT)->cellAccessRelatedInfo_r13.cellIdentity_r13.buf = MALLOC(8); // why allocate 8 byte?
#if defined(ENABLE_ITTI)
(*sib1_NB_IoT)->cellAccessRelatedInfo_r13.cellIdentity_r13.buf[0] = (configuration->cell_identity >> 20) & 0xff;
(*sib1_NB_IoT)->cellAccessRelatedInfo_r13.cellIdentity_r13.buf[1] = (configuration->cell_identity >> 12) & 0xff;
(*sib1_NB_IoT)->cellAccessRelatedInfo_r13.cellIdentity_r13.buf[2] = (configuration->cell_identity >> 4) & 0xff;
(*sib1_NB_IoT)->cellAccessRelatedInfo_r13.cellIdentity_r13.buf[3] = (configuration->cell_identity << 4) & 0xf0;
#else
(*sib1_NB_IoT)->cellAccessRelatedInfo_r13.cellIdentity_r13.buf[0] = 0x00;
(*sib1_NB_IoT)->cellAccessRelatedInfo_r13.cellIdentity_r13.buf[1] = 0x00;
(*sib1_NB_IoT)->cellAccessRelatedInfo_r13.cellIdentity_r13.buf[2] = 0x00;
(*sib1_NB_IoT)->cellAccessRelatedInfo_r13.cellIdentity_r13.buf[3] = 0x10;
#endif
(*sib1_NB_IoT)->cellAccessRelatedInfo_r13.cellIdentity_r13.size=4;
(*sib1_NB_IoT)->cellAccessRelatedInfo_r13.cellIdentity_r13.bits_unused=4;
//Still set to "notBarred" as in the previous case
......@@ -264,11 +239,8 @@ uint8_t do_SIB1_NB_IoT(uint8_t Mod_id, int CC_id,
*((*sib1_NB_IoT)->p_Max_r13) = 23;
//FIXME
(*sib1_NB_IoT)->freqBandIndicator_r13 =
#if defined(ENABLE_ITTI)
configuration->eutra_band;
#else
5; //if not configured we use band 5 (UL: 824 MHz - 849MHz / DL: 869 MHz - 894 MHz FDD mode)
#endif
//OPTIONAL new parameters, to be used?
/*
* freqBandInfo_r13
......@@ -305,10 +277,8 @@ uint8_t do_SIB1_NB_IoT(uint8_t Mod_id, int CC_id,
ASN_SEQUENCE_ADD(&schedulingInfo_NB_IoT[0].sib_MappingInfo_r13.list,&sib_type_NB_IoT[0]);
ASN_SEQUENCE_ADD(&(*sib1_NB_IoT)->schedulingInfoList_r13.list,&schedulingInfo_NB_IoT[0]);
//printf("[ASN Debug] SI P: %ld\n",(*sib1_NB_IoT)->schedulingInfoList_r13.list.array[0]->si_Periodicity_r13);
#if defined(ENABLE_ITTI)
if (configuration->frame_type == TDD)
#endif
{
//FIXME in NB-IoT mandatory to be FDD --> so must give an error
LOG_E(RRC,"[NB-IoT %d] Frame Type is TDD --> not supported by NB-IoT, exiting\n", Mod_id); //correct?
......@@ -342,9 +312,7 @@ uint8_t do_SIB1_NB_IoT(uint8_t Mod_id, int CC_id,
enc_rval.failed_type->name, enc_rval.encoded);
}
#ifdef USER_MODE
LOG_D(RRC,"[NB-IoT] SystemInformationBlockType1-NB Encoded %zd bits (%zd bytes)\n",enc_rval.encoded,(enc_rval.encoded+7)/8);
#endif
if (enc_rval.encoded==-1) {
return(-1);
......@@ -563,10 +531,9 @@ uint8_t do_SIB23_NB_IoT(uint8_t Mod_id,
900);
// AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n",
// enc_rval.failed_type->name, enc_rval.encoded);
//#if defined(ENABLE_ITTI).....
#ifdef USER_MODE
LOG_D(RRC,"[NB-IoT] SystemInformation-NB Encoded %zd bits (%zd bytes)\n",enc_rval.encoded,(enc_rval.encoded+7)/8);
#endif
if (enc_rval.encoded==-1) {
msg("[RRC] ASN1 : SI-NB encoding failed for SIB23_NB_IoT\n");
......@@ -748,10 +715,8 @@ uint8_t do_RRCConnectionSetup_NB_IoT(
enc_rval.failed_type->name, enc_rval.encoded);
}
#ifdef USER_MODE
LOG_D(RRC,"RRCConnectionSetup-NB Encoded %zd bits (%zd bytes), ecause %d\n",
enc_rval.encoded,(enc_rval.encoded+7)/8,ecause);
#endif
LOG_D(RRC,"RRCConnectionSetup-NB Encoded %zd bits (%zd bytes)\n",
enc_rval.encoded,(enc_rval.encoded+7)/8);
return((enc_rval.encoded+7)/8);
}
......@@ -793,15 +758,11 @@ uint8_t do_SecurityModeCommand_NB_IoT(
enc_rval.failed_type->name, enc_rval.encoded);
}
//#if defined(ENABLE_ITTI)
//# if !defined(DISABLE_XER_SPRINT)....
#ifdef USER_MODE
LOG_D(RRC,"[NB-IoT %d] securityModeCommand-NB for UE %x Encoded %zd bits (%zd bytes)\n",
ctxt_pP->module_id,
ctxt_pP->rnti,
enc_rval.encoded,
(enc_rval.encoded+7)/8);
#endif
if (enc_rval.encoded==-1) {
LOG_E(RRC,"[NB-IoT %d] ASN1 : securityModeCommand-NB encoding failed for UE %x\n",
......@@ -850,15 +811,12 @@ uint8_t do_UECapabilityEnquiry_NB_IoT(
enc_rval.failed_type->name, enc_rval.encoded);
}
//#if defined(ENABLE_ITTI)
//# if !defined(DISABLE_XER_SPRINT)....
#ifdef USER_MODE
LOG_D(RRC,"[NB-IoT %d] UECapabilityEnquiry-NB for UE %x Encoded %zd bits (%zd bytes)\n",
ctxt_pP->module_id,
ctxt_pP->rnti,
enc_rval.encoded,
(enc_rval.encoded+7)/8);
#endif
if (enc_rval.encoded==-1) {
LOG_E(RRC,"[NB-IoT %d] ASN1 : UECapabilityEnquiry-NB encoding failed for UE %x\n",
......@@ -940,8 +898,6 @@ uint16_t do_RRCConnectionReconfiguration_NB_IoT(
xer_fprint(stdout,&asn_DEF_LTE_DL_DCCH_Message_NB,(void *)&dl_dcch_msg_NB_IoT);
}
//#if defined(ENABLE_ITTI)
//# if !defined(DISABLE_XER_SPRINT)...
LOG_I(RRC,"RRCConnectionReconfiguration-NB Encoded %zd bits (%zd bytes)\n",enc_rval.encoded,(enc_rval.encoded+7)/8);
return((enc_rval.encoded+7)/8);
}
......@@ -977,10 +933,8 @@ uint8_t do_RRCConnectionReestablishmentReject_NB_IoT(
}
//Only change in "asn_DEF_DL_CCCH_Message_NB"
#ifdef USER_MODE
LOG_D(RRC,"RRCConnectionReestablishmentReject Encoded %zd bits (%zd bytes)\n",
enc_rval.encoded,(enc_rval.encoded+7)/8);
#endif
return((enc_rval.encoded+7)/8);
}
......@@ -1025,10 +979,8 @@ uint8_t do_RRCConnectionReject_NB_IoT(
enc_rval.failed_type->name, enc_rval.encoded);
}
#ifdef USER_MODE
LOG_D(RRC,"RRCConnectionReject-NB Encoded %zd bits (%zd bytes)\n",
enc_rval.encoded,(enc_rval.encoded+7)/8);
#endif
return((enc_rval.encoded+7)/8);
}
......
......@@ -152,21 +152,15 @@ init_SI(
(int)configuration->N_RB_DL[CC_id]);
RC.rrc[ctxt_pP->module_id]->carrier[CC_id].MIB_FeMBMS = (uint8_t *) malloc16(4);
do_MIB_FeMBMS(&RC.rrc[ctxt_pP->module_id]->carrier[CC_id],
#ifdef ENABLE_ITTI
configuration->N_RB_DL[CC_id],
0 //additionalNonMBSFN
#else
50,0
#endif
,0);
0, //additionalNonMBSFN
0);
RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sizeof_SIB1_MBMS = 0;
RC.rrc[ctxt_pP->module_id]->carrier[CC_id].SIB1_MBMS = (uint8_t *) malloc16(32);
AssertFatal(RC.rrc[ctxt_pP->module_id]->carrier[CC_id].SIB1_MBMS!=NULL,PROTOCOL_RRC_CTXT_FMT" init_SI: FATAL, no memory for SIB1_MBMS allocated\n",
PROTOCOL_RRC_CTXT_ARGS(ctxt_pP));
RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sizeof_SIB1_MBMS = do_SIB1_MBMS(&RC.rrc[ctxt_pP->module_id]->carrier[CC_id],ctxt_pP->module_id,CC_id
#if defined(ENABLE_ITTI)
, configuration
#endif
RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sizeof_SIB1_MBMS = do_SIB1_MBMS(&RC.rrc[ctxt_pP->module_id]->carrier[CC_id],ctxt_pP->module_id,CC_id,
configuration
);
LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" Contents of SIB1-MBMS\n",
PROTOCOL_RRC_CTXT_ARGS(ctxt_pP)
......@@ -892,7 +886,6 @@ rrc_eNB_free_mem_UE_context(
//uint8_t Status;
//rnti_t rnti;
//uint64_t random_ue_identity;
#if defined(ENABLE_ITTI)
//UE_S_TMSI Initialue_identity_s_TMSI;
//EstablishmentCause_t establishment_cause;
//ReestablishmentCause_t reestablishment_cause;
......@@ -905,7 +898,6 @@ rrc_eNB_free_mem_UE_context(
//transport_layer_addr_t enb_gtp_addrs[S1AP_MAX_E_RAB];
//rb_id_t enb_gtp_ebi[S1AP_MAX_E_RAB];
#endif
#endif
}
//-----------------------------------------------------------------------------
......@@ -4758,7 +4750,6 @@ check_handovers(
if (ue_context_p->ue_context.Status == RRC_RECONFIGURED
&& ue_context_p->ue_context.handover_info != NULL &&
ue_context_p->ue_context.handover_info->forwarding_state == FORWARDING_NO_EMPTY ) {
#if defined(ENABLE_ITTI)
MessageDef *msg_p;
int result;
protocol_ctxt_t ctxt;
......@@ -4889,7 +4880,6 @@ check_handovers(
ue_context_p->ue_context.handover_info->endmark_state = ENDMARK_EMPTY;
ue_context_p->ue_context.handover_info->state = HO_FORWARDING_COMPLETE;
#endif
}
}
}
......@@ -5805,7 +5795,6 @@ rrc_eNB_generate_HO_RRCConnectionReconfiguration(const protocol_ctxt_t *const ct
securityConfigHO->handoverType.choice.intraLTE.securityAlgorithmConfig = NULL; /* TODO: to be checked */
securityConfigHO->handoverType.choice.intraLTE.keyChangeIndicator = 0;
securityConfigHO->handoverType.choice.intraLTE.nextHopChainingCount = 0;
#if defined(ENABLE_ITTI)
/* Initialize NAS list */
dedicatedInfoNASList = CALLOC(1, sizeof(struct LTE_RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList));
......@@ -5838,7 +5827,6 @@ rrc_eNB_generate_HO_RRCConnectionReconfiguration(const protocol_ctxt_t *const ct
dedicatedInfoNASList = NULL;
}
#endif
measurements_enabled = RC.rrc[ENB_INSTANCE_TO_MODULE_ID(ctxt_pP->instance)]->configuration.enable_x2 ||
RC.rrc[ENB_INSTANCE_TO_MODULE_ID(ctxt_pP->instance)]->configuration.enable_measurement_reports;
memset(buffer, 0, RRC_BUF_SIZE);
......@@ -5887,7 +5875,6 @@ rrc_eNB_generate_HO_RRCConnectionReconfiguration(const protocol_ctxt_t *const ct
*_size = size = ho_size;
LOG_DUMPMSG(RRC,DEBUG_RRC,(char *)buffer,size,
"[MSG] RRC Connection Reconfiguration handover\n");
#if defined(ENABLE_ITTI)
/* Free all NAS PDUs */
for (i = 0; i < ue_context_pP->ue_context.nb_of_e_rabs; i++) {
......@@ -5897,8 +5884,6 @@ rrc_eNB_generate_HO_RRCConnectionReconfiguration(const protocol_ctxt_t *const ct
ue_context_pP->ue_context.e_rab[i].param.nas_pdu.buffer = NULL;
}
}
#endif
LOG_I(RRC,
"[eNB %d] Frame %d, Logical Channel DL-DCCH, Generate RRCConnectionReconfiguration handover (bytes %d, UE id %x)\n",
ctxt_pP->module_id, ctxt_pP->frame, size, ue_context_pP->ue_context.rnti);
......
......@@ -27,7 +27,6 @@
* \email: lionel.gauthier@eurecom.fr
*/
//#if defined(ENABLE_USE_MME)
# include "rrc_defs.h"
# include "rrc_extern.h"
# include "RRC/LTE/MESSAGES/asn1_msg.h"
......@@ -35,10 +34,10 @@
# include "rrc_eNB_UE_context.h"
# include "msc.h"
//# if defined(ENABLE_ITTI)
# include "asn1_conversions.h"
# include "intertask_interface.h"
//#endif
#include "asn1_conversions.h"
#include "intertask_interface.h"
# include "common/ran_context.h"
......@@ -113,7 +112,6 @@ gtpv_data_req(
return FALSE;
}
LOG_D(GTPU,"gtpv_data_req ue rnti %x sdu_sizeP %d rb id %ld", ctxt_pP->rnti, sdu_sizeP, rb_idP);
#if defined(ENABLE_ITTI)
{
MessageDef *message_p;
// Uses a new buffer to avoid issue with PDCP buffer content that could be changed by PDCP (asynchronous message handling).
......@@ -167,8 +165,6 @@ gtpv_data_req(
return TRUE; // TODO should be changed to a CNF message later, currently RRC lite does not used the returned value anyway.
}
}
#endif
return TRUE;
}
......
......@@ -58,7 +58,7 @@
#include "TLVDecoder.h"
#include "S1AP_NAS-PDU.h"
#include "flexran_agent_common_internal.h"
#include "executables/softmodem-common.h"
extern RAN_CONTEXT_t RC;
extern int
......@@ -540,9 +540,10 @@ rrc_pdcp_config_security(
derive_key_rrc_int(ue_context_pP->ue_context.integrity_algorithm,
ue_context_pP->ue_context.kenb,
&kRRCint);
#if !defined(USRP_REC_PLAY)
if (!IS_SOFTMODEM_IQPLAYER) {
SET_LOG_DUMP(DEBUG_SECURITY) ;
#endif
}
if ( LOG_DUMPFLAG( DEBUG_SECURITY ) ) {
if (print_keys ==1 ) {
......
......@@ -36,9 +36,7 @@
#include "msc.h"
#include "common/ran_context.h"
#if defined(ENABLE_ITTI)
# include "intertask_interface.h"
#endif
#include "intertask_interface.h"
#include "NR_MIB.h"
#include "NR_BCCH-BCH-Message.h"
......
......@@ -99,9 +99,7 @@
#include "gnb_config.h"
#endif
#if defined(ENABLE_ITTI)
#include "intertask_interface.h"
#endif
#include "intertask_interface.h"
#include "common/ran_context.h"
......@@ -289,23 +287,18 @@ uint8_t do_MIB_NR(rrc_gNB_carrier_data_t *carrier,
}
uint8_t do_SIB1_NR(rrc_gNB_carrier_data_t *carrier
#if defined(ENABLE_ITTI)
, gNB_RrcConfigurationReq *configuration
#endif
uint8_t do_SIB1_NR(rrc_gNB_carrier_data_t *carrier,
gNB_RrcConfigurationReq *configuration
) {
asn_enc_rval_t enc_rval;
NR_BCCH_DL_SCH_Message_t *sib1_message ;
struct NR_SIB1 *sib1 ;
int i;
struct NR_PLMN_IdentityInfo nr_plmn_info;
#if defined(ENABLE_ITTI)
// TODO : Add support for more than one PLMN
//int num_plmn = configuration->num_plmn;
int num_plmn = 1;
#else
int num_plmn = 1;
#endif
struct NR_PLMN_Identity nr_plmn[num_plmn];
NR_MCC_MNC_Digit_t nr_mcc_digit[num_plmn][3];
NR_MCC_MNC_Digit_t nr_mnc_digit[num_plmn][3];
......@@ -329,30 +322,18 @@ uint8_t do_SIB1_NR(rrc_gNB_carrier_data_t *carrier
memset(nr_plmn,0,num_plmn*sizeof(struct NR_PLMN_Identity));
for (i = 0; i < num_plmn; ++i) {
#ifdef ENABLE_ITTI
nr_mcc_digit[i][0] = (configuration->mcc[i]/100)%10;
nr_mcc_digit[i][1] = (configuration->mcc[i]/10)%10;
nr_mcc_digit[i][2] = (configuration->mcc[i])%10;
#else
nr_mcc_digit[i][0] = 0;
nr_mcc_digit[i][1] = 0;
nr_mcc_digit[i][2] = 1;
#endif
nr_plmn[i].mcc = CALLOC(1,sizeof(struct NR_MCC));
memset(nr_plmn[i].mcc,0,sizeof(struct NR_MCC));
asn_set_empty(&nr_plmn[i].mcc->list);
ASN_SEQUENCE_ADD(&nr_plmn[i].mcc->list, &nr_mcc_digit[i][0]);
ASN_SEQUENCE_ADD(&nr_plmn[i].mcc->list, &nr_mcc_digit[i][1]);
ASN_SEQUENCE_ADD(&nr_plmn[i].mcc->list, &nr_mcc_digit[i][2]);
#ifdef ENABLE_ITTI
nr_mnc_digit[i][0] = (configuration->mnc[i]/100)%10;
nr_mnc_digit[i][1] = (configuration->mnc[i]/10)%10;
nr_mnc_digit[i][2] = (configuration->mnc[i])%10;
#else
nr_mnc_digit[i][0] = 0;
nr_mnc_digit[i][1] = 0;
nr_mnc_digit[i][2] = 1;
#endif
memset(&nr_plmn[i].mnc,0,sizeof(NR_MNC_t));
nr_plmn[i].mnc.list.size=0;
nr_plmn[i].mnc.list.count=0;
......@@ -364,17 +345,10 @@ uint8_t do_SIB1_NR(rrc_gNB_carrier_data_t *carrier
nr_plmn_info.cellIdentity.buf = MALLOC(8);
memset(nr_plmn_info.cellIdentity.buf,0,8);
#ifdef ENABLE_ITTI
nr_plmn_info.cellIdentity.buf[0]= (configuration->cell_identity >> 20) & 0xff;
nr_plmn_info.cellIdentity.buf[1]= (configuration->cell_identity >> 12) & 0xff;
nr_plmn_info.cellIdentity.buf[2]= (configuration->cell_identity >> 4) & 0xff;
nr_plmn_info.cellIdentity.buf[3]= (configuration->cell_identity << 4) & 0xff;
#else
nr_plmn_info.cellIdentity.buf[0]= 0x00;
nr_plmn_info.cellIdentity.buf[1]= 0x00;
nr_plmn_info.cellIdentity.buf[2]= 0x00;
nr_plmn_info.cellIdentity.buf[3]= 0x10;
#endif
nr_plmn_info.cellIdentity.size= 4;
nr_plmn_info.cellIdentity.bits_unused= 4;
nr_plmn_info.cellReservedForOperatorUse = 0;
......@@ -410,9 +384,7 @@ uint8_t do_SIB1_NR(rrc_gNB_carrier_data_t *carrier
void do_SERVINGCELLCONFIGCOMMON(uint8_t Mod_id,
int CC_id,
#if defined(ENABLE_ITTI)
gNB_RrcConfigurationReq *configuration,
#endif
gNB_RrcConfigurationReq *configuration,
int initial_flag
) {
NR_ServingCellConfigCommon_t **servingcellconfigcommon = &RC.nrrrc[Mod_id]->carrier[CC_id].servingcellconfigcommon;
......@@ -1143,17 +1115,13 @@ void do_SpCellConfig(uint8_t Mod_id,
common_configuration = CALLOC(1,sizeof(gNB_RrcConfigurationReq));
//Fill servingcellconfigcommon config value
rrc_config_servingcellconfigcommon(Mod_id,
CC_id
#if defined(ENABLE_ITTI)
,common_configuration
#endif
CC_id,
common_configuration
);
//Fill common config to structure
do_SERVINGCELLCONFIGCOMMON(Mod_id,
CC_id,
#if defined(ENABLE_ITTI)
common_configuration,
#endif
0
);
spconfig->reconfigurationWithSync = CALLOC(1,sizeof(struct NR_ReconfigurationWithSync));
......
......@@ -76,17 +76,13 @@ uint8_t do_MIB_NR(rrc_gNB_carrier_data_t *carrier,
@param carrier pointer to Carrier information
@param configuration Pointer Configuration Request structure
@return size of encoded bit stream in bytes*/
uint8_t do_SIB1_NR(rrc_gNB_carrier_data_t *carrier
#if defined(ENABLE_ITTI)
, gNB_RrcConfigurationReq *configuration
#endif
uint8_t do_SIB1_NR(rrc_gNB_carrier_data_t *carrier,
gNB_RrcConfigurationReq *configuration
);
void do_SERVINGCELLCONFIGCOMMON(uint8_t Mod_id,
int CC_id,
#if defined(ENABLE_ITTI)
gNB_RrcConfigurationReq *configuration,
#endif
int initial_flag);
void do_RLC_BEARER(uint8_t Mod_id,
......
......@@ -31,10 +31,8 @@
#include "nr_rrc_config.h"
void rrc_config_servingcellconfigcommon(uint8_t Mod_id,
int CC_id
#if defined(ENABLE_ITTI)
,gNB_RrcConfigurationReq *common_configuration
#endif
int CC_id,
gNB_RrcConfigurationReq *common_configuration
){
common_configuration->MIB_subCarrierSpacingCommon[CC_id] = 0;
......@@ -259,4 +257,4 @@ void rrc_config_rachdedicated(uint8_t Mod_id,
physicalcellgroup_t *physicalcellgroup_config
){
}
\ No newline at end of file
}
......@@ -117,10 +117,8 @@ typedef struct rach_dedicated_s{
}rach_dedicated_t;
void rrc_config_servingcellconfigcommon(uint8_t Mod_id,
int CC_id
#if defined(ENABLE_ITTI)
,gNB_RrcConfigurationReq *common_configuration
#endif
int CC_id,
gNB_RrcConfigurationReq *common_configuration
);
void rrc_config_rlc_bearer(uint8_t Mod_id,
......@@ -138,4 +136,4 @@ void rrc_config_physicalcellgroup(uint8_t Mod_id,
physicalcellgroup_t *physicalcellgroup_config
);
#endif
\ No newline at end of file
#endif
......@@ -72,21 +72,15 @@
#include "NR_EstablishmentCause.h"
//-------------------
#if defined(ENABLE_ITTI)
#include "intertask_interface.h"
#endif
#include "intertask_interface.h"
/* TODO: be sure this include is correct.
* It solves a problem of compilation of the RRH GW,
* issue #186.
*/
#if !defined(ENABLE_ITTI)
#include "as_message.h"
#endif
#if defined(ENABLE_USE_MME)
#include "commonDef.h"
#endif
/*I will change the name of the structure for compile purposes--> hope not to undo this process*/
......@@ -295,7 +289,6 @@ typedef struct gNB_RRC_UE_s {
rnti_t rnti;
uint64_t random_ue_identity;
#if defined(ENABLE_ITTI)
/* Information from UE RRC ConnectionRequest */
UE_S_TMSI Initialue_identity_s_TMSI;
NR_EstablishmentCause_t establishment_cause;
......@@ -328,7 +321,6 @@ typedef struct gNB_RRC_UE_s {
uint32_t enb_gtp_teid[S1AP_MAX_E_RAB];
transport_layer_addr_t enb_gtp_addrs[S1AP_MAX_E_RAB];
rb_id_t enb_gtp_ebi[S1AP_MAX_E_RAB];
#endif
uint32_t ul_failure_timer;
uint32_t ue_release_timer;
uint32_t ue_release_timer_thres;
......@@ -420,9 +412,7 @@ typedef struct gNB_RRC_INST_s {
hash_table_t *s1ap_id2_s1ap_ids ; // key is content is rrc_ue_s1ap_ids_t
//RRC configuration
#if defined(ENABLE_ITTI)
gNB_RrcConfigurationReq configuration;//rrc_messages_types.h
#endif
// other PLMN parameters
/// Mobile country code
......
......@@ -58,9 +58,7 @@ void rrc_gNB_generate_SgNBAdditionRequestAcknowledge(
);
#if defined(ENABLE_ITTI)
/**\brief RRC eNB task.
\param void *args_p Pointer on arguments to start the task. */
void *rrc_gnb_task(void *args_p);
#endif
\ No newline at end of file
......@@ -67,21 +67,15 @@
#include "UTIL/OSA/osa_defs.h"
#endif
#if defined(ENABLE_USE_MME)
#include "rrc_eNB_S1AP.h"
#include "rrc_eNB_GTPV1U.h"
#if defined(ENABLE_ITTI)
#else
#include "../../S1AP/s1ap_eNB.h"
#endif
#endif
#include "rrc_eNB_S1AP.h"
#include "rrc_eNB_GTPV1U.h"
#include "pdcp.h"
#include "gtpv1u_eNB_task.h"
#if defined(ENABLE_ITTI)
#include "intertask_interface.h"
#endif
#include "intertask_interface.h"
#if ENABLE_RAL
#include "rrc_eNB_ral.h"
......@@ -200,11 +194,9 @@ void rrc_gNB_generate_SgNBAdditionRequestAcknowledge(
///---------------------------------------------------------------------------------------------------------------///
static void init_NR_SI(const protocol_ctxt_t *const ctxt_pP,
const int CC_id
#if defined(ENABLE_ITTI)
,
gNB_RrcConfigurationReq *configuration
#endif
const int CC_id,
gNB_RrcConfigurationReq *configuration
) {
//int i;
LOG_D(RRC,"%s()\n\n\n\n",__FUNCTION__);
......@@ -219,20 +211,14 @@ static void init_NR_SI(const protocol_ctxt_t *const ctxt_pP,
RC.nrrrc[ctxt_pP->module_id]->carrier[CC_id].sizeof_MIB = 0;
RC.nrrrc[ctxt_pP->module_id]->carrier[CC_id].MIB = (uint8_t *) malloc16(4);
RC.nrrrc[ctxt_pP->module_id]->carrier[CC_id].sizeof_MIB = do_MIB_NR(&RC.nrrrc[ctxt_pP->module_id]->carrier[CC_id],0,
#ifdef ENABLE_ITTI
configuration->MIB_ssb_SubcarrierOffset[CC_id],
configuration->pdcch_ConfigSIB1[CC_id],
configuration->MIB_subCarrierSpacingCommon[CC_id],
configuration->MIB_dmrs_TypeA_Position[CC_id]
#else
0,0,15,2
#endif
configuration->MIB_ssb_SubcarrierOffset[CC_id],
configuration->pdcch_ConfigSIB1[CC_id],
configuration->MIB_subCarrierSpacingCommon[CC_id],
configuration->MIB_dmrs_TypeA_Position[CC_id]
);
do_SERVINGCELLCONFIGCOMMON(ctxt_pP->module_id,
CC_id,
#if defined(ENABLE_ITTI)
configuration,
#endif
1
);
LOG_I(NR_RRC,"Done init_NR_SI\n");
......@@ -268,9 +254,8 @@ char openair_rrc_gNB_configuration(const module_id_t gnb_mod_idP, gNB_RrcConfigu
#endif
AssertFatal(RC.nrrrc[gnb_mod_idP] != NULL, "RC.nrrrc not initialized!");
AssertFatal(NUMBER_OF_UE_MAX < (module_id_t)0xFFFFFFFFFFFFFFFF, " variable overflow");
#ifdef ENABLE_ITTI
AssertFatal(configuration!=NULL,"configuration input is null\n");
#endif
RC.nrrrc[ctxt.module_id]->Nb_ue = 0;
for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) {
......@@ -287,10 +272,8 @@ char openair_rrc_gNB_configuration(const module_id_t gnb_mod_idP, gNB_RrcConfigu
for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) {
init_NR_SI(&ctxt,
CC_id
#if defined(ENABLE_ITTI)
,configuration
#endif
CC_id,
configuration
);
}//END for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++)
......@@ -302,7 +285,7 @@ char openair_rrc_gNB_configuration(const module_id_t gnb_mod_idP, gNB_RrcConfigu
///---------------------------------------------------------------------------------------------------------------///
///---------------------------------------------------------------------------------------------------------------///
#if defined(ENABLE_ITTI)
void *rrc_gnb_task(void *args_p) {
MessageDef *msg_p;
......@@ -408,4 +391,3 @@ void *rrc_gnb_task(void *args_p) {
}
}
#endif //END #if defined(ENABLE_ITTI)
This diff is collapsed.
......@@ -43,13 +43,7 @@ Description Timer utilities
#include <string.h> // memset
#include <stdlib.h> // malloc, free
#include <sys/time.h> // setitimer
#if defined(ENABLE_ITTI)
# include "intertask_interface.h"
#else
# include <signal.h>
# include <time.h> // clock_gettime
#endif
#include "intertask_interface.h"
#include "nas_timer.h"
#include "commonDef.h"
#include "msc.h"
......@@ -69,11 +63,7 @@ Description Timer utilities
* value when the timer entry was allocated.
*/
typedef struct {
#if defined(ENABLE_ITTI)
long timer_id; /* Timer id returned by the timer API from ITTI */
#else
pthread_t pid; /* Thread identifier of the callback */
#endif
long timer_id; /* Timer id returned by the timer API from ITTI */
struct timeval itv; /* Initial interval timer value */
struct timeval tv; /* Interval timer value */
......@@ -105,10 +95,6 @@ typedef struct {
#define TIMER_DATABASE_SIZE 256
timer_queue_t tq[TIMER_DATABASE_SIZE];
timer_queue_t *head;/* Pointer to the first timer entry to be fired */
#if !defined(ENABLE_ITTI)
pthread_mutex_t mutex;
#endif
} nas_timer_database_t;
/*
......@@ -118,25 +104,15 @@ static nas_timer_database_t _nas_timer_db = {
0,
{},
NULL
#if !defined(ENABLE_ITTI)
, PTHREAD_MUTEX_INITIALIZER
#endif
};
#if defined(ENABLE_ITTI)
#define nas_timer_lock_db()
#define nas_timer_unlock_db()
#else
#define nas_timer_lock_db() pthread_mutex_lock(&_nas_timer_db.mutex)
#define nas_timer_unlock_db() pthread_mutex_unlock(&_nas_timer_db.mutex)
#endif
/*
* The handler executed whenever the system timer expires
*/
#if !defined(ENABLE_ITTI)
static void _nas_timer_handler(int signal);
#endif
/*
* -----------------------------------------------------------------------------
......@@ -191,33 +167,6 @@ int nas_timer_init(void)
/* Initialize the timer database */
_nas_timer_db_init();
#if !defined(ENABLE_ITTI)
/* Setup the timer database handler */
struct sigaction act;
(void) memset (&act, 0, sizeof (act));
(void) sigfillset (&act.sa_mask);
(void) sigdelset (&act.sa_mask, SIGHUP);
(void) sigdelset (&act.sa_mask, SIGINT);
(void) sigdelset (&act.sa_mask, SIGTERM);
(void) sigdelset (&act.sa_mask, SIGILL);
(void) sigdelset (&act.sa_mask, SIGTRAP);
(void) sigdelset (&act.sa_mask, SIGIOT);
# ifndef LINUX
(void) sigdelset (&act.sa_mask, SIGEMT);
# endif
(void) sigdelset (&act.sa_mask, SIGFPE);
(void) sigdelset (&act.sa_mask, SIGBUS);
(void) sigdelset (&act.sa_mask, SIGSEGV);
(void) sigdelset (&act.sa_mask, SIGSYS);
act.sa_handler = _nas_timer_handler;
if ( sigaction (SIGALRM, &act, 0) < 0 ) {
return (RETURNerror);
}
#endif
return (RETURNok);
}
......@@ -243,10 +192,8 @@ int nas_timer_start(long sec, nas_timer_callback_t cb, void *args)
{
int id;
nas_timer_entry_t *te;
#if defined(ENABLE_ITTI)
int ret;
long timer_id;
#endif
/* Do not start null timer */
if (sec == 0) {
......@@ -270,7 +217,6 @@ int nas_timer_start(long sec, nas_timer_callback_t cb, void *args)
/* Insert the new entry into the timer queue */
_nas_timer_db_insert_entry(id, te);
#if defined(ENABLE_ITTI)
# if defined(NAS_MME)
ret = timer_setup(sec, 0, TASK_NAS_MME, INSTANCE_DEFAULT, TIMER_PERIODIC, args, &timer_id);
# else
......@@ -280,10 +226,7 @@ int nas_timer_start(long sec, nas_timer_callback_t cb, void *args)
if (ret == -1) {
return NAS_TIMER_INACTIVE_ID;
}
te->timer_id = timer_id;
#endif
return (id);
}
......@@ -309,11 +252,7 @@ int nas_timer_stop(int id)
nas_timer_entry_t *entry;
/* Remove the entry from the timer queue */
entry = _nas_timer_db_remove_entry(id);
#if defined(ENABLE_ITTI)
timer_remove(entry->timer_id);
#else
(void)entry;
#endif
/* Delete the timer entry */
_nas_timer_db_delete_entry(id);
return (NAS_TIMER_INACTIVE_ID);
......@@ -380,7 +319,7 @@ int nas_timer_restart(int id)
** Others: _nas_timer_db **
** **
***************************************************************************/
#if defined(ENABLE_ITTI)
void nas_timer_handle_signal_expiry(long timer_id, void *arg_p)
{
/* Get the timer entry for which the system timer expired */
......@@ -388,25 +327,7 @@ void nas_timer_handle_signal_expiry(long timer_id, void *arg_p)
te->cb(te->args);
}
#else
static void _nas_timer_handler(int signal)
{
/* At least one timer has been started */
assert( (_nas_timer_db.head != NULL) && (_nas_timer_db.head->entry != NULL) );
/* Get the timer entry for which the system timer expired */
nas_timer_entry_t *te = _nas_timer_db.head->entry;
threadCreate (&te->pid, te->cb, te->args, "nas-timer", -1, OAI_PRIORITY_RT_LOW);
void *result = NULL;
(void) pthread_join(te->pid, &result);
if (result) {
free(result);
}
}
#endif
/*
* -----------------------------------------------------------------------------
......@@ -605,17 +526,7 @@ static void _nas_timer_db_insert_entry(int id, nas_timer_entry_t *te)
restart = _nas_timer_db_insert(&_nas_timer_db.tq[id]);
nas_timer_unlock_db();
#if !defined(ENABLE_ITTI)
if (restart) {
/* The new entry is the first entry of the list;
* restart the system timer */
setitimer(ITIMER_REAL, &it, 0);
}
#else
(void)(restart);
#endif
}
static int _nas_timer_db_insert(timer_queue_t *entry)
......@@ -704,21 +615,8 @@ static nas_timer_entry_t *_nas_timer_db_remove_entry(int id)
tv.tv_usec = ts.tv_nsec/1000;
/* tv = tv - time() */
rc = _nas_timer_sub(&_nas_timer_db.head->entry->tv, &tv, &it.it_value);
#if defined(ENABLE_ITTI)
timer_remove(_nas_timer_db.head->entry->timer_id);
(void) (rc);
#else
if (rc < 0) {
/* The system timer should have already expired */
_nas_timer_handler(SIGALRM);
} else {
/* Restart the system timer */
setitimer(ITIMER_REAL, &it, 0);
}
#endif
}
/* Return a pointer to the removed entry */
......@@ -749,17 +647,6 @@ static int _nas_timer_db_remove(timer_queue_t *entry)
/* Other timers are scheduled to expire */
return TRUE;
}
#if !defined(ENABLE_ITTI)
{
/* No more timer is scheduled to expire; stop the system timer */
struct itimerval it;
it.it_interval.tv_sec = it.it_interval.tv_usec = 0;
it.it_value.tv_sec = it.it_value.tv_usec = 0;
setitimer(ITIMER_REAL, &it, 0);
return FALSE;
}
#endif
}
/* The entry was NOT the first entry of the list */
......
......@@ -107,7 +107,7 @@ void* socket_udp_open(int type, const char* host, const char* port)
{
struct addrinfo socket_info; /* endpoint information */
struct addrinfo *socket_addr, *sp; /* endpoint address */
int sfd; /* socket file descriptor */
int sfd=-1; /* socket file descriptor */
/*
* Parameters sanity check
......
......@@ -80,7 +80,6 @@ bool parse_plmn_param(config_setting_t *plmn_setting, plmn_conf_param_t *conf) {
bool parse_plmns(config_setting_t *all_plmn_setting, networks_t *networks) {
config_setting_t *plmn_setting = NULL;
char plmn[10];
int size = 0;
size = config_setting_length(all_plmn_setting);
......@@ -93,6 +92,7 @@ bool parse_plmns(config_setting_t *all_plmn_setting, networks_t *networks) {
for (int i = 0; i < networks->size; i++) {
network_t *network = &networks->items[i];
char plmn[100];
sprintf(plmn, "%s%d", PLMN, i);
plmn_setting = config_setting_get_member(all_plmn_setting, plmn);
if (plmn_setting == NULL) {
......
......@@ -13,7 +13,6 @@ bool parse_config_file(const char *output_dir, const char *conf_filename, int ou
config_setting_t *root_setting = NULL;
config_setting_t *ue_setting = NULL;
config_setting_t *all_plmn_setting = NULL;
char user[10];
config_t cfg;
networks_t networks;;
......@@ -47,6 +46,7 @@ bool parse_config_file(const char *output_dir, const char *conf_filename, int ou
user_plmns_t user_plmns;
char user[100];
sprintf(user, "%s%d", UE, i);
ue_setting = config_setting_get_member(root_setting, user);
......
......@@ -61,9 +61,7 @@ Description Defines the PDN connectivity ESM procedure executed by the
#include "emm_sap.h"
#if defined(ENABLE_ITTI)
# include "assertions.h"
#endif
/****************************************************************************/
/**************** E X T E R N A L D E F I N I T I O N S ****************/
......
......@@ -20,7 +20,6 @@
*/
#include "utils.h"
#if defined(ENABLE_ITTI)
# include "assertions.h"
# include "intertask_interface.h"
# include "nas_ue_task.h"
......@@ -301,4 +300,3 @@ char *make_port_str_from_ueid(const char *base_port_str, int ueid) {
return itoa(port);
}
#endif
......@@ -33,8 +33,6 @@ typedef struct {
nas_user_t *find_user_from_fd(nas_user_container_t *users, int fd);
# if defined(ENABLE_ITTI)
void *nas_ue_task(void *args_p);
# endif
#endif /* NAS_TASK_H_ */
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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