diff --git a/.vscode/launch.json b/.vscode/launch.json index a138bccfd1f3d0d042112896ffffc7079a3d47fc..6a76c83ab7a8bb3393692c614a82ed959791d021 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -22,11 +22,10 @@ "name": "(gdb) Launch VNF", "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/rcc.band78.tm1.106PRB.nfapi.conf", - "--vnf"], + "program": "/home/spclab/nfapimode/openairinterface5g/cmake_targets/ran_build/build/nr-softmodem", + "args": ["-O ", + "/home/spclab/nfapimode/openairinterface5g/targets/PROJECTS/GENERIC-LTE-EPC/CONF/rcc.band78.tm1.106PRB.nfapi.conf", + "--nfapi","2","--phy-test","--noS1"], "stopAtEntry": false, "cwd": "${workspaceFolder}", "environment": [], @@ -45,11 +44,11 @@ "name": "(gdb) Launch PNF", "type": "cppdbg", "request": "launch", - "program": "/home/glab/NR_nfapi/openairinterface5g/cmake_targets/ran_build/build/nr-softmodem", + "program": "/home/spclab/nfapimode/openairinterface5g/cmake_targets/ran_build/build/nr-softmodem", "args": ["-E", "-O ", - "/home/glab/NR_nfapi/openairinterface5g/targets/PROJECTS/GENERIC-LTE-EPC/CONF/oaiL1.nfapi.usrpx300.conf", - "--pnf"], + "/home/spclab/nfapimode/openairinterface5g/targets/PROJECTS/GENERIC-LTE-EPC/CONF/oaiL1.nfapi.usrpx300.conf", + "--nfapi","1"], "stopAtEntry": false, "cwd": "${workspaceFolder}", "environment": [], @@ -95,10 +94,10 @@ { - "name": "(gdb) Launch GNB", + "name": "(gdb) Launch UE", "type": "cppdbg", "request": "launch", - "program": " /home/glab/NR_nfapi/openairinterface5g/cmake_targets/ran_build/build/nr-softmodem", + "program": "/home/spclab/nfapimode/openairinterface5g/cmake_targets/ran_build/build/nr-uesoftmodem", // "/home/glab/NR_nfapi/openairinterface5g/cmake_targets/ran_build/build/nr-softmodem", @@ -109,7 +108,9 @@ // "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"], + "args":["--numerology","1","-r", "106", "-C" ,"3510000000" ,"--rfsim", + "--rfsimulator.serveraddr", + "127.0.0.1" ], "stopAtEntry": false, "cwd": "${workspaceFolder}", "environment": [], @@ -128,9 +129,9 @@ "name": "(rfsim) Launch GNB", "type": "cppdbg", "request": "launch", - "program": " /home/glab/NR_nfapi/openairinterface5g/cmake_targets/ran_build/build/nr-softmodem", + "program": "/home/spclab/nfapimode/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.usrpx300.conf", + "/home/spclab/nfapimode/openairinterface5g/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpn300.conf", "--rfsim", "--rfsimulator.serveraddr", "server", diff --git a/common/config/config_load_configmodule.c b/common/config/config_load_configmodule.c index e7c59b5a9aabb9e8064b44b0e8d91bec1ff227c4..a6682f6eeafeb3c3f3fc2162d40934f17547fa26 100644 --- a/common/config/config_load_configmodule.c +++ b/common/config/config_load_configmodule.c @@ -45,7 +45,7 @@ #define CONFIG_SHAREDLIBFORMAT "libparams_%s.so" #include "nfapi/oai_integration/vendor_ext.h" -uint8_t nfapi_mode=0; +extern uint8_t nfapi_mode; int load_config_sharedlib(configmodule_interface_t *cfgptr) { void *lib_handle; @@ -215,15 +215,15 @@ configmodule_interface_t *load_configmodule(int argc, tmpflags = CONFIG_HELP; } - if( strcmp(argv[i], "--vnf") == 0 ){ - printf("\nVNF ENABLED\n"); - nfapi_mode = NFAPI_MODE_VNF; - } + // if( strcmp(argv[i], "--vnf") == 0 ){ + // printf("\nVNF ENABLED\n"); + // nfapi_mode = NFAPI_MODE_VNF; + // } - if( strcmp(argv[i], "--pnf") == 0 ){ - printf("\nPNF ENABLED\n"); - nfapi_mode = NFAPI_MODE_PNF; - } + // if( strcmp(argv[i], "--pnf") == 0 ){ + // printf("\nPNF ENABLED\n"); + // nfapi_mode = NFAPI_MODE_PNF; + // } } diff --git a/executables/nr-gnb.c b/executables/nr-gnb.c index 59cacea56465b688b4fe94b72f6f81cb3d7d5a13..744aa59282fe8dcbc013f5bf86b8d288aed99faa 100644 --- a/executables/nr-gnb.c +++ b/executables/nr-gnb.c @@ -146,9 +146,6 @@ extern void add_subframe(uint16_t *frameP, uint16_t *subframeP, int offset); static inline int rxtx(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx, int frame_tx, int slot_tx, char *thread_name) { struct timespec current; clock_gettime(CLOCK_MONOTONIC, ¤t); -//LOG_I(PHY,"%sCurrent time %d.%d,frame_rx %d,slot_rx %d,frame_tx %d,slot_tx %d\n", __FUNCTION__, current.tv_sec,current.tv_nsec,frame_rx,slot_rx,frame_tx,slot_tx); - // if(nfapi_mode!=0) - // sf_ahead = (uint16_t) ceil((float)6/(0x01<<gNB->frame_parms.numerology_index)); sl_ahead = sf_ahead*gNB->frame_parms.slots_per_subframe; nfapi_nr_config_request_scf_t *cfg = &gNB->gNB_config; @@ -157,7 +154,7 @@ clock_gettime(CLOCK_MONOTONIC, ¤t); // ******************************************************************* // NFAPI not yet supported for NR - this code has to be revised - if (nfapi_mode == NFAPI_MODE_PNF) { + if (NFAPI_MODE == NFAPI_MODE_PNF) { // I am a PNF and I need to let nFAPI know that we have a (sub)frame tick //add_subframe(&frame, &subframe, 4); //oai_subframe_ind(proc->frame_tx, proc->subframe_tx); @@ -187,7 +184,6 @@ clock_gettime(CLOCK_MONOTONIC, ¤t); // **************************************** T(T_GNB_PHY_DL_TICK, T_INT(gNB->Mod_id), T_INT(frame_tx), T_INT(slot_tx)); - /* hack to remove UEs */ extern int rnti_to_remove[10]; extern volatile int rnti_to_remove_count; @@ -248,16 +244,15 @@ clock_gettime(CLOCK_MONOTONIC, ¤t); } */ // Call the scheduler - pthread_mutex_lock(&gNB->UL_INFO_mutex); gNB->UL_INFO.frame = frame_rx; gNB->UL_INFO.slot = slot_rx; gNB->UL_INFO.module_id = gNB->Mod_id; gNB->UL_INFO.CC_id = gNB->CC_id; + gNB->if_inst->NR_UL_indication(&gNB->UL_INFO); + pthread_mutex_unlock(&gNB->UL_INFO_mutex); - - // RX processing int tx_slot_type = nr_slot_select(cfg,frame_tx,slot_tx); int rx_slot_type = nr_slot_select(cfg,frame_rx,slot_rx); @@ -408,7 +403,6 @@ static void *gNB_L1_thread( void *param ) { while (!oai_exit) { struct timespec t; clock_gettime(CLOCK_MONOTONIC,&t); - //printf("\nbefore time %d.%d\n",t.tv_sec,t.tv_nsec); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_gNB_PROC_RXTX0, 0 ); if (wait_on_condition(&L1_proc->mutex,&L1_proc->cond,&L1_proc->instance_cnt,thread_name)<0) break; VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_gNB_PROC_RXTX0, 1 ); @@ -419,8 +413,6 @@ static void *gNB_L1_thread( void *param ) { int frame_tx = L1_proc->frame_tx; int slot_tx = L1_proc->slot_tx; uint64_t timestamp_tx = L1_proc->timestamp_tx; - - //printf("\nframe %d slot %d after wait time %d.%d\n",frame_rx,slot_rx,t.tv_sec,t.tv_nsec); VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_SLOT_NUMBER_TX0_GNB,slot_tx); diff --git a/executables/nr-ru.c b/executables/nr-ru.c index 73a0c8909b687cfb9b17636ddfc92dd3d096fd40..1184a9d80c925b2732d0cebd2f7779d286564f95 100644 --- a/executables/nr-ru.c +++ b/executables/nr-ru.c @@ -1565,7 +1565,7 @@ void *ru_thread( void *param ) { if((slot_start.tv_sec > curr_time.tv_sec) || (slot_start.tv_sec == curr_time.tv_sec && slot_start.tv_nsec > curr_time.tv_nsec)){ sleep_time = timespec_sub(slot_start,curr_time); - usleep(sleep_time.tv_nsec * 1e-3); + usleep(sleep_time.tv_nsec * 1e-3); } else{//continue } diff --git a/executables/nr-softmodem.c b/executables/nr-softmodem.c index 0d238cf63b3160835fc11c35f1fa3759a4e85a00..45755abe95814ea925649d989cf3a8952bbe00ab 100644 --- a/executables/nr-softmodem.c +++ b/executables/nr-softmodem.c @@ -915,7 +915,7 @@ if(!IS_SOFTMODEM_NOS1) usleep(1000); - if (nfapi_mode) { + if (NFAPI_MODE) { printf("NFAPI*** - mutex and cond created - will block shortly for completion of PNF connection\n"); pthread_cond_init(&sync_cond,NULL); pthread_mutex_init(&sync_mutex, NULL); @@ -923,7 +923,7 @@ if(!IS_SOFTMODEM_NOS1) const char *nfapi_mode_str = "<UNKNOWN>"; - switch(nfapi_mode) { + switch(NFAPI_MODE) { case 0: nfapi_mode_str = "MONOLITHIC"; break; @@ -943,7 +943,7 @@ if(!IS_SOFTMODEM_NOS1) printf("NFAPI MODE:%s\n", nfapi_mode_str); - if (nfapi_mode==NFAPI_MODE_VNF) // VNF + if (NFAPI_MODE==NFAPI_MODE_VNF) // VNF wait_nfapi_init("main?"); printf("START MAIN THREADS\n"); @@ -972,7 +972,7 @@ if(!IS_SOFTMODEM_NOS1) config_sync_var=0; - if (nfapi_mode==NFAPI_MODE_PNF) { // PNF + if (NFAPI_MODE==NFAPI_MODE_PNF) { // PNF wait_nfapi_init("main?"); } @@ -992,7 +992,7 @@ if(!IS_SOFTMODEM_NOS1) load_softscope("nr",&p); } - if (nfapi_mode != NFAPI_MODE_PNF && nfapi_mode != NFAPI_MODE_VNF) { + if (NFAPI_MODE != NFAPI_MODE_PNF && NFAPI_MODE != NFAPI_MODE_VNF) { printf("Not NFAPI mode - call init_eNB_afterRU()\n"); init_eNB_afterRU(); } else { diff --git a/executables/softmodem-common.c b/executables/softmodem-common.c index 04a58413b5a1b9f29a6d6c4626b3d648d9f4128e..ab35d6bb55be8f0fc2d78f0cee13eceead2bed37 100644 --- a/executables/softmodem-common.c +++ b/executables/softmodem-common.c @@ -39,11 +39,13 @@ #include "executables/thread-common.h" #include "common/utils/LOG/log.h" #include "softmodem-common.h" +#include "nfapi/oai_integration/vendor_ext.h" + static softmodem_params_t softmodem_params; char *parallel_config=NULL; char *worker_config=NULL; - +uint8_t nfapi_mode=0; static mapping softmodem_funcs[] = MAPPING_SOFTMODEM_FUNCTIONS; static struct timespec start; @@ -143,6 +145,7 @@ void get_common_options(uint32_t execmask) { if(parallel_config != NULL) set_parallel_conf(parallel_config); if(worker_config != NULL) set_worker_conf(worker_config); + nfapi_setmode(nfapi_mode); } void softmodem_printresources(int sig, telnet_printfunc_t pf) { struct rusage usage; diff --git a/executables/softmodem-common.h b/executables/softmodem-common.h index f8e9b0959fa57617617e0f2ec979e9c802e57a34..29bbe36f2b440247a917773a80db598f61abeaa0 100644 --- a/executables/softmodem-common.h +++ b/executables/softmodem-common.h @@ -90,7 +90,7 @@ extern "C" #define CONFIG_HLP_RFSIM "Run in rf simulator mode (also known as basic simulator)\n" #define CONFIG_HLP_NOKRNMOD "(noS1 only): Use tun instead of namesh module \n" #define CONFIG_HLP_DISABLNBIOT "disable nb-iot, even if defined in config\n" - +#define CONFIG_HLP_NFAPI "Change the nFAPI mode for NR\n" /*-----------------------------------------------------------------------------------------------------------------------------------------------------*/ /* command line parameters common to eNodeB and UE */ /* optname helpstr paramflags XXXptr defXXXval type numelt */ @@ -110,6 +110,7 @@ extern "C" #define SEND_DMRSSYNC softmodem_params.send_dmrs_sync #define USIM_TEST softmodem_params.usim_test #define USE_256QAM_TABLE softmodem_params.use_256qam_table +#define NFAPI softmodem_params.nfapi #define DEFAULT_RFCONFIG_FILE "/usr/local/etc/syriq/ue.band7.tm1.PRB100.NR40.dat"; @@ -139,6 +140,7 @@ extern "C" {"nokrnmod", CONFIG_HLP_NOKRNMOD, PARAMFLAG_BOOL, uptr:&nokrnmod, defintval:0, TYPE_INT, 0}, \ {"nbiot-disable", CONFIG_HLP_DISABLNBIOT, PARAMFLAG_BOOL, uptr:&nonbiot, defuintval:0, TYPE_INT, 0}, \ {"use-256qam-table", CONFIG_HLP_256QAM, PARAMFLAG_BOOL, iptr:&USE_256QAM_TABLE, defintval:0, TYPE_INT, 0}, \ + {"nfapi", CONFIG_HLP_NFAPI, 0, u8ptr:&nfapi_mode, defintval:0, TYPE_UINT8, 0}, \ } @@ -225,6 +227,8 @@ typedef struct { int hw_timing_advance; uint32_t send_dmrs_sync; int use_256qam_table; + uint8_t nfapi; + } softmodem_params_t; extern uint64_t get_softmodem_optmask(void); @@ -236,6 +240,8 @@ extern char *get_softmodem_function(uint64_t *sofmodemfunc_mask_ptr); extern void set_softmodem_sighandler(void); extern uint64_t downlink_frequency[MAX_NUM_CCs][4]; extern int32_t uplink_frequency_offset[MAX_NUM_CCs][4]; +extern uint8_t nfapi_mode; + #ifdef __cplusplus } #endif diff --git a/nfapi/oai_integration/nfapi_pnf.c b/nfapi/oai_integration/nfapi_pnf.c index da7a346398fd614eb1a7220f45408f6fde40d0ed..c9589c19c8b5b80359d545fd81a7b9e546b16758 100644 --- a/nfapi/oai_integration/nfapi_pnf.c +++ b/nfapi/oai_integration/nfapi_pnf.c @@ -536,7 +536,7 @@ void nfapi_nr_send_pnf_start_resp(nfapi_pnf_config_t *config, uint16_t phy_id) { printf("Sending NFAPI_START_RESPONSE config:%p phy_id:%d\n", config, phy_id); nfapi_nr_start_response_scf_t start_resp; memset(&start_resp, 0, sizeof(start_resp)); - start_resp.header.message_id = NFAPI_START_RESPONSE; + start_resp.header.message_id = NFAPI_NR_PHY_MSG_TYPE_START_RESPONSE; start_resp.header.phy_id = phy_id; start_resp.error_code = NFAPI_MSG_OK; nfapi_nr_pnf_start_resp(config, &start_resp); diff --git a/nfapi/open-nFAPI/nfapi/public_inc/nfapi_nr_interface_scf.h b/nfapi/open-nFAPI/nfapi/public_inc/nfapi_nr_interface_scf.h index e84c7d983bbc44ea90f7bed99d16f610daeb9dd2..f7ac655ddd7cc5ec7a8fcc874d7d381f6e3e930a 100644 --- a/nfapi/open-nFAPI/nfapi/public_inc/nfapi_nr_interface_scf.h +++ b/nfapi/open-nFAPI/nfapi/public_inc/nfapi_nr_interface_scf.h @@ -59,6 +59,8 @@ typedef enum { NFAPI_NR_PHY_MSG_TYPE_STOP_REQUEST= 0X05, NFAPI_NR_PHY_MSG_TYPE_STOP_INDICATION=0X06, NFAPI_NR_PHY_MSG_TYPE_ERROR_INDICATION=0X07, + NFAPI_NR_PHY_MSG_TYPE_START_RESPONSE=0X010D, + NFAPI_NR_PHY_MSG_TYPE_STOP_RESPONSE=0X010F, //RESERVED 0X08 ~ 0X7F NFAPI_NR_PHY_MSG_TYPE_DL_TTI_REQUEST= 0X80, NFAPI_NR_PHY_MSG_TYPE_UL_TTI_REQUEST= 0X81, @@ -523,7 +525,7 @@ typedef struct { /* PARAM.RESPONSE */ typedef struct { nfapi_p4_p5_message_header_t header; - nfapi_nr_param_errors_e error_code; + uint8_t error_code; uint8_t num_tlv; nfapi_vendor_extension_tlv_t vendor_extension; @@ -545,7 +547,6 @@ typedef struct { /* CONFIG.REQUEST */ typedef struct { nfapi_p4_p5_message_header_t header; - nfapi_nr_param_errors_e error_code; // TODO: check if needed uint8_t num_tlv; nfapi_vendor_extension_tlv_t vendor_extension; @@ -564,7 +565,7 @@ typedef struct { /* CONFIG.RESPONSE */ typedef struct { nfapi_p4_p5_message_header_t header; - nfapi_nr_config_errors_e error_code; + uint8_t error_code; //uint8_t num_invalid_tlvs; // TODO: add list of invalid/unsupported TLVs (see Table 3.18) nfapi_vendor_extension_tlv_t vendor_extension; diff --git a/nfapi/open-nFAPI/nfapi/src/nfapi_p5.c b/nfapi/open-nFAPI/nfapi/src/nfapi_p5.c index 09289529dddac85201859f92271142399a574153..8aea9f590c91f8142884c0bcc8bd554780f9119d 100644 --- a/nfapi/open-nFAPI/nfapi/src/nfapi_p5.c +++ b/nfapi/open-nFAPI/nfapi/src/nfapi_p5.c @@ -259,13 +259,7 @@ static uint8_t pack_nr_pnf_param_response(void *msg, uint8_t **ppWritePackedMsg, return (push32(pNfapiMsg->error_code, ppWritePackedMsg, end) && pack_tlv(NFAPI_PNF_PARAM_GENERAL_TAG, &pNfapiMsg->pnf_param_general, ppWritePackedMsg, end, &pack_pnf_param_general_value) && pack_tlv(NFAPI_PNF_PHY_TAG, &pNfapiMsg->pnf_phy, ppWritePackedMsg, end, &pack_pnf_phy_value) && - // pack_tlv(NFAPI_PNF_RF_TAG, &pNfapiMsg->pnf_rf, ppWritePackedMsg, end, &pack_pnf_rf_value) && - // pack_tlv(NFAPI_PNF_PHY_REL10_TAG, &pNfapiMsg->pnf_phy_rel10, ppWritePackedMsg, end, &pack_pnf_phy_rel10_value) && - // pack_tlv(NFAPI_PNF_PHY_REL11_TAG, &pNfapiMsg->pnf_phy_rel11, ppWritePackedMsg, end, &pack_pnf_phy_rel11_value) && - // pack_tlv(NFAPI_PNF_PHY_REL12_TAG, &pNfapiMsg->pnf_phy_rel12, ppWritePackedMsg, end, &pack_pnf_phy_rel12_value) && - // pack_tlv(NFAPI_PNF_PHY_REL13_TAG, &pNfapiMsg->pnf_phy_rel13, ppWritePackedMsg, end, &pack_pnf_phy_rel13_value) && - // pack_tlv(NFAPI_PNF_PHY_REL13_NB_IOT_TAG, &pNfapiMsg->pnf_phy_rel13_nb_iot, ppWritePackedMsg, end, &pack_pnf_phy_rel13_nb_iot_value) && - pack_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config)); + pack_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config)); } @@ -276,13 +270,13 @@ static uint8_t pack_pnf_param_response(void *msg, uint8_t **ppWritePackedMsg, ui return (push32(pNfapiMsg->error_code, ppWritePackedMsg, end) && pack_tlv(NFAPI_PNF_PARAM_GENERAL_TAG, &pNfapiMsg->pnf_param_general, ppWritePackedMsg, end, &pack_pnf_param_general_value) && pack_tlv(NFAPI_PNF_PHY_TAG, &pNfapiMsg->pnf_phy, ppWritePackedMsg, end, &pack_pnf_phy_value) && - // pack_tlv(NFAPI_PNF_RF_TAG, &pNfapiMsg->pnf_rf, ppWritePackedMsg, end, &pack_pnf_rf_value) && - // pack_tlv(NFAPI_PNF_PHY_REL10_TAG, &pNfapiMsg->pnf_phy_rel10, ppWritePackedMsg, end, &pack_pnf_phy_rel10_value) && - // pack_tlv(NFAPI_PNF_PHY_REL11_TAG, &pNfapiMsg->pnf_phy_rel11, ppWritePackedMsg, end, &pack_pnf_phy_rel11_value) && - // pack_tlv(NFAPI_PNF_PHY_REL12_TAG, &pNfapiMsg->pnf_phy_rel12, ppWritePackedMsg, end, &pack_pnf_phy_rel12_value) && - // pack_tlv(NFAPI_PNF_PHY_REL13_TAG, &pNfapiMsg->pnf_phy_rel13, ppWritePackedMsg, end, &pack_pnf_phy_rel13_value) && - // pack_tlv(NFAPI_PNF_PHY_REL13_NB_IOT_TAG, &pNfapiMsg->pnf_phy_rel13_nb_iot, ppWritePackedMsg, end, &pack_pnf_phy_rel13_nb_iot_value) && - pack_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config)); + pack_tlv(NFAPI_PNF_RF_TAG, &pNfapiMsg->pnf_rf, ppWritePackedMsg, end, &pack_pnf_rf_value) && + pack_tlv(NFAPI_PNF_PHY_REL10_TAG, &pNfapiMsg->pnf_phy_rel10, ppWritePackedMsg, end, &pack_pnf_phy_rel10_value) && + pack_tlv(NFAPI_PNF_PHY_REL11_TAG, &pNfapiMsg->pnf_phy_rel11, ppWritePackedMsg, end, &pack_pnf_phy_rel11_value) && + pack_tlv(NFAPI_PNF_PHY_REL12_TAG, &pNfapiMsg->pnf_phy_rel12, ppWritePackedMsg, end, &pack_pnf_phy_rel12_value) && + pack_tlv(NFAPI_PNF_PHY_REL13_TAG, &pNfapiMsg->pnf_phy_rel13, ppWritePackedMsg, end, &pack_pnf_phy_rel13_value) && + pack_tlv(NFAPI_PNF_PHY_REL13_NB_IOT_TAG, &pNfapiMsg->pnf_phy_rel13_nb_iot, ppWritePackedMsg, end, &pack_pnf_phy_rel13_nb_iot_value) && + pack_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config)); } @@ -426,18 +420,6 @@ static uint8_t unpack_uint32_tlv_value(void* tlv, uint8_t **ppReadPackedMsg, uin return pull32(ppReadPackedMsg, &value->value, end); } -static uint8_t pack_int32_tlv_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_int32_tlv_t* value = (nfapi_int32_tlv_t*)tlv; - return pushs32(value->value, ppWritePackedMsg, end); -} - -static uint8_t unpack_int32_tlv_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_int32_tlv_t* value = (nfapi_int32_tlv_t*)tlv; - return pulls32(ppReadPackedMsg, &value->value, end); -} - static uint8_t pack_uint16_tlv_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) { @@ -882,8 +864,7 @@ static uint8_t pack_nr_config_request(void *msg, uint8_t **ppWritePackedMsg, uin nfapi_nr_config_request_scf_t *pNfapiMsg = (nfapi_nr_config_request_scf_t*)msg; - return (push8(pNfapiMsg->error_code, ppWritePackedMsg, end) && - push8(pNfapiMsg->num_tlv, ppWritePackedMsg, end) && + return (push8(pNfapiMsg->num_tlv, ppWritePackedMsg, end) && pack_tlv(NFAPI_NR_CONFIG_DL_BANDWIDTH_TAG, &(pNfapiMsg->carrier_config.dl_bandwidth), ppWritePackedMsg, end, &pack_uint16_tlv_value) && pack_tlv(NFAPI_NR_CONFIG_DL_FREQUENCY_TAG, &(pNfapiMsg->carrier_config.dl_frequency), ppWritePackedMsg, end, &pack_uint32_tlv_value) && pack_tlv(NFAPI_NR_CONFIG_DL_GRID_SIZE_TAG, &(pNfapiMsg->carrier_config.dl_grid_size[1]), ppWritePackedMsg, end, &pack_uint16_tlv_value) && @@ -1088,7 +1069,7 @@ static uint8_t pack_nr_p5_message_body(nfapi_p4_p5_message_header_t *header, uin result = pack_nr_start_request(header, ppWritePackedMsg, end, config); break; - case NFAPI_START_RESPONSE: + case NFAPI_NR_PHY_MSG_TYPE_START_RESPONSE: result = pack_nr_start_response(header, ppWritePackedMsg, end, config); break; @@ -1096,18 +1077,9 @@ static uint8_t pack_nr_p5_message_body(nfapi_p4_p5_message_header_t *header, uin result = pack_stop_request(header, ppWritePackedMsg, end, config); break; - case NFAPI_STOP_RESPONSE: + case NFAPI_NR_PHY_MSG_TYPE_STOP_RESPONSE: result = pack_stop_response(header, ppWritePackedMsg, end, config); break; - - case NFAPI_MEASUREMENT_REQUEST: - result = pack_measurement_request(header, ppWritePackedMsg, end, config); - break; - - case NFAPI_MEASUREMENT_RESPONSE: - result = pack_measurement_response(header, ppWritePackedMsg, end, config); - break; - default: { if(header->message_id >= NFAPI_VENDOR_EXT_MSG_MIN && @@ -1580,14 +1552,6 @@ static uint8_t unpack_nr_pnf_param_response(uint8_t **ppReadPackedMsg, uint8_t * { { NFAPI_PNF_PARAM_GENERAL_TAG, &pNfapiMsg->pnf_param_general, &unpack_pnf_param_general_value}, { NFAPI_PNF_PHY_TAG, &pNfapiMsg->pnf_phy, &unpack_pnf_phy_value}, - /* - { NFAPI_PNF_RF_TAG, &pNfapiMsg->pnf_rf, &unpack_pnf_rf_value}, - { NFAPI_PNF_PHY_REL10_TAG, &pNfapiMsg->pnf_phy_rel10, &unpack_pnf_phy_rel10_value}, - { NFAPI_PNF_PHY_REL11_TAG, &pNfapiMsg->pnf_phy_rel11, &unpack_pnf_phy_rel11_value}, - { NFAPI_PNF_PHY_REL12_TAG, &pNfapiMsg->pnf_phy_rel12, &unpack_pnf_phy_rel12_value}, - { NFAPI_PNF_PHY_REL13_TAG, &pNfapiMsg->pnf_phy_rel13, &unpack_pnf_phy_rel13_value}, - { NFAPI_PNF_PHY_REL13_NB_IOT_TAG, &pNfapiMsg->pnf_phy_rel13_nb_iot, &unpack_pnf_phy_rel13_nb_iot_value}, - */ }; return ( pull32(ppReadPackedMsg, &pNfapiMsg->error_code, end) && @@ -1604,14 +1568,13 @@ static uint8_t unpack_pnf_param_response(uint8_t **ppReadPackedMsg, uint8_t *end { { NFAPI_PNF_PARAM_GENERAL_TAG, &pNfapiMsg->pnf_param_general, &unpack_pnf_param_general_value}, { NFAPI_PNF_PHY_TAG, &pNfapiMsg->pnf_phy, &unpack_pnf_phy_value}, - /* { NFAPI_PNF_RF_TAG, &pNfapiMsg->pnf_rf, &unpack_pnf_rf_value}, { NFAPI_PNF_PHY_REL10_TAG, &pNfapiMsg->pnf_phy_rel10, &unpack_pnf_phy_rel10_value}, { NFAPI_PNF_PHY_REL11_TAG, &pNfapiMsg->pnf_phy_rel11, &unpack_pnf_phy_rel11_value}, { NFAPI_PNF_PHY_REL12_TAG, &pNfapiMsg->pnf_phy_rel12, &unpack_pnf_phy_rel12_value}, { NFAPI_PNF_PHY_REL13_TAG, &pNfapiMsg->pnf_phy_rel13, &unpack_pnf_phy_rel13_value}, { NFAPI_PNF_PHY_REL13_NB_IOT_TAG, &pNfapiMsg->pnf_phy_rel13_nb_iot, &unpack_pnf_phy_rel13_nb_iot_value}, - */ + }; return ( pull32(ppReadPackedMsg, &pNfapiMsg->error_code, end) && @@ -2149,23 +2112,17 @@ static uint8_t unpack_nr_config_request(uint8_t **ppReadPackedMsg, uint8_t *end, { 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_CONFIG_SLOT_CONFIG_TAG, &(pNfapiMsg->tdd_table.max_tdd_periodicity_list[0].max_num_of_symbol_per_slot_list[0].slot_config), &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}, { NFAPI_NR_NFAPI_P7_PNF_ADDRESS_IPV4_TAG, &(pNfapiMsg->nfapi_config.p7_pnf_address_ipv4), &unpack_ipv4_address_value}, { NFAPI_NR_NFAPI_P7_PNF_ADDRESS_IPV6_TAG, &(pNfapiMsg->nfapi_config.p7_pnf_address_ipv6), &unpack_ipv6_address_value}, { NFAPI_NR_NFAPI_P7_PNF_PORT_TAG, &(pNfapiMsg->nfapi_config.p7_pnf_port), &unpack_uint16_tlv_value}, { NFAPI_NR_NFAPI_P7_VNF_ADDRESS_IPV4_TAG, &(pNfapiMsg->nfapi_config.p7_vnf_address_ipv4), &unpack_ipv4_address_value}, { NFAPI_NR_NFAPI_P7_VNF_ADDRESS_IPV6_TAG, &(pNfapiMsg->nfapi_config.p7_vnf_address_ipv6), &unpack_ipv6_address_value}, { NFAPI_NR_NFAPI_P7_VNF_PORT_TAG, &(pNfapiMsg->nfapi_config.p7_vnf_port), &unpack_uint16_tlv_value}, - //{ NFAPI_NR_NFAPI_RF_BANDS_TAG, &(pNfapiMsg->nfapi_config.rf_bands), &unpack_rf_bands_value}, { NFAPI_NR_NFAPI_TIMING_INFO_MODE_TAG, &(pNfapiMsg->nfapi_config.timing_info_mode), &unpack_uint8_tlv_value}, { NFAPI_NR_NFAPI_TIMING_INFO_PERIOD_TAG, &(pNfapiMsg->nfapi_config.timing_info_period), &unpack_uint8_tlv_value}, { NFAPI_NR_NFAPI_TIMING_WINDOW_TAG, &(pNfapiMsg->nfapi_config.timing_window), &unpack_uint8_tlv_value}, - //{ NFAPI_NR_NFAPI_UPLINK_UES_PER_SUBFRAME_TAG, &(pNfapiMsg->nfapi_config.ul_ue_per_sf), &unpack_uint8_tlv_value}, }; - return ( pull8(ppReadPackedMsg, &pNfapiMsg->error_code, end) && - pull8(ppReadPackedMsg, &pNfapiMsg->num_tlv, end) && + return ( pull8(ppReadPackedMsg, &pNfapiMsg->num_tlv, end) && unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension)); } @@ -2378,17 +2335,17 @@ static int check_nr_unpack_length(nfapi_nr_phy_msg_type_e msgId, uint32_t unpack retLen = sizeof( nfapi_nr_start_request_scf_t); break; - case NFAPI_START_RESPONSE: + case NFAPI_NR_PHY_MSG_TYPE_START_RESPONSE: if (unpackedBufLen >= sizeof(nfapi_nr_start_response_scf_t)) retLen = sizeof(nfapi_nr_start_response_scf_t); break; - case NFAPI_STOP_REQUEST: + case NFAPI_NR_PHY_MSG_TYPE_STOP_REQUEST: if (unpackedBufLen >= sizeof(nfapi_stop_request_t)) retLen = sizeof(nfapi_stop_request_t); break; - case NFAPI_STOP_RESPONSE: + case NFAPI_NR_PHY_MSG_TYPE_STOP_RESPONSE: if (unpackedBufLen >= sizeof(nfapi_stop_response_t)) retLen = sizeof(nfapi_stop_response_t); break; @@ -2637,15 +2594,15 @@ int nfapi_nr_p5_message_unpack(void *pMessageBuf, uint32_t messageBufLen, void * result = unpack_nr_start_request(&pReadPackedMessage, end, pMessageHeader, config); break; - case NFAPI_START_RESPONSE: + case NFAPI_NR_PHY_MSG_TYPE_START_RESPONSE: result = unpack_nr_start_response(&pReadPackedMessage, end, pMessageHeader, config); break; - case NFAPI_STOP_REQUEST: + case NFAPI_NR_PHY_MSG_TYPE_STOP_REQUEST: result = unpack_stop_request(&pReadPackedMessage, end, pMessageHeader, config); break; - case NFAPI_STOP_RESPONSE: + case NFAPI_NR_PHY_MSG_TYPE_STOP_RESPONSE: result = unpack_stop_response(&pReadPackedMessage, end, pMessageHeader, config); break; diff --git a/nfapi/open-nFAPI/pnf/public_inc/nfapi_pnf_interface.h b/nfapi/open-nFAPI/pnf/public_inc/nfapi_pnf_interface.h index 8b8edd7fd6ee07c13549eb69077f945163b2bd8b..fc9cd660774bbf497e77eb76ecfa1691c8a2f965 100644 --- a/nfapi/open-nFAPI/pnf/public_inc/nfapi_pnf_interface.h +++ b/nfapi/open-nFAPI/pnf/public_inc/nfapi_pnf_interface.h @@ -214,7 +214,8 @@ typedef struct nfapi_pnf_config * STOP.request. This can be done in the call back. */ int (*stop_req)(nfapi_pnf_config_t* config, nfapi_pnf_phy_config_t* phy, nfapi_stop_request_t* req); - + int (*nr_stop_req)(nfapi_pnf_config_t* config, nfapi_pnf_phy_config_t* phy, nfapi_nr_stop_request_t* req); + /*! A callback for the MEASUREMENT.request * \param config A pointer to the pnf configuration * \param phy A pointer to the pnf phy configuration diff --git a/nfapi/open-nFAPI/pnf/src/pnf.c b/nfapi/open-nFAPI/pnf/src/pnf.c index 20c6c12a7462c961f46fb34815f9f16e8b11852f..fdafd93279179da659f75096b9cccbce0bf88272 100644 --- a/nfapi/open-nFAPI/pnf/src/pnf.c +++ b/nfapi/open-nFAPI/pnf/src/pnf.c @@ -829,7 +829,7 @@ void pnf_nr_handle_start_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen) { nfapi_nr_start_response_scf_t resp; memset(&resp, 0, sizeof(resp)); - resp.header.message_id = NFAPI_START_RESPONSE; + resp.header.message_id = NFAPI_NR_PHY_MSG_TYPE_START_RESPONSE; resp.header.phy_id = req.header.phy_id; resp.error_code = NFAPI_MSG_INVALID_STATE; nfapi_nr_pnf_start_resp(config, &resp); @@ -839,7 +839,7 @@ void pnf_nr_handle_start_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen) { nfapi_nr_start_response_scf_t resp; memset(&resp, 0, sizeof(resp)); - resp.header.message_id = NFAPI_START_RESPONSE; + resp.header.message_id = NFAPI_NR_PHY_MSG_TYPE_START_RESPONSE; resp.header.phy_id = req.header.phy_id; resp.error_code = NFAPI_MSG_INVALID_CONFIG; nfapi_nr_pnf_start_resp(config, &resp); @@ -849,7 +849,7 @@ void pnf_nr_handle_start_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen) { nfapi_nr_start_response_scf_t resp; memset(&resp, 0, sizeof(resp)); - resp.header.message_id = NFAPI_START_RESPONSE; + resp.header.message_id = NFAPI_NR_PHY_MSG_TYPE_START_RESPONSE; resp.header.phy_id = req.header.phy_id; resp.error_code = NFAPI_MSG_INVALID_STATE; nfapi_nr_pnf_start_resp(config, &resp); @@ -962,16 +962,16 @@ void pnf_nr_handle_stop_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen) { if(phy->state != NFAPI_PNF_PHY_RUNNING) { - if(config->stop_req) + if(config->nr_stop_req) { - (config->stop_req)(config, phy, &req); + (config->nr_stop_req)(config, phy, &req); } } else { nfapi_stop_response_t resp; memset(&resp, 0, sizeof(resp)); - resp.header.message_id = NFAPI_STOP_RESPONSE; + resp.header.message_id = NFAPI_NR_PHY_MSG_TYPE_STOP_RESPONSE; resp.header.phy_id = req.header.phy_id; resp.error_code = NFAPI_MSG_INVALID_STATE; nfapi_pnf_stop_resp(config, &resp); @@ -981,7 +981,7 @@ void pnf_nr_handle_stop_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen) { nfapi_stop_response_t resp; memset(&resp, 0, sizeof(resp)); - resp.header.message_id = NFAPI_STOP_RESPONSE; + resp.header.message_id = NFAPI_NR_PHY_MSG_TYPE_STOP_RESPONSE; resp.header.phy_id = req.header.phy_id; resp.error_code = NFAPI_MSG_INVALID_CONFIG; nfapi_pnf_stop_resp(config, &resp); @@ -991,7 +991,7 @@ void pnf_nr_handle_stop_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen) { nfapi_stop_response_t resp; memset(&resp, 0, sizeof(resp)); - resp.header.message_id = NFAPI_STOP_RESPONSE; + resp.header.message_id = NFAPI_NR_PHY_MSG_TYPE_STOP_RESPONSE; resp.header.phy_id = req.header.phy_id; resp.error_code = NFAPI_MSG_INVALID_STATE; nfapi_pnf_stop_resp(config, &resp); diff --git a/nfapi/open-nFAPI/pnf/src/pnf_p7.c b/nfapi/open-nFAPI/pnf/src/pnf_p7.c index 8e2c5e88ace017b6575ca44a2d69dc1b6c5cb7f3..18891cdee955d24928b84f40967f0edb63d769f4 100644 --- a/nfapi/open-nFAPI/pnf/src/pnf_p7.c +++ b/nfapi/open-nFAPI/pnf/src/pnf_p7.c @@ -514,7 +514,7 @@ static uint32_t get_slot_time(uint32_t now_hr, uint32_t slot_start_hr) // if the us have wrapped adjust for it if(now_hr < slot_start_us) { - now_us += 500000; // changed from 1e6 - gokul + now_us += 500000; } return now_us - slot_start_us; @@ -985,8 +985,6 @@ int pnf_p7_slot_ind(pnf_p7_t* pnf_p7, uint16_t phy_id, uint16_t sfn, uint16_t sl uint8_t tx_buffer_index = tx_slot_dec % pnf_p7->_public.slot_buffer_size; nfapi_pnf_p7_slot_buffer_t* tx_slot_buffer = &(pnf_p7->slot_buffer[tx_buffer_index]); - - //printf("sfn_sf_dec:%d tx_sfn_sf_dec:%d\n", sfn_sf_dec, tx_sfn_sf_dec); if (0) NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() shift:%d slot_buffer->sfn_sf:%d tx_slot_buffer->sfn_slot:%d sfn_sf:%d subframe_buffer[buffer_index:%u dl_config_req:%p tx_req:%p] " "TX:sfn_sf:%d:tx_buffer_index:%d[dl_config_req:%p tx_req:%p]\n", __FUNCTION__, @@ -1013,18 +1011,16 @@ int pnf_p7_slot_ind(pnf_p7_t* pnf_p7, uint16_t phy_id, uint16_t sfn, uint16_t sl { if(pnf_p7->_public.tx_data_req_fn) - { - + { (pnf_p7->_public.tx_data_req_fn)(&(pnf_p7->_public), tx_slot_buffer->tx_data_req); } - //deallocate_nfapi_tx_request(slot_buffer->tx_req, pnf_p7); } else { // send dummy if(pnf_p7->_public.tx_data_req_fn && pnf_p7->_public.dummy_slot.tx_data_req) { - pnf_p7->_public.dummy_slot.tx_data_req->SFN = sfn_tx; // TODO: change tx_req to nfapi_nr_tx_data_request_t + pnf_p7->_public.dummy_slot.tx_data_req->SFN = sfn_tx; pnf_p7->_public.dummy_slot.tx_data_req->Slot = slot_tx; (pnf_p7->_public.tx_data_req_fn)(&(pnf_p7->_public), pnf_p7->_public.dummy_slot.tx_data_req); @@ -1036,12 +1032,8 @@ int pnf_p7_slot_ind(pnf_p7_t* pnf_p7, uint16_t phy_id, uint16_t sfn, uint16_t sl { if(pnf_p7->_public.dl_tti_req_fn) { - - printf("\nIn pnf_phy_dl_tti_req VNF: sfn %d slot %d, PNF: sfn %d slot %d \n",tx_slot_buffer->dl_tti_req->SFN,tx_slot_buffer->dl_tti_req->Slot,pnf_p7->sfn,pnf_p7->slot); - (pnf_p7->_public.dl_tti_req_fn)(NULL, &(pnf_p7->_public), tx_slot_buffer->dl_tti_req); } - //deallocate_nfapi_dl_config_request(subframe_buffer->dl_config_req, pnf_p7); } @@ -1050,7 +1042,7 @@ int pnf_p7_slot_ind(pnf_p7_t* pnf_p7, uint16_t phy_id, uint16_t sfn, uint16_t sl // send dummy if(pnf_p7->_public.dl_tti_req_fn && pnf_p7->_public.dummy_slot.dl_tti_req) { - pnf_p7->_public.dummy_slot.dl_tti_req->SFN = sfn_tx; // TODO: Change dl_config_req to nfapi_nr_dl_tti_request_t + pnf_p7->_public.dummy_slot.dl_tti_req->SFN = sfn_tx; pnf_p7->_public.dummy_slot.dl_tti_req->Slot = slot_tx; (pnf_p7->_public.dl_tti_req_fn)(NULL, &(pnf_p7->_public), pnf_p7->_public.dummy_slot.dl_tti_req); } @@ -1059,10 +1051,9 @@ int pnf_p7_slot_ind(pnf_p7_t* pnf_p7, uint16_t phy_id, uint16_t sfn, uint16_t sl if(tx_slot_buffer->ul_dci_req!= 0) { if(pnf_p7->_public.ul_dci_req_fn) - { printf("\nIn pnf_phy_Ul_DCI_req VNF: sfn %d slot %d, PNF: sfn %d slot %d\n",tx_slot_buffer->ul_dci_req->SFN,tx_slot_buffer->ul_dci_req->Slot,pnf_p7->sfn,pnf_p7->slot); + { (pnf_p7->_public.ul_dci_req_fn)(NULL, &(pnf_p7->_public), tx_slot_buffer->ul_dci_req); } - //deallocate_nfapi_hi_dci0_request(subframe_buffer->hi_dci0_req, pnf_p7); } else { @@ -1074,24 +1065,6 @@ int pnf_p7_slot_ind(pnf_p7_t* pnf_p7, uint16_t phy_id, uint16_t sfn, uint16_t sl (pnf_p7->_public.ul_dci_req_fn)(NULL, &(pnf_p7->_public), pnf_p7->_public.dummy_slot.ul_dci_req); } } - #if 0 - if(tx_slot_buffer->ue_release_req != 0) // TODO: check later if needed - { - if(pnf_p7->_public.ue_release_req) - (pnf_p7->_public.ue_release_req)(&(pnf_p7->_public), tx_slot_buffer->ue_release_req); - } - - else - { - //send dummy - if(pnf_p7->_public.ue_release_req && pnf_p7->_public.dummy_slot.ue_release_req) - { - pnf_p7->_public.dummy_slot.ue_release_req->sfn_sf = sfn_slot_tx; - (pnf_p7->_public.ue_release_req)(&(pnf_p7->_public), pnf_p7->_public.dummy_slot.ue_release_req); - } - } - #endif - //TODO: add deallocate fns for the new structs if(tx_slot_buffer->dl_tti_req != 0) { deallocate_nfapi_dl_tti_request(tx_slot_buffer->dl_tti_req, pnf_p7); @@ -1125,10 +1098,7 @@ int pnf_p7_slot_ind(pnf_p7_t* pnf_p7, uint16_t phy_id, uint16_t sfn, uint16_t sl if(slot_buffer->ul_tti_req != 0) { if(pnf_p7->_public.ul_tti_req_fn) - { struct timespec curr; - // clock_gettime(CLOCK_MONOTONIC,&curr); - // printf("\ntime at which ul_tti handle fn %ld.%ld \n",curr.tv_sec,curr.tv_nsec); - printf("\nIn pnf_phy_ul_tti_req VNF: sfn %d slot %d, PNF: sfn %d slot %d \n",slot_buffer->ul_tti_req->SFN,slot_buffer->ul_tti_req->Slot,pnf_p7->sfn,pnf_p7->slot); + { (pnf_p7->_public.ul_tti_req_fn)(NULL, &(pnf_p7->_public), slot_buffer->ul_tti_req); } //deallocate_nfapi_ul_config_request(subframe_buffer->ul_config_req, pnf_p7); @@ -2597,8 +2567,6 @@ void pnf_nr_handle_dl_node_sync(void *pRecvMsg, int recvMsgLen, pnf_p7_t* pnf_p7 ul_node_sync.t1 = dl_node_sync.t1; ul_node_sync.t2 = calculate_nr_t2(rx_hr_time, pnf_p7->sfn,pnf_p7->slot, pnf_p7->slot_start_time_hr); ul_node_sync.t3 = calculate_nr_t3(pnf_p7->sfn,pnf_p7->slot, pnf_p7->slot_start_time_hr); -// ul_node_sync.t2 = ul_node_sync.t1 + 10; -// ul_node_sync.t3 = ul_node_sync.t2 + 10; // hardcoded - gokul if(pthread_mutex_unlock(&(pnf_p7->mutex)) != 0) { @@ -3020,7 +2988,7 @@ void pnf_nr_nfapi_p7_read_dispatch_message(pnf_p7_t* pnf_p7, uint32_t now_hr_tim int recvfrom_result = 0; struct sockaddr_in remote_addr; socklen_t remote_addr_size = sizeof(remote_addr); - remote_addr.sin_family = 2; // Gokul - hardcoded + remote_addr.sin_family = 2; //hardcoded do { @@ -3130,7 +3098,6 @@ int pnf_p7_message_pump(pnf_p7_t* pnf_p7) struct sockaddr_in addr; memset(&addr, 0, sizeof(addr)); addr.sin_family = AF_INET; - //addr.sin_port = htons(pnf_p7->_public.local_p7_port); Gokul addr.sin_port = pnf_p7->_public.local_p7_port; if(pnf_p7->_public.local_p7_addr == 0) @@ -3271,7 +3238,6 @@ int pnf_nr_p7_message_pump(pnf_p7_t* pnf_p7) struct sockaddr_in addr; memset(&addr, 0, sizeof(addr)); addr.sin_family = AF_INET; - //addr.sin_port = htons(pnf_p7->_public.local_p7_port); Gokul addr.sin_port = pnf_p7->_public.local_p7_port; if(pnf_p7->_public.local_p7_addr == 0) diff --git a/nfapi/open-nFAPI/vnf/src/vnf.c b/nfapi/open-nFAPI/vnf/src/vnf.c index 30c2f4c03c119c0e521d28425011a6cb5fc447ca..7fee47d6d5423b5acd381d998a9083a582632eb9 100644 --- a/nfapi/open-nFAPI/vnf/src/vnf.c +++ b/nfapi/open-nFAPI/vnf/src/vnf.c @@ -1100,62 +1100,14 @@ void vnf_nr_handle_p4_p5_message(void *pRecvMsg, int recvMsgLen, int p5_idx, nfa vnf_nr_handle_config_response(pRecvMsg, recvMsgLen, config, p5_idx); break; - case NFAPI_START_RESPONSE: + case NFAPI_NR_PHY_MSG_TYPE_START_RESPONSE: vnf_nr_handle_start_response(pRecvMsg, recvMsgLen, config, p5_idx); break; - case NFAPI_STOP_RESPONSE: + case NFAPI_NR_PHY_MSG_TYPE_STOP_RESPONSE: vnf_handle_stop_response(pRecvMsg, recvMsgLen, config, p5_idx); break; - case NFAPI_MEASUREMENT_RESPONSE: - vnf_handle_measurement_response(pRecvMsg, recvMsgLen, config, p5_idx); - break; - - case NFAPI_RSSI_RESPONSE: - vnf_handle_rssi_response(pRecvMsg, recvMsgLen, config, p5_idx); - break; - - case NFAPI_RSSI_INDICATION: - vnf_handle_rssi_indication(pRecvMsg, recvMsgLen, config, p5_idx); - break; - - case NFAPI_CELL_SEARCH_RESPONSE: - vnf_handle_cell_search_response(pRecvMsg, recvMsgLen, config, p5_idx); - break; - - case NFAPI_CELL_SEARCH_INDICATION: - vnf_handle_cell_search_indication(pRecvMsg, recvMsgLen, config, p5_idx); - break; - - case NFAPI_BROADCAST_DETECT_RESPONSE: - vnf_handle_broadcast_detect_response(pRecvMsg, recvMsgLen, config, p5_idx); - break; - - case NFAPI_BROADCAST_DETECT_INDICATION: - vnf_handle_broadcast_detect_indication(pRecvMsg, recvMsgLen, config, p5_idx); - break; - - case NFAPI_SYSTEM_INFORMATION_SCHEDULE_RESPONSE: - vnf_handle_system_information_schedule_response(pRecvMsg, recvMsgLen, config, p5_idx); - break; - - case NFAPI_SYSTEM_INFORMATION_SCHEDULE_INDICATION: - vnf_handle_system_information_schedule_indication(pRecvMsg, recvMsgLen, config, p5_idx); - break; - - case NFAPI_SYSTEM_INFORMATION_RESPONSE: - vnf_handle_system_information_response(pRecvMsg, recvMsgLen, config, p5_idx); - break; - - case NFAPI_SYSTEM_INFORMATION_INDICATION: - vnf_handle_system_information_indication(pRecvMsg, recvMsgLen, config, p5_idx); - break; - - case NFAPI_NMM_STOP_RESPONSE: - vnf_handle_nmm_stop_response(pRecvMsg, recvMsgLen, config, p5_idx); - break; - default: { if(messageHeader.message_id >= NFAPI_VENDOR_EXT_MSG_MIN && @@ -1387,11 +1339,11 @@ int vnf_nr_read_dispatch_message(nfapi_vnf_config_t* config, nfapi_vnf_pnf_info_ // handle now if complete message in one or more segments if ((flags & 0x80) == 0x80) { - printf("\nVNF RECEIVES:\n"); - for(int i=0; i<message_size; i++){ - printf("%d", read_buffer[i]); - } - printf("\n"); + // printf("\nVNF RECEIVES:\n"); + // for(int i=0; i<message_size; i++){ + // printf("%d", read_buffer[i]); + // } + // printf("\n"); vnf_nr_handle_p4_p5_message(read_buffer, message_size, pnf->p5_idx, config); } @@ -1516,11 +1468,11 @@ int vnf_read_dispatch_message(nfapi_vnf_config_t* config, nfapi_vnf_pnf_info_t* // handle now if complete message in one or more segments if ((flags & 0x80) == 0x80) { - printf("\nVNF RECEIVES:\n"); - for(int i=0; i<message_size; i++){ - printf("%d", read_buffer[i]); - } - printf("\n"); + // printf("\nVNF RECEIVES:\n"); + // for(int i=0; i<message_size; i++){ + // printf("%d", read_buffer[i]); + // } + // printf("\n"); vnf_handle_p4_p5_message(read_buffer, message_size, pnf->p5_idx, config); } @@ -1549,11 +1501,11 @@ int vnf_read_dispatch_message(nfapi_vnf_config_t* config, nfapi_vnf_pnf_info_t* static int vnf_send_p5_msg(nfapi_vnf_pnf_info_t* pnf, const void *msg, int len, uint8_t stream) { - printf("\n MESSAGE SENT: \n"); - for(int i=0; i<len; i++){ - printf("%d", *(uint8_t *)(msg + i)); - } - printf("\n"); + // printf("\n MESSAGE SENT: \n"); + // for(int i=0; i<len; i++){ + // printf("%d", *(uint8_t *)(msg + i)); + // } + // printf("\n"); //NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s len:%d stream:%d\n", __FUNCTION__, len, stream); diff --git a/nfapi/open-nFAPI/vnf/src/vnf_p7_interface.c b/nfapi/open-nFAPI/vnf/src/vnf_p7_interface.c index cac462b2c25fdbb334096326a4dfae036c7c6c5e..3fa1f035fdc102e6c9a11d8032a7529ecb0e59ce 100644 --- a/nfapi/open-nFAPI/vnf/src/vnf_p7_interface.c +++ b/nfapi/open-nFAPI/vnf/src/vnf_p7_interface.c @@ -176,7 +176,7 @@ int nfapi_nr_vnf_p7_start(nfapi_vnf_p7_config_t* config) slot_start = timespec_add(slot_start, slot_duration); NFAPI_TRACE(NFAPI_TRACE_INFO, "next slot will start at %d.%d\n", slot_start.tv_sec, slot_start.tv_nsec); - //printf("next slot will start at %d.%d\n",slot_start.tv_sec, slot_start.tv_nsec); + while(vnf_p7->terminate == 0) { fd_set rfds; @@ -380,7 +380,7 @@ NFAPI_TRACE(NFAPI_TRACE_ERROR, "INVAL: pselect_timeout:%d.%ld adj[dur:%d adj:%d] else { // we have overrun the subframe advance to go and collect $200 - // CHANGE - gokul + if((millisecond - last_millisecond) > 3) NFAPI_TRACE(NFAPI_TRACE_WARN, "subframe overrun %ld %ld (%ld)\n", millisecond, last_millisecond, millisecond - last_millisecond + 1); @@ -411,11 +411,8 @@ struct timespec current_time; curr->slot++; } vnf_nr_sync(vnf_p7, curr); - //printf("\nsfn:%d, slot:%d\n current time:%d.%d",curr->sfn,curr->slot,current_time.tv_sec, current_time.tv_nsec); //remove later - gokul - //printf("next slot will start at %d.%d\n",current_time.tv_sec, current_time.tv_nsec); curr = curr->next; } - //send_mac_subframe_indications(vnf_p7); send_mac_slot_indications(vnf_p7); } else if(selectRetval > 0) diff --git a/openair1/PHY/NR_TRANSPORT/nr_dlsch.c b/openair1/PHY/NR_TRANSPORT/nr_dlsch.c index d1b868eac857e8f293fbeedf87d3f347799d3625..e244485193224e279ba196fc6f89cb045f1d0df4 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_dlsch.c +++ b/openair1/PHY/NR_TRANSPORT/nr_dlsch.c @@ -421,7 +421,7 @@ void dump_pdsch_stats(PHY_VARS_gNB *gNB) { for (int i=0;i<NUMBER_OF_NR_SCH_STATS_MAX;i++) if (gNB->dlsch_stats[i].rnti > 0) - LOG_I(PHY,"DLSCH RNTI %x: round_trials %d(%1.1e):%d(%1.1e):%d(%1.1e):%d, current_Qm %d, current_RI %d, total_bytes TX %d\n", + LOG_D(PHY,"DLSCH RNTI %x: round_trials %d(%1.1e):%d(%1.1e):%d(%1.1e):%d, current_Qm %d, current_RI %d, total_bytes TX %d\n", gNB->dlsch_stats[i].rnti, gNB->dlsch_stats[i].round_trials[0], (double)gNB->dlsch_stats[i].round_trials[1]/gNB->dlsch_stats[i].round_trials[0], diff --git a/openair1/SCHED/nfapi_lte_dummy.c b/openair1/SCHED/nfapi_lte_dummy.c index 6b17043ca60dc7c716b9e1a0b0e508ba6a46d52a..9562e2de30ca6b7e7266888e31fabed83b6c664a 100644 --- a/openair1/SCHED/nfapi_lte_dummy.c +++ b/openair1/SCHED/nfapi_lte_dummy.c @@ -12,16 +12,16 @@ void handle_nfapi_nr_pdcch_pdu(PHY_VARS_gNB *gNB, void handle_nr_nfapi_ssb_pdu(PHY_VARS_gNB *gNB,int frame,int slot, nfapi_nr_dl_tti_request_pdu_t *dl_tti_pdu){} -int16_t find_nr_dlsch(uint16_t rnti, PHY_VARS_gNB *gNB,find_type_t type){} +int16_t find_nr_dlsch(uint16_t rnti, PHY_VARS_gNB *gNB,find_type_t type){return 0;} void handle_nr_nfapi_pdsch_pdu(PHY_VARS_gNB *gNB,int frame,int slot, nfapi_nr_dl_tti_pdsch_pdu *pdsch_pdu, uint8_t *sdu){ } -int l1_north_init_gNB(void){} +int l1_north_init_gNB(void){return 0;} uint8_t slot_ahead=6; //uint8_t nfapi_mode=0; -NR_IF_Module_t *NR_IF_Module_init(int Mod_id) {} +NR_IF_Module_t *NR_IF_Module_init(int Mod_id) {return NULL;} void handle_nfapi_nr_ul_dci_pdu(PHY_VARS_gNB *gNB, int frame, int slot, diff --git a/openair1/SCHED/nfapi_nr_dummy.c b/openair1/SCHED/nfapi_nr_dummy.c index e3664ec5803d3c60e1df04fb62103055256e995b..db20017fb81e828e50c9ae8754f941301b2c2bc5 100644 --- a/openair1/SCHED/nfapi_nr_dummy.c +++ b/openair1/SCHED/nfapi_nr_dummy.c @@ -12,16 +12,16 @@ void handle_nfapi_nr_pdcch_pdu(PHY_VARS_gNB *gNB, void handle_nr_nfapi_ssb_pdu(PHY_VARS_gNB *gNB,int frame,int slot, nfapi_nr_dl_tti_request_pdu_t *dl_tti_pdu){} -int16_t find_nr_dlsch(uint16_t rnti, PHY_VARS_gNB *gNB,find_type_t type){} +int16_t find_nr_dlsch(uint16_t rnti, PHY_VARS_gNB *gNB,find_type_t type){return 0;} void handle_nr_nfapi_pdsch_pdu(PHY_VARS_gNB *gNB,int frame,int slot, nfapi_nr_dl_tti_pdsch_pdu *pdsch_pdu, uint8_t *sdu){ } -int l1_north_init_gNB(void){} +int l1_north_init_gNB(void){return 0;} uint8_t slot_ahead=6; //uint8_t nfapi_mode=0; -NR_IF_Module_t *NR_IF_Module_init(int Mod_id) {} +NR_IF_Module_t *NR_IF_Module_init(int Mod_id) {return NULL;} void handle_nfapi_nr_ul_dci_pdu(PHY_VARS_gNB *gNB, int frame, int slot, diff --git a/openair1/SCHED_NR/fapi_nr_l1.c b/openair1/SCHED_NR/fapi_nr_l1.c index 0fd3cc23434ee1f9a296e320a784dca1f44763ef..b03a6b2e178b24e7fe837d35fab6d81b665fa184 100644 --- a/openair1/SCHED_NR/fapi_nr_l1.c +++ b/openair1/SCHED_NR/fapi_nr_l1.c @@ -177,7 +177,7 @@ void nr_schedule_response(NR_Sched_Rsp_t *Sched_INFO){ switch (dl_tti_pdu->PDUType) { case NFAPI_NR_DL_TTI_SSB_PDU_TYPE: gNB->pbch_configured=1; - if(nfapi_mode != NFAPI_MODE_VNF) + if(NFAPI_MODE != NFAPI_MODE_VNF) handle_nr_nfapi_ssb_pdu(gNB,frame,slot, dl_tti_pdu); @@ -185,7 +185,7 @@ void nr_schedule_response(NR_Sched_Rsp_t *Sched_INFO){ case NFAPI_NR_DL_TTI_PDCCH_PDU_TYPE: AssertFatal(pdcch_received == 0, "pdcch_received is not 0, we can only handle one PDCCH PDU per slot\n"); - if(nfapi_mode != NFAPI_MODE_VNF) + if(NFAPI_MODE != NFAPI_MODE_VNF) handle_nfapi_nr_pdcch_pdu(gNB, frame, slot, &dl_tti_pdu->pdcch_pdu); @@ -202,19 +202,19 @@ void nr_schedule_response(NR_Sched_Rsp_t *Sched_INFO){ AssertFatal(TX_req->pdu_list[pduIndex].num_TLV == 1, "TX_req->pdu_list[%d].num_TLV %d != 1\n", pduIndex,TX_req->pdu_list[pduIndex].num_TLV); uint8_t *sdu = (uint8_t *)TX_req->pdu_list[pduIndex].TLVs[0].value.direct; - if(nfapi_mode != NFAPI_MODE_VNF) + if(NFAPI_MODE != NFAPI_MODE_VNF) handle_nr_nfapi_pdsch_pdu(gNB,frame,slot,&dl_tti_pdu->pdsch_pdu, sdu); } } } // if (UL_tti_req!=NULL) memcpy(&gNB->UL_tti_req,UL_tti_req,sizeof(nfapi_nr_ul_tti_request_t)); - if(nfapi_mode != NFAPI_MODE_VNF) + if(NFAPI_MODE != NFAPI_MODE_VNF) for (int i=0;i<number_ul_dci_pdu;i++) { handle_nfapi_nr_ul_dci_pdu(gNB, frame, slot, &UL_dci_req->ul_dci_pdu_list[i]); } -if(nfapi_mode != NFAPI_MODE_VNF) +if(NFAPI_MODE != NFAPI_MODE_VNF) for (int i = 0; i < number_ul_tti_pdu; i++) { switch (UL_tti_req->pdus_list[i].pdu_type) { case NFAPI_NR_UL_CONFIG_PUSCH_PDU_TYPE: @@ -234,17 +234,17 @@ if(nfapi_mode != NFAPI_MODE_VNF) } } -// if(nfapi_mode != NFAPI_MONOLITHIC && number_ul_tti_pdu>0) +// if(NFAPI_MODE != NFAPI_MONOLITHIC && number_ul_tti_pdu>0) // { // oai_nfapi_ul_tti_req(UL_tti_req); // } -// if (nfapi_mode != NFAPI_MONOLITHIC && Sched_INFO->UL_dci_req->numPdus!=0) +// if (NFAPI_MODE != NFAPI_MONOLITHIC && Sched_INFO->UL_dci_req->numPdus!=0) // { // oai_nfapi_ul_dci_req(Sched_INFO->UL_dci_req); // }//Only DL - if (nfapi_mode != NFAPI_MONOLITHIC) + if (NFAPI_MODE != NFAPI_MONOLITHIC) { if(Sched_INFO->DL_req->dl_tti_request_body.nPDUs>0) { Sched_INFO->DL_req->SFN = frame; diff --git a/openair1/SCHED_NR/phy_frame_config_nr.c b/openair1/SCHED_NR/phy_frame_config_nr.c index 6535f8bb1b17f5619a136e51a60c2e5c631bbb71..ee0e6d7c0b793150f45a29ced445f7629f370285 100644 --- a/openair1/SCHED_NR/phy_frame_config_nr.c +++ b/openair1/SCHED_NR/phy_frame_config_nr.c @@ -150,6 +150,7 @@ int set_tdd_config_nr( nfapi_nr_config_request_scf_t *cfg, } } } + //printf("Set tdd config nr tti: 26, symbol count: 0 value: %d \n", cfg->tdd_table.max_tdd_periodicity_list[26].max_num_of_symbol_per_slot_list[0].slot_config.value); /* while(slot_number != nb_slots_to_set) { @@ -312,14 +313,16 @@ int set_tdd_configuration_dedicated_nr(NR_DL_FRAME_PARMS *frame_parms) { int nr_slot_select(nfapi_nr_config_request_scf_t *cfg, int nr_frame, int nr_tti) { /* for FDD all slot can be considered as an uplink */ + int mu = cfg->ssb_config.scs_common.value,check_slot=0; if (cfg->cell_config.frame_duplex_type.value == FDD) { return (NR_UPLINK_SLOT | NR_DOWNLINK_SLOT ); } - -#if 1 // Hardcoding, change later + if (nr_frame%2 == 0) { + + for(int symbol_count=0; symbol_count<NR_NUMBER_OF_SYMBOLS_PER_SLOT; symbol_count++) { if (cfg->tdd_table.max_tdd_periodicity_list[nr_tti].max_num_of_symbol_per_slot_list[symbol_count].slot_config.value==1) { check_slot++; @@ -331,7 +334,7 @@ int nr_slot_select(nfapi_nr_config_request_scf_t *cfg, int nr_frame, int nr_tti) } check_slot = 0; - + for(int symbol_count=0; symbol_count<NR_NUMBER_OF_SYMBOLS_PER_SLOT; symbol_count++) { if (cfg->tdd_table.max_tdd_periodicity_list[nr_tti].max_num_of_symbol_per_slot_list[symbol_count].slot_config.value==0) { check_slot++; @@ -344,7 +347,8 @@ int nr_slot_select(nfapi_nr_config_request_scf_t *cfg, int nr_frame, int nr_tti) return (NR_MIXED_SLOT); } } else { - for(int symbol_count=0; symbol_count<NR_NUMBER_OF_SYMBOLS_PER_SLOT; symbol_count++) { + + for(int symbol_count=0; symbol_count<NR_NUMBER_OF_SYMBOLS_PER_SLOT; symbol_count++) { if (cfg->tdd_table.max_tdd_periodicity_list[((1<<mu) * NR_NUMBER_OF_SUBFRAMES_PER_FRAME) + nr_tti].max_num_of_symbol_per_slot_list[symbol_count].slot_config.value==1) { check_slot++; } @@ -355,7 +359,7 @@ int nr_slot_select(nfapi_nr_config_request_scf_t *cfg, int nr_frame, int nr_tti) } check_slot = 0; - + for(int symbol_count=0; symbol_count<NR_NUMBER_OF_SYMBOLS_PER_SLOT; symbol_count++) { if (cfg->tdd_table.max_tdd_periodicity_list[((1<<mu) * NR_NUMBER_OF_SUBFRAMES_PER_FRAME) + nr_tti].max_num_of_symbol_per_slot_list[symbol_count].slot_config.value==0) { check_slot++; @@ -368,10 +372,6 @@ 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 - } diff --git a/openair1/SCHED_NR/phy_procedures_nr_gNB.c b/openair1/SCHED_NR/phy_procedures_nr_gNB.c index 09d1648eb5a36dd5a949fa6e8f523d08aae1e962..202a8e5c70e157db331ace389102f426a3ebd32b 100644 --- a/openair1/SCHED_NR/phy_procedures_nr_gNB.c +++ b/openair1/SCHED_NR/phy_procedures_nr_gNB.c @@ -164,7 +164,7 @@ void phy_procedures_gNB_TX(PHY_VARS_gNB *gNB, } VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_gNB_COMMON_TX,1); - if (nfapi_mode == NFAPI_MONOLITHIC || nfapi_mode == NFAPI_MODE_PNF) { + if (NFAPI_MODE == NFAPI_MONOLITHIC || NFAPI_MODE == NFAPI_MODE_PNF) { if ((!(frame%ssb_frame_periodicity))) // generate SSB only for given frames according to SSB periodicity nr_common_signal_procedures(gNB,frame, slot); } diff --git a/openair1/SIMULATION/NR_PHY/nr_dummy_functions.c b/openair1/SIMULATION/NR_PHY/nr_dummy_functions.c index 2bccea3235b5b83d14097b5cc153e031988bc16a..3e57320c4be30c0af6d7f2df6d93b396c41e574d 100644 --- a/openair1/SIMULATION/NR_PHY/nr_dummy_functions.c +++ b/openair1/SIMULATION/NR_PHY/nr_dummy_functions.c @@ -9,4 +9,8 @@ int oai_nfapi_ul_tti_req(nfapi_nr_ul_tti_request_t *ul_tti_req){ return(0); } int32_t get_uldl_offset(int nr_bandP) { return(0); } NR_IF_Module_t *NR_IF_Module_init(int Mod_id) {return(NULL);} // int dummy_nr_ue_dl_indication(nr_downlink_indication_t *dl_info) { return(0); } -// int dummy_nr_ue_ul_indication(nr_uplink_indication_t *ul_info) { return(0); } \ No newline at end of file +// int dummy_nr_ue_ul_indication(nr_uplink_indication_t *ul_info) { return(0); } +nfapi_mode_t nfapi_mod; +nfapi_mode_t nfapi_getmode(void) { + return nfapi_mod; +} \ No newline at end of file diff --git a/openair1/SIMULATION/NR_PHY/prachsim.c b/openair1/SIMULATION/NR_PHY/prachsim.c index 9ed492b1619f509600633c60e574d72d6a7b82ab..8e05a01e96cb15080752ad393203736bfa17978d 100644 --- a/openair1/SIMULATION/NR_PHY/prachsim.c +++ b/openair1/SIMULATION/NR_PHY/prachsim.c @@ -47,7 +47,7 @@ #include "OCG_vars.h" #include <openair2/LAYER2/MAC/mac_vars.h> #include <openair2/RRC/LTE/rrc_vars.h> -#include "openair1/SIMULATION/NR_PHY/nr_dummy_functions.c" +//#include "openair1/SIMULATION/NR_PHY/nr_dummy_functions.c" #define NR_PRACH_DEBUG 1 @@ -71,6 +71,10 @@ int sl_ahead = 0; /* temporary dummy implem of get_softmodem_optmask, till basic simulators implemented as device */ uint64_t get_softmodem_optmask(void) {return 0;} softmodem_params_t *get_softmodem_params(void) {return 0;} +int oai_nfapi_dl_tti_req(nfapi_nr_dl_tti_request_t *dl_config_req) { return(0); } +int oai_nfapi_tx_data_req(nfapi_nr_tx_data_request_t *tx_data_req){ return(0); } +int oai_nfapi_ul_dci_req(nfapi_nr_ul_dci_request_t *ul_dci_req){ return(0); } +int oai_nfapi_ul_tti_req(nfapi_nr_ul_tti_request_t *ul_tti_req){ return(0); } void rrc_data_ind( diff --git a/openair2/LAYER2/NR_MAC_gNB/config.c b/openair2/LAYER2/NR_MAC_gNB/config.c index e24ea915cc4dfb8579fb725d63823b7801b58133..c9c4802374112fede32e751efa8107b2e37a6942 100644 --- a/openair2/LAYER2/NR_MAC_gNB/config.c +++ b/openair2/LAYER2/NR_MAC_gNB/config.c @@ -308,6 +308,7 @@ void config_common(int Mod_idP, int pdsch_AntennaPorts, NR_ServingCellConfigComm LOG_E(MAC,"TDD configuration can not be done\n"); else LOG_I(MAC,"TDD has been properly configurated\n"); + } } diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c index d557db2851bfdcfc87a988cb921ad11a73c40b84..e375bdb3837414988f286df67823c861db287234 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c @@ -97,7 +97,7 @@ void clear_nr_nfapi_information(gNB_MAC_INST * gNB, gNB->pdu_index[CC_idP] = 0; - if (nfapi_mode == NFAPI_MONOLITHIC || nfapi_mode == NFAPI_MODE_PNF) { // monolithic or PNF + if (NFAPI_MODE == NFAPI_MONOLITHIC || NFAPI_MODE == NFAPI_MODE_PNF) { // monolithic or PNF DL_req[CC_idP].SFN = frameP; DL_req[CC_idP].Slot = slotP; @@ -291,10 +291,11 @@ bool is_xlsch_in_slot(uint64_t bitmap, sub_frame_t slot) { return (bitmap >> slot) & 0x01; } -void gNB_dlsch_ulsch_scheduler(module_id_t module_idP, +void +gNB_dlsch_ulsch_scheduler(module_id_t module_idP, frame_t frame, sub_frame_t slot){ - + protocol_ctxt_t ctxt; PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, module_idP, ENB_FLAG_YES, NOT_A_RNTI, frame, slot,module_idP); @@ -308,7 +309,7 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP, NR_COMMON_channels_t *cc = gNB->common_channels; NR_ServingCellConfigCommon_t *scc = cc->ServingCellConfigCommon; NR_TDD_UL_DL_Pattern_t *tdd_pattern = &scc->tdd_UL_DL_ConfigurationCommon->pattern1; - + switch(scc->tdd_UL_DL_ConfigurationCommon->pattern1.dl_UL_TransmissionPeriodicity) { case 0: nb_periods_per_frame = 20; // 10ms/0p5ms @@ -360,7 +361,7 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP, nr_rlc_tick(frame, slot >> *scc->ssbSubcarrierSpacing); nr_rrc_trigger(&ctxt, 0 /*CC_id*/, frame, slot >> *scc->ssbSubcarrierSpacing); } - + const uint64_t dlsch_in_slot_bitmap = (1 << 1) | (1 << 2); //const uint64_t dlsch_in_slot_bitmap = (1 << 2); const uint64_t ulsch_in_slot_bitmap = (1 << 8); @@ -371,7 +372,6 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP, RC.nrmac[module_idP]->UE_info.num_pdcch_cand[UE_id][i] = 0; for (int CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) { //mbsfn_status[CC_id] = 0; - // clear vrb_maps memset(cc[CC_id].vrb_map, 0, sizeof(uint16_t) * 275); // clear last scheduled slot's content (only)! @@ -382,14 +382,11 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP, clear_nr_nfapi_information(RC.nrmac[module_idP], CC_id, frame, slot); } - - + if ((slot == 0) && (frame & 127) == 0) dump_mac_stats(RC.nrmac[module_idP]); - // This schedules MIB schedule_nr_mib(module_idP, frame, slot, nr_slots_per_frame[*scc->ssbSubcarrierSpacing]); - // This schedule PRACH if we are not in phy_test mode if (get_softmodem_params()->phy_test == 0) { /* we need to make sure that resources for PRACH are free. To avoid that @@ -402,6 +399,7 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP, const frame_t f = (frame + (slot + n_slots_ahead) / nr_slots_per_frame[*scc->ssbSubcarrierSpacing]) % 1024; const sub_frame_t s = (slot + n_slots_ahead) % nr_slots_per_frame[*scc->ssbSubcarrierSpacing]; schedule_nr_prach(module_idP, f, s); + } // This schedule SR @@ -416,23 +414,20 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP, if (get_softmodem_params()->phy_test == 0) { nr_schedule_RA(module_idP, frame, slot); } - // This schedules the DCI for Uplink and subsequently PUSCH if (slot < 10) { + if(NFAPI_MODE == NFAPI_MODE_VNF){ + gNB->UL_tti_req_ahead[0][8].SFN = frame;//Added to set the UL_tti_req_ahead SFN in VNF mode + } nr_schedule_ulsch(module_idP, frame, slot, num_slots_per_tdd, nr_ulmix_slots, ulsch_in_slot_bitmap); } - // This schedules the DCI for Downlink and PDSCH if (is_xlsch_in_slot(dlsch_in_slot_bitmap, slot % num_slots_per_tdd) && slot < 10) { nr_schedule_ue_spec(module_idP, frame, slot, num_slots_per_tdd); } - - if (UE_info->active[UE_id]) nr_schedule_pucch(module_idP, UE_id, nr_ulmix_slots, frame, slot); - stop_meas(&RC.nrmac[module_idP]->eNB_scheduler); - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_gNB_DLSCH_ULSCH_SCHEDULER,VCD_FUNCTION_OUT); } diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c index e15963f35502b9d493eb16d166645d4817f5725f..903c230e74330c91bc935533692b66363ddec0bf 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c @@ -669,6 +669,7 @@ void nr_add_msg3(module_id_t module_idP, int CC_id, frame_t frameP, sub_frame_t future_ul_tti_req->pdus_list[future_ul_tti_req->n_pdus].pdu_size = sizeof(nfapi_nr_pusch_pdu_t); nfapi_nr_pusch_pdu_t *pusch_pdu = &future_ul_tti_req->pdus_list[future_ul_tti_req->n_pdus].pusch_pdu; memset(pusch_pdu, 0, sizeof(nfapi_nr_pusch_pdu_t)); + //pusch_pdu = (nfapi_nr_pusch_pdu_t *) malloc(sizeof(nfapi_nr_pusch_pdu_t)); future_ul_tti_req->n_pdus += 1; AssertFatal(ra->secondaryCellGroup, diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c index ec5195ec5beacf7c19ff9f40ed5f483da4f4e115..8293947874275dce873dce88b4e9194ad462bc70 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c @@ -31,6 +31,7 @@ #include "NR_MAC_COMMON/nr_mac_extern.h" #include "NR_MAC_gNB/mac_proto.h" #include "common/ran_context.h" +#include "nfapi/oai_integration/vendor_ext.h" extern RAN_CONTEXT_t RC; @@ -39,9 +40,9 @@ void nr_schedule_pucch(int Mod_idP, int nr_ulmix_slots, frame_t frameP, sub_frame_t slotP) { + NR_UE_info_t *UE_info = &RC.nrmac[Mod_idP]->UE_info; AssertFatal(UE_info->active[UE_id],"Cannot find UE_id %d is not active\n",UE_id); - for (int k=0; k<nr_ulmix_slots; k++) { for (int l=0; l<2; l++) { NR_sched_pucch *curr_pucch = &UE_info->UE_sched_ctrl[UE_id].sched_pucch[k][l]; @@ -52,7 +53,7 @@ void nr_schedule_pucch(int Mod_idP, || frameP != curr_pucch->frame || slotP != curr_pucch->ul_slot) continue; - + nfapi_nr_ul_tti_request_t *future_ul_tti_req = &RC.nrmac[Mod_idP]->UL_tti_req_ahead[0][curr_pucch->ul_slot]; AssertFatal(future_ul_tti_req->SFN == curr_pucch->frame @@ -62,12 +63,16 @@ void nr_schedule_pucch(int Mod_idP, future_ul_tti_req->Slot, curr_pucch->frame, curr_pucch->ul_slot); - future_ul_tti_req->pdus_list[future_ul_tti_req->n_pdus].pdu_type = NFAPI_NR_UL_CONFIG_PUCCH_PDU_TYPE; - future_ul_tti_req->pdus_list[future_ul_tti_req->n_pdus].pdu_size = sizeof(nfapi_nr_pucch_pdu_t); + nfapi_nr_pucch_pdu_t *pucch_pdu = &future_ul_tti_req->pdus_list[future_ul_tti_req->n_pdus].pucch_pdu; - memset(pucch_pdu, 0, sizeof(nfapi_nr_pucch_pdu_t)); - future_ul_tti_req->n_pdus += 1; + future_ul_tti_req->pdus_list[future_ul_tti_req->n_pdus].pdu_type = NFAPI_NR_UL_CONFIG_PUCCH_PDU_TYPE; + + //future_ul_tti_req->pdus_list[future_ul_tti_req->n_pdus].pdu_size = sizeof(nfapi_nr_pucch_pdu_t); + + /*For some reason, seems to cause a segmentation fault in the VNF while running nFAPI. If size of pucch pdu is needed, + use the size function on the pdu structure directly. */ + future_ul_tti_req->n_pdus += 1; LOG_D(MAC, "%4d.%2d Scheduling pucch reception in %4d.%2d: bits SR %d, ACK %d, CSI %d, k %d l %d\n", frameP, @@ -79,6 +84,11 @@ void nr_schedule_pucch(int Mod_idP, O_csi, k, l); + if(NFAPI_MODE == NFAPI_MONOLITHIC) + memset(pucch_pdu, 0, sizeof(nfapi_nr_pucch_pdu_t)); + + if(NFAPI_MODE == NFAPI_MODE_VNF) + pucch_pdu = (nfapi_nr_pucch_pdu_t*) calloc(1,sizeof(nfapi_nr_pucch_pdu_t)); NR_ServingCellConfigCommon_t *scc = RC.nrmac[Mod_idP]->common_channels->ServingCellConfigCommon; nr_configure_pucch(pucch_pdu, scc, @@ -88,7 +98,6 @@ void nr_schedule_pucch(int Mod_idP, O_csi, O_ack, O_sr); - memset(&UE_info->UE_sched_ctrl[UE_id].sched_pucch[k][l], 0, sizeof(NR_sched_pucch)); diff --git a/openair2/NR_PHY_INTERFACE/NR_IF_Module.c b/openair2/NR_PHY_INTERFACE/NR_IF_Module.c index 9513869fa5d6a6a17b776b86978edbb5a8e5ea59..e91ebbd64a2520498ea3ad2fa7a541c9f352dd2b 100644 --- a/openair2/NR_PHY_INTERFACE/NR_IF_Module.c +++ b/openair2/NR_PHY_INTERFACE/NR_IF_Module.c @@ -193,7 +193,7 @@ void NR_UL_indication(NR_UL_IND_t *UL_info) { module_id,CC_id, UL_info->rach_ind.number_of_pdus, UL_info->rx_ind.number_of_pdus, UL_info->crc_ind.number_crcs); - if (nfapi_mode != NFAPI_MODE_PNF) { + if (NFAPI_MODE != NFAPI_MODE_PNF) { if (ifi->CC_mask==0) { ifi->current_frame = UL_info->frame; ifi->current_slot = UL_info->slot; @@ -212,7 +212,7 @@ void NR_UL_indication(NR_UL_IND_t *UL_info) { mac->UL_dci_req[CC_id].numPdus = 0; handle_nr_ulsch(UL_info); - if (nfapi_mode != NFAPI_MODE_PNF) { + if (NFAPI_MODE != NFAPI_MODE_PNF) { if (ifi->CC_mask == ((1<<MAX_NUM_CCs)-1)) { /* eNB_dlsch_ulsch_scheduler(module_id, @@ -220,11 +220,12 @@ void NR_UL_indication(NR_UL_IND_t *UL_info) { (UL_info->slot+sl_ahead)%10); */ nfapi_nr_config_request_scf_t *cfg = &mac->config[CC_id]; + int spf = get_spf(cfg); + gNB_dlsch_ulsch_scheduler(module_id, (UL_info->frame+((UL_info->slot>(spf-1-sl_ahead))?1:0)) % 1024, (UL_info->slot+sl_ahead)%spf); - ifi->CC_mask = 0; sched_info->module_id = module_id; sched_info->CC_id = CC_id; @@ -239,7 +240,6 @@ void NR_UL_indication(NR_UL_IND_t *UL_info) { #ifdef DUMP_FAPI dump_dl(sched_info); #endif - if (ifi->NR_Schedule_response) { AssertFatal(ifi->NR_Schedule_response!=NULL, "nr_schedule_response is null (mod %d, cc %d)\n", @@ -247,11 +247,11 @@ void NR_UL_indication(NR_UL_IND_t *UL_info) { CC_id); ifi->NR_Schedule_response(sched_info); } - LOG_D(PHY,"NR_Schedule_response: SFN_SF:%d%d dl_pdus:%d\n", sched_info->frame, sched_info->slot, sched_info->DL_req->dl_tti_request_body.nPDUs); + } } }