Commit 933dcd28 authored by David Kim's avatar David Kim

Updated vnf codes to fix merge errors.

1. Prototype of nr indication functions were updated.
2. nr_rx_indication name changed to nr_rx_data_indication
3. Added other logs and assert conditions that were gone away from merge.
4. pnf files were not touched.
5. To be sync with original nfapi branch, the following file was checkout from eurocom-nfapi_nr_arch_mod
   nfapi/open-nFAPI/vnf/public_inc/nfapi_vnf_interface.h
parent 2a979f4e
......@@ -721,7 +721,7 @@ int phy_rach_indication(struct nfapi_vnf_p7_config *config, nfapi_rach_indicatio
return 1;
}
int phy_nr_rach_indication(struct nfapi_vnf_p7_config *config, nfapi_nr_rach_indication_t *ind)
int phy_nr_rach_indication(nfapi_nr_rach_indication_t *ind)
{
if(NFAPI_MODE == NFAPI_MODE_VNF)
{
......@@ -762,7 +762,7 @@ int phy_nr_rach_indication(struct nfapi_vnf_p7_config *config, nfapi_nr_rach_ind
return 1;
}
int phy_nr_uci_indication(struct nfapi_vnf_p7_config *config, nfapi_nr_uci_indication_t *ind)
int phy_nr_uci_indication(nfapi_nr_uci_indication_t *ind)
{
LOG_I(NR_MAC, "In %s() NFAPI SFN/SF: %d/%d number_of_pdus :%u\n",
......@@ -936,7 +936,7 @@ int phy_crc_indication(struct nfapi_vnf_p7_config *config, nfapi_crc_indication_
return 1;
}
int phy_nr_crc_indication(struct nfapi_vnf_p7_config *config, nfapi_nr_crc_indication_t *ind) {
int phy_nr_crc_indication(nfapi_nr_crc_indication_t *ind) {
LOG_I(NR_MAC, "In %s() NFAPI SFN/SF: %d/%d number_of_pdus :%u\n",
__FUNCTION__,ind->sfn, ind->slot, ind->number_crcs);
......@@ -1055,7 +1055,7 @@ int phy_rx_indication(struct nfapi_vnf_p7_config *config, nfapi_rx_indication_t
return 1;
}
int phy_nr_rx_indication(struct nfapi_vnf_p7_config *config, nfapi_nr_rx_data_indication_t *ind) {
int phy_nr_rx_data_indication(nfapi_nr_rx_data_indication_t *ind) {
LOG_I(NR_MAC, "In %s() NFAPI SFN/SF: %d/%d number_of_pdus :%u, and pdu %p\n",
__FUNCTION__,ind->sfn, ind->slot, ind->number_of_pdus, ind->pdu_list[0].pdu);
......@@ -1070,7 +1070,7 @@ int phy_nr_rx_indication(struct nfapi_vnf_p7_config *config, nfapi_nr_rx_data_in
if (ind->number_of_pdus > 0) {
rx_ind->pdu_list = CALLOC(NFAPI_NR_RX_DATA_IND_MAX_PDU, sizeof(nfapi_nr_rx_data_pdu_t));
AssertFatal(rx_ind->pdu_list != NULL, "Memory not allocated for rx_ind->pdu_list in phy_nr_rx_indication.");
AssertFatal(rx_ind->pdu_list != NULL, "Memory not allocated for rx_ind->pdu_list in phy_nr_rx_data_indication.");
}
for (int j = 0; j < ind->number_of_pdus; j++)
{
......@@ -1431,7 +1431,7 @@ void *vnf_nr_p7_thread_start(void *ptr) {
p7_vnf->config->slot_indication = &phy_slot_indication;
p7_vnf->config->harq_indication = &phy_harq_indication;
p7_vnf->config->nr_crc_indication = &phy_nr_crc_indication;
p7_vnf->config->nr_rx_indication = &phy_nr_rx_indication;
p7_vnf->config->nr_rx_data_indication = &phy_nr_rx_data_indication;
p7_vnf->config->nr_rach_indication = &phy_nr_rach_indication;
p7_vnf->config->nr_uci_indication = &phy_nr_uci_indication;
p7_vnf->config->srs_indication = &phy_srs_indication;
......
......@@ -117,11 +117,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;
......@@ -401,8 +408,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;
......@@ -449,6 +459,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,15 +27,13 @@
#include <nfapi.h>
#include <debug.h>
static uint32_t get_packed_msg_len(uintptr_t msgHead, uintptr_t msgEnd)
{
if (msgEnd < msgHead)
{
NFAPI_TRACE(NFAPI_TRACE_ERROR, "Error in pointers supplied %lu, %lu\n", msgHead, msgEnd);
return 0;
}
return (msgEnd - msgHead);
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 %lu, %lu\n", msgHead, msgEnd);
return 0;
}
return (msgEnd - msgHead);
}
static uint8_t pack_opaque_data_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) {
......
......@@ -308,7 +308,8 @@ static uint8_t pack_dl_tti_ssb_pdu_rel15_value(void *tlv, uint8_t **ppWritePacke
push8(value->SsbSubcarrierOffset, ppWritePackedMsg, end) &&
push16(value->ssbOffsetPointA, ppWritePackedMsg, end) &&
push8(value->bchPayloadFlag, ppWritePackedMsg, end) &&
push32(value->bchPayload, ppWritePackedMsg, end)
push32(value->bchPayload, ppWritePackedMsg, end) &&
push8(value->ssbRsrp, ppWritePackedMsg, end)
// TODO: pack precoding_and_beamforming too
);
}
......@@ -2263,6 +2264,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 +2306,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 +2315,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 +2351,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 +2362,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 +2371,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].rx_ind_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 +2590,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 +2632,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 +2653,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 +3017,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 +3034,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;
return 0;
for(int i=0; i<pNfapiMsg->number_of_pdus;i++)
for (int i = 0; i < pNfapiMsg->number_of_pdus; i++)
{
if(!pack_nr_rx_data_indication_body(pNfapiMsg->pdu_list,ppWritePackedMsg,end))
return 0;
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 +3075,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 +3144,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;
}
......@@ -3172,28 +3183,27 @@ static uint8_t pack_nr_uci_pucch_0_1(void* tlv, uint8_t **ppWritePackedMsg, uint
push16(value->rnti, ppWritePackedMsg, end) &&
push8(value->pucch_format, ppWritePackedMsg, end) &&
push8(value->ul_cqi, ppWritePackedMsg, end) &&
push16(value->timing_advance, ppWritePackedMsg, end) &&
push16(value->timing_advance, ppWritePackedMsg, end) &&
push16(value->rssi, ppWritePackedMsg, end)
))
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 +3268,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:
......@@ -3307,13 +3317,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) &&
......@@ -3465,13 +3468,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) &&
......@@ -3738,7 +3734,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
);
}
......@@ -5656,19 +5653,29 @@ return 1;
//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) &&
pull16(ppReadPackedMsg, &value->pdu_length, end) &&
pull8(ppReadPackedMsg, &value->ul_cqi, end) &&
pull16(ppReadPackedMsg, &value->timing_advance, end) &&
pull16(ppReadPackedMsg, &value->rssi, end)
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;
}
......@@ -5676,16 +5683,19 @@ static uint8_t unpack_nr_rx_data_indication_body(void* tlv, uint8_t **ppReadPack
static uint8_t unpack_nr_rx_data_indication(uint8_t **ppReadPackedMsg, uint8_t *end, nfapi_nr_rx_data_indication_t *msg, nfapi_p7_codec_config_t* config)
{
nfapi_nr_rx_data_indication_t *pNfapiMsg = (nfapi_nr_rx_data_indication_t*)msg;
if (!(pull16(ppReadPackedMsg, &pNfapiMsg->sfn , end) &&
pull16(ppReadPackedMsg, &pNfapiMsg->slot , end) &&
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 +5725,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));
if (!(pull16(ppReadPackedMsg, &pNfapiMsg->sfn, end) &&
pull16(ppReadPackedMsg, &pNfapiMsg->slot, end) &&
nfapi_nr_crc_indication_t *pNfapiMsg = (nfapi_nr_crc_indication_t*)msg;
if (!(pull16(ppReadPackedMsg, &pNfapiMsg->sfn , end) &&
pull16(ppReadPackedMsg, &pNfapiMsg->slot , end) &&
pull16(ppReadPackedMsg, &pNfapiMsg->number_crcs, end)
))
return 0;
return 0;
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++)
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 +5792,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 +5807,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 +5829,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
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;
// uint8_t *ptr = *ppReadPackedMsg;
// printf("\n Read P7 message uci_0_1 indication unpack: ");
// while(ptr < end){
// printf(" %d ", *ptr);
// ptr++;
// }
// printf("\n");
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) {
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) &&
......@@ -5854,18 +5867,32 @@ static uint8_t unpack_nr_uci_pucch_0_1(nfapi_nr_uci_pucch_pdu_format_0_1_t* tlv,
}
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,31 +5957,39 @@ 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)
))
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_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;
switch (value->pdu_type) {
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;
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;
return 1;
}
static uint8_t unpack_nr_uci_indication(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config)
......@@ -5967,13 +6002,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 +6269,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 +6334,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 +6387,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].rx_ind_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].rx_ind_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) {
......@@ -7745,7 +7810,7 @@ int nfapi_nr_p7_message_unpack(void *pMessageBuf, uint32_t messageBufLen, void *
nfapi_p7_message_header_t *pMessageHeader = (nfapi_p7_message_header_t*)pUnpackedBuf;
uint8_t *pReadPackedMessage = pMessageBuf;
uint8_t *end = pMessageBuf + messageBufLen;
if (pMessageBuf == NULL || pUnpackedBuf == NULL)
{
NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 unpack supplied pointers are null\n");
......@@ -7757,14 +7822,6 @@ int nfapi_nr_p7_message_unpack(void *pMessageBuf, uint32_t messageBufLen, void *
NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 unpack supplied message buffer is too small %d, %d\n", messageBufLen, unpackedBufLen);
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);
......
......@@ -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;
}
......
/*
* 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.
......@@ -22,6 +22,7 @@
#include "nfapi_nr_interface.h"
#include "debug.h"
#include "netinet/in.h"
#if defined(__cplusplus)
......@@ -105,79 +106,79 @@ typedef struct nfapi_vnf_config
/*! Configuration options for the p4 p5 pack unpack functions */
nfapi_p4_p5_codec_config_t codec_config;
/*! Optional user defined data that will be avaliable in the callbacks*/
void* user_data;
/*! \brief Callback indicating that a pnf has established connection
/*! \brief Callback indicating that a pnf has established connection
* \param config A pointer to the vnf configuration
* \param p5_idx The p5 used to indicate this pnf p5 connection
*
* The client is expected to send the PNF_PARAM.request in response to
*
* The client is expected to send the PNF_PARAM.request in response to
* the connection indication
*
*
* \todo Do we need to send the address information of the PNF?
*/
int (*pnf_nr_connection_indication)(nfapi_vnf_config_t* config, int p5_idx);
int (*pnf_connection_indication)(nfapi_vnf_config_t* config, int p5_idx);
/*! \brief Callback indicating that a pnf has lost connection
/*! \brief Callback indicating that a pnf has lost connection
* \param config A pointer to the vnf configuration
* \param p5_idx The p5 used to indicate this pnf p5 connection
*
* The p5_idx may be used for future new p5 connections
*
* The client is responsiable for communicating to the p7 instance(s) that
* may be associated with this p5 that they should be deleted using the
* may be associated with this p5 that they should be deleted using the
* nfapi_vnf_p7_del_pnf functon
*
*
*/
int (*pnf_disconnect_indication)(nfapi_vnf_config_t* config, int p5_idx);
// p5 interface functions
/*! \brief A callback to handle the PNF_PARAM.resp
* \param config A pointer to the vnf configuration
* \param p5_idx The p5 index used to indicate a particular pnf p5 connection
* \param resp A data structure for the decoded PNF_PARAM.response. This will
* have been allocated on the stack.
* \param resp A data structure for the decoded PNF_PARAM.response. This will
* have been allocated on the stack.
* \return not currently used.
*
*
* The PNF_PARAM.resp contains the capability of the PNF identified by the
* p5_idx.
*
* p5_idx.
*
* The client is expected to send the PNF_CONFIG.request after receiving the
* PNF_PARAM.resp. This can be done in the call back.
* PNF_PARAM.resp. This can be done in the call back.
*
* It is expected that the client when building the PNF_CONFIG.request will
* used the nfapi_vnf_allocate_phy() to allocate unique phy id for each FAPI
* instance the client wishes to create.
*
* The resp may contain pointers to dyanmically allocated sub structures
* such as the vendor_extention. The dyanmically allocated structure will
* be deallocated on return. If the client wishes to 'keep' the structures
*
* The resp may contain pointers to dyanmically allocated sub structures
* such as the vendor_extention. The dyanmically allocated structure will
* be deallocated on return. If the client wishes to 'keep' the structures
* then the substructure pointers should be set to 0 and then the client should
* use the codec_config.deallocate function to release it at a future point
*/
int (*pnf_nr_param_resp)(nfapi_vnf_config_t* config, int p5_idx, nfapi_nr_pnf_param_response_t* resp);
int (*pnf_param_resp)(nfapi_vnf_config_t* config, int p5_idx, nfapi_pnf_param_response_t* resp);
/*! A callback for the PNF_CONFIG.resp
/*! A callback for the PNF_CONFIG.resp
* \param config A pointer to the vnf configuration
* \param p5_idx The p5 index used to indicate a particular pnf p5 connection
* \param resp A data structure for the decoded PNF_CONFIG.response. This will
* have been allocated on the stack.
* \param resp A data structure for the decoded PNF_CONFIG.response. This will
* have been allocated on the stack.
* \return not currently used.
*
* The PNF_CONFIG.resp contains the result of the PNF_CONFIG.request for the
* PNF identified by the p5_idx.
*
*
* The PNF_CONFIG.resp contains the result of the PNF_CONFIG.request for the
* PNF identified by the p5_idx.
*
* The client is expected to send the PNF_START.request after receiving the
* PNF_PARAM.resp. This can be done in the call back.
*
* The resp may contain pointers to dyanmically allocated sub structures
* such as the vendor_extention. The dyanmically allocated structure will
* be deallocated on return. If the client wishes to 'keep' the structures
* PNF_PARAM.resp. This can be done in the call back.
*
* The resp may contain pointers to dyanmically allocated sub structures
* such as the vendor_extention. The dyanmically allocated structure will
* be deallocated on return. If the client wishes to 'keep' the structures
* then the substructure pointers should be set to 0 and then the client should
* use the codec_config.deallocate function to release it at a future point
*/
......@@ -187,19 +188,19 @@ typedef struct nfapi_vnf_config
/*! A callback for the PNF_START.resp
* \param config A pointer to the vnf configuration
* \param p5_idx The p5 index used to indicate a particular pnf p5 connection
* \param resp A data structure for the decoded PNF_START.response. This will
* have been allocated on the stack.
* \param resp A data structure for the decoded PNF_START.response. This will
* have been allocated on the stack.
* \return not currently used.
*
* The PNF_START.resp contains the result of the PNF_START.request for the
* PNF identified by the p5_idx.
*
* The client is expected to send the PARAM.request for each FAPI instance
* that has been created in the PNF.
*
* The resp may contain pointers to dyanmically allocated sub structures
* such as the vendor_extention. The dyanmically allocated structure will
* be deallocated on return. If the client wishes to 'keep' the structures
*
* The PNF_START.resp contains the result of the PNF_START.request for the
* PNF identified by the p5_idx.
*
* The client is expected to send the PARAM.request for each FAPI instance
* that has been created in the PNF.
*
* The resp may contain pointers to dyanmically allocated sub structures
* such as the vendor_extention. The dyanmically allocated structure will
* be deallocated on return. If the client wishes to 'keep' the structures
* then the substructure pointers should be set to 0 and then the client should
* use the codec_config.deallocate function to release it at a future point
*/
......@@ -209,63 +210,63 @@ typedef struct nfapi_vnf_config
/*! A callback for the PNF_STOP.resp
* \param config A pointer to the vnf configuration
* \param p5_idx The p5 index used to indicate a particular pnf p5 connection
* \param resp A data structure for the decoded PNF_STOP.response. This will
* have been allocated on the stack.
* \param resp A data structure for the decoded PNF_STOP.response. This will
* have been allocated on the stack.
* \return not currently used.
*
* The PNF_STOP.response contains the result of the PNF_STOP.request for the
* PNF identified by the p5_idx.
*
* The resp may contain pointers to dyanmically allocated sub structures
* such as the vendor_extention. The dyanmically allocated structure will
* be deallocated on return. If the client wishes to 'keep' the structures
*
* The PNF_STOP.response contains the result of the PNF_STOP.request for the
* PNF identified by the p5_idx.
*
* The resp may contain pointers to dyanmically allocated sub structures
* such as the vendor_extention. The dyanmically allocated structure will
* be deallocated on return. If the client wishes to 'keep' the structures
* then the substructure pointers should be set to 0 and then the client should
* use the codec_config.deallocate function to release it at a future point
*/
int (*pnf_stop_resp)(nfapi_vnf_config_t* config, int p5_idx, nfapi_pnf_stop_response_t* resp);
/*! A callback for the PARAM.resp
* \param config A pointer to the vnf configuration
* \param p5_idx The p5 index used to indicate a particular pnf p5 connection
* \param resp A data structure for the decoded PARAM.resposne. This will
* have been allocated on the stack.
* \param resp A data structure for the decoded PARAM.resposne. This will
* have been allocated on the stack.
* \return not currently used.
*
*
* The PARAM.request contains the capabilities of the FAPI instance identified
* by the phy_id
*
* The client is expected to send the CONFIG.request after receiving the
* PARAM.response. This can be done in the call back. The PARAM.response
* contains the PNF P7 address (ipv4 or ipv6) and port. This information
* PARAM.response. This can be done in the call back. The PARAM.response
* contains the PNF P7 address (ipv4 or ipv6) and port. This information
* is used when calling the nfapi_vnf_p7_add_pnf()
*
* The client is responsible for identifing the VNF P7 ip address
*
* The client is responsible for identifing the VNF P7 ip address
* (ipv4 or ipv6) and port for the VNF P7 entity which will be sent to the
* PNF P7 entity. That endpoint should be valid before send the
* PNF P7 entity. That endpoint should be valid before send the
* CONFIG.request.
*
* The resp may contain pointers to dyanmically allocated sub structures
* such as the vendor_extention. The dyanmically allocated structure will
* be deallocated on return. If the client wishes to 'keep' the structures
*
* The resp may contain pointers to dyanmically allocated sub structures
* such as the vendor_extention. The dyanmically allocated structure will
* be deallocated on return. If the client wishes to 'keep' the structures
* then the substructure pointers should be set to 0 and then the client should
* use the codec_config.deallocate function to release it at a future point
*/
int (*param_resp)(nfapi_vnf_config_t* config, int p5_idx, nfapi_param_response_t* resp);
int (*nr_param_resp)(nfapi_vnf_config_t* config, int p5_idx, nfapi_nr_param_response_scf_t* resp);
/*! A callback for the CONFIG.response
* \param config A pointer to the vnf configuration
* \param p5_idx The p5 index used to indicate a particular pnf p5 connection
* \param resp A data structure for the decoded CONFIG.response This will
* have been allocated on the stack.
* \param resp A data structure for the decoded CONFIG.response This will
* have been allocated on the stack.
* \return not currently used.
*
*
* The CONFIG.response contains the result of the CONFIG.request
*
*
* The resp may contain pointers to dyanmically allocated sub structures
* such as the vendor_extention. The dyanmically allocated structure will
* be deallocated on return. If the client wishes to 'keep' the structures
*
* The resp may contain pointers to dyanmically allocated sub structures
* such as the vendor_extention. The dyanmically allocated structure will
* be deallocated on return. If the client wishes to 'keep' the structures
* then the substructure pointers should be set to 0 and then the client should
* use the codec_config.deallocate function to release it at a future point
*/
......@@ -275,173 +276,173 @@ typedef struct nfapi_vnf_config
/*! A callback for the START.resp
* \param config A pointer to the vnf configuration
* \param p5_idx The p5 index used to indicate a particular pnf p5 connection
* \param resp A data structure for the decoded START.response This will
* have been allocated on the stack.
* \param resp A data structure for the decoded START.response This will
* have been allocated on the stack.
* \return not currently used.
*
*
* The START.response contains the result of the START.request
*
*
* The resp may contain pointers to dyanmically allocated sub structures
* such as the vendor_extention. The dyanmically allocated structure will
* be deallocated on return. If the client wishes to 'keep' the structures
*
* The resp may contain pointers to dyanmically allocated sub structures
* such as the vendor_extention. The dyanmically allocated structure will
* be deallocated on return. If the client wishes to 'keep' the structures
* then the substructure pointers should be set to 0 and then the client should
* use the codec_config.deallocate function to release it at a future point
*/
int (*start_resp)(nfapi_vnf_config_t* config, int p5_idx, nfapi_start_response_t* resp);
int (*nr_start_resp)(nfapi_vnf_config_t* config, int p5_idx, nfapi_nr_start_response_scf_t* resp);
/*! A callback for the STOP.resp
* \param config A pointer to the vnf configuration
* \param p5_idx The p5 index used to indicate a particular pnf p5 connection
* \param resp A data structure for the decoded STOP.response This will
* have been allocated on the stack.
* \param resp A data structure for the decoded STOP.response This will
* have been allocated on the stack.
* \return not currently used.
*
*
* The STOP.response contains the result of the STOP.request
*
*
* The resp may contain pointers to dyanmically allocated sub structures
* such as the vendor_extention. The dyanmically allocated structure will
* be deallocated on return. If the client wishes to 'keep' the structures
*
* The resp may contain pointers to dyanmically allocated sub structures
* such as the vendor_extention. The dyanmically allocated structure will
* be deallocated on return. If the client wishes to 'keep' the structures
* then the substructure pointers should be set to 0 and then the client should
* use the codec_config.deallocate function to release it at a future point
*/
*/
int (*stop_resp)(nfapi_vnf_config_t* config, int p5_idx, nfapi_stop_response_t* resp);
/*! A callback for the MEASUREMENT.resp
/*! A callback for the MEASUREMENT.resp
* \param config A pointer to the vnf configuration
* \param p5_idx The p5 index used to indicate a particular pnf p5 connection
* \param resp A data structure for the decoded MEASUREMENT.response This will
* have been allocated on the stack.
* \param resp A data structure for the decoded MEASUREMENT.response This will
* have been allocated on the stack.
* \return not currently used.
*
*
* The MEASUREMENT.response contains the result of the MEASUREMENT.request
*
* The resp may contain pointers to dyanmically allocated sub structures
* such as the vendor_extention. The dyanmically allocated structure will
* be deallocated on return. If the client wishes to 'keep' the structures
*
* The resp may contain pointers to dyanmically allocated sub structures
* such as the vendor_extention. The dyanmically allocated structure will
* be deallocated on return. If the client wishes to 'keep' the structures
* then the substructure pointers should be set to 0 and then the client should
* use the codec_config.deallocate function to release it at a future point
*/
*/
int (*measurement_resp)(nfapi_vnf_config_t* config, int p5_idx, nfapi_measurement_response_t* resp);
// p4 interface functions
/*! A callback for the RSSI.resp
/*! A callback for the RSSI.resp
* \param config A pointer to the vnf configuration
* \param p5_idx The p5 index used to indicate a particular pnf p5 connection
* \param resp A data structure for the decoded RSSI.response This will
* have been allocated on the stack.
* \param resp A data structure for the decoded RSSI.response This will
* have been allocated on the stack.
* \return not currently used.
*/
int (*rssi_resp)(nfapi_vnf_config_t* config, int p5_idx, nfapi_rssi_response_t* resp);
/*! A callback for the RSSI.indication
* \param config A pointer to the vnf configuration
* \param p5_idx The p5 index used to indicate a particular pnf p5 connection
* \param resp A data structure for the decoded RSSI.indication This will
* have been allocated on the stack.
* \param resp A data structure for the decoded RSSI.indication This will
* have been allocated on the stack.
* \return not currently used.
*/
int (*rssi_ind)(nfapi_vnf_config_t* config, int p5_idx, nfapi_rssi_indication_t* ind);
/*! A callback for the CELL_SEARCH.response
* \param config A pointer to the vnf configuration
* \param p5_idx The p5 index used to indicate a particular pnf p5 connection
* \param resp A data structure for the decoded CELL_SEARCH.response This will
* have been allocated on the stack.
* \param resp A data structure for the decoded CELL_SEARCH.response This will
* have been allocated on the stack.
* \return not currently used.
*/
int (*cell_search_resp)(nfapi_vnf_config_t* config, int p5_idx, nfapi_cell_search_response_t* resp);
/*! A callback for the CELL_SEARCH.indication
* \param config A pointer to the vnf configuration
* \param p5_idx The p5 index used to indicate a particular pnf p5 connection
* \param resp A data structure for the decoded CELL_SEARCH.indication This will
* have been allocated on the stack.
* \param resp A data structure for the decoded CELL_SEARCH.indication This will
* have been allocated on the stack.
* \return not currently used.
*/
int (*cell_search_ind)(nfapi_vnf_config_t* config, int p5_idx, nfapi_cell_search_indication_t* ind);
/*! A callback for the BROADCAST_DETECT.response
* \param config A pointer to the vnf configuration
* \param p5_idx The p5 index used to indicate a particular pnf p5 connection
* \param resp A data structure for the decoded BROADCAST_DETECT.response This will
* have been allocated on the stack.
* \param resp A data structure for the decoded BROADCAST_DETECT.response This will
* have been allocated on the stack.
* \return not currently used. */
int (*broadcast_detect_resp)(nfapi_vnf_config_t* config, int p5_idx, nfapi_broadcast_detect_response_t* resp);
/*! A callback for the BROADCAST_DETECT.indication
* \param config A pointer to the vnf configuration
* \param p5_idx The p5 index used to indicate a particular pnf p5 connection
* \param resp A data structure for the decoded BROADCAST_DETECT.indication This will
* have been allocated on the stack.
* \return not currently used.
* \param resp A data structure for the decoded BROADCAST_DETECT.indication This will
* have been allocated on the stack.
* \return not currently used.
*/
int (*broadcast_detect_ind)(nfapi_vnf_config_t* config, int p5_idx, nfapi_broadcast_detect_indication_t* ind);
/*! A callback for the SYSTEM_INFORMATION_SCHEUDLE.response
* \param config A pointer to the vnf configuration
* \param p5_idx The p5 index used to indicate a particular pnf p5 connection
* \param resp A data structure for the decoded SYSTEM_INFORMATION_SCHEUDLE.response This will
* have been allocated on the stack.
* \return not currently used.
* \param resp A data structure for the decoded SYSTEM_INFORMATION_SCHEUDLE.response This will
* have been allocated on the stack.
* \return not currently used.
*/
int (*system_information_schedule_resp)(nfapi_vnf_config_t* config, int p5_idx, nfapi_system_information_schedule_response_t* resp);
/*! A callback for the SYSTEM_INFORMATION_SCHEUDLE.indication
* \param config A pointer to the vnf configuration
* \param p5_idx The p5 index used to indicate a particular pnf p5 connection
* \param resp A data structure for the decoded SYSTEM_INFORMATION_SCHEUDLE.indication This will
* have been allocated on the stack.
* \return not currently used.
* \param resp A data structure for the decoded SYSTEM_INFORMATION_SCHEUDLE.indication This will
* have been allocated on the stack.
* \return not currently used.
*/
int (*system_information_schedule_ind)(nfapi_vnf_config_t* config, int p5_idx, nfapi_system_information_schedule_indication_t* ind);
/*! A callback for the SYSTEM_INFORMATION.response
* \param config A pointer to the vnf configuration
* \param p5_idx The p5 index used to indicate a particular pnf p5 connection
* \param resp A data structure for the decoded SYSTEM_INFORMATION.response This will
* have been allocated on the stack.
* \return not currently used.
* \param resp A data structure for the decoded SYSTEM_INFORMATION.response This will
* have been allocated on the stack.
* \return not currently used.
*/
int (*system_information_resp)(nfapi_vnf_config_t* config, int p5_idx, nfapi_system_information_response_t* resp);
/*! A callback for the SYSTEM_INFORMATION.indication
* \param config A pointer to the vnf configuration
* \param p5_idx The p5 index used to indicate a particular pnf p5 connection
* \param resp A data structure for the decoded SYSTEM_INFORMATION.indication This will
* have been allocated on the stack.
* \return not currently used.
* \param resp A data structure for the decoded SYSTEM_INFORMATION.indication This will
* have been allocated on the stack.
* \return not currently used.
*/
int (*system_information_ind)(nfapi_vnf_config_t* config, int p5_idx, nfapi_system_information_indication_t* ind);
/*! A callback for the NMM_STOP.response
* \param config A pointer to the vnf configuration
* \param p5_idx The p5 index used to indicate a particular pnf p5 connection
* \param resp A data structure for the decoded NMM_STOP.response This will
* have been allocated on the stack.
* \return not currently used.
* \param resp A data structure for the decoded NMM_STOP.response This will
* have been allocated on the stack.
* \return not currently used.
*/
int (*nmm_stop_resp)(nfapi_vnf_config_t* config, int p5_idx, nfapi_nmm_stop_response_t* resp);
/*! A callback for any vendor extension message received
* \param config A pointer to the vnf configuration
* \param p5_idx The p5 index used to indicate a particular pnf p5 connection
* \param resp A data structure for the decoded vendor extention message
* \return not currently used.
* \param resp A data structure for the decoded vendor extention message
* \return not currently used.
*/
int (*vendor_ext)(nfapi_vnf_config_t* config, int p5_idx, nfapi_p4_p5_message_header_t* msg);
/*! A callback to allocate vendor extension messages
* \param message_id The message is taken from the message header
* \param msg_size The is the vendor extention message that has been allocated.
* \param msg_size The is the vendor extention message that has been allocated.
* The callee must set this value
* \return A pointer to an allocated vendor extention message
*/
nfapi_p4_p5_message_header_t* (*allocate_p4_p5_vendor_ext)(uint16_t message_id, uint16_t* msg_size);
/*! A callback to deallocate vendor extension messages
* \param header A pointer to an allocated vendor extention message
*/
......@@ -450,8 +451,8 @@ typedef struct nfapi_vnf_config
} nfapi_vnf_config_t;
/*! Creates and initialise the vnf config structure before use
......@@ -464,24 +465,24 @@ nfapi_vnf_config_t* nfapi_vnf_config_create(void);
void nfapi_vnf_config_destory(nfapi_vnf_config_t* config);
/*! Start the VNF library.
/*! Start the VNF library.
* \param config A pointer to a vnf config
* \return 0 means success, -1 failure
*
* The config should be initailize with port the vnf should listen on and
* the callback set to functions that will be called when a nFAPI message is
* the callback set to functions that will be called when a nFAPI message is
* recevied before calling nfapi_vnf_start.
*
*
* This function will not return untill nfapi_vnf_stop is called
*/
int nfapi_nr_vnf_start(nfapi_vnf_config_t* config);
int nfapi_vnf_start(nfapi_vnf_config_t* config);
/*! Stop the VNF library.
/*! Stop the VNF library.
* \param config A pointer to a vnf config
* \return 0 means success, -1 failure
*
*
* This function will cause the nfapi_vnf_start function to return
*/
int nfapi_vnf_stop(nfapi_vnf_config_t* config);
......@@ -491,7 +492,7 @@ int nfapi_vnf_stop(nfapi_vnf_config_t* config);
* \param p5_idx The P5 index return by the callbacks
* \param phy_id A pointer to a phy_id that will be set by this function
* \return 0 means success, -1 failure
*
*
* Called before nfapi_vnf_config_req to allocate a vnf phy instance. This
* function will return unqiue phy_id to be used for this identify the phy
*
......@@ -652,7 +653,7 @@ typedef struct nfapi_vnf_p7_config
* If not set the vnf p7 library will use malloc
*/
void* (*malloc)(size_t size);
/*! A user define callback to override the default memory deallocation
* \param ptr Pointer to a memory block to deallocate
*
......@@ -697,204 +698,148 @@ typedef struct nfapi_vnf_p7_config
*
* \todo Need some way the tell the VNF how long it has
*/
int (*subframe_indication)(struct nfapi_vnf_p7_config* config, uint16_t phy_id, uint16_t sfn_sf);
int (*slot_indication)(struct nfapi_vnf_p7_config* config, uint16_t phy_id, uint16_t sfn, uint16_t slot);
/*! A callback for the HARQ.indication
* \param config A pointer to the vnf p7 configuration
* \param ind A data structure for the decoded HARQ.indication This will
* have been allocated on the stack.
* \param ind A data structure for the decoded HARQ.indication This will
* have been allocated on the stack.
* \return not currently used.
*
* The ind may contain pointers to dyanmically allocated sub structures
* such as the pdu. The dyanmically allocated structure will
* be deallocated on return. If the client wishes to 'keep' the structures
*
* The ind may contain pointers to dyanmically allocated sub structures
* such as the pdu. The dyanmically allocated structure will
* be deallocated on return. If the client wishes to 'keep' the structures
* then the substructure pointers should be set to 0 and then the client should
* use the codec_config.deallocate function to release it at a future point
*/
*/
int (*harq_indication)(struct nfapi_vnf_p7_config* config, nfapi_harq_indication_t* ind);
/*! A callback for the CRC.ind
* \param config A pointer to the vnf p7 configuration
* \param ind A data structure for the decoded CRC.indication This will
* have been allocated on the stack.
* \param ind A data structure for the decoded CRC.indication This will
* have been allocated on the stack.
* \return not currently used.
*
* The ind may contain pointers to dyanmically allocated sub structures
* such as the pdu. The dyanmically allocated structure will
* be deallocated on return. If the client wishes to 'keep' the structures
*
* The ind may contain pointers to dyanmically allocated sub structures
* such as the pdu. The dyanmically allocated structure will
* be deallocated on return. If the client wishes to 'keep' the structures
* then the substructure pointers should be set to 0 and then the client should
* use the codec_config.deallocate function to release it at a future point
*/
*/
int (*crc_indication)(struct nfapi_vnf_p7_config* config, nfapi_crc_indication_t* ind);
/*! A callback for the nrCRC.indication
* \param config A pointer to the vnf p7 configuration
* \param ind A data structure for the decoded nrCRC.indication This will
* have been allocated on the stack.
* \return not currently used.
*
* The ind may contain pointers to dyanmically allocated sub structures
* such as the pdu. The dyanmically allocated structure will
* be deallocated on return. If the client wishes to 'keep' the structures
* then the substructure pointers should be set to 0 and then the client should
* use the codec_config.deallocate function to release it at a future point
*/
int (*nr_crc_indication)(struct nfapi_vnf_p7_config* config, nfapi_nr_crc_indication_t* ind);
/*! A callback for the RX_ULSCH.indication
* \param config A pointer to the vnf p7 configuration
* \param ind A data structure for the decoded RX_ULSCH.indication This will
* have been allocated on the stack.
* \param ind A data structure for the decoded RX_ULSCH.indication This will
* have been allocated on the stack.
* \return not currently used.
*
* The ind may contain pointers to dyanmically allocated sub structures
* such as the pdu. The dyanmically allocated structure will
* be deallocated on return. If the client wishes to 'keep' the structures
*
* The ind may contain pointers to dyanmically allocated sub structures
* such as the pdu. The dyanmically allocated structure will
* be deallocated on return. If the client wishes to 'keep' the structures
* then the substructure pointers should be set to 0 and then the client should
* use the codec_config.deallocate function to release it at a future point
*
* Note that the rx_indication may hold one or many uplink pdus in the
* Note that the rx_indication may hold one or many uplink pdus in the
* ind.rx_indication_body.rx_pdu_list
*/
*/
int (*rx_indication)(struct nfapi_vnf_p7_config* config, nfapi_rx_indication_t* ind);
/*! A callback for the nrRX.indication
* \param config A pointer to the vnf p7 configuration
* \param ind A data structure for the decoded nrRX.indication This will
* have been allocated on the stack.
* \return not currently used.
*
* The ind may contain pointers to dyanmically allocated sub structures
* such as the pdu. The dyanmically allocated structure will
* be deallocated on return. If the client wishes to 'keep' the structures
* then the substructure pointers should be set to 0 and then the client should
* use the codec_config.deallocate function to release it at a future point
*/
int (*nr_rx_indication)(struct nfapi_vnf_p7_config* config, nfapi_nr_rx_data_indication_t* ind);
/*! A callback for the RACH.indication
* \param config A pointer to the vnf p7 configuration
* \param ind A data structure for the decoded RACH.indication This will
* have been allocated on the stack.
* \param ind A data structure for the decoded RACH.indication This will
* have been allocated on the stack.
* \return not currently used.
*
* The ind may contain pointers to dyanmically allocated sub structures
* such as the pdu. The dyanmically allocated structure will
* be deallocated on return. If the client wishes to 'keep' the structures
*
* The ind may contain pointers to dyanmically allocated sub structures
* such as the pdu. The dyanmically allocated structure will
* be deallocated on return. If the client wishes to 'keep' the structures
* then the substructure pointers should be set to 0 and then the client should
* use the codec_config.deallocate function to release it at a future point
*/
*/
int (*rach_indication)(struct nfapi_vnf_p7_config* config, nfapi_rach_indication_t* ind);
/*! A callback for the nrRACH.indication
* \param config A pointer to the vnf p7 configuration
* \param ind A data structure for the decoded nrRACH.indication This will
* have been allocated on the stack.
* \return not currently used.
*
* The ind may contain pointers to dyanmically allocated sub structures
* such as the pdu. The dyanmically allocated structure will
* be deallocated on return. If the client wishes to 'keep' the structures
* then the substructure pointers should be set to 0 and then the client should
* use the codec_config.deallocate function to release it at a future point
*/
int (*nr_rach_indication)(struct nfapi_vnf_p7_config* config, nfapi_nr_rach_indication_t* ind);
/*! A callback for the nrRACH.indication
* \param config A pointer to the vnf p7 configuration
* \param ind A data structure for the decoded nrRACH.indication This will
* have been allocated on the stack.
* \return not currently used.
*
* The ind may contain pointers to dyanmically allocated sub structures
* such as the pdu. The dyanmically allocated structure will
* be deallocated on return. If the client wishes to 'keep' the structures
* then the substructure pointers should be set to 0 and then the client should
* use the codec_config.deallocate function to release it at a future point
*/
int (*nr_uci_indication)(struct nfapi_vnf_p7_config* config, nfapi_nr_uci_indication_t* ind);
/*! A callback for the SRS.indication
* \param config A pointer to the vnf p7 configuration
* \param ind A data structure for the decoded SRS.indication This will
* have been allocated on the stack.
* \param ind A data structure for the decoded SRS.indication This will
* have been allocated on the stack.
* \return not currently used.
*
* The ind may contain pointers to dyanmically allocated sub structures
* such as the pdu. The dyanmically allocated structure will
* be deallocated on return. If the client wishes to 'keep' the structures
*
* The ind may contain pointers to dyanmically allocated sub structures
* such as the pdu. The dyanmically allocated structure will
* be deallocated on return. If the client wishes to 'keep' the structures
* then the substructure pointers should be set to 0 and then the client should
* use the codec_config.deallocate function to release it at a future point
*/
*/
int (*srs_indication)(struct nfapi_vnf_p7_config* config, nfapi_srs_indication_t* ind);
/*! A callback for the RX_SR.indication
* \param config A pointer to the vnf p7 configuration
* \param ind A data structure for the decoded RX_SR.indication This will
* have been allocated on the stack.
* \param ind A data structure for the decoded RX_SR.indication This will
* have been allocated on the stack.
* \return not currently used.
*
* The ind may contain pointers to dyanmically allocated sub structures
* such as the pdu. The dyanmically allocated structure will
* be deallocated on return. If the client wishes to 'keep' the structures
*
* The ind may contain pointers to dyanmically allocated sub structures
* such as the pdu. The dyanmically allocated structure will
* be deallocated on return. If the client wishes to 'keep' the structures
* then the substructure pointers should be set to 0 and then the client should
* use the codec_config.deallocate function to release it at a future point
*/
*/
int (*sr_indication)(struct nfapi_vnf_p7_config* config, nfapi_sr_indication_t* ind);
/*! A callback for the RX_CQI.indication
* \param config A pointer to the vnf p7 configuration
* \param ind A data structure for the decoded RX_CQI.indication This will
* have been allocated on the stack.
* \param ind A data structure for the decoded RX_CQI.indication This will
* have been allocated on the stack.
* \return not currently used.
*
* The ind may contain pointers to dyanmically allocated sub structures
* such as the pdu. The dyanmically allocated structure will
* be deallocated on return. If the client wishes to 'keep' the structures
*
* The ind may contain pointers to dyanmically allocated sub structures
* such as the pdu. The dyanmically allocated structure will
* be deallocated on return. If the client wishes to 'keep' the structures
* then the substructure pointers should be set to 0 and then the client should
* use the codec_config.deallocate function to release it at a future point
*/
*/
int (*cqi_indication)(struct nfapi_vnf_p7_config* config, nfapi_cqi_indication_t* ind);
/*! A callback for the LBT_DL.indication
* \param config A pointer to the vnf p7 configuration
* \param ind A data structure for the decoded LBT_DL.indication This will
* have been allocated on the stack.
* \param ind A data structure for the decoded LBT_DL.indication This will
* have been allocated on the stack.
* \return not currently used.
*
* The ind may contain pointers to dyanmically allocated sub structures
* such as the pdu. The dyanmically allocated structure will
* be deallocated on return. If the client wishes to 'keep' the structures
*
* The ind may contain pointers to dyanmically allocated sub structures
* such as the pdu. The dyanmically allocated structure will
* be deallocated on return. If the client wishes to 'keep' the structures
* then the substructure pointers should be set to 0 and then the client should
* use the codec_config.deallocate function to release it at a future point
*/
*/
int (*lbt_dl_indication)(struct nfapi_vnf_p7_config* config, nfapi_lbt_dl_indication_t* ind);
/*! A callback for the NB_HARQ.indication
* \param config A pointer to the vnf p7 configuration
* \param ind A data structure for the decoded LBT_DL.indication This will
* have been allocated on the stack.
* \param ind A data structure for the decoded LBT_DL.indication This will
* have been allocated on the stack.
* \return not currently used.
*
* The ind may contain pointers to dyanmically allocated sub structures
* such as the pdu. The dyanmically allocated structure will
* be deallocated on return. If the client wishes to 'keep' the structures
*
* The ind may contain pointers to dyanmically allocated sub structures
* such as the pdu. The dyanmically allocated structure will
* be deallocated on return. If the client wishes to 'keep' the structures
* then the substructure pointers should be set to 0 and then the client should
* use the codec_config.deallocate function to release it at a future point
*/
int (*nb_harq_indication)(struct nfapi_vnf_p7_config* config, nfapi_nb_harq_indication_t* ind);
*/
int (*nb_harq_indication)(struct nfapi_vnf_p7_config* config, nfapi_nb_harq_indication_t* ind);
/*! A callback for the NRACH.indication
* \param config A pointer to the vnf p7 configuration
* \param ind A data structure for the decoded LBT_DL.indication This will
* have been allocated on the stack.
* \param ind A data structure for the decoded LBT_DL.indication This will
* have been allocated on the stack.
* \return not currently used.
*
* The ind may contain pointers to dyanmically allocated sub structures
* such as the pdu. The dyanmically allocated structure will
* be deallocated on return. If the client wishes to 'keep' the structures
*
* The ind may contain pointers to dyanmically allocated sub structures
* such as the pdu. The dyanmically allocated structure will
* be deallocated on return. If the client wishes to 'keep' the structures
* then the substructure pointers should be set to 0 and then the client should
* use the codec_config.deallocate function to release it at a future point
*/
......@@ -902,6 +847,10 @@ typedef struct nfapi_vnf_p7_config
//The NR indication functions below copy uplink information received at the VNF into the UL info struct
int (*nr_slot_indication)(nfapi_nr_slot_indication_scf_t* ind);
int (*nr_crc_indication)(nfapi_nr_crc_indication_t* ind);
int (*nr_rx_data_indication)(nfapi_nr_rx_data_indication_t* ind);
int (*nr_uci_indication)(nfapi_nr_uci_indication_t* ind);
int (*nr_rach_indication)(nfapi_nr_rach_indication_t* ind);
int (*nr_srs_indication)(nfapi_nr_srs_indication_t* ind);
/*! A callback for any vendor extension messages
......@@ -909,20 +858,20 @@ typedef struct nfapi_vnf_p7_config
* \param msg A data structure for the decoded vendor extention message allocated
* using the allocate_p7_vendor_ext callback
* \return not currently used.
*/
*/
int (*vendor_ext)(struct nfapi_vnf_p7_config* config, nfapi_p7_message_header_t* msg);
/*! Optional userdata that will be passed back in the callbacks*/
void* user_data;
/*! A callback to allocate a memory for a vendor extension message
* \param message_id The message is taken from the p7 message header
* \param msg_size The is the vendor extention message that has been allocated.
* \param msg_size The is the vendor extention message that has been allocated.
* The callee must set this value
* \return A pointer to an allocated vendor extention message
*/
nfapi_p7_message_header_t* (*allocate_p7_vendor_ext)(uint16_t message_id, uint16_t* msg_size);
/*! A callback to deallocate a vendor extension message
* \param header A pointer to an allocated vendor extention message
*/
......@@ -941,7 +890,7 @@ nfapi_vnf_p7_config_t* nfapi_vnf_p7_config_create(void);
*
* The pointer to the config will not long be valid after this call
*/
void nfapi_vnf_p7_config_destory(nfapi_vnf_p7_config_t* config);
/*! Start the VNF P7 library.
......@@ -949,17 +898,17 @@ void nfapi_vnf_p7_config_destory(nfapi_vnf_p7_config_t* config);
* \return A status value. 0 equal success, -1 indicates failure
*
* This function is blocking and will not return until the nfapi_vnf_p7_stop
* function is called.
* function is called.
*/
int nfapi_vnf_p7_start(nfapi_vnf_p7_config_t* config);
int nfapi_nr_vnf_p7_start(nfapi_vnf_p7_config_t* config);
/*! Stop the VNF P7 library.
/*! Stop the VNF P7 library.
* \param config A pointer to an vnf p7 configuration structure
* \return A status value. 0 equal success, -1 indicates failure
*
*
* This function will cause the nfapi_vnf_p7_start function to return
*/
int nfapi_vnf_p7_stop(nfapi_vnf_p7_config_t* config);
......@@ -980,7 +929,7 @@ int nfapi_vnf_p7_release_pdu(nfapi_vnf_p7_config_t* config, void*);
/*! Add a vnf p7 instance to the vnf p7 module
* \param config A pointer to the vnf p7 configuration
* \param pnf_p7_addr The udp address the pnf p7 entity has chosen
* \param pnf_p7_addr The udp address the pnf p7 entity has chosen
* \param pnf_p7_port The udp port the pnf p7 entity has chosen
* \param phy_id The unique phy id for the pnf p7 entity
* \return A status value. 0 equal success, -1 indicates failure
......@@ -1004,7 +953,7 @@ int nfapi_vnf_p7_del_pnf(nfapi_vnf_p7_config_t* config, int phy_id);
* \param config A pointer to the vnf p7 configuration
* \param req A data structure for the decoded DL_CONFIG.request.
* \return A status value. 0 equal success, -1 indicates failure
*
*
* The caller is responsiable for memory management of any pointers set in the req, which
* may be released after this function call has returned or at a later pointer
*/
......@@ -1015,7 +964,7 @@ int nfapi_vnf_p7_nr_dl_config_req(nfapi_vnf_p7_config_t* config, nfapi_nr_dl_tti
* \param config A pointer to the vnf p7 configuration
* \param req A data structure for the decoded UL_CONFIG.request.
* \return A status value. 0 equal success, -1 indicates failure
*
*
* The caller is responsiable for memory management of any pointers set in the req, which
* may be released after this function call has returned or at a later pointer
*/
......@@ -1025,7 +974,7 @@ int nfapi_vnf_p7_ul_tti_req(nfapi_vnf_p7_config_t* config, nfapi_nr_ul_tti_reque
* \param config A pointer to the vnf p7 configuration
* \param req A data structure for the decoded HI_DCI0.request.
* \return A status value. 0 equal success, -1 indicates failure
*
*
* The caller is responsiable for memory management of any pointers set in the req, which
* may be released after this function call has returned or at a later pointer
*/
......@@ -1035,7 +984,7 @@ int nfapi_vnf_p7_ul_dci_req(nfapi_vnf_p7_config_t* config, nfapi_nr_ul_dci_reque
* \param config A pointer to the vnf p7 configuration
* \param req A data structure for the decoded HI_DCI0.request.
* \return A status value. 0 equal success, -1 indicates failure
*
*
* The caller is responsiable for memory management of any pointers set in the req, which
* may be released after this function call has returned or at a later pointer
*/
......@@ -1045,7 +994,7 @@ int nfapi_vnf_p7_tx_data_req(nfapi_vnf_p7_config_t* config, nfapi_nr_tx_data_req
* \param config A pointer to the vnf p7 configuration
* \param req A data structure for the decoded LBT_DL_CONFIG.request.
* \return A status value. 0 equal success, -1 indicates failure
*
*
* The caller is responsiable for memory management of any pointers set in the req, which
* may be released after this function call has returned or at a later pointer
*/
......@@ -1055,7 +1004,7 @@ int nfapi_vnf_p7_lbt_dl_config_req(nfapi_vnf_p7_config_t* config, nfapi_lbt_dl_c
* \param config A pointer to the vnf p7 configuration
* \param msg A data structure for the decoded vendor extention message
* \return A status value. 0 equal success, -1 indicates failure
*
*
* The caller is responsiable for memory management of any pointers set in the req, which
* may be released after this function call has returned or at a later pointer
*/
......
......@@ -23,9 +23,9 @@
#include <string.h>
#include <unistd.h>
#include <errno.h>
#include <stdio.h>
#include <assert.h>
#include <stdio.h>
#include "vnf_p7.h"
#ifdef NDEBUG
......@@ -1473,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 +1497,12 @@ void vnf_handle_nr_rx_data_indication(void *pRecvMsg, int recvMsgLen, vnf_p7_t*
{
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Failed to unpack message\n", __FUNCTION__);
}
else
else
{
NFAPI_TRACE(NFAPI_TRACE_INFO, "%s: Handling RX Indication\n", __FUNCTION__);
if(vnf_p7->_public.nr_rx_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_indication)(&vnf_p7->_public, &ind);
(vnf_p7->_public.nr_rx_data_indication)(&ind);
}
}
}
......@@ -1522,12 +1523,12 @@ void vnf_handle_nr_crc_indication(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_
{
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Failed to unpack message\n", __FUNCTION__);
}
else
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)(&vnf_p7->_public, &ind);
(vnf_p7->_public.nr_crc_indication)(&ind);
}
}
}
......@@ -1573,12 +1574,12 @@ void vnf_handle_nr_uci_indication(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_
{
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Failed to unpack message\n", __FUNCTION__);
}
else
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)(&vnf_p7->_public, &ind);
(vnf_p7->_public.nr_uci_indication)(&ind);
}
}
}
......@@ -1604,11 +1605,9 @@ void vnf_handle_nr_rach_indication(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf
NFAPI_TRACE(NFAPI_TRACE_INFO, "%s: Handling RACH Indication\n", __FUNCTION__);
if(vnf_p7->_public.nr_rach_indication)
{
(vnf_p7->_public.nr_rach_indication)(&vnf_p7->_public, &ind);
(vnf_p7->_public.nr_rach_indication)(&ind);
}
}
//vnf_p7_codec_free(vnf_p7, ind.nr_rach_indication_body.preamble_list); Melissa do we need to do this?
//vnf_p7_codec_free(vnf_p7, ind.vendor_extension);
}
}
......@@ -1703,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) %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",
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;
......@@ -1742,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) );
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment