Commit 776a7440 authored by MaheshK1995's avatar MaheshK1995

LTE to NR conversions

parent 01751798
...@@ -864,7 +864,7 @@ if(!IS_SOFTMODEM_NOS1) ...@@ -864,7 +864,7 @@ if(!IS_SOFTMODEM_NOS1)
AssertFatal(create_gNB_tasks(1) == 0,"cannot create ITTI tasks\n"); AssertFatal(create_gNB_tasks(1) == 0,"cannot create ITTI tasks\n");
} else { } else {
printf("No ITTI, Initializing L1\n"); printf("No ITTI, Initializing L1\n");
RCconfig_L1(); RCconfig_NR_L1();
} }
/* Start the agent. If it is turned off in the configuration, it won't start */ /* Start the agent. If it is turned off in the configuration, it won't start */
......
...@@ -30,6 +30,9 @@ ...@@ -30,6 +30,9 @@
#include "debug.h" #include "debug.h"
#include "nfapi/oai_integration/vendor_ext.h" #include "nfapi/oai_integration/vendor_ext.h"
#include "nfapi_pnf_interface.h" #include "nfapi_pnf_interface.h"
#include "nfapi_nr_interface.h"
#include "nfapi_nr_interface_scf.h"
#include "nfapi.h" #include "nfapi.h"
#include "nfapi_pnf.h" #include "nfapi_pnf.h"
#include "common/ran_context.h" #include "common/ran_context.h"
...@@ -52,6 +55,7 @@ extern RAN_CONTEXT_t RC; ...@@ -52,6 +55,7 @@ extern RAN_CONTEXT_t RC;
#include "PHY/INIT/phy_init.h" #include "PHY/INIT/phy_init.h"
#include "PHY/LTE_TRANSPORT/transport_proto.h" #include "PHY/LTE_TRANSPORT/transport_proto.h"
#include "openair2/LAYER2/NR_MAC_gNB/mac_proto.h"
#define NUM_P5_PHY 2 #define NUM_P5_PHY 2
...@@ -452,7 +456,7 @@ int pnf_stop_request(nfapi_pnf_config_t *config, nfapi_pnf_stop_request_t *req) ...@@ -452,7 +456,7 @@ int pnf_stop_request(nfapi_pnf_config_t *config, nfapi_pnf_stop_request_t *req)
return 0; return 0;
} }
int param_request(nfapi_pnf_config_t *config, nfapi_pnf_phy_config_t *phy, nfapi_param_request_t *req) { int param_request(nfapi_pnf_config_t *config, nfapi_pnf_phy_config_t *phy, nfapi_nr_param_request_scf_t *req) {
printf("[PNF] Received NFAPI_PARAM_REQUEST phy_id:%d\n", req->header.phy_id); printf("[PNF] Received NFAPI_PARAM_REQUEST phy_id:%d\n", req->header.phy_id);
//pnf_info* pnf = (pnf_info*)(config->user_data); //pnf_info* pnf = (pnf_info*)(config->user_data);
nfapi_param_response_t nfapi_resp; nfapi_param_response_t nfapi_resp;
...@@ -463,12 +467,12 @@ int param_request(nfapi_pnf_config_t *config, nfapi_pnf_phy_config_t *phy, nfapi ...@@ -463,12 +467,12 @@ int param_request(nfapi_pnf_config_t *config, nfapi_pnf_phy_config_t *phy, nfapi
nfapi_resp.error_code = 0; // DJP - what value??? nfapi_resp.error_code = 0; // DJP - what value???
struct sockaddr_in pnf_p7_sockaddr; struct sockaddr_in pnf_p7_sockaddr;
pnf_p7_sockaddr.sin_addr.s_addr = inet_addr(pnf->phys[0].local_addr); pnf_p7_sockaddr.sin_addr.s_addr = inet_addr(pnf->phys[0].local_addr);
nfapi_resp.nfapi_config.p7_pnf_address_ipv4.tl.tag = NFAPI_NFAPI_P7_PNF_ADDRESS_IPV4_TAG; nfapi_resp.nfapi_config.p7_pnf_address_ipv4.tl.tag = NFAPI_NR_NFAPI_P7_PNF_ADDRESS_IPV4_TAG;
memcpy(nfapi_resp.nfapi_config.p7_pnf_address_ipv4.address, &pnf_p7_sockaddr.sin_addr.s_addr, 4); memcpy(nfapi_resp.nfapi_config.p7_pnf_address_ipv4.address, &pnf_p7_sockaddr.sin_addr.s_addr, 4);
nfapi_resp.num_tlv++; nfapi_resp.num_tlv++;
// P7 PNF Port // P7 PNF Port
nfapi_resp.nfapi_config.p7_pnf_port.tl.tag = NFAPI_NFAPI_P7_PNF_PORT_TAG; nfapi_resp.nfapi_config.p7_pnf_port.tl.tag = NFAPI_NR_NFAPI_P7_PNF_PORT_TAG;
nfapi_resp.nfapi_config.p7_pnf_port.value = 32123; // DJP - hard code alert!!!! FIXME TODO nfapi_resp.nfapi_config.p7_pnf_port.value = pnf->phys[0].local_port; // 32123; // DJP - hard code alert!!!! FIXME TODO
nfapi_resp.num_tlv++; nfapi_resp.num_tlv++;
nfapi_pnf_param_resp(config, &nfapi_resp); nfapi_pnf_param_resp(config, &nfapi_resp);
printf("[PNF] Sent NFAPI_PARAM_RESPONSE phy_id:%d number_of_tlvs:%u\n", req->header.phy_id, nfapi_resp.num_tlv); printf("[PNF] Sent NFAPI_PARAM_RESPONSE phy_id:%d number_of_tlvs:%u\n", req->header.phy_id, nfapi_resp.num_tlv);
...@@ -476,24 +480,26 @@ int param_request(nfapi_pnf_config_t *config, nfapi_pnf_phy_config_t *phy, nfapi ...@@ -476,24 +480,26 @@ int param_request(nfapi_pnf_config_t *config, nfapi_pnf_phy_config_t *phy, nfapi
return 0; return 0;
} }
int config_request(nfapi_pnf_config_t *config, nfapi_pnf_phy_config_t *phy, nfapi_config_request_t *req) { int config_request(nfapi_pnf_config_t *config, nfapi_pnf_phy_config_t *phy, nfapi_nr_config_request_scf_t *req) {
printf("[PNF] Received NFAPI_CONFIG_REQ phy_id:%d\n", req->header.phy_id); printf("[PNF] Received NFAPI_CONFIG_REQ phy_id:%d\n", req->header.phy_id);
pnf_info *pnf = (pnf_info *)(config->user_data); pnf_info *pnf = (pnf_info *)(config->user_data);
uint8_t num_tlv = 0; uint8_t num_tlv = 0;
//struct PHY_VARS_eNB_s *eNB = RC.eNB[0][0]; //struct PHY_VARS_eNB_s *eNB = RC.eNB[0][0];
// In the case of nfapi_mode = 3 (UE = PNF) we should not have dependency on any eNB var. So we aim // In the case of nfapi_mode = 3 (UE = PNF) we should not have dependency on any eNB var. So we aim
// to keep only the necessary just to keep the nfapi FSM rolling by sending a dummy response. // to keep only the necessary just to keep the nfapi FSM rolling by sending a dummy response.
LTE_DL_FRAME_PARMS *fp; NR_DL_FRAME_PARMS *fp;
if (NFAPI_MODE!=NFAPI_UE_STUB_PNF) { if (NFAPI_MODE!=NFAPI_UE_STUB_PNF) {
struct PHY_VARS_eNB_s *eNB = RC.eNB[0][0]; struct PHY_VARS_gNB_s *gNB = RC.gNB[0];
fp = &eNB->frame_parms; fp = &gNB->frame_parms;
} else { } else {
fp = (LTE_DL_FRAME_PARMS *) malloc(sizeof(LTE_DL_FRAME_PARMS)); fp = (NR_DL_FRAME_PARMS *) malloc(sizeof(NR_DL_FRAME_PARMS));
} }
phy_info *phy_info = pnf->phys; phy_info *phy_info = pnf->phys;
// TODO: change all these tags to NR
#if 0
if(req->nfapi_config.timing_window.tl.tag == NFAPI_NFAPI_TIMING_WINDOW_TAG) { if(req->nfapi_config.timing_window.tl.tag == NFAPI_NFAPI_TIMING_WINDOW_TAG) {
phy_info->timing_window = req->nfapi_config.timing_window.value; phy_info->timing_window = req->nfapi_config.timing_window.value;
printf("Phy_info:Timing window:%u NFAPI_CONFIG:timing_window:%u\n", phy_info->timing_window, req->nfapi_config.timing_window.value); printf("Phy_info:Timing window:%u NFAPI_CONFIG:timing_window:%u\n", phy_info->timing_window, req->nfapi_config.timing_window.value);
...@@ -650,14 +656,14 @@ int config_request(nfapi_pnf_config_t *config, nfapi_pnf_phy_config_t *phy, nfap ...@@ -650,14 +656,14 @@ int config_request(nfapi_pnf_config_t *config, nfapi_pnf_phy_config_t *phy, nfap
if(NFAPI_MODE!=NFAPI_UE_STUB_PNF) { if(NFAPI_MODE!=NFAPI_UE_STUB_PNF) {
printf("[PNF] CONFIG_REQUEST[num_tlv:%d] TLVs processed:%d\n", req->num_tlv, num_tlv); printf("[PNF] CONFIG_REQUEST[num_tlv:%d] TLVs processed:%d\n", req->num_tlv, num_tlv);
printf("[PNF] Simulating PHY CONFIG - DJP\n"); printf("[PNF] Simulating PHY CONFIG - DJP\n");
PHY_Config_t phy_config; NR_PHY_Config_t nr_phy_config;
phy_config.Mod_id = 0; nr_phy_config.Mod_id = 0;
phy_config.CC_id=0; nr_phy_config.CC_id=0;
phy_config.cfg = req; nr_phy_config.cfg = req;
phy_config_request(&phy_config); nr_phy_config_request(&nr_phy_config);
dump_frame_parms(fp); nr_dump_frame_parms(fp);
} }
#endif
phy_info->remote_port = req->nfapi_config.p7_vnf_port.value; phy_info->remote_port = req->nfapi_config.p7_vnf_port.value;
struct sockaddr_in vnf_p7_sockaddr; struct sockaddr_in vnf_p7_sockaddr;
memcpy(&vnf_p7_sockaddr.sin_addr.s_addr, &(req->nfapi_config.p7_vnf_address_ipv4.address[0]), 4); memcpy(&vnf_p7_sockaddr.sin_addr.s_addr, &(req->nfapi_config.p7_vnf_address_ipv4.address[0]), 4);
......
...@@ -39,6 +39,7 @@ ...@@ -39,6 +39,7 @@
#include "nfapi_vnf.h" #include "nfapi_vnf.h"
#include "PHY/defs_eNB.h" #include "PHY/defs_eNB.h"
#include "PHY/LTE_TRANSPORT/transport_proto.h" #include "PHY/LTE_TRANSPORT/transport_proto.h"
#include "openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h"
#include "common/ran_context.h" #include "common/ran_context.h"
extern RAN_CONTEXT_t RC; extern RAN_CONTEXT_t RC;
...@@ -189,7 +190,7 @@ int vnf_pack_vendor_extension_tlv(void *ve, uint8_t **ppWritePackedMsg, uint8_t ...@@ -189,7 +190,7 @@ int vnf_pack_vendor_extension_tlv(void *ve, uint8_t **ppWritePackedMsg, uint8_t
int vnf_unpack_vendor_extension_tlv(nfapi_tl_t *tl, uint8_t **ppReadPackedMessage, uint8_t *end, void **ve, nfapi_p4_p5_codec_config_t *codec) { int vnf_unpack_vendor_extension_tlv(nfapi_tl_t *tl, uint8_t **ppReadPackedMessage, uint8_t *end, void **ve, nfapi_p4_p5_codec_config_t *codec) {
return -1; return -1;
} }
void install_nr_schedule_handlers(NR_IF_Module_t *if_inst);
void install_schedule_handlers(IF_Module_t *if_inst); void install_schedule_handlers(IF_Module_t *if_inst);
extern int single_thread_flag; extern int single_thread_flag;
extern void init_eNB_afterRU(void); extern void init_eNB_afterRU(void);
...@@ -1011,14 +1012,14 @@ int pnf_start_resp_cb(nfapi_vnf_config_t *config, int p5_idx, nfapi_pnf_start_re ...@@ -1011,14 +1012,14 @@ int pnf_start_resp_cb(nfapi_vnf_config_t *config, int p5_idx, nfapi_pnf_start_re
extern uint32_t to_earfcn(int eutra_bandP,uint32_t dl_CarrierFreq,uint32_t bw); extern uint32_t to_earfcn(int eutra_bandP,uint32_t dl_CarrierFreq,uint32_t bw);
int param_resp_cb(nfapi_vnf_config_t *config, int p5_idx, nfapi_param_response_t *resp) { int param_resp_cb(nfapi_vnf_config_t *config, int p5_idx, nfapi_nr_param_response_scf_t *resp) {
printf("[VNF] Received NFAPI_PARAM_RESP idx:%d phy_id:%d\n", p5_idx, resp->header.phy_id); printf("[VNF] Received NFAPI_PARAM_RESP idx:%d phy_id:%d\n", p5_idx, resp->header.phy_id);
vnf_info *vnf = (vnf_info *)(config->user_data); vnf_info *vnf = (vnf_info *)(config->user_data);
vnf_p7_info *p7_vnf = vnf->p7_vnfs; vnf_p7_info *p7_vnf = vnf->p7_vnfs;
pnf_info *pnf = vnf->pnfs; pnf_info *pnf = vnf->pnfs;
phy_info *phy = pnf->phys; phy_info *phy = pnf->phys;
struct sockaddr_in pnf_p7_sockaddr; struct sockaddr_in pnf_p7_sockaddr;
nfapi_config_request_t *req = &RC.mac[0]->config[0]; nfapi_nr_config_request_t *req = &RC.nrmac[0]->config[0];
phy->remote_port = resp->nfapi_config.p7_pnf_port.value; phy->remote_port = resp->nfapi_config.p7_pnf_port.value;
memcpy(&pnf_p7_sockaddr.sin_addr.s_addr, &(resp->nfapi_config.p7_pnf_address_ipv4.address[0]), 4); memcpy(&pnf_p7_sockaddr.sin_addr.s_addr, &(resp->nfapi_config.p7_pnf_address_ipv4.address[0]), 4);
phy->remote_addr = inet_ntoa(pnf_p7_sockaddr.sin_addr); phy->remote_addr = inet_ntoa(pnf_p7_sockaddr.sin_addr);
...@@ -1028,28 +1029,28 @@ int param_resp_cb(nfapi_vnf_config_t *config, int p5_idx, nfapi_param_response_t ...@@ -1028,28 +1029,28 @@ int param_resp_cb(nfapi_vnf_config_t *config, int p5_idx, nfapi_param_response_t
req->header.message_id = NFAPI_CONFIG_REQUEST; req->header.message_id = NFAPI_CONFIG_REQUEST;
req->header.phy_id = phy->id; req->header.phy_id = phy->id;
printf("[VNF] Send NFAPI_CONFIG_REQUEST\n"); printf("[VNF] Send NFAPI_CONFIG_REQUEST\n");
req->nfapi_config.p7_vnf_port.tl.tag = NFAPI_NFAPI_P7_VNF_PORT_TAG; req->nfapi_config.p7_vnf_port.tl.tag = NFAPI_NR_NFAPI_P7_VNF_PORT_TAG;
req->nfapi_config.p7_vnf_port.value = p7_vnf->local_port; req->nfapi_config.p7_vnf_port.value = p7_vnf->local_port;
req->num_tlv++; req->num_tlv++;
printf("[VNF] DJP local_port:%d\n", p7_vnf->local_port); printf("[VNF] DJP local_port:%d\n", p7_vnf->local_port);
req->nfapi_config.p7_vnf_address_ipv4.tl.tag = NFAPI_NFAPI_P7_VNF_ADDRESS_IPV4_TAG; req->nfapi_config.p7_vnf_address_ipv4.tl.tag = NFAPI_NR_NFAPI_P7_VNF_ADDRESS_IPV4_TAG;
struct sockaddr_in vnf_p7_sockaddr; struct sockaddr_in vnf_p7_sockaddr;
vnf_p7_sockaddr.sin_addr.s_addr = inet_addr(p7_vnf->local_addr); vnf_p7_sockaddr.sin_addr.s_addr = inet_addr(p7_vnf->local_addr);
memcpy(&(req->nfapi_config.p7_vnf_address_ipv4.address[0]), &vnf_p7_sockaddr.sin_addr.s_addr, 4); memcpy(&(req->nfapi_config.p7_vnf_address_ipv4.address[0]), &vnf_p7_sockaddr.sin_addr.s_addr, 4);
req->num_tlv++; req->num_tlv++;
printf("[VNF] DJP local_addr:%s\n", p7_vnf->local_addr); printf("[VNF] DJP local_addr:%s\n", p7_vnf->local_addr);
req->nfapi_config.timing_window.tl.tag = NFAPI_NFAPI_TIMING_WINDOW_TAG; req->nfapi_config.timing_window.tl.tag = NFAPI_NR_NFAPI_TIMING_WINDOW_TAG;
req->nfapi_config.timing_window.value = p7_vnf->timing_window; req->nfapi_config.timing_window.value = p7_vnf->timing_window;
printf("[VNF] Timing window:%u\n", p7_vnf->timing_window); printf("[VNF] Timing window:%u\n", p7_vnf->timing_window);
req->num_tlv++; req->num_tlv++;
if(p7_vnf->periodic_timing_enabled || p7_vnf->aperiodic_timing_enabled) { if(p7_vnf->periodic_timing_enabled || p7_vnf->aperiodic_timing_enabled) {
req->nfapi_config.timing_info_mode.tl.tag = NFAPI_NFAPI_TIMING_INFO_MODE_TAG; req->nfapi_config.timing_info_mode.tl.tag = NFAPI_NR_NFAPI_TIMING_INFO_MODE_TAG;
req->nfapi_config.timing_info_mode.value = (p7_vnf->aperiodic_timing_enabled << 1) | (p7_vnf->periodic_timing_enabled); req->nfapi_config.timing_info_mode.value = (p7_vnf->aperiodic_timing_enabled << 1) | (p7_vnf->periodic_timing_enabled);
req->num_tlv++; req->num_tlv++;
if(p7_vnf->periodic_timing_enabled) { if(p7_vnf->periodic_timing_enabled) {
req->nfapi_config.timing_info_period.tl.tag = NFAPI_NFAPI_TIMING_INFO_PERIOD_TAG; req->nfapi_config.timing_info_period.tl.tag = NFAPI_NR_NFAPI_TIMING_INFO_PERIOD_TAG;
req->nfapi_config.timing_info_period.value = p7_vnf->periodic_timing_period; req->nfapi_config.timing_info_period.value = p7_vnf->periodic_timing_period;
req->num_tlv++; req->num_tlv++;
} }
...@@ -1153,7 +1154,7 @@ void configure_nfapi_vnf(char *vnf_addr, int vnf_p5_port) { ...@@ -1153,7 +1154,7 @@ void configure_nfapi_vnf(char *vnf_addr, int vnf_p5_port) {
vnf.p7_vnfs[0].config = nfapi_vnf_p7_config_create(); vnf.p7_vnfs[0].config = nfapi_vnf_p7_config_create();
NFAPI_TRACE(NFAPI_TRACE_INFO, "[VNF] %s() vnf.p7_vnfs[0].config:%p VNF ADDRESS:%s:%d\n", __FUNCTION__, vnf.p7_vnfs[0].config, vnf_addr, vnf_p5_port); NFAPI_TRACE(NFAPI_TRACE_INFO, "[VNF] %s() vnf.p7_vnfs[0].config:%p VNF ADDRESS:%s:%d\n", __FUNCTION__, vnf.p7_vnfs[0].config, vnf_addr, vnf_p5_port);
strcpy(vnf.p7_vnfs[0].local_addr, vnf_addr); strcpy(vnf.p7_vnfs[0].local_addr, vnf_addr);
vnf.p7_vnfs[0].local_port = 50001; vnf.p7_vnfs[0].local_port = vnf.p7_vnfs[0].local_port; // 50001; // TODO: remove hardcode
vnf.p7_vnfs[0].mac = (mac_t *)malloc(sizeof(mac_t)); vnf.p7_vnfs[0].mac = (mac_t *)malloc(sizeof(mac_t));
nfapi_vnf_config_t *config = nfapi_vnf_config_create(); nfapi_vnf_config_t *config = nfapi_vnf_config_create();
config->malloc = malloc; config->malloc = malloc;
......
...@@ -587,6 +587,26 @@ typedef struct { ...@@ -587,6 +587,26 @@ typedef struct {
#define NFAPI_PNF_PHY_RF_TAG 0x1003 #define NFAPI_PNF_PHY_RF_TAG 0x1003
// Generic strucutre for single tlv value. // Generic strucutre for single tlv value.
typedef struct {
nfapi_tl_t tl;
int32_t value;
} nfapi_int32_tlv_t;
typedef struct {
nfapi_tl_t tl;
uint32_t value;
} nfapi_uint32_tlv_t;
typedef struct {
nfapi_tl_t tl;
int64_t value;
} nfapi_int64_tlv_t;
typedef struct {
nfapi_tl_t tl;
uint64_t value;
} nfapi_uint64_tlv_t;
typedef struct { typedef struct {
nfapi_tl_t tl; nfapi_tl_t tl;
uint16_t value; uint16_t value;
...@@ -3653,6 +3673,42 @@ typedef struct { ...@@ -3653,6 +3673,42 @@ typedef struct {
nfapi_vendor_extension_tlv_t vendor_extension; nfapi_vendor_extension_tlv_t vendor_extension;
} nfapi_nmm_stop_response_t; } nfapi_nmm_stop_response_t;
typedef struct
{
// TODO: see if this needs to be uncommented
// These TLVs are used to setup the transport connection between VNF and PNF
nfapi_ipv4_address_t p7_vnf_address_ipv4;
nfapi_ipv6_address_t p7_vnf_address_ipv6;
nfapi_uint16_tlv_t p7_vnf_port;
nfapi_ipv4_address_t p7_pnf_address_ipv4;
nfapi_ipv6_address_t p7_pnf_address_ipv6;
nfapi_uint16_tlv_t p7_pnf_port;
// // These TLVs are used to setup the transport connection between VNF and PNF
nfapi_uint8_tlv_t dl_ue_per_sf;
nfapi_uint8_tlv_t ul_ue_per_sf;
// These TLVs are used by PNF to report its RF capabilities to the VNF software
nfapi_rf_bands_t rf_bands;
// These TLVs are used by the VNF to configure the synchronization with the PNF.
nfapi_uint8_tlv_t timing_window;
nfapi_uint8_tlv_t timing_info_mode;
nfapi_uint8_tlv_t timing_info_period;
// These TLVs are used by the VNF to configure the RF in the PNF
nfapi_uint16_tlv_t max_transmit_power;
nfapi_uint32_tlv_t nrarfcn;
// nfapi_nmm_frequency_bands_t nmm_gsm_frequency_bands;
// nfapi_nmm_frequency_bands_t nmm_umts_frequency_bands;
// nfapi_nmm_frequency_bands_t nmm_lte_frequency_bands;
// nfapi_uint8_tlv_t nmm_uplink_rssi_supported;
} nfapi_nr_nfapi_t;
// //
// Configuration options for the encode decode functions // Configuration options for the encode decode functions
// //
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
#define _NFAPI_NR_INTERFACE_H_ #define _NFAPI_NR_INTERFACE_H_
#include "nfapi_interface.h" #include "nfapi_interface.h"
#include <nfapi/open-nFAPI/nfapi/public_inc/nfapi_nr_interface_scf.h> #include "/home/glab/NR_nfapi/openairinterface5g/nfapi/open-nFAPI/nfapi/public_inc/nfapi_nr_interface_scf.h"
#define NFAPI_NR_MAX_NB_CCE_AGGREGATION_LEVELS 5 #define NFAPI_NR_MAX_NB_CCE_AGGREGATION_LEVELS 5
#define NFAPI_NR_MAX_NB_TCI_STATES_PDCCH 64 #define NFAPI_NR_MAX_NB_TCI_STATES_PDCCH 64
...@@ -22,41 +22,8 @@ ...@@ -22,41 +22,8 @@
// nFAPI enums // nFAPI enums
//These TLVs are used exclusively by nFAPI //These TLVs are used exclusively by nFAPI
typedef struct
{
// These TLVs are used to setup the transport connection between VNF and PNF
// nfapi_ipv4_address_t p7_vnf_address_ipv4;
// nfapi_ipv6_address_t p7_vnf_address_ipv6;
// nfapi_uint16_tlv_t p7_vnf_port;
// nfapi_ipv4_address_t p7_pnf_address_ipv4;
// nfapi_ipv6_address_t p7_pnf_address_ipv6;
// nfapi_uint16_tlv_t p7_pnf_port;
// // These TLVs are used to setup the transport connection between VNF and PNF
// nfapi_uint8_tlv_t dl_ue_per_sf;
// nfapi_uint8_tlv_t ul_ue_per_sf;
// These TLVs are used by PNF to report its RF capabilities to the VNF software
nfapi_rf_bands_t rf_bands;
// These TLVs are used by the VNF to configure the synchronization with the PNF.
// nfapi_uint8_tlv_t timing_window;
// nfapi_uint8_tlv_t timing_info_mode;
// nfapi_uint8_tlv_t timing_info_period;
// These TLVs are used by the VNF to configure the RF in the PNF
// nfapi_uint16_tlv_t max_transmit_power;
nfapi_uint32_tlv_t nrarfcn;
// nfapi_nmm_frequency_bands_t nmm_gsm_frequency_bands;
// nfapi_nmm_frequency_bands_t nmm_umts_frequency_bands;
// nfapi_nmm_frequency_bands_t nmm_lte_frequency_bands;
// nfapi_uint8_tlv_t nmm_uplink_rssi_supported;
} nfapi_nr_nfapi_t;
#define NFAPI_NR_NFAPI_P7_VNF_ADDRESS_IPV4_TAG 0x5100 #define NFAPI_NR_NFAPI_P7_VNF_ADDRESS_IPV4_TAG 0x5100
#define NFAPI_NR_NFAPI_P7_VNF_ADDRESS_IPV6_TAG 0x5101 #define NFAPI_NR_NFAPI_P7_VNF_ADDRESS_IPV6_TAG 0x5101
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#include "stddef.h" #include "stddef.h"
#include "nfapi_interface.h" #include "nfapi_interface.h"
#include "nfapi_nr_interface.h"
#define NFAPI_NR_MAX_NB_CCE_AGGREGATION_LEVELS 5 #define NFAPI_NR_MAX_NB_CCE_AGGREGATION_LEVELS 5
#define NFAPI_NR_MAX_NB_TCI_STATES_PDCCH 64 #define NFAPI_NR_MAX_NB_TCI_STATES_PDCCH 64
...@@ -24,25 +25,7 @@ ...@@ -24,25 +25,7 @@
#define NFAPI_MAX_NUM_CB 8 #define NFAPI_MAX_NUM_CB 8
// Extension to the generic structures for single tlv values // Extension to the generic structures for single tlv values
typedef struct {
nfapi_tl_t tl;
int32_t value;
} nfapi_int32_tlv_t;
typedef struct {
nfapi_tl_t tl;
uint32_t value;
} nfapi_uint32_tlv_t;
typedef struct {
nfapi_tl_t tl;
int64_t value;
} nfapi_int64_tlv_t;
typedef struct {
nfapi_tl_t tl;
uint64_t value;
} nfapi_uint64_tlv_t;
typedef enum { typedef enum {
NFAPI_NR_DMRS_TYPE1=0, NFAPI_NR_DMRS_TYPE1=0,
...@@ -94,6 +77,8 @@ typedef enum { ...@@ -94,6 +77,8 @@ typedef enum {
//3.3.1 PARAM //3.3.1 PARAM
//same with nfapi_param_request_t //same with nfapi_param_request_t
typedef struct { typedef struct {
nfapi_p4_p5_message_header_t header; nfapi_p4_p5_message_header_t header;
...@@ -463,9 +448,39 @@ typedef struct ...@@ -463,9 +448,39 @@ typedef struct
} nfapi_nr_measurement_config_t; } nfapi_nr_measurement_config_t;
/* PARAM.REQUEST */
typedef struct {
nfapi_p4_p5_message_header_t header;
nfapi_vendor_extension_tlv_t vendor_extension;
} nfapi_nr_param_request_scf_t;
/* PARAM.RESPONSE */
typedef struct {
nfapi_p4_p5_message_header_t header;
nfapi_nr_param_errors_e error_code;
uint8_t number_of_tlvs;
nfapi_vendor_extension_tlv_t vendor_extension;
nfapi_nr_cell_param_t cell_param;
nfapi_nr_carrier_param_t carrier_param;
nfapi_nr_pdcch_param_t pdcch_param;
nfapi_nr_pucch_param_t pucch_param;
nfapi_nr_pdsch_param_t pdsch_param;
nfapi_nr_pusch_param_t pusch_param;
nfapi_nr_prach_param_t prach_param;
nfapi_nr_measurement_param_t measurement_param;
nfapi_nr_nfapi_t nfapi_config;
} nfapi_nr_param_response_scf_t;
/* CONFIG.REQUEST */
typedef struct { typedef struct {
nfapi_p4_p5_message_header_t header;
nfapi_nr_param_errors_e error_code;
uint8_t num_tlv; uint8_t num_tlv;
nfapi_vendor_extension_tlv_t vendor_extension;
nfapi_nr_carrier_config_t carrier_config; nfapi_nr_carrier_config_t carrier_config;
nfapi_nr_cell_config_t cell_config; nfapi_nr_cell_config_t cell_config;
nfapi_nr_ssb_config_t ssb_config; nfapi_nr_ssb_config_t ssb_config;
...@@ -473,8 +488,13 @@ typedef struct { ...@@ -473,8 +488,13 @@ typedef struct {
nfapi_nr_ssb_table_t ssb_table; nfapi_nr_ssb_table_t ssb_table;
nfapi_nr_tdd_table_t tdd_table; nfapi_nr_tdd_table_t tdd_table;
nfapi_nr_measurement_config_t measurement_config; nfapi_nr_measurement_config_t measurement_config;
nfapi_nr_nfapi_t nfapi_config;
} nfapi_nr_config_request_scf_t; } nfapi_nr_config_request_scf_t;
/* CONFIG.RESPONSE */
typedef struct {
// TODO: add here
} nfapi_nr_config_response_scf_t;
//------------------------------// //------------------------------//
//3.3.3 START //3.3.3 START
......
...@@ -33,11 +33,13 @@ ...@@ -33,11 +33,13 @@
#include <nfapi_interface.h> #include <nfapi_interface.h>
#include <nfapi.h> #include <nfapi.h>
#include "nfapi_nr_interface.h"
#include "nfapi_nr_interface_scf.h"
#include <debug.h> #include <debug.h>
// Pack routines // Pack routines
//TODO: Add pacl/unpack fns for uint32 and uint64
static uint8_t pack_pnf_param_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t* end, nfapi_p4_p5_codec_config_t* config) static uint8_t pack_pnf_param_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t* end, nfapi_p4_p5_codec_config_t* config)
{ {
nfapi_pnf_param_request_t* request = (nfapi_pnf_param_request_t*)msg; nfapi_pnf_param_request_t* request = (nfapi_pnf_param_request_t*)msg;
......
...@@ -25,9 +25,12 @@ extern "C" { ...@@ -25,9 +25,12 @@ extern "C" {
#include "nfapi_interface.h" #include "nfapi_interface.h"
#include "debug.h" #include "debug.h"
#include <openair2/PHY_INTERFACE/IF_Module.h> #include <openair2/PHY_INTERFACE/IF_Module.h>
#include "nfapi_nr_interface.h"
#include "nfapi_nr_interface_scf.h"
#include <sys/types.h> #include <sys/types.h>
/*! This enum is used to describe the states of the pnf /*! This enum is used to describe the states of the pnf
*/ */
typedef enum typedef enum
...@@ -166,7 +169,7 @@ typedef struct nfapi_pnf_config ...@@ -166,7 +169,7 @@ typedef struct nfapi_pnf_config
* The client is expected to send the PARAM.response after receiving the * The client is expected to send the PARAM.response after receiving the
* PARAM.request. This can be done in the call back. * PARAM.request. This can be done in the call back.
*/ */
int (*param_req)(nfapi_pnf_config_t* config, nfapi_pnf_phy_config_t* phy, nfapi_param_request_t* req); int (*param_req)(nfapi_pnf_config_t* config, nfapi_pnf_phy_config_t* phy, nfapi_nr_param_request_scf_t* req);
/*! A callback for the CONFIG.request /*! A callback for the CONFIG.request
* \param config A pointer to the pnf configuration * \param config A pointer to the pnf configuration
...@@ -178,7 +181,7 @@ typedef struct nfapi_pnf_config ...@@ -178,7 +181,7 @@ typedef struct nfapi_pnf_config
* The client is expected to send the CONFIG.response after receiving the * The client is expected to send the CONFIG.response after receiving the
* CONFIG.request. This can be done in the call back. * CONFIG.request. This can be done in the call back.
*/ */
int (*config_req)(nfapi_pnf_config_t* config, nfapi_pnf_phy_config_t* phy, nfapi_config_request_t* req); int (*config_req)(nfapi_pnf_config_t* config, nfapi_pnf_phy_config_t* phy, nfapi_nr_config_request_scf_t* req);
/*! A callback for the START.request /*! A callback for the START.request
* \param config A pointer to the pnf configuration * \param config A pointer to the pnf configuration
......
...@@ -26,7 +26,8 @@ ...@@ -26,7 +26,8 @@
#include <string.h> #include <string.h>
#include <unistd.h> #include <unistd.h>
#include <errno.h> #include <errno.h>
#include "nfapi_nr_interface.h"
#include "nfapi_nr_interface_scf.h"
#include "pnf.h" #include "pnf.h"
#define MAX_SCTP_STREAMS 16 #define MAX_SCTP_STREAMS 16
...@@ -267,7 +268,7 @@ void pnf_handle_param_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen) ...@@ -267,7 +268,7 @@ void pnf_handle_param_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
} }
else else
{ {
nfapi_param_request_t req; nfapi_nr_param_request_scf_t req;
nfapi_pnf_config_t* config = &(pnf->_public); nfapi_pnf_config_t* config = &(pnf->_public);
...@@ -340,7 +341,7 @@ void pnf_handle_config_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen) ...@@ -340,7 +341,7 @@ void pnf_handle_config_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
} }
else else
{ {
nfapi_config_request_t req; nfapi_nr_config_request_scf_t req;
NFAPI_TRACE(NFAPI_TRACE_INFO, "CONFIG.request received\n"); NFAPI_TRACE(NFAPI_TRACE_INFO, "CONFIG.request received\n");
...@@ -1393,8 +1394,15 @@ int pnf_connect(pnf_t* pnf) ...@@ -1393,8 +1394,15 @@ int pnf_connect(pnf_t* pnf)
int pnf_send_message(pnf_t* pnf, uint8_t *msg, uint32_t len, uint16_t stream) int pnf_send_message(pnf_t* pnf, uint8_t *msg, uint32_t len, uint16_t stream)
{ {
if (pnf->sctp) if (pnf->sctp)
{ {
printf("\nPNF SENDS: \n");
for(int i=0; i<len; i++){
printf("%d", msg[i]);
}
printf("\n");
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)
{ {
NFAPI_TRACE(NFAPI_TRACE_ERROR, "sctp_sendmsg failed errno: %d\n", errno); NFAPI_TRACE(NFAPI_TRACE_ERROR, "sctp_sendmsg failed errno: %d\n", errno);
...@@ -1486,6 +1494,13 @@ int pnf_read_dispatch_message(pnf_t* pnf) ...@@ -1486,6 +1494,13 @@ int pnf_read_dispatch_message(pnf_t* pnf)
} }
else else
{ {
// print the received message
printf("\n MESSAGE RECEIVED: \n");
for(int i=0; i<message_size; i++){
printf("%d", read_buffer[i]);
}
printf("\n");
if (flags & MSG_NOTIFICATION) if (flags & MSG_NOTIFICATION)
{ {
NFAPI_TRACE(NFAPI_TRACE_INFO, "Notification received from %s:%u\n", inet_ntoa(addr.sin_addr), ntohs(addr.sin_port)); NFAPI_TRACE(NFAPI_TRACE_INFO, "Notification received from %s:%u\n", inet_ntoa(addr.sin_addr), ntohs(addr.sin_port));
......
...@@ -19,6 +19,8 @@ ...@@ -19,6 +19,8 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <unistd.h> #include <unistd.h>
#include "nfapi_nr_interface.h"
#include "nfapi_nr_interface_scf.h"
nfapi_pnf_config_t* nfapi_pnf_config_create() nfapi_pnf_config_t* nfapi_pnf_config_create()
{ {
......
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
#include "nfapi_interface.h" #include "nfapi_interface.h"
#include "nfapi_nr_interface_scf.h" #include "nfapi_nr_interface_scf.h"
#include "nfapi_nr_interface.h"
#include "debug.h" #include "debug.h"
...@@ -248,7 +249,7 @@ typedef struct nfapi_vnf_config ...@@ -248,7 +249,7 @@ typedef struct nfapi_vnf_config
* then the substructure pointers should be set to 0 and then the client should * then the substructure pointers should be set to 0 and then the client should
* use the codec_config.deallocate function to release it at a future point * use the codec_config.deallocate function to release it at a future point
*/ */
int (*param_resp)(nfapi_vnf_config_t* config, int p5_idx, nfapi_param_response_t* resp); int (*param_resp)(nfapi_vnf_config_t* config, int p5_idx, nfapi_nr_param_response_scf_t* resp);
/*! A callback for the CONFIG.response /*! A callback for the CONFIG.response
* \param config A pointer to the vnf configuration * \param config A pointer to the vnf configuration
...@@ -266,7 +267,8 @@ typedef struct nfapi_vnf_config ...@@ -266,7 +267,8 @@ typedef struct nfapi_vnf_config
* then the substructure pointers should be set to 0 and then the client should * then the substructure pointers should be set to 0 and then the client should
* use the codec_config.deallocate function to release it at a future point * use the codec_config.deallocate function to release it at a future point
*/ */
int (*config_resp)(nfapi_vnf_config_t* config, int p5_idx, nfapi_config_response_t* resp); //TODO: Add nfapi_nr_config_response_scf_t struct
int (*config_resp)(nfapi_vnf_config_t* config, int p5_idx, nfapi_nr_config_response_scf_t* resp);
/*! A callback for the START.resp /*! A callback for the START.resp
* \param config A pointer to the vnf configuration * \param config A pointer to the vnf configuration
......
...@@ -24,6 +24,8 @@ ...@@ -24,6 +24,8 @@
#include <errno.h> #include <errno.h>
#include "vnf.h" #include "vnf.h"
#include "nfapi_nr_interface.h"
#include "nfapi_nr_interface_scf.h"
void* vnf_malloc(nfapi_vnf_config_t* config, size_t size) void* vnf_malloc(nfapi_vnf_config_t* config, size_t size)
...@@ -1024,6 +1026,12 @@ int vnf_read_dispatch_message(nfapi_vnf_config_t* config, nfapi_vnf_pnf_info_t* ...@@ -1024,6 +1026,12 @@ 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 // handle now if complete message in one or more segments
if ((flags & 0x80) == 0x80) if ((flags & 0x80) == 0x80)
{ {
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); vnf_handle_p4_p5_message(read_buffer, message_size, pnf->p5_idx, config);
} }
else else
...@@ -1051,6 +1059,12 @@ int vnf_read_dispatch_message(nfapi_vnf_config_t* config, nfapi_vnf_pnf_info_t* ...@@ -1051,6 +1059,12 @@ 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) 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");
//NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s len:%d stream:%d\n", __FUNCTION__, len, stream); //NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s len:%d stream:%d\n", __FUNCTION__, len, stream);
int result = sctp_sendmsg(pnf->p5_sock, msg, len, (struct sockaddr*)&pnf->p5_pnf_sockaddr, sizeof(pnf->p5_pnf_sockaddr),1, 0, stream, 0, 4); int result = sctp_sendmsg(pnf->p5_sock, msg, len, (struct sockaddr*)&pnf->p5_pnf_sockaddr, sizeof(pnf->p5_pnf_sockaddr),1, 0, stream, 0, 4);
......
...@@ -360,6 +360,13 @@ void phy_free_nr_gNB(PHY_VARS_gNB *gNB) ...@@ -360,6 +360,13 @@ void phy_free_nr_gNB(PHY_VARS_gNB *gNB)
for (UE_id = 0; UE_id < NUMBER_OF_UE_MAX; UE_id++) gNB->UE_stats_ptr[UE_id] = NULL; for (UE_id = 0; UE_id < NUMBER_OF_UE_MAX; UE_id++) gNB->UE_stats_ptr[UE_id] = NULL;
*/ */
} }
//Adding nr_schedule_handler
void install_nr_schedule_handlers(NR_IF_Module_t *if_inst)
{
if_inst->NR_PHY_config_req = nr_phy_config_request;
if_inst->NR_Schedule_response = nr_schedule_response;
}
/* /*
void install_schedule_handlers(IF_Module_t *if_inst) void install_schedule_handlers(IF_Module_t *if_inst)
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment