Allocate VNF_info directly in config instead of global variable
This allows access to the VNF configuration in the various transport mechanisms straight from config, without this, the transport specific thread would cause a segmentation fault when trying to access the pack/unpack function pointers. Add 2 functions to access the P5 and P7 VNF structures, to avoid having to always cast user_data and p7_vnfs
This commit is contained in:
@@ -63,12 +63,8 @@ char cpu_buf_recv[RECV_BUF_LEN];
|
||||
|
||||
uint16_t sfn = 0, slot = 0;
|
||||
nv_ipc_t *ipc;
|
||||
nfapi_vnf_config_t *vnf_config = 0;
|
||||
|
||||
void set_config(nfapi_vnf_config_t *conf)
|
||||
{
|
||||
vnf_config = conf;
|
||||
}
|
||||
|
||||
static uint16_t old_sfn = 0;
|
||||
static uint16_t old_slot = 0;
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
@@ -84,6 +80,7 @@ static int ipc_handle_rx_msg(nv_ipc_t *ipc, nv_ipc_msg_t *msg)
|
||||
uint8_t *end = msg->msg_buf + msg->msg_len;
|
||||
|
||||
// unpack FAPI messages and handle them
|
||||
nfapi_vnf_config_t * vnf_config = get_config();
|
||||
if (vnf_config != 0) {
|
||||
// first, unpack the header
|
||||
fapi_phy_api_msg fapi_msg;
|
||||
@@ -576,13 +573,13 @@ int nvIPC_Init(nvipc_params_t nvipc_params_s)
|
||||
|
||||
int oai_fapi_ul_tti_req(nfapi_nr_ul_tti_request_t *ul_tti_req)
|
||||
{
|
||||
nfapi_vnf_p7_config_t *p7_config = (((vnf_info *)vnf_config->user_data)->p7_vnfs[0].config);
|
||||
nfapi_vnf_p7_config_t *p7_config = get_p7_vnf_config();
|
||||
|
||||
ul_tti_req->header.phy_id = 1; // DJP HACK TODO FIXME - need to pass this around!!!!
|
||||
ul_tti_req->header.message_id = NFAPI_NR_PHY_MSG_TYPE_UL_TTI_REQUEST;
|
||||
|
||||
// int retval = nfapi_vnf_p7_ul_tti_req(p7_config, ul_tti_req);
|
||||
int retval = p7_config->send_p7_msg((vnf_p7_t *)p7_config, &ul_tti_req->header);
|
||||
int retval = p7_config->send_p7_msg(get_p7_vnf(), &ul_tti_req->header);
|
||||
|
||||
if (retval != 0) {
|
||||
LOG_E(PHY, "%s() Problem sending retval:%d\n", __FUNCTION__, retval);
|
||||
@@ -598,11 +595,11 @@ int oai_fapi_ul_tti_req(nfapi_nr_ul_tti_request_t *ul_tti_req)
|
||||
|
||||
int oai_fapi_ul_dci_req(nfapi_nr_ul_dci_request_t *ul_dci_req)
|
||||
{
|
||||
nfapi_vnf_p7_config_t *p7_config = (((vnf_info *)vnf_config->user_data)->p7_vnfs[0].config);
|
||||
nfapi_vnf_p7_config_t *p7_config = get_p7_vnf_config();
|
||||
ul_dci_req->header.phy_id = 1; // DJP HACK TODO FIXME - need to pass this around!!!!
|
||||
ul_dci_req->header.message_id = NFAPI_NR_PHY_MSG_TYPE_UL_DCI_REQUEST;
|
||||
// int retval = nfapi_vnf_p7_ul_dci_req(p7_config, ul_dci_req);
|
||||
int retval = p7_config->send_p7_msg((vnf_p7_t *)p7_config, &ul_dci_req->header);
|
||||
int retval = p7_config->send_p7_msg(get_p7_vnf(), &ul_dci_req->header);
|
||||
if (retval != 0) {
|
||||
LOG_E(PHY, "%s() Problem sending retval:%d\n", __FUNCTION__, retval);
|
||||
} else {
|
||||
@@ -613,12 +610,12 @@ int oai_fapi_ul_dci_req(nfapi_nr_ul_dci_request_t *ul_dci_req)
|
||||
|
||||
int oai_fapi_tx_data_req(nfapi_nr_tx_data_request_t *tx_data_req)
|
||||
{
|
||||
nfapi_vnf_p7_config_t *p7_config = (((vnf_info *)vnf_config->user_data)->p7_vnfs[0].config);
|
||||
nfapi_vnf_p7_config_t *p7_config = get_p7_vnf_config();
|
||||
tx_data_req->header.phy_id = 1; // DJP HACK TODO FIXME - need to pass this around!!!!
|
||||
tx_data_req->header.message_id = NFAPI_NR_PHY_MSG_TYPE_TX_DATA_REQUEST;
|
||||
// LOG_D(PHY, "[VNF] %s() TX_REQ sfn_sf:%d number_of_pdus:%d\n", __FUNCTION__, NFAPI_SFNSF2DEC(tx_data_req->SFN),
|
||||
// tx_data_req->Number_of_PDUs); int retval = nfapi_vnf_p7_tx_data_req(p7_config, tx_data_req);
|
||||
int retval = p7_config->send_p7_msg((vnf_p7_t *)p7_config, &tx_data_req->header);
|
||||
int retval = p7_config->send_p7_msg(get_p7_vnf(), &tx_data_req->header);
|
||||
if (retval != 0) {
|
||||
LOG_E(PHY, "%s() Problem sending retval:%d\n", __FUNCTION__, retval);
|
||||
} else {
|
||||
@@ -630,10 +627,10 @@ int oai_fapi_tx_data_req(nfapi_nr_tx_data_request_t *tx_data_req)
|
||||
|
||||
int oai_fapi_dl_tti_req(nfapi_nr_dl_tti_request_t *dl_config_req)
|
||||
{
|
||||
nfapi_vnf_p7_config_t *p7_config = (((vnf_info *)vnf_config->user_data)->p7_vnfs[0].config);
|
||||
nfapi_vnf_p7_config_t *p7_config = get_p7_vnf_config();
|
||||
dl_config_req->header.message_id = NFAPI_NR_PHY_MSG_TYPE_DL_TTI_REQUEST;
|
||||
dl_config_req->header.phy_id = 1; // DJP HACK TODO FIXME - need to pass this around!!!!
|
||||
int retval = p7_config->send_p7_msg((vnf_p7_t *)p7_config, &dl_config_req->header);
|
||||
int retval = p7_config->send_p7_msg(get_p7_vnf(), &dl_config_req->header);
|
||||
dl_config_req->dl_tti_request_body.nPDUs = 0;
|
||||
dl_config_req->dl_tti_request_body.nGroup = 0;
|
||||
|
||||
@@ -644,9 +641,9 @@ int oai_fapi_dl_tti_req(nfapi_nr_dl_tti_request_t *dl_config_req)
|
||||
}
|
||||
|
||||
int oai_fapi_send_end_request(int cell, uint32_t frame, uint32_t slot){
|
||||
nfapi_vnf_p7_config_t *p7_config = (((vnf_info *)vnf_config->user_data)->p7_vnfs[0].config);
|
||||
nfapi_vnf_p7_config_t *p7_config = get_p7_vnf_config();
|
||||
nfapi_nr_slot_indication_scf_t nr_slot_resp = {.header.message_id = 0x8F, .sfn = frame, .slot = slot};
|
||||
int retval = p7_config->send_p7_msg((vnf_p7_t *)p7_config, &nr_slot_resp.header);
|
||||
int retval = p7_config->send_p7_msg(get_p7_vnf(), &nr_slot_resp.header);
|
||||
if (retval != 0) {
|
||||
LOG_E(PHY, "%s() Problem sending retval:%d\n", __FUNCTION__, retval);
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ bool aerial_send_P7_msg_with_data(void *packedBuf,
|
||||
void *dataBuf,
|
||||
uint32_t dataLength,
|
||||
nfapi_nr_p7_message_header_t *header);
|
||||
void set_config(nfapi_vnf_config_t *conf);
|
||||
|
||||
int nvIPC_Init(nvipc_params_t nvipc_params_s);
|
||||
int oai_fapi_send_end_request(int cell_id, uint32_t frame, uint32_t slot);
|
||||
int oai_fapi_ul_tti_req(nfapi_nr_ul_tti_request_t *ul_tti_req);
|
||||
|
||||
@@ -70,10 +70,25 @@
|
||||
#endif
|
||||
|
||||
#define TEST
|
||||
|
||||
static nfapi_vnf_config_t *config;
|
||||
extern RAN_CONTEXT_t RC;
|
||||
extern UL_RCC_IND_t UL_RCC_INFO;
|
||||
|
||||
nfapi_vnf_config_t * get_config()
|
||||
{
|
||||
return config;
|
||||
}
|
||||
vnf_p7_t *get_p7_vnf()
|
||||
{
|
||||
vnf_info *vnf = config->user_data;
|
||||
return (vnf_p7_t *)vnf->p7_vnfs->config;
|
||||
}
|
||||
|
||||
nfapi_vnf_p7_config_t *get_p7_vnf_config()
|
||||
{
|
||||
return &get_p7_vnf()->_public;
|
||||
}
|
||||
|
||||
int vnf_pack_vendor_extension_tlv(void *ve, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t *codec) {
|
||||
//NFAPI_TRACE(NFAPI_TRACE_INFO, "vnf_pack_vendor_extension_tlv\n");
|
||||
nfapi_tl_t *tlv = (nfapi_tl_t *)ve;
|
||||
@@ -1341,7 +1356,6 @@ void *configure_nr_p7_vnf(void *ptr)
|
||||
p7_vnf->config->hdr_unpack_func = &fapi_nr_p7_message_header_unpack;
|
||||
p7_vnf->config->pack_func = &fapi_nr_p7_message_pack;
|
||||
p7_vnf->config->send_p7_msg = &wls_vnf_nr_send_p7_message;
|
||||
wls_vnf_set_p7_config(p7_vnf->config);
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_SOCKET
|
||||
@@ -1735,32 +1749,30 @@ void vnf_start_thread(void *ptr) {
|
||||
nfapi_vnf_start((nfapi_vnf_config_t *)ptr);
|
||||
}
|
||||
|
||||
static vnf_info vnf;
|
||||
|
||||
void configure_nr_nfapi_vnf(eth_params_t params)
|
||||
{
|
||||
#ifndef ENABLE_AERIAL
|
||||
nfapi_setmode(NFAPI_MODE_VNF);
|
||||
#endif
|
||||
memset(&vnf, 0, sizeof(vnf));
|
||||
memset(vnf.p7_vnfs, 0, sizeof(vnf.p7_vnfs));
|
||||
vnf.p7_vnfs[0].timing_window = 30;
|
||||
vnf.p7_vnfs[0].periodic_timing_enabled = 0;
|
||||
vnf.p7_vnfs[0].aperiodic_timing_enabled = 0;
|
||||
vnf.p7_vnfs[0].periodic_timing_period = 1;
|
||||
vnf.p7_vnfs[0].config = nfapi_vnf_p7_config_create();
|
||||
vnf_info *vnf = calloc(1, sizeof(vnf_info));
|
||||
memset(vnf->p7_vnfs, 0, sizeof(vnf->p7_vnfs));
|
||||
vnf->p7_vnfs[0].timing_window = 30;
|
||||
vnf->p7_vnfs[0].periodic_timing_enabled = 0;
|
||||
vnf->p7_vnfs[0].aperiodic_timing_enabled = 0;
|
||||
vnf->p7_vnfs[0].periodic_timing_period = 1;
|
||||
vnf->p7_vnfs[0].config = nfapi_vnf_p7_config_create();
|
||||
#ifndef ENABLE_AERIAL
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO,
|
||||
"[VNF] %s() vnf.p7_vnfs[0].config:%p VNF ADDRESS:%s:%d\n",
|
||||
"[VNF] %s() vnf->p7_vnfs[0].config:%p VNF ADDRESS:%s:%d\n",
|
||||
__FUNCTION__,
|
||||
vnf.p7_vnfs[0].config,
|
||||
vnf->p7_vnfs[0].config,
|
||||
params.my_addr,
|
||||
params.my_portc);
|
||||
strcpy(vnf.p7_vnfs[0].local_addr, params.my_addr);
|
||||
vnf.p7_vnfs[0].local_port = params.my_portd;
|
||||
strcpy(vnf->p7_vnfs[0].local_addr, params.my_addr);
|
||||
vnf->p7_vnfs[0].local_port = params.my_portd;
|
||||
#endif
|
||||
vnf.p7_vnfs[0].mac = (mac_t *)malloc(sizeof(mac_t));
|
||||
nfapi_vnf_config_t *config = nfapi_vnf_config_create();
|
||||
vnf->p7_vnfs[0].mac = malloc(sizeof(mac_t));
|
||||
config = nfapi_vnf_config_create();
|
||||
config->malloc = malloc;
|
||||
config->free = free;
|
||||
config->vnf_p5_port = params.my_portc;
|
||||
@@ -1780,7 +1792,7 @@ void configure_nr_nfapi_vnf(eth_params_t params)
|
||||
config->nr_start_resp = &nr_start_resp_cb;
|
||||
config->nr_error_ind = &nr_error_ind_cb;
|
||||
config->vendor_ext = &vendor_nr_ext_cb;
|
||||
config->user_data = &vnf;
|
||||
config->user_data = vnf;
|
||||
// To allow custom vendor extentions to be added to nfapi
|
||||
config->codec_config.unpack_vendor_extension_tlv = &vnf_nr_unpack_vendor_extension_tlv;
|
||||
config->codec_config.pack_vendor_extension_tlv = &vnf_nr_pack_vendor_extension_tlv;
|
||||
@@ -1817,7 +1829,6 @@ void configure_nr_nfapi_vnf(eth_params_t params)
|
||||
config->hdr_unpack_func = &fapi_nr_message_header_unpack;
|
||||
config->pack_func = &fapi_nr_p5_message_pack;
|
||||
config->send_p5_msg = &aerial_nr_send_p5_message;
|
||||
set_config(config);
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "[VNF] Created VNF NFAPI start thread %s\n", __FUNCTION__);
|
||||
nfapi_vnf_pnf_info_t *pnf = (nfapi_vnf_pnf_info_t *)malloc(sizeof(nfapi_vnf_pnf_info_t));
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "MALLOC nfapi_vnf_pnf_info_t for pnf_list pnf:%p\n", pnf);
|
||||
@@ -1826,7 +1837,6 @@ void configure_nr_nfapi_vnf(eth_params_t params)
|
||||
pnf->connected = 1;
|
||||
// Add needed parameters
|
||||
|
||||
vnf_info *vnf = (vnf_info *)(config->user_data);
|
||||
pnf_info *pnf_info = vnf->pnfs;
|
||||
|
||||
for (int i = 0; i < 1; ++i) {
|
||||
@@ -1863,18 +1873,23 @@ void configure_nr_nfapi_vnf(eth_params_t params)
|
||||
|
||||
void configure_nfapi_vnf(char *vnf_addr, int vnf_p5_port, char *pnf_ip_addr, int pnf_p7_port, int vnf_p7_port) {
|
||||
nfapi_setmode(NFAPI_MODE_VNF);
|
||||
memset(&vnf, 0, sizeof(vnf));
|
||||
memset(vnf.p7_vnfs, 0, sizeof(vnf.p7_vnfs));
|
||||
vnf.p7_vnfs[0].timing_window = 32;
|
||||
vnf.p7_vnfs[0].periodic_timing_enabled = 1;
|
||||
vnf.p7_vnfs[0].aperiodic_timing_enabled = 0;
|
||||
vnf.p7_vnfs[0].periodic_timing_period = 10;
|
||||
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);
|
||||
strcpy(vnf.p7_vnfs[0].local_addr, vnf_addr);
|
||||
vnf.p7_vnfs[0].local_port = vnf_p7_port;
|
||||
vnf.p7_vnfs[0].mac = (mac_t *)malloc(sizeof(mac_t));
|
||||
nfapi_vnf_config_t *config = nfapi_vnf_config_create();
|
||||
vnf_info *vnf = calloc(1, sizeof(vnf_info));
|
||||
memset(vnf->p7_vnfs, 0, sizeof(vnf->p7_vnfs));
|
||||
vnf->p7_vnfs[0].timing_window = 32;
|
||||
vnf->p7_vnfs[0].periodic_timing_enabled = 1;
|
||||
vnf->p7_vnfs[0].aperiodic_timing_enabled = 0;
|
||||
vnf->p7_vnfs[0].periodic_timing_period = 10;
|
||||
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);
|
||||
strcpy(vnf->p7_vnfs[0].local_addr, vnf_addr);
|
||||
vnf->p7_vnfs[0].local_port = vnf_p7_port;
|
||||
vnf->p7_vnfs[0].mac = malloc(sizeof(mac_t));
|
||||
config = nfapi_vnf_config_create();
|
||||
config->malloc = malloc;
|
||||
config->free = free;
|
||||
config->vnf_p5_port = vnf_p5_port;
|
||||
@@ -1893,7 +1908,7 @@ void configure_nfapi_vnf(char *vnf_addr, int vnf_p5_port, char *pnf_ip_addr, int
|
||||
config->config_resp = &config_resp_cb;
|
||||
config->start_resp = &start_resp_cb;
|
||||
config->vendor_ext = &vendor_ext_cb;
|
||||
config->user_data = &vnf;
|
||||
config->user_data = vnf;
|
||||
// To allow custom vendor extentions to be added to nfapi
|
||||
config->codec_config.unpack_vendor_extension_tlv = &vnf_unpack_vendor_extension_tlv;
|
||||
config->codec_config.pack_vendor_extension_tlv = &vnf_pack_vendor_extension_tlv;
|
||||
@@ -1910,7 +1925,7 @@ void configure_nfapi_vnf(char *vnf_addr, int vnf_p5_port, char *pnf_ip_addr, int
|
||||
}
|
||||
|
||||
int oai_nfapi_dl_config_req(nfapi_dl_config_request_t *dl_config_req) {
|
||||
nfapi_vnf_p7_config_t *p7_config = vnf.p7_vnfs[0].config;
|
||||
nfapi_vnf_p7_config_t *p7_config = get_p7_vnf_config();
|
||||
dl_config_req->header.phy_id = 1; // HACK TODO FIXME - need to pass this around!!!!
|
||||
dl_config_req->header.message_id = NFAPI_DL_CONFIG_REQUEST;
|
||||
LOG_D(PHY, "[VNF] %s() DL_CONFIG_REQ sfn_sf:%d_%d number_of_pdus:%d\n", __FUNCTION__,
|
||||
@@ -1946,7 +1961,7 @@ int oai_nfapi_dl_config_req(nfapi_dl_config_request_t *dl_config_req) {
|
||||
int oai_nfapi_dl_tti_req(nfapi_nr_dl_tti_request_t *dl_config_req)
|
||||
{
|
||||
LOG_D(NR_PHY, "Entering oai_nfapi_nr_dl_config_req sfn:%d,slot:%d\n", dl_config_req->SFN, dl_config_req->Slot);
|
||||
nfapi_vnf_p7_config_t *p7_config = vnf.p7_vnfs[0].config;
|
||||
nfapi_vnf_p7_config_t *p7_config = get_p7_vnf_config();
|
||||
dl_config_req->header.message_id= NFAPI_NR_PHY_MSG_TYPE_DL_TTI_REQUEST;
|
||||
dl_config_req->header.phy_id = 1; // HACK TODO FIXME - need to pass this around!!!!
|
||||
|
||||
@@ -1965,7 +1980,7 @@ int oai_nfapi_dl_tti_req(nfapi_nr_dl_tti_request_t *dl_config_req)
|
||||
int oai_nfapi_tx_data_req(nfapi_nr_tx_data_request_t *tx_data_req)
|
||||
{
|
||||
LOG_D(NR_PHY, "Entering oai_nfapi_nr_tx_data_req sfn:%d,slot:%d\n", tx_data_req->SFN, tx_data_req->Slot);
|
||||
nfapi_vnf_p7_config_t *p7_config = vnf.p7_vnfs[0].config;
|
||||
nfapi_vnf_p7_config_t *p7_config = get_p7_vnf_config();
|
||||
tx_data_req->header.phy_id = 1; // HACK TODO FIXME - need to pass this around!!!!
|
||||
tx_data_req->header.message_id = NFAPI_NR_PHY_MSG_TYPE_TX_DATA_REQUEST;
|
||||
//LOG_D(PHY, "[VNF] %s() TX_REQ sfn_sf:%d number_of_pdus:%d\n", __FUNCTION__, NFAPI_SFNSF2DEC(tx_req->sfn_sf), tx_req->tx_request_body.number_of_pdus);
|
||||
@@ -1982,7 +1997,7 @@ int oai_nfapi_tx_data_req(nfapi_nr_tx_data_request_t *tx_data_req)
|
||||
|
||||
int oai_nfapi_tx_req(nfapi_tx_request_t *tx_req)
|
||||
{
|
||||
nfapi_vnf_p7_config_t *p7_config = vnf.p7_vnfs[0].config;
|
||||
nfapi_vnf_p7_config_t *p7_config = get_p7_vnf_config();
|
||||
tx_req->header.phy_id = 1; // HACK TODO FIXME - need to pass this around!!!!
|
||||
tx_req->header.message_id = NFAPI_TX_REQUEST;
|
||||
//LOG_D(PHY, "[VNF] %s() TX_REQ sfn_sf:%d number_of_pdus:%d\n", __FUNCTION__, NFAPI_SFNSF2DEC(tx_req->sfn_sf), tx_req->tx_request_body.number_of_pdus);
|
||||
@@ -1998,7 +2013,7 @@ int oai_nfapi_tx_req(nfapi_tx_request_t *tx_req)
|
||||
}
|
||||
|
||||
int oai_nfapi_ul_dci_req(nfapi_nr_ul_dci_request_t *ul_dci_req) {
|
||||
nfapi_vnf_p7_config_t *p7_config = vnf.p7_vnfs[0].config;
|
||||
nfapi_vnf_p7_config_t *p7_config = get_p7_vnf_config();
|
||||
ul_dci_req->header.phy_id = 1; // HACK TODO FIXME - need to pass this around!!!!
|
||||
ul_dci_req->header.message_id = NFAPI_NR_PHY_MSG_TYPE_UL_DCI_REQUEST;
|
||||
//LOG_D(PHY, "[VNF] %s() HI_DCI0_REQ sfn_sf:%d dci:%d hi:%d\n", __FUNCTION__, NFAPI_SFNSF2DEC(hi_dci0_req->sfn_sf), hi_dci0_req->hi_dci0_request_body.number_of_dci, hi_dci0_req->hi_dci0_request_body.number_of_hi);
|
||||
@@ -2014,7 +2029,7 @@ int oai_nfapi_ul_dci_req(nfapi_nr_ul_dci_request_t *ul_dci_req) {
|
||||
}
|
||||
|
||||
int oai_nfapi_hi_dci0_req(nfapi_hi_dci0_request_t *hi_dci0_req) {
|
||||
nfapi_vnf_p7_config_t *p7_config = vnf.p7_vnfs[0].config;
|
||||
nfapi_vnf_p7_config_t *p7_config = get_p7_vnf_config();
|
||||
hi_dci0_req->header.phy_id = 1; // HACK TODO FIXME - need to pass this around!!!!
|
||||
hi_dci0_req->header.message_id = NFAPI_HI_DCI0_REQUEST;
|
||||
//LOG_D(PHY, "[VNF] %s() HI_DCI0_REQ sfn_sf:%d dci:%d hi:%d\n", __FUNCTION__, NFAPI_SFNSF2DEC(hi_dci0_req->sfn_sf), hi_dci0_req->hi_dci0_request_body.number_of_dci, hi_dci0_req->hi_dci0_request_body.number_of_hi);
|
||||
@@ -2050,7 +2065,7 @@ static void remove_ul_config_req_pdu(int index, nfapi_ul_config_request_t *ul_co
|
||||
}
|
||||
|
||||
int oai_nfapi_ul_tti_req(nfapi_nr_ul_tti_request_t *ul_tti_req) {
|
||||
nfapi_vnf_p7_config_t *p7_config = vnf.p7_vnfs[0].config;
|
||||
nfapi_vnf_p7_config_t *p7_config = get_p7_vnf_config();
|
||||
|
||||
ul_tti_req->header.phy_id = 1; // HACK TODO FIXME - need to pass this around!!!!
|
||||
ul_tti_req->header.message_id = NFAPI_NR_PHY_MSG_TYPE_UL_TTI_REQUEST;
|
||||
@@ -2070,7 +2085,7 @@ int oai_nfapi_ul_tti_req(nfapi_nr_ul_tti_request_t *ul_tti_req) {
|
||||
}
|
||||
|
||||
int oai_nfapi_ul_config_req(nfapi_ul_config_request_t *ul_config_req) {
|
||||
nfapi_vnf_p7_config_t *p7_config = vnf.p7_vnfs[0].config;
|
||||
nfapi_vnf_p7_config_t *p7_config = get_p7_vnf_config();
|
||||
ul_config_req->header.phy_id = 1; // HACK TODO FIXME - need to pass this around!!!!
|
||||
ul_config_req->header.message_id = NFAPI_UL_CONFIG_REQUEST;
|
||||
//LOG_D(PHY, "[VNF] %s() header message_id:%02x\n", __FUNCTION__, ul_config_req->header.message_id);
|
||||
@@ -2130,7 +2145,7 @@ int oai_nfapi_ul_config_req(nfapi_ul_config_request_t *ul_config_req) {
|
||||
int oai_nfapi_ue_release_req(nfapi_ue_release_request_t *release_req){
|
||||
if(release_req->ue_release_request_body.number_of_TLVs <= 0)
|
||||
return 0;
|
||||
nfapi_vnf_p7_config_t *p7_config = vnf.p7_vnfs[0].config;
|
||||
nfapi_vnf_p7_config_t *p7_config = get_p7_vnf_config();
|
||||
|
||||
release_req->header.phy_id = 1; // HACK TODO FIXME - need to pass this around!!!!
|
||||
release_req->header.message_id = NFAPI_UE_RELEASE_REQUEST;
|
||||
|
||||
@@ -148,5 +148,7 @@ typedef struct {
|
||||
|
||||
void configure_nfapi_vnf(char *vnf_addr, int vnf_p5_port, char *pnf_ip_addr, int pnf_p7_port, int vnf_p7_port);
|
||||
void configure_nr_nfapi_vnf(eth_params_t params);
|
||||
|
||||
nfapi_vnf_config_t *get_config();
|
||||
vnf_p7_t *get_p7_vnf();
|
||||
nfapi_vnf_p7_config_t *get_p7_vnf_config();
|
||||
#endif /* NFAPI_VNF_H_ */
|
||||
|
||||
@@ -21,6 +21,9 @@
|
||||
#include "socket_pnf.h"
|
||||
#include "nfapi.h"
|
||||
|
||||
#include "nfapi.h"
|
||||
static nfapi_pnf_config_t *config;
|
||||
|
||||
bool pnf_nr_send_p5_message(pnf_t *pnf, nfapi_nr_p4_p5_message_header_t *msg, uint32_t msg_len)
|
||||
{
|
||||
int packed_len =
|
||||
@@ -148,7 +151,7 @@ bool pnf_nr_send_p7_message(pnf_p7_t *pnf_p7, nfapi_nr_p7_message_header_t *head
|
||||
void *pnf_start_p5_thread(void *ptr)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "[PNF] IN PNF NFAPI start thread %s\n", __FUNCTION__);
|
||||
nfapi_pnf_config_t *config = (nfapi_pnf_config_t *)ptr;
|
||||
config = (nfapi_pnf_config_t *)ptr;
|
||||
struct sched_param sp;
|
||||
sp.sched_priority = 20;
|
||||
pthread_setschedparam(pthread_self(), SCHED_FIFO, &sp);
|
||||
|
||||
@@ -21,6 +21,8 @@
|
||||
#include "socket_vnf.h"
|
||||
|
||||
#include "nfapi.h"
|
||||
#include "nfapi_vnf.h"
|
||||
#include <common/platform_constants.h>
|
||||
#include "nfapi/oai_integration/vendor_ext.h" //TODO: Remove this include when removing the Aerial transport stuff
|
||||
|
||||
static bool send_p5_msg(vnf_t *vnf, nfapi_vnf_pnf_info_t *pnf, const void *msg, int len, uint8_t stream)
|
||||
@@ -279,7 +281,6 @@ static int nfapi_nr_vnf_p5_start(nfapi_vnf_config_t *config)
|
||||
// Verify that config is not null
|
||||
if (config == 0)
|
||||
return -1;
|
||||
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "%s()\n", __FUNCTION__);
|
||||
|
||||
int p5ListenSock, p5Sock;
|
||||
@@ -293,7 +294,7 @@ static int nfapi_nr_vnf_p5_start(nfapi_vnf_config_t *config)
|
||||
struct sctp_initmsg initMsg = {0};
|
||||
int noDelay;
|
||||
|
||||
vnf_t *vnf = (vnf_t *)(config);
|
||||
vnf_t *vnf = (vnf_t *)(get_config());
|
||||
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "Starting P5 VNF connection on port %u\n", config->vnf_p5_port);
|
||||
|
||||
@@ -747,8 +748,8 @@ static int nfapi_nr_vnf_p7_start(nfapi_vnf_p7_config_t *config)
|
||||
return -1;
|
||||
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "%s()\n", __FUNCTION__);
|
||||
|
||||
vnf_p7_t *vnf_p7 = (vnf_p7_t *)config;
|
||||
vnf_p7_t *vnf_p7 = get_p7_vnf();
|
||||
vnf_p7 = (vnf_p7_t *)config;
|
||||
|
||||
// Create p7 receive udp port
|
||||
// todo : this needs updating for Ipv6
|
||||
|
||||
@@ -27,7 +27,6 @@
|
||||
|
||||
void *wls_fapi_vnf_nr_start_thread(void *ptr);
|
||||
int wls_fapi_nr_vnf_start();
|
||||
void wls_vnf_set_p7_config(void *p7_config);
|
||||
bool wls_vnf_nr_send_p5_message(vnf_t *vnf,uint16_t p5_idx, nfapi_nr_p4_p5_message_header_t* msg, uint32_t msg_len);
|
||||
bool wls_vnf_nr_send_p7_message(vnf_p7_t* vnf_p7,nfapi_nr_p7_message_header_t* msg);
|
||||
#endif //OPENAIRINTERFACE_WLS_VNF_H
|
||||
|
||||
@@ -33,14 +33,7 @@
|
||||
static nfapi_vnf_config_t *config;
|
||||
static WLS_MAC_CTX wls_mac_iface;
|
||||
vnf_t *_vnf = NULL;
|
||||
// A copy of the VNF P7 config is needed for the message processing thread, in other transport mechanisms where P7 is handled in a
|
||||
// different thread, the config is passed to it upon the thread creation
|
||||
nfapi_vnf_p7_config_t *wls_vnf_p7_config = NULL;
|
||||
|
||||
void wls_vnf_set_p7_config(void *p7_config)
|
||||
{
|
||||
wls_vnf_p7_config = (nfapi_vnf_p7_config_t *)p7_config;
|
||||
}
|
||||
|
||||
static PWLS_MAC_CTX wls_mac_get_ctx(void)
|
||||
{
|
||||
@@ -258,7 +251,7 @@ for(int i = 0 ; i< pWls->nTotalBlocks; i++){
|
||||
void* pMsg = wls_mac_alloc_buffer(pWls, 0, i);
|
||||
/* Enqueue all blocks */
|
||||
nBlocks += WLS_EnqueueBlock(pWls->hWls, WLS_VA2PA(pWls->hWls, pMsg));
|
||||
}
|
||||
}
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "\nAllocated %d Blocks \n", nBlocks);
|
||||
return true;
|
||||
}
|
||||
@@ -294,11 +287,11 @@ static void procPhyMessages(uint32_t msg_size, void *msg_buf, uint16_t msg_id)
|
||||
case NFAPI_NR_PHY_MSG_TYPE_CONFIG_RESPONSE:
|
||||
case NFAPI_NR_PHY_MSG_TYPE_START_RESPONSE:
|
||||
case NFAPI_NR_PHY_MSG_TYPE_STOP_INDICATION:
|
||||
vnf_nr_handle_p4_p5_message(msg_buf, msg_size, 0, config);
|
||||
vnf_nr_handle_p4_p5_message(msg_buf, msg_size, 0, get_config());
|
||||
break;
|
||||
|
||||
case NFAPI_NR_PHY_MSG_TYPE_DL_TTI_REQUEST ... NFAPI_NR_PHY_MSG_TYPE_RACH_INDICATION: {
|
||||
vnf_nr_handle_p7_message(msg_buf, msg_size + NFAPI_NR_P7_HEADER_LENGTH, (vnf_p7_t *)wls_vnf_p7_config);
|
||||
vnf_nr_handle_p7_message(msg_buf, msg_size + NFAPI_NR_P7_HEADER_LENGTH, get_p7_vnf());
|
||||
break;
|
||||
}
|
||||
default:
|
||||
@@ -308,6 +301,7 @@ static void procPhyMessages(uint32_t msg_size, void *msg_buf, uint16_t msg_id)
|
||||
|
||||
int wls_fapi_nr_vnf_start(nfapi_vnf_config_t *cfg)
|
||||
{
|
||||
nfapi_vnf_config_t * config = get_config();
|
||||
config = cfg;
|
||||
|
||||
if (config == 0) {
|
||||
@@ -403,7 +397,7 @@ bool wls_vnf_nr_send_p7_message(vnf_p7_t *vnf_p7, nfapi_nr_p7_message_header_t *
|
||||
AssertFatal(fapiMsgElem, "WLS_PA2VA failed for fapiMsgElem\n");
|
||||
//memcpy((uint8_t *)(fapiMsgElem + 1), message, packed_len + NFAPI_HEADER_LENGTH);
|
||||
const uint8_t wls_header[] = {1, 0}; // num_messages , opaque_handle
|
||||
|
||||
|
||||
fill_fapi_list_elem(headerElem, fapiMsgElem, FAPI_VENDOR_MSG_HEADER_IND, 1, 2);
|
||||
memcpy((uint8_t *)(headerElem + 1), wls_header, 2);
|
||||
int packed_len = ((nfapi_vnf_p7_config_t *)vnf_p7)->pack_func(msg, (fapiMsgElem + 1), NFAPI_MAX_PACKED_MESSAGE_SIZE, NULL);
|
||||
|
||||
@@ -100,9 +100,6 @@ bool wls_vnf_nr_send_p7_message(vnf_p7_t *vnf_p7, nfapi_nr_p7_message_header_t *
|
||||
return false;
|
||||
}
|
||||
|
||||
void wls_vnf_set_p7_config(void *p7_config)
|
||||
{
|
||||
}
|
||||
|
||||
bool wls_vnf_nr_send_p5_message(vnf_t *vnf,uint16_t p5_idx, nfapi_nr_p4_p5_message_header_t* msg, uint32_t msg_len)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user