Pack and send DBT to Aerial

This commit is contained in:
Gabriele Gemmi
2026-03-08 00:29:31 +00:00
parent d448e99e64
commit b4a3440128
4 changed files with 59 additions and 4 deletions

View File

@@ -49,6 +49,7 @@
#include <sys/epoll.h>
#include "fapi_nvIPC.h"
#include <nfapi_vnf.h>
#include <nr_fapi_p5.h>
#include <nr_fapi_p7_utils.h>
#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);

View File

@@ -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

View File

@@ -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),

View File

@@ -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