Compare commits

...

1 Commits

Author SHA1 Message Date
Bartosz Podrygajlo
b27975e1f6 Remove references to gNB from ru_thread
Remove the references to gNB from ru_thread. This way the ru_thread
can be run without gNB being present in an executable.
2025-07-10 12:16:00 +02:00
12 changed files with 42 additions and 40 deletions

View File

@@ -74,14 +74,13 @@
#define L1STATSSTRLEN 16384
static void rx_func(processingData_L1_t *param);
static void tx_func(processingData_L1tx_t *info)
static void tx_func(processingData_L1tx_t *info, PHY_VARS_gNB *gNB)
{
int frame_tx = info->frame;
int slot_tx = info->slot;
int frame_rx = info->frame_rx;
int slot_rx = info->slot_rx;
LOG_D(NR_PHY, "%d.%d running tx_func\n", frame_tx, slot_tx);
PHY_VARS_gNB *gNB = info->gNB;
module_id_t module_id = gNB->Mod_id;
uint8_t CC_id = gNB->CC_id;
NR_IF_Module_t *ifi = gNB->if_inst;
@@ -99,7 +98,6 @@ static void tx_func(processingData_L1tx_t *info)
stop_meas(&gNB->slot_indication_stats);
gNB->msgDataTx->timestamp_tx = info->timestamp_tx;
info = gNB->msgDataTx;
info->gNB = gNB;
// At this point, MAC scheduler just ran, including scheduling
// PRACH/PUCCH/PUSCH, so trigger RX chain processing
@@ -115,10 +113,9 @@ static void tx_func(processingData_L1tx_t *info)
int tx_slot_type = nr_slot_select(cfg, frame_tx, slot_tx);
if (tx_slot_type == NR_DOWNLINK_SLOT || tx_slot_type == NR_MIXED_SLOT || get_softmodem_params()->continuous_tx) {
start_meas(&info->gNB->phy_proc_tx);
phy_procedures_gNB_TX(info, frame_tx, slot_tx, 1);
start_meas(&gNB->phy_proc_tx);
phy_procedures_gNB_TX(info, frame_tx, slot_tx, 1, gNB);
PHY_VARS_gNB *gNB = info->gNB;
processingData_RU_t syncMsgRU;
syncMsgRU.frame_tx = frame_tx;
syncMsgRU.slot_tx = slot_tx;
@@ -126,7 +123,7 @@ static void tx_func(processingData_L1tx_t *info)
syncMsgRU.timestamp_tx = info->timestamp_tx;
LOG_D(PHY, "gNB: %d.%d : calling RU TX function\n", syncMsgRU.frame_tx, syncMsgRU.slot_tx);
ru_tx_func((void *)&syncMsgRU);
stop_meas(&info->gNB->phy_proc_tx);
stop_meas(&gNB->phy_proc_tx);
}
if (NFAPI_MODE == NFAPI_MONOLITHIC) {
@@ -161,7 +158,7 @@ void *L1_tx_thread(void *arg) {
if (res == NULL) // stopping condition, happens only when queue is freed
break;
processingData_L1tx_t *info = (processingData_L1tx_t *)NotifiedFifoData(res);
tx_func(info);
tx_func(info, gNB);
delNotifiedFIFO_elt(res);
}
return NULL;

View File

@@ -1098,7 +1098,6 @@ void *ru_thread(void *param)
RU_t *ru = (RU_t *)param;
RU_proc_t *proc = &ru->proc;
NR_DL_FRAME_PARMS *fp = ru->nr_frame_parms;
PHY_VARS_gNB *gNB = RC.gNB[0];
int ret;
int slot = fp->slots_per_frame-1;
int frame = 1023;
@@ -1111,7 +1110,6 @@ void *ru_thread(void *param)
// set default return value
sprintf(threadname,"ru_thread %u",ru->idx);
LOG_I(PHY,"Starting RU %d (%s,%s) on cpu %d\n",ru->idx,NB_functions[ru->function],NB_timing[ru->if_timing],sched_getcpu());
memcpy((void *)&ru->config,(void *)&RC.gNB[0]->gNB_config,sizeof(ru->config));
nr_init_frame_parms(&ru->config, fp);
nr_dump_frame_parms(fp);
@@ -1245,12 +1243,14 @@ void *ru_thread(void *param)
proc->timestamp_tx += fp->get_samples_per_slot(i % fp->slots_per_frame, fp);
proc->tti_tx = (proc->tti_rx + ru->sl_ahead) % fp->slots_per_frame;
proc->frame_tx = proc->tti_rx > proc->tti_tx ? (proc->frame_rx + 1) & 1023 : proc->frame_rx;
LOG_D(PHY,"AFTER fh_south_in - SFN/SL:%d%d RU->proc[RX:%d.%d TX:%d.%d] RC.gNB[0]:[RX:%d%d TX(SFN):%d]\n",
frame,slot,
proc->frame_rx,proc->tti_rx,
proc->frame_tx,proc->tti_tx,
RC.gNB[0]->proc.frame_rx,RC.gNB[0]->proc.slot_rx,
RC.gNB[0]->proc.frame_tx);
LOG_D(PHY,
"AFTER fh_south_in - SFN/SL:%d%d RU->proc[RX:%d.%d TX:%d.%d]\n",
frame,
slot,
proc->frame_rx,
proc->tti_rx,
proc->frame_tx,
proc->tti_tx);
if (ru->idx != 0)
proc->frame_tx = (proc->frame_tx + proc->frame_offset) & 1023;
@@ -1258,20 +1258,20 @@ void *ru_thread(void *param)
// do RX front-end processing (frequency-shift, dft) if needed
int slot_type = nr_slot_select(&ru->config, proc->frame_rx, proc->tti_rx);
if (slot_type == NR_UPLINK_SLOT || slot_type == NR_MIXED_SLOT) {
if (!wait_free_rx_tti(&gNB->L1_rx_out, rx_tti_busy, proc->frame_rx, proc->tti_rx))
if (!wait_free_rx_tti(ru->L1_rx_out, rx_tti_busy, proc->frame_rx, proc->tti_rx))
break; // nothing to wait for: we have to stop
if (ru->feprx) {
ru->feprx(ru,proc->tti_rx);
LOG_D(NR_PHY, "Setting %d.%d (%d) to busy\n", proc->frame_rx, proc->tti_rx, proc->tti_rx % RU_RX_SLOT_DEPTH);
//LOG_M("rxdata.m","rxs",ru->common.rxdata[0],1228800,1,1);
LOG_D(PHY,"RU proc: frame_rx = %d, tti_rx = %d\n", proc->frame_rx, proc->tti_rx);
gNBscopeCopy(RC.gNB[0],
gNBscopeCopy(ru,
gNBRxdataF,
ru->common.rxdataF[0],
sizeof(c16_t),
1,
gNB->frame_parms.samples_per_slot_wCP,
proc->tti_rx * gNB->frame_parms.samples_per_slot_wCP);
ru->nr_frame_parms->samples_per_slot_wCP,
proc->tti_rx * ru->nr_frame_parms->samples_per_slot_wCP);
// Do PRACH RU processing
int prach_id = find_nr_prach_ru(ru, proc->frame_rx, proc->tti_rx, SEARCH_EXIST);
@@ -1307,16 +1307,15 @@ void *ru_thread(void *param)
} // end if (ru->feprx)
} // end if (slot_type == NR_UPLINK_SLOT || slot_type == NR_MIXED_SLOT) {
notifiedFIFO_elt_t *resTx = newNotifiedFIFO_elt(sizeof(processingData_L1tx_t), 0, &gNB->L1_tx_out, NULL);
notifiedFIFO_elt_t *resTx = newNotifiedFIFO_elt(sizeof(processingData_L1tx_t), 0, ru->L1_tx_out, NULL);
processingData_L1tx_t *syncMsgTx = NotifiedFifoData(resTx);
syncMsgTx->gNB = gNB;
syncMsgTx->frame = proc->frame_tx;
syncMsgTx->slot = proc->tti_tx;
syncMsgTx->frame_rx = proc->frame_rx;
syncMsgTx->slot_rx = proc->tti_rx;
syncMsgTx->timestamp_tx = proc->timestamp_tx;
resTx->key = proc->tti_tx;
pushNotifiedFIFO(&gNB->L1_tx_out, resTx);
pushNotifiedFIFO(ru->L1_tx_out, resTx);
}
ru_thread_status = 0;

View File

@@ -477,7 +477,9 @@ int start_L1L2(module_id_t gnb_id)
prepare_du_configuration_update(mac, info, mib, sib1);
init_NR_RU(config_get_if(), NULL);
RC.ru[0]->L1_rx_out = &RC.gNB[0]->L1_rx_out;
RC.ru[0]->L1_tx_out = &RC.gNB[0]->L1_tx_out;
memcpy(&RC.ru[0]->config, &RC.gNB[0]->gNB_config, sizeof(RC.ru[0]->config));
start_NR_RU();
wait_RUs();
init_eNB_afterRU();
@@ -701,8 +703,12 @@ int main( int argc, char **argv ) {
if (NFAPI_MODE != NFAPI_MODE_PNF && (NODE_IS_DU(node_type) || NODE_IS_MONOLITHIC(node_type)))
wait_f1_setup_response();
if (RC.nb_RU > 0)
if (RC.nb_RU > 0) {
RC.ru[0]->L1_rx_out = &RC.gNB[0]->L1_rx_out;
RC.ru[0]->L1_tx_out = &RC.gNB[0]->L1_tx_out;
memcpy(&RC.ru[0]->config, &RC.gNB[0]->gNB_config, sizeof(RC.ru[0]->config));
start_NR_RU();
}
#ifdef ENABLE_AERIAL
gNB_MAC_INST *nrmac = RC.nrmac[0];

View File

@@ -247,15 +247,14 @@ static void nr_generate_dci(PHY_VARS_gNB *gNB,
} // for (int d=0;d<pdcch_pdu_rel15->numDlDci;d++)
}
void nr_generate_dci_top(processingData_L1tx_t *msgTx, int slot, int txdataF_offset)
void nr_generate_dci_top(processingData_L1tx_t *msgTx, int slot, int txdataF_offset, PHY_VARS_gNB *gNB)
{
PHY_VARS_gNB *gNB = msgTx->gNB;
NR_DL_FRAME_PARMS *frame_parms = &gNB->frame_parms;
start_meas(&gNB->dci_generation_stats);
for (int i = 0; i < msgTx->num_ul_pdcch; i++)
nr_generate_dci(msgTx->gNB, &msgTx->ul_pdcch_pdu[i].pdcch_pdu.pdcch_pdu_rel15, txdataF_offset, frame_parms, slot);
nr_generate_dci(gNB, &msgTx->ul_pdcch_pdu[i].pdcch_pdu.pdcch_pdu_rel15, txdataF_offset, frame_parms, slot);
for (int i = 0; i < msgTx->num_dl_pdcch; i++)
nr_generate_dci(msgTx->gNB, &msgTx->pdcch_pdu[i].pdcch_pdu_rel15, txdataF_offset, frame_parms, slot);
nr_generate_dci(gNB, &msgTx->pdcch_pdu[i].pdcch_pdu_rel15, txdataF_offset, frame_parms, slot);
stop_meas(&gNB->dci_generation_stats);
}

View File

@@ -26,7 +26,7 @@
#include "PHY/NR_REFSIG/nr_refsig.h"
#include "nfapi/open-nFAPI/nfapi/public_inc/nfapi_nr_interface.h"
void nr_generate_dci_top(processingData_L1tx_t *msgTx, int slot, int txdataF_offset);
void nr_generate_dci_top(processingData_L1tx_t *msgTx, int slot, int txdataF_offset, PHY_VARS_gNB *gNB);
int16_t find_nr_pdcch(int frame,int slot, PHY_VARS_gNB *gNB,find_type_t type);

View File

@@ -772,9 +772,8 @@ static int do_one_dlsch(unsigned char *input_ptr, PHY_VARS_gNB *gNB, NR_gNB_DLSC
return ((size_output_tb + 511) >> 9) << 6;
}
void nr_generate_pdsch(processingData_L1tx_t *msgTx, int frame, int slot)
void nr_generate_pdsch(processingData_L1tx_t *msgTx, int frame, int slot, PHY_VARS_gNB *gNB)
{
PHY_VARS_gNB *gNB = msgTx->gNB;
NR_DL_FRAME_PARMS *frame_parms = &gNB->frame_parms;
time_stats_t *dlsch_encoding_stats = &gNB->dlsch_encoding_stats;
time_stats_t *tinput = &gNB->tinput;

View File

@@ -40,7 +40,8 @@ void nr_fill_dlsch_tx_req(processingData_L1tx_t *msgTx, int idx, uint8_t *sdu);
void nr_generate_pdsch(processingData_L1tx_t *msgTx,
int frame,
int slot);
int slot,
PHY_VARS_gNB *gNB);
int nr_dlsch_encoding(PHY_VARS_gNB *gNB,
processingData_L1tx_t *msgTx,

View File

@@ -668,6 +668,8 @@ typedef struct RU_t_s {
/// number of cores for RU ThreadPool
int num_tpcores;
void* scopeData;
notifiedFIFO_t *L1_rx_out;
notifiedFIFO_t *L1_tx_out;
} RU_t;

View File

@@ -627,7 +627,6 @@ typedef struct processingData_L1tx {
int frame_rx;
int slot_rx;
openair0_timestamp timestamp_tx;
PHY_VARS_gNB *gNB;
nfapi_nr_dl_tti_pdcch_pdu pdcch_pdu[NFAPI_NR_MAX_NB_CORESETS];
nfapi_nr_ul_dci_request_pdus_t ul_pdcch_pdu[NFAPI_NR_MAX_NB_CORESETS];
NR_gNB_CSIRS_t csirs_pdu[NR_SYMBOLS_PER_SLOT];

View File

@@ -195,9 +195,9 @@ void clear_slot_beamid(PHY_VARS_gNB *gNB, int slot)
void phy_procedures_gNB_TX(processingData_L1tx_t *msgTx,
int frame,
int slot,
int do_meas)
int do_meas,
PHY_VARS_gNB *gNB)
{
PHY_VARS_gNB *gNB = msgTx->gNB;
NR_DL_FRAME_PARMS *fp = &gNB->frame_parms;
nfapi_nr_config_request_scf_t *cfg = &gNB->gNB_config;
int slot_prs = 0;
@@ -249,7 +249,7 @@ void phy_procedures_gNB_TX(processingData_L1tx_t *msgTx,
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_gNB_PDCCH_TX,1);
nr_generate_dci_top(msgTx, slot, txdataF_offset);
nr_generate_dci_top(msgTx, slot, txdataF_offset, gNB);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_gNB_PDCCH_TX,0);
}
@@ -259,7 +259,7 @@ void phy_procedures_gNB_TX(processingData_L1tx_t *msgTx,
if (msgTx->num_pdsch_slot > 0) {
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_GENERATE_DLSCH,1);
LOG_D(PHY, "PDSCH generation started (%d) in frame %d.%d\n", msgTx->num_pdsch_slot,frame,slot);
nr_generate_pdsch(msgTx, frame, slot);
nr_generate_pdsch(msgTx, frame, slot, gNB);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_GENERATE_DLSCH,0);
}
msgTx->num_pdsch_slot = 0;

View File

@@ -33,7 +33,7 @@
#include "phy_frame_config_nr.h"
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, PHY_VARS_gNB *gNB);
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, 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);

View File

@@ -1121,7 +1121,7 @@ printf("%d\n", slot);
msgDataTx->gNB = gNB;
start_meas(&gNB->phy_proc_tx);
phy_procedures_gNB_TX(msgDataTx,frame,slot,1);
phy_procedures_gNB_TX(msgDataTx, frame, slot, 1, gNB);
stop_meas(&gNB->phy_proc_tx);
int txdataF_offset = slot * frame_parms->samples_per_slot_wCP;