Commit 39d9d32e authored by Robert Schmidt's avatar Robert Schmidt

Merge remote-tracking branch 'origin/local-UL_INFO' into integration_2025_w02 (!3076)

Move UL_INFO structure allocation local to a rx slot processing

UL_INFO is allocated a gNB, so require mutex and obscur information
passing function to function.  Instead, make a local UL_INFO per slot,
removing the mutex and making the code easier to understand.
parents 189396aa b4bc7c96
...@@ -212,10 +212,10 @@ static void rx_func(processingData_L1_t *info) ...@@ -212,10 +212,10 @@ static void rx_func(processingData_L1_t *info)
LOG_D(NR_PHY, "%d.%d Starting RX processing\n", frame_rx, slot_rx); LOG_D(NR_PHY, "%d.%d Starting RX processing\n", frame_rx, slot_rx);
// UE-specific RX processing for subframe n // UE-specific RX processing for subframe n
// TODO: check if this is correct for PARALLEL_RU_L1_TRX_SPLIT NR_UL_IND_t UL_INFO = {.frame = frame_rx, .slot = slot_rx, .module_id = gNB->Mod_id, .CC_id = gNB->CC_id};
// Do PRACH RU processing // Do PRACH RU processing
L1_nr_prach_procedures(gNB,frame_rx,slot_rx); UL_INFO.rach_ind.pdu_list = UL_INFO.prach_pdu_indication_list;
L1_nr_prach_procedures(gNB, frame_rx, slot_rx, &UL_INFO.rach_ind);
//WA: comment rotation in tx/rx //WA: comment rotation in tx/rx
if (gNB->phase_comp) { if (gNB->phase_comp) {
...@@ -234,15 +234,11 @@ static void rx_func(processingData_L1_t *info) ...@@ -234,15 +234,11 @@ static void rx_func(processingData_L1_t *info)
} }
} }
} }
phy_procedures_gNB_uespec_RX(gNB, frame_rx, slot_rx); phy_procedures_gNB_uespec_RX(gNB, frame_rx, slot_rx, &UL_INFO);
// Call the scheduler // Call the scheduler
start_meas(&gNB->ul_indication_stats); start_meas(&gNB->ul_indication_stats);
gNB->UL_INFO.frame = frame_rx; gNB->if_inst->NR_UL_indication(&UL_INFO);
gNB->UL_INFO.slot = slot_rx;
gNB->UL_INFO.module_id = gNB->Mod_id;
gNB->UL_INFO.CC_id = gNB->CC_id;
gNB->if_inst->NR_UL_indication(&gNB->UL_INFO);
stop_meas(&gNB->ul_indication_stats); stop_meas(&gNB->ul_indication_stats);
#ifndef OAI_FHI72 #ifndef OAI_FHI72
...@@ -454,17 +450,11 @@ void init_gNB() ...@@ -454,17 +450,11 @@ void init_gNB()
// Register MAC interface module // Register MAC interface module
AssertFatal((gNB->if_inst = NR_IF_Module_init(inst)) != NULL, "Cannot register interface"); AssertFatal((gNB->if_inst = NR_IF_Module_init(inst)) != NULL, "Cannot register interface");
LOG_I(NR_PHY, "Registered with MAC interface module (%p)\n", gNB->if_inst);
// Set function pointers in MAC IF module LOG_I(NR_PHY, "Registered with MAC interface module (%p)\n", gNB->if_inst);
gNB->if_inst->NR_Schedule_response = nr_schedule_response; gNB->if_inst->NR_Schedule_response = nr_schedule_response;
gNB->if_inst->NR_PHY_config_req = nr_phy_config_request; gNB->if_inst->NR_PHY_config_req = nr_phy_config_request;
// Clear UL_INFO and set rx/crc indication lists
memset((void *)&gNB->UL_INFO, 0, sizeof(gNB->UL_INFO));
gNB->UL_INFO.rx_ind.pdu_list = gNB->rx_pdu_list;
gNB->UL_INFO.crc_ind.crc_list = gNB->crc_pdu_list;
gNB->prach_energy_counter = 0; gNB->prach_energy_counter = 0;
gNB->chest_time = get_softmodem_params()->chest_time; gNB->chest_time = get_softmodem_params()->chest_time;
gNB->chest_freq = get_softmodem_params()->chest_freq; gNB->chest_freq = get_softmodem_params()->chest_freq;
......
...@@ -182,24 +182,25 @@ int nfapi_nr_vnf_p7_start(nfapi_vnf_p7_config_t* config) ...@@ -182,24 +182,25 @@ int nfapi_nr_vnf_p7_start(nfapi_vnf_p7_config_t* config)
NFAPI_TRACE(NFAPI_TRACE_DEBUG, "This is the slot_ind queue size %ld in %s():%d\n", NFAPI_TRACE(NFAPI_TRACE_DEBUG, "This is the slot_ind queue size %ld in %s():%d\n",
gnb_slot_ind_queue.num_items, __FUNCTION__, __LINE__); gnb_slot_ind_queue.num_items, __FUNCTION__, __LINE__);
if (slot_ind) { if (slot_ind) {
gNB->UL_INFO.frame = slot_ind->sfn; NR_UL_IND_t UL_INFO = {.frame = slot_ind->sfn, .slot = slot_ind->slot};
gNB->UL_INFO.slot = slot_ind->slot;
NFAPI_TRACE(NFAPI_TRACE_DEBUG, "UL_INFO.frame = %d and slot %d, prev_slot = %d\n", UL_INFO.frame, UL_INFO.slot, prev_slot);
NFAPI_TRACE(NFAPI_TRACE_DEBUG, "gNB->UL_INFO.frame = %d and slot %d, prev_slot = %d\n", if (setup_done && prev_slot != UL_INFO.slot) { // Give the VNF sufficient time to setup before starting scheduling &&
gNB->UL_INFO.frame, gNB->UL_INFO.slot, prev_slot); // prev_slot != UL_INFO.slot
if (setup_done && prev_slot != gNB->UL_INFO.slot) { //Give the VNF sufficient time to setup before starting scheduling && prev_slot != gNB->UL_INFO.slot
// Call the scheduler
//Call the scheduler UL_INFO.module_id = gNB->Mod_id;
gNB->UL_INFO.module_id = gNB->Mod_id; UL_INFO.CC_id = gNB->CC_id;
gNB->UL_INFO.CC_id = gNB->CC_id; NFAPI_TRACE(NFAPI_TRACE_DEBUG,
NFAPI_TRACE(NFAPI_TRACE_DEBUG, "Calling NR_UL_indication for gNB->UL_INFO.frame = %d and slot %d\n", "Calling NR_UL_indication for UL_INFO.frame = %d and slot %d\n",
gNB->UL_INFO.frame, gNB->UL_INFO.slot); UL_INFO.frame,
gNB->if_inst->NR_UL_indication(&gNB->UL_INFO); UL_INFO.slot);
prev_slot = gNB->UL_INFO.slot; gNB->if_inst->NR_UL_indication(&UL_INFO);
} prev_slot = UL_INFO.slot;
free(slot_ind); }
slot_ind = NULL; free(slot_ind);
} slot_ind = NULL;
}
selectRetval = pselect(maxSock+1, &rfds, NULL, NULL, &pselect_timeout, NULL); selectRetval = pselect(maxSock+1, &rfds, NULL, NULL, &pselect_timeout, NULL);
......
...@@ -136,8 +136,6 @@ void phy_init_nr_gNB(PHY_VARS_gNB *gNB) ...@@ -136,8 +136,6 @@ void phy_init_nr_gNB(PHY_VARS_gNB *gNB)
int ret_loader = load_nrLDPC_coding_interface(NULL, &gNB->nrLDPC_coding_interface); int ret_loader = load_nrLDPC_coding_interface(NULL, &gNB->nrLDPC_coding_interface);
AssertFatal(ret_loader == 0, "error loading LDPC library\n"); AssertFatal(ret_loader == 0, "error loading LDPC library\n");
pthread_mutex_init(&gNB->UL_INFO.crc_rx_mutex, NULL);
gNB->max_nb_pdsch = MAX_MOBILES_PER_GNB; gNB->max_nb_pdsch = MAX_MOBILES_PER_GNB;
init_delay_table(fp->ofdm_symbol_size, MAX_DELAY_COMP, NR_MAX_OFDM_SYMBOL_SIZE, fp->delay_table); init_delay_table(fp->ofdm_symbol_size, MAX_DELAY_COMP, NR_MAX_OFDM_SYMBOL_SIZE, fp->delay_table);
...@@ -231,8 +229,6 @@ void phy_free_nr_gNB(PHY_VARS_gNB *gNB) ...@@ -231,8 +229,6 @@ void phy_free_nr_gNB(PHY_VARS_gNB *gNB)
const int max_ul_mimo_layers = 4; // taken from phy_init_nr_gNB() const int max_ul_mimo_layers = 4; // taken from phy_init_nr_gNB()
const int n_buf = Prx * max_ul_mimo_layers; const int n_buf = Prx * max_ul_mimo_layers;
pthread_mutex_destroy(&gNB->UL_INFO.crc_rx_mutex);
PHY_MEASUREMENTS_gNB *meas = &gNB->measurements; PHY_MEASUREMENTS_gNB *meas = &gNB->measurements;
free_and_zero(meas->n0_subband_power); free_and_zero(meas->n0_subband_power);
free_and_zero(meas->n0_subband_power_dB); free_and_zero(meas->n0_subband_power_dB);
......
...@@ -45,6 +45,7 @@ ...@@ -45,6 +45,7 @@
#include "PHY/CODING/nrLDPC_decoder/nrLDPC_types.h" #include "PHY/CODING/nrLDPC_decoder/nrLDPC_types.h"
#include "executables/rt_profiling.h" #include "executables/rt_profiling.h"
#include "nfapi_nr_interface_scf.h" #include "nfapi_nr_interface_scf.h"
#include "openair2/NR_PHY_INTERFACE/NR_IF_Module.h"
#define MAX_NUM_RU_PER_gNB 8 #define MAX_NUM_RU_PER_gNB 8
#define MAX_PUCCH0_NID 8 #define MAX_PUCCH0_NID 8
...@@ -415,10 +416,6 @@ typedef struct { ...@@ -415,10 +416,6 @@ typedef struct {
int prach_I0; int prach_I0;
} PHY_MEASUREMENTS_gNB; } PHY_MEASUREMENTS_gNB;
#define MAX_NUM_NR_RX_RACH_PDUS 4
#define MAX_UL_PDUS_PER_SLOT 8
#define MAX_NUM_NR_SRS_PDUS 8
// the current RRC resource allocation is that each UE gets its // the current RRC resource allocation is that each UE gets its
// "own" PUCCH resource (for F0) in a dedicated PRB in each slot // "own" PUCCH resource (for F0) in a dedicated PRB in each slot
// therefore, we can have up to "number of UE" UCI PDUs // therefore, we can have up to "number of UE" UCI PDUs
...@@ -443,22 +440,9 @@ typedef struct PHY_VARS_gNB_s { ...@@ -443,22 +440,9 @@ typedef struct PHY_VARS_gNB_s {
NR_DL_FRAME_PARMS frame_parms; NR_DL_FRAME_PARMS frame_parms;
PHY_MEASUREMENTS_gNB measurements; PHY_MEASUREMENTS_gNB measurements;
NR_IF_Module_t *if_inst; NR_IF_Module_t *if_inst;
NR_UL_IND_t UL_INFO;
/// NFAPI RX ULSCH information
nfapi_nr_rx_data_pdu_t rx_pdu_list[MAX_UL_PDUS_PER_SLOT];
/// NFAPI RX ULSCH CRC information
nfapi_nr_crc_t crc_pdu_list[MAX_UL_PDUS_PER_SLOT];
/// NFAPI SRS information
nfapi_nr_srs_indication_pdu_t srs_pdu_list[MAX_NUM_NR_SRS_PDUS];
/// NFAPI UCI information
nfapi_nr_uci_t uci_pdu_list[MAX_NUM_NR_UCI_PDUS];
/// NFAPI PRACH information
nfapi_nr_prach_indication_pdu_t prach_pdu_indication_list[MAX_NUM_NR_RX_RACH_PDUS];
nfapi_nr_ul_tti_request_t UL_tti_req; nfapi_nr_ul_tti_request_t UL_tti_req;
nfapi_nr_uci_indication_t uci_indication;
int max_nb_pucch; int max_nb_pucch;
int max_nb_srs; int max_nb_srs;
int max_nb_pdsch; int max_nb_pdsch;
......
...@@ -53,8 +53,15 @@ void handle_nr_nfapi_pdsch_pdu(processingData_L1tx_t *msgTx, ...@@ -53,8 +53,15 @@ void handle_nr_nfapi_pdsch_pdu(processingData_L1tx_t *msgTx,
nfapi_nr_dl_tti_pdsch_pdu *pdsch_pdu, nfapi_nr_dl_tti_pdsch_pdu *pdsch_pdu,
uint8_t *sdu); uint8_t *sdu);
void nr_fill_indication(PHY_VARS_gNB *gNB,
void nr_fill_indication(PHY_VARS_gNB *gNB, int frame, int slot_rx, int UE_id, uint8_t harq_pid, uint8_t crc_flag,int dtx_flag); int frame,
int slot_rx,
int UE_id,
uint8_t harq_pid,
uint8_t crc_flag,
int dtx_flag,
nfapi_nr_crc_t *crc,
nfapi_nr_rx_data_pdu_t *pdu);
//added //added
void handle_nfapi_nr_ul_dci_pdu(PHY_VARS_gNB *gNB, void handle_nfapi_nr_ul_dci_pdu(PHY_VARS_gNB *gNB,
......
...@@ -98,22 +98,19 @@ uint8_t get_nr_prach_duration(uint8_t prach_format){ ...@@ -98,22 +98,19 @@ uint8_t get_nr_prach_duration(uint8_t prach_format){
} }
} }
void L1_nr_prach_procedures(PHY_VARS_gNB *gNB,int frame,int slot) { void L1_nr_prach_procedures(PHY_VARS_gNB *gNB, int frame, int slot, nfapi_nr_rach_indication_t *rach_ind)
{
uint16_t max_preamble[4]={0},max_preamble_energy[4]={0},max_preamble_delay[4]={0}; uint16_t max_preamble[4]={0},max_preamble_energy[4]={0},max_preamble_delay[4]={0};
uint8_t pdu_index = 0;
RU_t *ru; RU_t *ru;
int aa=0; int aa=0;
int ru_aa; int ru_aa;
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_ENB_PRACH_RX,1); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_ENB_PRACH_RX,1);
gNB->UL_INFO.rach_ind.sfn = frame; rach_ind->sfn = frame;
gNB->UL_INFO.rach_ind.slot = slot; rach_ind->slot = slot;
gNB->UL_INFO.rach_ind.pdu_list = gNB->prach_pdu_indication_list; rach_ind->number_of_pdus = 0;
gNB->UL_INFO.rach_ind.number_of_pdus = 0;
ru=gNB->RU_list[0]; ru=gNB->RU_list[0];
...@@ -152,7 +149,7 @@ void L1_nr_prach_procedures(PHY_VARS_gNB *gNB,int frame,int slot) { ...@@ -152,7 +149,7 @@ void L1_nr_prach_procedures(PHY_VARS_gNB *gNB,int frame,int slot) {
gNB->prach_energy_counter); gNB->prach_energy_counter);
if ((gNB->prach_energy_counter == 100) && (max_preamble_energy[0] > gNB->measurements.prach_I0 + gNB->prach_thres) if ((gNB->prach_energy_counter == 100) && (max_preamble_energy[0] > gNB->measurements.prach_I0 + gNB->prach_thres)
&& (pdu_index < MAX_NUM_NR_RX_RACH_PDUS)) { && (rach_ind->number_of_pdus < MAX_NUM_NR_RX_RACH_PDUS)) {
LOG_A(NR_PHY, LOG_A(NR_PHY,
"[RAPROC] %d.%d Initiating RA procedure with preamble %d, energy %d.%d dB (I0 %d, thres %d), delay %d start symbol " "[RAPROC] %d.%d Initiating RA procedure with preamble %d, energy %d.%d dB (I0 %d, thres %d), delay %d start symbol "
"%u freq index %u\n", "%u freq index %u\n",
...@@ -175,9 +172,7 @@ void L1_nr_prach_procedures(PHY_VARS_gNB *gNB,int frame,int slot) { ...@@ -175,9 +172,7 @@ void L1_nr_prach_procedures(PHY_VARS_gNB *gNB,int frame,int slot) {
T_INT(max_preamble_energy[0]), T_INT(max_preamble_energy[0]),
T_INT(max_preamble_delay[0])); T_INT(max_preamble_delay[0]));
gNB->UL_INFO.rach_ind.number_of_pdus += 1; nfapi_nr_prach_indication_pdu_t *ind = rach_ind->pdu_list + rach_ind->number_of_pdus;
nfapi_nr_prach_indication_pdu_t *ind = &gNB->prach_pdu_indication_list[pdu_index];
ind->phy_cell_id = gNB->gNB_config.cell_config.phy_cell_id.value; ind->phy_cell_id = gNB->gNB_config.cell_config.phy_cell_id.value;
ind->symbol_index = prachStartSymbol; ind->symbol_index = prachStartSymbol;
ind->slot_index = slot; ind->slot_index = slot;
...@@ -189,7 +184,7 @@ void L1_nr_prach_procedures(PHY_VARS_gNB *gNB,int frame,int slot) { ...@@ -189,7 +184,7 @@ void L1_nr_prach_procedures(PHY_VARS_gNB *gNB,int frame,int slot) {
ind->preamble_list[0].preamble_index = max_preamble[0]; ind->preamble_list[0].preamble_index = max_preamble[0];
ind->preamble_list[0].timing_advance = max_preamble_delay[0]; ind->preamble_list[0].timing_advance = max_preamble_delay[0];
ind->preamble_list[0].preamble_pwr = 0xffffffff; ind->preamble_list[0].preamble_pwr = 0xffffffff;
pdu_index++; rach_ind->number_of_pdus++;
} }
gNB->measurements.prach_I0 = ((gNB->measurements.prach_I0*900)>>10) + ((max_preamble_energy[0]*124)>>10); gNB->measurements.prach_I0 = ((gNB->measurements.prach_I0*900)>>10) + ((max_preamble_energy[0]*124)>>10);
if (frame==0) LOG_I(PHY,"prach_I0 = %d.%d dB\n",gNB->measurements.prach_I0/10,gNB->measurements.prach_I0%10); if (frame==0) LOG_I(PHY,"prach_I0 = %d.%d dB\n",gNB->measurements.prach_I0/10,gNB->measurements.prach_I0%10);
...@@ -198,4 +193,3 @@ void L1_nr_prach_procedures(PHY_VARS_gNB *gNB,int frame,int slot) { ...@@ -198,4 +193,3 @@ void L1_nr_prach_procedures(PHY_VARS_gNB *gNB,int frame,int slot) {
} //for NUMBER_OF_NR_PRACH_OCCASION_MAX } //for NUMBER_OF_NR_PRACH_OCCASION_MAX
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_ENB_PRACH_RX,0); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_ENB_PRACH_RX,0);
} }
This diff is collapsed.
...@@ -34,8 +34,8 @@ ...@@ -34,8 +34,8 @@
void nr_set_ssb_first_subcarrier(nfapi_nr_config_request_scf_t *cfg, NR_DL_FRAME_PARMS *fp); void nr_set_ssb_first_subcarrier(nfapi_nr_config_request_scf_t *cfg, NR_DL_FRAME_PARMS *fp);
void phy_procedures_gNB_TX(processingData_L1tx_t *msgTx, int frame_tx, int slot_tx, int do_meas); void phy_procedures_gNB_TX(processingData_L1tx_t *msgTx, int frame_tx, int slot_tx, int do_meas);
int phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx); int phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx, NR_UL_IND_t *UL_INFO);
void L1_nr_prach_procedures(PHY_VARS_gNB *gNB,int frame,int slot); void L1_nr_prach_procedures(PHY_VARS_gNB *gNB, int frame, int slot, nfapi_nr_rach_indication_t *rach_ind);
void nr_common_signal_procedures (PHY_VARS_gNB *gNB,int frame,int slot,nfapi_nr_dl_tti_ssb_pdu ssb_pdu); void nr_common_signal_procedures (PHY_VARS_gNB *gNB,int frame,int slot,nfapi_nr_dl_tti_ssb_pdu ssb_pdu);
void nr_feptx_ofdm(RU_t *ru,int frame_tx,int tti_tx); void nr_feptx_ofdm(RU_t *ru,int frame_tx,int tti_tx);
void nr_feptx0(RU_t *ru,int tti_tx,int first_symbol, int num_symbols, int aa); void nr_feptx0(RU_t *ru,int tti_tx,int first_symbol, int num_symbols, int aa);
......
...@@ -574,7 +574,6 @@ int main(int argc, char **argv) ...@@ -574,7 +574,6 @@ int main(int argc, char **argv)
printf("\n"); printf("\n");
exit(-1); exit(-1);
#endif #endif
nr_ulsch_decoding(gNB, frame_parms, frame, subframe, &G, &UE_id, 1); nr_ulsch_decoding(gNB, frame_parms, frame, subframe, &G, &UE_id, 1);
bool crc_valid = check_crc(harq_process_gNB->b, lenWithCrc(1, (harq_process_gNB->TBS) << 3), crcType(1, (harq_process_gNB->TBS) << 3)); bool crc_valid = check_crc(harq_process_gNB->b, lenWithCrc(1, (harq_process_gNB->TBS) << 3), crcType(1, (harq_process_gNB->TBS) << 3));
if (!crc_valid) { if (!crc_valid) {
......
...@@ -602,11 +602,11 @@ int main(int argc, char *argv[]) ...@@ -602,11 +602,11 @@ int main(int argc, char *argv[])
gNB->msgDataTx = msgDataTx; gNB->msgDataTx = msgDataTx;
//gNB_config = &gNB->gNB_config; //gNB_config = &gNB->gNB_config;
//memset((void *)&gNB->UL_INFO,0,sizeof(gNB->UL_INFO)); NR_UL_IND_t UL_INFO = {0};
gNB->UL_INFO.rx_ind.pdu_list = (nfapi_nr_rx_data_pdu_t *)malloc(NB_UE_INST*sizeof(nfapi_nr_rx_data_pdu_t)); UL_INFO.crc_ind.crc_list = UL_INFO.crc_pdu_list;
gNB->UL_INFO.crc_ind.crc_list = (nfapi_nr_crc_t *)malloc(NB_UE_INST*sizeof(nfapi_nr_crc_t)); UL_INFO.rx_ind.pdu_list = UL_INFO.rx_pdu_list;
gNB->UL_INFO.rx_ind.number_of_pdus = 0; UL_INFO.rx_ind.number_of_pdus = 0;
gNB->UL_INFO.crc_ind.number_crcs = 0; UL_INFO.crc_ind.number_crcs = 0;
gNB->max_ldpc_iterations = max_ldpc_iterations; gNB->max_ldpc_iterations = max_ldpc_iterations;
gNB->pusch_thres = -20; gNB->pusch_thres = -20;
frame_parms = &gNB->frame_parms; //to be initialized I suppose (maybe not necessary for PBCH) frame_parms = &gNB->frame_parms; //to be initialized I suppose (maybe not necessary for PBCH)
...@@ -1256,9 +1256,9 @@ int main(int argc, char *argv[]) ...@@ -1256,9 +1256,9 @@ int main(int argc, char *argv[])
//---------------------------------------------------------- //----------------------------------------------------------
//------------------- gNB phy procedures ------------------- //------------------- gNB phy procedures -------------------
//---------------------------------------------------------- //----------------------------------------------------------
gNB->UL_INFO.rx_ind.number_of_pdus = 0; UL_INFO.rx_ind.number_of_pdus = 0;
gNB->UL_INFO.crc_ind.number_crcs = 0; UL_INFO.crc_ind.number_crcs = 0;
gNB->UL_INFO.srs_ind.number_of_pdus = 0; UL_INFO.srs_ind.number_of_pdus = 0;
for(uint8_t symbol = 0; symbol < (gNB->frame_parms.Ncp == EXTENDED ? 12 : 14); symbol++) { for(uint8_t symbol = 0; symbol < (gNB->frame_parms.Ncp == EXTENDED ? 12 : 14); symbol++) {
for (int aa = 0; aa < gNB->frame_parms.nb_antennas_rx; aa++) for (int aa = 0; aa < gNB->frame_parms.nb_antennas_rx; aa++)
...@@ -1281,7 +1281,7 @@ int main(int argc, char *argv[]) ...@@ -1281,7 +1281,7 @@ int main(int argc, char *argv[])
gNB->frame_parms.Ncp == EXTENDED ? 12 : 14); gNB->frame_parms.Ncp == EXTENDED ? 12 : 14);
} }
ul_proc_error = phy_procedures_gNB_uespec_RX(gNB, frame, slot); ul_proc_error = phy_procedures_gNB_uespec_RX(gNB, frame, slot, &UL_INFO);
if (n_trials == 1 && round == 0) { if (n_trials == 1 && round == 0) {
LOG_M("rxsig0.m", "rx0", &rxdata[0][slot_offset], slot_length, 1, 1); LOG_M("rxsig0.m", "rx0", &rxdata[0][slot_offset], slot_length, 1, 1);
......
...@@ -62,8 +62,7 @@ extern int oai_nfapi_nr_uci_indication(nfapi_nr_uci_indication_t *ind); ...@@ -62,8 +62,7 @@ extern int oai_nfapi_nr_uci_indication(nfapi_nr_uci_indication_t *ind);
extern int oai_nfapi_nr_rach_indication(nfapi_nr_rach_indication_t *ind); extern int oai_nfapi_nr_rach_indication(nfapi_nr_rach_indication_t *ind);
extern uint8_t nfapi_mode; extern uint8_t nfapi_mode;
static void handle_nr_rach(NR_UL_IND_t *UL_info)
void handle_nr_rach(NR_UL_IND_t *UL_info)
{ {
if (NFAPI_MODE == NFAPI_MODE_PNF) { if (NFAPI_MODE == NFAPI_MODE_PNF) {
if (UL_info->rach_ind.number_of_pdus > 0) { if (UL_info->rach_ind.number_of_pdus > 0) {
...@@ -73,35 +72,40 @@ void handle_nr_rach(NR_UL_IND_t *UL_info) ...@@ -73,35 +72,40 @@ void handle_nr_rach(NR_UL_IND_t *UL_info)
} }
return; return;
} }
if (UL_info->rach_ind.number_of_pdus) {
int frame_diff = UL_info->frame - UL_info->rach_ind.sfn;
if (frame_diff < 0) {
frame_diff += 1024;
}
bool in_timewindow = frame_diff == 0 || (frame_diff == 1 && UL_info->slot < 7);
int frame_diff = UL_info->frame - UL_info->rach_ind.sfn; if (in_timewindow) {
if (frame_diff < 0) { LOG_D(MAC,
frame_diff += 1024; "UL_info[Frame %d, Slot %d] Calling initiate_ra_proc RACH:SFN/SLOT:%d/%d\n",
} UL_info->frame,
bool in_timewindow = frame_diff == 0 || (frame_diff == 1 && UL_info->slot < 7); UL_info->slot,
UL_info->rach_ind.sfn,
if (UL_info->rach_ind.number_of_pdus > 0 && in_timewindow) { UL_info->rach_ind.slot);
LOG_D(MAC,"UL_info[Frame %d, Slot %d] Calling initiate_ra_proc RACH:SFN/SLOT:%d/%d\n", for (int i = 0; i < UL_info->rach_ind.number_of_pdus; i++) {
UL_info->frame, UL_info->slot, UL_info->rach_ind.sfn, UL_info->rach_ind.slot); nfapi_nr_prach_indication_pdu_t *rach = UL_info->rach_ind.pdu_list + i;
for (int i = 0; i < UL_info->rach_ind.number_of_pdus; i++) { if (rach->num_preamble > 1) {
if (UL_info->rach_ind.pdu_list[i].num_preamble > 1) { LOG_E(MAC, "Not more than 1 preamble per RACH PDU supported, ignoring the rest\n");
LOG_E(MAC, "Not more than 1 preamble per RACH PDU supported, ignoring the rest\n"); }
nr_initiate_ra_proc(UL_info->module_id,
UL_info->CC_id,
UL_info->rach_ind.sfn,
UL_info->rach_ind.slot,
rach->preamble_list[0].preamble_index,
rach->freq_index,
rach->symbol_index,
rach->preamble_list[0].timing_advance,
rach->preamble_list[0].preamble_pwr);
} }
nr_initiate_ra_proc(UL_info->module_id,
UL_info->CC_id,
UL_info->rach_ind.sfn,
UL_info->rach_ind.slot,
UL_info->rach_ind.pdu_list[i].preamble_list[0].preamble_index,
UL_info->rach_ind.pdu_list[i].freq_index,
UL_info->rach_ind.pdu_list[i].symbol_index,
UL_info->rach_ind.pdu_list[i].preamble_list[0].timing_advance,
UL_info->rach_ind.pdu_list[i].preamble_list[0].preamble_pwr);
} }
} }
} }
static void handle_nr_uci(NR_UL_IND_t *UL_info)
void handle_nr_uci(NR_UL_IND_t *UL_info)
{ {
if(NFAPI_MODE == NFAPI_MODE_PNF) { if(NFAPI_MODE == NFAPI_MODE_PNF) {
if (UL_info->uci_ind.num_ucis > 0) { if (UL_info->uci_ind.num_ucis > 0) {
...@@ -162,7 +166,7 @@ static bool crc_sfn_slot_matcher(void *wanted, void *candidate) ...@@ -162,7 +166,7 @@ static bool crc_sfn_slot_matcher(void *wanted, void *candidate)
return false; return false;
} }
void handle_nr_ulsch(NR_UL_IND_t *UL_info) static void handle_nr_ulsch(NR_UL_IND_t *UL_info)
{ {
if(NFAPI_MODE == NFAPI_MODE_PNF) { if(NFAPI_MODE == NFAPI_MODE_PNF) {
if (UL_info->crc_ind.number_crcs > 0) { if (UL_info->crc_ind.number_crcs > 0) {
...@@ -180,9 +184,6 @@ void handle_nr_ulsch(NR_UL_IND_t *UL_info) ...@@ -180,9 +184,6 @@ void handle_nr_ulsch(NR_UL_IND_t *UL_info)
} }
if (UL_info->rx_ind.number_of_pdus > 0 && UL_info->crc_ind.number_crcs > 0) { if (UL_info->rx_ind.number_of_pdus > 0 && UL_info->crc_ind.number_crcs > 0) {
// see nr_fill_indication about why this mutex is necessary
int rc = pthread_mutex_lock(&UL_info->crc_rx_mutex);
DevAssert(rc == 0);
AssertFatal(UL_info->rx_ind.number_of_pdus == UL_info->crc_ind.number_crcs, AssertFatal(UL_info->rx_ind.number_of_pdus == UL_info->crc_ind.number_crcs,
"number_of_pdus %d, number_crcs %d\n", "number_of_pdus %d, number_crcs %d\n",
UL_info->rx_ind.number_of_pdus, UL_info->crc_ind.number_crcs); UL_info->rx_ind.number_of_pdus, UL_info->crc_ind.number_crcs);
...@@ -192,12 +193,12 @@ void handle_nr_ulsch(NR_UL_IND_t *UL_info) ...@@ -192,12 +193,12 @@ void handle_nr_ulsch(NR_UL_IND_t *UL_info)
LOG_D(NR_PHY, "UL_info->crc_ind.pdu_list[%d].rnti:%04x " LOG_D(NR_PHY, "UL_info->crc_ind.pdu_list[%d].rnti:%04x "
"UL_info->rx_ind.pdu_list[%d].rnti:%04x\n", "UL_info->rx_ind.pdu_list[%d].rnti:%04x\n",
i, crc->rnti, i, rx->rnti); i, crc->rnti, i, rx->rnti);
AssertFatal(crc->rnti == rx->rnti, "mis-match between CRC RNTI %04x and RX RNTI %04x\n", crc->rnti, rx->rnti);
AssertFatal(crc->rnti == rx->rnti, "mis-match between CRC RNTI %04x and RX RNTI %04x\n", AssertFatal(crc->harq_id == rx->harq_id,
crc->rnti, rx->rnti); "mis-match between CRC HARQ ID %04x and RX HARQ ID %04x\n",
crc->harq_id,
AssertFatal(crc->harq_id == rx->harq_id, "mis-match between CRC HARQ ID %04x and RX HARQ ID %04x\n", rx->harq_id);
crc->harq_id, rx->harq_id);
LOG_D(NR_MAC, LOG_D(NR_MAC,
"%4d.%2d Calling rx_sdu (CRC %s/tb_crc_status %d)\n", "%4d.%2d Calling rx_sdu (CRC %s/tb_crc_status %d)\n",
...@@ -222,13 +223,11 @@ void handle_nr_ulsch(NR_UL_IND_t *UL_info) ...@@ -222,13 +223,11 @@ void handle_nr_ulsch(NR_UL_IND_t *UL_info)
} }
UL_info->rx_ind.number_of_pdus = 0; UL_info->rx_ind.number_of_pdus = 0;
UL_info->crc_ind.number_crcs = 0; UL_info->crc_ind.number_crcs = 0;
rc = pthread_mutex_unlock(&UL_info->crc_rx_mutex);
DevAssert(rc == 0);
} }
} }
void handle_nr_srs(NR_UL_IND_t *UL_info) { static void handle_nr_srs(NR_UL_IND_t *UL_info)
{
if(NFAPI_MODE == NFAPI_MODE_PNF) { if(NFAPI_MODE == NFAPI_MODE_PNF) {
if (UL_info->srs_ind.number_of_pdus > 0) { if (UL_info->srs_ind.number_of_pdus > 0) {
LOG_D(PHY,"PNF Sending UL_info->srs_ind.number_of_pdus: %d, SFN/SF:%d.%d \n", LOG_D(PHY,"PNF Sending UL_info->srs_ind.number_of_pdus: %d, SFN/SF:%d.%d \n",
......
...@@ -37,6 +37,9 @@ ...@@ -37,6 +37,9 @@
#include <stdint.h> #include <stdint.h>
#include "assertions.h" #include "assertions.h"
#include "nfapi_nr_interface_scf.h" #include "nfapi_nr_interface_scf.h"
#include "common/platform_constants.h"
#include "common/platform_types.h"
#include "common/openairinterface5g_limits.h"
#define MAX_NUM_DL_PDU 100 #define MAX_NUM_DL_PDU 100
#define MAX_NUM_UL_PDU 100 #define MAX_NUM_UL_PDU 100
...@@ -50,6 +53,10 @@ ...@@ -50,6 +53,10 @@
#define MAX_NUM_RACH_IND 100 #define MAX_NUM_RACH_IND 100
#define MAX_NUM_SRS_IND 100 #define MAX_NUM_SRS_IND 100
#define MAX_NUM_NR_RX_RACH_PDUS 4
#define MAX_UL_PDUS_PER_SLOT 8
#define MAX_NUM_NR_SRS_PDUS 8
#define MAX_NUM_NR_UCI_PDUS MAX_MOBILES_PER_GNB
typedef struct { typedef struct {
/// Module ID /// Module ID
module_id_t module_id; module_id_t module_id;
...@@ -64,10 +71,6 @@ typedef struct { ...@@ -64,10 +71,6 @@ typedef struct {
nfapi_nr_crc_indication_t crc_ind; nfapi_nr_crc_indication_t crc_ind;
/// RX indication /// RX indication
nfapi_nr_rx_data_indication_t rx_ind; nfapi_nr_rx_data_indication_t rx_ind;
/// mutex to protect concurrent access to crc_ind and rx_ind, which the L2
/// needs to be pairwise
pthread_mutex_t crc_rx_mutex;
/// RACH indication list /// RACH indication list
nfapi_nr_rach_indication_t rach_ind; nfapi_nr_rach_indication_t rach_ind;
...@@ -76,6 +79,12 @@ typedef struct { ...@@ -76,6 +79,12 @@ typedef struct {
/// UCI indication /// UCI indication
nfapi_nr_uci_indication_t uci_ind; nfapi_nr_uci_indication_t uci_ind;
nfapi_nr_crc_t crc_pdu_list[MAX_UL_PDUS_PER_SLOT];
nfapi_nr_rx_data_pdu_t rx_pdu_list[MAX_UL_PDUS_PER_SLOT];
nfapi_nr_srs_indication_pdu_t srs_pdu_list[MAX_NUM_NR_SRS_PDUS];
nfapi_nr_uci_t uci_pdu_list[MAX_NUM_NR_UCI_PDUS];
/// NFAPI PRACH information
nfapi_nr_prach_indication_pdu_t prach_pdu_indication_list[MAX_NUM_NR_RX_RACH_PDUS];
} NR_UL_IND_t; } NR_UL_IND_t;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment