Add send function pointers to VNF
This commit is contained in:
@@ -1537,7 +1537,7 @@ static int vnf_send_p5_msg(nfapi_vnf_pnf_info_t* pnf, const void *msg, int len,
|
||||
return 0;
|
||||
}
|
||||
|
||||
int vnf_nr_pack_and_send_p5_message(vnf_t* vnf, uint16_t p5_idx, nfapi_nr_p4_p5_message_header_t* msg, uint16_t msg_len)
|
||||
bool vnf_nr_send_p5_message(vnf_t* vnf, uint16_t p5_idx, nfapi_nr_p4_p5_message_header_t* msg, uint32_t msg_len)
|
||||
{
|
||||
nfapi_vnf_pnf_info_t* pnf = nfapi_vnf_pnf_list_find(&(vnf->_public), p5_idx);
|
||||
|
||||
@@ -1554,9 +1554,9 @@ int vnf_nr_pack_and_send_p5_message(vnf_t* vnf, uint16_t p5_idx, nfapi_nr_p4_p5_
|
||||
int packedMessageLengthFAPI = -1;
|
||||
packedMessageLengthFAPI =
|
||||
fapi_nr_p5_message_pack(msg, msg_len, tx_messagebufferFAPI, sizeof(tx_messagebufferFAPI), &vnf->_public.codec_config);
|
||||
return aerial_send_P5_msg(tx_messagebufferFAPI, packedMessageLengthFAPI, msg);
|
||||
return aerial_send_P5_msg(tx_messagebufferFAPI, packedMessageLengthFAPI, msg) == 0;
|
||||
#else
|
||||
return 0;
|
||||
return true;
|
||||
#endif
|
||||
} else {
|
||||
packedMessageLength = nfapi_nr_p5_message_pack(msg,
|
||||
@@ -1567,7 +1567,7 @@ int vnf_nr_pack_and_send_p5_message(vnf_t* vnf, uint16_t p5_idx, nfapi_nr_p4_p5_
|
||||
|
||||
if (packedMessageLength < 0) {
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "nfapi_nr_p5_message_pack failed with return %d\n", packedMessageLength);
|
||||
return -1;
|
||||
return false;
|
||||
}
|
||||
// printf("msg id = 0x%02x, entire message length: %d\n", msg->message_id, packedMessageLength);
|
||||
// for (int i = 0; i < packedMessageLength; i++) {
|
||||
@@ -1578,7 +1578,7 @@ int vnf_nr_pack_and_send_p5_message(vnf_t* vnf, uint16_t p5_idx, nfapi_nr_p4_p5_
|
||||
}
|
||||
} else {
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() cannot find pnf info for p5_idx:%d\n", __FUNCTION__, p5_idx);
|
||||
return -1;
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
/*
|
||||
* Copyright 2017 Cisco Systems, Inc.
|
||||
*
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
@@ -14,6 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "assertions.h"
|
||||
|
||||
#include <sys/socket.h>
|
||||
#include <sys/types.h>
|
||||
@@ -894,8 +895,8 @@ int nfapi_nr_vnf_pnf_param_req(nfapi_vnf_config_t* config, int p5_idx, nfapi_nr_
|
||||
return -1;
|
||||
|
||||
vnf_t* _this = (vnf_t*)(config);
|
||||
|
||||
return vnf_nr_pack_and_send_p5_message(_this, p5_idx, &req->header, sizeof(nfapi_nr_pnf_param_request_t));
|
||||
AssertFatal(config->send_p5_msg, "Function pointer must be configured\n");
|
||||
return config->send_p5_msg(_this, p5_idx, &req->header, sizeof(nfapi_nr_pnf_param_request_t));
|
||||
}
|
||||
|
||||
int nfapi_vnf_pnf_param_req(nfapi_vnf_config_t* config, int p5_idx, nfapi_pnf_param_request_t* req)
|
||||
@@ -914,8 +915,8 @@ int nfapi_nr_vnf_pnf_config_req(nfapi_vnf_config_t* config, int p5_idx, nfapi_nr
|
||||
return -1;
|
||||
|
||||
vnf_t* _this = (vnf_t*)(config);
|
||||
|
||||
return vnf_nr_pack_and_send_p5_message(_this, p5_idx, &req->header, sizeof(nfapi_nr_pnf_config_request_t));
|
||||
AssertFatal(config->send_p5_msg, "Function pointer must be configured\n");
|
||||
return config->send_p5_msg(_this, p5_idx, &req->header, sizeof(nfapi_nr_pnf_config_request_t));
|
||||
}
|
||||
|
||||
|
||||
@@ -945,8 +946,8 @@ int nfapi_nr_vnf_pnf_start_req(nfapi_vnf_config_t* config, int p5_idx, nfapi_nr_
|
||||
return -1;
|
||||
|
||||
vnf_t* _this = (vnf_t*)(config);
|
||||
|
||||
return vnf_nr_pack_and_send_p5_message(_this, p5_idx, &req->header, sizeof(nfapi_nr_pnf_start_request_t));
|
||||
AssertFatal(config->send_p5_msg, "Function pointer must be configured\n");
|
||||
return config->send_p5_msg(_this, p5_idx, &req->header, sizeof(nfapi_nr_pnf_start_request_t));
|
||||
}
|
||||
|
||||
int nfapi_vnf_pnf_stop_req(nfapi_vnf_config_t* config, int p5_idx, nfapi_pnf_stop_request_t* req)
|
||||
@@ -965,8 +966,8 @@ int nfapi_nr_vnf_param_req(nfapi_vnf_config_t* config, int p5_idx, nfapi_nr_para
|
||||
return -1;
|
||||
|
||||
vnf_t* _this = (vnf_t*)(config);
|
||||
|
||||
return vnf_nr_pack_and_send_p5_message(_this, p5_idx, &req->header, sizeof(nfapi_nr_param_request_scf_t));
|
||||
AssertFatal(config->send_p5_msg, "Function pointer must be configured\n");
|
||||
return config->send_p5_msg(_this, p5_idx, &req->header, sizeof(nfapi_nr_param_request_scf_t));
|
||||
}
|
||||
|
||||
int nfapi_vnf_param_req(nfapi_vnf_config_t* config, int p5_idx, nfapi_param_request_t* req)
|
||||
@@ -983,7 +984,7 @@ int nfapi_nr_vnf_config_req(nfapi_vnf_config_t* config, int p5_idx, nfapi_nr_con
|
||||
{
|
||||
if(config == 0 || req == 0)
|
||||
return -1;
|
||||
|
||||
AssertFatal(config->send_p5_msg, "Function pointer must be configured\n");
|
||||
vnf_t* _this = (vnf_t*)(config);
|
||||
|
||||
nfapi_vnf_phy_info_t* phy = nfapi_vnf_phy_info_list_find(config, req->header.phy_id);
|
||||
@@ -1007,7 +1008,7 @@ int nfapi_nr_vnf_config_req(nfapi_vnf_config_t* config, int p5_idx, nfapi_nr_con
|
||||
req->nfapi_config.timing_info_period.value = phy->timing_info_period;
|
||||
req->num_tlv++;
|
||||
|
||||
return vnf_nr_pack_and_send_p5_message(_this, p5_idx, &req->header, sizeof(nfapi_nr_config_request_scf_t));
|
||||
return config->send_p5_msg(_this, p5_idx, &req->header, sizeof(nfapi_nr_config_request_scf_t));
|
||||
}
|
||||
|
||||
int nfapi_vnf_config_req(nfapi_vnf_config_t* config, int p5_idx, nfapi_config_request_t* req)
|
||||
@@ -1057,8 +1058,8 @@ int nfapi_nr_vnf_start_req(nfapi_vnf_config_t* config, int p5_idx, nfapi_nr_star
|
||||
return -1;
|
||||
|
||||
vnf_t* _this = (vnf_t*)(config);
|
||||
|
||||
return vnf_nr_pack_and_send_p5_message(_this, p5_idx, &req->header, sizeof(nfapi_nr_start_request_scf_t));
|
||||
AssertFatal(config->send_p5_msg, "Function pointer must be configured\n");
|
||||
return config->send_p5_msg(_this, p5_idx, &req->header, sizeof(nfapi_nr_start_request_scf_t));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -473,9 +473,8 @@ int vnf_send_p7_msg(vnf_p7_t* vnf_p7, nfapi_vnf_p7_connection_info_t* p7_info, u
|
||||
return 0;
|
||||
}
|
||||
|
||||
int vnf_nr_p7_pack_and_send_p7_msg(vnf_p7_t* vnf_p7, nfapi_nr_p7_message_header_t* header)
|
||||
bool vnf_nr_send_p7_msg(vnf_p7_t* vnf_p7, nfapi_nr_p7_message_header_t* header)
|
||||
{
|
||||
|
||||
nfapi_vnf_p7_connection_info_t* p7_connection = vnf_p7_connection_info_list_find(vnf_p7, header->phy_id);
|
||||
if(p7_connection)
|
||||
{
|
||||
@@ -491,7 +490,7 @@ int vnf_nr_p7_pack_and_send_p7_msg(vnf_p7_t* vnf_p7, nfapi_nr_p7_message_header_
|
||||
if(len < 0)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() failed to pack p7 message phy_id:%d\n", __FUNCTION__, header->phy_id);
|
||||
return -1;
|
||||
return false;
|
||||
}
|
||||
|
||||
if(len > vnf_p7->_public.segment_size)
|
||||
@@ -560,12 +559,12 @@ int vnf_nr_p7_pack_and_send_p7_msg(vnf_p7_t* vnf_p7, nfapi_nr_p7_message_header_
|
||||
}
|
||||
|
||||
p7_connection->sequence_number++;
|
||||
return send_result;
|
||||
return send_result == 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() cannot find p7 connection info for phy_id:%d\n", __FUNCTION__, header->phy_id);
|
||||
return -1;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -676,7 +675,8 @@ int vnf_build_send_dl_node_sync(vnf_p7_t* vnf_p7, nfapi_vnf_p7_connection_info_t
|
||||
}
|
||||
|
||||
int vnf_nr_build_send_dl_node_sync(vnf_p7_t* vnf_p7, nfapi_vnf_p7_connection_info_t* p7_info)
|
||||
{
|
||||
{
|
||||
nfapi_vnf_p7_config_t* config = (nfapi_vnf_p7_config_t*)vnf_p7;
|
||||
nfapi_nr_dl_node_sync_t dl_node_sync;
|
||||
memset(&dl_node_sync, 0, sizeof(dl_node_sync));
|
||||
|
||||
@@ -686,7 +686,7 @@ int vnf_nr_build_send_dl_node_sync(vnf_p7_t* vnf_p7, nfapi_vnf_p7_connection_inf
|
||||
dl_node_sync.t1 = calculate_nr_t1(p7_info->mu, p7_info->sfn,p7_info->slot, vnf_p7->slot_start_time_hr);
|
||||
dl_node_sync.delta_sfn_slot = 0;
|
||||
|
||||
return vnf_nr_p7_pack_and_send_p7_msg(vnf_p7, &dl_node_sync.header);
|
||||
return config->send_p7_msg(vnf_p7, &dl_node_sync.header);
|
||||
}
|
||||
|
||||
int vnf_nr_sync(vnf_p7_t* vnf_p7, nfapi_vnf_p7_connection_info_t* p7_info)
|
||||
|
||||
@@ -600,7 +600,7 @@ int nfapi_vnf_p7_dl_config_req(nfapi_vnf_p7_config_t* config, nfapi_dl_config_re
|
||||
return vnf_p7_pack_and_send_p7_msg(vnf_p7, &req->header);
|
||||
}
|
||||
|
||||
int nfapi_vnf_p7_nr_dl_config_req(nfapi_vnf_p7_config_t* config, nfapi_nr_dl_tti_request_t* req)
|
||||
bool nfapi_vnf_p7_nr_dl_config_req(nfapi_vnf_p7_config_t* config, nfapi_nr_dl_tti_request_t* req)
|
||||
{
|
||||
//NFAPI_TRACE(NFAPI_TRACE_INFO, "%s(config:%p req:%p)\n", __FUNCTION__, config, req);
|
||||
|
||||
@@ -608,15 +608,17 @@ int nfapi_vnf_p7_nr_dl_config_req(nfapi_vnf_p7_config_t* config, nfapi_nr_dl_tti
|
||||
return -1;
|
||||
|
||||
vnf_p7_t* vnf_p7 = (vnf_p7_t*)config;
|
||||
return vnf_nr_p7_pack_and_send_p7_msg(vnf_p7, &req->header);
|
||||
AssertFatal(config->send_p7_msg, "Function pointer must be configured|");
|
||||
return config->send_p7_msg(vnf_p7, &req->header);
|
||||
}
|
||||
|
||||
int nfapi_vnf_p7_ul_tti_req(nfapi_vnf_p7_config_t* config, nfapi_nr_ul_tti_request_t* req)
|
||||
bool nfapi_vnf_p7_ul_tti_req(nfapi_vnf_p7_config_t* config, nfapi_nr_ul_tti_request_t* req)
|
||||
{
|
||||
if(config == 0 || req == 0)
|
||||
return -1;
|
||||
vnf_p7_t* vnf_p7 = (vnf_p7_t*)config;
|
||||
return vnf_nr_p7_pack_and_send_p7_msg(vnf_p7, &req->header);
|
||||
AssertFatal(config->send_p7_msg, "Function pointer must be configured|");
|
||||
return config->send_p7_msg(vnf_p7, &req->header);
|
||||
}
|
||||
|
||||
int nfapi_vnf_p7_ul_config_req(nfapi_vnf_p7_config_t* config, nfapi_ul_config_request_t* req)
|
||||
@@ -627,13 +629,14 @@ int nfapi_vnf_p7_ul_config_req(nfapi_vnf_p7_config_t* config, nfapi_ul_config_re
|
||||
vnf_p7_t* vnf_p7 = (vnf_p7_t*)config;
|
||||
return vnf_p7_pack_and_send_p7_msg(vnf_p7, &req->header);
|
||||
}
|
||||
int nfapi_vnf_p7_ul_dci_req(nfapi_vnf_p7_config_t* config, nfapi_nr_ul_dci_request_t* req)
|
||||
bool nfapi_vnf_p7_ul_dci_req(nfapi_vnf_p7_config_t* config, nfapi_nr_ul_dci_request_t* req)
|
||||
{
|
||||
if(config == 0 || req == 0)
|
||||
return -1;
|
||||
|
||||
vnf_p7_t* vnf_p7 = (vnf_p7_t*)config;
|
||||
return vnf_nr_p7_pack_and_send_p7_msg(vnf_p7, &req->header);
|
||||
AssertFatal(config->send_p7_msg, "Function pointer must be configured|");
|
||||
return config->send_p7_msg(vnf_p7, &req->header);
|
||||
}
|
||||
int nfapi_vnf_p7_hi_dci0_req(nfapi_vnf_p7_config_t* config, nfapi_hi_dci0_request_t* req)
|
||||
{
|
||||
@@ -643,13 +646,14 @@ int nfapi_vnf_p7_hi_dci0_req(nfapi_vnf_p7_config_t* config, nfapi_hi_dci0_reques
|
||||
vnf_p7_t* vnf_p7 = (vnf_p7_t*)config;
|
||||
return vnf_p7_pack_and_send_p7_msg(vnf_p7, &req->header);
|
||||
}
|
||||
int nfapi_vnf_p7_tx_data_req(nfapi_vnf_p7_config_t* config, nfapi_nr_tx_data_request_t* req)
|
||||
bool nfapi_vnf_p7_tx_data_req(nfapi_vnf_p7_config_t* config, nfapi_nr_tx_data_request_t* req)
|
||||
{
|
||||
if(config == 0 || req == 0)
|
||||
return -1;
|
||||
|
||||
vnf_p7_t* vnf_p7 = (vnf_p7_t*)config;
|
||||
return vnf_nr_p7_pack_and_send_p7_msg(vnf_p7, &req->header);
|
||||
AssertFatal(config->send_p7_msg, "Function pointer must be configured|");
|
||||
return config->send_p7_msg(vnf_p7, &req->header);
|
||||
}
|
||||
int nfapi_vnf_p7_tx_req(nfapi_vnf_p7_config_t* config, nfapi_tx_request_t* req)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user