diff --git a/.vscode/launch.json b/.vscode/launch.json index 44ca96f23328917f83fc2f47a0c0e73e83db77a7..d8aa6aaaaa026520f5e9118f75dc9dd542b64868 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -64,15 +64,49 @@ } ] } + { + "name": "(rfsim) PNF", + "type": "cppdbg", + "request": "launch", + "program": " /home/glab/NR_nfapi/openairinterface5g/cmake_targets/ran_build/build/nr-softmodem", + "args": ["RFSIMULATOR=server","-O", + "/home/glab/NR_nfapi/openairinterface5g/targets/PROJECTS/GENERIC-LTE-EPC/CONF/oaiL1.nfapi.usrpx300.conf", + "--pnf", + "--parallel-config", + "PARALLEL_SINGLE_THREAD", + "--rfsim"], + "stopAtEntry": false, + "cwd": "${workspaceFolder}", + "environment": [], + "externalConsole": false, + "MIMode": "gdb", + "miDebuggerPath": "/usr/bin/gdb", + "setupCommands": [ + { + "description": "Enable pretty-printing for gdb", + "text": "-enable-pretty-printing", + "ignoreFailures": true + } + ] + } + + { "name": "(gdb) Launch GNB", "type": "cppdbg", "request": "launch", - "program": "/home/glab/NR_nfapi/openairinterface5g/cmake_targets/ran_build/build/nr-softmodem", - "args": ["-E", - "-O ", - "/home/glab/NR_nfapi/openairinterface5g/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpn300.conf","--parallel-config","PARALLEL_SINGLE_THREAD", - "--rfsim","--phy-test"], + "program": " /home/glab/NR_nfapi/openairinterface5g/cmake_targets/ran_build/build/nr-softmodem", + + + // "/home/glab/NR_nfapi/openairinterface5g/cmake_targets/ran_build/build/nr-softmodem", + // "args": [, + // "-O ", + // "/home/glab/NR_nfapi/openairinterface5g/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpn300.conf", + // "--parallel-config", + // "PARALLEL_SINGLE_THREAD", + // "--rfsim", + // "--phy-test"], + "args":["-O","/home/glab/NR_nfapi/openairinterface5g/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpx300.conf"], "stopAtEntry": false, "cwd": "${workspaceFolder}", "environment": [], diff --git a/nfapi/CHANGES.md b/nfapi/CHANGES.md new file mode 100644 index 0000000000000000000000000000000000000000..b086cabf0441179e1bb15e303ff3abe8857828e9 --- /dev/null +++ b/nfapi/CHANGES.md @@ -0,0 +1,38 @@ +# Changelog + +### 14/06/20 +* we are not clear on how the parameters are extracted from the config file +* in ssc struct +* for some values it is okay and for others it is zero (in `config_request`) +* This causes Assertion Failures leading to termination on PNF side. + +### 15/06/20 +* The values to config request are assigned in: `config_common()` in `config.c` +* need to add lines for `cfg->nfapi_config` +* the config request unpacked on pnf side still has some zero values, which causes assertional failure in from_nrarfcn() + +### 16/06/20 +* Config request is recived and unpacked correctly +* Regarding config response + * we are confused about its' struct definition + * it says list of TLVs in its entirety + * and we need to dyanmically insert the invalid TLVs after checking in a categorical fashion + * Need to think of a data structure to enable this feature. + ```struct{ + list of uint8_t tlvs + list of uint16_t tlvs + list of uint32_t tlvs + }list of tlvs + ``` +* Need the `N_RB` value to be non-zero and obtained from the config file. (carrier config grid size) +`int N_RB = gNB_config->carrier_config.dl_grid_size[gNB_config->ssb_config.scs_common.value].value;` +* how is this `gNB_config` assigned its values? + +### 19/06/20 +* `ret = openair0_device_load(&ru->rfdevice,&ru->openair0_cfg);` sloc: 1428 in `nr-ru.c` +* the `ru->rfdevice` has all members zero or null. +* This issue was solved by adding `sdr_addrs` to config file of PNF. + +* `if (cfg->tdd_table.max_tdd_periodicity_list[nr_tti].max_num_of_symbol_per_slot_list[symbol_count].slot_config.value==1` + * throws segmentation error + * `max_tdd_periodicity_list` is not assigned memory diff --git a/nfapi/README.md b/nfapi/README.md index b086cabf0441179e1bb15e303ff3abe8857828e9..bd62b1398986c8f28d74937c928e6ca2758ab3e3 100644 --- a/nfapi/README.md +++ b/nfapi/README.md @@ -1,38 +1,21 @@ -# Changelog +## Running using USRP +### PNF +``` +sudo /cmake_targets/ran_build/build/nr-softmodem -O /targets/PROJECTS/GENERIC-LTE-EPC/CONF/oaiL1.nfapi.usrpx300.conf --pnf +``` -### 14/06/20 -* we are not clear on how the parameters are extracted from the config file -* in ssc struct -* for some values it is okay and for others it is zero (in `config_request`) -* This causes Assertion Failures leading to termination on PNF side. +### VNF +``` +sudo /cmake_targets/ran_build/build/nr-softmodem -O /targets/PROJECTS/GENERIC-LTE-EPC/CONF/rcc.band78.tm1.106PRB.nfapi.conf --vnf +``` -### 15/06/20 -* The values to config request are assigned in: `config_common()` in `config.c` -* need to add lines for `cfg->nfapi_config` -* the config request unpacked on pnf side still has some zero values, which causes assertional failure in from_nrarfcn() -### 16/06/20 -* Config request is recived and unpacked correctly -* Regarding config response - * we are confused about its' struct definition - * it says list of TLVs in its entirety - * and we need to dyanmically insert the invalid TLVs after checking in a categorical fashion - * Need to think of a data structure to enable this feature. - ```struct{ - list of uint8_t tlvs - list of uint16_t tlvs - list of uint32_t tlvs - }list of tlvs - ``` -* Need the `N_RB` value to be non-zero and obtained from the config file. (carrier config grid size) -`int N_RB = gNB_config->carrier_config.dl_grid_size[gNB_config->ssb_config.scs_common.value].value;` -* how is this `gNB_config` assigned its values? - -### 19/06/20 -* `ret = openair0_device_load(&ru->rfdevice,&ru->openair0_cfg);` sloc: 1428 in `nr-ru.c` -* the `ru->rfdevice` has all members zero or null. -* This issue was solved by adding `sdr_addrs` to config file of PNF. - -* `if (cfg->tdd_table.max_tdd_periodicity_list[nr_tti].max_num_of_symbol_per_slot_list[symbol_count].slot_config.value==1` - * throws segmentation error - * `max_tdd_periodicity_list` is not assigned memory +## Running using RF-Simulator +### PNF +``` +sudo RFSIMULATOR=server /cmake_targets/ran_build/build/nr-softmodem -O /targets/PROJECTS/GENERIC-LTE-EPC/CONF/oaiL1.nfapi.usrpx300.conf --pnf --parallel-config PARALLEL_SINGLE_THREAD --rfsim +``` +### VNF +``` +sudo /cmake_targets/ran_build/build/nr-softmodem -O /targets/PROJECTS/GENERIC-LTE-EPC/CONF/rcc.band78.tm1.106PRB.nfapi.conf --vnf +``` \ No newline at end of file diff --git a/nfapi/open-nFAPI/nfapi/src/nfapi_p5.c b/nfapi/open-nFAPI/nfapi/src/nfapi_p5.c index 7293477601104ac03bd20ace625d01799bf1d61a..639dcbdd3caa87f683825e542aea2c9117f994fd 100644 --- a/nfapi/open-nFAPI/nfapi/src/nfapi_p5.c +++ b/nfapi/open-nFAPI/nfapi/src/nfapi_p5.c @@ -704,7 +704,7 @@ static uint8_t pack_config_request(void *msg, uint8_t **ppWritePackedMsg, uint8_ pack_tlv(NFAPI_NR_CONFIG_SSB_SUBCARRIER_OFFSET_TAG, &(pNfapiMsg->ssb_table.ssb_subcarrier_offset), ppWritePackedMsg, end, &pack_uint8_tlv_value) && pack_tlv(NFAPI_NR_CONFIG_TDD_PERIOD_TAG, &(pNfapiMsg->tdd_table.tdd_period), ppWritePackedMsg, end, &pack_uint8_tlv_value) && - + pack_tlv(NFAPI_NR_NFAPI_DOWNLINK_UES_PER_SUBFRAME_TAG, &(pNfapiMsg->nfapi_config.dl_ue_per_sf), ppWritePackedMsg, end, &pack_uint8_tlv_value) && pack_tlv(NFAPI_NR_NFAPI_MAXIMUM_TRANSMIT_POWER_TAG, &(pNfapiMsg->nfapi_config.max_transmit_power), ppWritePackedMsg, end, &pack_uint16_tlv_value) && pack_tlv(NFAPI_NR_NFAPI_NRARFCN_TAG, &(pNfapiMsg->nfapi_config.nrarfcn), ppWritePackedMsg, end, &pack_uint32_tlv_value) && @@ -1644,6 +1644,7 @@ static uint8_t unpack_config_request(uint8_t **ppReadPackedMsg, uint8_t *end, vo { NFAPI_NR_CONFIG_SSB_PERIOD_TAG, &(pNfapiMsg->ssb_table.ssb_period), &unpack_uint8_tlv_value}, { NFAPI_NR_CONFIG_SSB_SUBCARRIER_OFFSET_TAG, &(pNfapiMsg->ssb_table.ssb_subcarrier_offset), &unpack_uint8_tlv_value}, { NFAPI_NR_CONFIG_TDD_PERIOD_TAG, &(pNfapiMsg->tdd_table.tdd_period), &unpack_uint8_tlv_value}, + { NFAPI_NR_NFAPI_DOWNLINK_UES_PER_SUBFRAME_TAG, &(pNfapiMsg->nfapi_config.dl_ue_per_sf), &unpack_uint8_tlv_value}, { NFAPI_NR_NFAPI_MAXIMUM_TRANSMIT_POWER_TAG, &(pNfapiMsg->nfapi_config.max_transmit_power), &unpack_uint16_tlv_value}, { NFAPI_NR_NFAPI_NRARFCN_TAG, &(pNfapiMsg->nfapi_config.nrarfcn), &unpack_uint32_tlv_value}, diff --git a/nfapi/open-nFAPI/pnf/src/pnf.c b/nfapi/open-nFAPI/pnf/src/pnf.c index 2bc8320466863c78f1f61106988aefe4d225690e..b90c15870864ba0473f5309f1dee072bcc69f4be 100644 --- a/nfapi/open-nFAPI/pnf/src/pnf.c +++ b/nfapi/open-nFAPI/pnf/src/pnf.c @@ -30,6 +30,25 @@ #include "nfapi_nr_interface_scf.h" #include "pnf.h" +# if 1 // for hard-code (remove later) +#include "COMMON/platform_types.h" +#include "COMMON/platform_constants.h" +#include "common/ran_context.h" + +#include "common/utils/LOG/log.h" +#include "common/utils/LOG/vcd_signal_dumper.h" + +#include "NR_BCCH-BCH-Message.h" +#include "NR_ServingCellConfigCommon.h" + +#include "LAYER2/NR_MAC_gNB/mac_proto.h" +#include "SCHED_NR/phy_frame_config_nr.h" + +#include "NR_MIB.h" +#include "openair2/LAYER2/NR_MAC_gNB/nr_mac_common.h" + +#endif + #define MAX_SCTP_STREAMS 16 void nfapi_pnf_phy_config_delete_all(nfapi_pnf_config_t* config) @@ -353,6 +372,11 @@ void pnf_handle_config_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen) if(config->state == NFAPI_PNF_RUNNING) { nfapi_pnf_phy_config_t* phy = nfapi_pnf_phy_config_find(config, req.header.phy_id); + +#if 1 // emulate set_config TLV reception (hard-code) + int tdd_return = set_tdd_config_nr(&req, 1, 7, 6, 2, 4); +#endif + if(phy) { if(phy->state != NFAPI_PNF_PHY_RUNNING) @@ -360,6 +384,8 @@ void pnf_handle_config_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen) if(config->config_req) { (config->config_req)(config, phy, &req); + + } } else diff --git a/openair1/SCHED_NR/phy_frame_config_nr.c b/openair1/SCHED_NR/phy_frame_config_nr.c index efbcd805ce6d15bb4ece0eb84982854a1dd0b205..9fe093c4d03e557260799ebf940334f5b13c2105 100644 --- a/openair1/SCHED_NR/phy_frame_config_nr.c +++ b/openair1/SCHED_NR/phy_frame_config_nr.c @@ -118,7 +118,9 @@ int set_tdd_config_nr( nfapi_nr_config_request_scf_t *cfg, while(slot_number != nb_slots_to_set) { if(nrofDownlinkSlots != 0) { for (int number_of_symbol = 0; number_of_symbol < nrofDownlinkSlots*NR_NUMBER_OF_SYMBOLS_PER_SLOT; number_of_symbol++) { - cfg->tdd_table.max_tdd_periodicity_list[slot_number].max_num_of_symbol_per_slot_list[number_of_symbol%NR_NUMBER_OF_SYMBOLS_PER_SLOT].slot_config.value= 0; + cfg->tdd_table.max_tdd_periodicity_list[slot_number].max_num_of_symbol_per_slot_list[number_of_symbol%NR_NUMBER_OF_SYMBOLS_PER_SLOT].slot_config.value= 0; // was 0, made 10 to check + // cfg->tdd_table.max_tdd_periodicity_list[slot_number].max_num_of_symbol_per_slot_list[number_of_symbol%NR_NUMBER_OF_SYMBOLS_PER_SLOT].slot_config.tl.tag= NFAPI_NR_CONFIG_SLOT_CONFIG_TAG; + if((number_of_symbol+1)%NR_NUMBER_OF_SYMBOLS_PER_SLOT == 0) slot_number++; @@ -318,6 +320,7 @@ int nr_slot_select(nfapi_nr_config_request_scf_t *cfg, int nr_frame, int nr_tti) return (NR_UPLINK_SLOT | NR_DOWNLINK_SLOT ); } +#if 1 // Hardcoding, change later if (nr_frame%2 == 0) { for(int symbol_count=0; symbol_counttdd_table.max_tdd_periodicity_list[nr_tti].max_num_of_symbol_per_slot_list[symbol_count].slot_config.value==1) { @@ -367,6 +370,11 @@ int nr_slot_select(nfapi_nr_config_request_scf_t *cfg, int nr_frame, int nr_tti) return (NR_MIXED_SLOT); } } +#else + return (NR_DOWNLINK_SLOT); +#endif + + } /*******************************************************************