Merge branch 'episys/master' into episys-merge

Conflicts:
	common/utils/LOG/log.h
	common/utils/ocp_itti/intertask_interface.cpp
	nfapi/oai_integration/nfapi_vnf.c
	nfapi/open-nFAPI/nfapi/src/nfapi.c
	openair2/LAYER2/MAC/main_ue.c
	openair2/LAYER2/PDCP_v10.1.0/pdcp.c
	openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c
	openair2/PHY_INTERFACE/phy_stub_UE.c
	openair2/RRC/LTE/rrc_UE.c
	openair2/RRC/LTE/rrc_eNB.c
	openair3/NAS/UE/ESM/esm_ebr_context.c
	targets/COMMON/openairinterface5g_limits.h
	targets/RT/USER/lte-softmodem.c
	targets/RT/USER/lte-uesoftmodem.c
This commit is contained in:
Raymond Knopp
2021-02-13 22:52:33 +01:00
65 changed files with 3640 additions and 726 deletions
+8 -5
View File
@@ -8,14 +8,17 @@
"name": "(gdb) Launch",
"type": "cppdbg",
"request": "launch",
"program": "enter program name, for example ${workspaceFolder}/a.exe",
"args": [],
"program": "${workspaceFolder}/cmake_targets/ran_build/build/lte-softmodem",
"args": [
"-O", "../ci-scripts/conf_files/rcc.band7.tm1.nfapi.conf",
"--noS1"
],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"cwd": "${workspaceFolder}/cmake_targets",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"miDebuggerPath": "/path/to/gdb",
"miDebuggerPath": "${workspaceFolder}/cmake_targets/sudo-gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
@@ -25,4 +28,4 @@
]
}
]
}
}
+25 -10
View File
@@ -1,15 +1,30 @@
# OpenAirInterface License #
# Description #
The purpose of this repository is to provide an updated version of the original OAI code base. The original code base can be found here: https://gitlab.eurecom.fr/oai/openairinterface5g. The updates to the OAI code base removed some latent bugs, added multi-UE scalability, and were tested with a standard bypass proxy between the UE(s) and eNB. The proxy is available at: https://github.com/EpiSci/oai-lte-multi-ue-proxy. With this package, various multi-UE scenarios can be tested without the overhead of PHY-layer features of underlying radios. This proxy was created to allow users to test and utilize EpiSci's updated version of the OAI code.
### Where this all began: ###
OAI code was used to baseline this work. The initial framework for this development was started from the following commit: https://gitlab.eurecom.fr/oai/openairinterface5g/-/commit/362da7c9205691a7314de56bbe8ec369f636da7b.
OpenAirInterface is under OpenAirInterface Software Alliance license.
### Included Fixes: ###
- Ease of use of gprof and address sanitizer for debugging purposes
- Updated json files to allow for GDB, real-time debugging capabilities
- Updated logging features to minimally log only key connection milestones. This imroves scalability of multiple UEs.
- Updated logging to include time stamp for timing analysis
- Updated memory allocation procedures to correct size requirements
- Added debugging features to handle signal terminations
- nfapi.c pullarray8 fix invalid pointer math
- Overlapping destination and source memory in memcpy, so updated to memmove to check for this bug
- Advanced error checking mechanisms in critical pack and unpack functions
- Created option for CPU assignment to UE to improve scalability
- Added EPC integration to allow multiple individual UE entities to each have their USIM information parced by the executables
- Updated random value seeds to minimize probability of error in generation of random values
- Enables capability round robin scheduler if desired
- Enables capability real time scheduler if desired
- Added new standalone functions to the UE phy-layer (phy_stub_ue.c) to incorporate individual UE entities
- Updated sending and packing functions in UE (lte_ue.c) to incorporate new standalone changes
- Incorporated semaphores to control timing of incoming downlink packets
- Implemented new queuing system to handle message exchange from UE to eNB and vice versa
- Updated global value in nFAPI for size of subframe
- Updated global value to increase scalability in system
* [OAI License Model](http://www.openairinterface.org/?page_id=101)
* [OAI License v1.1 on our website](http://www.openairinterface.org/?page_id=698)
It is distributed under **OAI Public License V1.1**.
The license information is distributed under [LICENSE](LICENSE) file in the same directory.
Please see [NOTICE](NOTICE.md) file for third party software that is included in the sources.
# Where to Start #
@@ -206,15 +206,16 @@ eNBs =
MACRLCs = (
{
num_cc = 1;
local_s_if_name = "ens3";
remote_s_address = "CI_UE_IP_ADDR";
local_s_address = "CI_ENB_IP_ADDR";
local_s_if_name = "lo";
remote_s_address = "127.0.0.1";
local_s_address = "127.0.0.1";
local_s_portc = 50001;
remote_s_portc = 50000;
local_s_portd = 50011;
remote_s_portd = 50010;
tr_s_preference = "nfapi";
tr_n_preference = "local_RRC";
scheduler_mode = "fairRR";
}
);
+3 -3
View File
@@ -20,9 +20,9 @@ L1s = (
{
num_cc = 1;
tr_n_preference = "nfapi";
local_n_if_name = "ens3";
remote_n_address = "CI_ENB_IP_ADDR";
local_n_address = "CI_UE_IP_ADDR";
local_n_if_name = "lo";
remote_n_address = "127.0.0.1";
local_n_address = "127.0.0.1";
local_n_portc = 50000;
remote_n_portc = 50001;
local_n_portd = 50010;
+5
View File
@@ -0,0 +1,5 @@
/.ue.nvram0
/.ue_emm.nvram0
/.usim.nvram0
/nvram
/usim
+9
View File
@@ -333,6 +333,14 @@ else (CUDA_FOUND)
)
endif ()
# Uncomment these lines to enable the address sanitizer
#set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address")
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address")
# Uncomment these lines to enable gprof profiling
#set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pg -DUSING_GPROF")
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pg -DUSING_GPROF")
add_definitions("-DASN_DISABLE_OER_SUPPORT")
#########################
@@ -2095,6 +2103,7 @@ set (MAC_NR_SRC
set (MAC_SRC_UE
${PHY_INTERFACE_DIR}/phy_stub_UE.c
${PHY_INTERFACE_DIR}/queue.c
${MAC_DIR}/main_ue.c
${MAC_DIR}/ue_procedures.c
${MAC_DIR}/ra_procedures.c
+13
View File
@@ -0,0 +1,13 @@
#!/bin/bash
cd "$(dirname "$0")/.." || exit
source oaienv
cd cmake_targets || exit
cmd=(
./ran_build/build/lte-softmodem
-O ../ci-scripts/conf_files/rcc.band7.tm1.nfapi.conf
--noS1
"$@"
)
exec sudo -E gdb "$@" --args "${cmd[@]}"
+83
View File
@@ -0,0 +1,83 @@
-------------------------------------------------------------------------------
Build.
Make sure you've built with debug info:
cd ~/openairinterface5g # or wherever
source oaienv
cd cmake_targets
./build_oai --UE --eNB --verbose-compile --run-with-gdb RelWithDebInfo
make -C ran_build/build -j4 lte-softmodem lte-uesoftmodem
-------------------------------------------------------------------------------
Verify.
Verify the build was done correctly:
$ ./gdb-helper
...
Reading symbols from ./ran_build/build/lte-softmodem...done.
(gdb) b main
Breakpoint 1 at 0x59f110: file /local/episys/openairinterface5g/targets/RT/USER/lte-softmodem.c, line 516.
(gdb) run
Starting program: /local/episys/openairinterface5g/cmake_targets/ran_build/build/lte-softmodem -O ../ci-scripts/conf_files/rcc.band7.tm1.nfapi.conf --noS1
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Breakpoint 1, main (argc=4, argv=0x7fffffffe058) at /local/episys/openairinterface5g/targets/RT/USER/lte-softmodem.c:516
516 {
(gdb) list
511 pthread_mutex_unlock(&nfapi_sync_mutex);
512 printf( "NFAPI: got sync (%s)\n", thread_name);
513 }
514
515 int main ( int argc, char **argv )
516 {
517 struct sched_param param =
518 {
519 .sched_priority = 79
520 };
(gdb) n
521 if (sched_setscheduler( 0, SCHED_RR, &param ) == -1 )
(gdb) quit
A debugging session is active.
Inferior 1 [process 19964] will be killed.
Quit anyway? (y or n) y
$
If gdb says "no debugging symbols found" then clean your workspace and re-do
the build as above.
(gdb) b main
-------------------------------------------------------------------------------
Password-less sudo.
Vscode launches lte-softmodem via sudo. Make sure sudo does not prompt you
for a password:
sudo -n id
If that command fails, do the following:
echo "$USER ALL=(ALL) NOPASSWD: ALL" | sudo tee -a /etc/sudoers
Then verify:
sudo -n id
-------------------------------------------------------------------------------
Vscode.
Launch Vscode:
cd ~/openairinterface5g # or wherever
code . targets/RT/USER/lte-softmodem.c .vscode/launch.json
See launch.json for details about how vscode launches lte-softmodem for debugging.
For example, in lte-softmodem.c, scroll to main() and click the line number to
the left of main to add a breakpoint. then do Run => Start debugging (F5) to
run lte-softmodem in the debugger
+6
View File
@@ -0,0 +1,6 @@
#!/bin/bash
# Helper script for Vscode. See .vscode/launch.json "miDebuggerPath"
cd "$(dirname "$0")/.." || exit
source oaienv
cd cmake_targets || exit
exec sudo -nE gdb "$@"
+60 -8
View File
@@ -43,6 +43,8 @@
#include <string.h>
#include <linux/prctl.h>
#include "common/config/config_userapi.h"
#include <time.h>
#include <sys/time.h>
// main log variables
@@ -476,6 +478,51 @@ char *log_getthreadname(char *threadname,
}
}
#if LOG_MINIMAL
void logMinimal(int comp, int level, const char *format, ...)
{
struct timespec ts;
if (clock_gettime(CLOCK_MONOTONIC, &ts) == -1)
abort();
char buf[MAX_LOG_TOTAL];
int n = snprintf(buf, sizeof(buf), "%lu.%06lu [%s] %c ",
ts.tv_sec,
ts.tv_nsec / 1000,
g_log->log_component[comp].name,
level);
if (n < 0 || n >= sizeof(buf))
{
fprintf(stderr, "%s: n=%d\n", __func__, n);
return;
}
va_list args;
va_start(args, format);
int m = vsnprintf(buf + n, sizeof(buf) - n, format, args);
va_end(args);
if (m < 0)
{
fprintf(stderr, "%s: n=%d m=%d\n", __func__, n, m);
return;
}
int len = n + m;
if (len > sizeof(buf) - 1)
{
len = sizeof(buf) - 1;
}
if (buf[len - 1] != '\n')
{
buf[len++] = '\n';
}
__attribute__((unused))
int unused = write(STDOUT_FILENO, buf, len);
}
#endif // LOG_MINIMAL
static int log_header(char *log_buffer,
int buffsize,
int comp,
@@ -483,14 +530,19 @@ static int log_header(char *log_buffer,
const char *format)
{
char threadname[PR_SET_NAME];
return snprintf(log_buffer, buffsize, "%s%s[%s]%c %s %s%s",
log_level_highlight_end[level],
( (g_log->flag & FLAG_NOCOLOR)?"":log_level_highlight_start[level]),
g_log->log_component[comp].name,
( (g_log->flag & FLAG_LEVEL)?g_log->level2string[level]:' '),
( (g_log->flag & FLAG_THREAD)?log_getthreadname(threadname,PR_SET_NAME+1):""),
format,
log_level_highlight_end[level]);
struct timespec ts;
if (clock_gettime(CLOCK_MONOTONIC, &ts) == -1)
abort();
return snprintf(log_buffer, buffsize, "%lu.%06lu %s%s[%s]%c %s %s%s",
ts.tv_sec,
ts.tv_nsec / 1000,
log_level_highlight_end[level],
( (g_log->flag & FLAG_NOCOLOR)?"":log_level_highlight_start[level]),
g_log->log_component[comp].name,
( (g_log->flag & FLAG_LEVEL)?g_log->level2string[level]:' '),
( (g_log->flag & FLAG_THREAD)?log_getthreadname(threadname,PR_SET_NAME+1):""),
format,
log_level_highlight_end[level]);
}
void logRecord_mt(const char *file,
+34
View File
@@ -100,12 +100,21 @@ extern "C" {
/* .log_format = 0x13 uncolored standard messages
* .log_format = 0x93 colored standard messages */
/* keep white space in first position; switching it to 0 allows colors to be disabled*/
#if LOG_WITH_COLORS
#define LOG_RED "\033[1;31m" /*!< \brief VT100 sequence for bold red foreground */
#define LOG_GREEN "\033[32m" /*!< \brief VT100 sequence for green foreground */
#define LOG_ORANGE "\033[93m" /*!< \brief VT100 sequence for orange foreground */
#define LOG_BLUE "\033[34m" /*!< \brief VT100 sequence for blue foreground */
#define LOG_CYBL "\033[40;36m" /*!< \brief VT100 sequence for cyan foreground on black background */
#define LOG_RESET "\033[0m" /*!< \brief VT100 sequence for reset (black) foreground */
#else
# define LOG_RED ""
# define LOG_GREEN ""
# define LOG_ORANGE ""
# define LOG_BLUE ""
# define LOG_CYBL ""
# define LOG_RESET ""
#endif // LOG_WITH_COLORS
/* @}*/
@@ -381,10 +390,32 @@ int32_t write_file_matlab(const char *fname, const char *vname, void *data, int
#define LOG_DUMP_DOUBLE 1
// debugging macros
#define LOG_F LOG_I /* because LOG_F was originaly to dump a message or buffer but is also used as a regular level...., to dump use LOG_DUMPMSG */
#define LOG_MINIMAL 1 /* 1 for minimal logging: E, W and A */
#if LOG_MINIMAL
void logMinimal(int component, int level, const char *format, ...) __attribute__((format(printf, 3, 4)));
# define LOG_E(COMPONENT, ...) do if (1) logMinimal(COMPONENT, 'E', __VA_ARGS__); while (0)
# define LOG_W(COMPONENT, ...) do if (1) logMinimal(COMPONENT, 'W', __VA_ARGS__); while (0)
# define LOG_A(COMPONENT, ...) do if (1) logMinimal(COMPONENT, 'A', __VA_ARGS__); while (0) /* logs intended for analysis */
# define LOG_I(COMPONENT, ...) do if (0) logMinimal(COMPONENT, 'I', __VA_ARGS__); while (0)
# define LOG_D(COMPONENT, ...) do if (0) logMinimal(COMPONENT, 'D', __VA_ARGS__); while (0)
# define LOG_T(COMPONENT, ...) do if (0) logMinimal(COMPONENT, 'T', __VA_ARGS__); while (0)
# define LOG_M(FILE, VECTOR, DATA, LEN, DEC, FORMAT) ((void) 0)
# define LOG_DUMPFLAG(D) 0
# define LOG_DEBUGFLAG(D) 0
# define LOG_DUMPMSG(C, B, S, X...) ((void) 0)
# define VLOG(C, L, F, ARGS) ((void) 0)
#else // LOG_MINIMAL
# if T_TRACER
/* per component, level dependent macros */
# define LOG_E(c, x...) do { if (T_stdout) { if( g_log->log_component[c].level >= OAILOG_ERR ) logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_ERR, x) ;} else { T(T_LEGACY_ ## c ## _ERROR, T_PRINTF(x)) ;}} while (0)
# define LOG_W(c, x...) do { if (T_stdout) { if( g_log->log_component[c].level >= OAILOG_WARNING) logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_WARNING, x) ;} else { T(T_LEGACY_ ## c ## _WARNING, T_PRINTF(x)) ;}} while (0)
# define LOG_A LOG_I
# define LOG_I(c, x...) do { if (T_stdout) { if( g_log->log_component[c].level >= OAILOG_INFO ) logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_INFO, x) ;} else { T(T_LEGACY_ ## c ## _INFO, T_PRINTF(x)) ;}} while (0)
# define LOG_D(c, x...) do { if (T_stdout) { if( g_log->log_component[c].level >= OAILOG_DEBUG ) logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_DEBUG, x) ;} else { T(T_LEGACY_ ## c ## _DEBUG, T_PRINTF(x)) ;}} while (0)
# define LOG_T(c, x...) do { if (T_stdout) { if( g_log->log_component[c].level >= OAILOG_TRACE ) logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_TRACE, x) ;} else { T(T_LEGACY_ ## c ## _TRACE, T_PRINTF(x)) ;}} while (0)
@@ -404,6 +435,7 @@ int32_t write_file_matlab(const char *fname, const char *vname, void *data, int
# define LOG_E(c, x...) do { if( g_log->log_component[c].level >= OAILOG_ERR ) logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_ERR, x) ;} while (0)
# define LOG_W(c, x...) do { if( g_log->log_component[c].level >= OAILOG_WARNING) logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_WARNING, x) ;} while (0)
# define LOG_I(c, x...) do { if( g_log->log_component[c].level >= OAILOG_INFO ) logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_INFO, x) ;} while (0)
# define LOG_A LOG_I
# define LOG_D(c, x...) do { if( g_log->log_component[c].level >= OAILOG_DEBUG ) logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_DEBUG, x) ;} while (0)
# define LOG_T(c, x...) do { if( g_log->log_component[c].level >= OAILOG_TRACE ) logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_TRACE, x) ;} while (0)
# define VLOG(c,l, f, args) do { if( g_log->log_component[c].level >= l ) vlogRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, l, f, args) ; } while (0)
@@ -416,6 +448,8 @@ int32_t write_file_matlab(const char *fname, const char *vname, void *data, int
# define LOG_M(file, vector, data, len, dec, format) do { write_file_matlab(file, vector, data, len, dec, format);} while(0)
# define LOG_VAR(A,B) A B
# endif /* T_TRACER */
#endif // LOG_MINIMAL
/* avoid warnings for variables only used in LOG macro's but set outside debug section */
#define GCC_NOTUSED __attribute__((unused))
#define LOG_USEDINLOG_VAR(A,B) GCC_NOTUSED A B
+53 -3
View File
@@ -82,7 +82,7 @@ extern "C" {
void *itti_malloc(task_id_t origin_task_id, task_id_t destination_task_id, ssize_t size) {
void *ptr = NULL;
AssertFatal ((ptr=calloc (size, 1)) != NULL, "Memory allocation of %zu bytes failed (%d -> %d)!\n",
AssertFatal ((ptr=calloc (1, size)) != NULL, "Memory allocation of %zu bytes failed (%d -> %d)!\n",
size, origin_task_id, destination_task_id);
return ptr;
}
@@ -436,9 +436,22 @@ extern "C" {
void itti_send_terminate_message(task_id_t task_id) {
}
static volatile bool shutting_down;
static void catch_sigterm(int) {
static const char msg[] = "\n** Caught SIGTERM, shutting down\n";
__attribute__((unused))
int unused = write(STDOUT_FILENO, msg, sizeof(msg) - 1);
shutting_down = true;
}
void itti_wait_tasks_end(void) {
while(1)
sleep(24*3600);
shutting_down = false;
signal(SIGTERM, catch_sigterm);
while (! shutting_down)
{
sleep(24 * 3600);
}
}
void itti_update_lte_time(uint32_t frame, uint8_t slot) {}
@@ -453,4 +466,41 @@ extern "C" {
int signal_mask(void) {
return 0;
}
void log_scheduler(const char* label)
{
int policy = sched_getscheduler(0);
struct sched_param param;
if (sched_getparam(0, &param) == -1)
{
LOG_E(HW, "sched_getparam: %s\n", strerror(errno));
abort();
}
cpu_set_t cpu_set;
if (sched_getaffinity(0, sizeof(cpu_set), &cpu_set) == -1)
{
LOG_E(HW, "sched_getaffinity: %s\n", strerror(errno));
abort();
}
int num_cpus = sysconf(_SC_NPROCESSORS_ONLN);
if (num_cpus < 1)
{
LOG_E(HW, "sysconf(_SC_NPROCESSORS_ONLN): %s\n", strerror(errno));
abort();
}
char buffer[num_cpus];
for (int i = 0; i < num_cpus; i++)
{
buffer[i] = CPU_ISSET(i, &cpu_set) ? 'Y' : '-';
}
LOG_A(HW, "Scheduler policy=%d priority=%d affinity=[%d]%.*s label=%s\n",
policy,
param.sched_priority,
num_cpus,
num_cpus,
buffer,
label);
}
@@ -360,6 +360,8 @@ typedef enum {
FOREACH_TASK(TASK_ENUM)
} task_id_t;
extern uint16_t ue_idx_standalone;
extern uint16_t node_number;
typedef task_id_t thread_id_t;
@@ -581,6 +583,7 @@ int timer_remove(long timer_id);
int signal_handle(int *end);
int signal_mask(void);
void log_scheduler(const char *label);
#ifdef __cplusplus
}
#endif
+2 -2
View File
@@ -1042,14 +1042,14 @@ void init_pdcp(void) {
}
static void wait_nfapi_init(char *thread_name) {
printf( "waiting for NFAPI PNF connection and population of global structure (%s)\n",thread_name);
LOG_I(ENB_APP, "waiting for NFAPI PNF connection and population of global structure (%s)\n",thread_name);
pthread_mutex_lock( &nfapi_sync_mutex );
while (nfapi_sync_var<0)
pthread_cond_wait( &nfapi_sync_cond, &nfapi_sync_mutex );
pthread_mutex_unlock(&nfapi_sync_mutex);
printf( "NFAPI: got sync (%s)\n", thread_name);
LOG_I(ENB_APP, "NFAPI: got sync (%s)\n", thread_name);
}
void terminate_task(module_id_t mod_id, task_id_t from, task_id_t to) {
+6 -5
View File
@@ -197,10 +197,11 @@ void set_softmodem_sighandler(void) {
memset(&act,0,sizeof(act));
act.sa_handler=signal_handler;
sigaction(SOFTMODEM_RTSIGNAL,&act,&oldact);
printf("Send signal %d to display resource usage...\n",SIGRTMIN+1);
signal(SIGSEGV, signal_handler);
signal(SIGINT, signal_handler);
signal(SIGTERM, signal_handler);
signal(SIGABRT, signal_handler);
// Disabled in order generate a core dump for analysis with gdb
// printf("Send signal %d to display resource usage...\n",SIGRTMIN+1);
// signal(SIGSEGV, signal_handler);
// signal(SIGINT, signal_handler);
// signal(SIGTERM, signal_handler);
// signal(SIGABRT, signal_handler);
}
+10 -2
View File
@@ -23,7 +23,15 @@
#include <pthread.h>
#include "nfapi/oai_integration/vendor_ext.h"
#include "common/utils/LOG/log.h"
static char nfapi_str_mode[6][24] = {"MONOLITHIC","PNF","VNF","UE_STUB_PNF","UE_STUB_OFFNET","<UNKNOWN NFAPI MODE>"};
static const char *const nfapi_str_mode[] = {
"MONOLITHIC",
"PNF",
"VNF",
"UE_STUB_PNF",
"UE_STUB_OFFNET",
"STANDALONE_PNF",
"<UNKNOWN NFAPI MODE>"
};
typedef struct {
nfapi_mode_t nfapi_mode;
@@ -54,7 +62,7 @@ void set_thread_priority(int priority) {
}
}
char *nfapi_get_strmode(void) {
const char *nfapi_get_strmode(void) {
if (nfapi_params.nfapi_mode > NFAPI_MODE_UNKNOWN)
return nfapi_str_mode[NFAPI_MODE_UNKNOWN];
+6 -6
View File
@@ -485,7 +485,7 @@ int config_request(nfapi_pnf_config_t *config, nfapi_pnf_phy_config_t *phy, nfap
// to keep only the necessary just to keep the nfapi FSM rolling by sending a dummy response.
LTE_DL_FRAME_PARMS *fp;
if (NFAPI_MODE!=NFAPI_UE_STUB_PNF) {
if (NFAPI_MODE!=NFAPI_UE_STUB_PNF && NFAPI_MODE!=NFAPI_MODE_STANDALONE_PNF) {
struct PHY_VARS_eNB_s *eNB = RC.eNB[0][0];
fp = &eNB->frame_parms;
} else {
@@ -647,7 +647,7 @@ int config_request(nfapi_pnf_config_t *config, nfapi_pnf_phy_config_t *phy, nfap
num_tlv++;
}
if(NFAPI_MODE!=NFAPI_UE_STUB_PNF) {
if(NFAPI_MODE!=NFAPI_UE_STUB_PNF && NFAPI_MODE!=NFAPI_MODE_STANDALONE_PNF) {
printf("[PNF] CONFIG_REQUEST[num_tlv:%d] TLVs processed:%d\n", req->num_tlv, num_tlv);
printf("[PNF] Simulating PHY CONFIG - DJP\n");
PHY_Config_t phy_config;
@@ -672,7 +672,7 @@ int config_request(nfapi_pnf_config_t *config, nfapi_pnf_phy_config_t *phy, nfap
nfapi_pnf_config_resp(config, &nfapi_resp);
printf("[PNF] Sent NFAPI_CONFIG_RESPONSE phy_id:%d\n", phy_info->id);
if(NFAPI_MODE==NFAPI_UE_STUB_PNF)
if(NFAPI_MODE==NFAPI_UE_STUB_PNF || NFAPI_MODE==NFAPI_MODE_STANDALONE_PNF)
free(fp);
return 0;
@@ -1029,7 +1029,7 @@ int start_request(nfapi_pnf_config_t *config, nfapi_pnf_phy_config_t *phy, nfapi
p7_config->tx_req = &pnf_phy_tx_req;
p7_config->lbt_dl_config_req = &pnf_phy_lbt_dl_config_req;
p7_config->ue_release_req = &pnf_phy_ue_release_req;
if (NFAPI_MODE==NFAPI_UE_STUB_PNF) {
if (NFAPI_MODE==NFAPI_UE_STUB_PNF || NFAPI_MODE==NFAPI_MODE_STANDALONE_PNF) {
p7_config->dl_config_req = &memcpy_dl_config_req;
p7_config->ul_config_req = &memcpy_ul_config_req;
p7_config->hi_dci0_req = &memcpy_hi_dci0_req;
@@ -1086,7 +1086,7 @@ int start_request(nfapi_pnf_config_t *config, nfapi_pnf_phy_config_t *phy, nfapi
//phy_init_RU(RC.ru[0]);
printf("[PNF] About to call init_eNB_afterRU()\n");
if (NFAPI_MODE!=NFAPI_UE_STUB_PNF) {
if (NFAPI_MODE!=NFAPI_UE_STUB_PNF && NFAPI_MODE!=NFAPI_MODE_STANDALONE_PNF) {
init_eNB_afterRU();
}
@@ -1370,7 +1370,7 @@ void *pnf_start_thread(void *ptr) {
void configure_nfapi_pnf(char *vnf_ip_addr, int vnf_p5_port, char *pnf_ip_addr, int pnf_p7_port, int vnf_p7_port) {
printf("%s() PNF\n\n\n\n\n\n", __FUNCTION__);
if(NFAPI_MODE!=NFAPI_UE_STUB_PNF) {
if(NFAPI_MODE!=NFAPI_UE_STUB_PNF && NFAPI_MODE!=NFAPI_MODE_STANDALONE_PNF) {
nfapi_setmode(NFAPI_MODE_PNF); // PNF!
}
+119 -79
View File
@@ -454,18 +454,8 @@ int phy_rach_indication(struct nfapi_vnf_p7_config *config, nfapi_rach_indicatio
printf("[VNF] RACH_IND eNB:%p sfn_sf:%d number_of_preambles:%d\n", eNB, NFAPI_SFNSF2DEC(ind->sfn_sf), ind->rach_indication_body.number_of_preambles);
pthread_mutex_lock(&eNB->UL_INFO_mutex);
if(NFAPI_MODE == NFAPI_MODE_VNF){
int8_t index = -1;
for(uint8_t i= 0;i< NUM_NFPAI_SUBFRAME;i++){
if((UL_RCC_INFO.rach_ind[i].header.message_id == 0) && (index == -1)){
index = i;
break;
}
}
if(index == -1){
LOG_E(MAC,"phy_rach_indication : num of rach reach max \n");
pthread_mutex_unlock(&eNB->UL_INFO_mutex);
return 0;
}
int8_t index = NFAPI_SFNSF2SF(ind->sfn_sf);
UL_RCC_INFO.rach_ind[index] = *ind;
if (ind->rach_indication_body.number_of_preambles > 0)
@@ -519,18 +509,8 @@ int phy_harq_indication(struct nfapi_vnf_p7_config *config, nfapi_harq_indicatio
LOG_D(MAC, "%s() NFAPI SFN/SF:%d number_of_harqs:%u\n", __FUNCTION__, NFAPI_SFNSF2DEC(ind->sfn_sf), ind->harq_indication_body.number_of_harqs);
pthread_mutex_lock(&eNB->UL_INFO_mutex);
if(NFAPI_MODE == NFAPI_MODE_VNF){
int8_t index = -1;
for(uint8_t i= 0;i< NUM_NFPAI_SUBFRAME;i++){
if((UL_RCC_INFO.harq_ind[i].header.message_id == 0) && (index == -1)){
index = i;
break;
}
}
if(index == -1){
LOG_E(MAC,"phy_harq_indication : num of harq reach max \n");
pthread_mutex_unlock(&eNB->UL_INFO_mutex);
return 0;
}
int8_t index = NFAPI_SFNSF2SF(ind->sfn_sf);
UL_RCC_INFO.harq_ind[index] = *ind;
if (ind->harq_indication_body.number_of_harqs > 0)
@@ -556,21 +536,8 @@ int phy_crc_indication(struct nfapi_vnf_p7_config *config, nfapi_crc_indication_
struct PHY_VARS_eNB_s *eNB = RC.eNB[0][0];
pthread_mutex_lock(&eNB->UL_INFO_mutex);
if(NFAPI_MODE == NFAPI_MODE_VNF){
int8_t index = -1;
for(uint8_t i= 0;i< NUM_NFPAI_SUBFRAME;i++){
if((UL_RCC_INFO.crc_ind[i].header.message_id == 0) && (index == -1)){
index = i;
}
if(UL_RCC_INFO.rx_ind[i].sfn_sf == ind->sfn_sf){
index = i;
break;
}
}
if(index == -1){
LOG_E(MAC,"phy_crc_indication : num of crc reach max \n");
pthread_mutex_unlock(&eNB->UL_INFO_mutex);
return 0;
}
int8_t index = NFAPI_SFNSF2SF(ind->sfn_sf);
UL_RCC_INFO.crc_ind[index] = *ind;
if (ind->crc_indication_body.number_of_crcs > 0)
@@ -622,21 +589,8 @@ int phy_rx_indication(struct nfapi_vnf_p7_config *config, nfapi_rx_indication_t
pthread_mutex_lock(&eNB->UL_INFO_mutex);
if(NFAPI_MODE == NFAPI_MODE_VNF){
int8_t index = -1;
for(uint8_t i= 0;i< NUM_NFPAI_SUBFRAME;i++){
if((UL_RCC_INFO.rx_ind[i].header.message_id == 0) && (index == -1)){
index = i;
}
if(UL_RCC_INFO.crc_ind[i].sfn_sf == ind->sfn_sf){
index = i;
break;
}
}
if(index == -1){
LOG_E(MAC,"phy_rx_indication : num of rx reach max \n");
pthread_mutex_unlock(&eNB->UL_INFO_mutex);
return 0;
}
int8_t index = NFAPI_SFNSF2SF(ind->sfn_sf);
UL_RCC_INFO.rx_ind[index] = *ind;
if (ind->rx_indication_body.number_of_pdus > 0)
@@ -709,18 +663,8 @@ int phy_sr_indication(struct nfapi_vnf_p7_config *config, nfapi_sr_indication_t
LOG_D(MAC, "%s() NFAPI SFN/SF:%d srs:%d\n", __FUNCTION__, NFAPI_SFNSF2DEC(ind->sfn_sf), ind->sr_indication_body.number_of_srs);
pthread_mutex_lock(&eNB->UL_INFO_mutex);
if(NFAPI_MODE == NFAPI_MODE_VNF){
int8_t index = -1;
for(uint8_t i= 0;i< NUM_NFPAI_SUBFRAME;i++){
if((UL_RCC_INFO.sr_ind[i].header.message_id == 0) && (index == -1)){
index = i;
break;
}
}
if(index == -1){
LOG_E(MAC,"phy_sr_indication : num of sr reach max \n");
pthread_mutex_unlock(&eNB->UL_INFO_mutex);
return 0;
}
int8_t index = NFAPI_SFNSF2SF(ind->sfn_sf);
UL_RCC_INFO.sr_ind[index] = *ind;
LOG_D(MAC,"%s() UL_INFO[%d].sr_ind.sr_indication_body.number_of_srs:%d\n", __FUNCTION__, index, eNB->UL_INFO.sr_ind.sr_indication_body.number_of_srs);
if (ind->sr_indication_body.number_of_srs > 0)
@@ -754,6 +698,35 @@ int phy_sr_indication(struct nfapi_vnf_p7_config *config, nfapi_sr_indication_t
return 1;
}
static bool is_ue_same(uint16_t ue_id_1, uint16_t ue_id_2)
{
return (ue_id_1 == ue_id_2);
}
static void analyze_cqi_pdus_for_duplicates(nfapi_cqi_indication_t *ind)
{
uint16_t num_cqis = ind->cqi_indication_body.number_of_cqis;
for (int i = 0; i < num_cqis; i++)
{
nfapi_cqi_indication_pdu_t *src_pdu = &ind->cqi_indication_body.cqi_pdu_list[i];
LOG_I(MAC, "CQI_IND[PDU:%d][rnti:%x cqi:%d channel:%d]\n", i, src_pdu->rx_ue_information.rnti,
src_pdu->ul_cqi_information.ul_cqi, src_pdu->ul_cqi_information.channel);
for (int j = i + 1; j < num_cqis; j++)
{
uint16_t rnti_i = ind->cqi_indication_body.cqi_pdu_list[i].rx_ue_information.rnti;
uint16_t rnti_j = ind->cqi_indication_body.cqi_pdu_list[j].rx_ue_information.rnti;
if (is_ue_same(rnti_i, rnti_j))
{
LOG_E(MAC, "Problem, two cqis received from a single UE for rnti %x\n",
rnti_i);
abort();
}
}
}
}
int phy_cqi_indication(struct nfapi_vnf_p7_config *config, nfapi_cqi_indication_t *ind) {
// vnf_p7_info* p7_vnf = (vnf_p7_info*)(config->user_data);
//mac_cqi_ind(p7_vnf->mac, ind);
@@ -761,23 +734,16 @@ int phy_cqi_indication(struct nfapi_vnf_p7_config *config, nfapi_cqi_indication_
LOG_D(MAC, "%s() NFAPI SFN/SF:%d number_of_cqis:%u\n", __FUNCTION__, NFAPI_SFNSF2DEC(ind->sfn_sf), ind->cqi_indication_body.number_of_cqis);
pthread_mutex_lock(&eNB->UL_INFO_mutex);
if(NFAPI_MODE == NFAPI_MODE_VNF){
int8_t index = -1;
for(uint8_t i= 0;i< NUM_NFPAI_SUBFRAME;i++){
if((UL_RCC_INFO.cqi_ind[i].header.message_id == 0) && (index == -1)){
index = i;
break;
}
}
if(index == -1){
LOG_E(MAC,"phy_cqi_indication : num of cqi reach max \n");
pthread_mutex_unlock(&eNB->UL_INFO_mutex);
return 0;
}
int8_t index = NFAPI_SFNSF2SF(ind->sfn_sf);
UL_RCC_INFO.cqi_ind[index] = *ind;
if (ind->cqi_indication_body.number_of_cqis > 0){
UL_RCC_INFO.cqi_ind[index].cqi_indication_body.cqi_pdu_list = malloc(sizeof(nfapi_cqi_indication_pdu_t)*ind->cqi_indication_body.number_of_cqis );
UL_RCC_INFO.cqi_ind[index].cqi_indication_body.cqi_raw_pdu_list = malloc(sizeof(nfapi_cqi_indication_raw_pdu_t)*ind->cqi_indication_body.number_of_cqis );
}
analyze_cqi_pdus_for_duplicates(ind);
for (int i=0; i<ind->cqi_indication_body.number_of_cqis; i++) {
nfapi_cqi_indication_pdu_t *src_pdu = &ind->cqi_indication_body.cqi_pdu_list[i];
LOG_D(MAC, "SR_IND[PDU:%d][rnti:%x cqi:%d channel:%d]\n", i, src_pdu->rx_ue_information.rnti,
@@ -795,7 +761,7 @@ int phy_cqi_indication(struct nfapi_vnf_p7_config *config, nfapi_cqi_indication_
dest_ind->cqi_indication_body.cqi_raw_pdu_list = ind->cqi_indication_body.cqi_raw_pdu_list;
for(int i=0; i<ind->cqi_indication_body.number_of_cqis; i++) {
nfapi_cqi_indication_pdu_t *src_pdu = &ind->cqi_indication_body.cqi_pdu_list[i];
LOG_D(MAC, "SR_IND[PDU:%d][rnti:%x cqi:%d channel:%d]\n", i, src_pdu->rx_ue_information.rnti,
LOG_D(MAC, "CQI_IND[PDU:%d][rnti:%x cqi:%d channel:%d]\n", i, src_pdu->rx_ue_information.rnti,
src_pdu->ul_cqi_information.ul_cqi, src_pdu->ul_cqi_information.channel);
memcpy(&dest_ind->cqi_indication_body.cqi_pdu_list[i],
src_pdu, sizeof(nfapi_cqi_indication_pdu_t));
@@ -1190,6 +1156,23 @@ int oai_nfapi_dl_config_req(nfapi_dl_config_request_t *dl_config_req) {
nfapi_vnf_p7_config_t *p7_config = vnf.p7_vnfs[0].config;
dl_config_req->header.phy_id = 1; // DJP HACK TODO FIXME - need to pass this around!!!!
dl_config_req->header.message_id = NFAPI_DL_CONFIG_REQUEST;
LOG_I(PHY, "[VNF] %s() DL_CONFIG_REQ sfn_sf:%d_%d number_of_pdus:%d\n", __FUNCTION__,
NFAPI_SFNSF2SFN(dl_config_req->sfn_sf),NFAPI_SFNSF2SF(dl_config_req->sfn_sf), dl_config_req->dl_config_request_body.number_pdu);
if (dl_config_req->dl_config_request_body.number_pdu > 0)
{
for (int i = 0; i < dl_config_req->dl_config_request_body.number_pdu; i++)
{
uint8_t pdu_type = dl_config_req->dl_config_request_body.dl_config_pdu_list[i].pdu_type;
if(pdu_type == NFAPI_DL_CONFIG_DLSCH_PDU_TYPE)
{
uint16_t dl_rnti = dl_config_req->dl_config_request_body.dl_config_pdu_list[i].dlsch_pdu.dlsch_pdu_rel8.rnti;
uint16_t numPDUs = dl_config_req->dl_config_request_body.number_pdu;
LOG_A(MAC, "(OAI eNB) Sending dl_config_req at VNF during Frame: %d and Subframe: %d,"
" with a RNTI value of: %x and with number of PDUs: %u\n",
NFAPI_SFNSF2SFN(dl_config_req->sfn_sf),NFAPI_SFNSF2SF(dl_config_req->sfn_sf), dl_rnti, numPDUs);
}
}
}
int retval = nfapi_vnf_p7_dl_config_req(p7_config, dl_config_req);
dl_config_req->dl_config_request_body.number_pdcch_ofdm_symbols = 1;
dl_config_req->dl_config_request_body.number_dci = 0;
@@ -1255,12 +1238,69 @@ int oai_nfapi_hi_dci0_req(nfapi_hi_dci0_request_t *hi_dci0_req) {
return retval;
}
static void remove_ul_config_req_pdu(int index, nfapi_ul_config_request_t *ul_config_req)
{
int num_pdus = ul_config_req->ul_config_request_body.number_of_pdus;
nfapi_ul_config_request_pdu_t *pdu_list = ul_config_req->ul_config_request_body.ul_config_pdu_list;
if (index >= num_pdus || index < 0)
{
LOG_E(MAC, "%s() Unable to drop bad ul_config_req PDU\n", __FUNCTION__);
abort();
}
for(int i = index; i + 1 < num_pdus; i++)
{
pdu_list[i] = pdu_list[i + 1];
}
ul_config_req->ul_config_request_body.number_of_pdus--;
}
int oai_nfapi_ul_config_req(nfapi_ul_config_request_t *ul_config_req) {
nfapi_vnf_p7_config_t *p7_config = vnf.p7_vnfs[0].config;
ul_config_req->header.phy_id = 1; // DJP HACK TODO FIXME - need to pass this around!!!!
ul_config_req->header.message_id = NFAPI_UL_CONFIG_REQUEST;
//LOG_D(PHY, "[VNF] %s() header message_id:%02x\n", __FUNCTION__, ul_config_req->header.message_id);
//LOG_D(PHY, "[VNF] %s() UL_CONFIG sfn_sf:%d PDUs:%d rach_prach_frequency_resources:%d srs_present:%d\n", __FUNCTION__, NFAPI_SFNSF2DEC(ul_config_req->sfn_sf), ul_config_req->ul_config_request_body.number_of_pdus, ul_config_req->ul_config_request_body.rach_prach_frequency_resources, ul_config_req->ul_config_request_body.srs_present);
int num_pdus = ul_config_req->ul_config_request_body.number_of_pdus;
nfapi_ul_config_request_pdu_t *pdu_list = ul_config_req->ul_config_request_body.ul_config_pdu_list;
for (int i = 0; i < num_pdus; i++)
{
uint8_t pdu_type = pdu_list[i].pdu_type;
LOG_I(MAC, "ul_config_req num_pdus: %u pdu_number: %d pdu_type: %u SFN.SF: %d.%d\n",
num_pdus, i, pdu_type, ul_config_req->sfn_sf >> 4, ul_config_req->sfn_sf & 15);
if (pdu_type != NFAPI_UL_CONFIG_ULSCH_CQI_RI_PDU_TYPE)
{
continue;
}
for (int j = i + 1; j < num_pdus; j++)
{
uint8_t pdu_type2 = pdu_list[j].pdu_type;
if (pdu_type != pdu_type2)
{
continue;
}
uint16_t rnti_i = pdu_list[i].ulsch_cqi_ri_pdu.ulsch_pdu.ulsch_pdu_rel8.rnti;
uint16_t rnti_j = pdu_list[j].ulsch_cqi_ri_pdu.ulsch_pdu.ulsch_pdu_rel8.rnti;
if (!is_ue_same(rnti_i, rnti_j))
{
continue;
}
remove_ul_config_req_pdu(j, ul_config_req);
j--;
num_pdus--;
LOG_E(MAC, "Problem, two cqis being sent to a single UE for rnti %x dropping one\n",
rnti_i);
}
}
int retval = nfapi_vnf_p7_ul_config_req(p7_config, ul_config_req);
if (retval!=0) {
+2 -1
View File
@@ -70,10 +70,11 @@ typedef enum {
NFAPI_MODE_VNF,
NFAPI_UE_STUB_PNF,
NFAPI_UE_STUB_OFFNET,
NFAPI_MODE_STANDALONE_PNF,
NFAPI_MODE_UNKNOWN
} nfapi_mode_t;
char *nfapi_get_strmode(void);
const char *nfapi_get_strmode(void);
void nfapi_logmode(void);
nfapi_mode_t nfapi_getmode(void);
void nfapi_setmode(nfapi_mode_t nfapi_mode);
+268 -253
View File
@@ -37,6 +37,7 @@
#include <nfapi.h>
#include <debug.h>
extern int nfapi_unpack_p7_vendor_extension(nfapi_p7_message_header_t* header, uint8_t **ppReadPackedMsg, void* user_data);
extern int nfapi_pack_p7_vendor_extension(nfapi_p7_message_header_t* header, uint8_t **ppWritePackedMsg, void* user_data);
@@ -81,19 +82,19 @@ void* nfapi_p7_allocate(size_t size, nfapi_p7_codec_config_t* config)
if(size == 0)
return 0;
void* buffer_p = NULL;
void* buffer_p = NULL;
if(config && config->allocate)
{
buffer_p = (config->allocate)(size);
if(buffer_p != NULL){
memset(buffer_p,0,size);
}
return buffer_p;
buffer_p = (config->allocate)(size);
if(buffer_p != NULL){
memset(buffer_p,0,size);
}
return buffer_p;
}
else
{
buffer_p = calloc(1, size);
return buffer_p;
buffer_p = calloc(1, size);
return buffer_p;
}
}
@@ -1551,7 +1552,7 @@ static uint8_t pack_tx_request_body_value(void* tlv, uint8_t **ppWritePackedMsg,
// DJP - if(pusharray8(pdu->segments[j].segment_data, (uint32_t)(-1), pdu->segments[j].segment_length, ppWritePackedMsg, end) == 0)
int push_ret = pusharray8(pdu->segments[j].segment_data, 65535, pdu->segments[j].segment_length, ppWritePackedMsg, end);
if (pdu->segments[j].segment_length == 3)
if (pdu->segments[j].segment_length == 3)
{
NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() BCH? segment_data:%x %x %x\n", __FUNCTION__,
pdu->segments[j].segment_data[0],
@@ -1583,43 +1584,43 @@ static uint8_t pack_tx_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *e
return x && y && z;
}
static uint8_t pack_release_request_body_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
{
nfapi_ue_release_request_body_t* value = (nfapi_ue_release_request_body_t*)tlv;
if(push16(value->number_of_TLVs, ppWritePackedMsg, end) == 0){
return 0;
}
uint8_t j;
uint16_t num = value->number_of_TLVs;
for(j = 0; j < num; ++j){
if(push16(value->ue_release_request_TLVs_list[j].rnti, ppWritePackedMsg, end) == 0){
return 0;
}
}
return 1;
}
static uint8_t pack_ue_release_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
{
nfapi_ue_release_request_t *pNfapiMsg = (nfapi_ue_release_request_t*)msg;
int x = push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end);
int y = pack_tlv(NFAPI_UE_RELEASE_BODY_TAG, &pNfapiMsg->ue_release_request_body, ppWritePackedMsg, end, &pack_release_request_body_value);
int z = pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config);
return x && y && z;
}
static uint8_t pack_ue_release_response(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
{
nfapi_ue_release_response_t *pNfapiMsg = (nfapi_ue_release_response_t*)msg;
int x = push32(pNfapiMsg->error_code, ppWritePackedMsg, end);
int z = pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config);
return x && z;
}
static uint8_t pack_release_request_body_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
{
nfapi_ue_release_request_body_t* value = (nfapi_ue_release_request_body_t*)tlv;
if(push16(value->number_of_TLVs, ppWritePackedMsg, end) == 0){
return 0;
}
uint8_t j;
uint16_t num = value->number_of_TLVs;
for(j = 0; j < num; ++j){
if(push16(value->ue_release_request_TLVs_list[j].rnti, ppWritePackedMsg, end) == 0){
return 0;
}
}
return 1;
}
static uint8_t pack_ue_release_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
{
nfapi_ue_release_request_t *pNfapiMsg = (nfapi_ue_release_request_t*)msg;
int x = push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end);
int y = pack_tlv(NFAPI_UE_RELEASE_BODY_TAG, &pNfapiMsg->ue_release_request_body, ppWritePackedMsg, end, &pack_release_request_body_value);
int z = pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config);
return x && y && z;
}
static uint8_t pack_ue_release_response(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
{
nfapi_ue_release_response_t *pNfapiMsg = (nfapi_ue_release_response_t*)msg;
int x = push32(pNfapiMsg->error_code, ppWritePackedMsg, end);
int z = pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config);
return x && z;
}
static uint8_t pack_rx_ue_information_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
{
nfapi_rx_ue_information* value = (nfapi_rx_ue_information*)tlv;
@@ -2707,15 +2708,15 @@ int nfapi_p7_message_pack(void *pMessageBuf, void *pPackedBuf, uint32_t packedBu
//NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() NFAPI_TX_REQUEST\n", __FUNCTION__);
result = pack_tx_request(pMessageHeader, &pWritePackedMessage, end, config);
break;
case NFAPI_UE_RELEASE_REQUEST:
result =pack_ue_release_request(pMessageHeader, &pWritePackedMessage, end, config);
break;
case NFAPI_UE_RELEASE_RESPONSE:
result =pack_ue_release_response(pMessageHeader, &pWritePackedMessage, end, config);
break;
case NFAPI_UE_RELEASE_REQUEST:
result =pack_ue_release_request(pMessageHeader, &pWritePackedMessage, end, config);
break;
case NFAPI_UE_RELEASE_RESPONSE:
result =pack_ue_release_response(pMessageHeader, &pWritePackedMessage, end, config);
break;
case NFAPI_HARQ_INDICATION:
result = pack_harq_indication(pMessageHeader, &pWritePackedMessage, end, config);
break;
@@ -4479,43 +4480,45 @@ static uint8_t unpack_tx_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *
for(i = 0; i < totalNumPdus; ++i)
{
nfapi_tx_request_pdu_t* pdu = &(pNfapiMsg->tx_request_body.tx_pdu_list[i]);
if (pdu) {
uint16_t length = 0;
uint16_t index = 0;
if (pdu) {
uint16_t length = 0;
uint16_t index = 0;
if(!(pull16(ppReadPackedMsg, &length, end) &&
if(!(pull16(ppReadPackedMsg, &length, end) &&
pull16(ppReadPackedMsg, &index, end)))
return 0;
return 0;
pdu->pdu_length = length;
pdu->pdu_index = index;
pdu->pdu_length = length;
pdu->pdu_index = index;
// TODO : May need to rethink this bit
pdu->num_segments = 1;
pdu->segments[0].segment_length = pdu->pdu_length;
pdu->segments[0].segment_data = nfapi_p7_allocate(pdu->pdu_length, config);
pdu->num_segments = 1;
pdu->segments[0].segment_length = pdu->pdu_length;
pdu->segments[0].segment_data = nfapi_p7_allocate(pdu->pdu_length, config);
if(pdu->segments[0].segment_data)
{
if(!pullarray8(ppReadPackedMsg, pdu->segments[0].segment_data, pdu->segments[0].segment_length, pdu->segments[0].segment_length, end))
if(pdu->segments[0].segment_data)
{
if(!pullarray8(ppReadPackedMsg, pdu->segments[0].segment_data, pdu->segments[0].segment_length, pdu->segments[0].segment_length, end))
return 0;
if (pdu->segments[0].segment_length == 3)
{
#if 0
if (pdu->segments[0].segment_length == 3)
{
NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() BCH? segment_data:%x %x %x\n", __FUNCTION__,
pdu->segments[0].segment_data[0],
pdu->segments[0].segment_data[1],
pdu->segments[0].segment_data[2]
);
}
}
else
{
}
#endif
}
else
{
NFAPI_TRACE(NFAPI_TRACE_ERROR, "unpack_tx_request: Failed to allocate pdu (len:%d) %d/%d %d\n", pdu->pdu_length, totalNumPdus, i, pdu->pdu_index);
}
} else {
NFAPI_TRACE(NFAPI_TRACE_ERROR, "NULL pdu\n");
}
}
} else {
NFAPI_TRACE(NFAPI_TRACE_ERROR, "NULL pdu\n");
}
}
}
break;
@@ -4529,55 +4532,55 @@ static uint8_t unpack_tx_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *
return 1;
}
static uint8_t unpack_ue_release_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config)
{
uint8_t proceed = 1;
nfapi_ue_release_request_t *pNfapiMsg = (nfapi_ue_release_request_t*)msg;
if(pull16(ppReadPackedMsg, &pNfapiMsg->sfn_sf, end) == 0)
return 0;
while (((uint8_t*)(*ppReadPackedMsg) < end) && proceed)
{
nfapi_tl_t generic_tl;
if(unpack_tl(ppReadPackedMsg, &generic_tl, end) == 0)
return 0;
switch(generic_tl.tag)
{
case NFAPI_UE_RELEASE_BODY_TAG:
{
pNfapiMsg->ue_release_request_body.tl = generic_tl;
if( pull16(ppReadPackedMsg, &pNfapiMsg->ue_release_request_body.number_of_TLVs, end) == 0)
return 0;
if(pNfapiMsg->ue_release_request_body.number_of_TLVs > NFAPI_RELEASE_MAX_RNTI)
{
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s number of relese rnti's exceed maxium (count:%d max:%d)\n", __FUNCTION__, pNfapiMsg->ue_release_request_body.number_of_TLVs, NFAPI_RELEASE_MAX_RNTI);
return 0;
} else {
uint8_t j;
uint16_t num = pNfapiMsg->ue_release_request_body.number_of_TLVs;
for(j = 0; j < num; ++j){
if(pull16(ppReadPackedMsg, &pNfapiMsg->ue_release_request_body.ue_release_request_TLVs_list[j].rnti, end) == 0){
return 0;
}
}
}
}
break;
default:
{
NFAPI_TRACE(NFAPI_TRACE_ERROR, "unpack_ue_release_request FIXME : Invalid type %d \n", generic_tl.tag );
}
break;
};
}
return 1;
}
static uint8_t unpack_ue_release_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config)
{
uint8_t proceed = 1;
nfapi_ue_release_request_t *pNfapiMsg = (nfapi_ue_release_request_t*)msg;
if(pull16(ppReadPackedMsg, &pNfapiMsg->sfn_sf, end) == 0)
return 0;
while (((uint8_t*)(*ppReadPackedMsg) < end) && proceed)
{
nfapi_tl_t generic_tl;
if(unpack_tl(ppReadPackedMsg, &generic_tl, end) == 0)
return 0;
switch(generic_tl.tag)
{
case NFAPI_UE_RELEASE_BODY_TAG:
{
pNfapiMsg->ue_release_request_body.tl = generic_tl;
if( pull16(ppReadPackedMsg, &pNfapiMsg->ue_release_request_body.number_of_TLVs, end) == 0)
return 0;
if(pNfapiMsg->ue_release_request_body.number_of_TLVs > NFAPI_RELEASE_MAX_RNTI)
{
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s number of relese rnti's exceed maxium (count:%d max:%d)\n", __FUNCTION__, pNfapiMsg->ue_release_request_body.number_of_TLVs, NFAPI_RELEASE_MAX_RNTI);
return 0;
} else {
uint8_t j;
uint16_t num = pNfapiMsg->ue_release_request_body.number_of_TLVs;
for(j = 0; j < num; ++j){
if(pull16(ppReadPackedMsg, &pNfapiMsg->ue_release_request_body.ue_release_request_TLVs_list[j].rnti, end) == 0){
return 0;
}
}
}
}
break;
default:
{
NFAPI_TRACE(NFAPI_TRACE_ERROR, "unpack_ue_release_request FIXME : Invalid type %d \n", generic_tl.tag );
}
break;
};
}
return 1;
}
static uint8_t unpack_harq_indication_tdd_harq_data_bundling(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
{
nfapi_harq_indication_tdd_harq_data_bundling_t* value = (nfapi_harq_indication_tdd_harq_data_bundling_t*)tlv;
@@ -4929,35 +4932,35 @@ static uint8_t unpack_rx_indication_rel9_value(void *tlv, uint8_t **ppReadPacked
return (pull16(ppReadPackedMsg, &value->timing_advance_r9, end));
}
static uint8_t unpack_rx_indication_body_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
static uint8_t unpack_rx_indication_body_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end, nfapi_p7_codec_config_t *config)
{
nfapi_rx_indication_body_t* value = (nfapi_rx_indication_body_t*)tlv;
nfapi_rx_indication_body_t *value = (nfapi_rx_indication_body_t *)tlv;
// the rxBodyEnd points to the end of the cqi PDU's
uint8_t* rxBodyEnd = *ppReadPackedMsg + value->tl.length;
uint8_t* rxPduEnd = rxBodyEnd;
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s value->tl.length in unpack: %u \n", __FUNCTION__,
value->tl.length);
uint8_t *rxBodyEnd = *ppReadPackedMsg + value->tl.length;
uint8_t* numberOfPdusAddress = *ppReadPackedMsg;
if(rxBodyEnd > end)
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s rxBodyEnd: %p end: %p\n", __FUNCTION__,
rxBodyEnd, end);
if (rxBodyEnd > end)
{
// pdu end is past buffer end
return 0;
}
if(pull16(ppReadPackedMsg, &value->number_of_pdus, end) == 0)
if (pull16(ppReadPackedMsg, &value->number_of_pdus, end) == 0)
return 0;
if(value->number_of_pdus > NFAPI_RX_IND_MAX_PDU)
if (value->number_of_pdus > NFAPI_RX_IND_MAX_PDU)
{
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s number of rx ind pdu's exceed maxium (count:%d max:%d)\n", __FUNCTION__, value->number_of_pdus, NFAPI_RX_IND_MAX_PDU);
return 0;
return 0;
}
if(value->number_of_pdus > 0)
if (value->number_of_pdus > 0)
{
value->rx_pdu_list = (nfapi_rx_indication_pdu_t*)nfapi_p7_allocate(sizeof(nfapi_rx_indication_pdu_t) * value->number_of_pdus, config);
if(value->rx_pdu_list == NULL)
value->rx_pdu_list = (nfapi_rx_indication_pdu_t *)nfapi_p7_allocate(sizeof(nfapi_rx_indication_pdu_t) * value->number_of_pdus, config);
if (value->rx_pdu_list == NULL)
{
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate rx ind pdu list (count:%d)\n", __FUNCTION__, value->number_of_pdus);
return 0;
@@ -4967,87 +4970,97 @@ static uint8_t unpack_rx_indication_body_value(void* tlv, uint8_t **ppReadPacked
{
value->rx_pdu_list = 0;
}
uint8_t i = 0;
nfapi_rx_indication_pdu_t* pdu = 0;
while((uint8_t*)(*ppReadPackedMsg) < rxBodyEnd && (uint8_t*)(*ppReadPackedMsg) < rxPduEnd)
{
nfapi_tl_t generic_tl;
if( unpack_tl(ppReadPackedMsg, &generic_tl, end) == 0)
return 0;
switch(generic_tl.tag)
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s number_of_pdus = %u\n", __FUNCTION__, value->number_of_pdus);
for (int i = 0; i < value->number_of_pdus; i++)
{
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s i = %u\n", __FUNCTION__, i);
nfapi_tl_t generic_tl;
// NFAPI_RX_UE_INFORMATION_TAG
if (unpack_tl(ppReadPackedMsg, &generic_tl, end) == 0)
{
case NFAPI_RX_UE_INFORMATION_TAG:
{
pdu = &(value->rx_pdu_list[i++]);
pdu->rx_ue_information.tl = generic_tl;
if(unpack_rx_ue_information_value(&pdu->rx_ue_information, ppReadPackedMsg, end) == 0)
return 0;
}
break;
case NFAPI_RX_INDICATION_REL8_TAG:
{
if(pdu != 0)
{
pdu->rx_indication_rel8.tl = generic_tl;
if(unpack_rx_indication_rel8_value(&pdu->rx_indication_rel8, ppReadPackedMsg, end) == 0)
return 0;
if(pdu->rx_indication_rel8.offset > 0)
{
// Need to check that the data is within the tlv
if(numberOfPdusAddress + pdu->rx_indication_rel8.offset + pdu->rx_indication_rel8.length <= rxBodyEnd)
{
// If this the first pdu set the rxPduEnd
if(numberOfPdusAddress + pdu->rx_indication_rel8.offset < rxPduEnd)
{
rxPduEnd = numberOfPdusAddress + pdu->rx_indication_rel8.offset;
if(rxPduEnd > end)
{
// pdu end is past buffer end
return 0;
}
}
}
else
{
NFAPI_TRACE(NFAPI_TRACE_ERROR, "FIXME: the rx data is outside of the tlv\n");
}
}
}
}
break;
case NFAPI_RX_INDICATION_REL9_TAG:
{
if(pdu != 0)
{
pdu->rx_indication_rel9.tl = generic_tl;
if(unpack_rx_indication_rel9_value(&pdu->rx_indication_rel9, ppReadPackedMsg, end) == 0)
return 0;
}
}
break;
default:
{
NFAPI_TRACE(NFAPI_TRACE_ERROR, "RX_ULSCH.indication Invalid pdu type %d \n", generic_tl.tag );
}
break;
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s unpack_tl failed\n", __FUNCTION__);
return 0;
}
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s generic_tl.tag = 0x%x length = %u\n", __FUNCTION__, generic_tl.tag, generic_tl.length);
if (generic_tl.tag != NFAPI_RX_UE_INFORMATION_TAG)
{
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s generic_tl.tag wrong\n", __FUNCTION__);
return 0;
}
nfapi_rx_indication_pdu_t *pdu = &value->rx_pdu_list[i];
pdu->rx_ue_information.tl = generic_tl;
if (unpack_rx_ue_information_value(&pdu->rx_ue_information, ppReadPackedMsg, end) == 0)
{
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s unpack_rx_ue_info failure\n", __FUNCTION__);
return 0;
}
// NFAPI_RX_INDICATION_REL8_TAG
if (unpack_tl(ppReadPackedMsg, &generic_tl, end) == 0)
{
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s unpack_tl failed\n", __FUNCTION__);
return 0;
}
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s generic_tl.tag = 0x%x length = %u\n", __FUNCTION__, generic_tl.tag, generic_tl.length);
if (generic_tl.tag != NFAPI_RX_INDICATION_REL8_TAG)
{
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s generic_tl.tag wrong\n", __FUNCTION__);
return 0;
}
pdu->rx_indication_rel8.tl = generic_tl;
if (unpack_rx_indication_rel8_value(&pdu->rx_indication_rel8, ppReadPackedMsg, end) == 0)
{
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s unpack_rx_indication_rel8 failure\n", __FUNCTION__);
return 0;
}
//What is offset not stripping 10 bytes
NFAPI_TRACE(NFAPI_TRACE_INFO, "%s pdu->rx_indication_rel8.offset = %u", __FUNCTION__,
pdu->rx_indication_rel8.offset);
// NFAPI_RX_INDICATION_REL9_TAG
if (unpack_tl(ppReadPackedMsg, &generic_tl, end) == 0)
{
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s unpack_tl failed\n", __FUNCTION__);
return 0;
}
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s generic_tl.tag = 0x%x length = %u\n", __FUNCTION__, generic_tl.tag, generic_tl.length);
if (generic_tl.tag != NFAPI_RX_INDICATION_REL9_TAG)
{
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s generic_tl.tag wrong\n", __FUNCTION__);
return 0;
}
pdu->rx_indication_rel9.tl = generic_tl;
if (unpack_rx_indication_rel9_value(&pdu->rx_indication_rel9, ppReadPackedMsg, end) == 0)
{
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s unpack_rx_indication_rel9 failure\n", __FUNCTION__);
return 0;
}
}
uint8_t idx = 0;
for(idx = 0; idx < value->number_of_pdus; ++idx)
for (int i = 0; i < value->number_of_pdus; ++i)
{
if(value->rx_pdu_list[idx].rx_indication_rel8.tl.tag == NFAPI_RX_INDICATION_REL8_TAG)
nfapi_rx_indication_pdu_t *pdu = &value->rx_pdu_list[i];
if (pdu->rx_indication_rel8.tl.tag == NFAPI_RX_INDICATION_REL8_TAG)
{
uint32_t length = value->rx_pdu_list[idx].rx_indication_rel8.length;
value->rx_pdu_list[idx].data = nfapi_p7_allocate(length, config);
if(pullarray8(ppReadPackedMsg, value->rx_pdu_list[idx].data, length, length, end) == 0)
uint32_t length = pdu->rx_indication_rel8.length;
value->rx_pdu_list[i].data = nfapi_p7_allocate(length, config);
if (pullarray8(ppReadPackedMsg, pdu->data, length, length, end) == 0)
{
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s pullarray8 failure\n", __FUNCTION__);
return 0;
}
}
}
@@ -5825,18 +5838,18 @@ static uint8_t unpack_nrach_indication_rel13_value(void *tlv, uint8_t **ppReadPa
pull8(ppReadPackedMsg, &value->nrach_ce_level, end));
}
static uint8_t unpack_ue_release_resp(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config)
{
nfapi_ue_release_response_t *pNfapiMsg = (nfapi_ue_release_response_t*)msg;
if(pull32(ppReadPackedMsg, &pNfapiMsg->error_code, end) == 0){
return 0;
}
else{
NFAPI_TRACE(NFAPI_TRACE_INFO, "ue_release_response:error_code = %d\n", pNfapiMsg->error_code);
}
return 1;
}
static uint8_t unpack_ue_release_resp(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config)
{
nfapi_ue_release_response_t *pNfapiMsg = (nfapi_ue_release_response_t*)msg;
if(pull32(ppReadPackedMsg, &pNfapiMsg->error_code, end) == 0){
return 0;
}
else{
NFAPI_TRACE(NFAPI_TRACE_INFO, "ue_release_response:error_code = %d\n", pNfapiMsg->error_code);
}
return 1;
}
static uint8_t unpack_nrach_indication_body_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
{
nfapi_nrach_indication_body_t* value = (nfapi_nrach_indication_body_t*)tlv;
@@ -6049,17 +6062,17 @@ static int check_unpack_length(nfapi_message_id_e msgId, uint32_t unpackedBufLen
if (unpackedBufLen >= sizeof(nfapi_timing_info_t))
retLen = sizeof(nfapi_timing_info_t);
break;
case NFAPI_UE_RELEASE_REQUEST:
if (unpackedBufLen >= sizeof(nfapi_ue_release_request_t))
retLen = sizeof(nfapi_ue_release_request_t);
break;
case NFAPI_UE_RELEASE_RESPONSE:
if (unpackedBufLen >= sizeof(nfapi_ue_release_response_t))
retLen = sizeof(nfapi_ue_release_response_t);
break;
case NFAPI_UE_RELEASE_REQUEST:
if (unpackedBufLen >= sizeof(nfapi_ue_release_request_t))
retLen = sizeof(nfapi_ue_release_request_t);
break;
case NFAPI_UE_RELEASE_RESPONSE:
if (unpackedBufLen >= sizeof(nfapi_ue_release_response_t))
retLen = sizeof(nfapi_ue_release_response_t);
break;
default:
NFAPI_TRACE(NFAPI_TRACE_ERROR, "Unknown message ID %d\n", msgId);
break;
@@ -6179,14 +6192,14 @@ int nfapi_p7_message_unpack(void *pMessageBuf, uint32_t messageBufLen, void *pUn
else
return -1;
break;
case NFAPI_UE_RELEASE_REQUEST:
if (check_unpack_length(NFAPI_UE_RELEASE_REQUEST, unpackedBufLen))
result = unpack_ue_release_request(&pReadPackedMessage, end, pMessageHeader, config);
else
return -1;
break;
case NFAPI_UE_RELEASE_REQUEST:
if (check_unpack_length(NFAPI_UE_RELEASE_REQUEST, unpackedBufLen))
result = unpack_ue_release_request(&pReadPackedMessage, end, pMessageHeader, config);
else
return -1;
break;
case NFAPI_HARQ_INDICATION:
if (check_unpack_length(NFAPI_HARQ_INDICATION, unpackedBufLen))
result = unpack_harq_indication(&pReadPackedMessage, end, pMessageHeader, config);
@@ -6203,7 +6216,9 @@ int nfapi_p7_message_unpack(void *pMessageBuf, uint32_t messageBufLen, void *pUn
case NFAPI_RX_ULSCH_INDICATION:
if (check_unpack_length(NFAPI_RX_ULSCH_INDICATION, unpackedBufLen))
{
result = unpack_rx_indication(&pReadPackedMessage, end, pMessageHeader, config);
}
else
return -1;
break;
@@ -6284,14 +6299,14 @@ int nfapi_p7_message_unpack(void *pMessageBuf, uint32_t messageBufLen, void *pUn
else
return -1;
break;
case NFAPI_UE_RELEASE_RESPONSE:
if (check_unpack_length(NFAPI_UE_RELEASE_RESPONSE, unpackedBufLen))
result = unpack_ue_release_resp(&pReadPackedMessage, end, pMessageHeader, config);
else
return -1;
break;
case NFAPI_UE_RELEASE_RESPONSE:
if (check_unpack_length(NFAPI_UE_RELEASE_RESPONSE, unpackedBufLen))
result = unpack_ue_release_resp(&pReadPackedMessage, end, pMessageHeader, config);
else
return -1;
break;
default:
if(pMessageHeader->message_id >= NFAPI_VENDOR_EXT_MSG_MIN &&
@@ -6315,7 +6330,7 @@ int nfapi_p7_message_unpack(void *pMessageBuf, uint32_t messageBufLen, void *pUn
if(result == 0)
return -1;
else
else
return 0;
}
+2
View File
@@ -939,6 +939,7 @@ int vnf_read_dispatch_message(nfapi_vnf_config_t* config, nfapi_vnf_pnf_info_t*
uint32_t header_buffer_size = NFAPI_HEADER_LENGTH;
uint8_t header_buffer[header_buffer_size];
memset(header_buffer, 0, header_buffer_size);
uint32_t stack_buffer_size = 32; //should it be the size of then sctp_notificatoin structure
uint8_t stack_buffer[stack_buffer_size];
@@ -949,6 +950,7 @@ int vnf_read_dispatch_message(nfapi_vnf_config_t* config, nfapi_vnf_pnf_info_t*
uint32_t message_size = 0;
struct sockaddr_in addr;
memset(&addr, 0, sizeof(addr));
socklen_t addr_len = sizeof(addr);
struct sctp_sndrcvinfo sndrcvinfo;
+1
View File
@@ -17,6 +17,7 @@
#include <time.h>
#include <stdio.h>
#include <sys/time.h>
#include <stdlib.h>
#include <string.h>
@@ -362,9 +362,7 @@ if (selectRetval==-1 && errno == 22)
while(curr != 0)
{
curr->sfn_sf = increment_sfn_sf(curr->sfn_sf);
vnf_sync(vnf_p7, curr);
curr = curr->next;
}
+1 -1
View File
@@ -95,7 +95,7 @@ void phy_config_request(PHY_Config_t *phy_config) {
int Ncp = cfg->subframe_config.dl_cyclic_prefix_type.value;
int p_eNB = cfg->rf_config.tx_antenna_ports.value;
uint32_t dl_CarrierFreq = cfg->nfapi_config.earfcn.value;
LOG_I(PHY,"Configuring MIB for instance %d, CCid %d : (band %d,N_RB_DL %d, N_RB_UL %d, Nid_cell %d,eNB_tx_antenna_ports %d,Ncp %d,DL freq %u,phich_config.resource %d, phich_config.duration %d)\n",
LOG_A(PHY,"Configuring MIB for instance %d, CCid %d : (band %d,N_RB_DL %d, N_RB_UL %d, Nid_cell %d,eNB_tx_antenna_ports %d,Ncp %d,DL freq %u,phich_config.resource %d, phich_config.duration %d)\n",
Mod_id, CC_id, eutra_band, dl_Bandwidth, ul_Bandwidth, Nid_cell, p_eNB,Ncp,dl_CarrierFreq,
cfg->phich_config.phich_resource.value,
cfg->phich_config.phich_duration.value);
+1 -1
View File
@@ -547,7 +547,7 @@ void phy_config_dedicated_ue(module_id_t Mod_id,int CC_id,uint8_t eNB_id,
phy_vars_ue->decode_MIB = 0;
}
if(NFAPI_MODE!=NFAPI_UE_STUB_PNF) {
if(NFAPI_MODE!=NFAPI_UE_STUB_PNF && NFAPI_MODE!=NFAPI_MODE_STANDALONE_PNF) {
//phy_vars_ue->pdcch_vars[1][eNB_id]->crnti = phy_vars_ue->pdcch_vars[0][eNB_id]->crnti;
if(phy_vars_ue->pdcch_vars[0][eNB_id]->crnti == 0x1234)
phy_vars_ue->pdcch_vars[0][eNB_id]->crnti = phy_vars_ue->pdcch_vars[1][eNB_id]->crnti;
+1 -1
View File
@@ -469,7 +469,7 @@ void nr_phy_config_request(NR_PHY_Config_t *phy_config) {
LOG_I(PHY, "DL frequency %lu Hz, UL frequency %lu Hz: band %d, uldl offset %d Hz\n", fp->dl_CarrierFreq, fp->ul_CarrierFreq, fp->nr_band, dlul_offset);
fp->threequarter_fs = openair0_cfg[0].threequarter_fs;
LOG_I(PHY,"Configuring MIB for instance %d, : (Nid_cell %d,DL freq %llu, UL freq %llu)\n",
LOG_A(PHY,"Configuring MIB for instance %d, : (Nid_cell %d,DL freq %llu, UL freq %llu)\n",
Mod_id,
gNB_config->cell_config.phy_cell_id.value,
(unsigned long long)fp->dl_CarrierFreq,
+1 -1
View File
@@ -115,7 +115,7 @@ void pusch_power_cntl(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uint8_
}
int8_t get_PHR(uint8_t Mod_id, uint8_t CC_id,uint8_t eNB_index) {
if(NFAPI_MODE!=NFAPI_UE_STUB_PNF)
if(NFAPI_MODE!=NFAPI_UE_STUB_PNF && NFAPI_MODE!=NFAPI_MODE_STANDALONE_PNF)
return PHY_vars_UE_g[Mod_id][CC_id]->ulsch[eNB_index]->PHR;
else
return 40; // l1l2 simulator => ideal conditions
@@ -95,11 +95,16 @@ static int tun_alloc(char *dev) {
}
int netlink_init_mbms_tun(char *ifprefix) {
int netlink_init_mbms_tun(char *ifprefix, int id) {//for UE, id = 1, 2, ...,
int ret;
char ifname[64];
sprintf(ifname, "oaitun_%.3s1",ifprefix); // added "1": for historical reasons
if ( id > 0 ){
sprintf(ifname, "oaitun_%.3s%d",ifprefix, id-1);
}
else{
sprintf(ifname, "oaitun_%.3s1",ifprefix); // added "1": for historical reasons
}
nas_sock_mbms_fd = tun_alloc(ifname);
if (nas_sock_mbms_fd == -1) {
@@ -151,11 +156,13 @@ int netlink_init_mbms_tun(char *ifprefix) {
return 1;
}
int netlink_init_tun(char *ifprefix, int num_if) {
int netlink_init_tun(char *ifprefix, int num_if, int id) {//for UE, id = 1, 2, ...,
int ret;
char ifname[64];
for (int i = 0; i < num_if; i++) {
int begx = (id == 0) ? 0 : id - 1;
int endx = (id == 0) ? num_if : id;
for (int i = begx; i < endx; i++) {
sprintf(ifname, "oaitun_%.3s%d",ifprefix,i+1);
nas_sock_fd[i] = tun_alloc(ifname);
+2 -2
View File
@@ -62,7 +62,7 @@ int multicast_link_read_data_from_sock(uint8_t eNB_flag);
void clear_eNB_transport_info(uint8_t);
void clear_UE_transport_info(uint8_t);
int netlink_init(void);
int netlink_init_tun(char *ifsuffix, int num_if);
int netlink_init_mbms_tun(char *ifsuffix);
int netlink_init_tun(char *ifsuffix, int num_if, int id);
int netlink_init_mbms_tun(char *ifsuffix, int id);
#endif /* EMU_PROTO_H_ */
+16 -5
View File
@@ -24,7 +24,7 @@
//#include "SIMULATION/TOOLS/sim.h"
unsigned int s0, s1, s2, b;
static unsigned int s0, s1, s2;
//----------------------------------------------
//
@@ -34,7 +34,7 @@ unsigned int s0, s1, s2, b;
unsigned int taus(void)
{
b = (((s0 << 13) ^ s0) >> 19);
unsigned int b = (((s0 << 13) ^ s0) >> 19);
s0 = (((s0 & 0xFFFFFFFE) << 12)^ b);
b = (((s1 << 2) ^ s1) >> 25);
s1 = (((s1 & 0xFFFFFFF8) << 4)^ b);
@@ -50,9 +50,20 @@ void set_taus_seed(unsigned int seed_init)
unsigned long result = 0;
if (seed_init == 0) {
s0 = (unsigned int)time(NULL);
s1 = (unsigned int)time(NULL);
s2 = (unsigned int)time(NULL);
unsigned int data[3];
int fd = open("/dev/urandom", O_RDONLY);
if (fd == -1)
{
abort();
}
if (read(fd, data, sizeof(data)) != sizeof(data))
{
abort();
}
close(fd);
s0 = data[0];
s1 = data[1];
s2 = data[2];
} else {
/* Use reentrant version of rand48 to ensure that no conflicts with other generators occur */
srand48_r((long int)seed_init, &buffer);
+2 -2
View File
@@ -73,8 +73,8 @@
#define MAX_eNB 2
#define MAX_gNB 2
#else
#define MAX_MOBILES_PER_ENB 4
#define MAX_MOBILES_PER_ENB_NB_IoT 4
#define MAX_MOBILES_PER_ENB 40
#define MAX_MOBILES_PER_ENB_NB_IoT 40
#define MAX_MOBILES_PER_GNB 2//16
#define MAX_eNB 2
#define MAX_gNB 2
+1 -1
View File
@@ -720,7 +720,7 @@ int DU_send_UL_RRC_MESSAGE_TRANSFER(instance_t instance,
LOG_E(F1AP, "Did not find the UE context associated with UE RNTOI %x, ue_context_p is NULL\n", rnti);
} else {
LOG_I(F1AP, "Processing RRCConnectionSetupComplete UE %x\n", rnti);
LOG_A(F1AP, "Processing RRCConnectionSetupComplete UE %x\n", rnti);
ue_context_p->ue_context.Status = RRC_CONNECTED;
}
break;
+2 -2
View File
@@ -798,7 +798,7 @@ int rrc_mac_config_req_eNB(module_id_t Mod_idP,
RC.mac[Mod_idP]->common_channels[CC_idP].Ncp = Ncp;
RC.mac[Mod_idP]->common_channels[CC_idP].eutra_band = eutra_band;
RC.mac[Mod_idP]->common_channels[CC_idP].dl_CarrierFreq = dl_CarrierFreq;
LOG_I(MAC,
LOG_A(MAC,
"Configuring MIB for instance %d, CCid %d : (band %d,N_RB_DL %d,Nid_cell %d,p %d,DL freq %u,phich_config.resource %d, phich_config.duration %d)\n",
Mod_idP,
CC_idP,
@@ -1065,7 +1065,7 @@ int rrc_mac_config_req_eNB(module_id_t Mod_idP,
while(RC.mac[Mod_idP]->if_inst->PHY_config_req == NULL) {
// DJP AssertFatal(RC.mac[Mod_idP]->if_inst->PHY_config_req != NULL,"if_inst->phy_config_request is null\n");
usleep(100 * 1000);
printf("Waiting for PHY_config_req\n");
LOG_I(MAC, "Waiting for PHY_config_req\n");
}
}
+2 -2
View File
@@ -203,7 +203,7 @@ rrc_mac_config_req_ue(module_id_t Mod_idP,
LTE_MAC_MainConfig__ul_SCH_Config__maxHARQ_Tx_n5;
}
if(NFAPI_MODE != NFAPI_UE_STUB_PNF)
if(NFAPI_MODE!=NFAPI_UE_STUB_PNF && NFAPI_MODE!=NFAPI_MODE_STANDALONE_PNF)
phy_config_harq_ue(Mod_idP, 0, eNB_index, UE_mac_inst[Mod_idP].scheduling_info.maxHARQ_Tx);
if (mac_MainConfig->ul_SCH_Config->retxBSR_Timer) {
@@ -311,7 +311,7 @@ rrc_mac_config_req_ue(module_id_t Mod_idP,
}
if (physicalConfigDedicated != NULL) {
if(NFAPI_MODE != NFAPI_UE_STUB_PNF)
if(NFAPI_MODE != NFAPI_UE_STUB_PNF && NFAPI_MODE != NFAPI_MODE_STANDALONE_PNF)
phy_config_dedicated_ue(Mod_idP, 0, eNB_index,
physicalConfigDedicated);
+22
View File
@@ -313,6 +313,7 @@ schedule_SR (module_id_t module_idP,
nfapi_ul_config_request_body_t *ul_req_body = NULL;
LTE_SchedulingRequestConfig_t *SRconfig = NULL;
nfapi_ul_config_sr_information sr;
memset(&sr, 0, sizeof(sr));
for (int CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) {
eNB->UL_req[CC_id].sfn_sf = (frameP << 4) + subframeP;
@@ -576,6 +577,27 @@ eNB_dlsch_ulsch_scheduler(module_id_t module_idP,
UE_sched_ctrl_t *UE_scheduling_control = NULL;
start_meas(&(eNB->eNB_scheduler));
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_ULSCH_SCHEDULER, VCD_FUNCTION_IN);
// TODO: Better solution needed this is the first
// 3 indications of this function on startup
// 1303275.278188 [MAC] XXX 0.0 -> 0.4 = 4
// 1303275.279443 [MAC] XXX 0.4 -> 639.5 = 6391
// 1303275.348686 [MAC] XXX 646.3 -> 646.3 = 0
int delta = (frameP * 10 + subframeP) - (eNB->frame * 10 + eNB->subframe);
if (delta < 0)
{
delta += 10240; // sfn_sf decimal values range from 0 to 10239
}
// If we ever see a difference this big something is very wrong
// This threshold is arbitrary
if (delta > 8500 || delta == 0) // 850 frames
{
LOG_I(MAC, "scheduler ignoring outerspace %d.%d -> %d.%d = %d\n",
eNB->frame, eNB->subframe, frameP, subframeP, delta);
return;
}
LOG_I(MAC, "Entering dlsch_ulsch scheduler %d.%d -> %d.%d = %d\n",
eNB->frame, eNB->subframe, frameP, subframeP, delta);
eNB->frame = frameP;
eNB->subframe = subframeP;
+2 -2
View File
@@ -918,7 +918,7 @@ generate_Msg4(module_id_t module_idP,
module_idP, CC_idP, frameP, subframeP, UE_id, rrc_sdu_length);
// AssertFatal(rrc_sdu_length > 0,
// "[MAC][eNB Scheduler] CCCH not allocated, rrc_sdu_length: %d\n", rrc_sdu_length);
LOG_I(MAC,"[eNB %d][RAPROC] CC_id %d Frame %d, subframeP %d: Generating Msg4 with RRC Piggyback (RNTI %x)\n",
LOG_A(MAC,"[eNB %d][RAPROC] CC_id %d Frame %d, subframeP %d: Generating Msg4 with RRC Piggyback (RNTI %x)\n",
module_idP, CC_idP, frameP, subframeP, ra->rnti);
/// Choose first 4 RBs for Msg4, should really check that these are free!
first_rb = 0;
@@ -1288,7 +1288,7 @@ initiate_ra_proc(module_id_t module_idP,
prach_ParametersListCE_r13 = &ext4_prach->prach_ParametersListCE_r13;
}
LOG_D(MAC,
LOG_I(MAC,
"[eNB %d][RAPROC] CC_id %d Frame %d, Subframe %d Initiating RA procedure for preamble index %d\n",
module_idP, CC_id, frameP, subframeP, preamble_index);
LOG_D(MAC,
+1 -1
View File
@@ -289,7 +289,7 @@ PRACH_RESOURCES_t *ue_get_rach(module_id_t module_idP, int CC_id,
UE_MODE_t UE_mode;
// Modification for phy_stub_ue operation
if(NFAPI_MODE == NFAPI_UE_STUB_PNF) { // phy_stub_ue mode
if(NFAPI_MODE == NFAPI_UE_STUB_PNF || NFAPI_MODE == NFAPI_MODE_STANDALONE_PNF) { // phy_stub_ue mode
UE_mode = UE_mac_inst[module_idP].UE_mode[0];
LOG_D(MAC, "ue_get_rach , UE_mode: %d", UE_mode);
} else { // Full stack mode
+6 -4
View File
@@ -67,6 +67,7 @@ uint16_t ue_process_rar(const module_id_t module_idP, const int CC_id, const fra
LOG_D(PHY, "Found RAR with the intended RAPID %d\n",
rarh->RAPID);
rar = (uint8_t *) (dlsch_buffer + n_rarh + (n_rarpy - 1) * 6);
UE_mac_inst[module_idP].UE_mode[0] = RA_RESPONSE;
break;
}
@@ -77,9 +78,10 @@ uint16_t ue_process_rar(const module_id_t module_idP, const int CC_id, const fra
}
if (rarh->E == 0) {
LOG_I(PHY,
LOG_I(MAC,
"No RAR found with the intended RAPID. The closest RAPID in all RARs is %d\n",
best_rx_rapid);
UE_mac_inst[module_idP].UE_mode[0] = PRACH;
break;
} else {
rarh++;
@@ -94,7 +96,7 @@ uint16_t ue_process_rar(const module_id_t module_idP, const int CC_id, const fra
return (0xffff);
}
LOG_I(MAC,
LOG_A(MAC,
"[UE %d][RAPROC] Frame %d Received RAR (%02x|%02x.%02x.%02x.%02x.%02x.%02x) for preamble %d/%d\n",
module_idP, frameP, *(uint8_t *) rarh, rar[0], rar[1], rar[2],
rar[3], rar[4], rar[5], rarh->RAPID, preamble_index);
@@ -130,7 +132,7 @@ uint16_t ue_process_rar(const module_id_t module_idP, const int CC_id, const fra
}
// move the selected RAR to the front of the RA_PDSCH buffer
memcpy(selected_rar_buffer + 0, (uint8_t *) rarh, 1);
memcpy(selected_rar_buffer + 1, (uint8_t *) rar, 6);
memmove(selected_rar_buffer + 0, (uint8_t *) rarh, 1);
memmove(selected_rar_buffer + 1, (uint8_t *) rar, 6);
return ret;
}
+8 -10
View File
@@ -156,15 +156,13 @@ void ue_init_mac(module_id_t module_idP) {
UE_mac_inst[module_idP].scheduling_info.LCID_buffer_remain[i] = 0;
}
if(NFAPI_MODE==NFAPI_UE_STUB_PNF) {
if(NFAPI_MODE==NFAPI_UE_STUB_PNF || NFAPI_MODE==NFAPI_MODE_STANDALONE_PNF) {
pthread_mutex_init(&UE_mac_inst[module_idP].UL_INFO_mutex,NULL);
UE_mac_inst[module_idP].UE_mode[0] = NOT_SYNCHED; //PRACH;
UE_mac_inst[module_idP].UE_mode[0] = PRACH; //NOT_SYNCHED;
UE_mac_inst[module_idP].first_ULSCH_Tx =0;
UE_mac_inst[module_idP].SI_Decoded = 0;
next_ra_frame = 0;
next_Mod_id = 0;
tx_request_pdu_list = NULL;
tx_req_num_elems = 0;
}
}
@@ -418,7 +416,7 @@ ue_send_sdu(module_id_t module_idP,
if (payload_ptr != NULL) {
for (i = 0; i < num_ce; i++) {
// printf("ce %d : %d\n",i,rx_ces[i]);
LOG_I(MAC, "ce %d : %d\n",i,rx_ces[i]);
switch (rx_ces[i]) {
case UE_CONT_RES:
LOG_I(MAC,
@@ -443,7 +441,7 @@ ue_send_sdu(module_id_t module_idP,
"[UE %d][RAPROC] Contention detected, RA failed\n",
module_idP);
if(NFAPI_MODE==NFAPI_UE_STUB_PNF) { // phy_stub mode
if(NFAPI_MODE==NFAPI_UE_STUB_PNF || NFAPI_MODE==NFAPI_MODE_STANDALONE_PNF) { // phy_stub mode
// Modification for phy_stub mode operation here. We only need to make sure that the ue_mode is back to
// PRACH state.
LOG_I(MAC, "nfapi_mode3: Setting UE_mode BACK to PRACH 1\n");
@@ -469,7 +467,7 @@ ue_send_sdu(module_id_t module_idP,
[module_idP].
RA_contention_resolution_timer_active = 0;
if(NFAPI_MODE==NFAPI_UE_STUB_PNF) { // phy_stub mode
if(NFAPI_MODE==NFAPI_UE_STUB_PNF || NFAPI_MODE==NFAPI_MODE_STANDALONE_PNF) { // phy_stub mode
// Modification for phy_stub mode operation here. We only need to change the ue_mode to PUSCH
UE_mac_inst[module_idP].UE_mode[eNB_index] = PUSCH;
} else { // Full stack mode
@@ -487,7 +485,7 @@ ue_send_sdu(module_id_t module_idP,
#endif
// Eliminate call to process_timing_advance for the phy_stub UE operation mode. Is this correct?
if (NFAPI_MODE!=NFAPI_UE_STUB_PNF) {
if (NFAPI_MODE!=NFAPI_UE_STUB_PNF && NFAPI_MODE!=NFAPI_MODE_STANDALONE_PNF) {
process_timing_advance(module_idP,CC_id,payload_ptr[0]);
}
@@ -2747,7 +2745,7 @@ ue_get_sdu(module_id_t module_idP, int CC_id, frame_t frameP,
// build PHR and update the timers
if (phr_ce_len == sizeof(POWER_HEADROOM_CMD)) {
if(NFAPI_MODE==NFAPI_UE_STUB_PNF) {
if(NFAPI_MODE==NFAPI_UE_STUB_PNF || NFAPI_MODE==NFAPI_MODE_STANDALONE_PNF) {
//Substitute with a static value for the MAC layer abstraction (phy_stub mode)
phr_p->PH = 60;
} else {
@@ -3198,7 +3196,7 @@ ue_scheduler(const module_id_t module_idP,
"Module id %u Contention resolution timer expired, RA failed\n",
module_idP);
if(NFAPI_MODE==NFAPI_UE_STUB_PNF) { // phy_stub mode
if(NFAPI_MODE==NFAPI_UE_STUB_PNF || NFAPI_MODE==NFAPI_MODE_STANDALONE_PNF) { // phy_stub mode
// Modification for phy_stub mode operation here. We only need to make sure that the ue_mode is back to
// PRACH state.
LOG_I(MAC, "nfapi_mode3: Setting UE_mode to PRACH 2 \n");
+9 -9
View File
@@ -986,7 +986,7 @@ pdcp_data_ind(
* for the UE compiled in noS1 mode, we need 0
* TODO: be sure of this
*/
if (NFAPI_MODE == NFAPI_UE_STUB_PNF ) {
if (NFAPI_MODE == NFAPI_UE_STUB_PNF || NFAPI_MODE == NFAPI_MODE_STANDALONE_PNF) {
pdcpHead->inst = ctxt_pP->module_id;
} else { // nfapi_mode
if (UE_NAS_USE_TUN) {
@@ -2251,7 +2251,7 @@ void pdcp_set_pdcp_data_ind_func(pdcp_data_ind_func_t pdcp_data_ind) {
pdcp_params.pdcp_data_ind_func = pdcp_data_ind;
}
uint64_t pdcp_module_init( uint64_t pdcp_optmask ) {
uint64_t pdcp_module_init( uint64_t pdcp_optmask, int id) {
/* temporary enforce netlink when UE_NAS_USE_TUN is set,
this is while switching from noS1 as build option
to noS1 as config option */
@@ -2268,18 +2268,18 @@ uint64_t pdcp_module_init( uint64_t pdcp_optmask ) {
nas_getparams();
if(UE_NAS_USE_TUN) {
int num_if = (NFAPI_MODE == NFAPI_UE_STUB_PNF || IS_SOFTMODEM_SIML1 )? MAX_MOBILES_PER_ENB : 1;
int num_if = (NFAPI_MODE == NFAPI_UE_STUB_PNF || IS_SOFTMODEM_SIML1 || NFAPI_MODE == NFAPI_MODE_STANDALONE_PNF)? MAX_MOBILES_PER_ENB : 1;
netlink_init_tun("ue",num_if);
if (IS_SOFTMODEM_NOS1)
nas_config(1, 1, 2, "ue");
netlink_init_mbms_tun("uem");
nas_config(1, 1, 2, "ue");
netlink_init_mbms_tun("uem", id);
nas_config_mbms(1, 2, 2, "uem");
LOG_I(PDCP, "UE pdcp will use tun interface\n");
} else if(ENB_NAS_USE_TUN) {
netlink_init_tun("enb",1);
netlink_init_tun("enb", 1, 0);
nas_config(1, 1, 1, "enb");
if(pdcp_optmask & ENB_NAS_USE_TUN_W_MBMS_BIT){
netlink_init_mbms_tun("enm");
netlink_init_mbms_tun("enm", 0);
nas_config_mbms(1, 2, 1, "enm");
LOG_I(PDCP, "ENB pdcp will use mbms tun interface\n");
}
@@ -2291,8 +2291,8 @@ uint64_t pdcp_module_init( uint64_t pdcp_optmask ) {
}else{
if(pdcp_optmask & ENB_NAS_USE_TUN_W_MBMS_BIT){
LOG_W(PDCP, "ENB pdcp will use tun interface for MBMS\n");
netlink_init_mbms_tun("enm");
nas_config_mbms_s1(1, 2, 1, "enm");
netlink_init_mbms_tun("enm", 1);
nas_config_mbms_s1(1, 2, 1, "enm");
}else
LOG_E(PDCP, "ENB pdcp will not use tun interface\n");
}
+1 -1
View File
@@ -402,7 +402,7 @@ void pdcp_mbms_run (
*/
void pdcp_run (
const protocol_ctxt_t *const ctxt_pP);
uint64_t pdcp_module_init (uint64_t pdcp_optmask);
uint64_t pdcp_module_init (uint64_t pdcp_optmask, int ue_id);
void pdcp_module_cleanup (void);
void nr_ip_over_LTE_DRB_preconfiguration (void);
void pdcp_layer_init (void);
+18 -8
View File
@@ -91,7 +91,7 @@ extern struct msghdr nas_msg_rx;
extern int gtpv1u_new_data_req( uint8_t enb_module_idP, rnti_t ue_rntiP, uint8_t rab_idP, uint8_t *buffer_pP, uint32_t buf_lenP, uint32_t buf_offsetP);
uint16_t ue_id_g;// global variable to identify ue id for each ue. Change happens only in main function of lte-uesoftmodem.c
void debug_pdcp_pc5s_sdu(sidelink_pc5s_element *sl_pc5s_msg, char *title) {
LOG_I(PDCP,"%s: \nPC5S message, header traffic_type: %d)\n", title, sl_pc5s_msg->pc5s_header.traffic_type);
@@ -217,8 +217,15 @@ int pdcp_fifo_read_input_sdus_fromtun (const protocol_ctxt_t *const ctxt_pP) {
do {
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_FIFO_READ, 1 );
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_FIFO_READ_BUFFER, 1 );
len = read(UE_NAS_USE_TUN?nas_sock_fd[ctxt_pP->module_id]:nas_sock_fd[0], &nl_rx_buf, NL_MAX_PAYLOAD);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_FIFO_READ_BUFFER, 0 );
if (ue_id_g == 0)
{
len = read(UE_NAS_USE_TUN?nas_sock_fd[ctxt_pP->module_id]:nas_sock_fd[0], &nl_rx_buf, NL_MAX_PAYLOAD);
}
else
{
len = read(UE_NAS_USE_TUN?nas_sock_fd[ue_id_g]:nas_sock_fd[0], &nl_rx_buf, NL_MAX_PAYLOAD);
}
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_FIFO_READ_BUFFER, 0 );
if (len<=0) continue;
@@ -497,7 +504,10 @@ int pdcp_fifo_read_input_sdus_fromnetlinksock (const protocol_ctxt_t *const ctx
}
}
} else { // ctxt.enb_flag => UE
if (NFAPI_MODE == NFAPI_UE_STUB_PNF) {
if (NFAPI_MODE == NFAPI_UE_STUB_PNF || NFAPI_MODE == NFAPI_MODE_STANDALONE_PNF) {
#ifdef UESIM_EXPANSION
ctxt.module_id = inst_pdcp_list[pdcp_read_header_g.inst];
#else
ctxt.module_id = pdcp_read_header_g.inst;
} else {
ctxt.module_id = 0;
@@ -549,8 +559,8 @@ int pdcp_fifo_read_input_sdus_fromnetlinksock (const protocol_ctxt_t *const ctx
pdcp_read_header_g.data_size,
(unsigned char *)NLMSG_DATA(nas_nlh_rx),
PDCP_TRANSMISSION_MODE_DATA,
(NFAPI_MODE == NFAPI_UE_STUB_PNF)?NULL:&pdcp_read_header_g.sourceL2Id,
(NFAPI_MODE == NFAPI_UE_STUB_PNF)?NULL:&pdcp_read_header_g.destinationL2Id
(NFAPI_MODE == NFAPI_UE_STUB_PNF || NFAPI_MODE == NFAPI_MODE_STANDALONE_PNF)?NULL:&pdcp_read_header_g.sourceL2Id,
(NFAPI_MODE == NFAPI_UE_STUB_PNF || NFAPI_MODE == NFAPI_MODE_STANDALONE_PNF)?NULL:&pdcp_read_header_g.destinationL2Id
);
} else { /* else of h_rc == HASH_TABLE_OK */
MSC_LOG_RX_DISCARDED_MESSAGE(
@@ -594,8 +604,8 @@ int pdcp_fifo_read_input_sdus_fromnetlinksock (const protocol_ctxt_t *const ctx
pdcp_read_header_g.data_size,
(unsigned char *)NLMSG_DATA(nas_nlh_rx),
PDCP_TRANSMISSION_MODE_DATA,
(NFAPI_MODE == NFAPI_UE_STUB_PNF) ? NULL :&pdcp_read_header_g.sourceL2Id,
(NFAPI_MODE == NFAPI_UE_STUB_PNF) ? NULL :&pdcp_read_header_g.destinationL2Id
(NFAPI_MODE == NFAPI_UE_STUB_PNF|| NFAPI_MODE == NFAPI_MODE_STANDALONE_PNF) ? NULL :&pdcp_read_header_g.sourceL2Id,
(NFAPI_MODE == NFAPI_UE_STUB_PNF|| NFAPI_MODE == NFAPI_MODE_STANDALONE_PNF) ? NULL :&pdcp_read_header_g.destinationL2Id
);
} /* rab_id == 0 */
} /*pdcp_read_state_g != 0 */
+1
View File
@@ -0,0 +1 @@
/queue_test
+25 -18
View File
@@ -22,25 +22,31 @@ extern UL_RCC_IND_t UL_RCC_INFO;
uint16_t frame_cnt=0;
void handle_rach(UL_IND_t *UL_info) {
int i;
if(NFAPI_MODE == NFAPI_MODE_VNF) {
for(uint8_t j = 0; j < NUM_NFPAI_SUBFRAME; j++) {
if (UL_RCC_INFO.rach_ind[j].rach_indication_body.number_of_preambles>0) {
AssertFatal(UL_RCC_INFO.rach_ind[j].rach_indication_body.number_of_preambles==1,"More than 1 preamble not supported\n");
LOG_D(MAC,"UL_info[Frame %d, Subframe %d] Calling initiate_ra_proc RACH:SFN/SF:%d\n",UL_info->frame,UL_info->subframe, NFAPI_SFNSF2DEC(UL_RCC_INFO.rach_ind[j].sfn_sf));
initiate_ra_proc(UL_info->module_id,
UL_info->CC_id,
NFAPI_SFNSF2SFN(UL_RCC_INFO.rach_ind[j].sfn_sf),
NFAPI_SFNSF2SF(UL_RCC_INFO.rach_ind[j].sfn_sf),
UL_RCC_INFO.rach_ind[j].rach_indication_body.preamble_list[0].preamble_rel8.preamble,
UL_RCC_INFO.rach_ind[j].rach_indication_body.preamble_list[0].preamble_rel8.timing_advance,
UL_RCC_INFO.rach_ind[j].rach_indication_body.preamble_list[0].preamble_rel8.rnti,
0
);
free(UL_RCC_INFO.rach_ind[j].rach_indication_body.preamble_list);
UL_RCC_INFO.rach_ind[j].rach_indication_body.number_of_preambles = 0;
UL_RCC_INFO.rach_ind[j].header.message_id = 0;
int j = UL_info->subframe;
AssertFatal(j < sizeof(UL_RCC_INFO.rach_ind) / sizeof(UL_RCC_INFO.rach_ind[0]), "j index out of range of index of rach_ind\n");
if (NFAPI_MODE == NFAPI_MODE_VNF)
{
if (UL_RCC_INFO.rach_ind[j].rach_indication_body.number_of_preambles > 0)
{
if (UL_RCC_INFO.rach_ind[j].rach_indication_body.number_of_preambles > 1)
{
LOG_D(MAC, "handle_rach j: %d UL_RCC_INFO.rach_ind[j].rach_indication_body.number_of_preambles: %d\n",
j, UL_RCC_INFO.rach_ind[j].rach_indication_body.number_of_preambles);
LOG_D(MAC, "UL_info[Frame %d, Subframe %d] Calling initiate_ra_proc RACH:Frame: %d Subframe: %d\n",
UL_info->frame, UL_info->subframe, NFAPI_SFNSF2SFN(UL_RCC_INFO.rach_ind[j].sfn_sf), NFAPI_SFNSF2SF(UL_RCC_INFO.rach_ind[j].sfn_sf));
}
AssertFatal(UL_RCC_INFO.rach_ind[j].rach_indication_body.number_of_preambles == 1, "More than 1 preamble not supported\n"); // dump frame/sf and all things in UL_RCC_INFO
initiate_ra_proc(UL_info->module_id,
UL_info->CC_id,
NFAPI_SFNSF2SFN(UL_RCC_INFO.rach_ind[j].sfn_sf),
NFAPI_SFNSF2SF(UL_RCC_INFO.rach_ind[j].sfn_sf),
UL_RCC_INFO.rach_ind[j].rach_indication_body.preamble_list[0].preamble_rel8.preamble,
UL_RCC_INFO.rach_ind[j].rach_indication_body.preamble_list[0].preamble_rel8.timing_advance,
UL_RCC_INFO.rach_ind[j].rach_indication_body.preamble_list[0].preamble_rel8.rnti,
0);
free(UL_RCC_INFO.rach_ind[j].rach_indication_body.preamble_list);
UL_RCC_INFO.rach_ind[j].rach_indication_body.number_of_preambles = 0;
UL_RCC_INFO.rach_ind[j].header.message_id = 0;
}
} else {
if (UL_info->rach_ind.rach_indication_body.number_of_preambles>0) {
@@ -788,6 +794,7 @@ IF_Module_t *IF_Module_init(int Mod_id) {
"allocation of if_inst[%d]->if_mutex fails\n",Mod_id);
}
memset(&UL_RCC_INFO, 0, sizeof(UL_RCC_INFO));
return if_inst[Mod_id];
}
+1 -1
View File
@@ -88,7 +88,7 @@ typedef struct {
} UL_IND_t;
// Downlink subframe P7
#define NUM_NFPAI_SUBFRAME 5
#define NUM_NFPAI_SUBFRAME 10
typedef struct {
/// harq indication list
nfapi_harq_indication_t harq_ind[NUM_NFPAI_SUBFRAME];
File diff suppressed because it is too large Load Diff
+66 -14
View File
@@ -13,21 +13,19 @@
#include "openair2/PHY_INTERFACE/IF_Module.h"
#include "nfapi_interface.h"
#include "nfapi_pnf_interface.h"
#include <pthread.h>
#include <semaphore.h>
#include "nfapi/oai_integration/vendor_ext.h"
//#include "openair1/PHY/LTE_TRANSPORT/defs.h"
//#include "openair1/PHY/defs.h"
//#include "openair1/PHY/LTE_TRANSPORT/defs.h"
#include "queue.h"
//below 2 difinitions move to phy_stub_UE.c to add initialization when difinition.
extern UL_IND_t *UL_INFO;
extern nfapi_tx_request_pdu_t* tx_request_pdu_list;
// New
/// Pointers to config_request types. Used from nfapi callback functions.
//below 3 difinitions move to phy_stub_UE.c to add initialization when difinition.
extern nfapi_dl_config_request_t* dl_config_req;
extern nfapi_ul_config_request_t* ul_config_req;
extern nfapi_hi_dci0_request_t* hi_dci0_req;
int tx_req_num_elems;
//below 2 difinitions move to lte-ue.c to add initialization when difinition.
//int next_ra_frame;
@@ -61,16 +59,19 @@ void send_nfapi_UL_indications(UL_IND_t UL_INFO);
//void fill_rx_indication_UE_MAC(module_id_t Mod_id,int frame,int subframe);
void fill_rx_indication_UE_MAC(module_id_t Mod_id,int frame,int subframe, UL_IND_t *UL_INFO, uint8_t *ulsch_buffer, uint16_t buflen, uint16_t rnti, int index);
void fill_rx_indication_UE_MAC(module_id_t Mod_id,int frame,int subframe, UL_IND_t *UL_INFO, uint8_t *ulsch_buffer, uint16_t buflen, uint16_t rnti, int index,
nfapi_ul_config_request_t *ul_config_req);
// This function should be indicating directly to the eNB when there is a planned scheduling request at the MAC layer
// of the UE. It should get called from ue_get_SR()
void fill_sr_indication_UE_MAC(int Mod_id,int frame,int subframe, UL_IND_t *UL_INFO, uint16_t rnti);
void fill_sr_indication_UE_MAC(int Mod_id,int frame,int subframe, UL_IND_t *UL_INFO, uint16_t rnti,
nfapi_ul_config_request_t *ul_config_req);
// In our case the this function will be always indicating ACK to the MAC of the eNB (i.e. always assuming)
// successful decoding.
void fill_crc_indication_UE_MAC(int Mod_id,int frame,int subframe, UL_IND_t *UL_INFO, uint8_t crc_flag, int index, uint16_t rnti);
void fill_crc_indication_UE_MAC(int Mod_id,int frame,int subframe, UL_IND_t *UL_INFO, uint8_t crc_flag, int index, uint16_t rnti,
nfapi_ul_config_request_t *ul_config_req);
void fill_rach_indication_UE_MAC(int Mod_id,int frame,int subframe, UL_IND_t *UL_INFO, uint8_t ra_PreambleIndex, uint16_t ra_RNTI);
@@ -79,9 +80,11 @@ void fill_rach_indication_UE_MAC(int Mod_id,int frame,int subframe, UL_IND_t *UL
void fill_ulsch_cqi_indication_UE_MAC(int Mod_id, uint16_t frame,uint8_t subframe, UL_IND_t *UL_INFO, uint16_t rnti);
void fill_ulsch_harq_indication_UE_MAC(int Mod_id, int frame,int subframe, UL_IND_t *UL_INFO, nfapi_ul_config_ulsch_harq_information *harq_information, uint16_t rnti);
void fill_ulsch_harq_indication_UE_MAC(int Mod_id, int frame,int subframe, UL_IND_t *UL_INFO, nfapi_ul_config_ulsch_harq_information *harq_information, uint16_t rnti,
nfapi_ul_config_request_t *ul_config_req);
void fill_uci_harq_indication_UE_MAC(int Mod_id, int frame, int subframe, UL_IND_t *UL_INFO,nfapi_ul_config_harq_information *harq_information, uint16_t rnti
void fill_uci_harq_indication_UE_MAC(int Mod_id, int frame, int subframe, UL_IND_t *UL_INFO,nfapi_ul_config_harq_information *harq_information, uint16_t rnti,
nfapi_ul_config_request_t *ul_config_req
/*uint8_t tdd_mapping_mode,
uint16_t tdd_multiplexing_mask*/);
@@ -89,13 +92,29 @@ int ul_config_req_UE_MAC(nfapi_ul_config_request_t* req, int frame, int subframe
void handle_nfapi_ul_pdu_UE_MAC(module_id_t Mod_id,
nfapi_ul_config_request_pdu_t *ul_config_pdu,
uint16_t frame,uint8_t subframe,uint8_t srs_present, int index);
uint16_t frame,uint8_t subframe,uint8_t srs_present, int index,
nfapi_ul_config_request_t *ul_config_req);
typedef struct nfapi_tx_req_pdu_list_t
{
int num_pdus; /* number .pdus[] objects */
nfapi_tx_request_pdu_t pdus[]; /* see "struct hack" */
} nfapi_tx_req_pdu_list_t;
typedef struct nfapi_dl_config_req_tx_req_t
{
nfapi_dl_config_request_t *dl_config_req;
nfapi_tx_req_pdu_list_t *tx_req_pdu_list;
} nfapi_dl_config_req_tx_req_t;
void nfapi_free_tx_req_pdu_list(nfapi_tx_req_pdu_list_t *);
void dl_config_req_UE_MAC_dci(int sfn,
int sf,
nfapi_dl_config_request_pdu_t *dci,
nfapi_dl_config_request_pdu_t *dlsch,
int num_ue);
int num_ue,
nfapi_tx_req_pdu_list_t *);
void dl_config_req_UE_MAC_bch(int sfn,
int sf,
nfapi_dl_config_request_pdu_t *bch,
@@ -103,7 +122,8 @@ void dl_config_req_UE_MAC_bch(int sfn,
void dl_config_req_UE_MAC_mch(int sfn,
int sf,
nfapi_dl_config_request_pdu_t *bch,
int num_ue);
int num_ue,
nfapi_tx_req_pdu_list_t *);
int tx_req_UE_MAC(nfapi_tx_request_t* req);
@@ -129,6 +149,38 @@ int memcpy_hi_dci0_req (L1_rxtx_proc_t *proc, nfapi_pnf_p7_config_t* pnf_p7, nfa
void UE_config_stub_pnf(void);
void *memcpy_tx_req_standalone(nfapi_tx_request_t *tx_req);
void *memcpy_dl_config_req_standalone(nfapi_dl_config_request_t *dl_config_req);
// open an SCTP socket with a standalone PNF module
void ue_init_standalone_socket(const char *addr, int tx_port, int rx_port);
// read from standalone pnf socket call corresponding memcpy functions
void *ue_standalone_pnf_task(void *context);
void send_standalone_msg(UL_IND_t *UL, nfapi_message_id_e msg_type);
void send_standalone_dummy(void);
void enqueue_dl_config_req_tx_req(nfapi_dl_config_request_t *dl_config_req, nfapi_tx_request_t *tx_req);
// Convert downlink nfapi messages to a string.
// Returned memory is malloc'ed, caller is responsible for freeing.
char *nfapi_dl_config_req_to_string(nfapi_dl_config_request_t *req);
char *nfapi_ul_config_req_to_string(nfapi_ul_config_request_t *req);
// Convert downlink nfapi messages to a string.
// Returned memory is statically allocated.
const char *dl_pdu_type_to_string(uint8_t pdu_type);
const char *ul_pdu_type_to_string(uint8_t pdu_type);
extern queue_t dl_config_req_tx_req_queue;
extern queue_t ul_config_req_queue;
extern queue_t hi_dci0_req_queue;
extern nfapi_ul_config_request_t* ul_config_req;
extern nfapi_hi_dci0_request_t* hi_dci0_req;
extern int current_sfn_sf;
extern sem_t sfn_semaphore;
#endif /* PHY_STUB_UE_H_ */
+159
View File
@@ -0,0 +1,159 @@
#include "queue.h"
#include <string.h>
#include <assert.h>
#ifdef UNITTEST
#include <stdio.h>
#define LOG_ERROR(MSG) printf(MSG "\n")
#else
#include "common/utils/LOG/log.h"
#define LOG_ERROR(MSG) LOG_E(PHY, MSG "\n")
#endif
void init_queue(queue_t *q)
{
memset(q, 0, sizeof(*q));
pthread_mutex_init(&q->mutex, NULL);
}
bool put_queue(queue_t *q, void *item)
{
assert(item != NULL);
if (pthread_mutex_lock(&q->mutex) != 0)
{
LOG_ERROR("put_queue: mutex_lock failed");
return false;
}
bool queued;
if (q->num_items >= MAX_QUEUE_SIZE)
{
LOG_ERROR("put_queue: queue is full");
queued = false;
}
else
{
assert(q->items[q->write_index] == NULL);
q->items[q->write_index] = item;
q->write_index = (q->write_index + 1) % MAX_QUEUE_SIZE;
q->num_items++;
queued = true;
}
pthread_mutex_unlock(&q->mutex);
return queued;
}
void *get_queue(queue_t *q)
{
void *item = NULL;
if (pthread_mutex_lock(&q->mutex) != 0)
{
LOG_ERROR("get_queue: mutex_lock failed");
return NULL;
}
if (q->num_items > 0)
{
item = q->items[q->read_index];
assert(item != NULL);
q->items[q->read_index] = NULL;
q->read_index = (q->read_index + 1) % MAX_QUEUE_SIZE;
q->num_items--;
}
pthread_mutex_unlock(&q->mutex);
return item;
}
bool requeue(queue_t *q, void *item)
{
assert(item != NULL);
if (pthread_mutex_lock(&q->mutex) != 0)
{
LOG_ERROR("requeue: mutex_lock failed");
return false;
}
bool queued;
if (q->num_items >= MAX_QUEUE_SIZE)
{
LOG_ERROR("requeue: queue is full");
queued = false;
}
else
{
q->read_index = (q->read_index + MAX_QUEUE_SIZE - 1) % MAX_QUEUE_SIZE;
assert(q->items[q->read_index] == NULL);
q->items[q->read_index] = item;
q->num_items++;
queued = true;
}
pthread_mutex_unlock(&q->mutex);
return queued;
}
void *unqueue(queue_t *q)
{
void *item = NULL;
if (pthread_mutex_lock(&q->mutex) != 0) {
LOG_ERROR("unqueue: mutex_lock failed");
return NULL;
}
if (q->num_items > 0) {
q->write_index = (q->write_index + MAX_QUEUE_SIZE - 1) % MAX_QUEUE_SIZE;
item = q->items[q->write_index];
q->items[q->write_index] = NULL;
q->num_items--;
}
pthread_mutex_unlock(&q->mutex);
return item;
}
void *unqueue_matching(queue_t *q, size_t max_depth, queue_matcher_t *matcher, void *wanted)
{
if (pthread_mutex_lock(&q->mutex) != 0)
{
LOG_ERROR("unqueue_matching: mutex_lock failed");
return NULL;
}
void *item = NULL;
size_t endi = q->write_index;
for (size_t i = 0; i < q->num_items; i++)
{
if (max_depth == 0)
{
break;
}
--max_depth;
endi = (endi + MAX_QUEUE_SIZE - 1) % MAX_QUEUE_SIZE;
void *candidate = q->items[endi];
if (matcher(wanted, candidate))
{
item = candidate;
// delete item from the queue and move other items down
for (;;)
{
size_t j = (endi + 1) % MAX_QUEUE_SIZE;
if (j == q->write_index)
{
q->items[endi] = NULL;
q->write_index = endi;
q->num_items--;
break;
}
q->items[endi] = q->items[j];
endi = j;
}
break;
}
}
pthread_mutex_unlock(&q->mutex);
return item;
}
+62
View File
@@ -0,0 +1,62 @@
/*
queue_t is a basic thread-safe non-blocking fixed-size queue.
put_queue returns false if the queue is full.
get_queue returns NULL if the queue is empty.
Example usage:
// Initialization:
queue_t fooq;
init_queue(&fooq);
// Producer:
foo_t *item = new_foo();
if (!put_queue(&fooq, item))
delete_foo(item);
// Consumer:
foo_t *item = get_queue(&fooq);
if (item)
{
do_something_with_foo(item);
delete_foo(item);
}
*/
#pragma once
#include <stdbool.h>
#include <stdint.h>
#include <pthread.h>
#define MAX_QUEUE_SIZE 512
typedef struct queue_t
{
void *items[MAX_QUEUE_SIZE];
size_t read_index, write_index;
size_t num_items;
pthread_mutex_t mutex;
} queue_t;
void init_queue(queue_t *q);
bool put_queue(queue_t *q, void *item);
void *get_queue(queue_t *q);
/* Put the given item back onto this queue at the head.
(The next call to put_queue would return this item.)
Return true if successful, false if the queue was full */
bool requeue(queue_t *q, void *item);
/* Remove the last item queued.
Return the item or NULL if the queue was empty */
void *unqueue(queue_t *q);
typedef bool queue_matcher_t(void *wanted, void *candidate);
/* Unqueue the most recently queued item for which `matcher(wanted, candidate)`
returns true where `candidate` is an item currently on the queue.
Look only at the last `max_depth` items on the queue, at most.
Returns the candidate item, or NULL if none matches */
void *unqueue_matching(queue_t *q, size_t max_depth, queue_matcher_t *matcher, void *wanted);
+226
View File
@@ -0,0 +1,226 @@
#include "queue.h"
#include <stdio.h>
#include <stdlib.h>
#define FAIL do { \
printf("\n*** FAILED at %s line %d\n", __FILE__, __LINE__); \
pass = false; \
} while (0)
#define EQUAL(A, B) do { \
if ((A) != (B)) \
FAIL; \
} while (0)
typedef uint32_t Thing_t; /* actual type doesn't matter */
static Thing_t things[MAX_QUEUE_SIZE];
static Thing_t thing1, thing2;
static bool matcher(void *wanted, void *candidate)
{
return wanted == candidate;
}
int main(void)
{
bool pass = true;
queue_t queue;
init_queue(&queue);
for (int i = 0; i < MAX_QUEUE_SIZE; ++i)
{
if (!put_queue(&queue, &things[i]))
{
FAIL;
}
}
/* queue is full */
if (put_queue(&queue, &thing1))
FAIL;
Thing_t *p;
for (int i = 0; i < MAX_QUEUE_SIZE; ++i)
{
p = get_queue(&queue);
EQUAL(p, &things[i]);
}
/* queue is empty */
p = get_queue(&queue);
EQUAL(p, NULL);
for (int i = 0; i < MAX_QUEUE_SIZE; ++i)
{
if (!put_queue(&queue, &things[i]))
{
FAIL;
}
}
p = get_queue(&queue);
EQUAL(p, &things[0]);
p = get_queue(&queue);
EQUAL(p, &things[1]);
if (!requeue(&queue, &thing1))
FAIL;
if (!requeue(&queue, &thing2))
FAIL;
p = get_queue(&queue);
EQUAL(p, &thing2);
p = get_queue(&queue);
EQUAL(p, &thing1);
if (!requeue(&queue, &things[1]))
FAIL;
if (!requeue(&queue, &things[0]))
FAIL;
for (int i = 0; i < MAX_QUEUE_SIZE / 2; ++i)
{
p = get_queue(&queue);
EQUAL(p, &things[i]);
}
for (int i = MAX_QUEUE_SIZE / 2; i < MAX_QUEUE_SIZE; ++i)
{
if (!put_queue(&queue, &things[i]))
FAIL;
}
p = get_queue(&queue);
EQUAL(p, &things[MAX_QUEUE_SIZE / 2]);
p = get_queue(&queue);
EQUAL(p, &things[MAX_QUEUE_SIZE / 2 + 1]);
// ---- unqueue ----
init_queue(&queue);
for (int i = 0; i < MAX_QUEUE_SIZE; ++i)
{
if (!put_queue(&queue, &things[i]))
{
FAIL;
}
}
for (int i = MAX_QUEUE_SIZE; --i >= 0;)
{
p = unqueue(&queue);
EQUAL(p, &things[i]);
EQUAL(queue.num_items, i);
}
EQUAL(queue.num_items, 0);
if (!put_queue(&queue, &thing1))
FAIL;
if (!put_queue(&queue, &thing2))
FAIL;
EQUAL(queue.num_items, 2);
p = get_queue(&queue);
EQUAL(p, &thing1);
p = get_queue(&queue);
EQUAL(p, &thing2);
// ---- unqueue_matching ----
init_queue(&queue);
// empty queue
p = unqueue_matching(&queue, MAX_QUEUE_SIZE, matcher, &thing1);
EQUAL(p, NULL);
EQUAL(queue.num_items, 0);
// one item in queue
if (!put_queue(&queue, &thing1))
FAIL;
EQUAL(queue.num_items, 1);
p = unqueue_matching(&queue, MAX_QUEUE_SIZE, matcher, &thing2);
EQUAL(p, NULL);
EQUAL(queue.num_items, 1);
p = unqueue_matching(&queue, /*max_queue=*/ 0, matcher, &thing1);
EQUAL(p, NULL);
EQUAL(queue.num_items, 1);
p = unqueue_matching(&queue, /*max_queue=*/ 1, matcher, &thing1);
EQUAL(p, &thing1);
EQUAL(queue.num_items, 0);
// more max_queue values
for (int i = 0; i < MAX_QUEUE_SIZE; ++i)
{
if (!put_queue(&queue, &things[i]))
{
FAIL;
}
}
p = unqueue_matching(&queue, /*max_queue=*/ 0, matcher, &things[MAX_QUEUE_SIZE - 1]);
EQUAL(p, NULL);
p = unqueue_matching(&queue, /*max_queue=*/ 1, matcher, &things[MAX_QUEUE_SIZE - 1]);
EQUAL(p, &things[MAX_QUEUE_SIZE - 1]);
EQUAL(queue.num_items, MAX_QUEUE_SIZE - 1);
p = unqueue_matching(&queue, /*max_queue=*/ MAX_QUEUE_SIZE - 2, matcher, &things[0]);
EQUAL(p, NULL);
p = unqueue_matching(&queue, /*max_queue=*/ MAX_QUEUE_SIZE - 1, matcher, &things[0]);
EQUAL(p, &things[0]);
EQUAL(queue.num_items, MAX_QUEUE_SIZE - 2);
// fill the queue then remove every other item
init_queue(&queue);
for (int i = 0; i < MAX_QUEUE_SIZE; ++i)
{
if (!put_queue(&queue, &things[i]))
{
FAIL;
}
}
p = unqueue_matching(&queue, MAX_QUEUE_SIZE, matcher, &thing1);
EQUAL(p, NULL);
for (int i = MAX_QUEUE_SIZE - 1; i >= 0; i -= 2)
{
p = unqueue_matching(&queue, MAX_QUEUE_SIZE, matcher, &things[i]);
EQUAL(p, &things[i]);
}
EQUAL(queue.num_items, MAX_QUEUE_SIZE / 2);
p = unqueue_matching(&queue, MAX_QUEUE_SIZE, matcher, &thing1);
EQUAL(p, NULL);
for (int i = 0; i < MAX_QUEUE_SIZE; i += 2)
{
p = get_queue(&queue);
EQUAL(p, &things[i]);
}
EQUAL(queue.num_items, 0);
// fill the queue then remove every third item
for (int i = 0; i < MAX_QUEUE_SIZE; ++i)
{
if (!put_queue(&queue, &things[i]))
{
FAIL;
}
}
p = unqueue_matching(&queue, MAX_QUEUE_SIZE, matcher, &thing1);
EQUAL(p, NULL);
for (int i = 0; i < MAX_QUEUE_SIZE; i += 3)
{
p = unqueue_matching(&queue, MAX_QUEUE_SIZE, matcher, &things[i]);
EQUAL(p, &things[i]);
}
EQUAL(queue.num_items, MAX_QUEUE_SIZE * 2 / 3);
p = unqueue_matching(&queue, MAX_QUEUE_SIZE, matcher, &thing1);
EQUAL(p, NULL);
for (int i = 0; i < MAX_QUEUE_SIZE; ++i)
{
if (i % 3 == 0)
continue;
p = get_queue(&queue);
EQUAL(p, &things[i]);
}
EQUAL(queue.num_items, 0);
if (!pass)
return EXIT_FAILURE;
return EXIT_SUCCESS;
}
+18
View File
@@ -0,0 +1,18 @@
#!/bin/bash
opts=(
-Wall -Werror
-Wno-error=int-to-pointer-cast
-Wno-int-to-pointer-cast
-DUNITTEST
)
set -x
gcc "${opts[@]}" -fsanitize=address -o queue_test queue_test.c queue.c || exit
./queue_test || exit
gcc "${opts[@]}" -o queue_test queue_test.c queue.c || exit
valgrind ./queue_test || exit
: PASS
+14 -6
View File
@@ -407,12 +407,12 @@ char openair_rrc_ue_init( const module_id_t ue_mod_idP, const unsigned char eNB_
//-----------------------------------------------------------------------------
void rrc_ue_generate_RRCConnectionRequest( const protocol_ctxt_t *const ctxt_pP, const uint8_t eNB_index ) {
uint8_t i=0,rv[6];
uint8_t rv[6];
if(UE_rrc_inst[ctxt_pP->module_id].Srb0[eNB_index].Tx_buffer.payload_size ==0) {
// Get RRCConnectionRequest, fill random for now
// Generate random byte stream for contention resolution
for (i=0; i<6; i++) {
for (int i=0; i<6; i++) {
#ifdef SMBV
// if SMBV is configured the contention resolution needs to be fix for the connection procedure to succeed
rv[i]=i;
@@ -421,6 +421,14 @@ void rrc_ue_generate_RRCConnectionRequest( const protocol_ctxt_t *const ctxt_pP,
#endif
LOG_T(RRC,"%x.",rv[i]);
}
LOG_I(RRC, "%s: random = %02X %02X %02X %02X %02X %02X\n",
__func__,
rv[0],
rv[1],
rv[2],
rv[3],
rv[4],
rv[5]);
LOG_T(RRC,"\n");
UE_rrc_inst[ctxt_pP->module_id].Srb0[eNB_index].Tx_buffer.payload_size =
@@ -431,8 +439,8 @@ void rrc_ue_generate_RRCConnectionRequest( const protocol_ctxt_t *const ctxt_pP,
LOG_I(RRC,"[UE %d] : Frame %d, Logical Channel UL-CCCH (SRB0), Generating RRCConnectionRequest (bytes %d, eNB %d)\n",
ctxt_pP->module_id, ctxt_pP->frame, UE_rrc_inst[ctxt_pP->module_id].Srb0[eNB_index].Tx_buffer.payload_size, eNB_index);
for (i=0; i<UE_rrc_inst[ctxt_pP->module_id].Srb0[eNB_index].Tx_buffer.payload_size; i++) {
LOG_T(RRC,"%x.",UE_rrc_inst[ctxt_pP->module_id].Srb0[eNB_index].Tx_buffer.Payload[i]);
for (int i=0; i<UE_rrc_inst[ctxt_pP->module_id].Srb0[eNB_index].Tx_buffer.payload_size; i++) {
LOG_T(RRC,"%x.\n",UE_rrc_inst[ctxt_pP->module_id].Srb0[eNB_index].Tx_buffer.Payload[i]);
}
LOG_T(RRC,"\n");
@@ -622,7 +630,7 @@ int rrc_ue_decode_ccch( const protocol_ctxt_t *const ctxt_pP, const SRB_INFO *co
break;
case LTE_DL_CCCH_MessageType__c1_PR_rrcConnectionSetup:
LOG_I(RRC,
LOG_A(RRC,
"[UE%d][RAPROC] Frame %d : Logical Channel DL-CCCH (SRB0), Received RRCConnectionSetup RNTI %x\n",
ctxt_pP->module_id,
ctxt_pP->frame,
@@ -1694,7 +1702,7 @@ rrc_ue_process_ueCapabilityEnquiry(
xer_fprint(stdout, &asn_DEF_LTE_UL_DCCH_Message, (void *)&ul_dcch_msg);
}
LOG_I(RRC,"UECapabilityInformation Encoded %zd bits (%zd bytes)\n",enc_rval.encoded,(enc_rval.encoded+7)/8);
LOG_A(RRC,"UECapabilityInformation Encoded %zd bits (%zd bytes)\n",enc_rval.encoded,(enc_rval.encoded+7)/8);
rrc_data_req_ue (
ctxt_pP,
DCCH,
+3 -3
View File
@@ -155,7 +155,7 @@ init_SI(
LOG_D(RRC,"%s()\n\n\n\n",__FUNCTION__);
if(configuration->radioresourceconfig[CC_id].mbms_dedicated_serving_cell == TRUE) {
LOG_I(RRC, "Configuring MIB FeMBMS (N_RB_DL %d)\n",
LOG_A(RRC, "Configuring MIB FeMBMS (N_RB_DL %d)\n",
(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],
@@ -256,7 +256,7 @@ init_SI(
carrier->N_RB_DL = configuration->N_RB_DL[CC_id];
carrier->pbch_repetition = configuration->pbch_repetition[CC_id];
LOG_I(RRC, "configuration->schedulingInfoSIB1_BR_r13[CC_id] %d\n",(int)configuration->schedulingInfoSIB1_BR_r13[CC_id]);
LOG_I(RRC, "Configuring MIB (N_RB_DL %d,phich_Resource %d,phich_Duration %d)\n",
LOG_A(RRC, "Configuring MIB (N_RB_DL %d,phich_Resource %d,phich_Duration %d)\n",
(int)configuration->N_RB_DL[CC_id],
(int)configuration->radioresourceconfig[CC_id].phich_resource,
(int)configuration->radioresourceconfig[CC_id].phich_duration);
@@ -1198,7 +1198,7 @@ rrc_eNB_process_RRCConnectionSetupComplete(
)
//-----------------------------------------------------------------------------
{
LOG_I(RRC, PROTOCOL_RRC_CTXT_UE_FMT" [RAPROC] Logical Channel UL-DCCH, " "processing LTE_RRCConnectionSetupComplete from UE (SRB1 Active)\n",
LOG_A(RRC, PROTOCOL_RRC_CTXT_UE_FMT" [RAPROC] Logical Channel UL-DCCH, " "processing LTE_RRCConnectionSetupComplete from UE (SRB1 Active)\n",
PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP));
ue_context_pP->ue_context.Srb1.Active = 1;
ue_context_pP->ue_context.Status = RRC_CONNECTED;
+2
View File
@@ -262,10 +262,12 @@ void display_usim_data(const char *filename) {
kasme[USIM_K_ASME_SIZE] = '\0';
memcpy(kasme, data.securityctx.Kasme.value, USIM_K_ASME_SIZE);
printf("\tKasme\t: \"%s\"\n", kasme);
#if 0 //This doesn't compile anymore due to compiler warnings about pointers
printf("\tulNAScount\t: 0x%.8x\n",
*(uint32_t*) data.securityctx.ulNAScount.value);
printf("\tdlNAScount\t: 0x%.8x\n",
*(uint32_t*) data.securityctx.dlNAScount.value);
#endif
printf("\talgorithmID\t: 0x%.2x\n\n",
data.securityctx.algorithmID.value[0]);
+680 -8
View File
@@ -29,7 +29,7 @@ PLMN: {
PLMN4: {
FULLNAME="OAI LTEBOX";
SHORTNAME="OAIALU";
MNC="93";
MNC="95";
MCC="208";
};
PLMN5: {
@@ -74,32 +74,38 @@ PLMN: {
MNC="04";
MCC="262";
};
PLMN12: {
FULLNAME="Vodafone Germ";
SHORTNAME="VODAFONE";
MNC="230";
MCC="320";
};
};
UE0:
{
USER: {
IMEI="356113022094149";
IMEI="356113022094148";
MANUFACTURER="EURECOM";
MODEL="LTE Android PC";
PIN="0000";
};
SIM: {
MSIN="0100001111";
USIM_API_K="8baf473f2f8fd09487cccbd7097c6862";
OPC="e734f8734007d6c5ce7a0508809e7e9c";
MSISDN="33611123456";
MSIN="100000025";
USIM_API_K="0c0a34601d4f07677303652c0462535b";
OPC="ba05688178e398bedc100674071002cb";
MSISDN="1011234561024";
};
# Home PLMN Selector with Access Technology
HPLMN= "20893";
HPLMN= "320230";
# User controlled PLMN Selector with Access Technology
UCPLMN_LIST = ();
# Operator PLMN List
OPLMN_LIST = ("00101", "20810", "20811", "20813", "20893", "310280", "310028");
OPLMN_LIST = ("00101", "20810", "20811", "20813", "20895", "310280", "310028", "320230");
# Operator controlled PLMN Selector with Access Technology
OCPLMN_LIST = ("22210", "21401", "21406", "26202", "26204");
@@ -112,3 +118,669 @@ UE0:
# EHPLMN_LIST= ("20811", "20813");
EHPLMN_LIST= ();
};
UE1:
{
USER: {
IMEI="356113022094149";
MANUFACTURER="EURECOM";
MODEL="LTE Android PC";
PIN="0000";
};
SIM: {
MSIN="100000166";
USIM_API_K="0c0a34601d4f07677303652c0462535b";
OPC="ba05688178e398bedc100674071002cb";
MSISDN="1011234561165";
};
# Home PLMN Selector with Access Technology
HPLMN= "320230";
# User controlled PLMN Selector with Access Technology
UCPLMN_LIST = ();
# Operator PLMN List
OPLMN_LIST = ("00101", "20810", "20811", "20813", "20895", "310280", "310028", "320230");
# Operator controlled PLMN Selector with Access Technology
OCPLMN_LIST = ("22210", "21401", "21406", "26202", "26204");
# Forbidden plmns
FPLMN_LIST = ();
# List of Equivalent HPLMNs
#TODO: UE does not connect if set, to be fixed in the UE
# EHPLMN_LIST= ("20811", "20813");
EHPLMN_LIST= ();
};
UE2:
{
USER: {
IMEI="356113022094150";
MANUFACTURER="EURECOM";
MODEL="LTE Android PC";
PIN="0000";
};
SIM: {
MSIN="100000012";
USIM_API_K="0c0a34601d4f07677303652c0462535b";
OPC="ba05688178e398bedc100674071002cb";
MSISDN="1011234561011";
};
# Home PLMN Selector with Access Technology
HPLMN= "320230";
# User controlled PLMN Selector with Access Technology
UCPLMN_LIST = ();
# Operator PLMN List
OPLMN_LIST = ("00101", "20810", "20811", "20813", "20895", "310280", "310028", "320230");
# Operator controlled PLMN Selector with Access Technology
OCPLMN_LIST = ("22210", "21401", "21406", "26202", "26204");
# Forbidden plmns
FPLMN_LIST = ();
# List of Equivalent HPLMNs
#TODO: UE does not connect if set, to be fixed in the UE
# EHPLMN_LIST= ("20811", "20813");
EHPLMN_LIST= ();
};
UE3:
{
USER: {
IMEI="356113022094151";
MANUFACTURER="EURECOM";
MODEL="LTE Android PC";
PIN="0000";
};
SIM: {
MSIN="100000064";
USIM_API_K="0c0a34601d4f07677303652c0462535b";
OPC="ba05688178e398bedc100674071002cb";
MSISDN="1011234561063";
};
# Home PLMN Selector with Access Technology
HPLMN= "320230";
# User controlled PLMN Selector with Access Technology
UCPLMN_LIST = ();
# Operator PLMN List
OPLMN_LIST = ("00101", "20810", "20811", "20813", "20895", "310280", "310028", "320230");
# Operator controlled PLMN Selector with Access Technology
OCPLMN_LIST = ("22210", "21401", "21406", "26202", "26204");
# Forbidden plmns
FPLMN_LIST = ();
# List of Equivalent HPLMNs
#TODO: UE does not connect if set, to be fixed in the UE
# EHPLMN_LIST= ("20811", "20813");
EHPLMN_LIST= ();
};
UE4:
{
USER: {
IMEI="356113022094152";
MANUFACTURER="EURECOM";
MODEL="LTE Android PC";
PIN="0000";
};
SIM: {
MSIN="100000082";
USIM_API_K="0c0a34601d4f07677303652c0462535b";
OPC="ba05688178e398bedc100674071002cb";
MSISDN="1011234561081";
};
# Home PLMN Selector with Access Technology
HPLMN= "320230";
# User controlled PLMN Selector with Access Technology
UCPLMN_LIST = ();
# Operator PLMN List
OPLMN_LIST = ("00101", "20810", "20811", "20813", "20895", "310280", "310028", "320230");
# Operator controlled PLMN Selector with Access Technology
OCPLMN_LIST = ("22210", "21401", "21406", "26202", "26204");
# Forbidden plmns
FPLMN_LIST = ();
# List of Equivalent HPLMNs
#TODO: UE does not connect if set, to be fixed in the UE
# EHPLMN_LIST= ("20811", "20813");
EHPLMN_LIST= ();
};
UE5:
{
USER: {
IMEI="356113022094153";
MANUFACTURER="EURECOM";
MODEL="LTE Android PC";
PIN="0000";
};
SIM: {
MSIN="100000011";
USIM_API_K="0c0a34601d4f07677303652c0462535b";
OPC="ba05688178e398bedc100674071002cb";
MSISDN="1011234561010";
};
# Home PLMN Selector with Access Technology
HPLMN= "320230";
# User controlled PLMN Selector with Access Technology
UCPLMN_LIST = ();
# Operator PLMN List
OPLMN_LIST = ("00101", "20810", "20811", "20813", "20895", "310280", "310028", "320230");
# Operator controlled PLMN Selector with Access Technology
OCPLMN_LIST = ("22210", "21401", "21406", "26202", "26204");
# Forbidden plmns
FPLMN_LIST = ();
# List of Equivalent HPLMNs
#TODO: UE does not connect if set, to be fixed in the UE
# EHPLMN_LIST= ("20811", "20813");
EHPLMN_LIST= ();
};
UE6:
{
USER: {
IMEI="356113022094154";
MANUFACTURER="EURECOM";
MODEL="LTE Android PC";
PIN="0000";
};
SIM: {
MSIN="100000093";
USIM_API_K="0c0a34601d4f07677303652c0462535b";
OPC="ba05688178e398bedc100674071002cb";
MSISDN="1011234561092";
};
# Home PLMN Selector with Access Technology
HPLMN= "320230";
# User controlled PLMN Selector with Access Technology
UCPLMN_LIST = ();
# Operator PLMN List
OPLMN_LIST = ("00101", "20810", "20811", "20813", "20895", "310280", "310028", "320230");
# Operator controlled PLMN Selector with Access Technology
OCPLMN_LIST = ("22210", "21401", "21406", "26202", "26204");
# Forbidden plmns
FPLMN_LIST = ();
# List of Equivalent HPLMNs
#TODO: UE does not connect if set, to be fixed in the UE
# EHPLMN_LIST= ("20811", "20813");
EHPLMN_LIST= ();
};
UE7:
{
USER: {
IMEI="356113022094155";
MANUFACTURER="EURECOM";
MODEL="LTE Android PC";
PIN="0000";
};
SIM: {
MSIN="100000188";
USIM_API_K="0c0a34601d4f07677303652c0462535b";
OPC="ba05688178e398bedc100674071002cb";
MSISDN="1011234561187";
};
# Home PLMN Selector with Access Technology
HPLMN= "320230";
# User controlled PLMN Selector with Access Technology
UCPLMN_LIST = ();
# Operator PLMN List
OPLMN_LIST = ("00101", "20810", "20811", "20813", "20895", "310280", "310028", "320230");
# Operator controlled PLMN Selector with Access Technology
OCPLMN_LIST = ("22210", "21401", "21406", "26202", "26204");
# Forbidden plmns
FPLMN_LIST = ();
# List of Equivalent HPLMNs
#TODO: UE does not connect if set, to be fixed in the UE
# EHPLMN_LIST= ("20811", "20813");
EHPLMN_LIST= ();
};
UE8:
{
USER: {
IMEI="356113022094158";
MANUFACTURER="EURECOM";
MODEL="LTE Android PC";
PIN="0000";
};
SIM: {
MSIN="100000017";
USIM_API_K="0c0a34601d4f07677303652c0462535b";
OPC="ba05688178e398bedc100674071002cb";
MSISDN="1011234561016";
};
# Home PLMN Selector with Access Technology
HPLMN= "320230";
# User controlled PLMN Selector with Access Technology
UCPLMN_LIST = ();
# Operator PLMN List
OPLMN_LIST = ("00101", "20810", "20811", "20813", "20895", "310280", "310028", "320230");
# Operator controlled PLMN Selector with Access Technology
OCPLMN_LIST = ("22210", "21401", "21406", "26202", "26204");
# Forbidden plmns
FPLMN_LIST = ();
# List of Equivalent HPLMNs
#TODO: UE does not connect if set, to be fixed in the UE
# EHPLMN_LIST= ("20811", "20813");
EHPLMN_LIST= ();
};
UE9:
{
USER: {
IMEI="356113022094159";
MANUFACTURER="EURECOM";
MODEL="LTE Android PC";
PIN="0000";
};
SIM: {
MSIN="100000071";
USIM_API_K="0c0a34601d4f07677303652c0462535b";
OPC="ba05688178e398bedc100674071002cb";
MSISDN="1011234561070";
};
# Home PLMN Selector with Access Technology
HPLMN= "320230";
# User controlled PLMN Selector with Access Technology
UCPLMN_LIST = ();
# Operator PLMN List
OPLMN_LIST = ("00101", "20810", "20811", "20813", "20895", "310280", "310028", "320230");
# Operator controlled PLMN Selector with Access Technology
OCPLMN_LIST = ("22210", "21401", "21406", "26202", "26204");
# Forbidden plmns
FPLMN_LIST = ();
# List of Equivalent HPLMNs
#TODO: UE does not connect if set, to be fixed in the UE
# EHPLMN_LIST= ("20811", "20813");
EHPLMN_LIST= ();
};
UE10:
{
USER: {
IMEI="356113022094110";
MANUFACTURER="EURECOM";
MODEL="LTE Android PC";
PIN="0000";
};
SIM: {
MSIN="100000125";
USIM_API_K="0c0a34601d4f07677303652c0462535b";
OPC="ba05688178e398bedc100674071002cb";
MSISDN="1011234561124";
};
# Home PLMN Selector with Access Technology
HPLMN= "320230";
# User controlled PLMN Selector with Access Technology
UCPLMN_LIST = ();
# Operator PLMN List
OPLMN_LIST = ("00101", "20810", "20811", "20813", "20895", "310280", "310028", "320230");
# Operator controlled PLMN Selector with Access Technology
OCPLMN_LIST = ("22210", "21401", "21406", "26202", "26204");
# Forbidden plmns
FPLMN_LIST = ();
# List of Equivalent HPLMNs
#TODO: UE does not connect if set, to be fixed in the UE
# EHPLMN_LIST= ("20811", "20813");
EHPLMN_LIST= ();
};
UE11:
{
USER: {
IMEI="356113022094111";
MANUFACTURER="EURECOM";
MODEL="LTE Android PC";
PIN="0000";
};
SIM: {
MSIN="100000067";
USIM_API_K="0c0a34601d4f07677303652c0462535b";
OPC="ba05688178e398bedc100674071002cb";
MSISDN="1011234561066";
};
# Home PLMN Selector with Access Technology
HPLMN= "320230";
# User controlled PLMN Selector with Access Technology
UCPLMN_LIST = ();
# Operator PLMN List
OPLMN_LIST = ("00101", "20810", "20811", "20813", "20895", "310280", "310028", "320230");
# Operator controlled PLMN Selector with Access Technology
OCPLMN_LIST = ("22210", "21401", "21406", "26202", "26204");
# Forbidden plmns
FPLMN_LIST = ();
# List of Equivalent HPLMNs
#TODO: UE does not connect if set, to be fixed in the UE
# EHPLMN_LIST= ("20811", "20813");
EHPLMN_LIST= ();
};
UE12:
{
USER: {
IMEI="356113022094112";
MANUFACTURER="EURECOM";
MODEL="LTE Android PC";
PIN="0000";
};
SIM: {
MSIN="100000152";
USIM_API_K="0c0a34601d4f07677303652c0462535b";
OPC="ba05688178e398bedc100674071002cb";
MSISDN="1011234561151";
};
# Home PLMN Selector with Access Technology
HPLMN= "320230";
# User controlled PLMN Selector with Access Technology
UCPLMN_LIST = ();
# Operator PLMN List
OPLMN_LIST = ("00101", "20810", "20811", "20813", "20895", "310280", "310028", "320230");
# Operator controlled PLMN Selector with Access Technology
OCPLMN_LIST = ("22210", "21401", "21406", "26202", "26204");
# Forbidden plmns
FPLMN_LIST = ();
# List of Equivalent HPLMNs
#TODO: UE does not connect if set, to be fixed in the UE
# EHPLMN_LIST= ("20811", "20813");
EHPLMN_LIST= ();
};
UE13:
{
USER: {
IMEI="356113022094113";
MANUFACTURER="EURECOM";
MODEL="LTE Android PC";
PIN="0000";
};
SIM: {
MSIN="100000083";
USIM_API_K="0c0a34601d4f07677303652c0462535b";
OPC="ba05688178e398bedc100674071002cb";
MSISDN="1011234561082";
};
# Home PLMN Selector with Access Technology
HPLMN= "320230";
# User controlled PLMN Selector with Access Technology
UCPLMN_LIST = ();
# Operator PLMN List
OPLMN_LIST = ("00101", "20810", "20811", "20813", "20895", "310280", "310028", "320230");
# Operator controlled PLMN Selector with Access Technology
OCPLMN_LIST = ("22210", "21401", "21406", "26202", "26204");
# Forbidden plmns
FPLMN_LIST = ();
# List of Equivalent HPLMNs
#TODO: UE does not connect if set, to be fixed in the UE
# EHPLMN_LIST= ("20811", "20813");
EHPLMN_LIST= ();
};
UE14:
{
USER: {
IMEI="356113022094114";
MANUFACTURER="EURECOM";
MODEL="LTE Android PC";
PIN="0000";
};
SIM: {
MSIN="100000086";
USIM_API_K="0c0a34601d4f07677303652c0462535b";
OPC="ba05688178e398bedc100674071002cb";
MSISDN="1011234561085";
};
# Home PLMN Selector with Access Technology
HPLMN= "320230";
# User controlled PLMN Selector with Access Technology
UCPLMN_LIST = ();
# Operator PLMN List
OPLMN_LIST = ("00101", "20810", "20811", "20813", "20895", "310280", "310028", "320230");
# Operator controlled PLMN Selector with Access Technology
OCPLMN_LIST = ("22210", "21401", "21406", "26202", "26204");
# Forbidden plmns
FPLMN_LIST = ();
# List of Equivalent HPLMNs
#TODO: UE does not connect if set, to be fixed in the UE
# EHPLMN_LIST= ("20811", "20813");
EHPLMN_LIST= ();
};
UE15:
{
USER: {
IMEI="356113022094115";
MANUFACTURER="EURECOM";
MODEL="LTE Android PC";
PIN="0000";
};
SIM: {
MSIN="100000026";
USIM_API_K="0c0a34601d4f07677303652c0462535b";
OPC="ba05688178e398bedc100674071002cb";
MSISDN="1011234561025";
};
# Home PLMN Selector with Access Technology
HPLMN= "320230";
# User controlled PLMN Selector with Access Technology
UCPLMN_LIST = ();
# Operator PLMN List
OPLMN_LIST = ("00101", "20810", "20811", "20813", "20895", "310280", "310028", "320230");
# Operator controlled PLMN Selector with Access Technology
OCPLMN_LIST = ("22210", "21401", "21406", "26202", "26204");
# Forbidden plmns
FPLMN_LIST = ();
# List of Equivalent HPLMNs
#TODO: UE does not connect if set, to be fixed in the UE
# EHPLMN_LIST= ("20811", "20813");
EHPLMN_LIST= ();
};
UE16:
{
USER: {
IMEI="356113022094116";
MANUFACTURER="EURECOM";
MODEL="LTE Android PC";
PIN="0000";
};
SIM: {
MSIN="100000114";
USIM_API_K="0c0a34601d4f07677303652c0462535b";
OPC="ba05688178e398bedc100674071002cb";
MSISDN="1011234561113";
};
# Home PLMN Selector with Access Technology
HPLMN= "320230";
# User controlled PLMN Selector with Access Technology
UCPLMN_LIST = ();
# Operator PLMN List
OPLMN_LIST = ("00101", "20810", "20811", "20813", "20895", "310280", "310028", "320230");
# Operator controlled PLMN Selector with Access Technology
OCPLMN_LIST = ("22210", "21401", "21406", "26202", "26204");
# Forbidden plmns
FPLMN_LIST = ();
# List of Equivalent HPLMNs
#TODO: UE does not connect if set, to be fixed in the UE
# EHPLMN_LIST= ("20811", "20813");
EHPLMN_LIST= ();
};
UE17:
{
USER: {
IMEI="356113022094117";
MANUFACTURER="EURECOM";
MODEL="LTE Android PC";
PIN="0000";
};
SIM: {
MSIN="100000159";
USIM_API_K="0c0a34601d4f07677303652c0462535b";
OPC="ba05688178e398bedc100674071002cb";
MSISDN="1011234561158";
};
# Home PLMN Selector with Access Technology
HPLMN= "320230";
# User controlled PLMN Selector with Access Technology
UCPLMN_LIST = ();
# Operator PLMN List
OPLMN_LIST = ("00101", "20810", "20811", "20813", "20895", "310280", "310028", "320230");
# Operator controlled PLMN Selector with Access Technology
OCPLMN_LIST = ("22210", "21401", "21406", "26202", "26204");
# Forbidden plmns
FPLMN_LIST = ();
# List of Equivalent HPLMNs
#TODO: UE does not connect if set, to be fixed in the UE
# EHPLMN_LIST= ("20811", "20813");
EHPLMN_LIST= ();
};
UE18:
{
USER: {
IMEI="356113022094118";
MANUFACTURER="EURECOM";
MODEL="LTE Android PC";
PIN="0000";
};
SIM: {
MSIN="100000113";
USIM_API_K="0c0a34601d4f07677303652c0462535b";
OPC="ba05688178e398bedc100674071002cb";
MSISDN="1011234561112";
};
# Home PLMN Selector with Access Technology
HPLMN= "320230";
# User controlled PLMN Selector with Access Technology
UCPLMN_LIST = ();
# Operator PLMN List
OPLMN_LIST = ("00101", "20810", "20811", "20813", "20895", "310280", "310028", "320230");
# Operator controlled PLMN Selector with Access Technology
OCPLMN_LIST = ("22210", "21401", "21406", "26202", "26204");
# Forbidden plmns
FPLMN_LIST = ();
# List of Equivalent HPLMNs
#TODO: UE does not connect if set, to be fixed in the UE
# EHPLMN_LIST= ("20811", "20813");
EHPLMN_LIST= ();
};
+6 -2
View File
@@ -249,7 +249,9 @@ int usim_api_authenticate_test(usim_data_t *usim_data,
LOG_TRACE(INFO,
"USIM-API - Comparing the XMAC with the MAC included in AUTN Succeeded");
/* Verify that the received sequence number SQN is in the correct range */
rc = _usim_api_check_sqn(*(uint32_t*)(sqn), sqn[USIM_API_SQN_SIZE - 1]);
uint32_t v;
memcpy(&v, sqn, sizeof(v));
rc = _usim_api_check_sqn(v, sqn[USIM_API_SQN_SIZE - 1]);
}
@@ -392,7 +394,9 @@ int usim_api_authenticate(usim_data_t *usim_data, const OctetString* rand_pP, co
LOG_TRACE(INFO,
"USIM-API - Comparing the XMAC with the MAC included in AUTN Succeeded");
/* Verify that the received sequence number SQN is in the correct range */
rc = _usim_api_check_sqn(*(uint32_t*)(sqn), sqn[USIM_API_SQN_SIZE - 1]);
uint32_t v;
memcpy(&v, sqn, sizeof(v));
rc = _usim_api_check_sqn(v, sqn[USIM_API_SQN_SIZE - 1]);
}
+1 -1
View File
@@ -356,7 +356,7 @@ int esm_proc_pdn_connectivity_accept(nas_user_t *user, int pti, esm_proc_pdn_typ
int pid = RETURNerror;
char apn_first_char[4];
LOG_VAR(char, str[128]);
char str[128] __attribute__((unused));
if (isprint(apn->value[0])) {
apn_first_char[0] = '\0';
+78 -30
View File
@@ -24,7 +24,7 @@
# include "intertask_interface.h"
# include "nas_ue_task.h"
# include "common/utils/LOG/log.h"
# include "vendor_ext.h"
# include "user_defs.h"
# include "user_api.h"
# include "nas_parser.h"
@@ -95,41 +95,89 @@ void *nas_ue_task(void *args_p)
itti_mark_task_ready (TASK_NAS_UE);
MSC_START_USE();
LOG_I(NAS, "ue_idx_standalone val:: %u\n", ue_idx_standalone);
/* Initialize UE NAS (EURECOM-NAS) */
for (int i=0; i < users->count; i++)
// Intead of for loop for standalone mode
if (ue_idx_standalone == 0xFFFF)
{
nas_user_t *user = &users->item[i];
user->ueid=i;
for (int i = 0; i < users->count; i++)
{
nas_user_t *user = &users->item[i];
user->ueid = i;
/* Get USIM data application filename */
user->usim_data_store = memory_get_path_from_ueid(USIM_API_NVRAM_DIRNAME, USIM_API_NVRAM_FILENAME, user->ueid);
if ( user->usim_data_store == NULL ) {
LOG_E(NAS, "[UE %d] - Failed to get USIM data application filename", user->ueid);
exit(EXIT_FAILURE);
/* Get USIM data application filename */
user->usim_data_store = memory_get_path_from_ueid(USIM_API_NVRAM_DIRNAME, USIM_API_NVRAM_FILENAME, user->ueid);
if (user->usim_data_store == NULL)
{
LOG_E(NAS, "[UE %d] - Failed to get USIM data application filename", user->ueid);
exit(EXIT_FAILURE);
}
/* Get UE's data pathname */
user->user_nvdata_store = memory_get_path_from_ueid(USER_NVRAM_DIRNAME, USER_NVRAM_FILENAME, user->ueid);
if (user->user_nvdata_store == NULL)
{
LOG_E(NAS, "[UE %d] - Failed to get USIM nvdata filename", user->ueid);
exit(EXIT_FAILURE);
}
/* Get EMM data pathname */
user->emm_nvdata_store = memory_get_path_from_ueid(EMM_NVRAM_DIRNAME, EMM_NVRAM_FILENAME, user->ueid);
if (user->emm_nvdata_store == NULL)
{
LOG_E(NAS, "[UE %d] - Failed to get EMM nvdata filename", user->ueid);
exit(EXIT_FAILURE);
}
/* Initialize user interface (to exchange AT commands with user process) */
nas_user_api_id_initialize(user);
/* allocate needed structures */
user->user_at_commands = calloc_or_fail(sizeof(user_at_commands_t));
user->at_response = calloc_or_fail(sizeof(at_response_t));
user->lowerlayer_data = calloc_or_fail(sizeof(lowerlayer_data_t));
/* Initialize NAS user */
nas_user_initialize(user, &user_api_emm_callback, &user_api_esm_callback, FIRMWARE_VERSION);
}
}
else
{
// use new parameter passed into lte-uesoftmodem which instead of looping
// calls functions on specific UE index.
/* Get UE's data pathname */
user->user_nvdata_store = memory_get_path_from_ueid(USER_NVRAM_DIRNAME, USER_NVRAM_FILENAME, user->ueid);
if ( user->user_nvdata_store == NULL ) {
LOG_E(NAS, "[UE %d] - Failed to get USIM nvdata filename", user->ueid);
exit(EXIT_FAILURE);
}
nas_user_t *user = &users->item[0];
user->ueid = ue_idx_standalone;
LOG_I(NAS, "[UE %d] Configuring\n", user->ueid);
/* Get EMM data pathname */
user->emm_nvdata_store = memory_get_path_from_ueid(EMM_NVRAM_DIRNAME, EMM_NVRAM_FILENAME, user->ueid);
if ( user->emm_nvdata_store == NULL ) {
LOG_E(NAS, "[UE %d] - Failed to get EMM nvdata filename", user->ueid);
exit(EXIT_FAILURE);
}
/* Initialize user interface (to exchange AT commands with user process) */
nas_user_api_id_initialize(user);
/* allocate needed structures */
user->user_at_commands = calloc_or_fail(sizeof(user_at_commands_t));
user->at_response = calloc_or_fail(sizeof(at_response_t));
user->lowerlayer_data = calloc_or_fail(sizeof(lowerlayer_data_t));
/* Initialize NAS user */
nas_user_initialize (user, &user_api_emm_callback, &user_api_esm_callback, FIRMWARE_VERSION);
/* Get USIM data application filename */ //
user->usim_data_store = memory_get_path_from_ueid(USIM_API_NVRAM_DIRNAME, USIM_API_NVRAM_FILENAME, user->ueid);
if (user->usim_data_store == NULL)
{
LOG_E(NAS, "[UE %d] - Failed to get USIM data application filename", user->ueid);
exit(EXIT_FAILURE);
}
/* Get UE's data pathname */
user->user_nvdata_store = memory_get_path_from_ueid(USER_NVRAM_DIRNAME, USER_NVRAM_FILENAME, user->ueid);
if (user->user_nvdata_store == NULL)
{
LOG_E(NAS, "[UE %d] - Failed to get USIM nvdata filename", user->ueid);
exit(EXIT_FAILURE);
}
/* Get EMM data pathname */
user->emm_nvdata_store = memory_get_path_from_ueid(EMM_NVRAM_DIRNAME, EMM_NVRAM_FILENAME, user->ueid);
if (user->emm_nvdata_store == NULL)
{
LOG_E(NAS, "[UE %d] - Failed to get EMM nvdata filename", user->ueid);
exit(EXIT_FAILURE);
}
/* Initialize user interface (to exchange AT commands with user process) */
nas_user_api_id_initialize(user);
/* allocate needed structures */
user->user_at_commands = calloc_or_fail(sizeof(user_at_commands_t));
user->at_response = calloc_or_fail(sizeof(at_response_t));
user->lowerlayer_data = calloc_or_fail(sizeof(lowerlayer_data_t));
/* Initialize NAS user */
nas_user_initialize(user, &user_api_emm_callback, &user_api_esm_callback, FIRMWARE_VERSION);
user->ueid = 0;
}
/* Set UE activation state */
+7 -1
View File
@@ -8,7 +8,13 @@
# define NUMBER_OF_NR_RU_MAX 2
# ifndef PHYSIM
# ifndef UE_EXPANSION
# define NUMBER_OF_UE_MAX 4
// TODO:L2 FAPI simulator.
// UESIM_EXPANSION is used to be same value of NUMBER_OF_UE_MAX
// in eNB and UE.
// now , if we use --mu option in UE, compiling error will occur.
// This problem will be fixed in the future.
# ifndef UESIM_EXPANSION
# define NUMBER_OF_UE_MAX 40
# define NUMBER_OF_NR_UE_MAX 4
# define NUMBER_OF_UCI_VARS_MAX 14
# define NUMBER_OF_CONNECTED_eNB_MAX 1
+27 -2
View File
@@ -397,8 +397,20 @@ static void *L1_thread( void *param ) {
// set default return value
eNB_thread_rxtx_status = 0;
sprintf(thread_name,"RXn_TXnp4_%d\n",&eNB->proc.L1_proc == proc ? 0 : 1);
#if 1
{
struct sched_param sparam =
{
.sched_priority = 79,
};
if (pthread_setschedparam(pthread_self(), SCHED_RR, &sparam) != 0)
{
LOG_E(PHY,"pthread_setschedparam: %s\n", strerror(errno));
}
}
#else
thread_top_init(thread_name,1,470000,500000,500000);
pthread_setname_np( pthread_self(),"rxtx processing");
#endif
LOG_I(PHY,"thread rxtx created id=%ld\n", syscall(__NR_gettid));
while (!oai_exit) {
@@ -918,8 +930,18 @@ void init_eNB_proc(int inst) {
// Original Code from Fujitsu w/ old structure/field name
//pthread_create( &proc_rxtx[0].pthread_rxtx, attr0, eNB_thread_rxtx, &proc_rxtx[0] );
//pthread_create( &proc_rxtx[1].pthread_rxtx, attr1, eNB_thread_rxtx, &proc_rxtx[1] );
pthread_create( &L1_proc->pthread, attr0, L1_thread, L1_proc );
if (pthread_setname_np(L1_proc->pthread, "oai:enb-L1-rx") != 0)
{
LOG_E(PHY, "pthread_setname_np: %s\n", strerror(errno));
}
pthread_create( &L1_proc_tx->pthread, attr1, L1_thread, L1_proc_tx);
if (pthread_setname_np(L1_proc_tx->pthread, "oai:enb-L1-tx") != 0)
{
LOG_E(PHY, "pthread_setname_np: %s\n", strerror(errno));
}
}
if (NFAPI_MODE!=NFAPI_MODE_VNF) {
@@ -929,7 +951,10 @@ void init_eNB_proc(int inst) {
AssertFatal(proc->instance_cnt_prach == -1,"instance_cnt_prach = %d\n",proc->instance_cnt_prach);
if (opp_enabled == 1) pthread_create(&proc->process_stats_thread,NULL,process_stats_thread,(void *)eNB);
if (opp_enabled == 1)
{
pthread_create(&proc->process_stats_thread,NULL,process_stats_thread,(void *)eNB);
}
}
//for multiple CCs: setup master and slaves
+2
View File
@@ -1502,6 +1502,7 @@ static void *ru_stats_thread(void *param) {
static void *ru_thread_tx( void *param ) {
RU_t *ru = (RU_t *)param;
RU_proc_t *proc = &ru->proc;
__attribute__((unused))
LTE_DL_FRAME_PARMS *fp = ru->frame_parms;
PHY_VARS_eNB *eNB;
L1_proc_t *eNB_proc;
@@ -1909,6 +1910,7 @@ static void *ru_thread( void *param ) {
// This thread run the initial synchronization like a UE
void *ru_thread_synch(void *arg) {
RU_t *ru = (RU_t *)arg;
__attribute__((unused))
LTE_DL_FRAME_PARMS *fp = ru->frame_parms;
int64_t peak_val, avg;
static int ru_thread_synch_status = 0;
+28 -1
View File
@@ -95,6 +95,9 @@ unsigned short config_frames[4] = {2,9,11,13};
#include "NB_IoT_interface.h"
#include <executables/split_headers.h>
#if USING_GPROF
# include "sys/gmon.h"
#endif
pthread_cond_t nfapi_sync_cond;
pthread_mutex_t nfapi_sync_mutex;
@@ -179,6 +182,7 @@ eth_params_t *eth_params;
double cpuf;
int oaisim_flag=0;
uint16_t ue_idx_standalone = 0xFFFF;
/* forward declarations */
@@ -483,7 +487,7 @@ void init_pdcp(void) {
pdcp_initmask = pdcp_initmask | ENB_NAS_USE_TUN_W_MBMS_BIT;
pdcp_module_init(pdcp_initmask);
pdcp_module_init(pdcp_initmask, 0);
if (NODE_IS_CU(RC.rrc[0]->node_type)) {
pdcp_set_rlc_data_req_func((send_rlc_data_req_func_t)proto_agent_send_rlc_data_req);
@@ -509,6 +513,21 @@ static void wait_nfapi_init(char *thread_name) {
int main ( int argc, char **argv )
{
struct sched_param param =
{
.sched_priority = 79
};
if (sched_setscheduler( 0, SCHED_RR, &param ) == -1 )
{
fprintf(stderr, "sched_setscheduler: %s\n", strerror(errno));
return EXIT_FAILURE;
}
if (mlockall(MCL_CURRENT | MCL_FUTURE) == -1)
{
fprintf(stderr, "mlockall: %s\n", strerror(errno));
return EXIT_FAILURE;
}
int i;
int CC_id = 0;
int ru_id;
@@ -729,6 +748,14 @@ int main ( int argc, char **argv )
if(IS_SOFTMODEM_DOFORMS)
load_softscope("enb",NULL);
itti_wait_tasks_end();
#if USING_GPROF
// Save the gprof data now (rather than via atexit) in case we crash while shutting down
fprintf(stderr, "Recording gprof data...\n");
_mcleanup();
fprintf(stderr, "Recording gprof data...done\n");
#endif // USING_GPROF
oai_exit=1;
LOG_I(ENB_APP,"oai_exit=%d\n",oai_exit);
// stop threads
+4 -1
View File
@@ -115,7 +115,9 @@
{"usrp-args", CONFIG_HLP_USRP_ARGS, 0, strptr:(char **)&usrp_args, defstrval:"type=b200",TYPE_STRING, 0}, \
{"mmapped-dma", CONFIG_HLP_DMAMAP, PARAMFLAG_BOOL, uptr:&mmapped_dma, defintval:0, TYPE_INT, 0}, \
{"T" , CONFIG_HLP_TDD, PARAMFLAG_BOOL, iptr:&tddflag, defintval:0, TYPE_INT, 0}, \
{"A", CONFIG_HLP_TADV, 0, iptr:&(timingadv), defintval:0, TYPE_INT, 0} \
{"A", CONFIG_HLP_TADV, 0, iptr:&(timingadv), defintval:0, TYPE_INT, 0}, \
{"ue-idx-standalone", NULL, 0, u16ptr:&ue_idx_standalone, defuintval:0xFFFF, TYPE_UINT16, 0}, \
{"node-number", NULL, 0, u16ptr:&node_number, defuintval:2, TYPE_UINT16, 0}, \
}
/*-----------------------------------------------------------------------------------------------------------------------------*/
@@ -210,6 +212,7 @@ extern int stop_L1L2(module_id_t enb_id);
extern int restart_L1L2(module_id_t enb_id);
extern void init_UE_stub_single_thread(int nb_inst, int eMBMS_active, int uecap_xer_in, char *emul_iface);
extern void init_UE_standalone_thread(int ue_idx);
extern PHY_VARS_UE *init_ue_vars(LTE_DL_FRAME_PARMS *frame_parms, uint8_t UE_id, uint8_t abstraction_flag);
+453 -19
View File
@@ -193,7 +193,7 @@ PHY_VARS_UE *init_ue_vars(LTE_DL_FRAME_PARMS *frame_parms,
ue->mac_enabled = 1;
// In phy_stub_UE (MAC-to-MAC) mode these init functions don't need to get called. Is this correct?
if (NFAPI_MODE!=NFAPI_UE_STUB_PNF) {
if (NFAPI_MODE!=NFAPI_UE_STUB_PNF && NFAPI_MODE!=NFAPI_MODE_STANDALONE_PNF) {
// initialize all signal buffers
init_lte_ue_signal(ue,1,abstraction_flag);
// intialize transport
@@ -413,15 +413,32 @@ void init_UE_stub_single_thread(int nb_inst,
// PHY_vars_UE_g[inst][0] = init_ue_vars(NULL,inst,0);
}
init_timer_thread();
if(NFAPI_MODE != NFAPI_MODE_STANDALONE_PNF) {
init_timer_thread();
}
init_UE_single_thread_stub(nb_inst);
printf("UE threads created \n");
LOG_I(PHY,"Starting multicast link on %s\n",emul_iface);
if(NFAPI_MODE!=NFAPI_UE_STUB_PNF)
if(NFAPI_MODE!=NFAPI_UE_STUB_PNF && NFAPI_MODE!=NFAPI_MODE_STANDALONE_PNF) {
LOG_I(PHY,"Starting multicast link on %s\n",emul_iface);
multicast_link_start(ue_stub_rx_handler,0,emul_iface);
}
}
void init_UE_standalone_thread(int ue_idx)
{
const char *standalone_addr = "127.0.0.1"; // these two lines go into init
int standalone_tx_port = 3211 + ue_idx*2;
int standalone_rx_port = 3212 + ue_idx*2;
ue_init_standalone_socket(standalone_addr, standalone_tx_port, standalone_rx_port);
pthread_t thread;
if (pthread_create(&thread, NULL, ue_standalone_pnf_task, NULL) != 0) {
LOG_E(MAC, "pthread_create failed for calling ue_standalone_pnf_task");
}
pthread_setname_np(thread, "oai:ue-stand");
}
void init_UE_stub(int nb_inst,
int eMBMS_active,
@@ -449,7 +466,7 @@ void init_UE_stub(int nb_inst,
printf("UE threads created \n");
LOG_I(PHY,"Starting multicast link on %s\n",emul_iface);
if(NFAPI_MODE!=NFAPI_UE_STUB_PNF)
if(NFAPI_MODE!=NFAPI_UE_STUB_PNF && NFAPI_MODE!=NFAPI_MODE_STANDALONE_PNF)
multicast_link_start(ue_stub_rx_handler,0,emul_iface);
}
@@ -956,6 +973,410 @@ void ue_stub_rx_handler(unsigned int num_bytes,
}
}
uint64_t clock_usec(void)
{
struct timespec t;
if (clock_gettime(CLOCK_MONOTONIC, &t) == -1)
{
abort();
}
return (uint64_t)t.tv_sec * 1000000 + (t.tv_nsec / 1000);
}
static void reset_queue(queue_t *q)
{
void *p;
while ((p = get_queue(q)) != NULL)
{
free(p);
}
}
/*!
* \brief This is the UE thread for RX subframe n and TX subframe n+4.
* This thread performs the phy_procedures_UE_RX() on every received slot.
* then, if TX is enabled it performs TX for n+4.
* \param arg is a pointer to a \ref PHY_VARS_UE structure.
* \returns a pointer to an int. The storage is not on the heap and must not be freed.
*/
static void *UE_phy_stub_standalone_pnf_task(void *arg)
{
#if 1
{
struct sched_param sparam =
{
.sched_priority = 79,
};
if (pthread_setschedparam(pthread_self(), SCHED_RR, &sparam) != 0)
{
LOG_E(PHY,"pthread_setschedparam: %s\n", strerror(errno));
}
}
#else
thread_top_init("UE_phy_stub_thread_rxn_txnp4", 1, 870000L, 1000000L, 1000000L);
#endif
// for multipule UE's L2-emulator
//module_id_t Mod_id = 0;
//int init_ra_UE = -1; // This counter is used to initiate the RA of each UE in different SFrames
struct rx_tx_thread_data *rtd = arg;
if (rtd == NULL) {
LOG_E(MAC, "[SCHED][UE] rx_tx_thread_data *rtd: NULL pointer\n");
exit_fun("nothing to add");
}
UE_rxtx_proc_t *proc = rtd->proc;
// settings for nfapi-L2-emulator mode
module_id_t ue_thread_id = rtd->ue_thread_id;
uint16_t ue_index = 0;
uint16_t ue_num = NB_UE_INST / NB_THREAD_INST + ((NB_UE_INST % NB_THREAD_INST > ue_thread_id) ? 1 : 0);
module_id_t ue_Mod_id;
PHY_VARS_UE *UE = NULL;
int ret;
proc = &PHY_vars_UE_g[0][0]->proc.proc_rxtx[0];
UE = rtd->UE;
UL_INFO = (UL_IND_t *)calloc(1, sizeof(UL_IND_t));
UL_INFO->rx_ind.rx_indication_body.rx_pdu_list = calloc(NB_UE_INST, sizeof(nfapi_rx_indication_pdu_t));
UL_INFO->rx_ind.rx_indication_body.number_of_pdus = 0;
UL_INFO->crc_ind.crc_indication_body.crc_pdu_list = calloc(NB_UE_INST, sizeof(nfapi_crc_indication_pdu_t));
UL_INFO->crc_ind.crc_indication_body.number_of_crcs = 0;
UL_INFO->harq_ind.harq_indication_body.harq_pdu_list = calloc(NB_UE_INST, sizeof(nfapi_harq_indication_pdu_t));
UL_INFO->harq_ind.harq_indication_body.number_of_harqs = 0;
UL_INFO->sr_ind.sr_indication_body.sr_pdu_list = calloc(NB_UE_INST, sizeof(nfapi_sr_indication_pdu_t));
UL_INFO->sr_ind.sr_indication_body.number_of_srs = 0;
UL_INFO->cqi_ind.cqi_indication_body.cqi_pdu_list = calloc(NB_UE_INST, sizeof(nfapi_cqi_indication_pdu_t));
UL_INFO->cqi_ind.cqi_indication_body.cqi_raw_pdu_list = calloc(NB_UE_INST, sizeof(nfapi_cqi_indication_raw_pdu_t));
UL_INFO->cqi_ind.cqi_indication_body.number_of_cqis = 0;
proc->subframe_rx = proc->sub_frame_start;
proc->subframe_tx = -1;
proc->frame_rx = -1;
proc->frame_tx = -1;
// Initializations for nfapi-L2-emulator mode
sync_var = 0;
//PANOS: CAREFUL HERE!
wait_sync("UE_phy_stub_standalone_pnf_task");
int last_sfn_sf = -1;
LOG_I(MAC, "Clearing Queues\n");
reset_queue(&dl_config_req_tx_req_queue);
reset_queue(&ul_config_req_queue);
reset_queue(&hi_dci0_req_queue);
while (!oai_exit) {
bool sent_any = false;
if (sem_wait(&sfn_semaphore) != 0) {
LOG_E(MAC, "sem_wait() error\n");
abort();
}
int sfn_sf = current_sfn_sf;
if (sfn_sf == last_sfn_sf)
{
LOG_W(MAC, "repeated sfn_sf = %d.%d\n",
sfn_sf >> 4, sfn_sf & 15);
continue;
}
last_sfn_sf = sfn_sf;
nfapi_dl_config_req_tx_req_t *dl_config_req_tx_req = get_queue(&dl_config_req_tx_req_queue);
nfapi_ul_config_request_t *ul_config_req = get_queue(&ul_config_req_queue);
nfapi_hi_dci0_request_t *hi_dci0_req = get_queue(&hi_dci0_req_queue);
LOG_I(MAC, "received from proxy frame %d subframe %d\n",
NFAPI_SFNSF2SFN(sfn_sf), NFAPI_SFNSF2SF(sfn_sf));
if (ul_config_req != NULL) {
uint8_t ul_num_pdus = ul_config_req->ul_config_request_body.number_of_pdus;
if (ul_num_pdus > 0) {
char *ul_str = nfapi_ul_config_req_to_string(ul_config_req);
LOG_I(MAC, "ul_config_req: %s\n", ul_str);
free(ul_str);
}
}
if (hi_dci0_req != NULL) {
LOG_D(MAC, "hi_dci0_req pdus: %u Frame: %d Subframe: %d\n",
hi_dci0_req->hi_dci0_request_body.number_of_dci,
NFAPI_SFNSF2SFN(hi_dci0_req->sfn_sf), NFAPI_SFNSF2SF(hi_dci0_req->sfn_sf));
}
if (dl_config_req_tx_req != NULL) {
nfapi_tx_req_pdu_list_t *tx_req_pdu_list = dl_config_req_tx_req->tx_req_pdu_list;
nfapi_dl_config_request_t *dl_config_req = dl_config_req_tx_req->dl_config_req;
uint16_t dl_num_pdus = dl_config_req->dl_config_request_body.number_pdu;
LOG_A(MAC, "(OAI UE) Received dl_config_req from proxy at Frame: %d, Subframe: %d,"
" with number of PDUs: %u\n",
NFAPI_SFNSF2SFN(dl_config_req->sfn_sf), NFAPI_SFNSF2SF(dl_config_req->sfn_sf),
dl_num_pdus);
if (dl_num_pdus > 0) {
char *dl_str = nfapi_dl_config_req_to_string(dl_config_req);
LOG_I(MAC, "dl_config_req: %s\n", dl_str);
free(dl_str);
}
LOG_D(MAC, "tx_req pdus: %d\n", tx_req_pdu_list->num_pdus);
// Handling dl_config_req and tx_req:
nfapi_dl_config_request_body_t *dl_config_req_body = &dl_config_req->dl_config_request_body;
for (int i = 0; i < dl_config_req_body->number_pdu; ++i) {
nfapi_dl_config_request_pdu_t *pdu = &dl_config_req_body->dl_config_pdu_list[i];
if (pdu->pdu_type == NFAPI_DL_CONFIG_DCI_DL_PDU_TYPE) {
i += 1;
AssertFatal(i < dl_config_req->dl_config_request_body.number_pdu,
"Need PDU following DCI at index %d, but not found\n",
i);
nfapi_dl_config_request_pdu_t *dlsch = &dl_config_req_body->dl_config_pdu_list[i];
if (dlsch->pdu_type != NFAPI_DL_CONFIG_DLSCH_PDU_TYPE) {
LOG_E(MAC, "expected DLSCH PDU at index %d\n", i);
continue;
}
dl_config_req_UE_MAC_dci(NFAPI_SFNSF2SFN(dl_config_req->sfn_sf),
NFAPI_SFNSF2SF(dl_config_req->sfn_sf),
pdu,
dlsch,
ue_num,
tx_req_pdu_list);
} else if (pdu->pdu_type == NFAPI_DL_CONFIG_BCH_PDU_TYPE) {
dl_config_req_UE_MAC_bch(NFAPI_SFNSF2SFN(dl_config_req->sfn_sf),
NFAPI_SFNSF2SF(dl_config_req->sfn_sf),
pdu,
ue_num);
} else if (pdu->pdu_type == NFAPI_DL_CONFIG_MCH_PDU_TYPE) {
dl_config_req_UE_MAC_mch(NFAPI_SFNSF2SFN(dl_config_req->sfn_sf),
NFAPI_SFNSF2SF(dl_config_req->sfn_sf),
pdu,
ue_num,
tx_req_pdu_list);
}
}
}
if (hi_dci0_req) {
nfapi_hi_dci0_request_body_t *hi_dci0_body = &hi_dci0_req->hi_dci0_request_body;
for (int i = 0; i < hi_dci0_body->number_of_dci + hi_dci0_body->number_of_hi; i++) {
nfapi_hi_dci0_request_pdu_t *pdu = &hi_dci0_body->hi_dci0_pdu_list[i];
hi_dci0_req_UE_MAC(NFAPI_SFNSF2SFN(hi_dci0_req->sfn_sf),
NFAPI_SFNSF2SF(hi_dci0_req->sfn_sf),
pdu,
ue_num); // This function doesnt do anything? - Andrew
}
}
for (ue_index = 0; ue_index < ue_num; ue_index++) {
ue_Mod_id = ue_thread_id + NB_THREAD_INST * ue_index; // Always 0 in standalone pnf mode
UE = PHY_vars_UE_g[ue_Mod_id][0];
#if UE_TIMING_TRACE
start_meas(&UE->generic_stat);
#endif
int rx_frame = NFAPI_SFNSF2SF(sfn_sf) < 4 ? (NFAPI_SFNSF2SFN(sfn_sf) + 1023) % 1024 : NFAPI_SFNSF2SFN(sfn_sf); // subtracting 4 from subframe_tx
int rx_subframe = NFAPI_SFNSF2SF(sfn_sf) < 4 ? NFAPI_SFNSF2SF(sfn_sf) + 6 : NFAPI_SFNSF2SF(sfn_sf) - 4;
LOG_D(MAC, "rx_frame %d rx_subframe %d\n", rx_frame, rx_subframe);
if (UE->mac_enabled == 1) {
ret = ue_scheduler(ue_Mod_id,
rx_frame,
rx_subframe,
NFAPI_SFNSF2SFN(sfn_sf),
NFAPI_SFNSF2SF(sfn_sf),
subframe_select(&UE->frame_parms, NFAPI_SFNSF2SF(sfn_sf)),
0,
0 /*FIXME CC_id*/);
if (ret != CONNECTION_OK) {
LOG_E(PHY, "[UE %" PRIu8 "] Frame %" PRIu32 ", subframe %u %s\n",
UE->Mod_id, rx_frame, NFAPI_SFNSF2SF(sfn_sf), get_connectionloss_errstr(ret));
}
}
#if UE_TIMING_TRACE
stop_meas(&UE->generic_stat);
#endif
// Prepare the future Tx data
if ((subframe_select(&UE->frame_parms, NFAPI_SFNSF2SF(sfn_sf)) == SF_UL) ||
(UE->frame_parms.frame_type == FDD))
{
if (UE->mode != loop_through_memory)
{
// We make the start of RA between consecutive UEs differ by 20 frames
//if ((UE_mac_inst[Mod_id].UE_mode[0] == PRACH && Mod_id == 0) || (UE_mac_inst[Mod_id].UE_mode[0] == PRACH && Mod_id>0 && rx_frame >= UE_mac_inst[Mod_id-1].ra_frame + 20) ) {
if (UE_mac_inst[ue_Mod_id].UE_mode[0] == RA_RESPONSE &&
is_prach_subframe(&UE->frame_parms, NFAPI_SFNSF2SFN(sfn_sf), NFAPI_SFNSF2SF(sfn_sf)))
{
UE_mac_inst[ue_Mod_id].UE_mode[0] = PRACH;
}
LOG_D(MAC, "UE_mode: %d\n", UE_mac_inst[ue_Mod_id].UE_mode[0]);
if (UE_mac_inst[ue_Mod_id].UE_mode[0] == PRACH)
{ //&& ue_Mod_id == next_Mod_id) {
next_ra_frame++;
if (next_ra_frame > 500)
{
// check if we have PRACH opportunity
if (is_prach_subframe(&UE->frame_parms, NFAPI_SFNSF2SFN(sfn_sf), NFAPI_SFNSF2SF(sfn_sf)) && UE_mac_inst[ue_Mod_id].SI_Decoded == 1)
{
// The one working strangely...
//if (is_prach_subframe(&UE->frame_parms,NFAPI_SFNSF2SFN(sfn_sf), NFAPI_SFNSF2SF(sfn_sf) && Mod_id == (module_id_t) init_ra_UE) ) {
PRACH_RESOURCES_t *prach_resources = ue_get_rach(ue_Mod_id, 0, NFAPI_SFNSF2SFN(sfn_sf), 0, NFAPI_SFNSF2SF(sfn_sf));
if (prach_resources != NULL)
{
LOG_I(MAC, "preamble_received_tar_power: %d\n",
prach_resources->ra_PREAMBLE_RECEIVED_TARGET_POWER);
UE_mac_inst[ue_Mod_id].ra_frame = NFAPI_SFNSF2SFN(sfn_sf);
LOG_D(MAC, "UE_phy_stub_thread_rxn_txnp4 before RACH, Mod_id: %d frame %d subframe %d\n", ue_Mod_id, NFAPI_SFNSF2SFN(sfn_sf), NFAPI_SFNSF2SF(sfn_sf));
fill_rach_indication_UE_MAC(ue_Mod_id, NFAPI_SFNSF2SFN(sfn_sf), NFAPI_SFNSF2SF(sfn_sf), UL_INFO, prach_resources->ra_PreambleIndex, prach_resources->ra_RNTI);
sent_any = true;
Msg1_transmitted(ue_Mod_id, 0, NFAPI_SFNSF2SFN(sfn_sf), 0);
UE_mac_inst[ue_Mod_id].UE_mode[0] = RA_RESPONSE;
next_Mod_id = ue_Mod_id + 1;
//next_ra_frame = (rx_frame + 20)%1000;
next_ra_frame = 0;
}
//ue_prach_procedures(ue,proc,eNB_id,abstraction_flag,mode);
}
}
} // mode is PRACH
// Substitute call to phy_procedures Tx with call to phy_stub functions in order to trigger
// UE Tx procedures directly at the MAC layer, based on the received ul_config requests from the vnf (eNB).
// Generate UL_indications which correspond to UL traffic.
if (ul_config_req != NULL)
{ //&& UE_mac_inst[Mod_id].ul_config_req->ul_config_request_body.ul_config_pdu_list != NULL){
ul_config_req_UE_MAC(ul_config_req, NFAPI_SFNSF2SFN(sfn_sf), NFAPI_SFNSF2SF(sfn_sf), ue_Mod_id);
}
}
phy_procedures_UE_SL_RX(UE, proc);
}
else
{
LOG_I(MAC, "Skipping subframe select statement proxy SFN.SF: %d.%d\n",
NFAPI_SFNSF2SFN(sfn_sf), NFAPI_SFNSF2SF(sfn_sf));
if (ul_config_req != NULL)
{
LOG_I(MAC, "Skipping subframe select statement ul_config_req SFN.SF: %d.%d\n",
NFAPI_SFNSF2SFN(ul_config_req->sfn_sf), NFAPI_SFNSF2SF(ul_config_req->sfn_sf));
}
}
} //for (Mod_id=0; Mod_id<NB_UE_INST; Mod_id++)
if (UL_INFO->crc_ind.crc_indication_body.number_of_crcs > 0) {
//LOG_D(PHY,"UL_info->crc_ind.crc_indication_body.number_of_crcs:%d CRC_IND:SFN/SF:%d\n", UL_info->crc_ind.crc_indication_body.number_of_crcs, NFAPI_SFNSF2DEC(UL_info->crc_ind.sfn_sf));
//LOG_I(MAC, "ul_config_req_UE_MAC 2.2, SFN/SF of PNF counter:%d.%d, number_of_crcs: %d \n", timer_frame, timer_subframe, UL_INFO->crc_ind.crc_indication_body.number_of_crcs);
send_standalone_msg(UL_INFO, UL_INFO->crc_ind.header.message_id);
sent_any = true;
//LOG_I(MAC, "ul_config_req_UE_MAC 2.21 \n");
UL_INFO->crc_ind.crc_indication_body.number_of_crcs = 0;
}
if (UL_INFO->rx_ind.rx_indication_body.number_of_pdus > 0) {
//LOG_D(PHY,"UL_info->rx_ind.number_of_pdus:%d RX_IND:SFN/SF:%d\n", UL_info->rx_ind.rx_indication_body.number_of_pdus, NFAPI_SFNSF2DEC(UL_info->rx_ind.sfn_sf));
//LOG_I(MAC, "ul_config_req_UE_MAC 2.3, SFN/SF of PNF counter:%d.%d, number_of_pdus: %d \n", timer_frame, timer_subframe, UL_INFO->rx_ind.rx_indication_body.number_of_pdus);
send_standalone_msg(UL_INFO, UL_INFO->rx_ind.header.message_id);
sent_any = true;
for (uint8_t num_pdu = 0; num_pdu < UL_INFO->rx_ind.rx_indication_body.number_of_pdus; num_pdu++) {
free(UL_INFO->rx_ind.rx_indication_body.rx_pdu_list[num_pdu].data);
}
//LOG_I(MAC, "ul_config_req_UE_MAC 2.31 \n");
UL_INFO->rx_ind.rx_indication_body.number_of_pdus = 0;
}
if (UL_INFO->cqi_ind.cqi_indication_body.number_of_cqis > 0) {
send_standalone_msg(UL_INFO, UL_INFO->cqi_ind.header.message_id);
sent_any = true;
UL_INFO->cqi_ind.cqi_indication_body.number_of_cqis = 0;
}
if (UL_INFO->harq_ind.harq_indication_body.number_of_harqs > 0) {
//LOG_D(MAC, "ul_config_req_UE_MAC 2.4, SFN/SF of PNF counter:%d.%d, number_of_harqs: %d \n", timer_frame, timer_subframe, UL_INFO->harq_ind.harq_indication_body.number_of_harqs);
send_standalone_msg(UL_INFO, UL_INFO->harq_ind.header.message_id);
sent_any = true;
//LOG_I(MAC, "ul_config_req_UE_MAC 2.41 \n");
UL_INFO->harq_ind.harq_indication_body.number_of_harqs = 0;
}
if (UL_INFO->sr_ind.sr_indication_body.number_of_srs > 0) {
//LOG_I(MAC, "ul_config_req_UE_MAC 2.5, SFN/SF of PNF counter:%d.%d, number_of_srs: %d \n", timer_frame, timer_subframe, UL_INFO->sr_ind.sr_indication_body.number_of_srs);
send_standalone_msg(UL_INFO, UL_INFO->sr_ind.header.message_id);
sent_any = true;
//LOG_I(MAC, "ul_config_req_UE_MAC 2.51 \n");
UL_INFO->sr_ind.sr_indication_body.number_of_srs = 0;
}
// De-allocate memory of nfapi requests copies before next subframe round
if (dl_config_req_tx_req != NULL) {
if (dl_config_req_tx_req->dl_config_req->vendor_extension != NULL) {
free(dl_config_req_tx_req->dl_config_req->vendor_extension);
dl_config_req_tx_req->dl_config_req->vendor_extension = NULL;
}
if (dl_config_req_tx_req->dl_config_req->dl_config_request_body.dl_config_pdu_list != NULL) {
free(dl_config_req_tx_req->dl_config_req->dl_config_request_body.dl_config_pdu_list);
dl_config_req_tx_req->dl_config_req->dl_config_request_body.dl_config_pdu_list = NULL;
}
nfapi_free_tx_req_pdu_list(dl_config_req_tx_req->tx_req_pdu_list);
dl_config_req_tx_req->tx_req_pdu_list = NULL;
free(dl_config_req_tx_req->dl_config_req);
dl_config_req_tx_req->dl_config_req = NULL;
free(dl_config_req_tx_req);
dl_config_req_tx_req = NULL;
}
if (ul_config_req != NULL) {
if (ul_config_req->ul_config_request_body.ul_config_pdu_list != NULL) {
free(ul_config_req->ul_config_request_body.ul_config_pdu_list);
ul_config_req->ul_config_request_body.ul_config_pdu_list = NULL;
}
free(ul_config_req);
ul_config_req = NULL;
}
if (hi_dci0_req != NULL) {
if (hi_dci0_req->hi_dci0_request_body.hi_dci0_pdu_list != NULL) {
free(hi_dci0_req->hi_dci0_request_body.hi_dci0_pdu_list);
hi_dci0_req->hi_dci0_request_body.hi_dci0_pdu_list = NULL;
}
free(hi_dci0_req);
hi_dci0_req = NULL;
}
if (!sent_any)
{
send_standalone_dummy();
}
}
// Free UL_INFO messages
free(UL_INFO->cqi_ind.cqi_indication_body.cqi_raw_pdu_list);
UL_INFO->cqi_ind.cqi_indication_body.cqi_raw_pdu_list = NULL;
free(UL_INFO->cqi_ind.cqi_indication_body.cqi_pdu_list);
UL_INFO->cqi_ind.cqi_indication_body.cqi_pdu_list = NULL;
free(UL_INFO->sr_ind.sr_indication_body.sr_pdu_list);
UL_INFO->sr_ind.sr_indication_body.sr_pdu_list = NULL;
free(UL_INFO->harq_ind.harq_indication_body.harq_pdu_list);
UL_INFO->harq_ind.harq_indication_body.harq_pdu_list = NULL;
free(UL_INFO->crc_ind.crc_indication_body.crc_pdu_list);
UL_INFO->crc_ind.crc_indication_body.crc_pdu_list = NULL;
free(UL_INFO->rx_ind.rx_indication_body.rx_pdu_list);
UL_INFO->rx_ind.rx_indication_body.rx_pdu_list = NULL;
free(UL_INFO);
UL_INFO = NULL;
// thread finished
free(arg);
return NULL;
}
/*!
* \brief This is the UE thread for RX subframe n and TX subframe n+4.
@@ -967,6 +1388,7 @@ void ue_stub_rx_handler(unsigned int num_bytes,
static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg)
{
#if 0 // TODO: doesn't currently compile, obviated by multi-ue proxy
thread_top_init("UE_phy_stub_thread_rxn_txnp4",1,870000L,1000000L,1000000L);
// for multipule UE's L2-emulator
//module_id_t Mod_id = 0;
@@ -1012,7 +1434,7 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg)
dl_config_req = NULL;
ul_config_req = NULL;
hi_dci0_req = NULL;
tx_request_pdu_list = NULL;
tx_req_pdu_list = NULL;
// waiting for all UE's threads set phy_stub_ticking->num_single_thread[ue_thread_id] = -1.
do {
@@ -1108,7 +1530,7 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg)
}
}
if (dl_config_req && tx_request_pdu_list) {
if (dl_config_req && tx_req_pdu_list) {
nfapi_dl_config_request_body_t* dl_config_req_body = &dl_config_req->dl_config_request_body;
for (int i = 0; i < dl_config_req_body->number_pdu; ++i) {
nfapi_dl_config_request_pdu_t* pdu = &dl_config_req_body->dl_config_pdu_list[i];
@@ -1322,16 +1744,16 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg)
dl_config_req = NULL;
}
if(tx_request_pdu_list!=NULL) {
if(tx_req_pdu_list!=NULL) {
for (int i = 0; i < tx_req_num_elems; i++) {
for (int j = 0; j < tx_request_pdu_list[i].num_segments; j++) {
free(tx_request_pdu_list[i].segments[j].segment_data);
tx_request_pdu_list[i].segments[j].segment_data = NULL;
for (int j = 0; j < tx_req_pdu_list[i].num_segments; j++) {
free(tx_req_pdu_list[i].segments[j].segment_data);
tx_req_pdu_list[i].segments[j].segment_data = NULL;
}
}
tx_req_num_elems = 0;
free(tx_request_pdu_list);
tx_request_pdu_list = NULL;
free(tx_req_pdu_list);
tx_req_pdu_list = NULL;
}
if(ul_config_req!=NULL) {
@@ -1371,10 +1793,11 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg)
UL_INFO->rx_ind.rx_indication_body.rx_pdu_list = NULL;
free(UL_INFO);
UL_INFO = NULL;
#endif // disabled UE_phy_stub_single_thread_rxn_txnp4
// thread finished
free(arg);
return &UE_thread_rxtx_retval;
return NULL;
}
@@ -1388,6 +1811,7 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg)
static void *UE_phy_stub_thread_rxn_txnp4(void *arg)
{
#if 0
thread_top_init("UE_phy_stub_thread_rxn_txnp4",1,870000L,1000000L,1000000L);
module_id_t Mod_id = 0;
static __thread int UE_thread_rxtx_retval;
@@ -1536,10 +1960,10 @@ static void *UE_phy_stub_thread_rxn_txnp4(void *arg)
phy_procedures_UE_SL_RX(UE,proc);
}
#endif // disabled
// thread finished
free(arg);
return &UE_thread_rxtx_retval;
return NULL; //return &UE_thread_rxtx_retval;
}
@@ -1607,6 +2031,8 @@ void *UE_thread(void *arg)
oai_exit=1;
}
log_scheduler(__func__);
while (!oai_exit) {
if (IS_SOFTMODEM_BASICSIM)
while (!(UE->proc.instance_cnt_synch < 0)) {
@@ -1973,7 +2399,7 @@ void init_UE_single_thread_stub(int nb_inst)
AssertFatal(PHY_vars_UE_g[i]!=NULL,"PHY_vars_UE_g[inst] is NULL\n");
AssertFatal(PHY_vars_UE_g[i][0]!=NULL,"PHY_vars_UE_g[inst][0] is NULL\n");
if(NFAPI_MODE==NFAPI_UE_STUB_PNF) {
if(NFAPI_MODE==NFAPI_UE_STUB_PNF || NFAPI_MODE==NFAPI_MODE_STANDALONE_PNF) {
#ifdef NAS_UE
MessageDef *message_p;
message_p = itti_alloc_new_message(TASK_NAS_UE, 0, INITIALIZE_MESSAGE);
@@ -1993,6 +2419,13 @@ void init_UE_single_thread_stub(int nb_inst)
//int nb_threads=RX_NB_TH;
int nb_threads=1;
void* (*task_func)(void*);
if (NFAPI_MODE == NFAPI_MODE_STANDALONE_PNF) {
task_func = UE_phy_stub_standalone_pnf_task;
} else {
task_func = UE_phy_stub_single_thread_rxn_txnp4;
}
for(uint16_t ue_thread_id = 0; ue_thread_id < NB_THREAD_INST; ue_thread_id++) {
UE = PHY_vars_UE_g[ue_thread_id][0];
@@ -2009,7 +2442,8 @@ void init_UE_single_thread_stub(int nb_inst)
UE->proc.proc_rxtx[i].sub_frame_start=i;
UE->proc.proc_rxtx[i].sub_frame_step=nb_threads;
printf("Init_UE_threads rtd %d proc %d nb_threads %d i %d\n",rtd->proc->sub_frame_start, UE->proc.proc_rxtx[i].sub_frame_start,nb_threads, i);
pthread_create(&UE->proc.proc_rxtx[i].pthread_rxtx, NULL, UE_phy_stub_single_thread_rxn_txnp4, rtd);
pthread_create(&UE->proc.proc_rxtx[i].pthread_rxtx, NULL, task_func, rtd);
pthread_setname_np(UE->proc.proc_rxtx[i].pthread_rxtx, "oai:ue-phy");
}
}
@@ -2241,7 +2675,7 @@ static void *timer_thread( void *param )
pdu.header.packet_type = TTI_SYNC;
pdu.header.absSF = (timer_frame*10)+timer_subframe;
if (NFAPI_MODE != NFAPI_UE_STUB_PNF) {
if (NFAPI_MODE != NFAPI_UE_STUB_PNF && NFAPI_MODE != NFAPI_MODE_STANDALONE_PNF) {
multicast_link_write_sock(0,
(char *)&pdu,
sizeof(UE_tport_header_t));
+46 -8
View File
@@ -66,6 +66,7 @@
#include "LAYER2/MAC/mac_proto.h"
#include "RRC/LTE/rrc_vars.h"
#include "PHY_INTERFACE/phy_interface_vars.h"
#include "PHY_INTERFACE/phy_stub_UE.h"
#include "PHY/TOOLS/phy_scope_interface.h"
#include "common/utils/LOG/log.h"
#include "nfapi/oai_integration/vendor_ext.h"
@@ -85,9 +86,8 @@
#include "lte-softmodem.h"
extern int ue_id_g ;
/* temporary compilation wokaround (UE/eNB split */
uint16_t sf_ahead;
pthread_cond_t nfapi_sync_cond;
@@ -95,7 +95,7 @@ pthread_mutex_t nfapi_sync_mutex;
int nfapi_sync_var=-1; //!< protected by mutex \ref nfapi_sync_mutex
uint16_t sf_ahead=2;
uint16_t sf_ahead=1;
int tddflag;
char *emul_iface;
@@ -278,7 +278,8 @@ void exit_function(const char *file, const char *function, const int line, const
}
extern int16_t dlsch_demod_shift;
uint16_t ue_idx_standalone = 0xFFFF;
uint16_t node_number;
static void get_options(void) {
int CC_id=0;
int tddflag=0;
@@ -525,7 +526,7 @@ int restart_L1L2(module_id_t enb_id) {
return 0;
}
void init_pdcp(void) {
void init_pdcp(int ue_id) {
uint32_t pdcp_initmask = (!IS_SOFTMODEM_NOS1) ? LINK_ENB_PDCP_TO_GTPV1U_BIT : (LINK_ENB_PDCP_TO_GTPV1U_BIT | PDCP_USE_NETLINK_BIT | LINK_ENB_PDCP_TO_IP_DRIVER_BIT);
if (IS_SOFTMODEM_BASICSIM || IS_SOFTMODEM_RFSIM || (nfapi_getmode()==NFAPI_UE_STUB_PNF)) {
@@ -535,7 +536,7 @@ void init_pdcp(void) {
if (IS_SOFTMODEM_NOKRNMOD)
pdcp_initmask = pdcp_initmask | UE_NAS_USE_TUN_BIT;
pdcp_module_init(pdcp_initmask);
pdcp_module_init(pdcp_initmask, ue_id);
pdcp_set_rlc_data_req_func((send_rlc_data_req_func_t) rlc_data_req);
pdcp_set_pdcp_data_ind_func((pdcp_data_ind_func_t) pdcp_data_ind);
}
@@ -547,6 +548,21 @@ AssertFatal(false,"");
}
int main( int argc, char **argv ) {
struct sched_param param =
{
.sched_priority = 79
};
if (sched_setscheduler( 0, SCHED_RR, &param ) == -1 )
{
fprintf(stderr, "sched_setscheduler: %s\n", strerror(errno));
return EXIT_FAILURE;
}
if (mlockall(MCL_CURRENT | MCL_FUTURE) == -1)
{
fprintf(stderr, "mlockall: %s\n", strerror(errno));
return EXIT_FAILURE;
}
int CC_id;
uint8_t abstraction_flag=0;
// Default value for the number of UEs. It will hold,
@@ -610,7 +626,16 @@ int main( int argc, char **argv ) {
MSC_INIT(MSC_E_UTRAN, ADDED_QUEUES_MAX+TASK_MAX);
init_opt();
init_pdcp();
ue_id_g = (node_number == 0)? 0 : node_number-2 ;//ue_id_g = 0, 1, ...,
if( node_number == 0 )
{
init_pdcp(0);
}
else
{
init_pdcp(node_number-1);
}
//TTN for D2D
printf ("RRC control socket\n");
rrc_control_socket_init();
@@ -633,7 +658,7 @@ int main( int argc, char **argv ) {
NB_INST=1;
if(NFAPI_MODE==NFAPI_UE_STUB_PNF) {
if(NFAPI_MODE==NFAPI_UE_STUB_PNF || NFAPI_MODE==NFAPI_MODE_STANDALONE_PNF) {
PHY_vars_UE_g = malloc(sizeof(PHY_VARS_UE **)*NB_UE_INST);
for (int i=0; i<NB_UE_INST; i++) {
@@ -721,6 +746,19 @@ int main( int argc, char **argv ) {
//Panos: Temporarily we will be using single set of threads for multiple UEs.
//init_UE_stub(1,eMBMS_active,uecap_xer_in,emul_iface);
init_UE_stub_single_thread(NB_UE_INST,eMBMS_active,uecap_xer_in,emul_iface);
} else if (NFAPI_MODE==NFAPI_MODE_STANDALONE_PNF) {
init_queue(&dl_config_req_tx_req_queue);
init_queue(&hi_dci0_req_queue);
init_queue(&ul_config_req_queue);
config_sync_var=0;
if (sem_init(&sfn_semaphore, 0, 0) != 0)
{
LOG_E(MAC, "sem_init() error\n");
abort();
}
init_UE_stub_single_thread(NB_UE_INST,eMBMS_active,uecap_xer_in,emul_iface);
init_UE_standalone_thread(ue_id_g);
} else {
init_UE(NB_UE_INST,eMBMS_active,uecap_xer_in,0,get_softmodem_params()->phy_test,UE_scan,UE_scan_carrier,mode,(int)rx_gain[0][0],tx_max_power[0],
frame_parms[0]);