diff --git a/nfapi/open-nFAPI/fapi/inc/nr_fapi_p5.h b/nfapi/open-nFAPI/fapi/inc/nr_fapi_p5.h index 983fe153026135c1108262ff4e5ae028535faacb..fb84cb0689c9499160ca8e4a9e6827176325a9a9 100644 --- a/nfapi/open-nFAPI/fapi/inc/nr_fapi_p5.h +++ b/nfapi/open-nFAPI/fapi/inc/nr_fapi_p5.h @@ -36,4 +36,6 @@ uint8_t pack_nr_param_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t *config); uint8_t unpack_nr_param_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p4_p5_codec_config_t *config); +uint8_t pack_nr_param_response(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t *config); +uint8_t unpack_nr_param_response(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p4_p5_codec_config_t *config); #endif // OPENAIRINTERFACE_NR_FAPI_P5_H diff --git a/nfapi/open-nFAPI/fapi/src/nr_fapi_p5.c b/nfapi/open-nFAPI/fapi/src/nr_fapi_p5.c index 776c6d700e3900974d1100d4214f282c750c5ac1..fec25a57a312cccbd43ea666d1094ff771cd823a 100644 --- a/nfapi/open-nFAPI/fapi/src/nr_fapi_p5.c +++ b/nfapi/open-nFAPI/fapi/src/nr_fapi_p5.c @@ -337,3 +337,516 @@ uint8_t unpack_nr_param_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *m nfapi_nr_param_request_scf_t *pNfapiMsg = (nfapi_nr_param_request_scf_t *)msg; return unpack_nr_tlv_list(NULL, 0, ppReadPackedMsg, end, config, &(pNfapiMsg->vendor_extension)); } + +uint8_t pack_nr_param_response(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t *config) +{ + printf("\nRUNNING pack_param_response\n"); + nfapi_nr_param_response_scf_t *pNfapiMsg = (nfapi_nr_param_response_scf_t *)msg; + uint8_t retval = push8(pNfapiMsg->error_code, ppWritePackedMsg, end) && push8(pNfapiMsg->num_tlv, ppWritePackedMsg, end); + retval &= pack_nr_tlv(NFAPI_NR_PARAM_TLV_RELEASE_CAPABILITY_TAG, + &(pNfapiMsg->cell_param.release_capability), + ppWritePackedMsg, + end, + &pack_uint16_tlv_value) + && pack_nr_tlv(NFAPI_NR_PARAM_TLV_PHY_STATE_TAG, + &(pNfapiMsg->cell_param.phy_state), + ppWritePackedMsg, + end, + &pack_uint16_tlv_value) + && pack_nr_tlv(NFAPI_NR_PARAM_TLV_SKIP_BLANK_DL_CONFIG_TAG, + &(pNfapiMsg->cell_param.skip_blank_dl_config), + ppWritePackedMsg, + end, + &pack_uint8_tlv_value) + && pack_nr_tlv(NFAPI_NR_PARAM_TLV_SKIP_BLANK_UL_CONFIG_TAG, + &(pNfapiMsg->cell_param.skip_blank_ul_config), + ppWritePackedMsg, + end, + &pack_uint8_tlv_value) + && pack_nr_tlv(NFAPI_NR_PARAM_TLV_NUM_CONFIG_TLVS_TO_REPORT_TAG, + &(pNfapiMsg->cell_param.num_config_tlvs_to_report), + ppWritePackedMsg, + end, + &pack_uint16_tlv_value); + + for (int i = 0; i < pNfapiMsg->cell_param.num_config_tlvs_to_report.value; ++i) { + /*retval &= pack_nr_tlv(pNfapiMsg->cell_param.config_tlvs_to_report_list[i].tl.tag, + &(pNfapiMsg->cell_param.config_tlvs_to_report_list[i]), + ppWritePackedMsg, + end, + &pack_uint8_tlv_value);*/ + retval &= push16(pNfapiMsg->cell_param.config_tlvs_to_report_list[i].tl.tag, ppWritePackedMsg, end); + retval &= push8(pNfapiMsg->cell_param.config_tlvs_to_report_list[i].tl.length, ppWritePackedMsg, end); + retval &= push8(pNfapiMsg->cell_param.config_tlvs_to_report_list[i].value, ppWritePackedMsg, end); + // Add padding that ensures multiple of 4 bytes (SCF 225 Section 2.3.2.1) + int padding = get_tlv_padding(pNfapiMsg->cell_param.config_tlvs_to_report_list[i].tl.length); + NFAPI_TRACE(NFAPI_TRACE_DEBUG, + "TLV 0x%x with padding of %d bytes\n", + pNfapiMsg->cell_param.config_tlvs_to_report_list[i].tl.tag, + padding); + if (padding != 0) { + memset(*ppWritePackedMsg, 0, padding); + (*ppWritePackedMsg) += padding; + } + } + + retval &= pack_nr_tlv(NFAPI_NR_PARAM_TLV_CYCLIC_PREFIX_TAG, + &(pNfapiMsg->carrier_param.cyclic_prefix), + ppWritePackedMsg, + end, + &pack_uint8_tlv_value) + && pack_nr_tlv(NFAPI_NR_PARAM_TLV_SUPPORTED_SUBCARRIER_SPACINGS_DL_TAG, + &(pNfapiMsg->carrier_param.supported_subcarrier_spacings_dl), + ppWritePackedMsg, + end, + &pack_uint16_tlv_value) + && pack_nr_tlv(NFAPI_NR_PARAM_TLV_SUPPORTED_BANDWIDTH_DL_TAG, + &(pNfapiMsg->carrier_param.supported_bandwidth_dl), + ppWritePackedMsg, + end, + &pack_uint16_tlv_value) + && pack_nr_tlv(NFAPI_NR_PARAM_TLV_SUPPORTED_SUBCARRIER_SPACINGS_UL_TAG, + &(pNfapiMsg->carrier_param.supported_subcarrier_spacings_ul), + ppWritePackedMsg, + end, + &pack_uint8_tlv_value) + && pack_nr_tlv(NFAPI_NR_PARAM_TLV_SUPPORTED_BANDWIDTH_UL_TAG, + &(pNfapiMsg->carrier_param.supported_bandwidth_ul), + ppWritePackedMsg, + end, + &pack_uint16_tlv_value) + && pack_nr_tlv(NFAPI_NR_PARAM_TLV_CCE_MAPPING_TYPE_TAG, + &(pNfapiMsg->pdcch_param.cce_mapping_type), + ppWritePackedMsg, + end, + &pack_uint8_tlv_value) + && pack_nr_tlv(NFAPI_NR_PARAM_TLV_CORESET_OUTSIDE_FIRST_3_OFDM_SYMS_OF_SLOT_TAG, + &(pNfapiMsg->pdcch_param.coreset_outside_first_3_of_ofdm_syms_of_slot), + ppWritePackedMsg, + end, + &pack_uint8_tlv_value) + && pack_nr_tlv(NFAPI_NR_PARAM_TLV_PRECODER_GRANULARITY_CORESET_TAG, + &(pNfapiMsg->pdcch_param.coreset_precoder_granularity_coreset), + ppWritePackedMsg, + end, + &pack_uint8_tlv_value) + && pack_nr_tlv(NFAPI_NR_PARAM_TLV_PDCCH_MU_MIMO_TAG, + &(pNfapiMsg->pdcch_param.pdcch_mu_mimo), + ppWritePackedMsg, + end, + &pack_uint8_tlv_value) + && pack_nr_tlv(NFAPI_NR_PARAM_TLV_PDCCH_PRECODER_CYCLING_TAG, + &(pNfapiMsg->pdcch_param.pdcch_precoder_cycling), + ppWritePackedMsg, + end, + &pack_uint8_tlv_value) + && pack_nr_tlv(NFAPI_NR_PARAM_TLV_MAX_PDCCHS_PER_SLOT_TAG, + &(pNfapiMsg->pdcch_param.max_pdcch_per_slot), + ppWritePackedMsg, + end, + &pack_uint8_tlv_value) + && pack_nr_tlv(NFAPI_NR_PARAM_TLV_PUCCH_FORMATS_TAG, + &(pNfapiMsg->pucch_param.pucch_formats), + ppWritePackedMsg, + end, + &pack_uint8_tlv_value) + && pack_nr_tlv(NFAPI_NR_PARAM_TLV_MAX_PUCCHS_PER_SLOT_TAG, + &(pNfapiMsg->pucch_param.max_pucchs_per_slot), + ppWritePackedMsg, + end, + &pack_uint8_tlv_value) + && pack_nr_tlv(NFAPI_NR_PARAM_TLV_PDSCH_MAPPING_TYPE_TAG, + &(pNfapiMsg->pdsch_param.pdsch_mapping_type), + ppWritePackedMsg, + end, + &pack_uint8_tlv_value) + && pack_nr_tlv(NFAPI_NR_PARAM_TLV_PDSCH_ALLOCATION_TYPES_TAG, + &(pNfapiMsg->pdsch_param.pdsch_allocation_types), + ppWritePackedMsg, + end, + &pack_uint8_tlv_value) + && pack_nr_tlv(NFAPI_NR_PARAM_TLV_PDSCH_VRB_TO_PRB_MAPPING_TAG, + &(pNfapiMsg->pdsch_param.pdsch_vrb_to_prb_mapping), + ppWritePackedMsg, + end, + &pack_uint8_tlv_value) + && pack_nr_tlv(NFAPI_NR_PARAM_TLV_PDSCH_CBG_TAG, + &(pNfapiMsg->pdsch_param.pdsch_cbg), + ppWritePackedMsg, + end, + &pack_uint8_tlv_value) + && pack_nr_tlv(NFAPI_NR_PARAM_TLV_PDSCH_DMRS_CONFIG_TYPES_TAG, + &(pNfapiMsg->pdsch_param.pdsch_dmrs_config_types), + ppWritePackedMsg, + end, + &pack_uint8_tlv_value) + && pack_nr_tlv(NFAPI_NR_PARAM_TLV_PDSCH_DMRS_MAX_LENGTH_TAG, + &(pNfapiMsg->pdsch_param.pdsch_dmrs_max_length), + ppWritePackedMsg, + end, + &pack_uint8_tlv_value) + && pack_nr_tlv(NFAPI_NR_PARAM_TLV_PDSCH_DMRS_ADDITIONAL_POS_TAG, + &(pNfapiMsg->pdsch_param.pdsch_dmrs_additional_pos), + ppWritePackedMsg, + end, + &pack_uint8_tlv_value) + && pack_nr_tlv(NFAPI_NR_PARAM_TLV_MAX_PDSCH_S_TBS_PER_SLOT_TAG, + &(pNfapiMsg->pdsch_param.max_pdsch_tbs_per_slot), + ppWritePackedMsg, + end, + &pack_uint8_tlv_value) + && pack_nr_tlv(NFAPI_NR_PARAM_TLV_MAX_NUMBER_MIMO_LAYERS_PDSCH_TAG, + &(pNfapiMsg->pdsch_param.max_number_mimo_layers_pdsch), + ppWritePackedMsg, + end, + &pack_uint8_tlv_value) + && pack_nr_tlv(NFAPI_NR_PARAM_TLV_SUPPORTED_MAX_MODULATION_ORDER_DL_TAG, + &(pNfapiMsg->pdsch_param.supported_max_modulation_order_dl), + ppWritePackedMsg, + end, + &pack_uint8_tlv_value) + && pack_nr_tlv(NFAPI_NR_PARAM_TLV_MAX_MU_MIMO_USERS_DL_TAG, + &(pNfapiMsg->pdsch_param.max_mu_mimo_users_dl), + ppWritePackedMsg, + end, + &pack_uint8_tlv_value) + && pack_nr_tlv(NFAPI_NR_PARAM_TLV_PDSCH_DATA_IN_DMRS_SYMBOLS_TAG, + &(pNfapiMsg->pdsch_param.pdsch_data_in_dmrs_symbols), + ppWritePackedMsg, + end, + &pack_uint8_tlv_value) + && pack_nr_tlv(NFAPI_NR_PARAM_TLV_PREMPTION_SUPPORT_TAG, + &(pNfapiMsg->pdsch_param.premption_support), + ppWritePackedMsg, + end, + &pack_uint8_tlv_value) + && pack_nr_tlv(NFAPI_NR_PARAM_TLV_PDSCH_NON_SLOT_SUPPORT_TAG, + &(pNfapiMsg->pdsch_param.pdsch_non_slot_support), + ppWritePackedMsg, + end, + &pack_uint8_tlv_value) + && pack_nr_tlv(NFAPI_NR_PARAM_TLV_UCI_MUX_ULSCH_IN_PUSCH_TAG, + &(pNfapiMsg->pusch_param.uci_mux_ulsch_in_pusch), + ppWritePackedMsg, + end, + &pack_uint8_tlv_value) + && pack_nr_tlv(NFAPI_NR_PARAM_TLV_UCI_ONLY_PUSCH_TAG, + &(pNfapiMsg->pusch_param.uci_only_pusch), + ppWritePackedMsg, + end, + &pack_uint8_tlv_value) + && pack_nr_tlv(NFAPI_NR_PARAM_TLV_PUSCH_FREQUENCY_HOPPING_TAG, + &(pNfapiMsg->pusch_param.pusch_frequency_hopping), + ppWritePackedMsg, + end, + &pack_uint8_tlv_value) + && pack_nr_tlv(NFAPI_NR_PARAM_TLV_PUSCH_DMRS_CONFIG_TYPES_TAG, + &(pNfapiMsg->pusch_param.pusch_dmrs_config_types), + ppWritePackedMsg, + end, + &pack_uint8_tlv_value) + && pack_nr_tlv(NFAPI_NR_PARAM_TLV_PUSCH_DMRS_MAX_LEN_TAG, + &(pNfapiMsg->pusch_param.pusch_dmrs_max_len), + ppWritePackedMsg, + end, + &pack_uint8_tlv_value) + && pack_nr_tlv(NFAPI_NR_PARAM_TLV_PUSCH_DMRS_ADDITIONAL_POS_TAG, + &(pNfapiMsg->pusch_param.pusch_dmrs_additional_pos), + ppWritePackedMsg, + end, + &pack_uint8_tlv_value) + && pack_nr_tlv(NFAPI_NR_PARAM_TLV_PUSCH_CBG_TAG, + &(pNfapiMsg->pusch_param.pusch_cbg), + ppWritePackedMsg, + end, + &pack_uint8_tlv_value) + && pack_nr_tlv(NFAPI_NR_PARAM_TLV_PUSCH_MAPPING_TYPE_TAG, + &(pNfapiMsg->pusch_param.pusch_mapping_type), + ppWritePackedMsg, + end, + &pack_uint8_tlv_value) + && pack_nr_tlv(NFAPI_NR_PARAM_TLV_PUSCH_ALLOCATION_TYPES_TAG, + &(pNfapiMsg->pusch_param.pusch_allocation_types), + ppWritePackedMsg, + end, + &pack_uint8_tlv_value) + && pack_nr_tlv(NFAPI_NR_PARAM_TLV_PUSCH_VRB_TO_PRB_MAPPING_TAG, + &(pNfapiMsg->pusch_param.pusch_vrb_to_prb_mapping), + ppWritePackedMsg, + end, + &pack_uint8_tlv_value) + && pack_nr_tlv(NFAPI_NR_PARAM_TLV_PUSCH_MAX_PTRS_PORTS_TAG, + &(pNfapiMsg->pusch_param.pusch_max_ptrs_ports), + ppWritePackedMsg, + end, + &pack_uint8_tlv_value) + && pack_nr_tlv(NFAPI_NR_PARAM_TLV_MAX_PDUSCHS_TBS_PER_SLOT_TAG, + &(pNfapiMsg->pusch_param.max_pduschs_tbs_per_slot), + ppWritePackedMsg, + end, + &pack_uint8_tlv_value) + && pack_nr_tlv(NFAPI_NR_PARAM_TLV_MAX_NUMBER_MIMO_LAYERS_NON_CB_PUSCH_TAG, + &(pNfapiMsg->pusch_param.max_number_mimo_layers_non_cb_pusch), + ppWritePackedMsg, + end, + &pack_uint8_tlv_value) + && pack_nr_tlv(NFAPI_NR_PARAM_TLV_SUPPORTED_MODULATION_ORDER_UL_TAG, + &(pNfapiMsg->pusch_param.supported_modulation_order_ul), + ppWritePackedMsg, + end, + &pack_uint8_tlv_value) + && pack_nr_tlv(NFAPI_NR_PARAM_TLV_MAX_MU_MIMO_USERS_UL_TAG, + &(pNfapiMsg->pusch_param.max_mu_mimo_users_ul), + ppWritePackedMsg, + end, + &pack_uint8_tlv_value) + && pack_nr_tlv(NFAPI_NR_PARAM_TLV_DFTS_OFDM_SUPPORT_TAG, + &(pNfapiMsg->pusch_param.dfts_ofdm_support), + ppWritePackedMsg, + end, + &pack_uint8_tlv_value) + && pack_nr_tlv(NFAPI_NR_PARAM_TLV_PUSCH_AGGREGATION_FACTOR_TAG, + &(pNfapiMsg->pusch_param.pusch_aggregation_factor), + ppWritePackedMsg, + end, + &pack_uint8_tlv_value) + && pack_nr_tlv(NFAPI_NR_PARAM_TLV_PRACH_LONG_FORMATS_TAG, + &(pNfapiMsg->prach_param.prach_long_formats), + ppWritePackedMsg, + end, + &pack_uint8_tlv_value) + && pack_nr_tlv(NFAPI_NR_PARAM_TLV_PRACH_SHORT_FORMATS_TAG, + &(pNfapiMsg->prach_param.prach_short_formats), + ppWritePackedMsg, + end, + &pack_uint16_tlv_value) + && pack_nr_tlv(NFAPI_NR_PARAM_TLV_PRACH_RESTRICTED_SETS_TAG, + &(pNfapiMsg->prach_param.prach_restricted_sets), + ppWritePackedMsg, + end, + &pack_uint8_tlv_value) + && pack_nr_tlv(NFAPI_NR_PARAM_TLV_MAX_PRACH_FD_OCCASIONS_IN_A_SLOT_TAG, + &(pNfapiMsg->prach_param.max_prach_fd_occasions_in_a_slot), + ppWritePackedMsg, + end, + &pack_uint8_tlv_value) + && pack_nr_tlv(NFAPI_NR_PARAM_TLV_RSSI_MEASUREMENT_SUPPORT_TAG, + &(pNfapiMsg->measurement_param.rssi_measurement_support), + ppWritePackedMsg, + end, + &pack_uint8_tlv_value) + && + // config: + pack_nr_tlv(NFAPI_NR_NFAPI_P7_VNF_ADDRESS_IPV4_TAG, + &(pNfapiMsg->nfapi_config.p7_vnf_address_ipv4), + ppWritePackedMsg, + end, + &pack_ipv4_address_value) + && pack_nr_tlv(NFAPI_NR_NFAPI_P7_VNF_ADDRESS_IPV6_TAG, + &(pNfapiMsg->nfapi_config.p7_vnf_address_ipv6), + ppWritePackedMsg, + end, + &pack_ipv6_address_value) + && pack_nr_tlv(NFAPI_NR_NFAPI_P7_VNF_PORT_TAG, + &(pNfapiMsg->nfapi_config.p7_vnf_port), + ppWritePackedMsg, + end, + &pack_uint16_tlv_value) + && pack_nr_tlv(NFAPI_NR_NFAPI_P7_PNF_ADDRESS_IPV4_TAG, + &(pNfapiMsg->nfapi_config.p7_pnf_address_ipv4), + ppWritePackedMsg, + end, + &pack_ipv4_address_value) + && pack_nr_tlv(NFAPI_NR_NFAPI_P7_PNF_ADDRESS_IPV6_TAG, + &(pNfapiMsg->nfapi_config.p7_pnf_address_ipv6), + ppWritePackedMsg, + end, + &pack_ipv6_address_value) + && pack_nr_tlv(NFAPI_NR_NFAPI_P7_PNF_PORT_TAG, + &(pNfapiMsg->nfapi_config.p7_pnf_port), + ppWritePackedMsg, + end, + &pack_uint16_tlv_value) + && pack_nr_tlv(NFAPI_NR_NFAPI_TIMING_WINDOW_TAG, + &(pNfapiMsg->nfapi_config.timing_window), + ppWritePackedMsg, + end, + &pack_uint8_tlv_value) + && pack_nr_tlv(NFAPI_NR_NFAPI_TIMING_INFO_MODE_TAG, + &(pNfapiMsg->nfapi_config.timing_info_mode), + ppWritePackedMsg, + end, + &pack_uint8_tlv_value) + && pack_nr_tlv(NFAPI_NR_NFAPI_TIMING_INFO_PERIOD_TAG, + &(pNfapiMsg->nfapi_config.timing_info_period), + ppWritePackedMsg, + end, + &pack_uint8_tlv_value) + && pack_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config); + return retval; +} + +static uint8_t unpack_config_tlvs_to_report(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + uint8_t *pStartOfValue = *ppReadPackedMsg; + nfapi_nr_cell_param_t *cellParamTable = (nfapi_nr_cell_param_t *)tlv; + uint8_t retval = pull16(ppReadPackedMsg, &cellParamTable->num_config_tlvs_to_report.value, end); + + // check if the length was right; + if (cellParamTable->num_config_tlvs_to_report.tl.length != (*ppReadPackedMsg - pStartOfValue)) { + NFAPI_TRACE(NFAPI_TRACE_ERROR, + "Warning tlv tag 0x%x length %d not equal to unpack %ld\n", + cellParamTable->num_config_tlvs_to_report.tl.tag, + cellParamTable->num_config_tlvs_to_report.tl.length, + (*ppReadPackedMsg - pStartOfValue)); + } + // Remove padding that ensures multiple of 4 bytes (SCF 225 Section 2.3.2.1) + int padding = get_tlv_padding(cellParamTable->num_config_tlvs_to_report.tl.length); + if (padding != 0) { + (*ppReadPackedMsg) += padding; + } + + // after this value, get the tlv list + cellParamTable->config_tlvs_to_report_list = calloc(cellParamTable->num_config_tlvs_to_report.value, sizeof(nfapi_uint8_tlv_t *)); + + for (int i = 0; i < cellParamTable->num_config_tlvs_to_report.value; ++i) { + pull16(ppReadPackedMsg, &cellParamTable->config_tlvs_to_report_list[i].tl.tag, end); + pull8(ppReadPackedMsg, (uint8_t *)&cellParamTable->config_tlvs_to_report_list[i].tl.length, end); + pull8(ppReadPackedMsg, &cellParamTable->config_tlvs_to_report_list[i].value, end); + // Remove padding that ensures multiple of 4 bytes (SCF 225 Section 2.3.2.1) + padding = get_tlv_padding(cellParamTable->config_tlvs_to_report_list[i].tl.length); + if (padding != 0) { + (*ppReadPackedMsg) += padding; + } + } + return retval; +} + +uint8_t unpack_nr_param_response(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p4_p5_codec_config_t *config) +{ + nfapi_nr_param_response_scf_t *pNfapiMsg = (nfapi_nr_param_response_scf_t *)msg; + unpack_tlv_t unpack_fns[] = { + {NFAPI_NR_PARAM_TLV_RELEASE_CAPABILITY_TAG, &(pNfapiMsg->cell_param.release_capability), &unpack_uint16_tlv_value}, + {NFAPI_NR_PARAM_TLV_PHY_STATE_TAG, &(pNfapiMsg->cell_param.phy_state), &unpack_uint16_tlv_value}, + {NFAPI_NR_PARAM_TLV_SKIP_BLANK_DL_CONFIG_TAG, &(pNfapiMsg->cell_param.skip_blank_dl_config), &unpack_uint8_tlv_value}, + {NFAPI_NR_PARAM_TLV_SKIP_BLANK_UL_CONFIG_TAG, &(pNfapiMsg->cell_param.skip_blank_ul_config), &unpack_uint8_tlv_value}, + {NFAPI_NR_PARAM_TLV_NUM_CONFIG_TLVS_TO_REPORT_TAG, &(pNfapiMsg->cell_param), &unpack_config_tlvs_to_report}, + + {NFAPI_NR_PARAM_TLV_CYCLIC_PREFIX_TAG, &(pNfapiMsg->carrier_param.cyclic_prefix), &unpack_uint8_tlv_value}, + {NFAPI_NR_PARAM_TLV_SUPPORTED_SUBCARRIER_SPACINGS_DL_TAG, + &(pNfapiMsg->carrier_param.supported_subcarrier_spacings_dl), + &unpack_uint16_tlv_value}, + {NFAPI_NR_PARAM_TLV_SUPPORTED_BANDWIDTH_DL_TAG, &(pNfapiMsg->carrier_param.supported_bandwidth_dl), &unpack_uint16_tlv_value}, + {NFAPI_NR_PARAM_TLV_SUPPORTED_SUBCARRIER_SPACINGS_UL_TAG, + &(pNfapiMsg->carrier_param.supported_subcarrier_spacings_ul), + &unpack_uint8_tlv_value}, + {NFAPI_NR_PARAM_TLV_SUPPORTED_BANDWIDTH_UL_TAG, &(pNfapiMsg->carrier_param.supported_bandwidth_ul), &unpack_uint16_tlv_value}, + + {NFAPI_NR_PARAM_TLV_CCE_MAPPING_TYPE_TAG, &(pNfapiMsg->pdcch_param.cce_mapping_type), &unpack_uint8_tlv_value}, + {NFAPI_NR_PARAM_TLV_CORESET_OUTSIDE_FIRST_3_OFDM_SYMS_OF_SLOT_TAG, + &(pNfapiMsg->pdcch_param.coreset_outside_first_3_of_ofdm_syms_of_slot), + &unpack_uint8_tlv_value}, + {NFAPI_NR_PARAM_TLV_PRECODER_GRANULARITY_CORESET_TAG, + &(pNfapiMsg->pdcch_param.coreset_precoder_granularity_coreset), + &unpack_uint8_tlv_value}, + {NFAPI_NR_PARAM_TLV_PDCCH_MU_MIMO_TAG, &(pNfapiMsg->pdcch_param.pdcch_mu_mimo), &unpack_uint8_tlv_value}, + {NFAPI_NR_PARAM_TLV_PDCCH_PRECODER_CYCLING_TAG, &(pNfapiMsg->pdcch_param.pdcch_precoder_cycling), &unpack_uint8_tlv_value}, + {NFAPI_NR_PARAM_TLV_MAX_PDCCHS_PER_SLOT_TAG, &(pNfapiMsg->pdcch_param.max_pdcch_per_slot), &unpack_uint8_tlv_value}, + + {NFAPI_NR_PARAM_TLV_PUCCH_FORMATS_TAG, &(pNfapiMsg->pucch_param.pucch_formats), &unpack_uint8_tlv_value}, + {NFAPI_NR_PARAM_TLV_MAX_PUCCHS_PER_SLOT_TAG, &(pNfapiMsg->pucch_param.max_pucchs_per_slot), &unpack_uint8_tlv_value}, + + {NFAPI_NR_PARAM_TLV_PDSCH_MAPPING_TYPE_TAG, &(pNfapiMsg->pdsch_param.pdsch_mapping_type), &unpack_uint8_tlv_value}, + {NFAPI_NR_PARAM_TLV_PDSCH_ALLOCATION_TYPES_TAG, &(pNfapiMsg->pdsch_param.pdsch_allocation_types), &unpack_uint8_tlv_value}, + {NFAPI_NR_PARAM_TLV_PDSCH_VRB_TO_PRB_MAPPING_TAG, + &(pNfapiMsg->pdsch_param.pdsch_vrb_to_prb_mapping), + &unpack_uint8_tlv_value}, + {NFAPI_NR_PARAM_TLV_PDSCH_CBG_TAG, &(pNfapiMsg->pdsch_param.pdsch_cbg), &unpack_uint8_tlv_value}, + {NFAPI_NR_PARAM_TLV_PDSCH_DMRS_CONFIG_TYPES_TAG, &(pNfapiMsg->pdsch_param.pdsch_dmrs_config_types), &unpack_uint8_tlv_value}, + {NFAPI_NR_PARAM_TLV_PDSCH_DMRS_MAX_LENGTH_TAG, &(pNfapiMsg->pdsch_param.pdsch_dmrs_max_length), &unpack_uint8_tlv_value}, + {NFAPI_NR_PARAM_TLV_PDSCH_DMRS_ADDITIONAL_POS_TAG, + &(pNfapiMsg->pdsch_param.pdsch_dmrs_additional_pos), + &unpack_uint8_tlv_value}, + {NFAPI_NR_PARAM_TLV_MAX_PDSCH_S_TBS_PER_SLOT_TAG, &(pNfapiMsg->pdsch_param.max_pdsch_tbs_per_slot), &unpack_uint8_tlv_value}, + {NFAPI_NR_PARAM_TLV_MAX_NUMBER_MIMO_LAYERS_PDSCH_TAG, + &(pNfapiMsg->pdsch_param.max_number_mimo_layers_pdsch), + &unpack_uint8_tlv_value}, + {NFAPI_NR_PARAM_TLV_SUPPORTED_MAX_MODULATION_ORDER_DL_TAG, + &(pNfapiMsg->pdsch_param.supported_max_modulation_order_dl), + &unpack_uint8_tlv_value}, + {NFAPI_NR_PARAM_TLV_MAX_MU_MIMO_USERS_DL_TAG, &(pNfapiMsg->pdsch_param.max_mu_mimo_users_dl), &unpack_uint8_tlv_value}, + {NFAPI_NR_PARAM_TLV_PDSCH_DATA_IN_DMRS_SYMBOLS_TAG, + &(pNfapiMsg->pdsch_param.pdsch_data_in_dmrs_symbols), + &unpack_uint8_tlv_value}, + {NFAPI_NR_PARAM_TLV_PREMPTION_SUPPORT_TAG, &(pNfapiMsg->pdsch_param.premption_support), &unpack_uint8_tlv_value}, + {NFAPI_NR_PARAM_TLV_PDSCH_NON_SLOT_SUPPORT_TAG, &(pNfapiMsg->pdsch_param.pdsch_non_slot_support), &unpack_uint8_tlv_value}, + + {NFAPI_NR_PARAM_TLV_UCI_MUX_ULSCH_IN_PUSCH_TAG, &(pNfapiMsg->pusch_param.uci_mux_ulsch_in_pusch), &unpack_uint8_tlv_value}, + {NFAPI_NR_PARAM_TLV_UCI_ONLY_PUSCH_TAG, &(pNfapiMsg->pusch_param.uci_only_pusch), &unpack_uint8_tlv_value}, + {NFAPI_NR_PARAM_TLV_PUSCH_FREQUENCY_HOPPING_TAG, &(pNfapiMsg->pusch_param.pusch_frequency_hopping), &unpack_uint8_tlv_value}, + {NFAPI_NR_PARAM_TLV_PUSCH_DMRS_CONFIG_TYPES_TAG, &(pNfapiMsg->pusch_param.pusch_dmrs_config_types), &unpack_uint8_tlv_value}, + {NFAPI_NR_PARAM_TLV_PUSCH_DMRS_MAX_LEN_TAG, &(pNfapiMsg->pusch_param.pusch_dmrs_max_len), &unpack_uint8_tlv_value}, + {NFAPI_NR_PARAM_TLV_PUSCH_DMRS_ADDITIONAL_POS_TAG, + &(pNfapiMsg->pusch_param.pusch_dmrs_additional_pos), + &unpack_uint8_tlv_value}, + {NFAPI_NR_PARAM_TLV_PUSCH_CBG_TAG, &(pNfapiMsg->pusch_param.pusch_cbg), &unpack_uint8_tlv_value}, + {NFAPI_NR_PARAM_TLV_PUSCH_MAPPING_TYPE_TAG, &(pNfapiMsg->pusch_param.pusch_mapping_type), &unpack_uint8_tlv_value}, + {NFAPI_NR_PARAM_TLV_PUSCH_ALLOCATION_TYPES_TAG, &(pNfapiMsg->pusch_param.pusch_allocation_types), &unpack_uint8_tlv_value}, + {NFAPI_NR_PARAM_TLV_PUSCH_VRB_TO_PRB_MAPPING_TAG, + &(pNfapiMsg->pusch_param.pusch_vrb_to_prb_mapping), + &unpack_uint8_tlv_value}, + {NFAPI_NR_PARAM_TLV_PUSCH_MAX_PTRS_PORTS_TAG, &(pNfapiMsg->pusch_param.pusch_max_ptrs_ports), &unpack_uint8_tlv_value}, + {NFAPI_NR_PARAM_TLV_MAX_PDUSCHS_TBS_PER_SLOT_TAG, + &(pNfapiMsg->pusch_param.max_pduschs_tbs_per_slot), + &unpack_uint8_tlv_value}, + {NFAPI_NR_PARAM_TLV_MAX_NUMBER_MIMO_LAYERS_NON_CB_PUSCH_TAG, + &(pNfapiMsg->pusch_param.max_number_mimo_layers_non_cb_pusch), + &unpack_uint8_tlv_value}, + {NFAPI_NR_PARAM_TLV_SUPPORTED_MODULATION_ORDER_UL_TAG, + &(pNfapiMsg->pusch_param.supported_modulation_order_ul), + &unpack_uint8_tlv_value}, + {NFAPI_NR_PARAM_TLV_MAX_MU_MIMO_USERS_UL_TAG, &(pNfapiMsg->pusch_param.max_mu_mimo_users_ul), &unpack_uint8_tlv_value}, + {NFAPI_NR_PARAM_TLV_DFTS_OFDM_SUPPORT_TAG, &(pNfapiMsg->pusch_param.dfts_ofdm_support), &unpack_uint8_tlv_value}, + {NFAPI_NR_PARAM_TLV_PUSCH_AGGREGATION_FACTOR_TAG, + &(pNfapiMsg->pusch_param.pusch_aggregation_factor), + &unpack_uint8_tlv_value}, + + {NFAPI_NR_PARAM_TLV_PRACH_LONG_FORMATS_TAG, &(pNfapiMsg->prach_param.prach_long_formats), &unpack_uint8_tlv_value}, + {NFAPI_NR_PARAM_TLV_PRACH_SHORT_FORMATS_TAG, &(pNfapiMsg->prach_param.prach_short_formats), &unpack_uint16_tlv_value}, + {NFAPI_NR_PARAM_TLV_PRACH_RESTRICTED_SETS_TAG, &(pNfapiMsg->prach_param.prach_restricted_sets), &unpack_uint8_tlv_value}, + {NFAPI_NR_PARAM_TLV_MAX_PRACH_FD_OCCASIONS_IN_A_SLOT_TAG, + &(pNfapiMsg->prach_param.max_prach_fd_occasions_in_a_slot), + &unpack_uint8_tlv_value}, + + {NFAPI_NR_PARAM_TLV_RSSI_MEASUREMENT_SUPPORT_TAG, + &(pNfapiMsg->measurement_param.rssi_measurement_support), + &unpack_uint8_tlv_value}, + // config + {NFAPI_NR_NFAPI_P7_VNF_ADDRESS_IPV4_TAG, &pNfapiMsg->nfapi_config.p7_vnf_address_ipv4, &unpack_ipv4_address_value}, + {NFAPI_NR_NFAPI_P7_VNF_ADDRESS_IPV6_TAG, &pNfapiMsg->nfapi_config.p7_vnf_address_ipv6, &unpack_ipv6_address_value}, + {NFAPI_NR_NFAPI_P7_VNF_PORT_TAG, &pNfapiMsg->nfapi_config.p7_vnf_port, &unpack_uint16_tlv_value}, + {NFAPI_NR_NFAPI_P7_PNF_ADDRESS_IPV4_TAG, &pNfapiMsg->nfapi_config.p7_pnf_address_ipv4, &unpack_ipv4_address_value}, + {NFAPI_NR_NFAPI_P7_PNF_ADDRESS_IPV6_TAG, &pNfapiMsg->nfapi_config.p7_pnf_address_ipv6, &unpack_ipv6_address_value}, + {NFAPI_NR_NFAPI_P7_PNF_PORT_TAG, &pNfapiMsg->nfapi_config.p7_pnf_port, &unpack_uint16_tlv_value}, + {NFAPI_NR_NFAPI_TIMING_WINDOW_TAG, &pNfapiMsg->nfapi_config.timing_window, &unpack_uint8_tlv_value}, + {NFAPI_NR_NFAPI_TIMING_INFO_MODE_TAG, &pNfapiMsg->nfapi_config.timing_info_mode, &unpack_uint8_tlv_value}, + {NFAPI_NR_NFAPI_TIMING_INFO_PERIOD_TAG, &pNfapiMsg->nfapi_config.timing_info_period, &unpack_uint8_tlv_value}, + }; + // print ppReadPackedMsg + uint8_t *ptr = *ppReadPackedMsg; + printf("\n Read message unpack_param_response: "); + + while (ptr < end) { + printf(" 0x%02x", *ptr); + ptr++; + } + + printf("\n"); + return (pull8(ppReadPackedMsg, &pNfapiMsg->error_code, end) && pull8(ppReadPackedMsg, &pNfapiMsg->num_tlv, end) + && unpack_nr_tlv_list(unpack_fns, + sizeof(unpack_fns) / sizeof(unpack_tlv_t), + ppReadPackedMsg, + end, + config, + &pNfapiMsg->vendor_extension)); +} diff --git a/nfapi/open-nFAPI/nfapi/public_inc/nfapi_interface.h b/nfapi/open-nFAPI/nfapi/public_inc/nfapi_interface.h index a771d74beed3eea8ab10eeaf2cc2e4fbc4e257d0..3ec1cb7a0453d6337603e1fe1146443e62d2955f 100644 --- a/nfapi/open-nFAPI/nfapi/public_inc/nfapi_interface.h +++ b/nfapi/open-nFAPI/nfapi/public_inc/nfapi_interface.h @@ -4121,10 +4121,6 @@ int pack_nr_srs_beamforming_report(void *pMessageBuf, void *pPackedBuf, uint32_t */ int unpack_nr_srs_beamforming_report(void *pMessageBuf, uint32_t messageBufLen, void *pUnpackedBuf, uint32_t unpackedBufLen); -uint8_t pack_nr_param_response(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t *config); - -uint8_t unpack_nr_param_response(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p4_p5_codec_config_t *config); - uint8_t pack_nr_config_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t *config); uint8_t unpack_nr_config_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p4_p5_codec_config_t *config); diff --git a/nfapi/open-nFAPI/nfapi/src/nfapi_p5.c b/nfapi/open-nFAPI/nfapi/src/nfapi_p5.c index cb201d63137ffaaaeb6e719ebba9e7bc01a17518..1a54263731df799c1957eb22b72126d19caa746c 100644 --- a/nfapi/open-nFAPI/nfapi/src/nfapi_p5.c +++ b/nfapi/open-nFAPI/nfapi/src/nfapi_p5.c @@ -661,354 +661,6 @@ static uint8_t pack_param_response(void *msg, uint8_t **ppWritePackedMsg, uint8_ && pack_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config)); } -uint8_t pack_nr_param_response(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t *config) -{ - printf("\nRUNNING pack_param_response\n"); - nfapi_nr_param_response_scf_t *pNfapiMsg = (nfapi_nr_param_response_scf_t *)msg; - uint8_t retval = push8(pNfapiMsg->error_code, ppWritePackedMsg, end) && push8(pNfapiMsg->num_tlv, ppWritePackedMsg, end) - && pack_nr_tlv(NFAPI_NR_PARAM_TLV_RELEASE_CAPABILITY_TAG, - &(pNfapiMsg->cell_param.release_capability), - ppWritePackedMsg, - end, - &pack_uint16_tlv_value) - && pack_nr_tlv(NFAPI_NR_PARAM_TLV_PHY_STATE_TAG, - &(pNfapiMsg->cell_param.phy_state), - ppWritePackedMsg, - end, - &pack_uint16_tlv_value) - && pack_nr_tlv(NFAPI_NR_PARAM_TLV_SKIP_BLANK_DL_CONFIG_TAG, - &(pNfapiMsg->cell_param.skip_blank_dl_config), - ppWritePackedMsg, - end, - &pack_uint8_tlv_value) - && pack_nr_tlv(NFAPI_NR_PARAM_TLV_SKIP_BLANK_UL_CONFIG_TAG, - &(pNfapiMsg->cell_param.skip_blank_ul_config), - ppWritePackedMsg, - end, - &pack_uint8_tlv_value) - && pack_nr_tlv(NFAPI_NR_PARAM_TLV_NUM_CONFIG_TLVS_TO_REPORT_TAG, - &(pNfapiMsg->cell_param.num_config_tlvs_to_report), - ppWritePackedMsg, - end, - &pack_uint16_tlv_value); - - for (int i = 0; i < pNfapiMsg->cell_param.num_config_tlvs_to_report.value; ++i) { - /*retval &= pack_nr_tlv(pNfapiMsg->cell_param.config_tlvs_to_report_list[i].tl.tag, - &(pNfapiMsg->cell_param.config_tlvs_to_report_list[i]), - ppWritePackedMsg, - end, - &pack_uint8_tlv_value);*/ - retval &= push16(pNfapiMsg->cell_param.config_tlvs_to_report_list[i].tl.tag, ppWritePackedMsg, end); - retval &= push8(pNfapiMsg->cell_param.config_tlvs_to_report_list[i].tl.length, ppWritePackedMsg, end); - retval &= push8(pNfapiMsg->cell_param.config_tlvs_to_report_list[i].value, ppWritePackedMsg, end); - // Add padding that ensures multiple of 4 bytes (SCF 225 Section 2.3.2.1) - int padding = get_tlv_padding(pNfapiMsg->cell_param.config_tlvs_to_report_list[i].tl.length); - NFAPI_TRACE(NFAPI_TRACE_DEBUG, - "TLV 0x%x with padding of %d bytes\n", - pNfapiMsg->cell_param.config_tlvs_to_report_list[i].tl.tag, - padding); - if (padding != 0) { - memset(*ppWritePackedMsg, 0, padding); - (*ppWritePackedMsg) += padding; - } - } - - retval &= pack_nr_tlv(NFAPI_NR_PARAM_TLV_CYCLIC_PREFIX_TAG, - &(pNfapiMsg->carrier_param.cyclic_prefix), - ppWritePackedMsg, - end, - &pack_uint8_tlv_value) - && pack_nr_tlv(NFAPI_NR_PARAM_TLV_SUPPORTED_SUBCARRIER_SPACINGS_DL_TAG, - &(pNfapiMsg->carrier_param.supported_subcarrier_spacings_dl), - ppWritePackedMsg, - end, - &pack_uint16_tlv_value) - && pack_nr_tlv(NFAPI_NR_PARAM_TLV_SUPPORTED_BANDWIDTH_DL_TAG, - &(pNfapiMsg->carrier_param.supported_bandwidth_dl), - ppWritePackedMsg, - end, - &pack_uint16_tlv_value) - && pack_nr_tlv(NFAPI_NR_PARAM_TLV_SUPPORTED_SUBCARRIER_SPACINGS_UL_TAG, - &(pNfapiMsg->carrier_param.supported_subcarrier_spacings_ul), - ppWritePackedMsg, - end, - &pack_uint8_tlv_value) - && pack_nr_tlv(NFAPI_NR_PARAM_TLV_SUPPORTED_BANDWIDTH_UL_TAG, - &(pNfapiMsg->carrier_param.supported_bandwidth_ul), - ppWritePackedMsg, - end, - &pack_uint16_tlv_value) - && pack_nr_tlv(NFAPI_NR_PARAM_TLV_CCE_MAPPING_TYPE_TAG, - &(pNfapiMsg->pdcch_param.cce_mapping_type), - ppWritePackedMsg, - end, - &pack_uint8_tlv_value) - && pack_nr_tlv(NFAPI_NR_PARAM_TLV_CORESET_OUTSIDE_FIRST_3_OFDM_SYMS_OF_SLOT_TAG, - &(pNfapiMsg->pdcch_param.coreset_outside_first_3_of_ofdm_syms_of_slot), - ppWritePackedMsg, - end, - &pack_uint8_tlv_value) - && pack_nr_tlv(NFAPI_NR_PARAM_TLV_PRECODER_GRANULARITY_CORESET_TAG, - &(pNfapiMsg->pdcch_param.coreset_precoder_granularity_coreset), - ppWritePackedMsg, - end, - &pack_uint8_tlv_value) - && pack_nr_tlv(NFAPI_NR_PARAM_TLV_PDCCH_MU_MIMO_TAG, - &(pNfapiMsg->pdcch_param.pdcch_mu_mimo), - ppWritePackedMsg, - end, - &pack_uint8_tlv_value) - && pack_nr_tlv(NFAPI_NR_PARAM_TLV_PDCCH_PRECODER_CYCLING_TAG, - &(pNfapiMsg->pdcch_param.pdcch_precoder_cycling), - ppWritePackedMsg, - end, - &pack_uint8_tlv_value) - && pack_nr_tlv(NFAPI_NR_PARAM_TLV_MAX_PDCCHS_PER_SLOT_TAG, - &(pNfapiMsg->pdcch_param.max_pdcch_per_slot), - ppWritePackedMsg, - end, - &pack_uint8_tlv_value) - && pack_nr_tlv(NFAPI_NR_PARAM_TLV_PUCCH_FORMATS_TAG, - &(pNfapiMsg->pucch_param.pucch_formats), - ppWritePackedMsg, - end, - &pack_uint8_tlv_value) - && pack_nr_tlv(NFAPI_NR_PARAM_TLV_MAX_PUCCHS_PER_SLOT_TAG, - &(pNfapiMsg->pucch_param.max_pucchs_per_slot), - ppWritePackedMsg, - end, - &pack_uint8_tlv_value) - && pack_nr_tlv(NFAPI_NR_PARAM_TLV_PDSCH_MAPPING_TYPE_TAG, - &(pNfapiMsg->pdsch_param.pdsch_mapping_type), - ppWritePackedMsg, - end, - &pack_uint8_tlv_value) - && pack_nr_tlv(NFAPI_NR_PARAM_TLV_PDSCH_ALLOCATION_TYPES_TAG, - &(pNfapiMsg->pdsch_param.pdsch_allocation_types), - ppWritePackedMsg, - end, - &pack_uint8_tlv_value) - && pack_nr_tlv(NFAPI_NR_PARAM_TLV_PDSCH_VRB_TO_PRB_MAPPING_TAG, - &(pNfapiMsg->pdsch_param.pdsch_vrb_to_prb_mapping), - ppWritePackedMsg, - end, - &pack_uint8_tlv_value) - && pack_nr_tlv(NFAPI_NR_PARAM_TLV_PDSCH_CBG_TAG, - &(pNfapiMsg->pdsch_param.pdsch_cbg), - ppWritePackedMsg, - end, - &pack_uint8_tlv_value) - && pack_nr_tlv(NFAPI_NR_PARAM_TLV_PDSCH_DMRS_CONFIG_TYPES_TAG, - &(pNfapiMsg->pdsch_param.pdsch_dmrs_config_types), - ppWritePackedMsg, - end, - &pack_uint8_tlv_value) - && pack_nr_tlv(NFAPI_NR_PARAM_TLV_PDSCH_DMRS_MAX_LENGTH_TAG, - &(pNfapiMsg->pdsch_param.pdsch_dmrs_max_length), - ppWritePackedMsg, - end, - &pack_uint8_tlv_value) - && pack_nr_tlv(NFAPI_NR_PARAM_TLV_PDSCH_DMRS_ADDITIONAL_POS_TAG, - &(pNfapiMsg->pdsch_param.pdsch_dmrs_additional_pos), - ppWritePackedMsg, - end, - &pack_uint8_tlv_value) - && pack_nr_tlv(NFAPI_NR_PARAM_TLV_MAX_PDSCH_S_TBS_PER_SLOT_TAG, - &(pNfapiMsg->pdsch_param.max_pdsch_tbs_per_slot), - ppWritePackedMsg, - end, - &pack_uint8_tlv_value) - && pack_nr_tlv(NFAPI_NR_PARAM_TLV_MAX_NUMBER_MIMO_LAYERS_PDSCH_TAG, - &(pNfapiMsg->pdsch_param.max_number_mimo_layers_pdsch), - ppWritePackedMsg, - end, - &pack_uint8_tlv_value) - && pack_nr_tlv(NFAPI_NR_PARAM_TLV_SUPPORTED_MAX_MODULATION_ORDER_DL_TAG, - &(pNfapiMsg->pdsch_param.supported_max_modulation_order_dl), - ppWritePackedMsg, - end, - &pack_uint8_tlv_value) - && pack_nr_tlv(NFAPI_NR_PARAM_TLV_MAX_MU_MIMO_USERS_DL_TAG, - &(pNfapiMsg->pdsch_param.max_mu_mimo_users_dl), - ppWritePackedMsg, - end, - &pack_uint8_tlv_value) - && pack_nr_tlv(NFAPI_NR_PARAM_TLV_PDSCH_DATA_IN_DMRS_SYMBOLS_TAG, - &(pNfapiMsg->pdsch_param.pdsch_data_in_dmrs_symbols), - ppWritePackedMsg, - end, - &pack_uint8_tlv_value) - && pack_nr_tlv(NFAPI_NR_PARAM_TLV_PREMPTION_SUPPORT_TAG, - &(pNfapiMsg->pdsch_param.premption_support), - ppWritePackedMsg, - end, - &pack_uint8_tlv_value) - && pack_nr_tlv(NFAPI_NR_PARAM_TLV_PDSCH_NON_SLOT_SUPPORT_TAG, - &(pNfapiMsg->pdsch_param.pdsch_non_slot_support), - ppWritePackedMsg, - end, - &pack_uint8_tlv_value) - && pack_nr_tlv(NFAPI_NR_PARAM_TLV_UCI_MUX_ULSCH_IN_PUSCH_TAG, - &(pNfapiMsg->pusch_param.uci_mux_ulsch_in_pusch), - ppWritePackedMsg, - end, - &pack_uint8_tlv_value) - && pack_nr_tlv(NFAPI_NR_PARAM_TLV_UCI_ONLY_PUSCH_TAG, - &(pNfapiMsg->pusch_param.uci_only_pusch), - ppWritePackedMsg, - end, - &pack_uint8_tlv_value) - && pack_nr_tlv(NFAPI_NR_PARAM_TLV_PUSCH_FREQUENCY_HOPPING_TAG, - &(pNfapiMsg->pusch_param.pusch_frequency_hopping), - ppWritePackedMsg, - end, - &pack_uint8_tlv_value) - && pack_nr_tlv(NFAPI_NR_PARAM_TLV_PUSCH_DMRS_CONFIG_TYPES_TAG, - &(pNfapiMsg->pusch_param.pusch_dmrs_config_types), - ppWritePackedMsg, - end, - &pack_uint8_tlv_value) - && pack_nr_tlv(NFAPI_NR_PARAM_TLV_PUSCH_DMRS_MAX_LEN_TAG, - &(pNfapiMsg->pusch_param.pusch_dmrs_max_len), - ppWritePackedMsg, - end, - &pack_uint8_tlv_value) - && pack_nr_tlv(NFAPI_NR_PARAM_TLV_PUSCH_DMRS_ADDITIONAL_POS_TAG, - &(pNfapiMsg->pusch_param.pusch_dmrs_additional_pos), - ppWritePackedMsg, - end, - &pack_uint8_tlv_value) - && pack_nr_tlv(NFAPI_NR_PARAM_TLV_PUSCH_CBG_TAG, - &(pNfapiMsg->pusch_param.pusch_cbg), - ppWritePackedMsg, - end, - &pack_uint8_tlv_value) - && pack_nr_tlv(NFAPI_NR_PARAM_TLV_PUSCH_MAPPING_TYPE_TAG, - &(pNfapiMsg->pusch_param.pusch_mapping_type), - ppWritePackedMsg, - end, - &pack_uint8_tlv_value) - && pack_nr_tlv(NFAPI_NR_PARAM_TLV_PUSCH_ALLOCATION_TYPES_TAG, - &(pNfapiMsg->pusch_param.pusch_allocation_types), - ppWritePackedMsg, - end, - &pack_uint8_tlv_value) - && pack_nr_tlv(NFAPI_NR_PARAM_TLV_PUSCH_VRB_TO_PRB_MAPPING_TAG, - &(pNfapiMsg->pusch_param.pusch_vrb_to_prb_mapping), - ppWritePackedMsg, - end, - &pack_uint8_tlv_value) - && pack_nr_tlv(NFAPI_NR_PARAM_TLV_PUSCH_MAX_PTRS_PORTS_TAG, - &(pNfapiMsg->pusch_param.pusch_max_ptrs_ports), - ppWritePackedMsg, - end, - &pack_uint8_tlv_value) - && pack_nr_tlv(NFAPI_NR_PARAM_TLV_MAX_PDUSCHS_TBS_PER_SLOT_TAG, - &(pNfapiMsg->pusch_param.max_pduschs_tbs_per_slot), - ppWritePackedMsg, - end, - &pack_uint8_tlv_value) - && pack_nr_tlv(NFAPI_NR_PARAM_TLV_MAX_NUMBER_MIMO_LAYERS_NON_CB_PUSCH_TAG, - &(pNfapiMsg->pusch_param.max_number_mimo_layers_non_cb_pusch), - ppWritePackedMsg, - end, - &pack_uint8_tlv_value) - && pack_nr_tlv(NFAPI_NR_PARAM_TLV_SUPPORTED_MODULATION_ORDER_UL_TAG, - &(pNfapiMsg->pusch_param.supported_modulation_order_ul), - ppWritePackedMsg, - end, - &pack_uint8_tlv_value) - && pack_nr_tlv(NFAPI_NR_PARAM_TLV_MAX_MU_MIMO_USERS_UL_TAG, - &(pNfapiMsg->pusch_param.max_mu_mimo_users_ul), - ppWritePackedMsg, - end, - &pack_uint8_tlv_value) - && pack_nr_tlv(NFAPI_NR_PARAM_TLV_DFTS_OFDM_SUPPORT_TAG, - &(pNfapiMsg->pusch_param.dfts_ofdm_support), - ppWritePackedMsg, - end, - &pack_uint8_tlv_value) - && pack_nr_tlv(NFAPI_NR_PARAM_TLV_PUSCH_AGGREGATION_FACTOR_TAG, - &(pNfapiMsg->pusch_param.pusch_aggregation_factor), - ppWritePackedMsg, - end, - &pack_uint8_tlv_value) - && pack_nr_tlv(NFAPI_NR_PARAM_TLV_PRACH_LONG_FORMATS_TAG, - &(pNfapiMsg->prach_param.prach_long_formats), - ppWritePackedMsg, - end, - &pack_uint8_tlv_value) - && pack_nr_tlv(NFAPI_NR_PARAM_TLV_PRACH_SHORT_FORMATS_TAG, - &(pNfapiMsg->prach_param.prach_short_formats), - ppWritePackedMsg, - end, - &pack_uint16_tlv_value) - && pack_nr_tlv(NFAPI_NR_PARAM_TLV_PRACH_RESTRICTED_SETS_TAG, - &(pNfapiMsg->prach_param.prach_restricted_sets), - ppWritePackedMsg, - end, - &pack_uint8_tlv_value) - && pack_nr_tlv(NFAPI_NR_PARAM_TLV_MAX_PRACH_FD_OCCASIONS_IN_A_SLOT_TAG, - &(pNfapiMsg->prach_param.max_prach_fd_occasions_in_a_slot), - ppWritePackedMsg, - end, - &pack_uint8_tlv_value) - && pack_nr_tlv(NFAPI_NR_PARAM_TLV_RSSI_MEASUREMENT_SUPPORT_TAG, - &(pNfapiMsg->measurement_param.rssi_measurement_support), - ppWritePackedMsg, - end, - &pack_uint8_tlv_value) - && - // config: - pack_nr_tlv(NFAPI_NR_NFAPI_P7_VNF_ADDRESS_IPV4_TAG, - &(pNfapiMsg->nfapi_config.p7_vnf_address_ipv4), - ppWritePackedMsg, - end, - &pack_ipv4_address_value) - && pack_nr_tlv(NFAPI_NR_NFAPI_P7_VNF_ADDRESS_IPV6_TAG, - &(pNfapiMsg->nfapi_config.p7_vnf_address_ipv6), - ppWritePackedMsg, - end, - &pack_ipv6_address_value) - && pack_nr_tlv(NFAPI_NR_NFAPI_P7_VNF_PORT_TAG, - &(pNfapiMsg->nfapi_config.p7_vnf_port), - ppWritePackedMsg, - end, - &pack_uint16_tlv_value) - && pack_nr_tlv(NFAPI_NR_NFAPI_P7_PNF_ADDRESS_IPV4_TAG, - &(pNfapiMsg->nfapi_config.p7_pnf_address_ipv4), - ppWritePackedMsg, - end, - &pack_ipv4_address_value) - && pack_nr_tlv(NFAPI_NR_NFAPI_P7_PNF_ADDRESS_IPV6_TAG, - &(pNfapiMsg->nfapi_config.p7_pnf_address_ipv6), - ppWritePackedMsg, - end, - &pack_ipv6_address_value) - && pack_nr_tlv(NFAPI_NR_NFAPI_P7_PNF_PORT_TAG, - &(pNfapiMsg->nfapi_config.p7_pnf_port), - ppWritePackedMsg, - end, - &pack_uint16_tlv_value) - && pack_nr_tlv(NFAPI_NR_NFAPI_TIMING_WINDOW_TAG, - &(pNfapiMsg->nfapi_config.timing_window), - ppWritePackedMsg, - end, - &pack_uint8_tlv_value) - && pack_nr_tlv(NFAPI_NR_NFAPI_TIMING_INFO_MODE_TAG, - &(pNfapiMsg->nfapi_config.timing_info_mode), - ppWritePackedMsg, - end, - &pack_uint8_tlv_value) - && pack_nr_tlv(NFAPI_NR_NFAPI_TIMING_INFO_PERIOD_TAG, - &(pNfapiMsg->nfapi_config.timing_info_period), - ppWritePackedMsg, - end, - &pack_uint8_tlv_value) - && pack_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config); - return retval; -} - static uint8_t pack_config_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t *config) { nfapi_config_request_t *pNfapiMsg = (nfapi_config_request_t *)msg; @@ -2614,170 +2266,6 @@ static uint8_t unpack_param_response(uint8_t **ppReadPackedMsg, uint8_t *end, vo config, &pNfapiMsg->vendor_extension)); } -static uint8_t unpack_config_tlvs_to_report(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - uint8_t *pStartOfValue = *ppReadPackedMsg; - nfapi_nr_cell_param_t *cellParamTable = (nfapi_nr_cell_param_t *)tlv; - uint8_t retval = pull16(ppReadPackedMsg, &cellParamTable->num_config_tlvs_to_report.value, end); - - // check if the length was right; - if (cellParamTable->num_config_tlvs_to_report.tl.length != (*ppReadPackedMsg - pStartOfValue)) { - NFAPI_TRACE(NFAPI_TRACE_ERROR, - "Warning tlv tag 0x%x length %d not equal to unpack %ld\n", - cellParamTable->num_config_tlvs_to_report.tl.tag, - cellParamTable->num_config_tlvs_to_report.tl.length, - (*ppReadPackedMsg - pStartOfValue)); - } - // Remove padding that ensures multiple of 4 bytes (SCF 225 Section 2.3.2.1) - int padding = get_tlv_padding(cellParamTable->num_config_tlvs_to_report.tl.length); - if (padding != 0) { - (*ppReadPackedMsg) += padding; - } - - // after this value, get the tlv list - cellParamTable->config_tlvs_to_report_list = calloc(cellParamTable->num_config_tlvs_to_report.value, sizeof(nfapi_uint8_tlv_t *)); - - for (int i = 0; i < cellParamTable->num_config_tlvs_to_report.value; ++i) { - pull16(ppReadPackedMsg, &cellParamTable->config_tlvs_to_report_list[i].tl.tag, end); - pull8(ppReadPackedMsg, (uint8_t *)&cellParamTable->config_tlvs_to_report_list[i].tl.length, end); - pull8(ppReadPackedMsg, &cellParamTable->config_tlvs_to_report_list[i].value, end); - // Remove padding that ensures multiple of 4 bytes (SCF 225 Section 2.3.2.1) - padding = get_tlv_padding(cellParamTable->config_tlvs_to_report_list[i].tl.length); - if (padding != 0) { - (*ppReadPackedMsg) += padding; - } - } - return retval; -} - -uint8_t unpack_nr_param_response(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p4_p5_codec_config_t *config) -{ - nfapi_nr_param_response_scf_t *pNfapiMsg = (nfapi_nr_param_response_scf_t *)msg; - unpack_tlv_t unpack_fns[] = { - {NFAPI_NR_PARAM_TLV_RELEASE_CAPABILITY_TAG, &(pNfapiMsg->cell_param.release_capability), &unpack_uint16_tlv_value}, - {NFAPI_NR_PARAM_TLV_PHY_STATE_TAG, &(pNfapiMsg->cell_param.phy_state), &unpack_uint16_tlv_value}, - {NFAPI_NR_PARAM_TLV_SKIP_BLANK_DL_CONFIG_TAG, &(pNfapiMsg->cell_param.skip_blank_dl_config), &unpack_uint8_tlv_value}, - {NFAPI_NR_PARAM_TLV_SKIP_BLANK_UL_CONFIG_TAG, &(pNfapiMsg->cell_param.skip_blank_ul_config), &unpack_uint8_tlv_value}, - {NFAPI_NR_PARAM_TLV_NUM_CONFIG_TLVS_TO_REPORT_TAG, &(pNfapiMsg->cell_param), &unpack_config_tlvs_to_report}, - - {NFAPI_NR_PARAM_TLV_CYCLIC_PREFIX_TAG, &(pNfapiMsg->carrier_param.cyclic_prefix), &unpack_uint8_tlv_value}, - {NFAPI_NR_PARAM_TLV_SUPPORTED_SUBCARRIER_SPACINGS_DL_TAG, - &(pNfapiMsg->carrier_param.supported_subcarrier_spacings_dl), - &unpack_uint16_tlv_value}, - {NFAPI_NR_PARAM_TLV_SUPPORTED_BANDWIDTH_DL_TAG, &(pNfapiMsg->carrier_param.supported_bandwidth_dl), &unpack_uint16_tlv_value}, - {NFAPI_NR_PARAM_TLV_SUPPORTED_SUBCARRIER_SPACINGS_UL_TAG, - &(pNfapiMsg->carrier_param.supported_subcarrier_spacings_ul), - &unpack_uint8_tlv_value}, - {NFAPI_NR_PARAM_TLV_SUPPORTED_BANDWIDTH_UL_TAG, &(pNfapiMsg->carrier_param.supported_bandwidth_ul), &unpack_uint16_tlv_value}, - - {NFAPI_NR_PARAM_TLV_CCE_MAPPING_TYPE_TAG, &(pNfapiMsg->pdcch_param.cce_mapping_type), &unpack_uint8_tlv_value}, - {NFAPI_NR_PARAM_TLV_CORESET_OUTSIDE_FIRST_3_OFDM_SYMS_OF_SLOT_TAG, - &(pNfapiMsg->pdcch_param.coreset_outside_first_3_of_ofdm_syms_of_slot), - &unpack_uint8_tlv_value}, - {NFAPI_NR_PARAM_TLV_PRECODER_GRANULARITY_CORESET_TAG, - &(pNfapiMsg->pdcch_param.coreset_precoder_granularity_coreset), - &unpack_uint8_tlv_value}, - {NFAPI_NR_PARAM_TLV_PDCCH_MU_MIMO_TAG, &(pNfapiMsg->pdcch_param.pdcch_mu_mimo), &unpack_uint8_tlv_value}, - {NFAPI_NR_PARAM_TLV_PDCCH_PRECODER_CYCLING_TAG, &(pNfapiMsg->pdcch_param.pdcch_precoder_cycling), &unpack_uint8_tlv_value}, - {NFAPI_NR_PARAM_TLV_MAX_PDCCHS_PER_SLOT_TAG, &(pNfapiMsg->pdcch_param.max_pdcch_per_slot), &unpack_uint8_tlv_value}, - - {NFAPI_NR_PARAM_TLV_PUCCH_FORMATS_TAG, &(pNfapiMsg->pucch_param.pucch_formats), &unpack_uint8_tlv_value}, - {NFAPI_NR_PARAM_TLV_MAX_PUCCHS_PER_SLOT_TAG, &(pNfapiMsg->pucch_param.max_pucchs_per_slot), &unpack_uint8_tlv_value}, - - {NFAPI_NR_PARAM_TLV_PDSCH_MAPPING_TYPE_TAG, &(pNfapiMsg->pdsch_param.pdsch_mapping_type), &unpack_uint8_tlv_value}, - {NFAPI_NR_PARAM_TLV_PDSCH_ALLOCATION_TYPES_TAG, &(pNfapiMsg->pdsch_param.pdsch_allocation_types), &unpack_uint8_tlv_value}, - {NFAPI_NR_PARAM_TLV_PDSCH_VRB_TO_PRB_MAPPING_TAG, - &(pNfapiMsg->pdsch_param.pdsch_vrb_to_prb_mapping), - &unpack_uint8_tlv_value}, - {NFAPI_NR_PARAM_TLV_PDSCH_CBG_TAG, &(pNfapiMsg->pdsch_param.pdsch_cbg), &unpack_uint8_tlv_value}, - {NFAPI_NR_PARAM_TLV_PDSCH_DMRS_CONFIG_TYPES_TAG, &(pNfapiMsg->pdsch_param.pdsch_dmrs_config_types), &unpack_uint8_tlv_value}, - {NFAPI_NR_PARAM_TLV_PDSCH_DMRS_MAX_LENGTH_TAG, &(pNfapiMsg->pdsch_param.pdsch_dmrs_max_length), &unpack_uint8_tlv_value}, - {NFAPI_NR_PARAM_TLV_PDSCH_DMRS_ADDITIONAL_POS_TAG, - &(pNfapiMsg->pdsch_param.pdsch_dmrs_additional_pos), - &unpack_uint8_tlv_value}, - {NFAPI_NR_PARAM_TLV_MAX_PDSCH_S_TBS_PER_SLOT_TAG, &(pNfapiMsg->pdsch_param.max_pdsch_tbs_per_slot), &unpack_uint8_tlv_value}, - {NFAPI_NR_PARAM_TLV_MAX_NUMBER_MIMO_LAYERS_PDSCH_TAG, - &(pNfapiMsg->pdsch_param.max_number_mimo_layers_pdsch), - &unpack_uint8_tlv_value}, - {NFAPI_NR_PARAM_TLV_SUPPORTED_MAX_MODULATION_ORDER_DL_TAG, - &(pNfapiMsg->pdsch_param.supported_max_modulation_order_dl), - &unpack_uint8_tlv_value}, - {NFAPI_NR_PARAM_TLV_MAX_MU_MIMO_USERS_DL_TAG, &(pNfapiMsg->pdsch_param.max_mu_mimo_users_dl), &unpack_uint8_tlv_value}, - {NFAPI_NR_PARAM_TLV_PDSCH_DATA_IN_DMRS_SYMBOLS_TAG, - &(pNfapiMsg->pdsch_param.pdsch_data_in_dmrs_symbols), - &unpack_uint8_tlv_value}, - {NFAPI_NR_PARAM_TLV_PREMPTION_SUPPORT_TAG, &(pNfapiMsg->pdsch_param.premption_support), &unpack_uint8_tlv_value}, - {NFAPI_NR_PARAM_TLV_PDSCH_NON_SLOT_SUPPORT_TAG, &(pNfapiMsg->pdsch_param.pdsch_non_slot_support), &unpack_uint8_tlv_value}, - - {NFAPI_NR_PARAM_TLV_UCI_MUX_ULSCH_IN_PUSCH_TAG, &(pNfapiMsg->pusch_param.uci_mux_ulsch_in_pusch), &unpack_uint8_tlv_value}, - {NFAPI_NR_PARAM_TLV_UCI_ONLY_PUSCH_TAG, &(pNfapiMsg->pusch_param.uci_only_pusch), &unpack_uint8_tlv_value}, - {NFAPI_NR_PARAM_TLV_PUSCH_FREQUENCY_HOPPING_TAG, &(pNfapiMsg->pusch_param.pusch_frequency_hopping), &unpack_uint8_tlv_value}, - {NFAPI_NR_PARAM_TLV_PUSCH_DMRS_CONFIG_TYPES_TAG, &(pNfapiMsg->pusch_param.pusch_dmrs_config_types), &unpack_uint8_tlv_value}, - {NFAPI_NR_PARAM_TLV_PUSCH_DMRS_MAX_LEN_TAG, &(pNfapiMsg->pusch_param.pusch_dmrs_max_len), &unpack_uint8_tlv_value}, - {NFAPI_NR_PARAM_TLV_PUSCH_DMRS_ADDITIONAL_POS_TAG, - &(pNfapiMsg->pusch_param.pusch_dmrs_additional_pos), - &unpack_uint8_tlv_value}, - {NFAPI_NR_PARAM_TLV_PUSCH_CBG_TAG, &(pNfapiMsg->pusch_param.pusch_cbg), &unpack_uint8_tlv_value}, - {NFAPI_NR_PARAM_TLV_PUSCH_MAPPING_TYPE_TAG, &(pNfapiMsg->pusch_param.pusch_mapping_type), &unpack_uint8_tlv_value}, - {NFAPI_NR_PARAM_TLV_PUSCH_ALLOCATION_TYPES_TAG, &(pNfapiMsg->pusch_param.pusch_allocation_types), &unpack_uint8_tlv_value}, - {NFAPI_NR_PARAM_TLV_PUSCH_VRB_TO_PRB_MAPPING_TAG, - &(pNfapiMsg->pusch_param.pusch_vrb_to_prb_mapping), - &unpack_uint8_tlv_value}, - {NFAPI_NR_PARAM_TLV_PUSCH_MAX_PTRS_PORTS_TAG, &(pNfapiMsg->pusch_param.pusch_max_ptrs_ports), &unpack_uint8_tlv_value}, - {NFAPI_NR_PARAM_TLV_MAX_PDUSCHS_TBS_PER_SLOT_TAG, - &(pNfapiMsg->pusch_param.max_pduschs_tbs_per_slot), - &unpack_uint8_tlv_value}, - {NFAPI_NR_PARAM_TLV_MAX_NUMBER_MIMO_LAYERS_NON_CB_PUSCH_TAG, - &(pNfapiMsg->pusch_param.max_number_mimo_layers_non_cb_pusch), - &unpack_uint8_tlv_value}, - {NFAPI_NR_PARAM_TLV_SUPPORTED_MODULATION_ORDER_UL_TAG, - &(pNfapiMsg->pusch_param.supported_modulation_order_ul), - &unpack_uint8_tlv_value}, - {NFAPI_NR_PARAM_TLV_MAX_MU_MIMO_USERS_UL_TAG, &(pNfapiMsg->pusch_param.max_mu_mimo_users_ul), &unpack_uint8_tlv_value}, - {NFAPI_NR_PARAM_TLV_DFTS_OFDM_SUPPORT_TAG, &(pNfapiMsg->pusch_param.dfts_ofdm_support), &unpack_uint8_tlv_value}, - {NFAPI_NR_PARAM_TLV_PUSCH_AGGREGATION_FACTOR_TAG, - &(pNfapiMsg->pusch_param.pusch_aggregation_factor), - &unpack_uint8_tlv_value}, - - {NFAPI_NR_PARAM_TLV_PRACH_LONG_FORMATS_TAG, &(pNfapiMsg->prach_param.prach_long_formats), &unpack_uint8_tlv_value}, - {NFAPI_NR_PARAM_TLV_PRACH_SHORT_FORMATS_TAG, &(pNfapiMsg->prach_param.prach_short_formats), &unpack_uint16_tlv_value}, - {NFAPI_NR_PARAM_TLV_PRACH_RESTRICTED_SETS_TAG, &(pNfapiMsg->prach_param.prach_restricted_sets), &unpack_uint8_tlv_value}, - {NFAPI_NR_PARAM_TLV_MAX_PRACH_FD_OCCASIONS_IN_A_SLOT_TAG, - &(pNfapiMsg->prach_param.max_prach_fd_occasions_in_a_slot), - &unpack_uint8_tlv_value}, - - {NFAPI_NR_PARAM_TLV_RSSI_MEASUREMENT_SUPPORT_TAG, - &(pNfapiMsg->measurement_param.rssi_measurement_support), - &unpack_uint8_tlv_value}, - // config - {NFAPI_NR_NFAPI_P7_VNF_ADDRESS_IPV4_TAG, &pNfapiMsg->nfapi_config.p7_vnf_address_ipv4, &unpack_ipv4_address_value}, - {NFAPI_NR_NFAPI_P7_VNF_ADDRESS_IPV6_TAG, &pNfapiMsg->nfapi_config.p7_vnf_address_ipv6, &unpack_ipv6_address_value}, - {NFAPI_NR_NFAPI_P7_VNF_PORT_TAG, &pNfapiMsg->nfapi_config.p7_vnf_port, &unpack_uint16_tlv_value}, - {NFAPI_NR_NFAPI_P7_PNF_ADDRESS_IPV4_TAG, &pNfapiMsg->nfapi_config.p7_pnf_address_ipv4, &unpack_ipv4_address_value}, - {NFAPI_NR_NFAPI_P7_PNF_ADDRESS_IPV6_TAG, &pNfapiMsg->nfapi_config.p7_pnf_address_ipv6, &unpack_ipv6_address_value}, - {NFAPI_NR_NFAPI_P7_PNF_PORT_TAG, &pNfapiMsg->nfapi_config.p7_pnf_port, &unpack_uint16_tlv_value}, - {NFAPI_NR_NFAPI_TIMING_WINDOW_TAG, &pNfapiMsg->nfapi_config.timing_window, &unpack_uint8_tlv_value}, - {NFAPI_NR_NFAPI_TIMING_INFO_MODE_TAG, &pNfapiMsg->nfapi_config.timing_info_mode, &unpack_uint8_tlv_value}, - {NFAPI_NR_NFAPI_TIMING_INFO_PERIOD_TAG, &pNfapiMsg->nfapi_config.timing_info_period, &unpack_uint8_tlv_value}, - }; - // print ppReadPackedMsg - uint8_t *ptr = *ppReadPackedMsg; - printf("\n Read message unpack_param_response: "); - - while (ptr < end) { - printf(" 0x%02x", *ptr); - ptr++; - } - - printf("\n"); - return (pull8(ppReadPackedMsg, &pNfapiMsg->error_code, end) && pull8(ppReadPackedMsg, &pNfapiMsg->num_tlv, end) - && unpack_nr_tlv_list(unpack_fns, - sizeof(unpack_fns) / sizeof(unpack_tlv_t), - ppReadPackedMsg, - end, - config, - &pNfapiMsg->vendor_extension)); -} static uint8_t unpack_config_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p4_p5_codec_config_t *config) { diff --git a/nfapi/tests/nr_fapi_test.h b/nfapi/tests/nr_fapi_test.h index 8f30bfb40787090386af8c9f451392807b5b5b46..3c4c67a542b7b613cb96320188dfcd8b45600c10 100644 --- a/nfapi/tests/nr_fapi_test.h +++ b/nfapi/tests/nr_fapi_test.h @@ -44,6 +44,12 @@ #include "nfapi_nr_interface.h" #include "nfapi_nr_interface_scf.h" +#define FILL_TLV(TlV, TaG, VaL) \ + do { \ + TlV.tl.tag = TaG; \ + TlV.value = VaL; \ + } while (0) + uint8_t rand8() { return (rand() & 0xff); diff --git a/nfapi/tests/p5/CMakeLists.txt b/nfapi/tests/p5/CMakeLists.txt index 7544e176a5988ab2a4c76141cf323039f9998057..bac6676dd72d45df04b86d89dcc392b64777eaea 100644 --- a/nfapi/tests/p5/CMakeLists.txt +++ b/nfapi/tests/p5/CMakeLists.txt @@ -1,5 +1,5 @@ set(Test_Labels fapi p5) -set(_fapi_p5_messages "param_request") +set(_fapi_p5_messages "param_request;param_response") foreach (fapi_p5_message IN LISTS _fapi_p5_messages) add_executable(nr_fapi_${fapi_p5_message}_test nr_fapi_${fapi_p5_message}_test.c) diff --git a/nfapi/tests/p5/nr_fapi_param_response_test.c b/nfapi/tests/p5/nr_fapi_param_response_test.c new file mode 100644 index 0000000000000000000000000000000000000000..75ca6d5e31ef0878f009038511da7caaed27062c --- /dev/null +++ b/nfapi/tests/p5/nr_fapi_param_response_test.c @@ -0,0 +1,279 @@ +/* + * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The OpenAirInterface Software Alliance licenses this file to You under + * the OAI Public License, Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.openairinterface.org/?page_id=698 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *------------------------------------------------------------------------------- + * For more information about the OpenAirInterface (OAI) Software Alliance: + * contact@openairinterface.org + */ +/*! \file nfapi/tests/p5/nr_fapi_param_response_test.c + * \brief + * \author Ruben S. Silva + * \date 2024 + * \version 0.1 + * \company OpenAirInterface Software Alliance + * \email: contact@openairinterface.org, rsilva@allbesmart.pt + * \note + * \warning + */ +#include "nfapi/tests/nr_fapi_test.h" +#include "nr_fapi_p5_utils.h" + +void fill_param_response_tlv(nfapi_nr_param_response_scf_t *nfapi_resp) +{ + nfapi_resp->error_code = rand8_range(NFAPI_MSG_OK, NFAPI_MSG_INVALID_STATE); + + FILL_TLV(nfapi_resp->cell_param.release_capability, NFAPI_NR_PARAM_TLV_RELEASE_CAPABILITY_TAG, rand16()); + nfapi_resp->num_tlv++; + + FILL_TLV(nfapi_resp->cell_param.phy_state, NFAPI_NR_PARAM_TLV_PHY_STATE_TAG, rand16()); + nfapi_resp->num_tlv++; + + FILL_TLV(nfapi_resp->cell_param.skip_blank_dl_config, NFAPI_NR_PARAM_TLV_SKIP_BLANK_DL_CONFIG_TAG, rand8()); + nfapi_resp->num_tlv++; + + FILL_TLV(nfapi_resp->cell_param.skip_blank_ul_config, NFAPI_NR_PARAM_TLV_SKIP_BLANK_UL_CONFIG_TAG, rand8()); + nfapi_resp->num_tlv++; + + FILL_TLV(nfapi_resp->cell_param.num_config_tlvs_to_report, + NFAPI_NR_PARAM_TLV_NUM_CONFIG_TLVS_TO_REPORT_TAG, + rand16_range(0, NFAPI_NR_CONFIG_RSSI_MEASUREMENT_TAG - NFAPI_NR_CONFIG_DL_BANDWIDTH_TAG)); + nfapi_resp->num_tlv++; + + nfapi_resp->cell_param.config_tlvs_to_report_list = + calloc(nfapi_resp->cell_param.num_config_tlvs_to_report.value, sizeof(nfapi_uint8_tlv_t *)); + for (int i = 0; i < nfapi_resp->cell_param.num_config_tlvs_to_report.value; ++i) { + FILL_TLV(nfapi_resp->cell_param.config_tlvs_to_report_list[i], + rand16_range(NFAPI_NR_CONFIG_DL_BANDWIDTH_TAG, NFAPI_NR_CONFIG_RSSI_MEASUREMENT_TAG), + rand8_range(0, 5)); + nfapi_resp->cell_param.config_tlvs_to_report_list[i].tl.length = 1; + } + + FILL_TLV(nfapi_resp->carrier_param.cyclic_prefix, NFAPI_NR_PARAM_TLV_CYCLIC_PREFIX_TAG, rand8()); + nfapi_resp->num_tlv++; + + FILL_TLV(nfapi_resp->carrier_param.supported_subcarrier_spacings_dl, + NFAPI_NR_PARAM_TLV_SUPPORTED_SUBCARRIER_SPACINGS_DL_TAG, + rand16()); + nfapi_resp->num_tlv++; + + FILL_TLV(nfapi_resp->carrier_param.supported_bandwidth_dl, NFAPI_NR_PARAM_TLV_SUPPORTED_BANDWIDTH_DL_TAG, rand16()); + nfapi_resp->num_tlv++; + + FILL_TLV(nfapi_resp->carrier_param.supported_subcarrier_spacings_ul, + NFAPI_NR_PARAM_TLV_SUPPORTED_SUBCARRIER_SPACINGS_UL_TAG, + rand8()); + nfapi_resp->num_tlv++; + + FILL_TLV(nfapi_resp->carrier_param.supported_bandwidth_ul, NFAPI_NR_PARAM_TLV_SUPPORTED_BANDWIDTH_UL_TAG, rand16()); + nfapi_resp->num_tlv++; + + FILL_TLV(nfapi_resp->pdcch_param.cce_mapping_type, NFAPI_NR_PARAM_TLV_CCE_MAPPING_TYPE_TAG, rand8()); + nfapi_resp->num_tlv++; + + FILL_TLV(nfapi_resp->pdcch_param.coreset_outside_first_3_of_ofdm_syms_of_slot, + NFAPI_NR_PARAM_TLV_CORESET_OUTSIDE_FIRST_3_OFDM_SYMS_OF_SLOT_TAG, + rand8()); + nfapi_resp->num_tlv++; + + FILL_TLV(nfapi_resp->pdcch_param.coreset_precoder_granularity_coreset, + NFAPI_NR_PARAM_TLV_PRECODER_GRANULARITY_CORESET_TAG, + rand8()); + nfapi_resp->num_tlv++; + + FILL_TLV(nfapi_resp->pdcch_param.pdcch_mu_mimo, NFAPI_NR_PARAM_TLV_PDCCH_MU_MIMO_TAG, rand8()); + nfapi_resp->num_tlv++; + + FILL_TLV(nfapi_resp->pdcch_param.pdcch_precoder_cycling, NFAPI_NR_PARAM_TLV_PDCCH_PRECODER_CYCLING_TAG, rand8()); + nfapi_resp->num_tlv++; + + FILL_TLV(nfapi_resp->pdcch_param.max_pdcch_per_slot, NFAPI_NR_PARAM_TLV_MAX_PDCCHS_PER_SLOT_TAG, rand8()); + nfapi_resp->num_tlv++; + + FILL_TLV(nfapi_resp->pucch_param.pucch_formats, NFAPI_NR_PARAM_TLV_PUCCH_FORMATS_TAG, rand8()); + nfapi_resp->num_tlv++; + + FILL_TLV(nfapi_resp->pucch_param.max_pucchs_per_slot, NFAPI_NR_PARAM_TLV_MAX_PUCCHS_PER_SLOT_TAG, rand8()); + nfapi_resp->num_tlv++; + + FILL_TLV(nfapi_resp->pdsch_param.pdsch_mapping_type, NFAPI_NR_PARAM_TLV_PDSCH_MAPPING_TYPE_TAG, rand8()); + nfapi_resp->num_tlv++; + + FILL_TLV(nfapi_resp->pdsch_param.pdsch_allocation_types, NFAPI_NR_PARAM_TLV_PDSCH_ALLOCATION_TYPES_TAG, rand8()); + nfapi_resp->num_tlv++; + + FILL_TLV(nfapi_resp->pdsch_param.pdsch_vrb_to_prb_mapping, NFAPI_NR_PARAM_TLV_PDSCH_VRB_TO_PRB_MAPPING_TAG, rand8()); + nfapi_resp->num_tlv++; + + FILL_TLV(nfapi_resp->pdsch_param.pdsch_cbg, NFAPI_NR_PARAM_TLV_PDSCH_CBG_TAG, rand8()); + nfapi_resp->num_tlv++; + + FILL_TLV(nfapi_resp->pdsch_param.pdsch_dmrs_config_types, NFAPI_NR_PARAM_TLV_PDSCH_DMRS_CONFIG_TYPES_TAG, rand8()); + nfapi_resp->num_tlv++; + + FILL_TLV(nfapi_resp->pdsch_param.pdsch_dmrs_max_length, NFAPI_NR_PARAM_TLV_PDSCH_DMRS_MAX_LENGTH_TAG, rand8()); + nfapi_resp->num_tlv++; + + FILL_TLV(nfapi_resp->pdsch_param.pdsch_dmrs_additional_pos, NFAPI_NR_PARAM_TLV_PDSCH_DMRS_ADDITIONAL_POS_TAG, rand8()); + nfapi_resp->num_tlv++; + + FILL_TLV(nfapi_resp->pdsch_param.max_pdsch_tbs_per_slot, NFAPI_NR_PARAM_TLV_MAX_PDSCH_S_TBS_PER_SLOT_TAG, rand8()); + nfapi_resp->num_tlv++; + + FILL_TLV(nfapi_resp->pdsch_param.max_number_mimo_layers_pdsch, NFAPI_NR_PARAM_TLV_MAX_NUMBER_MIMO_LAYERS_PDSCH_TAG, rand8()); + nfapi_resp->num_tlv++; + + FILL_TLV(nfapi_resp->pdsch_param.supported_max_modulation_order_dl, + NFAPI_NR_PARAM_TLV_SUPPORTED_MAX_MODULATION_ORDER_DL_TAG, + rand8()); + nfapi_resp->num_tlv++; + + FILL_TLV(nfapi_resp->pdsch_param.max_mu_mimo_users_dl, NFAPI_NR_PARAM_TLV_MAX_MU_MIMO_USERS_DL_TAG, rand8()); + nfapi_resp->num_tlv++; + + FILL_TLV(nfapi_resp->pdsch_param.pdsch_data_in_dmrs_symbols, NFAPI_NR_PARAM_TLV_PDSCH_DATA_IN_DMRS_SYMBOLS_TAG, rand8()); + nfapi_resp->num_tlv++; + + FILL_TLV(nfapi_resp->pdsch_param.premption_support, NFAPI_NR_PARAM_TLV_PREMPTION_SUPPORT_TAG, rand8()); + nfapi_resp->num_tlv++; + + FILL_TLV(nfapi_resp->pdsch_param.pdsch_non_slot_support, NFAPI_NR_PARAM_TLV_PDSCH_NON_SLOT_SUPPORT_TAG, rand8()); + nfapi_resp->num_tlv++; + + FILL_TLV(nfapi_resp->pusch_param.uci_mux_ulsch_in_pusch, NFAPI_NR_PARAM_TLV_UCI_MUX_ULSCH_IN_PUSCH_TAG, rand8()); + nfapi_resp->num_tlv++; + + FILL_TLV(nfapi_resp->pusch_param.uci_only_pusch, NFAPI_NR_PARAM_TLV_UCI_ONLY_PUSCH_TAG, rand8()); + nfapi_resp->num_tlv++; + + FILL_TLV(nfapi_resp->pusch_param.pusch_frequency_hopping, NFAPI_NR_PARAM_TLV_PUSCH_FREQUENCY_HOPPING_TAG, rand8()); + nfapi_resp->num_tlv++; + + FILL_TLV(nfapi_resp->pusch_param.pusch_dmrs_config_types, NFAPI_NR_PARAM_TLV_PUSCH_DMRS_CONFIG_TYPES_TAG, rand8()); + nfapi_resp->num_tlv++; + + FILL_TLV(nfapi_resp->pusch_param.pusch_dmrs_max_len, NFAPI_NR_PARAM_TLV_PUSCH_DMRS_MAX_LEN_TAG, rand8()); + nfapi_resp->num_tlv++; + + FILL_TLV(nfapi_resp->pusch_param.pusch_dmrs_additional_pos, NFAPI_NR_PARAM_TLV_PUSCH_DMRS_ADDITIONAL_POS_TAG, rand8()); + nfapi_resp->num_tlv++; + + FILL_TLV(nfapi_resp->pusch_param.pusch_cbg, NFAPI_NR_PARAM_TLV_PUSCH_CBG_TAG, rand8()); + nfapi_resp->num_tlv++; + + FILL_TLV(nfapi_resp->pusch_param.pusch_mapping_type, NFAPI_NR_PARAM_TLV_PUSCH_MAPPING_TYPE_TAG, rand8()); + nfapi_resp->num_tlv++; + + FILL_TLV(nfapi_resp->pusch_param.pusch_allocation_types, NFAPI_NR_PARAM_TLV_PUSCH_ALLOCATION_TYPES_TAG, rand8()); + nfapi_resp->num_tlv++; + + FILL_TLV(nfapi_resp->pusch_param.pusch_vrb_to_prb_mapping, NFAPI_NR_PARAM_TLV_PUSCH_VRB_TO_PRB_MAPPING_TAG, rand8()); + nfapi_resp->num_tlv++; + + FILL_TLV(nfapi_resp->pusch_param.pusch_max_ptrs_ports, NFAPI_NR_PARAM_TLV_PUSCH_MAX_PTRS_PORTS_TAG, rand8()); + nfapi_resp->num_tlv++; + + FILL_TLV(nfapi_resp->pusch_param.max_pduschs_tbs_per_slot, NFAPI_NR_PARAM_TLV_MAX_PDUSCHS_TBS_PER_SLOT_TAG, rand8()); + nfapi_resp->num_tlv++; + + FILL_TLV(nfapi_resp->pusch_param.max_number_mimo_layers_non_cb_pusch, + NFAPI_NR_PARAM_TLV_MAX_NUMBER_MIMO_LAYERS_NON_CB_PUSCH_TAG, + rand8()); + nfapi_resp->num_tlv++; + + FILL_TLV(nfapi_resp->pusch_param.supported_modulation_order_ul, NFAPI_NR_PARAM_TLV_SUPPORTED_MODULATION_ORDER_UL_TAG, rand8()); + nfapi_resp->num_tlv++; + + FILL_TLV(nfapi_resp->pusch_param.max_mu_mimo_users_ul, NFAPI_NR_PARAM_TLV_MAX_MU_MIMO_USERS_UL_TAG, rand8()); + nfapi_resp->num_tlv++; + + FILL_TLV(nfapi_resp->pusch_param.dfts_ofdm_support, NFAPI_NR_PARAM_TLV_DFTS_OFDM_SUPPORT_TAG, rand8()); + nfapi_resp->num_tlv++; + + FILL_TLV(nfapi_resp->pusch_param.pusch_aggregation_factor, NFAPI_NR_PARAM_TLV_PUSCH_AGGREGATION_FACTOR_TAG, rand8()); + nfapi_resp->num_tlv++; + + FILL_TLV(nfapi_resp->prach_param.prach_long_formats, NFAPI_NR_PARAM_TLV_PRACH_LONG_FORMATS_TAG, rand8()); + nfapi_resp->num_tlv++; + + FILL_TLV(nfapi_resp->prach_param.prach_short_formats, NFAPI_NR_PARAM_TLV_PRACH_SHORT_FORMATS_TAG, rand16()); + nfapi_resp->num_tlv++; + + FILL_TLV(nfapi_resp->prach_param.prach_restricted_sets, NFAPI_NR_PARAM_TLV_PRACH_RESTRICTED_SETS_TAG, rand8()); + nfapi_resp->num_tlv++; + + FILL_TLV(nfapi_resp->prach_param.max_prach_fd_occasions_in_a_slot, + NFAPI_NR_PARAM_TLV_MAX_PRACH_FD_OCCASIONS_IN_A_SLOT_TAG, + rand8()); + nfapi_resp->num_tlv++; + + FILL_TLV(nfapi_resp->measurement_param.rssi_measurement_support, NFAPI_NR_PARAM_TLV_RSSI_MEASUREMENT_SUPPORT_TAG, rand8()); + nfapi_resp->num_tlv++; +} + +void test_pack_unpack(nfapi_nr_param_response_scf_t *req) +{ + uint8_t msg_buf[65535]; + uint16_t msg_len = sizeof(*req); + // first test the packing procedure + int pack_result = fapi_nr_p5_message_pack(req, msg_len, msg_buf, sizeof(msg_buf), NULL); + // PARAM.response message body length is AT LEAST 10 (NFAPI_HEADER_LENGTH + 1 byte error_code + 1 byte num_tlv) + DevAssert(pack_result >= NFAPI_HEADER_LENGTH + 1 + 1); + // update req message_length value with value calculated in message_pack procedure + req->header.message_length = pack_result - NFAPI_HEADER_LENGTH; + // test the unpacking of the header + // copy first NFAPI_HEADER_LENGTH bytes into a new buffer, to simulate SCTP PEEK + nfapi_p4_p5_message_header_t header; + uint32_t header_buffer_size = NFAPI_HEADER_LENGTH; + uint8_t header_buffer[header_buffer_size]; + for (int idx = 0; idx < header_buffer_size; idx++) { + header_buffer[idx] = msg_buf[idx]; + } + uint8_t *pReadPackedMessage = header_buffer; + int unpack_header_result = fapi_nr_p5_message_header_unpack(&pReadPackedMessage, NFAPI_HEADER_LENGTH, &header, sizeof(header), 0); + DevAssert(unpack_header_result >= 0); + DevAssert(header.message_id == req->header.message_id); + DevAssert(header.message_length == req->header.message_length); + // test the unpaking and compare with initial message + nfapi_nr_param_response_scf_t unpacked_req = {0}; + int unpack_result = + fapi_nr_p5_message_unpack(msg_buf, header.message_length + NFAPI_HEADER_LENGTH, &unpacked_req, sizeof(unpacked_req), NULL); + DevAssert(unpack_result >= 0); + DevAssert(eq_param_response(&unpacked_req, req)); + free_param_response(&unpacked_req); +} + +void test_copy(const nfapi_nr_param_response_scf_t *msg) +{ + // Test copy function + nfapi_nr_param_response_scf_t copy = {0}; + copy_param_response(msg, ©); + DevAssert(eq_param_response(msg, ©)); + free_param_response(©); +} + +int main(int n, char *v[]) +{ + fapi_test_init(); + nfapi_nr_param_response_scf_t req = {.header.message_id = NFAPI_NR_PHY_MSG_TYPE_PARAM_RESPONSE}; + // Fill Param response TVLs + fill_param_response_tlv(&req); + // Perform tests + test_pack_unpack(&req); + test_copy(&req); + // All tests successful! + free_param_response(&req); + return 0; +}