Commit 07d8ba2d authored by Siddharth Rana's avatar Siddharth Rana Committed by Vaibhav Shrivastava

Rebasing nfapi directory

parent c5fcab72
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (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.openairinterface.org/?page_id=698
*
* 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.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#include "gnb_ind_vars.h" #include "gnb_ind_vars.h"
queue_t gnb_rach_ind_queue; queue_t gnb_rach_ind_queue;
......
...@@ -52,6 +52,7 @@ ...@@ -52,6 +52,7 @@
#include "common/utils/LOG/log.h" #include "common/utils/LOG/log.h"
#include "PHY/INIT/phy_init.h" #include "PHY/INIT/phy_init.h"
#include "PHY/INIT/nr_phy_init.h"
#include "PHY/LTE_TRANSPORT/transport_proto.h" #include "PHY/LTE_TRANSPORT/transport_proto.h"
#include "openair2/LAYER2/NR_MAC_gNB/mac_proto.h" #include "openair2/LAYER2/NR_MAC_gNB/mac_proto.h"
#include "openair1/SCHED_NR/fapi_nr_l1.h" #include "openair1/SCHED_NR/fapi_nr_l1.h"
...@@ -250,7 +251,6 @@ void *pnf_nr_p7_thread_start(void *ptr) { ...@@ -250,7 +251,6 @@ void *pnf_nr_p7_thread_start(void *ptr) {
return 0; return 0;
} }
#ifdef NFAPI_PRE_CLEANUP
int pnf_nr_param_request(nfapi_pnf_config_t *config, nfapi_nr_pnf_param_request_t *req) { int pnf_nr_param_request(nfapi_pnf_config_t *config, nfapi_nr_pnf_param_request_t *req) {
printf("[PNF] pnf param request\n"); printf("[PNF] pnf param request\n");
nfapi_nr_pnf_param_response_t resp; nfapi_nr_pnf_param_response_t resp;
...@@ -496,7 +496,7 @@ void nfapi_nr_send_pnf_start_resp(nfapi_pnf_config_t *config, uint16_t phy_id) { ...@@ -496,7 +496,7 @@ void nfapi_nr_send_pnf_start_resp(nfapi_pnf_config_t *config, uint16_t phy_id) {
memset(&start_resp, 0, sizeof(start_resp)); memset(&start_resp, 0, sizeof(start_resp));
start_resp.header.message_id = NFAPI_NR_PHY_MSG_TYPE_START_RESPONSE; start_resp.header.message_id = NFAPI_NR_PHY_MSG_TYPE_START_RESPONSE;
start_resp.header.phy_id = phy_id; start_resp.header.phy_id = phy_id;
start_resp.error_code = NFAPI_MSG_OK; start_resp.error_code = NFAPI_NR_START_MSG_OK;
nfapi_nr_pnf_start_resp(config, &start_resp); nfapi_nr_pnf_start_resp(config, &start_resp);
} }
...@@ -549,13 +549,12 @@ int pnf_stop_request(nfapi_pnf_config_t *config, nfapi_pnf_stop_request_t *req) ...@@ -549,13 +549,12 @@ int pnf_stop_request(nfapi_pnf_config_t *config, nfapi_pnf_stop_request_t *req)
int param_request(nfapi_pnf_config_t *config, nfapi_pnf_phy_config_t *phy, nfapi_param_request_t *req) { int param_request(nfapi_pnf_config_t *config, nfapi_pnf_phy_config_t *phy, nfapi_param_request_t *req) {
printf("[PNF] Received NFAPI_PARAM_REQUEST phy_id:%d\n", req->header.phy_id); printf("[PNF] Received NFAPI_PARAM_REQUEST phy_id:%d\n", req->header.phy_id);
//pnf_info* pnf = (pnf_info*)(config->user_data);
nfapi_param_response_t nfapi_resp; nfapi_param_response_t nfapi_resp;
pnf_info *pnf = (pnf_info *)(config->user_data); pnf_info *pnf = (pnf_info *)(config->user_data);
memset(&nfapi_resp, 0, sizeof(nfapi_resp)); memset(&nfapi_resp, 0, sizeof(nfapi_resp));
nfapi_resp.header.message_id = NFAPI_PARAM_RESPONSE; nfapi_resp.header.message_id = NFAPI_PARAM_RESPONSE;
nfapi_resp.header.phy_id = req->header.phy_id; nfapi_resp.header.phy_id = req->header.phy_id;
nfapi_resp.error_code = 0; // DJP - what value??? nfapi_resp.error_code = 0;
struct sockaddr_in pnf_p7_sockaddr; struct sockaddr_in pnf_p7_sockaddr;
pnf_p7_sockaddr.sin_addr.s_addr = inet_addr(pnf->phys[0].local_addr); pnf_p7_sockaddr.sin_addr.s_addr = inet_addr(pnf->phys[0].local_addr);
nfapi_resp.nfapi_config.p7_pnf_address_ipv4.tl.tag = NFAPI_NFAPI_P7_PNF_ADDRESS_IPV4_TAG; nfapi_resp.nfapi_config.p7_pnf_address_ipv4.tl.tag = NFAPI_NFAPI_P7_PNF_ADDRESS_IPV4_TAG;
...@@ -563,7 +562,7 @@ int param_request(nfapi_pnf_config_t *config, nfapi_pnf_phy_config_t *phy, nfapi ...@@ -563,7 +562,7 @@ int param_request(nfapi_pnf_config_t *config, nfapi_pnf_phy_config_t *phy, nfapi
nfapi_resp.num_tlv++; nfapi_resp.num_tlv++;
// P7 PNF Port // P7 PNF Port
nfapi_resp.nfapi_config.p7_pnf_port.tl.tag = NFAPI_NFAPI_P7_PNF_PORT_TAG; nfapi_resp.nfapi_config.p7_pnf_port.tl.tag = NFAPI_NFAPI_P7_PNF_PORT_TAG;
nfapi_resp.nfapi_config.p7_pnf_port.value = 32123; // DJP - hard code alert!!!! FIXME TODO nfapi_resp.nfapi_config.p7_pnf_port.value = htons(pnf->phys[0].udp.rx_port);
nfapi_resp.num_tlv++; nfapi_resp.num_tlv++;
nfapi_pnf_param_resp(config, &nfapi_resp); nfapi_pnf_param_resp(config, &nfapi_resp);
printf("[PNF] Sent NFAPI_PARAM_RESPONSE phy_id:%d number_of_tlvs:%u\n", req->header.phy_id, nfapi_resp.num_tlv); printf("[PNF] Sent NFAPI_PARAM_RESPONSE phy_id:%d number_of_tlvs:%u\n", req->header.phy_id, nfapi_resp.num_tlv);
...@@ -573,13 +572,12 @@ int param_request(nfapi_pnf_config_t *config, nfapi_pnf_phy_config_t *phy, nfapi ...@@ -573,13 +572,12 @@ int param_request(nfapi_pnf_config_t *config, nfapi_pnf_phy_config_t *phy, nfapi
int nr_param_request(nfapi_pnf_config_t *config, nfapi_pnf_phy_config_t *phy, nfapi_nr_param_request_scf_t *req) { int nr_param_request(nfapi_pnf_config_t *config, nfapi_pnf_phy_config_t *phy, nfapi_nr_param_request_scf_t *req) {
printf("[PNF] Received NFAPI_PARAM_REQUEST phy_id:%d\n", req->header.phy_id); printf("[PNF] Received NFAPI_PARAM_REQUEST phy_id:%d\n", req->header.phy_id);
//pnf_info* pnf = (pnf_info*)(config->user_data);
nfapi_nr_param_response_scf_t nfapi_resp; nfapi_nr_param_response_scf_t nfapi_resp;
pnf_info *pnf = (pnf_info *)(config->user_data); pnf_info *pnf = (pnf_info *)(config->user_data);
memset(&nfapi_resp, 0, sizeof(nfapi_resp)); memset(&nfapi_resp, 0, sizeof(nfapi_resp));
nfapi_resp.header.message_id = NFAPI_NR_PHY_MSG_TYPE_PARAM_RESPONSE; nfapi_resp.header.message_id = NFAPI_NR_PHY_MSG_TYPE_PARAM_RESPONSE;
nfapi_resp.header.phy_id = req->header.phy_id; nfapi_resp.header.phy_id = req->header.phy_id;
nfapi_resp.error_code = 0; // DJP - what value??? nfapi_resp.error_code = 0;
struct sockaddr_in pnf_p7_sockaddr; struct sockaddr_in pnf_p7_sockaddr;
// ASSIGN TAGS // ASSIGN TAGS
...@@ -776,7 +774,7 @@ int nr_param_request(nfapi_pnf_config_t *config, nfapi_pnf_phy_config_t *phy, nf ...@@ -776,7 +774,7 @@ int nr_param_request(nfapi_pnf_config_t *config, nfapi_pnf_phy_config_t *phy, nf
nfapi_resp.num_tlv++; nfapi_resp.num_tlv++;
} }
nfapi_resp.nfapi_config.p7_pnf_port.value = 32123; //pnf->phys[0].local_port; DJP - hard code alert!!!! FIXME TODO nfapi_resp.nfapi_config.p7_pnf_port.value = htons(pnf->phys[0].udp.rx_port);
nfapi_resp.num_tlv++; nfapi_resp.num_tlv++;
pnf_p7_sockaddr.sin_addr.s_addr = inet_addr(pnf->phys[0].local_addr); pnf_p7_sockaddr.sin_addr.s_addr = inet_addr(pnf->phys[0].local_addr);
...@@ -878,7 +876,7 @@ int config_request(nfapi_pnf_config_t *config, nfapi_pnf_phy_config_t *phy, nfap ...@@ -878,7 +876,7 @@ int config_request(nfapi_pnf_config_t *config, nfapi_pnf_phy_config_t *phy, nfap
num_tlv++; num_tlv++;
} }
fp->num_MBSFN_config = 0; // DJP - hard code alert fp->num_MBSFN_config = 0; // hard code alert
if (req->sch_config.physical_cell_id.tl.tag == NFAPI_SCH_CONFIG_PHYSICAL_CELL_ID_TAG) { if (req->sch_config.physical_cell_id.tl.tag == NFAPI_SCH_CONFIG_PHYSICAL_CELL_ID_TAG) {
fp->Nid_cell = req->sch_config.physical_cell_id.value; fp->Nid_cell = req->sch_config.physical_cell_id.value;
...@@ -930,13 +928,13 @@ int config_request(nfapi_pnf_config_t *config, nfapi_pnf_phy_config_t *phy, nfap ...@@ -930,13 +928,13 @@ int config_request(nfapi_pnf_config_t *config, nfapi_pnf_phy_config_t *phy, nfap
} }
if (req->pusch_config.hopping_mode.tl.tag == NFAPI_PUSCH_CONFIG_HOPPING_MODE_TAG) { if (req->pusch_config.hopping_mode.tl.tag == NFAPI_PUSCH_CONFIG_HOPPING_MODE_TAG) {
} // DJP - not being handled? } // not being handled?
if (req->pusch_config.hopping_offset.tl.tag == NFAPI_PUSCH_CONFIG_HOPPING_OFFSET_TAG) { if (req->pusch_config.hopping_offset.tl.tag == NFAPI_PUSCH_CONFIG_HOPPING_OFFSET_TAG) {
} // DJP - not being handled? } // not being handled?
if (req->pusch_config.number_of_subbands.tl.tag == NFAPI_PUSCH_CONFIG_NUMBER_OF_SUBBANDS_TAG) { if (req->pusch_config.number_of_subbands.tl.tag == NFAPI_PUSCH_CONFIG_NUMBER_OF_SUBBANDS_TAG) {
} // DJP - not being handled? } // not being handled?
if (req->prach_config.configuration_index.tl.tag == NFAPI_PRACH_CONFIG_CONFIGURATION_INDEX_TAG) { if (req->prach_config.configuration_index.tl.tag == NFAPI_PRACH_CONFIG_CONFIGURATION_INDEX_TAG) {
fp->prach_config_common.prach_ConfigInfo.prach_ConfigIndex=req->prach_config.configuration_index.value; fp->prach_config_common.prach_ConfigInfo.prach_ConfigIndex=req->prach_config.configuration_index.value;
...@@ -965,7 +963,7 @@ int config_request(nfapi_pnf_config_t *config, nfapi_pnf_phy_config_t *phy, nfap ...@@ -965,7 +963,7 @@ int config_request(nfapi_pnf_config_t *config, nfapi_pnf_phy_config_t *phy, nfap
if(NFAPI_MODE!=NFAPI_UE_STUB_PNF && NFAPI_MODE!=NFAPI_MODE_STANDALONE_PNF) { if(NFAPI_MODE!=NFAPI_UE_STUB_PNF && NFAPI_MODE!=NFAPI_MODE_STANDALONE_PNF) {
printf("[PNF] CONFIG_REQUEST[num_tlv:%d] TLVs processed:%d\n", req->num_tlv, num_tlv); printf("[PNF] CONFIG_REQUEST[num_tlv:%d] TLVs processed:%d\n", req->num_tlv, num_tlv);
printf("[PNF] Simulating PHY CONFIG - DJP\n"); printf("[PNF] Simulating PHY CONFIG\n");
PHY_Config_t phy_config; PHY_Config_t phy_config;
phy_config.Mod_id = 0; phy_config.Mod_id = 0;
phy_config.CC_id=0; phy_config.CC_id=0;
...@@ -983,7 +981,7 @@ int config_request(nfapi_pnf_config_t *config, nfapi_pnf_phy_config_t *phy, nfap ...@@ -983,7 +981,7 @@ int config_request(nfapi_pnf_config_t *config, nfapi_pnf_phy_config_t *phy, nfap
memset(&nfapi_resp, 0, sizeof(nfapi_resp)); memset(&nfapi_resp, 0, sizeof(nfapi_resp));
nfapi_resp.header.message_id = NFAPI_CONFIG_RESPONSE; nfapi_resp.header.message_id = NFAPI_CONFIG_RESPONSE;
nfapi_resp.header.phy_id = phy_info->id; nfapi_resp.header.phy_id = phy_info->id;
nfapi_resp.error_code = 0; // DJP - some value resp->error_code; nfapi_resp.error_code = 0;
nfapi_pnf_config_resp(config, &nfapi_resp); nfapi_pnf_config_resp(config, &nfapi_resp);
printf("[PNF] Sent NFAPI_CONFIG_RESPONSE phy_id:%d\n", phy_info->id); printf("[PNF] Sent NFAPI_CONFIG_RESPONSE phy_id:%d\n", phy_info->id);
...@@ -1059,7 +1057,7 @@ int nr_config_request(nfapi_pnf_config_t *config, nfapi_pnf_phy_config_t *phy, n ...@@ -1059,7 +1057,7 @@ int nr_config_request(nfapi_pnf_config_t *config, nfapi_pnf_phy_config_t *phy, n
if(NFAPI_MODE!=NFAPI_UE_STUB_PNF) { if(NFAPI_MODE!=NFAPI_UE_STUB_PNF) {
printf("[PNF] CONFIG_REQUEST[num_tlv:%d] TLVs processed:%d\n", req->num_tlv, num_tlv); printf("[PNF] CONFIG_REQUEST[num_tlv:%d] TLVs processed:%d\n", req->num_tlv, num_tlv);
printf("[PNF] Simulating PHY CONFIG - DJP\n"); printf("[PNF] Simulating PHY CONFIG\n");
NR_PHY_Config_t nr_phy_config; NR_PHY_Config_t nr_phy_config;
nr_phy_config.Mod_id = 0; nr_phy_config.Mod_id = 0;
nr_phy_config.CC_id=0; nr_phy_config.CC_id=0;
...@@ -1077,7 +1075,7 @@ int nr_config_request(nfapi_pnf_config_t *config, nfapi_pnf_phy_config_t *phy, n ...@@ -1077,7 +1075,7 @@ int nr_config_request(nfapi_pnf_config_t *config, nfapi_pnf_phy_config_t *phy, n
memset(&nfapi_resp, 0, sizeof(nfapi_resp)); memset(&nfapi_resp, 0, sizeof(nfapi_resp));
nfapi_resp.header.message_id = NFAPI_NR_PHY_MSG_TYPE_CONFIG_RESPONSE; nfapi_resp.header.message_id = NFAPI_NR_PHY_MSG_TYPE_CONFIG_RESPONSE;
nfapi_resp.header.phy_id = phy_info->id; nfapi_resp.header.phy_id = phy_info->id;
nfapi_resp.error_code = 0; // DJP - some value resp->error_code; nfapi_resp.error_code = 0;
nfapi_nr_pnf_config_resp(config, &nfapi_resp); nfapi_nr_pnf_config_resp(config, &nfapi_resp);
printf("[PNF] Sent NFAPI_PNF_CONFIG_RESPONSE phy_id:%d\n", phy_info->id); printf("[PNF] Sent NFAPI_PNF_CONFIG_RESPONSE phy_id:%d\n", phy_info->id);
...@@ -1086,7 +1084,6 @@ int nr_config_request(nfapi_pnf_config_t *config, nfapi_pnf_phy_config_t *phy, n ...@@ -1086,7 +1084,6 @@ int nr_config_request(nfapi_pnf_config_t *config, nfapi_pnf_phy_config_t *phy, n
return 0; return 0;
} }
#endif
nfapi_p7_message_header_t *pnf_phy_allocate_p7_vendor_ext(uint16_t message_id, uint16_t *msg_size) { 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) { if(message_id == P7_VENDOR_EXT_REQ) {
...@@ -1223,8 +1220,8 @@ int pnf_phy_dl_tti_req(gNB_L1_rxtx_proc_t *proc, nfapi_pnf_p7_config_t *pnf_p7, ...@@ -1223,8 +1220,8 @@ int pnf_phy_dl_tti_req(gNB_L1_rxtx_proc_t *proc, nfapi_pnf_p7_config_t *pnf_p7,
if (tx_data != NULL) { if (tx_data != NULL) {
uint8_t *dlsch_sdu = (uint8_t *)tx_data->TLVs[0].value.direct; uint8_t *dlsch_sdu = (uint8_t *)tx_data->TLVs[0].value.direct;
//NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() DLSCH:pdu_index:%d handle_nfapi_dlsch_pdu(eNB, proc_rxtx, dlsch_pdu, transport_blocks:%d sdu:%p) eNB->pdcch_vars[proc->subframe_tx & 1].num_pdcch_symbols:%d\n", __FUNCTION__, rel8_pdu->pdu_index, rel8_pdu->transport_blocks, dlsch_sdu, eNB->pdcch_vars[proc->subframe_tx & 1].num_pdcch_symbols); //NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() DLSCH:pdu_index:%d handle_nfapi_dlsch_pdu(eNB, proc_rxtx, dlsch_pdu, transport_blocks:%d sdu:%p) eNB->pdcch_vars[proc->subframe_tx & 1].num_pdcch_symbols:%d\n", __FUNCTION__, rel8_pdu->pdu_index, rel8_pdu->transport_blocks, dlsch_sdu, eNB->pdcch_vars[proc->subframe_tx & 1].num_pdcch_symbols);
AssertFatal(msgTx->num_pdsch_slot < gNB->number_of_nr_dlsch_max,"Number of PDSCH PDUs %d exceeded the limit %d\n", AssertFatal(msgTx->num_pdsch_slot < NUMBER_OF_NR_DLSCH_MAX,"Number of PDSCH PDUs %d exceeded the limit %d\n",
msgTx->num_pdsch_slot,gNB->number_of_nr_dlsch_max); msgTx->num_pdsch_slot, NUMBER_OF_NR_DLSCH_MAX);
handle_nr_nfapi_pdsch_pdu(msgTx, pdsch_pdu, dlsch_sdu); handle_nr_nfapi_pdsch_pdu(msgTx, pdsch_pdu, dlsch_sdu);
} }
else { else {
...@@ -1632,8 +1629,7 @@ int start_request(nfapi_pnf_config_t *config, nfapi_pnf_phy_config_t *phy, nfapi ...@@ -1632,8 +1629,7 @@ int start_request(nfapi_pnf_config_t *config, nfapi_pnf_phy_config_t *phy, nfapi
p7_config->phy_id = phy->phy_id; p7_config->phy_id = phy->phy_id;
p7_config->remote_p7_port = phy_info->remote_port; p7_config->remote_p7_port = phy_info->remote_port;
p7_config->remote_p7_addr = phy_info->remote_addr; p7_config->remote_p7_addr = phy_info->remote_addr;
p7_config->local_p7_port = 32123;//phy_info->local_port;//50010; // DJP - good grief cannot seem to get the right answer phy_info->local_port; p7_config->local_p7_port = phy_info->udp.rx_port;
//DJP p7_config->local_p7_addr = (char*)phy_info->local_addr.c_str();
p7_config->local_p7_addr = phy_info->local_addr; 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->user_data = phy_info;
...@@ -1704,7 +1700,7 @@ int start_request(nfapi_pnf_config_t *config, nfapi_pnf_phy_config_t *phy, nfapi ...@@ -1704,7 +1700,7 @@ int start_request(nfapi_pnf_config_t *config, nfapi_pnf_phy_config_t *phy, nfapi
//((pnf_phy_user_data_t*)(phy_info->fapi->user_data))->p7_config = p7_config; //((pnf_phy_user_data_t*)(phy_info->fapi->user_data))->p7_config = p7_config;
NFAPI_TRACE(NFAPI_TRACE_INFO, "[PNF] Calling l1_north_init_eNB() %s\n", __FUNCTION__); NFAPI_TRACE(NFAPI_TRACE_INFO, "[PNF] Calling l1_north_init_eNB() %s\n", __FUNCTION__);
l1_north_init_eNB(); l1_north_init_eNB();
NFAPI_TRACE(NFAPI_TRACE_INFO, "[PNF] DJP - HACK - Set p7_config global ready for subframe ind%s\n", __FUNCTION__); NFAPI_TRACE(NFAPI_TRACE_INFO, "[PNF] HACK - Set p7_config global ready for subframe ind%s\n", __FUNCTION__);
p7_config_g = p7_config; p7_config_g = p7_config;
// Need to wait for main thread to create RU structures // Need to wait for main thread to create RU structures
...@@ -1736,11 +1732,9 @@ int start_request(nfapi_pnf_config_t *config, nfapi_pnf_phy_config_t *phy, nfapi ...@@ -1736,11 +1732,9 @@ int start_request(nfapi_pnf_config_t *config, nfapi_pnf_phy_config_t *phy, nfapi
} }
printf("[PNF] Sending PNF_START_RESP\n"); printf("[PNF] Sending PNF_START_RESP\n");
#ifdef NFAPI_PRE_CLEANUP
nfapi_send_pnf_start_resp(config, p7_config->phy_id); nfapi_send_pnf_start_resp(config, p7_config->phy_id);
#endif
printf("[PNF] Sending first P7 subframe ind\n"); printf("[PNF] Sending first P7 subframe ind\n");
nfapi_pnf_p7_subframe_ind(p7_config, p7_config->phy_id, 0); // DJP - SFN_SF set to zero - correct??? 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"); printf("[PNF] Sent first P7 subframe ind\n");
return 0; return 0;
} }
...@@ -1753,9 +1747,8 @@ int nr_start_request(nfapi_pnf_config_t *config, nfapi_pnf_phy_config_t *phy, n ...@@ -1753,9 +1747,8 @@ int nr_start_request(nfapi_pnf_config_t *config, nfapi_pnf_phy_config_t *phy, n
p7_config->phy_id = phy->phy_id; p7_config->phy_id = phy->phy_id;
p7_config->remote_p7_port = phy_info->remote_port; p7_config->remote_p7_port = phy_info->remote_port;
p7_config->remote_p7_addr = phy_info->remote_addr; p7_config->remote_p7_addr = phy_info->remote_addr;
// TODO: remove this hardcoded port
p7_config->local_p7_port = 32123; // DJP - good grief cannot seem to get the right answer phy_info->local_port; p7_config->local_p7_port = phy_info->udp.rx_port;
//DJP p7_config->local_p7_addr = (char*)phy_info->local_addr.c_str();
p7_config->local_p7_addr = phy_info->local_addr; 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->user_data = phy_info;
...@@ -1831,10 +1824,9 @@ int nr_start_request(nfapi_pnf_config_t *config, nfapi_pnf_phy_config_t *phy, n ...@@ -1831,10 +1824,9 @@ int nr_start_request(nfapi_pnf_config_t *config, nfapi_pnf_phy_config_t *phy, n
NFAPI_TRACE(NFAPI_TRACE_INFO, "[PNF] Creating P7 thread %s\n", __FUNCTION__); NFAPI_TRACE(NFAPI_TRACE_INFO, "[PNF] Creating P7 thread %s\n", __FUNCTION__);
pthread_t p7_thread; pthread_t p7_thread;
pthread_create(&p7_thread, NULL, &pnf_nr_p7_thread_start, p7_config); pthread_create(&p7_thread, NULL, &pnf_nr_p7_thread_start, p7_config);
//((pnf_phy_user_data_t*)(phy_info->fapi->user_data))->p7_config = p7_config;
NFAPI_TRACE(NFAPI_TRACE_INFO, "[PNF] Calling l1_north_init_eNB() %s\n", __FUNCTION__); NFAPI_TRACE(NFAPI_TRACE_INFO, "[PNF] Calling l1_north_init_eNB() %s\n", __FUNCTION__);
l1_north_init_gNB(); l1_north_init_gNB();
NFAPI_TRACE(NFAPI_TRACE_INFO, "[PNF] DJP - HACK - Set p7_config global ready for subframe ind%s\n", __FUNCTION__); NFAPI_TRACE(NFAPI_TRACE_INFO, "[PNF] HACK - Set p7_config global ready for subframe ind%s\n", __FUNCTION__);
p7_config_g = p7_config; p7_config_g = p7_config;
// Need to wait for main thread to create RU structures // Need to wait for main thread to create RU structures
...@@ -1866,15 +1858,13 @@ int nr_start_request(nfapi_pnf_config_t *config, nfapi_pnf_phy_config_t *phy, n ...@@ -1866,15 +1858,13 @@ int nr_start_request(nfapi_pnf_config_t *config, nfapi_pnf_phy_config_t *phy, n
} }
printf("[PNF] Sending PNF_START_RESP\n"); printf("[PNF] Sending PNF_START_RESP\n");
#ifdef NFAPI_PRE_CLEANUP
nfapi_nr_send_pnf_start_resp(config, p7_config->phy_id); nfapi_nr_send_pnf_start_resp(config, p7_config->phy_id);
#endif
printf("[PNF] Sending first P7 slot indication\n"); printf("[PNF] Sending first P7 slot indication\n");
#if 1 #if 1
nfapi_pnf_p7_slot_ind(p7_config, p7_config->phy_id, 0, 0); nfapi_pnf_p7_slot_ind(p7_config, p7_config->phy_id, 0, 0);
printf("[PNF] Sent first P7 slot ind\n"); printf("[PNF] Sent first P7 slot ind\n");
#else #else
nfapi_pnf_p7_subframe_ind(p7_config, p7_config->phy_id, 0); // DJP - SFN_SF set to zero - correct??? 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"); printf("[PNF] Sent first P7 subframe ind\n");
#endif #endif
...@@ -1882,7 +1872,6 @@ int nr_start_request(nfapi_pnf_config_t *config, nfapi_pnf_phy_config_t *phy, n ...@@ -1882,7 +1872,6 @@ int nr_start_request(nfapi_pnf_config_t *config, nfapi_pnf_phy_config_t *phy, n
return 0; return 0;
} }
#ifdef NFAPI_PRE_CLEANUP
int measurement_request(nfapi_pnf_config_t *config, nfapi_pnf_phy_config_t *phy, nfapi_measurement_request_t *req) { int measurement_request(nfapi_pnf_config_t *config, nfapi_pnf_phy_config_t *phy, nfapi_measurement_request_t *req) {
nfapi_measurement_response_t resp; nfapi_measurement_response_t resp;
memset(&resp, 0, sizeof(resp)); memset(&resp, 0, sizeof(resp));
...@@ -1989,8 +1978,6 @@ int broadcast_detect_request(nfapi_pnf_config_t *config, nfapi_pnf_phy_config_t ...@@ -1989,8 +1978,6 @@ int broadcast_detect_request(nfapi_pnf_config_t *config, nfapi_pnf_phy_config_t
case NFAPI_RAT_TYPE_UTRAN: { case NFAPI_RAT_TYPE_UTRAN: {
ind.utran_broadcast_detect_indication.tl.tag = NFAPI_UTRAN_BROADCAST_DETECT_INDICATION_TAG; ind.utran_broadcast_detect_indication.tl.tag = NFAPI_UTRAN_BROADCAST_DETECT_INDICATION_TAG;
ind.utran_broadcast_detect_indication.mib_length = 4; ind.utran_broadcast_detect_indication.mib_length = 4;
//ind.utran_broadcast_detect_indication.mib...
// ind.utran_broadcast_detect_indication.sfn_offset; DJP - nonsense line
} }
break; break;
} }
...@@ -2091,7 +2078,6 @@ int vendor_ext(nfapi_pnf_config_t *config, nfapi_p4_p5_message_header_t *msg) { ...@@ -2091,7 +2078,6 @@ int vendor_ext(nfapi_pnf_config_t *config, nfapi_p4_p5_message_header_t *msg) {
return 0; return 0;
} }
#endif
nfapi_p4_p5_message_header_t *pnf_sim_allocate_p4_p5_vendor_ext(uint16_t message_id, uint16_t *msg_size) { 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) { if(message_id == P5_VENDOR_EXT_REQ) {
...@@ -2131,29 +2117,21 @@ int pnf_sim_unpack_p4_p5_vendor_extension(nfapi_p4_p5_message_header_t *header, ...@@ -2131,29 +2117,21 @@ int pnf_sim_unpack_p4_p5_vendor_extension(nfapi_p4_p5_message_header_t *header,
/*------------------------------------------------------------------------------*/ /*------------------------------------------------------------------------------*/
void *pnf_start_thread(void *ptr) { void *pnf_start_thread(void *ptr) {
NFAPI_TRACE(NFAPI_TRACE_INFO, "[PNF] IN PNF NFAPI start thread %s\n", __FUNCTION__); NFAPI_TRACE(NFAPI_TRACE_INFO, "[PNF] IN PNF NFAPI start thread %s\n", __FUNCTION__);
#ifdef NFAPI_PRE_CLEANUP
nfapi_pnf_config_t *config = (nfapi_pnf_config_t *)ptr; nfapi_pnf_config_t *config = (nfapi_pnf_config_t *)ptr;
#endif
struct sched_param sp; struct sched_param sp;
sp.sched_priority = 20; sp.sched_priority = 20;
pthread_setschedparam(pthread_self(),SCHED_FIFO,&sp); pthread_setschedparam(pthread_self(),SCHED_FIFO,&sp);
#ifdef NFAPI_PRE_CLEANUP
nfapi_pnf_start(config); nfapi_pnf_start(config);
#endif
return (void *)0; return (void *)0;
} }
void *pnf_nr_start_thread(void *ptr) { void *pnf_nr_start_thread(void *ptr) {
NFAPI_TRACE(NFAPI_TRACE_INFO, "[PNF] IN PNF NFAPI start thread %s\n", __FUNCTION__); NFAPI_TRACE(NFAPI_TRACE_INFO, "[PNF] IN PNF NFAPI start thread %s\n", __FUNCTION__);
#ifdef NFAPI_PRE_CLEANUP
nfapi_pnf_config_t *config = (nfapi_pnf_config_t *)ptr; nfapi_pnf_config_t *config = (nfapi_pnf_config_t *)ptr;
#endif
struct sched_param sp; struct sched_param sp;
sp.sched_priority = 20; sp.sched_priority = 20;
pthread_setschedparam(pthread_self(),SCHED_FIFO,&sp); pthread_setschedparam(pthread_self(),SCHED_FIFO,&sp);
#ifdef NFAPI_PRE_CLEANUP
nfapi_nr_pnf_start(config); nfapi_nr_pnf_start(config);
#endif
return (void *)0; return (void *)0;
} }
...@@ -2165,7 +2143,7 @@ void configure_nr_nfapi_pnf(char *vnf_ip_addr, int vnf_p5_port, char *pnf_ip_add ...@@ -2165,7 +2143,7 @@ void configure_nr_nfapi_pnf(char *vnf_ip_addr, int vnf_p5_port, char *pnf_ip_add
config->vnf_ip_addr = vnf_ip_addr; config->vnf_ip_addr = vnf_ip_addr;
config->vnf_p5_port = vnf_p5_port; config->vnf_p5_port = vnf_p5_port;
pnf.phys[0].udp.enabled = 1; pnf.phys[0].udp.enabled = 1;
pnf.phys[0].udp.rx_port = 32123;//pnf_p7_port; pnf.phys[0].udp.rx_port = pnf_p7_port;
pnf.phys[0].udp.tx_port = vnf_p7_port; pnf.phys[0].udp.tx_port = vnf_p7_port;
strcpy(pnf.phys[0].udp.tx_addr, vnf_ip_addr); strcpy(pnf.phys[0].udp.tx_addr, vnf_ip_addr);
strcpy(pnf.phys[0].local_addr, pnf_ip_addr); strcpy(pnf.phys[0].local_addr, pnf_ip_addr);
...@@ -2174,7 +2152,6 @@ void configure_nr_nfapi_pnf(char *vnf_ip_addr, int vnf_p5_port, char *pnf_ip_add ...@@ -2174,7 +2152,6 @@ void configure_nr_nfapi_pnf(char *vnf_ip_addr, int vnf_p5_port, char *pnf_ip_add
pnf.phys[0].local_addr, pnf.phys[0].local_addr,
pnf.phys[0].udp.tx_addr, pnf.phys[0].udp.tx_port, pnf.phys[0].udp.tx_addr, pnf.phys[0].udp.tx_port,
pnf.phys[0].udp.rx_port); pnf.phys[0].udp.rx_port);
#ifdef NFAPI_PRE_CLEANUP
config->cell_search_req = &cell_search_request; config->cell_search_req = &cell_search_request;
...@@ -2185,9 +2162,7 @@ void configure_nr_nfapi_pnf(char *vnf_ip_addr, int vnf_p5_port, char *pnf_ip_add ...@@ -2185,9 +2162,7 @@ void configure_nr_nfapi_pnf(char *vnf_ip_addr, int vnf_p5_port, char *pnf_ip_add
config->pnf_stop_req = &pnf_stop_request; config->pnf_stop_req = &pnf_stop_request;
config->nr_param_req = &nr_param_request; config->nr_param_req = &nr_param_request;
config->nr_config_req = &nr_config_request; config->nr_config_req = &nr_config_request;
#endif
config->nr_start_req = &nr_start_request; config->nr_start_req = &nr_start_request;
#ifdef NFAPI_PRE_CLEANUP
config->measurement_req = &measurement_request; config->measurement_req = &measurement_request;
config->rssi_req = &rssi_request; config->rssi_req = &rssi_request;
config->broadcast_detect_req = &broadcast_detect_request; config->broadcast_detect_req = &broadcast_detect_request;
...@@ -2195,7 +2170,6 @@ void configure_nr_nfapi_pnf(char *vnf_ip_addr, int vnf_p5_port, char *pnf_ip_add ...@@ -2195,7 +2170,6 @@ void configure_nr_nfapi_pnf(char *vnf_ip_addr, int vnf_p5_port, char *pnf_ip_add
config->system_information_req = &system_information_request; config->system_information_req = &system_information_request;
config->nmm_stop_req = &nmm_stop_request; config->nmm_stop_req = &nmm_stop_request;
config->vendor_ext = &vendor_ext; config->vendor_ext = &vendor_ext;
#endif
config->trace = &pnf_nfapi_trace; config->trace = &pnf_nfapi_trace;
config->user_data = &pnf; config->user_data = &pnf;
// To allow custom vendor extentions to be added to nfapi // To allow custom vendor extentions to be added to nfapi
...@@ -2220,7 +2194,7 @@ void configure_nfapi_pnf(char *vnf_ip_addr, int vnf_p5_port, char *pnf_ip_addr, ...@@ -2220,7 +2194,7 @@ void configure_nfapi_pnf(char *vnf_ip_addr, int vnf_p5_port, char *pnf_ip_addr,
config->vnf_ip_addr = vnf_ip_addr; config->vnf_ip_addr = vnf_ip_addr;
config->vnf_p5_port = vnf_p5_port; config->vnf_p5_port = vnf_p5_port;
pnf.phys[0].udp.enabled = 1; pnf.phys[0].udp.enabled = 1;
pnf.phys[0].udp.rx_port = 32123;//pnf_p7_port; pnf.phys[0].udp.rx_port = pnf_p7_port;
pnf.phys[0].udp.tx_port = vnf_p7_port; pnf.phys[0].udp.tx_port = vnf_p7_port;
strcpy(pnf.phys[0].udp.tx_addr, vnf_ip_addr); strcpy(pnf.phys[0].udp.tx_addr, vnf_ip_addr);
strcpy(pnf.phys[0].local_addr, pnf_ip_addr); strcpy(pnf.phys[0].local_addr, pnf_ip_addr);
...@@ -2230,16 +2204,13 @@ void configure_nfapi_pnf(char *vnf_ip_addr, int vnf_p5_port, char *pnf_ip_addr, ...@@ -2230,16 +2204,13 @@ void configure_nfapi_pnf(char *vnf_ip_addr, int vnf_p5_port, char *pnf_ip_addr,
pnf.phys[0].local_addr, pnf.phys[0].local_addr,
pnf.phys[0].udp.tx_addr, pnf.phys[0].udp.tx_port, pnf.phys[0].udp.tx_addr, pnf.phys[0].udp.tx_port,
pnf.phys[0].udp.rx_port); pnf.phys[0].udp.rx_port);
#ifdef NFAPI_PRE_CLEANUP
config->pnf_param_req = &pnf_param_request; config->pnf_param_req = &pnf_param_request;
config->pnf_config_req = &pnf_config_request; config->pnf_config_req = &pnf_config_request;
config->pnf_start_req = &pnf_start_request; config->pnf_start_req = &pnf_start_request;
config->pnf_stop_req = &pnf_stop_request; config->pnf_stop_req = &pnf_stop_request;
config->param_req = &param_request; config->param_req = &param_request;
config->config_req = &config_request; config->config_req = &config_request;
#endif
config->start_req = &start_request; config->start_req = &start_request;
#ifdef NFAPI_PRE_CLEANUP
config->measurement_req = &measurement_request; config->measurement_req = &measurement_request;
config->rssi_req = &rssi_request; config->rssi_req = &rssi_request;
config->cell_search_req = &cell_search_request; config->cell_search_req = &cell_search_request;
...@@ -2248,7 +2219,6 @@ void configure_nfapi_pnf(char *vnf_ip_addr, int vnf_p5_port, char *pnf_ip_addr, ...@@ -2248,7 +2219,6 @@ void configure_nfapi_pnf(char *vnf_ip_addr, int vnf_p5_port, char *pnf_ip_addr,
config->system_information_req = &system_information_request; config->system_information_req = &system_information_request;
config->nmm_stop_req = &nmm_stop_request; config->nmm_stop_req = &nmm_stop_request;
config->vendor_ext = &vendor_ext; config->vendor_ext = &vendor_ext;
#endif
config->trace = &pnf_nfapi_trace; config->trace = &pnf_nfapi_trace;
config->user_data = &pnf; config->user_data = &pnf;
// To allow custom vendor extentions to be added to nfapi // To allow custom vendor extentions to be added to nfapi
...@@ -2266,7 +2236,7 @@ void configure_nfapi_pnf(char *vnf_ip_addr, int vnf_p5_port, char *pnf_ip_addr, ...@@ -2266,7 +2236,7 @@ void configure_nfapi_pnf(char *vnf_ip_addr, int vnf_p5_port, char *pnf_ip_addr,
void oai_subframe_ind(uint16_t sfn, uint16_t sf) { void oai_subframe_ind(uint16_t sfn, uint16_t sf) {
//LOG_D(PHY,"%s(sfn:%d, sf:%d)\n", __FUNCTION__, sfn, sf); //LOG_D(PHY,"%s(sfn:%d, sf:%d)\n", __FUNCTION__, sfn, sf);
//TODO FIXME - HACK - DJP - using a global to bodge it in //TODO FIXME - HACK - using a global to bodge it in
if (p7_config_g != NULL && sync_var==0) { if (p7_config_g != NULL && sync_var==0) {
uint16_t sfn_sf_tx = sfn<<4 | sf; uint16_t sfn_sf_tx = sfn<<4 | sf;
...@@ -2306,13 +2276,13 @@ void handle_nr_slot_ind(uint16_t sfn, uint16_t slot) { ...@@ -2306,13 +2276,13 @@ void handle_nr_slot_ind(uint16_t sfn, uint16_t slot) {
} }
int oai_nfapi_rach_ind(nfapi_rach_indication_t *rach_ind) { int oai_nfapi_rach_ind(nfapi_rach_indication_t *rach_ind) {
rach_ind->header.phy_id = 1; // DJP HACK TODO FIXME - need to pass this around!!!! rach_ind->header.phy_id = 1; // HACK TODO FIXME - need to pass this around!!!!
LOG_D(PHY, "%s() sfn_sf:%d preambles:%d\n", __FUNCTION__, NFAPI_SFNSF2DEC(rach_ind->sfn_sf), rach_ind->rach_indication_body.number_of_preambles); LOG_D(PHY, "%s() sfn_sf:%d preambles:%d\n", __FUNCTION__, NFAPI_SFNSF2DEC(rach_ind->sfn_sf), rach_ind->rach_indication_body.number_of_preambles);
return nfapi_pnf_p7_rach_ind(p7_config_g, rach_ind); return nfapi_pnf_p7_rach_ind(p7_config_g, rach_ind);
} }
int oai_nfapi_harq_indication(nfapi_harq_indication_t *harq_ind) { int oai_nfapi_harq_indication(nfapi_harq_indication_t *harq_ind) {
harq_ind->header.phy_id = 1; // DJP HACK TODO FIXME - need to pass this around!!!! harq_ind->header.phy_id = 1; // HACK TODO FIXME - need to pass this around!!!!
harq_ind->header.message_id = NFAPI_HARQ_INDICATION; harq_ind->header.message_id = NFAPI_HARQ_INDICATION;
LOG_D(PHY, "%s() sfn_sf:%d number_of_harqs:%d\n", __FUNCTION__, NFAPI_SFNSF2DEC(harq_ind->sfn_sf), harq_ind->harq_indication_body.number_of_harqs); LOG_D(PHY, "%s() sfn_sf:%d number_of_harqs:%d\n", __FUNCTION__, NFAPI_SFNSF2DEC(harq_ind->sfn_sf), harq_ind->harq_indication_body.number_of_harqs);
int retval = nfapi_pnf_p7_harq_ind(p7_config_g, harq_ind); int retval = nfapi_pnf_p7_harq_ind(p7_config_g, harq_ind);
...@@ -2324,21 +2294,21 @@ int oai_nfapi_harq_indication(nfapi_harq_indication_t *harq_ind) { ...@@ -2324,21 +2294,21 @@ int oai_nfapi_harq_indication(nfapi_harq_indication_t *harq_ind) {
} }
int oai_nfapi_crc_indication(nfapi_crc_indication_t *crc_ind) { int oai_nfapi_crc_indication(nfapi_crc_indication_t *crc_ind) {
crc_ind->header.phy_id = 1; // DJP HACK TODO FIXME - need to pass this around!!!! crc_ind->header.phy_id = 1; // HACK TODO FIXME - need to pass this around!!!!
crc_ind->header.message_id = NFAPI_CRC_INDICATION; crc_ind->header.message_id = NFAPI_CRC_INDICATION;
//LOG_D(PHY, "%s() sfn_sf:%d number_of_crcs:%d\n", __FUNCTION__, NFAPI_SFNSF2DEC(crc_ind->sfn_sf), crc_ind->crc_indication_body.number_of_crcs); //LOG_D(PHY, "%s() sfn_sf:%d number_of_crcs:%d\n", __FUNCTION__, NFAPI_SFNSF2DEC(crc_ind->sfn_sf), crc_ind->crc_indication_body.number_of_crcs);
return nfapi_pnf_p7_crc_ind(p7_config_g, crc_ind); return nfapi_pnf_p7_crc_ind(p7_config_g, crc_ind);
} }
int oai_nfapi_cqi_indication(nfapi_cqi_indication_t *ind) { int oai_nfapi_cqi_indication(nfapi_cqi_indication_t *ind) {
ind->header.phy_id = 1; // DJP HACK TODO FIXME - need to pass this around!!!! ind->header.phy_id = 1; // HACK TODO FIXME - need to pass this around!!!!
ind->header.message_id = NFAPI_RX_CQI_INDICATION; ind->header.message_id = NFAPI_RX_CQI_INDICATION;
//LOG_D(PHY, "%s() sfn_sf:%d number_of_cqis:%d\n", __FUNCTION__, NFAPI_SFNSF2DEC(ind->sfn_sf), ind->cqi_indication_body.number_of_cqis); //LOG_D(PHY, "%s() sfn_sf:%d number_of_cqis:%d\n", __FUNCTION__, NFAPI_SFNSF2DEC(ind->sfn_sf), ind->cqi_indication_body.number_of_cqis);
return nfapi_pnf_p7_cqi_ind(p7_config_g, ind); return nfapi_pnf_p7_cqi_ind(p7_config_g, ind);
} }
int oai_nfapi_rx_ind(nfapi_rx_indication_t *ind) { int oai_nfapi_rx_ind(nfapi_rx_indication_t *ind) {
ind->header.phy_id = 1; // DJP HACK TODO FIXME - need to pass this around!!!! ind->header.phy_id = 1; // HACK TODO FIXME - need to pass this around!!!!
ind->header.message_id = NFAPI_RX_ULSCH_INDICATION; ind->header.message_id = NFAPI_RX_ULSCH_INDICATION;
int retval = nfapi_pnf_p7_rx_ind(p7_config_g, ind); int retval = nfapi_pnf_p7_rx_ind(p7_config_g, ind);
//LOG_D(PHY,"%s() SFN/SF:%d pdus:%d retval:%d\n", __FUNCTION__, NFAPI_SFNSF2DEC(ind->sfn_sf), ind->rx_indication_body.number_of_pdus, retval); //LOG_D(PHY,"%s() SFN/SF:%d pdus:%d retval:%d\n", __FUNCTION__, NFAPI_SFNSF2DEC(ind->sfn_sf), ind->rx_indication_body.number_of_pdus, retval);
...@@ -2347,7 +2317,7 @@ int oai_nfapi_rx_ind(nfapi_rx_indication_t *ind) { ...@@ -2347,7 +2317,7 @@ int oai_nfapi_rx_ind(nfapi_rx_indication_t *ind) {
} }
int oai_nfapi_sr_indication(nfapi_sr_indication_t *ind) { int oai_nfapi_sr_indication(nfapi_sr_indication_t *ind) {
ind->header.phy_id = 1; // DJP HACK TODO FIXME - need to pass this around!!!! ind->header.phy_id = 1; // HACK TODO FIXME - need to pass this around!!!!
int retval = nfapi_pnf_p7_sr_ind(p7_config_g, ind); int retval = nfapi_pnf_p7_sr_ind(p7_config_g, ind);
//LOG_D(PHY,"%s() SFN/SF:%d srs:%d retval:%d\n", __FUNCTION__, NFAPI_SFNSF2DEC(ind->sfn_sf), ind->sr_indication_body.number_of_srs, retval); //LOG_D(PHY,"%s() SFN/SF:%d srs:%d retval:%d\n", __FUNCTION__, NFAPI_SFNSF2DEC(ind->sfn_sf), ind->sr_indication_body.number_of_srs, retval);
//free(ind.rx_indication_body.rx_pdu_list); //free(ind.rx_indication_body.rx_pdu_list);
...@@ -2363,31 +2333,31 @@ int oai_nfapi_nr_slot_indication(nfapi_nr_slot_indication_scf_t *ind) { ...@@ -2363,31 +2333,31 @@ int oai_nfapi_nr_slot_indication(nfapi_nr_slot_indication_scf_t *ind) {
} }
int oai_nfapi_nr_rx_data_indication(nfapi_nr_rx_data_indication_t *ind) { int oai_nfapi_nr_rx_data_indication(nfapi_nr_rx_data_indication_t *ind) {
ind->header.phy_id = 1; // DJP HACK TODO FIXME - need to pass this around!!!! ind->header.phy_id = 1; // HACK TODO FIXME - need to pass this around!!!!
ind->header.message_id = NFAPI_NR_PHY_MSG_TYPE_RX_DATA_INDICATION; ind->header.message_id = NFAPI_NR_PHY_MSG_TYPE_RX_DATA_INDICATION;
return nfapi_pnf_p7_nr_rx_data_ind(p7_config_g, ind); return nfapi_pnf_p7_nr_rx_data_ind(p7_config_g, ind);
} }
int oai_nfapi_nr_crc_indication(nfapi_nr_crc_indication_t *ind) { int oai_nfapi_nr_crc_indication(nfapi_nr_crc_indication_t *ind) {
ind->header.phy_id = 1; // DJP HACK TODO FIXME - need to pass this around!!!! ind->header.phy_id = 1; // HACK TODO FIXME - need to pass this around!!!!
ind->header.message_id = NFAPI_NR_PHY_MSG_TYPE_CRC_INDICATION; ind->header.message_id = NFAPI_NR_PHY_MSG_TYPE_CRC_INDICATION;
return nfapi_pnf_p7_nr_crc_ind(p7_config_g, ind); return nfapi_pnf_p7_nr_crc_ind(p7_config_g, ind);
} }
int oai_nfapi_nr_srs_indication(nfapi_nr_srs_indication_t *ind) { int oai_nfapi_nr_srs_indication(nfapi_nr_srs_indication_t *ind) {
ind->header.phy_id = 1; // DJP HACK TODO FIXME - need to pass this around!!!! ind->header.phy_id = 1; // HACK TODO FIXME - need to pass this around!!!!
ind->header.message_id = NFAPI_NR_PHY_MSG_TYPE_SRS_INDICATION; ind->header.message_id = NFAPI_NR_PHY_MSG_TYPE_SRS_INDICATION;
return nfapi_pnf_p7_nr_srs_ind(p7_config_g, ind); return nfapi_pnf_p7_nr_srs_ind(p7_config_g, ind);
} }
int oai_nfapi_nr_uci_indication(nfapi_nr_uci_indication_t *ind) { int oai_nfapi_nr_uci_indication(nfapi_nr_uci_indication_t *ind) {
ind->header.phy_id = 1; // DJP HACK TODO FIXME - need to pass this around!!!! ind->header.phy_id = 1; // HACK TODO FIXME - need to pass this around!!!!
ind->header.message_id = NFAPI_NR_PHY_MSG_TYPE_UCI_INDICATION; ind->header.message_id = NFAPI_NR_PHY_MSG_TYPE_UCI_INDICATION;
return nfapi_pnf_p7_nr_uci_ind(p7_config_g, ind); return nfapi_pnf_p7_nr_uci_ind(p7_config_g, ind);
} }
int oai_nfapi_nr_rach_indication(nfapi_nr_rach_indication_t *ind) { int oai_nfapi_nr_rach_indication(nfapi_nr_rach_indication_t *ind) {
ind->header.phy_id = 1; // DJP HACK TODO FIXME - need to pass this around!!!! ind->header.phy_id = 1; // HACK TODO FIXME - need to pass this around!!!!
ind->header.message_id = NFAPI_NR_PHY_MSG_TYPE_RACH_INDICATION; ind->header.message_id = NFAPI_NR_PHY_MSG_TYPE_RACH_INDICATION;
return nfapi_pnf_p7_nr_rach_ind(p7_config_g, ind); return nfapi_pnf_p7_nr_rach_ind(p7_config_g, ind);
} }
......
...@@ -41,6 +41,7 @@ ...@@ -41,6 +41,7 @@
#include "PHY/LTE_TRANSPORT/transport_proto.h" #include "PHY/LTE_TRANSPORT/transport_proto.h"
#include "openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h" #include "openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h"
#include "executables/lte-softmodem.h" #include "executables/lte-softmodem.h"
#include "openair1/PHY/defs_gNB.h"
#include "common/ran_context.h" #include "common/ran_context.h"
#include "openair2/PHY_INTERFACE/queue_t.h" #include "openair2/PHY_INTERFACE/queue_t.h"
...@@ -240,6 +241,13 @@ void oai_create_enb(void) { ...@@ -240,6 +241,13 @@ void oai_create_enb(void) {
FAPI_configured_for_a_CC = 1; FAPI_configured_for_a_CC = 1;
NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() eNB Cell %d is now configured\n", __FUNCTION__,CC_id); NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() eNB Cell %d is now configured\n", __FUNCTION__,CC_id);
} }
do {
NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() Waiting for eNB to become configured (by RRC/PHY) - need to wait otherwise NFAPI messages won't contain correct values\n", __FUNCTION__);
usleep(50000);
} while(eNB->configured != 1);
NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() eNB is now configured\n", __FUNCTION__);
} }
void oai_enb_init(void) { void oai_enb_init(void) {
...@@ -665,9 +673,17 @@ int phy_subframe_indication(struct nfapi_vnf_p7_config *config, uint16_t phy_id, ...@@ -665,9 +673,17 @@ int phy_subframe_indication(struct nfapi_vnf_p7_config *config, uint16_t phy_id,
} else { } else {
NFAPI_TRACE(NFAPI_TRACE_INFO, "[VNF] %s() RC.eNB:%p\n", __FUNCTION__, RC.eNB); NFAPI_TRACE(NFAPI_TRACE_INFO, "[VNF] %s() RC.eNB:%p\n", __FUNCTION__, RC.eNB);
if (RC.eNB) NFAPI_TRACE(NFAPI_TRACE_INFO, "RC.eNB[0][CC_id]->configured:%d\n", RC.eNB[0][CC_id]->configured); if (RC.eNB && RC.eNB[0][0]->configured) {
} uint16_t sfn = NFAPI_SFNSF2SFN(sfn_sf);
uint16_t sf = NFAPI_SFNSF2SF(sfn_sf);
//LOG_D(PHY,"[VNF] subframe indication sfn_sf:%d sfn:%d sf:%d\n", sfn_sf, sfn, sf);
wake_eNB_rxtx(RC.eNB[0][0], sfn, sf);
} else {
NFAPI_TRACE(NFAPI_TRACE_INFO, "[VNF] %s() RC.eNB:%p\n", __FUNCTION__, RC.eNB);
if (RC.eNB) NFAPI_TRACE(NFAPI_TRACE_INFO, "RC.eNB[0][0]->configured:%d\n", RC.eNB[0][0]->configured);
} }
return 0; return 0;
} }
...@@ -1701,6 +1717,7 @@ int nr_config_resp_cb(nfapi_vnf_config_t *config, int p5_idx, nfapi_nr_config_re ...@@ -1701,6 +1717,7 @@ int nr_config_resp_cb(nfapi_vnf_config_t *config, int p5_idx, nfapi_nr_config_re
nfapi_nr_start_request_scf_t req; nfapi_nr_start_request_scf_t req;
NFAPI_TRACE(NFAPI_TRACE_INFO, "[VNF] Received NFAPI_CONFIG_RESP idx:%d phy_id:%d\n", p5_idx, resp->header.phy_id); NFAPI_TRACE(NFAPI_TRACE_INFO, "[VNF] Received NFAPI_CONFIG_RESP idx:%d phy_id:%d\n", p5_idx, resp->header.phy_id);
NFAPI_TRACE(NFAPI_TRACE_INFO, "[VNF] Calling oai_enb_init()\n"); NFAPI_TRACE(NFAPI_TRACE_INFO, "[VNF] Calling oai_enb_init()\n");
oai_enb_init(); // TODO: change to gnb
memset(&req, 0, sizeof(req)); memset(&req, 0, sizeof(req));
req.header.message_id = NFAPI_NR_PHY_MSG_TYPE_START_REQUEST; req.header.message_id = NFAPI_NR_PHY_MSG_TYPE_START_REQUEST;
req.header.phy_id = resp->header.phy_id; req.header.phy_id = resp->header.phy_id;
...@@ -1722,13 +1739,24 @@ int config_resp_cb(nfapi_vnf_config_t *config, int p5_idx, nfapi_config_response ...@@ -1722,13 +1739,24 @@ int config_resp_cb(nfapi_vnf_config_t *config, int p5_idx, nfapi_config_response
} }
int start_resp_cb(nfapi_vnf_config_t *config, int p5_idx, nfapi_start_response_t *resp) { int start_resp_cb(nfapi_vnf_config_t *config, int p5_idx, nfapi_start_response_t *resp) {
NFAPI_TRACE(NFAPI_TRACE_INFO, "[VNF] Received NFAPI_START_RESP idx:%d phy_id:%d\n", p5_idx, resp->header.phy_id); NFAPI_TRACE(NFAPI_TRACE_INFO, "[VNF] Received NFAPI_START_RESP idx:%d phy_id:%d\n", p5_idx, resp->header.phy_id);
vnf_info *vnf = (vnf_info *)(config->user_data); vnf_info *vnf = (vnf_info *)(config->user_data);
pnf_info *pnf = vnf->pnfs; pnf_info *pnf = vnf->pnfs;
phy_info *phy = pnf->phys; phy_info *phy = pnf->phys;
vnf_p7_info *p7_vnf = vnf->p7_vnfs; vnf_p7_info *p7_vnf = vnf->p7_vnfs;
nfapi_vnf_p7_add_pnf((p7_vnf->config), phy->remote_addr, htons(phy->remote_port), phy->id); uint16_t port =htons(phy->remote_port);
return 0; char *remote_addr = (char *) malloc(strlen(phy->remote_addr)+1);
memset(remote_addr, 0, strlen(phy->remote_addr)+1);
strncpy(remote_addr, phy->remote_addr, strlen(phy->remote_addr));
for(int i=0; i < pnf->num_phys; i++ )
{
nfapi_vnf_p7_add_pnf((p7_vnf->config), remote_addr, (int)port, phy->id);
LOG_D(NFAPI_VNF, "MultiCell: fxn:%d phy_id added:%d\n", p5_idx, resp->header.phy_id);
phy +=1;
}
free(remote_addr);
remote_addr = NULL;
return 0;
} }
int nr_start_resp_cb(nfapi_vnf_config_t *config, int p5_idx, nfapi_nr_start_response_scf_t *resp) { int nr_start_resp_cb(nfapi_vnf_config_t *config, int p5_idx, nfapi_nr_start_response_scf_t *resp) {
...@@ -1802,7 +1830,7 @@ void vnf_start_thread(void *ptr) { ...@@ -1802,7 +1830,7 @@ void vnf_start_thread(void *ptr) {
static vnf_info vnf; static vnf_info vnf;
void configure_nr_nfapi_vnf(char *vnf_addr, int vnf_p5_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); nfapi_setmode(NFAPI_MODE_VNF);
memset(&vnf, 0, sizeof(vnf)); memset(&vnf, 0, sizeof(vnf));
memset(vnf.p7_vnfs, 0, sizeof(vnf.p7_vnfs)); memset(vnf.p7_vnfs, 0, sizeof(vnf.p7_vnfs));
...@@ -1853,7 +1881,7 @@ void configure_nr_nfapi_vnf(char *vnf_addr, int vnf_p5_port) { ...@@ -1853,7 +1881,7 @@ void configure_nr_nfapi_vnf(char *vnf_addr, int vnf_p5_port) {
} }
void configure_nfapi_vnf(char *vnf_addr, int vnf_p5_port) { 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); nfapi_setmode(NFAPI_MODE_VNF);
memset(&vnf, 0, sizeof(vnf)); memset(&vnf, 0, sizeof(vnf));
memset(vnf.p7_vnfs, 0, sizeof(vnf.p7_vnfs)); memset(vnf.p7_vnfs, 0, sizeof(vnf.p7_vnfs));
...@@ -2146,17 +2174,3 @@ int oai_nfapi_ue_release_req(nfapi_ue_release_request_t *release_req){ ...@@ -2146,17 +2174,3 @@ int oai_nfapi_ue_release_req(nfapi_ue_release_request_t *release_req){
} }
return retval; return retval;
} }
int oai_nfapi_slot_ind(nfapi_nr_slot_indication_scf_t * slot_ind)
{
LOG_D(NR_PHY, "Entering oai_nfapi_slot_ind sfn:%d,slot:%d\n", slot_ind->sfn, slot_ind->slot);
nfapi_vnf_p7_config_t *p7_config = vnf.p7_vnfs[0].config;
slot_ind->header.message_id= NFAPI_NR_PHY_MSG_TYPE_SLOT_INDICATION;
int retval = nfapi_vnf_p7_nr_slot_ind(p7_config, slot_ind);
if (retval!=0) {
LOG_E(PHY, "%s() Problem sending retval:%d\n", __FUNCTION__, retval);
}
return retval;
}
\ No newline at end of file
...@@ -20,8 +20,8 @@ ...@@ -20,8 +20,8 @@
*/ */
void configure_nfapi_vnf(char *vnf_addr, int vnf_p5_port); 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(char *vnf_addr, int vnf_p5_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);
uint32_t sfnslot_add_slot(uint16_t sfn, uint16_t slot, int offset); uint32_t sfnslot_add_slot(uint16_t sfn, uint16_t slot, int offset);
...@@ -87,6 +87,7 @@ typedef struct { ...@@ -87,6 +87,7 @@ typedef struct {
typedef struct { typedef struct {
uint16_t rnti; uint16_t rnti;
uint8_t dci_format; uint8_t dci_format;
uint8_t coreset_type;
int ss_type; int ss_type;
// n_CCE index of first CCE for PDCCH reception // n_CCE index of first CCE for PDCCH reception
int n_CCE; int n_CCE;
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
#define _NFAPI_NR_INTERFACE_H_ #define _NFAPI_NR_INTERFACE_H_
#include "nfapi_interface.h" #include "nfapi_interface.h"
#include "nfapi_nr_interface_scf.h" #include "nfapi/open-nFAPI/nfapi/public_inc/nfapi_nr_interface_scf.h"
#define NFAPI_NR_MAX_NB_CCE_AGGREGATION_LEVELS 5 #define NFAPI_NR_MAX_NB_CCE_AGGREGATION_LEVELS 5
#define NFAPI_NR_MAX_NB_TCI_STATES_PDCCH 64 #define NFAPI_NR_MAX_NB_TCI_STATES_PDCCH 64
......
...@@ -452,7 +452,7 @@ typedef struct ...@@ -452,7 +452,7 @@ typedef struct
// ERROR enums // ERROR enums
typedef enum { // Table 2-22 typedef enum { // Table 2-22
NFAPI_NR_PARAM_MSG_OK = 0, NFAPI_NR_PARAM_MSG_OK = 0,
NFAPI_NR_PARAM_MSG_INVALID_STATE NFAPI_NR_PARAM_MSG_INVALID_STATE
} nfapi_nr_param_errors_e; } nfapi_nr_param_errors_e;
typedef enum { // Table 2-25 typedef enum { // Table 2-25
...@@ -463,7 +463,7 @@ typedef enum { // Table 2-25 ...@@ -463,7 +463,7 @@ typedef enum { // Table 2-25
typedef enum { // Table 2-27 typedef enum { // Table 2-27
NFAPI_NR_START_MSG_OK = 0, NFAPI_NR_START_MSG_OK = 0,
NFAPI_NR_START_MSG_INVALID_STATE NFAPI_NR_START_MSG_INVALID_STATE
} nfapi_nr_start_errors_e; } nfapi_nr_start_errors_e;
//PNF P5 NR //PNF P5 NR
...@@ -679,9 +679,6 @@ typedef struct { ...@@ -679,9 +679,6 @@ typedef struct {
} nfapi_nr_slot_indication_scf_t; } nfapi_nr_slot_indication_scf_t;
/** VTUESLOT.indication sent from UE as an ACK in the virtual time scenario */
typedef nfapi_nr_slot_indication_scf_t nfapi_ue_slot_indication_vt_t;
// 3.4.2 // 3.4.2
//for pdcch_pdu: //for pdcch_pdu:
......
...@@ -37,7 +37,6 @@ ...@@ -37,7 +37,6 @@
#include <nfapi.h> #include <nfapi.h>
#include <debug.h> #include <debug.h>
#include "nfapi_nr_interface_scf.h" #include "nfapi_nr_interface_scf.h"
#include "vendor_ext.h"
extern int nfapi_unpack_p7_vendor_extension(nfapi_p7_message_header_t *header, uint8_t **ppReadPackedMsg, void *user_data); extern int nfapi_unpack_p7_vendor_extension(nfapi_p7_message_header_t *header, uint8_t **ppReadPackedMsg, void *user_data);
extern int nfapi_pack_p7_vendor_extension(nfapi_p7_message_header_t *header, uint8_t **ppWritePackedMsg, void *user_data); extern int nfapi_pack_p7_vendor_extension(nfapi_p7_message_header_t *header, uint8_t **ppWritePackedMsg, void *user_data);
...@@ -3385,13 +3384,6 @@ static uint8_t pack_nr_uci_pucch_2_3_4(void* tlv, uint8_t **ppWritePackedMsg, ui ...@@ -3385,13 +3384,6 @@ static uint8_t pack_nr_uci_pucch_2_3_4(void* tlv, uint8_t **ppWritePackedMsg, ui
return 1; return 1;
} }
static uint8_t pack_subframe_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
{
nfapi_subframe_indication_t *pNfapiMsg = (nfapi_subframe_indication_t*)msg;
return (push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end));
}
static uint8_t pack_nr_uci_indication_body(nfapi_nr_uci_t* value, uint8_t **ppWritePackedMsg, uint8_t *end) static uint8_t pack_nr_uci_indication_body(nfapi_nr_uci_t* value, uint8_t **ppWritePackedMsg, uint8_t *end)
{ {
if (!push16(value->pdu_type, ppWritePackedMsg, end)) if (!push16(value->pdu_type, ppWritePackedMsg, end))
...@@ -3497,7 +3489,6 @@ int nfapi_nr_p7_message_pack(void *pMessageBuf, void *pPackedBuf, uint32_t packe ...@@ -3497,7 +3489,6 @@ int nfapi_nr_p7_message_pack(void *pMessageBuf, void *pPackedBuf, uint32_t packe
case NFAPI_NR_PHY_MSG_TYPE_SLOT_INDICATION: case NFAPI_NR_PHY_MSG_TYPE_SLOT_INDICATION:
result = pack_nr_slot_indication(pMessageHeader, &pWritePackedMessage, end, config); result = pack_nr_slot_indication(pMessageHeader, &pWritePackedMessage, end, config);
break;
case NFAPI_NR_PHY_MSG_TYPE_RX_DATA_INDICATION: case NFAPI_NR_PHY_MSG_TYPE_RX_DATA_INDICATION:
result = pack_nr_rx_data_indication(pMessageHeader, &pWritePackedMessage, end, config); result = pack_nr_rx_data_indication(pMessageHeader, &pWritePackedMessage, end, config);
...@@ -3705,10 +3696,6 @@ int nfapi_p7_message_pack(void *pMessageBuf, void *pPackedBuf, uint32_t packedBu ...@@ -3705,10 +3696,6 @@ int nfapi_p7_message_pack(void *pMessageBuf, void *pPackedBuf, uint32_t packedBu
result = pack_timing_info(pMessageHeader, &pWritePackedMessage, end, config); result = pack_timing_info(pMessageHeader, &pWritePackedMessage, end, config);
break; break;
case NFAPI_SUBFRAME_INDICATION:
result = pack_subframe_indication(pMessageHeader, &pWritePackedMessage, end, config);
break;
default: { default: {
if(pMessageHeader->message_id >= NFAPI_VENDOR_EXT_MSG_MIN && if(pMessageHeader->message_id >= NFAPI_VENDOR_EXT_MSG_MIN &&
pMessageHeader->message_id <= NFAPI_VENDOR_EXT_MSG_MAX) { pMessageHeader->message_id <= NFAPI_VENDOR_EXT_MSG_MAX) {
...@@ -5348,16 +5335,6 @@ static uint8_t unpack_ul_config_request(uint8_t **ppReadPackedMsg, uint8_t *end, ...@@ -5348,16 +5335,6 @@ static uint8_t unpack_ul_config_request(uint8_t **ppReadPackedMsg, uint8_t *end,
unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension)); unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension));
} }
static uint8_t unpack_subframe_indication(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config)
{
nfapi_subframe_indication_t *pNfapiMsg = (nfapi_subframe_indication_t *)msg;
if (!(pull16(ppReadPackedMsg, &pNfapiMsg->sfn_sf , end) ))
return 0;
return 1;
}
static uint8_t unpack_hi_dci0_hi_pdu_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) { static uint8_t unpack_hi_dci0_hi_pdu_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) {
nfapi_hi_dci0_hi_pdu_rel8_t *hi_pdu_rel8 = (nfapi_hi_dci0_hi_pdu_rel8_t *)tlv; nfapi_hi_dci0_hi_pdu_rel8_t *hi_pdu_rel8 = (nfapi_hi_dci0_hi_pdu_rel8_t *)tlv;
return( pull8(ppReadPackedMsg, &hi_pdu_rel8->resource_block_start, end) && return( pull8(ppReadPackedMsg, &hi_pdu_rel8->resource_block_start, end) &&
...@@ -7602,53 +7579,6 @@ static uint8_t unpack_nr_timing_info(uint8_t **ppReadPackedMsg, uint8_t *end, vo ...@@ -7602,53 +7579,6 @@ static uint8_t unpack_nr_timing_info(uint8_t **ppReadPackedMsg, uint8_t *end, vo
unpack_p7_tlv_list(NULL, 0, ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension)); unpack_p7_tlv_list(NULL, 0, ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension));
} }
static uint8_t unpack_p7_lte_cell_search_indication_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
{
nfapi_lte_cell_search_indication_t* value = (nfapi_lte_cell_search_indication_t*)tlv;
uint16_t idx = 0;
if(pull16(ppReadPackedMsg, &value->number_of_lte_cells_found, end) == 0)
return 0;
if(value->number_of_lte_cells_found <= NFAPI_MAX_LTE_CELLS_FOUND)
{
for(idx = 0; idx < value->number_of_lte_cells_found; ++idx)
{
if(!(pull16(ppReadPackedMsg, &value->lte_found_cells[idx].pci, end) &&
pull8(ppReadPackedMsg, &value->lte_found_cells[idx].rsrp, end) &&
pull8(ppReadPackedMsg, &value->lte_found_cells[idx].rsrq, end) &&
pulls16(ppReadPackedMsg, &value->lte_found_cells[idx].frequency_offset, end)))
return 0;
}
}
else
{
NFAPI_TRACE(NFAPI_TRACE_ERROR, "More found LTE cells than we can decode %d \n", value->number_of_lte_cells_found);
return 0;
}
return 1;
}
static uint8_t unpack_p7_cell_search_indication(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config)
{
vendor_nfapi_cell_search_indication_t *pNfapiMsg = (vendor_nfapi_cell_search_indication_t*)msg;
unpack_p7_tlv_t unpack_fns[] =
{
{ NFAPI_LTE_CELL_SEARCH_INDICATION_TAG, &pNfapiMsg->lte_cell_search_indication, &unpack_p7_lte_cell_search_indication_value},
#if 0 /** FC: Lets do LTE for now */
{ NFAPI_UTRAN_CELL_SEARCH_INDICATION_TAG, &pNfapiMsg->utran_cell_search_indication, &unpack_utran_cell_search_indication_value},
{ NFAPI_GERAN_CELL_SEARCH_INDICATION_TAG, &pNfapiMsg->geran_cell_search_indication, &unpack_geran_cell_search_indication_value},
{ NFAPI_PNF_CELL_SEARCH_STATE_TAG, &pNfapiMsg->pnf_cell_search_state, &unpack_opaque_data_value},
{ NFAPI_NB_IOT_CELL_SEARCH_INDICATION_TAG, &pNfapiMsg->nb_iot_cell_search_indication, &unpack_nb_iot_cell_search_indication_value},
#endif
};
return (pull32(ppReadPackedMsg, &pNfapiMsg->error_code, end) &&
unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension));
}
// unpack length check // unpack length check
...@@ -7791,7 +7721,7 @@ static int check_unpack_length(nfapi_message_id_e msgId, uint32_t unpackedBufLen ...@@ -7791,7 +7721,7 @@ static int check_unpack_length(nfapi_message_id_e msgId, uint32_t unpackedBufLen
return retLen; return retLen;
} }
static int check_nr_unpack_length(nfapi_message_id_e msgId, uint32_t unpackedBufLen) static int check_nr_unpack_length(nfapi_nr_phy_msg_type_e msgId, uint32_t unpackedBufLen)
{ {
int retLen = 0; int retLen = 0;
...@@ -7852,21 +7782,6 @@ static int check_nr_unpack_length(nfapi_message_id_e msgId, uint32_t unpackedBuf ...@@ -7852,21 +7782,6 @@ static int check_nr_unpack_length(nfapi_message_id_e msgId, uint32_t unpackedBuf
retLen = sizeof(nfapi_nr_ul_node_sync_t); retLen = sizeof(nfapi_nr_ul_node_sync_t);
break; break;
case NFAPI_TIMING_INFO:
if (unpackedBufLen >= sizeof(nfapi_timing_info_t))
retLen = sizeof(nfapi_timing_info_t);
break;
case NFAPI_UE_RELEASE_REQUEST:
if (unpackedBufLen >= sizeof(nfapi_ue_release_request_t))
retLen = sizeof(nfapi_ue_release_request_t);
break;
case NFAPI_UE_RELEASE_RESPONSE:
if (unpackedBufLen >= sizeof(nfapi_ue_release_response_t))
retLen = sizeof(nfapi_ue_release_response_t);
break;
default: default:
NFAPI_TRACE(NFAPI_TRACE_ERROR, "Unknown message ID %d\n", msgId); NFAPI_TRACE(NFAPI_TRACE_ERROR, "Unknown message ID %d\n", msgId);
break; break;
...@@ -7960,14 +7875,6 @@ int nfapi_p7_message_unpack(void *pMessageBuf, uint32_t messageBufLen, void *pUn ...@@ -7960,14 +7875,6 @@ int nfapi_p7_message_unpack(void *pMessageBuf, uint32_t messageBufLen, void *pUn
// look for the specific message // look for the specific message
switch (pMessageHeader->message_id) { switch (pMessageHeader->message_id) {
case NFAPI_SUBFRAME_INDICATION:
if (check_unpack_length(NFAPI_SUBFRAME_INDICATION, unpackedBufLen)){
nfapi_subframe_indication_t* msg = (nfapi_subframe_indication_t*) pMessageHeader;
result = unpack_subframe_indication(&pReadPackedMessage, end, msg, config);
}
else
return -1;
break;
case NFAPI_DL_CONFIG_REQUEST: case NFAPI_DL_CONFIG_REQUEST:
if (check_unpack_length(NFAPI_DL_CONFIG_REQUEST, unpackedBufLen)) if (check_unpack_length(NFAPI_DL_CONFIG_REQUEST, unpackedBufLen))
result = unpack_dl_config_request(&pReadPackedMessage, end, pMessageHeader, config); result = unpack_dl_config_request(&pReadPackedMessage, end, pMessageHeader, config);
...@@ -8131,26 +8038,13 @@ int nfapi_p7_message_unpack(void *pMessageBuf, uint32_t messageBufLen, void *pUn ...@@ -8131,26 +8038,13 @@ int nfapi_p7_message_unpack(void *pMessageBuf, uint32_t messageBufLen, void *pUn
default: default:
if(pMessageHeader->message_id >= NFAPI_VENDOR_EXT_MSG_MIN && if(pMessageHeader->message_id >= NFAPI_VENDOR_EXT_MSG_MIN &&
pMessageHeader->message_id <= NFAPI_VENDOR_EXT_MSG_MAX) { pMessageHeader->message_id <= NFAPI_VENDOR_EXT_MSG_MAX) {
if ( pMessageHeader->message_id == P7_CELL_SEARCH_IND ) if(config && config->unpack_p7_vendor_extension) {
{ result = (config->unpack_p7_vendor_extension)(pMessageHeader, &pReadPackedMessage, end, config);
result = unpack_p7_cell_search_indication(&pReadPackedMessage, end, pMessageHeader, config); } else {
break; NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s VE NFAPI message ID %d. No ve decoder provided\n", __FUNCTION__, pMessageHeader->message_id);
}
else
{
if(config && config->unpack_p7_vendor_extension)
{
result = (config->unpack_p7_vendor_extension)(pMessageHeader, &pReadPackedMessage, end, config);
}
else
{
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s VE NFAPI message ID %d. No ve decoder provided\n", __FUNCTION__, pMessageHeader->message_id);
}
} }
} } else {
else NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s NFAPI Unknown message ID %d\n", __FUNCTION__, pMessageHeader->message_id);
{
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s NFAPI Unknown message ID %d\n", __FUNCTION__, pMessageHeader->message_id);
} }
break; break;
...@@ -8239,7 +8133,7 @@ int nfapi_nr_p7_message_unpack(void *pMessageBuf, uint32_t messageBufLen, void * ...@@ -8239,7 +8133,7 @@ int nfapi_nr_p7_message_unpack(void *pMessageBuf, uint32_t messageBufLen, void *
return -1; return -1;
break; break;
case NFAPI_UE_RELEASE_REQUEST: case NFAPI_UE_RELEASE_REQUEST:
if (check_nr_unpack_length(NFAPI_UE_RELEASE_REQUEST, unpackedBufLen)) if (check_unpack_length(NFAPI_UE_RELEASE_REQUEST, unpackedBufLen))
result = unpack_ue_release_request(&pReadPackedMessage, end, pMessageHeader, config); result = unpack_ue_release_request(&pReadPackedMessage, end, pMessageHeader, config);
else else
return -1; return -1;
...@@ -8319,14 +8213,14 @@ int nfapi_nr_p7_message_unpack(void *pMessageBuf, uint32_t messageBufLen, void * ...@@ -8319,14 +8213,14 @@ int nfapi_nr_p7_message_unpack(void *pMessageBuf, uint32_t messageBufLen, void *
break; break;
case NFAPI_TIMING_INFO: case NFAPI_TIMING_INFO:
if (check_nr_unpack_length(NFAPI_TIMING_INFO, unpackedBufLen)) if (check_unpack_length(NFAPI_TIMING_INFO, unpackedBufLen))
result = unpack_nr_timing_info(&pReadPackedMessage, end, pMessageHeader, config); result = unpack_nr_timing_info(&pReadPackedMessage, end, pMessageHeader, config);
else else
return -1; return -1;
break; break;
case NFAPI_UE_RELEASE_RESPONSE: case NFAPI_UE_RELEASE_RESPONSE:
if (check_nr_unpack_length(NFAPI_UE_RELEASE_RESPONSE, unpackedBufLen)) if (check_unpack_length(NFAPI_UE_RELEASE_RESPONSE, unpackedBufLen))
result = unpack_ue_release_resp(&pReadPackedMessage, end, pMessageHeader, config); result = unpack_ue_release_resp(&pReadPackedMessage, end, pMessageHeader, config);
else else
return -1; return -1;
...@@ -8337,11 +8231,6 @@ int nfapi_nr_p7_message_unpack(void *pMessageBuf, uint32_t messageBufLen, void * ...@@ -8337,11 +8231,6 @@ int nfapi_nr_p7_message_unpack(void *pMessageBuf, uint32_t messageBufLen, void *
if(pMessageHeader->message_id >= NFAPI_VENDOR_EXT_MSG_MIN && if(pMessageHeader->message_id >= NFAPI_VENDOR_EXT_MSG_MIN &&
pMessageHeader->message_id <= NFAPI_VENDOR_EXT_MSG_MAX) pMessageHeader->message_id <= NFAPI_VENDOR_EXT_MSG_MAX)
{ {
if ( pMessageHeader->message_id == P7_CELL_SEARCH_IND) {
result = unpack_p7_cell_search_indication(&pReadPackedMessage, end, pMessageHeader, config);
break;
}
else {
if(config && config->unpack_p7_vendor_extension) if(config && config->unpack_p7_vendor_extension)
{ {
result = (config->unpack_p7_vendor_extension)(pMessageHeader, &pReadPackedMessage, end, config); result = (config->unpack_p7_vendor_extension)(pMessageHeader, &pReadPackedMessage, end, config);
...@@ -8350,7 +8239,6 @@ int nfapi_nr_p7_message_unpack(void *pMessageBuf, uint32_t messageBufLen, void * ...@@ -8350,7 +8239,6 @@ int nfapi_nr_p7_message_unpack(void *pMessageBuf, uint32_t messageBufLen, void *
{ {
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s VE NFAPI message ID %d. No ve decoder provided\n", __FUNCTION__, pMessageHeader->message_id); NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s VE NFAPI message ID %d. No ve decoder provided\n", __FUNCTION__, pMessageHeader->message_id);
} }
}
} }
else else
{ {
......
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
# if 1 // for hard-code (remove later) # if 1 // for hard-code (remove later)
#include "COMMON/platform_types.h" #include "COMMON/platform_types.h"
#include "COMMON/platform_constants.h" #include "common/platform_constants.h"
#include "common/ran_context.h" #include "common/ran_context.h"
#include "common/utils/LOG/log.h" #include "common/utils/LOG/log.h"
...@@ -831,7 +831,7 @@ void pnf_nr_handle_start_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen) ...@@ -831,7 +831,7 @@ void pnf_nr_handle_start_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
memset(&resp, 0, sizeof(resp)); memset(&resp, 0, sizeof(resp));
resp.header.message_id = NFAPI_NR_PHY_MSG_TYPE_START_RESPONSE; resp.header.message_id = NFAPI_NR_PHY_MSG_TYPE_START_RESPONSE;
resp.header.phy_id = req.header.phy_id; resp.header.phy_id = req.header.phy_id;
resp.error_code = NFAPI_MSG_INVALID_STATE; resp.error_code = NFAPI_NR_START_MSG_INVALID_STATE;
nfapi_nr_pnf_start_resp(config, &resp); nfapi_nr_pnf_start_resp(config, &resp);
} }
} }
...@@ -841,7 +841,7 @@ void pnf_nr_handle_start_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen) ...@@ -841,7 +841,7 @@ void pnf_nr_handle_start_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
memset(&resp, 0, sizeof(resp)); memset(&resp, 0, sizeof(resp));
resp.header.message_id = NFAPI_NR_PHY_MSG_TYPE_START_RESPONSE; resp.header.message_id = NFAPI_NR_PHY_MSG_TYPE_START_RESPONSE;
resp.header.phy_id = req.header.phy_id; resp.header.phy_id = req.header.phy_id;
resp.error_code = NFAPI_MSG_INVALID_CONFIG; resp.error_code = NFAPI_NR_START_MSG_INVALID_STATE;
nfapi_nr_pnf_start_resp(config, &resp); nfapi_nr_pnf_start_resp(config, &resp);
} }
} }
...@@ -851,7 +851,7 @@ void pnf_nr_handle_start_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen) ...@@ -851,7 +851,7 @@ void pnf_nr_handle_start_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
memset(&resp, 0, sizeof(resp)); memset(&resp, 0, sizeof(resp));
resp.header.message_id = NFAPI_NR_PHY_MSG_TYPE_START_RESPONSE; resp.header.message_id = NFAPI_NR_PHY_MSG_TYPE_START_RESPONSE;
resp.header.phy_id = req.header.phy_id; resp.header.phy_id = req.header.phy_id;
resp.error_code = NFAPI_MSG_INVALID_STATE; resp.error_code = NFAPI_NR_START_MSG_INVALID_STATE;
nfapi_nr_pnf_start_resp(config, &resp); nfapi_nr_pnf_start_resp(config, &resp);
} }
} }
...@@ -2309,7 +2309,7 @@ int pnf_message_pump(pnf_t* pnf) ...@@ -2309,7 +2309,7 @@ int pnf_message_pump(pnf_t* pnf)
} }
// Drop back to idle if we have lost connection // Drop back to idle if we have lost connection
pnf->_public.state = NFAPI_PNF_PHY_IDLE; pnf->_public.state = NFAPI_PNF_IDLE;
// close the connection and socket // close the connection and socket
...@@ -2370,7 +2370,7 @@ int pnf_nr_message_pump(pnf_t* pnf) ...@@ -2370,7 +2370,7 @@ int pnf_nr_message_pump(pnf_t* pnf)
} }
// Drop back to idle if we have lost connection // Drop back to idle if we have lost connection
pnf->_public.state = NFAPI_PNF_PHY_IDLE; pnf->_public.state = NFAPI_PNF_IDLE;
// close the connection and socket // close the connection and socket
......
...@@ -967,7 +967,7 @@ int pnf_p7_slot_ind(pnf_p7_t* pnf_p7, uint16_t phy_id, uint16_t sfn, uint16_t sl ...@@ -967,7 +967,7 @@ int pnf_p7_slot_ind(pnf_p7_t* pnf_p7, uint16_t phy_id, uint16_t sfn, uint16_t sl
slot = shifted_slot; slot = shifted_slot;
// //
// DJP - why does the shift not apply to pnf_p7->sfn_sf??? // why does the shift not apply to pnf_p7->sfn_sf???
// //
pnf_p7->slot_shift = 0; pnf_p7->slot_shift = 0;
...@@ -1219,7 +1219,7 @@ int pnf_p7_subframe_ind(pnf_p7_t* pnf_p7, uint16_t phy_id, uint16_t sfn_sf) ...@@ -1219,7 +1219,7 @@ int pnf_p7_subframe_ind(pnf_p7_t* pnf_p7, uint16_t phy_id, uint16_t sfn_sf)
sfn_sf = shifted_sfn_sf; sfn_sf = shifted_sfn_sf;
// //
// DJP - why does the shift not apply to pnf_p7->sfn_sf??? // why does the shift not apply to pnf_p7->sfn_sf???
// //
pnf_p7->sfn_sf_shift = 0; pnf_p7->sfn_sf_shift = 0;
...@@ -1596,74 +1596,74 @@ uint8_t is_p7_request_in_window(uint16_t sfnsf, const char* name, pnf_p7_t* phy) ...@@ -1596,74 +1596,74 @@ uint8_t is_p7_request_in_window(uint16_t sfnsf, const char* name, pnf_p7_t* phy)
// P7 messages // P7 messages
void pnf_handle_dl_tti_request(void* pRecvMsg, int recvMsgLen, pnf_p7_t* pnf_p7) void pnf_handle_dl_tti_request(void* pRecvMsg, int recvMsgLen, pnf_p7_t* pnf_p7)
{ {
//NFAPI_TRACE(NFAPI_TRACE_INFO, "DL_CONFIG.req Received\n"); //NFAPI_TRACE(NFAPI_TRACE_INFO, "DL_CONFIG.req Received\n");
nfapi_nr_dl_tti_request_t* req = allocate_nfapi_dl_tti_request(pnf_p7); nfapi_nr_dl_tti_request_t* req = allocate_nfapi_dl_tti_request(pnf_p7);
if(req == NULL) if(req == NULL)
{ {
NFAPI_TRACE(NFAPI_TRACE_INFO, "failed to allocate nfapi_dl_tti_request structure\n"); NFAPI_TRACE(NFAPI_TRACE_INFO, "failed to allocate nfapi_dl_tti_request structure\n");
return; return;
} }
int unpack_result = nfapi_nr_p7_message_unpack(pRecvMsg, recvMsgLen, req, sizeof(nfapi_nr_dl_tti_request_t), &(pnf_p7->_public.codec_config)); int unpack_result = nfapi_nr_p7_message_unpack(pRecvMsg, recvMsgLen, req, sizeof(nfapi_nr_dl_tti_request_t), &(pnf_p7->_public.codec_config));
if(unpack_result == 0) if(unpack_result == 0)
{ {
if(pthread_mutex_lock(&(pnf_p7->mutex)) != 0) if(pthread_mutex_lock(&(pnf_p7->mutex)) != 0)
{ {
NFAPI_TRACE(NFAPI_TRACE_INFO, "failed to lock mutex\n"); NFAPI_TRACE(NFAPI_TRACE_INFO, "failed to lock mutex\n");
return; return;
} }
if(is_nr_p7_request_in_window(req->SFN,req->Slot, "dl_tti_request", pnf_p7)) if(is_nr_p7_request_in_window(req->SFN,req->Slot, "dl_tti_request", pnf_p7))
{ {
uint32_t sfn_slot_dec = NFAPI_SFNSLOT2DEC(req->SFN,req->Slot); uint32_t sfn_slot_dec = NFAPI_SFNSLOT2DEC(req->SFN,req->Slot);
uint8_t buffer_index = sfn_slot_dec % 20; uint8_t buffer_index = sfn_slot_dec % 20;
struct timespec t;
clock_gettime(CLOCK_MONOTONIC, &t);
NFAPI_TRACE(NFAPI_TRACE_INFO,"%s() %ld.%09ld POPULATE DL_TTI_REQ current tx sfn/slot:%d.%d p7 msg sfn/slot: %d.%d buffer_index:%d\n", __FUNCTION__, t.tv_sec, t.tv_nsec, pnf_p7->sfn,pnf_p7->slot, req->SFN, req->Slot, buffer_index);
// if there is already an dl_tti_req make sure we free it.
if(pnf_p7->slot_buffer[buffer_index].dl_tti_req != 0)
{
NFAPI_TRACE(NFAPI_TRACE_NOTE, "%s() is_nr_p7_request_in_window()=TRUE buffer_index occupied - free it first sfn_slot:%d buffer_index:%d\n", __FUNCTION__, NFAPI_SFNSLOT2DEC(req->SFN,req->Slot), buffer_index);
//NFAPI_TRACE(NFAPI_TRACE_NOTE, "[%d] Freeing dl_config_req at index %d (%d/%d)",
// pMyPhyInfo->sfnSf, bufferIdx,
// SFNSF2SFN(dreq->sfn_sf), SFNSF2SF(dreq->sfn_sf));
deallocate_nfapi_dl_tti_request(pnf_p7->slot_buffer[buffer_index].dl_tti_req, pnf_p7);
}
// filling dl_tti_request in slot buffer
pnf_p7->slot_buffer[buffer_index].sfn = req->SFN;
pnf_p7->slot_buffer[buffer_index].slot = req->Slot;
pnf_p7->slot_buffer[buffer_index].dl_tti_req = req;
pnf_p7->stats.dl_tti_ontime++;
}
else
{
//NFAPI_TRACE(NFAPI_TRACE_NOTE, "NOT storing dl_config_req SFN/SF %d\n", req->sfn_sf);
deallocate_nfapi_dl_tti_request(req, pnf_p7);
if(pnf_p7->_public.timing_info_mode_aperiodic) struct timespec t;
{ clock_gettime(CLOCK_MONOTONIC, &t);
pnf_p7->timing_info_aperiodic_send = 1;
}
pnf_p7->stats.dl_tti_late++; NFAPI_TRACE(NFAPI_TRACE_INFO,"%s() %ld.%09ld POPULATE DL_TTI_REQ current tx sfn/slot:%d.%d p7 msg sfn/slot: %d.%d buffer_index:%d\n", __FUNCTION__, t.tv_sec, t.tv_nsec, pnf_p7->sfn,pnf_p7->slot, req->SFN, req->Slot, buffer_index);
}
if(pthread_mutex_unlock(&(pnf_p7->mutex)) != 0) // if there is already an dl_tti_req make sure we free it.
{ if(pnf_p7->slot_buffer[buffer_index].dl_tti_req != 0)
NFAPI_TRACE(NFAPI_TRACE_INFO, "failed to unlock mutex\n"); {
return; NFAPI_TRACE(NFAPI_TRACE_NOTE, "%s() is_nr_p7_request_in_window()=TRUE buffer_index occupied - free it first sfn_slot:%d buffer_index:%d\n", __FUNCTION__, NFAPI_SFNSLOT2DEC(req->SFN,req->Slot), buffer_index);
} //NFAPI_TRACE(NFAPI_TRACE_NOTE, "[%d] Freeing dl_config_req at index %d (%d/%d)",
} // pMyPhyInfo->sfnSf, bufferIdx,
else // SFNSF2SFN(dreq->sfn_sf), SFNSF2SF(dreq->sfn_sf));
{ deallocate_nfapi_dl_tti_request(pnf_p7->slot_buffer[buffer_index].dl_tti_req, pnf_p7);
NFAPI_TRACE(NFAPI_TRACE_ERROR, "Failed to unpack dl_tti_req"); }
deallocate_nfapi_dl_tti_request(req, pnf_p7);
} // filling dl_tti_request in slot buffer
pnf_p7->slot_buffer[buffer_index].sfn = req->SFN;
pnf_p7->slot_buffer[buffer_index].slot = req->Slot;
pnf_p7->slot_buffer[buffer_index].dl_tti_req = req;
pnf_p7->stats.dl_tti_ontime++;
}
else
{
//NFAPI_TRACE(NFAPI_TRACE_NOTE, "NOT storing dl_config_req SFN/SF %d\n", req->sfn_sf);
deallocate_nfapi_dl_tti_request(req, pnf_p7);
if(pnf_p7->_public.timing_info_mode_aperiodic)
{
pnf_p7->timing_info_aperiodic_send = 1;
}
pnf_p7->stats.dl_tti_late++;
}
if(pthread_mutex_unlock(&(pnf_p7->mutex)) != 0)
{
NFAPI_TRACE(NFAPI_TRACE_INFO, "failed to unlock mutex\n");
return;
}
}
else
{
NFAPI_TRACE(NFAPI_TRACE_ERROR, "Failed to unpack dl_tti_req");
deallocate_nfapi_dl_tti_request(req, pnf_p7);
}
} }
...@@ -1781,32 +1781,32 @@ void pnf_handle_ul_tti_request(void* pRecvMsg, int recvMsgLen, pnf_p7_t* pnf_p7) ...@@ -1781,32 +1781,32 @@ void pnf_handle_ul_tti_request(void* pRecvMsg, int recvMsgLen, pnf_p7_t* pnf_p7)
} }
if(is_nr_p7_request_in_window(req->SFN,req->Slot, "ul_tti_request", pnf_p7)) if(is_nr_p7_request_in_window(req->SFN,req->Slot, "ul_tti_request", pnf_p7))
{ {
uint32_t sfn_slot_dec = NFAPI_SFNSLOT2DEC(req->SFN,req->Slot); uint32_t sfn_slot_dec = NFAPI_SFNSLOT2DEC(req->SFN,req->Slot);
uint8_t buffer_index = (sfn_slot_dec % 20); uint8_t buffer_index = (sfn_slot_dec % 20);
struct timespec t;
clock_gettime(CLOCK_MONOTONIC, &t);
NFAPI_TRACE(NFAPI_TRACE_INFO,"%s() %ld.%09ld POPULATE UL_TTI_REQ current tx sfn/slot:%d.%d p7 msg sfn/slot: %d.%d buffer_index:%d\n", __FUNCTION__, t.tv_sec, t.tv_nsec, pnf_p7->sfn,pnf_p7->slot, req->SFN, req->Slot, buffer_index);
if(pnf_p7->slot_buffer[buffer_index].ul_tti_req != 0) struct timespec t;
{ clock_gettime(CLOCK_MONOTONIC, &t);
//NFAPI_TRACE(NFAPI_TRACE_NOTE, "[%d] Freeing ul_config_req at index %d (%d/%d)",
// pMyPhyInfo->sfnSf, bufferIdx,
// SFNSF2SFN(dreq->sfn_sf), SFNSF2SF(dreq->sfn_sf));
deallocate_nfapi_ul_tti_request(pnf_p7->slot_buffer[buffer_index].ul_tti_req, pnf_p7); NFAPI_TRACE(NFAPI_TRACE_INFO,"%s() %ld.%09ld POPULATE UL_TTI_REQ current tx sfn/slot:%d.%d p7 msg sfn/slot: %d.%d buffer_index:%d\n", __FUNCTION__, t.tv_sec, t.tv_nsec, pnf_p7->sfn,pnf_p7->slot, req->SFN, req->Slot, buffer_index);
}
//filling slot buffer if(pnf_p7->slot_buffer[buffer_index].ul_tti_req != 0)
{
//NFAPI_TRACE(NFAPI_TRACE_NOTE, "[%d] Freeing ul_config_req at index %d (%d/%d)",
// pMyPhyInfo->sfnSf, bufferIdx,
// SFNSF2SFN(dreq->sfn_sf), SFNSF2SF(dreq->sfn_sf));
pnf_p7->slot_buffer[buffer_index].sfn = req->SFN; deallocate_nfapi_ul_tti_request(pnf_p7->slot_buffer[buffer_index].ul_tti_req, pnf_p7);
pnf_p7->slot_buffer[buffer_index].slot = req->Slot; }
pnf_p7->slot_buffer[buffer_index].ul_tti_req = req;
//filling slot buffer
pnf_p7->stats.ul_tti_ontime++; pnf_p7->slot_buffer[buffer_index].sfn = req->SFN;
} pnf_p7->slot_buffer[buffer_index].slot = req->Slot;
pnf_p7->slot_buffer[buffer_index].ul_tti_req = req;
pnf_p7->stats.ul_tti_ontime++;
}
else else
{ {
NFAPI_TRACE(NFAPI_TRACE_NOTE, "[%d] NOT storing ul_tti_req OUTSIDE OF TRANSMIT BUFFER WINDOW SFN/SLOT %d\n", NFAPI_SFNSLOT2DEC(pnf_p7->sfn,pnf_p7->slot), NFAPI_SFNSLOT2DEC(req->SFN,req->Slot)); NFAPI_TRACE(NFAPI_TRACE_NOTE, "[%d] NOT storing ul_tti_req OUTSIDE OF TRANSMIT BUFFER WINDOW SFN/SLOT %d\n", NFAPI_SFNSLOT2DEC(pnf_p7->sfn,pnf_p7->slot), NFAPI_SFNSLOT2DEC(req->SFN,req->Slot));
...@@ -2505,7 +2505,6 @@ void pnf_nr_handle_dl_node_sync(void *pRecvMsg, int recvMsgLen, pnf_p7_t* pnf_p7 ...@@ -2505,7 +2505,6 @@ void pnf_nr_handle_dl_node_sync(void *pRecvMsg, int recvMsgLen, pnf_p7_t* pnf_p7
return; return;
} }
if(pthread_mutex_lock(&(pnf_p7->mutex)) != 0) if(pthread_mutex_lock(&(pnf_p7->mutex)) != 0)
{ {
NFAPI_TRACE(NFAPI_TRACE_INFO, "failed to lock mutex\n"); NFAPI_TRACE(NFAPI_TRACE_INFO, "failed to lock mutex\n");
...@@ -2909,7 +2908,7 @@ void pnf_nfapi_p7_read_dispatch_message(pnf_p7_t* pnf_p7, uint32_t now_hr_time) ...@@ -2909,7 +2908,7 @@ void pnf_nfapi_p7_read_dispatch_message(pnf_p7_t* pnf_p7, uint32_t now_hr_time)
recvfrom_result = recvfrom(pnf_p7->p7_sock, pnf_p7->rx_message_buffer, pnf_p7->rx_message_buffer_size, recvfrom_result = recvfrom(pnf_p7->p7_sock, pnf_p7->rx_message_buffer, pnf_p7->rx_message_buffer_size,
MSG_DONTWAIT | MSG_TRUNC, (struct sockaddr*)&remote_addr, &remote_addr_size); MSG_DONTWAIT | MSG_TRUNC, (struct sockaddr*)&remote_addr, &remote_addr_size);
now_hr_time = pnf_get_current_time_hr(); //DJP - moved to here - get closer timestamp??? now_hr_time = pnf_get_current_time_hr(); //moved to here - get closer timestamp???
if(recvfrom_result > 0) if(recvfrom_result > 0)
{ {
...@@ -2976,7 +2975,7 @@ void pnf_nr_nfapi_p7_read_dispatch_message(pnf_p7_t* pnf_p7, uint32_t now_hr_tim ...@@ -2976,7 +2975,7 @@ void pnf_nr_nfapi_p7_read_dispatch_message(pnf_p7_t* pnf_p7, uint32_t now_hr_tim
// read the segment // read the segment
recvfrom_result = recvfrom(pnf_p7->p7_sock, pnf_p7->rx_message_buffer, header.message_length, MSG_DONTWAIT, (struct sockaddr*)&remote_addr, &remote_addr_size); recvfrom_result = recvfrom(pnf_p7->p7_sock, pnf_p7->rx_message_buffer, header.message_length, MSG_DONTWAIT, (struct sockaddr*)&remote_addr, &remote_addr_size);
now_hr_time = pnf_get_current_time_hr(); //DJP - moved to here - get closer timestamp??? now_hr_time = pnf_get_current_time_hr(); //moved to here - get closer timestamp???
if(recvfrom_result > 0) if(recvfrom_result > 0)
{ {
...@@ -3061,7 +3060,7 @@ int pnf_p7_message_pump(pnf_p7_t* pnf_p7) ...@@ -3061,7 +3060,7 @@ int pnf_p7_message_pump(pnf_p7_t* pnf_p7)
struct sockaddr_in addr; struct sockaddr_in addr;
memset(&addr, 0, sizeof(addr)); memset(&addr, 0, sizeof(addr));
addr.sin_family = AF_INET; addr.sin_family = AF_INET;
addr.sin_port = pnf_p7->_public.local_p7_port; addr.sin_port = htons(pnf_p7->_public.local_p7_port);
if(pnf_p7->_public.local_p7_addr == 0) if(pnf_p7->_public.local_p7_addr == 0)
{ {
...@@ -3233,7 +3232,7 @@ int pnf_nr_p7_message_pump(pnf_p7_t* pnf_p7) ...@@ -3233,7 +3232,7 @@ int pnf_nr_p7_message_pump(pnf_p7_t* pnf_p7)
struct sockaddr_in addr; struct sockaddr_in addr;
memset(&addr, 0, sizeof(addr)); memset(&addr, 0, sizeof(addr));
addr.sin_family = AF_INET; addr.sin_family = AF_INET;
addr.sin_port = pnf_p7->_public.local_p7_port; addr.sin_port = htons(pnf_p7->_public.local_p7_port);
if(pnf_p7->_public.local_p7_addr == 0) if(pnf_p7->_public.local_p7_addr == 0)
{ {
......
...@@ -27,8 +27,9 @@ typedef enum ...@@ -27,8 +27,9 @@ typedef enum
P7_VENDOR_EXT_REQ, P7_VENDOR_EXT_REQ,
P7_VENDOR_EXT_IND, P7_VENDOR_EXT_IND,
#if 1 /** TODO: FC Need clean up for OAI */ #if 1 /** TODO: FC Need clean up for OAI */
P7_CELL_SEARCH_IND P7_CELL_SEARCH_IND
#endif #endif
} vendor_ext_message_id_e; } vendor_ext_message_id_e;
typedef struct { typedef struct {
......
...@@ -950,16 +950,6 @@ int nfapi_vnf_p7_add_pnf(nfapi_vnf_p7_config_t* config, const char* pnf_p7_addr, ...@@ -950,16 +950,6 @@ int nfapi_vnf_p7_add_pnf(nfapi_vnf_p7_config_t* config, const char* pnf_p7_addr,
*/ */
int nfapi_vnf_p7_del_pnf(nfapi_vnf_p7_config_t* config, int phy_id); int nfapi_vnf_p7_del_pnf(nfapi_vnf_p7_config_t* config, int phy_id);
/*! Send the SLOT_IND.request
* \param config A pointer to the vnf p7 configuration
* \param req A data structure for the decoded SLOT_IND.request.
* \return A status value. 0 equal success, -1 indicates failure
*
* The caller is responsiable for memory management of any pointers set in the req, which
* may be released after this function call has returned or at a later pointer
*/
int nfapi_vnf_p7_nr_slot_ind(nfapi_vnf_p7_config_t* config, nfapi_nr_slot_indication_scf_t* req);
/*! Send the DL_CONFIG.request /*! Send the DL_CONFIG.request
* \param config A pointer to the vnf p7 configuration * \param config A pointer to the vnf p7 configuration
* \param req A data structure for the decoded DL_CONFIG.request. * \param req A data structure for the decoded DL_CONFIG.request.
......
...@@ -1511,7 +1511,7 @@ void vnf_handle_nr_slot_indication(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf ...@@ -1511,7 +1511,7 @@ void vnf_handle_nr_slot_indication(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf
} }
else else
{ {
NFAPI_TRACE(NFAPI_TRACE_DEBUG, "%s: Handling NR SLOT Indication sfn:%d slot:%d\n", __FUNCTION__, ind.sfn, ind.slot); NFAPI_TRACE(NFAPI_TRACE_DEBUG, "%s: Handling NR SLOT Indication\n", __FUNCTION__);
if(vnf_p7->_public.nr_slot_indication) if(vnf_p7->_public.nr_slot_indication)
{ {
(vnf_p7->_public.nr_slot_indication)(&ind); (vnf_p7->_public.nr_slot_indication)(&ind);
...@@ -1537,7 +1537,7 @@ void vnf_handle_nr_rx_data_indication(void *pRecvMsg, int recvMsgLen, vnf_p7_t* ...@@ -1537,7 +1537,7 @@ void vnf_handle_nr_rx_data_indication(void *pRecvMsg, int recvMsgLen, vnf_p7_t*
} }
else else
{ {
NFAPI_TRACE(NFAPI_TRACE_INFO, "%s: Handling RX Indication sfn:%d slot:%d\n", __FUNCTION__, ind.sfn, ind.slot); NFAPI_TRACE(NFAPI_TRACE_INFO, "%s: Handling RX Indication\n", __FUNCTION__);
if(vnf_p7->_public.nr_rx_data_indication) if(vnf_p7->_public.nr_rx_data_indication)
{ {
(vnf_p7->_public.nr_rx_data_indication)(&ind); (vnf_p7->_public.nr_rx_data_indication)(&ind);
...@@ -1563,7 +1563,7 @@ void vnf_handle_nr_crc_indication(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_ ...@@ -1563,7 +1563,7 @@ void vnf_handle_nr_crc_indication(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_
} }
else else
{ {
NFAPI_TRACE(NFAPI_TRACE_INFO, "%s: Handling CRC Indication sfn:%d slot:%d\n", __FUNCTION__, ind.sfn, ind.slot); NFAPI_TRACE(NFAPI_TRACE_INFO, "%s: Handling CRC Indication\n", __FUNCTION__);
if(vnf_p7->_public.nr_crc_indication) if(vnf_p7->_public.nr_crc_indication)
{ {
(vnf_p7->_public.nr_crc_indication)(&ind); (vnf_p7->_public.nr_crc_indication)(&ind);
...@@ -1589,7 +1589,6 @@ void vnf_handle_nr_srs_indication(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_ ...@@ -1589,7 +1589,6 @@ void vnf_handle_nr_srs_indication(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_
} }
else else
{ {
NFAPI_TRACE(NFAPI_TRACE_INFO, "%s: Handling SRS Indication sfn:%d slot:%d\n", __FUNCTION__, ind.sfn, ind.slot);
if(vnf_p7->_public.nr_srs_indication) if(vnf_p7->_public.nr_srs_indication)
{ {
(vnf_p7->_public.nr_srs_indication)(&ind); (vnf_p7->_public.nr_srs_indication)(&ind);
...@@ -1615,7 +1614,7 @@ void vnf_handle_nr_uci_indication(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_ ...@@ -1615,7 +1614,7 @@ void vnf_handle_nr_uci_indication(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_
} }
else else
{ {
NFAPI_TRACE(NFAPI_TRACE_INFO, "%s: Handling UCI Indication sfn:%d slot:%d\n", __FUNCTION__, ind.sfn, ind.slot); NFAPI_TRACE(NFAPI_TRACE_INFO, "%s: Handling UCI Indication\n", __FUNCTION__);
if(vnf_p7->_public.nr_uci_indication) if(vnf_p7->_public.nr_uci_indication)
{ {
(vnf_p7->_public.nr_uci_indication)(&ind); (vnf_p7->_public.nr_uci_indication)(&ind);
...@@ -1641,7 +1640,7 @@ void vnf_handle_nr_rach_indication(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf ...@@ -1641,7 +1640,7 @@ void vnf_handle_nr_rach_indication(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf
} }
else else
{ {
NFAPI_TRACE(NFAPI_TRACE_INFO, "%s: Handling RACH Indication sfn:%d slot:%d\n", __FUNCTION__, ind.sfn, ind.slot); NFAPI_TRACE(NFAPI_TRACE_INFO, "%s: Handling RACH Indication\n", __FUNCTION__);
if(vnf_p7->_public.nr_rach_indication) if(vnf_p7->_public.nr_rach_indication)
{ {
(vnf_p7->_public.nr_rach_indication)(&ind); (vnf_p7->_public.nr_rach_indication)(&ind);
......
...@@ -668,16 +668,6 @@ int nfapi_vnf_p7_del_pnf(nfapi_vnf_p7_config_t* config, int phy_id) ...@@ -668,16 +668,6 @@ int nfapi_vnf_p7_del_pnf(nfapi_vnf_p7_config_t* config, int phy_id)
return 0; return 0;
} }
int nfapi_vnf_p7_nr_slot_ind(nfapi_vnf_p7_config_t* config, nfapi_nr_slot_indication_scf_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);
}
int nfapi_vnf_p7_dl_config_req(nfapi_vnf_p7_config_t* config, nfapi_dl_config_request_t* req) int nfapi_vnf_p7_dl_config_req(nfapi_vnf_p7_config_t* config, nfapi_dl_config_request_t* req)
{ {
//NFAPI_TRACE(NFAPI_TRACE_INFO, "%s(config:%p req:%p)\n", __FUNCTION__, config, req); //NFAPI_TRACE(NFAPI_TRACE_INFO, "%s(config:%p req:%p)\n", __FUNCTION__, config, req);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment