Commit c17881e8 authored by francescomani's avatar francescomani

implmenent RA trigger for PDCCH order (DCI initiated RA)

parent 796c2a61
...@@ -293,7 +293,13 @@ typedef struct { ...@@ -293,7 +293,13 @@ typedef struct {
} NR_PRACH_RESOURCES_t; } NR_PRACH_RESOURCES_t;
typedef struct { 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 // pointer to RACH config dedicated
NR_RACH_ConfigDedicated_t *rach_ConfigDedicated; NR_RACH_ConfigDedicated_t *rach_ConfigDedicated;
/// state of RA procedure /// state of RA procedure
...@@ -361,8 +367,7 @@ typedef struct { ...@@ -361,8 +367,7 @@ typedef struct {
/// Transmitted UE Contention Resolution Identifier /// Transmitted UE Contention Resolution Identifier
uint8_t cont_res_id[6]; uint8_t cont_res_id[6];
/// BeamfailurerecoveryConfig NR_pdcch_order_config_t pdcch_order;
NR_BeamFailureRecoveryConfig_t RA_BeamFailureRecoveryConfig;
NR_PRACH_RESOURCES_t prach_resources; NR_PRACH_RESOURCES_t prach_resources;
} RA_config_t; } RA_config_t;
......
...@@ -353,7 +353,7 @@ void free_rach_structures(NR_UE_MAC_INST_t *nr_mac, int bwp_id); ...@@ -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 schedule_RA_after_SR_failure(NR_UE_MAC_INST_t *mac);
void nr_Msg1_transmitted(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 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 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); 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, int8_t nr_ue_process_dci_freq_dom_resource_assignment(nfapi_nr_ue_pusch_pdu_t *pusch_config_pdu,
......
...@@ -216,8 +216,6 @@ bool init_RA(NR_UE_MAC_INST_t *mac, int frame) ...@@ -216,8 +216,6 @@ bool init_RA(NR_UE_MAC_INST_t *mac, int frame)
n_prbs, n_prbs,
start_prb); 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 // 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 // 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) ...@@ -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_ConfigCommonTwoStepRA_r16_t *twostep_conf = NULL;
NR_RACH_ConfigDedicated_t *rach_Dedicated = ra->rach_ConfigDedicated; 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 Random Access procedure is initiated by PDCCH order
// if the contention-free Random Access Resources for 4-step RA type have been explicitly provided // and if the ra-PreambleIndex explicitly provided by PDCCH is not 0b000000
// in rach-ConfigDedicated for the BWP selected for Random Access procedure 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"); LOG_I(MAC, "Initialization of 4-Step CFRA procedure\n");
ra->ra_type = RA_4_STEP; ra->ra_type = RA_4_STEP;
ra->cfra = true; 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 ...@@ -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); LOG_W(NR_MAC, "Triggering new RA procedure for UE with RNTI %x\n", mac->crnti);
mac->state = UE_PERFORMING_RA; mac->state = UE_PERFORMING_RA;
reset_ra(mac, false); 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) void prepare_msg4_msgb_feedback(NR_UE_MAC_INST_t *mac, int pid, int ack_nack)
......
...@@ -2929,7 +2929,7 @@ void nr_ue_send_sdu(NR_UE_MAC_INST_t *mac, nr_downlink_indication_t *dl_info, in ...@@ -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); nr_timer_start(mac->data_inactivity_timer);
// DL data arrival during RRC_CONNECTED when UL synchronisation status is "non-synchronised" // 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) { 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; break;
} }
nr_ue_process_mac_pdu(mac, dl_info, pdu_id); 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 ...@@ -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); 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"); 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 ...@@ -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); EXTRACT_DCI_ITEM(dci_pdu_rel15->ss_pbch_index, 6);
// prach_mask_index 4 bits // prach_mask_index 4 bits
EXTRACT_DCI_ITEM(dci_pdu_rel15->prach_mask_index, 4); EXTRACT_DCI_ITEM(dci_pdu_rel15->prach_mask_index, 4);
trigger_MAC_UE_RA(mac, dci_pdu_rel15);
return true;
} // end if } // end if
else {
// Time domain assignment 4bit // Time domain assignment 4bit
EXTRACT_DCI_ITEM(dci_pdu_rel15->time_domain_assignment.val, 4); EXTRACT_DCI_ITEM(dci_pdu_rel15->time_domain_assignment.val, 4);
// VRB to PRB mapping 1bit // VRB to PRB mapping 1bit
EXTRACT_DCI_ITEM(dci_pdu_rel15->vrb_to_prb_mapping.val, 1); EXTRACT_DCI_ITEM(dci_pdu_rel15->vrb_to_prb_mapping.val, 1);
// MCS 5bit //bit over 32, so dci_pdu ++ // MCS 5bit //bit over 32, so dci_pdu ++
EXTRACT_DCI_ITEM(dci_pdu_rel15->mcs, 5); EXTRACT_DCI_ITEM(dci_pdu_rel15->mcs, 5);
// New data indicator 1bit // New data indicator 1bit
EXTRACT_DCI_ITEM(dci_pdu_rel15->ndi, 1); EXTRACT_DCI_ITEM(dci_pdu_rel15->ndi, 1);
// Redundancy version 2bit // Redundancy version 2bit
EXTRACT_DCI_ITEM(dci_pdu_rel15->rv, 2); EXTRACT_DCI_ITEM(dci_pdu_rel15->rv, 2);
// HARQ process number 4/5 bit // HARQ process number 4/5 bit
EXTRACT_DCI_ITEM(dci_pdu_rel15->harq_pid.val, dci_pdu_rel15->harq_pid.nbits); EXTRACT_DCI_ITEM(dci_pdu_rel15->harq_pid.val, dci_pdu_rel15->harq_pid.nbits);
// Downlink assignment index 2bit // Downlink assignment index 2bit
EXTRACT_DCI_ITEM(dci_pdu_rel15->dai[0].val, 2); EXTRACT_DCI_ITEM(dci_pdu_rel15->dai[0].val, 2);
// TPC command for scheduled PUCCH 2bit // TPC command for scheduled PUCCH 2bit
EXTRACT_DCI_ITEM(dci_pdu_rel15->tpc, 2); EXTRACT_DCI_ITEM(dci_pdu_rel15->tpc, 2);
// PUCCH resource indicator 3bit // PUCCH resource indicator 3bit
EXTRACT_DCI_ITEM(dci_pdu_rel15->pucch_resource_indicator, 3); EXTRACT_DCI_ITEM(dci_pdu_rel15->pucch_resource_indicator, 3);
// PDSCH-to-HARQ_feedback timing indicator 3bit // PDSCH-to-HARQ_feedback timing indicator 3bit
EXTRACT_DCI_ITEM(dci_pdu_rel15->pdsch_to_harq_feedback_timing_indicator.val, 3); EXTRACT_DCI_ITEM(dci_pdu_rel15->pdsch_to_harq_feedback_timing_indicator.val, 3);
} // end else return false;
} }
static void extract_00_c_rnti(dci_pdu_rel15_t *dci_pdu_rel15, const uint8_t *dci_pdu, int pos) 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, ...@@ -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); int n_RB = get_nrb_for_dci(mac, format, ss_type);
if (n_RB == 0) if (n_RB == 0)
return NR_DCI_NONE; 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 { else {
format = NR_UL_DCI_FORMAT_0_0; format = NR_UL_DCI_FORMAT_0_0;
......
...@@ -1144,7 +1144,7 @@ void schedule_RA_after_SR_failure(NR_UE_MAC_INST_t *mac) ...@@ -1144,7 +1144,7 @@ void schedule_RA_after_SR_failure(NR_UE_MAC_INST_t *mac)
{ {
if (get_softmodem_params()->phy_test) if (get_softmodem_params()->phy_test)
return; // cannot trigger RA in phytest mode 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 PUCCH for all Serving Cells;
// release SRS for all Serving Cells; // release SRS for all Serving Cells;
release_PUCCH_SRS(mac); 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) ...@@ -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))) { && (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) { 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" // 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; return;
} }
// Getting IP traffic to be transmitted // Getting IP traffic to be transmitted
......
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