From d2b131af1dc60e4349197f5d6c9b936503bbdccf Mon Sep 17 00:00:00 2001 From: francescomani Date: Sun, 15 Aug 2021 18:16:15 +0200 Subject: [PATCH] msg3 retransmission rounds at gnb --- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c | 7 +++++-- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c | 10 +++++++++- openair2/LAYER2/NR_MAC_gNB/mac_proto.h | 1 + 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c index ecdcc8bcc0..919bbd07db 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c @@ -773,6 +773,7 @@ void nr_generate_Msg3_retransmission(module_id_t module_idP, int CC_id, frame_t memset(pusch_pdu, 0, sizeof(nfapi_nr_pusch_pdu_t)); fill_msg3_pusch_pdu(pusch_pdu, scc, + ra->msg3_round, startSymbolAndLength, ra->rnti, scs, bwpSize, bwpStart, @@ -956,6 +957,7 @@ void nr_get_Msg3alloc(module_id_t module_id, void fill_msg3_pusch_pdu(nfapi_nr_pusch_pdu_t *pusch_pdu, NR_ServingCellConfigCommon_t *scc, + int round, int startSymbolAndLength, rnti_t rnti, int scs, int bwp_size, int bwp_start, @@ -1006,9 +1008,9 @@ void fill_msg3_pusch_pdu(nfapi_nr_pusch_pdu_t *pusch_pdu, pusch_pdu->start_symbol_index = start_symbol_index; pusch_pdu->nr_of_symbols = nr_of_symbols; //Optional Data only included if indicated in pduBitmap - pusch_pdu->pusch_data.rv_index = 0; // 8.3 in 38.213 + pusch_pdu->pusch_data.rv_index = nr_rv_round_map[round]; pusch_pdu->pusch_data.harq_process_id = 0; - pusch_pdu->pusch_data.new_data_indicator = 1; // new data + pusch_pdu->pusch_data.new_data_indicator = 1; pusch_pdu->pusch_data.num_cb = 0; pusch_pdu->pusch_data.tb_size = nr_compute_tbs(pusch_pdu->qam_mod_order, pusch_pdu->target_code_rate, @@ -1097,6 +1099,7 @@ void nr_add_msg3(module_id_t module_idP, int CC_id, frame_t frameP, sub_frame_t bwp_start = ibwp_start; fill_msg3_pusch_pdu(pusch_pdu,scc, + ra->msg3_round, startSymbolAndLength, ra->rnti, scs, ibwp_size, bwp_start, diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c index 866a318fce..08823c23ca 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c @@ -795,7 +795,15 @@ void nr_rx_sdu(const module_id_t gnb_mod_idP, if( (frameP!=ra->Msg3_frame) || (slotP!=ra->Msg3_slot)) continue; - LOG_W(NR_MAC, "Random Access %i failed at state %i (CRC did not pass)\n", i, ra->state); + if (ra->msg3_round >= MAX_HARQ_ROUNDS - 1) { + LOG_W(NR_MAC, "Random Access %i failed at state %i (Reached msg3 max harq rounds)\n", i, ra->state); + nr_mac_remove_ra_rnti(gnb_mod_idP, ra->rnti); + nr_clear_ra_proc(gnb_mod_idP, CC_idP, frameP, ra); + return; + } + + LOG_W(NR_MAC, "Random Access %i Msg3 CRC did not pass)\n", i); + ra->msg3_round++; ra->state = Msg3_retransmission; } } diff --git a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h index 46eed89b39..89bf273ca3 100644 --- a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h +++ b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h @@ -138,6 +138,7 @@ void nr_fill_rar(uint8_t Mod_idP, void fill_msg3_pusch_pdu(nfapi_nr_pusch_pdu_t *pusch_pdu, NR_ServingCellConfigCommon_t *scc, + int round, int startSymbolAndLength, rnti_t rnti, int scs, int bwp_size, int bwp_start,