Commit 31cf9ab8 authored by rmagueta's avatar rmagueta

Fix ra->rnti

parent 495ba892
...@@ -655,6 +655,7 @@ typedef struct { ...@@ -655,6 +655,7 @@ typedef struct {
int prach_I0; int prach_I0;
} PHY_MEASUREMENTS_gNB; } PHY_MEASUREMENTS_gNB;
#define TOTAL_NUM_NR_PRACH_PREAMBLES 64
#define MAX_NUM_NR_RX_RACH_PDUS 4 #define MAX_NUM_NR_RX_RACH_PDUS 4
#define MAX_NUM_NR_RX_PRACH_PREAMBLES 4 #define MAX_NUM_NR_RX_PRACH_PREAMBLES 4
#define MAX_UL_PDUS_PER_SLOT 8 #define MAX_UL_PDUS_PER_SLOT 8
......
...@@ -416,6 +416,13 @@ int rrc_mac_config_req_gNB(module_id_t Mod_idP, ...@@ -416,6 +416,13 @@ int rrc_mac_config_req_gNB(module_id_t Mod_idP,
for (int i = 0; i < num_preamble; i++) for (int i = 0; i < num_preamble; i++)
ra->preambles.preamble_list[i] = cfra.resources.choice.ssb->ssb_ResourceList.list.array[i]->ra_PreambleIndex; ra->preambles.preamble_list[i] = cfra.resources.choice.ssb->ssb_ResourceList.list.array[i]->ra_PreambleIndex;
} }
} else {
ra->cfra = false;
ra->rnti = rnti;
ra->preambles.num_preambles = TOTAL_NUM_NR_PRACH_PREAMBLES;
ra->preambles.preamble_list = (uint8_t *) malloc(TOTAL_NUM_NR_PRACH_PREAMBLES*sizeof(uint8_t));
for (int i = 0; i < TOTAL_NUM_NR_PRACH_PREAMBLES; i++)
ra->preambles.preamble_list[i] = i;
} }
LOG_I(PHY,"Added new RA process for UE RNTI %04x with initial secondaryCellGroup\n", rnti); LOG_I(PHY,"Added new RA process for UE RNTI %04x with initial secondaryCellGroup\n", rnti);
} else { // secondaryCellGroup has been updated } else { // secondaryCellGroup has been updated
......
...@@ -454,16 +454,12 @@ void nr_initiate_ra_proc(module_id_t module_idP, ...@@ -454,16 +454,12 @@ void nr_initiate_ra_proc(module_id_t module_idP,
// if the preamble received correspond to one of the listed // if the preamble received correspond to one of the listed
// the UE sent a RACH either for starting RA procedure or RA procedure failed and UE retries // the UE sent a RACH either for starting RA procedure or RA procedure failed and UE retries
int pr_found=0; int pr_found=0;
if(ra->preambles.num_preambles > 0) {
for (int i = 0; i < ra->preambles.num_preambles; i++) { for (int i = 0; i < ra->preambles.num_preambles; i++) {
if (preamble_index == ra->preambles.preamble_list[i]) { if (preamble_index == ra->preambles.preamble_list[i]) {
pr_found=1; pr_found=1;
break; break;
} }
} }
} else {
pr_found=1;
}
if (!pr_found) { if (!pr_found) {
LOG_E(MAC, "[gNB %d][RAPROC] FAILURE: preamble %d does not correspond to any of the ones in rach_ConfigDedicated\n", LOG_E(MAC, "[gNB %d][RAPROC] FAILURE: preamble %d does not correspond to any of the ones in rach_ConfigDedicated\n",
...@@ -487,7 +483,7 @@ void nr_initiate_ra_proc(module_id_t module_idP, ...@@ -487,7 +483,7 @@ void nr_initiate_ra_proc(module_id_t module_idP,
preamble_index, preamble_index,
freq_index, freq_index,
symbol); symbol);
int loop = 0;
LOG_D(MAC, "Frame %d, Slot %d: Activating RA process \n", frameP, slotP); LOG_D(MAC, "Frame %d, Slot %d: Activating RA process \n", frameP, slotP);
ra->state = Msg2; ra->state = Msg2;
ra->timing_offset = timing_offset; ra->timing_offset = timing_offset;
...@@ -514,6 +510,10 @@ void nr_initiate_ra_proc(module_id_t module_idP, ...@@ -514,6 +510,10 @@ void nr_initiate_ra_proc(module_id_t module_idP,
ra->Msg2_slot = msg2_slot; ra->Msg2_slot = msg2_slot;
LOG_I(MAC, "%s() Msg2[%04d%d] SFN/SF:%04d%d\n", __FUNCTION__, ra->Msg2_frame, ra->Msg2_slot, frameP, slotP); LOG_I(MAC, "%s() Msg2[%04d%d] SFN/SF:%04d%d\n", __FUNCTION__, ra->Msg2_frame, ra->Msg2_slot, frameP, slotP);
// TODO: Configure RRC with the new RNTI of the following commented lines
/*
int loop = 0;
if (!ra->cfra) { if (!ra->cfra) {
do { do {
ra->rnti = (taus() % 65518) + 1; ra->rnti = (taus() % 65518) + 1;
...@@ -525,6 +525,8 @@ void nr_initiate_ra_proc(module_id_t module_idP, ...@@ -525,6 +525,8 @@ void nr_initiate_ra_proc(module_id_t module_idP,
abort(); abort();
} }
} }
*/
ra->RA_rnti = ra_rnti; ra->RA_rnti = ra_rnti;
ra->preamble_index = preamble_index; ra->preamble_index = preamble_index;
ra->beam_id = beam_index; ra->beam_id = beam_index;
......
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