Merge remote-tracking branch 'origin/aerial-cleanup' into integration_2024_w41
This commit is contained in:
@@ -54,7 +54,8 @@ RUN /bin/sh oaienv && \
|
|||||||
RUN /bin/sh oaienv && \
|
RUN /bin/sh oaienv && \
|
||||||
cd cmake_targets && \
|
cd cmake_targets && \
|
||||||
mkdir -p log && \
|
mkdir -p log && \
|
||||||
./build_oai -w AERIAL --gNB --ninja
|
./build_oai -c -w AERIAL --gNB --ninja \
|
||||||
|
--cmake-opt -DCMAKE_C_FLAGS="-Werror" --cmake-opt -DCMAKE_CXX_FLAGS="-Werror"
|
||||||
|
|
||||||
|
|
||||||
#start from scratch for target executable
|
#start from scratch for target executable
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ if (OAI_AERIAL)
|
|||||||
else ()
|
else ()
|
||||||
message(STATUS " nvlog library found in ${NVLOG_LIB}")
|
message(STATUS " nvlog library found in ${NVLOG_LIB}")
|
||||||
endif ()
|
endif ()
|
||||||
target_compile_definitions(aerial_lib PUBLIC ENABLE_L2_SLT_RSP ENABLE_AERIAL)
|
target_compile_definitions(aerial_lib PUBLIC ENABLE_L2_SLT_RSP)
|
||||||
target_link_libraries(aerial_lib PRIVATE asn1_lte_rrc_hdrs asn1_nr_rrc_hdrs)
|
target_link_libraries(aerial_lib PRIVATE asn1_lte_rrc_hdrs asn1_nr_rrc_hdrs)
|
||||||
target_link_libraries(aerial_lib PRIVATE nr_fapi_p5)
|
target_link_libraries(aerial_lib PRIVATE nr_fapi_p5)
|
||||||
target_link_libraries(aerial_lib PRIVATE "${NVLOG_LIB}" "${NVIPC_LIB}")
|
target_link_libraries(aerial_lib PRIVATE "${NVLOG_LIB}" "${NVIPC_LIB}")
|
||||||
|
|||||||
@@ -29,7 +29,7 @@
|
|||||||
* \note
|
* \note
|
||||||
* \warning
|
* \warning
|
||||||
*/
|
*/
|
||||||
#ifdef ENABLE_AERIAL
|
|
||||||
#define _GNU_SOURCE
|
#define _GNU_SOURCE
|
||||||
#include <sched.h>
|
#include <sched.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
@@ -79,39 +79,8 @@ static int ipc_handle_rx_msg(nv_ipc_t *ipc, nv_ipc_msg_t *msg)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *p_cpu_data = NULL;
|
uint8_t *pReadPackedMessage = msg->msg_buf;
|
||||||
if (msg->data_buf != NULL) {
|
uint8_t *end = msg->msg_buf + msg->msg_len;
|
||||||
int gpu;
|
|
||||||
if (msg->data_pool == NV_IPC_MEMPOOL_CUDA_DATA) {
|
|
||||||
gpu = 1;
|
|
||||||
} else {
|
|
||||||
gpu = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef NVIPC_CUDA_ENABLE
|
|
||||||
// Test CUDA: call CUDA functions to change all string to lower case
|
|
||||||
test_cuda_to_lower_case(test_cuda_device_id, msg->data_buf, TEST_DATA_BUF_LEN, gpu);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (gpu) {
|
|
||||||
p_cpu_data = cpu_buf_recv;
|
|
||||||
memset(cpu_buf_recv, 0, RECV_BUF_LEN);
|
|
||||||
ipc->cuda_memcpy_to_host(ipc, p_cpu_data, msg->data_buf, RECV_BUF_LEN);
|
|
||||||
} else {
|
|
||||||
p_cpu_data = msg->data_buf;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int messageBufLen = msg->msg_len;
|
|
||||||
int dataBufLen = msg->data_len;
|
|
||||||
uint8_t msgbuf[messageBufLen];
|
|
||||||
uint8_t databuf[dataBufLen];
|
|
||||||
memcpy(msgbuf, msg->msg_buf, messageBufLen);
|
|
||||||
memcpy(databuf, msg->data_buf, dataBufLen);
|
|
||||||
uint8_t *pReadPackedMessage = msgbuf;
|
|
||||||
uint8_t *pReadData = databuf;
|
|
||||||
uint8_t *end = msgbuf + messageBufLen;
|
|
||||||
uint8_t *data_end = databuf + dataBufLen;
|
|
||||||
|
|
||||||
// unpack FAPI messages and handle them
|
// unpack FAPI messages and handle them
|
||||||
if (vnf_config != 0) {
|
if (vnf_config != 0) {
|
||||||
@@ -209,6 +178,9 @@ static int ipc_handle_rx_msg(nv_ipc_t *ipc, nv_ipc_msg_t *msg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
case NFAPI_NR_PHY_MSG_TYPE_RX_DATA_INDICATION: {
|
case NFAPI_NR_PHY_MSG_TYPE_RX_DATA_INDICATION: {
|
||||||
|
uint8_t *pReadData = msg->data_buf;
|
||||||
|
int dataBufLen = msg->data_len;
|
||||||
|
uint8_t *data_end = msg->data_buf + dataBufLen;
|
||||||
nfapi_nr_rx_data_indication_t ind;
|
nfapi_nr_rx_data_indication_t ind;
|
||||||
ind.header.message_id = fapi_msg.message_id;
|
ind.header.message_id = fapi_msg.message_id;
|
||||||
ind.header.message_length = fapi_msg.message_length;
|
ind.header.message_length = fapi_msg.message_length;
|
||||||
@@ -652,11 +624,7 @@ int load_hard_code_config(nv_ipc_config_t *config, int module_type, nv_ipc_trans
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef NVIPC_CUDA_ENABLE
|
|
||||||
int test_cuda_device_id = get_cuda_device_id();
|
|
||||||
#else
|
|
||||||
int test_cuda_device_id = -1;
|
int test_cuda_device_id = -1;
|
||||||
#endif
|
|
||||||
LOG_D(NFAPI_VNF,"CUDA device ID configured : %d \n", test_cuda_device_id);
|
LOG_D(NFAPI_VNF,"CUDA device ID configured : %d \n", test_cuda_device_id);
|
||||||
config->transport_config.shm.cuda_device_id = test_cuda_device_id;
|
config->transport_config.shm.cuda_device_id = test_cuda_device_id;
|
||||||
if (test_cuda_device_id >= 0) {
|
if (test_cuda_device_id >= 0) {
|
||||||
@@ -686,4 +654,3 @@ int nvIPC_Init(nvipc_params_t nvipc_params_s)
|
|||||||
aerial_pnf_nr_connection_indication_cb(vnf_config, 1);
|
aerial_pnf_nr_connection_indication_cb(vnf_config, 1);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|||||||
@@ -29,7 +29,6 @@
|
|||||||
* \note
|
* \note
|
||||||
* \warning
|
* \warning
|
||||||
*/
|
*/
|
||||||
#ifdef ENABLE_AERIAL
|
|
||||||
#ifndef OPENAIRINTERFACE_FAPI_NVIPC_H
|
#ifndef OPENAIRINTERFACE_FAPI_NVIPC_H
|
||||||
#define OPENAIRINTERFACE_FAPI_NVIPC_H
|
#define OPENAIRINTERFACE_FAPI_NVIPC_H
|
||||||
|
|
||||||
@@ -37,9 +36,10 @@
|
|||||||
#include "nv_ipc_utils.h"
|
#include "nv_ipc_utils.h"
|
||||||
#include "nvlog.h"
|
#include "nvlog.h"
|
||||||
#include "nfapi/open-nFAPI/vnf/public_inc/nfapi_vnf_interface.h"
|
#include "nfapi/open-nFAPI/vnf/public_inc/nfapi_vnf_interface.h"
|
||||||
#include "openair1/PHY/defs_gNB.h"
|
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
|
|
||||||
|
#include "openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h"
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
uint8_t num_msg;
|
uint8_t num_msg;
|
||||||
uint8_t opaque_handle;
|
uint8_t opaque_handle;
|
||||||
@@ -55,7 +55,6 @@ int aerial_send_P7_msg_with_data(void *packedBuf,
|
|||||||
uint32_t dataLength,
|
uint32_t dataLength,
|
||||||
nfapi_p7_message_header_t *header);
|
nfapi_p7_message_header_t *header);
|
||||||
void set_config(nfapi_vnf_config_t *conf);
|
void set_config(nfapi_vnf_config_t *conf);
|
||||||
int nvIPC_Init(nvipc_params_t);
|
int nvIPC_Init(nvipc_params_t nvipc_params_s);
|
||||||
|
|
||||||
#endif // OPENAIRINTERFACE_FAPI_NVIPC_H
|
#endif // OPENAIRINTERFACE_FAPI_NVIPC_H
|
||||||
#endif
|
|
||||||
|
|||||||
@@ -29,7 +29,7 @@
|
|||||||
* \note
|
* \note
|
||||||
* \warning
|
* \warning
|
||||||
*/
|
*/
|
||||||
#ifdef ENABLE_AERIAL
|
|
||||||
#include "fapi_vnf_p5.h"
|
#include "fapi_vnf_p5.h"
|
||||||
#include "fapi_vnf_p7.h"
|
#include "fapi_vnf_p7.h"
|
||||||
#include "nfapi/open-nFAPI/vnf/inc/vnf_p7.h"
|
#include "nfapi/open-nFAPI/vnf/inc/vnf_p7.h"
|
||||||
@@ -53,19 +53,19 @@ void *aerial_vnf_nr_p7_config_init(void *ptr)
|
|||||||
init_queue(&gnb_slot_ind_queue);
|
init_queue(&gnb_slot_ind_queue);
|
||||||
|
|
||||||
p7_vnf->config->port = p7_vnf->local_port;
|
p7_vnf->config->port = p7_vnf->local_port;
|
||||||
p7_vnf->config->sync_indication = &aerial_phy_sync_indication;
|
p7_vnf->config->sync_indication = NULL;
|
||||||
p7_vnf->config->slot_indication = &aerial_phy_slot_indication;
|
p7_vnf->config->slot_indication = NULL;
|
||||||
p7_vnf->config->harq_indication = &aerial_phy_harq_indication;
|
p7_vnf->config->harq_indication = NULL;
|
||||||
p7_vnf->config->nr_crc_indication = &aerial_phy_nr_crc_indication;
|
p7_vnf->config->nr_crc_indication = &aerial_phy_nr_crc_indication;
|
||||||
p7_vnf->config->nr_rx_data_indication = &aerial_phy_nr_rx_data_indication;
|
p7_vnf->config->nr_rx_data_indication = &aerial_phy_nr_rx_data_indication;
|
||||||
p7_vnf->config->nr_rach_indication = &aerial_phy_nr_rach_indication;
|
p7_vnf->config->nr_rach_indication = &aerial_phy_nr_rach_indication;
|
||||||
p7_vnf->config->nr_uci_indication = &aerial_phy_nr_uci_indication;
|
p7_vnf->config->nr_uci_indication = &aerial_phy_nr_uci_indication;
|
||||||
p7_vnf->config->srs_indication = &aerial_phy_srs_indication;
|
p7_vnf->config->srs_indication = NULL;
|
||||||
p7_vnf->config->sr_indication = &aerial_phy_sr_indication;
|
p7_vnf->config->sr_indication = NULL;
|
||||||
p7_vnf->config->cqi_indication = &aerial_phy_cqi_indication;
|
p7_vnf->config->cqi_indication = NULL;
|
||||||
p7_vnf->config->lbt_dl_indication = &aerial_phy_lbt_dl_indication;
|
p7_vnf->config->lbt_dl_indication = NULL;
|
||||||
p7_vnf->config->nb_harq_indication = &aerial_phy_nb_harq_indication;
|
p7_vnf->config->nb_harq_indication = NULL;
|
||||||
p7_vnf->config->nrach_indication = &aerial_phy_nrach_indication;
|
p7_vnf->config->nrach_indication = NULL;
|
||||||
p7_vnf->config->nr_slot_indication = &aerial_phy_nr_slot_indication;
|
p7_vnf->config->nr_slot_indication = &aerial_phy_nr_slot_indication;
|
||||||
p7_vnf->config->nr_srs_indication = &aerial_phy_nr_srs_indication;
|
p7_vnf->config->nr_srs_indication = &aerial_phy_nr_srs_indication;
|
||||||
p7_vnf->config->malloc = &aerial_vnf_allocate;
|
p7_vnf->config->malloc = &aerial_vnf_allocate;
|
||||||
@@ -283,7 +283,7 @@ int aerial_nr_send_config_request(nfapi_vnf_config_t *config, int p5_idx)
|
|||||||
pnf_info *pnf = vnf->pnfs;
|
pnf_info *pnf = vnf->pnfs;
|
||||||
phy_info *phy = pnf->phys;
|
phy_info *phy = pnf->phys;
|
||||||
|
|
||||||
nfapi_nr_config_request_scf_t *req = &RC.nrmac[0]->config[0]; //&RC.gNB[0]->gNB_config; // check
|
nfapi_nr_config_request_scf_t *req = &RC.nrmac[0]->config[0];
|
||||||
|
|
||||||
NFAPI_TRACE(NFAPI_TRACE_INFO,
|
NFAPI_TRACE(NFAPI_TRACE_INFO,
|
||||||
"[VNF] %d.%d pnf p7 %s:%d timing %u %u %u %u\n",
|
"[VNF] %d.%d pnf p7 %s:%d timing %u %u %u %u\n",
|
||||||
@@ -617,4 +617,3 @@ int oai_fapi_send_end_request(int cell, uint32_t frame, uint32_t slot){
|
|||||||
}
|
}
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|||||||
@@ -29,7 +29,7 @@
|
|||||||
* \note
|
* \note
|
||||||
* \warning
|
* \warning
|
||||||
*/
|
*/
|
||||||
#ifdef ENABLE_AERIAL
|
|
||||||
#ifndef OPENAIRINTERFACE_FAPI_VNF_P5_H
|
#ifndef OPENAIRINTERFACE_FAPI_VNF_P5_H
|
||||||
#define OPENAIRINTERFACE_FAPI_VNF_P5_H
|
#define OPENAIRINTERFACE_FAPI_VNF_P5_H
|
||||||
#define _GNU_SOURCE
|
#define _GNU_SOURCE
|
||||||
@@ -70,4 +70,3 @@ int oai_fapi_ul_dci_req(nfapi_nr_ul_dci_request_t *ul_dci_req);
|
|||||||
int oai_fapi_tx_data_req(nfapi_nr_tx_data_request_t *tx_data_req);
|
int oai_fapi_tx_data_req(nfapi_nr_tx_data_request_t *tx_data_req);
|
||||||
int oai_fapi_dl_tti_req(nfapi_nr_dl_tti_request_t *dl_config_req);
|
int oai_fapi_dl_tti_req(nfapi_nr_dl_tti_request_t *dl_config_req);
|
||||||
#endif //OPENAIRINTERFACE_FAPI_VNF_P5_H
|
#endif //OPENAIRINTERFACE_FAPI_VNF_P5_H
|
||||||
#endif
|
|
||||||
|
|||||||
@@ -29,414 +29,148 @@
|
|||||||
* \note
|
* \note
|
||||||
* \warning
|
* \warning
|
||||||
*/
|
*/
|
||||||
#ifdef ENABLE_AERIAL
|
|
||||||
#include "fapi_vnf_p7.h"
|
#include "fapi_vnf_p7.h"
|
||||||
#include "nr_nfapi_p7.h"
|
#include "nr_nfapi_p7.h"
|
||||||
|
|
||||||
extern RAN_CONTEXT_t RC;
|
#include "openair2/LAYER2/NR_MAC_gNB/mac_proto.h" // for handle_nr_srs_measurements()
|
||||||
extern UL_RCC_IND_t UL_RCC_INFO;
|
|
||||||
extern uint16_t sf_ahead;
|
|
||||||
|
|
||||||
int aerial_wake_gNB_rxtx(PHY_VARS_gNB *gNB, uint16_t sfn, uint16_t slot)
|
|
||||||
{
|
|
||||||
struct timespec curr_t;
|
|
||||||
clock_gettime(CLOCK_MONOTONIC, &curr_t);
|
|
||||||
// NFAPI_TRACE(NFAPI_TRACE_INFO, "\n wake_gNB_rxtx before assignment sfn:%d slot:%d TIME
|
|
||||||
// %d.%d",sfn,slot,curr_t.tv_sec,curr_t.tv_nsec);
|
|
||||||
gNB_L1_proc_t *proc = &gNB->proc;
|
|
||||||
gNB_L1_rxtx_proc_t *L1_proc = (slot & 1) ? &proc->L1_proc : &proc->L1_proc_tx;
|
|
||||||
|
|
||||||
NR_DL_FRAME_PARMS *fp = &gNB->frame_parms;
|
|
||||||
// NFAPI_TRACE(NFAPI_TRACE_INFO, "%s(eNB:%p, sfn:%d, sf:%d)\n", __FUNCTION__, eNB, sfn, sf);
|
|
||||||
// int i;
|
|
||||||
struct timespec wait;
|
|
||||||
clock_gettime(CLOCK_REALTIME, &wait);
|
|
||||||
wait.tv_sec = 0;
|
|
||||||
wait.tv_nsec += 5000L;
|
|
||||||
// wait.tv_nsec = 0;
|
|
||||||
// wake up TX for subframe n+sf_ahead
|
|
||||||
// lock the TX mutex and make sure the thread is ready
|
|
||||||
if (pthread_mutex_timedlock(&L1_proc->mutex, &wait) != 0) {
|
|
||||||
LOG_E(PHY, "[gNB] ERROR pthread_mutex_lock for gNB RXTX thread %d (IC %d)\n", L1_proc->slot_rx & 1, L1_proc->instance_cnt);
|
|
||||||
exit_fun("error locking mutex_rxtx");
|
|
||||||
return (-1);
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
static uint16_t old_slot = 0;
|
|
||||||
static uint16_t old_sfn = 0;
|
|
||||||
proc->slot_rx = old_slot;
|
|
||||||
proc->frame_rx = old_sfn;
|
|
||||||
// Try to be 1 frame back
|
|
||||||
old_slot = slot;
|
|
||||||
old_sfn = sfn;
|
|
||||||
// NFAPI_TRACE(NFAPI_TRACE_INFO, "\n wake_gNB_rxtx after assignment sfn:%d slot:%d",proc->frame_rx,proc->slot_rx);
|
|
||||||
if (old_slot == 0 && old_sfn % 100 == 0)
|
|
||||||
LOG_W(PHY,
|
|
||||||
"[gNB] sfn/slot:%d%d old_sfn/slot:%d%d proc[rx:%d%d]\n",
|
|
||||||
sfn,
|
|
||||||
slot,
|
|
||||||
old_sfn,
|
|
||||||
old_slot,
|
|
||||||
proc->frame_rx,
|
|
||||||
proc->slot_rx);
|
|
||||||
}
|
|
||||||
|
|
||||||
++L1_proc->instance_cnt;
|
|
||||||
// LOG_D( PHY,"[VNF-subframe_ind] sfn/sf:%d:%d proc[frame_rx:%d subframe_rx:%d] L1_proc->instance_cnt_rxtx:%d \n", sfn, sf,
|
|
||||||
// proc->frame_rx, proc->subframe_rx, L1_proc->instance_cnt_rxtx);
|
|
||||||
// We have just received and processed the common part of a subframe, say n.
|
|
||||||
// TS_rx is the last received timestamp (start of 1st slot), TS_tx is the desired
|
|
||||||
// transmitted timestamp of the next TX slot (first).
|
|
||||||
// The last (TS_rx mod samples_per_frame) was n*samples_per_tti,
|
|
||||||
// we want to generate subframe (n+N), so TS_tx = TX_rx+N*samples_per_tti,
|
|
||||||
// and proc->subframe_tx = proc->subframe_rx+sf_ahead
|
|
||||||
L1_proc->timestamp_tx = proc->timestamp_rx + (gNB->if_inst->sl_ahead * fp->samples_per_subframe);
|
|
||||||
L1_proc->frame_rx = proc->frame_rx;
|
|
||||||
L1_proc->slot_rx = proc->slot_rx;
|
|
||||||
L1_proc->frame_tx = (L1_proc->slot_rx > (19 - gNB->if_inst->sl_ahead)) ? (L1_proc->frame_rx + 1) & 1023 : L1_proc->frame_rx;
|
|
||||||
L1_proc->slot_tx = (L1_proc->slot_rx + gNB->if_inst->sl_ahead) % 20;
|
|
||||||
|
|
||||||
// LOG_I(PHY, "sfn/sf:%d%d proc[rx:%d%d] rx:%d%d] About to wake rxtx thread\n\n", sfn, slot, proc->frame_rx, proc->slot_rx,
|
|
||||||
// L1_proc->frame_rx, L1_proc->slot_rx); NFAPI_TRACE(NFAPI_TRACE_INFO, "\nEntering wake_gNB_rxtx sfn %d slot
|
|
||||||
// %d\n",L1_proc->frame_rx,L1_proc->slot_rx);
|
|
||||||
// the thread can now be woken up
|
|
||||||
if (pthread_cond_signal(&L1_proc->cond) != 0) {
|
|
||||||
LOG_E(PHY, "[gNB] ERROR pthread_cond_signal for gNB RXn-TXnp4 thread\n");
|
|
||||||
exit_fun("ERROR pthread_clond_signal");
|
|
||||||
return (-1);
|
|
||||||
}
|
|
||||||
|
|
||||||
// LOG_D(PHY,"%s() About to attempt pthread_mutex_unlock\n", __FUNCTION__);
|
|
||||||
pthread_mutex_unlock(&L1_proc->mutex);
|
|
||||||
// LOG_D(PHY,"%s() UNLOCKED pthread_mutex_unlock\n", __FUNCTION__);
|
|
||||||
return (0);
|
|
||||||
}
|
|
||||||
|
|
||||||
int aerialwake_eNB_rxtx(PHY_VARS_eNB *eNB, uint16_t sfn, uint16_t sf)
|
|
||||||
{
|
|
||||||
L1_proc_t *proc = &eNB->proc;
|
|
||||||
L1_rxtx_proc_t *L1_proc = (sf & 1) ? &proc->L1_proc : &proc->L1_proc_tx;
|
|
||||||
LTE_DL_FRAME_PARMS *fp = &eNB->frame_parms;
|
|
||||||
// NFAPI_TRACE(NFAPI_TRACE_INFO, "%s(eNB:%p, sfn:%d, sf:%d)\n", __FUNCTION__, eNB, sfn, sf);
|
|
||||||
// int i;
|
|
||||||
struct timespec wait;
|
|
||||||
wait.tv_sec = 0;
|
|
||||||
wait.tv_nsec = 5000000L;
|
|
||||||
|
|
||||||
// wake up TX for subframe n+sf_ahead
|
|
||||||
// lock the TX mutex and make sure the thread is ready
|
|
||||||
// if (pthread_mutex_timedlock(&L1_proc->mutex,&wait) != 0) {
|
|
||||||
// LOG_E( PHY, "[eNB] ERROR pthread_mutex_lock for eNB RXTX thread %d (IC %d)\n", L1_proc->subframe_rx&1,L1_proc->instance_cnt );
|
|
||||||
// exit_fun( "error locking mutex_rxtx" );
|
|
||||||
// return(-1);
|
|
||||||
//}
|
|
||||||
|
|
||||||
{
|
|
||||||
static uint16_t old_sf = 0;
|
|
||||||
static uint16_t old_sfn = 0;
|
|
||||||
proc->subframe_rx = old_sf;
|
|
||||||
proc->frame_rx = old_sfn;
|
|
||||||
// Try to be 1 frame back
|
|
||||||
old_sf = sf;
|
|
||||||
old_sfn = sfn;
|
|
||||||
|
|
||||||
if (old_sf == 0 && old_sfn % 100 == 0)
|
|
||||||
LOG_D(PHY, "[eNB] sfn/sf:%d%d old_sfn/sf:%d%d proc[rx:%d%d]\n", sfn, sf, old_sfn, old_sf, proc->frame_rx, proc->subframe_rx);
|
|
||||||
}
|
|
||||||
// wake up TX for subframe n+sf_ahead
|
|
||||||
// lock the TX mutex and make sure the thread is ready
|
|
||||||
if (pthread_mutex_timedlock(&L1_proc->mutex, &wait) != 0) {
|
|
||||||
LOG_E(PHY, "[eNB] ERROR pthread_mutex_lock for eNB RXTX thread %d (IC %d)\n", L1_proc->subframe_rx & 1, L1_proc->instance_cnt);
|
|
||||||
// exit_fun( "error locking mutex_rxtx" );
|
|
||||||
return (-1);
|
|
||||||
}
|
|
||||||
static int busy_log_cnt = 0;
|
|
||||||
if (L1_proc->instance_cnt < 0) {
|
|
||||||
++L1_proc->instance_cnt;
|
|
||||||
if (busy_log_cnt != 0) {
|
|
||||||
LOG_E(MAC,
|
|
||||||
"RCC singal to rxtx frame %d subframe %d busy end %d (frame %d subframe %d)\n",
|
|
||||||
L1_proc->frame_rx,
|
|
||||||
L1_proc->subframe_rx,
|
|
||||||
busy_log_cnt,
|
|
||||||
proc->frame_rx,
|
|
||||||
proc->subframe_rx);
|
|
||||||
}
|
|
||||||
busy_log_cnt = 0;
|
|
||||||
} else {
|
|
||||||
if (busy_log_cnt == 0) {
|
|
||||||
LOG_E(MAC,
|
|
||||||
"RCC singal to rxtx frame %d subframe %d busy %d (frame %d subframe %d)\n",
|
|
||||||
L1_proc->frame_rx,
|
|
||||||
L1_proc->subframe_rx,
|
|
||||||
L1_proc->instance_cnt,
|
|
||||||
proc->frame_rx,
|
|
||||||
proc->subframe_rx);
|
|
||||||
}
|
|
||||||
pthread_mutex_unlock(&L1_proc->mutex);
|
|
||||||
busy_log_cnt++;
|
|
||||||
return (0);
|
|
||||||
}
|
|
||||||
|
|
||||||
pthread_mutex_unlock(&L1_proc->mutex);
|
|
||||||
|
|
||||||
// LOG_D( PHY,"[VNF-subframe_ind] sfn/sf:%d:%d proc[frame_rx:%d subframe_rx:%d] L1_proc->instance_cnt_rxtx:%d \n", sfn, sf,
|
|
||||||
// proc->frame_rx, proc->subframe_rx, L1_proc->instance_cnt_rxtx);
|
|
||||||
// We have just received and processed the common part of a subframe, say n.
|
|
||||||
// TS_rx is the last received timestamp (start of 1st slot), TS_tx is the desired
|
|
||||||
// transmitted timestamp of the next TX slot (first).
|
|
||||||
// The last (TS_rx mod samples_per_frame) was n*samples_per_tti,
|
|
||||||
// we want to generate subframe (n+N), so TS_tx = TX_rx+N*samples_per_tti,
|
|
||||||
// and proc->subframe_tx = proc->subframe_rx+sf_ahead
|
|
||||||
L1_proc->timestamp_tx = proc->timestamp_rx + (sf_ahead * fp->samples_per_tti);
|
|
||||||
L1_proc->frame_rx = proc->frame_rx;
|
|
||||||
L1_proc->subframe_rx = proc->subframe_rx;
|
|
||||||
L1_proc->frame_tx = (L1_proc->subframe_rx > (9 - sf_ahead)) ? (L1_proc->frame_rx + 1) & 1023 : L1_proc->frame_rx;
|
|
||||||
L1_proc->subframe_tx = (L1_proc->subframe_rx + sf_ahead) % 10;
|
|
||||||
|
|
||||||
// LOG_D(PHY, "sfn/sf:%d%d proc[rx:%d%d] L1_proc[instance_cnt_rxtx:%d rx:%d%d] About to wake rxtx thread\n\n", sfn, sf,
|
|
||||||
// proc->frame_rx, proc->subframe_rx, L1_proc->instance_cnt_rxtx, L1_proc->frame_rx, L1_proc->subframe_rx);
|
|
||||||
|
|
||||||
// the thread can now be woken up
|
|
||||||
if (pthread_cond_signal(&L1_proc->cond) != 0) {
|
|
||||||
LOG_E(PHY, "[eNB] ERROR pthread_cond_signal for eNB RXn-TXnp4 thread\n");
|
|
||||||
exit_fun("ERROR pthread_cond_signal");
|
|
||||||
return (-1);
|
|
||||||
}
|
|
||||||
|
|
||||||
return (0);
|
|
||||||
}
|
|
||||||
|
|
||||||
extern pthread_cond_t nfapi_sync_cond;
|
extern pthread_cond_t nfapi_sync_cond;
|
||||||
extern pthread_mutex_t nfapi_sync_mutex;
|
extern pthread_mutex_t nfapi_sync_mutex;
|
||||||
extern int nfapi_sync_var;
|
extern int nfapi_sync_var;
|
||||||
|
|
||||||
int aerial_phy_sync_indication(struct nfapi_vnf_p7_config *config, uint8_t sync)
|
|
||||||
{
|
|
||||||
// NFAPI_TRACE(NFAPI_TRACE_INFO, "[VNF] SYNC %s\n", sync==1 ? "ACHIEVED" : "LOST");
|
|
||||||
|
|
||||||
if (sync == 1 && nfapi_sync_var != 0) {
|
|
||||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "[VNF] Signal to OAI main code that it can go\n");
|
|
||||||
pthread_mutex_lock(&nfapi_sync_mutex);
|
|
||||||
nfapi_sync_var = 0;
|
|
||||||
pthread_cond_broadcast(&nfapi_sync_cond);
|
|
||||||
pthread_mutex_unlock(&nfapi_sync_mutex);
|
|
||||||
}
|
|
||||||
|
|
||||||
return (0);
|
|
||||||
}
|
|
||||||
|
|
||||||
int aerial_phy_slot_indication(struct nfapi_vnf_p7_config *config, uint16_t phy_id, uint16_t sfn, uint16_t slot)
|
|
||||||
{
|
|
||||||
static uint8_t first_time = 1;
|
|
||||||
|
|
||||||
if (first_time) {
|
|
||||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "[VNF] slot indication %d\n", NFAPI_SFNSLOT2DEC(sfn, slot));
|
|
||||||
first_time = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (RC.gNB && RC.gNB[0]->configured) {
|
|
||||||
// uint16_t sfn = NFAPI_SFNSF2SFN(sfn_sf);
|
|
||||||
// uint16_t sf = NFAPI_SFNSF2SF(sfn_sf);
|
|
||||||
LOG_D(PHY, "[VNF] slot indication sfn:%d slot:%d\n", sfn, slot);
|
|
||||||
aerial_wake_gNB_rxtx(RC.gNB[0], sfn, slot); // DONE: find NR equivalent
|
|
||||||
} else {
|
|
||||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "[VNF] %s() RC.gNB:%p\n", __FUNCTION__, RC.gNB);
|
|
||||||
|
|
||||||
if (RC.gNB)
|
|
||||||
NFAPI_TRACE(NFAPI_TRACE_INFO, "RC.gNB[0]->configured:%d\n", RC.gNB[0]->configured);
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int aerial_phy_harq_indication(struct nfapi_vnf_p7_config *config, nfapi_harq_indication_t *ind)
|
|
||||||
{
|
|
||||||
struct PHY_VARS_eNB_s *eNB = RC.eNB[0][0];
|
|
||||||
LOG_D(MAC,
|
|
||||||
"%s() NFAPI SFN/SF:%d number_of_harqs:%u\n",
|
|
||||||
__FUNCTION__,
|
|
||||||
NFAPI_SFNSF2DEC(ind->sfn_sf),
|
|
||||||
ind->harq_indication_body.number_of_harqs);
|
|
||||||
AssertFatal(pthread_mutex_lock(&eNB->UL_INFO_mutex) == 0, "Mutex lock failed");
|
|
||||||
if (NFAPI_MODE == NFAPI_MODE_VNF) {
|
|
||||||
int8_t index = NFAPI_SFNSF2SF(ind->sfn_sf);
|
|
||||||
|
|
||||||
UL_RCC_INFO.harq_ind[index] = *ind;
|
|
||||||
|
|
||||||
assert(ind->harq_indication_body.number_of_harqs <= NFAPI_HARQ_IND_MAX_PDU);
|
|
||||||
if (ind->harq_indication_body.number_of_harqs > 0) {
|
|
||||||
UL_RCC_INFO.harq_ind[index].harq_indication_body.harq_pdu_list =
|
|
||||||
malloc(sizeof(nfapi_harq_indication_pdu_t) * NFAPI_HARQ_IND_MAX_PDU);
|
|
||||||
}
|
|
||||||
for (int i = 0; i < ind->harq_indication_body.number_of_harqs; i++) {
|
|
||||||
memcpy(&UL_RCC_INFO.harq_ind[index].harq_indication_body.harq_pdu_list[i],
|
|
||||||
&ind->harq_indication_body.harq_pdu_list[i],
|
|
||||||
sizeof(nfapi_harq_indication_pdu_t));
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
eNB->UL_INFO.harq_ind = *ind;
|
|
||||||
eNB->UL_INFO.harq_ind.harq_indication_body.harq_pdu_list = eNB->harq_pdu_list;
|
|
||||||
|
|
||||||
assert(ind->harq_indication_body.number_of_harqs <= NFAPI_HARQ_IND_MAX_PDU);
|
|
||||||
for (int i = 0; i < ind->harq_indication_body.number_of_harqs; i++) {
|
|
||||||
memcpy(&eNB->UL_INFO.harq_ind.harq_indication_body.harq_pdu_list[i],
|
|
||||||
&ind->harq_indication_body.harq_pdu_list[i],
|
|
||||||
sizeof(eNB->UL_INFO.harq_ind.harq_indication_body.harq_pdu_list[i]));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
AssertFatal(pthread_mutex_unlock(&eNB->UL_INFO_mutex) == 0, "Mutex unlock failed");
|
|
||||||
// vnf_p7_info* p7_vnf = (vnf_p7_info*)(config->user_data);
|
|
||||||
// mac_harq_ind(p7_vnf->mac, ind);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
int aerial_phy_nr_crc_indication(nfapi_nr_crc_indication_t *ind)
|
int aerial_phy_nr_crc_indication(nfapi_nr_crc_indication_t *ind)
|
||||||
{
|
{
|
||||||
if (NFAPI_MODE == NFAPI_MODE_AERIAL) {
|
nfapi_nr_crc_indication_t *crc_ind = CALLOC(1, sizeof(*crc_ind));
|
||||||
nfapi_nr_crc_indication_t *crc_ind = CALLOC(1, sizeof(*crc_ind));
|
crc_ind->header.message_id = ind->header.message_id;
|
||||||
crc_ind->header.message_id = ind->header.message_id;
|
crc_ind->number_crcs = ind->number_crcs;
|
||||||
crc_ind->number_crcs = ind->number_crcs;
|
crc_ind->sfn = ind->sfn;
|
||||||
crc_ind->sfn = ind->sfn;
|
crc_ind->slot = ind->slot;
|
||||||
crc_ind->slot = ind->slot;
|
if (ind->number_crcs > 0) {
|
||||||
if (ind->number_crcs > 0) {
|
crc_ind->crc_list = CALLOC(NFAPI_NR_CRC_IND_MAX_PDU, sizeof(nfapi_nr_crc_t));
|
||||||
crc_ind->crc_list = CALLOC(NFAPI_NR_CRC_IND_MAX_PDU, sizeof(nfapi_nr_crc_t));
|
AssertFatal(crc_ind->crc_list != NULL, "Memory not allocated for crc_ind->crc_list in phy_nr_crc_indication.");
|
||||||
AssertFatal(crc_ind->crc_list != NULL, "Memory not allocated for crc_ind->crc_list in phy_nr_crc_indication.");
|
}
|
||||||
|
for (int j = 0; j < ind->number_crcs; j++) {
|
||||||
|
crc_ind->crc_list[j].handle = ind->crc_list[j].handle;
|
||||||
|
crc_ind->crc_list[j].rnti = ind->crc_list[j].rnti;
|
||||||
|
crc_ind->crc_list[j].harq_id = ind->crc_list[j].harq_id;
|
||||||
|
crc_ind->crc_list[j].tb_crc_status = ind->crc_list[j].tb_crc_status;
|
||||||
|
crc_ind->crc_list[j].num_cb = ind->crc_list[j].num_cb;
|
||||||
|
crc_ind->crc_list[j].cb_crc_status = ind->crc_list[j].cb_crc_status;
|
||||||
|
crc_ind->crc_list[j].ul_cqi = ind->crc_list[j].ul_cqi;
|
||||||
|
crc_ind->crc_list[j].timing_advance = ind->crc_list[j].timing_advance;
|
||||||
|
crc_ind->crc_list[j].rssi = ind->crc_list[j].rssi;
|
||||||
|
if (crc_ind->crc_list[j].tb_crc_status != 0) {
|
||||||
|
LOG_D(NR_MAC,
|
||||||
|
"Received crc_ind.harq_id %d status %d for index %d SFN SLot %u %u with rnti %04x\n",
|
||||||
|
crc_ind->crc_list[j].harq_id,
|
||||||
|
crc_ind->crc_list[j].tb_crc_status,
|
||||||
|
j,
|
||||||
|
crc_ind->sfn,
|
||||||
|
crc_ind->slot,
|
||||||
|
crc_ind->crc_list[j].rnti);
|
||||||
}
|
}
|
||||||
for (int j = 0; j < ind->number_crcs; j++) {
|
}
|
||||||
crc_ind->crc_list[j].handle = ind->crc_list[j].handle;
|
if (!put_queue(&gnb_crc_ind_queue, crc_ind)) {
|
||||||
crc_ind->crc_list[j].rnti = ind->crc_list[j].rnti;
|
LOG_E(NR_MAC, "Put_queue failed for crc_ind\n");
|
||||||
crc_ind->crc_list[j].harq_id = ind->crc_list[j].harq_id;
|
free(crc_ind->crc_list);
|
||||||
crc_ind->crc_list[j].tb_crc_status = ind->crc_list[j].tb_crc_status;
|
free(crc_ind);
|
||||||
crc_ind->crc_list[j].num_cb = ind->crc_list[j].num_cb;
|
|
||||||
crc_ind->crc_list[j].cb_crc_status = ind->crc_list[j].cb_crc_status;
|
|
||||||
crc_ind->crc_list[j].ul_cqi = ind->crc_list[j].ul_cqi;
|
|
||||||
crc_ind->crc_list[j].timing_advance = ind->crc_list[j].timing_advance;
|
|
||||||
crc_ind->crc_list[j].rssi = ind->crc_list[j].rssi;
|
|
||||||
if (crc_ind->crc_list[j].tb_crc_status != 0) {
|
|
||||||
LOG_D(NR_MAC,
|
|
||||||
"Received crc_ind.harq_id %d status %d for index %d SFN SLot %u %u with rnti %04x\n",
|
|
||||||
crc_ind->crc_list[j].harq_id,
|
|
||||||
crc_ind->crc_list[j].tb_crc_status,
|
|
||||||
j,
|
|
||||||
crc_ind->sfn,
|
|
||||||
crc_ind->slot,
|
|
||||||
crc_ind->crc_list[j].rnti);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!put_queue(&gnb_crc_ind_queue, crc_ind)) {
|
|
||||||
LOG_E(NR_MAC, "Put_queue failed for crc_ind\n");
|
|
||||||
free(crc_ind->crc_list);
|
|
||||||
free(crc_ind);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
LOG_E(NR_MAC, "NFAPI_MODE = %d not NFAPI_MODE_AERIAL(3)\n", nfapi_getmode());
|
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int aerial_phy_nr_rx_data_indication(nfapi_nr_rx_data_indication_t *ind)
|
int aerial_phy_nr_rx_data_indication(nfapi_nr_rx_data_indication_t *ind)
|
||||||
{
|
{
|
||||||
if (NFAPI_MODE == NFAPI_MODE_AERIAL) {
|
nfapi_nr_rx_data_indication_t *rx_ind = CALLOC(1, sizeof(*rx_ind));
|
||||||
nfapi_nr_rx_data_indication_t *rx_ind = CALLOC(1, sizeof(*rx_ind));
|
rx_ind->header.message_id = ind->header.message_id;
|
||||||
rx_ind->header.message_id = ind->header.message_id;
|
rx_ind->sfn = ind->sfn;
|
||||||
rx_ind->sfn = ind->sfn;
|
rx_ind->slot = ind->slot;
|
||||||
rx_ind->slot = ind->slot;
|
rx_ind->number_of_pdus = ind->number_of_pdus;
|
||||||
rx_ind->number_of_pdus = ind->number_of_pdus;
|
|
||||||
|
|
||||||
if (ind->number_of_pdus > 0) {
|
if (ind->number_of_pdus > 0) {
|
||||||
rx_ind->pdu_list = CALLOC(NFAPI_NR_RX_DATA_IND_MAX_PDU, sizeof(nfapi_nr_rx_data_pdu_t));
|
rx_ind->pdu_list = CALLOC(NFAPI_NR_RX_DATA_IND_MAX_PDU, sizeof(nfapi_nr_rx_data_pdu_t));
|
||||||
AssertFatal(rx_ind->pdu_list != NULL, "Memory not allocated for rx_ind->pdu_list in phy_nr_rx_data_indication.");
|
AssertFatal(rx_ind->pdu_list != NULL, "Memory not allocated for rx_ind->pdu_list in phy_nr_rx_data_indication.");
|
||||||
}
|
}
|
||||||
for (int j = 0; j < ind->number_of_pdus; j++) {
|
for (int j = 0; j < ind->number_of_pdus; j++) {
|
||||||
rx_ind->pdu_list[j].handle = ind->pdu_list[j].handle;
|
rx_ind->pdu_list[j].handle = ind->pdu_list[j].handle;
|
||||||
rx_ind->pdu_list[j].rnti = ind->pdu_list[j].rnti;
|
rx_ind->pdu_list[j].rnti = ind->pdu_list[j].rnti;
|
||||||
rx_ind->pdu_list[j].harq_id = ind->pdu_list[j].harq_id;
|
rx_ind->pdu_list[j].harq_id = ind->pdu_list[j].harq_id;
|
||||||
rx_ind->pdu_list[j].pdu_length = ind->pdu_list[j].pdu_length;
|
rx_ind->pdu_list[j].pdu_length = ind->pdu_list[j].pdu_length;
|
||||||
rx_ind->pdu_list[j].ul_cqi = ind->pdu_list[j].ul_cqi;
|
rx_ind->pdu_list[j].ul_cqi = ind->pdu_list[j].ul_cqi;
|
||||||
rx_ind->pdu_list[j].timing_advance = ind->pdu_list[j].timing_advance;
|
rx_ind->pdu_list[j].timing_advance = ind->pdu_list[j].timing_advance;
|
||||||
rx_ind->pdu_list[j].rssi = ind->pdu_list[j].rssi;
|
rx_ind->pdu_list[j].rssi = ind->pdu_list[j].rssi;
|
||||||
|
// Only copy PDU data if there's any to copy
|
||||||
|
if (rx_ind->pdu_list[j].pdu_length > 0) {
|
||||||
rx_ind->pdu_list[j].pdu = calloc(rx_ind->pdu_list[j].pdu_length, sizeof(uint8_t));
|
rx_ind->pdu_list[j].pdu = calloc(rx_ind->pdu_list[j].pdu_length, sizeof(uint8_t));
|
||||||
memcpy(rx_ind->pdu_list[j].pdu,ind->pdu_list[j].pdu,ind->pdu_list[j].pdu_length);
|
memcpy(rx_ind->pdu_list[j].pdu, ind->pdu_list[j].pdu, ind->pdu_list[j].pdu_length);
|
||||||
LOG_D(NR_MAC,
|
|
||||||
"(%d.%d) Handle %d for index %d, RNTI, %04x, HARQID %d\n",
|
|
||||||
ind->sfn,
|
|
||||||
ind->slot,
|
|
||||||
ind->pdu_list[j].handle,
|
|
||||||
j,
|
|
||||||
ind->pdu_list[j].rnti,
|
|
||||||
ind->pdu_list[j].harq_id);
|
|
||||||
}
|
}
|
||||||
if (!put_queue(&gnb_rx_ind_queue, rx_ind)) {
|
LOG_D(NR_MAC,
|
||||||
LOG_E(NR_MAC, "Put_queue failed for rx_ind\n");
|
"(%d.%d) Handle %d for index %d, RNTI, %04x, HARQID %d\n",
|
||||||
free(rx_ind->pdu_list);
|
ind->sfn,
|
||||||
free(rx_ind);
|
ind->slot,
|
||||||
}
|
ind->pdu_list[j].handle,
|
||||||
} else {
|
j,
|
||||||
LOG_E(NR_MAC, "NFAPI_MODE = %d not NFAPI_MODE_AERIAL(3)\n", nfapi_getmode());
|
ind->pdu_list[j].rnti,
|
||||||
|
ind->pdu_list[j].harq_id);
|
||||||
|
}
|
||||||
|
if (!put_queue(&gnb_rx_ind_queue, rx_ind)) {
|
||||||
|
LOG_E(NR_MAC, "Put_queue failed for rx_ind\n");
|
||||||
|
free(rx_ind->pdu_list);
|
||||||
|
free(rx_ind);
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int aerial_phy_nr_rach_indication(nfapi_nr_rach_indication_t *ind)
|
int aerial_phy_nr_rach_indication(nfapi_nr_rach_indication_t *ind)
|
||||||
{
|
{
|
||||||
if (NFAPI_MODE == NFAPI_MODE_AERIAL) {
|
nfapi_nr_rach_indication_t *rach_ind = CALLOC(1, sizeof(*rach_ind));
|
||||||
nfapi_nr_rach_indication_t *rach_ind = CALLOC(1, sizeof(*rach_ind));
|
rach_ind->header.message_id = ind->header.message_id;
|
||||||
rach_ind->header.message_id = ind->header.message_id;
|
rach_ind->sfn = ind->sfn;
|
||||||
rach_ind->sfn = ind->sfn;
|
rach_ind->slot = ind->slot;
|
||||||
rach_ind->slot = ind->slot;
|
rach_ind->number_of_pdus = ind->number_of_pdus;
|
||||||
rach_ind->number_of_pdus = ind->number_of_pdus;
|
rach_ind->pdu_list = CALLOC(rach_ind->number_of_pdus, sizeof(*rach_ind->pdu_list));
|
||||||
rach_ind->pdu_list = CALLOC(rach_ind->number_of_pdus, sizeof(*rach_ind->pdu_list));
|
AssertFatal(rach_ind->pdu_list != NULL, "Memory not allocated for rach_ind->pdu_list in phy_nr_rach_indication.");
|
||||||
AssertFatal(rach_ind->pdu_list != NULL, "Memory not allocated for rach_ind->pdu_list in phy_nr_rach_indication.");
|
for (int i = 0; i < ind->number_of_pdus; i++) {
|
||||||
for (int i = 0; i < ind->number_of_pdus; i++) {
|
rach_ind->pdu_list[i].phy_cell_id = ind->pdu_list[i].phy_cell_id;
|
||||||
rach_ind->pdu_list[i].phy_cell_id = ind->pdu_list[i].phy_cell_id;
|
rach_ind->pdu_list[i].symbol_index = ind->pdu_list[i].symbol_index;
|
||||||
rach_ind->pdu_list[i].symbol_index = ind->pdu_list[i].symbol_index;
|
rach_ind->pdu_list[i].slot_index = ind->pdu_list[i].slot_index;
|
||||||
rach_ind->pdu_list[i].slot_index = ind->pdu_list[i].slot_index;
|
rach_ind->pdu_list[i].freq_index = ind->pdu_list[i].freq_index;
|
||||||
rach_ind->pdu_list[i].freq_index = ind->pdu_list[i].freq_index;
|
rach_ind->pdu_list[i].avg_rssi = ind->pdu_list[i].avg_rssi;
|
||||||
rach_ind->pdu_list[i].avg_rssi = ind->pdu_list[i].avg_rssi;
|
rach_ind->pdu_list[i].avg_snr = ind->pdu_list[i].avg_snr;
|
||||||
rach_ind->pdu_list[i].avg_snr = ind->pdu_list[i].avg_snr;
|
rach_ind->pdu_list[i].num_preamble = ind->pdu_list[i].num_preamble;
|
||||||
rach_ind->pdu_list[i].num_preamble = ind->pdu_list[i].num_preamble;
|
for (int j = 0; j < ind->pdu_list[i].num_preamble; j++) {
|
||||||
for (int j = 0; j < ind->pdu_list[i].num_preamble; j++) {
|
rach_ind->pdu_list[i].preamble_list[j].preamble_index = ind->pdu_list[i].preamble_list[j].preamble_index;
|
||||||
rach_ind->pdu_list[i].preamble_list[j].preamble_index = ind->pdu_list[i].preamble_list[j].preamble_index;
|
rach_ind->pdu_list[i].preamble_list[j].timing_advance = ind->pdu_list[i].preamble_list[j].timing_advance;
|
||||||
rach_ind->pdu_list[i].preamble_list[j].timing_advance = ind->pdu_list[i].preamble_list[j].timing_advance;
|
rach_ind->pdu_list[i].preamble_list[j].preamble_pwr = ind->pdu_list[i].preamble_list[j].preamble_pwr;
|
||||||
rach_ind->pdu_list[i].preamble_list[j].preamble_pwr = ind->pdu_list[i].preamble_list[j].preamble_pwr;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!put_queue(&gnb_rach_ind_queue, rach_ind)) {
|
|
||||||
LOG_E(NR_MAC, "Put_queue failed for rach_ind\n");
|
|
||||||
for (int i = 0; i < ind->number_of_pdus; i++) {
|
|
||||||
free(rach_ind->pdu_list[i].preamble_list);
|
|
||||||
}
|
|
||||||
free(rach_ind->pdu_list);
|
|
||||||
free(rach_ind);
|
|
||||||
} else {
|
|
||||||
LOG_I(NR_MAC, "RACH.indication put_queue successfull\n");
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
if (!put_queue(&gnb_rach_ind_queue, rach_ind)) {
|
||||||
|
LOG_E(NR_MAC, "Put_queue failed for rach_ind\n");
|
||||||
|
free(rach_ind->pdu_list);
|
||||||
|
free(rach_ind);
|
||||||
} else {
|
} else {
|
||||||
LOG_E(NR_MAC, "NFAPI_MODE = %d not NFAPI_MODE_AERIAL(3)\n", nfapi_getmode());
|
LOG_I(NR_MAC, "RACH.indication put_queue successfull\n");
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int aerial_phy_nr_uci_indication(nfapi_nr_uci_indication_t *ind)
|
int aerial_phy_nr_uci_indication(nfapi_nr_uci_indication_t *ind)
|
||||||
{
|
{
|
||||||
if (NFAPI_MODE == NFAPI_MODE_AERIAL) {
|
nfapi_nr_uci_indication_t *uci_ind = CALLOC(1, sizeof(*uci_ind));
|
||||||
nfapi_nr_uci_indication_t *uci_ind = CALLOC(1, sizeof(*uci_ind));
|
AssertFatal(uci_ind, "Memory not allocated for uci_ind in phy_nr_uci_indication.");
|
||||||
AssertFatal(uci_ind, "Memory not allocated for uci_ind in phy_nr_uci_indication.");
|
*uci_ind = *ind;
|
||||||
*uci_ind = *ind;
|
|
||||||
|
|
||||||
uci_ind->uci_list = CALLOC(NFAPI_NR_UCI_IND_MAX_PDU, sizeof(nfapi_nr_uci_t));
|
uci_ind->uci_list = CALLOC(NFAPI_NR_UCI_IND_MAX_PDU, sizeof(nfapi_nr_uci_t));
|
||||||
AssertFatal(uci_ind->uci_list != NULL, "Memory not allocated for uci_ind->uci_list in phy_nr_uci_indication.");
|
AssertFatal(uci_ind->uci_list != NULL, "Memory not allocated for uci_ind->uci_list in phy_nr_uci_indication.");
|
||||||
for (int i = 0; i < ind->num_ucis; i++) {
|
for (int i = 0; i < ind->num_ucis; i++) {
|
||||||
uci_ind->uci_list[i] = ind->uci_list[i];
|
uci_ind->uci_list[i] = ind->uci_list[i];
|
||||||
|
|
||||||
switch (uci_ind->uci_list[i].pdu_type) {
|
switch (uci_ind->uci_list[i].pdu_type) {
|
||||||
case NFAPI_NR_UCI_PUSCH_PDU_TYPE:
|
case NFAPI_NR_UCI_PUSCH_PDU_TYPE:
|
||||||
LOG_E(MAC, "%s(): unhandled NFAPI_NR_UCI_PUSCH_PDU_TYPE\n", __func__);
|
LOG_E(MAC, "%s(): unhandled NFAPI_NR_UCI_PUSCH_PDU_TYPE\n", __func__);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NFAPI_NR_UCI_FORMAT_0_1_PDU_TYPE: {
|
case NFAPI_NR_UCI_FORMAT_0_1_PDU_TYPE: {
|
||||||
// nfapi_nr_uci_pucch_pdu_format_0_1_t *uci_ind_pdu = &uci_ind->uci_list[i].pucch_pdu_format_0_1;
|
// nfapi_nr_uci_pucch_pdu_format_0_1_t *uci_ind_pdu = &uci_ind->uci_list[i].pucch_pdu_format_0_1;
|
||||||
// nfapi_nr_uci_pucch_pdu_format_0_1_t *ind_pdu = &ind->uci_list[i].pucch_pdu_format_0_1;
|
// nfapi_nr_uci_pucch_pdu_format_0_1_t *ind_pdu = &ind->uci_list[i].pucch_pdu_format_0_1;
|
||||||
// if (ind_pdu->sr) {
|
// if (ind_pdu->sr) {
|
||||||
@@ -455,49 +189,49 @@ int aerial_phy_nr_uci_indication(nfapi_nr_uci_indication_t *ind)
|
|||||||
// for (int j = 0; j < uci_ind_pdu->harq->num_harq; j++)
|
// for (int j = 0; j < uci_ind_pdu->harq->num_harq; j++)
|
||||||
// uci_ind_pdu->harq->harq_list[j].harq_value = ind_pdu->harq->harq_list[j].harq_value;
|
// uci_ind_pdu->harq->harq_list[j].harq_value = ind_pdu->harq->harq_list[j].harq_value;
|
||||||
// }
|
// }
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case NFAPI_NR_UCI_FORMAT_2_3_4_PDU_TYPE: {
|
case NFAPI_NR_UCI_FORMAT_2_3_4_PDU_TYPE: {
|
||||||
nfapi_nr_uci_pucch_pdu_format_2_3_4_t *uci_ind_pdu = &uci_ind->uci_list[i].pucch_pdu_format_2_3_4;
|
nfapi_nr_uci_pucch_pdu_format_2_3_4_t *uci_ind_pdu = &uci_ind->uci_list[i].pucch_pdu_format_2_3_4;
|
||||||
nfapi_nr_uci_pucch_pdu_format_2_3_4_t *ind_pdu = &ind->uci_list[i].pucch_pdu_format_2_3_4;
|
nfapi_nr_uci_pucch_pdu_format_2_3_4_t *ind_pdu = &ind->uci_list[i].pucch_pdu_format_2_3_4;
|
||||||
*uci_ind_pdu = *ind_pdu;
|
*uci_ind_pdu = *ind_pdu;
|
||||||
if (ind_pdu->harq.harq_payload) {
|
if (ind_pdu->harq.harq_payload) {
|
||||||
uci_ind_pdu->harq.harq_payload = CALLOC(1, sizeof(*uci_ind_pdu->harq.harq_payload));
|
uci_ind_pdu->harq.harq_payload = CALLOC(1, sizeof(*uci_ind_pdu->harq.harq_payload));
|
||||||
AssertFatal(uci_ind_pdu->harq.harq_payload != NULL,
|
AssertFatal(uci_ind_pdu->harq.harq_payload != NULL,
|
||||||
"Memory not allocated for uci_ind_pdu->harq.harq_payload in phy_nr_uci_indication.");
|
"Memory not allocated for uci_ind_pdu->harq.harq_payload in phy_nr_uci_indication.");
|
||||||
*uci_ind_pdu->harq.harq_payload = *ind_pdu->harq.harq_payload;
|
*uci_ind_pdu->harq.harq_payload = *ind_pdu->harq.harq_payload;
|
||||||
}
|
|
||||||
if (ind_pdu->sr.sr_payload) {
|
|
||||||
uci_ind_pdu->sr.sr_payload = CALLOC(1, sizeof(*uci_ind_pdu->sr.sr_payload));
|
|
||||||
AssertFatal(uci_ind_pdu->sr.sr_payload != NULL,
|
|
||||||
"Memory not allocated for uci_ind_pdu->sr.sr_payload in phy_nr_uci_indication.");
|
|
||||||
//SCF222.10.02 sr_bit_len values from 1 to 8, payload always just one byte
|
|
||||||
uci_ind_pdu->sr.sr_payload[0] = ind_pdu->sr.sr_payload[0];
|
|
||||||
}
|
|
||||||
if (ind_pdu->csi_part1.csi_part1_payload) {
|
|
||||||
uint8_t byte_len = (ind_pdu->csi_part1.csi_part1_bit_len / 8) + 1;
|
|
||||||
uci_ind_pdu->csi_part1.csi_part1_payload = calloc(byte_len, sizeof(uint8_t));
|
|
||||||
AssertFatal(uci_ind_pdu->csi_part1.csi_part1_payload != NULL,
|
|
||||||
"Memory not allocated for uci_ind_pdu->csi_part1.csi_part1_payload in phy_nr_uci_indication.");
|
|
||||||
memcpy(uci_ind_pdu->csi_part1.csi_part1_payload,ind_pdu->csi_part1.csi_part1_payload,byte_len);
|
|
||||||
}
|
|
||||||
if (ind_pdu->csi_part2.csi_part2_payload) {
|
|
||||||
uint8_t byte_len = (ind_pdu->csi_part2.csi_part2_bit_len / 8) + 1;
|
|
||||||
uci_ind_pdu->csi_part2.csi_part2_payload = calloc(byte_len, sizeof(uint8_t));
|
|
||||||
AssertFatal(uci_ind_pdu->csi_part2.csi_part2_payload != NULL,
|
|
||||||
"Memory not allocated for uci_ind_pdu->csi_part2.csi_part2_payload in phy_nr_uci_indication.");
|
|
||||||
memcpy(uci_ind_pdu->csi_part2.csi_part2_payload,ind_pdu->csi_part2.csi_part2_payload,byte_len);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
if (ind_pdu->sr.sr_payload) {
|
||||||
|
uci_ind_pdu->sr.sr_payload = CALLOC(1, sizeof(*uci_ind_pdu->sr.sr_payload));
|
||||||
|
AssertFatal(uci_ind_pdu->sr.sr_payload != NULL,
|
||||||
|
"Memory not allocated for uci_ind_pdu->sr.sr_payload in phy_nr_uci_indication.");
|
||||||
|
//SCF222.10.02 sr_bit_len values from 1 to 8, payload always just one byte
|
||||||
|
uci_ind_pdu->sr.sr_payload[0] = ind_pdu->sr.sr_payload[0];
|
||||||
|
}
|
||||||
|
if (ind_pdu->csi_part1.csi_part1_payload) {
|
||||||
|
uint8_t byte_len = (ind_pdu->csi_part1.csi_part1_bit_len / 8) + 1;
|
||||||
|
uci_ind_pdu->csi_part1.csi_part1_payload = calloc(byte_len, sizeof(uint8_t));
|
||||||
|
AssertFatal(uci_ind_pdu->csi_part1.csi_part1_payload != NULL,
|
||||||
|
"Memory not allocated for uci_ind_pdu->csi_part1.csi_part1_payload in phy_nr_uci_indication.");
|
||||||
|
memcpy(uci_ind_pdu->csi_part1.csi_part1_payload,ind_pdu->csi_part1.csi_part1_payload,byte_len);
|
||||||
|
}
|
||||||
|
if (ind_pdu->csi_part2.csi_part2_payload) {
|
||||||
|
uint8_t byte_len = (ind_pdu->csi_part2.csi_part2_bit_len / 8) + 1;
|
||||||
|
uci_ind_pdu->csi_part2.csi_part2_payload = calloc(byte_len, sizeof(uint8_t));
|
||||||
|
AssertFatal(uci_ind_pdu->csi_part2.csi_part2_payload != NULL,
|
||||||
|
"Memory not allocated for uci_ind_pdu->csi_part2.csi_part2_payload in phy_nr_uci_indication.");
|
||||||
|
memcpy(uci_ind_pdu->csi_part2.csi_part2_payload,ind_pdu->csi_part2.csi_part2_payload,byte_len);
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!put_queue(&gnb_uci_ind_queue, uci_ind)) {
|
if (!put_queue(&gnb_uci_ind_queue, uci_ind)) {
|
||||||
LOG_E(NR_MAC, "Put_queue failed for uci_ind\n");
|
LOG_E(NR_MAC, "Put_queue failed for uci_ind\n");
|
||||||
for (int i = 0; i < ind->num_ucis; i++) {
|
for (int i = 0; i < ind->num_ucis; i++) {
|
||||||
if (uci_ind->uci_list[i].pdu_type == NFAPI_NR_UCI_FORMAT_0_1_PDU_TYPE) {
|
if (uci_ind->uci_list[i].pdu_type == NFAPI_NR_UCI_FORMAT_0_1_PDU_TYPE) {
|
||||||
// if (uci_ind->uci_list[i].pucch_pdu_format_0_1.harq) {
|
// if (uci_ind->uci_list[i].pucch_pdu_format_0_1.harq) {
|
||||||
// free(uci_ind->uci_list[i].pucch_pdu_format_0_1.harq->harq_list);
|
// free(uci_ind->uci_list[i].pucch_pdu_format_0_1.harq->harq_list);
|
||||||
// uci_ind->uci_list[i].pucch_pdu_format_0_1.harq->harq_list = NULL;
|
// uci_ind->uci_list[i].pucch_pdu_format_0_1.harq->harq_list = NULL;
|
||||||
@@ -508,210 +242,21 @@ int aerial_phy_nr_uci_indication(nfapi_nr_uci_indication_t *ind)
|
|||||||
// free(uci_ind->uci_list[i].pucch_pdu_format_0_1.sr);
|
// free(uci_ind->uci_list[i].pucch_pdu_format_0_1.sr);
|
||||||
// uci_ind->uci_list[i].pucch_pdu_format_0_1.sr = NULL;
|
// uci_ind->uci_list[i].pucch_pdu_format_0_1.sr = NULL;
|
||||||
// }
|
// }
|
||||||
}
|
|
||||||
if (uci_ind->uci_list[i].pdu_type == NFAPI_NR_UCI_FORMAT_2_3_4_PDU_TYPE) {
|
|
||||||
free(uci_ind->uci_list[i].pucch_pdu_format_2_3_4.harq.harq_payload);
|
|
||||||
free(uci_ind->uci_list[i].pucch_pdu_format_2_3_4.csi_part1.csi_part1_payload);
|
|
||||||
free(uci_ind->uci_list[i].pucch_pdu_format_2_3_4.csi_part2.csi_part2_payload);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
free(uci_ind->uci_list);
|
if (uci_ind->uci_list[i].pdu_type == NFAPI_NR_UCI_FORMAT_2_3_4_PDU_TYPE) {
|
||||||
uci_ind->uci_list = NULL;
|
free(uci_ind->uci_list[i].pucch_pdu_format_2_3_4.harq.harq_payload);
|
||||||
free(uci_ind);
|
free(uci_ind->uci_list[i].pucch_pdu_format_2_3_4.csi_part1.csi_part1_payload);
|
||||||
uci_ind = NULL;
|
free(uci_ind->uci_list[i].pucch_pdu_format_2_3_4.csi_part2.csi_part2_payload);
|
||||||
}
|
|
||||||
} else {
|
|
||||||
LOG_E(NR_MAC, "NFAPI_MODE = %d not NFAPI_MODE_AERIAL(3)\n", nfapi_getmode());
|
|
||||||
}
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
int aerial_phy_srs_indication(struct nfapi_vnf_p7_config *config, nfapi_srs_indication_t *ind)
|
|
||||||
{
|
|
||||||
// vnf_p7_info* p7_vnf = (vnf_p7_info*)(config->user_data);
|
|
||||||
// mac_srs_ind(p7_vnf->mac, ind);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
int aerial_phy_sr_indication(struct nfapi_vnf_p7_config *config, nfapi_sr_indication_t *ind)
|
|
||||||
{
|
|
||||||
struct PHY_VARS_eNB_s *eNB = RC.eNB[0][0];
|
|
||||||
LOG_D(MAC, "%s() NFAPI SFN/SF:%d srs:%d\n", __FUNCTION__, NFAPI_SFNSF2DEC(ind->sfn_sf), ind->sr_indication_body.number_of_srs);
|
|
||||||
AssertFatal(pthread_mutex_lock(&eNB->UL_INFO_mutex) == 0, "Mutex lock failed");
|
|
||||||
if (NFAPI_MODE == NFAPI_MODE_VNF) {
|
|
||||||
int8_t index = NFAPI_SFNSF2SF(ind->sfn_sf);
|
|
||||||
|
|
||||||
UL_RCC_INFO.sr_ind[index] = *ind;
|
|
||||||
LOG_D(MAC,
|
|
||||||
"%s() UL_INFO[%d].sr_ind.sr_indication_body.number_of_srs:%d\n",
|
|
||||||
__FUNCTION__,
|
|
||||||
index,
|
|
||||||
eNB->UL_INFO.sr_ind.sr_indication_body.number_of_srs);
|
|
||||||
if (ind->sr_indication_body.number_of_srs > 0) {
|
|
||||||
assert(ind->sr_indication_body.number_of_srs <= NFAPI_SR_IND_MAX_PDU);
|
|
||||||
UL_RCC_INFO.sr_ind[index].sr_indication_body.sr_pdu_list = malloc(sizeof(nfapi_sr_indication_pdu_t) * NFAPI_SR_IND_MAX_PDU);
|
|
||||||
}
|
|
||||||
|
|
||||||
assert(ind->sr_indication_body.number_of_srs <= NFAPI_SR_IND_MAX_PDU);
|
|
||||||
for (int i = 0; i < ind->sr_indication_body.number_of_srs; i++) {
|
|
||||||
nfapi_sr_indication_pdu_t *dest_pdu = &UL_RCC_INFO.sr_ind[index].sr_indication_body.sr_pdu_list[i];
|
|
||||||
nfapi_sr_indication_pdu_t *src_pdu = &ind->sr_indication_body.sr_pdu_list[i];
|
|
||||||
|
|
||||||
LOG_D(MAC,
|
|
||||||
"SR_IND[PDU:%d %d][rnti:%x cqi:%d channel:%d]\n",
|
|
||||||
index,
|
|
||||||
i,
|
|
||||||
src_pdu->rx_ue_information.rnti,
|
|
||||||
src_pdu->ul_cqi_information.ul_cqi,
|
|
||||||
src_pdu->ul_cqi_information.channel);
|
|
||||||
|
|
||||||
memcpy(dest_pdu, src_pdu, sizeof(*src_pdu));
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
nfapi_sr_indication_t *dest_ind = &eNB->UL_INFO.sr_ind;
|
|
||||||
nfapi_sr_indication_pdu_t *dest_pdu_list = eNB->sr_pdu_list;
|
|
||||||
*dest_ind = *ind;
|
|
||||||
dest_ind->sr_indication_body.sr_pdu_list = dest_pdu_list;
|
|
||||||
LOG_D(MAC,
|
|
||||||
"%s() eNB->UL_INFO.sr_ind.sr_indication_body.number_of_srs:%d\n",
|
|
||||||
__FUNCTION__,
|
|
||||||
eNB->UL_INFO.sr_ind.sr_indication_body.number_of_srs);
|
|
||||||
|
|
||||||
assert(eNB->UL_INFO.sr_ind.sr_indication_body.number_of_srs <= NFAPI_SR_IND_MAX_PDU);
|
|
||||||
for (int i = 0; i < eNB->UL_INFO.sr_ind.sr_indication_body.number_of_srs; i++) {
|
|
||||||
nfapi_sr_indication_pdu_t *dest_pdu = &dest_ind->sr_indication_body.sr_pdu_list[i];
|
|
||||||
nfapi_sr_indication_pdu_t *src_pdu = &ind->sr_indication_body.sr_pdu_list[i];
|
|
||||||
LOG_D(MAC,
|
|
||||||
"SR_IND[PDU:%d][rnti:%x cqi:%d channel:%d]\n",
|
|
||||||
i,
|
|
||||||
src_pdu->rx_ue_information.rnti,
|
|
||||||
src_pdu->ul_cqi_information.ul_cqi,
|
|
||||||
src_pdu->ul_cqi_information.channel);
|
|
||||||
memcpy(dest_pdu, src_pdu, sizeof(*src_pdu));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
AssertFatal(pthread_mutex_unlock(&eNB->UL_INFO_mutex) == 0, "Mutex unlock failed");
|
|
||||||
// vnf_p7_info* p7_vnf = (vnf_p7_info*)(config->user_data);
|
|
||||||
// mac_sr_ind(p7_vnf->mac, ind);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool aerial_is_ue_same(uint16_t ue_id_1, uint16_t ue_id_2)
|
|
||||||
{
|
|
||||||
return (ue_id_1 == ue_id_2);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void aerial_analyze_cqi_pdus_for_duplicates(nfapi_cqi_indication_t *ind)
|
|
||||||
{
|
|
||||||
uint16_t num_cqis = ind->cqi_indication_body.number_of_cqis;
|
|
||||||
assert(num_cqis <= NFAPI_CQI_IND_MAX_PDU);
|
|
||||||
for (int i = 0; i < num_cqis; i++) {
|
|
||||||
nfapi_cqi_indication_pdu_t *src_pdu = &ind->cqi_indication_body.cqi_pdu_list[i];
|
|
||||||
|
|
||||||
LOG_I(MAC,
|
|
||||||
"CQI_IND[PDU:%d][rnti:%x cqi:%d channel:%d]\n",
|
|
||||||
i,
|
|
||||||
src_pdu->rx_ue_information.rnti,
|
|
||||||
src_pdu->ul_cqi_information.ul_cqi,
|
|
||||||
src_pdu->ul_cqi_information.channel);
|
|
||||||
|
|
||||||
for (int j = i + 1; j < num_cqis; j++) {
|
|
||||||
uint16_t rnti_i = ind->cqi_indication_body.cqi_pdu_list[i].rx_ue_information.rnti;
|
|
||||||
uint16_t rnti_j = ind->cqi_indication_body.cqi_pdu_list[j].rx_ue_information.rnti;
|
|
||||||
if (aerial_is_ue_same(rnti_i, rnti_j)) {
|
|
||||||
LOG_E(MAC, "Problem, two cqis received from a single UE for rnti %x\n", rnti_i);
|
|
||||||
// abort(); This will be fixed in merge request which handles multiple CQIs.
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
free(uci_ind->uci_list);
|
||||||
|
uci_ind->uci_list = NULL;
|
||||||
|
free(uci_ind);
|
||||||
|
uci_ind = NULL;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
int aerial_phy_cqi_indication(struct nfapi_vnf_p7_config *config, nfapi_cqi_indication_t *ind)
|
|
||||||
{
|
|
||||||
// vnf_p7_info* p7_vnf = (vnf_p7_info*)(config->user_data);
|
|
||||||
// mac_cqi_ind(p7_vnf->mac, ind);
|
|
||||||
struct PHY_VARS_eNB_s *eNB = RC.eNB[0][0];
|
|
||||||
LOG_D(MAC,
|
|
||||||
"%s() NFAPI SFN/SF:%d number_of_cqis:%u\n",
|
|
||||||
__FUNCTION__,
|
|
||||||
NFAPI_SFNSF2DEC(ind->sfn_sf),
|
|
||||||
ind->cqi_indication_body.number_of_cqis);
|
|
||||||
AssertFatal(pthread_mutex_lock(&eNB->UL_INFO_mutex) == 0, "Mutex lock failed");
|
|
||||||
if (NFAPI_MODE == NFAPI_MODE_VNF) {
|
|
||||||
int8_t index = NFAPI_SFNSF2SF(ind->sfn_sf);
|
|
||||||
|
|
||||||
UL_RCC_INFO.cqi_ind[index] = *ind;
|
|
||||||
assert(ind->cqi_indication_body.number_of_cqis <= NFAPI_CQI_IND_MAX_PDU);
|
|
||||||
if (ind->cqi_indication_body.number_of_cqis > 0) {
|
|
||||||
UL_RCC_INFO.cqi_ind[index].cqi_indication_body.cqi_pdu_list =
|
|
||||||
malloc(sizeof(nfapi_cqi_indication_pdu_t) * NFAPI_CQI_IND_MAX_PDU);
|
|
||||||
UL_RCC_INFO.cqi_ind[index].cqi_indication_body.cqi_raw_pdu_list =
|
|
||||||
malloc(sizeof(nfapi_cqi_indication_raw_pdu_t) * NFAPI_CQI_IND_MAX_PDU);
|
|
||||||
}
|
|
||||||
|
|
||||||
aerial_analyze_cqi_pdus_for_duplicates(ind);
|
|
||||||
|
|
||||||
assert(ind->cqi_indication_body.number_of_cqis <= NFAPI_CQI_IND_MAX_PDU);
|
|
||||||
for (int i = 0; i < ind->cqi_indication_body.number_of_cqis; i++) {
|
|
||||||
nfapi_cqi_indication_pdu_t *src_pdu = &ind->cqi_indication_body.cqi_pdu_list[i];
|
|
||||||
LOG_D(MAC,
|
|
||||||
"SR_IND[PDU:%d][rnti:%x cqi:%d channel:%d]\n",
|
|
||||||
i,
|
|
||||||
src_pdu->rx_ue_information.rnti,
|
|
||||||
src_pdu->ul_cqi_information.ul_cqi,
|
|
||||||
src_pdu->ul_cqi_information.channel);
|
|
||||||
memcpy(&UL_RCC_INFO.cqi_ind[index].cqi_indication_body.cqi_pdu_list[i], src_pdu, sizeof(nfapi_cqi_indication_pdu_t));
|
|
||||||
|
|
||||||
memcpy(&UL_RCC_INFO.cqi_ind[index].cqi_indication_body.cqi_raw_pdu_list[i],
|
|
||||||
&ind->cqi_indication_body.cqi_raw_pdu_list[i],
|
|
||||||
sizeof(nfapi_cqi_indication_raw_pdu_t));
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
nfapi_cqi_indication_t *dest_ind = &eNB->UL_INFO.cqi_ind;
|
|
||||||
*dest_ind = *ind;
|
|
||||||
dest_ind->cqi_indication_body.cqi_pdu_list = ind->cqi_indication_body.cqi_pdu_list;
|
|
||||||
dest_ind->cqi_indication_body.cqi_raw_pdu_list = ind->cqi_indication_body.cqi_raw_pdu_list;
|
|
||||||
assert(ind->cqi_indication_body.number_of_cqis <= NFAPI_CQI_IND_MAX_PDU);
|
|
||||||
for (int i = 0; i < ind->cqi_indication_body.number_of_cqis; i++) {
|
|
||||||
nfapi_cqi_indication_pdu_t *src_pdu = &ind->cqi_indication_body.cqi_pdu_list[i];
|
|
||||||
LOG_D(MAC,
|
|
||||||
"CQI_IND[PDU:%d][rnti:%x cqi:%d channel:%d]\n",
|
|
||||||
i,
|
|
||||||
src_pdu->rx_ue_information.rnti,
|
|
||||||
src_pdu->ul_cqi_information.ul_cqi,
|
|
||||||
src_pdu->ul_cqi_information.channel);
|
|
||||||
memcpy(&dest_ind->cqi_indication_body.cqi_pdu_list[i], src_pdu, sizeof(nfapi_cqi_indication_pdu_t));
|
|
||||||
memcpy(&dest_ind->cqi_indication_body.cqi_raw_pdu_list[i],
|
|
||||||
&ind->cqi_indication_body.cqi_raw_pdu_list[i],
|
|
||||||
sizeof(nfapi_cqi_indication_raw_pdu_t));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
AssertFatal(pthread_mutex_unlock(&eNB->UL_INFO_mutex) == 0, "Mutex unlock failed");
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int aerial_phy_lbt_dl_indication(struct nfapi_vnf_p7_config *config, nfapi_lbt_dl_indication_t *ind)
|
|
||||||
{
|
|
||||||
// vnf_p7_info* p7_vnf = (vnf_p7_info*)(config->user_data);
|
|
||||||
// mac_lbt_dl_ind(p7_vnf->mac, ind);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
int aerial_phy_nb_harq_indication(struct nfapi_vnf_p7_config *config, nfapi_nb_harq_indication_t *ind)
|
|
||||||
{
|
|
||||||
// vnf_p7_info* p7_vnf = (vnf_p7_info*)(config->user_data);
|
|
||||||
// mac_nb_harq_ind(p7_vnf->mac, ind);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
int aerial_phy_nrach_indication(struct nfapi_vnf_p7_config *config, nfapi_nrach_indication_t *ind)
|
|
||||||
{
|
|
||||||
// vnf_p7_info* p7_vnf = (vnf_p7_info*)(config->user_data);
|
|
||||||
// mac_nrach_ind(p7_vnf->mac, ind);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
NR_Sched_Rsp_t g_sched_resp;
|
NR_Sched_Rsp_t g_sched_resp;
|
||||||
void gNB_dlsch_ulsch_scheduler(module_id_t module_idP, frame_t frame, sub_frame_t slot, NR_Sched_Rsp_t* sched_info);
|
void gNB_dlsch_ulsch_scheduler(module_id_t module_idP, frame_t frame, sub_frame_t slot, NR_Sched_Rsp_t* sched_info);
|
||||||
int oai_fapi_dl_tti_req(nfapi_nr_dl_tti_request_t *dl_config_req);
|
int oai_fapi_dl_tti_req(nfapi_nr_dl_tti_request_t *dl_config_req);
|
||||||
@@ -728,29 +273,26 @@ int trigger_scheduler(nfapi_nr_slot_indication_scf_t *slot_ind)
|
|||||||
// Call into the scheduler (this is hardcoded and should be init properly!)
|
// Call into the scheduler (this is hardcoded and should be init properly!)
|
||||||
// memset(sched_resp, 0, sizeof(*sched_resp));
|
// memset(sched_resp, 0, sizeof(*sched_resp));
|
||||||
gNB_dlsch_ulsch_scheduler(0, slot_ind->sfn, slot_ind->slot, &g_sched_resp);
|
gNB_dlsch_ulsch_scheduler(0, slot_ind->sfn, slot_ind->slot, &g_sched_resp);
|
||||||
if (NFAPI_MODE == NFAPI_MODE_AERIAL) {
|
|
||||||
#ifdef ENABLE_AERIAL
|
bool send_slt_resp = false;
|
||||||
bool send_slt_resp = false;
|
if (g_sched_resp.DL_req.dl_tti_request_body.nPDUs> 0) {
|
||||||
if (g_sched_resp.DL_req.dl_tti_request_body.nPDUs> 0) {
|
oai_fapi_dl_tti_req(&g_sched_resp.DL_req);
|
||||||
oai_fapi_dl_tti_req(&g_sched_resp.DL_req);
|
send_slt_resp = true;
|
||||||
send_slt_resp = true;
|
}
|
||||||
}
|
if (g_sched_resp.UL_tti_req.n_pdus > 0) {
|
||||||
if (g_sched_resp.UL_tti_req.n_pdus > 0) {
|
oai_fapi_ul_tti_req(&g_sched_resp.UL_tti_req);
|
||||||
oai_fapi_ul_tti_req(&g_sched_resp.UL_tti_req);
|
send_slt_resp = true;
|
||||||
send_slt_resp = true;
|
}
|
||||||
}
|
if (g_sched_resp.TX_req.Number_of_PDUs > 0) {
|
||||||
if (g_sched_resp.TX_req.Number_of_PDUs > 0) {
|
oai_fapi_tx_data_req(&g_sched_resp.TX_req);
|
||||||
oai_fapi_tx_data_req(&g_sched_resp.TX_req);
|
send_slt_resp = true;
|
||||||
send_slt_resp = true;
|
}
|
||||||
}
|
if (g_sched_resp.UL_dci_req.numPdus > 0) {
|
||||||
if (g_sched_resp.UL_dci_req.numPdus > 0) {
|
oai_fapi_ul_dci_req(&g_sched_resp.UL_dci_req);
|
||||||
oai_fapi_ul_dci_req(&g_sched_resp.UL_dci_req);
|
send_slt_resp = true;
|
||||||
send_slt_resp = true;
|
}
|
||||||
}
|
if (send_slt_resp) {
|
||||||
if (send_slt_resp) {
|
oai_fapi_send_end_request(0,slot_ind->sfn, slot_ind->slot);
|
||||||
oai_fapi_send_end_request(0,slot_ind->sfn, slot_ind->slot);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
@@ -772,26 +314,10 @@ int aerial_phy_nr_slot_indication(nfapi_nr_slot_indication_scf_t *ind)
|
|||||||
|
|
||||||
int aerial_phy_nr_srs_indication(nfapi_nr_srs_indication_t *ind)
|
int aerial_phy_nr_srs_indication(nfapi_nr_srs_indication_t *ind)
|
||||||
{
|
{
|
||||||
struct PHY_VARS_gNB_s *gNB = RC.gNB[0];
|
// or queue to decouple, but I think it should be fast (in all likelihood,
|
||||||
|
// the VNF has nothing to do)
|
||||||
gNB->UL_INFO.srs_ind = *ind;
|
for (int i = 0; i < ind->number_of_pdus; ++i)
|
||||||
|
handle_nr_srs_measurements(0, ind->sfn, ind->slot, &ind->pdu_list[i]);
|
||||||
if (ind->number_of_pdus > 0)
|
|
||||||
gNB->UL_INFO.srs_ind.pdu_list = malloc(sizeof(nfapi_nr_srs_indication_pdu_t) * ind->number_of_pdus);
|
|
||||||
|
|
||||||
for (int i = 0; i < ind->number_of_pdus; i++) {
|
|
||||||
memcpy(&gNB->UL_INFO.srs_ind.pdu_list[i], &ind->pdu_list[i], sizeof(ind->pdu_list[0]));
|
|
||||||
|
|
||||||
LOG_D(MAC,
|
|
||||||
"%s() NFAPI SFN/Slot:%d.%d SRS_IND:number_of_pdus:%d UL_INFO:pdus:%d\n",
|
|
||||||
__FUNCTION__,
|
|
||||||
ind->sfn,
|
|
||||||
ind->slot,
|
|
||||||
ind->number_of_pdus,
|
|
||||||
gNB->UL_INFO.srs_ind.number_of_pdus);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1314,4 +840,3 @@ int fapi_nr_pack_and_send_p7_message(vnf_p7_t *vnf_p7, nfapi_p7_message_header_t
|
|||||||
return aerial_send_P7_msg(FAPI_buffer, len_FAPI, header);
|
return aerial_send_P7_msg(FAPI_buffer, len_FAPI, header);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|||||||
@@ -30,7 +30,6 @@
|
|||||||
* \warning
|
* \warning
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef ENABLE_AERIAL
|
|
||||||
#ifndef OPENAIRINTERFACE_FAPI_VNF_P7_H
|
#ifndef OPENAIRINTERFACE_FAPI_VNF_P7_H
|
||||||
#define OPENAIRINTERFACE_FAPI_VNF_P7_H
|
#define OPENAIRINTERFACE_FAPI_VNF_P7_H
|
||||||
|
|
||||||
@@ -180,21 +179,10 @@ typedef struct {
|
|||||||
|
|
||||||
} vnf_info;
|
} vnf_info;
|
||||||
|
|
||||||
int aerial_wake_gNB_rxtx(PHY_VARS_gNB *gNB, uint16_t sfn, uint16_t slot);
|
|
||||||
int aerial_wake_eNB_rxtx(PHY_VARS_eNB *eNB, uint16_t sfn, uint16_t sf);
|
|
||||||
int aerial_phy_sync_indication(struct nfapi_vnf_p7_config *config, uint8_t sync);
|
|
||||||
int aerial_phy_slot_indication(struct nfapi_vnf_p7_config *config, uint16_t phy_id, uint16_t sfn, uint16_t slot);
|
|
||||||
int aerial_phy_harq_indication(struct nfapi_vnf_p7_config *config, nfapi_harq_indication_t *ind);
|
|
||||||
int aerial_phy_nr_crc_indication(nfapi_nr_crc_indication_t *ind);
|
int aerial_phy_nr_crc_indication(nfapi_nr_crc_indication_t *ind);
|
||||||
int aerial_phy_nr_rx_data_indication(nfapi_nr_rx_data_indication_t *ind);
|
int aerial_phy_nr_rx_data_indication(nfapi_nr_rx_data_indication_t *ind);
|
||||||
int aerial_phy_nr_rach_indication(nfapi_nr_rach_indication_t *ind);
|
int aerial_phy_nr_rach_indication(nfapi_nr_rach_indication_t *ind);
|
||||||
int aerial_phy_nr_uci_indication(nfapi_nr_uci_indication_t *ind);
|
int aerial_phy_nr_uci_indication(nfapi_nr_uci_indication_t *ind);
|
||||||
int aerial_phy_srs_indication(struct nfapi_vnf_p7_config *config, nfapi_srs_indication_t *ind);
|
|
||||||
int aerial_phy_sr_indication(struct nfapi_vnf_p7_config *config, nfapi_sr_indication_t *ind);
|
|
||||||
int aerial_phy_cqi_indication(struct nfapi_vnf_p7_config *config, nfapi_cqi_indication_t *ind);
|
|
||||||
int aerial_phy_lbt_dl_indication(struct nfapi_vnf_p7_config *config, nfapi_lbt_dl_indication_t *ind);
|
|
||||||
int aerial_phy_nb_harq_indication(struct nfapi_vnf_p7_config *config, nfapi_nb_harq_indication_t *ind);
|
|
||||||
int aerial_phy_nrach_indication(struct nfapi_vnf_p7_config *config, nfapi_nrach_indication_t *ind);
|
|
||||||
int aerial_phy_nr_slot_indication(nfapi_nr_slot_indication_scf_t *ind);
|
int aerial_phy_nr_slot_indication(nfapi_nr_slot_indication_scf_t *ind);
|
||||||
int aerial_phy_nr_srs_indication(nfapi_nr_srs_indication_t *ind);
|
int aerial_phy_nr_srs_indication(nfapi_nr_srs_indication_t *ind);
|
||||||
void *aerial_vnf_allocate(size_t size);
|
void *aerial_vnf_allocate(size_t size);
|
||||||
@@ -241,4 +229,3 @@ uint8_t aerial_unpack_nr_rach_indication(uint8_t **ppReadPackedMsg,
|
|||||||
// int fapi_nr_p7_message_pack(void *pMessageBuf, void *pPackedBuf, uint32_t packedBufLen, nfapi_p7_codec_config_t* config);
|
// int fapi_nr_p7_message_pack(void *pMessageBuf, void *pPackedBuf, uint32_t packedBufLen, nfapi_p7_codec_config_t* config);
|
||||||
int fapi_nr_pack_and_send_p7_message(vnf_p7_t *vnf_p7, nfapi_p7_message_header_t *header);
|
int fapi_nr_pack_and_send_p7_message(vnf_p7_t *vnf_p7, nfapi_p7_message_header_t *header);
|
||||||
#endif // OPENAIRINTERFACE_FAPI_VNF_P7_H
|
#endif // OPENAIRINTERFACE_FAPI_VNF_P7_H
|
||||||
#endif
|
|
||||||
|
|||||||
@@ -4,3 +4,6 @@ add_library(nr_fapi_p5
|
|||||||
)
|
)
|
||||||
target_include_directories(nr_fapi_p5 PUBLIC inc)
|
target_include_directories(nr_fapi_p5 PUBLIC inc)
|
||||||
target_link_libraries(nr_fapi_p5 PUBLIC nfapi_common)
|
target_link_libraries(nr_fapi_p5 PUBLIC nfapi_common)
|
||||||
|
if(OAI_AERIAL)
|
||||||
|
target_compile_definitions(nr_fapi_p5 PRIVATE ENABLE_AERIAL)
|
||||||
|
endif()
|
||||||
|
|||||||
@@ -792,6 +792,11 @@ typedef struct f1_config_t {
|
|||||||
uint32_t gnb_id; // associated gNB's ID, not used in DU itself
|
uint32_t gnb_id; // associated gNB's ID, not used in DU itself
|
||||||
} f1_config_t;
|
} f1_config_t;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
char *nvipc_shm_prefix;
|
||||||
|
int8_t nvipc_poll_core;
|
||||||
|
} nvipc_params_t;
|
||||||
|
|
||||||
/*! \brief top level eNB MAC structure */
|
/*! \brief top level eNB MAC structure */
|
||||||
typedef struct gNB_MAC_INST_s {
|
typedef struct gNB_MAC_INST_s {
|
||||||
/// Ethernet parameters for northbound midhaul interface
|
/// Ethernet parameters for northbound midhaul interface
|
||||||
|
|||||||
@@ -241,6 +241,8 @@ void handle_nr_srs(NR_UL_IND_t *UL_info) {
|
|||||||
const int num_srs = UL_info->srs_ind.number_of_pdus;
|
const int num_srs = UL_info->srs_ind.number_of_pdus;
|
||||||
nfapi_nr_srs_indication_pdu_t *srs_list = UL_info->srs_ind.pdu_list;
|
nfapi_nr_srs_indication_pdu_t *srs_list = UL_info->srs_ind.pdu_list;
|
||||||
|
|
||||||
|
// from here
|
||||||
|
|
||||||
for (int i = 0; i < num_srs; i++) {
|
for (int i = 0; i < num_srs; i++) {
|
||||||
nfapi_nr_srs_indication_pdu_t *srs_ind = &srs_list[i];
|
nfapi_nr_srs_indication_pdu_t *srs_ind = &srs_list[i];
|
||||||
LOG_D(NR_PHY, "(%d.%d) UL_info->srs_ind.pdu_list[%d].rnti: 0x%04x\n", frame, slot, i, srs_ind->rnti);
|
LOG_D(NR_PHY, "(%d.%d) UL_info->srs_ind.pdu_list[%d].rnti: 0x%04x\n", frame, slot, i, srs_ind->rnti);
|
||||||
|
|||||||
@@ -336,11 +336,6 @@ typedef struct {
|
|||||||
uint8_t if_compress;
|
uint8_t if_compress;
|
||||||
} eth_params_t;
|
} eth_params_t;
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
char *nvipc_shm_prefix;
|
|
||||||
int8_t nvipc_poll_core;
|
|
||||||
} nvipc_params_t;
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
//! Tx buffer for if device, keep one per subframe now to allow multithreading
|
//! Tx buffer for if device, keep one per subframe now to allow multithreading
|
||||||
void *tx[10];
|
void *tx[10];
|
||||||
|
|||||||
Reference in New Issue
Block a user