Commit 205cc665 authored by Robert Schmidt's avatar Robert Schmidt

Refactor former find_nr_RA_id() to static function

parent 8f747d7a
......@@ -575,6 +575,16 @@ static NR_RA_t *find_free_nr_RA(NR_RA_t *ra_base, int ra_count, uint16_t preambl
return NULL;
}
static const NR_RA_t *find_nr_RA_rnti(const NR_RA_t *ra_base, int ra_count, rnti_t rnti)
{
for (int i = 0; i < ra_count; ++i) {
const NR_RA_t *ra = &ra_base[i];
if (ra->ra_state != nrRA_gNB_IDLE && ra->rnti == rnti)
return ra;
}
return NULL;
}
void nr_initiate_ra_proc(module_id_t module_idP,
int CC_id,
frame_t frameP,
......@@ -608,7 +618,7 @@ void nr_initiate_ra_proc(module_id_t module_idP,
while (trial < 1 || trial > 0xffef)
trial = (taus() % 0xffef) + 1;
exist_connected_ue = find_nr_UE(&nr_mac->UE_info, trial) != NULL;
exist_in_pending_ra_ue = find_nr_RA_id(module_idP, CC_id, trial) != -1;
exist_in_pending_ra_ue = find_nr_RA_rnti(cc->ra, sizeofArray(cc->ra), ra->rnti) != NULL;
loop++;
} while (loop < 100 && (exist_connected_ue || exist_in_pending_ra_ue) );
if (loop == 100) {
......
......@@ -2071,20 +2071,6 @@ NR_UE_info_t *find_nr_UE(NR_UEs_t *UEs, rnti_t rntiP)
return NULL;
}
int find_nr_RA_id(module_id_t mod_idP, int CC_idP, rnti_t rntiP)
{
NR_RA_t *ra = RC.nrmac[mod_idP]->common_channels[CC_idP].ra;
for (int RA_id = 0; RA_id < NR_NB_RA_PROC_MAX; RA_id++) {
LOG_D(NR_MAC, "Checking RA_id %d for %x : state %s\n", RA_id, rntiP, nrra_text[ra[RA_id].ra_state]);
if (ra[RA_id].ra_state != nrRA_gNB_IDLE && ra[RA_id].rnti == rntiP)
return RA_id;
}
return -1;
}
int get_nrofHARQ_ProcessesForPDSCH(e_NR_PDSCH_ServingCellConfig__nrofHARQ_ProcessesForPDSCH n)
{
switch (n) {
......
......@@ -302,8 +302,6 @@ void remove_front_nr_list(NR_list_t *listP);
NR_UE_info_t * find_nr_UE(NR_UEs_t* UEs, rnti_t rntiP);
int find_nr_RA_id(module_id_t mod_idP, int CC_idP, rnti_t rntiP);
void configure_UE_BWP(gNB_MAC_INST *nr_mac,
NR_ServingCellConfigCommon_t *scc,
NR_UE_sched_ctrl_t *sched_ctrl,
......
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