Commit cbbbeb80 authored by ndomingues's avatar ndomingues

Baseline implementation of RA 2-Step MsgA procedures at gNB

parent c609dd8f
...@@ -596,7 +596,7 @@ void handle_nr_ul_harq(const int CC_idP, ...@@ -596,7 +596,7 @@ void handle_nr_ul_harq(const int CC_idP,
} }
} }
NR_SCHED_UNLOCK(&nrmac->sched_lock); NR_SCHED_UNLOCK(&nrmac->sched_lock);
LOG_E(NR_MAC, "no RA proc for RNTI 0x%04x in Msg3/PUSCH\n", crc_pdu->rnti); LOG_D(NR_MAC, "no RA proc for RNTI 0x%04x in Msg3/MsgA-PUSCH\n", crc_pdu->rnti);
return; return;
} }
if (nrmac->radio_config.disable_harq) { if (nrmac->radio_config.disable_harq) {
...@@ -819,7 +819,7 @@ static void _nr_rx_sdu(const module_id_t gnb_mod_idP, ...@@ -819,7 +819,7 @@ static void _nr_rx_sdu(const module_id_t gnb_mod_idP,
* it. */ * it. */
for (int i = 0; i < NR_NB_RA_PROC_MAX; ++i) { for (int i = 0; i < NR_NB_RA_PROC_MAX; ++i) {
NR_RA_t *ra = &gNB_mac->common_channels[CC_idP].ra[i]; NR_RA_t *ra = &gNB_mac->common_channels[CC_idP].ra[i];
if (ra->ra_state != nrRA_WAIT_Msg3) if (ra->ra_type == RA_4_STEP && ra->ra_state != nrRA_WAIT_Msg3)
continue; continue;
if (no_sig) { if (no_sig) {
...@@ -827,22 +827,29 @@ static void _nr_rx_sdu(const module_id_t gnb_mod_idP, ...@@ -827,22 +827,29 @@ static void _nr_rx_sdu(const module_id_t gnb_mod_idP,
handle_msg3_failed_rx(ra, i, gNB_mac->ul_bler.harq_round_max); handle_msg3_failed_rx(ra, i, gNB_mac->ul_bler.harq_round_max);
continue; continue;
} }
if (ra->ra_type == RA_2_STEP) {
// random access pusch with TC-RNTI // random access pusch with RA-RNTI
if (ra->rnti != current_rnti) { if (ra->RA_rnti != current_rnti) {
LOG_D(NR_MAC, "expected TC_RNTI %04x to match current RNTI %04x\n", ra->rnti, current_rnti); LOG_E(NR_MAC, "expected TC_RNTI %04x to match current RNTI %04x\n", ra->RA_rnti, current_rnti);
continue;
if ((frameP == ra->Msg3_frame) && (slotP == ra->Msg3_slot)) {
LOG_W(NR_MAC,
"Random Access %i failed at state %s (TC_RNTI %04x RNTI %04x)\n",
i,
nrra_text[ra->ra_state],
ra->rnti,
current_rnti);
nr_clear_ra_proc(ra);
} }
} else {
// random access pusch with TC-RNTI
if (ra->rnti != current_rnti) {
LOG_E(NR_MAC, "expected TC_RNTI %04x to match current RNTI %04x\n", ra->rnti, current_rnti);
if ((frameP == ra->Msg3_frame) && (slotP == ra->Msg3_slot)) {
LOG_W(NR_MAC,
"Random Access %i failed at state %s (TC_RNTI %04x RNTI %04x)\n",
i,
nrra_text[ra->ra_state],
ra->rnti,
current_rnti);
nr_clear_ra_proc(ra);
}
continue; continue;
}
} }
UE = UE ? UE : add_new_nr_ue(gNB_mac, ra->rnti, ra->CellGroup); UE = UE ? UE : add_new_nr_ue(gNB_mac, ra->rnti, ra->CellGroup);
...@@ -882,7 +889,7 @@ static void _nr_rx_sdu(const module_id_t gnb_mod_idP, ...@@ -882,7 +889,7 @@ static void _nr_rx_sdu(const module_id_t gnb_mod_idP,
process_addmod_bearers_cellGroupConfig(&UE->UE_sched_ctrl, ra->CellGroup->rlc_BearerToAddModList); process_addmod_bearers_cellGroupConfig(&UE->UE_sched_ctrl, ra->CellGroup->rlc_BearerToAddModList);
nr_clear_ra_proc(ra); nr_clear_ra_proc(ra);
} else { } else {
LOG_D(NR_MAC, "[RAPROC] Received Msg3:\n"); LOG_D(NR_MAC, "[RAPROC] Received %s:\n", ra->ra_type == RA_2_STEP ? "MsgA-PUSCH" : "Msg3");
for (uint32_t k = 0; k < sdu_lenP; k++) { for (uint32_t k = 0; k < sdu_lenP; k++) {
LOG_D(NR_MAC, "(%i): 0x%x\n", k, sduP[k]); LOG_D(NR_MAC, "(%i): 0x%x\n", k, sduP[k]);
} }
......
...@@ -114,16 +114,18 @@ typedef struct { ...@@ -114,16 +114,18 @@ typedef struct {
} NR_list_t; } NR_list_t;
typedef enum { typedef enum {
nrRA_gNB_IDLE = 0, nrRA_gNB_IDLE,
nrRA_Msg2 = 1, nrRA_Msg2,
nrRA_WAIT_Msg3 = 2, nrRA_WAIT_MsgA_PUSCH,
nrRA_Msg3_retransmission = 3, nrRA_WAIT_Msg3,
nrRA_Msg4 = 4, nrRA_Msg3_retransmission,
nrRA_WAIT_Msg4_ACK = 5, nrRA_Msg4,
nrRA_MsgB,
nrRA_WAIT_Msg4_ACK,
} RA_gNB_state_t; } RA_gNB_state_t;
static const char *const nrra_text[] = static const char *const nrra_text[] =
{"IDLE", "Msg2", "WAIT_Msg3", "Msg3_retransmission", "Msg3_dcch_dtch", "Msg4", "WAIT_Msg4_ACK"}; {"IDLE", "Msg2", "WAIT_MsgA_PUSCH", "WAIT_Msg3", "Msg3_retransmission", "Msg3_dcch_dtch", "Msg4", "MsgB", "WAIT_Msg4_ACK"};
typedef struct { typedef struct {
int idx; int idx;
...@@ -219,6 +221,8 @@ typedef struct { ...@@ -219,6 +221,8 @@ typedef struct {
rnti_t rnti; rnti_t rnti;
/// RA RNTI allocated from received PRACH /// RA RNTI allocated from received PRACH
uint16_t RA_rnti; uint16_t RA_rnti;
/// MsgB RNTI allocated from received MsgA
uint16_t MsgB_rnti;
/// Received UE Contention Resolution Identifier /// Received UE Contention Resolution Identifier
uint8_t cont_res_id[6]; uint8_t cont_res_id[6];
/// Msg3 first RB /// Msg3 first RB
...@@ -247,6 +251,7 @@ typedef struct { ...@@ -247,6 +251,7 @@ typedef struct {
/// Preambles for contention-free access /// Preambles for contention-free access
NR_preamble_ue_t preambles; NR_preamble_ue_t preambles;
int contention_resolution_timer; int contention_resolution_timer;
nr_ra_type_t ra_type;
/// CFRA flag /// CFRA flag
bool cfra; bool cfra;
// BWP for RA // BWP for RA
......
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