From eeb2b904aab3713a31187a6cf493356caf097639 Mon Sep 17 00:00:00 2001 From: Andre Puschmann Date: Tue, 22 Sep 2020 09:39:33 +0200 Subject: [PATCH] ue,rach: fix failing RACH proc when Msg3 grant RNTI matches current CRNTI this was preventing that the Temp-CRNTI used in the RAR to be identical to the currently configured C-RNTI of the UE. The issue simply was that the RACH procedure was declared successful too early, even before the Msg3 UL grant was filled with the Msg3 content. The patch moves the logic that detects the successful completion of the RACH procedure below the Msg3 packing. --- srsue/src/stack/mac/proc_ra.cc | 1 + srsue/src/stack/mac/ul_harq.cc | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/srsue/src/stack/mac/proc_ra.cc b/srsue/src/stack/mac/proc_ra.cc index f51eb17a5..42fe0db24 100644 --- a/srsue/src/stack/mac/proc_ra.cc +++ b/srsue/src/stack/mac/proc_ra.cc @@ -624,6 +624,7 @@ bool ra_proc::contention_resolution_id_received(uint64_t rx_contention_id) void ra_proc::pdcch_to_crnti(bool is_new_uplink_transmission) { + // TS 36.321 Section 5.1.5 rDebug("PDCCH to C-RNTI received %s new UL transmission\n", is_new_uplink_transmission ? "with" : "without"); if ((!started_by_pdcch && is_new_uplink_transmission) || started_by_pdcch) { rDebug("PDCCH for C-RNTI received\n"); diff --git a/srsue/src/stack/mac/ul_harq.cc b/srsue/src/stack/mac/ul_harq.cc index 8222da9c1..31a8a8ab5 100644 --- a/srsue/src/stack/mac/ul_harq.cc +++ b/srsue/src/stack/mac/ul_harq.cc @@ -231,10 +231,6 @@ void ul_harq_entity::ul_harq_process::new_grant_ul(mac_interface_phy_lte::mac_gr // New transmission reset(); - if (grant.rnti == harq_entity->rntis->crnti && harq_entity->ra_procedure->is_contention_resolution()) { - harq_entity->ra_procedure->pdcch_to_crnti(true); - } - // Check buffer size if (grant.tb.tbs > payload_buffer_len) { Error("Grant size exceeds payload buffer size (%d > %d)\n", grant.tb.tbs, payload_buffer_len); @@ -264,6 +260,10 @@ void ul_harq_entity::ul_harq_process::new_grant_ul(mac_interface_phy_lte::mac_gr Warning("Uplink dci but no MAC PDU in Multiplex Unit buffer\n"); } } + + if (grant.rnti == harq_entity->rntis->crnti && harq_entity->ra_procedure->is_contention_resolution()) { + harq_entity->ra_procedure->pdcch_to_crnti(true); + } } else if (has_grant()) { // Adaptive Re-TX generate_retx(grant, action);