Merge remote-tracking branch 'origin/develop' into develop-SRS
# Conflicts: # ci-scripts/conf_files/gnb.band78.sa.fr1.106PRB.usrpn310.conf # ci-scripts/conf_files/gnb.band78.sa.fr1.162PRB.2x2.usrpn310.conf # openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c # openair2/RRC/NR/L2_nr_interface.c
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
#include "gnb_ind_vars.h"
|
||||
|
||||
queue_t gnb_rach_ind_queue;
|
||||
queue_t gnb_rx_ind_queue;
|
||||
queue_t gnb_crc_ind_queue;
|
||||
queue_t gnb_uci_ind_queue;
|
||||
queue_t gnb_slot_ind_queue;
|
||||
@@ -0,0 +1,9 @@
|
||||
#pragma once
|
||||
|
||||
#include "openair2/PHY_INTERFACE/queue_t.h"
|
||||
|
||||
extern queue_t gnb_rach_ind_queue;
|
||||
extern queue_t gnb_rx_ind_queue;
|
||||
extern queue_t gnb_crc_ind_queue;
|
||||
extern queue_t gnb_uci_ind_queue;
|
||||
extern queue_t gnb_slot_ind_queue;
|
||||
@@ -23,7 +23,15 @@
|
||||
#include <pthread.h>
|
||||
#include "nfapi/oai_integration/vendor_ext.h"
|
||||
#include "common/utils/LOG/log.h"
|
||||
static char nfapi_str_mode[6][24] = {"MONOLITHIC","PNF","VNF","UE_STUB_PNF","UE_STUB_OFFNET","<UNKNOWN NFAPI MODE>"};
|
||||
static const char *const nfapi_str_mode[] = {
|
||||
"MONOLITHIC",
|
||||
"PNF",
|
||||
"VNF",
|
||||
"UE_STUB_PNF",
|
||||
"UE_STUB_OFFNET",
|
||||
"STANDALONE_PNF",
|
||||
"<UNKNOWN NFAPI MODE>"
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
nfapi_mode_t nfapi_mode;
|
||||
@@ -32,15 +40,9 @@ typedef struct {
|
||||
static nfapi_params_t nfapi_params = {0};
|
||||
|
||||
void set_thread_priority(int priority) {
|
||||
//printf("%s(priority:%d)\n", __FUNCTION__, priority);
|
||||
set_priority(priority);
|
||||
|
||||
pthread_attr_t ptAttr;
|
||||
struct sched_param schedParam;
|
||||
schedParam.__sched_priority = priority; //79;
|
||||
|
||||
if(sched_setscheduler(0, SCHED_RR, &schedParam) != 0) {
|
||||
printf("Failed to set scheduler to SCHED_RR\n");
|
||||
}
|
||||
|
||||
if(pthread_attr_setschedpolicy(&ptAttr, SCHED_RR) != 0) {
|
||||
printf("Failed to set pthread sched policy SCHED_RR\n");
|
||||
}
|
||||
@@ -54,7 +56,7 @@ void set_thread_priority(int priority) {
|
||||
}
|
||||
}
|
||||
|
||||
char *nfapi_get_strmode(void) {
|
||||
const char *nfapi_get_strmode(void) {
|
||||
if (nfapi_params.nfapi_mode > NFAPI_MODE_UNKNOWN)
|
||||
return nfapi_str_mode[NFAPI_MODE_UNKNOWN];
|
||||
|
||||
|
||||
@@ -218,14 +218,9 @@ void pnf_nfapi_trace(nfapi_trace_level_t nfapi_level, const char *message, ...)
|
||||
}
|
||||
|
||||
void pnf_set_thread_priority(int priority) {
|
||||
set_priority(priority);
|
||||
|
||||
pthread_attr_t ptAttr;
|
||||
struct sched_param schedParam;
|
||||
schedParam.__sched_priority = priority;
|
||||
|
||||
if(sched_setscheduler(0, SCHED_RR, &schedParam) != 0) {
|
||||
printf("failed to set SCHED_RR\n");
|
||||
}
|
||||
|
||||
if(pthread_attr_setschedpolicy(&ptAttr, SCHED_RR) != 0) {
|
||||
printf("failed to set pthread SCHED_RR %d\n", errno);
|
||||
}
|
||||
@@ -248,7 +243,7 @@ void *pnf_p7_thread_start(void *ptr) {
|
||||
}
|
||||
|
||||
void *pnf_nr_p7_thread_start(void *ptr) {
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "[PNF] P7 THREAD %s\n", __FUNCTION__);
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "[NR_PNF] NR P7 THREAD %s\n", __FUNCTION__);
|
||||
pnf_set_thread_priority(79);
|
||||
nfapi_pnf_p7_config_t *config = (nfapi_pnf_p7_config_t *)ptr;
|
||||
nfapi_nr_pnf_p7_start(config);
|
||||
@@ -805,7 +800,7 @@ int config_request(nfapi_pnf_config_t *config, nfapi_pnf_phy_config_t *phy, nfap
|
||||
// to keep only the necessary just to keep the nfapi FSM rolling by sending a dummy response.
|
||||
LTE_DL_FRAME_PARMS *fp;
|
||||
|
||||
if (NFAPI_MODE!=NFAPI_UE_STUB_PNF) {
|
||||
if (NFAPI_MODE!=NFAPI_UE_STUB_PNF && NFAPI_MODE!=NFAPI_MODE_STANDALONE_PNF) {
|
||||
struct PHY_VARS_eNB_s *eNB = RC.eNB[0][0];
|
||||
fp = &eNB->frame_parms;
|
||||
} else {
|
||||
@@ -967,7 +962,7 @@ int config_request(nfapi_pnf_config_t *config, nfapi_pnf_phy_config_t *phy, nfap
|
||||
num_tlv++;
|
||||
}
|
||||
|
||||
if(NFAPI_MODE!=NFAPI_UE_STUB_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] Simulating PHY CONFIG - DJP\n");
|
||||
PHY_Config_t phy_config;
|
||||
@@ -991,7 +986,7 @@ int config_request(nfapi_pnf_config_t *config, nfapi_pnf_phy_config_t *phy, nfap
|
||||
nfapi_pnf_config_resp(config, &nfapi_resp);
|
||||
printf("[PNF] Sent NFAPI_CONFIG_RESPONSE phy_id:%d\n", phy_info->id);
|
||||
|
||||
if(NFAPI_MODE==NFAPI_UE_STUB_PNF)
|
||||
if(NFAPI_MODE==NFAPI_UE_STUB_PNF || NFAPI_MODE==NFAPI_MODE_STANDALONE_PNF)
|
||||
free(fp);
|
||||
|
||||
return 0;
|
||||
@@ -1226,15 +1221,15 @@ int pnf_phy_dl_tti_req(gNB_L1_rxtx_proc_t *proc, nfapi_pnf_p7_config_t *pnf_p7,
|
||||
proc = &gNB->proc.L1_proc;
|
||||
nfapi_nr_dl_tti_request_pdu_t *dl_tti_pdu_list = req->dl_tti_request_body.dl_tti_pdu_list;
|
||||
|
||||
//if (req->dl_tti_request_body.nPDUs)
|
||||
// NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() TX:%d/%d RX:%d/%d; sfn:%d, slot:%d, nGroup:%u, nPDUs: %u, nUE: %u, PduIdx: %u,\n",
|
||||
// __FUNCTION__, proc->frame_tx, proc->slot_tx, proc->frame_rx, proc->slot_rx, // TODO: change subframes to slot
|
||||
// req->SFN,
|
||||
// req->Slot,
|
||||
// req->dl_tti_request_body.nGroup,
|
||||
// req->dl_tti_request_body.nPDUs,
|
||||
// req->dl_tti_request_body.nUe,
|
||||
// req->dl_tti_request_body.PduIdx);
|
||||
if (req->dl_tti_request_body.nPDUs)
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() TX:%d/%d RX:%d/%d; sfn:%d, slot:%d, nGroup:%u, nPDUs: %u, nUE: %p, PduIdx: %p,\n",
|
||||
__FUNCTION__, proc->frame_tx, proc->slot_tx, proc->frame_rx, proc->slot_rx, // TODO: change subframes to slot
|
||||
req->SFN,
|
||||
req->Slot,
|
||||
req->dl_tti_request_body.nGroup,
|
||||
req->dl_tti_request_body.nPDUs,
|
||||
req->dl_tti_request_body.nUe,
|
||||
req->dl_tti_request_body.PduIdx);
|
||||
|
||||
for (int i=0; i<req->dl_tti_request_body.nPDUs; i++) {
|
||||
// NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() sfn/sf:%d PDU[%d] size:%d pdcch_vars->num_dci:%d\n", __FUNCTION__, NFAPI_SFNSF2DEC(req->sfn_sf), i, dl_config_pdu_list[i].pdu_size,pdcch_vars->num_dci);
|
||||
@@ -1250,10 +1245,10 @@ int pnf_phy_dl_tti_req(gNB_L1_rxtx_proc_t *proc, nfapi_pnf_p7_config_t *pnf_p7,
|
||||
//NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() PDU:%d BCH: pdu_index:%u pdu_length:%d sdu_length:%d BCH_SDU:%x,%x,%x\n", __FUNCTION__, i, pdu_index, bch_pdu->bch_pdu_rel8.length, tx_request_pdu[sfn][sf][pdu_index]->segments[0].segment_length, sdu[0], sdu[1], sdu[2]);
|
||||
handle_nr_nfapi_ssb_pdu(msgTx, sfn, slot, &dl_tti_pdu_list[i]);
|
||||
gNB->pbch_configured=1;
|
||||
}
|
||||
}
|
||||
else if (dl_tti_pdu_list[i].PDUType == NFAPI_NR_DL_TTI_PDSCH_PDU_TYPE) {
|
||||
nfapi_nr_dl_tti_pdsch_pdu *pdsch_pdu = &dl_tti_pdu_list[i].pdsch_pdu;
|
||||
nfapi_nr_dl_tti_pdsch_pdu_rel15_t *rel15_pdu = &pdsch_pdu->pdsch_pdu_rel15;
|
||||
nfapi_nr_dl_tti_pdsch_pdu_rel15_t *rel15_pdu = &pdsch_pdu->pdsch_pdu_rel15;
|
||||
nfapi_nr_pdu_t *tx_data = tx_data_request[sfn][slot][rel15_pdu->pduIndex];
|
||||
|
||||
if (tx_data != NULL) {
|
||||
@@ -1466,6 +1461,7 @@ int pnf_phy_ul_tti_req(gNB_L1_rxtx_proc_t *proc, nfapi_pnf_p7_config_t *pnf_p7,
|
||||
switch (ul_tti_pdu_list[i].pdu_type) {
|
||||
case NFAPI_NR_UL_CONFIG_PUSCH_PDU_TYPE:
|
||||
//LOG_D(PHY,"frame %d, slot %d, Got NFAPI_NR_UL_TTI_PUSCH_PDU_TYPE for %d.%d\n", frame, slot, UL_tti_req->SFN, UL_tti_req->Slot);
|
||||
//curr_sfn = curr_sfn + 3; //Gokul
|
||||
nr_fill_ulsch(gNB,curr_sfn, curr_slot, &ul_tti_pdu_list[i].pusch_pdu);
|
||||
break;
|
||||
case NFAPI_NR_UL_CONFIG_PUCCH_PDU_TYPE:
|
||||
@@ -1661,7 +1657,6 @@ nfapi_pnf_p7_subframe_buffer_t dummy_subframe;
|
||||
|
||||
int start_request(nfapi_pnf_config_t *config, nfapi_pnf_phy_config_t *phy, nfapi_start_request_t *req) {
|
||||
printf("[PNF] Received NFAPI_START_REQ phy_id:%d\n", req->header.phy_id);
|
||||
nfapi_set_trace_level(NFAPI_TRACE_INFO);
|
||||
pnf_info *pnf = (pnf_info *)(config->user_data);
|
||||
phy_info *phy_info = pnf->phys;
|
||||
nfapi_pnf_p7_config_t *p7_config = nfapi_pnf_p7_config_create();
|
||||
@@ -1697,11 +1692,11 @@ int start_request(nfapi_pnf_config_t *config, nfapi_pnf_phy_config_t *phy, nfapi
|
||||
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) {
|
||||
p7_config->dl_config_req = &memcpy_dl_config_req;
|
||||
p7_config->ul_config_req = &memcpy_ul_config_req;
|
||||
p7_config->hi_dci0_req = &memcpy_hi_dci0_req;
|
||||
p7_config->tx_req = &memcpy_tx_req;
|
||||
if (NFAPI_MODE==NFAPI_UE_STUB_PNF || NFAPI_MODE==NFAPI_MODE_STANDALONE_PNF) {
|
||||
p7_config->dl_config_req = NULL;
|
||||
p7_config->ul_config_req = NULL;
|
||||
p7_config->hi_dci0_req = NULL;
|
||||
p7_config->tx_req = NULL;
|
||||
} else {
|
||||
p7_config->dl_config_req = &pnf_phy_dl_config_req;
|
||||
p7_config->ul_config_req = &pnf_phy_ul_config_req;
|
||||
@@ -1754,7 +1749,7 @@ int start_request(nfapi_pnf_config_t *config, nfapi_pnf_phy_config_t *phy, nfapi
|
||||
//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 && NFAPI_MODE!=NFAPI_MODE_STANDALONE_PNF) {
|
||||
init_eNB_afterRU();
|
||||
}
|
||||
|
||||
@@ -1781,7 +1776,6 @@ int start_request(nfapi_pnf_config_t *config, nfapi_pnf_phy_config_t *phy, nfapi
|
||||
|
||||
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);
|
||||
nfapi_set_trace_level(NFAPI_TRACE_INFO);
|
||||
pnf_info *pnf = (pnf_info *)(config->user_data);
|
||||
phy_info *phy_info = pnf->phys;
|
||||
nfapi_pnf_p7_config_t *p7_config = nfapi_pnf_p7_config_create();
|
||||
@@ -1827,10 +1821,10 @@ 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;
|
||||
p7_config->ue_release_req = &pnf_phy_ue_release_req;
|
||||
if (NFAPI_MODE==NFAPI_UE_STUB_PNF) {
|
||||
p7_config->dl_config_req = &memcpy_dl_config_req;
|
||||
p7_config->ul_config_req = &memcpy_ul_config_req;
|
||||
p7_config->hi_dci0_req = &memcpy_hi_dci0_req;
|
||||
p7_config->tx_req = &memcpy_tx_req;
|
||||
p7_config->dl_config_req = NULL;
|
||||
p7_config->ul_config_req = NULL;
|
||||
p7_config->hi_dci0_req = NULL;
|
||||
p7_config->tx_req = NULL;
|
||||
} else {
|
||||
p7_config->dl_config_req = &pnf_phy_dl_config_req;
|
||||
p7_config->ul_config_req = &pnf_phy_ul_config_req;
|
||||
@@ -2232,7 +2226,7 @@ void configure_nr_nfapi_pnf(char *vnf_ip_addr, int vnf_p5_port, char *pnf_ip_add
|
||||
void configure_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__);
|
||||
|
||||
if(NFAPI_MODE!=NFAPI_UE_STUB_PNF) {
|
||||
if(NFAPI_MODE!=NFAPI_UE_STUB_PNF && NFAPI_MODE!=NFAPI_MODE_STANDALONE_PNF) {
|
||||
nfapi_setmode(NFAPI_MODE_PNF); // PNF!
|
||||
}
|
||||
nfapi_pnf_config_t *config = nfapi_pnf_config_create();
|
||||
@@ -2286,15 +2280,13 @@ void oai_subframe_ind(uint16_t sfn, uint16_t sf) {
|
||||
uint16_t sfn_sf_tx = sfn<<4 | sf;
|
||||
|
||||
if ((sfn % 100 == 0) && sf==0) {
|
||||
struct timespec ts;
|
||||
clock_gettime(CLOCK_MONOTONIC, &ts);
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "[PNF] %s %d.%d (sfn:%u sf:%u) SFN/SF(TX):%u\n", __FUNCTION__, ts.tv_sec, ts.tv_nsec, sfn, sf, NFAPI_SFNSF2DEC(sfn_sf_tx));
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "[PNF] (sfn:%u sf:%u) SFN/SF(TX):%u\n", sfn, sf, NFAPI_SFNSF2DEC(sfn_sf_tx));
|
||||
}
|
||||
|
||||
int subframe_ret = nfapi_pnf_p7_subframe_ind(p7_config_g, p7_config_g->phy_id, sfn_sf_tx);
|
||||
|
||||
if (subframe_ret) {
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "[PNF] %s(frame:%u subframe:%u) SFN/SF(TX):%u - PROBLEM with pnf_p7_subframe_ind()\n", __FUNCTION__, sfn, sf, sfn_sf_tx, NFAPI_SFNSF2DEC(sfn_sf_tx));
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "[PNF] (frame:%u subframe:%u) SFN/SF(TX):%u - PROBLEM with pnf_p7_subframe_ind()\n", sfn, sf, sfn_sf_tx);
|
||||
} else {
|
||||
//NFAPI_TRACE(NFAPI_TRACE_INFO, "***NFAPI subframe handler finished *** \n");
|
||||
}
|
||||
|
||||
+521
-298
File diff suppressed because it is too large
Load Diff
@@ -70,10 +70,11 @@ typedef enum {
|
||||
NFAPI_MODE_VNF,
|
||||
NFAPI_UE_STUB_PNF,
|
||||
NFAPI_UE_STUB_OFFNET,
|
||||
NFAPI_MODE_STANDALONE_PNF,
|
||||
NFAPI_MODE_UNKNOWN
|
||||
} nfapi_mode_t;
|
||||
|
||||
char *nfapi_get_strmode(void);
|
||||
const char *nfapi_get_strmode(void);
|
||||
void nfapi_logmode(void);
|
||||
nfapi_mode_t nfapi_getmode(void);
|
||||
void nfapi_setmode(nfapi_mode_t nfapi_mode);
|
||||
|
||||
@@ -14,38 +14,31 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef _DEBUG_H_
|
||||
#define _DEBUG_H_
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
|
||||
#define ERR strerror(errno)
|
||||
|
||||
/*! The trace levels used by the nfapi libraries */
|
||||
typedef enum nfapi_trace_level
|
||||
{
|
||||
NFAPI_TRACE_ERROR = 1,
|
||||
NFAPI_TRACE_WARN,
|
||||
NFAPI_TRACE_NOTE,
|
||||
NFAPI_TRACE_INFO,
|
||||
|
||||
NFAPI_TRACE_LEVEL_MAX
|
||||
NFAPI_TRACE_NONE,
|
||||
NFAPI_TRACE_ERROR,
|
||||
NFAPI_TRACE_WARN,
|
||||
NFAPI_TRACE_NOTE,
|
||||
NFAPI_TRACE_INFO,
|
||||
NFAPI_TRACE_DEBUG,
|
||||
} nfapi_trace_level_t;
|
||||
|
||||
/*! The trace function pointer */
|
||||
typedef void (*nfapi_trace_fn_t)(nfapi_trace_level_t level, const char* format, ...);
|
||||
void nfapi_trace(nfapi_trace_level_t, char const *caller, const char *format, ...)
|
||||
__attribute__((format(printf, 3, 4)));
|
||||
|
||||
/*! Global trace function */
|
||||
extern nfapi_trace_fn_t nfapi_trace_g;
|
||||
nfapi_trace_level_t nfapi_trace_level(void);
|
||||
|
||||
/*! Global trace level */
|
||||
extern nfapi_trace_level_t nfapi_trace_level_g;
|
||||
#define NFAPI_TRACE(LEVEL, FORMAT, ...) do { \
|
||||
if (nfapi_trace_level() >= (LEVEL)) \
|
||||
nfapi_trace(LEVEL, __func__, FORMAT, ##__VA_ARGS__); \
|
||||
} while (0)
|
||||
|
||||
/*! NFAPI trace macro */
|
||||
//#define NFAPI_TRACE(level, format, ...) { if(nfapi_trace_g && ((nfapi_trace_level_t)level <= nfapi_trace_level_g)) (*nfapi_trace_g)(level, format, ##__VA_ARGS__); }
|
||||
#define NFAPI_TRACE(level, format, ...) { if (nfapi_trace_g) (*nfapi_trace_g)(level, format, ##__VA_ARGS__); }
|
||||
|
||||
/*! Function to change the trace level
|
||||
* \param new_level The modified trace level
|
||||
*/
|
||||
|
||||
void nfapi_set_trace_level(nfapi_trace_level_t new_level);
|
||||
|
||||
#endif /* _DEBUG_H_ */
|
||||
|
||||
@@ -1,75 +1,87 @@
|
||||
/*
|
||||
* Copyright 2017 Cisco Systems, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/types.h>
|
||||
#include <pthread.h>
|
||||
#include <syslog.h>
|
||||
|
||||
#include <debug.h>
|
||||
|
||||
#define MAX_MSG_LENGTH 2096
|
||||
#define TRACE_HEADER_LENGTH 44
|
||||
|
||||
void nfapi_trace_dbg(nfapi_trace_level_t level, const char *format, ...);
|
||||
|
||||
// initialize the trace function to 0
|
||||
void (*nfapi_trace_g)(nfapi_trace_level_t level, const char* format, ...) = &nfapi_trace_dbg;
|
||||
|
||||
nfapi_trace_level_t nfapi_trace_level_g = NFAPI_TRACE_INFO;
|
||||
//nfapi_trace_level_t nfapi_trace_level_g = NFAPI_TRACE_WARN;
|
||||
|
||||
void nfapi_set_trace_level(nfapi_trace_level_t new_level)
|
||||
{
|
||||
nfapi_trace_level_g = new_level;
|
||||
}
|
||||
|
||||
void nfapi_trace_dbg(nfapi_trace_level_t level, const char *format, ...)
|
||||
{
|
||||
char trace_buff[MAX_MSG_LENGTH + TRACE_HEADER_LENGTH];
|
||||
uint32_t num_chars;
|
||||
va_list p_args;
|
||||
struct timeval tv;
|
||||
pthread_t tid = pthread_self();
|
||||
|
||||
(void)gettimeofday(&tv, NULL);
|
||||
|
||||
num_chars = (uint32_t)snprintf(trace_buff, TRACE_HEADER_LENGTH, "%04u.%06u: 0x%02x: %10u: ", ((uint32_t)tv.tv_sec) & 0x1FFF, (uint32_t)tv.tv_usec, (uint32_t)level, (uint32_t)tid);
|
||||
|
||||
if (num_chars > TRACE_HEADER_LENGTH)
|
||||
{
|
||||
printf("trace_dbg: Error, num_chars is too large: %d", num_chars);
|
||||
return;
|
||||
}
|
||||
|
||||
va_start(p_args, format);
|
||||
if ((num_chars = (uint32_t)vsnprintf(&trace_buff[num_chars], MAX_MSG_LENGTH, format, p_args)))
|
||||
{
|
||||
if (level <= NFAPI_TRACE_WARN)
|
||||
{
|
||||
printf("%s", trace_buff);
|
||||
}
|
||||
printf("%s", trace_buff);
|
||||
}
|
||||
va_end(p_args);
|
||||
}
|
||||
/*
|
||||
* Copyright 2017 Cisco Systems, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "debug.h"
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
#include <pthread.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
static nfapi_trace_level_t trace_level = NFAPI_TRACE_WARN;
|
||||
|
||||
static void nfapi_trace_init(void)
|
||||
{
|
||||
static bool initialized;
|
||||
if (initialized)
|
||||
return;
|
||||
initialized = true;
|
||||
|
||||
const char *env = getenv("NFAPI_TRACE_LEVEL");
|
||||
if (!env)
|
||||
return;
|
||||
if (strcmp(env, "none") == 0)
|
||||
trace_level = NFAPI_TRACE_NONE;
|
||||
else if (strcmp(env, "error") == 0)
|
||||
trace_level = NFAPI_TRACE_ERROR;
|
||||
else if (strcmp(env, "warn") == 0)
|
||||
trace_level = NFAPI_TRACE_WARN;
|
||||
else if (strcmp(env, "note") == 0)
|
||||
trace_level = NFAPI_TRACE_NOTE;
|
||||
else if (strcmp(env, "info") == 0)
|
||||
trace_level = NFAPI_TRACE_INFO;
|
||||
else if (strcmp(env, "debug") == 0)
|
||||
trace_level = NFAPI_TRACE_DEBUG;
|
||||
else
|
||||
{
|
||||
nfapi_trace(NFAPI_TRACE_ERROR, __func__, "Invalid NFAPI_TRACE_LEVEL='%s'", env);
|
||||
return;
|
||||
}
|
||||
nfapi_trace(trace_level, __func__, "NFAPI_TRACE_LEVEL='%s'", env);
|
||||
}
|
||||
|
||||
nfapi_trace_level_t nfapi_trace_level()
|
||||
{
|
||||
nfapi_trace_init();
|
||||
return trace_level;
|
||||
}
|
||||
|
||||
void nfapi_trace(nfapi_trace_level_t level,
|
||||
char const *caller,
|
||||
char const *format, ...)
|
||||
{
|
||||
struct timespec ts;
|
||||
clock_gettime(CLOCK_MONOTONIC, &ts);
|
||||
printf("%ld%06ld [%c] %10u: %s: ",
|
||||
ts.tv_sec,
|
||||
ts.tv_nsec / 1000,
|
||||
"XEWNID"[level], // NFAPI_TRACE_NONE, NFAPI_TRACE_ERROR, ...
|
||||
(unsigned) pthread_self(),
|
||||
caller);
|
||||
|
||||
va_list ap;
|
||||
va_start(ap, format);
|
||||
vprintf(format, ap);
|
||||
va_end(ap);
|
||||
|
||||
// Add a newline if the format string didn't have one
|
||||
int len = strlen(format);
|
||||
if (len == 0 || format[len - 1] != '\n')
|
||||
putchar('\n');
|
||||
|
||||
fflush(stdout);
|
||||
}
|
||||
|
||||
@@ -118,11 +118,18 @@ typedef struct {
|
||||
short rsrp_dBm;
|
||||
} fapi_nr_ssb_pdu_t;
|
||||
|
||||
typedef struct {
|
||||
uint32_t pdu_length;
|
||||
uint8_t* pdu;
|
||||
uint32_t sibs_mask;
|
||||
} fapi_nr_sib_pdu_t;
|
||||
|
||||
typedef struct {
|
||||
uint8_t pdu_type;
|
||||
union {
|
||||
fapi_nr_pdsch_pdu_t pdsch_pdu;
|
||||
fapi_nr_ssb_pdu_t ssb_pdu;
|
||||
fapi_nr_sib_pdu_t sib_pdu;
|
||||
};
|
||||
} fapi_nr_rx_indication_body_t;
|
||||
|
||||
@@ -429,8 +436,11 @@ typedef struct {
|
||||
uint8_t tb2_rv;
|
||||
uint8_t harq_process_nbr;
|
||||
vrb_to_prb_mapping_t vrb_to_prb_mapping;
|
||||
uint8_t dai;
|
||||
double scaling_factor_S;
|
||||
int8_t accumulated_delta_PUCCH;
|
||||
uint8_t pucch_resource_id;
|
||||
uint8_t pdsch_to_harq_feedback_time_ind;
|
||||
uint8_t n_dmrs_cdm_groups;
|
||||
uint8_t dmrs_ports[10];
|
||||
uint8_t n_front_load_symb;
|
||||
@@ -477,6 +487,437 @@ typedef struct {
|
||||
} fapi_nr_dl_config_request_t;
|
||||
|
||||
|
||||
//
|
||||
// P5
|
||||
//
|
||||
|
||||
|
||||
|
||||
typedef struct {
|
||||
fapi_nr_coreset_t coreset;
|
||||
|
||||
uint8_t monitoring_slot_peridicity;
|
||||
uint8_t monitoring_slot_offset;
|
||||
uint16_t duration;
|
||||
uint16_t monitoring_symbols_within_slot;
|
||||
uint8_t number_of_candidates[5]; // aggregation level 1, 2, 4, 8, 16
|
||||
|
||||
uint8_t dci_2_0_number_of_candidates[5]; // aggregation level 1, 2, 4, 8, 16
|
||||
uint8_t dci_2_3_monitorying_periodicity;
|
||||
uint8_t dci_2_3_number_of_candidates;
|
||||
|
||||
} fapi_nr_search_space_t;
|
||||
|
||||
typedef struct {
|
||||
fapi_nr_search_space_t search_space_sib1;
|
||||
fapi_nr_search_space_t search_space_others_sib;
|
||||
fapi_nr_search_space_t search_space_paging;
|
||||
//fapi_nr_coreset_t coreset_ra; // common coreset
|
||||
fapi_nr_search_space_t search_space_ra;
|
||||
} fapi_nr_pdcch_config_common_t;
|
||||
|
||||
typedef struct {
|
||||
uint8_t k0;
|
||||
uint8_t mapping_type;
|
||||
uint8_t symbol_starting;
|
||||
uint8_t symbol_length;
|
||||
} fapi_nr_pdsch_time_domain_resource_allocation_t;
|
||||
|
||||
typedef struct {
|
||||
fapi_nr_pdsch_time_domain_resource_allocation_t allocation_list[FAPI_NR_MAX_NUM_DL_ALLOCATIONS];
|
||||
} fapi_nr_pdsch_config_common_t;
|
||||
|
||||
typedef struct {
|
||||
uint8_t prach_configuration_index;
|
||||
uint8_t msg1_fdm;
|
||||
uint8_t msg1_frequency_start;
|
||||
uint8_t zero_correlation_zone_config;
|
||||
uint8_t preamble_received_target_power;
|
||||
uint8_t preamble_transmission_max;
|
||||
uint8_t power_ramping_step;
|
||||
uint8_t ra_window_size;
|
||||
|
||||
uint8_t total_number_of_preamble;
|
||||
uint8_t ssb_occasion_per_rach;
|
||||
uint8_t cb_preamble_per_ssb;
|
||||
|
||||
uint8_t group_a_msg3_size;
|
||||
uint8_t group_a_number_of_preamble;
|
||||
uint8_t group_b_power_offset;
|
||||
uint8_t contention_resolution_timer;
|
||||
uint8_t rsrp_threshold_ssb;
|
||||
uint8_t rsrp_threshold_ssb_sul;
|
||||
uint8_t prach_length; // l839, l139
|
||||
uint8_t prach_root_sequence_index; // 0 - 837 for l839, 0 - 137 for l139
|
||||
uint8_t msg1_subcarrier_spacing;
|
||||
uint8_t restrictedset_config;
|
||||
uint8_t msg3_transform_precoding;
|
||||
} fapi_nr_rach_config_common_t;
|
||||
|
||||
typedef struct {
|
||||
uint8_t k2;
|
||||
uint8_t mapping_type;
|
||||
uint8_t symbol_starting;
|
||||
uint8_t symbol_length;
|
||||
} fapi_nr_pusch_time_domain_resource_allocation_t;
|
||||
|
||||
typedef struct {
|
||||
uint8_t group_hopping_enabled_transform_precoding;
|
||||
fapi_nr_pusch_time_domain_resource_allocation_t allocation_list[FAPI_NR_MAX_NUM_UL_ALLOCATIONS];
|
||||
uint8_t msg3_delta_preamble;
|
||||
uint8_t p0_nominal_with_grant;
|
||||
} fapi_nr_pusch_config_common_t;
|
||||
|
||||
typedef struct {
|
||||
uint8_t pucch_resource_common;
|
||||
uint8_t pucch_group_hopping;
|
||||
uint8_t hopping_id;
|
||||
uint8_t p0_nominal;
|
||||
} fapi_nr_pucch_config_common_t;
|
||||
|
||||
typedef struct {
|
||||
|
||||
fapi_nr_pdcch_config_common_t pdcch_config_common;
|
||||
fapi_nr_pdsch_config_common_t pdsch_config_common;
|
||||
|
||||
} fapi_nr_dl_bwp_common_config_t;
|
||||
|
||||
|
||||
|
||||
typedef struct {
|
||||
uint16_t int_rnti;
|
||||
uint8_t time_frequency_set;
|
||||
uint8_t dci_payload_size;
|
||||
uint8_t serving_cell_id[FAPI_NR_MAX_NUM_SERVING_CELLS]; // interrupt configuration per serving cell
|
||||
uint8_t position_in_dci[FAPI_NR_MAX_NUM_SERVING_CELLS]; // interrupt configuration per serving cell
|
||||
} fapi_nr_downlink_preemption_t;
|
||||
|
||||
typedef struct {
|
||||
uint8_t tpc_index;
|
||||
uint8_t tpc_index_sul;
|
||||
uint8_t target_cell;
|
||||
} fapi_nr_pusch_tpc_command_config_t;
|
||||
|
||||
typedef struct {
|
||||
uint8_t tpc_index_pcell;
|
||||
uint8_t tpc_index_pucch_scell;
|
||||
} fapi_nr_pucch_tpc_command_config_t;
|
||||
|
||||
typedef struct {
|
||||
uint8_t starting_bit_of_format_2_3;
|
||||
uint8_t feild_type_format_2_3;
|
||||
} fapi_nr_srs_tpc_command_config_t;
|
||||
|
||||
typedef struct {
|
||||
fapi_nr_downlink_preemption_t downlink_preemption;
|
||||
fapi_nr_pusch_tpc_command_config_t tpc_pusch;
|
||||
fapi_nr_pucch_tpc_command_config_t tpc_pucch;
|
||||
fapi_nr_srs_tpc_command_config_t tpc_srs;
|
||||
} fapi_nr_pdcch_config_dedicated_t;
|
||||
|
||||
typedef struct {
|
||||
uint8_t dmrs_type;
|
||||
uint8_t dmrs_addition_position;
|
||||
uint8_t max_length;
|
||||
uint16_t scrambling_id0;
|
||||
uint16_t scrambling_id1;
|
||||
uint8_t ptrs_frequency_density[2]; // phase tracking rs
|
||||
uint8_t ptrs_time_density[3]; // phase tracking rs
|
||||
uint8_t ptrs_epre_ratio; // phase tracking rs
|
||||
uint8_t ptrs_resource_element_offset; // phase tracking rs
|
||||
} fapi_nr_dmrs_downlink_config_t;
|
||||
|
||||
typedef struct {
|
||||
uint8_t bwp_or_cell_level;
|
||||
uint8_t pattern_type;
|
||||
uint32_t resource_blocks[9]; // bitmaps type 275 bits
|
||||
uint8_t slot_type; // bitmaps type one/two slot(s)
|
||||
uint32_t symbols_in_resouece_block; // bitmaps type 14/28 bits
|
||||
uint8_t periodic; // bitmaps type
|
||||
uint32_t pattern[2]; // bitmaps type 2/4/5/8/10/20/40 bits
|
||||
|
||||
fapi_nr_coreset_t coreset; // coreset
|
||||
|
||||
uint8_t subcarrier_spacing;
|
||||
uint8_t mode;
|
||||
} fapi_nr_rate_matching_pattern_group_t;
|
||||
|
||||
typedef struct {
|
||||
// resource mapping
|
||||
uint8_t row; // row1/row2/row4/other
|
||||
uint16_t frequency_domain_allocation; // 4/12/3/6 bits
|
||||
uint8_t number_of_ports;
|
||||
uint8_t first_ofdm_symbol_in_time_domain;
|
||||
uint8_t first_ofdm_symbol_in_time_domain2;
|
||||
uint8_t cdm_type;
|
||||
uint8_t density; // .5/1/3
|
||||
uint8_t density_dot5_type; // even/odd PRBs
|
||||
|
||||
uint8_t frequency_band_starting_rb; // freqBand
|
||||
uint8_t frequency_band_number_of_rb; // freqBand
|
||||
|
||||
// periodicityAndOffset
|
||||
uint8_t periodicity; // slot4/5/8/10/16/20/32/40/64/80/160/320/640
|
||||
uint32_t offset; // 0..639 bits
|
||||
} fapi_nr_zp_csi_rs_resource_t;
|
||||
|
||||
typedef struct {
|
||||
uint16_t data_scrambling_id_pdsch;
|
||||
fapi_nr_dmrs_downlink_config_t dmrs_dl_for_pdsch_mapping_type_a;
|
||||
fapi_nr_dmrs_downlink_config_t dmrs_dl_for_pdsch_mapping_type_b;
|
||||
uint8_t vrb_to_prb_interleaver;
|
||||
uint8_t resource_allocation;
|
||||
fapi_nr_pdsch_time_domain_resource_allocation_t allocation_list[FAPI_NR_MAX_NUM_DL_ALLOCATIONS];
|
||||
uint8_t pdsch_aggregation_factor;
|
||||
fapi_nr_rate_matching_pattern_group_t rate_matching_pattern_group1;
|
||||
fapi_nr_rate_matching_pattern_group_t rate_matching_pattern_group2;
|
||||
uint8_t rbg_size;
|
||||
uint8_t mcs_table;
|
||||
uint8_t max_num_of_code_word_scheduled_by_dci;
|
||||
uint8_t bundle_size; // prb_bundling static
|
||||
uint8_t bundle_size_set1; // prb_bundling dynamic
|
||||
uint8_t bundle_size_set2; // prb_bundling dynamic
|
||||
fapi_nr_zp_csi_rs_resource_t periodically_zp_csi_rs_resource_set[FAPI_NR_MAX_NUM_ZP_CSI_RS_RESOURCE_PER_SET];
|
||||
} fapi_nr_pdsch_config_dedicated_t;
|
||||
|
||||
typedef struct {
|
||||
uint16_t starting_prb;
|
||||
uint8_t intra_slot_frequency_hopping;
|
||||
uint16_t second_hop_prb;
|
||||
uint8_t format; // pucch format 0..4
|
||||
uint8_t initial_cyclic_shift;
|
||||
uint8_t number_of_symbols;
|
||||
uint8_t starting_symbol_index;
|
||||
uint8_t time_domain_occ;
|
||||
uint8_t number_of_prbs;
|
||||
uint8_t occ_length;
|
||||
uint8_t occ_index;
|
||||
} fapi_nr_pucch_resource_t;
|
||||
|
||||
typedef struct {
|
||||
uint8_t periodicity;
|
||||
uint8_t number_of_harq_process;
|
||||
fapi_nr_pucch_resource_t n1_pucch_an;
|
||||
} fapi_nr_sps_config_t;
|
||||
|
||||
typedef struct {
|
||||
uint8_t beam_failure_instance_max_count;
|
||||
uint8_t beam_failure_detection_timer;
|
||||
} fapi_nr_radio_link_monitoring_config_t;
|
||||
|
||||
typedef struct {
|
||||
fapi_nr_pdcch_config_dedicated_t pdcch_config_dedicated;
|
||||
fapi_nr_pdsch_config_dedicated_t pdsch_config_dedicated;
|
||||
fapi_nr_sps_config_t sps_config;
|
||||
fapi_nr_radio_link_monitoring_config_t radio_link_monitoring_config;
|
||||
|
||||
} fapi_nr_dl_bwp_dedicated_config_t;
|
||||
|
||||
typedef struct {
|
||||
fapi_nr_rach_config_common_t rach_config_common;
|
||||
fapi_nr_pusch_config_common_t pusch_config_common;
|
||||
fapi_nr_pucch_config_common_t pucch_config_common;
|
||||
|
||||
} fapi_nr_ul_bwp_common_config_t;
|
||||
|
||||
typedef struct {
|
||||
uint8_t inter_slot_frequency_hopping;
|
||||
uint8_t additional_dmrs;
|
||||
uint8_t max_code_rate;
|
||||
uint8_t number_of_slots;
|
||||
uint8_t pi2bpsk;
|
||||
uint8_t simultaneous_harq_ack_csi;
|
||||
} fapi_nr_pucch_format_config_t;
|
||||
|
||||
typedef struct {
|
||||
fapi_nr_pucch_format_config_t format1;
|
||||
fapi_nr_pucch_format_config_t format2;
|
||||
fapi_nr_pucch_format_config_t format3;
|
||||
fapi_nr_pucch_format_config_t format4;
|
||||
fapi_nr_pucch_resource_t multi_csi_pucch_resources[2];
|
||||
uint8_t dl_data_to_ul_ack[8];
|
||||
// pucch power control
|
||||
uint8_t deltaF_pucch_f0;
|
||||
uint8_t deltaF_pucch_f1;
|
||||
uint8_t deltaF_pucch_f2;
|
||||
uint8_t deltaF_pucch_f3;
|
||||
uint8_t deltaF_pucch_f4;
|
||||
uint8_t two_pucch_pc_adjusment_states;
|
||||
} fapi_nr_pucch_config_dedicated_t;
|
||||
|
||||
typedef struct {
|
||||
uint8_t dmrs_type;
|
||||
uint8_t dmrs_addition_position;
|
||||
uint8_t ptrs_uplink_config; // to indicate if PTRS Uplink is configured of not
|
||||
uint8_t ptrs_type; //cp-OFDM, dft-S-OFDM
|
||||
uint16_t ptrs_frequency_density[2];
|
||||
uint8_t ptrs_time_density[3];
|
||||
uint8_t ptrs_max_number_of_ports;
|
||||
uint8_t ptrs_resource_element_offset;
|
||||
uint8_t ptrs_power;
|
||||
uint16_t ptrs_sample_density[5];
|
||||
uint8_t ptrs_time_density_transform_precoding;
|
||||
|
||||
uint8_t max_length;
|
||||
uint16_t scrambling_id0;
|
||||
uint16_t scrambling_id1;
|
||||
uint8_t npusch_identity;
|
||||
uint8_t disable_sequence_group_hopping;
|
||||
uint8_t sequence_hopping_enable;
|
||||
} fapi_nr_dmrs_uplink_config_t;
|
||||
|
||||
typedef struct {
|
||||
uint8_t tpc_accmulation;
|
||||
uint8_t msg3_alpha;
|
||||
uint8_t p0_nominal_with_grant;
|
||||
uint8_t two_pusch_pc_adjustments_states;
|
||||
uint8_t delta_mcs;
|
||||
} fapi_nr_pusch_power_control_t;
|
||||
|
||||
typedef enum {tx_config_codebook = 1, tx_config_nonCodebook = 2} tx_config_t;
|
||||
typedef enum {transform_precoder_enabled = 0, transform_precoder_disabled = 1} transform_precoder_t;
|
||||
typedef enum {
|
||||
codebook_subset_fullyAndPartialAndNonCoherent = 1,
|
||||
codebook_subset_partialAndNonCoherent = 2,
|
||||
codebook_subset_nonCoherent = 3} codebook_subset_t;
|
||||
typedef struct {
|
||||
uint16_t data_scrambling_identity;
|
||||
tx_config_t tx_config;
|
||||
fapi_nr_dmrs_uplink_config_t dmrs_ul_for_pusch_mapping_type_a;
|
||||
fapi_nr_dmrs_uplink_config_t dmrs_ul_for_pusch_mapping_type_b;
|
||||
fapi_nr_pusch_power_control_t pusch_power_control;
|
||||
uint8_t frequency_hopping;
|
||||
uint16_t frequency_hopping_offset_lists[4];
|
||||
uint8_t resource_allocation;
|
||||
fapi_nr_pusch_time_domain_resource_allocation_t allocation_list[FAPI_NR_MAX_NUM_UL_ALLOCATIONS];
|
||||
uint8_t pusch_aggregation_factor;
|
||||
uint8_t mcs_table;
|
||||
uint8_t mcs_table_transform_precoder;
|
||||
transform_precoder_t transform_precoder;
|
||||
codebook_subset_t codebook_subset;
|
||||
uint8_t max_rank;
|
||||
uint8_t rbg_size;
|
||||
|
||||
//uci-OnPUSCH
|
||||
uint8_t uci_on_pusch_type; //dynamic, semi-static
|
||||
uint8_t beta_offset_ack_index1[4];
|
||||
uint8_t beta_offset_ack_index2[4];
|
||||
uint8_t beta_offset_ack_index3[4];
|
||||
uint8_t beta_offset_csi_part1_index1[4];
|
||||
uint8_t beta_offset_csi_part1_index2[4];
|
||||
uint8_t beta_offset_csi_part2_index1[4];
|
||||
uint8_t beta_offset_csi_part2_index2[4];
|
||||
|
||||
uint8_t tp_pi2BPSK;
|
||||
} fapi_nr_pusch_config_dedicated_t;
|
||||
|
||||
typedef struct {
|
||||
uint8_t frequency_hopping;
|
||||
fapi_nr_dmrs_uplink_config_t cg_dmrs_configuration;
|
||||
uint8_t mcs_table;
|
||||
uint8_t mcs_table_transform_precoder;
|
||||
|
||||
//uci-OnPUSCH
|
||||
uint8_t uci_on_pusch_type; //dynamic, semi-static
|
||||
uint8_t beta_offset_ack_index1[4];
|
||||
uint8_t beta_offset_ack_index2[4];
|
||||
uint8_t beta_offset_ack_index3[4];
|
||||
uint8_t beta_offset_csi_part1_index1[4];
|
||||
uint8_t beta_offset_csi_part1_index2[4];
|
||||
uint8_t beta_offset_csi_part2_index1[4];
|
||||
uint8_t beta_offset_csi_part2_index2[4];
|
||||
|
||||
uint8_t resource_allocation;
|
||||
// rgb-Size structure missing in spec.
|
||||
uint8_t power_control_loop_to_use;
|
||||
// p0-PUSCH-Alpha
|
||||
uint8_t p0;
|
||||
uint8_t alpha;
|
||||
|
||||
uint8_t transform_precoder;
|
||||
uint8_t number_of_harq_process;
|
||||
uint8_t rep_k;
|
||||
uint8_t rep_k_rv;
|
||||
uint8_t periodicity;
|
||||
uint8_t configured_grant_timer;
|
||||
// rrc-ConfiguredUplinkGrant
|
||||
uint16_t time_domain_offset;
|
||||
uint8_t time_domain_allocation;
|
||||
uint32_t frequency_domain_allocation;
|
||||
uint8_t antenna_ports;
|
||||
uint8_t dmrs_seq_initialization;
|
||||
uint8_t precoding_and_number_of_layers;
|
||||
uint8_t srs_resource_indicator;
|
||||
uint8_t mcs_and_tbs;
|
||||
uint8_t frequency_hopping_offset;
|
||||
uint8_t path_loss_reference_index;
|
||||
|
||||
} fapi_nr_configured_grant_config_t;
|
||||
|
||||
typedef struct {
|
||||
uint8_t qcl_type1_serving_cell_index;
|
||||
uint8_t qcl_type1_bwp_id;
|
||||
uint8_t qcl_type1_rs_type; // csi-rs or ssb
|
||||
uint8_t qcl_type1_nzp_csi_rs_resource_id;
|
||||
uint8_t qcl_type1_ssb_index;
|
||||
uint8_t qcl_type1_type;
|
||||
|
||||
uint8_t qcl_type2_serving_cell_index;
|
||||
uint8_t qcl_type2_bwp_id;
|
||||
uint8_t qcl_type2_rs_type; // csi-rs or ssb
|
||||
uint8_t qcl_type2_nzp_csi_rs_resource_id;
|
||||
uint8_t qcl_type2_ssb_index;
|
||||
uint8_t qcl_type2_type;
|
||||
|
||||
} fapi_nr_tci_state_t;
|
||||
|
||||
typedef struct {
|
||||
uint8_t root_sequence_index;
|
||||
// rach genertic
|
||||
uint8_t prach_configuration_index;
|
||||
uint8_t msg1_fdm;
|
||||
uint8_t msg1_frequency_start;
|
||||
uint8_t zero_correlation_zone_config;
|
||||
uint8_t preamble_received_target_power;
|
||||
uint8_t preamble_transmission_max;
|
||||
uint8_t power_ramping_step;
|
||||
uint8_t ra_window_size;
|
||||
|
||||
uint8_t rsrp_threshold_ssb;
|
||||
// PRACH-ResourceDedicatedBFR
|
||||
uint8_t bfr_ssb_index[FAPI_NR_MAX_NUM_CANDIDATE_BEAMS];
|
||||
uint8_t bfr_ssb_ra_preamble_index[FAPI_NR_MAX_NUM_CANDIDATE_BEAMS];
|
||||
// NZP-CSI-RS-Resource
|
||||
uint8_t bfr_csi_rs_nzp_resource_mapping[FAPI_NR_MAX_NUM_CANDIDATE_BEAMS];
|
||||
uint8_t bfr_csi_rs_power_control_offset[FAPI_NR_MAX_NUM_CANDIDATE_BEAMS];
|
||||
uint8_t bfr_csi_rs_power_control_offset_ss[FAPI_NR_MAX_NUM_CANDIDATE_BEAMS];
|
||||
uint16_t bfr_csi_rs_scrambling_id[FAPI_NR_MAX_NUM_CANDIDATE_BEAMS];
|
||||
uint8_t bfr_csi_rs_resource_periodicity[FAPI_NR_MAX_NUM_CANDIDATE_BEAMS];
|
||||
uint16_t bfr_csi_rs_resource_offset[FAPI_NR_MAX_NUM_CANDIDATE_BEAMS];
|
||||
fapi_nr_tci_state_t qcl_infomation_periodic_csi_rs[FAPI_NR_MAX_NUM_CANDIDATE_BEAMS];
|
||||
|
||||
uint8_t bfr_csirs_ra_occasions[FAPI_NR_MAX_NUM_CANDIDATE_BEAMS];
|
||||
uint8_t bfr_csirs_ra_preamble_index[FAPI_NR_MAX_NUM_CANDIDATE_BEAMS][FAPI_NR_MAX_RA_OCCASION_PER_CSIRS];
|
||||
|
||||
uint8_t ssb_per_rach_occasion;
|
||||
uint8_t ra_ssb_occasion_mask_index;
|
||||
fapi_nr_search_space_t recovery_search_space;
|
||||
// RA-Prioritization
|
||||
uint8_t power_ramping_step_high_priority;
|
||||
uint8_t scaling_factor_bi;
|
||||
uint8_t beam_failure_recovery_timer;
|
||||
} fapi_nr_beam_failure_recovery_config_t;
|
||||
|
||||
typedef struct {
|
||||
fapi_nr_pucch_config_dedicated_t pucch_config_dedicated;
|
||||
fapi_nr_pusch_config_dedicated_t pusch_config_dedicated;
|
||||
fapi_nr_configured_grant_config_t configured_grant_config;
|
||||
// SRS-Config
|
||||
uint8_t srs_tpc_accumulation;
|
||||
fapi_nr_beam_failure_recovery_config_t beam_failure_recovery_config;
|
||||
|
||||
} fapi_nr_ul_bwp_dedicated_config_t;
|
||||
|
||||
#define FAPI_NR_CONFIG_REQUEST_MASK_PBCH 0x01
|
||||
#define FAPI_NR_CONFIG_REQUEST_MASK_DL_BWP_COMMON 0x02
|
||||
#define FAPI_NR_CONFIG_REQUEST_MASK_UL_BWP_COMMON 0x04
|
||||
|
||||
@@ -27,6 +27,8 @@
|
||||
#define NFAPI_PNF_PARAM_GENERAL_OUI_LENGTH 3
|
||||
#define NFAPI_MAX_NUM_RF_BANDS 16
|
||||
|
||||
#define NFAPI_MAX_PACKED_MESSAGE_SIZE 8192
|
||||
|
||||
// The following definition control the size of arrays used in the interface.
|
||||
// These may be changed if desired. They are used in the encoder to make sure
|
||||
// that the user has not specified a 'count' larger than the max array, and also
|
||||
@@ -122,12 +124,13 @@ typedef struct {
|
||||
|
||||
// Convenience methods to convert between SFN/SLOT formats
|
||||
#define NFAPI_SFNSLOT2DEC(_sfn,_slot) ( _sfn*20 + _slot ) // total count of slots
|
||||
#define NFAPI_SFNSLOTDEC2SFNSLOT(_sfnslot_dec) ((((_sfnslot_dec) / 20) << 4) | (((_sfnslot_dec) - (((_sfnslot_dec) / 20) * 10)) & 0x3F))
|
||||
#define NFAPI_SFNSLOTDEC2SFNSLOT(_sfnslot_dec) ((((_sfnslot_dec) / 20) << 6) | (((_sfnslot_dec) - (((_sfnslot_dec) / 20) * 20)) & 0x3F))
|
||||
|
||||
#define NFAPI_SFNSLOT2SFN(_sfnslot) ((_sfnslot) >> 6)
|
||||
#define NFAPI_SFNSLOT2SLOT(_sfnslot) ((_sfnslot) & 0x3F)
|
||||
#define NFAPI_SFNSLOTDEC2SFN(_sfnslot_dec) ((_sfnslot_dec) / 20)
|
||||
#define NFAPI_SFNSLOTDEC2SLOT(_sfnslot_dec) ((_sfnslot_dec) % 20)
|
||||
#define NFAPI_SFNSLOT2HEX(_sfn,_slot) ((_sfn << 6) | (_slot & 0x3F))
|
||||
|
||||
#define NFAPI_MAX_SFNSLOTDEC 1024*20 // 20 is for numerology 1
|
||||
|
||||
@@ -706,7 +709,6 @@ typedef struct {
|
||||
#define NFAPI_PHICH_CONFIG_PHICH_DURATION_TAG 0x0015
|
||||
#define NFAPI_PHICH_CONFIG_PHICH_POWER_OFFSET_TAG 0x0016
|
||||
|
||||
|
||||
typedef struct {
|
||||
nfapi_uint16_tlv_t primary_synchronization_signal_epre_eprers;
|
||||
nfapi_uint16_tlv_t secondary_synchronization_signal_epre_eprers;
|
||||
@@ -2497,7 +2499,7 @@ typedef struct {
|
||||
typedef struct {
|
||||
nfapi_p7_message_header_t header;
|
||||
uint32_t t1;
|
||||
int32_t delta_sfn_sf;
|
||||
int32_t delta_sfn_sf;
|
||||
nfapi_vendor_extension_tlv_t vendor_extension;
|
||||
} nfapi_dl_node_sync_t;
|
||||
|
||||
@@ -2872,11 +2874,12 @@ typedef struct {
|
||||
} nfapi_rx_indication_rel9_t;
|
||||
#define NFAPI_RX_INDICATION_REL9_TAG 0x2025
|
||||
|
||||
#define NFAPI_RX_IND_DATA_MAX 8192
|
||||
typedef struct {
|
||||
nfapi_rx_ue_information rx_ue_information;
|
||||
nfapi_rx_indication_rel8_t rx_indication_rel8;
|
||||
nfapi_rx_indication_rel9_t rx_indication_rel9;
|
||||
uint8_t* data;
|
||||
uint8_t rx_ind_data[NFAPI_RX_IND_DATA_MAX];
|
||||
} nfapi_rx_indication_pdu_t;
|
||||
|
||||
#define NFAPI_RX_IND_MAX_PDU 100
|
||||
|
||||
@@ -984,6 +984,8 @@ typedef struct {
|
||||
/// A value indicating how the BCH payload is generated. This should match the PARAM/CONFIG TLVs. Value: 0: MAC generates the full PBCH payload, see Table 3-41, where bchPayload has 31 bits 1: PHY generates the timing PBCH bits, see Table 3-41, where the bchPayload has 24 bits 2: PHY generates the full PBCH payload
|
||||
uint8_t bchPayloadFlag;
|
||||
uint32_t bchPayload;
|
||||
/// A value indicating the channel quality between the gNB and nrUE. Value: 0->255 dBM
|
||||
uint8_t ssbRsrp;
|
||||
nfapi_nr_tx_precoding_and_beamforming_t precoding_and_beamforming;
|
||||
} nfapi_nr_dl_tti_ssb_pdu_rel15_t;
|
||||
|
||||
@@ -1476,7 +1478,7 @@ typedef enum {
|
||||
//section 3.4.7 rx_data_indication
|
||||
|
||||
//table 3-61
|
||||
|
||||
#define NFAPI_NR_RX_DATA_IND_MAX_PDU 100
|
||||
typedef struct
|
||||
{
|
||||
uint32_t handle;
|
||||
@@ -1497,12 +1499,13 @@ typedef struct
|
||||
uint16_t sfn;
|
||||
uint16_t slot;
|
||||
uint16_t number_of_pdus;
|
||||
nfapi_nr_rx_data_pdu_t *pdu_list;
|
||||
nfapi_nr_rx_data_pdu_t *pdu_list;
|
||||
|
||||
} nfapi_nr_rx_data_indication_t;
|
||||
|
||||
//3.4.8 crc_indication
|
||||
//table 3-62
|
||||
#define NFAPI_NR_CRC_IND_MAX_PDU 100
|
||||
typedef struct
|
||||
{
|
||||
uint32_t handle;
|
||||
@@ -1642,6 +1645,7 @@ typedef enum {
|
||||
NFAPI_NR_UCI_FORMAT_2_3_4_PDU_TYPE = 2,
|
||||
} nfapi_nr_uci_pdu_type_e;
|
||||
|
||||
#define NFAPI_NR_UCI_IND_MAX_PDU 100
|
||||
typedef struct
|
||||
{
|
||||
uint16_t pdu_type; // 0 for PDU on PUSCH, 1 for PUCCH format 0 or 1, 2 for PUCCH format 2 to 4
|
||||
@@ -1678,7 +1682,7 @@ typedef struct
|
||||
nfapi_nr_srs_indication_reported_symbol_resource_block_t* rb_list;
|
||||
}nfapi_nr_srs_indication_reported_symbol_t;
|
||||
|
||||
|
||||
#define NFAPI_NR_SRS_IND_MAX_PDU 100
|
||||
typedef struct
|
||||
{
|
||||
uint32_t handle;
|
||||
|
||||
+783
-783
File diff suppressed because it is too large
Load Diff
@@ -29,7 +29,7 @@
|
||||
|
||||
static uint32_t get_packed_msg_len(uintptr_t msgHead, uintptr_t msgEnd) {
|
||||
if (msgEnd < msgHead) {
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "get_packed_msg_len: Error in pointers supplied %d, %d\n", msgHead, msgEnd);
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "get_packed_msg_len: Error in pointers supplied %lu, %lu\n", msgHead, msgEnd);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -429,16 +429,6 @@ static uint8_t pack_embms_mbsfn_config_value(void *tlv, uint8_t **ppWritePackedM
|
||||
pusharray8(value->fourframes_flag, 8,value->num_mbsfn_config,ppWritePackedMsg, end) &&
|
||||
pusharrays32(value->mbsfn_subframeconfig, 8, value->num_mbsfn_config, ppWritePackedMsg, end));
|
||||
}
|
||||
// static uint8_t unpack_embms_mbsfn_config_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t* end)
|
||||
// {
|
||||
// nfapi_embms_mbsfn_config_t* value = (nfapi_embms_mbsfn_config_t*)tlv;
|
||||
|
||||
// return ( pull16(ppReadPackedMsg, &value->num_mbsfn_config, end) &&
|
||||
// pull16(ppReadPackedMsg, &value->radioframe_allocation_period, end) &&
|
||||
// pull16(ppReadPackedMsg, &value->radioframe_allocation_offset, end) &&
|
||||
// pull8(ppReadPackedMsg, &value->fourframes_flag, end) &&
|
||||
// pullarrays32(ppReadPackedMsg, value->mbsfn_subframeconfig, 8, value->num_mbsfn_config, end));
|
||||
// }
|
||||
|
||||
static uint8_t pack_param_response(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t *config) {
|
||||
nfapi_param_response_t *pNfapiMsg = (nfapi_param_response_t *)msg;
|
||||
@@ -734,10 +724,10 @@ static uint8_t pack_nr_config_request(void *msg, uint8_t **ppWritePackedMsg, uin
|
||||
pack_tlv(NFAPI_NR_CONFIG_UL_K0_TAG, &(pNfapiMsg->carrier_config.ul_k0[1]), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
|
||||
pack_tlv(NFAPI_NR_CONFIG_UPLINK_BANDWIDTH_TAG, &(pNfapiMsg->carrier_config.uplink_bandwidth), ppWritePackedMsg, end, &pack_uint16_tlv_value) &&
|
||||
pack_tlv(NFAPI_NR_CONFIG_UPLINK_FREQUENCY_TAG, &(pNfapiMsg->carrier_config.uplink_frequency), ppWritePackedMsg, end, &pack_uint32_tlv_value) &&
|
||||
|
||||
|
||||
pack_tlv(NFAPI_NR_CONFIG_FRAME_DUPLEX_TYPE_TAG, &(pNfapiMsg->cell_config.frame_duplex_type), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
|
||||
pack_tlv(NFAPI_NR_CONFIG_PHY_CELL_ID_TAG, &(pNfapiMsg->cell_config.phy_cell_id), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
|
||||
|
||||
|
||||
pack_tlv(NFAPI_NR_CONFIG_NUM_PRACH_FD_OCCASIONS_TAG, &(pNfapiMsg->prach_config.num_prach_fd_occasions), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
|
||||
pack_tlv(NFAPI_NR_CONFIG_PRACH_SEQUENCE_LENGTH_TAG, &(pNfapiMsg->prach_config.prach_sequence_length), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
|
||||
pack_tlv(NFAPI_NR_CONFIG_RESTRICTED_SET_CONFIG_TAG, &(pNfapiMsg->prach_config.restricted_set_config), ppWritePackedMsg, end, &pack_uint8_tlv_value) &&
|
||||
@@ -1036,7 +1026,7 @@ static uint8_t pack_p5_message_body(nfapi_p4_p5_message_header_t *header, uint8_
|
||||
|
||||
static uint32_t get_packed_msg_len(uintptr_t msgHead, uintptr_t msgEnd) {
|
||||
if (msgEnd < msgHead) {
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "get_packed_msg_len: Error in pointers supplied %d, %d\n", msgHead, msgEnd);
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "get_packed_msg_len: Error in pointers supplied %lu, %lu\n", msgHead, msgEnd);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1351,7 +1341,6 @@ static uint8_t unpack_nr_pnf_config_request(uint8_t **ppReadPackedMsg, uint8_t *
|
||||
}
|
||||
|
||||
|
||||
|
||||
static uint8_t unpack_pnf_config_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p4_p5_codec_config_t *config) {
|
||||
nfapi_pnf_config_request_t *pNfapiMsg = (nfapi_pnf_config_request_t *)msg;
|
||||
unpack_tlv_t unpack_fns[] = {
|
||||
@@ -1723,6 +1712,7 @@ static uint8_t unpack_config_request(uint8_t **ppReadPackedMsg, uint8_t *end, vo
|
||||
return ( pull8(ppReadPackedMsg, &pNfapiMsg->num_tlv, end) &&
|
||||
unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension));
|
||||
}
|
||||
|
||||
static uint8_t unpack_nr_config_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p4_p5_codec_config_t* config)
|
||||
{
|
||||
nfapi_nr_config_request_scf_t *pNfapiMsg = (nfapi_nr_config_request_scf_t*)msg;
|
||||
@@ -1786,7 +1776,7 @@ static uint8_t unpack_nr_config_request(uint8_t **ppReadPackedMsg, uint8_t *end,
|
||||
|
||||
return ( pull8(ppReadPackedMsg, &pNfapiMsg->num_tlv, end) &&
|
||||
unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension));
|
||||
|
||||
|
||||
}
|
||||
|
||||
static uint8_t unpack_config_response(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p4_p5_codec_config_t *config) {
|
||||
@@ -2386,3 +2376,4 @@ int nfapi_p5_message_unpack(void *pMessageBuf, uint32_t messageBufLen, void *pUn
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -223,7 +223,6 @@ static uint8_t pack_dl_tti_csi_rs_pdu_rel15_value(void *tlv, uint8_t **ppWritePa
|
||||
static uint8_t pack_dl_tti_pdcch_pdu_rel15_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) {
|
||||
|
||||
nfapi_nr_dl_tti_pdcch_pdu_rel15_t* value = (nfapi_nr_dl_tti_pdcch_pdu_rel15_t*)tlv;
|
||||
|
||||
for(uint8_t i = 0; i < MAX_DCI_CORESET; ++i)
|
||||
{
|
||||
if(!(push16(value->dci_pdu[i].RNTI, ppWritePackedMsg, end) &&
|
||||
@@ -236,7 +235,6 @@ static uint8_t pack_dl_tti_pdcch_pdu_rel15_value(void* tlv, uint8_t **ppWritePac
|
||||
push16(value->dci_pdu[i].PayloadSizeBits, ppWritePackedMsg, end) &&
|
||||
pusharray8(value->dci_pdu[i].Payload, value->dci_pdu[i].PayloadSizeBits, value->dci_pdu[i].PayloadSizeBits, ppWritePackedMsg, end)))
|
||||
return 0;
|
||||
|
||||
}
|
||||
// TODO: resolve the packaging of array (currently sending a single element)
|
||||
return(
|
||||
@@ -300,17 +298,21 @@ static uint8_t pack_dl_tti_pdsch_pdu_rel15_value(void *tlv, uint8_t **ppWritePac
|
||||
|
||||
|
||||
static uint8_t pack_dl_tti_ssb_pdu_rel15_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) {
|
||||
nfapi_nr_dl_tti_ssb_pdu_rel15_t *value = (nfapi_nr_dl_tti_ssb_pdu_rel15_t *)tlv;
|
||||
return(
|
||||
push16(value->PhysCellId, ppWritePackedMsg, end) &&
|
||||
push8(value->BetaPss, ppWritePackedMsg, end) &&
|
||||
push8(value->SsbBlockIndex, ppWritePackedMsg, end) &&
|
||||
push8(value->SsbSubcarrierOffset, ppWritePackedMsg, end) &&
|
||||
push16(value->ssbOffsetPointA, ppWritePackedMsg, end) &&
|
||||
push8(value->bchPayloadFlag, ppWritePackedMsg, end) &&
|
||||
push32(value->bchPayload, ppWritePackedMsg, end)
|
||||
// TODO: pack precoding_and_beamforming too
|
||||
);
|
||||
NFAPI_TRACE(NFAPI_TRACE_DEBUG, "Packing ssb. \n");
|
||||
nfapi_nr_dl_tti_ssb_pdu_rel15_t* value = (nfapi_nr_dl_tti_ssb_pdu_rel15_t*)tlv;
|
||||
|
||||
return(
|
||||
push16(value->PhysCellId, ppWritePackedMsg, end) &&
|
||||
push8(value->BetaPss, ppWritePackedMsg, end) &&
|
||||
push8(value->SsbBlockIndex, ppWritePackedMsg, end) &&
|
||||
push8(value->SsbSubcarrierOffset, ppWritePackedMsg, end) &&
|
||||
push16(value->ssbOffsetPointA, ppWritePackedMsg, end) &&
|
||||
push8(value->bchPayloadFlag, ppWritePackedMsg, end) &&
|
||||
push32(value->bchPayload, ppWritePackedMsg, end) &&
|
||||
push8(value->ssbRsrp, ppWritePackedMsg, end)
|
||||
// TODO: pack precoding_and_beamforming too
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -778,38 +780,41 @@ static uint8_t pack_dl_config_request_body_value(void *tlv, uint8_t **ppWritePac
|
||||
}
|
||||
|
||||
|
||||
static uint8_t pack_dl_tti_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t *config) {
|
||||
nfapi_nr_dl_tti_request_t *pNfapiMsg = (nfapi_nr_dl_tti_request_t *)msg;
|
||||
static uint8_t pack_dl_tti_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config)
|
||||
{
|
||||
nfapi_nr_dl_tti_request_t *pNfapiMsg = (nfapi_nr_dl_tti_request_t*)msg;
|
||||
|
||||
if (!(push16(pNfapiMsg->SFN, ppWritePackedMsg, end) &&
|
||||
push16(pNfapiMsg->Slot, ppWritePackedMsg, end) &&
|
||||
push8(pNfapiMsg->dl_tti_request_body.nGroup, ppWritePackedMsg, end) &&
|
||||
push8(pNfapiMsg->dl_tti_request_body.nPDUs, ppWritePackedMsg, end) &&
|
||||
pusharray8(pNfapiMsg->dl_tti_request_body.nUe,256,pNfapiMsg->dl_tti_request_body.nGroup, ppWritePackedMsg, end)
|
||||
//pusharray8(pNfapiMsg->PduIdx[0] ,256,256, ppWritePackedMsg, end)
|
||||
))
|
||||
return 0;
|
||||
if (!(push16(pNfapiMsg->SFN , ppWritePackedMsg, end) &&
|
||||
push16(pNfapiMsg->Slot , ppWritePackedMsg, end) &&
|
||||
push8(pNfapiMsg->dl_tti_request_body.nGroup , ppWritePackedMsg, end) &&
|
||||
push8(pNfapiMsg->dl_tti_request_body.nPDUs , ppWritePackedMsg, end) &&
|
||||
pusharray8(pNfapiMsg->dl_tti_request_body.nUe, 256, pNfapiMsg->dl_tti_request_body.nGroup, ppWritePackedMsg, end)
|
||||
//pusharray8(pNfapiMsg->PduIdx[0] ,256,256, ppWritePackedMsg, end)
|
||||
))
|
||||
return 0;
|
||||
|
||||
int arr[12];
|
||||
int arr[12];
|
||||
for(int i=0;i<pNfapiMsg->dl_tti_request_body.nGroup;i++)
|
||||
{
|
||||
for(int j=0;j<pNfapiMsg->dl_tti_request_body.nUe[i];j++)
|
||||
{
|
||||
arr[j] = pNfapiMsg->dl_tti_request_body.PduIdx[i][j];
|
||||
}
|
||||
if(!(pusharrays32(arr, 12, pNfapiMsg->dl_tti_request_body.nUe[i], ppWritePackedMsg, end)))
|
||||
return 0;
|
||||
}
|
||||
|
||||
for(int i=0; i<pNfapiMsg->dl_tti_request_body.nGroup; i++) {
|
||||
for(int j=0; j<pNfapiMsg->dl_tti_request_body.nUe[i]; j++) {
|
||||
arr[j] = pNfapiMsg->dl_tti_request_body.PduIdx[i][j];
|
||||
}
|
||||
for(int i=0;i<pNfapiMsg->dl_tti_request_body.nPDUs;i++)
|
||||
{
|
||||
if(!pack_dl_tti_request_body_value(&pNfapiMsg->dl_tti_request_body.dl_tti_pdu_list[i],ppWritePackedMsg,end))
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(!(pusharrays32(arr,12,pNfapiMsg->dl_tti_request_body.nUe[i],ppWritePackedMsg, end)))
|
||||
return 0;
|
||||
}
|
||||
|
||||
for(int i=0; i<pNfapiMsg->dl_tti_request_body.nPDUs; i++) {
|
||||
if(!pack_dl_tti_request_body_value(&pNfapiMsg->dl_tti_request_body.dl_tti_pdu_list[i],ppWritePackedMsg,end))
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static uint8_t pack_dl_config_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t *config) {
|
||||
nfapi_dl_config_request_t *pNfapiMsg = (nfapi_dl_config_request_t *)msg;
|
||||
//return ( push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end) &&
|
||||
@@ -902,6 +907,7 @@ static uint8_t pack_ul_tti_request_pucch_pdu(nfapi_nr_pucch_pdu_t *pucch_pdu, ui
|
||||
push8(pucch_pdu->cyclic_prefix, ppWritePackedMsg, end) &&
|
||||
push8(pucch_pdu->format_type, ppWritePackedMsg, end) &&
|
||||
push8(pucch_pdu->multi_slot_tx_indicator, ppWritePackedMsg, end) &&
|
||||
push8(pucch_pdu->pi_2bpsk, ppWritePackedMsg, end) &&
|
||||
push16(pucch_pdu->prb_start, ppWritePackedMsg, end) &&
|
||||
push16(pucch_pdu->prb_size, ppWritePackedMsg, end) &&
|
||||
push8(pucch_pdu->start_symbol_index, ppWritePackedMsg, end) &&
|
||||
@@ -1803,7 +1809,6 @@ static uint8_t pack_hi_dci0_request_body_value(void *tlv, uint8_t **ppWritePacke
|
||||
static uint8_t pack_ul_dci_pdu_list_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
|
||||
{
|
||||
nfapi_nr_ul_dci_request_pdus_t* value = (nfapi_nr_ul_dci_request_pdus_t*)tlv;
|
||||
|
||||
for(uint8_t i = 0; i < MAX_DCI_CORESET; ++i)
|
||||
{
|
||||
if(!(push16(value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].RNTI, ppWritePackedMsg, end) &&
|
||||
@@ -1816,7 +1821,6 @@ static uint8_t pack_ul_dci_pdu_list_value(void* tlv, uint8_t **ppWritePackedMsg,
|
||||
|
||||
push8(value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].powerControlOffsetSS, ppWritePackedMsg, end) &&
|
||||
push16(value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].PayloadSizeBits, ppWritePackedMsg, end) &&
|
||||
|
||||
pusharray8(value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].Payload, value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].PayloadSizeBits, value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].PayloadSizeBits, ppWritePackedMsg, end)))
|
||||
|
||||
return 0;
|
||||
@@ -2263,6 +2267,7 @@ static uint8_t pack_crc_indication_body_value(void *tlv, uint8_t **ppWritePacked
|
||||
uint16_t i = 0;
|
||||
uint16_t total_number_of_pdus = value->number_of_crcs;
|
||||
|
||||
assert(total_number_of_pdus <= NFAPI_CRC_IND_MAX_PDU);
|
||||
for(; i < total_number_of_pdus; ++i) {
|
||||
nfapi_crc_indication_pdu_t *pdu = &(value->crc_pdu_list[i]);
|
||||
uint8_t *instance_length_p = *ppWritePackedMsg;
|
||||
@@ -2304,7 +2309,7 @@ static uint8_t pack_rx_indication_rel9_value(void *tlv, uint8_t **ppWritePackedM
|
||||
static uint8_t pack_rx_ulsch_indication_body_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) {
|
||||
nfapi_rx_indication_body_t *value = (nfapi_rx_indication_body_t *)tlv;
|
||||
|
||||
//printf("RX ULSCH BODY\n");
|
||||
//NFAPI_TRACE(NFAPI_TRACE_DEBUG, "RX ULSCH BODY\n");
|
||||
|
||||
if( push16(value->number_of_pdus, ppWritePackedMsg, end) == 0)
|
||||
return 0;
|
||||
@@ -2313,28 +2318,30 @@ static uint8_t pack_rx_ulsch_indication_body_value(void *tlv, uint8_t **ppWriteP
|
||||
uint16_t i = 0;
|
||||
uint16_t offset = 2; // taking into account the number_of_pdus
|
||||
uint16_t total_number_of_pdus = value->number_of_pdus;
|
||||
//printf("ULSCH:pdus:%d\n", total_number_of_pdus);
|
||||
//NFAPI_TRACE(NFAPI_TRACE_DEBUG, "ULSCH:pdus:%d\n", total_number_of_pdus);
|
||||
|
||||
assert(total_number_of_pdus <= NFAPI_RX_IND_MAX_PDU);
|
||||
for(i = 0; i < total_number_of_pdus; ++i) {
|
||||
nfapi_rx_indication_pdu_t *pdu = &(value->rx_pdu_list[i]);
|
||||
|
||||
if(pdu->rx_ue_information.tl.tag == NFAPI_RX_UE_INFORMATION_TAG) {
|
||||
//printf("NFAPI_RX_UE_INFORMATION_TAG\n");
|
||||
//NFAPI_TRACE(NFAPI_TRACE_DEBUG, "NFAPI_RX_UE_INFORMATION_TAG\n");
|
||||
offset += 4 + 6;
|
||||
}
|
||||
|
||||
if(pdu->rx_indication_rel8.tl.tag == NFAPI_RX_INDICATION_REL8_TAG) {
|
||||
//printf("NFAPI_RX_INDICATION_REL8_TAG\n");
|
||||
//NFAPI_TRACE(NFAPI_TRACE_DEBUG, "NFAPI_RX_INDICATION_REL8_TAG\n");
|
||||
offset += 4 + 7;
|
||||
}
|
||||
|
||||
if(pdu->rx_indication_rel9.tl.tag == NFAPI_RX_INDICATION_REL9_TAG) {
|
||||
//printf("NFAPI_RX_INDICATION_REL9_TAG\n");
|
||||
//NFAPI_TRACE(NFAPI_TRACE_DEBUG, "NFAPI_RX_INDICATION_REL9_TAG\n");
|
||||
offset += 4 + 2;
|
||||
}
|
||||
}
|
||||
|
||||
// Now update the structure to include the offset
|
||||
assert(total_number_of_pdus <= NFAPI_RX_IND_MAX_PDU);
|
||||
for(i =0; i < total_number_of_pdus; ++i) {
|
||||
nfapi_rx_indication_pdu_t *pdu = &(value->rx_pdu_list[i]);
|
||||
|
||||
@@ -2347,6 +2354,7 @@ static uint8_t pack_rx_ulsch_indication_body_value(void *tlv, uint8_t **ppWriteP
|
||||
}
|
||||
|
||||
// Write out the pdu
|
||||
assert(total_number_of_pdus <= NFAPI_RX_IND_MAX_PDU);
|
||||
for(i = 0; i < total_number_of_pdus; ++i) {
|
||||
nfapi_rx_indication_pdu_t *pdu = &(value->rx_pdu_list[i]);
|
||||
|
||||
@@ -2357,6 +2365,7 @@ static uint8_t pack_rx_ulsch_indication_body_value(void *tlv, uint8_t **ppWriteP
|
||||
}
|
||||
|
||||
// Write out the pdu data
|
||||
assert(total_number_of_pdus <= NFAPI_RX_IND_MAX_PDU);
|
||||
for(i = 0; i < total_number_of_pdus; ++i) {
|
||||
uint16_t length = 0;
|
||||
nfapi_rx_indication_pdu_t *pdu = &(value->rx_pdu_list[i]);
|
||||
@@ -2365,7 +2374,7 @@ static uint8_t pack_rx_ulsch_indication_body_value(void *tlv, uint8_t **ppWriteP
|
||||
length = pdu->rx_indication_rel8.length;
|
||||
}
|
||||
|
||||
if( pusharray8(value->rx_pdu_list[i].data, length, length, ppWritePackedMsg, end) == 0)
|
||||
if( pusharray8(value->rx_pdu_list[i].rx_ind_data, NFAPI_RX_IND_DATA_MAX, length, ppWritePackedMsg, end) == 0)
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -2584,6 +2593,7 @@ static uint8_t pack_cqi_indication_body_value(void *tlv, uint8_t **ppWritePacked
|
||||
uint16_t offset = 2; // taking into account the number_of_cqis
|
||||
uint16_t total_number_of_pdus = value->number_of_cqis;
|
||||
|
||||
assert(total_number_of_pdus <= NFAPI_CQI_IND_MAX_PDU);
|
||||
for(i = 0; i < total_number_of_pdus; ++i) {
|
||||
nfapi_cqi_indication_pdu_t *pdu = &(value->cqi_pdu_list[i]);
|
||||
offset += 2; // for the instance length
|
||||
@@ -2625,6 +2635,7 @@ static uint8_t pack_cqi_indication_body_value(void *tlv, uint8_t **ppWritePacked
|
||||
}
|
||||
|
||||
// Write out the cqi information
|
||||
assert(total_number_of_pdus <= NFAPI_CQI_IND_MAX_PDU);
|
||||
for(i = 0; i < total_number_of_pdus; ++i) {
|
||||
nfapi_cqi_indication_pdu_t *pdu = &(value->cqi_pdu_list[i]);
|
||||
uint8_t *instance_length_p = *ppWritePackedMsg;
|
||||
@@ -2645,6 +2656,7 @@ static uint8_t pack_cqi_indication_body_value(void *tlv, uint8_t **ppWritePacked
|
||||
}
|
||||
|
||||
// Write out the cqi raw data
|
||||
assert(total_number_of_pdus <= NFAPI_CQI_IND_MAX_PDU);
|
||||
for(i = 0; i < total_number_of_pdus; ++i) {
|
||||
uint16_t length = 0;
|
||||
nfapi_cqi_indication_pdu_t *pdu = &(value->cqi_pdu_list[i]);
|
||||
@@ -3008,7 +3020,10 @@ static uint8_t pack_nr_rx_data_indication_body(void* tlv, uint8_t **ppWritePacke
|
||||
push16(value->timing_advance, ppWritePackedMsg, end) &&
|
||||
push16(value->rssi, ppWritePackedMsg, end)
|
||||
))
|
||||
return 0;
|
||||
return 0;
|
||||
|
||||
if(pusharray8(value->pdu, value->pdu_length, value->pdu_length, ppWritePackedMsg, end) == 0)
|
||||
return 0;
|
||||
|
||||
return 1;
|
||||
}
|
||||
@@ -3022,22 +3037,21 @@ static uint8_t pack_nr_rx_data_indication(void *msg, uint8_t **ppWritePackedMsg,
|
||||
push16(pNfapiMsg->slot , ppWritePackedMsg, end) &&
|
||||
push16(pNfapiMsg->number_of_pdus, ppWritePackedMsg, end)
|
||||
))
|
||||
return 0;
|
||||
|
||||
for(int i=0; i<pNfapiMsg->number_of_pdus;i++)
|
||||
{
|
||||
if(!pack_nr_rx_data_indication_body(pNfapiMsg->pdu_list,ppWritePackedMsg,end))
|
||||
return 0;
|
||||
|
||||
for (int i = 0; i < pNfapiMsg->number_of_pdus; i++)
|
||||
{
|
||||
if(!pack_nr_rx_data_indication_body(&(pNfapiMsg->pdu_list[i]), ppWritePackedMsg, end))
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
return 1;
|
||||
}
|
||||
|
||||
//NR CRC INDICATION
|
||||
|
||||
static uint8_t pack_nr_crc_indication_body(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
|
||||
static uint8_t pack_nr_crc_indication_body(nfapi_nr_crc_t* value, uint8_t **ppWritePackedMsg, uint8_t *end)
|
||||
{
|
||||
nfapi_nr_crc_t* value = (nfapi_nr_crc_t*)tlv;
|
||||
|
||||
if(!(push32(value->handle, ppWritePackedMsg, end) &&
|
||||
push16(value->rnti, ppWritePackedMsg, end) &&
|
||||
@@ -3064,9 +3078,9 @@ static uint8_t pack_nr_crc_indication(void *msg, uint8_t **ppWritePackedMsg, uin
|
||||
))
|
||||
return 0;
|
||||
|
||||
for(int i=0; i<pNfapiMsg->number_crcs;i++)
|
||||
for (int i = 0; i < pNfapiMsg->number_crcs; i++)
|
||||
{
|
||||
if(!pack_nr_crc_indication_body(pNfapiMsg->crc_list,ppWritePackedMsg,end))
|
||||
if(!pack_nr_crc_indication_body(&pNfapiMsg->crc_list[i], ppWritePackedMsg, end))
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -3133,9 +3147,9 @@ static uint8_t pack_nr_rach_indication_body(void* tlv, uint8_t **ppWritePackedMs
|
||||
return 0;
|
||||
for(int i = 0; i < value->num_preamble; i++)
|
||||
{
|
||||
if(!(push8(value->preamble_list->preamble_index, ppWritePackedMsg, end) &&
|
||||
push16(value->preamble_list->timing_advance, ppWritePackedMsg, end) &&
|
||||
push32(value->preamble_list->preamble_pwr, ppWritePackedMsg, end)
|
||||
if(!(push8(value->preamble_list[i].preamble_index, ppWritePackedMsg, end) &&
|
||||
push16(value->preamble_list[i].timing_advance, ppWritePackedMsg, end) &&
|
||||
push32(value->preamble_list[i].preamble_pwr, ppWritePackedMsg, end)
|
||||
))
|
||||
return 0;
|
||||
}
|
||||
@@ -3177,23 +3191,22 @@ static uint8_t pack_nr_uci_pucch_0_1(void* tlv, uint8_t **ppWritePackedMsg, uint
|
||||
))
|
||||
return 0;
|
||||
if (value->pduBitmap & 0x01) { //SR
|
||||
if(!(push8(value->sr->sr_indication, ppWritePackedMsg, end) &&
|
||||
push8(value->sr->sr_confidence_level, ppWritePackedMsg, end)
|
||||
if (!(push8(value->sr->sr_indication, ppWritePackedMsg, end) &&
|
||||
push8(value->sr->sr_confidence_level, ppWritePackedMsg, end)
|
||||
))
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (((value->pduBitmap >> 1) & 0x01)) { //HARQ
|
||||
if(!(push8(value->harq->num_harq, ppWritePackedMsg, end) &&
|
||||
push8(value->harq->harq_confidence_level, ppWritePackedMsg, end)
|
||||
if (!(push8(value->harq->num_harq, ppWritePackedMsg, end) &&
|
||||
push8(value->harq->harq_confidence_level, ppWritePackedMsg, end)
|
||||
))
|
||||
return 0;
|
||||
|
||||
for(int i=0; i<value->harq->num_harq;i++)
|
||||
for (int i = 0; i < value->harq->num_harq; i++)
|
||||
{
|
||||
if(!(push8(value->harq->harq_list[i].harq_value, ppWritePackedMsg, end)
|
||||
if (!(push8(value->harq->harq_list[i].harq_value, ppWritePackedMsg, end)
|
||||
))
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3258,7 +3271,7 @@ static uint8_t pack_nr_uci_indication_body(void* tlv, uint8_t **ppWritePackedMsg
|
||||
|
||||
switch (value->pdu_type) {
|
||||
case NFAPI_NR_UCI_PUSCH_PDU_TYPE:
|
||||
printf("Unhandled NFAPI_NR_UCI_PUSCH_PDU_TYPE \n");
|
||||
NFAPI_TRACE(NFAPI_TRACE_WARN, "Unhandled NFAPI_NR_UCI_PUSCH_PDU_TYPE \n");
|
||||
break;
|
||||
|
||||
case NFAPI_NR_UCI_FORMAT_0_1_PDU_TYPE:
|
||||
@@ -3285,8 +3298,9 @@ static uint8_t pack_nr_uci_indication(void *msg, uint8_t **ppWritePackedMsg, uin
|
||||
|
||||
for(int i=0; i<pNfapiMsg->num_ucis;i++)
|
||||
{
|
||||
if(!pack_nr_uci_indication_body(pNfapiMsg->uci_list,ppWritePackedMsg,end))
|
||||
return 0;
|
||||
if (!pack_nr_uci_indication_body(&pNfapiMsg->uci_list[i], ppWritePackedMsg, end))
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
return 1;
|
||||
@@ -3307,13 +3321,6 @@ int nfapi_nr_p7_message_pack(void *pMessageBuf, void *pPackedBuf, uint32_t packe
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 Pack supplied pointers are null\n");
|
||||
return -1;
|
||||
}
|
||||
/*
|
||||
printf("\n P7 MESSAGE SENT: \n");
|
||||
for(int i=0; i< packedBufLen; i++){
|
||||
printf("%d", *(uint8_t *)(pMessageBuf + i));
|
||||
}
|
||||
printf("\n");
|
||||
*/
|
||||
// process the header
|
||||
if(!(push16(pMessageHeader->phy_id, &pWritePackedMessage, end) &&
|
||||
push16(pMessageHeader->message_id, &pWritePackedMessage, end) &&
|
||||
@@ -3349,7 +3356,6 @@ int nfapi_nr_p7_message_pack(void *pMessageBuf, void *pPackedBuf, uint32_t packe
|
||||
case NFAPI_NR_PHY_MSG_TYPE_UL_DCI_REQUEST:
|
||||
result = pack_ul_dci_request(pMessageHeader, &pWritePackedMessage, end, config);
|
||||
break;
|
||||
|
||||
case NFAPI_UE_RELEASE_REQUEST:
|
||||
result =pack_ue_release_request(pMessageHeader, &pWritePackedMessage, end, config);
|
||||
break;
|
||||
@@ -3465,13 +3471,6 @@ int nfapi_p7_message_pack(void *pMessageBuf, void *pPackedBuf, uint32_t packedBu
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
printf("\n P7 MESSAGE SENT: \n");
|
||||
for(int i=0; i< packedBufLen; i++){
|
||||
printf("%d", *(uint8_t *)(pMessageBuf + i));
|
||||
}
|
||||
printf("\n");
|
||||
*/
|
||||
// process the header
|
||||
if(!(push16(pMessageHeader->phy_id, &pWritePackedMessage, end) &&
|
||||
push16(pMessageHeader->message_id, &pWritePackedMessage, end) &&
|
||||
@@ -3651,7 +3650,6 @@ static uint8_t unpack_dl_tti_csi_rs_pdu_rel15_value(void *tlv, uint8_t **ppReadP
|
||||
static uint8_t unpack_dl_tti_pdcch_pdu_rel15_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end) {
|
||||
|
||||
nfapi_nr_dl_tti_pdcch_pdu_rel15_t* value = (nfapi_nr_dl_tti_pdcch_pdu_rel15_t*)tlv;
|
||||
|
||||
for(uint8_t i = 0; i < MAX_DCI_CORESET; ++i)
|
||||
{
|
||||
if(!(pull16(ppReadPackedMsg, &value->dci_pdu[i].RNTI, end) &&
|
||||
@@ -3738,7 +3736,8 @@ static uint8_t unpack_dl_tti_ssb_pdu_rel15_value(void *tlv, uint8_t **ppReadPack
|
||||
pull8(ppReadPackedMsg, &value->SsbSubcarrierOffset, end) &&
|
||||
pull16(ppReadPackedMsg, &value->ssbOffsetPointA, end) &&
|
||||
pull8(ppReadPackedMsg, &value->bchPayloadFlag, end) &&
|
||||
pull32(ppReadPackedMsg, &value->bchPayload, end)
|
||||
pull32(ppReadPackedMsg, &value->bchPayload, end) &&
|
||||
pull8(ppReadPackedMsg, &value->ssbRsrp, end)
|
||||
// TODO: pack precoding_and_beamforming too
|
||||
);
|
||||
}
|
||||
@@ -4404,6 +4403,7 @@ static uint8_t unpack_ul_tti_request_pucch_pdu(void *tlv, uint8_t **ppReadPacked
|
||||
pull8(ppReadPackedMsg, &pucch_pdu->cyclic_prefix, end) &&
|
||||
pull8(ppReadPackedMsg, &pucch_pdu->format_type, end) &&
|
||||
pull8(ppReadPackedMsg, &pucch_pdu->multi_slot_tx_indicator, end) &&
|
||||
pull8(ppReadPackedMsg, &pucch_pdu->pi_2bpsk, end) &&
|
||||
pull16(ppReadPackedMsg, &pucch_pdu->prb_start, end) &&
|
||||
pull16(ppReadPackedMsg, &pucch_pdu->prb_size, end) &&
|
||||
pull8(ppReadPackedMsg, &pucch_pdu->start_symbol_index, end) &&
|
||||
@@ -5364,7 +5364,7 @@ static uint8_t unpack_hi_dci0_request_body_value(void *tlv, uint8_t **ppReadPack
|
||||
|
||||
if(packedPduEnd > end) {
|
||||
// pdu end if past buffer end
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s pdu size to big %d %d\n", __FUNCTION__, packedPduEnd, end);
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s pdu size to big %p %p\n", __FUNCTION__, packedPduEnd, end);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -5464,7 +5464,6 @@ static uint8_t unpack_ul_dci_pdu_list_value(uint8_t **ppReadPackedMsg, uint8_t *
|
||||
pull16(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.ShiftIndex, end) &&
|
||||
pull8(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.precoderGranularity, end) &&
|
||||
pull16(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.numDlDci, end));
|
||||
|
||||
}
|
||||
|
||||
static uint8_t unpack_ul_dci_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t *config) {
|
||||
@@ -5654,12 +5653,13 @@ static uint8_t unpack_nr_slot_indication(uint8_t **ppReadPackedMsg, uint8_t *end
|
||||
return 1;
|
||||
}
|
||||
|
||||
//RX DATA INDICATION
|
||||
//RX DATA INDICATION
|
||||
|
||||
static uint8_t unpack_nr_rx_data_indication_body(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
|
||||
static uint8_t unpack_nr_rx_data_indication_body(nfapi_nr_rx_data_pdu_t* value,
|
||||
uint8_t **ppReadPackedMsg,
|
||||
uint8_t *end,
|
||||
nfapi_p7_codec_config_t* config)
|
||||
{
|
||||
nfapi_nr_rx_data_pdu_t* value = (nfapi_nr_rx_data_pdu_t*)tlv;
|
||||
|
||||
if(!(pull32(ppReadPackedMsg, &value->handle, end) &&
|
||||
pull16(ppReadPackedMsg, &value->rnti, end) &&
|
||||
pull8(ppReadPackedMsg, &value->harq_id, end) &&
|
||||
@@ -5668,7 +5668,16 @@ static uint8_t unpack_nr_rx_data_indication_body(void* tlv, uint8_t **ppReadPack
|
||||
pull16(ppReadPackedMsg, &value->timing_advance, end) &&
|
||||
pull16(ppReadPackedMsg, &value->rssi, end)
|
||||
))
|
||||
return 0;
|
||||
return 0;
|
||||
|
||||
uint16_t length = value->pdu_length;
|
||||
value->pdu = nfapi_p7_allocate(length, config);
|
||||
|
||||
if (pullarray8(ppReadPackedMsg, value->pdu, length, length, end) == 0)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s pullarray8 failure\n", __FUNCTION__);
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -5682,10 +5691,14 @@ static uint8_t unpack_nr_rx_data_indication(uint8_t **ppReadPackedMsg, uint8_t *
|
||||
pull16(ppReadPackedMsg, &pNfapiMsg->number_of_pdus, end)
|
||||
))
|
||||
return 0;
|
||||
if (pNfapiMsg->number_of_pdus > 0)
|
||||
{
|
||||
pNfapiMsg->pdu_list = nfapi_p7_allocate(sizeof(*pNfapiMsg->pdu_list) * pNfapiMsg->number_of_pdus, config);
|
||||
}
|
||||
|
||||
for(int i=0; i<pNfapiMsg->number_of_pdus;i++)
|
||||
for (int i = 0; i < pNfapiMsg->number_of_pdus; i++)
|
||||
{
|
||||
if(!unpack_nr_rx_data_indication_body(pNfapiMsg->pdu_list, ppReadPackedMsg, end))
|
||||
if(!unpack_nr_rx_data_indication_body(&pNfapiMsg->pdu_list[i], ppReadPackedMsg, end, config))
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -5715,21 +5728,23 @@ static uint8_t unpack_nr_crc_indication_body(nfapi_nr_crc_t* value, uint8_t **pp
|
||||
|
||||
static uint8_t unpack_nr_crc_indication(uint8_t **ppReadPackedMsg, uint8_t *end, nfapi_nr_crc_indication_t *msg, nfapi_p7_codec_config_t* config)
|
||||
{
|
||||
nfapi_nr_crc_indication_t *pNfapiMsg = (nfapi_nr_crc_indication_t *) msg;
|
||||
// pNfapiMsg = (nfapi_nr_crc_indication_t *) malloc(sizeof(nfapi_nr_crc_indication_t));
|
||||
// pNfapiMsg->crc_list = (nfapi_nr_crc_t *) malloc(sizeof(nfapi_nr_crc_t));
|
||||
nfapi_nr_crc_indication_t *pNfapiMsg = (nfapi_nr_crc_indication_t*)msg;
|
||||
|
||||
if (!(pull16(ppReadPackedMsg, &pNfapiMsg->sfn, end) &&
|
||||
pull16(ppReadPackedMsg, &pNfapiMsg->slot, end) &&
|
||||
if (!(pull16(ppReadPackedMsg, &pNfapiMsg->sfn , end) &&
|
||||
pull16(ppReadPackedMsg, &pNfapiMsg->slot , end) &&
|
||||
pull16(ppReadPackedMsg, &pNfapiMsg->number_crcs, end)
|
||||
))
|
||||
return 0;
|
||||
return 0;
|
||||
|
||||
for(int i=0; i<pNfapiMsg->number_crcs;i++)
|
||||
if (pNfapiMsg->number_crcs > 0)
|
||||
{
|
||||
pNfapiMsg->crc_list = nfapi_p7_allocate(sizeof(*pNfapiMsg->crc_list) * pNfapiMsg->number_crcs, config);
|
||||
}
|
||||
|
||||
for (int i = 0; i < pNfapiMsg->number_crcs; i++)
|
||||
{
|
||||
if(!unpack_nr_crc_indication_body(pNfapiMsg->crc_list,ppReadPackedMsg,end))
|
||||
//if(!unpack_nr_crc_indication_body(value,ppReadPackedMsg,end))
|
||||
return 0;
|
||||
if(!unpack_nr_crc_indication_body(&pNfapiMsg->crc_list[i], ppReadPackedMsg, end))
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
@@ -5780,9 +5795,11 @@ return 1;
|
||||
|
||||
//NR RACH
|
||||
|
||||
static uint8_t unpack_nr_rach_indication_body(nfapi_nr_prach_indication_pdu_t* tlv, uint8_t **ppReadPackedMsg, uint8_t *end)
|
||||
static uint8_t unpack_nr_rach_indication_body(nfapi_nr_prach_indication_pdu_t* value,
|
||||
uint8_t **ppReadPackedMsg,
|
||||
uint8_t *end,
|
||||
nfapi_p7_codec_config_t* config)
|
||||
{
|
||||
nfapi_nr_prach_indication_pdu_t* value = (nfapi_nr_prach_indication_pdu_t*)tlv;
|
||||
|
||||
if(!(pull16(ppReadPackedMsg, &value->phy_cell_id, end) &&
|
||||
pull8(ppReadPackedMsg, &value->symbol_index, end) &&
|
||||
@@ -5793,15 +5810,18 @@ static uint8_t unpack_nr_rach_indication_body(nfapi_nr_prach_indication_pdu_t* t
|
||||
pull8(ppReadPackedMsg, &value->num_preamble, end)
|
||||
))
|
||||
return 0;
|
||||
value->preamble_list = (nfapi_nr_prach_indication_preamble_t*) malloc(sizeof(nfapi_nr_prach_indication_preamble_t) * value->num_preamble);
|
||||
for(int i = 0; i < value->num_preamble; i++)
|
||||
{
|
||||
if(!(pull8(ppReadPackedMsg, &value->preamble_list->preamble_index, end) &&
|
||||
pull16(ppReadPackedMsg, &value->preamble_list->timing_advance, end) &&
|
||||
pull32(ppReadPackedMsg, &value->preamble_list->preamble_pwr, end)
|
||||
))
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (value->num_preamble > 0) {
|
||||
value->preamble_list = nfapi_p7_allocate(sizeof(*value->preamble_list) * value->num_preamble, config);
|
||||
for(int i = 0; i < value->num_preamble; i++)
|
||||
{
|
||||
if(!(pull8(ppReadPackedMsg, &value->preamble_list[i].preamble_index, end) &&
|
||||
pull16(ppReadPackedMsg, &value->preamble_list[i].timing_advance, end) &&
|
||||
pull32(ppReadPackedMsg, &value->preamble_list[i].preamble_pwr, end)
|
||||
))
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -5812,31 +5832,27 @@ static uint8_t unpack_nr_rach_indication(uint8_t **ppReadPackedMsg, uint8_t *end
|
||||
pull16(ppReadPackedMsg, &pNfapiMsg->slot , end) &&
|
||||
pull8(ppReadPackedMsg, &pNfapiMsg->number_of_pdus, end)
|
||||
))
|
||||
return 0;
|
||||
pNfapiMsg->pdu_list = (nfapi_nr_prach_indication_pdu_t*) malloc(sizeof(nfapi_nr_prach_indication_pdu_t) * pNfapiMsg->number_of_pdus);
|
||||
for(int i=0; i< pNfapiMsg->number_of_pdus;i++)
|
||||
{
|
||||
if(!unpack_nr_rach_indication_body(pNfapiMsg->pdu_list,ppReadPackedMsg,end))
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
if (pNfapiMsg->number_of_pdus > 0) {
|
||||
pNfapiMsg->pdu_list = nfapi_p7_allocate(sizeof(*pNfapiMsg->pdu_list) * pNfapiMsg->number_of_pdus, config);
|
||||
for(int i = 0; i < pNfapiMsg->number_of_pdus; i++)
|
||||
{
|
||||
if(!unpack_nr_rach_indication_body(&pNfapiMsg->pdu_list[i], ppReadPackedMsg, end, config))
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
//NR UCI
|
||||
//NR UCI
|
||||
|
||||
static uint8_t unpack_nr_uci_pucch_0_1(nfapi_nr_uci_pucch_pdu_format_0_1_t* tlv, uint8_t **ppReadPackedMsg, uint8_t *end) {
|
||||
nfapi_nr_uci_pucch_pdu_format_0_1_t* value = (nfapi_nr_uci_pucch_pdu_format_0_1_t*)tlv;
|
||||
static uint8_t unpack_nr_uci_pucch_0_1(nfapi_nr_uci_pucch_pdu_format_0_1_t *value,
|
||||
uint8_t **ppReadPackedMsg,
|
||||
uint8_t *end,
|
||||
nfapi_p7_codec_config_t *config) {
|
||||
|
||||
// uint8_t *ptr = *ppReadPackedMsg;
|
||||
// printf("\n Read P7 message uci_0_1 indication unpack: ");
|
||||
// while(ptr < end){
|
||||
// printf(" %d ", *ptr);
|
||||
// ptr++;
|
||||
// }
|
||||
// printf("\n");
|
||||
|
||||
if(!(pull8(ppReadPackedMsg, &value->pduBitmap, end) &&
|
||||
if (!(pull8(ppReadPackedMsg, &value->pduBitmap, end) &&
|
||||
pull32(ppReadPackedMsg, &value->handle, end) &&
|
||||
pull16(ppReadPackedMsg, &value->rnti, end) &&
|
||||
pull8(ppReadPackedMsg, &value->pucch_format, end) &&
|
||||
@@ -5846,26 +5862,45 @@ static uint8_t unpack_nr_uci_pucch_0_1(nfapi_nr_uci_pucch_pdu_format_0_1_t* tlv,
|
||||
))
|
||||
return 0;
|
||||
if (value->pduBitmap & 0x01) { //SR
|
||||
value->sr = (nfapi_nr_sr_pdu_0_1_t*) malloc(sizeof(nfapi_nr_sr_pdu_0_1_t));
|
||||
value->sr = nfapi_p7_allocate(sizeof(*value->sr), config);
|
||||
if (value->sr == NULL)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate sr pdu\n", __FUNCTION__);
|
||||
return 0;
|
||||
}
|
||||
if(!(pull8(ppReadPackedMsg, &value->sr->sr_indication, end) &&
|
||||
pull8(ppReadPackedMsg, &value->sr->sr_confidence_level, end)
|
||||
pull8(ppReadPackedMsg, &value->sr->sr_confidence_level, end)
|
||||
))
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (((value->pduBitmap >> 1) & 0x01)) { //HARQ
|
||||
value->harq = (nfapi_nr_harq_pdu_0_1_t*) malloc(sizeof(nfapi_nr_harq_pdu_0_1_t));
|
||||
if(!(pull8(ppReadPackedMsg, &value->harq->num_harq, end) &&
|
||||
pull8(ppReadPackedMsg, &value->harq->harq_confidence_level, end)
|
||||
))
|
||||
return 0;
|
||||
value->harq->harq_list = (nfapi_nr_harq_t*) malloc(sizeof(nfapi_nr_harq_t*) * value->harq->num_harq);
|
||||
for(int i=0; i<value->harq->num_harq;i++)
|
||||
{
|
||||
if(!(pull8(ppReadPackedMsg, &value->harq->harq_list->harq_value, end)
|
||||
))
|
||||
return 0;
|
||||
}
|
||||
|
||||
value->harq = nfapi_p7_allocate(sizeof(*value->harq), config);
|
||||
if (value->harq == NULL)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate nr_harq pdu\n", __FUNCTION__);
|
||||
return 0;
|
||||
}
|
||||
if (!(pull8(ppReadPackedMsg, &value->harq->num_harq, end) &&
|
||||
pull8(ppReadPackedMsg, &value->harq->harq_confidence_level, end)
|
||||
))
|
||||
return 0;
|
||||
value->harq->harq_list = NULL;
|
||||
if (value->harq->num_harq > 0) {
|
||||
value->harq->harq_list = nfapi_p7_allocate(sizeof(*value->harq->harq_list) * value->harq->num_harq, config);
|
||||
if (value->harq->harq_list == NULL)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate harq ind pdu list (count:%d)\n",
|
||||
__FUNCTION__, value->harq->num_harq);
|
||||
return 0;
|
||||
}
|
||||
for (int i = 0; i < value->harq->num_harq; i++) {
|
||||
if (!pull8(ppReadPackedMsg, &value->harq->harq_list[i].harq_value, end)) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 1;
|
||||
@@ -5930,7 +5965,10 @@ static uint8_t unpack_nr_uci_pucch_2_3_4(nfapi_nr_uci_pucch_pdu_format_2_3_4_t*
|
||||
return 1;
|
||||
}
|
||||
|
||||
static uint8_t unpack_nr_uci_indication_body(nfapi_nr_uci_t* value, uint8_t **ppReadPackedMsg, uint8_t *end)
|
||||
static uint8_t unpack_nr_uci_indication_body(nfapi_nr_uci_t *value,
|
||||
uint8_t **ppReadPackedMsg,
|
||||
uint8_t *end,
|
||||
nfapi_p7_codec_config_t *config)
|
||||
{
|
||||
if(!(pull16(ppReadPackedMsg, &value->pdu_type, end) &&
|
||||
pull16(ppReadPackedMsg, &value->pdu_size, end)
|
||||
@@ -5938,21 +5976,26 @@ static uint8_t unpack_nr_uci_indication_body(nfapi_nr_uci_t* value, uint8_t **pp
|
||||
return 0;
|
||||
|
||||
switch (value->pdu_type) {
|
||||
case NFAPI_NR_UCI_PUSCH_PDU_TYPE:
|
||||
printf("Unhandled NFAPI_NR_UCI_PUSCH_PDU_TYPE \n");
|
||||
break;
|
||||
case NFAPI_NR_UCI_PUSCH_PDU_TYPE:
|
||||
NFAPI_TRACE(NFAPI_TRACE_WARN, "Unhandled NFAPI_NR_UCI_PUSCH_PDU_TYPE \n");
|
||||
break;
|
||||
|
||||
case NFAPI_NR_UCI_FORMAT_0_1_PDU_TYPE: {
|
||||
nfapi_nr_uci_pucch_pdu_format_0_1_t* uci_pdu = &value->pucch_pdu_format_0_1;
|
||||
unpack_nr_uci_pucch_0_1(uci_pdu, ppReadPackedMsg, end);
|
||||
break;
|
||||
case NFAPI_NR_UCI_FORMAT_0_1_PDU_TYPE: {
|
||||
nfapi_nr_uci_pucch_pdu_format_0_1_t *uci_pdu = &value->pucch_pdu_format_0_1;
|
||||
if (!unpack_nr_uci_pucch_0_1(uci_pdu, ppReadPackedMsg, end, config))
|
||||
return 0;
|
||||
break;
|
||||
}
|
||||
case NFAPI_NR_UCI_FORMAT_2_3_4_PDU_TYPE: {
|
||||
nfapi_nr_uci_pucch_pdu_format_2_3_4_t *uci_pdu = &value->pucch_pdu_format_2_3_4;
|
||||
if (!unpack_nr_uci_pucch_2_3_4(uci_pdu, ppReadPackedMsg, end))
|
||||
return 0;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
NFAPI_TRACE(NFAPI_TRACE_WARN, "Unexpected pdu type %d\n", value->pdu_type);
|
||||
break;
|
||||
}
|
||||
case NFAPI_NR_UCI_FORMAT_2_3_4_PDU_TYPE: {
|
||||
nfapi_nr_uci_pucch_pdu_format_2_3_4_t *uci_pdu = &value->pucch_pdu_format_2_3_4;
|
||||
unpack_nr_uci_pucch_2_3_4(uci_pdu, ppReadPackedMsg, end);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
@@ -5967,13 +6010,14 @@ static uint8_t unpack_nr_uci_indication(uint8_t **ppReadPackedMsg, uint8_t *end,
|
||||
))
|
||||
return 0;
|
||||
|
||||
for(int i=0; i<pNfapiMsg->num_ucis;i++)
|
||||
pNfapiMsg->uci_list = nfapi_p7_allocate(sizeof(*pNfapiMsg->uci_list) * pNfapiMsg->num_ucis, config);
|
||||
for (int i = 0; i < pNfapiMsg->num_ucis; i++)
|
||||
{
|
||||
if(!unpack_nr_uci_indication_body(pNfapiMsg->uci_list,ppReadPackedMsg,end))
|
||||
return 0;
|
||||
if(!unpack_nr_uci_indication_body(&pNfapiMsg->uci_list[i], ppReadPackedMsg, end, config))
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
return 1;
|
||||
}
|
||||
|
||||
static uint8_t unpack_ue_release_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t *config) {
|
||||
@@ -6233,6 +6277,7 @@ static uint8_t unpack_harq_indication_body_value(void *tlv, uint8_t **ppReadPack
|
||||
return 0;
|
||||
}
|
||||
|
||||
assert(value->number_of_harqs <= NFAPI_HARQ_IND_MAX_PDU);
|
||||
value->harq_pdu_list = (nfapi_harq_indication_pdu_t *)nfapi_p7_allocate(sizeof(nfapi_harq_indication_pdu_t) * value->number_of_harqs, config);
|
||||
|
||||
if(value->harq_pdu_list == NULL) {
|
||||
@@ -6297,7 +6342,8 @@ static uint8_t unpack_crc_indication_body_value(void *tlv, uint8_t **ppReadPacke
|
||||
}
|
||||
|
||||
if(value->number_of_crcs > 0) {
|
||||
value->crc_pdu_list = (nfapi_crc_indication_pdu_t *)nfapi_p7_allocate(sizeof(nfapi_crc_indication_pdu_t) * value->number_of_crcs, config);
|
||||
assert(value->number_of_crcs <= NFAPI_CRC_IND_MAX_PDU);
|
||||
value->crc_pdu_list = (nfapi_crc_indication_pdu_t *)nfapi_p7_allocate(sizeof(nfapi_crc_indication_pdu_t) * NFAPI_CRC_IND_MAX_PDU, config);
|
||||
|
||||
if(value->crc_pdu_list == NULL) {
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate crc ind pdu list (count:%d)\n", __FUNCTION__, value->number_of_crcs);
|
||||
@@ -6349,114 +6395,141 @@ static uint8_t unpack_rx_indication_rel9_value(void *tlv, uint8_t **ppReadPacked
|
||||
return (pull16(ppReadPackedMsg, &value->timing_advance_r9, end));
|
||||
}
|
||||
|
||||
static uint8_t unpack_rx_indication_body_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end, nfapi_p7_codec_config_t *config) {
|
||||
nfapi_rx_indication_body_t *value = (nfapi_rx_indication_body_t *)tlv;
|
||||
// the rxBodyEnd points to the end of the cqi PDU's
|
||||
uint8_t *rxBodyEnd = *ppReadPackedMsg + value->tl.length;
|
||||
uint8_t *rxPduEnd = rxBodyEnd;
|
||||
uint8_t *numberOfPdusAddress = *ppReadPackedMsg;
|
||||
static uint8_t unpack_rx_indication_body_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end, nfapi_p7_codec_config_t *config)
|
||||
{
|
||||
nfapi_rx_indication_body_t *value = (nfapi_rx_indication_body_t*)tlv;
|
||||
|
||||
if(rxBodyEnd > end) {
|
||||
// pdu end is past buffer end
|
||||
return 0;
|
||||
}
|
||||
NFAPI_TRACE(NFAPI_TRACE_DEBUG, "%s value->tl.length in unpack: %u \n", __FUNCTION__,
|
||||
value->tl.length);
|
||||
uint8_t *rxBodyEnd = *ppReadPackedMsg + value->tl.length;
|
||||
|
||||
if(pull16(ppReadPackedMsg, &value->number_of_pdus, end) == 0)
|
||||
return 0;
|
||||
NFAPI_TRACE(NFAPI_TRACE_DEBUG, "%s rxBodyEnd: %p end: %p\n", __FUNCTION__,
|
||||
rxBodyEnd, end);
|
||||
if (rxBodyEnd > end)
|
||||
{
|
||||
// pdu end is past buffer end
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(value->number_of_pdus > NFAPI_RX_IND_MAX_PDU) {
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s number of rx ind pdu's exceed maxium (count:%d max:%d)\n", __FUNCTION__, value->number_of_pdus, NFAPI_RX_IND_MAX_PDU);
|
||||
return 0;
|
||||
}
|
||||
if (pull16(ppReadPackedMsg, &value->number_of_pdus, end) == 0)
|
||||
return 0;
|
||||
|
||||
if(value->number_of_pdus > 0) {
|
||||
value->rx_pdu_list = (nfapi_rx_indication_pdu_t *)nfapi_p7_allocate(sizeof(nfapi_rx_indication_pdu_t) * value->number_of_pdus, config);
|
||||
if (value->number_of_pdus > NFAPI_RX_IND_MAX_PDU)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s number of rx ind pdu's exceed maxium (count:%d max:%d)\n", __FUNCTION__, value->number_of_pdus, NFAPI_RX_IND_MAX_PDU);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(value->rx_pdu_list == NULL) {
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate rx ind pdu list (count:%d)\n", __FUNCTION__, value->number_of_pdus);
|
||||
return 0;
|
||||
}
|
||||
} else {
|
||||
value->rx_pdu_list = 0;
|
||||
}
|
||||
if (value->number_of_pdus > 0)
|
||||
{
|
||||
assert(value->number_of_pdus <= NFAPI_RX_IND_MAX_PDU);
|
||||
value->rx_pdu_list = (nfapi_rx_indication_pdu_t *)nfapi_p7_allocate(sizeof(nfapi_rx_indication_pdu_t) * NFAPI_RX_IND_MAX_PDU, config);
|
||||
if (value->rx_pdu_list == NULL)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate rx ind pdu list (count:%d)\n", __FUNCTION__, value->number_of_pdus);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
value->rx_pdu_list = 0;
|
||||
}
|
||||
|
||||
uint8_t i = 0;
|
||||
nfapi_rx_indication_pdu_t *pdu = 0;
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "%s number_of_pdus = %u\n", __FUNCTION__, value->number_of_pdus);
|
||||
for (int i = 0; i < value->number_of_pdus; i++)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "%s i = %u\n", __FUNCTION__, i);
|
||||
nfapi_tl_t generic_tl;
|
||||
|
||||
while((uint8_t *)(*ppReadPackedMsg) < rxBodyEnd && (uint8_t *)(*ppReadPackedMsg) < rxPduEnd) {
|
||||
nfapi_tl_t generic_tl;
|
||||
// NFAPI_RX_UE_INFORMATION_TAG
|
||||
if (unpack_tl(ppReadPackedMsg, &generic_tl, end) == 0)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s unpack_tl failed\n", __FUNCTION__);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if( unpack_tl(ppReadPackedMsg, &generic_tl, end) == 0)
|
||||
return 0;
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "%s generic_tl.tag = 0x%x length = %u\n", __FUNCTION__, generic_tl.tag, generic_tl.length);
|
||||
|
||||
switch(generic_tl.tag) {
|
||||
case NFAPI_RX_UE_INFORMATION_TAG: {
|
||||
pdu = &(value->rx_pdu_list[i++]);
|
||||
pdu->rx_ue_information.tl = generic_tl;
|
||||
if (generic_tl.tag != NFAPI_RX_UE_INFORMATION_TAG)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s generic_tl.tag wrong\n", __FUNCTION__);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(unpack_rx_ue_information_value(&pdu->rx_ue_information, ppReadPackedMsg, end) == 0)
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
assert(i < NFAPI_RX_IND_MAX_PDU);
|
||||
nfapi_rx_indication_pdu_t *pdu = &value->rx_pdu_list[i];
|
||||
|
||||
case NFAPI_RX_INDICATION_REL8_TAG: {
|
||||
if(pdu != 0) {
|
||||
pdu->rx_indication_rel8.tl = generic_tl;
|
||||
pdu->rx_ue_information.tl = generic_tl;
|
||||
if (unpack_rx_ue_information_value(&pdu->rx_ue_information, ppReadPackedMsg, end) == 0)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s unpack_rx_ue_info failure\n", __FUNCTION__);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(unpack_rx_indication_rel8_value(&pdu->rx_indication_rel8, ppReadPackedMsg, end) == 0)
|
||||
return 0;
|
||||
// NFAPI_RX_INDICATION_REL8_TAG
|
||||
if (unpack_tl(ppReadPackedMsg, &generic_tl, end) == 0)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s unpack_tl failed\n", __FUNCTION__);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(pdu->rx_indication_rel8.offset > 0) {
|
||||
// Need to check that the data is within the tlv
|
||||
if(numberOfPdusAddress + pdu->rx_indication_rel8.offset + pdu->rx_indication_rel8.length <= rxBodyEnd) {
|
||||
// If this the first pdu set the rxPduEnd
|
||||
if(numberOfPdusAddress + pdu->rx_indication_rel8.offset < rxPduEnd) {
|
||||
rxPduEnd = numberOfPdusAddress + pdu->rx_indication_rel8.offset;
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "%s generic_tl.tag = 0x%x length = %u\n", __FUNCTION__, generic_tl.tag, generic_tl.length);
|
||||
|
||||
if(rxPduEnd > end) {
|
||||
// pdu end is past buffer end
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "FIXME: the rx data is outside of the tlv\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
if (generic_tl.tag != NFAPI_RX_INDICATION_REL8_TAG)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s generic_tl.tag wrong\n", __FUNCTION__);
|
||||
return 0;
|
||||
}
|
||||
|
||||
case NFAPI_RX_INDICATION_REL9_TAG: {
|
||||
if(pdu != 0) {
|
||||
pdu->rx_indication_rel9.tl = generic_tl;
|
||||
pdu->rx_indication_rel8.tl = generic_tl;
|
||||
if (unpack_rx_indication_rel8_value(&pdu->rx_indication_rel8, ppReadPackedMsg, end) == 0)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s unpack_rx_indication_rel8 failure\n", __FUNCTION__);
|
||||
return 0;
|
||||
}
|
||||
//What is offset not stripping 10 bytes
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "%s pdu->rx_indication_rel8.offset = %u", __FUNCTION__,
|
||||
pdu->rx_indication_rel8.offset);
|
||||
|
||||
if(unpack_rx_indication_rel9_value(&pdu->rx_indication_rel9, ppReadPackedMsg, end) == 0)
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
break;
|
||||
// NFAPI_RX_INDICATION_REL9_TAG
|
||||
if (unpack_tl(ppReadPackedMsg, &generic_tl, end) == 0)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s unpack_tl failed\n", __FUNCTION__);
|
||||
return 0;
|
||||
}
|
||||
|
||||
default: {
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "RX_ULSCH.indication Invalid pdu type %d \n", generic_tl.tag );
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "%s generic_tl.tag = 0x%x length = %u\n", __FUNCTION__, generic_tl.tag, generic_tl.length);
|
||||
|
||||
uint8_t idx = 0;
|
||||
if (generic_tl.tag != NFAPI_RX_INDICATION_REL9_TAG)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s generic_tl.tag wrong\n", __FUNCTION__);
|
||||
return 0;
|
||||
}
|
||||
|
||||
for(idx = 0; idx < value->number_of_pdus; ++idx) {
|
||||
if(value->rx_pdu_list[idx].rx_indication_rel8.tl.tag == NFAPI_RX_INDICATION_REL8_TAG) {
|
||||
uint32_t length = value->rx_pdu_list[idx].rx_indication_rel8.length;
|
||||
value->rx_pdu_list[idx].data = nfapi_p7_allocate(length, config);
|
||||
pdu->rx_indication_rel9.tl = generic_tl;
|
||||
if (unpack_rx_indication_rel9_value(&pdu->rx_indication_rel9, ppReadPackedMsg, end) == 0)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s unpack_rx_indication_rel9 failure\n", __FUNCTION__);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
if(pullarray8(ppReadPackedMsg, value->rx_pdu_list[idx].data, length, length, end) == 0) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
assert(value->number_of_pdus <= NFAPI_RX_IND_MAX_PDU);
|
||||
for (int i = 0; i < value->number_of_pdus; ++i)
|
||||
{
|
||||
nfapi_rx_indication_pdu_t *pdu = &value->rx_pdu_list[i];
|
||||
if (pdu->rx_indication_rel8.tl.tag == NFAPI_RX_INDICATION_REL8_TAG)
|
||||
{
|
||||
uint32_t length = pdu->rx_indication_rel8.length;
|
||||
if (pullarray8(ppReadPackedMsg, pdu->rx_ind_data, NFAPI_RX_IND_DATA_MAX, length, end) == 0)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s pullarray8 failure\n", __FUNCTION__);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 1;
|
||||
return 1;
|
||||
}
|
||||
|
||||
static uint8_t unpack_rx_indication(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t *config) {
|
||||
@@ -7414,12 +7487,10 @@ static int check_nr_unpack_length(nfapi_message_id_e msgId, uint32_t unpackedBuf
|
||||
if (unpackedBufLen >= sizeof(nfapi_nr_tx_data_request_t))
|
||||
retLen = sizeof(nfapi_nr_tx_data_request_t);
|
||||
break;
|
||||
|
||||
case NFAPI_NR_PHY_MSG_TYPE_RX_DATA_INDICATION:
|
||||
if (unpackedBufLen >= sizeof(nfapi_nr_rx_data_indication_t))
|
||||
retLen = sizeof(nfapi_nr_rx_data_indication_t);
|
||||
break;
|
||||
|
||||
case NFAPI_NR_PHY_MSG_TYPE_CRC_INDICATION:
|
||||
if (unpackedBufLen >= sizeof(nfapi_nr_crc_indication_t))
|
||||
retLen = sizeof(nfapi_nr_crc_indication_t);
|
||||
@@ -7429,17 +7500,14 @@ static int check_nr_unpack_length(nfapi_message_id_e msgId, uint32_t unpackedBuf
|
||||
if (unpackedBufLen >= sizeof(nfapi_nr_rach_indication_t))
|
||||
retLen = sizeof(nfapi_nr_rach_indication_t);
|
||||
break;
|
||||
|
||||
case NFAPI_NR_PHY_MSG_TYPE_UCI_INDICATION:
|
||||
if (unpackedBufLen >= sizeof(nfapi_nr_uci_indication_t))
|
||||
retLen = sizeof(nfapi_nr_uci_indication_t);
|
||||
break;
|
||||
|
||||
case NFAPI_NR_PHY_MSG_TYPE_SRS_INDICATION:
|
||||
if (unpackedBufLen >= sizeof(nfapi_nr_srs_indication_t))
|
||||
retLen = sizeof(nfapi_nr_srs_indication_t);
|
||||
break;
|
||||
|
||||
case NFAPI_NR_PHY_MSG_TYPE_DL_NODE_SYNC:
|
||||
if (unpackedBufLen >= sizeof(nfapi_nr_dl_node_sync_t))
|
||||
retLen = sizeof(nfapi_nr_dl_node_sync_t);
|
||||
@@ -7758,14 +7826,6 @@ int nfapi_nr_p7_message_unpack(void *pMessageBuf, uint32_t messageBufLen, void *
|
||||
return -1;
|
||||
}
|
||||
|
||||
// uint8_t *ptr = pMessageBuf;
|
||||
// printf("\n Read P7 message unpack: ");
|
||||
// while(ptr < end){
|
||||
// printf(" %d ", *ptr);
|
||||
// ptr++;
|
||||
// }
|
||||
// printf("\n");
|
||||
|
||||
// clean the supplied buffer for - tag value blanking
|
||||
(void)memset(pUnpackedBuf, 0, unpackedBufLen);
|
||||
|
||||
@@ -7823,7 +7883,6 @@ int nfapi_nr_p7_message_unpack(void *pMessageBuf, uint32_t messageBufLen, void *
|
||||
else
|
||||
return -1;
|
||||
break;
|
||||
|
||||
case NFAPI_UE_RELEASE_REQUEST:
|
||||
if (check_nr_unpack_length(NFAPI_UE_RELEASE_REQUEST, unpackedBufLen))
|
||||
result = unpack_ue_release_request(&pReadPackedMessage, end, pMessageHeader, config);
|
||||
|
||||
@@ -148,6 +148,7 @@ typedef struct {
|
||||
int pnf_p7_message_pump(pnf_p7_t* pnf_p7);
|
||||
int pnf_nr_p7_message_pump(pnf_p7_t* pnf_p7);
|
||||
int pnf_p7_pack_and_send_p7_message(pnf_p7_t* pnf_p7, nfapi_p7_message_header_t* msg, uint32_t msg_len);
|
||||
int pnf_nr_p7_pack_and_send_p7_message(pnf_p7_t* pnf_p7, nfapi_p7_message_header_t* header, uint32_t msg_len);
|
||||
int pnf_p7_send_message(pnf_p7_t* pnf_p7, uint8_t* msg, uint32_t msg_len);
|
||||
|
||||
|
||||
|
||||
@@ -800,6 +800,7 @@ int nfapi_pnf_p7_harq_ind(nfapi_pnf_p7_config_t* config, nfapi_harq_indication_t
|
||||
* \return 0 means success, -1 means failure
|
||||
*/
|
||||
int nfapi_pnf_p7_crc_ind(nfapi_pnf_p7_config_t* config, nfapi_crc_indication_t* ind);
|
||||
int nfapi_pnf_p7_nr_crc_ind(nfapi_pnf_p7_config_t* config, nfapi_nr_crc_indication_t* ind);
|
||||
|
||||
/*! Send the RX.indication
|
||||
* \param config A pointer to a PNF P7 config
|
||||
@@ -807,6 +808,7 @@ int nfapi_pnf_p7_crc_ind(nfapi_pnf_p7_config_t* config, nfapi_crc_indication_t*
|
||||
* \return 0 means success, -1 means failure
|
||||
*/
|
||||
int nfapi_pnf_p7_rx_ind(nfapi_pnf_p7_config_t* config, nfapi_rx_indication_t* ind);
|
||||
int nfapi_pnf_p7_nr_rx_data_ind(nfapi_pnf_p7_config_t* config, nfapi_nr_rx_data_indication_t* ind);
|
||||
|
||||
/*! Send the RACH.indication
|
||||
* \param config A pointer to a PNF P7 config
|
||||
@@ -821,6 +823,7 @@ int nfapi_pnf_p7_rach_ind(nfapi_pnf_p7_config_t* config, nfapi_rach_indication_t
|
||||
* \return 0 means success, -1 means failure
|
||||
*/
|
||||
int nfapi_pnf_p7_srs_ind(nfapi_pnf_p7_config_t* config, nfapi_srs_indication_t* ind);
|
||||
int nfapi_pnf_p7_nr_srs_ind(nfapi_pnf_p7_config_t* config, nfapi_nr_srs_indication_t* ind);
|
||||
|
||||
/*! Send the SR.indication
|
||||
* \param config A pointer to a PNF P7 config
|
||||
@@ -842,6 +845,7 @@ int nfapi_pnf_p7_cqi_ind(nfapi_pnf_p7_config_t* config, nfapi_cqi_indication_t*
|
||||
* \return 0 means success, -1 means failure
|
||||
*/
|
||||
int nfapi_pnf_p7_lbt_dl_ind(nfapi_pnf_p7_config_t* config, nfapi_lbt_dl_indication_t* ind);
|
||||
int nfapi_pnf_p7_nr_uci_ind(nfapi_pnf_p7_config_t* config, nfapi_nr_uci_indication_t* ind);
|
||||
|
||||
/*! Send the NB_HARQ.indication
|
||||
* \param config A pointer to a PNF P7 config
|
||||
@@ -856,6 +860,7 @@ int nfapi_pnf_p7_nb_harq_ind(nfapi_pnf_p7_config_t* config, nfapi_nb_harq_indica
|
||||
* \return 0 means success, -1 means failure
|
||||
*/
|
||||
int nfapi_pnf_p7_nrach_ind(nfapi_pnf_p7_config_t* config, nfapi_nrach_indication_t* ind);
|
||||
int nfapi_pnf_p7_nr_rach_ind(nfapi_pnf_p7_config_t* config, nfapi_nr_rach_indication_t* ind);
|
||||
|
||||
|
||||
/*! Send a vendor exntesion message
|
||||
|
||||
+118
-113
@@ -1,12 +1,12 @@
|
||||
/*
|
||||
* Copyright 2017 Cisco Systems, Inc.
|
||||
*
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
@@ -93,9 +93,9 @@ void pnf_nr_handle_pnf_param_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
|
||||
else
|
||||
{
|
||||
nfapi_nr_pnf_param_request_t req;
|
||||
|
||||
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "PNF_PARAM.request received\n");
|
||||
|
||||
|
||||
// unpack the message
|
||||
if (nfapi_nr_p5_message_unpack(pRecvMsg, recvMsgLen, &req, sizeof(nfapi_nr_pnf_param_request_t), &pnf->_public.codec_config) >= 0)
|
||||
{
|
||||
@@ -109,7 +109,7 @@ void pnf_nr_handle_pnf_param_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
|
||||
else
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: PNF not in IDLE state\n", __FUNCTION__);
|
||||
|
||||
|
||||
nfapi_nr_pnf_param_response_t resp;
|
||||
memset(&resp, 0, sizeof(resp));
|
||||
resp.header.message_id = NFAPI_NR_PHY_MSG_TYPE_PNF_PARAM_RESPONSE;
|
||||
@@ -121,7 +121,7 @@ void pnf_nr_handle_pnf_param_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Unpack message failed, ignoring\n", __FUNCTION__);
|
||||
}
|
||||
|
||||
|
||||
if(req.vendor_extension)
|
||||
pnf->_public.codec_config.deallocate(req.vendor_extension);
|
||||
}
|
||||
@@ -137,9 +137,9 @@ void pnf_handle_pnf_param_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
|
||||
else
|
||||
{
|
||||
nfapi_pnf_param_request_t req;
|
||||
|
||||
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "PNF_PARAM.request received\n");
|
||||
|
||||
|
||||
// unpack the message
|
||||
if (nfapi_p5_message_unpack(pRecvMsg, recvMsgLen, &req, sizeof(nfapi_pnf_param_request_t), &pnf->_public.codec_config) >= 0)
|
||||
{
|
||||
@@ -153,7 +153,7 @@ void pnf_handle_pnf_param_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
|
||||
else
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: PNF not in IDLE state\n", __FUNCTION__);
|
||||
|
||||
|
||||
nfapi_pnf_param_response_t resp;
|
||||
memset(&resp, 0, sizeof(resp));
|
||||
resp.header.message_id = NFAPI_PNF_PARAM_RESPONSE;
|
||||
@@ -165,7 +165,7 @@ void pnf_handle_pnf_param_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Unpack message failed, ignoring\n", __FUNCTION__);
|
||||
}
|
||||
|
||||
|
||||
if(req.vendor_extension)
|
||||
pnf->_public.codec_config.deallocate(req.vendor_extension);
|
||||
}
|
||||
@@ -185,7 +185,7 @@ void pnf_handle_pnf_config_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
|
||||
nfapi_pnf_config_request_t req;
|
||||
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "PNF_CONFIG.request received\n");
|
||||
|
||||
|
||||
// unpack the message
|
||||
if (nfapi_p5_message_unpack(pRecvMsg, recvMsgLen, &req, sizeof(req), &pnf->_public.codec_config) >= 0)
|
||||
{
|
||||
@@ -194,7 +194,7 @@ void pnf_handle_pnf_config_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
|
||||
{
|
||||
// delete the phy records
|
||||
nfapi_pnf_phy_config_delete_all(&pnf->_public);
|
||||
|
||||
|
||||
// create the phy records
|
||||
if (req.pnf_phy_rf_config.tl.tag == NFAPI_PNF_PHY_RF_TAG)
|
||||
{
|
||||
@@ -203,14 +203,14 @@ void pnf_handle_pnf_config_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
|
||||
{
|
||||
nfapi_pnf_phy_config_t* phy = (nfapi_pnf_phy_config_t*)malloc(sizeof(nfapi_pnf_phy_config_t));
|
||||
memset(phy, 0, sizeof(nfapi_pnf_phy_config_t));
|
||||
|
||||
|
||||
phy->state = NFAPI_PNF_PHY_IDLE;
|
||||
phy->phy_id = req.pnf_phy_rf_config.phy_rf_config[i].phy_id;
|
||||
|
||||
|
||||
nfapi_pnf_phy_config_add(&(pnf->_public), phy);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(pnf->_public.pnf_config_req)
|
||||
{
|
||||
(pnf->_public.pnf_config_req)(&(pnf->_public), &req);
|
||||
@@ -219,7 +219,7 @@ void pnf_handle_pnf_config_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
|
||||
else
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: PNF not in correct state: %d\n", __FUNCTION__, pnf->_public.state);
|
||||
|
||||
|
||||
nfapi_pnf_config_response_t resp;
|
||||
memset(&resp, 0, sizeof(resp));
|
||||
resp.header.message_id = NFAPI_PNF_CONFIG_RESPONSE;
|
||||
@@ -251,7 +251,7 @@ void pnf_nr_handle_pnf_config_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen
|
||||
nfapi_nr_pnf_config_request_t req;
|
||||
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "PNF_CONFIG.request received\n");
|
||||
|
||||
|
||||
// unpack the message
|
||||
if (nfapi_nr_p5_message_unpack(pRecvMsg, recvMsgLen, &req, sizeof(req), &pnf->_public.codec_config) >= 0)
|
||||
{
|
||||
@@ -260,7 +260,7 @@ void pnf_nr_handle_pnf_config_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen
|
||||
{
|
||||
// delete the phy records
|
||||
nfapi_pnf_phy_config_delete_all(&pnf->_public);
|
||||
|
||||
|
||||
// create the phy records
|
||||
if (req.pnf_phy_rf_config.tl.tag == NFAPI_PNF_PHY_RF_TAG)
|
||||
{
|
||||
@@ -269,14 +269,14 @@ void pnf_nr_handle_pnf_config_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen
|
||||
{
|
||||
nfapi_pnf_phy_config_t* phy = (nfapi_pnf_phy_config_t*)malloc(sizeof(nfapi_pnf_phy_config_t));
|
||||
memset(phy, 0, sizeof(nfapi_pnf_phy_config_t));
|
||||
|
||||
|
||||
phy->state = NFAPI_PNF_PHY_IDLE;
|
||||
phy->phy_id = req.pnf_phy_rf_config.phy_rf_config[i].phy_id;
|
||||
|
||||
|
||||
nfapi_pnf_phy_config_add(&(pnf->_public), phy);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(pnf->_public.pnf_nr_config_req)
|
||||
{
|
||||
(pnf->_public.pnf_nr_config_req)(&(pnf->_public), &req);
|
||||
@@ -285,7 +285,7 @@ void pnf_nr_handle_pnf_config_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen
|
||||
else
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: PNF not in correct state: %d\n", __FUNCTION__, pnf->_public.state);
|
||||
|
||||
|
||||
nfapi_nr_pnf_config_response_t resp;
|
||||
memset(&resp, 0, sizeof(resp));
|
||||
resp.header.message_id = NFAPI_PNF_CONFIG_RESPONSE;
|
||||
@@ -315,7 +315,7 @@ void pnf_handle_pnf_start_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
|
||||
nfapi_pnf_start_request_t req;
|
||||
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "PNF_START.request Received\n");
|
||||
|
||||
|
||||
// unpack the message
|
||||
if (nfapi_p5_message_unpack(pRecvMsg, recvMsgLen, &req, sizeof(req), &pnf->_public.codec_config) >= 0)
|
||||
{
|
||||
@@ -357,7 +357,7 @@ void pnf_nr_handle_pnf_start_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
|
||||
nfapi_nr_pnf_start_request_t req;
|
||||
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "PNF_START.request Received\n");
|
||||
|
||||
|
||||
// unpack the message
|
||||
if (nfapi_nr_p5_message_unpack(pRecvMsg, recvMsgLen, &req, sizeof(req), &pnf->_public.codec_config) >= 0)
|
||||
{
|
||||
@@ -397,9 +397,9 @@ void pnf_handle_pnf_stop_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
|
||||
else
|
||||
{
|
||||
nfapi_pnf_stop_request_t req;
|
||||
|
||||
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "PNF_STOP.request Received\n");
|
||||
|
||||
|
||||
// unpack the message
|
||||
if (nfapi_p5_message_unpack(pRecvMsg, recvMsgLen, &req, sizeof(req), &pnf->_public.codec_config) >= 0)
|
||||
{
|
||||
@@ -423,7 +423,7 @@ void pnf_handle_pnf_stop_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Unpack message failed, ignoring\n", __FUNCTION__);
|
||||
}
|
||||
|
||||
|
||||
|
||||
if(req.vendor_extension)
|
||||
pnf->_public.codec_config.deallocate(req.vendor_extension);
|
||||
@@ -440,11 +440,11 @@ void pnf_handle_param_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
|
||||
else
|
||||
{
|
||||
nfapi_param_request_t req;
|
||||
|
||||
|
||||
nfapi_pnf_config_t* config = &(pnf->_public);
|
||||
|
||||
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "PARAM.request received\n");
|
||||
|
||||
|
||||
// unpack the message
|
||||
if (nfapi_p5_message_unpack(pRecvMsg, recvMsgLen, &req, sizeof(req), &config->codec_config) >= 0)
|
||||
{
|
||||
@@ -479,7 +479,7 @@ void pnf_handle_param_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
|
||||
resp.error_code = NFAPI_MSG_INVALID_CONFIG;
|
||||
nfapi_pnf_param_resp(config, &resp);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -495,7 +495,7 @@ void pnf_handle_param_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Unpack message failed, ignoring\n", __FUNCTION__);
|
||||
}
|
||||
|
||||
|
||||
if(req.vendor_extension)
|
||||
pnf->_public.codec_config.deallocate(req.vendor_extension);
|
||||
|
||||
@@ -512,11 +512,11 @@ void pnf_nr_handle_param_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
|
||||
else
|
||||
{
|
||||
nfapi_nr_param_request_scf_t req;
|
||||
|
||||
|
||||
nfapi_pnf_config_t* config = &(pnf->_public);
|
||||
|
||||
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "PARAM.request received\n");
|
||||
|
||||
|
||||
// unpack the message
|
||||
if (nfapi_nr_p5_message_unpack(pRecvMsg, recvMsgLen, &req, sizeof(req), &config->codec_config) >= 0)
|
||||
{
|
||||
@@ -551,7 +551,7 @@ void pnf_nr_handle_param_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
|
||||
resp.error_code = NFAPI_MSG_INVALID_CONFIG;
|
||||
nfapi_nr_pnf_param_resp(config, &resp);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -567,7 +567,7 @@ void pnf_nr_handle_param_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Unpack message failed, ignoring\n", __FUNCTION__);
|
||||
}
|
||||
|
||||
|
||||
if(req.vendor_extension)
|
||||
pnf->_public.codec_config.deallocate(req.vendor_extension);
|
||||
|
||||
@@ -587,9 +587,9 @@ void pnf_handle_config_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
|
||||
nfapi_config_request_t req;
|
||||
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "CONFIG.request received\n");
|
||||
|
||||
|
||||
nfapi_pnf_config_t* config = &(pnf->_public);
|
||||
|
||||
|
||||
// unpack the message
|
||||
if (nfapi_p5_message_unpack(pRecvMsg, recvMsgLen, &req, sizeof(req), &config->codec_config) >= 0)
|
||||
{
|
||||
@@ -639,7 +639,7 @@ void pnf_handle_config_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Unpack message failed, ignoring\n", __FUNCTION__);
|
||||
}
|
||||
|
||||
|
||||
if(req.vendor_extension)
|
||||
pnf->_public.codec_config.deallocate(req.vendor_extension);
|
||||
}
|
||||
@@ -659,9 +659,9 @@ void pnf_nr_handle_config_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
|
||||
nfapi_nr_config_request_scf_t req;
|
||||
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "CONFIG.request received\n");
|
||||
|
||||
|
||||
nfapi_pnf_config_t* config = &(pnf->_public);
|
||||
|
||||
|
||||
// unpack the message
|
||||
if (nfapi_nr_p5_message_unpack(pRecvMsg, recvMsgLen, &req, sizeof(req), &config->codec_config) >= 0)
|
||||
{
|
||||
@@ -681,7 +681,7 @@ void pnf_nr_handle_config_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
|
||||
{
|
||||
(config->nr_config_req)(config, phy, &req);
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -718,7 +718,7 @@ void pnf_nr_handle_config_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Unpack message failed, ignoring\n", __FUNCTION__);
|
||||
}
|
||||
|
||||
|
||||
if(req.vendor_extension)
|
||||
pnf->_public.codec_config.deallocate(req.vendor_extension);
|
||||
}
|
||||
@@ -734,11 +734,11 @@ void pnf_handle_start_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
|
||||
else
|
||||
{
|
||||
nfapi_start_request_t req;
|
||||
|
||||
|
||||
nfapi_pnf_config_t* config = &(pnf->_public);
|
||||
|
||||
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() START.request received state:%d\n", __FUNCTION__, config->state);
|
||||
|
||||
|
||||
// unpack the message
|
||||
if (nfapi_p5_message_unpack(pRecvMsg, recvMsgLen, &req, sizeof(req), &config->codec_config) >= 0)
|
||||
{
|
||||
@@ -788,7 +788,7 @@ void pnf_handle_start_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Unpack message failed, ignoring\n", __FUNCTION__);
|
||||
}
|
||||
|
||||
|
||||
if(req.vendor_extension)
|
||||
pnf->_public.codec_config.deallocate(req.vendor_extension);
|
||||
|
||||
@@ -805,11 +805,11 @@ void pnf_nr_handle_start_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
|
||||
else
|
||||
{
|
||||
nfapi_nr_start_request_scf_t req;
|
||||
|
||||
|
||||
nfapi_pnf_config_t* config = &(pnf->_public);
|
||||
|
||||
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() START.request received state:%d\n", __FUNCTION__, config->state);
|
||||
|
||||
|
||||
// unpack the message
|
||||
if (nfapi_nr_p5_message_unpack(pRecvMsg, recvMsgLen, &req, sizeof(req), &config->codec_config) >= 0)
|
||||
{
|
||||
@@ -859,7 +859,7 @@ void pnf_nr_handle_start_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Unpack message failed, ignoring\n", __FUNCTION__);
|
||||
}
|
||||
|
||||
|
||||
if(req.vendor_extension)
|
||||
pnf->_public.codec_config.deallocate(req.vendor_extension);
|
||||
|
||||
@@ -878,9 +878,9 @@ void pnf_handle_stop_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
|
||||
nfapi_stop_request_t req;
|
||||
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "STOP.request received\n");
|
||||
|
||||
|
||||
nfapi_pnf_config_t* config = &(pnf->_public);
|
||||
|
||||
|
||||
// unpack the message
|
||||
if (nfapi_p5_message_unpack(pRecvMsg, recvMsgLen, &req, sizeof(req), &config->codec_config) >= 0)
|
||||
{
|
||||
@@ -930,10 +930,10 @@ void pnf_handle_stop_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Unpack message failed, ignoring\n", __FUNCTION__);
|
||||
}
|
||||
|
||||
|
||||
if(req.vendor_extension)
|
||||
pnf->_public.codec_config.deallocate(req.vendor_extension);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -949,9 +949,9 @@ void pnf_nr_handle_stop_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
|
||||
nfapi_nr_stop_request_t req;
|
||||
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "STOP.request received\n");
|
||||
|
||||
|
||||
nfapi_pnf_config_t* config = &(pnf->_public);
|
||||
|
||||
|
||||
// unpack the message
|
||||
if (nfapi_nr_p5_message_unpack(pRecvMsg, recvMsgLen, &req, sizeof(req), &config->codec_config) >= 0)
|
||||
{
|
||||
@@ -1001,10 +1001,10 @@ void pnf_nr_handle_stop_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Unpack message failed, ignoring\n", __FUNCTION__);
|
||||
}
|
||||
|
||||
|
||||
if(req.vendor_extension)
|
||||
pnf->_public.codec_config.deallocate(req.vendor_extension);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1020,9 +1020,9 @@ void pnf_handle_measurement_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
|
||||
nfapi_measurement_request_t req;
|
||||
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "MEASUREMENT.request received\n");
|
||||
|
||||
|
||||
nfapi_pnf_config_t* config = &(pnf->_public);
|
||||
|
||||
|
||||
// unpack the message
|
||||
if (nfapi_p5_message_unpack(pRecvMsg, recvMsgLen, &req, sizeof(req), &config->codec_config) >= 0)
|
||||
{
|
||||
@@ -1072,7 +1072,7 @@ void pnf_handle_measurement_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Unpack message failed, ignoring\n", __FUNCTION__);
|
||||
}
|
||||
|
||||
|
||||
if(req.vendor_extension)
|
||||
pnf->_public.codec_config.deallocate(req.vendor_extension);
|
||||
}
|
||||
@@ -1087,13 +1087,13 @@ void pnf_handle_rssi_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__);
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
nfapi_rssi_request_t req;
|
||||
|
||||
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "RSSI.request received\n");
|
||||
|
||||
|
||||
nfapi_pnf_config_t* config = &(pnf->_public);
|
||||
|
||||
|
||||
// unpack the message
|
||||
if (nfapi_p4_message_unpack(pRecvMsg, recvMsgLen, &req, sizeof(req), &config->codec_config) >= 0)
|
||||
{
|
||||
@@ -1143,10 +1143,10 @@ void pnf_handle_rssi_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Unpack message failed, ignoring\n", __FUNCTION__);
|
||||
}
|
||||
|
||||
|
||||
if(req.vendor_extension)
|
||||
pnf->_public.codec_config.deallocate(req.vendor_extension);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1159,11 +1159,11 @@ void pnf_handle_cell_search_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
|
||||
else
|
||||
{
|
||||
nfapi_cell_search_request_t req;
|
||||
|
||||
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "CELL_SEARCH.request received\n");
|
||||
|
||||
|
||||
nfapi_pnf_config_t* config = &(pnf->_public);
|
||||
|
||||
|
||||
if (nfapi_p4_message_unpack(pRecvMsg, recvMsgLen, &req, sizeof(req), &config->codec_config) >= 0)
|
||||
{
|
||||
if(config->state == NFAPI_PNF_RUNNING)
|
||||
@@ -1212,7 +1212,7 @@ void pnf_handle_cell_search_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Unpack message failed, ignoring\n", __FUNCTION__);
|
||||
}
|
||||
|
||||
|
||||
if(req.vendor_extension)
|
||||
pnf->_public.codec_config.deallocate(req.vendor_extension);
|
||||
}
|
||||
@@ -1231,9 +1231,9 @@ void pnf_handle_broadcast_detect_request(pnf_t* pnf, void *pRecvMsg, int recvMsg
|
||||
nfapi_broadcast_detect_request_t req;
|
||||
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "BROADCAST_DETECT.request received\n");
|
||||
|
||||
|
||||
nfapi_pnf_config_t* config = &(pnf->_public);
|
||||
|
||||
|
||||
if (nfapi_p4_message_unpack(pRecvMsg, recvMsgLen, &req, sizeof(req), &config->codec_config) >= 0)
|
||||
{
|
||||
if(config->state == NFAPI_PNF_RUNNING)
|
||||
@@ -1282,7 +1282,7 @@ void pnf_handle_broadcast_detect_request(pnf_t* pnf, void *pRecvMsg, int recvMsg
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Unpack message failed, ignoring\n", __FUNCTION__);
|
||||
}
|
||||
|
||||
|
||||
if(req.vendor_extension)
|
||||
pnf->_public.codec_config.deallocate(req.vendor_extension);
|
||||
|
||||
@@ -1298,11 +1298,11 @@ void pnf_handle_system_information_schedule_request(pnf_t* pnf, void *pRecvMsg,
|
||||
else
|
||||
{
|
||||
nfapi_system_information_schedule_request_t req;
|
||||
|
||||
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "SYSTEM_INFORMATION_SCHEDULE.request received\n");
|
||||
|
||||
|
||||
nfapi_pnf_config_t* config = &(pnf->_public);
|
||||
|
||||
|
||||
if (nfapi_p4_message_unpack(pRecvMsg, recvMsgLen, &req, sizeof(req), &config->codec_config) >= 0)
|
||||
{
|
||||
if(config->state == NFAPI_PNF_RUNNING)
|
||||
@@ -1351,7 +1351,7 @@ void pnf_handle_system_information_schedule_request(pnf_t* pnf, void *pRecvMsg,
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Unpack message failed, ignoring\n", __FUNCTION__);
|
||||
}
|
||||
|
||||
|
||||
if(req.vendor_extension)
|
||||
pnf->_public.codec_config.deallocate(req.vendor_extension);
|
||||
}
|
||||
@@ -1368,9 +1368,9 @@ void pnf_handle_system_information_request(pnf_t* pnf, void *pRecvMsg, int recvM
|
||||
nfapi_system_information_request_t req;
|
||||
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "SYSTEM_INFORMATION.request received\n");
|
||||
|
||||
|
||||
nfapi_pnf_config_t* config = &(pnf->_public);
|
||||
|
||||
|
||||
if (nfapi_p4_message_unpack(pRecvMsg, recvMsgLen, &req, sizeof(req), &config->codec_config) >= 0)
|
||||
{
|
||||
if(config->state == NFAPI_PNF_RUNNING)
|
||||
@@ -1419,7 +1419,7 @@ void pnf_handle_system_information_request(pnf_t* pnf, void *pRecvMsg, int recvM
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Unpack message failed, ignoring\n", __FUNCTION__);
|
||||
}
|
||||
|
||||
|
||||
if(req.vendor_extension)
|
||||
pnf->_public.codec_config.deallocate(req.vendor_extension);
|
||||
}
|
||||
@@ -1435,11 +1435,11 @@ void pnf_handle_nmm_stop_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
|
||||
else
|
||||
{
|
||||
nfapi_nmm_stop_request_t req;
|
||||
|
||||
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "NMM_STOP.request received\n");
|
||||
|
||||
|
||||
nfapi_pnf_config_t* config = &(pnf->_public);
|
||||
|
||||
|
||||
if (nfapi_p4_message_unpack(pRecvMsg, recvMsgLen, &req, sizeof(req), &config->codec_config) >= 0)
|
||||
{
|
||||
if(config->state == NFAPI_PNF_RUNNING)
|
||||
@@ -1488,7 +1488,7 @@ void pnf_handle_nmm_stop_request(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Unpack message failed, ignoring\n", __FUNCTION__);
|
||||
}
|
||||
|
||||
|
||||
if(req.vendor_extension)
|
||||
pnf->_public.codec_config.deallocate(req.vendor_extension);
|
||||
}
|
||||
@@ -1504,21 +1504,21 @@ void pnf_handle_vendor_extension(void* pRecvMsg, int recvMsgLen, pnf_t* pnf, uin
|
||||
else
|
||||
{
|
||||
nfapi_pnf_config_t* config = &(pnf->_public);
|
||||
|
||||
|
||||
if(config->allocate_p4_p5_vendor_ext)
|
||||
{
|
||||
uint16_t msg_size;
|
||||
nfapi_p4_p5_message_header_t* msg = config->allocate_p4_p5_vendor_ext(message_id, &msg_size);
|
||||
|
||||
|
||||
if(msg == 0)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "%s failed to allocate vendor extention structure\n");
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "failed to allocate vendor extention structure\n");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
int unpack_result = nfapi_p5_message_unpack(pRecvMsg, recvMsgLen, msg, msg_size, &config->codec_config);
|
||||
|
||||
|
||||
if(unpack_result == 0)
|
||||
{
|
||||
if(config->vendor_ext)
|
||||
@@ -1528,10 +1528,10 @@ void pnf_handle_vendor_extension(void* pRecvMsg, int recvMsgLen, pnf_t* pnf, uin
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Unpack message failed, ignoring\n", __FUNCTION__);
|
||||
}
|
||||
|
||||
|
||||
if(config->deallocate_p4_p5_vendor_ext)
|
||||
config->deallocate_p4_p5_vendor_ext(msg);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1732,8 +1732,8 @@ void pnf_handle_p5_message(pnf_t* pnf, void *pRecvMsg, int recvMsgLen)
|
||||
int pnf_nr_pack_and_send_p5_message(pnf_t* pnf, nfapi_p4_p5_message_header_t* msg, uint32_t msg_len)
|
||||
{
|
||||
int packed_len = nfapi_nr_p5_message_pack(msg, msg_len,
|
||||
pnf->tx_message_buffer,
|
||||
sizeof(pnf->tx_message_buffer),
|
||||
pnf->tx_message_buffer,
|
||||
sizeof(pnf->tx_message_buffer),
|
||||
&pnf->_public.codec_config);
|
||||
|
||||
if (packed_len < 0)
|
||||
@@ -1749,8 +1749,8 @@ int pnf_nr_pack_and_send_p5_message(pnf_t* pnf, nfapi_p4_p5_message_header_t* ms
|
||||
int pnf_pack_and_send_p5_message(pnf_t* pnf, nfapi_p4_p5_message_header_t* msg, uint32_t msg_len)
|
||||
{
|
||||
int packed_len = nfapi_p5_message_pack(msg, msg_len,
|
||||
pnf->tx_message_buffer,
|
||||
sizeof(pnf->tx_message_buffer),
|
||||
pnf->tx_message_buffer,
|
||||
sizeof(pnf->tx_message_buffer),
|
||||
&pnf->_public.codec_config);
|
||||
|
||||
if (packed_len < 0)
|
||||
@@ -1765,8 +1765,8 @@ int pnf_pack_and_send_p5_message(pnf_t* pnf, nfapi_p4_p5_message_header_t* msg,
|
||||
int pnf_pack_and_send_p4_message(pnf_t* pnf, nfapi_p4_p5_message_header_t* msg, uint32_t msg_len)
|
||||
{
|
||||
int packed_len = nfapi_p4_message_pack(msg, msg_len,
|
||||
pnf->tx_message_buffer,
|
||||
sizeof(pnf->tx_message_buffer),
|
||||
pnf->tx_message_buffer,
|
||||
sizeof(pnf->tx_message_buffer),
|
||||
&pnf->_public.codec_config);
|
||||
|
||||
if (packed_len < 0)
|
||||
@@ -1797,14 +1797,14 @@ int pnf_connect(pnf_t* pnf)
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "Starting P5 PNF connection to VNF at %s:%u\n", pnf->_public.vnf_ip_addr, pnf->_public.vnf_p5_port);
|
||||
|
||||
// todo split the vnf address list. currently only supporting 1
|
||||
|
||||
|
||||
struct addrinfo hints, *servinfo;
|
||||
memset(&hints, 0, sizeof(hints));
|
||||
|
||||
hints.ai_socktype = SOCK_STREAM; // For SCTP we are only interested in SOCK_STREAM
|
||||
// todo : allow the client to restrict IPV4 or IPV6
|
||||
// todo : randomize which address to connect to?
|
||||
|
||||
|
||||
char port_str[8];
|
||||
snprintf(port_str, sizeof(port_str), "%d", pnf->_public.vnf_p5_port);
|
||||
if(getaddrinfo(pnf->_public.vnf_ip_addr, port_str, &hints, &servinfo) != 0)
|
||||
@@ -1822,7 +1822,7 @@ int pnf_connect(pnf_t* pnf)
|
||||
char* family = "Unknown";
|
||||
char* address = "Unknown";
|
||||
char _addr[128];
|
||||
|
||||
|
||||
if(p->ai_family == AF_INET6)
|
||||
{
|
||||
family = "IPV6";
|
||||
@@ -1886,7 +1886,7 @@ int pnf_connect(pnf_t* pnf)
|
||||
}
|
||||
else
|
||||
{
|
||||
// Create an IP socket point
|
||||
// Create an IP socket point
|
||||
if ((pnf->p5_sock = socket(p->ai_family, SOCK_STREAM, IPPROTO_IP)) < 0)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "After P5 socket errno: %d\n", errno);
|
||||
@@ -1894,12 +1894,12 @@ int pnf_connect(pnf_t* pnf)
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "P5 socket created...\n");
|
||||
|
||||
|
||||
if (connect(pnf->p5_sock, p->ai_addr, p->ai_addrlen ) < 0)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "After connect (address:%s port:%d) errno: %d\n",
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "After connect (address:%s port:%d) errno: %d\n",
|
||||
pnf->_public.vnf_ip_addr, pnf->_public.vnf_p5_port, errno);
|
||||
|
||||
if(errno == EINVAL)
|
||||
@@ -1970,14 +1970,16 @@ int pnf_connect(pnf_t* pnf)
|
||||
|
||||
int pnf_send_message(pnf_t* pnf, uint8_t *msg, uint32_t len, uint16_t stream)
|
||||
{
|
||||
|
||||
|
||||
if (pnf->sctp)
|
||||
{
|
||||
#if 0
|
||||
printf("\nPNF SENDS: \n");
|
||||
for(int i=0; i<len; i++){
|
||||
printf("%d", msg[i]);
|
||||
}
|
||||
printf("\n");
|
||||
#endif
|
||||
|
||||
if (sctp_sendmsg(pnf->p5_sock, msg, len, NULL, 0, 42/*config->sctp_stream_number*/, 0, stream/*P5_STREAM_ID*/, 0, 0) < 0)
|
||||
{
|
||||
@@ -2069,12 +2071,14 @@ int pnf_read_dispatch_message(pnf_t* pnf)
|
||||
}
|
||||
else
|
||||
{
|
||||
#if 0
|
||||
// print the received message
|
||||
printf("\n MESSAGE RECEIVED: \n");
|
||||
for(int i=0; i<message_size; i++){
|
||||
printf("%d", read_buffer[i]);
|
||||
}
|
||||
printf("\n");
|
||||
#endif
|
||||
|
||||
if (flags & MSG_NOTIFICATION)
|
||||
{
|
||||
@@ -2198,12 +2202,14 @@ int pnf_nr_read_dispatch_message(pnf_t* pnf)
|
||||
}
|
||||
else
|
||||
{
|
||||
#if 0
|
||||
// print the received message
|
||||
printf("\n MESSAGE RECEIVED: \n");
|
||||
for(int i=0; i<message_size; i++){
|
||||
printf("%d", read_buffer[i]);
|
||||
}
|
||||
printf("\n");
|
||||
#endif
|
||||
|
||||
if (flags & MSG_NOTIFICATION)
|
||||
{
|
||||
@@ -2275,7 +2281,7 @@ int pnf_message_pump(pnf_t* pnf)
|
||||
selectRetval = select(pnf->p5_sock+1, &rfds, NULL, NULL, &timeout);
|
||||
|
||||
if(selectRetval == 0)
|
||||
{
|
||||
{
|
||||
// timeout
|
||||
continue;
|
||||
}
|
||||
@@ -2336,7 +2342,7 @@ int pnf_nr_message_pump(pnf_t* pnf)
|
||||
selectRetval = select(pnf->p5_sock+1, &rfds, NULL, NULL, &timeout);
|
||||
|
||||
if(selectRetval == 0)
|
||||
{
|
||||
{
|
||||
// timeout
|
||||
continue;
|
||||
}
|
||||
@@ -2376,4 +2382,3 @@ int pnf_nr_message_pump(pnf_t* pnf)
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
/*
|
||||
* Copyright 2017 Cisco Systems, Inc.
|
||||
*
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
@@ -32,11 +32,11 @@ nfapi_pnf_config_t* nfapi_pnf_config_create()
|
||||
memset(_this, 0, sizeof(pnf_t));
|
||||
|
||||
_this->sctp = 1; // enable sctp
|
||||
|
||||
|
||||
_this->_public.vnf_p5_port = NFAPI_P5_SCTP_PORT;
|
||||
|
||||
|
||||
_this->_public.malloc = &malloc;
|
||||
_this->_public.free = &free;
|
||||
_this->_public.free = &free;
|
||||
|
||||
_this->_public.codec_config.allocate = &malloc;
|
||||
_this->_public.codec_config.deallocate = &free;
|
||||
@@ -55,10 +55,6 @@ int nfapi_pnf_start(nfapi_pnf_config_t* config)
|
||||
if(config == 0)
|
||||
return -1;
|
||||
|
||||
// Make sure to set the defined trace function before using NFAPI_TRACE
|
||||
if(config->trace)
|
||||
nfapi_trace_g = config->trace;
|
||||
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "%s\n", __FUNCTION__);
|
||||
|
||||
pnf_t* _this = (pnf_t*)(config);
|
||||
@@ -89,10 +85,6 @@ int nfapi_nr_pnf_start(nfapi_pnf_config_t* config)
|
||||
if(config == 0)
|
||||
return -1;
|
||||
|
||||
// Make sure to set the defined trace function before using NFAPI_TRACE
|
||||
if(config->trace)
|
||||
nfapi_trace_g = config->trace;
|
||||
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "%s\n", __FUNCTION__);
|
||||
|
||||
pnf_t* _this = (pnf_t*)(config);
|
||||
@@ -265,7 +257,7 @@ int nfapi_pnf_param_resp(nfapi_pnf_config_t* config, nfapi_param_response_t* res
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
pnf_t* _this = (pnf_t*)(config);
|
||||
|
||||
return pnf_pack_and_send_p5_message(_this, &(resp->header), sizeof(nfapi_param_response_t));
|
||||
@@ -279,7 +271,7 @@ int nfapi_nr_pnf_param_resp(nfapi_pnf_config_t* config, nfapi_nr_param_response_
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
pnf_t* _this = (pnf_t*)(config);
|
||||
|
||||
return pnf_nr_pack_and_send_p5_message(_this, &(resp->header), sizeof(nfapi_nr_param_response_scf_t));
|
||||
@@ -591,4 +583,3 @@ int nfapi_pnf_vendor_extension(nfapi_pnf_config_t* config, nfapi_p4_p5_message_h
|
||||
|
||||
return pnf_pack_and_send_p5_message(_this, msg, msg_len);
|
||||
}
|
||||
|
||||
|
||||
@@ -1060,6 +1060,23 @@ int pnf_p7_slot_ind(pnf_p7_t* pnf_p7, uint16_t phy_id, uint16_t sfn, uint16_t sl
|
||||
(pnf_p7->_public.ul_dci_req_fn)(NULL, &(pnf_p7->_public), pnf_p7->_public.dummy_slot.ul_dci_req);
|
||||
}
|
||||
}
|
||||
if(tx_slot_buffer->ul_tti_req != 0)
|
||||
{
|
||||
if(pnf_p7->_public.ul_tti_req_fn)
|
||||
{
|
||||
(pnf_p7->_public.ul_tti_req_fn)(NULL, &(pnf_p7->_public), tx_slot_buffer->ul_tti_req);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// send dummy
|
||||
if(pnf_p7->_public.ul_tti_req_fn && pnf_p7->_public.dummy_slot.ul_tti_req)
|
||||
{
|
||||
pnf_p7->_public.dummy_slot.ul_tti_req->SFN = sfn_tx;
|
||||
pnf_p7->_public.dummy_slot.ul_tti_req->Slot = slot_tx;
|
||||
(pnf_p7->_public.ul_tti_req_fn)(NULL, &(pnf_p7->_public), pnf_p7->_public.dummy_slot.ul_tti_req);
|
||||
}
|
||||
}
|
||||
|
||||
//deallocate slot buffers after passing down the PDUs to PHY processing
|
||||
|
||||
@@ -1585,7 +1602,7 @@ void pnf_handle_dl_tti_request(void* pRecvMsg, int recvMsgLen, pnf_p7_t* pnf_p7)
|
||||
|
||||
if(req == NULL)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "%s failed to alloced nfapi_dl_tti_request structure\n");
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "failed to allocate nfapi_dl_tti_request structure\n");
|
||||
return;
|
||||
}
|
||||
int unpack_result = nfapi_nr_p7_message_unpack(pRecvMsg, recvMsgLen, req, sizeof(nfapi_nr_dl_tti_request_t), &(pnf_p7->_public.codec_config));
|
||||
@@ -1659,7 +1676,7 @@ void pnf_handle_dl_config_request(void* pRecvMsg, int recvMsgLen, pnf_p7_t* pnf_
|
||||
|
||||
if(req == NULL)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "%s failed to alloced nfapi_dl_config_request structure\n");
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "failed to allocate nfapi_dl_config_request structure\n");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1750,7 +1767,7 @@ void pnf_handle_ul_tti_request(void* pRecvMsg, int recvMsgLen, pnf_p7_t* pnf_p7)
|
||||
|
||||
if(req == NULL)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "%s failed to alloced nfapi_ul_tti_request structure\n");
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "failed to allocate nfapi_ul_tti_request structure\n");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1825,7 +1842,7 @@ void pnf_handle_ul_config_request(void* pRecvMsg, int recvMsgLen, pnf_p7_t* pnf_
|
||||
|
||||
if(req == NULL)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "%s failed to alloced nfapi_ul_config_request structure\n");
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "failed to allocate nfapi_ul_config_request structure\n");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1898,7 +1915,7 @@ void pnf_handle_ul_dci_request(void* pRecvMsg, int recvMsgLen, pnf_p7_t* pnf_p7)
|
||||
|
||||
if(req == NULL)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "%s failed to allocate nfapi_ul_dci_request structure\n");
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "failed to allocate nfapi_ul_dci_request structure\n");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1969,7 +1986,7 @@ void pnf_handle_hi_dci0_request(void* pRecvMsg, int recvMsgLen, pnf_p7_t* pnf_p7
|
||||
|
||||
if(req == NULL)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "%s failed to alloced nfapi_hi_dci0_request structure\n");
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "failed to allocate nfapi_hi_dci0_request structure\n");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2038,7 +2055,7 @@ void pnf_handle_tx_data_request(void* pRecvMsg, int recvMsgLen, pnf_p7_t* pnf_p7
|
||||
|
||||
if(req == NULL)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "%s failed to alloced nfapi_tx_request structure\n");
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "failed to allocate nfapi_tx_request structure\n");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2118,7 +2135,7 @@ void pnf_handle_tx_request(void* pRecvMsg, int recvMsgLen, pnf_p7_t* pnf_p7)
|
||||
|
||||
if(req == NULL)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "%s failed to alloced nfapi_tx_request structure\n");
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "failed to allocate nfapi_tx_request structure\n");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2192,7 +2209,7 @@ void pnf_handle_lbt_dl_config_request(void* pRecvMsg, int recvMsgLen, pnf_p7_t*
|
||||
|
||||
if(req == NULL)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "%s failed to alloced nfapi_lbt_dl_config_request structure\n");
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "failed to allocate nfapi_lbt_dl_config_request structure\n");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2255,7 +2272,7 @@ void pnf_handle_p7_vendor_extension(void* pRecvMsg, int recvMsgLen, pnf_p7_t* pn
|
||||
|
||||
if(msg == 0)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "%s failed to allocate vendor extention structure\n");
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "failed to allocate vendor extention structure\n");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2279,7 +2296,7 @@ void pnf_handle_ue_release_request(void* pRecvMsg, int recvMsgLen, pnf_p7_t* pnf
|
||||
nfapi_ue_release_request_t* req = allocate_nfapi_ue_release_request(pnf_p7);
|
||||
if(req == NULL)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to alloced nfapi_ue_release_request structure\n");
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "failed to allocate nfapi_ue_release_request structure\n");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2381,7 +2398,7 @@ uint32_t calculate_nr_t2(uint32_t now_time_hr, uint16_t sfn,uint16_t slot, uint3
|
||||
{
|
||||
static uint32_t prev_t2 = 0;
|
||||
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s(now_time_hr:%u sfn:%d slot:%d slot_start_time_Hr:%u) slot_time_us:%u t2:%u prev_t2:%u diff:%u\n",
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s(now_time_hr:%u sfn to slot:%d slot_start_time_Hr:%u) slot_time_us:%u t2:%u prev_t2:%u diff:%u\n",
|
||||
__FUNCTION__,
|
||||
now_time_hr, NFAPI_SFNSLOT2DEC(sfn, slot), slot_start_time_hr,
|
||||
slot_time_us,
|
||||
@@ -2656,7 +2673,7 @@ void pnf_handle_p7_message(void *pRecvMsg, int recvMsgLen, pnf_p7_t* pnf_p7, ui
|
||||
// validate the input params
|
||||
if(pRecvMsg == NULL || recvMsgLen < 4 || pnf_p7 == NULL)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "pnf_handle_p7_message: invalid input params (%d %d %d)\n", pRecvMsg, recvMsgLen, pnf_p7);
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "pnf_handle_p7_message: invalid input params (%p %d %p)\n", pRecvMsg, recvMsgLen, pnf_p7);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2762,7 +2779,7 @@ void pnf_nr_handle_p7_message(void *pRecvMsg, int recvMsgLen, pnf_p7_t* pnf_p7,
|
||||
// validate the input params
|
||||
if(pRecvMsg == NULL || recvMsgLen < 4 || pnf_p7 == NULL)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "pnf_handle_p7_message: invalid input params (%d %d %d)\n", pRecvMsg, recvMsgLen, pnf_p7);
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "pnf_handle_p7_message: invalid input params (%p %d %p)\n", pRecvMsg, recvMsgLen, pnf_p7);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2889,12 +2906,19 @@ void pnf_nfapi_p7_read_dispatch_message(pnf_p7_t* pnf_p7, uint32_t now_hr_time)
|
||||
}
|
||||
|
||||
// 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, pnf_p7->rx_message_buffer_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???
|
||||
|
||||
if(recvfrom_result > 0)
|
||||
{
|
||||
if (recvfrom_result != header.message_length)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "(%d) Received unexpected number of bytes. %d != %d",
|
||||
__LINE__, recvfrom_result, header.message_length);
|
||||
break;
|
||||
}
|
||||
pnf_handle_p7_message(pnf_p7->rx_message_buffer, recvfrom_result, pnf_p7, now_hr_time);
|
||||
//printf("\npnf_handle_p7_message sfn=%d,slot=%d\n",pnf_p7->sfn,pnf_p7->slot);
|
||||
}
|
||||
@@ -3126,6 +3150,38 @@ int pnf_p7_message_pump(pnf_p7_t* pnf_p7)
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct timespec pnf_timespec_add(struct timespec lhs, struct timespec rhs)
|
||||
{
|
||||
struct timespec result;
|
||||
|
||||
result.tv_sec = lhs.tv_sec + rhs.tv_sec;
|
||||
result.tv_nsec = lhs.tv_nsec + rhs.tv_nsec;
|
||||
|
||||
if(result.tv_nsec > 1e9)
|
||||
{
|
||||
result.tv_sec++;
|
||||
result.tv_nsec-= 1e9;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
struct timespec pnf_timespec_sub(struct timespec lhs, struct timespec rhs)
|
||||
{
|
||||
struct timespec result;
|
||||
if ((lhs.tv_nsec-rhs.tv_nsec)<0)
|
||||
{
|
||||
result.tv_sec = lhs.tv_sec-rhs.tv_sec-1;
|
||||
result.tv_nsec = 1000000000+lhs.tv_nsec-rhs.tv_nsec;
|
||||
}
|
||||
else
|
||||
{
|
||||
result.tv_sec = lhs.tv_sec-rhs.tv_sec;
|
||||
result.tv_nsec = lhs.tv_nsec-rhs.tv_nsec;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
int pnf_nr_p7_message_pump(pnf_p7_t* pnf_p7)
|
||||
{
|
||||
|
||||
@@ -3201,6 +3257,19 @@ int pnf_nr_p7_message_pump(pnf_p7_t* pnf_p7)
|
||||
}
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "PNF P7 bind succeeded...\n");
|
||||
|
||||
//Initializaing timing structures needed for slot ticking
|
||||
|
||||
struct timespec slot_start;
|
||||
clock_gettime(CLOCK_MONOTONIC, &slot_start);
|
||||
|
||||
struct timespec pselect_start;
|
||||
|
||||
struct timespec slot_duration;
|
||||
slot_duration.tv_sec = 0;
|
||||
slot_duration.tv_nsec = 0.5e6;
|
||||
|
||||
//Infinite loop
|
||||
|
||||
while(pnf_p7->terminate == 0)
|
||||
{
|
||||
fd_set rfds;
|
||||
@@ -3210,11 +3279,29 @@ int pnf_nr_p7_message_pump(pnf_p7_t* pnf_p7)
|
||||
FD_ZERO(&rfds);
|
||||
FD_SET(pnf_p7->p7_sock, &rfds);
|
||||
|
||||
struct timeval timeout;
|
||||
struct timespec timeout;
|
||||
timeout.tv_sec = 100;
|
||||
timeout.tv_usec = 0;
|
||||
timeout.tv_nsec = 0;
|
||||
clock_gettime(CLOCK_MONOTONIC, &pselect_start);
|
||||
|
||||
selectRetval = select(pnf_p7->p7_sock+1, &rfds, NULL, NULL, &timeout);
|
||||
//setting the timeout
|
||||
|
||||
if((pselect_start.tv_sec > slot_start.tv_sec) || ((pselect_start.tv_sec == slot_start.tv_sec) && (pselect_start.tv_nsec > slot_start.tv_nsec)))
|
||||
{
|
||||
// overran the end of the subframe we do not want to wait
|
||||
timeout.tv_sec = 0;
|
||||
timeout.tv_nsec = 0;
|
||||
|
||||
//struct timespec overrun = pnf_timespec_sub(pselect_start, sf_start);
|
||||
//NFAPI_TRACE(NFAPI_TRACE_INFO, "Subframe overrun detected of %d.%d running to catchup\n", overrun.tv_sec, overrun.tv_nsec);
|
||||
}
|
||||
else
|
||||
{
|
||||
// still time before the end of the subframe wait
|
||||
timeout = pnf_timespec_sub(slot_start, pselect_start);
|
||||
}
|
||||
|
||||
selectRetval = pselect(pnf_p7->p7_sock+1, &rfds, NULL, NULL, &timeout, NULL);
|
||||
|
||||
uint32_t now_hr_time = pnf_get_current_time_hr();
|
||||
|
||||
@@ -3224,6 +3311,17 @@ int pnf_nr_p7_message_pump(pnf_p7_t* pnf_p7)
|
||||
if(selectRetval == 0)
|
||||
{
|
||||
// timeout
|
||||
|
||||
//update slot start timing
|
||||
slot_start = pnf_timespec_add(slot_start, slot_duration);
|
||||
|
||||
//increment sfn/slot
|
||||
if (++pnf_p7->slot == 20)
|
||||
{
|
||||
pnf_p7->slot = 0;
|
||||
pnf_p7->sfn = (pnf_p7->sfn + 1) % 1024;
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
else if (selectRetval == -1 && (errno == EINTR))
|
||||
@@ -3242,7 +3340,7 @@ int pnf_nr_p7_message_pump(pnf_p7_t* pnf_p7)
|
||||
if(FD_ISSET(pnf_p7->p7_sock, &rfds))
|
||||
|
||||
{
|
||||
pnf_nr_nfapi_p7_read_dispatch_message(pnf_p7, now_hr_time);
|
||||
pnf_nr_nfapi_p7_read_dispatch_message(pnf_p7, now_hr_time);
|
||||
}
|
||||
}
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "PNF_P7 Terminating..\n");
|
||||
|
||||
@@ -44,6 +44,7 @@ nfapi_pnf_p7_config_t* nfapi_pnf_p7_config_create()
|
||||
_this->_public.codec_config.allocate = &malloc;
|
||||
_this->_public.codec_config.deallocate = &free;
|
||||
|
||||
// cppcheck-suppress memleak
|
||||
return &(_this->_public);
|
||||
}
|
||||
|
||||
@@ -63,10 +64,6 @@ int nfapi_pnf_p7_start(nfapi_pnf_p7_config_t* config)
|
||||
if(config == 0)
|
||||
return -1;
|
||||
|
||||
// Make sure to set the defined trace function before using NFAPI_TRACE
|
||||
if(config->trace)
|
||||
nfapi_trace_g = config->trace;
|
||||
|
||||
pnf_p7_t* _this = (pnf_p7_t*)(config);
|
||||
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "%s\n", __FUNCTION__);
|
||||
@@ -82,10 +79,6 @@ int nfapi_nr_pnf_p7_start(nfapi_pnf_p7_config_t* config)
|
||||
if(config == 0)
|
||||
return -1;
|
||||
|
||||
// Make sure to set the defined trace function before using NFAPI_TRACE
|
||||
if(config->trace)
|
||||
nfapi_trace_g = config->trace;
|
||||
|
||||
pnf_p7_t* _this = (pnf_p7_t*)(config);
|
||||
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "%s\n", __FUNCTION__);
|
||||
@@ -175,17 +168,7 @@ int nfapi_pnf_p7_rach_ind(nfapi_pnf_p7_config_t* config, nfapi_rach_indication_t
|
||||
pnf_p7_t* _this = (pnf_p7_t*)(config);
|
||||
return pnf_p7_pack_and_send_p7_message(_this, (nfapi_p7_message_header_t*)ind, sizeof(nfapi_rach_indication_t));
|
||||
}
|
||||
int nfapi_pnf_p7_srs_ind(nfapi_pnf_p7_config_t* config, nfapi_srs_indication_t* ind)
|
||||
{
|
||||
if(config == NULL || ind == NULL)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: invalid input params\n", __FUNCTION__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
pnf_p7_t* _this = (pnf_p7_t*)(config);
|
||||
return pnf_p7_pack_and_send_p7_message(_this, (nfapi_p7_message_header_t*)ind, sizeof(nfapi_srs_indication_t));
|
||||
}
|
||||
int nfapi_pnf_p7_sr_ind(nfapi_pnf_p7_config_t* config, nfapi_sr_indication_t* ind)
|
||||
{
|
||||
if(config == NULL || ind == NULL)
|
||||
|
||||
@@ -278,7 +278,7 @@ void *fapi_thread_start(void *ptr) {
|
||||
|
||||
if(instance->tick == 1000) {
|
||||
if(instance->tx_byte_count > 0) {
|
||||
printf("[FAPI] Tx rate %d bytes/sec\n", instance->tx_byte_count);
|
||||
printf("[FAPI] Tx rate %u bytes/sec\n", instance->tx_byte_count);
|
||||
instance->tx_byte_count = 0;
|
||||
}
|
||||
|
||||
@@ -319,7 +319,7 @@ void *fapi_thread_start(void *ptr) {
|
||||
millisec = now_ts.tv_nsec / 1e6;
|
||||
|
||||
if(last_millisec != -1 && ((last_millisec + 1 ) % 1000) != millisec) {
|
||||
printf("*** missing millisec %d %d\n", last_millisec, millisec);
|
||||
printf("*** missing millisec %u %u\n", last_millisec, millisec);
|
||||
catchup = millisec - last_millisec - 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#include "nfapi_interface.h"
|
||||
#include "nfapi_nr_interface_scf.h"
|
||||
#include "nfapi_nr_interface.h"
|
||||
#include "openair2/PHY_INTERFACE/queue_t.h"
|
||||
|
||||
#include "debug.h"
|
||||
|
||||
@@ -86,8 +87,6 @@ typedef struct nfapi_vnf_config
|
||||
void* (*malloc)(size_t size);
|
||||
/*! A user define callback to override the default memory deallocation */
|
||||
void (*free)(void*);
|
||||
/*! A user define callback to handle trace from the pnf */
|
||||
void (*trace)(nfapi_trace_level_t level, const char* message, ...);
|
||||
|
||||
/*! The port the VNF P5 SCTP connection listens on
|
||||
*
|
||||
@@ -662,12 +661,6 @@ typedef struct nfapi_vnf_p7_config
|
||||
* If not set the vnf p7 library will use free
|
||||
*/
|
||||
void (*free)(void*);
|
||||
|
||||
/*! A user define callback to handle trace from the pnf
|
||||
* \param level The trace level
|
||||
* \param message The trace string
|
||||
*/
|
||||
void (*trace)(nfapi_trace_level_t level, const char* message, ...);
|
||||
|
||||
/*! The port the vnf p7 will receive on */
|
||||
int port;
|
||||
@@ -908,7 +901,7 @@ void nfapi_vnf_p7_config_destory(nfapi_vnf_p7_config_t* config);
|
||||
* This function is blocking and will not return until the nfapi_vnf_p7_stop
|
||||
* function is called.
|
||||
*/
|
||||
|
||||
extern queue_t gnb_slot_ind_queue;
|
||||
int nfapi_vnf_p7_start(nfapi_vnf_p7_config_t* config);
|
||||
int nfapi_nr_vnf_p7_start(nfapi_vnf_p7_config_t* config);
|
||||
|
||||
|
||||
@@ -85,7 +85,7 @@ void nfapi_vnf_pnf_list_add(nfapi_vnf_config_t* config, nfapi_vnf_pnf_info_t* no
|
||||
|
||||
nfapi_vnf_pnf_info_t* nfapi_vnf_pnf_list_find(nfapi_vnf_config_t* config, int p5_idx)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s : config->pnf_list:%p\n", __FUNCTION__, config->pnf_list);
|
||||
NFAPI_TRACE(NFAPI_TRACE_DEBUG, "config->pnf_list:%p\n", config->pnf_list);
|
||||
|
||||
nfapi_vnf_pnf_info_t* curr = config->pnf_list;
|
||||
while(curr != 0)
|
||||
@@ -1051,7 +1051,7 @@ void vnf_handle_vendor_extension(void* pRecvMsg, int recvMsgLen, nfapi_vnf_confi
|
||||
}
|
||||
else
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "%s failed to allocate vendor extention structure\n");
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "failed to allocate vendor extention structure\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1383,6 +1383,7 @@ int vnf_read_dispatch_message(nfapi_vnf_config_t* config, nfapi_vnf_pnf_info_t*
|
||||
|
||||
uint32_t header_buffer_size = NFAPI_HEADER_LENGTH;
|
||||
uint8_t header_buffer[header_buffer_size];
|
||||
memset(header_buffer, 0, header_buffer_size);
|
||||
|
||||
uint32_t stack_buffer_size = 32; //should it be the size of then sctp_notificatoin structure
|
||||
uint8_t stack_buffer[stack_buffer_size];
|
||||
@@ -1393,6 +1394,7 @@ int vnf_read_dispatch_message(nfapi_vnf_config_t* config, nfapi_vnf_pnf_info_t*
|
||||
uint32_t message_size = 0;
|
||||
|
||||
struct sockaddr_in addr;
|
||||
memset(&addr, 0, sizeof(addr));
|
||||
socklen_t addr_len = sizeof(addr);
|
||||
|
||||
struct sctp_sndrcvinfo sndrcvinfo;
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
@@ -69,10 +70,6 @@ int nfapi_nr_vnf_start(nfapi_vnf_config_t* config)
|
||||
if(config == 0)
|
||||
return -1;
|
||||
|
||||
// Make sure to set the defined trace function before using NFAPI_TRACE
|
||||
if(config->trace)
|
||||
nfapi_trace_g = (nfapi_trace_fn_t)config->trace;
|
||||
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "%s()\n", __FUNCTION__);
|
||||
|
||||
int p5ListenSock, p5Sock;
|
||||
@@ -218,7 +215,7 @@ int nfapi_nr_vnf_start(nfapi_vnf_config_t* config)
|
||||
initMsg.sinit_max_instreams = 5; //MAX_SCTP_STREAMS; // number of output streams can be greater
|
||||
if (setsockopt(p5ListenSock, IPPROTO_SCTP, SCTP_INITMSG, &initMsg, sizeof(initMsg)) < 0)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "After setsockopt (SCTP_INITMSG) errno: %d\n", errno)
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "After setsockopt (SCTP_INITMSG) errno: %d\n", errno);
|
||||
close(p5ListenSock);
|
||||
return 0;
|
||||
}
|
||||
@@ -477,14 +474,7 @@ int nfapi_nr_vnf_start(nfapi_vnf_config_t* config)
|
||||
|
||||
int nfapi_vnf_start(nfapi_vnf_config_t* config)
|
||||
{
|
||||
// Verify that config is not null
|
||||
if(config == 0)
|
||||
return -1;
|
||||
|
||||
// Make sure to set the defined trace function before using NFAPI_TRACE
|
||||
if(config->trace)
|
||||
nfapi_trace_g = (nfapi_trace_fn_t)config->trace;
|
||||
|
||||
assert(config != 0);
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "%s()\n", __FUNCTION__);
|
||||
|
||||
int p5ListenSock, p5Sock;
|
||||
@@ -630,7 +620,7 @@ int nfapi_vnf_start(nfapi_vnf_config_t* config)
|
||||
initMsg.sinit_max_instreams = 5; //MAX_SCTP_STREAMS; // number of output streams can be greater
|
||||
if (setsockopt(p5ListenSock, IPPROTO_SCTP, SCTP_INITMSG, &initMsg, sizeof(initMsg)) < 0)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "After setsockopt (SCTP_INITMSG) errno: %d\n", errno)
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "After setsockopt (SCTP_INITMSG) errno: %d\n", errno);
|
||||
close(p5ListenSock);
|
||||
return 0;
|
||||
}
|
||||
@@ -1164,7 +1154,7 @@ int nfapi_vnf_allocate_phy(nfapi_vnf_config_t* config, int p5_idx, uint16_t* phy
|
||||
|
||||
info->timing_window = 30; // This seems to override what gets set by the user - why??? //TODO: Change in NR in terms of microsecends,what should be the value?
|
||||
info->timing_info_mode = 0x03;
|
||||
info->timing_info_period = 128;
|
||||
info->timing_info_period = 10;
|
||||
|
||||
nfapi_vnf_phy_info_list_add(config, info);
|
||||
|
||||
|
||||
@@ -17,14 +17,21 @@
|
||||
|
||||
#include <time.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <sys/time.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include "vnf_p7.h"
|
||||
|
||||
#ifdef NDEBUG
|
||||
# warning assert is disabled
|
||||
#endif
|
||||
|
||||
#define SYNC_CYCLE_COUNT 2
|
||||
|
||||
void* vnf_p7_malloc(vnf_p7_t* vnf_p7, size_t size)
|
||||
@@ -816,11 +823,6 @@ void vnf_handle_rx_ulsch_indication(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vn
|
||||
}
|
||||
}
|
||||
|
||||
uint16_t i = 0;
|
||||
for(i = 0; i < ind.rx_indication_body.number_of_pdus; ++i)
|
||||
{
|
||||
vnf_p7_codec_free(vnf_p7, ind.rx_indication_body.rx_pdu_list[i].data);
|
||||
}
|
||||
vnf_p7_codec_free(vnf_p7, ind.rx_indication_body.rx_pdu_list);
|
||||
vnf_p7_codec_free(vnf_p7, ind.vendor_extension);
|
||||
}
|
||||
@@ -1157,7 +1159,7 @@ void vnf_handle_ul_node_sync(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_p7)
|
||||
struct timespec ts;
|
||||
clock_gettime(CLOCK_MONOTONIC, &ts);
|
||||
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "(%4d/%1d) %d.%d PNF to VNF phy_id:%2d (t1/2/3/4:%8u, %8u, %8u, %8u) txrx:%4u procT:%3u latency(us):%4d(avg:%4d) offset(us):%8d filtered(us):%8d wrap[t1:%u t2:%u]\n",
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "(%4d/%1d) %ld.%ld PNF to VNF phy_id:%2d (t1/2/3/4:%8u, %8u, %8u, %8u) txrx:%4u procT:%3u latency(us):%4d(avg:%4d) offset(us):%8d filtered(us):%8d wrap[t1:%u t2:%u]\n",
|
||||
NFAPI_SFNSF2SFN(phy->sfn_sf), NFAPI_SFNSF2SF(phy->sfn_sf), ts.tv_sec, ts.tv_nsec, ind.header.phy_id,
|
||||
ind.t1, ind.t2, ind.t3, t4,
|
||||
tx_2_rx, pnf_proc_time, latency, phy->average_latency, phy->sf_offset, phy->sf_offset_filtered,
|
||||
@@ -1292,7 +1294,7 @@ void vnf_handle_ul_node_sync(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_p7)
|
||||
//NFAPI_TRACE(NFAPI_TRACE_NOTE, "VNF P7 In Sync with phy (phy_id:%d)\n", phy->phy_id);
|
||||
|
||||
if(vnf_p7->_public.sync_indication)
|
||||
(vnf_p7->_public.sync_indication)(&(vnf_p7->_public), 1);
|
||||
(vnf_p7->_public.sync_indication)(&(vnf_p7->_public), phy->in_sync);
|
||||
}
|
||||
|
||||
phy->in_sync = 1;
|
||||
@@ -1471,7 +1473,8 @@ void vnf_handle_nr_slot_indication(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf
|
||||
}
|
||||
else
|
||||
{
|
||||
if(vnf_p7->_public.nr_slot_indication)
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "%s: Handling NR SLOT Indication\n", __FUNCTION__);
|
||||
if(vnf_p7->_public.nr_slot_indication)
|
||||
{
|
||||
(vnf_p7->_public.nr_slot_indication)(&ind);
|
||||
}
|
||||
@@ -1496,12 +1499,12 @@ void vnf_handle_nr_rx_data_indication(void *pRecvMsg, int recvMsgLen, vnf_p7_t*
|
||||
}
|
||||
else
|
||||
{
|
||||
if(vnf_p7->_public.nr_rx_data_indication)
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "%s: Handling RX Indication\n", __FUNCTION__);
|
||||
if(vnf_p7->_public.nr_rx_data_indication)
|
||||
{
|
||||
(vnf_p7->_public.nr_rx_data_indication)(&ind);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1522,12 +1525,12 @@ void vnf_handle_nr_crc_indication(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_
|
||||
}
|
||||
else
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "%s: Handling CRC Indication\n", __FUNCTION__);
|
||||
if(vnf_p7->_public.nr_crc_indication)
|
||||
{
|
||||
{
|
||||
(vnf_p7->_public.nr_crc_indication)(&ind);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1573,12 +1576,12 @@ void vnf_handle_nr_uci_indication(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_
|
||||
}
|
||||
else
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "%s: Handling UCI Indication\n", __FUNCTION__);
|
||||
if(vnf_p7->_public.nr_uci_indication)
|
||||
{
|
||||
(vnf_p7->_public.nr_uci_indication)(&ind);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1599,12 +1602,12 @@ void vnf_handle_nr_rach_indication(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf
|
||||
}
|
||||
else
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "%s: Handling RACH Indication\n", __FUNCTION__);
|
||||
if(vnf_p7->_public.nr_rach_indication)
|
||||
{
|
||||
(vnf_p7->_public.nr_rach_indication)(&ind);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1699,14 +1702,7 @@ void vnf_nr_handle_ul_node_sync(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_p7
|
||||
}
|
||||
|
||||
if (phy->filtered_adjust && (phy->slot_offset_filtered > 1e6 || phy->slot_offset_filtered < -1e6))
|
||||
{ struct timespec ts;
|
||||
clock_gettime(CLOCK_MONOTONIC, &ts);
|
||||
NFAPI_TRACE(NFAPI_TRACE_NOTE, "(%4d/%1d) %d.%d PNF to VNF phy_id:%2d (t1/2/3/4:%8u, %8u, %8u, %8u) txrx:%4u procT:%3u latency(us):%4d(avg:%4d) offset(us):%8d filtered(us):%8d wrap[t1:%u t2:%u]\n",
|
||||
phy->sfn, phy->slot, ts.tv_sec, ts.tv_nsec, ind.header.phy_id,
|
||||
ind.t1, ind.t2, ind.t3, t4,
|
||||
tx_2_rx, pnf_proc_time, latency, phy->average_latency, phy->slot_offset, phy->slot_offset_filtered,
|
||||
(ind.t1<phy->previous_t1), (ind.t2<phy->previous_t2));
|
||||
|
||||
{
|
||||
phy->filtered_adjust = 0;
|
||||
phy->zero_count=0;
|
||||
phy->min_sync_cycle_count = 2;
|
||||
@@ -1738,7 +1734,7 @@ void vnf_nr_handle_ul_node_sync(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_p7
|
||||
|
||||
sfn_slot_dec += (phy->slot_offset / 500);
|
||||
|
||||
//NFAPI_TRACE(NFAPI_TRACE_NOTE, "PNF to VNF slot offset:%d sfn :%d slot:%d \n",phy->slot_offset,NFAPI_SFNSLOTDEC2SFN(sfn_slot_dec),NFAPI_SFNSLOTDEC2SLOT(sfn_slot_dec) );
|
||||
NFAPI_TRACE(NFAPI_TRACE_NOTE, "PNF to VNF slot offset:%d sfn :%d slot:%d \n",phy->slot_offset,NFAPI_SFNSLOTDEC2SFN(sfn_slot_dec),NFAPI_SFNSLOTDEC2SLOT(sfn_slot_dec) );
|
||||
|
||||
|
||||
}
|
||||
@@ -1838,7 +1834,7 @@ void vnf_nr_handle_ul_node_sync(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_p7
|
||||
NFAPI_TRACE(NFAPI_TRACE_NOTE, "VNF P7 In Sync with phy (phy_id:%d)\n", phy->phy_id);
|
||||
|
||||
if(vnf_p7->_public.sync_indication)
|
||||
(vnf_p7->_public.sync_indication)(&(vnf_p7->_public), 1);
|
||||
(vnf_p7->_public.sync_indication)(&(vnf_p7->_public), phy->in_sync);
|
||||
}
|
||||
|
||||
phy->in_sync = 1;
|
||||
@@ -2032,6 +2028,7 @@ void vnf_handle_timing_info(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_p7)
|
||||
}
|
||||
}
|
||||
|
||||
int16_t vnf_pnf_sfnslot_delta;
|
||||
|
||||
void vnf_nr_handle_timing_info(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_p7)
|
||||
{
|
||||
@@ -2051,18 +2048,21 @@ void vnf_nr_handle_timing_info(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_p7)
|
||||
if (vnf_p7 && vnf_p7->p7_connections)
|
||||
{
|
||||
//int16_t vnf_pnf_sfnsf_delta = NFAPI_SFNSF2DEC(vnf_p7->p7_connections[0].sfn_sf) - NFAPI_SFNSF2DEC(ind.last_sfn_sf);
|
||||
int16_t vnf_pnf_sfnslot_delta = NFAPI_SFNSLOT2DEC(vnf_p7->p7_connections[0].sfn,vnf_p7->p7_connections[0].slot) - NFAPI_SFNSLOT2DEC(ind.last_sfn,ind.last_slot);
|
||||
vnf_pnf_sfnslot_delta = NFAPI_SFNSLOT2DEC(vnf_p7->p7_connections[0].sfn,vnf_p7->p7_connections[0].slot) - NFAPI_SFNSLOT2DEC(ind.last_sfn,ind.last_slot);
|
||||
//NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() PNF:SFN/SF:%d VNF:SFN/SF:%d deltaSFNSF:%d\n", __FUNCTION__, NFAPI_SFNSF2DEC(ind.last_sfn_sf), NFAPI_SFNSF2DEC(vnf_p7->p7_connections[0].sfn_sf), vnf_pnf_sfnsf_delta);
|
||||
|
||||
// Panos: Careful here!!! Modification of the original nfapi-code
|
||||
//if (vnf_pnf_sfnsf_delta>1 || vnf_pnf_sfnsf_delta < -1)
|
||||
//printf("VNF-PNF delta - %d", vnf_pnf_sfnslot_delta);
|
||||
if (vnf_pnf_sfnslot_delta>0 || vnf_pnf_sfnslot_delta < 0)
|
||||
if (vnf_pnf_sfnslot_delta != 0)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() LARGE SFN/SF DELTA between PNF and VNF delta:%d VNF:%d PNF:%d\n\n\n\n\n\n\n\n\n", __FUNCTION__, vnf_pnf_sfnslot_delta,NFAPI_SFNSLOT2DEC(vnf_p7->p7_connections[0].sfn,vnf_p7->p7_connections[0].slot),NFAPI_SFNSLOT2DEC(ind.last_sfn,ind.last_slot)) ;
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() LARGE SFN/SLOT DELTA between PNF and VNF. Delta %d. PNF:%d.%d VNF:%d.%d\n\n\n\n\n\n\n\n\n",
|
||||
__FUNCTION__, vnf_pnf_sfnslot_delta,
|
||||
ind.last_sfn, ind.last_slot,
|
||||
vnf_p7->p7_connections[0].sfn, vnf_p7->p7_connections[0].slot);
|
||||
// Panos: Careful here!!! Modification of the original nfapi-code
|
||||
// vnf_p7->p7_connections[0].sfn = ind.last_sfn;
|
||||
// vnf_p7->p7_connections[0].slot = ind.last_slot;
|
||||
vnf_p7->p7_connections[0].sfn = ind.last_sfn;
|
||||
vnf_p7->p7_connections[0].slot = ind.last_slot;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2248,7 +2248,7 @@ void vnf_handle_p7_message(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_p7)
|
||||
// validate the input params
|
||||
if(pRecvMsg == NULL || recvMsgLen < 4 || vnf_p7 == NULL)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "vnf_handle_p7_message: invalid input params (%d %d %d)\n", pRecvMsg, recvMsgLen, vnf_p7);
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "vnf_handle_p7_message: invalid input params (%p %d %p)\n", pRecvMsg, recvMsgLen, vnf_p7);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2366,7 +2366,7 @@ void vnf_nr_handle_p7_message(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_p7)
|
||||
// validate the input params
|
||||
if(pRecvMsg == NULL || recvMsgLen < 4 || vnf_p7 == NULL)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "vnf_handle_p7_message: invalid input params (%d %d %d)\n", pRecvMsg, recvMsgLen, vnf_p7);
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "vnf_handle_p7_message: invalid input params (%p %d %p)\n", pRecvMsg, recvMsgLen, vnf_p7);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2508,26 +2508,22 @@ int vnf_nr_p7_read_dispatch_message(vnf_p7_t* vnf_p7)
|
||||
}
|
||||
|
||||
// read the segment
|
||||
recvfrom_result = recvfrom(vnf_p7->socket, vnf_p7->rx_message_buffer, header.message_length, MSG_WAITALL, (struct sockaddr*)&remote_addr, &remote_addr_size);
|
||||
recvfrom_result = recvfrom(vnf_p7->socket, vnf_p7->rx_message_buffer, header.message_length, MSG_WAITALL | MSG_TRUNC, (struct sockaddr*)&remote_addr, &remote_addr_size);
|
||||
NFAPI_TRACE(NFAPI_TRACE_DEBUG, "recvfrom_result = %d from %s():%d\n", recvfrom_result, __FUNCTION__, __LINE__);
|
||||
|
||||
// todo : how to handle incomplete readfroms, need some sort of buffer/select
|
||||
|
||||
if(recvfrom_result == 0)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "recvfrom returned 0\n");
|
||||
}
|
||||
else if(recvfrom_result != header.message_length)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_NOTE, "did not receive the entire message %d %d\n", recvfrom_result, header.message_length);
|
||||
|
||||
recvfrom_result += recvfrom(vnf_p7->socket, &vnf_p7->rx_message_buffer[recvfrom_result], header.message_length - recvfrom_result, MSG_WAITALL, (struct sockaddr*)&remote_addr, &remote_addr_size);
|
||||
|
||||
}
|
||||
|
||||
|
||||
if(recvfrom_result > 0)
|
||||
if (recvfrom_result > 0)
|
||||
{
|
||||
if (recvfrom_result != header.message_length)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "(%d) Received unexpected number of bytes. %d != %d",
|
||||
__LINE__, recvfrom_result, header.message_length);
|
||||
break;
|
||||
}
|
||||
NFAPI_TRACE(NFAPI_TRACE_DEBUG, "Calling vnf_nr_handle_p7_message from %d\n", __LINE__);
|
||||
vnf_nr_handle_p7_message(vnf_p7->rx_message_buffer, recvfrom_result, vnf_p7);
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -2592,9 +2588,9 @@ int vnf_p7_read_dispatch_message(vnf_p7_t* vnf_p7)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "recvfrom returned 0\n");
|
||||
}
|
||||
else if(recvfrom_result != header.message_length)
|
||||
else if(recvfrom_result != -1 && recvfrom_result != header.message_length)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_NOTE, "did not receive the entire message %d %d\n", recvfrom_result, header.message_length);
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "Received unexpected number of bytes %d %d\n", recvfrom_result, header.message_length);
|
||||
|
||||
recvfrom_result += recvfrom(vnf_p7->socket, &vnf_p7->rx_message_buffer[recvfrom_result], header.message_length - recvfrom_result, MSG_WAITALL, (struct sockaddr*)&remote_addr, &remote_addr_size);
|
||||
|
||||
@@ -2646,10 +2642,11 @@ void vnf_p7_release_msg(vnf_p7_t* vnf_p7, nfapi_p7_message_header_t* header)
|
||||
case NFAPI_RX_ULSCH_INDICATION:
|
||||
{
|
||||
nfapi_rx_indication_t* rx_ind = (nfapi_rx_indication_t*)(header);
|
||||
uint16_t i = 0;
|
||||
for(i = 0; i < rx_ind->rx_indication_body.number_of_pdus; ++i)
|
||||
size_t number_of_pdus = rx_ind->rx_indication_body.number_of_pdus;
|
||||
assert(number_of_pdus <= NFAPI_RX_IND_MAX_PDU);
|
||||
for(size_t i = 0; i < number_of_pdus; ++i)
|
||||
{
|
||||
vnf_p7_codec_free(vnf_p7, rx_ind->rx_indication_body.rx_pdu_list[i].data);
|
||||
vnf_p7_codec_free(vnf_p7, rx_ind->rx_indication_body.rx_pdu_list[i].rx_ind_data);
|
||||
}
|
||||
|
||||
vnf_p7_codec_free(vnf_p7, rx_ind->rx_indication_body.rx_pdu_list);
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
/*
|
||||
* Copyright 2017 Cisco Systems, Inc.
|
||||
*
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
@@ -45,13 +45,13 @@ nfapi_vnf_p7_config_t* nfapi_vnf_p7_config_create()
|
||||
_this->_public.segment_size = 1400;
|
||||
_this->_public.max_num_segments = 8;
|
||||
_this->_public.checksum_enabled = 1;
|
||||
|
||||
|
||||
_this->_public.malloc = &malloc;
|
||||
_this->_public.free = &free;
|
||||
_this->_public.free = &free;
|
||||
|
||||
_this->_public.codec_config.allocate = &malloc;
|
||||
_this->_public.codec_config.deallocate = &free;
|
||||
|
||||
|
||||
|
||||
return (nfapi_vnf_p7_config_t*)_this;
|
||||
}
|
||||
@@ -81,12 +81,12 @@ struct timespec timespec_add(struct timespec lhs, struct timespec rhs)
|
||||
struct timespec timespec_sub(struct timespec lhs, struct timespec rhs)
|
||||
{
|
||||
struct timespec result;
|
||||
if ((lhs.tv_nsec-rhs.tv_nsec)<0)
|
||||
if ((lhs.tv_nsec-rhs.tv_nsec)<0)
|
||||
{
|
||||
result.tv_sec = lhs.tv_sec-rhs.tv_sec-1;
|
||||
result.tv_nsec = 1000000000+lhs.tv_nsec-rhs.tv_nsec;
|
||||
}
|
||||
else
|
||||
}
|
||||
else
|
||||
{
|
||||
result.tv_sec = lhs.tv_sec-rhs.tv_sec;
|
||||
result.tv_nsec = lhs.tv_nsec-rhs.tv_nsec;
|
||||
@@ -94,7 +94,7 @@ struct timespec timespec_sub(struct timespec lhs, struct timespec rhs)
|
||||
return result;
|
||||
}
|
||||
|
||||
// monitor the p7 endpoints and the timing loop and
|
||||
// monitor the p7 endpoints and the timing loop and
|
||||
// send indications to mac
|
||||
int nfapi_nr_vnf_p7_start(nfapi_vnf_p7_config_t* config)
|
||||
{
|
||||
@@ -107,9 +107,9 @@ int nfapi_nr_vnf_p7_start(nfapi_vnf_p7_config_t* config)
|
||||
|
||||
vnf_p7_t* vnf_p7 = (vnf_p7_t*)config;
|
||||
|
||||
// Create p7 receive udp port
|
||||
// Create p7 receive udp port
|
||||
// todo : this needs updating for Ipv6
|
||||
|
||||
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "Initialising VNF P7 port:%u\n", config->port);
|
||||
|
||||
// open the UDP socket
|
||||
@@ -128,7 +128,7 @@ int nfapi_nr_vnf_p7_start(nfapi_vnf_p7_config_t* config)
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "After setsockopt (IP_TOS) errno: %d\n", errno);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "VNF P7 setsockopt succeeded...\n");
|
||||
|
||||
// Create the address structure
|
||||
@@ -168,20 +168,34 @@ int nfapi_nr_vnf_p7_start(nfapi_vnf_p7_config_t* config)
|
||||
// Add the p7 socket
|
||||
FD_SET(vnf_p7->socket, &rfds);
|
||||
maxSock = vnf_p7->socket;
|
||||
|
||||
|
||||
struct timespec curr_time;
|
||||
clock_gettime(CLOCK_MONOTONIC, &curr_time);
|
||||
setup_time = curr_time.tv_sec - ref_time.tv_sec;
|
||||
|
||||
if(setup_time > 10 && prev_slot != gNB->UL_INFO.slot){ //Give the VNF sufficient time to setup before starting scheduling
|
||||
|
||||
//Call the scheduler
|
||||
nfapi_nr_slot_indication_scf_t *slot_ind = get_queue(&gnb_slot_ind_queue);
|
||||
NFAPI_TRACE(NFAPI_TRACE_DEBUG, "This is the slot_ind queue size %ld in %s():%d\n",
|
||||
gnb_slot_ind_queue.num_items, __FUNCTION__, __LINE__);
|
||||
if (slot_ind) {
|
||||
pthread_mutex_lock(&gNB->UL_INFO_mutex);
|
||||
gNB->UL_INFO.module_id = gNB->Mod_id;
|
||||
gNB->UL_INFO.CC_id = gNB->CC_id;
|
||||
gNB->if_inst->NR_UL_indication(&gNB->UL_INFO);
|
||||
gNB->UL_INFO.frame = slot_ind->sfn;
|
||||
gNB->UL_INFO.slot = slot_ind->slot;
|
||||
|
||||
NFAPI_TRACE(NFAPI_TRACE_DEBUG, "gNB->UL_INFO.frame = %d and slot %d, prev_slot = %d, setup_time = %d\n",
|
||||
gNB->UL_INFO.frame, gNB->UL_INFO.slot, prev_slot, setup_time);
|
||||
if (setup_time > 3 && prev_slot != gNB->UL_INFO.slot) { //Give the VNF sufficient time to setup before starting scheduling && prev_slot != gNB->UL_INFO.slot
|
||||
|
||||
//Call the scheduler
|
||||
gNB->UL_INFO.module_id = gNB->Mod_id;
|
||||
gNB->UL_INFO.CC_id = gNB->CC_id;
|
||||
NFAPI_TRACE(NFAPI_TRACE_DEBUG, "Calling NR_UL_indication for gNB->UL_INFO.frame = %d and slot %d\n",
|
||||
gNB->UL_INFO.frame, gNB->UL_INFO.slot);
|
||||
gNB->if_inst->NR_UL_indication(&gNB->UL_INFO);
|
||||
prev_slot = gNB->UL_INFO.slot;
|
||||
}
|
||||
pthread_mutex_unlock(&gNB->UL_INFO_mutex);
|
||||
prev_slot = gNB->UL_INFO.slot;
|
||||
free(slot_ind);
|
||||
slot_ind = NULL;
|
||||
}
|
||||
|
||||
selectRetval = pselect(maxSock+1, &rfds, NULL, NULL, &pselect_timeout, NULL);
|
||||
@@ -234,9 +248,9 @@ int nfapi_vnf_p7_start(nfapi_vnf_p7_config_t* config)
|
||||
|
||||
vnf_p7_t* vnf_p7 = (vnf_p7_t*)config;
|
||||
|
||||
// Create p7 receive udp port
|
||||
// Create p7 receive udp port
|
||||
// todo : this needs updating for Ipv6
|
||||
|
||||
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "Initialising VNF P7 port:%u\n", config->port);
|
||||
|
||||
// open the UDP socket
|
||||
@@ -255,7 +269,7 @@ int nfapi_vnf_p7_start(nfapi_vnf_p7_config_t* config)
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "After setsockopt (IP_TOS) errno: %d\n", errno);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "VNF P7 setsockopt succeeded...\n");
|
||||
|
||||
// Create the address structure
|
||||
@@ -299,7 +313,7 @@ int nfapi_vnf_p7_start(nfapi_vnf_p7_config_t* config)
|
||||
clock_gettime(CLOCK_MONOTONIC, &sf_start);
|
||||
long millisecond = sf_start.tv_nsec / 1e6;
|
||||
sf_start = timespec_add(sf_start, sf_duration);
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "next subframe will start at %d.%d\n", sf_start.tv_sec, sf_start.tv_nsec);
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "next subframe will start at %ld.%ld\n", sf_start.tv_sec, sf_start.tv_nsec);
|
||||
|
||||
while(vnf_p7->terminate == 0)
|
||||
{
|
||||
@@ -311,7 +325,7 @@ int nfapi_vnf_p7_start(nfapi_vnf_p7_config_t* config)
|
||||
// Add the p7 socket
|
||||
FD_SET(vnf_p7->socket, &rfds);
|
||||
maxSock = vnf_p7->socket;
|
||||
|
||||
|
||||
clock_gettime(CLOCK_MONOTONIC, &pselect_start);
|
||||
//long millisecond = pselect_start.tv_nsec / 1e6;
|
||||
|
||||
@@ -320,7 +334,7 @@ int nfapi_vnf_p7_start(nfapi_vnf_p7_config_t* config)
|
||||
//NFAPI_TRACE(NFAPI_TRACE_INFO, "pselect_start:%d.%d sf_start:%d.%d\n", pselect_start.tv_sec, pselect_start.tv_nsec, sf_start.tv_sec, sf_start.tv_nsec);
|
||||
|
||||
|
||||
if((pselect_start.tv_sec > sf_start.tv_sec) ||
|
||||
if((pselect_start.tv_sec > sf_start.tv_sec) ||
|
||||
((pselect_start.tv_sec == sf_start.tv_sec) && (pselect_start.tv_nsec > sf_start.tv_nsec)))
|
||||
{
|
||||
// overran the end of the subframe we do not want to wait
|
||||
@@ -343,7 +357,7 @@ int nfapi_vnf_p7_start(nfapi_vnf_p7_config_t* config)
|
||||
//pselect_timeout.tv_nsec = 1e6 - (pselect_start.tv_nsec % 1000000);
|
||||
|
||||
//uint8_t underrun_possible =0;
|
||||
|
||||
|
||||
// if we are not sleeping until the next milisecond due to the
|
||||
// insycn minor adjment flag it so we don't consider it an error
|
||||
//uint8_t underrun_possible =0;
|
||||
@@ -353,7 +367,7 @@ int nfapi_vnf_p7_start(nfapi_vnf_p7_config_t* config)
|
||||
if(phy && phy->in_sync && phy->insync_minor_adjustment != 0 && phy->insync_minor_adjustment_duration > 0 && pselect_start.tv_nsec != 0)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_NOTE, "[VNF] Subframe minor adjustment %d (%d->%d)\n", phy->insync_minor_adjustment,
|
||||
pselect_timeout.tv_nsec, pselect_timeout.tv_nsec - (phy->insync_minor_adjustment * 1000))
|
||||
pselect_timeout.tv_nsec, pselect_timeout.tv_nsec - (phy->insync_minor_adjustment * 1000))
|
||||
if(phy->insync_minor_adjustment > 0)
|
||||
{
|
||||
// todo check we don't go below 0
|
||||
@@ -376,7 +390,7 @@ int nfapi_vnf_p7_start(nfapi_vnf_p7_config_t* config)
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
|
||||
//long wraps = pselect_timeout.tv_nsec % 1e9;
|
||||
|
||||
@@ -389,9 +403,9 @@ int nfapi_vnf_p7_start(nfapi_vnf_p7_config_t* config)
|
||||
|
||||
if (selectRetval==-1 && errno == 22)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "INVAL: pselect_timeout:%d.%ld adj[dur:%d adj:%d], sf_dur:%d.%ld\n",
|
||||
pselect_timeout.tv_sec, pselect_timeout.tv_nsec,
|
||||
phy->insync_minor_adjustment_duration, phy->insync_minor_adjustment,
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "INVAL: pselect_timeout:%ld.%ld adj[dur:%d adj:%d], sf_dur:%ld.%ld\n",
|
||||
pselect_timeout.tv_sec, pselect_timeout.tv_nsec,
|
||||
phy->insync_minor_adjustment_duration, phy->insync_minor_adjustment,
|
||||
sf_duration.tv_sec, sf_duration.tv_nsec);
|
||||
}
|
||||
if(selectRetval == 0)
|
||||
@@ -449,7 +463,7 @@ if (selectRetval==-1 && errno == 22)
|
||||
//phy->insync_minor_adjustment = 0;
|
||||
phy->insync_minor_adjustment_duration--;
|
||||
|
||||
NFAPI_TRACE(NFAPI_TRACE_NOTE, "[VNF] AFTER adjustment - Subframe minor adjustment %dus sf_start.tv_nsec:%d duration:%u\n",
|
||||
NFAPI_TRACE(NFAPI_TRACE_NOTE, "[VNF] AFTER adjustment - Subframe minor adjustment %dus sf_start.tv_nsec:%ld duration:%u\n",
|
||||
phy->insync_minor_adjustment, sf_start.tv_nsec, phy->insync_minor_adjustment_duration);
|
||||
|
||||
if (phy->insync_minor_adjustment_duration==0)
|
||||
@@ -473,7 +487,7 @@ if (selectRetval==-1 && errno == 22)
|
||||
}
|
||||
last_millisecond = millisecond;
|
||||
*/
|
||||
|
||||
|
||||
millisecond ++;
|
||||
}
|
||||
}
|
||||
@@ -497,9 +511,7 @@ if (selectRetval==-1 && errno == 22)
|
||||
while(curr != 0)
|
||||
{
|
||||
curr->sfn_sf = increment_sfn_sf(curr->sfn_sf);
|
||||
|
||||
vnf_sync(vnf_p7, curr);
|
||||
|
||||
curr = curr->next;
|
||||
}
|
||||
|
||||
@@ -523,7 +535,7 @@ if (selectRetval==-1 && errno == 22)
|
||||
}
|
||||
else
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "P7 select failed result %d errno %d timeout:%d.%d orginal:%d.%d last_ms:%ld ms:%ld\n", selectRetval, errno, pselect_timeout.tv_sec, pselect_timeout.tv_nsec, pselect_timeout.tv_sec, pselect_timeout.tv_nsec, last_millisecond, millisecond);
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "P7 select failed result %d errno %d timeout:%ld.%ld orginal:%ld.%ld last_ms:%ld ms:%ld\n", selectRetval, errno, pselect_timeout.tv_sec, pselect_timeout.tv_nsec, pselect_timeout.tv_sec, pselect_timeout.tv_nsec, last_millisecond, millisecond);
|
||||
// should we exit now?
|
||||
if (selectRetval == -1 && errno == 22) // invalid argument??? not sure about timeout duration
|
||||
{
|
||||
@@ -534,7 +546,7 @@ if (selectRetval==-1 && errno == 22)
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "Closing p7 socket\n");
|
||||
close(vnf_p7->socket);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user