Separate LTE and NR (n)FAPI headers
Update NR P5 and P7 nFAPI headers to have 32-bit message_length In the NR functions, this causes the header parameters following message_length to have their position shifted by 2 bytes, due to the increase in message_length size. Change needed to accommodate SCF222.10.02 Table 3-3 Separates nfapi_p4_p5_message_header_t and nfapi_nr_p4_p5_message_header_t Change the callbacks signature to accept/return void* intead of expecting a particular header type, being the NR/LTE distinction done inside the callback functions. Create NR related functions for nFAPI transmit timestamp and checksum calculation. Move nfapi_p7_codec_config_t and nfapi_p4_p5_codec_config_t to separate header to be shared between LTE and NR VNF/PNF Move nfapi_nr_timing_info_t into NR header. Move NR specific function declarations to NR header.
This commit is contained in:
committed by
Robert Schmidt
parent
434a6b5e84
commit
4e5b841a16
@@ -288,7 +288,7 @@ int8_t buf[1024];
|
||||
|
||||
nv_ipc_config_t nv_ipc_config;
|
||||
|
||||
int aerial_send_P5_msg(void *packedBuf, uint32_t packedMsgLength, nfapi_p4_p5_message_header_t *header)
|
||||
int aerial_send_P5_msg(void *packedBuf, uint32_t packedMsgLength, nfapi_nr_p4_p5_message_header_t *header)
|
||||
{
|
||||
if (ipc == NULL) {
|
||||
return -1;
|
||||
@@ -334,12 +334,12 @@ int aerial_send_P5_msg(void *packedBuf, uint32_t packedMsgLength, nfapi_p4_p5_me
|
||||
|
||||
memcpy(send_msg.msg_buf, packedBuf, send_msg.msg_len);
|
||||
LOG_D(NFAPI_VNF,
|
||||
"send: cell_id=%d msg_id=0x%02X msg_len=%d data_len=%d data_pool=%d\n",
|
||||
send_msg.cell_id,
|
||||
send_msg.msg_id,
|
||||
send_msg.msg_len,
|
||||
send_msg.data_len,
|
||||
send_msg.data_pool);
|
||||
"send: cell_id=%d msg_id=0x%02X msg_len=%d data_len=%d data_pool=%d\n",
|
||||
send_msg.cell_id,
|
||||
send_msg.msg_id,
|
||||
send_msg.msg_len,
|
||||
send_msg.data_len,
|
||||
send_msg.data_pool);
|
||||
// Send the message
|
||||
int send_retval = ipc->tx_send_msg(ipc, &send_msg);
|
||||
if (send_retval < 0) {
|
||||
@@ -352,7 +352,7 @@ int aerial_send_P5_msg(void *packedBuf, uint32_t packedMsgLength, nfapi_p4_p5_me
|
||||
return 0;
|
||||
}
|
||||
|
||||
int aerial_send_P7_msg(void *packedBuf, uint32_t packedMsgLength, nfapi_p7_message_header_t *header)
|
||||
int aerial_send_P7_msg(void *packedBuf, uint32_t packedMsgLength, nfapi_nr_p7_message_header_t *header)
|
||||
{
|
||||
if (ipc == NULL) {
|
||||
return -1;
|
||||
@@ -421,12 +421,12 @@ int aerial_send_P7_msg(void *packedBuf, uint32_t packedMsgLength, nfapi_p7_messa
|
||||
|
||||
memcpy(send_msg.msg_buf, packedBuf, send_msg.msg_len);
|
||||
LOG_D(NFAPI_VNF,
|
||||
"send: cell_id=%d msg_id=0x%02X msg_len=%d data_len=%d data_pool=%d\n",
|
||||
send_msg.cell_id,
|
||||
send_msg.msg_id,
|
||||
send_msg.msg_len,
|
||||
send_msg.data_len,
|
||||
send_msg.data_pool);
|
||||
"send: cell_id=%d msg_id=0x%02X msg_len=%d data_len=%d data_pool=%d\n",
|
||||
send_msg.cell_id,
|
||||
send_msg.msg_id,
|
||||
send_msg.msg_len,
|
||||
send_msg.data_len,
|
||||
send_msg.data_pool);
|
||||
// Send the message
|
||||
int send_retval = ipc->tx_send_msg(ipc, &send_msg);
|
||||
if (send_retval < 0) {
|
||||
@@ -440,10 +440,10 @@ int aerial_send_P7_msg(void *packedBuf, uint32_t packedMsgLength, nfapi_p7_messa
|
||||
}
|
||||
|
||||
int aerial_send_P7_msg_with_data(void *packedBuf,
|
||||
uint32_t packedMsgLength,
|
||||
void *dataBuf,
|
||||
uint32_t dataLength,
|
||||
nfapi_p7_message_header_t *header)
|
||||
uint32_t packedMsgLength,
|
||||
void *dataBuf,
|
||||
uint32_t dataLength,
|
||||
nfapi_nr_p7_message_header_t *header)
|
||||
{
|
||||
if (ipc == NULL) {
|
||||
return -1;
|
||||
@@ -511,12 +511,12 @@ int aerial_send_P7_msg_with_data(void *packedBuf,
|
||||
memcpy(send_msg.msg_buf, packedBuf, send_msg.msg_len);
|
||||
memcpy(send_msg.data_buf, dataBuf, send_msg.data_len);
|
||||
LOG_D(NFAPI_VNF,
|
||||
"send: cell_id=%d msg_id=0x%02X msg_len=%d data_len=%d data_pool=%d\n",
|
||||
send_msg.cell_id,
|
||||
send_msg.msg_id,
|
||||
send_msg.msg_len,
|
||||
send_msg.data_len,
|
||||
send_msg.data_pool);
|
||||
"send: cell_id=%d msg_id=0x%02X msg_len=%d data_len=%d data_pool=%d\n",
|
||||
send_msg.cell_id,
|
||||
send_msg.msg_id,
|
||||
send_msg.msg_len,
|
||||
send_msg.data_len,
|
||||
send_msg.data_pool);
|
||||
// Send the message
|
||||
int send_retval = ipc->tx_send_msg(ipc, &send_msg);
|
||||
if (send_retval != 0) {
|
||||
|
||||
@@ -47,13 +47,13 @@ typedef struct {
|
||||
uint32_t message_length;
|
||||
} fapi_phy_api_msg;
|
||||
|
||||
int aerial_send_P5_msg(void *packedBuf, uint32_t packedMsgLength, nfapi_p4_p5_message_header_t *header);
|
||||
int aerial_send_P7_msg(void *packedBuf, uint32_t packedMsgLength, nfapi_p7_message_header_t *header);
|
||||
int aerial_send_P5_msg(void *packedBuf, uint32_t packedMsgLength, nfapi_nr_p4_p5_message_header_t *header);
|
||||
int aerial_send_P7_msg(void *packedBuf, uint32_t packedMsgLength, nfapi_nr_p7_message_header_t *header);
|
||||
int aerial_send_P7_msg_with_data(void *packedBuf,
|
||||
uint32_t packedMsgLength,
|
||||
void *dataBuf,
|
||||
uint32_t dataLength,
|
||||
nfapi_p7_message_header_t *header);
|
||||
uint32_t packedMsgLength,
|
||||
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);
|
||||
|
||||
|
||||
@@ -299,7 +299,6 @@ int aerial_nr_send_config_request(nfapi_vnf_config_t *config, int p5_idx)
|
||||
req->header.phy_id = phy->id;
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "[VNF] Send NFAPI_CONFIG_REQUEST\n");
|
||||
|
||||
|
||||
vnf_t *_this = (vnf_t *)(config);
|
||||
|
||||
nfapi_vnf_phy_info_t *vnf_phy = nfapi_vnf_phy_info_list_find(config, req->header.phy_id);
|
||||
@@ -309,7 +308,7 @@ int aerial_nr_send_config_request(nfapi_vnf_config_t *config, int p5_idx)
|
||||
return -1;
|
||||
}
|
||||
|
||||
nfapi_p4_p5_message_header_t *msg = &req->header;
|
||||
nfapi_nr_p4_p5_message_header_t *msg = &req->header;
|
||||
uint16_t msg_len = sizeof(nfapi_nr_config_request_scf_t);
|
||||
uint8_t tx_messagebufferFAPI[sizeof(_this->tx_message_buffer)];
|
||||
int packedMessageLengthFAPI = -1;
|
||||
@@ -346,19 +345,19 @@ int aerial_nr_start_resp_cb(nfapi_vnf_config_t *config, int p5_idx, nfapi_nr_sta
|
||||
return 0;
|
||||
}
|
||||
|
||||
int aerial_vendor_ext_cb(nfapi_vnf_config_t *config, int p5_idx, nfapi_p4_p5_message_header_t *msg)
|
||||
int aerial_vendor_ext_cb(nfapi_vnf_config_t *config, int p5_idx, void *msg)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "[VNF] %s\n", __FUNCTION__);
|
||||
|
||||
switch (msg->message_id) {
|
||||
switch (((nfapi_nr_p4_p5_message_header_t *)msg)->message_id) {
|
||||
case P5_VENDOR_EXT_RSP: {
|
||||
vendor_ext_p5_rsp *rsp = (vendor_ext_p5_rsp *)msg;
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "[VNF] P5_VENDOR_EXT_RSP error_code:%d\n", rsp->error_code);
|
||||
// send the start request
|
||||
nfapi_pnf_start_request_t req;
|
||||
nfapi_nr_pnf_start_request_t req;
|
||||
memset(&req, 0, sizeof(req));
|
||||
req.header.message_id = NFAPI_PNF_START_REQUEST;
|
||||
nfapi_vnf_pnf_start_req(config, p5_idx, &req);
|
||||
nfapi_nr_vnf_pnf_start_req(config, p5_idx, &req);
|
||||
} break;
|
||||
}
|
||||
|
||||
@@ -392,12 +391,12 @@ int aerial_vnf_pack_vendor_extension_tlv(void *vext, uint8_t **ppWritePackedMsg,
|
||||
return -1;
|
||||
}
|
||||
|
||||
int aerial_vnf_unpack_p4_p5_vendor_extension(nfapi_p4_p5_message_header_t *header,
|
||||
int aerial_vnf_unpack_p4_p5_vendor_extension(void *header,
|
||||
uint8_t **ppReadPackedMessage,
|
||||
uint8_t *end,
|
||||
nfapi_p4_p5_codec_config_t *codec)
|
||||
{
|
||||
if (header->message_id == P5_VENDOR_EXT_RSP) {
|
||||
if (((nfapi_nr_p4_p5_message_header_t *)header)->message_id == P5_VENDOR_EXT_RSP) {
|
||||
vendor_ext_p5_rsp *req = (vendor_ext_p5_rsp *)(header);
|
||||
return (!pull16(ppReadPackedMessage, &req->error_code, end));
|
||||
}
|
||||
@@ -405,12 +404,12 @@ int aerial_vnf_unpack_p4_p5_vendor_extension(nfapi_p4_p5_message_header_t *heade
|
||||
return 0;
|
||||
}
|
||||
|
||||
int aerial_vnf_pack_p4_p5_vendor_extension(nfapi_p4_p5_message_header_t *header,
|
||||
int aerial_vnf_pack_p4_p5_vendor_extension(void *header,
|
||||
uint8_t **ppWritePackedMsg,
|
||||
uint8_t *end,
|
||||
nfapi_p4_p5_codec_config_t *codec)
|
||||
{
|
||||
if (header->message_id == P5_VENDOR_EXT_REQ) {
|
||||
if (((nfapi_nr_p4_p5_message_header_t *)header)->message_id == P5_VENDOR_EXT_REQ) {
|
||||
vendor_ext_p5_req *req = (vendor_ext_p5_req *)(header);
|
||||
return (!(push16(req->dummy1, ppWritePackedMsg, end) && push16(req->dummy2, ppWritePackedMsg, end)));
|
||||
}
|
||||
@@ -418,17 +417,17 @@ int aerial_vnf_pack_p4_p5_vendor_extension(nfapi_p4_p5_message_header_t *header,
|
||||
return 0;
|
||||
}
|
||||
|
||||
nfapi_p4_p5_message_header_t *aerial_vnf_allocate_p4_p5_vendor_ext(uint16_t message_id, uint16_t *msg_size)
|
||||
void *aerial_vnf_allocate_p4_p5_vendor_ext(uint16_t message_id, uint16_t *msg_size)
|
||||
{
|
||||
if (message_id == P5_VENDOR_EXT_RSP) {
|
||||
*msg_size = sizeof(vendor_ext_p5_rsp);
|
||||
return (nfapi_p4_p5_message_header_t *)malloc(sizeof(vendor_ext_p5_rsp));
|
||||
return malloc(sizeof(vendor_ext_p5_rsp));
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void aerial_vnf_deallocate_p4_p5_vendor_ext(nfapi_p4_p5_message_header_t *header)
|
||||
void aerial_vnf_deallocate_p4_p5_vendor_ext(void *header)
|
||||
{
|
||||
free(header);
|
||||
}
|
||||
|
||||
@@ -333,25 +333,25 @@ void aerial_vnf_deallocate(void *ptr)
|
||||
free(ptr);
|
||||
}
|
||||
|
||||
int aerial_phy_vendor_ext(struct nfapi_vnf_p7_config *config, nfapi_p7_message_header_t *msg)
|
||||
int aerial_phy_vendor_ext(struct nfapi_vnf_p7_config *config, void *msg)
|
||||
{
|
||||
if (msg->message_id == P7_VENDOR_EXT_IND) {
|
||||
if (((nfapi_nr_p7_message_header_t *)msg)->message_id == P7_VENDOR_EXT_IND) {
|
||||
// vendor_ext_p7_ind* ind = (vendor_ext_p7_ind*)msg;
|
||||
// NFAPI_TRACE(NFAPI_TRACE_INFO, "[VNF] vendor_ext (error_code:%d)\n", ind->error_code);
|
||||
} else {
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "[VNF] unknown %02x\n", msg->message_id);
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "[VNF] unknown %02x\n", ((nfapi_nr_p7_message_header_t *)msg)->message_id);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int aerial_phy_unpack_p7_vendor_extension(nfapi_p7_message_header_t *header,
|
||||
int aerial_phy_unpack_p7_vendor_extension(void *header,
|
||||
uint8_t **ppReadPackedMessage,
|
||||
uint8_t *end,
|
||||
nfapi_p7_codec_config_t *config)
|
||||
{
|
||||
// NFAPI_TRACE(NFAPI_TRACE_INFO, "%s\n", __FUNCTION__);
|
||||
if (header->message_id == P7_VENDOR_EXT_IND) {
|
||||
if (((nfapi_nr_p7_message_header_t *)header)->message_id == P7_VENDOR_EXT_IND) {
|
||||
vendor_ext_p7_ind *req = (vendor_ext_p7_ind *)(header);
|
||||
|
||||
if (!pull16(ppReadPackedMessage, &req->error_code, end))
|
||||
@@ -361,13 +361,10 @@ int aerial_phy_unpack_p7_vendor_extension(nfapi_p7_message_header_t *header,
|
||||
return 1;
|
||||
}
|
||||
|
||||
int aerial_phy_pack_p7_vendor_extension(nfapi_p7_message_header_t *header,
|
||||
uint8_t **ppWritePackedMsg,
|
||||
uint8_t *end,
|
||||
nfapi_p7_codec_config_t *config)
|
||||
int aerial_phy_pack_p7_vendor_extension(void *header, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t *config)
|
||||
{
|
||||
// NFAPI_TRACE(NFAPI_TRACE_INFO, "%s\n", __FUNCTION__);
|
||||
if (header->message_id == P7_VENDOR_EXT_REQ) {
|
||||
if (((nfapi_nr_p7_message_header_t *)header)->message_id == P7_VENDOR_EXT_REQ) {
|
||||
// NFAPI_TRACE(NFAPI_TRACE_INFO, "%s\n", __FUNCTION__);
|
||||
vendor_ext_p7_req *req = (vendor_ext_p7_req *)(header);
|
||||
|
||||
@@ -412,17 +409,17 @@ int aerial_phy_pack_vendor_extension_tlv(void *ve, uint8_t **ppWritePackedMsg, u
|
||||
}
|
||||
}
|
||||
|
||||
nfapi_p7_message_header_t *aerial_phy_allocate_p7_vendor_ext(uint16_t message_id, uint16_t *msg_size)
|
||||
void *aerial_phy_allocate_p7_vendor_ext(uint16_t message_id, uint16_t *msg_size)
|
||||
{
|
||||
if (message_id == P7_VENDOR_EXT_IND) {
|
||||
*msg_size = sizeof(vendor_ext_p7_ind);
|
||||
return (nfapi_p7_message_header_t *)malloc(sizeof(vendor_ext_p7_ind));
|
||||
return (nfapi_nr_p7_message_header_t *)malloc(sizeof(vendor_ext_p7_ind));
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void aerial_phy_deallocate_p7_vendor_ext(nfapi_p7_message_header_t *header)
|
||||
void aerial_phy_deallocate_p7_vendor_ext(void *header)
|
||||
{
|
||||
free(header);
|
||||
}
|
||||
@@ -530,7 +527,7 @@ static int32_t aerial_pack_tx_data_request(void *pMessageBuf,
|
||||
return -1;
|
||||
}
|
||||
|
||||
nfapi_p7_message_header_t *pMessageHeader = pMessageBuf;
|
||||
nfapi_nr_p7_message_header_t *pMessageHeader = pMessageBuf;
|
||||
uint8_t *end = pPackedBuf + packedBufLen;
|
||||
uint8_t *data_end = pDataBuf + dataBufLen;
|
||||
uint8_t *pWritePackedMessage = pPackedBuf;
|
||||
@@ -569,8 +566,7 @@ static int32_t aerial_pack_tx_data_request(void *pMessageBuf,
|
||||
// recalculate PDU_Length for Aerial (leave only the size occupied in the payload buffer afterward)
|
||||
// assuming there is only 1 TLV present
|
||||
value->PDU_length = value->TLVs[0].length;
|
||||
if (!(push32(value->PDU_length, ppWriteBody, end)
|
||||
&& // cuBB expects TX_DATA.request PDUSize to be 32 bit
|
||||
if (!(push32(value->PDU_length, ppWriteBody, end) && // cuBB expects TX_DATA.request PDUSize to be 32 bit
|
||||
push16(value->PDU_index, ppWriteBody, end) && push32(value->num_TLV, ppWriteBody, end))) {
|
||||
return 0;
|
||||
}
|
||||
@@ -589,7 +585,7 @@ static int32_t aerial_pack_tx_data_request(void *pMessageBuf,
|
||||
}
|
||||
}
|
||||
|
||||
//Actual payloads are packed in a separate buffer
|
||||
// Actual payloads are packed in a separate buffer
|
||||
for (int i = 0; i < pNfapiMsg->Number_of_PDUs; i++) {
|
||||
nfapi_nr_pdu_t *value = (nfapi_nr_pdu_t *)&pNfapiMsg->pdu_list[i];
|
||||
|
||||
@@ -626,12 +622,11 @@ static int32_t aerial_pack_tx_data_request(void *pMessageBuf,
|
||||
}
|
||||
}
|
||||
} else {
|
||||
LOG_E(NR_MAC,"value->TLVs[i].length was 0! (%d.%d) \n", pNfapiMsg->SFN, pNfapiMsg->Slot);
|
||||
LOG_E(NR_MAC, "value->TLVs[i].length was 0! (%d.%d) \n", pNfapiMsg->SFN, pNfapiMsg->Slot);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// calculate data_len
|
||||
uintptr_t dataHead = (uintptr_t)pPackedDataFieldStart;
|
||||
uintptr_t dataEnd = (uintptr_t)pPackedDataField;
|
||||
@@ -807,7 +802,7 @@ int fapi_nr_p7_message_pack(void *pMessageBuf, void *pPackedBuf, uint32_t packed
|
||||
return (packedMsgLen16);
|
||||
}
|
||||
|
||||
int fapi_nr_pack_and_send_p7_message(vnf_p7_t *vnf_p7, nfapi_p7_message_header_t *header)
|
||||
int fapi_nr_pack_and_send_p7_message(vnf_p7_t *vnf_p7, nfapi_nr_p7_message_header_t *header)
|
||||
{
|
||||
uint8_t FAPI_buffer[1024 * 64];
|
||||
// Check if TX_DATA request, if true, need to pack to data_buf
|
||||
@@ -817,7 +812,7 @@ int fapi_nr_pack_and_send_p7_message(vnf_p7_t *vnf_p7, nfapi_p7_message_header_t
|
||||
for (int i = 0; i < pNfapiMsg->Number_of_PDUs; ++i) {
|
||||
size += pNfapiMsg->pdu_list[i].PDU_length;
|
||||
}
|
||||
AssertFatal(size <= 1024 * 1024 * 2, "Message data larger than available buffer, tried to pack %"PRId64 ,size);
|
||||
AssertFatal(size <= 1024 * 1024 * 2, "Message data larger than available buffer, tried to pack %" PRId64, size);
|
||||
uint8_t FAPI_data_buffer[1024 * 1024 * 2]; // 2MB
|
||||
uint32_t data_len = 0;
|
||||
int32_t len_FAPI = aerial_pack_tx_data_request(header,
|
||||
|
||||
@@ -187,23 +187,20 @@ int aerial_phy_nr_slot_indication(nfapi_nr_slot_indication_scf_t *ind);
|
||||
int aerial_phy_nr_srs_indication(nfapi_nr_srs_indication_t *ind);
|
||||
void *aerial_vnf_allocate(size_t size);
|
||||
void aerial_vnf_deallocate(void *ptr);
|
||||
int aerial_phy_vendor_ext(struct nfapi_vnf_p7_config *config, nfapi_p7_message_header_t *msg);
|
||||
int aerial_phy_unpack_p7_vendor_extension(nfapi_p7_message_header_t *header,
|
||||
int aerial_phy_vendor_ext(struct nfapi_vnf_p7_config *config, void *msg);
|
||||
int aerial_phy_unpack_p7_vendor_extension(void *header,
|
||||
uint8_t **ppReadPackedMessage,
|
||||
uint8_t *end,
|
||||
nfapi_p7_codec_config_t *config);
|
||||
int aerial_phy_pack_p7_vendor_extension(nfapi_p7_message_header_t *header,
|
||||
uint8_t **ppWritePackedMsg,
|
||||
uint8_t *end,
|
||||
nfapi_p7_codec_config_t *config);
|
||||
int aerial_phy_pack_p7_vendor_extension(void *header, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t *config);
|
||||
int aerial_phy_unpack_vendor_extension_tlv(nfapi_tl_t *tl,
|
||||
uint8_t **ppReadPackedMessage,
|
||||
uint8_t *end,
|
||||
void **ve,
|
||||
nfapi_p7_codec_config_t *codec);
|
||||
int aerial_phy_pack_vendor_extension_tlv(void *ve, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t *codec);
|
||||
nfapi_p7_message_header_t *aerial_phy_allocate_p7_vendor_ext(uint16_t message_id, uint16_t *msg_size);
|
||||
void aerial_phy_deallocate_p7_vendor_ext(nfapi_p7_message_header_t *header);
|
||||
void *aerial_phy_allocate_p7_vendor_ext(uint16_t message_id, uint16_t *msg_size);
|
||||
void aerial_phy_deallocate_p7_vendor_ext(void *header);
|
||||
|
||||
uint8_t aerial_unpack_nr_slot_indication(uint8_t **ppReadPackedMsg,
|
||||
uint8_t *end,
|
||||
@@ -227,5 +224,5 @@ uint8_t aerial_unpack_nr_rach_indication(uint8_t **ppReadPackedMsg,
|
||||
nfapi_p7_codec_config_t *config);
|
||||
|
||||
// int fapi_nr_p7_message_pack(void *pMessageBuf, void *pPackedBuf, uint32_t packedBufLen, nfapi_p7_codec_config_t* config);
|
||||
int fapi_nr_pack_and_send_p7_message(vnf_p7_t *vnf_p7, nfapi_p7_message_header_t *header);
|
||||
int fapi_nr_pack_and_send_p7_message(vnf_p7_t *vnf_p7, nfapi_nr_p7_message_header_t *header);
|
||||
#endif // OPENAIRINTERFACE_FAPI_VNF_P7_H
|
||||
|
||||
@@ -1076,8 +1076,9 @@ int nr_config_request(nfapi_pnf_config_t *config, nfapi_pnf_phy_config_t *phy, n
|
||||
return 0;
|
||||
}
|
||||
|
||||
nfapi_p7_message_header_t *pnf_phy_allocate_p7_vendor_ext(uint16_t message_id, uint16_t *msg_size) {
|
||||
if(message_id == P7_VENDOR_EXT_REQ) {
|
||||
void *pnf_phy_allocate_p7_vendor_ext(uint16_t message_id, uint16_t *msg_size)
|
||||
{
|
||||
if (message_id == P7_VENDOR_EXT_REQ) {
|
||||
(*msg_size) = sizeof(vendor_ext_p7_req);
|
||||
return (nfapi_p7_message_header_t *)malloc(sizeof(vendor_ext_p7_req));
|
||||
}
|
||||
@@ -1085,7 +1086,23 @@ nfapi_p7_message_header_t *pnf_phy_allocate_p7_vendor_ext(uint16_t message_id, u
|
||||
return 0;
|
||||
}
|
||||
|
||||
void pnf_phy_deallocate_p7_vendor_ext(nfapi_p7_message_header_t *header) {
|
||||
void *pnf_nr_phy_allocate_p7_vendor_ext(uint16_t message_id, uint16_t *msg_size)
|
||||
{
|
||||
if (message_id == P7_VENDOR_EXT_REQ) {
|
||||
(*msg_size) = sizeof(vendor_ext_p7_req);
|
||||
return (nfapi_nr_p7_message_header_t *)malloc(sizeof(vendor_ext_p7_req));
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void pnf_phy_deallocate_p7_vendor_ext(void *header)
|
||||
{
|
||||
free(header);
|
||||
}
|
||||
|
||||
void pnf_nr_phy_deallocate_p7_vendor_ext(void *header)
|
||||
{
|
||||
free(header);
|
||||
}
|
||||
|
||||
@@ -1522,10 +1539,11 @@ int pnf_phy_ue_release_req(nfapi_pnf_p7_config_t* config, nfapi_ue_release_reque
|
||||
return 0;
|
||||
}
|
||||
|
||||
int pnf_phy_vendor_ext(nfapi_pnf_p7_config_t *config, nfapi_p7_message_header_t *msg) {
|
||||
if(msg->message_id == P7_VENDOR_EXT_REQ) {
|
||||
//vendor_ext_p7_req* req = (vendor_ext_p7_req*)msg;
|
||||
//printf("[PNF] vendor request (1:%d 2:%d)\n", req->dummy1, req->dummy2);
|
||||
int pnf_phy_vendor_ext(nfapi_pnf_p7_config_t *config, void *msg)
|
||||
{
|
||||
if (((nfapi_p7_message_header_t *)msg)->message_id == P7_VENDOR_EXT_REQ) {
|
||||
// vendor_ext_p7_req* req = (vendor_ext_p7_req*)msg;
|
||||
// printf("[PNF] vendor request (1:%d 2:%d)\n", req->dummy1, req->dummy2);
|
||||
} else {
|
||||
printf("[PNF] unknown vendor ext\n");
|
||||
}
|
||||
@@ -1533,9 +1551,21 @@ int pnf_phy_vendor_ext(nfapi_pnf_p7_config_t *config, nfapi_p7_message_header_t
|
||||
return 0;
|
||||
}
|
||||
|
||||
int pnf_phy_pack_p7_vendor_extension(nfapi_p7_message_header_t *header, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t *codex) {
|
||||
int pnf_nr_phy_vendor_ext(nfapi_pnf_p7_config_t *config, void *msg)
|
||||
{
|
||||
if (((nfapi_nr_p7_message_header_t *)msg)->message_id == P7_VENDOR_EXT_REQ) {
|
||||
// vendor_ext_p7_req* req = (vendor_ext_p7_req*)msg;
|
||||
// printf("[PNF] vendor request (1:%d 2:%d)\n", req->dummy1, req->dummy2);
|
||||
} else {
|
||||
printf("[PNF] unknown vendor ext\n");
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int pnf_phy_pack_p7_vendor_extension(void *header, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t *codex) {
|
||||
//NFAPI_TRACE(NFAPI_TRACE_INFO, "%s\n", __FUNCTION__);
|
||||
if(header->message_id == P7_VENDOR_EXT_IND) {
|
||||
if(((nfapi_p7_message_header_t*)header)->message_id == P7_VENDOR_EXT_IND) {
|
||||
vendor_ext_p7_ind *ind = (vendor_ext_p7_ind *)(header);
|
||||
|
||||
if(!push16(ind->error_code, ppWritePackedMsg, end))
|
||||
@@ -1547,13 +1577,43 @@ int pnf_phy_pack_p7_vendor_extension(nfapi_p7_message_header_t *header, uint8_t
|
||||
return -1;
|
||||
}
|
||||
|
||||
int pnf_phy_unpack_p7_vendor_extension(nfapi_p7_message_header_t *header, uint8_t **ppReadPackedMessage, uint8_t *end, nfapi_p7_codec_config_t *codec) {
|
||||
if(header->message_id == P7_VENDOR_EXT_REQ) {
|
||||
//NFAPI_TRACE(NFAPI_TRACE_INFO, "%s\n", __FUNCTION__);
|
||||
int pnf_phy_unpack_p7_vendor_extension(void *header, uint8_t **ppReadPackedMessage, uint8_t *end, nfapi_p7_codec_config_t *codec)
|
||||
{
|
||||
if (((nfapi_p7_message_header_t *)header)->message_id == P7_VENDOR_EXT_REQ) {
|
||||
// NFAPI_TRACE(NFAPI_TRACE_INFO, "%s\n", __FUNCTION__);
|
||||
vendor_ext_p7_req *req = (vendor_ext_p7_req *)(header);
|
||||
|
||||
if(!(pull16(ppReadPackedMessage, &req->dummy1, end) &&
|
||||
pull16(ppReadPackedMessage, &req->dummy2, end)))
|
||||
if (!(pull16(ppReadPackedMessage, &req->dummy1, end) && pull16(ppReadPackedMessage, &req->dummy2, end)))
|
||||
return 0;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
int pnf_nr_phy_pack_p7_vendor_extension(void *header, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t *codex)
|
||||
{
|
||||
// NFAPI_TRACE(NFAPI_TRACE_INFO, "%s\n", __FUNCTION__);
|
||||
if (((nfapi_nr_p7_message_header_t *)header)->message_id == P7_VENDOR_EXT_IND) {
|
||||
vendor_ext_p7_ind *ind = (vendor_ext_p7_ind *)(header);
|
||||
|
||||
if (!push16(ind->error_code, ppWritePackedMsg, end))
|
||||
return 0;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
int pnf_nr_phy_unpack_p7_vendor_extension(void *header, uint8_t **ppReadPackedMessage, uint8_t *end, nfapi_p7_codec_config_t *codec)
|
||||
{
|
||||
if (((nfapi_nr_p7_message_header_t *)header)->message_id == P7_VENDOR_EXT_REQ) {
|
||||
// NFAPI_TRACE(NFAPI_TRACE_INFO, "%s\n", __FUNCTION__);
|
||||
vendor_ext_p7_req *req = (vendor_ext_p7_req *)(header);
|
||||
|
||||
if (!(pull16(ppReadPackedMessage, &req->dummy1, end) && pull16(ppReadPackedMessage, &req->dummy2, end)))
|
||||
return 0;
|
||||
|
||||
return 1;
|
||||
@@ -1585,6 +1645,34 @@ int pnf_phy_pack_vendor_extention_tlv(void *ve, uint8_t **ppWritePackedMsg, uint
|
||||
return -1;
|
||||
}
|
||||
|
||||
int pnf_nr_phy_unpack_vendor_extension_tlv(nfapi_tl_t *tl,
|
||||
uint8_t **ppReadPackedMessage,
|
||||
uint8_t *end,
|
||||
void **ve,
|
||||
nfapi_p7_codec_config_t *config)
|
||||
{
|
||||
// NFAPI_TRACE(NFAPI_TRACE_INFO, "pnf_phy_unpack_vendor_extension_tlv\n");
|
||||
switch (tl->tag) {
|
||||
case VENDOR_EXT_TLV_1_TAG:
|
||||
*ve = malloc(sizeof(vendor_ext_tlv_1));
|
||||
|
||||
if (!pull32(ppReadPackedMessage, &((vendor_ext_tlv_1 *)(*ve))->dummy, end))
|
||||
return 0;
|
||||
|
||||
return 1;
|
||||
break;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
int pnf_nr_phy_pack_vendor_extention_tlv(void *ve, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t *config)
|
||||
{
|
||||
// printf("%s\n", __FUNCTION__);
|
||||
(void)ve;
|
||||
(void)ppWritePackedMsg;
|
||||
return -1;
|
||||
}
|
||||
int pnf_sim_unpack_vendor_extension_tlv(nfapi_tl_t *tl, uint8_t **ppReadPackedMessage, uint8_t *end, void **ve, nfapi_p4_p5_codec_config_t *config) {
|
||||
//NFAPI_TRACE(NFAPI_TRACE_INFO, "pnf_sim_unpack_vendor_extension_tlv\n");
|
||||
switch(tl->tag) {
|
||||
@@ -1601,6 +1689,27 @@ int pnf_sim_unpack_vendor_extension_tlv(nfapi_tl_t *tl, uint8_t **ppReadPackedMe
|
||||
return -1;
|
||||
}
|
||||
|
||||
int pnf_nr_sim_unpack_vendor_extension_tlv(nfapi_tl_t *tl,
|
||||
uint8_t **ppReadPackedMessage,
|
||||
uint8_t *end,
|
||||
void **ve,
|
||||
nfapi_p4_p5_codec_config_t *config)
|
||||
{
|
||||
// NFAPI_TRACE(NFAPI_TRACE_INFO, "pnf_sim_unpack_vendor_extension_tlv\n");
|
||||
switch (tl->tag) {
|
||||
case VENDOR_EXT_TLV_2_TAG:
|
||||
*ve = malloc(sizeof(vendor_ext_tlv_2));
|
||||
|
||||
if (!pull32(ppReadPackedMessage, &((vendor_ext_tlv_2 *)(*ve))->dummy, end))
|
||||
return 0;
|
||||
|
||||
return 1;
|
||||
break;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
int pnf_sim_pack_vendor_extention_tlv(void *ve, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t *config) {
|
||||
//printf("%s\n", __FUNCTION__);
|
||||
(void)ve;
|
||||
@@ -1609,6 +1718,15 @@ int pnf_sim_pack_vendor_extention_tlv(void *ve, uint8_t **ppWritePackedMsg, uint
|
||||
return -1;
|
||||
}
|
||||
|
||||
int pnf_nr_sim_pack_vendor_extention_tlv(void *ve, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t *config)
|
||||
{
|
||||
// printf("%s\n", __FUNCTION__);
|
||||
(void)ve;
|
||||
(void)ppWritePackedMsg;
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
nfapi_dl_config_request_t dummy_dl_config_req;
|
||||
nfapi_tx_request_t dummy_tx_req;
|
||||
|
||||
@@ -1726,7 +1844,8 @@ int start_request(nfapi_pnf_config_t *config, nfapi_pnf_phy_config_t *phy, nfapi
|
||||
return 0;
|
||||
}
|
||||
|
||||
int nr_start_request(nfapi_pnf_config_t *config, nfapi_pnf_phy_config_t *phy, nfapi_nr_start_request_scf_t *req) {
|
||||
int nr_start_request(nfapi_pnf_config_t *config, nfapi_pnf_phy_config_t *phy, nfapi_nr_start_request_scf_t *req)
|
||||
{
|
||||
printf("[PNF] Received NFAPI_START_REQ phy_id:%d\n", req->header.phy_id);
|
||||
pnf_info *pnf = (pnf_info *)(config->user_data);
|
||||
phy_info *phy_info = pnf->phys;
|
||||
@@ -1737,7 +1856,11 @@ int nr_start_request(nfapi_pnf_config_t *config, nfapi_pnf_phy_config_t *phy, n
|
||||
|
||||
p7_config->local_p7_port = phy_info->udp.rx_port;
|
||||
p7_config->local_p7_addr = phy_info->local_addr;
|
||||
printf("[PNF] P7 remote:%s:%d local:%s:%d\n", p7_config->remote_p7_addr, p7_config->remote_p7_port, p7_config->local_p7_addr, p7_config->local_p7_port);
|
||||
printf("[PNF] P7 remote:%s:%d local:%s:%d\n",
|
||||
p7_config->remote_p7_addr,
|
||||
p7_config->remote_p7_port,
|
||||
p7_config->local_p7_addr,
|
||||
p7_config->local_p7_port);
|
||||
p7_config->user_data = phy_info;
|
||||
p7_config->malloc = &pnf_allocate;
|
||||
p7_config->free = &pnf_deallocate;
|
||||
@@ -1749,19 +1872,19 @@ int nr_start_request(nfapi_pnf_config_t *config, nfapi_pnf_phy_config_t *phy, n
|
||||
p7_config->slot_buffer_size = phy_info->timing_window; // TODO: check if correct for NR
|
||||
printf("subframe_buffer_size configured using phy_info->timing_window:%d\n", phy_info->timing_window);
|
||||
|
||||
if(phy_info->timing_info_mode & 0x1) {
|
||||
if (phy_info->timing_info_mode & 0x1) {
|
||||
p7_config->timing_info_mode_periodic = 1;
|
||||
p7_config->timing_info_period = phy_info->timing_info_period;
|
||||
}
|
||||
|
||||
if(phy_info->timing_info_mode & 0x2) {
|
||||
if (phy_info->timing_info_mode & 0x2) {
|
||||
p7_config->timing_info_mode_aperiodic = 1;
|
||||
}
|
||||
|
||||
// NR
|
||||
p7_config->dl_tti_req_fn = &pnf_phy_dl_tti_req;
|
||||
p7_config->ul_tti_req_fn = &pnf_phy_ul_tti_req;
|
||||
p7_config->ul_dci_req_fn = &pnf_phy_ul_dci_req;
|
||||
p7_config->dl_tti_req_fn = &pnf_phy_dl_tti_req;
|
||||
p7_config->ul_tti_req_fn = &pnf_phy_ul_tti_req;
|
||||
p7_config->ul_dci_req_fn = &pnf_phy_ul_dci_req;
|
||||
p7_config->tx_data_req_fn = &pnf_phy_tx_data_req;
|
||||
|
||||
// LTE
|
||||
@@ -1771,7 +1894,7 @@ int nr_start_request(nfapi_pnf_config_t *config, nfapi_pnf_phy_config_t *phy, n
|
||||
p7_config->tx_req = &pnf_phy_tx_req;
|
||||
p7_config->lbt_dl_config_req = &pnf_phy_lbt_dl_config_req;
|
||||
p7_config->ue_release_req = &pnf_phy_ue_release_req;
|
||||
if (NFAPI_MODE==NFAPI_UE_STUB_PNF) {
|
||||
if (NFAPI_MODE == NFAPI_UE_STUB_PNF) {
|
||||
p7_config->dl_config_req = NULL;
|
||||
p7_config->ul_config_req = NULL;
|
||||
p7_config->hi_dci0_req = NULL;
|
||||
@@ -1785,25 +1908,25 @@ int nr_start_request(nfapi_pnf_config_t *config, nfapi_pnf_phy_config_t *phy, n
|
||||
|
||||
p7_config->lbt_dl_config_req = &pnf_phy_lbt_dl_config_req;
|
||||
memset(&dummy_dl_config_req, 0, sizeof(dummy_dl_config_req));
|
||||
dummy_dl_config_req.dl_config_request_body.tl.tag=NFAPI_DL_CONFIG_REQUEST_BODY_TAG;
|
||||
dummy_dl_config_req.dl_config_request_body.number_pdcch_ofdm_symbols=1;
|
||||
dummy_dl_config_req.dl_config_request_body.number_dci=0;
|
||||
dummy_dl_config_req.dl_config_request_body.number_pdu=0;
|
||||
dummy_dl_config_req.dl_config_request_body.number_pdsch_rnti=0;
|
||||
dummy_dl_config_req.dl_config_request_body.transmission_power_pcfich=6000;
|
||||
dummy_dl_config_req.dl_config_request_body.dl_config_pdu_list=0;
|
||||
dummy_dl_config_req.dl_config_request_body.tl.tag = NFAPI_DL_CONFIG_REQUEST_BODY_TAG;
|
||||
dummy_dl_config_req.dl_config_request_body.number_pdcch_ofdm_symbols = 1;
|
||||
dummy_dl_config_req.dl_config_request_body.number_dci = 0;
|
||||
dummy_dl_config_req.dl_config_request_body.number_pdu = 0;
|
||||
dummy_dl_config_req.dl_config_request_body.number_pdsch_rnti = 0;
|
||||
dummy_dl_config_req.dl_config_request_body.transmission_power_pcfich = 6000;
|
||||
dummy_dl_config_req.dl_config_request_body.dl_config_pdu_list = 0;
|
||||
memset(&dummy_tx_req, 0, sizeof(dummy_tx_req));
|
||||
dummy_tx_req.tx_request_body.number_of_pdus=0;
|
||||
dummy_tx_req.tx_request_body.tl.tag=NFAPI_TX_REQUEST_BODY_TAG;
|
||||
dummy_tx_req.tx_request_body.number_of_pdus = 0;
|
||||
dummy_tx_req.tx_request_body.tl.tag = NFAPI_TX_REQUEST_BODY_TAG;
|
||||
memset(&p7_config->dummy_subframe, 0, sizeof(p7_config->dummy_subframe));
|
||||
p7_config->dummy_subframe.dl_config_req = &dummy_dl_config_req;
|
||||
p7_config->vendor_ext = &pnf_phy_vendor_ext;
|
||||
p7_config->allocate_p7_vendor_ext = &pnf_phy_allocate_p7_vendor_ext;
|
||||
p7_config->deallocate_p7_vendor_ext = &pnf_phy_deallocate_p7_vendor_ext;
|
||||
p7_config->codec_config.unpack_p7_vendor_extension = &pnf_phy_unpack_p7_vendor_extension;
|
||||
p7_config->codec_config.pack_p7_vendor_extension = &pnf_phy_pack_p7_vendor_extension;
|
||||
p7_config->codec_config.unpack_vendor_extension_tlv = &pnf_phy_unpack_vendor_extension_tlv;
|
||||
p7_config->codec_config.pack_vendor_extension_tlv = &pnf_phy_pack_vendor_extention_tlv;
|
||||
p7_config->vendor_ext = &pnf_nr_phy_vendor_ext;
|
||||
p7_config->allocate_p7_vendor_ext = &pnf_nr_phy_allocate_p7_vendor_ext;
|
||||
p7_config->deallocate_p7_vendor_ext = &pnf_nr_phy_deallocate_p7_vendor_ext;
|
||||
p7_config->codec_config.unpack_p7_vendor_extension = &pnf_nr_phy_unpack_p7_vendor_extension;
|
||||
p7_config->codec_config.pack_p7_vendor_extension = &pnf_nr_phy_pack_p7_vendor_extension;
|
||||
p7_config->codec_config.unpack_vendor_extension_tlv = &pnf_nr_phy_unpack_vendor_extension_tlv;
|
||||
p7_config->codec_config.pack_vendor_extension_tlv = &pnf_nr_phy_pack_vendor_extention_tlv;
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "[PNF] Creating P7 thread %s\n", __FUNCTION__);
|
||||
pthread_t p7_thread;
|
||||
threadCreate(&p7_thread, &pnf_nr_p7_thread_start, p7_config, "pnf_p7_thread", -1, OAI_PRIORITY_RT);
|
||||
@@ -1813,24 +1936,24 @@ int nr_start_request(nfapi_pnf_config_t *config, nfapi_pnf_phy_config_t *phy, n
|
||||
p7_config_g = p7_config;
|
||||
|
||||
// Need to wait for main thread to create RU structures
|
||||
while(config_sync_var<0) {
|
||||
while (config_sync_var < 0) {
|
||||
usleep(5000000);
|
||||
printf("[PNF] waiting for OAI to be configured (eNB/RU)\n");
|
||||
}
|
||||
|
||||
printf("[PNF] OAI eNB/RU configured\n");
|
||||
//printf("[PNF] About to call phy_init_RU() for RC.ru[0]:%p\n", RC.ru[0]);
|
||||
//phy_init_RU(RC.ru[0]);
|
||||
// printf("[PNF] About to call phy_init_RU() for RC.ru[0]:%p\n", RC.ru[0]);
|
||||
// phy_init_RU(RC.ru[0]);
|
||||
printf("[PNF] About to call init_eNB_afterRU()\n");
|
||||
|
||||
if (NFAPI_MODE!=NFAPI_UE_STUB_PNF) {
|
||||
if (NFAPI_MODE != NFAPI_UE_STUB_PNF) {
|
||||
init_eNB_afterRU();
|
||||
}
|
||||
|
||||
// Signal to main thread that it can carry on - otherwise RU will startup too quickly and it is not initialised
|
||||
{
|
||||
pthread_mutex_lock(&nfapi_sync_mutex);
|
||||
nfapi_sync_var=0;
|
||||
nfapi_sync_var = 0;
|
||||
pthread_cond_broadcast(&nfapi_sync_cond);
|
||||
pthread_mutex_unlock(&nfapi_sync_mutex);
|
||||
}
|
||||
@@ -1850,8 +1973,7 @@ int nr_start_request(nfapi_pnf_config_t *config, nfapi_pnf_phy_config_t *phy, n
|
||||
nfapi_pnf_p7_subframe_ind(p7_config, p7_config->phy_id, 0); // SFN_SF set to zero - correct???
|
||||
printf("[PNF] Sent first P7 subframe ind\n");
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -2042,10 +2164,11 @@ int nmm_stop_request(nfapi_pnf_config_t *config, nfapi_pnf_phy_config_t *phy, nf
|
||||
return 0;
|
||||
}
|
||||
|
||||
int vendor_ext(nfapi_pnf_config_t *config, nfapi_p4_p5_message_header_t *msg) {
|
||||
int vendor_ext(nfapi_pnf_config_t *config, void *msg)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "[PNF] P5 %s %p\n", __FUNCTION__, msg);
|
||||
|
||||
switch(msg->message_id) {
|
||||
switch (((nfapi_p4_p5_message_header_t *)msg)->message_id) {
|
||||
case P5_VENDOR_EXT_REQ: {
|
||||
vendor_ext_p5_req *req = (vendor_ext_p5_req *)msg;
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "[PNF] P5 Vendor Ext Req (%d %d)\n", req->dummy1, req->dummy2);
|
||||
@@ -2055,15 +2178,35 @@ int vendor_ext(nfapi_pnf_config_t *config, nfapi_p4_p5_message_header_t *msg) {
|
||||
rsp.header.message_id = P5_VENDOR_EXT_RSP;
|
||||
rsp.error_code = NFAPI_MSG_OK;
|
||||
nfapi_pnf_vendor_extension(config, &rsp.header, sizeof(vendor_ext_p5_rsp));
|
||||
}
|
||||
break;
|
||||
} break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
nfapi_p4_p5_message_header_t *pnf_sim_allocate_p4_p5_vendor_ext(uint16_t message_id, uint16_t *msg_size) {
|
||||
if(message_id == P5_VENDOR_EXT_REQ) {
|
||||
int nr_vendor_ext(nfapi_pnf_config_t *config, void *msg)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "[PNF] P5 %s %p\n", __FUNCTION__, msg);
|
||||
|
||||
switch (((nfapi_nr_p4_p5_message_header_t *)msg)->message_id) {
|
||||
case P5_VENDOR_EXT_REQ: {
|
||||
vendor_ext_p5_req *req = (vendor_ext_p5_req *)msg;
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "[PNF] P5 Vendor Ext Req (%d %d)\n", req->dummy1, req->dummy2);
|
||||
// send back the P5_VENDOR_EXT_RSP
|
||||
vendor_ext_p5_rsp rsp;
|
||||
memset(&rsp, 0, sizeof(rsp));
|
||||
rsp.header.message_id = P5_VENDOR_EXT_RSP;
|
||||
rsp.error_code = NFAPI_MSG_OK;
|
||||
nfapi_pnf_vendor_extension(config, &rsp.header, sizeof(vendor_ext_p5_rsp));
|
||||
} break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void *pnf_sim_allocate_p4_p5_vendor_ext(uint16_t message_id, uint16_t *msg_size)
|
||||
{
|
||||
if (message_id == P5_VENDOR_EXT_REQ) {
|
||||
(*msg_size) = sizeof(vendor_ext_p5_req);
|
||||
return (nfapi_p4_p5_message_header_t *)malloc(sizeof(vendor_ext_p5_req));
|
||||
}
|
||||
@@ -2071,13 +2214,30 @@ nfapi_p4_p5_message_header_t *pnf_sim_allocate_p4_p5_vendor_ext(uint16_t message
|
||||
return 0;
|
||||
}
|
||||
|
||||
void pnf_sim_deallocate_p4_p5_vendor_ext(nfapi_p4_p5_message_header_t *header) {
|
||||
void *pnf_nr_sim_allocate_p4_p5_vendor_ext(uint16_t message_id, uint16_t *msg_size)
|
||||
{
|
||||
if (message_id == P5_VENDOR_EXT_REQ) {
|
||||
(*msg_size) = sizeof(vendor_ext_p5_req);
|
||||
return (nfapi_p4_p5_message_header_t *)malloc(sizeof(vendor_ext_p5_req));
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void pnf_sim_deallocate_p4_p5_vendor_ext(void *header)
|
||||
{
|
||||
free(header);
|
||||
}
|
||||
|
||||
int pnf_sim_pack_p4_p5_vendor_extension(nfapi_p4_p5_message_header_t *header, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t *config) {
|
||||
//NFAPI_TRACE(NFAPI_TRACE_INFO, "%s\n", __FUNCTION__);
|
||||
if(header->message_id == P5_VENDOR_EXT_RSP) {
|
||||
void pnf_nr_sim_deallocate_p4_p5_vendor_ext(void *header)
|
||||
{
|
||||
free(header);
|
||||
}
|
||||
|
||||
int pnf_sim_pack_p4_p5_vendor_extension(void *header, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t *config)
|
||||
{
|
||||
// NFAPI_TRACE(NFAPI_TRACE_INFO, "%s\n", __FUNCTION__);
|
||||
if (((nfapi_p4_p5_message_header_t *)header)->message_id == P5_VENDOR_EXT_RSP) {
|
||||
vendor_ext_p5_rsp *rsp = (vendor_ext_p5_rsp *)(header);
|
||||
return (!push16(rsp->error_code, ppWritePackedMsg, end));
|
||||
}
|
||||
@@ -2085,13 +2245,45 @@ int pnf_sim_pack_p4_p5_vendor_extension(nfapi_p4_p5_message_header_t *header, ui
|
||||
return 0;
|
||||
}
|
||||
|
||||
int pnf_sim_unpack_p4_p5_vendor_extension(nfapi_p4_p5_message_header_t *header, uint8_t **ppReadPackedMessage, uint8_t *end, nfapi_p4_p5_codec_config_t *codec) {
|
||||
//NFAPI_TRACE(NFAPI_TRACE_INFO, "%s\n", __FUNCTION__);
|
||||
if(header->message_id == P5_VENDOR_EXT_REQ) {
|
||||
int pnf_nr_sim_pack_p4_p5_vendor_extension(void *header,
|
||||
uint8_t **ppWritePackedMsg,
|
||||
uint8_t *end,
|
||||
nfapi_p4_p5_codec_config_t *config)
|
||||
{
|
||||
// NFAPI_TRACE(NFAPI_TRACE_INFO, "%s\n", __FUNCTION__);
|
||||
if (((nfapi_nr_p4_p5_message_header_t *)header)->message_id == P5_VENDOR_EXT_RSP) {
|
||||
vendor_ext_p5_rsp *rsp = (vendor_ext_p5_rsp *)(header);
|
||||
return (!push16(rsp->error_code, ppWritePackedMsg, end));
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int pnf_sim_unpack_p4_p5_vendor_extension(void *header,
|
||||
uint8_t **ppReadPackedMessage,
|
||||
uint8_t *end,
|
||||
nfapi_p4_p5_codec_config_t *codec)
|
||||
{
|
||||
// NFAPI_TRACE(NFAPI_TRACE_INFO, "%s\n", __FUNCTION__);
|
||||
if (((nfapi_p4_p5_message_header_t *)header)->message_id == P5_VENDOR_EXT_REQ) {
|
||||
vendor_ext_p5_req *req = (vendor_ext_p5_req *)(header);
|
||||
return (!(pull16(ppReadPackedMessage, &req->dummy1, end) &&
|
||||
pull16(ppReadPackedMessage, &req->dummy2, end)));
|
||||
//NFAPI_TRACE(NFAPI_TRACE_INFO, "%s (%d %d)\n", __FUNCTION__, req->dummy1, req->dummy2);
|
||||
return (!(pull16(ppReadPackedMessage, &req->dummy1, end) && pull16(ppReadPackedMessage, &req->dummy2, end)));
|
||||
// NFAPI_TRACE(NFAPI_TRACE_INFO, "%s (%d %d)\n", __FUNCTION__, req->dummy1, req->dummy2);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int pnf_nr_sim_unpack_p4_p5_vendor_extension(void *header,
|
||||
uint8_t **ppReadPackedMessage,
|
||||
uint8_t *end,
|
||||
nfapi_p4_p5_codec_config_t *codec)
|
||||
{
|
||||
// NFAPI_TRACE(NFAPI_TRACE_INFO, "%s\n", __FUNCTION__);
|
||||
if (((nfapi_nr_p4_p5_message_header_t *)header)->message_id == P5_VENDOR_EXT_REQ) {
|
||||
vendor_ext_p5_req *req = (vendor_ext_p5_req *)(header);
|
||||
return (!(pull16(ppReadPackedMessage, &req->dummy1, end) && pull16(ppReadPackedMessage, &req->dummy2, end)));
|
||||
// NFAPI_TRACE(NFAPI_TRACE_INFO, "%s (%d %d)\n", __FUNCTION__, req->dummy1, req->dummy2);
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -2118,9 +2310,10 @@ void *pnf_nr_start_thread(void *ptr) {
|
||||
return (void *)0;
|
||||
}
|
||||
|
||||
void configure_nr_nfapi_pnf(char *vnf_ip_addr, int vnf_p5_port, char *pnf_ip_addr, int pnf_p7_port, int vnf_p7_port) {
|
||||
void configure_nr_nfapi_pnf(char *vnf_ip_addr, int vnf_p5_port, char *pnf_ip_addr, int pnf_p7_port, int vnf_p7_port)
|
||||
{
|
||||
printf("%s() PNF\n\n\n\n\n\n", __FUNCTION__);
|
||||
nfapi_setmode(NFAPI_MODE_PNF); // PNF!
|
||||
nfapi_setmode(NFAPI_MODE_PNF); // PNF!
|
||||
|
||||
nfapi_pnf_config_t *config = nfapi_pnf_config_create();
|
||||
config->vnf_ip_addr = vnf_ip_addr;
|
||||
@@ -2139,9 +2332,8 @@ void configure_nr_nfapi_pnf(char *vnf_ip_addr, int vnf_p5_port, char *pnf_ip_add
|
||||
pnf.phys[0].udp.tx_port,
|
||||
pnf.phys[0].udp.rx_port);
|
||||
config->cell_search_req = &cell_search_request;
|
||||
|
||||
|
||||
//config->pnf_nr_param_req = &pnf_nr_param_request;
|
||||
|
||||
// config->pnf_nr_param_req = &pnf_nr_param_request;
|
||||
config->pnf_nr_param_req = &pnf_nr_param_request;
|
||||
config->pnf_nr_config_req = &pnf_nr_config_request;
|
||||
config->pnf_nr_start_req = &pnf_nr_start_request;
|
||||
@@ -2149,22 +2341,21 @@ void configure_nr_nfapi_pnf(char *vnf_ip_addr, int vnf_p5_port, char *pnf_ip_add
|
||||
config->nr_param_req = &nr_param_request;
|
||||
config->nr_config_req = &nr_config_request;
|
||||
config->nr_start_req = &nr_start_request;
|
||||
config->measurement_req = &measurement_request;
|
||||
config->rssi_req = &rssi_request;
|
||||
config->broadcast_detect_req = &broadcast_detect_request;
|
||||
config->system_information_schedule_req = &system_information_schedule_request;
|
||||
config->system_information_req = &system_information_request;
|
||||
config->nmm_stop_req = &nmm_stop_request;
|
||||
config->vendor_ext = &vendor_ext;
|
||||
config->vendor_ext = &nr_vendor_ext;
|
||||
config->trace = &pnf_nfapi_trace;
|
||||
config->user_data = &pnf;
|
||||
// To allow custom vendor extentions to be added to nfapi
|
||||
config->codec_config.unpack_vendor_extension_tlv = &pnf_sim_unpack_vendor_extension_tlv;
|
||||
config->codec_config.pack_vendor_extension_tlv = &pnf_sim_pack_vendor_extention_tlv;
|
||||
config->allocate_p4_p5_vendor_ext = &pnf_sim_allocate_p4_p5_vendor_ext;
|
||||
config->deallocate_p4_p5_vendor_ext = &pnf_sim_deallocate_p4_p5_vendor_ext;
|
||||
config->codec_config.unpack_p4_p5_vendor_extension = &pnf_sim_unpack_p4_p5_vendor_extension;
|
||||
config->codec_config.pack_p4_p5_vendor_extension = &pnf_sim_pack_p4_p5_vendor_extension;
|
||||
config->codec_config.unpack_vendor_extension_tlv = &pnf_nr_sim_unpack_vendor_extension_tlv;
|
||||
config->codec_config.pack_vendor_extension_tlv = &pnf_nr_sim_pack_vendor_extention_tlv;
|
||||
config->allocate_p4_p5_vendor_ext = &pnf_nr_sim_allocate_p4_p5_vendor_ext;
|
||||
config->deallocate_p4_p5_vendor_ext = &pnf_nr_sim_deallocate_p4_p5_vendor_ext;
|
||||
config->codec_config.unpack_p4_p5_vendor_extension = &pnf_nr_sim_unpack_p4_p5_vendor_extension;
|
||||
config->codec_config.pack_p4_p5_vendor_extension = &pnf_nr_sim_pack_p4_p5_vendor_extension;
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "[PNF] Creating PNF NFAPI start thread %s\n", __FUNCTION__);
|
||||
pthread_create(&pnf_start_pthread, NULL, &pnf_nr_start_thread, config);
|
||||
pthread_setname_np(pnf_start_pthread, "NFAPI_PNF");
|
||||
|
||||
@@ -195,9 +195,36 @@ int vnf_pack_vendor_extension_tlv(void *ve, uint8_t **ppWritePackedMsg, uint8_t
|
||||
return -1;
|
||||
}
|
||||
|
||||
int vnf_nr_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;
|
||||
|
||||
switch (tlv->tag) {
|
||||
case VENDOR_EXT_TLV_2_TAG: {
|
||||
// NFAPI_TRACE(NFAPI_TRACE_INFO, "Packing VENDOR_EXT_TLV_2\n");
|
||||
vendor_ext_tlv_2 *ve = (vendor_ext_tlv_2 *)tlv;
|
||||
|
||||
if (!push32(ve->dummy, ppWritePackedMsg, end))
|
||||
return 0;
|
||||
|
||||
return 1;
|
||||
} break;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
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;
|
||||
}
|
||||
int vnf_nr_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;
|
||||
}
|
||||
void install_nr_schedule_handlers(NR_IF_Module_t *if_inst);
|
||||
void install_schedule_handlers(IF_Module_t *if_inst);
|
||||
extern uint16_t sf_ahead;
|
||||
@@ -1288,6 +1315,17 @@ void vnf_deallocate(void *ptr) {
|
||||
free(ptr);
|
||||
}
|
||||
|
||||
void *vnf_nr_allocate(size_t size)
|
||||
{
|
||||
// return (void*)memory_pool::allocate(size);
|
||||
return (void *)malloc(size);
|
||||
}
|
||||
|
||||
void vnf_nr_deallocate(void *ptr)
|
||||
{
|
||||
// memory_pool::deallocate((uint8_t*)ptr);
|
||||
free(ptr);
|
||||
}
|
||||
|
||||
void vnf_trace(nfapi_trace_level_t nfapi_level, const char *message, ...) {
|
||||
va_list args;
|
||||
@@ -1296,18 +1334,31 @@ void vnf_trace(nfapi_trace_level_t nfapi_level, const char *message, ...) {
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
int phy_vendor_ext(struct nfapi_vnf_p7_config *config, nfapi_p7_message_header_t *msg) {
|
||||
if(msg->message_id == P7_VENDOR_EXT_IND) {
|
||||
//vendor_ext_p7_ind* ind = (vendor_ext_p7_ind*)msg;
|
||||
//NFAPI_TRACE(NFAPI_TRACE_INFO, "[VNF] vendor_ext (error_code:%d)\n", ind->error_code);
|
||||
int phy_vendor_ext(struct nfapi_vnf_p7_config *config, void *msg)
|
||||
{
|
||||
if (((nfapi_p7_message_header_t *)msg)->message_id == P7_VENDOR_EXT_IND) {
|
||||
// vendor_ext_p7_ind* ind = (vendor_ext_p7_ind*)msg;
|
||||
// NFAPI_TRACE(NFAPI_TRACE_INFO, "[VNF] vendor_ext (error_code:%d)\n", ind->error_code);
|
||||
} else {
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "[VNF] unknown %02x\n", msg->message_id);
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "[VNF] unknown %02x\n", ((nfapi_p7_message_header_t *)msg)->message_id);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
nfapi_p7_message_header_t *phy_allocate_p7_vendor_ext(uint16_t message_id, uint16_t *msg_size) {
|
||||
int phy_nr_vendor_ext(struct nfapi_vnf_p7_config *config, void *msg)
|
||||
{
|
||||
if (((nfapi_nr_p7_message_header_t *)msg)->message_id == P7_VENDOR_EXT_IND) {
|
||||
// vendor_ext_p7_ind* ind = (vendor_ext_p7_ind*)msg;
|
||||
// NFAPI_TRACE(NFAPI_TRACE_INFO, "[VNF] vendor_ext (error_code:%d)\n", ind->error_code);
|
||||
} else {
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "[VNF] unknown %02x\n", ((nfapi_nr_p7_message_header_t *)msg)->message_id);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void *phy_allocate_p7_vendor_ext(uint16_t message_id, uint16_t *msg_size) {
|
||||
if(message_id == P7_VENDOR_EXT_IND) {
|
||||
*msg_size = sizeof(vendor_ext_p7_ind);
|
||||
return (nfapi_p7_message_header_t *)malloc(sizeof(vendor_ext_p7_ind));
|
||||
@@ -1316,7 +1367,23 @@ nfapi_p7_message_header_t *phy_allocate_p7_vendor_ext(uint16_t message_id, uint1
|
||||
return 0;
|
||||
}
|
||||
|
||||
void phy_deallocate_p7_vendor_ext(nfapi_p7_message_header_t *header) {
|
||||
void phy_deallocate_p7_vendor_ext(void *header)
|
||||
{
|
||||
free(header);
|
||||
}
|
||||
|
||||
void *phy_nr_allocate_p7_vendor_ext(uint16_t message_id, uint16_t *msg_size)
|
||||
{
|
||||
if (message_id == P7_VENDOR_EXT_IND) {
|
||||
*msg_size = sizeof(vendor_ext_p7_ind);
|
||||
return (nfapi_p7_message_header_t *)malloc(sizeof(vendor_ext_p7_ind));
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void phy_nr_deallocate_p7_vendor_ext(void *header)
|
||||
{
|
||||
free(header);
|
||||
}
|
||||
|
||||
@@ -1327,6 +1394,18 @@ int phy_unpack_vendor_extension_tlv(nfapi_tl_t *tl, uint8_t **ppReadPackedMessag
|
||||
return -1;
|
||||
}
|
||||
|
||||
int phy_nr_unpack_vendor_extension_tlv(nfapi_tl_t *tl,
|
||||
uint8_t **ppReadPackedMessage,
|
||||
uint8_t *end,
|
||||
void **ve,
|
||||
nfapi_p7_codec_config_t *codec)
|
||||
{
|
||||
(void)tl;
|
||||
(void)ppReadPackedMessage;
|
||||
(void)ve;
|
||||
return -1;
|
||||
}
|
||||
|
||||
int phy_pack_vendor_extension_tlv(void *ve, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t *codec) {
|
||||
//NFAPI_TRACE(NFAPI_TRACE_INFO, "phy_pack_vendor_extension_tlv\n");
|
||||
nfapi_tl_t *tlv = (nfapi_tl_t *)ve;
|
||||
@@ -1349,39 +1428,100 @@ int phy_pack_vendor_extension_tlv(void *ve, uint8_t **ppWritePackedMsg, uint8_t
|
||||
}
|
||||
}
|
||||
|
||||
int phy_unpack_p7_vendor_extension(nfapi_p7_message_header_t *header, uint8_t **ppReadPackedMessage, uint8_t *end, nfapi_p7_codec_config_t *config) {
|
||||
//NFAPI_TRACE(NFAPI_TRACE_INFO, "%s\n", __FUNCTION__);
|
||||
if(header->message_id == P7_VENDOR_EXT_IND) {
|
||||
int phy_nr_pack_vendor_extension_tlv(void *ve, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t *codec)
|
||||
{
|
||||
// NFAPI_TRACE(NFAPI_TRACE_INFO, "phy_pack_vendor_extension_tlv\n");
|
||||
nfapi_tl_t *tlv = (nfapi_tl_t *)ve;
|
||||
|
||||
switch (tlv->tag) {
|
||||
case VENDOR_EXT_TLV_1_TAG: {
|
||||
// NFAPI_TRACE(NFAPI_TRACE_INFO, "Packing VENDOR_EXT_TLV_1\n");
|
||||
vendor_ext_tlv_1 *ve = (vendor_ext_tlv_1 *)tlv;
|
||||
|
||||
if (!push32(ve->dummy, ppWritePackedMsg, end))
|
||||
return 0;
|
||||
|
||||
return 1;
|
||||
} break;
|
||||
|
||||
default:
|
||||
return -1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
int phy_unpack_p7_vendor_extension(void *header, uint8_t **ppReadPackedMessage, uint8_t *end, nfapi_p7_codec_config_t *config)
|
||||
{
|
||||
// NFAPI_TRACE(NFAPI_TRACE_INFO, "%s\n", __FUNCTION__);
|
||||
if (((nfapi_p7_message_header_t *)header)->message_id == P7_VENDOR_EXT_IND) {
|
||||
vendor_ext_p7_ind *req = (vendor_ext_p7_ind *)(header);
|
||||
|
||||
if(!pull16(ppReadPackedMessage, &req->error_code, end))
|
||||
if (!pull16(ppReadPackedMessage, &req->error_code, end))
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int phy_pack_p7_vendor_extension(nfapi_p7_message_header_t *header, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t *config) {
|
||||
//NFAPI_TRACE(NFAPI_TRACE_INFO, "%s\n", __FUNCTION__);
|
||||
if(header->message_id == P7_VENDOR_EXT_REQ) {
|
||||
//NFAPI_TRACE(NFAPI_TRACE_INFO, "%s\n", __FUNCTION__);
|
||||
int phy_nr_unpack_p7_vendor_extension(void *header, uint8_t **ppReadPackedMessage, uint8_t *end, nfapi_p7_codec_config_t *config)
|
||||
{
|
||||
// NFAPI_TRACE(NFAPI_TRACE_INFO, "%s\n", __FUNCTION__);
|
||||
if (((nfapi_nr_p7_message_header_t *)header)->message_id == P7_VENDOR_EXT_IND) {
|
||||
vendor_ext_p7_ind *req = (vendor_ext_p7_ind *)(header);
|
||||
|
||||
if (!pull16(ppReadPackedMessage, &req->error_code, end))
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int phy_pack_p7_vendor_extension(void *header, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t *config)
|
||||
{
|
||||
// NFAPI_TRACE(NFAPI_TRACE_INFO, "%s\n", __FUNCTION__);
|
||||
if (((nfapi_p7_message_header_t *)header)->message_id == P7_VENDOR_EXT_REQ) {
|
||||
// NFAPI_TRACE(NFAPI_TRACE_INFO, "%s\n", __FUNCTION__);
|
||||
vendor_ext_p7_req *req = (vendor_ext_p7_req *)(header);
|
||||
|
||||
if(!(push16(req->dummy1, ppWritePackedMsg, end) &&
|
||||
push16(req->dummy2, ppWritePackedMsg, end)))
|
||||
if (!(push16(req->dummy1, ppWritePackedMsg, end) && push16(req->dummy2, ppWritePackedMsg, end)))
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int vnf_pack_p4_p5_vendor_extension(nfapi_p4_p5_message_header_t *header, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t *codec) {
|
||||
//NFAPI_TRACE(NFAPI_TRACE_INFO, "%s\n", __FUNCTION__);
|
||||
if(header->message_id == P5_VENDOR_EXT_REQ) {
|
||||
int phy_nr_pack_p7_vendor_extension(void *header, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t *config)
|
||||
{
|
||||
// NFAPI_TRACE(NFAPI_TRACE_INFO, "%s\n", __FUNCTION__);
|
||||
if (((nfapi_nr_p7_message_header_t *)header)->message_id == P7_VENDOR_EXT_REQ) {
|
||||
// NFAPI_TRACE(NFAPI_TRACE_INFO, "%s\n", __FUNCTION__);
|
||||
vendor_ext_p7_req *req = (vendor_ext_p7_req *)(header);
|
||||
|
||||
if (!(push16(req->dummy1, ppWritePackedMsg, end) && push16(req->dummy2, ppWritePackedMsg, end)))
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int vnf_pack_p4_p5_vendor_extension(void *header, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t *codec)
|
||||
{
|
||||
// NFAPI_TRACE(NFAPI_TRACE_INFO, "%s\n", __FUNCTION__);
|
||||
if (((nfapi_p4_p5_message_header_t *)header)->message_id == P5_VENDOR_EXT_REQ) {
|
||||
vendor_ext_p5_req *req = (vendor_ext_p5_req *)(header);
|
||||
//NFAPI_TRACE(NFAPI_TRACE_INFO, "%s %d %d\n", __FUNCTION__, req->dummy1, req->dummy2);
|
||||
return (!(push16(req->dummy1, ppWritePackedMsg, end) &&
|
||||
push16(req->dummy2, ppWritePackedMsg, end)));
|
||||
// NFAPI_TRACE(NFAPI_TRACE_INFO, "%s %d %d\n", __FUNCTION__, req->dummy1, req->dummy2);
|
||||
return (!(push16(req->dummy1, ppWritePackedMsg, end) && push16(req->dummy2, ppWritePackedMsg, end)));
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int vnf_nr_pack_p4_p5_vendor_extension(void *header, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t *codec)
|
||||
{
|
||||
// NFAPI_TRACE(NFAPI_TRACE_INFO, "%s\n", __FUNCTION__);
|
||||
if (((nfapi_nr_p4_p5_message_header_t *)header)->message_id == P5_VENDOR_EXT_REQ) {
|
||||
vendor_ext_p5_req *req = (vendor_ext_p5_req *)(header);
|
||||
// NFAPI_TRACE(NFAPI_TRACE_INFO, "%s %d %d\n", __FUNCTION__, req->dummy1, req->dummy2);
|
||||
return (!(push16(req->dummy1, ppWritePackedMsg, end) && push16(req->dummy2, ppWritePackedMsg, end)));
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -1406,7 +1546,8 @@ void *vnf_p7_start_thread(void *ptr) {
|
||||
return config;
|
||||
}
|
||||
|
||||
void *vnf_nr_p7_thread_start(void *ptr) {
|
||||
void *vnf_nr_p7_thread_start(void *ptr)
|
||||
{
|
||||
init_queue(&gnb_rach_ind_queue);
|
||||
init_queue(&gnb_rx_ind_queue);
|
||||
init_queue(&gnb_crc_ind_queue);
|
||||
@@ -1432,17 +1573,17 @@ void *vnf_nr_p7_thread_start(void *ptr) {
|
||||
p7_vnf->config->nr_srs_indication = &phy_nr_srs_indication;
|
||||
p7_vnf->config->malloc = &vnf_allocate;
|
||||
p7_vnf->config->free = &vnf_deallocate;
|
||||
p7_vnf->config->vendor_ext = &phy_vendor_ext;
|
||||
p7_vnf->config->vendor_ext = &phy_nr_vendor_ext;
|
||||
p7_vnf->config->user_data = p7_vnf;
|
||||
p7_vnf->mac->user_data = p7_vnf;
|
||||
p7_vnf->config->codec_config.unpack_p7_vendor_extension = &phy_unpack_p7_vendor_extension;
|
||||
p7_vnf->config->codec_config.pack_p7_vendor_extension = &phy_pack_p7_vendor_extension;
|
||||
p7_vnf->config->codec_config.unpack_vendor_extension_tlv = &phy_unpack_vendor_extension_tlv;
|
||||
p7_vnf->config->codec_config.pack_vendor_extension_tlv = &phy_pack_vendor_extension_tlv;
|
||||
p7_vnf->config->codec_config.unpack_p7_vendor_extension = &phy_nr_unpack_p7_vendor_extension;
|
||||
p7_vnf->config->codec_config.pack_p7_vendor_extension = &phy_nr_pack_p7_vendor_extension;
|
||||
p7_vnf->config->codec_config.unpack_vendor_extension_tlv = &phy_nr_unpack_vendor_extension_tlv;
|
||||
p7_vnf->config->codec_config.pack_vendor_extension_tlv = &phy_nr_pack_vendor_extension_tlv;
|
||||
p7_vnf->config->codec_config.allocate = &vnf_allocate;
|
||||
p7_vnf->config->codec_config.deallocate = &vnf_deallocate;
|
||||
p7_vnf->config->allocate_p7_vendor_ext = &phy_allocate_p7_vendor_ext;
|
||||
p7_vnf->config->deallocate_p7_vendor_ext = &phy_deallocate_p7_vendor_ext;
|
||||
p7_vnf->config->allocate_p7_vendor_ext = &phy_nr_allocate_p7_vendor_ext;
|
||||
p7_vnf->config->deallocate_p7_vendor_ext = &phy_nr_deallocate_p7_vendor_ext;
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "[VNF] Creating VNF NFAPI P7 start thread %s\n", __FUNCTION__);
|
||||
pthread_create(&vnf_p7_start_pthread, NULL, &vnf_nr_p7_start_thread, p7_vnf->config);
|
||||
return 0;
|
||||
@@ -1696,10 +1837,11 @@ int nr_start_resp_cb(nfapi_vnf_config_t *config, int p5_idx, nfapi_nr_start_resp
|
||||
return 0;
|
||||
}
|
||||
|
||||
int vendor_ext_cb(nfapi_vnf_config_t *config, int p5_idx, nfapi_p4_p5_message_header_t *msg) {
|
||||
int vendor_ext_cb(nfapi_vnf_config_t *config, int p5_idx, void *msg)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "[VNF] %s\n", __FUNCTION__);
|
||||
|
||||
switch(msg->message_id) {
|
||||
switch (((nfapi_p4_p5_message_header_t *)msg)->message_id) {
|
||||
case P5_VENDOR_EXT_RSP: {
|
||||
vendor_ext_p5_rsp *rsp = (vendor_ext_p5_rsp *)msg;
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "[VNF] P5_VENDOR_EXT_RSP error_code:%d\n", rsp->error_code);
|
||||
@@ -1708,25 +1850,58 @@ int vendor_ext_cb(nfapi_vnf_config_t *config, int p5_idx, nfapi_p4_p5_message_he
|
||||
memset(&req, 0, sizeof(req));
|
||||
req.header.message_id = NFAPI_PNF_START_REQUEST;
|
||||
nfapi_vnf_pnf_start_req(config, p5_idx, &req);
|
||||
}
|
||||
break;
|
||||
} break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int vnf_unpack_p4_p5_vendor_extension(nfapi_p4_p5_message_header_t *header, uint8_t **ppReadPackedMessage, uint8_t *end, nfapi_p4_p5_codec_config_t *codec) {
|
||||
//NFAPI_TRACE(NFAPI_TRACE_INFO, "%s\n", __FUNCTION__);
|
||||
if(header->message_id == P5_VENDOR_EXT_RSP) {
|
||||
int vendor_nr_ext_cb(nfapi_vnf_config_t *config, int p5_idx, void *msg)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "[VNF] %s\n", __FUNCTION__);
|
||||
|
||||
switch (((nfapi_nr_p4_p5_message_header_t *)msg)->message_id) {
|
||||
case P5_VENDOR_EXT_RSP: {
|
||||
vendor_ext_p5_rsp *rsp = (vendor_ext_p5_rsp *)msg;
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "[VNF] P5_VENDOR_EXT_RSP error_code:%d\n", rsp->error_code);
|
||||
// send the start request
|
||||
nfapi_nr_pnf_start_request_t req = {0};
|
||||
req.header.message_id = NFAPI_PNF_START_REQUEST;
|
||||
nfapi_nr_vnf_pnf_start_req(config, p5_idx, &req);
|
||||
} break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int vnf_unpack_p4_p5_vendor_extension(void *header, uint8_t **ppReadPackedMessage, uint8_t *end, nfapi_p4_p5_codec_config_t *codec)
|
||||
{
|
||||
// NFAPI_TRACE(NFAPI_TRACE_INFO, "%s\n", __FUNCTION__);
|
||||
if (((nfapi_p4_p5_message_header_t *)header)->message_id == P5_VENDOR_EXT_RSP) {
|
||||
vendor_ext_p5_rsp *req = (vendor_ext_p5_rsp *)(header);
|
||||
return(!pull16(ppReadPackedMessage, &req->error_code, end));
|
||||
return (!pull16(ppReadPackedMessage, &req->error_code, end));
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
nfapi_p4_p5_message_header_t *vnf_allocate_p4_p5_vendor_ext(uint16_t message_id, uint16_t *msg_size) {
|
||||
if(message_id == P5_VENDOR_EXT_RSP) {
|
||||
int vnf_nr_unpack_p4_p5_vendor_extension(void *header,
|
||||
uint8_t **ppReadPackedMessage,
|
||||
uint8_t *end,
|
||||
nfapi_p4_p5_codec_config_t *codec)
|
||||
{
|
||||
// NFAPI_TRACE(NFAPI_TRACE_INFO, "%s\n", __FUNCTION__);
|
||||
if (((nfapi_nr_p4_p5_message_header_t *)header)->message_id == P5_VENDOR_EXT_RSP) {
|
||||
vendor_ext_p5_rsp *req = (vendor_ext_p5_rsp *)(header);
|
||||
return (!pull16(ppReadPackedMessage, &req->error_code, end));
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void *vnf_allocate_p4_p5_vendor_ext(uint16_t message_id, uint16_t *msg_size)
|
||||
{
|
||||
if (message_id == P5_VENDOR_EXT_RSP) {
|
||||
*msg_size = sizeof(vendor_ext_p5_rsp);
|
||||
return (nfapi_p4_p5_message_header_t *)malloc(sizeof(vendor_ext_p5_rsp));
|
||||
}
|
||||
@@ -1734,10 +1909,26 @@ nfapi_p4_p5_message_header_t *vnf_allocate_p4_p5_vendor_ext(uint16_t message_id,
|
||||
return 0;
|
||||
}
|
||||
|
||||
void vnf_deallocate_p4_p5_vendor_ext(nfapi_p4_p5_message_header_t *header) {
|
||||
void vnf_deallocate_p4_p5_vendor_ext(void *header)
|
||||
{
|
||||
free(header);
|
||||
}
|
||||
|
||||
void *vnf_nr_allocate_p4_p5_vendor_ext(uint16_t message_id, uint16_t *msg_size)
|
||||
{
|
||||
if (message_id == P5_VENDOR_EXT_RSP) {
|
||||
*msg_size = sizeof(vendor_ext_p5_rsp);
|
||||
return (nfapi_p4_p5_message_header_t *)malloc(sizeof(vendor_ext_p5_rsp));
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void vnf_nr_deallocate_p4_p5_vendor_ext(void *header) {
|
||||
free(header);
|
||||
}
|
||||
|
||||
|
||||
nfapi_vnf_config_t *config = 0;
|
||||
|
||||
void vnf_nr_start_thread(void *ptr) {
|
||||
@@ -1756,7 +1947,8 @@ void vnf_start_thread(void *ptr) {
|
||||
|
||||
static vnf_info vnf;
|
||||
|
||||
void configure_nr_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(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));
|
||||
@@ -1765,7 +1957,12 @@ void configure_nr_nfapi_vnf(char *vnf_addr, int vnf_p5_port, char *pnf_ip_addr,
|
||||
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);
|
||||
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));
|
||||
@@ -1787,18 +1984,18 @@ void configure_nr_nfapi_vnf(char *vnf_addr, int vnf_p5_port, char *pnf_ip_addr,
|
||||
config->nr_param_resp = &nr_param_resp_cb;
|
||||
config->nr_config_resp = &nr_config_resp_cb;
|
||||
config->nr_start_resp = &nr_start_resp_cb;
|
||||
config->vendor_ext = &vendor_ext_cb;
|
||||
config->vendor_ext = &vendor_nr_ext_cb;
|
||||
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;
|
||||
config->codec_config.unpack_p4_p5_vendor_extension = &vnf_unpack_p4_p5_vendor_extension;
|
||||
config->codec_config.pack_p4_p5_vendor_extension = &vnf_pack_p4_p5_vendor_extension;
|
||||
config->allocate_p4_p5_vendor_ext = &vnf_allocate_p4_p5_vendor_ext;
|
||||
config->deallocate_p4_p5_vendor_ext = &vnf_deallocate_p4_p5_vendor_ext;
|
||||
config->codec_config.allocate = &vnf_allocate;
|
||||
config->codec_config.deallocate = &vnf_deallocate;
|
||||
memset(&UL_RCC_INFO,0,sizeof(UL_RCC_IND_t));
|
||||
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;
|
||||
config->codec_config.unpack_p4_p5_vendor_extension = &vnf_nr_unpack_p4_p5_vendor_extension;
|
||||
config->codec_config.pack_p4_p5_vendor_extension = &vnf_nr_pack_p4_p5_vendor_extension;
|
||||
config->allocate_p4_p5_vendor_ext = &vnf_nr_allocate_p4_p5_vendor_ext;
|
||||
config->deallocate_p4_p5_vendor_ext = &vnf_nr_deallocate_p4_p5_vendor_ext;
|
||||
config->codec_config.allocate = &vnf_nr_allocate;
|
||||
config->codec_config.deallocate = &vnf_nr_deallocate;
|
||||
memset(&UL_RCC_INFO, 0, sizeof(UL_RCC_IND_t));
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "[VNF] Creating VNF NFAPI start thread %s\n", __FUNCTION__);
|
||||
pthread_create(&vnf_start_pthread, NULL, (void *)&vnf_nr_start_thread, config);
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "[VNF] Created VNF NFAPI start thread %s\n", __FUNCTION__);
|
||||
|
||||
Reference in New Issue
Block a user