Use spsc_q to process PRACH jobs

Use two queues for PRACH processing:

- prach_ru_queue: pass jobs from TX thread (scheduler) to RU thread. For
  split 8, the RU thread itself handles PRACH processing; for split 7.2,
  it is the library that is responsible for handling PRACH messages (see
  oran_fh_if4p5_south_in())
- prach_l1rx_queue: after jobs have been handled in RU thread, use this
  queue to pass jobs to the RX thread. There, preamble detection is
  performed, and RACH.indication FAPI messages are filled if a preamble
  has been detected.

Together, these queues replace a linear search in a global array that
has been modified by three threads at the same time. The design ensures
that access now is thread-safe, and with less overhead.

Signed-off-by: Robert Schmidt <robert.schmidt@openairinterface.org>
This commit is contained in:
Robert Schmidt
2026-04-16 12:16:47 +02:00
parent 879e374d32
commit 03096dd495
11 changed files with 118 additions and 125 deletions
+8 -11
View File
@@ -547,12 +547,10 @@ int main(int argc, char **argv){
phy_init_nr_gNB(gNB);
nr_phy_init_RU(ru);
prach_item_t *prach_data = calloc(1,sizeof(prach_item_t));
gNB->prach_list.list[0] = prach_data;
nfapi_nr_prach_pdu_t *prach_pdu = &prach_data->pdu;
prach_pdu->num_cs = get_NCS(NCS_config, format0, restrictedSetConfig);
prach_config->num_prach_fd_occasions_list[fd_occasion].num_root_sequences.value = 1+(64/(N_ZC/prach_pdu->num_cs));
prach_pdu->prach_format = prach_format;
nfapi_nr_prach_pdu_t prach_pdu = {0};
prach_pdu.num_cs = get_NCS(NCS_config, format0, restrictedSetConfig);
prach_config->num_prach_fd_occasions_list[fd_occasion].num_root_sequences.value = 1+(64/(N_ZC/prach_pdu.num_cs));
prach_pdu.prach_format = prach_format;
// Configure UE
UE = malloc(sizeof(PHY_VARS_NR_UE));
@@ -749,14 +747,14 @@ int main(int argc, char **argv){
}
nfapi_nr_prach_config_t *cfg = &gNB->gNB_config.prach_config;
nfapi_nr_num_prach_fd_occasions_t *occ = &cfg->num_prach_fd_occasions_list[prach_pdu->num_ra];
prach_pdu->num_prach_ocas=1;
nfapi_nr_num_prach_fd_occasions_t *occ = &cfg->num_prach_fd_occasions_list[prach_pdu.num_ra];
prach_pdu.num_prach_ocas=1;
prach_item_t *in = malloc(sizeof(prach_item_t)
+ sizeof(c16_t) * gNB->gNB_config.carrier_config.num_rx_ant.value
* NUMBER_OF_NR_RU_PRACH_OCCASIONS_MAX * NR_PRACH_SEQ_LEN_L);
*in = (prach_item_t){.frame = frame,
.slot = slot,
.pdu = *prach_pdu,
.pdu = prach_pdu,
.rootSequenceIndex = occ->prach_root_sequence_index.value,
.numrootSequenceIndex = occ->num_root_sequences.value,
.msg1_frequencystart = occ->k1.value,
@@ -772,7 +770,7 @@ int main(int argc, char **argv){
if (n_frames == 1)
LOG_I(PHY,
"ncs %d,num_seq %d\n",
prach_pdu->num_cs,
prach_pdu.num_cs,
prach_config->num_prach_fd_occasions_list[fd_occasion].num_root_sequences.value);
rx_prach_out_t out = rx_nr_prach(in, prachOccasion);
@@ -823,7 +821,6 @@ int main(int argc, char **argv){
nr_phy_free_RU(ru);
free(RC.ru[0]);
free(RC.ru);
free(prach_data);
phy_free_nr_gNB(gNB);
// allocated in set_tdd_config_nr()
int nb_slots_to_set = (1<<mu)*NR_NUMBER_OF_SUBFRAMES_PER_FRAME;