From b4a3440128c92b64fdbd8166206688e9ed39c6e8 Mon Sep 17 00:00:00 2001 From: Gabriele Gemmi Date: Sun, 8 Mar 2026 00:29:31 +0000 Subject: [PATCH] Pack and send DBT to Aerial --- nfapi/oai_integration/aerial/fapi_nvIPC.c | 40 ++++++++++++++++++- nfapi/open-nFAPI/fapi/inc/nr_fapi_p5.h | 1 + nfapi/open-nFAPI/fapi/src/nr_fapi_p5.c | 18 ++++++++- .../nfapi/public_inc/nfapi_nr_interface_scf.h | 4 +- 4 files changed, 59 insertions(+), 4 deletions(-) diff --git a/nfapi/oai_integration/aerial/fapi_nvIPC.c b/nfapi/oai_integration/aerial/fapi_nvIPC.c index bbb0d66900..89f0786ec4 100644 --- a/nfapi/oai_integration/aerial/fapi_nvIPC.c +++ b/nfapi/oai_integration/aerial/fapi_nvIPC.c @@ -49,6 +49,7 @@ #include #include "fapi_nvIPC.h" #include +#include #include #include "nfapi_interface.h" #include "nfapi.h" @@ -66,6 +67,7 @@ nv_ipc_t *ipc; static nv_ipc_config_t nv_ipc_config; static int cpu_msg_buf_size = 0; static int cpu_data_buf_size = 0; +static int cpu_large_buf_size = 0; void nvIPC_Stop() { @@ -238,11 +240,21 @@ bool aerial_nr_send_p5_message(vnf_t *vnf, uint16_t p5_idx, nfapi_nr_p4_p5_messa // Create the message nv_ipc_msg_t send_msg = {.msg_id = msg->message_id, .cell_id = 0, - // For P5 we don't need CPU_DATA + // By default, P5 uses only message pool. .data_pool = NV_IPC_MEMPOOL_CPU_MSG, .data_len = 0, .data_buf = NULL}; + bool has_separate_dbt_payload = false; + nfapi_nr_config_request_scf_t *config_req = NULL; + if (msg->message_id == NFAPI_NR_PHY_MSG_TYPE_CONFIG_REQUEST) { + config_req = (nfapi_nr_config_request_scf_t *)msg; + has_separate_dbt_payload = config_req->dbt_config.num_dig_beams > 0; + if (has_separate_dbt_payload) { + send_msg.data_pool = NV_IPC_MEMPOOL_CPU_LARGE; + } + } + // Allocate the message if (!allocate_msg(&send_msg)) { return false; @@ -263,6 +275,31 @@ bool aerial_nr_send_p5_message(vnf_t *vnf, uint16_t p5_idx, nfapi_nr_p4_p5_messa } // Set the length send_msg.msg_len = packedMessageLengthFAPI + 8; // adding 8 to account for the size of the FAPI header + + if (has_separate_dbt_payload) { + AssertFatal(send_msg.data_buf != NULL, "CONFIG.request DBT path: data buffer is NULL\n"); + AssertFatal(cpu_large_buf_size > 0, "CONFIG.request DBT path: CPU_LARGE buffer size is not set\n"); + uint8_t *write_ptr = send_msg.data_buf; + uint8_t *buffer_end = send_msg.data_buf + cpu_large_buf_size; + nfapi_nr_dbt_tlv_ve_t dbt_tlv = { + .tl.tag = NFAPI_NR_CONFIG_BEAMFORMING_TABLE_TAG, + .value = config_req->dbt_config + }; + bool ok = pack_dbt_table_tlv_value(&dbt_tlv, &write_ptr, buffer_end); + if (!ok) { + LOG_E(NFAPI_VNF, "Failed to pack CONFIG.request DBT payload into separate buffer\n"); + release_msg(&send_msg); + return false; + } + send_msg.data_len = (uint32_t)(write_ptr - (uint8_t *)send_msg.data_buf); + LOG_I(NFAPI_VNF, + "CONFIG.request DBT sent in separate pool: num_beams=%u num_txrus=%u data_len=%d pool=%d\n", + config_req->dbt_config.num_dig_beams, + config_req->dbt_config.num_txrus, + send_msg.data_len, + send_msg.data_pool); + } + // Send return send_nvipc_msg(&send_msg); } else { @@ -386,6 +423,7 @@ int nvIPC_Init(nvipc_params_t nvipc_params_s) // save the mempool sizes for later use in packing cpu_msg_buf_size = nv_ipc_get_buf_size(&nv_ipc_config, NV_IPC_MEMPOOL_CPU_MSG); cpu_data_buf_size = nv_ipc_get_buf_size(&nv_ipc_config, NV_IPC_MEMPOOL_CPU_DATA); + cpu_large_buf_size = nv_ipc_get_buf_size(&nv_ipc_config, NV_IPC_MEMPOOL_CPU_LARGE); // Create nv_ipc_t instance LOG_I(NFAPI_VNF, "%s: creating IPC interface with prefix %s\n", __func__, nvipc_params_s.nvipc_shm_prefix); diff --git a/nfapi/open-nFAPI/fapi/inc/nr_fapi_p5.h b/nfapi/open-nFAPI/fapi/inc/nr_fapi_p5.h index d47f0ec929..8204f42e9f 100644 --- a/nfapi/open-nFAPI/fapi/inc/nr_fapi_p5.h +++ b/nfapi/open-nFAPI/fapi/inc/nr_fapi_p5.h @@ -54,4 +54,5 @@ uint8_t pack_nr_stop_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t * uint8_t unpack_nr_stop_indication(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p4_p5_codec_config_t *config); uint8_t pack_nr_error_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p4_p5_codec_config_t *config); uint8_t unpack_nr_error_indication(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p4_p5_codec_config_t *config); +uint8_t pack_dbt_table_tlv_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end); #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 bdd7b224ce..e6bb3814ea 100644 --- a/nfapi/open-nFAPI/fapi/src/nr_fapi_p5.c +++ b/nfapi/open-nFAPI/fapi/src/nr_fapi_p5.c @@ -721,8 +721,7 @@ uint8_t unpack_nr_param_response(uint8_t **ppReadPackedMsg, uint8_t *end, void * config, &pNfapiMsg->vendor_extension)); } -#ifndef ENABLE_AERIAL -static uint8_t pack_dbt_table_tlv_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +uint8_t pack_dbt_table_tlv_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) { nfapi_nr_dbt_tlv_ve_t *dbt_ve = (nfapi_nr_dbt_tlv_ve_t *)tlv; nfapi_nr_dbt_pdu_t *dbt_config = &dbt_ve->value; @@ -744,6 +743,7 @@ static uint8_t pack_dbt_table_tlv_value(void *tlv, uint8_t **ppWritePackedMsg, u return 1; } +#ifndef ENABLE_AERIAL static uint8_t pack_pm_table_tlv_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) { nfapi_nr_pm_tlv_ve_t *pm_ve = (nfapi_nr_pm_tlv_ve_t *)tlv; @@ -1143,6 +1143,20 @@ uint8_t pack_nr_config_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *e &pack_uint8_tlv_value); numTLVs++; // END Measurement Config + + // START Digital Beam Table (DBT) PDU + if (pNfapiMsg->dbt_config.num_dig_beams != 0) { + nfapi_nr_dbt_tlv_ve_t dbt_tlv = {.tl.tag = NFAPI_NR_CONFIG_BEAMFORMING_TABLE_TAG, .value = pNfapiMsg->dbt_config}; +#ifdef ENABLE_AERIAL + // For Aerial, DBT payload is sent in a separate nvIPC data buffer. + dbt_tlv.value.num_dig_beams = 0; + dbt_tlv.value.num_txrus = 0; +#endif + retval &= pack_nr_tlv(NFAPI_NR_CONFIG_BEAMFORMING_TABLE_TAG, &dbt_tlv, ppWritePackedMsg, end, &pack_dbt_table_tlv_value); + numTLVs++; + } + // END Digital Beam Table (DBT) PDU + #ifdef ENABLE_AERIAL retval &= pack_nr_tlv(NFAPI_NR_CONFIG_NUM_TX_PORT_TAG, &(pNfapiMsg->carrier_config.num_tx_port), diff --git a/nfapi/open-nFAPI/nfapi/public_inc/nfapi_nr_interface_scf.h b/nfapi/open-nFAPI/nfapi/public_inc/nfapi_nr_interface_scf.h index 5ffff64de4..ab7c678ea4 100644 --- a/nfapi/open-nFAPI/nfapi/public_inc/nfapi_nr_interface_scf.h +++ b/nfapi/open-nFAPI/nfapi/public_inc/nfapi_nr_interface_scf.h @@ -330,11 +330,13 @@ typedef struct #define NFAPI_NR_CONFIG_RSSI_MEASUREMENT_TAG 0x1028 #define NFAPI_NR_CONFIG_TDD_TABLE 0x1035 -#define NFAPI_NR_CONFIG_BEAMFORMING_TABLE_TAG 0x1043 // This tag was added in version 5 of the SCF222 standard ( Table 3-50 of SCF222.10.05 ) #define NFAPI_NR_CONFIG_PRECODING_TABLE_V6_TAG 0x104B // This tag was added in version 6 of the SCF222 standard ( Table 3-52 of SCF222.10.06 ) #ifdef ENABLE_AERIAL #define NFAPI_NR_CONFIG_NUM_TX_PORT_TAG 0xA016 #define NFAPI_NR_CONFIG_NUM_RX_PORT_TAG 0xA017 + #define NFAPI_NR_CONFIG_BEAMFORMING_TABLE_TAG 0xA010 +#else + #define NFAPI_NR_CONFIG_BEAMFORMING_TABLE_TAG 0x1043 // This tag was added in version 5 of the SCF222 standard ( Table 3-50 of SCF222.10.05 ) #endif //table 3-21