From cbf84897072c18c79be59b38e2e83c60f80f6653 Mon Sep 17 00:00:00 2001 From: luis_pereira87 Date: Mon, 15 Jul 2024 13:34:13 +0100 Subject: [PATCH 1/3] Switch to BWP where RA is configured when Msg3 contains MAC CE for C-RNTI Switch to BWP where RA is configured, typically in the InitialBWP At this point, MAC CE for C-RNTI received at gNB, UE already switched and triggered RA in that BWP, need to do BWP switching also at gNB for that C-RNTI --- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c index 1048be2528..b60be4bd88 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c @@ -899,6 +899,22 @@ static void _nr_rx_sdu(const module_id_t gnb_mod_idP, reset_dl_harq_list(&UE->UE_sched_ctrl); reset_ul_harq_list(&UE->UE_sched_ctrl); + // Switch to BWP where RA is configured, typically in the InitialBWP + // At this point, UE already switched and triggered RA in that BWP, need to do BWP switching also at gNB for C-RNTI + if ((ra->DL_BWP.bwp_id != UE->current_DL_BWP.bwp_id) || (ra->UL_BWP.bwp_id != UE->current_UL_BWP.bwp_id)) { + LOG_I(NR_MAC, + "BWP switching at gNB from BWP id %ld to BWP id %ld due to RA configuration\n", + UE->current_DL_BWP.bwp_id, + ra->DL_BWP.bwp_id); + configure_UE_BWP(RC.nrmac[gnb_mod_idP], + RC.nrmac[gnb_mod_idP]->common_channels[CC_idP].ServingCellConfigCommon, + &UE->UE_sched_ctrl, + NULL, + UE, + ra->DL_BWP.bwp_id, + ra->UL_BWP.bwp_id); + } + if (UE->reconfigCellGroup) { // Nothing to do // A RRCReconfiguration message should be already pending (for example, an ongoing RRCReestablishment), and it will be From 6bc486f504ec17866fdb613d9d83467aa0d7f487 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Thu, 18 Jul 2024 13:19:37 +0200 Subject: [PATCH 2/3] Fixup: Simplify code --- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c index b60be4bd88..19dcad7045 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c @@ -901,18 +901,10 @@ static void _nr_rx_sdu(const module_id_t gnb_mod_idP, // Switch to BWP where RA is configured, typically in the InitialBWP // At this point, UE already switched and triggered RA in that BWP, need to do BWP switching also at gNB for C-RNTI - if ((ra->DL_BWP.bwp_id != UE->current_DL_BWP.bwp_id) || (ra->UL_BWP.bwp_id != UE->current_UL_BWP.bwp_id)) { - LOG_I(NR_MAC, - "BWP switching at gNB from BWP id %ld to BWP id %ld due to RA configuration\n", - UE->current_DL_BWP.bwp_id, - ra->DL_BWP.bwp_id); - configure_UE_BWP(RC.nrmac[gnb_mod_idP], - RC.nrmac[gnb_mod_idP]->common_channels[CC_idP].ServingCellConfigCommon, - &UE->UE_sched_ctrl, - NULL, - UE, - ra->DL_BWP.bwp_id, - ra->UL_BWP.bwp_id); + if (ra->DL_BWP.bwp_id != UE->current_DL_BWP.bwp_id || ra->UL_BWP.bwp_id != UE->current_UL_BWP.bwp_id) { + LOG_D(NR_MAC, "UE %04x Switch BWP from %ld to BWP id %ld\n", UE->rnti, UE->current_DL_BWP.bwp_id, ra->DL_BWP.bwp_id); + NR_ServingCellConfigCommon_t *scc = gNB_mac->common_channels[CC_idP].ServingCellConfigCommon; + configure_UE_BWP(gNB_mac, scc, &UE->UE_sched_ctrl, NULL, UE, ra->DL_BWP.bwp_id, ra->UL_BWP.bwp_id); } if (UE->reconfigCellGroup) { From f28f9e52acf72a65270d304d36dbaff730cbe39c Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Thu, 18 Jul 2024 13:48:20 +0200 Subject: [PATCH 3/3] Use gNB_mac consistently --- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c index 19dcad7045..bab839622b 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c @@ -880,13 +880,13 @@ static void _nr_rx_sdu(const module_id_t gnb_mod_idP, nr_mac_trigger_release_timer(&UE->UE_sched_ctrl, UE->current_UL_BWP.scs); // Replace the current UE by the UE identified by C-RNTI - UE = find_nr_UE(&RC.nrmac[gnb_mod_idP]->UE_info, crnti); + UE = find_nr_UE(&gNB_mac->UE_info, crnti); if (!UE) { // The UE identified by C-RNTI no longer exists at the gNB // Let's abort the current RA, so the UE will trigger a new RA later but using RRCSetupRequest instead. A better // solution may be implemented LOG_W(NR_MAC, "No UE found with C-RNTI %04x, ignoring Msg3 to have UE come back with new RA attempt\n", ra->rnti); - mac_remove_nr_ue(RC.nrmac[gnb_mod_idP], ra->rnti); + mac_remove_nr_ue(gNB_mac, ra->rnti); nr_clear_ra_proc(ra); return; } @@ -914,7 +914,7 @@ static void _nr_rx_sdu(const module_id_t gnb_mod_idP, } else { // Trigger RRC Reconfiguration LOG_I(NR_MAC, "Received UL_SCH_LCID_C_RNTI with C-RNTI 0x%04x, triggering RRC Reconfiguration\n", UE->rnti); - nr_mac_trigger_reconfiguration(RC.nrmac[gnb_mod_idP], UE); + nr_mac_trigger_reconfiguration(gNB_mac, UE); } } else { // UE Contention Resolution Identity