Commit 2948a244 authored by David Kim's avatar David Kim

Merge branch 'episys/master' into episys/david/episys-merge-2nd-x2c

parents 94c9866b 8120c797
......@@ -353,6 +353,10 @@ set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS} -g3 -O0 -DMALLOC_CHECK_=3")
set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS} -g3 -DMALLOC_CHECK_=3 -O2 -fno-delete-null-pointer-checks")
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS} -O3")
# Enable assert() for RelWithDebInfo builds
string(REPLACE "-DNDEBUG" "" CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO}")
string(REPLACE "-DNDEBUG" "" CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}")
set(GIT_BRANCH "UNKNOWN")
set(GIT_COMMIT_HASH "UNKNOWN")
set(GIT_COMMIT_DATE "UNKNOWN")
......
......@@ -81,3 +81,115 @@ See launch.json for details about how vscode launches lte-softmodem for debuggin
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
-------------------------------------------------------------------------------
Running Vscode remotely.
Currently, running Vscode remotely (via an X-Windows connection) does not work
-- the Vscode window appears but remains blank. Presumably the Vscode
developers will fix this problem eventually. Meanwhile, you can use `sshfs`
to make the remote filesystem appear locally and then run Vscode locally.
On the local machine:
$ remote=surfer # or whatever the remote machine's name is
$ mkdir ~/openairinterface5g
$ sshfs $remote:openairinterface5g ~/openairinterface5g
$ ls ~/openairinterface5g
CHANGELOG.md CONTRIBUTING.md nfapi openair3 targets
...
$ code ~/openairinterface5g
$
The remote and local pathnames of your openairinterface5g workspace should be
the same. If they're different, use a symlink on the local machine to make
the remote pathnames work locally. This part is important because executables
built on $remote contain references to the source files and vscode & gdb will
use those pathnames to find the source files.
You may want to locally mount the remote logs directory, too:
$ mkdir ~/logs
$ sshfs $remote:logs ~/logs
$ ls -l ~/logs
total 40
lrwxrwxrwx 1 1002 1002 22 Jan 17 11:54 latest -> logs-2021-01-17-085419
drwxr-xr-x 1 1002 1002 4096 Jan 17 11:54 logs-2021-01-17-085419
$
That will give you access to core files collected by lte_testscript.py, for
example.
$ file ~/logs/latest/0001/coredump-6699
/home/michael/logs/latest/0001/coredump-6699: ELF 64-bit LSB core file,
x86-64, version 1 (SYSV), SVR4-style, from './ran_build/build/lte-softmodem
-O ../ci-scripts/conf_files/rcc.band7.tm1.nfapi', real uid: 0, effective
uid: 0, real gid: 0, effective gid: 0, execfn:
'./ran_build/build/lte-softmodem', platform: 'x86_64'
$
$ file ~/openairinterface5g/cmake_targets/ran_build/build/lte-softmodem
/home/michael/openairinterface5g/cmake_targets/ran_build/build/lte-softmodem:
ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked,
interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.32,
BuildID[sha1]=831400d4aae5d43b94ef3b22ebbd635107de48ae, with debug_info, not
stripped
$
Verify gdb can access these remote files:
$ gdb ~/openairinterface5g/cmake_targets/ran_build/build/lte-softmodem \
~/logs/latest/0001/coredump-6699
...
Program terminated with signal SIGABRT, Aborted.
#0 0x00007f7fd7d11438 in ?? ()
[Current thread is 1 (LWP 39)]
(gdb)
If this step is too slow, you may want to copy the executable and coredump
files to the local machine first.
$ scp -C $remote:openairinterface5g/cmake_targets/ran_build/build/lte-softmodem .
$ scp -C $remote:logs/latest/0001/coredump-6699 .
$ gdb lte-softmodem coredump-6699
Note, the local and remote machines should be the same version of Linux (e.g.,
both Ubuntu 16.04). Otherwise, gdb will likely have trouble understanding the
coredump.
To load the coredump into Vscode, modify launch.json to add "coreDumpPath".
You may also need to modify the "program" path and delete "miDebuggerPath".
--- .vscode/launch.json
+++ .vscode/launch.json
@@ -9,7 +9,7 @@
"name": "(gdb) Launch",
"type": "cppdbg",
"request": "launch",
- "program": "${workspaceFolder}/cmake_targets/ran_build/build/lte-so
+ "program": "/home/michael/tmp/lte-softmodem",
"args": [
"-O", "../ci-scripts/conf_files/rcc.band7.tm1.nfapi.conf",
"--noS1"
@@ -19,14 +19,14 @@
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
- "miDebuggerPath": "${workspaceFolder}/cmake_targets/sudo-gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
- ]
+ ],
+ "coreDumpPath": "/home/michael/tmp/coredump-6699"
}
]
}
Then, in Vscode click the debug icon on the left navigation bar, then click
the green "play" triangle near the upper left corner of the window. See the
"CALL STACK" near the lower left of the window.
-------------------------------------------------------------------------------
......@@ -54,6 +54,12 @@
#include "T.h"
#include <common/utils/utils.h>
/*----------------------------------------------------------------------------*/
#include <assert.h>
#ifdef NDEBUG
#warning assert is disabled
#endif
#define NUM_ELEMENTS(ARRAY) (sizeof(ARRAY) / sizeof(ARRAY[0]))
#define CHECK_INDEX(ARRAY, INDEX) assert((INDEX) < NUM_ELEMENTS(ARRAY))
#ifdef __cplusplus
extern "C" {
......@@ -418,7 +424,7 @@ int32_t write_file_matlab(const char *fname, const char *vname, void *data, int
# 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_I(COMPONENT, ...) do if (1) logMinimal(COMPONENT, 'I', __VA_ARGS__); while (0)
# define LOG_D(COMPONENT, ...) do if (0) logMinimal(COMPONENT, 'D', __VA_ARGS__); while (0)
# define LOG_T(COMPONENT, ...) do if (0) logMinimal(COMPONENT, 'T', __VA_ARGS__); while (0)
......
......@@ -1670,7 +1670,6 @@ nfapi_pnf_p7_subframe_buffer_t dummy_subframe;
int start_request(nfapi_pnf_config_t *config, nfapi_pnf_phy_config_t *phy, nfapi_start_request_t *req) {
printf("[PNF] Received NFAPI_START_REQ phy_id:%d\n", req->header.phy_id);
nfapi_set_trace_level(NFAPI_TRACE_INFO);
pnf_info *pnf = (pnf_info *)(config->user_data);
phy_info *phy_info = pnf->phys;
nfapi_pnf_p7_config_t *p7_config = nfapi_pnf_p7_config_create();
......
This diff is collapsed.
/*
* Copyright 2017 Cisco Systems, Inc.
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
......@@ -37,7 +37,7 @@ void nfapi_trace_dbg(nfapi_trace_level_t level, const char *format, ...);
// initialize the trace function to 0
void (*nfapi_trace_g)(nfapi_trace_level_t level, const char* format, ...) = &nfapi_trace_dbg;
nfapi_trace_level_t nfapi_trace_level_g = NFAPI_TRACE_INFO;
nfapi_trace_level_t nfapi_trace_level_g = NFAPI_TRACE_ERROR;
//nfapi_trace_level_t nfapi_trace_level_g = NFAPI_TRACE_WARN;
void nfapi_set_trace_level(nfapi_trace_level_t new_level)
......@@ -47,6 +47,8 @@ void nfapi_set_trace_level(nfapi_trace_level_t new_level)
void nfapi_trace_dbg(nfapi_trace_level_t level, const char *format, ...)
{
if (level < nfapi_trace_level_g)
return;
char trace_buff[MAX_MSG_LENGTH + TRACE_HEADER_LENGTH];
va_list p_args;
struct timeval tv;
......
......@@ -2484,6 +2484,7 @@ static uint8_t pack_harq_indication_body_value(void *tlv, uint8_t **ppWritePacke
uint16_t i = 0;
uint16_t total_number_of_pdus = value->number_of_harqs;
assert(total_number_of_pdus <= NFAPI_HARQ_IND_MAX_PDU);
for(; i < total_number_of_pdus; ++i)
{
nfapi_harq_indication_pdu_t* pdu = &(value->harq_pdu_list[i]);
......@@ -2536,6 +2537,7 @@ static uint8_t pack_crc_indication_body_value(void* tlv, uint8_t **ppWritePacked
uint16_t i = 0;
uint16_t total_number_of_pdus = value->number_of_crcs;
assert(total_number_of_pdus <= NFAPI_CRC_IND_MAX_PDU);
for(; i < total_number_of_pdus; ++i)
{
nfapi_crc_indication_pdu_t* pdu = &(value->crc_pdu_list[i]);
......@@ -2596,6 +2598,7 @@ static uint8_t pack_rx_ulsch_indication_body_value(void *tlv, uint8_t **ppWriteP
uint16_t total_number_of_pdus = value->number_of_pdus;
//printf("ULSCH:pdus:%d\n", total_number_of_pdus);
assert(total_number_of_pdus <= NFAPI_RX_IND_MAX_PDU);
for(i = 0; i < total_number_of_pdus; ++i)
{
nfapi_rx_indication_pdu_t* pdu = &(value->rx_pdu_list[i]);
......@@ -2619,6 +2622,7 @@ static uint8_t pack_rx_ulsch_indication_body_value(void *tlv, uint8_t **ppWriteP
}
// Now update the structure to include the offset
assert(total_number_of_pdus <= NFAPI_RX_IND_MAX_PDU);
for(i =0; i < total_number_of_pdus; ++i)
{
nfapi_rx_indication_pdu_t* pdu = &(value->rx_pdu_list[i]);
......@@ -2634,6 +2638,7 @@ static uint8_t pack_rx_ulsch_indication_body_value(void *tlv, uint8_t **ppWriteP
}
// Write out the pdu
assert(total_number_of_pdus <= NFAPI_RX_IND_MAX_PDU);
for(i = 0; i < total_number_of_pdus; ++i)
{
nfapi_rx_indication_pdu_t* pdu = &(value->rx_pdu_list[i]);
......@@ -2644,6 +2649,7 @@ static uint8_t pack_rx_ulsch_indication_body_value(void *tlv, uint8_t **ppWriteP
}
// Write out the pdu data
assert(total_number_of_pdus <= NFAPI_RX_IND_MAX_PDU);
for(i = 0; i < total_number_of_pdus; ++i)
{
uint16_t length = 0;
......@@ -2837,6 +2843,7 @@ static uint8_t pack_sr_indication_body_value(void *tlv, uint8_t **ppWritePackedM
uint16_t i = 0;
uint16_t total_number_of_pdus = value->number_of_srs;
assert(total_number_of_pdus <= NFAPI_SR_IND_MAX_PDU);
for(; i < total_number_of_pdus; ++i)
{
nfapi_sr_indication_pdu_t* pdu = &(value->sr_pdu_list[i]);
......@@ -2904,6 +2911,7 @@ static uint8_t pack_cqi_indication_body_value(void *tlv, uint8_t **ppWritePacked
uint16_t i = 0;
uint16_t offset = 2; // taking into account the number_of_cqis
uint16_t total_number_of_pdus = value->number_of_cqis;
assert(total_number_of_pdus <= NFAPI_CQI_IND_MAX_PDU);
for(i = 0; i < total_number_of_pdus; ++i)
{
nfapi_cqi_indication_pdu_t* pdu = &(value->cqi_pdu_list[i]);
......@@ -2932,6 +2940,7 @@ static uint8_t pack_cqi_indication_body_value(void *tlv, uint8_t **ppWritePacked
}
// Now update the structure to include the offset
assert(total_number_of_pdus <= NFAPI_CQI_IND_MAX_PDU);
for(i =0; i < total_number_of_pdus; ++i)
{
nfapi_cqi_indication_pdu_t* pdu = &(value->cqi_pdu_list[i]);
......@@ -2957,6 +2966,7 @@ static uint8_t pack_cqi_indication_body_value(void *tlv, uint8_t **ppWritePacked
}
// Write out the cqi information
assert(total_number_of_pdus <= NFAPI_CQI_IND_MAX_PDU);
for(i = 0; i < total_number_of_pdus; ++i)
{
nfapi_cqi_indication_pdu_t* pdu = &(value->cqi_pdu_list[i]);
......@@ -2979,6 +2989,7 @@ static uint8_t pack_cqi_indication_body_value(void *tlv, uint8_t **ppWritePacked
}
// Write out the cqi raw data
assert(total_number_of_pdus <= NFAPI_CQI_IND_MAX_PDU);
for(i = 0; i < total_number_of_pdus; ++i)
{
uint16_t length = 0;
......@@ -6334,15 +6345,16 @@ static uint8_t unpack_harq_indication_body_value(void* tlv, uint8_t **ppReadPack
return 0;
}
value->harq_pdu_list = (nfapi_harq_indication_pdu_t*)nfapi_p7_allocate(sizeof(nfapi_harq_indication_pdu_t) * value->number_of_harqs, config);
assert(value->number_of_harqs <= NFAPI_HARQ_IND_MAX_PDU);
value->harq_pdu_list = (nfapi_harq_indication_pdu_t*)nfapi_p7_allocate(sizeof(nfapi_harq_indication_pdu_t) * NFAPI_HARQ_IND_MAX_PDU, config);
if(value->harq_pdu_list == NULL)
{
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate harq ind pdu list (count:%d)\n", __FUNCTION__, value->number_of_harqs);
return 0;
}
uint8_t i = 0;
for(i = 0; i < value->number_of_harqs; ++i)
assert(value->number_of_harqs <= NFAPI_HARQ_IND_MAX_PDU);
for (size_t i = 0; i < value->number_of_harqs; ++i)
{
nfapi_harq_indication_pdu_t* pdu = &(value->harq_pdu_list[i]);
if(pull16(ppReadPackedMsg, &pdu->instance_length, end) == 0)
......@@ -6408,7 +6420,8 @@ static uint8_t unpack_crc_indication_body_value(void *tlv, uint8_t **ppReadPacke
if(value->number_of_crcs > 0)
{
value->crc_pdu_list = (nfapi_crc_indication_pdu_t*)nfapi_p7_allocate(sizeof(nfapi_crc_indication_pdu_t) * value->number_of_crcs, config);
assert(value->number_of_crcs <= NFAPI_CRC_IND_MAX_PDU);
value->crc_pdu_list = (nfapi_crc_indication_pdu_t*)nfapi_p7_allocate(sizeof(nfapi_crc_indication_pdu_t) * NFAPI_CRC_IND_MAX_PDU, config);
if(value->crc_pdu_list == NULL)
{
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate crc ind pdu list (count:%d)\n", __FUNCTION__, value->number_of_crcs);
......@@ -6422,6 +6435,7 @@ static uint8_t unpack_crc_indication_body_value(void *tlv, uint8_t **ppReadPacke
uint8_t i = 0;
assert(value->number_of_crcs <= NFAPI_CRC_IND_MAX_PDU);
for(i = 0; i < value->number_of_crcs; ++i)
{
nfapi_crc_indication_pdu_t* pdu = &(value->crc_pdu_list[i]);
......@@ -6500,7 +6514,8 @@ static uint8_t unpack_rx_indication_body_value(void *tlv, uint8_t **ppReadPacked
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);
assert(value->number_of_pdus <= NFAPI_RX_IND_MAX_PDU);
value->rx_pdu_list = (nfapi_rx_indication_pdu_t *)nfapi_p7_allocate(sizeof(nfapi_rx_indication_pdu_t) * NFAPI_RX_IND_MAX_PDU, 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);
......@@ -6533,6 +6548,7 @@ static uint8_t unpack_rx_indication_body_value(void *tlv, uint8_t **ppReadPacked
return 0;
}
assert(i <= NFAPI_RX_IND_MAX_PDU);
nfapi_rx_indication_pdu_t *pdu = &value->rx_pdu_list[i];
pdu->rx_ue_information.tl = generic_tl;
......@@ -6588,6 +6604,7 @@ static uint8_t unpack_rx_indication_body_value(void *tlv, uint8_t **ppReadPacked
}
}
assert(value->number_of_pdus <= NFAPI_RX_IND_MAX_PDU);
for (int i = 0; i < value->number_of_pdus; ++i)
{
nfapi_rx_indication_pdu_t *pdu = &value->rx_pdu_list[i];
......@@ -6869,7 +6886,8 @@ static uint8_t unpack_sr_indication_body_value(void *tlv, uint8_t **ppReadPacked
if(value->number_of_srs > 0)
{
value->sr_pdu_list = (nfapi_sr_indication_pdu_t*)nfapi_p7_allocate(sizeof(nfapi_sr_indication_pdu_t) * value->number_of_srs, config);
assert(value->number_of_srs <= NFAPI_SR_IND_MAX_PDU);
value->sr_pdu_list = (nfapi_sr_indication_pdu_t*)nfapi_p7_allocate(sizeof(nfapi_sr_indication_pdu_t) * NFAPI_SR_IND_MAX_PDU, config);
if(value->sr_pdu_list == NULL)
{
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate sr ind pdu list (count:%d)\n", __FUNCTION__, value->number_of_srs);
......@@ -6882,6 +6900,7 @@ static uint8_t unpack_sr_indication_body_value(void *tlv, uint8_t **ppReadPacked
}
uint8_t i = 0;
assert(value->number_of_srs <= NFAPI_SR_IND_MAX_PDU);
for(i = 0; i < value->number_of_srs; ++i)
{
nfapi_sr_indication_pdu_t* pdu = &(value->sr_pdu_list[i]);
......@@ -6978,7 +6997,8 @@ static uint8_t unpack_cqi_indication_body_value(void* tlv, uint8_t **ppReadPack
if(value->number_of_cqis > 0)
{
value->cqi_pdu_list = (nfapi_cqi_indication_pdu_t*)nfapi_p7_allocate(sizeof(nfapi_cqi_indication_pdu_t) * value->number_of_cqis, config);
assert(value->number_of_cqis <= NFAPI_SR_IND_MAX_PDU);
value->cqi_pdu_list = (nfapi_cqi_indication_pdu_t*)nfapi_p7_allocate(sizeof(nfapi_cqi_indication_pdu_t) * NFAPI_SR_IND_MAX_PDU, config);
if(value->cqi_pdu_list == NULL)
{
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate cqi ind pdu list (count:%d)\n", __FUNCTION__, value->number_of_cqis);
......@@ -6992,7 +7012,8 @@ static uint8_t unpack_cqi_indication_body_value(void* tlv, uint8_t **ppReadPack
if(value->number_of_cqis > 0)
{
value->cqi_raw_pdu_list = (nfapi_cqi_indication_raw_pdu_t*)nfapi_p7_allocate(sizeof(nfapi_cqi_indication_raw_pdu_t) * value->number_of_cqis, config);
assert(value->number_of_cqis <= NFAPI_SR_IND_MAX_PDU);
value->cqi_raw_pdu_list = (nfapi_cqi_indication_raw_pdu_t*)nfapi_p7_allocate(sizeof(nfapi_cqi_indication_raw_pdu_t) * NFAPI_SR_IND_MAX_PDU, config);
if(value->cqi_raw_pdu_list == NULL)
{
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate raw cqi ind pdu list (count:%d)\n", __FUNCTION__, value->number_of_cqis);
......@@ -7005,6 +7026,7 @@ static uint8_t unpack_cqi_indication_body_value(void* tlv, uint8_t **ppReadPack
}
uint8_t i = 0;
assert(value->number_of_cqis <= NFAPI_CQI_IND_MAX_PDU);
for(i = 0; i < value->number_of_cqis; ++i)
{
nfapi_cqi_indication_pdu_t* pdu = &(value->cqi_pdu_list[i]);
......@@ -7057,6 +7079,7 @@ static uint8_t unpack_cqi_indication_body_value(void* tlv, uint8_t **ppReadPack
}
uint8_t idx = 0;
assert(value->number_of_cqis <= NFAPI_CQI_IND_MAX_PDU);
for(idx = 0; idx < value->number_of_cqis; ++idx)
{
if(value->cqi_pdu_list[idx].cqi_indication_rel8.tl.tag == NFAPI_CQI_INDICATION_REL8_TAG)
......
......@@ -18,9 +18,8 @@
#ifndef _PNF_H_
#define _PNF_H_
#include "nfapi_pnf_interface.h"
#include "nfapi/open-nFAPI/pnf/inc/pnf_p7.h"
#define NFAPI_MAX_PACKED_MESSAGE_SIZE 8192
typedef struct {
......
This diff is collapsed.
/*
* Copyright 2017 Cisco Systems, Inc.
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
......@@ -32,11 +32,11 @@ nfapi_pnf_config_t* nfapi_pnf_config_create()
memset(_this, 0, sizeof(pnf_t));
_this->sctp = 1; // enable sctp
_this->_public.vnf_p5_port = NFAPI_P5_SCTP_PORT;
_this->_public.malloc = &malloc;
_this->_public.free = &free;
_this->_public.free = &free;
_this->_public.codec_config.allocate = &malloc;
_this->_public.codec_config.deallocate = &free;
......@@ -265,7 +265,7 @@ int nfapi_pnf_param_resp(nfapi_pnf_config_t* config, nfapi_param_response_t* res
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__);
return -1;
}
pnf_t* _this = (pnf_t*)(config);
return pnf_pack_and_send_p5_message(_this, &(resp->header), sizeof(nfapi_param_response_t));
......@@ -279,7 +279,7 @@ int nfapi_nr_pnf_param_resp(nfapi_pnf_config_t* config, nfapi_nr_param_response_
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__);
return -1;
}
pnf_t* _this = (pnf_t*)(config);
return pnf_nr_pack_and_send_p5_message(_this, &(resp->header), sizeof(nfapi_nr_param_response_scf_t));
......@@ -591,4 +591,3 @@ int nfapi_pnf_vendor_extension(nfapi_pnf_config_t* config, nfapi_p4_p5_message_h
return pnf_pack_and_send_p5_message(_this, msg, msg_len);
}
......@@ -2947,12 +2947,19 @@ void pnf_nfapi_p7_read_dispatch_message(pnf_p7_t* pnf_p7, uint32_t now_hr_time)
}
// read the segment
recvfrom_result = recvfrom(pnf_p7->p7_sock, pnf_p7->rx_message_buffer, header.message_length, MSG_DONTWAIT, (struct sockaddr*)&remote_addr, &remote_addr_size);
recvfrom_result = recvfrom(pnf_p7->p7_sock, pnf_p7->rx_message_buffer, pnf_p7->rx_message_buffer_size,
MSG_DONTWAIT | MSG_TRUNC, (struct sockaddr*)&remote_addr, &remote_addr_size);
now_hr_time = pnf_get_current_time_hr(); //DJP - moved to here - get closer timestamp???
if(recvfrom_result > 0)
{
if (recvfrom_result != header.message_length)
{
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s(%d). Received unexpected number of bytes. %d != %d",
__FUNCTION__, __LINE__, recvfrom_result, header.message_length);
break;
}
pnf_handle_p7_message(pnf_p7->rx_message_buffer, recvfrom_result, pnf_p7, now_hr_time);
//printf("\npnf_handle_p7_message sfn=%d,slot=%d\n",pnf_p7->sfn,pnf_p7->slot);
}
......
......@@ -18,6 +18,7 @@
#ifndef _VNF_H_
#define _VNF_H_
#include "pnf_p7.h"
#include "nfapi_vnf_interface.h"
typedef struct
......
......@@ -23,9 +23,14 @@
#include <string.h>
#include <unistd.h>
#include <errno.h>
#include <assert.h>
#include "vnf_p7.h"
#ifdef NDEBUG
# warning assert is disabled
#endif
#define SYNC_CYCLE_COUNT 2
void* vnf_p7_malloc(vnf_p7_t* vnf_p7, size_t size)
......@@ -818,6 +823,7 @@ void vnf_handle_rx_ulsch_indication(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vn
}
}
assert(ind.rx_indication_body.number_of_pdus <= NFAPI_RX_IND_MAX_PDU);
uint16_t i = 0;
for(i = 0; i < ind.rx_indication_body.number_of_pdus; ++i)
{
......@@ -2446,9 +2452,9 @@ int vnf_p7_read_dispatch_message(vnf_p7_t* vnf_p7)
{
NFAPI_TRACE(NFAPI_TRACE_ERROR, "recvfrom returned 0\n");
}
else if(recvfrom_result != header.message_length)
else if(recvfrom_result != -1 && recvfrom_result != header.message_length)
{
NFAPI_TRACE(NFAPI_TRACE_NOTE, "did not receive the entire message %d %d\n", recvfrom_result, header.message_length);
NFAPI_TRACE(NFAPI_TRACE_ERROR, "Received unexpected number of bytes %d %d\n", recvfrom_result, header.message_length);
recvfrom_result += recvfrom(vnf_p7->socket, &vnf_p7->rx_message_buffer[recvfrom_result], header.message_length - recvfrom_result, MSG_WAITALL, (struct sockaddr*)&remote_addr, &remote_addr_size);
......@@ -2500,8 +2506,9 @@ void vnf_p7_release_msg(vnf_p7_t* vnf_p7, nfapi_p7_message_header_t* header)
case NFAPI_RX_ULSCH_INDICATION:
{
nfapi_rx_indication_t* rx_ind = (nfapi_rx_indication_t*)(header);
uint16_t i = 0;
for(i = 0; i < rx_ind->rx_indication_body.number_of_pdus; ++i)
size_t number_of_pdus = rx_ind->rx_indication_body.number_of_pdus;
assert(number_of_pdus <= NFAPI_RX_IND_MAX_PDU);
for(size_t i = 0; i < number_of_pdus; ++i)
{
vnf_p7_codec_free(vnf_p7, rx_ind->rx_indication_body.rx_pdu_list[i].data);
}
......
......@@ -84,7 +84,8 @@ int16_t find_ulsch(uint16_t rnti, PHY_VARS_eNB *eNB,find_type_t type) {
AssertFatal(eNB!=NULL,"eNB is null\n");
for (i=0; i<NUMBER_OF_UE_MAX; i++) {
AssertFatal(eNB->ulsch[i]!=NULL,"eNB->ulsch[%d] is null\n",i);
if (eNB->ulsch[i] == NULL)
continue;
if ((eNB->ulsch[i]->harq_mask >0) &&
(eNB->ulsch[i]->rnti==rnti)) return i;
......
......@@ -91,7 +91,7 @@ const double sinr_to_cqi[4][16]= { {-2.5051, -2.5051, -1.7451, -0.3655, 1.0812,
};
//int cqi_to_mcs[16]={0, 0, 1, 3, 5, 7, 9, 13, 15, 16, 20, 23, 25, 27, 27, 27};
const int cqi_to_mcs[16]= {0, 0, 1, 2, 4, 6, 8, 11, 13, 16, 18, 20, 23, 25, 27, 28};
const int cqi_to_mcs[16]= {0, 0, 1, 2, 4, 6, 8, 11, 13, 16, 18, 20, 23, 25, 27, 27};
//for SNR to MI conversion 7 th order Polynomial coeff
const double q_qam16[8]= {3.21151853033897e-10,5.55435952230651e-09,-2.30760065362117e-07,-6.25587743817859e-06,4.62251036452795e-06,0.00224150813158937,0.0393723140344367,0.245486379182639};
......
......@@ -91,7 +91,7 @@ const double sinr_to_cqi[4][16]= { {-2.5051, -2.5051, -1.7451, -0.3655, 1.0812,
};
//int cqi_to_mcs[16]={0, 0, 1, 3, 5, 7, 9, 13, 15, 16, 20, 23, 25, 27, 27, 27};
const int cqi_to_mcs[16]= {0, 0, 1, 2, 4, 6, 8, 11, 13, 16, 18, 20, 23, 25, 27, 28};
const int cqi_to_mcs[16]= {0, 0, 1, 2, 4, 6, 8, 11, 13, 16, 18, 20, 23, 25, 27, 27};
//for SNR to MI conversion 7 th order Polynomial coeff
const double q_qam16[8]= {3.21151853033897e-10,5.55435952230651e-09,-2.30760065362117e-07,-6.25587743817859e-06,4.62251036452795e-06,0.00224150813158937,0.0393723140344367,0.245486379182639};
......
......@@ -84,7 +84,7 @@ const double sinr_to_cqi[4][16]= { {-2.5051, -2.5051, -1.7451, -0.3655, 1.0812,
};
//int cqi_to_mcs[16]={0, 0, 1, 3, 5, 7, 9, 13, 15, 16, 20, 23, 25, 27, 27, 27};
const int cqi_to_mcs[16]= {0, 0, 1, 2, 4, 6, 8, 11, 13, 16, 18, 20, 23, 25, 27, 28};
const int cqi_to_mcs[16]= {0, 0, 1, 2, 4, 6, 8, 11, 13, 16, 18, 20, 23, 25, 27, 27};
//for SNR to MI conversion 7 th order Polynomial coeff
const double q_qam16[8]= {3.21151853033897e-10,5.55435952230651e-09,-2.30760065362117e-07,-6.25587743817859e-06,4.62251036452795e-06,0.00224150813158937,0.0393723140344367,0.245486379182639};
......
......@@ -749,6 +749,7 @@ void fill_sr_indication(int UEid, PHY_VARS_eNB *eNB,uint16_t rnti,int frame,int
pthread_mutex_lock(&eNB->UL_INFO_mutex);
nfapi_sr_indication_t *sr_ind = &eNB->UL_INFO.sr_ind;
nfapi_sr_indication_body_t *sr_ind_body = &sr_ind->sr_indication_body;
assert(sr_ind_body->number_of_srs <= NFAPI_SR_IND_MAX_PDU);
nfapi_sr_indication_pdu_t *pdu = &sr_ind_body->sr_pdu_list[sr_ind_body->number_of_srs];
sr_ind->sfn_sf = frame<<4|subframe;
sr_ind->header.message_id = NFAPI_RX_SR_INDICATION;
......@@ -1554,6 +1555,7 @@ void fill_rx_indication(PHY_VARS_eNB *eNB,
pthread_mutex_lock(&eNB->UL_INFO_mutex);
eNB->UL_INFO.rx_ind.sfn_sf = frame<<4| subframe;
eNB->UL_INFO.rx_ind.rx_indication_body.tl.tag = NFAPI_RX_INDICATION_BODY_TAG;
assert(eNB->UL_INFO.rx_ind.rx_indication_body.number_of_pdus <= NFAPI_RX_IND_MAX_PDU);
pdu = &eNB->UL_INFO.rx_ind.rx_indication_body.rx_pdu_list[eNB->UL_INFO.rx_ind.rx_indication_body.number_of_pdus];
// pdu->rx_ue_information.handle = eNB->ulsch[UE_id]->handle;
pdu->rx_ue_information.tl.tag = NFAPI_RX_UE_INFORMATION_TAG;
......@@ -1795,6 +1797,7 @@ int getM(PHY_VARS_eNB *eNB,int frame,int subframe) {
void fill_ulsch_cqi_indication (PHY_VARS_eNB *eNB, uint16_t frame, uint8_t subframe, LTE_UL_eNB_HARQ_t *ulsch_harq, uint16_t rnti) {
pthread_mutex_lock (&eNB->UL_INFO_mutex);
assert(eNB->UL_INFO.cqi_ind.cqi_indication_body.number_of_cqis <= NFAPI_CQI_IND_MAX_PDU);
nfapi_cqi_indication_pdu_t *pdu = &eNB->UL_INFO.cqi_ind.cqi_indication_body.cqi_pdu_list[eNB->UL_INFO.cqi_ind.cqi_indication_body.number_of_cqis];
nfapi_cqi_indication_raw_pdu_t *raw_pdu = &eNB->UL_INFO.cqi_ind.cqi_indication_body.cqi_raw_pdu_list[eNB->UL_INFO.cqi_ind.cqi_indication_body.number_of_cqis];
pdu->instance_length = 0;
......@@ -1841,6 +1844,7 @@ void fill_ulsch_harq_indication (PHY_VARS_eNB *eNB, LTE_UL_eNB_HARQ_t *ulsch_har
//AssertFatal(UE_id>=0,"UE_id doesn't exist\n");
pthread_mutex_lock(&eNB->UL_INFO_mutex);
assert(eNB->UL_INFO.harq_ind.harq_indication_body.number_of_harqs <= NFAPI_HARQ_IND_MAX_PDU);
nfapi_harq_indication_pdu_t *pdu = &eNB->UL_INFO.harq_ind.harq_indication_body.harq_pdu_list[eNB->UL_INFO.harq_ind.harq_indication_body.number_of_harqs];
int M;
int i;
......@@ -1911,6 +1915,7 @@ void fill_uci_harq_indication (int UEid, PHY_VARS_eNB *eNB, LTE_eNB_UCI *uci, in
pthread_mutex_lock(&eNB->UL_INFO_mutex);
nfapi_harq_indication_t *ind = &eNB->UL_INFO.harq_ind;
nfapi_harq_indication_body_t *body = &ind->harq_indication_body;
assert(eNB->UL_INFO.harq_ind.harq_indication_body.number_of_harqs <= NFAPI_HARQ_IND_MAX_PDU);
nfapi_harq_indication_pdu_t *pdu = &body->harq_pdu_list[eNB->UL_INFO.harq_ind.harq_indication_body.number_of_harqs];
ind->sfn_sf = frame<<4|subframe;
ind->header.message_id = NFAPI_HARQ_INDICATION;
......@@ -2087,6 +2092,7 @@ void fill_uci_harq_indication (int UEid, PHY_VARS_eNB *eNB, LTE_eNB_UCI *uci, in
void fill_crc_indication (PHY_VARS_eNB *eNB, int UE_id, int frame, int subframe, uint8_t crc_flag) {
pthread_mutex_lock(&eNB->UL_INFO_mutex);
assert(eNB->UL_INFO.crc_ind.crc_indication_body.number_of_crcs <= NFAPI_CRC_IND_MAX_PDU);
nfapi_crc_indication_pdu_t *pdu = &eNB->UL_INFO.crc_ind.crc_indication_body.crc_pdu_list[eNB->UL_INFO.crc_ind.crc_indication_body.number_of_crcs];
eNB->UL_INFO.crc_ind.sfn_sf = frame<<4 | subframe;
eNB->UL_INFO.crc_ind.header.message_id = NFAPI_CRC_INDICATION;
......
......@@ -44,7 +44,7 @@
#include "LTE_SRB-ToAddModList.h"
#include "LTE_MBMS-SessionInfoList-r9.h"
#include "LTE_PMCH-InfoList-r9.h"
#include "common/utils/ocp_itti/intertask_interface.h"
typedef rlc_op_status_t (*send_rlc_data_req_func_t)(const protocol_ctxt_t *const,
const srb_flag_t, const MBMS_flag_t,
......@@ -54,6 +54,7 @@ typedef boolean_t (*pdcp_data_ind_func_t)( const protocol_ctxt_t *, const srb_fl
const MBMS_flag_t, const rb_id_t, const sdu_size_t,
mem_block_t *,const uint32_t *const, const uint32_t *const);
#define MAX_NUMBER_NETIF 1 //16
#define ENB_NAS_USE_TUN_W_MBMS_BIT (1<< 10)
#define PDCP_USE_NETLINK_BIT (1<< 11)
#define LINK_ENB_PDCP_TO_IP_DRIVER_BIT (1<< 13)
......
......@@ -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
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);
......@@ -132,7 +132,7 @@ int pdcp_fifo_flush_sdus(const protocol_ctxt_t *const ctxt_pP) {
}
else
{
if( LOG_DEBUGFLAG(DEBUG_PDCP) )
if( LOG_DEBUGFLAG(DEBUG_PDCP) )
log_dump(PDCP, pdcpData, pdcpHead->data_size, LOG_DUMP_CHAR,
"PDCP output to be sent to TUN interface: \n");
ret = write(nas_sock_fd[pdcpHead->inst], pdcpData, pdcpHead->data_size);
......@@ -140,7 +140,7 @@ int pdcp_fifo_flush_sdus(const protocol_ctxt_t *const ctxt_pP) {
ret,rb_id,nas_sock_fd[pdcpHead->inst], pdcpHead->data_size);
}
} else if (ENB_NAS_USE_TUN) {
if( LOG_DEBUGFLAG(DEBUG_PDCP) )
if( LOG_DEBUGFLAG(DEBUG_PDCP) )
log_dump(PDCP, pdcpData, pdcpHead->data_size, LOG_DUMP_CHAR,
"PDCP output to be sent to TUN interface: \n");
ret = write(nas_sock_fd[0], pdcpData, pdcpHead->data_size);
......@@ -152,7 +152,7 @@ int pdcp_fifo_flush_sdus(const protocol_ctxt_t *const ctxt_pP) {
nas_nlh_tx->nlmsg_len = sizeToWrite;
ret = sendmsg(nas_sock_fd[0],&nas_msg_tx,0);
} // PDCP_USE_NETLINK
AssertFatal(ret >= 0,"[PDCP_FIFOS] pdcp_fifo_flush_sdus (errno: %d %s), nas_sock_fd[0]: %d\n", errno, strerror(errno), nas_sock_fd[0]);
if( LOG_DEBUGFLAG(DEBUG_PDCP) )
......@@ -215,21 +215,46 @@ int pdcp_fifo_read_input_sdus_fromtun (const protocol_ctxt_t *const ctxt_pP) {
pdcp_t *pdcp_p = NULL;
int len;
rb_id_t rab_id = DEFAULT_RAB_ID;
int sockd;
do {
if (UE_NAS_USE_TUN) {
if (ue_id_g == 0) {
sockd = nas_sock_fd[ctxt_pP->module_id];
}
else {
sockd = nas_sock_fd[ue_id_g];
}
}
else {
sockd = nas_sock_fd[0];
}
for (;;) {
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 );
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);
len = read(sockd, &nl_rx_buf, NL_MAX_PAYLOAD);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_FIFO_READ_BUFFER, 0 );
if (len == -1) {
if (errno == EAGAIN) {
LOG_D(PDCP, "Error reading NAS socket: %s\n", strerror(errno));
}
else {
LOG_E(PDCP, "Error reading NAS socket: %s\n", strerror(errno));
}
break;
}
else
/* Check for message truncation. Strictly speaking if the packet is exactly sizeof(nl_rx_buf) bytes
that would not be an error. But we cannot distinguish that from a packet > sizeof(nl_rx_buf) */
if (len == sizeof(nl_rx_buf))
{
len = read(UE_NAS_USE_TUN?nas_sock_fd[ue_id_g]:nas_sock_fd[0], &nl_rx_buf, NL_MAX_PAYLOAD);
LOG_E(PDCP, "%s(%d). Message truncated %d\n", __FUNCTION__, __LINE__, len);
break;
}
if (len == 0) {
LOG_E(PDCP, "EOF Reading NAS socket\n");
break;
}
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_FIFO_READ_BUFFER, 0 );
if (len<=0) continue;
if (UE_NAS_USE_TUN) {
key = PDCP_COLL_KEY_DEFAULT_DRB_VALUE(ctxt.module_id, ctxt.rnti, ctxt.enb_flag);
......@@ -271,7 +296,7 @@ int pdcp_fifo_read_input_sdus_fromtun (const protocol_ctxt_t *const ctxt_pP) {
ctxt.frame, ctxt.instance, rab_id, len, ctxt.module_id,
ctxt.rnti, rab_id, key);
}
} while (len > 0);
}
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_FIFO_READ, 0 );
return len;
......@@ -644,9 +669,19 @@ void pdcp_fifo_read_input_sdus_frompc5s (const protocol_ctxt_t *const ctxt_pP)
//TTN for D2D (PC5S)
// receive a message from ProSe App
memset(receive_buf, 0, BUFSIZE);
bytes_received = recvfrom(pdcp_pc5_sockfd, receive_buf, BUFSIZE, 0,
bytes_received = recvfrom(pdcp_pc5_sockfd, receive_buf, BUFSIZE, MSG_TRUNC,
(struct sockaddr *) &prose_pdcp_addr, (socklen_t *)&prose_addr_len);
if (bytes_received == -1) {
LOG_E(PDCP, "%s(%d). recvfrom failed. %s\n", __FUNCTION__, __LINE__, strerror(errno));
return;
}
if (bytes_received == 0) {
LOG_E(PDCP, "%s(%d). EOF pdcp_pc5_sockfd.\n", __FUNCTION__, __LINE__);
}
if (bytes_received > BUFSIZE) {
LOG_E(PDCP, "%s(%d). Message truncated. %d\n", __FUNCTION__, __LINE__, bytes_received);
return;
}
if (bytes_received > 0) {
pc5s_header = calloc(1, sizeof(pc5s_header_t));
memcpy((void *)pc5s_header, (void *)receive_buf, sizeof(pc5s_header_t));
......@@ -865,4 +900,3 @@ pdcp_pc5_socket_init() {
exit(1);
}
}
......@@ -96,8 +96,9 @@ void handle_sr(UL_IND_t *UL_info) {
oai_nfapi_sr_indication(&UL_info->sr_ind);
}
} else if(NFAPI_MODE == NFAPI_MODE_VNF) {
for(uint8_t j = 0; j < NUM_NFPAI_SUBFRAME; j++) {
for(uint8_t j = 0; j < NUM_NFAPI_SUBFRAME; j++) {
if(UL_RCC_INFO.sr_ind[j].sr_indication_body.number_of_srs > 0) {
assert(UL_RCC_INFO.sr_ind[j].sr_indication_body.number_of_srs <= NFAPI_SR_IND_MAX_PDU);
for (i=0; i<UL_RCC_INFO.sr_ind[j].sr_indication_body.number_of_srs; i++) {
SR_indication(UL_info->module_id,
UL_info->CC_id,
......@@ -113,6 +114,7 @@ void handle_sr(UL_IND_t *UL_info) {
}
}
} else {
assert(UL_info->sr_ind.sr_indication_body.number_of_srs <= NFAPI_SR_IND_MAX_PDU);
for (i=0; i<UL_info->sr_ind.sr_indication_body.number_of_srs; i++)
SR_indication(UL_info->module_id,
UL_info->CC_id,
......@@ -137,8 +139,9 @@ void handle_cqi(UL_IND_t *UL_info) {
UL_info->cqi_ind.cqi_indication_body.number_of_cqis=0;
}
} else if (NFAPI_MODE == NFAPI_MODE_VNF) {
for(uint8_t j = 0; j < NUM_NFPAI_SUBFRAME; j++) {
for(uint8_t j = 0; j < NUM_NFAPI_SUBFRAME; j++) {
if(UL_RCC_INFO.cqi_ind[j].cqi_indication_body.number_of_cqis > 0) {
assert(UL_RCC_INFO.cqi_ind[j].cqi_indication_body.number_of_cqis <= NFAPI_CQI_IND_MAX_PDU);
for (i=0; i<UL_RCC_INFO.cqi_ind[j].cqi_indication_body.number_of_cqis; i++) {
cqi_indication(UL_info->module_id,
UL_info->CC_id,
......@@ -157,6 +160,7 @@ void handle_cqi(UL_IND_t *UL_info) {
}
}
} else {
assert(UL_info->cqi_ind.cqi_indication_body.number_of_cqis <= NFAPI_CQI_IND_MAX_PDU);
for (i=0; i<UL_info->cqi_ind.cqi_indication_body.number_of_cqis; i++)
cqi_indication(UL_info->module_id,
UL_info->CC_id,
......@@ -182,8 +186,9 @@ void handle_harq(UL_IND_t *UL_info) {
UL_info->harq_ind.harq_indication_body.number_of_harqs = 0;
} else if(NFAPI_MODE == NFAPI_MODE_VNF) {
for(uint8_t j = 0; j < NUM_NFPAI_SUBFRAME; j++) {
for(uint8_t j = 0; j < NUM_NFAPI_SUBFRAME; j++) {
if(UL_RCC_INFO.harq_ind[j].harq_indication_body.number_of_harqs > 0) {
assert(UL_RCC_INFO.harq_ind[j].harq_indication_body.number_of_harqs <= NFAPI_HARQ_IND_MAX_PDU);
for (int i=0; i<UL_RCC_INFO.harq_ind[j].harq_indication_body.number_of_harqs; i++) {
harq_indication(UL_info->module_id,
UL_info->CC_id,
......@@ -198,6 +203,7 @@ void handle_harq(UL_IND_t *UL_info) {
}
}
} else {
assert(UL_info->harq_ind.harq_indication_body.number_of_harqs <= NFAPI_HARQ_IND_MAX_PDU);
for (int i=0; i < UL_info->harq_ind.harq_indication_body.number_of_harqs; i++)
harq_indication(UL_info->module_id,
UL_info->CC_id,
......@@ -225,9 +231,11 @@ void handle_ulsch(UL_IND_t *UL_info) {
UL_info->rx_ind.rx_indication_body.number_of_pdus = 0;
}
} else if(NFAPI_MODE == NFAPI_MODE_VNF) {
for(uint8_t k = 0; k < NUM_NFPAI_SUBFRAME; k++) {
for(uint8_t k = 0; k < NUM_NFAPI_SUBFRAME; k++) {
if((UL_RCC_INFO.rx_ind[k].rx_indication_body.number_of_pdus>0) && (UL_RCC_INFO.crc_ind[k].crc_indication_body.number_of_crcs>0)) {
assert(UL_RCC_INFO.rx_ind[k].rx_indication_body.number_of_pdus <= NFAPI_RX_IND_MAX_PDU);
for (i=0; i<UL_RCC_INFO.rx_ind[k].rx_indication_body.number_of_pdus; i++) {
assert(UL_RCC_INFO.crc_ind[k].crc_indication_body.number_of_crcs <= NFAPI_CRC_IND_MAX_PDU);
for (j=0; j<UL_RCC_INFO.crc_ind[k].crc_indication_body.number_of_crcs; j++) {
// find crc_indication j corresponding rx_indication i
LOG_D(PHY,"UL_info->crc_ind.crc_indication_body.crc_pdu_list[%d].rx_ue_information.rnti:%04x UL_info->rx_ind.rx_indication_body.rx_pdu_list[%d].rx_ue_information.rnti:%04x\n",
......@@ -280,7 +288,9 @@ void handle_ulsch(UL_IND_t *UL_info) {
}
} else {
if (UL_info->rx_ind.rx_indication_body.number_of_pdus>0 && UL_info->crc_ind.crc_indication_body.number_of_crcs>0) {
assert(UL_info->rx_ind.rx_indication_body.number_of_pdus <= NFAPI_RX_IND_MAX_PDU);
for (i=0; i<UL_info->rx_ind.rx_indication_body.number_of_pdus; i++) {
assert(UL_info->crc_ind.crc_indication_body.number_of_crcs <= NFAPI_CRC_IND_MAX_PDU);
for (j=0; j<UL_info->crc_ind.crc_indication_body.number_of_crcs; j++) {
// find crc_indication j corresponding rx_indication i
LOG_D(PHY,"UL_info->crc_ind.crc_indication_body.crc_pdu_list[%d].rx_ue_information.rnti:%04x UL_info->rx_ind.rx_indication_body.rx_pdu_list[%d].rx_ue_information.rnti:%04x\n", j,
......
......@@ -88,25 +88,25 @@ typedef struct {
} UL_IND_t;
// Downlink subframe P7
#define NUM_NFPAI_SUBFRAME 10
#define NUM_NFAPI_SUBFRAME 10
typedef struct {
/// harq indication list
nfapi_harq_indication_t harq_ind[NUM_NFPAI_SUBFRAME];
nfapi_harq_indication_t harq_ind[NUM_NFAPI_SUBFRAME];
/// crc indication list
nfapi_crc_indication_t crc_ind[NUM_NFPAI_SUBFRAME];
nfapi_crc_indication_t crc_ind[NUM_NFAPI_SUBFRAME];
/// SR indication list
nfapi_sr_indication_t sr_ind[NUM_NFPAI_SUBFRAME];
nfapi_sr_indication_t sr_ind[NUM_NFAPI_SUBFRAME];
/// CQI indication list
nfapi_cqi_indication_t cqi_ind[NUM_NFPAI_SUBFRAME];
nfapi_cqi_indication_t cqi_ind[NUM_NFAPI_SUBFRAME];
/// RACH indication list
nfapi_rach_indication_t rach_ind[NUM_NFPAI_SUBFRAME];
nfapi_rach_indication_t rach_ind[NUM_NFAPI_SUBFRAME];
/// RX indication
nfapi_rx_indication_t rx_ind[NUM_NFPAI_SUBFRAME];
nfapi_rx_indication_t rx_ind[NUM_NFAPI_SUBFRAME];
} UL_RCC_IND_t;
......
This diff is collapsed.
......@@ -19,8 +19,13 @@
//#include "openair1/PHY/LTE_TRANSPORT/defs.h"
//#include "openair1/PHY/defs.h"
//#include "openair1/PHY/LTE_TRANSPORT/defs.h"
#include "nfapi/open-nFAPI/pnf/inc/pnf_p7.h"
#include "queue.h"
#define NUM_MCS 28
#define NUM_SINR 100
#define NUM_BLER_COL 13
// this mutex is used to set multiple UE's UL value in L2 FAPI simulator.
extern FILL_UL_INFO_MUTEX_t fill_ul_mutex;
//below 2 difinitions move to phy_stub_UE.c to add initialization when difinition.
......@@ -34,6 +39,32 @@ extern UL_IND_t *UL_INFO;
//module_id_t next_Mod_id;
eth_params_t stub_eth_params;
typedef struct
{
uint16_t sfn_sf;
float sinr;
// Incomplete, need all channel parameters
} channel_info;
typedef struct
{
uint8_t sf;
uint16_t rnti[256];
uint8_t mcs[256];
float sinr;
uint16_t pdu_size;
bool drop_flag[256];
bool latest;
} sf_rnti_mcs_s;
typedef struct
{
uint16_t length;
float bler_table[NUM_SINR][NUM_BLER_COL];
} bler_struct;
extern bler_struct bler_data[NUM_MCS];
......
......@@ -421,7 +421,8 @@ 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",
rv[0] = ctxt_pP->module_id; // Debugging duplicate random values
LOG_A(RRC, "%s: random = %02X %02X %02X %02X %02X %02X\n",
__func__,
rv[0],
rv[1],
......@@ -5241,13 +5242,20 @@ void *rrc_control_socket_thread_fct(void *arg) {
LOG_I(RRC,"Listening to incoming connection from ProSe App \n");
// receive a message from ProSe App
memset(receive_buf, 0, BUFSIZE);
n = recvfrom(ctrl_sock_fd, receive_buf, BUFSIZE, 0,
n = recvfrom(ctrl_sock_fd, receive_buf, BUFSIZE, MSG_TRUNC,
(struct sockaddr *) &prose_app_addr, (socklen_t *)&prose_addr_len);
if (n < 0) {
LOG_E(RRC, "ERROR: Failed to receive from ProSe App\n");
exit(EXIT_FAILURE);
}
if (n == 0) {
LOG_E(RRC, "%s(%d). EOF for ctrl_sock_fd\n", __FUNCTION__, __LINE__);
}
if (n > BUFSIZE) {
LOG_E(RRC, "%s(%d). Message truncated. %d\n", __FUNCTION__, __LINE__, n);
exit(EXIT_FAILURE);
}
//TODO: should store the address of ProSeApp [UE_rrc_inst] to be able to send UE state notification to the App
//sl_ctrl_msg_recv = (struct sidelink_ctrl_element *) receive_buf;
......
......@@ -409,10 +409,14 @@ static int socket_udp_receive(int socket_fd, void *buf, int size)
socklen_t slen = sizeof(client);
int l;
l = recvfrom(socket_fd, buf, size, 0, (struct sockaddr *) &client, &slen);
l = recvfrom(socket_fd, buf, size, MSG_TRUNC, (struct sockaddr *) &client, &slen);
//getsockname(socket_fd, (struct sockaddr *)&client, &slen);
if (l == -1) goto error;
if (l == 0) goto socket_closed;
if (l > size) {
LOG_E(MAC, "%s(%d). Message truncated. %d\n", __FUNCTION__, __LINE__, l);
return -1;
}
return l;
......
......@@ -221,7 +221,7 @@ NwGtpv1uRcT gtpv1u_eNB_process_stack_req(
* - END-MARKER
*/
case NW_GTPV1U_ULP_API_RECV_TPDU: {
uint8_t buffer[4096];
uint8_t buffer[NFAPI_MAX_PACKED_MESSAGE_SIZE];
uint32_t buffer_len;
struct rrc_eNB_ue_context_s *ue_context_p;
uint16_t msgType = NW_GTP_GPDU;
......
......@@ -29,6 +29,7 @@
#include "hashtable.h"
#include "LTE_asn_constant.h"
#include "nfapi/open-nFAPI/pnf/inc/pnf_p7.h"
#ifndef GTPV1U_ENB_DEFS_H_
#define GTPV1U_ENB_DEFS_H_
......
......@@ -235,7 +235,7 @@ udp_eNB_send_to(
void udp_eNB_receiver(struct udp_socket_desc_s *udp_sock_pP)
{
uint8_t l_buffer[2048];
uint8_t l_buffer[NFAPI_MAX_PACKED_MESSAGE_SIZE];
int n;
socklen_t from_len;
struct sockaddr_in addr;
......@@ -246,10 +246,13 @@ void udp_eNB_receiver(struct udp_socket_desc_s *udp_sock_pP)
if (1) {
from_len = (socklen_t)sizeof(struct sockaddr_in);
if ((n = recvfrom(udp_sock_pP->sd, l_buffer, sizeof(l_buffer), 0,
if ((n = recvfrom(udp_sock_pP->sd, l_buffer, sizeof(l_buffer), MSG_TRUNC,
(struct sockaddr *)&addr, &from_len)) < 0) {
LOG_E(UDP_, "Recvfrom failed %s\n", strerror(errno));
return;
} else if (n > sizeof(l_buffer)) {
LOG_E(UDP_, "%s(%d). Message truncated. %d\n", __FUNCTION__, __LINE__, n);
return;
} else if (n == 0) {
LOG_W(UDP_, "Recvfrom returned 0\n");
return;
......
......@@ -31,6 +31,7 @@
#ifndef UDP_ENB_TASK_H_
#define UDP_ENB_TASK_H_
#include "enb_config.h"
#include "nfapi/open-nFAPI/pnf/inc/pnf_p7.h"
/** \brief UDP recv callback prototype. Will be called every time a payload is
......
......@@ -761,6 +761,7 @@ int main ( int argc, char **argv )
LOG_I(ENB_APP,"oai_exit=%d\n",oai_exit);
// stop threads
#if 0 //Disable clean up because this tends to crash (and unnecessary)
if (RC.nb_inst == 0 || !NODE_IS_CU(node_type)) {
if(IS_SOFTMODEM_DOFORMS)
end_forms();
......@@ -802,6 +803,7 @@ int main ( int argc, char **argv )
}
}
}
#endif
pdcp_module_cleanup();
terminate_opt();
......
......@@ -216,4 +216,6 @@ 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);
extern void init_bler_table(void);
#endif
......@@ -1040,16 +1040,16 @@ static void *UE_phy_stub_standalone_pnf_task(void *arg)
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(NUMBER_OF_UE_MAX, sizeof(nfapi_rx_indication_pdu_t));
UL_INFO->rx_ind.rx_indication_body.rx_pdu_list = calloc(NFAPI_RX_IND_MAX_PDU, 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(NUMBER_OF_UE_MAX, sizeof(nfapi_crc_indication_pdu_t));
UL_INFO->crc_ind.crc_indication_body.crc_pdu_list = calloc(NFAPI_CRC_IND_MAX_PDU, 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(NUMBER_OF_UE_MAX, sizeof(nfapi_harq_indication_pdu_t));
UL_INFO->harq_ind.harq_indication_body.harq_pdu_list = calloc(NFAPI_HARQ_IND_MAX_PDU, 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(NUMBER_OF_UE_MAX, sizeof(nfapi_sr_indication_pdu_t));
UL_INFO->sr_ind.sr_indication_body.sr_pdu_list = calloc(NFAPI_SR_IND_MAX_PDU, 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(NUMBER_OF_UE_MAX, sizeof(nfapi_cqi_indication_pdu_t));
UL_INFO->cqi_ind.cqi_indication_body.cqi_raw_pdu_list = calloc(NUMBER_OF_UE_MAX, sizeof(nfapi_cqi_indication_raw_pdu_t));
UL_INFO->cqi_ind.cqi_indication_body.cqi_pdu_list = calloc(NFAPI_CQI_IND_MAX_PDU, sizeof(nfapi_cqi_indication_pdu_t));
UL_INFO->cqi_ind.cqi_indication_body.cqi_raw_pdu_list = calloc(NFAPI_CQI_IND_MAX_PDU, 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;
......@@ -1112,7 +1112,7 @@ static void *UE_phy_stub_standalone_pnf_task(void *arg)
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,"
LOG_I(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);
......@@ -1281,7 +1281,8 @@ static void *UE_phy_stub_standalone_pnf_task(void *arg)
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++) {
assert(UL_INFO->rx_ind.rx_indication_body.number_of_pdus <= NFAPI_RX_IND_MAX_PDU);
for (size_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);
}
......
......@@ -193,6 +193,8 @@ int oaisim_flag=0;
*/
uint8_t abstraction_flag=0;
bler_struct bler_data[NUM_MCS];
/* forward declarations */
void set_default_frame_parms(LTE_DL_FRAME_PARMS *frame_parms[MAX_NUM_CCs]);
......@@ -756,6 +758,8 @@ int main( int argc, char **argv ) {
init_queue(&hi_dci0_req_queue);
init_queue(&ul_config_req_queue);
init_bler_table();
config_sync_var=0;
if (sem_init(&sfn_semaphore, 0, 0) != 0)
{
......@@ -845,3 +849,68 @@ int main( int argc, char **argv ) {
printf("Bye.\n");
return 0;
}
// Read in each MCS file and build BLER-SINR-TB table
void init_bler_table(void)
{
size_t bufSize = 1024;
char * line = NULL;
char * token;
char * temp = NULL;
const char *openair_dir = getenv("OPENAIR_DIR");
if (!openair_dir)
{
LOG_E(MAC, "No $OPENAIR_DIR\n");
abort();
}
// Maybe not needed... and may not work.
memset(bler_data, 0, sizeof(bler_data));
for (unsigned int i = 0; i < NUM_MCS; i++)
{
// Filename needs to be changed to dynamic name
char fName[1024];
snprintf(fName, sizeof(fName), "%s/openair1/SIMULATION/LTE_PHY/BLER_SIMULATIONS/AWGN/AWGN_results/bler_tx1_chan18_nrx1_mcs%d.csv", openair_dir, i);
FILE *pFile = fopen(fName, "r");
if (!pFile)
{
LOG_E(MAC, "Bler File ERROR! - fopen(), file: %s\n", fName);
abort();
}
int nlines = 0;
while (getline(&line, &bufSize, pFile) > 0)
{
if (!strncmp(line,"SNR",3))
{
continue;
}
if (nlines > NUM_SINR)
{
LOG_E(MAC, "BLER FILE ERROR - num lines greater than expected - file: %s\n", fName);
abort();
}
token = strtok_r(line, ";", &temp);
int ncols = 0;
while (token != NULL)
{
if (ncols > NUM_BLER_COL)
{
LOG_E(MAC, "BLER FILE ERROR - num of cols greater than expected\n");
abort();
}
bler_data[i].bler_table[nlines][ncols] = strtof(token, NULL);
ncols++;
token = strtok_r(NULL, ";", &temp);
}
nlines++;
}
bler_data[i].length = nlines;
fclose(pFile);
}
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment