Lock the scheduler when reading MAC/RLC UE information for E2AP

For the E2SM-RLC REPORT service, return false if all connected UEs have 0 RBs.

Signed-off-by: Teodora Vladić <teodora.vladic@openairinterface.org>
This commit is contained in:
Teodora Vladić
2026-05-22 17:21:56 +02:00
parent a914b74ea8
commit 161b94b0cb
2 changed files with 14 additions and 11 deletions

View File

@@ -31,6 +31,8 @@ bool read_mac_sm(void* data)
assert(mac->msg.ue_stats != NULL && "Memory exhausted" );
}
gNB_MAC_INST *mac_inst = RC.nrmac[0];
NR_SCHED_LOCK(&mac_inst->sched_lock);
size_t i = 0; //TODO
UE_iterator(UE_info->connected_ue_list, UE) {
const NR_UE_sched_ctrl_t* sched_ctrl = &UE->UE_sched_ctrl;
@@ -93,6 +95,7 @@ bool read_mac_sm(void* data)
++i;
}
NR_SCHED_UNLOCK(&mac_inst->sched_lock);
return num_ues > 0;
}

View File

@@ -12,9 +12,6 @@
#include "openair2/LAYER2/nr_rlc/nr_rlc_oai_api.h"
#include "openair2/E2AP/flexric/src/util/time_now_us.h"
static
const int mod_id = 0;
static
uint32_t num_act_rb(NR_UEs_t* const UE_info)
{
@@ -57,20 +54,22 @@ bool read_rlc_sm(void* data)
rlc_ind_data_t* rlc = (rlc_ind_data_t*)data;
//fill_rlc_ind_data(rlc);
// use MAC structures to get RNTIs
NR_UEs_t *UE_info = &RC.nrmac[mod_id]->UE_info;
gNB_MAC_INST *mac_inst = RC.nrmac[0];
NR_SCHED_LOCK(&mac_inst->sched_lock);
NR_UEs_t *UE_info = &mac_inst->UE_info;
uint32_t const act_rb = num_act_rb(UE_info);
//assert(0!=0 && "Read RLC called");
rlc->msg.len = act_rb;
if (act_rb == 0) {
NR_SCHED_UNLOCK(&mac_inst->sched_lock);
return false;
}
rlc->msg.rb = calloc(rlc->msg.len, sizeof(rlc_radio_bearer_stats_t));
assert(rlc->msg.rb != NULL && "Memory exhausted");
// activate the rlc to calculate the average tx time
active_avg_to_tx(UE_info);
rlc->msg.len = act_rb;
if(rlc->msg.len > 0){
rlc->msg.rb = calloc(rlc->msg.len, sizeof(rlc_radio_bearer_stats_t));
assert(rlc->msg.rb != NULL && "Memory exhausted");
}
rlc->msg.tstamp = time_now_us();
uint32_t i = 0;
@@ -143,6 +142,7 @@ bool read_rlc_sm(void* data)
++i;
}
}
NR_SCHED_UNLOCK(&mac_inst->sched_lock);
return act_rb > 0;
}