Commit 0fb0203c authored by rmagueta's avatar rmagueta

Add condition to call or not the function nr_mac_prepare_ra_ue()

parent 464a62dd
...@@ -114,7 +114,11 @@ void process_CellGroup(NR_CellGroupConfig_t *CellGroup, NR_UE_info_t *UE) ...@@ -114,7 +114,11 @@ void process_CellGroup(NR_CellGroupConfig_t *CellGroup, NR_UE_info_t *UE)
//process_phr_Config(sched_ctrl,mac_CellGroupConfig->phr_Config); //process_phr_Config(sched_ctrl,mac_CellGroupConfig->phr_Config);
} }
nr_mac_prepare_ra_ue(RC.nrmac[0], UE->rnti, CellGroup); if (CellGroup->spCellConfig && CellGroup->spCellConfig->reconfigurationWithSync
&& CellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated
&& CellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra) {
nr_mac_prepare_ra_ue(RC.nrmac[0], UE->rnti, CellGroup);
}
process_rlcBearerConfig(CellGroup->rlc_BearerToAddModList, CellGroup->rlc_BearerToReleaseList, &UE->UE_sched_ctrl); process_rlcBearerConfig(CellGroup->rlc_BearerToAddModList, CellGroup->rlc_BearerToReleaseList, &UE->UE_sched_ctrl);
} }
...@@ -597,35 +601,21 @@ bool nr_mac_prepare_ra_ue(gNB_MAC_INST *nrmac, uint32_t rnti, NR_CellGroupConfig ...@@ -597,35 +601,21 @@ bool nr_mac_prepare_ra_ue(gNB_MAC_INST *nrmac, uint32_t rnti, NR_CellGroupConfig
return false; return false;
} }
NR_RA_t *ra = &cc->ra[ra_index]; NR_RA_t *ra = &cc->ra[ra_index];
if (CellGroup->spCellConfig && CellGroup->spCellConfig->reconfigurationWithSync ra->cfra = true;
&& CellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated != NULL) { ra->rnti = rnti;
if (CellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra != NULL) { ra->CellGroup = CellGroup;
ra->cfra = true; struct NR_CFRA *cfra = CellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra;
ra->rnti = rnti; uint8_t num_preamble = cfra->resources.choice.ssb->ssb_ResourceList.list.count;
ra->CellGroup = CellGroup; ra->preambles.num_preambles = num_preamble;
struct NR_CFRA *cfra = CellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra; ra->preambles.preamble_list = calloc(ra->preambles.num_preambles, sizeof(*ra->preambles.preamble_list));
uint8_t num_preamble = cfra->resources.choice.ssb->ssb_ResourceList.list.count; for (int i = 0; i < cc->num_active_ssb; i++) {
ra->preambles.num_preambles = num_preamble; for (int j = 0; j < num_preamble; j++) {
ra->preambles.preamble_list = calloc(ra->preambles.num_preambles, sizeof(*ra->preambles.preamble_list)); if (cc->ssb_index[i] == cfra->resources.choice.ssb->ssb_ResourceList.list.array[j]->ssb) {
for (int i = 0; i < cc->num_active_ssb; i++) { // one dedicated preamble for each beam
for (int j = 0; j < num_preamble; j++) { ra->preambles.preamble_list[i] = cfra->resources.choice.ssb->ssb_ResourceList.list.array[j]->ra_PreambleIndex;
if (cc->ssb_index[i] == cfra->resources.choice.ssb->ssb_ResourceList.list.array[j]->ssb) { break;
// one dedicated preamble for each beam
ra->preambles.preamble_list[i] = cfra->resources.choice.ssb->ssb_ResourceList.list.array[j]->ra_PreambleIndex;
break;
}
}
} }
} }
} else {
ra->cfra = false;
ra->rnti = 0;
if (ra->preambles.preamble_list == NULL) {
ra->preambles.num_preambles = MAX_NUM_NR_PRACH_PREAMBLES;
ra->preambles.preamble_list = (uint8_t *)malloc(MAX_NUM_NR_PRACH_PREAMBLES * sizeof(uint8_t));
for (int i = 0; i < MAX_NUM_NR_PRACH_PREAMBLES; i++)
ra->preambles.preamble_list[i] = i;
}
} }
LOG_I(NR_MAC, "Added new %s process for UE RNTI %04x with initial CellGroup\n", ra->cfra ? "CFRA" : "CBRA", rnti); LOG_I(NR_MAC, "Added new %s process for UE RNTI %04x with initial CellGroup\n", ra->cfra ? "CFRA" : "CBRA", rnti);
return true; return true;
......
...@@ -359,6 +359,11 @@ void rrc_add_nsa_user(gNB_RRC_INST *rrc, rrc_gNB_ue_context_t *ue_context_p, x2a ...@@ -359,6 +359,11 @@ void rrc_add_nsa_user(gNB_RRC_INST *rrc, rrc_gNB_ue_context_t *ue_context_p, x2a
// phytest mode: we don't set up RA, etc // phytest mode: we don't set up RA, etc
ret = nr_mac_add_test_ue(RC.nrmac[rrc->module_id], du_ue_id, ue_context_p->ue_context.secondaryCellGroup); ret = nr_mac_add_test_ue(RC.nrmac[rrc->module_id], du_ue_id, ue_context_p->ue_context.secondaryCellGroup);
} else { } else {
NR_CellGroupConfig_t *secondaryCellGroup = ue_context_p->ue_context.secondaryCellGroup;
DevAssert(secondaryCellGroup->spCellConfig
&& secondaryCellGroup->spCellConfig->reconfigurationWithSync
&& secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated
&& secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra);
NR_SCHED_LOCK(&RC.nrmac[rrc->module_id]->sched_lock); NR_SCHED_LOCK(&RC.nrmac[rrc->module_id]->sched_lock);
ret = nr_mac_prepare_ra_ue(RC.nrmac[rrc->module_id], du_ue_id, ue_context_p->ue_context.secondaryCellGroup); ret = nr_mac_prepare_ra_ue(RC.nrmac[rrc->module_id], du_ue_id, ue_context_p->ue_context.secondaryCellGroup);
NR_SCHED_UNLOCK(&RC.nrmac[rrc->module_id]->sched_lock); NR_SCHED_UNLOCK(&RC.nrmac[rrc->module_id]->sched_lock);
......
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