Merge branch 'eurecom-nfapi-nr-arch-mod' into episys/merge_nsa_w_develop
This commit is contained in:
@@ -101,6 +101,8 @@ typedef struct {
|
||||
|
||||
|
||||
typedef struct {
|
||||
uint8_t harq_pid;
|
||||
uint8_t ack_nack;
|
||||
uint32_t pdu_length;
|
||||
uint8_t* pdu;
|
||||
} fapi_nr_pdsch_pdu_t;
|
||||
@@ -112,20 +114,14 @@ typedef struct {
|
||||
uint8_t ssb_length;
|
||||
uint16_t cell_id;
|
||||
uint16_t ssb_start_subcarrier;
|
||||
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;
|
||||
|
||||
@@ -187,87 +183,33 @@ typedef struct {
|
||||
} fapi_nr_ul_config_prach_pdu;
|
||||
|
||||
typedef struct {
|
||||
|
||||
pucch_format_nr_t format; /* format 0 1 2 3 4 */
|
||||
uint8_t initialCyclicShift; /* x x */
|
||||
uint8_t nrofSymbols; /* x x x x x */
|
||||
uint8_t startingSymbolIndex; /* x x x x x */
|
||||
uint8_t timeDomainOCC; /* x */
|
||||
uint8_t nrofPRBs; /* x x */
|
||||
uint16_t startingPRB; /* maxNrofPhysicalResourceBlocks = 275 */
|
||||
uint8_t occ_length; /* x */
|
||||
uint8_t occ_Index; /* x */
|
||||
|
||||
feature_status_t intraSlotFrequencyHopping;
|
||||
uint16_t secondHopPRB;
|
||||
|
||||
/*
|
||||
-- Enabling inter-slot frequency hopping when PUCCH Format 1, 3 or 4 is repeated over multiple slots.
|
||||
-- The field is not applicable for format 2.
|
||||
*/
|
||||
feature_status_t interslotFrequencyHopping;
|
||||
/*
|
||||
-- Enabling 2 DMRS symbols per hop of a PUCCH Format 3 or 4 if both hops are more than X symbols when FH is enabled (X=4).
|
||||
-- Enabling 4 DMRS sybmols for a PUCCH Format 3 or 4 with more than 2X+1 symbols when FH is disabled (X=4).
|
||||
-- Corresponds to L1 parameter 'PUCCH-F3-F4-additional-DMRS' (see 38.213, section 9.2.1)
|
||||
-- The field is not applicable for format 1 and 2.
|
||||
*/
|
||||
enable_feature_t additionalDMRS;
|
||||
/*
|
||||
-- Max coding rate to determine how to feedback UCI on PUCCH for format 2, 3 or 4
|
||||
-- Corresponds to L1 parameter 'PUCCH-F2-maximum-coderate', 'PUCCH-F3-maximum-coderate' and 'PUCCH-F4-maximum-coderate'
|
||||
-- (see 38.213, section 9.2.5)
|
||||
-- The field is not applicable for format 1.
|
||||
*/
|
||||
PUCCH_MaxCodeRate_t maxCodeRate;
|
||||
/*
|
||||
-- Number of slots with the same PUCCH F1, F3 or F4. When the field is absent the UE applies the value n1.
|
||||
-- Corresponds to L1 parameter 'PUCCH-F1-number-of-slots', 'PUCCH-F3-number-of-slots' and 'PUCCH-F4-number-of-slots'
|
||||
-- (see 38.213, section 9.2.6)
|
||||
-- The field is not applicable for format 2.
|
||||
*/
|
||||
uint8_t nrofSlots;
|
||||
/*
|
||||
-- Enabling pi/2 BPSK for UCI symbols instead of QPSK for PUCCH.
|
||||
-- Corresponds to L1 parameter 'PUCCH-PF3-PF4-pi/2PBSK' (see 38.213, section 9.2.5)
|
||||
-- The field is not applicable for format 1 and 2.
|
||||
*/
|
||||
feature_status_t pi2PBSK;
|
||||
/*
|
||||
-- Enabling simultaneous transmission of CSI and HARQ-ACK feedback with or without SR with PUCCH Format 2, 3 or 4
|
||||
-- Corresponds to L1 parameter 'PUCCH-F2-Simultaneous-HARQ-ACK-CSI', 'PUCCH-F3-Simultaneous-HARQ-ACK-CSI' and
|
||||
-- 'PUCCH-F4-Simultaneous-HARQ-ACK-CSI' (see 38.213, section 9.2.5)
|
||||
-- When the field is absent the UE applies the value OFF
|
||||
-- The field is not applicable for format 1.
|
||||
*/
|
||||
enable_feature_t simultaneousHARQ_ACK_CSI;
|
||||
/*
|
||||
-- Configuration of group- and sequence hopping for all the PUCCH formats 0, 1, 3 and 4. "neither" implies neither group
|
||||
-- or sequence hopping is enabled. "enable" enables group hopping and disables sequence hopping. "disable"” disables group
|
||||
-- hopping and enables sequence hopping. Corresponds to L1 parameter 'PUCCH-GroupHopping' (see 38.211, section 6.4.1.3)
|
||||
pucch-GroupHopping ENUMERATED { neither, enable, disable },
|
||||
*/
|
||||
pucch_GroupHopping_t pucch_GroupHopping;
|
||||
/*
|
||||
-- Cell-Specific scrambling ID for group hoppping and sequence hopping if enabled.
|
||||
-- Corresponds to L1 parameter 'HoppingID' (see 38.211, section 6.3.2.2)
|
||||
hoppingId BIT STRING (SIZE (10)) OPTIONAL, -- Need R
|
||||
*/
|
||||
uint16_t hoppingId;
|
||||
/*
|
||||
-- Power control parameter P0 for PUCCH transmissions. Value in dBm. Only even values (step size 2) allowed.
|
||||
-- Corresponds to L1 parameter 'p0-nominal-pucch' (see 38.213, section 7.2)
|
||||
p0-nominal INTEGER (-202..24) OPTIONAL, -- Need R
|
||||
*/
|
||||
int8_t p0_nominal;
|
||||
|
||||
int8_t deltaF_PUCCH_f[NUMBER_PUCCH_FORMAT_NR];
|
||||
uint8_t p0_PUCCH_Id; /* INTEGER (1..8) */
|
||||
int8_t p0_PUCCH_Value;
|
||||
// pathlossReferenceRSs SEQUENCE (SIZE (1..maxNrofPUCCH-PathlossReferenceRSs)) OF PUCCH-PathlossReferenceRS OPTIONAL, -- Need M
|
||||
int8_t twoPUCCH_PC_AdjustmentStates;
|
||||
|
||||
} fapi_nr_ul_config_pucch_pdu;
|
||||
uint16_t rnti;
|
||||
uint16_t bwp_size;
|
||||
uint16_t bwp_start;
|
||||
uint8_t format_type;
|
||||
uint8_t start_symbol_index;
|
||||
uint8_t nr_of_symbols;
|
||||
uint16_t prb_start;
|
||||
uint16_t prb_size;
|
||||
uint32_t hopping_id;
|
||||
uint8_t freq_hop_flag;
|
||||
uint8_t group_hop_flag;
|
||||
uint8_t sequence_hop_flag;
|
||||
uint16_t second_hop_prb;
|
||||
uint16_t initial_cyclic_shift;
|
||||
uint8_t time_domain_occ_idx;
|
||||
uint8_t add_dmrs_flag;
|
||||
uint16_t dmrs_scrambling_id;
|
||||
uint16_t data_scrambling_id;
|
||||
uint8_t dmrs_cyclic_shift;
|
||||
uint8_t pi_2bpsk;
|
||||
uint8_t mcs;
|
||||
uint8_t pre_dft_occ_idx;
|
||||
uint8_t pre_dft_occ_len;
|
||||
int16_t pucch_tx_power;
|
||||
uint32_t n_bit;
|
||||
uint64_t payload;
|
||||
} fapi_nr_ul_config_pucch_pdu;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
@@ -459,11 +401,8 @@ 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;
|
||||
@@ -510,437 +449,6 @@ 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
|
||||
|
||||
@@ -2729,7 +2729,7 @@ typedef struct {
|
||||
} nfapi_cqi_indication_rel8_t;
|
||||
#define NFAPI_CQI_INDICATION_REL8_TAG 0x202f
|
||||
|
||||
#define NFAPI_CC_MAX 4
|
||||
#define NFAPI_CC_MAX MAX_NUM_CCs
|
||||
typedef struct {
|
||||
nfapi_tl_t tl;
|
||||
uint16_t length;
|
||||
|
||||
@@ -673,6 +673,7 @@ typedef struct {
|
||||
#define NFAPI_NR_SLOT_INDICATION_PERIOD_NUMEROLOGY_3 125 //us
|
||||
|
||||
typedef struct {
|
||||
nfapi_p7_message_header_t header;
|
||||
uint16_t sfn; //0->1023
|
||||
uint16_t slot;//0->319
|
||||
|
||||
@@ -1498,7 +1499,7 @@ typedef struct
|
||||
uint16_t sfn;
|
||||
uint16_t slot;
|
||||
uint16_t number_of_pdus;
|
||||
nfapi_nr_rx_data_pdu_t *pdu_list; //changed from pointer to struct - gokul
|
||||
nfapi_nr_rx_data_pdu_t *pdu_list;
|
||||
|
||||
} nfapi_nr_rx_data_indication_t;
|
||||
|
||||
|
||||
+581
-769
File diff suppressed because it is too large
Load Diff
+1637
-1890
File diff suppressed because it is too large
Load Diff
+1820
-2167
File diff suppressed because it is too large
Load Diff
Executable → Regular
+5997
-6855
File diff suppressed because it is too large
Load Diff
@@ -154,10 +154,17 @@ int pnf_p7_send_message(pnf_p7_t* pnf_p7, uint8_t* msg, uint32_t msg_len);
|
||||
|
||||
int pnf_p7_slot_ind(pnf_p7_t* config, uint16_t phy_id, uint16_t sfn, uint16_t slot);
|
||||
int pnf_p7_subframe_ind(pnf_p7_t* config, uint16_t phy_id, uint16_t sfn_sf);
|
||||
|
||||
int nfapi_pnf_p7_nr_slot_ind(nfapi_pnf_p7_config_t* config, nfapi_nr_slot_indication_scf_t* ind);
|
||||
int nfapi_pnf_p7_nr_rx_data_ind(nfapi_pnf_p7_config_t* config, nfapi_nr_rx_data_indication_t* ind);
|
||||
int nfapi_pnf_p7_nr_crc_ind(nfapi_pnf_p7_config_t* config, nfapi_nr_crc_indication_t* ind);
|
||||
int nfapi_pnf_p7_nr_srs_ind(nfapi_pnf_p7_config_t* config, nfapi_nr_srs_indication_t* ind);
|
||||
int nfapi_pnf_p7_nr_uci_ind(nfapi_pnf_p7_config_t* config, nfapi_nr_uci_indication_t* ind);
|
||||
int nfapi_pnf_p7_nr_rach_ind(nfapi_pnf_p7_config_t* config, nfapi_nr_rach_indication_t* ind);
|
||||
pnf_p7_rx_message_t* pnf_p7_rx_reassembly_queue_add_segment(pnf_p7_t* pnf_p7, pnf_p7_rx_reassembly_queue_t* queue, uint32_t rx_hr_time, uint16_t sequence_number, uint16_t segment_number, uint8_t m, uint8_t* data, uint16_t data_len);
|
||||
void pnf_p7_rx_reassembly_queue_remove_msg(pnf_p7_t* pnf_p7, pnf_p7_rx_reassembly_queue_t* queue, pnf_p7_rx_message_t* msg);
|
||||
void pnf_p7_rx_reassembly_queue_remove_old_msgs(pnf_p7_t* pnf_p7, pnf_p7_rx_reassembly_queue_t* queue, uint32_t rx_hr_time, uint32_t delta);
|
||||
|
||||
int pnf_nr_p7_pack_and_send_p7_message(pnf_p7_t* pnf_p7, nfapi_p7_message_header_t* header, uint32_t msg_len);
|
||||
|
||||
#endif /* _PNF_P7_H_ */
|
||||
|
||||
|
||||
@@ -27,6 +27,7 @@ extern "C" {
|
||||
#include <openair2/PHY_INTERFACE/IF_Module.h>
|
||||
#include "nfapi_nr_interface.h"
|
||||
#include "nfapi_nr_interface_scf.h"
|
||||
|
||||
#include <sys/types.h>
|
||||
#include "openair1/PHY/defs_gNB.h"
|
||||
|
||||
|
||||
+105
-159
@@ -156,17 +156,16 @@ nfapi_dl_config_request_t* allocate_nfapi_dl_config_request(pnf_p7_t* pnf_p7)
|
||||
void deallocate_nfapi_dl_tti_request(nfapi_nr_dl_tti_request_t* req, pnf_p7_t* pnf_p7)
|
||||
{
|
||||
//printf("%s() SFN/SF:%d %s req:%p pdu_list:%p\n", __FUNCTION__, NFAPI_SFNSF2DEC(req->sfn_sf), pnf_p7->_public.codec_config.deallocate ? "DEALLOCATE" : "FREE", req, req->dl_config_request_body.dl_config_pdu_list);
|
||||
/*
|
||||
if(pnf_p7->_public.codec_config.deallocate)
|
||||
{
|
||||
//nfapi_nr_dl_tti_request_pdu_t *temp = &req->dl_tti_pdu_list;
|
||||
(pnf_p7->_public.codec_config.deallocate)(req);
|
||||
}
|
||||
else
|
||||
{
|
||||
free(req);
|
||||
}
|
||||
*/
|
||||
|
||||
// if(pnf_p7->_public.codec_config.deallocate)
|
||||
// {
|
||||
// (pnf_p7->_public.codec_config.deallocate)(req);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// free(req);
|
||||
// }
|
||||
|
||||
pnf_p7_free(pnf_p7, req);
|
||||
}
|
||||
|
||||
@@ -915,14 +914,13 @@ void send_dummy_subframe(pnf_p7_t* pnf_p7, uint16_t sfn_sf)
|
||||
|
||||
|
||||
int pnf_p7_slot_ind(pnf_p7_t* pnf_p7, uint16_t phy_id, uint16_t sfn, uint16_t slot)
|
||||
{
|
||||
{
|
||||
//This function is aligned with rx sfn/slot
|
||||
|
||||
// We could either send an event to the p7 thread have have it run the
|
||||
// subframe or we could handle it here and lock access to the subframe
|
||||
// buffers. If we do it on the p7 thread then we run the risk of blocking
|
||||
// on the udp send.
|
||||
//
|
||||
// todo : start a timer to give us more of the 1 ms tick before send back
|
||||
// the frame
|
||||
|
||||
// todo : consider a more efficent lock mechasium
|
||||
//uint16_t NUM_SLOTS = 20;//10* 2^mu
|
||||
@@ -935,21 +933,21 @@ int pnf_p7_slot_ind(pnf_p7_t* pnf_p7, uint16_t phy_id, uint16_t sfn, uint16_t sl
|
||||
|
||||
// save the curren time, sfn and slot
|
||||
pnf_p7->slot_start_time_hr = pnf_get_current_time_hr();
|
||||
pnf_p7->sfn = sfn;
|
||||
|
||||
pnf_p7->slot = slot;
|
||||
|
||||
|
||||
|
||||
slot_ahead = 6;
|
||||
uint32_t sfn_slot_tx = sfnslot_add_slot(sfn, slot, slot_ahead);
|
||||
uint16_t sfn_tx = sfn_slot_tx>>6;
|
||||
uint16_t slot_tx = sfn_slot_tx & 0X3F;
|
||||
uint16_t sfn_tx = NFAPI_SFNSLOT2SFN(sfn_slot_tx);
|
||||
uint8_t slot_tx = NFAPI_SFNSLOT2SLOT(sfn_slot_tx);
|
||||
|
||||
// uint32_t tx_sfn_slot_dec = NFAPI_SFNSLOT2DEC(sfn,slot);
|
||||
uint32_t tx_slot_dec = NFAPI_SFNSLOT2DEC(sfn,slot);
|
||||
//We align the pnf_p7 sfn/slot with tx sfn/slot, and vnf is synced with pnf_p7 sfn/slot. This is so that the scheduler runs slot_ahead from rx thread.
|
||||
|
||||
pnf_p7->sfn = sfn_tx;
|
||||
pnf_p7->slot = slot_tx;
|
||||
|
||||
//uint32_t tx_sfn_slot_dec = NFAPI_SFNSLOT2DEC(sfn_slot_tx);
|
||||
uint32_t rx_slot_dec = NFAPI_SFNSLOT2DEC(sfn, slot);
|
||||
uint8_t buffer_index_rx = rx_slot_dec % 20;
|
||||
|
||||
uint32_t tx_slot_dec = NFAPI_SFNSLOT2DEC(sfn_tx,slot_tx);
|
||||
uint8_t buffer_index_tx = tx_slot_dec % 20;
|
||||
|
||||
// If the subframe_buffer has been configured
|
||||
if(pnf_p7->_public.slot_buffer_size!= 0) // for now value is same as sf_buffer_size
|
||||
@@ -976,28 +974,20 @@ int pnf_p7_slot_ind(pnf_p7_t* pnf_p7, uint16_t phy_id, uint16_t sfn, uint16_t sl
|
||||
pnf_p7->slot_shift = 0;
|
||||
}
|
||||
|
||||
uint32_t slot_dec = NFAPI_SFNSLOT2DEC(sfn, slot);
|
||||
uint8_t buffer_index = slot_dec % pnf_p7->_public.slot_buffer_size;
|
||||
nfapi_pnf_p7_slot_buffer_t* rx_slot_buffer = &(pnf_p7->slot_buffer[buffer_index_rx]);
|
||||
|
||||
nfapi_pnf_p7_slot_buffer_t* slot_buffer = &(pnf_p7->slot_buffer[buffer_index]);
|
||||
// see where the PNF_P7 slot buffer its getting filled
|
||||
nfapi_pnf_p7_slot_buffer_t* tx_slot_buffer = &(pnf_p7->slot_buffer[buffer_index_tx]);
|
||||
|
||||
uint8_t tx_buffer_index = tx_slot_dec % pnf_p7->_public.slot_buffer_size;
|
||||
nfapi_pnf_p7_slot_buffer_t* tx_slot_buffer = &(pnf_p7->slot_buffer[tx_buffer_index]);
|
||||
|
||||
if (0) NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() shift:%d slot_buffer->sfn_sf:%d tx_slot_buffer->sfn_slot:%d sfn_sf:%d subframe_buffer[buffer_index:%u dl_config_req:%p tx_req:%p] "
|
||||
"TX:sfn_sf:%d:tx_buffer_index:%d[dl_config_req:%p tx_req:%p]\n",
|
||||
__FUNCTION__,
|
||||
pnf_p7->slot_shift,
|
||||
NFAPI_SFNSLOT2DEC(slot_buffer->sfn, slot_buffer->slot),
|
||||
NFAPI_SFNSLOT2DEC(tx_slot_buffer->sfn, tx_slot_buffer->slot),
|
||||
slot_dec, buffer_index, slot_buffer->dl_tti_req, slot_buffer->tx_data_req,
|
||||
tx_slot_dec, tx_buffer_index, tx_slot_buffer->dl_tti_req, tx_slot_buffer->tx_data_req);
|
||||
// if (0) NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() shift:%d slot_buffer->sfn_sf:%d tx_slot_buffer->sfn_slot:%d sfn_sf:%d subframe_buffer[buffer_index:%u dl_config_req:%p tx_req:%p] "
|
||||
// "TX:sfn_sf:%d:tx_buffer_index:%d[dl_config_req:%p tx_req:%p]\n",
|
||||
// __FUNCTION__,
|
||||
// pnf_p7->slot_shift,
|
||||
// NFAPI_SFNSLOT2DEC(rx_slot_buffer->sfn, rx_slot_buffer->slot),
|
||||
// NFAPI_SFNSLOT2DEC(tx_slot_buffer->sfn, tx_slot_buffer->slot),
|
||||
// slot_dec, buffer_index_rx, rx_slot_buffer->dl_tti_req, rx_slot_buffer->tx_data_req,
|
||||
// tx_slot_dec, buffer_index_tx, tx_slot_buffer->dl_tti_req, tx_slot_buffer->tx_data_req);
|
||||
//TODO: Change later if required
|
||||
|
||||
|
||||
// if the subframe buffer sfn sf is set then we have atlease 1 message
|
||||
// from the vnf.
|
||||
// todo : how to handle the messages we don't have, send dummies for
|
||||
// now
|
||||
|
||||
@@ -1006,12 +996,16 @@ int pnf_p7_slot_ind(pnf_p7_t* pnf_p7, uint16_t phy_id, uint16_t sfn, uint16_t sl
|
||||
//printf("tx_slot_buff_sfn - %d, tx_slot_buf_slot - %d, sfn_tx = %d, sllot_tx - %d \n",tx_slot_buffer->sfn,tx_slot_buffer->slot,sfn_tx,slot_tx);
|
||||
// if(tx_slot_buffer->slot == slot_tx && tx_slot_buffer->sfn == sfn_tx)
|
||||
// {
|
||||
|
||||
if(tx_slot_buffer->tx_data_req != 0)
|
||||
|
||||
//checking in the tx slot buffers to see if a p7 msg is present. todo: what if it's a mixed slot?
|
||||
|
||||
if(tx_slot_buffer->tx_data_req != 0 && tx_slot_buffer->tx_data_req->SFN == sfn_tx && tx_slot_buffer->tx_data_req->Slot == slot_tx)
|
||||
{
|
||||
|
||||
if(pnf_p7->_public.tx_data_req_fn)
|
||||
{
|
||||
{
|
||||
//NFAPI_TRACE(NFAPI_TRACE_INFO, "Calling tx_data_req_fn in SFN/slot %d.%d \n",sfn,slot);
|
||||
LOG_D(PHY, "Process tx_data SFN/slot %d.%d buffer index: %d \n",sfn_tx,slot_tx,buffer_index_tx);
|
||||
(pnf_p7->_public.tx_data_req_fn)(&(pnf_p7->_public), tx_slot_buffer->tx_data_req);
|
||||
}
|
||||
}
|
||||
@@ -1027,11 +1021,11 @@ int pnf_p7_slot_ind(pnf_p7_t* pnf_p7, uint16_t phy_id, uint16_t sfn, uint16_t sl
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(tx_slot_buffer->dl_tti_req != 0)
|
||||
if(tx_slot_buffer->dl_tti_req != 0 && tx_slot_buffer->dl_tti_req->SFN == sfn_tx && tx_slot_buffer->dl_tti_req->Slot == slot_tx)
|
||||
{
|
||||
if(pnf_p7->_public.dl_tti_req_fn)
|
||||
{
|
||||
LOG_D(PHY, "Process dl_tti SFN/slot %d.%d buffer index: %d \n",sfn_tx,slot_tx,buffer_index_tx);
|
||||
(pnf_p7->_public.dl_tti_req_fn)(NULL, &(pnf_p7->_public), tx_slot_buffer->dl_tti_req);
|
||||
}
|
||||
}
|
||||
@@ -1047,10 +1041,12 @@ int pnf_p7_slot_ind(pnf_p7_t* pnf_p7, uint16_t phy_id, uint16_t sfn, uint16_t sl
|
||||
}
|
||||
|
||||
|
||||
if(tx_slot_buffer->ul_dci_req!= 0)
|
||||
if(tx_slot_buffer->ul_dci_req!= 0 && tx_slot_buffer->ul_dci_req->SFN == sfn_tx && tx_slot_buffer->ul_dci_req->Slot == slot_tx)
|
||||
{
|
||||
if(pnf_p7->_public.ul_dci_req_fn)
|
||||
{
|
||||
//NFAPI_TRACE(NFAPI_TRACE_INFO, "Calling UL_dci_req_fn in SFN/slot %d.%d \n",sfn,slot);
|
||||
LOG_D(PHY, "Process ul_dci SFN/slot %d.%d buffer index: %d \n",sfn_tx,slot_tx,buffer_index_tx);
|
||||
(pnf_p7->_public.ul_dci_req_fn)(NULL, &(pnf_p7->_public), tx_slot_buffer->ul_dci_req);
|
||||
}
|
||||
}
|
||||
@@ -1081,10 +1077,14 @@ int pnf_p7_slot_ind(pnf_p7_t* pnf_p7, uint16_t phy_id, uint16_t sfn, uint16_t sl
|
||||
(pnf_p7->_public.ul_tti_req_fn)(NULL, &(pnf_p7->_public), pnf_p7->_public.dummy_slot.ul_tti_req);
|
||||
}
|
||||
}
|
||||
|
||||
//deallocate slot buffers after passing down the PDUs to PHY processing
|
||||
|
||||
if(tx_slot_buffer->dl_tti_req != 0)
|
||||
{
|
||||
deallocate_nfapi_dl_tti_request(tx_slot_buffer->dl_tti_req, pnf_p7);
|
||||
tx_slot_buffer->dl_tti_req = 0;
|
||||
LOG_D(PHY,"SFN/slot %d.%d Buffer index : %d freed \n",sfn_tx,slot_tx,buffer_index_tx);
|
||||
}
|
||||
|
||||
if(tx_slot_buffer->tx_data_req != 0)
|
||||
@@ -1098,72 +1098,52 @@ int pnf_p7_slot_ind(pnf_p7_t* pnf_p7, uint16_t phy_id, uint16_t sfn, uint16_t sl
|
||||
deallocate_nfapi_ul_dci_request(tx_slot_buffer->ul_dci_req, pnf_p7);
|
||||
tx_slot_buffer->ul_dci_req = 0;
|
||||
}
|
||||
|
||||
|
||||
//checking in the rx slot buffers to see if a p7 msg is present.
|
||||
|
||||
if(rx_slot_buffer->ul_tti_req != 0 && rx_slot_buffer->ul_tti_req->SFN == sfn && rx_slot_buffer->ul_tti_req->Slot == slot)
|
||||
{
|
||||
if(pnf_p7->_public.ul_tti_req_fn)
|
||||
{
|
||||
//NFAPI_TRACE(NFAPI_TRACE_INFO, "Calling UL_tti_req_fn in SFN/slot %d.%d \n",sfn,slot);
|
||||
(pnf_p7->_public.ul_tti_req_fn)(NULL, &(pnf_p7->_public), rx_slot_buffer->ul_tti_req);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// If we ever need to "send" a dummy ul_config this won't work!!!
|
||||
// send_dummy_subframe(pnf_p7, sfn_sf_tx);
|
||||
// send dummy
|
||||
if(pnf_p7->_public.ul_tti_req_fn && pnf_p7->_public.dummy_slot.ul_tti_req)
|
||||
{
|
||||
pnf_p7->_public.dummy_slot.ul_tti_req->SFN = sfn;
|
||||
pnf_p7->_public.dummy_slot.ul_tti_req->Slot = slot;
|
||||
LOG_D(PHY, "Process ul_tti SFN/slot %d.%d buffer index: %d \n",sfn,slot,buffer_index_rx);
|
||||
(pnf_p7->_public.ul_tti_req_fn)(NULL, &(pnf_p7->_public), pnf_p7->_public.dummy_slot.ul_tti_req);
|
||||
}
|
||||
}
|
||||
if(rx_slot_buffer->ul_tti_req != 0)
|
||||
{
|
||||
deallocate_nfapi_ul_tti_request(rx_slot_buffer->ul_tti_req, pnf_p7);
|
||||
rx_slot_buffer->ul_tti_req = 0;
|
||||
|
||||
// send_dummy_slot(pnf_p7, sfn_tx, slot_tx);
|
||||
}
|
||||
|
||||
//reset slot buffer
|
||||
|
||||
|
||||
if(slot_buffer->sfn == sfn && slot_buffer->slot == slot )
|
||||
if ( rx_slot_buffer->dl_tti_req == 0 &&
|
||||
rx_slot_buffer->tx_data_req == 0 &&
|
||||
rx_slot_buffer->ul_tti_req == 0)
|
||||
{
|
||||
|
||||
if(slot_buffer->ul_tti_req != 0)
|
||||
{
|
||||
if(pnf_p7->_public.ul_tti_req_fn)
|
||||
{
|
||||
(pnf_p7->_public.ul_tti_req_fn)(NULL, &(pnf_p7->_public), slot_buffer->ul_tti_req);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// send dummy
|
||||
if(pnf_p7->_public.ul_tti_req_fn && pnf_p7->_public.dummy_slot.ul_tti_req)
|
||||
{
|
||||
pnf_p7->_public.dummy_slot.ul_tti_req->SFN = sfn;
|
||||
pnf_p7->_public.dummy_slot.ul_tti_req->Slot = slot;
|
||||
(pnf_p7->_public.ul_tti_req_fn)(NULL, &(pnf_p7->_public), pnf_p7->_public.dummy_slot.ul_tti_req);
|
||||
}
|
||||
}
|
||||
//if(subframe_buffer->dl_config_req != 0)
|
||||
//deallocate_nfapi_dl_config_request(subframe_buffer->dl_config_req, pnf_p7);
|
||||
//if(subframe_buffer->tx_req != 0)
|
||||
//deallocate_nfapi_tx_request(subframe_buffer->tx_req, pnf_p7);
|
||||
if(slot_buffer->ul_tti_req != 0)
|
||||
{
|
||||
deallocate_nfapi_ul_tti_request(slot_buffer->ul_tti_req, pnf_p7);
|
||||
slot_buffer->ul_tti_req = 0;
|
||||
|
||||
}
|
||||
#if 0
|
||||
if(slot_buffer->lbt_dl_config_req != 0)
|
||||
{
|
||||
deallocate_nfapi_lbt_dl_config_request(slot_buffer->lbt_dl_config_req, pnf_p7);
|
||||
slot_buffer->lbt_dl_config_req = 0;
|
||||
}
|
||||
#endif
|
||||
} // sfn_slot match
|
||||
|
||||
|
||||
if ( slot_buffer->dl_tti_req == 0 &&
|
||||
slot_buffer->tx_data_req == 0 &&
|
||||
slot_buffer->ul_tti_req == 0)
|
||||
//slot_buffer->lbt_dl_config_req == 0 &&
|
||||
//slot_buffer->ue_release_req == 0)
|
||||
{
|
||||
memset(&(pnf_p7->slot_buffer[buffer_index]), 0, sizeof(nfapi_pnf_p7_slot_buffer_t));
|
||||
pnf_p7->slot_buffer[buffer_index].sfn = -1;
|
||||
pnf_p7->slot_buffer[buffer_index].slot = -1;
|
||||
memset(&(pnf_p7->slot_buffer[buffer_index_rx]), 0, sizeof(nfapi_pnf_p7_slot_buffer_t));
|
||||
pnf_p7->slot_buffer[buffer_index_rx].sfn = -1;
|
||||
pnf_p7->slot_buffer[buffer_index_rx].slot = -1;
|
||||
}
|
||||
|
||||
//printf("pnf_p7->_public.timing_info_mode_periodic:%d pnf_p7->timing_info_period_counter:%d pnf_p7->_public.timing_info_period:%d\n", pnf_p7->_public.timing_info_mode_periodic, pnf_p7->timing_info_period_counter, pnf_p7->_public.timing_info_period);
|
||||
//printf("pnf_p7->_public.timing_info_mode_aperiodic:%d pnf_p7->timing_info_aperiodic_send:%d\n", pnf_p7->_public.timing_info_mode_aperiodic, pnf_p7->timing_info_aperiodic_send);
|
||||
//printf("pnf_p7->timing_info_ms_counter:%d\n", pnf_p7->timing_info_ms_counter);
|
||||
|
||||
// send the periodic timing info if configured
|
||||
//send the periodic timing info if configured
|
||||
if(pnf_p7->_public.timing_info_mode_periodic && (pnf_p7->timing_info_period_counter++) == pnf_p7->_public.timing_info_period)
|
||||
{
|
||||
pnf_nr_pack_and_send_timing_info(pnf_p7);
|
||||
@@ -1182,26 +1162,6 @@ int pnf_p7_slot_ind(pnf_p7_t* pnf_p7, uint16_t phy_id, uint16_t sfn, uint16_t sl
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
//send_dummy_subframe(pnf_p7, sfn_sf_tx);
|
||||
}
|
||||
|
||||
|
||||
//printf("pnf_p7->tick:%d\n", pnf_p7->tick);
|
||||
// if(pnf_p7->tick == 1000) // why?
|
||||
// {
|
||||
// // TODO: change stats to nr_stats
|
||||
// NFAPI_TRACE(NFAPI_TRACE_INFO, "[PNF P7:%d] (ONTIME/LATE) DL:(%d/%d) UL:(%d/%d) HI:(%d/%d) TX:(%d/%d)\n", pnf_p7->_public.phy_id,
|
||||
// pnf_p7->stats.dl_conf_ontime, pnf_p7->stats.dl_conf_late,
|
||||
// pnf_p7->stats.ul_conf_ontime, pnf_p7->stats.ul_conf_late,
|
||||
// pnf_p7->stats.hi_dci0_ontime, pnf_p7->stats.hi_dci0_late,
|
||||
// pnf_p7->stats.tx_ontime, pnf_p7->stats.tx_late);
|
||||
// pnf_p7->tick = 0;
|
||||
// memset(&pnf_p7->stats, 0, sizeof(pnf_p7->stats));
|
||||
// }
|
||||
// pnf_p7->tick++;
|
||||
|
||||
|
||||
if(pthread_mutex_unlock(&(pnf_p7->mutex)) != 0)
|
||||
{
|
||||
@@ -1561,11 +1521,11 @@ uint8_t is_nr_p7_request_in_window(uint16_t sfn,uint16_t slot, const char* name,
|
||||
// }
|
||||
if(current_sfn_slot_dec <= recv_sfn_slot_dec + timing_window){
|
||||
in_window = 1;
|
||||
NFAPI_TRACE(NFAPI_TRACE_NOTE, "[%d] %s is in window %d\n", current_sfn_slot_dec, name, recv_sfn_slot_dec);
|
||||
//NFAPI_TRACE(NFAPI_TRACE_NOTE, "[%d] %s is in window %d\n", current_sfn_slot_dec, name, recv_sfn_slot_dec);
|
||||
}
|
||||
else if(current_sfn_slot_dec + NFAPI_MAX_SFNSLOTDEC <= recv_sfn_slot_dec + timing_window){ //checking for wrap
|
||||
in_window = 1;
|
||||
NFAPI_TRACE(NFAPI_TRACE_NOTE, "[%d] %s is in window %d\n", current_sfn_slot_dec, name, recv_sfn_slot_dec);
|
||||
//NFAPI_TRACE(NFAPI_TRACE_NOTE, "[%d] %s is in window %d\n", current_sfn_slot_dec, name, recv_sfn_slot_dec);
|
||||
}
|
||||
|
||||
else
|
||||
@@ -1654,34 +1614,18 @@ void pnf_handle_dl_tti_request(void* pRecvMsg, int recvMsgLen, pnf_p7_t* pnf_p7)
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "failed to lock mutex\n");
|
||||
return;
|
||||
}
|
||||
#if 0
|
||||
if (
|
||||
0 &&
|
||||
(NFAPI_SFNSF2DEC(req->sfn_sf) % 100 ==0 ||
|
||||
NFAPI_SFNSF2DEC(req->sfn_sf) % 105 ==0
|
||||
)
|
||||
)
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "DL_CONFIG.req sfn_sf:%d pdcch:%u dci:%u pdu:%u pdsch_rnti:%u pcfich:%u\n",
|
||||
NFAPI_SFNSF2DEC(req->sfn_sf),
|
||||
req->dl_config_request_body.number_pdcch_ofdm_symbols,
|
||||
req->dl_config_request_body.number_dci,
|
||||
req->dl_config_request_body.number_pdu,
|
||||
req->dl_config_request_body.number_pdsch_rnti,
|
||||
req->dl_config_request_body.transmission_power_pcfich
|
||||
);
|
||||
#endif
|
||||
|
||||
if(is_nr_p7_request_in_window(req->SFN,req->Slot, "dl_tti_request", pnf_p7))
|
||||
{
|
||||
uint32_t sfn_slot_dec = NFAPI_SFNSLOT2DEC(req->SFN,req->Slot);
|
||||
uint8_t buffer_index = sfn_slot_dec % pnf_p7->_public.slot_buffer_size;
|
||||
if(is_nr_p7_request_in_window(req->SFN,req->Slot, "dl_tti_request", pnf_p7))
|
||||
{
|
||||
uint32_t sfn_slot_dec = NFAPI_SFNSLOT2DEC(req->SFN,req->Slot);
|
||||
uint8_t buffer_index = sfn_slot_dec % 20;
|
||||
|
||||
struct timespec t;
|
||||
clock_gettime(CLOCK_MONOTONIC, &t);
|
||||
struct timespec t;
|
||||
clock_gettime(CLOCK_MONOTONIC, &t);
|
||||
|
||||
//NFAPI_TRACE(NFAPI_TRACE_INFO,"%s() %ld.%09ld POPULATE DL_TTI_REQ sfn_slot:%d buffer_index:%d\n", __FUNCTION__, t.tv_sec, t.tv_nsec, sfn_slot_dec, buffer_index);
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO,"%s() %ld.%09ld POPULATE DL_TTI_REQ current tx sfn/slot:%d.%d p7 msg sfn/slot: %d.%d buffer_index:%d\n", __FUNCTION__, t.tv_sec, t.tv_nsec, pnf_p7->sfn,pnf_p7->slot, req->SFN, req->Slot, buffer_index);
|
||||
|
||||
// if there is already an dl_config_req make sure we free it.
|
||||
// if there is already an dl_tti_req make sure we free it.
|
||||
if(pnf_p7->slot_buffer[buffer_index].dl_tti_req != 0)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_NOTE, "%s() is_nr_p7_request_in_window()=TRUE buffer_index occupied - free it first sfn_slot:%d buffer_index:%d\n", __FUNCTION__, NFAPI_SFNSLOT2DEC(req->SFN,req->Slot), buffer_index);
|
||||
@@ -1691,7 +1635,7 @@ void pnf_handle_dl_tti_request(void* pRecvMsg, int recvMsgLen, pnf_p7_t* pnf_p7)
|
||||
deallocate_nfapi_dl_tti_request(pnf_p7->slot_buffer[buffer_index].dl_tti_req, pnf_p7);
|
||||
}
|
||||
|
||||
// saving dl_config_request in subframe buffer
|
||||
// filling dl_tti_request in slot buffer
|
||||
pnf_p7->slot_buffer[buffer_index].sfn = req->SFN;
|
||||
pnf_p7->slot_buffer[buffer_index].slot = req->Slot;
|
||||
pnf_p7->slot_buffer[buffer_index].dl_tti_req = req;
|
||||
@@ -1840,12 +1784,12 @@ void pnf_handle_ul_tti_request(void* pRecvMsg, int recvMsgLen, pnf_p7_t* pnf_p7)
|
||||
if(is_nr_p7_request_in_window(req->SFN,req->Slot, "ul_tti_request", pnf_p7))
|
||||
{
|
||||
uint32_t sfn_slot_dec = NFAPI_SFNSLOT2DEC(req->SFN,req->Slot);
|
||||
uint8_t buffer_index = sfn_slot_dec % pnf_p7->_public.slot_buffer_size;
|
||||
uint8_t buffer_index = (sfn_slot_dec % 20);
|
||||
|
||||
struct timespec t;
|
||||
clock_gettime(CLOCK_MONOTONIC, &t);
|
||||
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO,"%s() %ld.%09ld POPULATE UL_TTI_REQ sfn_slot:%d buffer_index:%d\n", __FUNCTION__, t.tv_sec, t.tv_nsec, sfn_slot_dec, buffer_index);
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO,"%s() %ld.%09ld POPULATE UL_TTI_REQ current tx sfn/slot:%d.%d p7 msg sfn/slot: %d.%d buffer_index:%d\n", __FUNCTION__, t.tv_sec, t.tv_nsec, pnf_p7->sfn,pnf_p7->slot, req->SFN, req->Slot, buffer_index);
|
||||
|
||||
if(pnf_p7->slot_buffer[buffer_index].ul_tti_req != 0)
|
||||
{
|
||||
@@ -1855,6 +1799,8 @@ void pnf_handle_ul_tti_request(void* pRecvMsg, int recvMsgLen, pnf_p7_t* pnf_p7)
|
||||
|
||||
deallocate_nfapi_ul_tti_request(pnf_p7->slot_buffer[buffer_index].ul_tti_req, pnf_p7);
|
||||
}
|
||||
|
||||
//filling slot buffer
|
||||
|
||||
pnf_p7->slot_buffer[buffer_index].sfn = req->SFN;
|
||||
pnf_p7->slot_buffer[buffer_index].slot = req->Slot;
|
||||
@@ -1986,7 +1932,7 @@ void pnf_handle_ul_dci_request(void* pRecvMsg, int recvMsgLen, pnf_p7_t* pnf_p7)
|
||||
if(is_nr_p7_request_in_window(req->SFN,req->Slot,"ul_dci_request", pnf_p7))
|
||||
{
|
||||
uint32_t sfn_slot_dec = NFAPI_SFNSLOT2DEC(req->SFN,req->Slot);
|
||||
uint8_t buffer_index = sfn_slot_dec % pnf_p7->_public.slot_buffer_size;
|
||||
uint8_t buffer_index = sfn_slot_dec % 20;
|
||||
|
||||
if(pnf_p7->slot_buffer[buffer_index].ul_dci_req!= 0)
|
||||
{
|
||||
@@ -2125,12 +2071,12 @@ void pnf_handle_tx_data_request(void* pRecvMsg, int recvMsgLen, pnf_p7_t* pnf_p7
|
||||
if(is_nr_p7_request_in_window(req->SFN, req->Slot,"tx_request", pnf_p7))
|
||||
{
|
||||
uint32_t sfn_slot_dec = NFAPI_SFNSLOT2DEC(req->SFN,req->Slot);
|
||||
uint8_t buffer_index = sfn_slot_dec % pnf_p7->_public.slot_buffer_size;
|
||||
uint8_t buffer_index = sfn_slot_dec % 20;
|
||||
|
||||
struct timespec t;
|
||||
clock_gettime(CLOCK_MONOTONIC, &t);
|
||||
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO,"%s() %ld.%09ld POPULATE TX_DATA_REQ sfn_sf:%d buffer_index:%d\n", __FUNCTION__, t.tv_sec, t.tv_nsec, sfn_slot_dec, buffer_index);
|
||||
//NFAPI_TRACE(NFAPI_TRACE_INFO,"%s() %ld.%09ld POPULATE TX_DATA_REQ sfn_sf:%d buffer_index:%d\n", __FUNCTION__, t.tv_sec, t.tv_nsec, sfn_slot_dec, buffer_index);
|
||||
#if 0
|
||||
if (0 && NFAPI_SFNSF2DEC(req->sfn_sf)%100==0) NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() TX_REQ.req sfn_sf:%d pdus:%d - TX_REQ is within window\n",
|
||||
__FUNCTION__,
|
||||
@@ -2692,9 +2638,7 @@ void pnf_nr_dispatch_p7_message(void *pRecvMsg, int recvMsgLen, pnf_p7_t* pnf_p7
|
||||
case NFAPI_NR_PHY_MSG_TYPE_DL_NODE_SYNC:
|
||||
pnf_nr_handle_dl_node_sync(pRecvMsg, recvMsgLen, pnf_p7, rx_hr_time);
|
||||
break;
|
||||
|
||||
case NFAPI_NR_PHY_MSG_TYPE_DL_TTI_REQUEST:
|
||||
//printf("\nEntering pnf_handle_dl_tti_request sfn=%d,slot=%d \n",pnf_p7->sfn,pnf_p7->slot);
|
||||
pnf_handle_dl_tti_request(pRecvMsg, recvMsgLen, pnf_p7);
|
||||
break;
|
||||
case NFAPI_NR_PHY_MSG_TYPE_UL_TTI_REQUEST:
|
||||
@@ -3324,7 +3268,7 @@ int pnf_nr_p7_message_pump(pnf_p7_t* pnf_p7)
|
||||
timeout.tv_sec = 0;
|
||||
timeout.tv_nsec = 500000;
|
||||
|
||||
struct timespec slot_duration;
|
||||
struct timespec slot_duration;
|
||||
slot_duration.tv_sec = 0;
|
||||
slot_duration.tv_nsec = 0.5e6;
|
||||
|
||||
@@ -3339,7 +3283,9 @@ int pnf_nr_p7_message_pump(pnf_p7_t* pnf_p7)
|
||||
FD_ZERO(&rfds);
|
||||
FD_SET(pnf_p7->p7_sock, &rfds);
|
||||
|
||||
clock_gettime(CLOCK_MONOTONIC, &pselect_start);
|
||||
struct timespec timeout;
|
||||
timeout.tv_sec = 100;
|
||||
timeout.tv_nsec = 0;
|
||||
|
||||
//setting the timeout
|
||||
|
||||
|
||||
@@ -251,6 +251,18 @@ int nfapi_pnf_ue_release_resp(nfapi_pnf_p7_config_t* config, nfapi_ue_release_re
|
||||
|
||||
//NR UPLINK INDICATION
|
||||
|
||||
int nfapi_pnf_p7_nr_slot_ind(nfapi_pnf_p7_config_t* config, nfapi_nr_slot_indication_scf_t* ind)
|
||||
{
|
||||
if(config == NULL || ind == NULL)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: invalid input params\n", __FUNCTION__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
pnf_p7_t* _this = (pnf_p7_t*)(config);
|
||||
return pnf_nr_p7_pack_and_send_p7_message(_this, (nfapi_p7_message_header_t*)ind, sizeof(nfapi_nr_rx_data_indication_t));
|
||||
}
|
||||
|
||||
int nfapi_pnf_p7_nr_rx_data_ind(nfapi_pnf_p7_config_t* config, nfapi_nr_rx_data_indication_t* ind)
|
||||
{
|
||||
if(config == NULL || ind == NULL)
|
||||
|
||||
@@ -278,7 +278,7 @@ void *fapi_thread_start(void *ptr) {
|
||||
|
||||
if(instance->tick == 1000) {
|
||||
if(instance->tx_byte_count > 0) {
|
||||
printf("[FAPI] Tx rate %u bytes/sec\n", instance->tx_byte_count);
|
||||
printf("[FAPI] Tx rate %d 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 %u %u\n", last_millisec, millisec);
|
||||
printf("*** missing millisec %d %d\n", last_millisec, millisec);
|
||||
catchup = millisec - last_millisec - 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -25,7 +25,6 @@
|
||||
#define TIME2TIMEHR(_time) (((uint32_t)(_time.tv_sec) & 0xFFF) << 20 | ((uint32_t)(_time.tv_usec) & 0xFFFFF))
|
||||
|
||||
|
||||
|
||||
typedef struct {
|
||||
uint8_t* buffer;
|
||||
uint16_t length;
|
||||
|
||||
@@ -897,8 +897,12 @@ typedef struct nfapi_vnf_p7_config
|
||||
* 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 (*nrach_indication)(struct nfapi_vnf_p7_config* config, nfapi_nrach_indication_t* ind);
|
||||
*/
|
||||
int (*nrach_indication)(struct nfapi_vnf_p7_config* config, nfapi_nrach_indication_t* ind);
|
||||
|
||||
//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_srs_indication)(nfapi_nr_srs_indication_t* ind);
|
||||
|
||||
/*! A callback for any vendor extension messages
|
||||
* \param config A pointer to the vnf p7 configuration
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#include <errno.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include "vnf_p7.h"
|
||||
|
||||
#ifdef NDEBUG
|
||||
@@ -462,7 +463,7 @@ int send_mac_subframe_indications(vnf_p7_t* vnf_p7)
|
||||
int vnf_send_p7_msg(vnf_p7_t* vnf_p7, nfapi_vnf_p7_connection_info_t* p7_info, uint8_t* msg, const uint32_t len)
|
||||
{
|
||||
int sendto_result = sendto(vnf_p7->socket, msg, len, 0, (struct sockaddr*)&(p7_info->remote_addr), sizeof(p7_info->remote_addr));
|
||||
//printf("\nSending p7 message sfn=%d,slot=%d\n",vnf_p7->p7_connections->sfn,vnf_p7->p7_connections->slot);
|
||||
//printf("P7 msg sent \n");
|
||||
if(sendto_result != len)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() sendto_result %d %d\n", __FUNCTION__, sendto_result, errno);
|
||||
@@ -539,6 +540,7 @@ int vnf_nr_p7_pack_and_send_p7_msg(vnf_p7_t* vnf_p7, nfapi_p7_message_header_t*
|
||||
nfapi_p7_update_transmit_timestamp(buffer, calculate_transmit_timestamp(p7_connection->sfn, p7_connection->slot, vnf_p7->slot_start_time_hr));
|
||||
|
||||
send_result = vnf_send_p7_msg(vnf_p7, p7_connection, &tx_buffer[0], segment_size);
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -555,7 +557,6 @@ int vnf_nr_p7_pack_and_send_p7_msg(vnf_p7_t* vnf_p7, nfapi_p7_message_header_t*
|
||||
}
|
||||
|
||||
p7_connection->sequence_number++;
|
||||
|
||||
return send_result;
|
||||
}
|
||||
else
|
||||
@@ -673,7 +674,6 @@ int vnf_build_send_dl_node_sync(vnf_p7_t* vnf_p7, nfapi_vnf_p7_connection_info_t
|
||||
|
||||
int vnf_nr_build_send_dl_node_sync(vnf_p7_t* vnf_p7, nfapi_vnf_p7_connection_info_t* p7_info)
|
||||
{
|
||||
|
||||
nfapi_nr_dl_node_sync_t dl_node_sync;
|
||||
memset(&dl_node_sync, 0, sizeof(dl_node_sync));
|
||||
|
||||
@@ -1291,7 +1291,7 @@ void vnf_handle_ul_node_sync(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_p7)
|
||||
{
|
||||
if(phy->in_sync == 0)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_NOTE, "VNF P7 In Sync with phy (phy_id:%d)\n", phy->phy_id);
|
||||
//NFAPI_TRACE(NFAPI_TRACE_NOTE, "VNF P7 In Sync with phy (phy_id:%d)\n", phy->phy_id);
|
||||
|
||||
if(vnf_p7->_public.sync_indication)
|
||||
(vnf_p7->_public.sync_indication)(&(vnf_p7->_public), phy->in_sync);
|
||||
@@ -1456,7 +1456,31 @@ void vnf_handle_ul_node_sync(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_p7)
|
||||
}
|
||||
|
||||
//NR HANDLES FOR UPLINK MESSAGES
|
||||
void vnf_handle_nr_slot_indication(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_p7)
|
||||
{
|
||||
// ensure it's valid
|
||||
if (pRecvMsg == NULL || vnf_p7 == NULL)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: NULL parameters\n", __FUNCTION__);
|
||||
}
|
||||
else
|
||||
{
|
||||
nfapi_nr_slot_indication_scf_t ind;
|
||||
|
||||
if(nfapi_nr_p7_message_unpack(pRecvMsg, recvMsgLen, &ind, sizeof(ind), &vnf_p7->_public.codec_config) < 0)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Failed to unpack message\n", __FUNCTION__);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(vnf_p7->_public.nr_slot_indication)
|
||||
{
|
||||
(vnf_p7->_public.nr_slot_indication)(&ind);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
void vnf_handle_nr_rx_data_indication(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_p7)
|
||||
{
|
||||
// ensure it's valid
|
||||
@@ -1524,7 +1548,13 @@ void vnf_handle_nr_srs_indication(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s: Failed to unpack message\n", __FUNCTION__);
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
if(vnf_p7->_public.nr_srs_indication)
|
||||
{
|
||||
(vnf_p7->_public.nr_srs_indication)(&ind);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1612,6 +1642,8 @@ void vnf_nr_handle_ul_node_sync(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_p7
|
||||
// divide by 2 using shift operator
|
||||
uint32_t latency = (tx_2_rx - pnf_proc_time) >> 1;
|
||||
|
||||
//phy->in_sync = 1;
|
||||
|
||||
if(!(phy->filtered_adjust))
|
||||
{
|
||||
phy->latency[phy->min_sync_cycle_count] = latency;
|
||||
@@ -1661,17 +1693,24 @@ void vnf_nr_handle_ul_node_sync(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_p7
|
||||
struct timespec ts;
|
||||
clock_gettime(CLOCK_MONOTONIC, &ts);
|
||||
|
||||
//NFAPI_TRACE(NFAPI_TRACE_NOTE, "(%4d/%1d) %d.%d PNF to VNF phy_id:%2d (t1/2/3/4:%8u, %8u, %8u, %8u) txrx:%4u procT:%3u latency(us):%4d(avg:%4d) offset(us):%8d filtered(us):%8d wrap[t1:%u t2:%u]\n",
|
||||
// phy->sfn, phy->slot, ts.tv_sec, ts.tv_nsec, ind.header.phy_id,
|
||||
// ind.t1, ind.t2, ind.t3, t4,
|
||||
// tx_2_rx, pnf_proc_time, latency, phy->average_latency, phy->slot_offset, phy->slot_offset_filtered,
|
||||
// (ind.t1<phy->previous_t1), (ind.t2<phy->previous_t2));
|
||||
// NFAPI_TRACE(NFAPI_TRACE_NOTE, "(%4d/%1d) %d.%d PNF to VNF phy_id:%2d (t1/2/3/4:%8u, %8u, %8u, %8u) txrx:%4u procT:%3u latency(us):%4d(avg:%4d) offset(us):%8d filtered(us):%8d wrap[t1:%u t2:%u]\n",
|
||||
// phy->sfn, phy->slot, ts.tv_sec, ts.tv_nsec, ind.header.phy_id,
|
||||
// ind.t1, ind.t2, ind.t3, t4,
|
||||
// tx_2_rx, pnf_proc_time, latency, phy->average_latency, phy->slot_offset, phy->slot_offset_filtered,
|
||||
// (ind.t1<phy->previous_t1), (ind.t2<phy->previous_t2));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
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;
|
||||
@@ -1703,7 +1742,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) );
|
||||
|
||||
|
||||
}
|
||||
@@ -2165,7 +2204,11 @@ void vnf_nr_dispatch_p7_message(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_p7
|
||||
case NFAPI_TIMING_INFO:
|
||||
vnf_nr_handle_timing_info(pRecvMsg, recvMsgLen, vnf_p7);
|
||||
break;
|
||||
|
||||
|
||||
case NFAPI_NR_PHY_MSG_TYPE_SLOT_INDICATION:
|
||||
vnf_handle_nr_slot_indication(pRecvMsg, recvMsgLen, vnf_p7);
|
||||
break;
|
||||
|
||||
case NFAPI_NR_PHY_MSG_TYPE_RX_DATA_INDICATION:
|
||||
vnf_handle_nr_rx_data_indication(pRecvMsg, recvMsgLen, vnf_p7);
|
||||
break;
|
||||
@@ -2178,13 +2221,13 @@ void vnf_nr_dispatch_p7_message(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_p7
|
||||
vnf_handle_nr_uci_indication(pRecvMsg, recvMsgLen, vnf_p7);
|
||||
break;
|
||||
|
||||
case NFAPI_NR_PHY_MSG_TYPE_RACH_INDICATION:
|
||||
vnf_handle_nr_rach_indication(pRecvMsg, recvMsgLen, vnf_p7);
|
||||
break;
|
||||
|
||||
case NFAPI_NR_PHY_MSG_TYPE_SRS_INDICATION:
|
||||
vnf_handle_nr_srs_indication(pRecvMsg, recvMsgLen, vnf_p7);
|
||||
break;
|
||||
|
||||
case NFAPI_NR_PHY_MSG_TYPE_RACH_INDICATION:
|
||||
vnf_handle_nr_rach_indication(pRecvMsg, recvMsgLen, vnf_p7);
|
||||
break;
|
||||
|
||||
case NFAPI_UE_RELEASE_RESPONSE:
|
||||
vnf_handle_ue_release_resp(pRecvMsg, recvMsgLen, vnf_p7);
|
||||
|
||||
@@ -25,9 +25,14 @@
|
||||
#include <errno.h>
|
||||
|
||||
#include "vnf_p7.h"
|
||||
#include "nfapi_vnf.h"
|
||||
|
||||
#include "common/ran_context.h"
|
||||
|
||||
#include "openair1/PHY/defs_gNB.h"
|
||||
#define FAPI2_IP_DSCP 0
|
||||
|
||||
extern RAN_CONTEXT_t RC;
|
||||
|
||||
nfapi_vnf_p7_config_t* nfapi_vnf_p7_config_create()
|
||||
{
|
||||
@@ -92,7 +97,9 @@ struct timespec timespec_sub(struct timespec lhs, struct timespec rhs)
|
||||
// monitor the p7 endpoints and the timing loop and
|
||||
// send indications to mac
|
||||
int nfapi_nr_vnf_p7_start(nfapi_vnf_p7_config_t* config)
|
||||
{
|
||||
{
|
||||
struct PHY_VARS_gNB_s *gNB = RC.gNB[0];
|
||||
uint8_t prev_slot = 0;
|
||||
if(config == 0)
|
||||
return -1;
|
||||
|
||||
@@ -145,40 +152,14 @@ int nfapi_nr_vnf_p7_start(nfapi_vnf_p7_config_t* config)
|
||||
|
||||
//struct timespec original_pselect_timeout;
|
||||
struct timespec pselect_timeout;
|
||||
pselect_timeout.tv_sec = 0;
|
||||
pselect_timeout.tv_nsec = 500000; // ns in a 0.5 ms
|
||||
//pselect_timeout.tv_nsec = 500000;
|
||||
|
||||
struct timespec pselect_start;
|
||||
struct timespec pselect_stop;
|
||||
|
||||
//struct timespec sf_end;
|
||||
|
||||
long last_millisecond = -1;
|
||||
|
||||
|
||||
// struct timespec sf_duration; //Change to slot_duration?
|
||||
// sf_duration.tv_sec = 0;
|
||||
// sf_duration.tv_nsec = 0.5e6; // We want 1ms pause //We want 0.5 ms pause for NR
|
||||
struct timespec slot_duration;
|
||||
slot_duration.tv_sec = 0;
|
||||
//slot_duration.tv_nsec = 0.5e6;
|
||||
slot_duration.tv_nsec = 0.5e6;
|
||||
|
||||
|
||||
// struct timespec sf_start; //Change to slot_start?
|
||||
struct timespec slot_start;
|
||||
// clock_gettime(CLOCK_MONOTONIC, &sf_start);
|
||||
clock_gettime(CLOCK_MONOTONIC, &slot_start);
|
||||
long millisecond = slot_start.tv_nsec / 0.5e6; //Check if we have to change
|
||||
//long millisecond = slot_start.tv_nsec / 0.5e6;
|
||||
// sf_start = timespec_add(sf_start, sf_duration);
|
||||
slot_start = timespec_add(slot_start, slot_duration);
|
||||
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "next slot will start at %ld.%ld\n", slot_start.tv_sec, slot_start.tv_nsec);
|
||||
pselect_timeout.tv_sec = 100;
|
||||
pselect_timeout.tv_nsec = 0;
|
||||
|
||||
struct timespec ref_time;
|
||||
clock_gettime(CLOCK_MONOTONIC, &ref_time);
|
||||
uint8_t setup_time;
|
||||
while(vnf_p7->terminate == 0)
|
||||
{
|
||||
{
|
||||
fd_set rfds;
|
||||
int maxSock = 0;
|
||||
FD_ZERO(&rfds);
|
||||
@@ -187,240 +168,34 @@ int nfapi_nr_vnf_p7_start(nfapi_vnf_p7_config_t* config)
|
||||
// Add the p7 socket
|
||||
FD_SET(vnf_p7->socket, &rfds);
|
||||
maxSock = vnf_p7->socket;
|
||||
|
||||
struct timespec curr_time;
|
||||
clock_gettime(CLOCK_MONOTONIC, &curr_time);
|
||||
setup_time = curr_time.tv_sec - ref_time.tv_sec;
|
||||
|
||||
clock_gettime(CLOCK_MONOTONIC, &pselect_start);
|
||||
//long millisecond = pselect_start.tv_nsec / 1e6;
|
||||
if(setup_time > 10 && prev_slot != gNB->UL_INFO.slot){ //Give the VNF sufficient time to setup before starting scheduling
|
||||
|
||||
if((last_millisecond == -1) || (millisecond == last_millisecond) || (millisecond == (last_millisecond + 1) % 1000) )
|
||||
{
|
||||
//NFAPI_TRACE(NFAPI_TRACE_INFO, "pselect_start:%d.%d sf_start:%d.%d\n", pselect_start.tv_sec, pselect_start.tv_nsec, sf_start.tv_sec, sf_start.tv_nsec);
|
||||
|
||||
|
||||
//if((pselect_start.tv_sec > sf_start.tv_sec) ||
|
||||
// ((pselect_start.tv_sec == sf_start.tv_sec) && (pselect_start.tv_nsec > sf_start.tv_nsec)))
|
||||
if((pselect_start.tv_sec > slot_start.tv_sec) || ((pselect_start.tv_sec == slot_start.tv_sec) && (pselect_start.tv_nsec > slot_start.tv_nsec)))
|
||||
{
|
||||
// overran the end of the subframe we do not want to wait
|
||||
pselect_timeout.tv_sec = 0;
|
||||
pselect_timeout.tv_nsec = 0;
|
||||
|
||||
//struct timespec overrun = timespec_sub(pselect_start, sf_start);
|
||||
//NFAPI_TRACE(NFAPI_TRACE_INFO, "Subframe overrun detected of %d.%d running to catchup\n", overrun.tv_sec, overrun.tv_nsec);
|
||||
}
|
||||
else
|
||||
{
|
||||
// still time before the end of the subframe wait
|
||||
//pselect_timeout = timespec_sub(sf_start, pselect_start);
|
||||
pselect_timeout = timespec_sub(slot_start, pselect_start);
|
||||
}
|
||||
|
||||
//original_pselect_timeout = pselect_timeout;
|
||||
|
||||
// detemine how long to sleep in ns before the start of the next 1ms
|
||||
//pselect_timeout.tv_nsec = 1e6 - (pselect_start.tv_nsec % 1000000);
|
||||
|
||||
//uint8_t underrun_possible =0;
|
||||
|
||||
// if we are not sleeping until the next milisecond due to the
|
||||
// insycn minor adjment flag it so we don't consider it an error
|
||||
//uint8_t underrun_possible =0;
|
||||
/*
|
||||
{
|
||||
nfapi_vnf_p7_connection_info_t* phy = vnf_p7->p7_connections;
|
||||
if(phy && phy->in_sync && phy->insync_minor_adjustment != 0 && phy->insync_minor_adjustment_duration > 0 && pselect_start.tv_nsec != 0)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_NOTE, "[VNF] Subframe minor adjustment %d (%d->%d)\n", phy->insync_minor_adjustment,
|
||||
pselect_timeout.tv_nsec, pselect_timeout.tv_nsec - (phy->insync_minor_adjustment * 1000))
|
||||
if(phy->insync_minor_adjustment > 0)
|
||||
{
|
||||
// todo check we don't go below 0
|
||||
if((phy->insync_minor_adjustment * 1000) > pselect_timeout.tv_nsec)
|
||||
pselect_timeout.tv_nsec = 0;
|
||||
else
|
||||
pselect_timeout.tv_nsec = pselect_timeout.tv_nsec - (phy->insync_minor_adjustment * 1000);
|
||||
|
||||
|
||||
//underrun_possible = 1;
|
||||
}
|
||||
else if(phy->insync_minor_adjustment < 0)
|
||||
{
|
||||
// todo check we don't go below 0
|
||||
pselect_timeout.tv_nsec = pselect_timeout.tv_nsec - (phy->insync_minor_adjustment * 1000);
|
||||
|
||||
|
||||
//phy->insync_minor_adjustment = 0;
|
||||
phy->insync_minor_adjustment_duration--;
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
//long wraps = pselect_timeout.tv_nsec % 1e9;
|
||||
|
||||
|
||||
selectRetval = pselect(maxSock+1, &rfds, NULL, NULL, &pselect_timeout, NULL);
|
||||
// selectRetval = pselect(120, &rfds, NULL, NULL, &pselect_timeout, NULL);
|
||||
|
||||
clock_gettime(CLOCK_MONOTONIC, &pselect_stop);
|
||||
|
||||
nfapi_vnf_p7_connection_info_t* phy = vnf_p7->p7_connections;
|
||||
|
||||
if (selectRetval==-1 && errno == 22)
|
||||
{
|
||||
// NFAPI_TRACE(NFAPI_TRACE_ERROR, "INVAL: pselect_timeout:%d.%ld adj[dur:%d adj:%d], sf_dur:%d.%ld\n",
|
||||
// pselect_timeout.tv_sec, pselect_timeout.tv_nsec,
|
||||
// phy->insync_minor_adjustment_duration, phy->insync_minor_adjustment,
|
||||
// sf_duration.tv_sec, sf_duration.tv_nsec);
|
||||
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "INVAL: pselect_timeout:%ld.%ld adj[dur:%d adj:%d], sf_dur:%ld.%ld\n",
|
||||
pselect_timeout.tv_sec, pselect_timeout.tv_nsec,
|
||||
phy->insync_minor_adjustment_duration, phy->insync_minor_adjustment,
|
||||
slot_duration.tv_sec, slot_duration.tv_nsec);
|
||||
|
||||
}
|
||||
if(selectRetval == 0)
|
||||
{
|
||||
// calculate the start of the next slot
|
||||
//sf_start = timespec_add(sf_start, sf_duration);
|
||||
slot_start = timespec_add(slot_start, slot_duration);
|
||||
//NFAPI_TRACE(NFAPI_TRACE_INFO, "next subframe will start at %d.%d\n", sf_start.tv_sec, sf_start.tv_nsec);
|
||||
|
||||
if(phy && phy->in_sync && phy->insync_minor_adjustment != 0 && phy->insync_minor_adjustment_duration > 0)
|
||||
{
|
||||
long insync_minor_adjustment_ns = (phy->insync_minor_adjustment * 1000);
|
||||
|
||||
//sf_start.tv_nsec -= insync_minor_adjustment_ns;
|
||||
slot_start.tv_nsec -= insync_minor_adjustment_ns;
|
||||
|
||||
#if 1
|
||||
/* if (sf_start.tv_nsec > 1e9) //Change to 0.5e6?
|
||||
{
|
||||
sf_start.tv_sec++;
|
||||
sf_start.tv_nsec-=1e9;
|
||||
}
|
||||
else if (sf_start.tv_nsec < 0)
|
||||
{
|
||||
sf_start.tv_sec--;
|
||||
sf_start.tv_nsec+=1e9;
|
||||
}*/
|
||||
if (slot_start.tv_nsec > 1e9)
|
||||
{
|
||||
slot_start.tv_sec++;
|
||||
slot_start.tv_nsec-=1e9;
|
||||
}
|
||||
else if (slot_start.tv_nsec < 0)
|
||||
{
|
||||
slot_start.tv_sec--;
|
||||
slot_start.tv_nsec+=1e9;
|
||||
}
|
||||
#else
|
||||
//NFAPI_TRACE(NFAPI_TRACE_NOTE, "[VNF] BEFORE adjustment - Subframe minor adjustment %dus sf_start.tv_nsec:%d\n", phy->insync_minor_adjustment, sf_start.tv_nsec);
|
||||
if(phy->insync_minor_adjustment > 0)
|
||||
{
|
||||
// decrease the subframe duration a little
|
||||
if (sf_start.tv_nsec > insync_minor_adjustment_ns)
|
||||
sf_start.tv_nsec -= insync_minor_adjustment_ns;
|
||||
else
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "[VNF] Adjustment would make it negative sf:%d.%ld adjust:%ld\n\n\n", sf_start.tv_sec, sf_start.tv_nsec, insync_minor_adjustment_ns);
|
||||
sf_start.tv_sec--;
|
||||
sf_start.tv_nsec += 1e9 - insync_minor_adjustment_ns;
|
||||
}
|
||||
}
|
||||
else if(phy->insync_minor_adjustment < 0)
|
||||
{
|
||||
// todo check we don't go below 0
|
||||
// increase the subframe duration a little
|
||||
sf_start.tv_nsec += insync_minor_adjustment_ns;
|
||||
|
||||
if (sf_start.tv_nsec < 0)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "[VNF] OVERFLOW %d.%ld\n\n\n\n", sf_start.tv_sec, sf_start.tv_nsec);
|
||||
sf_start.tv_sec++;
|
||||
sf_start.tv_nsec += 1e9;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
//phy->insync_minor_adjustment = 0;
|
||||
phy->insync_minor_adjustment_duration--;
|
||||
|
||||
// NFAPI_TRACE(NFAPI_TRACE_NOTE, "[VNF] AFTER adjustment - Subframe minor adjustment %dus sf_start.tv_nsec:%d duration:%u\n",
|
||||
// phy->insync_minor_adjustment, sf_start.tv_nsec, phy->insync_minor_adjustment_duration);
|
||||
// NFAPI_TRACE(NFAPI_TRACE_NOTE, "[VNF] AFTER adjustment - Slot minor adjustment %dus slot_start.tv_nsec:%d duration:%u\n",
|
||||
// phy->insync_minor_adjustment, slot_start.tv_nsec, phy->insync_minor_adjustment_duration);
|
||||
|
||||
if (phy->insync_minor_adjustment_duration==0)
|
||||
{
|
||||
phy->insync_minor_adjustment = 0;
|
||||
}
|
||||
}
|
||||
/*
|
||||
long pselect_stop_millisecond = pselect_stop.tv_nsec / 1e6;
|
||||
if(millisecond == pselect_stop_millisecond)
|
||||
{
|
||||
// we have woke up in the same subframe
|
||||
if(underrun_possible == 0)
|
||||
NFAPI_TRACE(NFAPI_TRACE_WARN, "subframe pselect underrun %ld (%d.%d)\n", millisecond, pselect_stop.tv_sec, pselect_stop.tv_nsec);
|
||||
}
|
||||
else if(((millisecond + 1) % 1000) != pselect_stop_millisecond)
|
||||
{
|
||||
// we have overrun the subframe
|
||||
NFAPI_TRACE(NFAPI_TRACE_WARN, "subframe pselect overrun %ld %ld\n", millisecond, pselect_stop_millisecond);
|
||||
NFAPI_TRACE(NFAPI_TRACE_WARN, "subframe underrun %ld\n", millisecond);
|
||||
}
|
||||
last_millisecond = millisecond;
|
||||
*/
|
||||
|
||||
//millisecond ++;
|
||||
millisecond = millisecond + 1;
|
||||
|
||||
}
|
||||
//Call the scheduler
|
||||
pthread_mutex_lock(&gNB->UL_INFO_mutex);
|
||||
gNB->UL_INFO.module_id = gNB->Mod_id;
|
||||
gNB->UL_INFO.CC_id = gNB->CC_id;
|
||||
gNB->if_inst->NR_UL_indication(&gNB->UL_INFO);
|
||||
pthread_mutex_unlock(&gNB->UL_INFO_mutex);
|
||||
prev_slot = gNB->UL_INFO.slot;
|
||||
}
|
||||
else
|
||||
{
|
||||
// we have overrun the subframe advance to go and collect $200
|
||||
|
||||
if((millisecond - last_millisecond) > 3)
|
||||
NFAPI_TRACE(NFAPI_TRACE_WARN, "subframe overrun %ld %ld (%ld)\n", millisecond, last_millisecond, millisecond - last_millisecond + 1);
|
||||
|
||||
last_millisecond = ( last_millisecond + 1 ) % 1000;
|
||||
selectRetval = 0;
|
||||
}
|
||||
selectRetval = pselect(maxSock+1, &rfds, NULL, NULL, &pselect_timeout, NULL);
|
||||
|
||||
if(selectRetval == 0)
|
||||
{
|
||||
//vnf_p7->sf_start_time_hr = vnf_get_current_time_hr();
|
||||
vnf_p7->slot_start_time_hr = vnf_get_current_time_hr();
|
||||
struct timespec current_time;
|
||||
clock_gettime(CLOCK_MONOTONIC, ¤t_time);
|
||||
// pselect timed out
|
||||
nfapi_vnf_p7_connection_info_t* curr = vnf_p7->p7_connections;
|
||||
while(curr != 0)
|
||||
{
|
||||
if (curr->slot == 19)
|
||||
{ //curr->slot = 0;
|
||||
if(curr->sfn == 1023)
|
||||
curr->sfn=0;
|
||||
else
|
||||
curr->sfn++;
|
||||
curr->slot=0;
|
||||
}
|
||||
else
|
||||
{
|
||||
curr->slot++;
|
||||
}
|
||||
vnf_nr_sync(vnf_p7, curr);
|
||||
curr = curr->next;
|
||||
}
|
||||
send_mac_slot_indications(vnf_p7);
|
||||
// pselect timed out, continue
|
||||
}
|
||||
else if(selectRetval > 0)
|
||||
{
|
||||
// have a p7 message
|
||||
if(FD_ISSET(vnf_p7->socket, &rfds))
|
||||
{
|
||||
vnf_nr_p7_read_dispatch_message(vnf_p7);
|
||||
{
|
||||
vnf_nr_p7_read_dispatch_message(vnf_p7);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -432,7 +207,7 @@ struct timespec current_time;
|
||||
}
|
||||
else
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "P7 select failed result %d errno %d timeout:%ld.%ld orginal:%ld.%ld last_ms:%ld ms:%ld\n", selectRetval, errno, pselect_timeout.tv_sec, pselect_timeout.tv_nsec, pselect_timeout.tv_sec, pselect_timeout.tv_nsec, last_millisecond, millisecond);
|
||||
//NFAPI_TRACE(NFAPI_TRACE_INFO, "P7 select failed result %d errno %d timeout:%d.%d orginal:%d.%d last_ms:%ld ms:%ld\n", selectRetval, errno, pselect_timeout.tv_sec, pselect_timeout.tv_nsec, pselect_timeout.tv_sec, pselect_timeout.tv_nsec, last_millisecond, millisecond);
|
||||
// should we exit now?
|
||||
if (selectRetval == -1 && errno == 22) // invalid argument??? not sure about timeout duration
|
||||
{
|
||||
@@ -440,10 +215,7 @@ struct timespec current_time;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "Closing p7 socket\n");
|
||||
close(vnf_p7->socket);
|
||||
|
||||
@@ -860,7 +632,6 @@ int nfapi_vnf_p7_ul_tti_req(nfapi_vnf_p7_config_t* config, nfapi_nr_ul_tti_reque
|
||||
{
|
||||
if(config == 0 || req == 0)
|
||||
return -1;
|
||||
|
||||
vnf_p7_t* vnf_p7 = (vnf_p7_t*)config;
|
||||
return vnf_nr_p7_pack_and_send_p7_msg(vnf_p7, &req->header);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user