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);
} }
+3 -1
View File
@@ -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 {
+6 -1
View File
@@ -1973,11 +1973,13 @@ 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)
{ {
@@ -2376,4 +2382,3 @@ int pnf_nr_message_pump(pnf_t* pnf)
return 0; return 0;
} }
-1
View File
@@ -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
@@ -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
*/ */
+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)
+49 -15
View File
@@ -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;
+297 -13
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,
@@ -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);
}
}