diff --git a/openair2/LAYER2/NR_MAC_UE/mac_defs.h b/openair2/LAYER2/NR_MAC_UE/mac_defs.h index d80a279952..ee0c226af4 100644 --- a/openair2/LAYER2/NR_MAC_UE/mac_defs.h +++ b/openair2/LAYER2/NR_MAC_UE/mac_defs.h @@ -293,7 +293,13 @@ typedef struct { } NR_PRACH_RESOURCES_t; typedef struct { + bool active; + uint32_t preamble_index; + uint32_t ssb_index; + uint32_t prach_mask; +} NR_pdcch_order_config_t; +typedef struct { // pointer to RACH config dedicated NR_RACH_ConfigDedicated_t *rach_ConfigDedicated; /// state of RA procedure @@ -361,8 +367,7 @@ typedef struct { /// Transmitted UE Contention Resolution Identifier uint8_t cont_res_id[6]; - /// BeamfailurerecoveryConfig - NR_BeamFailureRecoveryConfig_t RA_BeamFailureRecoveryConfig; + NR_pdcch_order_config_t pdcch_order; NR_PRACH_RESOURCES_t prach_resources; } RA_config_t; diff --git a/openair2/LAYER2/NR_MAC_UE/mac_proto.h b/openair2/LAYER2/NR_MAC_UE/mac_proto.h index 22f0cbaf84..f86f646c5f 100644 --- a/openair2/LAYER2/NR_MAC_UE/mac_proto.h +++ b/openair2/LAYER2/NR_MAC_UE/mac_proto.h @@ -353,7 +353,7 @@ void free_rach_structures(NR_UE_MAC_INST_t *nr_mac, int bwp_id); void schedule_RA_after_SR_failure(NR_UE_MAC_INST_t *mac); void nr_Msg1_transmitted(NR_UE_MAC_INST_t *mac); void nr_Msg3_transmitted(NR_UE_MAC_INST_t *mac, uint8_t CC_id, frame_t frameP, slot_t slotP, uint8_t gNB_id); -void trigger_MAC_UE_RA(NR_UE_MAC_INST_t *mac); +void trigger_MAC_UE_RA(NR_UE_MAC_INST_t *mac, dci_pdu_rel15_t *pdcch_order); void nr_get_Msg3_MsgA_PUSCH_payload(NR_UE_MAC_INST_t *mac, uint8_t *buf, int TBS_max); void handle_time_alignment_timer_expired(NR_UE_MAC_INST_t *mac); int8_t nr_ue_process_dci_freq_dom_resource_assignment(nfapi_nr_ue_pusch_pdu_t *pusch_config_pdu, diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c b/openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c index b16def686f..ccf02df0c1 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c @@ -216,8 +216,6 @@ bool init_RA(NR_UE_MAC_INST_t *mac, int frame) n_prbs, start_prb); - // TODO if the Random Access procedure is initiated by PDCCH order - // and if the ra-PreambleIndex explicitly provided by PDCCH is not 0b000000 // TODO if the Random Access procedure was initiated for SI request // and the Random Access Resources for SI request have been explicitly provided by RRC @@ -228,10 +226,14 @@ bool init_RA(NR_UE_MAC_INST_t *mac, int frame) NR_RACH_ConfigCommonTwoStepRA_r16_t *twostep_conf = NULL; NR_RACH_ConfigDedicated_t *rach_Dedicated = ra->rach_ConfigDedicated; - if (rach_Dedicated && rach_Dedicated->cfra) { - // if the Random Access procedure was initiated for reconfiguration with sync and - // if the contention-free Random Access Resources for 4-step RA type have been explicitly provided - // in rach-ConfigDedicated for the BWP selected for Random Access procedure + + // if the Random Access procedure is initiated by PDCCH order + // and if the ra-PreambleIndex explicitly provided by PDCCH is not 0b000000 + bool pdcch_order = (ra->pdcch_order.active && ra->pdcch_order.preamble_index != 0xb000000) ? true : false; + // or if the Random Access procedure was initiated for reconfiguration with sync and + // if the contention-free Random Access Resources for 4-step RA type have been explicitly provided + // in rach-ConfigDedicated for the BWP selected for Random Access procedure + if ((rach_Dedicated && rach_Dedicated->cfra) || pdcch_order) { LOG_I(MAC, "Initialization of 4-Step CFRA procedure\n"); ra->ra_type = RA_4_STEP; ra->cfra = true; @@ -1049,12 +1051,19 @@ void nr_ra_failed(NR_UE_MAC_INST_t *mac, uint8_t CC_id, NR_PRACH_RESOURCES_t *pr } } -void trigger_MAC_UE_RA(NR_UE_MAC_INST_t *mac) +void trigger_MAC_UE_RA(NR_UE_MAC_INST_t *mac, dci_pdu_rel15_t *pdcch_order) { LOG_W(NR_MAC, "Triggering new RA procedure for UE with RNTI %x\n", mac->crnti); mac->state = UE_PERFORMING_RA; reset_ra(mac, false); - mac->ra.msg3_C_RNTI = true; + RA_config_t *ra = &mac->ra; + ra->msg3_C_RNTI = true; + if (pdcch_order) { + ra->pdcch_order.active = true; + ra->pdcch_order.preamble_index = pdcch_order->ra_preamble_index; + ra->pdcch_order.ssb_index = pdcch_order->ss_pbch_index; + ra->pdcch_order.prach_mask = pdcch_order->prach_mask_index; + } } void prepare_msg4_msgb_feedback(NR_UE_MAC_INST_t *mac, int pid, int ack_nack) diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c index c150cc29cd..d6f0226482 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c @@ -2929,7 +2929,7 @@ void nr_ue_send_sdu(NR_UE_MAC_INST_t *mac, nr_downlink_indication_t *dl_info, in nr_timer_start(mac->data_inactivity_timer); // DL data arrival during RRC_CONNECTED when UL synchronisation status is "non-synchronised" if (!nr_timer_is_active(&mac->time_alignment_timer) && mac->state == UE_CONNECTED && !get_softmodem_params()->phy_test) { - trigger_MAC_UE_RA(mac); + trigger_MAC_UE_RA(mac, NULL); break; } nr_ue_process_mac_pdu(mac, dl_info, pdu_id); @@ -2991,7 +2991,11 @@ static void extract_10_si_rnti(dci_pdu_rel15_t *dci_pdu_rel15, const uint8_t *dc EXTRACT_DCI_ITEM(dci_pdu_rel15->system_info_indicator, 1); } -static void extract_10_c_rnti(dci_pdu_rel15_t *dci_pdu_rel15, const uint8_t *dci_pdu, int pos, const int N_RB) +static bool extract_10_c_rnti(NR_UE_MAC_INST_t *mac, + dci_pdu_rel15_t *dci_pdu_rel15, + const uint8_t *dci_pdu, + int pos, + const int N_RB) { LOG_D(NR_MAC_DCI, "Received dci 1_0 C rnti\n"); @@ -3014,29 +3018,31 @@ static void extract_10_c_rnti(dci_pdu_rel15_t *dci_pdu_rel15, const uint8_t *dci EXTRACT_DCI_ITEM(dci_pdu_rel15->ss_pbch_index, 6); // prach_mask_index 4 bits EXTRACT_DCI_ITEM(dci_pdu_rel15->prach_mask_index, 4); + trigger_MAC_UE_RA(mac, dci_pdu_rel15); + return true; } // end if - else { - // Time domain assignment 4bit - EXTRACT_DCI_ITEM(dci_pdu_rel15->time_domain_assignment.val, 4); - // VRB to PRB mapping 1bit - EXTRACT_DCI_ITEM(dci_pdu_rel15->vrb_to_prb_mapping.val, 1); - // MCS 5bit //bit over 32, so dci_pdu ++ - EXTRACT_DCI_ITEM(dci_pdu_rel15->mcs, 5); - // New data indicator 1bit - EXTRACT_DCI_ITEM(dci_pdu_rel15->ndi, 1); - // Redundancy version 2bit - EXTRACT_DCI_ITEM(dci_pdu_rel15->rv, 2); - // HARQ process number 4/5 bit - EXTRACT_DCI_ITEM(dci_pdu_rel15->harq_pid.val, dci_pdu_rel15->harq_pid.nbits); - // Downlink assignment index 2bit - EXTRACT_DCI_ITEM(dci_pdu_rel15->dai[0].val, 2); - // TPC command for scheduled PUCCH 2bit - EXTRACT_DCI_ITEM(dci_pdu_rel15->tpc, 2); - // PUCCH resource indicator 3bit - EXTRACT_DCI_ITEM(dci_pdu_rel15->pucch_resource_indicator, 3); - // PDSCH-to-HARQ_feedback timing indicator 3bit - EXTRACT_DCI_ITEM(dci_pdu_rel15->pdsch_to_harq_feedback_timing_indicator.val, 3); - } // end else + + // Time domain assignment 4bit + EXTRACT_DCI_ITEM(dci_pdu_rel15->time_domain_assignment.val, 4); + // VRB to PRB mapping 1bit + EXTRACT_DCI_ITEM(dci_pdu_rel15->vrb_to_prb_mapping.val, 1); + // MCS 5bit //bit over 32, so dci_pdu ++ + EXTRACT_DCI_ITEM(dci_pdu_rel15->mcs, 5); + // New data indicator 1bit + EXTRACT_DCI_ITEM(dci_pdu_rel15->ndi, 1); + // Redundancy version 2bit + EXTRACT_DCI_ITEM(dci_pdu_rel15->rv, 2); + // HARQ process number 4/5 bit + EXTRACT_DCI_ITEM(dci_pdu_rel15->harq_pid.val, dci_pdu_rel15->harq_pid.nbits); + // Downlink assignment index 2bit + EXTRACT_DCI_ITEM(dci_pdu_rel15->dai[0].val, 2); + // TPC command for scheduled PUCCH 2bit + EXTRACT_DCI_ITEM(dci_pdu_rel15->tpc, 2); + // PUCCH resource indicator 3bit + EXTRACT_DCI_ITEM(dci_pdu_rel15->pucch_resource_indicator, 3); + // PDSCH-to-HARQ_feedback timing indicator 3bit + EXTRACT_DCI_ITEM(dci_pdu_rel15->pdsch_to_harq_feedback_timing_indicator.val, 3); + return false; } static void extract_00_c_rnti(dci_pdu_rel15_t *dci_pdu_rel15, const uint8_t *dci_pdu, int pos) @@ -3297,7 +3303,9 @@ static nr_dci_format_t nr_extract_dci_00_10(NR_UE_MAC_INST_t *mac, int n_RB = get_nrb_for_dci(mac, format, ss_type); if (n_RB == 0) return NR_DCI_NONE; - extract_10_c_rnti(dci_pdu_rel15, dci_pdu, pos, n_RB); + bool pdcch_order = extract_10_c_rnti(mac, dci_pdu_rel15, dci_pdu, pos, n_RB); + if (pdcch_order) + return NR_DCI_NONE; } else { format = NR_UL_DCI_FORMAT_0_0; diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c index 94f9c80277..0872787bd5 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c @@ -1144,7 +1144,7 @@ void schedule_RA_after_SR_failure(NR_UE_MAC_INST_t *mac) { if (get_softmodem_params()->phy_test) return; // cannot trigger RA in phytest mode - trigger_MAC_UE_RA(mac); + trigger_MAC_UE_RA(mac, NULL); // release PUCCH for all Serving Cells; // release SRS for all Serving Cells; release_PUCCH_SRS(mac); @@ -1352,7 +1352,7 @@ void nr_ue_ul_scheduler(NR_UE_MAC_INST_t *mac, nr_uplink_indication_t *ul_info) && (mac->state == UE_CONNECTED || (ra->ra_state == nrRA_WAIT_RAR && ra->cfra))) { if (!nr_timer_is_active(&mac->time_alignment_timer) && mac->state == UE_CONNECTED && !get_softmodem_params()->phy_test) { // UL data arrival during RRC_CONNECTED when UL synchronisation status is "non-synchronised" - trigger_MAC_UE_RA(mac); + trigger_MAC_UE_RA(mac, NULL); return; } // Getting IP traffic to be transmitted