From 595a80a3f7fd152899d3a30fadeb20469fa3520d Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Mon, 13 Jan 2025 16:00:04 +0100 Subject: [PATCH] Remove FHI72 memory workaround The queue L1_rx_out was in place to keep RX/TX processing relatively "close" to each other (in terms of time, since in RFsim, they might advance faster than realtime; see also parent commit). This lead to a memory leak in radios that do not use ru->feprx (no front-end processing for RX, e.g., PRACH), as the code to read the L1_rx_out messages was inside a block of if (ru->feprx). Move it out so that the queue is always read and messages are freed to eliminate the memory leak, and remove the workaround for FHI72 to avoid this memory leak. This also allows to run RFsim when compiling FHI72, which was not possible before this commit. Closes: #812 --- executables/nr-gnb.c | 2 -- executables/nr-ru.c | 8 ++------ radio/fhi_72/CMakeLists.txt | 3 --- 3 files changed, 2 insertions(+), 11 deletions(-) diff --git a/executables/nr-gnb.c b/executables/nr-gnb.c index 0aa538c348..6acd649ab6 100644 --- a/executables/nr-gnb.c +++ b/executables/nr-gnb.c @@ -219,7 +219,6 @@ static void rx_func(processingData_L1_t *info) gNB->if_inst->NR_UL_indication(&UL_INFO); stop_meas(&gNB->ul_indication_stats); -#ifndef OAI_FHI72 notifiedFIFO_elt_t *res = newNotifiedFIFO_elt(sizeof(processingData_L1_t), 0, &gNB->L1_rx_out, NULL); processingData_L1_t *syncMsg = NotifiedFifoData(res); syncMsg->gNB = gNB; @@ -228,7 +227,6 @@ static void rx_func(processingData_L1_t *info) res->key = slot_rx; LOG_D(NR_PHY, "Signaling completion for %d.%d (mod_slot %d) on L1_rx_out\n", frame_rx, slot_rx, slot_rx % RU_RX_SLOT_DEPTH); pushNotifiedFIFO(&gNB->L1_rx_out, res); -#endif } } diff --git a/executables/nr-ru.c b/executables/nr-ru.c index 3921f6ca60..f3311ecb65 100644 --- a/executables/nr-ru.c +++ b/executables/nr-ru.c @@ -1139,9 +1139,7 @@ void *ru_thread(void *param) char threadname[40]; int initial_wait = 0; -#ifndef OAI_FHI72 bool rx_tti_busy[RU_RX_SLOT_DEPTH] = {false}; -#endif // set default return value ru_thread_status = 0; // set default return value @@ -1287,13 +1285,12 @@ void *ru_thread(void *param) if (ru->idx != 0) proc->frame_tx = (proc->frame_tx + proc->frame_offset) & 1023; -#ifndef OAI_FHI72 // 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)) + break; // nothing to wait for: we have to stop if (ru->feprx) { - if (!wait_free_rx_tti(&gNB->L1_rx_out, rx_tti_busy, proc->frame_rx, proc->tti_rx)) - break; // nothing to wait for: we have to stop 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); @@ -1331,7 +1328,6 @@ void *ru_thread(void *param) } // end if (prach_id > 0) } // end if (ru->feprx) } // end if (slot_type == NR_UPLINK_SLOT || slot_type == NR_MIXED_SLOT) { -#endif notifiedFIFO_elt_t *resTx = newNotifiedFIFO_elt(sizeof(processingData_L1tx_t), 0, &gNB->L1_tx_out, NULL); processingData_L1tx_t *syncMsgTx = NotifiedFifoData(resTx); diff --git a/radio/fhi_72/CMakeLists.txt b/radio/fhi_72/CMakeLists.txt index 00f7ef97e0..4068b285d8 100644 --- a/radio/fhi_72/CMakeLists.txt +++ b/radio/fhi_72/CMakeLists.txt @@ -43,6 +43,3 @@ set_target_properties(oran_fhlib_5g PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CMAKE_ add_custom_command(TARGET oran_fhlib_5g POST_BUILD COMMAND ${CMAKE_COMMAND} -E create_symlink liboran_fhlib_5g.so liboai_transpro.so WORKING_DIRECTORY ${CMAKE_BINARY_DIR}) - -message(STATUS "Temporary added -DOAI_FHI72") -target_compile_definitions(nr-softmodem PUBLIC OAI_FHI72)