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

This commit is contained in:
David Kim
2021-03-15 11:05:35 -07:00
35 changed files with 1132 additions and 487 deletions
+4
View File
@@ -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_RELWITHDEBINFO "${CMAKE_C_FLAGS} -g3 -DMALLOC_CHECK_=3 -O2 -fno-delete-null-pointer-checks")
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS} -O3") 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_BRANCH "UNKNOWN")
set(GIT_COMMIT_HASH "UNKNOWN") set(GIT_COMMIT_HASH "UNKNOWN")
set(GIT_COMMIT_DATE "UNKNOWN") set(GIT_COMMIT_DATE "UNKNOWN")
+112
View File
@@ -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 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 the left of main to add a breakpoint. then do Run => Start debugging (F5) to
run lte-softmodem in the debugger 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.
-------------------------------------------------------------------------------
+7 -1
View File
@@ -54,6 +54,12 @@
#include "T.h" #include "T.h"
#include <common/utils/utils.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 #ifdef __cplusplus
extern "C" { 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_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_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_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_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_T(COMPONENT, ...) do if (0) logMinimal(COMPONENT, 'T', __VA_ARGS__); while (0)
-1
View File
@@ -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) { 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); 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); pnf_info *pnf = (pnf_info *)(config->user_data);
phy_info *phy_info = pnf->phys; phy_info *phy_info = pnf->phys;
nfapi_pnf_p7_config_t *p7_config = nfapi_pnf_p7_config_create(); nfapi_pnf_p7_config_t *p7_config = nfapi_pnf_p7_config_create();
+45 -20
View File
@@ -708,18 +708,23 @@ int phy_harq_indication(struct nfapi_vnf_p7_config *config, nfapi_harq_indicatio
UL_RCC_INFO.harq_ind[index] = *ind; UL_RCC_INFO.harq_ind[index] = *ind;
if (ind->harq_indication_body.number_of_harqs > 0) assert(ind->harq_indication_body.number_of_harqs <= NFAPI_HARQ_IND_MAX_PDU);
UL_RCC_INFO.harq_ind[index].harq_indication_body.harq_pdu_list = malloc(sizeof(nfapi_harq_indication_pdu_t)*ind->harq_indication_body.number_of_harqs ); if (ind->harq_indication_body.number_of_harqs > 0) {
UL_RCC_INFO.harq_ind[index].harq_indication_body.harq_pdu_list = malloc(sizeof(nfapi_harq_indication_pdu_t) * NFAPI_HARQ_IND_MAX_PDU);
}
for (int i=0; i<ind->harq_indication_body.number_of_harqs; i++) { for (int i=0; i<ind->harq_indication_body.number_of_harqs; i++) {
memcpy(&UL_RCC_INFO.harq_ind[index].harq_indication_body.harq_pdu_list[i], &ind->harq_indication_body.harq_pdu_list[i], sizeof(nfapi_harq_indication_pdu_t)); memcpy(&UL_RCC_INFO.harq_ind[index].harq_indication_body.harq_pdu_list[i], &ind->harq_indication_body.harq_pdu_list[i], sizeof(nfapi_harq_indication_pdu_t));
} }
}else{ }else{
eNB->UL_INFO.harq_ind = *ind; eNB->UL_INFO.harq_ind = *ind;
eNB->UL_INFO.harq_ind.harq_indication_body.harq_pdu_list = eNB->harq_pdu_list; eNB->UL_INFO.harq_ind.harq_indication_body.harq_pdu_list = eNB->harq_pdu_list;
for (int i=0; i<ind->harq_indication_body.number_of_harqs; i++) { assert(ind->harq_indication_body.number_of_harqs <= NFAPI_HARQ_IND_MAX_PDU);
memcpy(&eNB->UL_INFO.harq_ind.harq_indication_body.harq_pdu_list[i], &ind->harq_indication_body.harq_pdu_list[i], sizeof(eNB->UL_INFO.harq_ind.harq_indication_body.harq_pdu_list[i])); for (int i=0; i<ind->harq_indication_body.number_of_harqs; i++) {
} memcpy(&eNB->UL_INFO.harq_ind.harq_indication_body.harq_pdu_list[i],
&ind->harq_indication_body.harq_pdu_list[i],
sizeof(eNB->UL_INFO.harq_ind.harq_indication_body.harq_pdu_list[i]));
}
} }
pthread_mutex_unlock(&eNB->UL_INFO_mutex); pthread_mutex_unlock(&eNB->UL_INFO_mutex);
// vnf_p7_info* p7_vnf = (vnf_p7_info*)(config->user_data); // vnf_p7_info* p7_vnf = (vnf_p7_info*)(config->user_data);
@@ -735,9 +740,12 @@ int phy_crc_indication(struct nfapi_vnf_p7_config *config, nfapi_crc_indication_
UL_RCC_INFO.crc_ind[index] = *ind; UL_RCC_INFO.crc_ind[index] = *ind;
if (ind->crc_indication_body.number_of_crcs > 0) assert(ind->crc_indication_body.number_of_crcs <= NFAPI_CRC_IND_MAX_PDU);
UL_RCC_INFO.crc_ind[index].crc_indication_body.crc_pdu_list = malloc(sizeof(nfapi_crc_indication_pdu_t)*ind->crc_indication_body.number_of_crcs ); if (ind->crc_indication_body.number_of_crcs > 0) {
UL_RCC_INFO.crc_ind[index].crc_indication_body.crc_pdu_list = malloc(sizeof(nfapi_crc_indication_pdu_t) * NFAPI_CRC_IND_MAX_PDU);
}
assert(ind->crc_indication_body.number_of_crcs <= NFAPI_CRC_IND_MAX_PDU);
for (int i=0; i<ind->crc_indication_body.number_of_crcs; i++) { for (int i=0; i<ind->crc_indication_body.number_of_crcs; i++) {
memcpy(&UL_RCC_INFO.crc_ind[index].crc_indication_body.crc_pdu_list[i], &ind->crc_indication_body.crc_pdu_list[i], sizeof(ind->crc_indication_body.crc_pdu_list[0])); memcpy(&UL_RCC_INFO.crc_ind[index].crc_indication_body.crc_pdu_list[i], &ind->crc_indication_body.crc_pdu_list[i], sizeof(ind->crc_indication_body.crc_pdu_list[0]));
@@ -759,6 +767,7 @@ int phy_crc_indication(struct nfapi_vnf_p7_config *config, nfapi_crc_indication_
LOG_D(MAC, "%s() NFAPI SFN/SF:%d IND:number_of_crcs:%u UL_INFO:crcs:%d\n", __FUNCTION__, NFAPI_SFNSF2DEC(ind->sfn_sf), ind->crc_indication_body.number_of_crcs, LOG_D(MAC, "%s() NFAPI SFN/SF:%d IND:number_of_crcs:%u UL_INFO:crcs:%d\n", __FUNCTION__, NFAPI_SFNSF2DEC(ind->sfn_sf), ind->crc_indication_body.number_of_crcs,
eNB->UL_INFO.crc_ind.crc_indication_body.number_of_crcs); eNB->UL_INFO.crc_ind.crc_indication_body.number_of_crcs);
assert(ind->crc_indication_body.number_of_crcs <= NFAPI_CRC_IND_MAX_PDU);
for (int i=0; i<ind->crc_indication_body.number_of_crcs; i++) { for (int i=0; i<ind->crc_indication_body.number_of_crcs; i++) {
memcpy(&dest_ind->crc_indication_body.crc_pdu_list[i], &ind->crc_indication_body.crc_pdu_list[i], sizeof(ind->crc_indication_body.crc_pdu_list[0])); memcpy(&dest_ind->crc_indication_body.crc_pdu_list[i], &ind->crc_indication_body.crc_pdu_list[i], sizeof(ind->crc_indication_body.crc_pdu_list[0]));
LOG_D(MAC, "%s() NFAPI SFN/SF:%d CRC_IND:number_of_crcs:%u UL_INFO:crcs:%d PDU[%d] rnti:%04x UL_INFO:rnti:%04x\n", LOG_D(MAC, "%s() NFAPI SFN/SF:%d CRC_IND:number_of_crcs:%u UL_INFO:crcs:%d PDU[%d] rnti:%04x UL_INFO:rnti:%04x\n",
@@ -788,10 +797,15 @@ int phy_rx_indication(struct nfapi_vnf_p7_config *config, nfapi_rx_indication_t
UL_RCC_INFO.rx_ind[index] = *ind; UL_RCC_INFO.rx_ind[index] = *ind;
if (ind->rx_indication_body.number_of_pdus > 0) size_t number_of_pdus = ind->rx_indication_body.number_of_pdus;
UL_RCC_INFO.rx_ind[index].rx_indication_body.rx_pdu_list = malloc(sizeof(nfapi_rx_indication_pdu_t)*ind->rx_indication_body.number_of_pdus ); assert(number_of_pdus <= NFAPI_RX_IND_MAX_PDU);
for (int i=0; i<ind->rx_indication_body.number_of_pdus; i++) { if (number_of_pdus > 0) {
UL_RCC_INFO.rx_ind[index].rx_indication_body.rx_pdu_list =
malloc(sizeof(nfapi_rx_indication_pdu_t) * NFAPI_RX_IND_MAX_PDU);
}
for (int i=0; i<number_of_pdus; i++) {
nfapi_rx_indication_pdu_t *dest_pdu = &UL_RCC_INFO.rx_ind[index].rx_indication_body.rx_pdu_list[i]; nfapi_rx_indication_pdu_t *dest_pdu = &UL_RCC_INFO.rx_ind[index].rx_indication_body.rx_pdu_list[i];
nfapi_rx_indication_pdu_t *src_pdu = &ind->rx_indication_body.rx_pdu_list[i]; nfapi_rx_indication_pdu_t *src_pdu = &ind->rx_indication_body.rx_pdu_list[i];
@@ -804,9 +818,9 @@ int phy_rx_indication(struct nfapi_vnf_p7_config *config, nfapi_rx_indication_t
dest_pdu->data = NULL; dest_pdu->data = NULL;
} }
LOG_D(PHY, "%s() NFAPI SFN/SF:%d PDUs:%d [PDU:%d] handle:%d rnti:%04x length:%d offset:%d ul_cqi:%d ta:%d data:%p\n", LOG_D(PHY, "%s() NFAPI SFN/SF:%d PDUs:%zu [PDU:%d] handle:%d rnti:%04x length:%d offset:%d ul_cqi:%d ta:%d data:%p\n",
__FUNCTION__, __FUNCTION__,
NFAPI_SFNSF2DEC(ind->sfn_sf), ind->rx_indication_body.number_of_pdus, i, NFAPI_SFNSF2DEC(ind->sfn_sf), number_of_pdus, i,
dest_pdu->rx_ue_information.handle, dest_pdu->rx_ue_information.handle,
dest_pdu->rx_ue_information.rnti, dest_pdu->rx_ue_information.rnti,
dest_pdu->rx_indication_rel8.length, dest_pdu->rx_indication_rel8.length,
@@ -822,6 +836,7 @@ int phy_rx_indication(struct nfapi_vnf_p7_config *config, nfapi_rx_indication_t
*dest_ind = *ind; *dest_ind = *ind;
dest_ind->rx_indication_body.rx_pdu_list = dest_pdu_list; dest_ind->rx_indication_body.rx_pdu_list = dest_pdu_list;
assert(ind->rx_indication_body.number_of_pdus <= NFAPI_RX_IND_MAX_PDU);
for(int i=0; i<ind->rx_indication_body.number_of_pdus; i++) { for(int i=0; i<ind->rx_indication_body.number_of_pdus; i++) {
nfapi_rx_indication_pdu_t *dest_pdu = &dest_ind->rx_indication_body.rx_pdu_list[i]; nfapi_rx_indication_pdu_t *dest_pdu = &dest_ind->rx_indication_body.rx_pdu_list[i];
nfapi_rx_indication_pdu_t *src_pdu = &ind->rx_indication_body.rx_pdu_list[i]; nfapi_rx_indication_pdu_t *src_pdu = &ind->rx_indication_body.rx_pdu_list[i];
@@ -862,9 +877,12 @@ int phy_sr_indication(struct nfapi_vnf_p7_config *config, nfapi_sr_indication_t
UL_RCC_INFO.sr_ind[index] = *ind; 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); 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) if (ind->sr_indication_body.number_of_srs > 0) {
UL_RCC_INFO.sr_ind[index].sr_indication_body.sr_pdu_list = malloc(sizeof(nfapi_sr_indication_pdu_t)*ind->sr_indication_body.number_of_srs ); assert(ind->sr_indication_body.number_of_srs <= NFAPI_SR_IND_MAX_PDU);
UL_RCC_INFO.sr_ind[index].sr_indication_body.sr_pdu_list = malloc(sizeof(nfapi_sr_indication_pdu_t) * NFAPI_SR_IND_MAX_PDU);
}
assert(ind->sr_indication_body.number_of_srs <= NFAPI_SR_IND_MAX_PDU);
for (int i=0; i<ind->sr_indication_body.number_of_srs; i++) { for (int i=0; i<ind->sr_indication_body.number_of_srs; i++) {
nfapi_sr_indication_pdu_t *dest_pdu = &UL_RCC_INFO.sr_ind[index].sr_indication_body.sr_pdu_list[i]; nfapi_sr_indication_pdu_t *dest_pdu = &UL_RCC_INFO.sr_ind[index].sr_indication_body.sr_pdu_list[i];
nfapi_sr_indication_pdu_t *src_pdu = &ind->sr_indication_body.sr_pdu_list[i]; nfapi_sr_indication_pdu_t *src_pdu = &ind->sr_indication_body.sr_pdu_list[i];
@@ -880,6 +898,7 @@ int phy_sr_indication(struct nfapi_vnf_p7_config *config, nfapi_sr_indication_t
dest_ind->sr_indication_body.sr_pdu_list = dest_pdu_list; dest_ind->sr_indication_body.sr_pdu_list = dest_pdu_list;
LOG_D(MAC,"%s() eNB->UL_INFO.sr_ind.sr_indication_body.number_of_srs:%d\n", __FUNCTION__, eNB->UL_INFO.sr_ind.sr_indication_body.number_of_srs); LOG_D(MAC,"%s() eNB->UL_INFO.sr_ind.sr_indication_body.number_of_srs:%d\n", __FUNCTION__, eNB->UL_INFO.sr_ind.sr_indication_body.number_of_srs);
assert(eNB->UL_INFO.sr_ind.sr_indication_body.number_of_srs <= NFAPI_SR_IND_MAX_PDU);
for (int i=0; i<eNB->UL_INFO.sr_ind.sr_indication_body.number_of_srs; i++) { for (int i=0; i<eNB->UL_INFO.sr_ind.sr_indication_body.number_of_srs; i++) {
nfapi_sr_indication_pdu_t *dest_pdu = &dest_ind->sr_indication_body.sr_pdu_list[i]; nfapi_sr_indication_pdu_t *dest_pdu = &dest_ind->sr_indication_body.sr_pdu_list[i];
nfapi_sr_indication_pdu_t *src_pdu = &ind->sr_indication_body.sr_pdu_list[i]; nfapi_sr_indication_pdu_t *src_pdu = &ind->sr_indication_body.sr_pdu_list[i];
@@ -901,6 +920,7 @@ static bool is_ue_same(uint16_t ue_id_1, uint16_t ue_id_2)
static void analyze_cqi_pdus_for_duplicates(nfapi_cqi_indication_t *ind) static void analyze_cqi_pdus_for_duplicates(nfapi_cqi_indication_t *ind)
{ {
uint16_t num_cqis = ind->cqi_indication_body.number_of_cqis; uint16_t num_cqis = ind->cqi_indication_body.number_of_cqis;
assert(num_cqis <= NFAPI_CQI_IND_MAX_PDU);
for (int i = 0; i < num_cqis; i++) for (int i = 0; i < num_cqis; i++)
{ {
nfapi_cqi_indication_pdu_t *src_pdu = &ind->cqi_indication_body.cqi_pdu_list[i]; nfapi_cqi_indication_pdu_t *src_pdu = &ind->cqi_indication_body.cqi_pdu_list[i];
@@ -916,7 +936,7 @@ static void analyze_cqi_pdus_for_duplicates(nfapi_cqi_indication_t *ind)
{ {
LOG_E(MAC, "Problem, two cqis received from a single UE for rnti %x\n", LOG_E(MAC, "Problem, two cqis received from a single UE for rnti %x\n",
rnti_i); rnti_i);
abort(); //abort(); This will be fixed in merge request which handles multiple CQIs.
} }
} }
} }
@@ -932,13 +952,17 @@ int phy_cqi_indication(struct nfapi_vnf_p7_config *config, nfapi_cqi_indication_
int8_t index = NFAPI_SFNSF2SF(ind->sfn_sf); int8_t index = NFAPI_SFNSF2SF(ind->sfn_sf);
UL_RCC_INFO.cqi_ind[index] = *ind; UL_RCC_INFO.cqi_ind[index] = *ind;
assert(ind->cqi_indication_body.number_of_cqis <= NFAPI_CQI_IND_MAX_PDU);
if (ind->cqi_indication_body.number_of_cqis > 0){ 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_pdu_list =
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 ); malloc(sizeof(nfapi_cqi_indication_pdu_t) * NFAPI_CQI_IND_MAX_PDU);
UL_RCC_INFO.cqi_ind[index].cqi_indication_body.cqi_raw_pdu_list =
malloc(sizeof(nfapi_cqi_indication_raw_pdu_t) * NFAPI_CQI_IND_MAX_PDU);
} }
analyze_cqi_pdus_for_duplicates(ind); analyze_cqi_pdus_for_duplicates(ind);
assert(ind->cqi_indication_body.number_of_cqis <= NFAPI_CQI_IND_MAX_PDU);
for (int i=0; i<ind->cqi_indication_body.number_of_cqis; i++) { 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]; 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, "SR_IND[PDU:%d][rnti:%x cqi:%d channel:%d]\n", i, src_pdu->rx_ue_information.rnti,
@@ -954,6 +978,7 @@ int phy_cqi_indication(struct nfapi_vnf_p7_config *config, nfapi_cqi_indication_
*dest_ind = *ind; *dest_ind = *ind;
dest_ind->cqi_indication_body.cqi_pdu_list = ind->cqi_indication_body.cqi_pdu_list; dest_ind->cqi_indication_body.cqi_pdu_list = ind->cqi_indication_body.cqi_pdu_list;
dest_ind->cqi_indication_body.cqi_raw_pdu_list = ind->cqi_indication_body.cqi_raw_pdu_list; dest_ind->cqi_indication_body.cqi_raw_pdu_list = ind->cqi_indication_body.cqi_raw_pdu_list;
assert(ind->cqi_indication_body.number_of_cqis <= NFAPI_CQI_IND_MAX_PDU);
for(int i=0; i<ind->cqi_indication_body.number_of_cqis; i++) { 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]; nfapi_cqi_indication_pdu_t *src_pdu = &ind->cqi_indication_body.cqi_pdu_list[i];
LOG_D(MAC, "CQI_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,
@@ -1579,7 +1604,7 @@ int oai_nfapi_dl_config_req(nfapi_dl_config_request_t *dl_config_req) {
{ {
uint16_t dl_rnti = dl_config_req->dl_config_request_body.dl_config_pdu_list[i].dlsch_pdu.dlsch_pdu_rel8.rnti; 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; 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," LOG_I(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", " 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); NFAPI_SFNSF2SFN(dl_config_req->sfn_sf),NFAPI_SFNSF2SF(dl_config_req->sfn_sf), dl_rnti, numPDUs);
} }
+6 -4
View File
@@ -1,12 +1,12 @@
/* /*
* Copyright 2017 Cisco Systems, Inc. * Copyright 2017 Cisco Systems, Inc.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * 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 // initialize the trace function to 0
void (*nfapi_trace_g)(nfapi_trace_level_t level, const char* format, ...) = &nfapi_trace_dbg; 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; //nfapi_trace_level_t nfapi_trace_level_g = NFAPI_TRACE_WARN;
void nfapi_set_trace_level(nfapi_trace_level_t new_level) 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, ...) 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]; char trace_buff[MAX_MSG_LENGTH + TRACE_HEADER_LENGTH];
va_list p_args; va_list p_args;
struct timeval tv; struct timeval tv;
+31 -8
View File
@@ -2484,6 +2484,7 @@ static uint8_t pack_harq_indication_body_value(void *tlv, uint8_t **ppWritePacke
uint16_t i = 0; uint16_t i = 0;
uint16_t total_number_of_pdus = value->number_of_harqs; 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) for(; i < total_number_of_pdus; ++i)
{ {
nfapi_harq_indication_pdu_t* pdu = &(value->harq_pdu_list[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 i = 0;
uint16_t total_number_of_pdus = value->number_of_crcs; 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) for(; i < total_number_of_pdus; ++i)
{ {
nfapi_crc_indication_pdu_t* pdu = &(value->crc_pdu_list[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; uint16_t total_number_of_pdus = value->number_of_pdus;
//printf("ULSCH:pdus:%d\n", total_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) for(i = 0; i < total_number_of_pdus; ++i)
{ {
nfapi_rx_indication_pdu_t* pdu = &(value->rx_pdu_list[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 // 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) for(i =0; i < total_number_of_pdus; ++i)
{ {
nfapi_rx_indication_pdu_t* pdu = &(value->rx_pdu_list[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 // Write out the pdu
assert(total_number_of_pdus <= NFAPI_RX_IND_MAX_PDU);
for(i = 0; i < total_number_of_pdus; ++i) for(i = 0; i < total_number_of_pdus; ++i)
{ {
nfapi_rx_indication_pdu_t* pdu = &(value->rx_pdu_list[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 // Write out the pdu data
assert(total_number_of_pdus <= NFAPI_RX_IND_MAX_PDU);
for(i = 0; i < total_number_of_pdus; ++i) for(i = 0; i < total_number_of_pdus; ++i)
{ {
uint16_t length = 0; 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 i = 0;
uint16_t total_number_of_pdus = value->number_of_srs; 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) for(; i < total_number_of_pdus; ++i)
{ {
nfapi_sr_indication_pdu_t* pdu = &(value->sr_pdu_list[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 i = 0;
uint16_t offset = 2; // taking into account the number_of_cqis uint16_t offset = 2; // taking into account the number_of_cqis
uint16_t total_number_of_pdus = value->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) for(i = 0; i < total_number_of_pdus; ++i)
{ {
nfapi_cqi_indication_pdu_t* pdu = &(value->cqi_pdu_list[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 // 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) for(i =0; i < total_number_of_pdus; ++i)
{ {
nfapi_cqi_indication_pdu_t* pdu = &(value->cqi_pdu_list[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 // Write out the cqi information
assert(total_number_of_pdus <= NFAPI_CQI_IND_MAX_PDU);
for(i = 0; i < total_number_of_pdus; ++i) for(i = 0; i < total_number_of_pdus; ++i)
{ {
nfapi_cqi_indication_pdu_t* pdu = &(value->cqi_pdu_list[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 // 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) for(i = 0; i < total_number_of_pdus; ++i)
{ {
uint16_t length = 0; uint16_t length = 0;
@@ -6334,15 +6345,16 @@ static uint8_t unpack_harq_indication_body_value(void* tlv, uint8_t **ppReadPack
return 0; 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) 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); NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate harq ind pdu list (count:%d)\n", __FUNCTION__, value->number_of_harqs);
return 0; return 0;
} }
uint8_t i = 0; assert(value->number_of_harqs <= NFAPI_HARQ_IND_MAX_PDU);
for(i = 0; i < value->number_of_harqs; ++i) for (size_t i = 0; i < value->number_of_harqs; ++i)
{ {
nfapi_harq_indication_pdu_t* pdu = &(value->harq_pdu_list[i]); nfapi_harq_indication_pdu_t* pdu = &(value->harq_pdu_list[i]);
if(pull16(ppReadPackedMsg, &pdu->instance_length, end) == 0) 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) 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) 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); 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; uint8_t i = 0;
assert(value->number_of_crcs <= NFAPI_CRC_IND_MAX_PDU);
for(i = 0; i < value->number_of_crcs; ++i) for(i = 0; i < value->number_of_crcs; ++i)
{ {
nfapi_crc_indication_pdu_t* pdu = &(value->crc_pdu_list[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) 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) 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); 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; return 0;
} }
assert(i <= NFAPI_RX_IND_MAX_PDU);
nfapi_rx_indication_pdu_t *pdu = &value->rx_pdu_list[i]; nfapi_rx_indication_pdu_t *pdu = &value->rx_pdu_list[i];
pdu->rx_ue_information.tl = generic_tl; 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) for (int i = 0; i < value->number_of_pdus; ++i)
{ {
nfapi_rx_indication_pdu_t *pdu = &value->rx_pdu_list[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) 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) 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); 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; uint8_t i = 0;
assert(value->number_of_srs <= NFAPI_SR_IND_MAX_PDU);
for(i = 0; i < value->number_of_srs; ++i) for(i = 0; i < value->number_of_srs; ++i)
{ {
nfapi_sr_indication_pdu_t* pdu = &(value->sr_pdu_list[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) 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) 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); 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) 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) 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); 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; uint8_t i = 0;
assert(value->number_of_cqis <= NFAPI_CQI_IND_MAX_PDU);
for(i = 0; i < value->number_of_cqis; ++i) for(i = 0; i < value->number_of_cqis; ++i)
{ {
nfapi_cqi_indication_pdu_t* pdu = &(value->cqi_pdu_list[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; uint8_t idx = 0;
assert(value->number_of_cqis <= NFAPI_CQI_IND_MAX_PDU);
for(idx = 0; idx < value->number_of_cqis; ++idx) 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) if(value->cqi_pdu_list[idx].cqi_indication_rel8.tl.tag == NFAPI_CQI_INDICATION_REL8_TAG)
+1 -2
View File
@@ -18,9 +18,8 @@
#ifndef _PNF_H_ #ifndef _PNF_H_
#define _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 { typedef struct {
+117 -112
View File
@@ -1,12 +1,12 @@
/* /*
* Copyright 2017 Cisco Systems, Inc. * Copyright 2017 Cisco Systems, Inc.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -93,9 +93,9 @@ void pnf_nr_handle_pnf_param_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
else else
{ {
nfapi_nr_pnf_param_request_t req; nfapi_nr_pnf_param_request_t req;
NFAPI_TRACE(NFAPI_TRACE_INFO, "PNF_PARAM.request received\n"); NFAPI_TRACE(NFAPI_TRACE_INFO, "PNF_PARAM.request received\n");
// unpack the message // unpack the message
if (nfapi_nr_p5_message_unpack(pRecvMsg, recvMsgLen, &req, sizeof(nfapi_nr_pnf_param_request_t), &pnf->_public.codec_config) >= 0) if (nfapi_nr_p5_message_unpack(pRecvMsg, recvMsgLen, &req, sizeof(nfapi_nr_pnf_param_request_t), &pnf->_public.codec_config) >= 0)
{ {
@@ -109,7 +109,7 @@ void pnf_nr_handle_pnf_param_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
else else
{ {
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: PNF not in IDLE state\n", __FUNCTION__); NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: PNF not in IDLE state\n", __FUNCTION__);
nfapi_nr_pnf_param_response_t resp; nfapi_nr_pnf_param_response_t resp;
memset(&resp, 0, sizeof(resp)); memset(&resp, 0, sizeof(resp));
resp.header.message_id = NFAPI_NR_PHY_MSG_TYPE_PNF_PARAM_RESPONSE; resp.header.message_id = NFAPI_NR_PHY_MSG_TYPE_PNF_PARAM_RESPONSE;
@@ -121,7 +121,7 @@ void pnf_nr_handle_pnf_param_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
{ {
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Unpack message failed, ignoring\n", __FUNCTION__); NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Unpack message failed, ignoring\n", __FUNCTION__);
} }
if(req.vendor_extension) if(req.vendor_extension)
pnf->_public.codec_config.deallocate(req.vendor_extension); pnf->_public.codec_config.deallocate(req.vendor_extension);
} }
@@ -137,9 +137,9 @@ void pnf_handle_pnf_param_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
else else
{ {
nfapi_pnf_param_request_t req; nfapi_pnf_param_request_t req;
NFAPI_TRACE(NFAPI_TRACE_INFO, "PNF_PARAM.request received\n"); NFAPI_TRACE(NFAPI_TRACE_INFO, "PNF_PARAM.request received\n");
// unpack the message // unpack the message
if (nfapi_p5_message_unpack(pRecvMsg, recvMsgLen, &req, sizeof(nfapi_pnf_param_request_t), &pnf->_public.codec_config) >= 0) if (nfapi_p5_message_unpack(pRecvMsg, recvMsgLen, &req, sizeof(nfapi_pnf_param_request_t), &pnf->_public.codec_config) >= 0)
{ {
@@ -153,7 +153,7 @@ void pnf_handle_pnf_param_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
else else
{ {
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: PNF not in IDLE state\n", __FUNCTION__); NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: PNF not in IDLE state\n", __FUNCTION__);
nfapi_pnf_param_response_t resp; nfapi_pnf_param_response_t resp;
memset(&resp, 0, sizeof(resp)); memset(&resp, 0, sizeof(resp));
resp.header.message_id = NFAPI_PNF_PARAM_RESPONSE; resp.header.message_id = NFAPI_PNF_PARAM_RESPONSE;
@@ -165,7 +165,7 @@ void pnf_handle_pnf_param_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
{ {
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Unpack message failed, ignoring\n", __FUNCTION__); NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Unpack message failed, ignoring\n", __FUNCTION__);
} }
if(req.vendor_extension) if(req.vendor_extension)
pnf->_public.codec_config.deallocate(req.vendor_extension); pnf->_public.codec_config.deallocate(req.vendor_extension);
} }
@@ -185,7 +185,7 @@ void pnf_handle_pnf_config_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
nfapi_pnf_config_request_t req; nfapi_pnf_config_request_t req;
NFAPI_TRACE(NFAPI_TRACE_INFO, "PNF_CONFIG.request received\n"); NFAPI_TRACE(NFAPI_TRACE_INFO, "PNF_CONFIG.request received\n");
// unpack the message // unpack the message
if (nfapi_p5_message_unpack(pRecvMsg, recvMsgLen, &req, sizeof(req), &pnf->_public.codec_config) >= 0) if (nfapi_p5_message_unpack(pRecvMsg, recvMsgLen, &req, sizeof(req), &pnf->_public.codec_config) >= 0)
{ {
@@ -194,7 +194,7 @@ void pnf_handle_pnf_config_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
{ {
// delete the phy records // delete the phy records
nfapi_pnf_phy_config_delete_all(&pnf->_public); nfapi_pnf_phy_config_delete_all(&pnf->_public);
// create the phy records // create the phy records
if (req.pnf_phy_rf_config.tl.tag == NFAPI_PNF_PHY_RF_TAG) if (req.pnf_phy_rf_config.tl.tag == NFAPI_PNF_PHY_RF_TAG)
{ {
@@ -203,14 +203,14 @@ void pnf_handle_pnf_config_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
{ {
nfapi_pnf_phy_config_t* phy = (nfapi_pnf_phy_config_t*)malloc(sizeof(nfapi_pnf_phy_config_t)); nfapi_pnf_phy_config_t* phy = (nfapi_pnf_phy_config_t*)malloc(sizeof(nfapi_pnf_phy_config_t));
memset(phy, 0, sizeof(nfapi_pnf_phy_config_t)); memset(phy, 0, sizeof(nfapi_pnf_phy_config_t));
phy->state = NFAPI_PNF_PHY_IDLE; phy->state = NFAPI_PNF_PHY_IDLE;
phy->phy_id = req.pnf_phy_rf_config.phy_rf_config[i].phy_id; phy->phy_id = req.pnf_phy_rf_config.phy_rf_config[i].phy_id;
nfapi_pnf_phy_config_add(&(pnf->_public), phy); nfapi_pnf_phy_config_add(&(pnf->_public), phy);
} }
} }
if(pnf->_public.pnf_config_req) if(pnf->_public.pnf_config_req)
{ {
(pnf->_public.pnf_config_req)(&(pnf->_public), &req); (pnf->_public.pnf_config_req)(&(pnf->_public), &req);
@@ -219,7 +219,7 @@ void pnf_handle_pnf_config_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
else else
{ {
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: PNF not in correct state: %d\n", __FUNCTION__, pnf->_public.state); NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: PNF not in correct state: %d\n", __FUNCTION__, pnf->_public.state);
nfapi_pnf_config_response_t resp; nfapi_pnf_config_response_t resp;
memset(&resp, 0, sizeof(resp)); memset(&resp, 0, sizeof(resp));
resp.header.message_id = NFAPI_PNF_CONFIG_RESPONSE; resp.header.message_id = NFAPI_PNF_CONFIG_RESPONSE;
@@ -251,7 +251,7 @@ void pnf_nr_handle_pnf_config_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen
nfapi_nr_pnf_config_request_t req; nfapi_nr_pnf_config_request_t req;
NFAPI_TRACE(NFAPI_TRACE_INFO, "PNF_CONFIG.request received\n"); NFAPI_TRACE(NFAPI_TRACE_INFO, "PNF_CONFIG.request received\n");
// unpack the message // unpack the message
if (nfapi_nr_p5_message_unpack(pRecvMsg, recvMsgLen, &req, sizeof(req), &pnf->_public.codec_config) >= 0) if (nfapi_nr_p5_message_unpack(pRecvMsg, recvMsgLen, &req, sizeof(req), &pnf->_public.codec_config) >= 0)
{ {
@@ -260,7 +260,7 @@ void pnf_nr_handle_pnf_config_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen
{ {
// delete the phy records // delete the phy records
nfapi_pnf_phy_config_delete_all(&pnf->_public); nfapi_pnf_phy_config_delete_all(&pnf->_public);
// create the phy records // create the phy records
if (req.pnf_phy_rf_config.tl.tag == NFAPI_PNF_PHY_RF_TAG) if (req.pnf_phy_rf_config.tl.tag == NFAPI_PNF_PHY_RF_TAG)
{ {
@@ -269,14 +269,14 @@ void pnf_nr_handle_pnf_config_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen
{ {
nfapi_pnf_phy_config_t* phy = (nfapi_pnf_phy_config_t*)malloc(sizeof(nfapi_pnf_phy_config_t)); nfapi_pnf_phy_config_t* phy = (nfapi_pnf_phy_config_t*)malloc(sizeof(nfapi_pnf_phy_config_t));
memset(phy, 0, sizeof(nfapi_pnf_phy_config_t)); memset(phy, 0, sizeof(nfapi_pnf_phy_config_t));
phy->state = NFAPI_PNF_PHY_IDLE; phy->state = NFAPI_PNF_PHY_IDLE;
phy->phy_id = req.pnf_phy_rf_config.phy_rf_config[i].phy_id; phy->phy_id = req.pnf_phy_rf_config.phy_rf_config[i].phy_id;
nfapi_pnf_phy_config_add(&(pnf->_public), phy); nfapi_pnf_phy_config_add(&(pnf->_public), phy);
} }
} }
if(pnf->_public.pnf_nr_config_req) if(pnf->_public.pnf_nr_config_req)
{ {
(pnf->_public.pnf_nr_config_req)(&(pnf->_public), &req); (pnf->_public.pnf_nr_config_req)(&(pnf->_public), &req);
@@ -285,7 +285,7 @@ void pnf_nr_handle_pnf_config_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen
else else
{ {
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: PNF not in correct state: %d\n", __FUNCTION__, pnf->_public.state); NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: PNF not in correct state: %d\n", __FUNCTION__, pnf->_public.state);
nfapi_nr_pnf_config_response_t resp; nfapi_nr_pnf_config_response_t resp;
memset(&resp, 0, sizeof(resp)); memset(&resp, 0, sizeof(resp));
resp.header.message_id = NFAPI_PNF_CONFIG_RESPONSE; resp.header.message_id = NFAPI_PNF_CONFIG_RESPONSE;
@@ -315,7 +315,7 @@ void pnf_handle_pnf_start_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
nfapi_pnf_start_request_t req; nfapi_pnf_start_request_t req;
NFAPI_TRACE(NFAPI_TRACE_INFO, "PNF_START.request Received\n"); NFAPI_TRACE(NFAPI_TRACE_INFO, "PNF_START.request Received\n");
// unpack the message // unpack the message
if (nfapi_p5_message_unpack(pRecvMsg, recvMsgLen, &req, sizeof(req), &pnf->_public.codec_config) >= 0) if (nfapi_p5_message_unpack(pRecvMsg, recvMsgLen, &req, sizeof(req), &pnf->_public.codec_config) >= 0)
{ {
@@ -357,7 +357,7 @@ void pnf_nr_handle_pnf_start_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
nfapi_nr_pnf_start_request_t req; nfapi_nr_pnf_start_request_t req;
NFAPI_TRACE(NFAPI_TRACE_INFO, "PNF_START.request Received\n"); NFAPI_TRACE(NFAPI_TRACE_INFO, "PNF_START.request Received\n");
// unpack the message // unpack the message
if (nfapi_nr_p5_message_unpack(pRecvMsg, recvMsgLen, &req, sizeof(req), &pnf->_public.codec_config) >= 0) if (nfapi_nr_p5_message_unpack(pRecvMsg, recvMsgLen, &req, sizeof(req), &pnf->_public.codec_config) >= 0)
{ {
@@ -397,9 +397,9 @@ void pnf_handle_pnf_stop_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
else else
{ {
nfapi_pnf_stop_request_t req; nfapi_pnf_stop_request_t req;
NFAPI_TRACE(NFAPI_TRACE_INFO, "PNF_STOP.request Received\n"); NFAPI_TRACE(NFAPI_TRACE_INFO, "PNF_STOP.request Received\n");
// unpack the message // unpack the message
if (nfapi_p5_message_unpack(pRecvMsg, recvMsgLen, &req, sizeof(req), &pnf->_public.codec_config) >= 0) if (nfapi_p5_message_unpack(pRecvMsg, recvMsgLen, &req, sizeof(req), &pnf->_public.codec_config) >= 0)
{ {
@@ -423,7 +423,7 @@ void pnf_handle_pnf_stop_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
{ {
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Unpack message failed, ignoring\n", __FUNCTION__); NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Unpack message failed, ignoring\n", __FUNCTION__);
} }
if(req.vendor_extension) if(req.vendor_extension)
pnf->_public.codec_config.deallocate(req.vendor_extension); pnf->_public.codec_config.deallocate(req.vendor_extension);
@@ -440,11 +440,11 @@ void pnf_handle_param_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
else else
{ {
nfapi_param_request_t req; nfapi_param_request_t req;
nfapi_pnf_config_t* config = &(pnf->_public); nfapi_pnf_config_t* config = &(pnf->_public);
NFAPI_TRACE(NFAPI_TRACE_INFO, "PARAM.request received\n"); NFAPI_TRACE(NFAPI_TRACE_INFO, "PARAM.request received\n");
// unpack the message // unpack the message
if (nfapi_p5_message_unpack(pRecvMsg, recvMsgLen, &req, sizeof(req), &config->codec_config) >= 0) if (nfapi_p5_message_unpack(pRecvMsg, recvMsgLen, &req, sizeof(req), &config->codec_config) >= 0)
{ {
@@ -479,7 +479,7 @@ void pnf_handle_param_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
resp.error_code = NFAPI_MSG_INVALID_CONFIG; resp.error_code = NFAPI_MSG_INVALID_CONFIG;
nfapi_pnf_param_resp(config, &resp); nfapi_pnf_param_resp(config, &resp);
} }
} }
else else
{ {
@@ -495,7 +495,7 @@ void pnf_handle_param_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
{ {
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Unpack message failed, ignoring\n", __FUNCTION__); NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Unpack message failed, ignoring\n", __FUNCTION__);
} }
if(req.vendor_extension) if(req.vendor_extension)
pnf->_public.codec_config.deallocate(req.vendor_extension); pnf->_public.codec_config.deallocate(req.vendor_extension);
@@ -512,11 +512,11 @@ void pnf_nr_handle_param_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
else else
{ {
nfapi_nr_param_request_scf_t req; nfapi_nr_param_request_scf_t req;
nfapi_pnf_config_t* config = &(pnf->_public); nfapi_pnf_config_t* config = &(pnf->_public);
NFAPI_TRACE(NFAPI_TRACE_INFO, "PARAM.request received\n"); NFAPI_TRACE(NFAPI_TRACE_INFO, "PARAM.request received\n");
// unpack the message // unpack the message
if (nfapi_nr_p5_message_unpack(pRecvMsg, recvMsgLen, &req, sizeof(req), &config->codec_config) >= 0) if (nfapi_nr_p5_message_unpack(pRecvMsg, recvMsgLen, &req, sizeof(req), &config->codec_config) >= 0)
{ {
@@ -551,7 +551,7 @@ void pnf_nr_handle_param_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
resp.error_code = NFAPI_MSG_INVALID_CONFIG; resp.error_code = NFAPI_MSG_INVALID_CONFIG;
nfapi_nr_pnf_param_resp(config, &resp); nfapi_nr_pnf_param_resp(config, &resp);
} }
} }
else else
{ {
@@ -567,7 +567,7 @@ void pnf_nr_handle_param_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
{ {
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Unpack message failed, ignoring\n", __FUNCTION__); NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Unpack message failed, ignoring\n", __FUNCTION__);
} }
if(req.vendor_extension) if(req.vendor_extension)
pnf->_public.codec_config.deallocate(req.vendor_extension); pnf->_public.codec_config.deallocate(req.vendor_extension);
@@ -587,9 +587,9 @@ void pnf_handle_config_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
nfapi_config_request_t req; nfapi_config_request_t req;
NFAPI_TRACE(NFAPI_TRACE_INFO, "CONFIG.request received\n"); NFAPI_TRACE(NFAPI_TRACE_INFO, "CONFIG.request received\n");
nfapi_pnf_config_t* config = &(pnf->_public); nfapi_pnf_config_t* config = &(pnf->_public);
// unpack the message // unpack the message
if (nfapi_p5_message_unpack(pRecvMsg, recvMsgLen, &req, sizeof(req), &config->codec_config) >= 0) if (nfapi_p5_message_unpack(pRecvMsg, recvMsgLen, &req, sizeof(req), &config->codec_config) >= 0)
{ {
@@ -639,7 +639,7 @@ void pnf_handle_config_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
{ {
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Unpack message failed, ignoring\n", __FUNCTION__); NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Unpack message failed, ignoring\n", __FUNCTION__);
} }
if(req.vendor_extension) if(req.vendor_extension)
pnf->_public.codec_config.deallocate(req.vendor_extension); pnf->_public.codec_config.deallocate(req.vendor_extension);
} }
@@ -659,9 +659,9 @@ void pnf_nr_handle_config_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
nfapi_nr_config_request_scf_t req; nfapi_nr_config_request_scf_t req;
NFAPI_TRACE(NFAPI_TRACE_INFO, "CONFIG.request received\n"); NFAPI_TRACE(NFAPI_TRACE_INFO, "CONFIG.request received\n");
nfapi_pnf_config_t* config = &(pnf->_public); nfapi_pnf_config_t* config = &(pnf->_public);
// unpack the message // unpack the message
if (nfapi_nr_p5_message_unpack(pRecvMsg, recvMsgLen, &req, sizeof(req), &config->codec_config) >= 0) if (nfapi_nr_p5_message_unpack(pRecvMsg, recvMsgLen, &req, sizeof(req), &config->codec_config) >= 0)
{ {
@@ -681,7 +681,7 @@ void pnf_nr_handle_config_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
{ {
(config->nr_config_req)(config, phy, &req); (config->nr_config_req)(config, phy, &req);
} }
} }
else else
@@ -718,7 +718,7 @@ void pnf_nr_handle_config_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
{ {
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Unpack message failed, ignoring\n", __FUNCTION__); NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Unpack message failed, ignoring\n", __FUNCTION__);
} }
if(req.vendor_extension) if(req.vendor_extension)
pnf->_public.codec_config.deallocate(req.vendor_extension); pnf->_public.codec_config.deallocate(req.vendor_extension);
} }
@@ -734,11 +734,11 @@ void pnf_handle_start_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
else else
{ {
nfapi_start_request_t req; nfapi_start_request_t req;
nfapi_pnf_config_t* config = &(pnf->_public); nfapi_pnf_config_t* config = &(pnf->_public);
NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() START.request received state:%d\n", __FUNCTION__, config->state); NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() START.request received state:%d\n", __FUNCTION__, config->state);
// unpack the message // unpack the message
if (nfapi_p5_message_unpack(pRecvMsg, recvMsgLen, &req, sizeof(req), &config->codec_config) >= 0) if (nfapi_p5_message_unpack(pRecvMsg, recvMsgLen, &req, sizeof(req), &config->codec_config) >= 0)
{ {
@@ -788,7 +788,7 @@ void pnf_handle_start_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
{ {
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Unpack message failed, ignoring\n", __FUNCTION__); NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Unpack message failed, ignoring\n", __FUNCTION__);
} }
if(req.vendor_extension) if(req.vendor_extension)
pnf->_public.codec_config.deallocate(req.vendor_extension); pnf->_public.codec_config.deallocate(req.vendor_extension);
@@ -805,11 +805,11 @@ void pnf_nr_handle_start_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
else else
{ {
nfapi_nr_start_request_scf_t req; nfapi_nr_start_request_scf_t req;
nfapi_pnf_config_t* config = &(pnf->_public); nfapi_pnf_config_t* config = &(pnf->_public);
NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() START.request received state:%d\n", __FUNCTION__, config->state); NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() START.request received state:%d\n", __FUNCTION__, config->state);
// unpack the message // unpack the message
if (nfapi_nr_p5_message_unpack(pRecvMsg, recvMsgLen, &req, sizeof(req), &config->codec_config) >= 0) if (nfapi_nr_p5_message_unpack(pRecvMsg, recvMsgLen, &req, sizeof(req), &config->codec_config) >= 0)
{ {
@@ -859,7 +859,7 @@ void pnf_nr_handle_start_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
{ {
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Unpack message failed, ignoring\n", __FUNCTION__); NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Unpack message failed, ignoring\n", __FUNCTION__);
} }
if(req.vendor_extension) if(req.vendor_extension)
pnf->_public.codec_config.deallocate(req.vendor_extension); pnf->_public.codec_config.deallocate(req.vendor_extension);
@@ -878,9 +878,9 @@ void pnf_handle_stop_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
nfapi_stop_request_t req; nfapi_stop_request_t req;
NFAPI_TRACE(NFAPI_TRACE_INFO, "STOP.request received\n"); NFAPI_TRACE(NFAPI_TRACE_INFO, "STOP.request received\n");
nfapi_pnf_config_t* config = &(pnf->_public); nfapi_pnf_config_t* config = &(pnf->_public);
// unpack the message // unpack the message
if (nfapi_p5_message_unpack(pRecvMsg, recvMsgLen, &req, sizeof(req), &config->codec_config) >= 0) if (nfapi_p5_message_unpack(pRecvMsg, recvMsgLen, &req, sizeof(req), &config->codec_config) >= 0)
{ {
@@ -930,10 +930,10 @@ void pnf_handle_stop_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
{ {
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Unpack message failed, ignoring\n", __FUNCTION__); NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Unpack message failed, ignoring\n", __FUNCTION__);
} }
if(req.vendor_extension) if(req.vendor_extension)
pnf->_public.codec_config.deallocate(req.vendor_extension); pnf->_public.codec_config.deallocate(req.vendor_extension);
} }
} }
@@ -949,9 +949,9 @@ void pnf_nr_handle_stop_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
nfapi_nr_stop_request_t req; nfapi_nr_stop_request_t req;
NFAPI_TRACE(NFAPI_TRACE_INFO, "STOP.request received\n"); NFAPI_TRACE(NFAPI_TRACE_INFO, "STOP.request received\n");
nfapi_pnf_config_t* config = &(pnf->_public); nfapi_pnf_config_t* config = &(pnf->_public);
// unpack the message // unpack the message
if (nfapi_nr_p5_message_unpack(pRecvMsg, recvMsgLen, &req, sizeof(req), &config->codec_config) >= 0) if (nfapi_nr_p5_message_unpack(pRecvMsg, recvMsgLen, &req, sizeof(req), &config->codec_config) >= 0)
{ {
@@ -1001,10 +1001,10 @@ void pnf_nr_handle_stop_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
{ {
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Unpack message failed, ignoring\n", __FUNCTION__); NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Unpack message failed, ignoring\n", __FUNCTION__);
} }
if(req.vendor_extension) if(req.vendor_extension)
pnf->_public.codec_config.deallocate(req.vendor_extension); pnf->_public.codec_config.deallocate(req.vendor_extension);
} }
} }
@@ -1020,9 +1020,9 @@ void pnf_handle_measurement_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
nfapi_measurement_request_t req; nfapi_measurement_request_t req;
NFAPI_TRACE(NFAPI_TRACE_INFO, "MEASUREMENT.request received\n"); NFAPI_TRACE(NFAPI_TRACE_INFO, "MEASUREMENT.request received\n");
nfapi_pnf_config_t* config = &(pnf->_public); nfapi_pnf_config_t* config = &(pnf->_public);
// unpack the message // unpack the message
if (nfapi_p5_message_unpack(pRecvMsg, recvMsgLen, &req, sizeof(req), &config->codec_config) >= 0) if (nfapi_p5_message_unpack(pRecvMsg, recvMsgLen, &req, sizeof(req), &config->codec_config) >= 0)
{ {
@@ -1072,7 +1072,7 @@ void pnf_handle_measurement_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
{ {
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Unpack message failed, ignoring\n", __FUNCTION__); NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Unpack message failed, ignoring\n", __FUNCTION__);
} }
if(req.vendor_extension) if(req.vendor_extension)
pnf->_public.codec_config.deallocate(req.vendor_extension); pnf->_public.codec_config.deallocate(req.vendor_extension);
} }
@@ -1087,13 +1087,13 @@ void pnf_handle_rssi_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__); NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__);
} }
else else
{ {
nfapi_rssi_request_t req; nfapi_rssi_request_t req;
NFAPI_TRACE(NFAPI_TRACE_INFO, "RSSI.request received\n"); NFAPI_TRACE(NFAPI_TRACE_INFO, "RSSI.request received\n");
nfapi_pnf_config_t* config = &(pnf->_public); nfapi_pnf_config_t* config = &(pnf->_public);
// unpack the message // unpack the message
if (nfapi_p4_message_unpack(pRecvMsg, recvMsgLen, &req, sizeof(req), &config->codec_config) >= 0) if (nfapi_p4_message_unpack(pRecvMsg, recvMsgLen, &req, sizeof(req), &config->codec_config) >= 0)
{ {
@@ -1143,10 +1143,10 @@ void pnf_handle_rssi_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
{ {
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Unpack message failed, ignoring\n", __FUNCTION__); NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Unpack message failed, ignoring\n", __FUNCTION__);
} }
if(req.vendor_extension) if(req.vendor_extension)
pnf->_public.codec_config.deallocate(req.vendor_extension); pnf->_public.codec_config.deallocate(req.vendor_extension);
} }
} }
@@ -1159,11 +1159,11 @@ void pnf_handle_cell_search_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
else else
{ {
nfapi_cell_search_request_t req; nfapi_cell_search_request_t req;
NFAPI_TRACE(NFAPI_TRACE_INFO, "CELL_SEARCH.request received\n"); NFAPI_TRACE(NFAPI_TRACE_INFO, "CELL_SEARCH.request received\n");
nfapi_pnf_config_t* config = &(pnf->_public); nfapi_pnf_config_t* config = &(pnf->_public);
if (nfapi_p4_message_unpack(pRecvMsg, recvMsgLen, &req, sizeof(req), &config->codec_config) >= 0) if (nfapi_p4_message_unpack(pRecvMsg, recvMsgLen, &req, sizeof(req), &config->codec_config) >= 0)
{ {
if(config->state == NFAPI_PNF_RUNNING) if(config->state == NFAPI_PNF_RUNNING)
@@ -1212,7 +1212,7 @@ void pnf_handle_cell_search_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
{ {
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Unpack message failed, ignoring\n", __FUNCTION__); NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Unpack message failed, ignoring\n", __FUNCTION__);
} }
if(req.vendor_extension) if(req.vendor_extension)
pnf->_public.codec_config.deallocate(req.vendor_extension); pnf->_public.codec_config.deallocate(req.vendor_extension);
} }
@@ -1231,9 +1231,9 @@ void pnf_handle_broadcast_detect_request(pnf_t* pnf, void *pRecvMsg, int recvMsg
nfapi_broadcast_detect_request_t req; nfapi_broadcast_detect_request_t req;
NFAPI_TRACE(NFAPI_TRACE_INFO, "BROADCAST_DETECT.request received\n"); NFAPI_TRACE(NFAPI_TRACE_INFO, "BROADCAST_DETECT.request received\n");
nfapi_pnf_config_t* config = &(pnf->_public); nfapi_pnf_config_t* config = &(pnf->_public);
if (nfapi_p4_message_unpack(pRecvMsg, recvMsgLen, &req, sizeof(req), &config->codec_config) >= 0) if (nfapi_p4_message_unpack(pRecvMsg, recvMsgLen, &req, sizeof(req), &config->codec_config) >= 0)
{ {
if(config->state == NFAPI_PNF_RUNNING) if(config->state == NFAPI_PNF_RUNNING)
@@ -1282,7 +1282,7 @@ void pnf_handle_broadcast_detect_request(pnf_t* pnf, void *pRecvMsg, int recvMsg
{ {
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Unpack message failed, ignoring\n", __FUNCTION__); NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Unpack message failed, ignoring\n", __FUNCTION__);
} }
if(req.vendor_extension) if(req.vendor_extension)
pnf->_public.codec_config.deallocate(req.vendor_extension); pnf->_public.codec_config.deallocate(req.vendor_extension);
@@ -1298,11 +1298,11 @@ void pnf_handle_system_information_schedule_request(pnf_t* pnf, void *pRecvMsg,
else else
{ {
nfapi_system_information_schedule_request_t req; nfapi_system_information_schedule_request_t req;
NFAPI_TRACE(NFAPI_TRACE_INFO, "SYSTEM_INFORMATION_SCHEDULE.request received\n"); NFAPI_TRACE(NFAPI_TRACE_INFO, "SYSTEM_INFORMATION_SCHEDULE.request received\n");
nfapi_pnf_config_t* config = &(pnf->_public); nfapi_pnf_config_t* config = &(pnf->_public);
if (nfapi_p4_message_unpack(pRecvMsg, recvMsgLen, &req, sizeof(req), &config->codec_config) >= 0) if (nfapi_p4_message_unpack(pRecvMsg, recvMsgLen, &req, sizeof(req), &config->codec_config) >= 0)
{ {
if(config->state == NFAPI_PNF_RUNNING) if(config->state == NFAPI_PNF_RUNNING)
@@ -1351,7 +1351,7 @@ void pnf_handle_system_information_schedule_request(pnf_t* pnf, void *pRecvMsg,
{ {
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Unpack message failed, ignoring\n", __FUNCTION__); NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Unpack message failed, ignoring\n", __FUNCTION__);
} }
if(req.vendor_extension) if(req.vendor_extension)
pnf->_public.codec_config.deallocate(req.vendor_extension); pnf->_public.codec_config.deallocate(req.vendor_extension);
} }
@@ -1368,9 +1368,9 @@ void pnf_handle_system_information_request(pnf_t* pnf, void *pRecvMsg, int recvM
nfapi_system_information_request_t req; nfapi_system_information_request_t req;
NFAPI_TRACE(NFAPI_TRACE_INFO, "SYSTEM_INFORMATION.request received\n"); NFAPI_TRACE(NFAPI_TRACE_INFO, "SYSTEM_INFORMATION.request received\n");
nfapi_pnf_config_t* config = &(pnf->_public); nfapi_pnf_config_t* config = &(pnf->_public);
if (nfapi_p4_message_unpack(pRecvMsg, recvMsgLen, &req, sizeof(req), &config->codec_config) >= 0) if (nfapi_p4_message_unpack(pRecvMsg, recvMsgLen, &req, sizeof(req), &config->codec_config) >= 0)
{ {
if(config->state == NFAPI_PNF_RUNNING) if(config->state == NFAPI_PNF_RUNNING)
@@ -1419,7 +1419,7 @@ void pnf_handle_system_information_request(pnf_t* pnf, void *pRecvMsg, int recvM
{ {
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Unpack message failed, ignoring\n", __FUNCTION__); NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Unpack message failed, ignoring\n", __FUNCTION__);
} }
if(req.vendor_extension) if(req.vendor_extension)
pnf->_public.codec_config.deallocate(req.vendor_extension); pnf->_public.codec_config.deallocate(req.vendor_extension);
} }
@@ -1435,11 +1435,11 @@ void pnf_handle_nmm_stop_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
else else
{ {
nfapi_nmm_stop_request_t req; nfapi_nmm_stop_request_t req;
NFAPI_TRACE(NFAPI_TRACE_INFO, "NMM_STOP.request received\n"); NFAPI_TRACE(NFAPI_TRACE_INFO, "NMM_STOP.request received\n");
nfapi_pnf_config_t* config = &(pnf->_public); nfapi_pnf_config_t* config = &(pnf->_public);
if (nfapi_p4_message_unpack(pRecvMsg, recvMsgLen, &req, sizeof(req), &config->codec_config) >= 0) if (nfapi_p4_message_unpack(pRecvMsg, recvMsgLen, &req, sizeof(req), &config->codec_config) >= 0)
{ {
if(config->state == NFAPI_PNF_RUNNING) if(config->state == NFAPI_PNF_RUNNING)
@@ -1488,7 +1488,7 @@ void pnf_handle_nmm_stop_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
{ {
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Unpack message failed, ignoring\n", __FUNCTION__); NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Unpack message failed, ignoring\n", __FUNCTION__);
} }
if(req.vendor_extension) if(req.vendor_extension)
pnf->_public.codec_config.deallocate(req.vendor_extension); pnf->_public.codec_config.deallocate(req.vendor_extension);
} }
@@ -1504,21 +1504,21 @@ void pnf_handle_vendor_extension(void* pRecvMsg, int recvMsgLen, pnf_t* pnf, uin
else else
{ {
nfapi_pnf_config_t* config = &(pnf->_public); nfapi_pnf_config_t* config = &(pnf->_public);
if(config->allocate_p4_p5_vendor_ext) if(config->allocate_p4_p5_vendor_ext)
{ {
uint16_t msg_size; uint16_t msg_size;
nfapi_p4_p5_message_header_t* msg = config->allocate_p4_p5_vendor_ext(message_id, &msg_size); nfapi_p4_p5_message_header_t* msg = config->allocate_p4_p5_vendor_ext(message_id, &msg_size);
if(msg == 0) if(msg == 0)
{ {
NFAPI_TRACE(NFAPI_TRACE_INFO, "%s failed to allocate vendor extention structure\n"); NFAPI_TRACE(NFAPI_TRACE_INFO, "%s failed to allocate vendor extention structure\n");
return; return;
} }
int unpack_result = nfapi_p5_message_unpack(pRecvMsg, recvMsgLen, msg, msg_size, &config->codec_config); int unpack_result = nfapi_p5_message_unpack(pRecvMsg, recvMsgLen, msg, msg_size, &config->codec_config);
if(unpack_result == 0) if(unpack_result == 0)
{ {
if(config->vendor_ext) if(config->vendor_ext)
@@ -1528,10 +1528,10 @@ void pnf_handle_vendor_extension(void* pRecvMsg, int recvMsgLen, pnf_t* pnf, uin
{ {
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Unpack message failed, ignoring\n", __FUNCTION__); NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Unpack message failed, ignoring\n", __FUNCTION__);
} }
if(config->deallocate_p4_p5_vendor_ext) if(config->deallocate_p4_p5_vendor_ext)
config->deallocate_p4_p5_vendor_ext(msg); config->deallocate_p4_p5_vendor_ext(msg);
} }
} }
} }
@@ -1732,8 +1732,8 @@ void pnf_handle_p5_message(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
int pnf_nr_pack_and_send_p5_message(pnf_t* pnf, nfapi_p4_p5_message_header_t* msg, uint32_t msg_len) int pnf_nr_pack_and_send_p5_message(pnf_t* pnf, nfapi_p4_p5_message_header_t* msg, uint32_t msg_len)
{ {
int packed_len = nfapi_nr_p5_message_pack(msg, msg_len, int packed_len = nfapi_nr_p5_message_pack(msg, msg_len,
pnf->tx_message_buffer, pnf->tx_message_buffer,
sizeof(pnf->tx_message_buffer), sizeof(pnf->tx_message_buffer),
&pnf->_public.codec_config); &pnf->_public.codec_config);
if (packed_len < 0) if (packed_len < 0)
@@ -1749,8 +1749,8 @@ int pnf_nr_pack_and_send_p5_message(pnf_t* pnf, nfapi_p4_p5_message_header_t* ms
int pnf_pack_and_send_p5_message(pnf_t* pnf, nfapi_p4_p5_message_header_t* msg, uint32_t msg_len) int pnf_pack_and_send_p5_message(pnf_t* pnf, nfapi_p4_p5_message_header_t* msg, uint32_t msg_len)
{ {
int packed_len = nfapi_p5_message_pack(msg, msg_len, int packed_len = nfapi_p5_message_pack(msg, msg_len,
pnf->tx_message_buffer, pnf->tx_message_buffer,
sizeof(pnf->tx_message_buffer), sizeof(pnf->tx_message_buffer),
&pnf->_public.codec_config); &pnf->_public.codec_config);
if (packed_len < 0) if (packed_len < 0)
@@ -1765,8 +1765,8 @@ int pnf_pack_and_send_p5_message(pnf_t* pnf, nfapi_p4_p5_message_header_t* msg,
int pnf_pack_and_send_p4_message(pnf_t* pnf, nfapi_p4_p5_message_header_t* msg, uint32_t msg_len) int pnf_pack_and_send_p4_message(pnf_t* pnf, nfapi_p4_p5_message_header_t* msg, uint32_t msg_len)
{ {
int packed_len = nfapi_p4_message_pack(msg, msg_len, int packed_len = nfapi_p4_message_pack(msg, msg_len,
pnf->tx_message_buffer, pnf->tx_message_buffer,
sizeof(pnf->tx_message_buffer), sizeof(pnf->tx_message_buffer),
&pnf->_public.codec_config); &pnf->_public.codec_config);
if (packed_len < 0) if (packed_len < 0)
@@ -1797,14 +1797,14 @@ int pnf_connect(pnf_t* pnf)
NFAPI_TRACE(NFAPI_TRACE_INFO, "Starting P5 PNF connection to VNF at %s:%u\n", pnf->_public.vnf_ip_addr, pnf->_public.vnf_p5_port); NFAPI_TRACE(NFAPI_TRACE_INFO, "Starting P5 PNF connection to VNF at %s:%u\n", pnf->_public.vnf_ip_addr, pnf->_public.vnf_p5_port);
// todo split the vnf address list. currently only supporting 1 // todo split the vnf address list. currently only supporting 1
struct addrinfo hints, *servinfo; struct addrinfo hints, *servinfo;
memset(&hints, 0, sizeof(hints)); memset(&hints, 0, sizeof(hints));
hints.ai_socktype = SOCK_STREAM; // For SCTP we are only interested in SOCK_STREAM hints.ai_socktype = SOCK_STREAM; // For SCTP we are only interested in SOCK_STREAM
// todo : allow the client to restrict IPV4 or IPV6 // todo : allow the client to restrict IPV4 or IPV6
// todo : randomize which address to connect to? // todo : randomize which address to connect to?
char port_str[8]; char port_str[8];
snprintf(port_str, sizeof(port_str), "%d", pnf->_public.vnf_p5_port); snprintf(port_str, sizeof(port_str), "%d", pnf->_public.vnf_p5_port);
if(getaddrinfo(pnf->_public.vnf_ip_addr, port_str, &hints, &servinfo) != 0) if(getaddrinfo(pnf->_public.vnf_ip_addr, port_str, &hints, &servinfo) != 0)
@@ -1822,7 +1822,7 @@ int pnf_connect(pnf_t* pnf)
char* family = "Unknown"; char* family = "Unknown";
char* address = "Unknown"; char* address = "Unknown";
char _addr[128]; char _addr[128];
if(p->ai_family == AF_INET6) if(p->ai_family == AF_INET6)
{ {
family = "IPV6"; family = "IPV6";
@@ -1886,7 +1886,7 @@ int pnf_connect(pnf_t* pnf)
} }
else else
{ {
// Create an IP socket point // Create an IP socket point
if ((pnf->p5_sock = socket(p->ai_family, SOCK_STREAM, IPPROTO_IP)) < 0) if ((pnf->p5_sock = socket(p->ai_family, SOCK_STREAM, IPPROTO_IP)) < 0)
{ {
NFAPI_TRACE(NFAPI_TRACE_ERROR, "After P5 socket errno: %d\n", errno); NFAPI_TRACE(NFAPI_TRACE_ERROR, "After P5 socket errno: %d\n", errno);
@@ -1894,12 +1894,12 @@ int pnf_connect(pnf_t* pnf)
return -1; return -1;
} }
} }
NFAPI_TRACE(NFAPI_TRACE_INFO, "P5 socket created...\n"); NFAPI_TRACE(NFAPI_TRACE_INFO, "P5 socket created...\n");
if (connect(pnf->p5_sock, p->ai_addr, p->ai_addrlen ) < 0) if (connect(pnf->p5_sock, p->ai_addr, p->ai_addrlen ) < 0)
{ {
NFAPI_TRACE(NFAPI_TRACE_ERROR, "After connect (address:%s port:%d) errno: %d\n", NFAPI_TRACE(NFAPI_TRACE_ERROR, "After connect (address:%s port:%d) errno: %d\n",
pnf->_public.vnf_ip_addr, pnf->_public.vnf_p5_port, errno); pnf->_public.vnf_ip_addr, pnf->_public.vnf_p5_port, errno);
if(errno == EINVAL) if(errno == EINVAL)
@@ -1970,14 +1970,16 @@ int pnf_connect(pnf_t* pnf)
int pnf_send_message(pnf_t* pnf, uint8_t *msg, uint32_t len, uint16_t stream) int pnf_send_message(pnf_t* pnf, uint8_t *msg, uint32_t len, uint16_t stream)
{ {
if (pnf->sctp) if (pnf->sctp)
{ {
#if 0
printf("\nPNF SENDS: \n"); printf("\nPNF SENDS: \n");
for(int i=0; i<len; i++){ for(int i=0; i<len; i++){
printf("%d", msg[i]); printf("%d", msg[i]);
} }
printf("\n"); printf("\n");
#endif
if (sctp_sendmsg(pnf->p5_sock, msg, len, NULL, 0, 42/*config->sctp_stream_number*/, 0, stream/*P5_STREAM_ID*/, 0, 0) < 0) if (sctp_sendmsg(pnf->p5_sock, msg, len, NULL, 0, 42/*config->sctp_stream_number*/, 0, stream/*P5_STREAM_ID*/, 0, 0) < 0)
{ {
@@ -2069,12 +2071,14 @@ int pnf_read_dispatch_message(pnf_t* pnf)
} }
else else
{ {
#if 0
// print the received message // print the received message
printf("\n MESSAGE RECEIVED: \n"); printf("\n MESSAGE RECEIVED: \n");
for(int i=0; i<message_size; i++){ for(int i=0; i<message_size; i++){
printf("%d", read_buffer[i]); printf("%d", read_buffer[i]);
} }
printf("\n"); printf("\n");
#endif
if (flags & MSG_NOTIFICATION) if (flags & MSG_NOTIFICATION)
{ {
@@ -2198,12 +2202,14 @@ int pnf_nr_read_dispatch_message(pnf_t* pnf)
} }
else else
{ {
#if 0
// print the received message // print the received message
printf("\n MESSAGE RECEIVED: \n"); printf("\n MESSAGE RECEIVED: \n");
for(int i=0; i<message_size; i++){ for(int i=0; i<message_size; i++){
printf("%d", read_buffer[i]); printf("%d", read_buffer[i]);
} }
printf("\n"); printf("\n");
#endif
if (flags & MSG_NOTIFICATION) if (flags & MSG_NOTIFICATION)
{ {
@@ -2275,7 +2281,7 @@ int pnf_message_pump(pnf_t* pnf)
selectRetval = select(pnf->p5_sock+1, &rfds, NULL, NULL, &timeout); selectRetval = select(pnf->p5_sock+1, &rfds, NULL, NULL, &timeout);
if(selectRetval == 0) if(selectRetval == 0)
{ {
// timeout // timeout
continue; continue;
} }
@@ -2336,7 +2342,7 @@ int pnf_nr_message_pump(pnf_t* pnf)
selectRetval = select(pnf->p5_sock+1, &rfds, NULL, NULL, &timeout); selectRetval = select(pnf->p5_sock+1, &rfds, NULL, NULL, &timeout);
if(selectRetval == 0) if(selectRetval == 0)
{ {
// timeout // timeout
continue; continue;
} }
@@ -2376,4 +2382,3 @@ int pnf_nr_message_pump(pnf_t* pnf)
return 0; return 0;
} }
+8 -9
View File
@@ -1,12 +1,12 @@
/* /*
* Copyright 2017 Cisco Systems, Inc. * Copyright 2017 Cisco Systems, Inc.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * 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)); memset(_this, 0, sizeof(pnf_t));
_this->sctp = 1; // enable sctp _this->sctp = 1; // enable sctp
_this->_public.vnf_p5_port = NFAPI_P5_SCTP_PORT; _this->_public.vnf_p5_port = NFAPI_P5_SCTP_PORT;
_this->_public.malloc = &malloc; _this->_public.malloc = &malloc;
_this->_public.free = &free; _this->_public.free = &free;
_this->_public.codec_config.allocate = &malloc; _this->_public.codec_config.allocate = &malloc;
_this->_public.codec_config.deallocate = &free; _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__); NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__);
return -1; return -1;
} }
pnf_t* _this = (pnf_t*)(config); pnf_t* _this = (pnf_t*)(config);
return pnf_pack_and_send_p5_message(_this, &(resp->header), sizeof(nfapi_param_response_t)); 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__); NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__);
return -1; return -1;
} }
pnf_t* _this = (pnf_t*)(config); pnf_t* _this = (pnf_t*)(config);
return pnf_nr_pack_and_send_p5_message(_this, &(resp->header), sizeof(nfapi_nr_param_response_scf_t)); 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); return pnf_pack_and_send_p5_message(_this, msg, msg_len);
} }
+8 -1
View File
@@ -2947,12 +2947,19 @@ void pnf_nfapi_p7_read_dispatch_message(pnf_p7_t* pnf_p7, uint32_t now_hr_time)
} }
// read the segment // 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??? now_hr_time = pnf_get_current_time_hr(); //DJP - moved to here - get closer timestamp???
if(recvfrom_result > 0) 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); 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); //printf("\npnf_handle_p7_message sfn=%d,slot=%d\n",pnf_p7->sfn,pnf_p7->slot);
} }
+1
View File
@@ -18,6 +18,7 @@
#ifndef _VNF_H_ #ifndef _VNF_H_
#define _VNF_H_ #define _VNF_H_
#include "pnf_p7.h"
#include "nfapi_vnf_interface.h" #include "nfapi_vnf_interface.h"
typedef struct typedef struct
@@ -1,12 +1,12 @@
/* /*
* Copyright 2017 Cisco Systems, Inc. * Copyright 2017 Cisco Systems, Inc.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -22,14 +22,12 @@
#include "nfapi_nr_interface.h" #include "nfapi_nr_interface.h"
#include "debug.h" #include "debug.h"
#include "netinet/in.h" #include "netinet/in.h"
#if defined(__cplusplus) #if defined(__cplusplus)
extern "C" { extern "C" {
#endif #endif
#define NFAPI_MAX_PACKED_MESSAGE_SIZE 8192
/*! The nfapi VNF phy configuration information /*! The nfapi VNF phy configuration information
*/ */
@@ -108,79 +106,79 @@ typedef struct nfapi_vnf_config
/*! Configuration options for the p4 p5 pack unpack functions */ /*! Configuration options for the p4 p5 pack unpack functions */
nfapi_p4_p5_codec_config_t codec_config; nfapi_p4_p5_codec_config_t codec_config;
/*! Optional user defined data that will be avaliable in the callbacks*/ /*! Optional user defined data that will be avaliable in the callbacks*/
void* user_data; void* user_data;
/*! \brief Callback indicating that a pnf has established connection /*! \brief Callback indicating that a pnf has established connection
* \param config A pointer to the vnf configuration * \param config A pointer to the vnf configuration
* \param p5_idx The p5 used to indicate this pnf p5 connection * \param p5_idx The p5 used to indicate this pnf p5 connection
* *
* The client is expected to send the PNF_PARAM.request in response to * The client is expected to send the PNF_PARAM.request in response to
* the connection indication * the connection indication
* *
* \todo Do we need to send the address information of the PNF? * \todo Do we need to send the address information of the PNF?
*/ */
int (*pnf_nr_connection_indication)(nfapi_vnf_config_t* config, int p5_idx); int (*pnf_nr_connection_indication)(nfapi_vnf_config_t* config, int p5_idx);
int (*pnf_connection_indication)(nfapi_vnf_config_t* config, int p5_idx); int (*pnf_connection_indication)(nfapi_vnf_config_t* config, int p5_idx);
/*! \brief Callback indicating that a pnf has lost connection /*! \brief Callback indicating that a pnf has lost connection
* \param config A pointer to the vnf configuration * \param config A pointer to the vnf configuration
* \param p5_idx The p5 used to indicate this pnf p5 connection * \param p5_idx The p5 used to indicate this pnf p5 connection
* *
* The p5_idx may be used for future new p5 connections * The p5_idx may be used for future new p5 connections
* *
* The client is responsiable for communicating to the p7 instance(s) that * The client is responsiable for communicating to the p7 instance(s) that
* may be associated with this p5 that they should be deleted using the * may be associated with this p5 that they should be deleted using the
* nfapi_vnf_p7_del_pnf functon * nfapi_vnf_p7_del_pnf functon
* *
*/ */
int (*pnf_disconnect_indication)(nfapi_vnf_config_t* config, int p5_idx); int (*pnf_disconnect_indication)(nfapi_vnf_config_t* config, int p5_idx);
// p5 interface functions // p5 interface functions
/*! \brief A callback to handle the PNF_PARAM.resp /*! \brief A callback to handle the PNF_PARAM.resp
* \param config A pointer to the vnf configuration * \param config A pointer to the vnf configuration
* \param p5_idx The p5 index used to indicate a particular pnf p5 connection * \param p5_idx The p5 index used to indicate a particular pnf p5 connection
* \param resp A data structure for the decoded PNF_PARAM.response. This will * \param resp A data structure for the decoded PNF_PARAM.response. This will
* have been allocated on the stack. * have been allocated on the stack.
* \return not currently used. * \return not currently used.
* *
* The PNF_PARAM.resp contains the capability of the PNF identified by the * The PNF_PARAM.resp contains the capability of the PNF identified by the
* p5_idx. * p5_idx.
* *
* The client is expected to send the PNF_CONFIG.request after receiving the * The client is expected to send the PNF_CONFIG.request after receiving the
* PNF_PARAM.resp. This can be done in the call back. * PNF_PARAM.resp. This can be done in the call back.
* *
* It is expected that the client when building the PNF_CONFIG.request will * It is expected that the client when building the PNF_CONFIG.request will
* used the nfapi_vnf_allocate_phy() to allocate unique phy id for each FAPI * used the nfapi_vnf_allocate_phy() to allocate unique phy id for each FAPI
* instance the client wishes to create. * instance the client wishes to create.
* *
* The resp may contain pointers to dyanmically allocated sub structures * The resp may contain pointers to dyanmically allocated sub structures
* such as the vendor_extention. The dyanmically allocated structure will * such as the vendor_extention. The dyanmically allocated structure will
* be deallocated on return. If the client wishes to 'keep' the structures * be deallocated on return. If the client wishes to 'keep' the structures
* then the substructure pointers should be set to 0 and then the client should * then the substructure pointers should be set to 0 and then the client should
* use the codec_config.deallocate function to release it at a future point * use the codec_config.deallocate function to release it at a future point
*/ */
int (*pnf_nr_param_resp)(nfapi_vnf_config_t* config, int p5_idx, nfapi_nr_pnf_param_response_t* resp); int (*pnf_nr_param_resp)(nfapi_vnf_config_t* config, int p5_idx, nfapi_nr_pnf_param_response_t* resp);
int (*pnf_param_resp)(nfapi_vnf_config_t* config, int p5_idx, nfapi_pnf_param_response_t* resp); int (*pnf_param_resp)(nfapi_vnf_config_t* config, int p5_idx, nfapi_pnf_param_response_t* resp);
/*! A callback for the PNF_CONFIG.resp /*! A callback for the PNF_CONFIG.resp
* \param config A pointer to the vnf configuration * \param config A pointer to the vnf configuration
* \param p5_idx The p5 index used to indicate a particular pnf p5 connection * \param p5_idx The p5 index used to indicate a particular pnf p5 connection
* \param resp A data structure for the decoded PNF_CONFIG.response. This will * \param resp A data structure for the decoded PNF_CONFIG.response. This will
* have been allocated on the stack. * have been allocated on the stack.
* \return not currently used. * \return not currently used.
* *
* The PNF_CONFIG.resp contains the result of the PNF_CONFIG.request for the * The PNF_CONFIG.resp contains the result of the PNF_CONFIG.request for the
* PNF identified by the p5_idx. * PNF identified by the p5_idx.
* *
* The client is expected to send the PNF_START.request after receiving the * The client is expected to send the PNF_START.request after receiving the
* PNF_PARAM.resp. This can be done in the call back. * PNF_PARAM.resp. This can be done in the call back.
* *
* The resp may contain pointers to dyanmically allocated sub structures * The resp may contain pointers to dyanmically allocated sub structures
* such as the vendor_extention. The dyanmically allocated structure will * such as the vendor_extention. The dyanmically allocated structure will
* be deallocated on return. If the client wishes to 'keep' the structures * be deallocated on return. If the client wishes to 'keep' the structures
* then the substructure pointers should be set to 0 and then the client should * then the substructure pointers should be set to 0 and then the client should
* use the codec_config.deallocate function to release it at a future point * use the codec_config.deallocate function to release it at a future point
*/ */
@@ -190,19 +188,19 @@ typedef struct nfapi_vnf_config
/*! A callback for the PNF_START.resp /*! A callback for the PNF_START.resp
* \param config A pointer to the vnf configuration * \param config A pointer to the vnf configuration
* \param p5_idx The p5 index used to indicate a particular pnf p5 connection * \param p5_idx The p5 index used to indicate a particular pnf p5 connection
* \param resp A data structure for the decoded PNF_START.response. This will * \param resp A data structure for the decoded PNF_START.response. This will
* have been allocated on the stack. * have been allocated on the stack.
* \return not currently used. * \return not currently used.
* *
* The PNF_START.resp contains the result of the PNF_START.request for the * The PNF_START.resp contains the result of the PNF_START.request for the
* PNF identified by the p5_idx. * PNF identified by the p5_idx.
* *
* The client is expected to send the PARAM.request for each FAPI instance * The client is expected to send the PARAM.request for each FAPI instance
* that has been created in the PNF. * that has been created in the PNF.
* *
* The resp may contain pointers to dyanmically allocated sub structures * The resp may contain pointers to dyanmically allocated sub structures
* such as the vendor_extention. The dyanmically allocated structure will * such as the vendor_extention. The dyanmically allocated structure will
* be deallocated on return. If the client wishes to 'keep' the structures * be deallocated on return. If the client wishes to 'keep' the structures
* then the substructure pointers should be set to 0 and then the client should * then the substructure pointers should be set to 0 and then the client should
* use the codec_config.deallocate function to release it at a future point * use the codec_config.deallocate function to release it at a future point
*/ */
@@ -212,63 +210,63 @@ typedef struct nfapi_vnf_config
/*! A callback for the PNF_STOP.resp /*! A callback for the PNF_STOP.resp
* \param config A pointer to the vnf configuration * \param config A pointer to the vnf configuration
* \param p5_idx The p5 index used to indicate a particular pnf p5 connection * \param p5_idx The p5 index used to indicate a particular pnf p5 connection
* \param resp A data structure for the decoded PNF_STOP.response. This will * \param resp A data structure for the decoded PNF_STOP.response. This will
* have been allocated on the stack. * have been allocated on the stack.
* \return not currently used. * \return not currently used.
* *
* The PNF_STOP.response contains the result of the PNF_STOP.request for the * The PNF_STOP.response contains the result of the PNF_STOP.request for the
* PNF identified by the p5_idx. * PNF identified by the p5_idx.
* *
* The resp may contain pointers to dyanmically allocated sub structures * The resp may contain pointers to dyanmically allocated sub structures
* such as the vendor_extention. The dyanmically allocated structure will * such as the vendor_extention. The dyanmically allocated structure will
* be deallocated on return. If the client wishes to 'keep' the structures * be deallocated on return. If the client wishes to 'keep' the structures
* then the substructure pointers should be set to 0 and then the client should * then the substructure pointers should be set to 0 and then the client should
* use the codec_config.deallocate function to release it at a future point * use the codec_config.deallocate function to release it at a future point
*/ */
int (*pnf_stop_resp)(nfapi_vnf_config_t* config, int p5_idx, nfapi_pnf_stop_response_t* resp); int (*pnf_stop_resp)(nfapi_vnf_config_t* config, int p5_idx, nfapi_pnf_stop_response_t* resp);
/*! A callback for the PARAM.resp /*! A callback for the PARAM.resp
* \param config A pointer to the vnf configuration * \param config A pointer to the vnf configuration
* \param p5_idx The p5 index used to indicate a particular pnf p5 connection * \param p5_idx The p5 index used to indicate a particular pnf p5 connection
* \param resp A data structure for the decoded PARAM.resposne. This will * \param resp A data structure for the decoded PARAM.resposne. This will
* have been allocated on the stack. * have been allocated on the stack.
* \return not currently used. * \return not currently used.
* *
* The PARAM.request contains the capabilities of the FAPI instance identified * The PARAM.request contains the capabilities of the FAPI instance identified
* by the phy_id * by the phy_id
* *
* The client is expected to send the CONFIG.request after receiving the * The client is expected to send the CONFIG.request after receiving the
* PARAM.response. This can be done in the call back. The PARAM.response * PARAM.response. This can be done in the call back. The PARAM.response
* contains the PNF P7 address (ipv4 or ipv6) and port. This information * contains the PNF P7 address (ipv4 or ipv6) and port. This information
* is used when calling the nfapi_vnf_p7_add_pnf() * is used when calling the nfapi_vnf_p7_add_pnf()
* *
* The client is responsible for identifing the VNF P7 ip address * The client is responsible for identifing the VNF P7 ip address
* (ipv4 or ipv6) and port for the VNF P7 entity which will be sent to the * (ipv4 or ipv6) and port for the VNF P7 entity which will be sent to the
* PNF P7 entity. That endpoint should be valid before send the * PNF P7 entity. That endpoint should be valid before send the
* CONFIG.request. * CONFIG.request.
* *
* The resp may contain pointers to dyanmically allocated sub structures * The resp may contain pointers to dyanmically allocated sub structures
* such as the vendor_extention. The dyanmically allocated structure will * such as the vendor_extention. The dyanmically allocated structure will
* be deallocated on return. If the client wishes to 'keep' the structures * be deallocated on return. If the client wishes to 'keep' the structures
* then the substructure pointers should be set to 0 and then the client should * then the substructure pointers should be set to 0 and then the client should
* use the codec_config.deallocate function to release it at a future point * use the codec_config.deallocate function to release it at a future point
*/ */
int (*param_resp)(nfapi_vnf_config_t* config, int p5_idx, nfapi_param_response_t* resp); int (*param_resp)(nfapi_vnf_config_t* config, int p5_idx, nfapi_param_response_t* resp);
int (*nr_param_resp)(nfapi_vnf_config_t* config, int p5_idx, nfapi_nr_param_response_scf_t* resp); int (*nr_param_resp)(nfapi_vnf_config_t* config, int p5_idx, nfapi_nr_param_response_scf_t* resp);
/*! A callback for the CONFIG.response /*! A callback for the CONFIG.response
* \param config A pointer to the vnf configuration * \param config A pointer to the vnf configuration
* \param p5_idx The p5 index used to indicate a particular pnf p5 connection * \param p5_idx The p5 index used to indicate a particular pnf p5 connection
* \param resp A data structure for the decoded CONFIG.response This will * \param resp A data structure for the decoded CONFIG.response This will
* have been allocated on the stack. * have been allocated on the stack.
* \return not currently used. * \return not currently used.
* *
* The CONFIG.response contains the result of the CONFIG.request * The CONFIG.response contains the result of the CONFIG.request
* *
* *
* The resp may contain pointers to dyanmically allocated sub structures * The resp may contain pointers to dyanmically allocated sub structures
* such as the vendor_extention. The dyanmically allocated structure will * such as the vendor_extention. The dyanmically allocated structure will
* be deallocated on return. If the client wishes to 'keep' the structures * be deallocated on return. If the client wishes to 'keep' the structures
* then the substructure pointers should be set to 0 and then the client should * then the substructure pointers should be set to 0 and then the client should
* use the codec_config.deallocate function to release it at a future point * use the codec_config.deallocate function to release it at a future point
*/ */
@@ -278,173 +276,173 @@ typedef struct nfapi_vnf_config
/*! A callback for the START.resp /*! A callback for the START.resp
* \param config A pointer to the vnf configuration * \param config A pointer to the vnf configuration
* \param p5_idx The p5 index used to indicate a particular pnf p5 connection * \param p5_idx The p5 index used to indicate a particular pnf p5 connection
* \param resp A data structure for the decoded START.response This will * \param resp A data structure for the decoded START.response This will
* have been allocated on the stack. * have been allocated on the stack.
* \return not currently used. * \return not currently used.
* *
* The START.response contains the result of the START.request * The START.response contains the result of the START.request
* *
* *
* The resp may contain pointers to dyanmically allocated sub structures * The resp may contain pointers to dyanmically allocated sub structures
* such as the vendor_extention. The dyanmically allocated structure will * such as the vendor_extention. The dyanmically allocated structure will
* be deallocated on return. If the client wishes to 'keep' the structures * be deallocated on return. If the client wishes to 'keep' the structures
* then the substructure pointers should be set to 0 and then the client should * then the substructure pointers should be set to 0 and then the client should
* use the codec_config.deallocate function to release it at a future point * use the codec_config.deallocate function to release it at a future point
*/ */
int (*start_resp)(nfapi_vnf_config_t* config, int p5_idx, nfapi_start_response_t* resp); int (*start_resp)(nfapi_vnf_config_t* config, int p5_idx, nfapi_start_response_t* resp);
int (*nr_start_resp)(nfapi_vnf_config_t* config, int p5_idx, nfapi_nr_start_response_scf_t* resp); int (*nr_start_resp)(nfapi_vnf_config_t* config, int p5_idx, nfapi_nr_start_response_scf_t* resp);
/*! A callback for the STOP.resp /*! A callback for the STOP.resp
* \param config A pointer to the vnf configuration * \param config A pointer to the vnf configuration
* \param p5_idx The p5 index used to indicate a particular pnf p5 connection * \param p5_idx The p5 index used to indicate a particular pnf p5 connection
* \param resp A data structure for the decoded STOP.response This will * \param resp A data structure for the decoded STOP.response This will
* have been allocated on the stack. * have been allocated on the stack.
* \return not currently used. * \return not currently used.
* *
* The STOP.response contains the result of the STOP.request * The STOP.response contains the result of the STOP.request
* *
* *
* The resp may contain pointers to dyanmically allocated sub structures * The resp may contain pointers to dyanmically allocated sub structures
* such as the vendor_extention. The dyanmically allocated structure will * such as the vendor_extention. The dyanmically allocated structure will
* be deallocated on return. If the client wishes to 'keep' the structures * be deallocated on return. If the client wishes to 'keep' the structures
* then the substructure pointers should be set to 0 and then the client should * then the substructure pointers should be set to 0 and then the client should
* use the codec_config.deallocate function to release it at a future point * use the codec_config.deallocate function to release it at a future point
*/ */
int (*stop_resp)(nfapi_vnf_config_t* config, int p5_idx, nfapi_stop_response_t* resp); int (*stop_resp)(nfapi_vnf_config_t* config, int p5_idx, nfapi_stop_response_t* resp);
/*! A callback for the MEASUREMENT.resp /*! A callback for the MEASUREMENT.resp
* \param config A pointer to the vnf configuration * \param config A pointer to the vnf configuration
* \param p5_idx The p5 index used to indicate a particular pnf p5 connection * \param p5_idx The p5 index used to indicate a particular pnf p5 connection
* \param resp A data structure for the decoded MEASUREMENT.response This will * \param resp A data structure for the decoded MEASUREMENT.response This will
* have been allocated on the stack. * have been allocated on the stack.
* \return not currently used. * \return not currently used.
* *
* The MEASUREMENT.response contains the result of the MEASUREMENT.request * The MEASUREMENT.response contains the result of the MEASUREMENT.request
* *
* The resp may contain pointers to dyanmically allocated sub structures * The resp may contain pointers to dyanmically allocated sub structures
* such as the vendor_extention. The dyanmically allocated structure will * such as the vendor_extention. The dyanmically allocated structure will
* be deallocated on return. If the client wishes to 'keep' the structures * be deallocated on return. If the client wishes to 'keep' the structures
* then the substructure pointers should be set to 0 and then the client should * then the substructure pointers should be set to 0 and then the client should
* use the codec_config.deallocate function to release it at a future point * use the codec_config.deallocate function to release it at a future point
*/ */
int (*measurement_resp)(nfapi_vnf_config_t* config, int p5_idx, nfapi_measurement_response_t* resp); int (*measurement_resp)(nfapi_vnf_config_t* config, int p5_idx, nfapi_measurement_response_t* resp);
// p4 interface functions // p4 interface functions
/*! A callback for the RSSI.resp /*! A callback for the RSSI.resp
* \param config A pointer to the vnf configuration * \param config A pointer to the vnf configuration
* \param p5_idx The p5 index used to indicate a particular pnf p5 connection * \param p5_idx The p5 index used to indicate a particular pnf p5 connection
* \param resp A data structure for the decoded RSSI.response This will * \param resp A data structure for the decoded RSSI.response This will
* have been allocated on the stack. * have been allocated on the stack.
* \return not currently used. * \return not currently used.
*/ */
int (*rssi_resp)(nfapi_vnf_config_t* config, int p5_idx, nfapi_rssi_response_t* resp); int (*rssi_resp)(nfapi_vnf_config_t* config, int p5_idx, nfapi_rssi_response_t* resp);
/*! A callback for the RSSI.indication /*! A callback for the RSSI.indication
* \param config A pointer to the vnf configuration * \param config A pointer to the vnf configuration
* \param p5_idx The p5 index used to indicate a particular pnf p5 connection * \param p5_idx The p5 index used to indicate a particular pnf p5 connection
* \param resp A data structure for the decoded RSSI.indication This will * \param resp A data structure for the decoded RSSI.indication This will
* have been allocated on the stack. * have been allocated on the stack.
* \return not currently used. * \return not currently used.
*/ */
int (*rssi_ind)(nfapi_vnf_config_t* config, int p5_idx, nfapi_rssi_indication_t* ind); int (*rssi_ind)(nfapi_vnf_config_t* config, int p5_idx, nfapi_rssi_indication_t* ind);
/*! A callback for the CELL_SEARCH.response /*! A callback for the CELL_SEARCH.response
* \param config A pointer to the vnf configuration * \param config A pointer to the vnf configuration
* \param p5_idx The p5 index used to indicate a particular pnf p5 connection * \param p5_idx The p5 index used to indicate a particular pnf p5 connection
* \param resp A data structure for the decoded CELL_SEARCH.response This will * \param resp A data structure for the decoded CELL_SEARCH.response This will
* have been allocated on the stack. * have been allocated on the stack.
* \return not currently used. * \return not currently used.
*/ */
int (*cell_search_resp)(nfapi_vnf_config_t* config, int p5_idx, nfapi_cell_search_response_t* resp); int (*cell_search_resp)(nfapi_vnf_config_t* config, int p5_idx, nfapi_cell_search_response_t* resp);
/*! A callback for the CELL_SEARCH.indication /*! A callback for the CELL_SEARCH.indication
* \param config A pointer to the vnf configuration * \param config A pointer to the vnf configuration
* \param p5_idx The p5 index used to indicate a particular pnf p5 connection * \param p5_idx The p5 index used to indicate a particular pnf p5 connection
* \param resp A data structure for the decoded CELL_SEARCH.indication This will * \param resp A data structure for the decoded CELL_SEARCH.indication This will
* have been allocated on the stack. * have been allocated on the stack.
* \return not currently used. * \return not currently used.
*/ */
int (*cell_search_ind)(nfapi_vnf_config_t* config, int p5_idx, nfapi_cell_search_indication_t* ind); int (*cell_search_ind)(nfapi_vnf_config_t* config, int p5_idx, nfapi_cell_search_indication_t* ind);
/*! A callback for the BROADCAST_DETECT.response /*! A callback for the BROADCAST_DETECT.response
* \param config A pointer to the vnf configuration * \param config A pointer to the vnf configuration
* \param p5_idx The p5 index used to indicate a particular pnf p5 connection * \param p5_idx The p5 index used to indicate a particular pnf p5 connection
* \param resp A data structure for the decoded BROADCAST_DETECT.response This will * \param resp A data structure for the decoded BROADCAST_DETECT.response This will
* have been allocated on the stack. * have been allocated on the stack.
* \return not currently used. */ * \return not currently used. */
int (*broadcast_detect_resp)(nfapi_vnf_config_t* config, int p5_idx, nfapi_broadcast_detect_response_t* resp); int (*broadcast_detect_resp)(nfapi_vnf_config_t* config, int p5_idx, nfapi_broadcast_detect_response_t* resp);
/*! A callback for the BROADCAST_DETECT.indication /*! A callback for the BROADCAST_DETECT.indication
* \param config A pointer to the vnf configuration * \param config A pointer to the vnf configuration
* \param p5_idx The p5 index used to indicate a particular pnf p5 connection * \param p5_idx The p5 index used to indicate a particular pnf p5 connection
* \param resp A data structure for the decoded BROADCAST_DETECT.indication This will * \param resp A data structure for the decoded BROADCAST_DETECT.indication This will
* have been allocated on the stack. * have been allocated on the stack.
* \return not currently used. * \return not currently used.
*/ */
int (*broadcast_detect_ind)(nfapi_vnf_config_t* config, int p5_idx, nfapi_broadcast_detect_indication_t* ind); int (*broadcast_detect_ind)(nfapi_vnf_config_t* config, int p5_idx, nfapi_broadcast_detect_indication_t* ind);
/*! A callback for the SYSTEM_INFORMATION_SCHEUDLE.response /*! A callback for the SYSTEM_INFORMATION_SCHEUDLE.response
* \param config A pointer to the vnf configuration * \param config A pointer to the vnf configuration
* \param p5_idx The p5 index used to indicate a particular pnf p5 connection * \param p5_idx The p5 index used to indicate a particular pnf p5 connection
* \param resp A data structure for the decoded SYSTEM_INFORMATION_SCHEUDLE.response This will * \param resp A data structure for the decoded SYSTEM_INFORMATION_SCHEUDLE.response This will
* have been allocated on the stack. * have been allocated on the stack.
* \return not currently used. * \return not currently used.
*/ */
int (*system_information_schedule_resp)(nfapi_vnf_config_t* config, int p5_idx, nfapi_system_information_schedule_response_t* resp); int (*system_information_schedule_resp)(nfapi_vnf_config_t* config, int p5_idx, nfapi_system_information_schedule_response_t* resp);
/*! A callback for the SYSTEM_INFORMATION_SCHEUDLE.indication /*! A callback for the SYSTEM_INFORMATION_SCHEUDLE.indication
* \param config A pointer to the vnf configuration * \param config A pointer to the vnf configuration
* \param p5_idx The p5 index used to indicate a particular pnf p5 connection * \param p5_idx The p5 index used to indicate a particular pnf p5 connection
* \param resp A data structure for the decoded SYSTEM_INFORMATION_SCHEUDLE.indication This will * \param resp A data structure for the decoded SYSTEM_INFORMATION_SCHEUDLE.indication This will
* have been allocated on the stack. * have been allocated on the stack.
* \return not currently used. * \return not currently used.
*/ */
int (*system_information_schedule_ind)(nfapi_vnf_config_t* config, int p5_idx, nfapi_system_information_schedule_indication_t* ind); int (*system_information_schedule_ind)(nfapi_vnf_config_t* config, int p5_idx, nfapi_system_information_schedule_indication_t* ind);
/*! A callback for the SYSTEM_INFORMATION.response /*! A callback for the SYSTEM_INFORMATION.response
* \param config A pointer to the vnf configuration * \param config A pointer to the vnf configuration
* \param p5_idx The p5 index used to indicate a particular pnf p5 connection * \param p5_idx The p5 index used to indicate a particular pnf p5 connection
* \param resp A data structure for the decoded SYSTEM_INFORMATION.response This will * \param resp A data structure for the decoded SYSTEM_INFORMATION.response This will
* have been allocated on the stack. * have been allocated on the stack.
* \return not currently used. * \return not currently used.
*/ */
int (*system_information_resp)(nfapi_vnf_config_t* config, int p5_idx, nfapi_system_information_response_t* resp); int (*system_information_resp)(nfapi_vnf_config_t* config, int p5_idx, nfapi_system_information_response_t* resp);
/*! A callback for the SYSTEM_INFORMATION.indication /*! A callback for the SYSTEM_INFORMATION.indication
* \param config A pointer to the vnf configuration * \param config A pointer to the vnf configuration
* \param p5_idx The p5 index used to indicate a particular pnf p5 connection * \param p5_idx The p5 index used to indicate a particular pnf p5 connection
* \param resp A data structure for the decoded SYSTEM_INFORMATION.indication This will * \param resp A data structure for the decoded SYSTEM_INFORMATION.indication This will
* have been allocated on the stack. * have been allocated on the stack.
* \return not currently used. * \return not currently used.
*/ */
int (*system_information_ind)(nfapi_vnf_config_t* config, int p5_idx, nfapi_system_information_indication_t* ind); int (*system_information_ind)(nfapi_vnf_config_t* config, int p5_idx, nfapi_system_information_indication_t* ind);
/*! A callback for the NMM_STOP.response /*! A callback for the NMM_STOP.response
* \param config A pointer to the vnf configuration * \param config A pointer to the vnf configuration
* \param p5_idx The p5 index used to indicate a particular pnf p5 connection * \param p5_idx The p5 index used to indicate a particular pnf p5 connection
* \param resp A data structure for the decoded NMM_STOP.response This will * \param resp A data structure for the decoded NMM_STOP.response This will
* have been allocated on the stack. * have been allocated on the stack.
* \return not currently used. * \return not currently used.
*/ */
int (*nmm_stop_resp)(nfapi_vnf_config_t* config, int p5_idx, nfapi_nmm_stop_response_t* resp); int (*nmm_stop_resp)(nfapi_vnf_config_t* config, int p5_idx, nfapi_nmm_stop_response_t* resp);
/*! A callback for any vendor extension message received /*! A callback for any vendor extension message received
* \param config A pointer to the vnf configuration * \param config A pointer to the vnf configuration
* \param p5_idx The p5 index used to indicate a particular pnf p5 connection * \param p5_idx The p5 index used to indicate a particular pnf p5 connection
* \param resp A data structure for the decoded vendor extention message * \param resp A data structure for the decoded vendor extention message
* \return not currently used. * \return not currently used.
*/ */
int (*vendor_ext)(nfapi_vnf_config_t* config, int p5_idx, nfapi_p4_p5_message_header_t* msg); int (*vendor_ext)(nfapi_vnf_config_t* config, int p5_idx, nfapi_p4_p5_message_header_t* msg);
/*! A callback to allocate vendor extension messages /*! A callback to allocate vendor extension messages
* \param message_id The message is taken from the message header * \param message_id The message is taken from the message header
* \param msg_size The is the vendor extention message that has been allocated. * \param msg_size The is the vendor extention message that has been allocated.
* The callee must set this value * The callee must set this value
* \return A pointer to an allocated vendor extention message * \return A pointer to an allocated vendor extention message
*/ */
nfapi_p4_p5_message_header_t* (*allocate_p4_p5_vendor_ext)(uint16_t message_id, uint16_t* msg_size); nfapi_p4_p5_message_header_t* (*allocate_p4_p5_vendor_ext)(uint16_t message_id, uint16_t* msg_size);
/*! A callback to deallocate vendor extension messages /*! A callback to deallocate vendor extension messages
* \param header A pointer to an allocated vendor extention message * \param header A pointer to an allocated vendor extention message
*/ */
@@ -453,8 +451,8 @@ typedef struct nfapi_vnf_config
} nfapi_vnf_config_t; } nfapi_vnf_config_t;
/*! Creates and initialise the vnf config structure before use /*! Creates and initialise the vnf config structure before use
@@ -467,24 +465,24 @@ nfapi_vnf_config_t* nfapi_vnf_config_create(void);
void nfapi_vnf_config_destory(nfapi_vnf_config_t* config); void nfapi_vnf_config_destory(nfapi_vnf_config_t* config);
/*! Start the VNF library. /*! Start the VNF library.
* \param config A pointer to a vnf config * \param config A pointer to a vnf config
* \return 0 means success, -1 failure * \return 0 means success, -1 failure
* *
* The config should be initailize with port the vnf should listen on and * The config should be initailize with port the vnf should listen on and
* the callback set to functions that will be called when a nFAPI message is * the callback set to functions that will be called when a nFAPI message is
* recevied before calling nfapi_vnf_start. * recevied before calling nfapi_vnf_start.
* *
* This function will not return untill nfapi_vnf_stop is called * This function will not return untill nfapi_vnf_stop is called
*/ */
int nfapi_nr_vnf_start(nfapi_vnf_config_t* config); int nfapi_nr_vnf_start(nfapi_vnf_config_t* config);
int nfapi_vnf_start(nfapi_vnf_config_t* config); int nfapi_vnf_start(nfapi_vnf_config_t* config);
/*! Stop the VNF library. /*! Stop the VNF library.
* \param config A pointer to a vnf config * \param config A pointer to a vnf config
* \return 0 means success, -1 failure * \return 0 means success, -1 failure
* *
* This function will cause the nfapi_vnf_start function to return * This function will cause the nfapi_vnf_start function to return
*/ */
int nfapi_vnf_stop(nfapi_vnf_config_t* config); int nfapi_vnf_stop(nfapi_vnf_config_t* config);
@@ -494,7 +492,7 @@ int nfapi_vnf_stop(nfapi_vnf_config_t* config);
* \param p5_idx The P5 index return by the callbacks * \param p5_idx The P5 index return by the callbacks
* \param phy_id A pointer to a phy_id that will be set by this function * \param phy_id A pointer to a phy_id that will be set by this function
* \return 0 means success, -1 failure * \return 0 means success, -1 failure
* *
* Called before nfapi_vnf_config_req to allocate a vnf phy instance. This * Called before nfapi_vnf_config_req to allocate a vnf phy instance. This
* function will return unqiue phy_id to be used for this identify the phy * function will return unqiue phy_id to be used for this identify the phy
* *
@@ -655,16 +653,16 @@ typedef struct nfapi_vnf_p7_config
* If not set the vnf p7 library will use malloc * If not set the vnf p7 library will use malloc
*/ */
void* (*malloc)(size_t size); void* (*malloc)(size_t size);
/*! A user define callback to override the default memory deallocation /*! A user define callback to override the default memory deallocation
* \param ptr Pointer to a memory block to deallocate * \param ptr Pointer to a memory block to deallocate
* *
* If not set the vnf p7 library will use free * If not set the vnf p7 library will use free
*/ */
void (*free)(void*); void (*free)(void*);
/*! A user define callback to handle trace from the pnf /*! A user define callback to handle trace from the pnf
* \param level The trace level * \param level The trace level
* \param message The trace string * \param message The trace string
*/ */
void (*trace)(nfapi_trace_level_t level, const char* message, ...); void (*trace)(nfapi_trace_level_t level, const char* message, ...);
@@ -706,172 +704,172 @@ typedef struct nfapi_vnf_p7_config
* *
* \todo Need some way the tell the VNF how long it has * \todo Need some way the tell the VNF how long it has
*/ */
int (*subframe_indication)(struct nfapi_vnf_p7_config* config, uint16_t phy_id, uint16_t sfn_sf); int (*subframe_indication)(struct nfapi_vnf_p7_config* config, uint16_t phy_id, uint16_t sfn_sf);
int (*slot_indication)(struct nfapi_vnf_p7_config* config, uint16_t phy_id, uint16_t sfn, uint16_t slot); int (*slot_indication)(struct nfapi_vnf_p7_config* config, uint16_t phy_id, uint16_t sfn, uint16_t slot);
/*! A callback for the HARQ.indication /*! A callback for the HARQ.indication
* \param config A pointer to the vnf p7 configuration * \param config A pointer to the vnf p7 configuration
* \param ind A data structure for the decoded HARQ.indication This will * \param ind A data structure for the decoded HARQ.indication This will
* have been allocated on the stack. * have been allocated on the stack.
* \return not currently used. * \return not currently used.
* *
* The ind may contain pointers to dyanmically allocated sub structures * The ind may contain pointers to dyanmically allocated sub structures
* such as the pdu. The dyanmically allocated structure will * such as the pdu. The dyanmically allocated structure will
* be deallocated on return. If the client wishes to 'keep' the structures * be deallocated on return. If the client wishes to 'keep' the structures
* then the substructure pointers should be set to 0 and then the client should * then the substructure pointers should be set to 0 and then the client should
* use the codec_config.deallocate function to release it at a future point * use the codec_config.deallocate function to release it at a future point
*/ */
int (*harq_indication)(struct nfapi_vnf_p7_config* config, nfapi_harq_indication_t* ind); int (*harq_indication)(struct nfapi_vnf_p7_config* config, nfapi_harq_indication_t* ind);
/*! A callback for the CRC.ind /*! A callback for the CRC.ind
* \param config A pointer to the vnf p7 configuration * \param config A pointer to the vnf p7 configuration
* \param ind A data structure for the decoded CRC.indication This will * \param ind A data structure for the decoded CRC.indication This will
* have been allocated on the stack. * have been allocated on the stack.
* \return not currently used. * \return not currently used.
* *
* The ind may contain pointers to dyanmically allocated sub structures * The ind may contain pointers to dyanmically allocated sub structures
* such as the pdu. The dyanmically allocated structure will * such as the pdu. The dyanmically allocated structure will
* be deallocated on return. If the client wishes to 'keep' the structures * be deallocated on return. If the client wishes to 'keep' the structures
* then the substructure pointers should be set to 0 and then the client should * then the substructure pointers should be set to 0 and then the client should
* use the codec_config.deallocate function to release it at a future point * use the codec_config.deallocate function to release it at a future point
*/ */
int (*crc_indication)(struct nfapi_vnf_p7_config* config, nfapi_crc_indication_t* ind); int (*crc_indication)(struct nfapi_vnf_p7_config* config, nfapi_crc_indication_t* ind);
/*! A callback for the RX_ULSCH.indication /*! A callback for the RX_ULSCH.indication
* \param config A pointer to the vnf p7 configuration * \param config A pointer to the vnf p7 configuration
* \param ind A data structure for the decoded RX_ULSCH.indication This will * \param ind A data structure for the decoded RX_ULSCH.indication This will
* have been allocated on the stack. * have been allocated on the stack.
* \return not currently used. * \return not currently used.
* *
* The ind may contain pointers to dyanmically allocated sub structures * The ind may contain pointers to dyanmically allocated sub structures
* such as the pdu. The dyanmically allocated structure will * such as the pdu. The dyanmically allocated structure will
* be deallocated on return. If the client wishes to 'keep' the structures * be deallocated on return. If the client wishes to 'keep' the structures
* then the substructure pointers should be set to 0 and then the client should * then the substructure pointers should be set to 0 and then the client should
* use the codec_config.deallocate function to release it at a future point * use the codec_config.deallocate function to release it at a future point
* *
* Note that the rx_indication may hold one or many uplink pdus in the * Note that the rx_indication may hold one or many uplink pdus in the
* ind.rx_indication_body.rx_pdu_list * ind.rx_indication_body.rx_pdu_list
*/ */
int (*rx_indication)(struct nfapi_vnf_p7_config* config, nfapi_rx_indication_t* ind); int (*rx_indication)(struct nfapi_vnf_p7_config* config, nfapi_rx_indication_t* ind);
/*! A callback for the RACH.indication /*! A callback for the RACH.indication
* \param config A pointer to the vnf p7 configuration * \param config A pointer to the vnf p7 configuration
* \param ind A data structure for the decoded RACH.indication This will * \param ind A data structure for the decoded RACH.indication This will
* have been allocated on the stack. * have been allocated on the stack.
* \return not currently used. * \return not currently used.
* *
* The ind may contain pointers to dyanmically allocated sub structures * The ind may contain pointers to dyanmically allocated sub structures
* such as the pdu. The dyanmically allocated structure will * such as the pdu. The dyanmically allocated structure will
* be deallocated on return. If the client wishes to 'keep' the structures * be deallocated on return. If the client wishes to 'keep' the structures
* then the substructure pointers should be set to 0 and then the client should * then the substructure pointers should be set to 0 and then the client should
* use the codec_config.deallocate function to release it at a future point * use the codec_config.deallocate function to release it at a future point
*/ */
int (*rach_indication)(struct nfapi_vnf_p7_config* config, nfapi_rach_indication_t* ind); int (*rach_indication)(struct nfapi_vnf_p7_config* config, nfapi_rach_indication_t* ind);
/*! A callback for the SRS.indication /*! A callback for the SRS.indication
* \param config A pointer to the vnf p7 configuration * \param config A pointer to the vnf p7 configuration
* \param ind A data structure for the decoded SRS.indication This will * \param ind A data structure for the decoded SRS.indication This will
* have been allocated on the stack. * have been allocated on the stack.
* \return not currently used. * \return not currently used.
* *
* The ind may contain pointers to dyanmically allocated sub structures * The ind may contain pointers to dyanmically allocated sub structures
* such as the pdu. The dyanmically allocated structure will * such as the pdu. The dyanmically allocated structure will
* be deallocated on return. If the client wishes to 'keep' the structures * be deallocated on return. If the client wishes to 'keep' the structures
* then the substructure pointers should be set to 0 and then the client should * then the substructure pointers should be set to 0 and then the client should
* use the codec_config.deallocate function to release it at a future point * use the codec_config.deallocate function to release it at a future point
*/ */
int (*srs_indication)(struct nfapi_vnf_p7_config* config, nfapi_srs_indication_t* ind); int (*srs_indication)(struct nfapi_vnf_p7_config* config, nfapi_srs_indication_t* ind);
/*! A callback for the RX_SR.indication /*! A callback for the RX_SR.indication
* \param config A pointer to the vnf p7 configuration * \param config A pointer to the vnf p7 configuration
* \param ind A data structure for the decoded RX_SR.indication This will * \param ind A data structure for the decoded RX_SR.indication This will
* have been allocated on the stack. * have been allocated on the stack.
* \return not currently used. * \return not currently used.
* *
* The ind may contain pointers to dyanmically allocated sub structures * The ind may contain pointers to dyanmically allocated sub structures
* such as the pdu. The dyanmically allocated structure will * such as the pdu. The dyanmically allocated structure will
* be deallocated on return. If the client wishes to 'keep' the structures * be deallocated on return. If the client wishes to 'keep' the structures
* then the substructure pointers should be set to 0 and then the client should * then the substructure pointers should be set to 0 and then the client should
* use the codec_config.deallocate function to release it at a future point * use the codec_config.deallocate function to release it at a future point
*/ */
int (*sr_indication)(struct nfapi_vnf_p7_config* config, nfapi_sr_indication_t* ind); int (*sr_indication)(struct nfapi_vnf_p7_config* config, nfapi_sr_indication_t* ind);
/*! A callback for the RX_CQI.indication /*! A callback for the RX_CQI.indication
* \param config A pointer to the vnf p7 configuration * \param config A pointer to the vnf p7 configuration
* \param ind A data structure for the decoded RX_CQI.indication This will * \param ind A data structure for the decoded RX_CQI.indication This will
* have been allocated on the stack. * have been allocated on the stack.
* \return not currently used. * \return not currently used.
* *
* The ind may contain pointers to dyanmically allocated sub structures * The ind may contain pointers to dyanmically allocated sub structures
* such as the pdu. The dyanmically allocated structure will * such as the pdu. The dyanmically allocated structure will
* be deallocated on return. If the client wishes to 'keep' the structures * be deallocated on return. If the client wishes to 'keep' the structures
* then the substructure pointers should be set to 0 and then the client should * then the substructure pointers should be set to 0 and then the client should
* use the codec_config.deallocate function to release it at a future point * use the codec_config.deallocate function to release it at a future point
*/ */
int (*cqi_indication)(struct nfapi_vnf_p7_config* config, nfapi_cqi_indication_t* ind); int (*cqi_indication)(struct nfapi_vnf_p7_config* config, nfapi_cqi_indication_t* ind);
/*! A callback for the LBT_DL.indication /*! A callback for the LBT_DL.indication
* \param config A pointer to the vnf p7 configuration * \param config A pointer to the vnf p7 configuration
* \param ind A data structure for the decoded LBT_DL.indication This will * \param ind A data structure for the decoded LBT_DL.indication This will
* have been allocated on the stack. * have been allocated on the stack.
* \return not currently used. * \return not currently used.
* *
* The ind may contain pointers to dyanmically allocated sub structures * The ind may contain pointers to dyanmically allocated sub structures
* such as the pdu. The dyanmically allocated structure will * such as the pdu. The dyanmically allocated structure will
* be deallocated on return. If the client wishes to 'keep' the structures * be deallocated on return. If the client wishes to 'keep' the structures
* then the substructure pointers should be set to 0 and then the client should * then the substructure pointers should be set to 0 and then the client should
* use the codec_config.deallocate function to release it at a future point * use the codec_config.deallocate function to release it at a future point
*/ */
int (*lbt_dl_indication)(struct nfapi_vnf_p7_config* config, nfapi_lbt_dl_indication_t* ind); int (*lbt_dl_indication)(struct nfapi_vnf_p7_config* config, nfapi_lbt_dl_indication_t* ind);
/*! A callback for the NB_HARQ.indication /*! A callback for the NB_HARQ.indication
* \param config A pointer to the vnf p7 configuration * \param config A pointer to the vnf p7 configuration
* \param ind A data structure for the decoded LBT_DL.indication This will * \param ind A data structure for the decoded LBT_DL.indication This will
* have been allocated on the stack. * have been allocated on the stack.
* \return not currently used. * \return not currently used.
* *
* The ind may contain pointers to dyanmically allocated sub structures * The ind may contain pointers to dyanmically allocated sub structures
* such as the pdu. The dyanmically allocated structure will * such as the pdu. The dyanmically allocated structure will
* be deallocated on return. If the client wishes to 'keep' the structures * be deallocated on return. If the client wishes to 'keep' the structures
* then the substructure pointers should be set to 0 and then the client should * then the substructure pointers should be set to 0 and then the client should
* use the codec_config.deallocate function to release it at a future point * use the codec_config.deallocate function to release it at a future point
*/ */
int (*nb_harq_indication)(struct nfapi_vnf_p7_config* config, nfapi_nb_harq_indication_t* ind); int (*nb_harq_indication)(struct nfapi_vnf_p7_config* config, nfapi_nb_harq_indication_t* ind);
/*! A callback for the NRACH.indication /*! A callback for the NRACH.indication
* \param config A pointer to the vnf p7 configuration * \param config A pointer to the vnf p7 configuration
* \param ind A data structure for the decoded LBT_DL.indication This will * \param ind A data structure for the decoded LBT_DL.indication This will
* have been allocated on the stack. * have been allocated on the stack.
* \return not currently used. * \return not currently used.
* *
* The ind may contain pointers to dyanmically allocated sub structures * The ind may contain pointers to dyanmically allocated sub structures
* such as the pdu. The dyanmically allocated structure will * such as the pdu. The dyanmically allocated structure will
* be deallocated on return. If the client wishes to 'keep' the structures * be deallocated on return. If the client wishes to 'keep' the structures
* then the substructure pointers should be set to 0 and then the client should * then the substructure pointers should be set to 0 and then the client should
* use the codec_config.deallocate function to release it at a future point * use the codec_config.deallocate function to release it at a future point
*/ */
int (*nrach_indication)(struct nfapi_vnf_p7_config* config, nfapi_nrach_indication_t* ind); int (*nrach_indication)(struct nfapi_vnf_p7_config* config, nfapi_nrach_indication_t* ind);
/*! A callback for any vendor extension messages /*! A callback for any vendor extension messages
* \param config A pointer to the vnf p7 configuration * \param config A pointer to the vnf p7 configuration
* \param msg A data structure for the decoded vendor extention message allocated * \param msg A data structure for the decoded vendor extention message allocated
* using the allocate_p7_vendor_ext callback * using the allocate_p7_vendor_ext callback
* \return not currently used. * \return not currently used.
*/ */
int (*vendor_ext)(struct nfapi_vnf_p7_config* config, nfapi_p7_message_header_t* msg); int (*vendor_ext)(struct nfapi_vnf_p7_config* config, nfapi_p7_message_header_t* msg);
/*! Optional userdata that will be passed back in the callbacks*/ /*! Optional userdata that will be passed back in the callbacks*/
void* user_data; void* user_data;
/*! A callback to allocate a memory for a vendor extension message /*! A callback to allocate a memory for a vendor extension message
* \param message_id The message is taken from the p7 message header * \param message_id The message is taken from the p7 message header
* \param msg_size The is the vendor extention message that has been allocated. * \param msg_size The is the vendor extention message that has been allocated.
* The callee must set this value * The callee must set this value
* \return A pointer to an allocated vendor extention message * \return A pointer to an allocated vendor extention message
*/ */
nfapi_p7_message_header_t* (*allocate_p7_vendor_ext)(uint16_t message_id, uint16_t* msg_size); nfapi_p7_message_header_t* (*allocate_p7_vendor_ext)(uint16_t message_id, uint16_t* msg_size);
/*! A callback to deallocate a vendor extension message /*! A callback to deallocate a vendor extension message
* \param header A pointer to an allocated vendor extention message * \param header A pointer to an allocated vendor extention message
*/ */
@@ -890,7 +888,7 @@ nfapi_vnf_p7_config_t* nfapi_vnf_p7_config_create(void);
* *
* The pointer to the config will not long be valid after this call * The pointer to the config will not long be valid after this call
*/ */
void nfapi_vnf_p7_config_destory(nfapi_vnf_p7_config_t* config); void nfapi_vnf_p7_config_destory(nfapi_vnf_p7_config_t* config);
/*! Start the VNF P7 library. /*! Start the VNF P7 library.
@@ -898,17 +896,17 @@ void nfapi_vnf_p7_config_destory(nfapi_vnf_p7_config_t* config);
* \return A status value. 0 equal success, -1 indicates failure * \return A status value. 0 equal success, -1 indicates failure
* *
* This function is blocking and will not return until the nfapi_vnf_p7_stop * This function is blocking and will not return until the nfapi_vnf_p7_stop
* function is called. * function is called.
*/ */
int nfapi_vnf_p7_start(nfapi_vnf_p7_config_t* config); int nfapi_vnf_p7_start(nfapi_vnf_p7_config_t* config);
int nfapi_nr_vnf_p7_start(nfapi_vnf_p7_config_t* config); int nfapi_nr_vnf_p7_start(nfapi_vnf_p7_config_t* config);
/*! Stop the VNF P7 library. /*! Stop the VNF P7 library.
* \param config A pointer to an vnf p7 configuration structure * \param config A pointer to an vnf p7 configuration structure
* \return A status value. 0 equal success, -1 indicates failure * \return A status value. 0 equal success, -1 indicates failure
* *
* This function will cause the nfapi_vnf_p7_start function to return * This function will cause the nfapi_vnf_p7_start function to return
*/ */
int nfapi_vnf_p7_stop(nfapi_vnf_p7_config_t* config); int nfapi_vnf_p7_stop(nfapi_vnf_p7_config_t* config);
@@ -929,7 +927,7 @@ int nfapi_vnf_p7_release_pdu(nfapi_vnf_p7_config_t* config, void*);
/*! Add a vnf p7 instance to the vnf p7 module /*! Add a vnf p7 instance to the vnf p7 module
* \param config A pointer to the vnf p7 configuration * \param config A pointer to the vnf p7 configuration
* \param pnf_p7_addr The udp address the pnf p7 entity has chosen * \param pnf_p7_addr The udp address the pnf p7 entity has chosen
* \param pnf_p7_port The udp port the pnf p7 entity has chosen * \param pnf_p7_port The udp port the pnf p7 entity has chosen
* \param phy_id The unique phy id for the pnf p7 entity * \param phy_id The unique phy id for the pnf p7 entity
* \return A status value. 0 equal success, -1 indicates failure * \return A status value. 0 equal success, -1 indicates failure
@@ -953,7 +951,7 @@ int nfapi_vnf_p7_del_pnf(nfapi_vnf_p7_config_t* config, int phy_id);
* \param config A pointer to the vnf p7 configuration * \param config A pointer to the vnf p7 configuration
* \param req A data structure for the decoded DL_CONFIG.request. * \param req A data structure for the decoded DL_CONFIG.request.
* \return A status value. 0 equal success, -1 indicates failure * \return A status value. 0 equal success, -1 indicates failure
* *
* The caller is responsiable for memory management of any pointers set in the req, which * The caller is responsiable for memory management of any pointers set in the req, which
* may be released after this function call has returned or at a later pointer * may be released after this function call has returned or at a later pointer
*/ */
@@ -964,7 +962,7 @@ int nfapi_vnf_p7_nr_dl_config_req(nfapi_vnf_p7_config_t* config, nfapi_nr_dl_tti
* \param config A pointer to the vnf p7 configuration * \param config A pointer to the vnf p7 configuration
* \param req A data structure for the decoded UL_CONFIG.request. * \param req A data structure for the decoded UL_CONFIG.request.
* \return A status value. 0 equal success, -1 indicates failure * \return A status value. 0 equal success, -1 indicates failure
* *
* The caller is responsiable for memory management of any pointers set in the req, which * The caller is responsiable for memory management of any pointers set in the req, which
* may be released after this function call has returned or at a later pointer * may be released after this function call has returned or at a later pointer
*/ */
@@ -974,7 +972,7 @@ int nfapi_vnf_p7_ul_tti_req(nfapi_vnf_p7_config_t* config, nfapi_nr_ul_tti_reque
* \param config A pointer to the vnf p7 configuration * \param config A pointer to the vnf p7 configuration
* \param req A data structure for the decoded HI_DCI0.request. * \param req A data structure for the decoded HI_DCI0.request.
* \return A status value. 0 equal success, -1 indicates failure * \return A status value. 0 equal success, -1 indicates failure
* *
* The caller is responsiable for memory management of any pointers set in the req, which * The caller is responsiable for memory management of any pointers set in the req, which
* may be released after this function call has returned or at a later pointer * may be released after this function call has returned or at a later pointer
*/ */
@@ -984,7 +982,7 @@ int nfapi_vnf_p7_ul_dci_req(nfapi_vnf_p7_config_t* config, nfapi_nr_ul_dci_reque
* \param config A pointer to the vnf p7 configuration * \param config A pointer to the vnf p7 configuration
* \param req A data structure for the decoded HI_DCI0.request. * \param req A data structure for the decoded HI_DCI0.request.
* \return A status value. 0 equal success, -1 indicates failure * \return A status value. 0 equal success, -1 indicates failure
* *
* The caller is responsiable for memory management of any pointers set in the req, which * The caller is responsiable for memory management of any pointers set in the req, which
* may be released after this function call has returned or at a later pointer * may be released after this function call has returned or at a later pointer
*/ */
@@ -994,7 +992,7 @@ int nfapi_vnf_p7_tx_data_req(nfapi_vnf_p7_config_t* config, nfapi_nr_tx_data_req
* \param config A pointer to the vnf p7 configuration * \param config A pointer to the vnf p7 configuration
* \param req A data structure for the decoded LBT_DL_CONFIG.request. * \param req A data structure for the decoded LBT_DL_CONFIG.request.
* \return A status value. 0 equal success, -1 indicates failure * \return A status value. 0 equal success, -1 indicates failure
* *
* The caller is responsiable for memory management of any pointers set in the req, which * The caller is responsiable for memory management of any pointers set in the req, which
* may be released after this function call has returned or at a later pointer * may be released after this function call has returned or at a later pointer
*/ */
@@ -1004,7 +1002,7 @@ int nfapi_vnf_p7_lbt_dl_config_req(nfapi_vnf_p7_config_t* config, nfapi_lbt_dl_c
* \param config A pointer to the vnf p7 configuration * \param config A pointer to the vnf p7 configuration
* \param msg A data structure for the decoded vendor extention message * \param msg A data structure for the decoded vendor extention message
* \return A status value. 0 equal success, -1 indicates failure * \return A status value. 0 equal success, -1 indicates failure
* *
* The caller is responsiable for memory management of any pointers set in the req, which * The caller is responsiable for memory management of any pointers set in the req, which
* may be released after this function call has returned or at a later pointer * may be released after this function call has returned or at a later pointer
*/ */
+11 -4
View File
@@ -23,9 +23,14 @@
#include <string.h> #include <string.h>
#include <unistd.h> #include <unistd.h>
#include <errno.h> #include <errno.h>
#include <assert.h>
#include "vnf_p7.h" #include "vnf_p7.h"
#ifdef NDEBUG
# warning assert is disabled
#endif
#define SYNC_CYCLE_COUNT 2 #define SYNC_CYCLE_COUNT 2
void* vnf_p7_malloc(vnf_p7_t* vnf_p7, size_t size) 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; uint16_t i = 0;
for(i = 0; i < ind.rx_indication_body.number_of_pdus; ++i) 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"); 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); 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: case NFAPI_RX_ULSCH_INDICATION:
{ {
nfapi_rx_indication_t* rx_ind = (nfapi_rx_indication_t*)(header); nfapi_rx_indication_t* rx_ind = (nfapi_rx_indication_t*)(header);
uint16_t i = 0; size_t number_of_pdus = rx_ind->rx_indication_body.number_of_pdus;
for(i = 0; i < rx_ind->rx_indication_body.number_of_pdus; ++i) 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); vnf_p7_codec_free(vnf_p7, rx_ind->rx_indication_body.rx_pdu_list[i].data);
} }
+2 -1
View File
@@ -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"); AssertFatal(eNB!=NULL,"eNB is null\n");
for (i=0; i<NUMBER_OF_UE_MAX; i++) { 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) && if ((eNB->ulsch[i]->harq_mask >0) &&
(eNB->ulsch[i]->rnti==rnti)) return i; (eNB->ulsch[i]->rnti==rnti)) return i;
+1 -1
View File
@@ -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}; //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 //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}; 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};
+1 -1
View File
@@ -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}; //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 //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}; 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};
+1 -1
View File
@@ -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}; //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 //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}; 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};
+6
View File
@@ -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); pthread_mutex_lock(&eNB->UL_INFO_mutex);
nfapi_sr_indication_t *sr_ind = &eNB->UL_INFO.sr_ind; nfapi_sr_indication_t *sr_ind = &eNB->UL_INFO.sr_ind;
nfapi_sr_indication_body_t *sr_ind_body = &sr_ind->sr_indication_body; 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]; 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->sfn_sf = frame<<4|subframe;
sr_ind->header.message_id = NFAPI_RX_SR_INDICATION; 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); pthread_mutex_lock(&eNB->UL_INFO_mutex);
eNB->UL_INFO.rx_ind.sfn_sf = frame<<4| subframe; 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; 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 = &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.handle = eNB->ulsch[UE_id]->handle;
pdu->rx_ue_information.tl.tag = NFAPI_RX_UE_INFORMATION_TAG; 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) { 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); 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_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]; 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; 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"); //AssertFatal(UE_id>=0,"UE_id doesn't exist\n");
pthread_mutex_lock(&eNB->UL_INFO_mutex); 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]; 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 M;
int i; 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); pthread_mutex_lock(&eNB->UL_INFO_mutex);
nfapi_harq_indication_t *ind = &eNB->UL_INFO.harq_ind; nfapi_harq_indication_t *ind = &eNB->UL_INFO.harq_ind;
nfapi_harq_indication_body_t *body = &ind->harq_indication_body; 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]; 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->sfn_sf = frame<<4|subframe;
ind->header.message_id = NFAPI_HARQ_INDICATION; 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) { 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); 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]; 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.sfn_sf = frame<<4 | subframe;
eNB->UL_INFO.crc_ind.header.message_id = NFAPI_CRC_INDICATION; eNB->UL_INFO.crc_ind.header.message_id = NFAPI_CRC_INDICATION;
+2 -1
View File
@@ -44,7 +44,7 @@
#include "LTE_SRB-ToAddModList.h" #include "LTE_SRB-ToAddModList.h"
#include "LTE_MBMS-SessionInfoList-r9.h" #include "LTE_MBMS-SessionInfoList-r9.h"
#include "LTE_PMCH-InfoList-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, typedef rlc_op_status_t (*send_rlc_data_req_func_t)(const protocol_ctxt_t *const,
const srb_flag_t, const MBMS_flag_t, 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, const MBMS_flag_t, const rb_id_t, const sdu_size_t,
mem_block_t *,const uint32_t *const, const uint32_t *const); 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 ENB_NAS_USE_TUN_W_MBMS_BIT (1<< 10)
#define PDCP_USE_NETLINK_BIT (1<< 11) #define PDCP_USE_NETLINK_BIT (1<< 11)
#define LINK_ENB_PDCP_TO_IP_DRIVER_BIT (1<< 13) #define LINK_ENB_PDCP_TO_IP_DRIVER_BIT (1<< 13)
+53 -19
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); 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) { 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); 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 else
{ {
if( LOG_DEBUGFLAG(DEBUG_PDCP) ) if( LOG_DEBUGFLAG(DEBUG_PDCP) )
log_dump(PDCP, pdcpData, pdcpHead->data_size, LOG_DUMP_CHAR, log_dump(PDCP, pdcpData, pdcpHead->data_size, LOG_DUMP_CHAR,
"PDCP output to be sent to TUN interface: \n"); "PDCP output to be sent to TUN interface: \n");
ret = write(nas_sock_fd[pdcpHead->inst], pdcpData, pdcpHead->data_size); 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); ret,rb_id,nas_sock_fd[pdcpHead->inst], pdcpHead->data_size);
} }
} else if (ENB_NAS_USE_TUN) { } 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, log_dump(PDCP, pdcpData, pdcpHead->data_size, LOG_DUMP_CHAR,
"PDCP output to be sent to TUN interface: \n"); "PDCP output to be sent to TUN interface: \n");
ret = write(nas_sock_fd[0], pdcpData, pdcpHead->data_size); 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; nas_nlh_tx->nlmsg_len = sizeToWrite;
ret = sendmsg(nas_sock_fd[0],&nas_msg_tx,0); ret = sendmsg(nas_sock_fd[0],&nas_msg_tx,0);
} // PDCP_USE_NETLINK } // 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]); 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) ) 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; pdcp_t *pdcp_p = NULL;
int len; int len;
rb_id_t rab_id = DEFAULT_RAB_ID; 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, 1 );
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_FIFO_READ_BUFFER, 1 ); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_FIFO_READ_BUFFER, 1 );
if (ue_id_g == 0) len = read(sockd, &nl_rx_buf, NL_MAX_PAYLOAD);
{
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; 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;
}
/* 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))
{
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;
}
if (UE_NAS_USE_TUN) { if (UE_NAS_USE_TUN) {
key = PDCP_COLL_KEY_DEFAULT_DRB_VALUE(ctxt.module_id, ctxt.rnti, ctxt.enb_flag); 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.frame, ctxt.instance, rab_id, len, ctxt.module_id,
ctxt.rnti, rab_id, key); ctxt.rnti, rab_id, key);
} }
} while (len > 0); }
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_FIFO_READ, 0 ); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_FIFO_READ, 0 );
return len; return len;
@@ -644,9 +669,19 @@ void pdcp_fifo_read_input_sdus_frompc5s (const protocol_ctxt_t *const ctxt_pP)
//TTN for D2D (PC5S) //TTN for D2D (PC5S)
// receive a message from ProSe App // receive a message from ProSe App
memset(receive_buf, 0, BUFSIZE); 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); (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) { if (bytes_received > 0) {
pc5s_header = calloc(1, sizeof(pc5s_header_t)); pc5s_header = calloc(1, sizeof(pc5s_header_t));
memcpy((void *)pc5s_header, (void *)receive_buf, 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); exit(1);
} }
} }
+14 -4
View File
@@ -96,8 +96,9 @@ void handle_sr(UL_IND_t *UL_info) {
oai_nfapi_sr_indication(&UL_info->sr_ind); oai_nfapi_sr_indication(&UL_info->sr_ind);
} }
} else if(NFAPI_MODE == NFAPI_MODE_VNF) { } 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) { 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++) { for (i=0; i<UL_RCC_INFO.sr_ind[j].sr_indication_body.number_of_srs; i++) {
SR_indication(UL_info->module_id, SR_indication(UL_info->module_id,
UL_info->CC_id, UL_info->CC_id,
@@ -113,6 +114,7 @@ void handle_sr(UL_IND_t *UL_info) {
} }
} }
} else { } 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++) for (i=0; i<UL_info->sr_ind.sr_indication_body.number_of_srs; i++)
SR_indication(UL_info->module_id, SR_indication(UL_info->module_id,
UL_info->CC_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; UL_info->cqi_ind.cqi_indication_body.number_of_cqis=0;
} }
} else if (NFAPI_MODE == NFAPI_MODE_VNF) { } 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) { 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++) { for (i=0; i<UL_RCC_INFO.cqi_ind[j].cqi_indication_body.number_of_cqis; i++) {
cqi_indication(UL_info->module_id, cqi_indication(UL_info->module_id,
UL_info->CC_id, UL_info->CC_id,
@@ -157,6 +160,7 @@ void handle_cqi(UL_IND_t *UL_info) {
} }
} }
} else { } 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++) for (i=0; i<UL_info->cqi_ind.cqi_indication_body.number_of_cqis; i++)
cqi_indication(UL_info->module_id, cqi_indication(UL_info->module_id,
UL_info->CC_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; UL_info->harq_ind.harq_indication_body.number_of_harqs = 0;
} else if(NFAPI_MODE == NFAPI_MODE_VNF) { } 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) { 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++) { for (int i=0; i<UL_RCC_INFO.harq_ind[j].harq_indication_body.number_of_harqs; i++) {
harq_indication(UL_info->module_id, harq_indication(UL_info->module_id,
UL_info->CC_id, UL_info->CC_id,
@@ -198,6 +203,7 @@ void handle_harq(UL_IND_t *UL_info) {
} }
} }
} else { } 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++) for (int i=0; i < UL_info->harq_ind.harq_indication_body.number_of_harqs; i++)
harq_indication(UL_info->module_id, harq_indication(UL_info->module_id,
UL_info->CC_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; UL_info->rx_ind.rx_indication_body.number_of_pdus = 0;
} }
} else if(NFAPI_MODE == NFAPI_MODE_VNF) { } 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)) { 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++) { 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++) { 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 // 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", 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 { } else {
if (UL_info->rx_ind.rx_indication_body.number_of_pdus>0 && UL_info->crc_ind.crc_indication_body.number_of_crcs>0) { 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++) { 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++) { for (j=0; j<UL_info->crc_ind.crc_indication_body.number_of_crcs; j++) {
// find crc_indication j corresponding rx_indication i // 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, 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,
+7 -7
View File
@@ -88,25 +88,25 @@ typedef struct {
} UL_IND_t; } UL_IND_t;
// Downlink subframe P7 // Downlink subframe P7
#define NUM_NFPAI_SUBFRAME 10 #define NUM_NFAPI_SUBFRAME 10
typedef struct { typedef struct {
/// harq indication list /// harq indication list
nfapi_harq_indication_t harq_ind[NUM_NFPAI_SUBFRAME]; nfapi_harq_indication_t harq_ind[NUM_NFAPI_SUBFRAME];
/// crc indication list /// crc indication list
nfapi_crc_indication_t crc_ind[NUM_NFPAI_SUBFRAME]; nfapi_crc_indication_t crc_ind[NUM_NFAPI_SUBFRAME];
/// SR indication list /// SR indication list
nfapi_sr_indication_t sr_ind[NUM_NFPAI_SUBFRAME]; nfapi_sr_indication_t sr_ind[NUM_NFAPI_SUBFRAME];
/// CQI indication list /// CQI indication list
nfapi_cqi_indication_t cqi_ind[NUM_NFPAI_SUBFRAME]; nfapi_cqi_indication_t cqi_ind[NUM_NFAPI_SUBFRAME];
/// RACH indication list /// RACH indication list
nfapi_rach_indication_t rach_ind[NUM_NFPAI_SUBFRAME]; nfapi_rach_indication_t rach_ind[NUM_NFAPI_SUBFRAME];
/// RX indication /// RX indication
nfapi_rx_indication_t rx_ind[NUM_NFPAI_SUBFRAME]; nfapi_rx_indication_t rx_ind[NUM_NFAPI_SUBFRAME];
} UL_RCC_IND_t; } UL_RCC_IND_t;
+299 -15
View File
@@ -56,10 +56,19 @@ FILL_UL_INFO_MUTEX_t fill_ul_mutex;
int current_sfn_sf; int current_sfn_sf;
sem_t sfn_semaphore; sem_t sfn_semaphore;
static sf_rnti_mcs_s sf_rnti_mcs[NUM_NFAPI_SUBFRAME];
static int ue_tx_sock_descriptor = -1; static int ue_tx_sock_descriptor = -1;
static int ue_rx_sock_descriptor = -1; static int ue_rx_sock_descriptor = -1;
static int get_mcs_from_sinr(float sinr);
static int get_cqi_from_mcs(void);
static void read_channel_param(const nfapi_dl_config_request_pdu_t * pdu, int sf, int index);
static bool did_drop_transport_block(int sf, uint16_t rnti);
static float get_bler_val(uint8_t mcs, int sinr);
static bool should_drop_transport_block(int sf, uint16_t rnti);
static void save_dci_pdu_for_crnti(nfapi_dl_config_request_t *dl_config_req);
extern nfapi_tx_request_pdu_t* tx_request_pdu[1023][10][10]; extern nfapi_tx_request_pdu_t* tx_request_pdu[1023][NUM_NFAPI_SUBFRAME][10]; //TODO: NFAPI_TX_MAX_PDU for last dim? Check nfapi_pnf.c ln. 81
//extern int timer_subframe; //extern int timer_subframe;
//extern int timer_frame; //extern int timer_frame;
@@ -87,6 +96,7 @@ void fill_rx_indication_UE_MAC(module_id_t Mod_id,
UL_INFO->rx_ind.rx_indication_body.tl.tag = NFAPI_RX_INDICATION_BODY_TAG; UL_INFO->rx_ind.rx_indication_body.tl.tag = NFAPI_RX_INDICATION_BODY_TAG;
UL_INFO->rx_ind.vendor_extension = ul_config_req->vendor_extension; UL_INFO->rx_ind.vendor_extension = ul_config_req->vendor_extension;
assert(UL_INFO->rx_ind.rx_indication_body.number_of_pdus <= NFAPI_RX_IND_MAX_PDU);
pdu = &UL_INFO->rx_ind.rx_indication_body pdu = &UL_INFO->rx_ind.rx_indication_body
.rx_pdu_list[UL_INFO->rx_ind.rx_indication_body.number_of_pdus]; .rx_pdu_list[UL_INFO->rx_ind.rx_indication_body.number_of_pdus];
// pdu = &UL_INFO->rx_ind.rx_indication_body.rx_pdu_list[index]; // pdu = &UL_INFO->rx_ind.rx_indication_body.rx_pdu_list[index];
@@ -134,6 +144,7 @@ void fill_sr_indication_UE_MAC(int Mod_id,
nfapi_sr_indication_t *sr_ind = &UL_INFO->sr_ind; nfapi_sr_indication_t *sr_ind = &UL_INFO->sr_ind;
nfapi_sr_indication_body_t *sr_ind_body = &sr_ind->sr_indication_body; 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]; nfapi_sr_indication_pdu_t *pdu = &sr_ind_body->sr_pdu_list[sr_ind_body->number_of_srs];
UL_INFO->sr_ind.vendor_extension = ul_config_req->vendor_extension; UL_INFO->sr_ind.vendor_extension = ul_config_req->vendor_extension;
@@ -272,6 +283,7 @@ void fill_ulsch_cqi_indication_UE_MAC(int Mod_id,
pthread_mutex_lock(&fill_ul_mutex.cqi_mutex); pthread_mutex_lock(&fill_ul_mutex.cqi_mutex);
LOG_D(MAC, "num_cqis: %u in fill_ulsch_cqi_indication_UE_MAC\n", LOG_D(MAC, "num_cqis: %u in fill_ulsch_cqi_indication_UE_MAC\n",
UL_INFO->cqi_ind.cqi_indication_body.number_of_cqis); UL_INFO->cqi_ind.cqi_indication_body.number_of_cqis);
assert(UL_INFO->cqi_ind.cqi_indication_body.number_of_cqis <= NFAPI_CQI_IND_MAX_PDU);
nfapi_cqi_indication_pdu_t *pdu = nfapi_cqi_indication_pdu_t *pdu =
&UL_INFO->cqi_ind.cqi_indication_body &UL_INFO->cqi_ind.cqi_indication_body
.cqi_pdu_list[UL_INFO->cqi_ind.cqi_indication_body.number_of_cqis]; .cqi_pdu_list[UL_INFO->cqi_ind.cqi_indication_body.number_of_cqis];
@@ -301,7 +313,7 @@ void fill_ulsch_cqi_indication_UE_MAC(int Mod_id,
pdu->ul_cqi_information.channel = 1; pdu->ul_cqi_information.channel = 1;
// eNB_scheduler_primitives.c:4839: the upper four bits seem to be the CQI // eNB_scheduler_primitives.c:4839: the upper four bits seem to be the CQI
const int cqi = 15; const int cqi = get_cqi_from_mcs();
raw_pdu->pdu[0] = cqi << 4; raw_pdu->pdu[0] = cqi << 4;
UL_INFO->cqi_ind.cqi_indication_body.number_of_cqis++; UL_INFO->cqi_ind.cqi_indication_body.number_of_cqis++;
@@ -319,6 +331,7 @@ void fill_ulsch_harq_indication_UE_MAC(
nfapi_ul_config_request_t *ul_config_req) { nfapi_ul_config_request_t *ul_config_req) {
pthread_mutex_lock(&fill_ul_mutex.harq_mutex); pthread_mutex_lock(&fill_ul_mutex.harq_mutex);
assert(UL_INFO->harq_ind.harq_indication_body.number_of_harqs <= NFAPI_HARQ_IND_MAX_PDU);
nfapi_harq_indication_pdu_t *pdu = nfapi_harq_indication_pdu_t *pdu =
&UL_INFO->harq_ind.harq_indication_body.harq_pdu_list &UL_INFO->harq_ind.harq_indication_body.harq_pdu_list
[UL_INFO->harq_ind.harq_indication_body.number_of_harqs]; [UL_INFO->harq_ind.harq_indication_body.number_of_harqs];
@@ -365,6 +378,7 @@ void fill_uci_harq_indication_UE_MAC(int Mod_id,
nfapi_harq_indication_t *ind = &UL_INFO->harq_ind; nfapi_harq_indication_t *ind = &UL_INFO->harq_ind;
nfapi_harq_indication_body_t *body = &ind->harq_indication_body; nfapi_harq_indication_body_t *body = &ind->harq_indication_body;
assert(UL_INFO->harq_ind.harq_indication_body.number_of_harqs <= NFAPI_HARQ_IND_MAX_PDU);
nfapi_harq_indication_pdu_t *pdu = nfapi_harq_indication_pdu_t *pdu =
&body->harq_pdu_list[UL_INFO->harq_ind.harq_indication_body &body->harq_pdu_list[UL_INFO->harq_ind.harq_indication_body
.number_of_harqs]; .number_of_harqs];
@@ -382,7 +396,7 @@ void fill_uci_harq_indication_UE_MAC(int Mod_id,
pdu->ul_cqi_information.tl.tag = NFAPI_UL_CQI_INFORMATION_TAG; pdu->ul_cqi_information.tl.tag = NFAPI_UL_CQI_INFORMATION_TAG;
int SNRtimes10 = 640; int SNRtimes10 = 640; // TODO: Replace with EpiSci SNR * 10
if (SNRtimes10 < -640) if (SNRtimes10 < -640)
pdu->ul_cqi_information.ul_cqi = 0; pdu->ul_cqi_information.ul_cqi = 0;
@@ -405,6 +419,17 @@ void fill_uci_harq_indication_UE_MAC(int Mod_id,
pdu->harq_indication_fdd_rel13.harq_tb_n[0] = pdu->harq_indication_fdd_rel13.harq_tb_n[0] =
1; // Assuming always an ACK (No NACK or DTX) 1; // Assuming always an ACK (No NACK or DTX)
// TODO: Fix ack/dtx -- needed for 5G
// 1.) if received dl_config_req (with c-rnti) store this info and corresponding subframe.
// 2.) if receiving ul_config_req for uci ack/nack or ulsch ack/nak in subframe n
// go look to see if dl_config_req (with c-rnti) was received in subframe (n - 4)
// 3.) if the answer to #2 is yes then send ACK IF NOT send DTX
if (did_drop_transport_block(((subframe+6) % 10), rnti)) // TODO: Handle DTX. Also discuss handling PDCCH
{
pdu->harq_indication_fdd_rel13.harq_tb_n[0] = 2;
LOG_I(PHY, "Setting HARQ No ACK - Channel Model\n");
}
} else if ((harq_information->harq_information_rel9_fdd.ack_nack_mode == 0) } else if ((harq_information->harq_information_rel9_fdd.ack_nack_mode == 0)
&& (harq_information->harq_information_rel9_fdd.harq_size && (harq_information->harq_information_rel9_fdd.harq_size
== 2)) { == 2)) {
@@ -797,10 +822,17 @@ void dl_config_req_UE_MAC_dci(int sfn,
sfn, sf, dci->pdu_size, sfn, sf, dci->pdu_size,
dlsch->dlsch_pdu.dlsch_pdu_rel8.pdu_index, dlsch->dlsch_pdu.dlsch_pdu_rel8.pdu_index,
tx_req_pdu_list->num_pdus); tx_req_pdu_list->num_pdus);
ue_send_sdu(ue_id, 0, sfn, sf, if (!should_drop_transport_block(sf, dci->dci_dl_pdu.dci_dl_pdu_rel8.rnti))
tx_req_pdu_list->pdus[pdu_index].segments[0].segment_data, {
tx_req_pdu_list->pdus[pdu_index].segments[0].segment_length, ue_send_sdu(ue_id, 0, sfn, sf,
0); tx_req_pdu_list->pdus[pdu_index].segments[0].segment_data,
tx_req_pdu_list->pdus[pdu_index].segments[0].segment_length,
0);
}
else
{
LOG_I(MAC, "Transport Block discarded - ue_send_sdu not called. sf: %d", sf);
}
return; return;
} }
} }
@@ -809,7 +841,6 @@ void dl_config_req_UE_MAC_dci(int sfn,
for (int ue_id = 0; ue_id < num_ue; ue_id++) { for (int ue_id = 0; ue_id < num_ue; ue_id++) {
if (UE_mac_inst[ue_id].UE_mode[0] == NOT_SYNCHED) if (UE_mac_inst[ue_id].UE_mode[0] == NOT_SYNCHED)
continue; continue;
ue_decode_si(ue_id, 0, sfn, 0, ue_decode_si(ue_id, 0, sfn, 0,
tx_req_pdu_list->pdus[pdu_index].segments[0].segment_data, tx_req_pdu_list->pdus[pdu_index].segments[0].segment_data,
tx_req_pdu_list->pdus[pdu_index].segments[0].segment_length); tx_req_pdu_list->pdus[pdu_index].segments[0].segment_length);
@@ -818,6 +849,7 @@ void dl_config_req_UE_MAC_dci(int sfn,
for (int ue_id = 0; ue_id < num_ue; ue_id++) { for (int ue_id = 0; ue_id < num_ue; ue_id++) {
LOG_I(MAC, "%s() Received paging message: sfn/sf:%d.%d\n", LOG_I(MAC, "%s() Received paging message: sfn/sf:%d.%d\n",
__func__, sfn, sf); __func__, sfn, sf);
ue_decode_p(ue_id, 0, sfn, 0, ue_decode_p(ue_id, 0, sfn, 0,
tx_req_pdu_list->pdus[pdu_index].segments[0].segment_data, tx_req_pdu_list->pdus[pdu_index].segments[0].segment_data,
tx_req_pdu_list->pdus[pdu_index].segments[0].segment_length); tx_req_pdu_list->pdus[pdu_index].segments[0].segment_length);
@@ -840,6 +872,7 @@ void dl_config_req_UE_MAC_dci(int sfn,
LOG_E(MAC, LOG_E(MAC,
"%s(): Received RAR, PreambleIndex: %d\n", "%s(): Received RAR, PreambleIndex: %d\n",
__func__, UE_mac_inst[ue_id].RA_prach_resources.ra_PreambleIndex); __func__, UE_mac_inst[ue_id].RA_prach_resources.ra_PreambleIndex);
ue_process_rar(ue_id, 0, sfn, ue_process_rar(ue_id, 0, sfn,
ra_rnti, //RA-RNTI ra_rnti, //RA-RNTI
tx_req_pdu_list->pdus[pdu_index].segments[0].segment_data, tx_req_pdu_list->pdus[pdu_index].segments[0].segment_data,
@@ -853,7 +886,7 @@ void dl_config_req_UE_MAC_dci(int sfn,
UE_mac_inst[ue_id].first_ULSCH_Tx = 1; UE_mac_inst[ue_id].first_ULSCH_Tx = 1;
} }
} }
} }
//else if (dl_config_pdu_list[i].pdu_type == NFAPI_DL_CONFIG_BCH_PDU_TYPE) { //else if (dl_config_pdu_list[i].pdu_type == NFAPI_DL_CONFIG_BCH_PDU_TYPE) {
// // BCH case: Last parameter is 1 if first time synchronization and zero // // BCH case: Last parameter is 1 if first time synchronization and zero
// // otherwise. Not sure which value to put for our case. // // otherwise. Not sure which value to put for our case.
@@ -882,7 +915,7 @@ void dl_config_req_UE_MAC_dci(int sfn,
// tx_request_pdu_list[pdu_index].segments[0].segment_length, // tx_request_pdu_list[pdu_index].segments[0].segment_length,
// 0,0); // 0,0);
//} //}
else { else {
LOG_W(MAC, "can not handle special RNTI %x\n", rnti); LOG_W(MAC, "can not handle special RNTI %x\n", rnti);
} }
@@ -1070,7 +1103,7 @@ int memcpy_hi_dci0_req (L1_rxtx_proc_t *proc,
if (!is_my_hi_dci0_req(req)) if (!is_my_hi_dci0_req(req))
{ {
LOG_W(MAC, "Filtering hi_dci0_req\n"); LOG_I(MAC, "Filtering hi_dci0_req\n");
return 0; return 0;
} }
nfapi_hi_dci0_request_t *p = (nfapi_hi_dci0_request_t *)malloc(sizeof(nfapi_hi_dci0_request_t)); nfapi_hi_dci0_request_t *p = (nfapi_hi_dci0_request_t *)malloc(sizeof(nfapi_hi_dci0_request_t));
@@ -1230,8 +1263,7 @@ void *ue_standalone_pnf_task(void *context)
{ {
struct sockaddr_in server_address; struct sockaddr_in server_address;
socklen_t addr_len = sizeof(server_address); socklen_t addr_len = sizeof(server_address);
char buffer[1024]; char buffer[NFAPI_MAX_PACKED_MESSAGE_SIZE];
int sd = ue_rx_sock_descriptor; int sd = ue_rx_sock_descriptor;
assert(sd > 0); assert(sd > 0);
@@ -1241,12 +1273,18 @@ void *ue_standalone_pnf_task(void *context)
bool dl_config_req_valid = false; bool dl_config_req_valid = false;
while (true) while (true)
{ {
ssize_t len = recvfrom(sd, buffer, sizeof(buffer), 0, (struct sockaddr *)&server_address, &addr_len); ssize_t len = recvfrom(sd, buffer, sizeof(buffer), MSG_TRUNC, (struct sockaddr *)&server_address, &addr_len);
if (len == -1) if (len == -1)
{ {
LOG_E(MAC, "reading from standalone pnf sctp socket failed \n"); LOG_E(MAC, "reading from standalone pnf sctp socket failed \n");
continue; continue;
} }
if (len > sizeof(buffer))
{
LOG_E(MAC, "%s(%d). Message truncated. %zd\n", __FUNCTION__, __LINE__, len);
continue;
}
/* First we'll check for possible messages from the proxy. We do this by checking /* First we'll check for possible messages from the proxy. We do this by checking
the length of the message. This works because sizeof(uint16_t) < sizeof(nfapi_p7_message_header_t) the length of the message. This works because sizeof(uint16_t) < sizeof(nfapi_p7_message_header_t)
and sizeof(phy_channel_params_t) < sizeof(nfapi_p7_message_header_t) and and sizeof(phy_channel_params_t) < sizeof(nfapi_p7_message_header_t) and
@@ -1263,6 +1301,26 @@ void *ue_standalone_pnf_task(void *context)
abort(); abort();
} }
} }
else if (len == sizeof(channel_info))
{
channel_info * ch_info = malloc(sizeof(channel_info));
memcpy(ch_info, buffer, sizeof(channel_info));
current_sfn_sf = ch_info->sfn_sf;
if (sem_post(&sfn_semaphore) != 0)
{
LOG_E(MAC, "sem_post() error\n");
abort();
}
uint16_t sf = ch_info->sfn_sf & 15;
if(sf > 10 && sf < 0)
{
LOG_E(MAC, "sf out of bounds, sfn: %d\n", sf);
abort();
}
sf_rnti_mcs[sf].sinr = ch_info->sinr;
LOG_D(MAC, "Received_SINR = %f\n",ch_info->sinr);
}
else if (len == sizeof(phy_channel_params_t)) else if (len == sizeof(phy_channel_params_t))
{ {
phy_channel_params_t ch_info; phy_channel_params_t ch_info;
@@ -1304,6 +1362,9 @@ void *ue_standalone_pnf_task(void *context)
dl_config_req.sfn_sf & 15); dl_config_req.sfn_sf & 15);
dl_config_req_valid = true; dl_config_req_valid = true;
save_dci_pdu_for_crnti(&dl_config_req);
if (tx_req_valid) if (tx_req_valid)
{ {
if (dl_config_req.sfn_sf != tx_req.sfn_sf) if (dl_config_req.sfn_sf != tx_req.sfn_sf)
@@ -1396,6 +1457,30 @@ void *ue_standalone_pnf_task(void *context)
} }
} }
static void save_dci_pdu_for_crnti(nfapi_dl_config_request_t *dl_config_req)
{
int count_sent = 0;
int number_of_dci = dl_config_req->dl_config_request_body.number_dci;
int number_of_pdu = dl_config_req->dl_config_request_body.number_pdu;
if (number_of_pdu <= 0)
{
LOG_E(MAC, "%s: dl_config_req pdu size <= 0\n", __FUNCTION__);
abort();
}
if (number_of_dci > 0)
{
for (int n = 0; n < number_of_pdu; n++)
{
const nfapi_dl_config_request_pdu_t *current_pdu_list = &dl_config_req->dl_config_request_body.dl_config_pdu_list[n];
int rnti_type = current_pdu_list->dci_dl_pdu.dci_dl_pdu_rel8.rnti_type;
if (current_pdu_list->pdu_type == NFAPI_DL_CONFIG_DCI_DL_PDU_TYPE && rnti_type == 1 && count_sent < number_of_dci)
{
read_channel_param(current_pdu_list, (dl_config_req->sfn_sf & 15), count_sent);
count_sent++;
}
}
}
}
void *memcpy_dl_config_req_standalone(nfapi_dl_config_request_t *dl_config_req) void *memcpy_dl_config_req_standalone(nfapi_dl_config_request_t *dl_config_req)
{ {
@@ -1538,6 +1623,7 @@ static void print_rx_ind(nfapi_rx_indication_t *p)
printf("rx_indication_body.tl.length: %u\n", p->rx_indication_body.tl.length); printf("rx_indication_body.tl.length: %u\n", p->rx_indication_body.tl.length);
printf("rx_indication_body.number_of_pdus: %u\n", p->rx_indication_body.number_of_pdus); printf("rx_indication_body.number_of_pdus: %u\n", p->rx_indication_body.number_of_pdus);
assert(p->rx_indication_body.number_of_pdus <= NFAPI_RX_IND_MAX_PDU);
nfapi_rx_indication_pdu_t *pdu = p->rx_indication_body.rx_pdu_list; nfapi_rx_indication_pdu_t *pdu = p->rx_indication_body.rx_pdu_list;
for (int i = 0; i < p->rx_indication_body.number_of_pdus; i++) for (int i = 0; i < p->rx_indication_body.number_of_pdus; i++)
{ {
@@ -1562,7 +1648,7 @@ static void print_rx_ind(nfapi_rx_indication_t *p)
void send_standalone_msg(UL_IND_t *UL, nfapi_message_id_e msg_type) void send_standalone_msg(UL_IND_t *UL, nfapi_message_id_e msg_type)
{ {
int encoded_size = -1; int encoded_size = -1;
char buffer[1024]; char buffer[NFAPI_MAX_PACKED_MESSAGE_SIZE];
switch (msg_type) switch (msg_type)
{ {
@@ -1837,3 +1923,201 @@ char *nfapi_ul_config_req_to_string(nfapi_ul_config_request_t *req)
void init_eNB_afterRU(void) void init_eNB_afterRU(void)
{ {
} }
static int get_mcs_from_sinr(float sinr)
{
if (sinr < (bler_data[0].bler_table[0][0]))
{
LOG_I(MAC, "The SINR was found is smaller than first MCS table\n");
return 0;
}
if (sinr > (bler_data[NUM_MCS-1].bler_table[bler_data[NUM_MCS-1].length - 1][0]))
{
LOG_I(MAC, "The SINR was found is larger than last MCS table\n");
return NUM_MCS-1;
}
for (int n = NUM_MCS-1; n >= 0; n--)
{
CHECK_INDEX(bler_data, n);
float largest_sinr = (bler_data[n].bler_table[bler_data[n].length - 1][0]);
float smallest_sinr = (bler_data[n].bler_table[0][0]);
if (sinr < largest_sinr && sinr > smallest_sinr)
{
LOG_I(MAC, "The SINR was found in MCS %d table\n", n);
return n;
}
}
LOG_E(MAC, "Unable to get an MCS value.\n");
abort();
}
static int get_cqi_from_mcs(void)
{
static const int mcs_to_cqi[] = {0, 1, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15};
assert(NUM_ELEMENTS(mcs_to_cqi) == NUM_MCS);
int sf = 0;
while(sf < NUM_NFAPI_SUBFRAME)
{
if (sf_rnti_mcs[sf].latest)
{
int pdu_size = sf_rnti_mcs[sf].pdu_size;
if (pdu_size <= 0)
{
LOG_E(MAC, "%s: sf_rnti_mcs[%d].pdu_size = 0\n", __FUNCTION__, sf);
abort();
}
CHECK_INDEX(sf_rnti_mcs[sf].mcs, pdu_size);
int mcs = get_mcs_from_sinr(sf_rnti_mcs[sf].sinr);
CHECK_INDEX(mcs_to_cqi, mcs);
int cqi = mcs_to_cqi[mcs];
LOG_I(MAC, "SINR: %f -> MCS: %d -> CQI: %d\n", sf_rnti_mcs[sf].sinr, mcs, cqi);
return cqi;
}
sf++;
}
LOG_E(MAC, "Unable to get CQI value because no MCS found\n");
abort();
}
static void read_channel_param(const nfapi_dl_config_request_pdu_t * pdu, int sf, int index)
{
if (pdu == NULL)
{
LOG_E(MAC,"PDU NULL\n");
abort();
}
/* This function is executed for every dci pdu type in a dl_config_req. We save
the assocaited MCS and RNTI value for each. The 'index' passed in is a count of
how many times we have called this function for a particular dl_config_req. It
allows us to save MCS/RNTI data in correct indicies when multiple dci's are received.*/
for (int i = 0; i < NUM_NFAPI_SUBFRAME; i++)
{
if (i == sf)
{
CHECK_INDEX(sf_rnti_mcs[sf].rnti, index);
CHECK_INDEX(sf_rnti_mcs[sf].mcs, index);
CHECK_INDEX(sf_rnti_mcs[sf].drop_flag, index);
sf_rnti_mcs[sf].rnti[index] = pdu->dci_dl_pdu.dci_dl_pdu_rel8.rnti;
sf_rnti_mcs[sf].mcs[index] = pdu->dci_dl_pdu.dci_dl_pdu_rel8.mcs_1;
sf_rnti_mcs[sf].drop_flag[index] = false;
sf_rnti_mcs[sf].pdu_size = index+1; //index starts at 0 so we incrament to get num of pdus
sf_rnti_mcs[sf].latest = true;
LOG_I(MAC, "Adding MCS %d and RNTI %x for sf_rnti_mcs[%d]\n", sf_rnti_mcs[sf].mcs[index], sf_rnti_mcs[sf].rnti[index], sf);
}
else
{
sf_rnti_mcs[i].latest = false;
}
}
return;
}
static bool did_drop_transport_block(int sf, uint16_t rnti)
{
int pdu_size = sf_rnti_mcs[sf].pdu_size;
if(pdu_size <= 0)
{
LOG_E(MAC, "Problem, the PDU size is <= 0. We dropped this packet\n");
return true;
}
CHECK_INDEX(sf_rnti_mcs[sf].rnti, pdu_size);
CHECK_INDEX(sf_rnti_mcs[sf].drop_flag, pdu_size);
for (int n = 0; n < pdu_size; n++)
{
if (sf_rnti_mcs[sf].rnti[n] == rnti && sf_rnti_mcs[sf].drop_flag[n])
{
return true;
}
}
return false;
}
static float get_bler_val(uint8_t mcs, int sinr)
{
// 4th col = dropped packets, 5th col = total packets
float bler_val = 0.0;
CHECK_INDEX(bler_data, mcs);
if (sinr < (int)(bler_data[mcs].bler_table[0][0] * 10))
{
LOG_I(MAC, "MCS %d table. SINR is smaller than lowest SINR, bler_val is set based on lowest SINR in table\n", mcs);
bler_val = bler_data[mcs].bler_table[0][4] / bler_data[mcs].bler_table[0][5];
return bler_val;
}
if (sinr > (int)(bler_data[mcs].bler_table[bler_data[mcs].length - 1][0] * 10))
{
LOG_I(MAC, "MCS %d table. SINR is greater than largest SINR. bler_val is set based on largest SINR in table\n", mcs);
bler_val = bler_data[mcs].bler_table[(bler_data[mcs].length - 1)][4] / bler_data[mcs].bler_table[(bler_data[mcs].length - 1)][5];
return bler_val;
}
// Loop through bler table to find sinr_index
for (int i = 0; i < bler_data[mcs].length; i++)
{
int temp_sinr = (int)(bler_data[mcs].bler_table[i][0] * 10);
if (temp_sinr == sinr)
{
bler_val = bler_data[mcs].bler_table[i][4] / bler_data[mcs].bler_table[i][5];
return bler_val;
}
// Linear interpolation when SINR is between indices
if (temp_sinr > sinr)
{
float bler_val1 = bler_data[mcs].bler_table[i - 1][4] / bler_data[mcs].bler_table[i - 1][5];
float bler_val2 = bler_data[mcs].bler_table[i][4] / bler_data[mcs].bler_table[i][5];
return ((bler_val1 + bler_val2) / 2);
}
}
LOG_E(MAC, "NO SINR INDEX FOUND!\n");
abort();
}
static bool should_drop_transport_block(int sf, uint16_t rnti)
{
/* Get block error rate (bler_val) from table based on every saved
MCS and SINR to be used as the cutoff rate for dropping packets.
Generate random uniform vairable to compare against bler_val. */
int pdu_size = sf_rnti_mcs[sf].pdu_size;
assert(sf < 10 && sf >= 0);
assert(pdu_size > 0);
CHECK_INDEX(sf_rnti_mcs[sf].rnti, pdu_size);
CHECK_INDEX(sf_rnti_mcs[sf].mcs, pdu_size);
CHECK_INDEX(sf_rnti_mcs[sf].drop_flag, pdu_size);
int n = 0;
uint8_t mcs = 99;
for (n = 0; n < pdu_size; n++)
{
if (sf_rnti_mcs[sf].rnti[n] == rnti)
{
mcs = sf_rnti_mcs[sf].mcs[n];
}
if (mcs != 99)
{
/* Use MCS to get the bler value. Since there can be multiple MCS
values for a particular subframe, we verify that all PDUs are not
flagged for drop before returning. If even one is flagged for drop
we return immediately because we drop the entire packet. */
float bler_val = get_bler_val(mcs, ((int)(sf_rnti_mcs[sf].sinr * 10)));
double drop_cutoff = ((double) rand() / (RAND_MAX));
assert(drop_cutoff <= 1);
LOG_I(MAC, "SINR = %f, Bler_val = %f, MCS = %"PRIu8"\n", sf_rnti_mcs[sf].sinr, bler_val, sf_rnti_mcs[sf].mcs[n]);
if (drop_cutoff <= bler_val)
{
sf_rnti_mcs[sf].drop_flag[n] = true;
LOG_D(MAC, "We are dropping this packet. Bler_val = %f, MCS = %"PRIu8", sf = %d\n", bler_val, sf_rnti_mcs[sf].mcs[n], sf);
return sf_rnti_mcs[sf].drop_flag[n];
}
}
}
if (mcs == 99)
{
LOG_E(MAC, "NO MCS Found for rnti %x. sf_rnti_mcs[%d].mcs[%d] \n", rnti, sf, n);
abort();
}
return false;
}
+31
View File
@@ -19,8 +19,13 @@
//#include "openair1/PHY/LTE_TRANSPORT/defs.h" //#include "openair1/PHY/LTE_TRANSPORT/defs.h"
//#include "openair1/PHY/defs.h" //#include "openair1/PHY/defs.h"
//#include "openair1/PHY/LTE_TRANSPORT/defs.h" //#include "openair1/PHY/LTE_TRANSPORT/defs.h"
#include "nfapi/open-nFAPI/pnf/inc/pnf_p7.h"
#include "queue.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. // this mutex is used to set multiple UE's UL value in L2 FAPI simulator.
extern FILL_UL_INFO_MUTEX_t fill_ul_mutex; extern FILL_UL_INFO_MUTEX_t fill_ul_mutex;
//below 2 difinitions move to phy_stub_UE.c to add initialization when difinition. //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; //module_id_t next_Mod_id;
eth_params_t stub_eth_params; 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];
+10 -2
View File
@@ -421,7 +421,8 @@ void rrc_ue_generate_RRCConnectionRequest( const protocol_ctxt_t *const ctxt_pP,
#endif #endif
LOG_T(RRC,"%x.",rv[i]); 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__, __func__,
rv[0], rv[0],
rv[1], 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"); LOG_I(RRC,"Listening to incoming connection from ProSe App \n");
// receive a message from ProSe App // receive a message from ProSe App
memset(receive_buf, 0, BUFSIZE); 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); (struct sockaddr *) &prose_app_addr, (socklen_t *)&prose_addr_len);
if (n < 0) { if (n < 0) {
LOG_E(RRC, "ERROR: Failed to receive from ProSe App\n"); LOG_E(RRC, "ERROR: Failed to receive from ProSe App\n");
exit(EXIT_FAILURE); 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 //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; //sl_ctrl_msg_recv = (struct sidelink_ctrl_element *) receive_buf;
+5 -1
View File
@@ -409,10 +409,14 @@ static int socket_udp_receive(int socket_fd, void *buf, int size)
socklen_t slen = sizeof(client); socklen_t slen = sizeof(client);
int l; 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); //getsockname(socket_fd, (struct sockaddr *)&client, &slen);
if (l == -1) goto error; if (l == -1) goto error;
if (l == 0) goto socket_closed; 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; return l;
+1 -1
View File
@@ -221,7 +221,7 @@ NwGtpv1uRcT gtpv1u_eNB_process_stack_req(
* - END-MARKER * - END-MARKER
*/ */
case NW_GTPV1U_ULP_API_RECV_TPDU: { case NW_GTPV1U_ULP_API_RECV_TPDU: {
uint8_t buffer[4096]; uint8_t buffer[NFAPI_MAX_PACKED_MESSAGE_SIZE];
uint32_t buffer_len; uint32_t buffer_len;
struct rrc_eNB_ue_context_s *ue_context_p; struct rrc_eNB_ue_context_s *ue_context_p;
uint16_t msgType = NW_GTP_GPDU; uint16_t msgType = NW_GTP_GPDU;
+1
View File
@@ -29,6 +29,7 @@
#include "hashtable.h" #include "hashtable.h"
#include "LTE_asn_constant.h" #include "LTE_asn_constant.h"
#include "nfapi/open-nFAPI/pnf/inc/pnf_p7.h"
#ifndef GTPV1U_ENB_DEFS_H_ #ifndef GTPV1U_ENB_DEFS_H_
#define GTPV1U_ENB_DEFS_H_ #define GTPV1U_ENB_DEFS_H_
+5 -2
View File
@@ -235,7 +235,7 @@ udp_eNB_send_to(
void udp_eNB_receiver(struct udp_socket_desc_s *udp_sock_pP) 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; int n;
socklen_t from_len; socklen_t from_len;
struct sockaddr_in addr; struct sockaddr_in addr;
@@ -246,10 +246,13 @@ void udp_eNB_receiver(struct udp_socket_desc_s *udp_sock_pP)
if (1) { if (1) {
from_len = (socklen_t)sizeof(struct sockaddr_in); 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) { (struct sockaddr *)&addr, &from_len)) < 0) {
LOG_E(UDP_, "Recvfrom failed %s\n", strerror(errno)); LOG_E(UDP_, "Recvfrom failed %s\n", strerror(errno));
return; return;
} else if (n > sizeof(l_buffer)) {
LOG_E(UDP_, "%s(%d). Message truncated. %d\n", __FUNCTION__, __LINE__, n);
return;
} else if (n == 0) { } else if (n == 0) {
LOG_W(UDP_, "Recvfrom returned 0\n"); LOG_W(UDP_, "Recvfrom returned 0\n");
return; return;
+1
View File
@@ -31,6 +31,7 @@
#ifndef UDP_ENB_TASK_H_ #ifndef UDP_ENB_TASK_H_
#define UDP_ENB_TASK_H_ #define UDP_ENB_TASK_H_
#include "enb_config.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 /** \brief UDP recv callback prototype. Will be called every time a payload is
+2
View File
@@ -761,6 +761,7 @@ int main ( int argc, char **argv )
LOG_I(ENB_APP,"oai_exit=%d\n",oai_exit); LOG_I(ENB_APP,"oai_exit=%d\n",oai_exit);
// stop threads // 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 (RC.nb_inst == 0 || !NODE_IS_CU(node_type)) {
if(IS_SOFTMODEM_DOFORMS) if(IS_SOFTMODEM_DOFORMS)
end_forms(); end_forms();
@@ -802,6 +803,7 @@ int main ( int argc, char **argv )
} }
} }
} }
#endif
pdcp_module_cleanup(); pdcp_module_cleanup();
terminate_opt(); terminate_opt();
+2
View File
@@ -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 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 #endif
+9 -8
View File
@@ -1040,16 +1040,16 @@ static void *UE_phy_stub_standalone_pnf_task(void *arg)
UE = rtd->UE; UE = rtd->UE;
UL_INFO = (UL_IND_t *)calloc(1, sizeof(UL_IND_t)); 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->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->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->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->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_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(NUMBER_OF_UE_MAX, sizeof(nfapi_cqi_indication_raw_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; UL_INFO->cqi_ind.cqi_indication_body.number_of_cqis = 0;
proc->subframe_rx = proc->sub_frame_start; 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; 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; 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", " with number of PDUs: %u\n",
NFAPI_SFNSF2SFN(dl_config_req->sfn_sf), NFAPI_SFNSF2SF(dl_config_req->sfn_sf), NFAPI_SFNSF2SFN(dl_config_req->sfn_sf), NFAPI_SFNSF2SF(dl_config_req->sfn_sf),
dl_num_pdus); 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); send_standalone_msg(UL_INFO, UL_INFO->rx_ind.header.message_id);
sent_any = true; 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); free(UL_INFO->rx_ind.rx_indication_body.rx_pdu_list[num_pdu].data);
} }
+69
View File
@@ -193,6 +193,8 @@ int oaisim_flag=0;
*/ */
uint8_t abstraction_flag=0; uint8_t abstraction_flag=0;
bler_struct bler_data[NUM_MCS];
/* forward declarations */ /* forward declarations */
void set_default_frame_parms(LTE_DL_FRAME_PARMS *frame_parms[MAX_NUM_CCs]); 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(&hi_dci0_req_queue);
init_queue(&ul_config_req_queue); init_queue(&ul_config_req_queue);
init_bler_table();
config_sync_var=0; config_sync_var=0;
if (sem_init(&sfn_semaphore, 0, 0) != 0) if (sem_init(&sfn_semaphore, 0, 0) != 0)
{ {
@@ -845,3 +849,68 @@ int main( int argc, char **argv ) {
printf("Bye.\n"); printf("Bye.\n");
return 0; 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);
}
}