Commit ee047b88 authored by rmagueta's avatar rmagueta

Remove TC-RNTI at PHY when RA procedure does not succeeded

parent 4bd9972f
...@@ -1378,7 +1378,7 @@ void nr_check_Msg4_Ack(module_id_t module_id, int CC_id, frame_t frame, sub_fram ...@@ -1378,7 +1378,7 @@ void nr_check_Msg4_Ack(module_id_t module_id, int CC_id, frame_t frame, sub_fram
NR_UE_info_t *UE_info = &RC.nrmac[module_id]->UE_info; NR_UE_info_t *UE_info = &RC.nrmac[module_id]->UE_info;
NR_UE_harq_t *harq = &UE_info->UE_sched_ctrl[UE_id].harq_processes[current_harq_pid]; NR_UE_harq_t *harq = &UE_info->UE_sched_ctrl[UE_id].harq_processes[current_harq_pid];
LOG_D(MAC, "ue %d, rnti %d, harq is waiting %d, round %d, frame %d %d, harq id %d\n", UE_id, ra->rnti, harq->is_waiting, harq->round, frame, slot, current_harq_pid); LOG_D(NR_MAC, "ue %d, rnti %d, harq is waiting %d, round %d, frame %d %d, harq id %d\n", UE_id, ra->rnti, harq->is_waiting, harq->round, frame, slot, current_harq_pid);
if (harq->is_waiting == 0) if (harq->is_waiting == 0)
{ {
......
...@@ -1756,12 +1756,22 @@ void mac_remove_nr_ue(module_id_t mod_id, rnti_t rnti) ...@@ -1756,12 +1756,22 @@ void mac_remove_nr_ue(module_id_t mod_id, rnti_t rnti)
if (pthread_mutex_lock(&rnti_to_remove_mutex)) exit(1); if (pthread_mutex_lock(&rnti_to_remove_mutex)) exit(1);
if (rnti_to_remove_count == 10) exit(1); if (rnti_to_remove_count == 10) exit(1);
rnti_to_remove[rnti_to_remove_count] = rnti; rnti_to_remove[rnti_to_remove_count] = rnti;
LOG_W(MAC, "to remove in mac rnti_to_remove[%d]=%d\n", rnti_to_remove_count, rnti); LOG_W(NR_MAC, "to remove in mac rnti_to_remove[%d] = 0x%04x\n", rnti_to_remove_count, rnti);
rnti_to_remove_count++; rnti_to_remove_count++;
if (pthread_mutex_unlock(&rnti_to_remove_mutex)) exit(1); if (pthread_mutex_unlock(&rnti_to_remove_mutex)) exit(1);
} }
} }
void nr_mac_remove_ra_rnti_ue(module_id_t mod_id, rnti_t rnti) {
// Hack to remove UE in the phy (following the same procedure as in function mac_remove_nr_ue)
if (pthread_mutex_lock(&rnti_to_remove_mutex)) exit(1);
if (rnti_to_remove_count == 10) exit(1);
rnti_to_remove[rnti_to_remove_count] = rnti;
LOG_W(NR_MAC, "to remove in mac rnti_to_remove[%d] = 0x%04x\n", rnti_to_remove_count, rnti);
rnti_to_remove_count++;
if (pthread_mutex_unlock(&rnti_to_remove_mutex)) exit(1);
}
uint8_t nr_get_tpc(int target, uint8_t cqi, int incr) { uint8_t nr_get_tpc(int target, uint8_t cqi, int incr) {
// al values passed to this function are x10 // al values passed to this function are x10
......
...@@ -492,6 +492,7 @@ void nr_rx_sdu(const module_id_t gnb_mod_idP, ...@@ -492,6 +492,7 @@ void nr_rx_sdu(const module_id_t gnb_mod_idP,
if(no_sig) { if(no_sig) {
LOG_W(NR_MAC, "Random Access %i failed at state %i\n", i, ra->state); LOG_W(NR_MAC, "Random Access %i failed at state %i\n", i, ra->state);
nr_mac_remove_ra_rnti_ue(gnb_mod_idP, ra->rnti);
nr_clear_ra_proc(gnb_mod_idP, CC_idP, frameP, ra); nr_clear_ra_proc(gnb_mod_idP, CC_idP, frameP, ra);
} else { } else {
...@@ -516,6 +517,7 @@ void nr_rx_sdu(const module_id_t gnb_mod_idP, ...@@ -516,6 +517,7 @@ void nr_rx_sdu(const module_id_t gnb_mod_idP,
if(ra->cfra) { if(ra->cfra) {
LOG_I(NR_MAC, "(ue %i, rnti 0x%04x) CFRA procedure succeeded!\n", UE_id, ra->rnti); LOG_I(NR_MAC, "(ue %i, rnti 0x%04x) CFRA procedure succeeded!\n", UE_id, ra->rnti);
nr_mac_remove_ra_rnti_ue(gnb_mod_idP, ra->rnti);
nr_clear_ra_proc(gnb_mod_idP, CC_idP, frameP, ra); nr_clear_ra_proc(gnb_mod_idP, CC_idP, frameP, ra);
free(ra->preambles.preamble_list); free(ra->preambles.preamble_list);
UE_info->active[UE_id] = true; UE_info->active[UE_id] = true;
...@@ -555,6 +557,7 @@ void nr_rx_sdu(const module_id_t gnb_mod_idP, ...@@ -555,6 +557,7 @@ void nr_rx_sdu(const module_id_t gnb_mod_idP,
continue; continue;
LOG_W(NR_MAC, "Random Access %i failed at state %i\n", i, ra->state); LOG_W(NR_MAC, "Random Access %i failed at state %i\n", i, ra->state);
nr_mac_remove_ra_rnti_ue(gnb_mod_idP, ra->rnti);
nr_clear_ra_proc(gnb_mod_idP, CC_idP, frameP, ra); nr_clear_ra_proc(gnb_mod_idP, CC_idP, frameP, ra);
} }
} }
......
...@@ -312,6 +312,8 @@ int add_new_nr_ue(module_id_t mod_idP, rnti_t rntiP, NR_CellGroupConfig_t *secon ...@@ -312,6 +312,8 @@ int add_new_nr_ue(module_id_t mod_idP, rnti_t rntiP, NR_CellGroupConfig_t *secon
void mac_remove_nr_ue(module_id_t mod_id, rnti_t rnti); void mac_remove_nr_ue(module_id_t mod_id, rnti_t rnti);
void nr_mac_remove_ra_rnti_ue(module_id_t mod_id, rnti_t rnti);
int allocate_nr_CCEs(gNB_MAC_INST *nr_mac, int allocate_nr_CCEs(gNB_MAC_INST *nr_mac,
NR_BWP_Downlink_t *bwp, NR_BWP_Downlink_t *bwp,
NR_ControlResourceSet_t *coreset, NR_ControlResourceSet_t *coreset,
......
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